${CMAKE_CURRENT_SOURCE_DIR}/designer_enums.h
${CMAKE_CURRENT_SOURCE_DIR}/appfontdialog.h
${CMAKE_CURRENT_SOURCE_DIR}/preferencesdialog.h
- ${CMAKE_CURRENT_SOURCE_DIR}/assistantclient.h
${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.h
${SHAREDDEVICESKIN_HEADERS}
)
${CMAKE_CURRENT_SOURCE_DIR}/versiondialog.cpp
${CMAKE_CURRENT_SOURCE_DIR}/appfontdialog.cpp
${CMAKE_CURRENT_SOURCE_DIR}/preferencesdialog.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/assistantclient.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.cpp
${CMAKE_CURRENT_SOURCE_DIR}/saveformastemplate.ui
${CMAKE_CURRENT_SOURCE_DIR}/preferencesdialog.ui
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "assistantclient.h"
-
-#include <QtCore/QString>
-#include <QtCore/QProcess>
-#include <QtCore/QDir>
-#include <QtCore/QLibraryInfo>
-#include <QtCore/QDebug>
-#include <QtCore/QFileInfo>
-#include <QtCore/QObject>
-#include <QtCore/QTextStream>
-#include <QtCore/QCoreApplication>
-
-QT_BEGIN_NAMESPACE
-
-enum { debugAssistantClient = 0 };
-
-AssistantClient::AssistantClient() :
- m_process(0)
-{
-}
-
-AssistantClient::~AssistantClient()
-{
- if (isRunning()) {
- m_process->terminate();
- m_process->waitForFinished();
- }
- delete m_process;
-}
-
-bool AssistantClient::showPage(const QString &path, QString *errorMessage)
-{
- QString cmd = QLatin1String("SetSource ");
- cmd += path;
- return sendCommand(cmd, errorMessage);
-}
-
-bool AssistantClient::activateIdentifier(const QString &identifier, QString *errorMessage)
-{
- QString cmd = QLatin1String("ActivateIdentifier ");
- cmd += identifier;
- return sendCommand(cmd, errorMessage);
-}
-
-bool AssistantClient::activateKeyword(const QString &keyword, QString *errorMessage)
-{
- QString cmd = QLatin1String("ActivateKeyword ");
- cmd += keyword;
- return sendCommand(cmd, errorMessage);
-}
-
-bool AssistantClient::sendCommand(const QString &cmd, QString *errorMessage)
-{
- if (debugAssistantClient)
- qDebug() << "sendCommand " << cmd;
- if (!ensureRunning(errorMessage))
- return false;
- if (!m_process->isWritable() || m_process->bytesToWrite() > 0) {
- *errorMessage = QCoreApplication::translate("AssistantClient", "Unable to send request: Assistant is not responding.");
- return false;
- }
- QTextStream str(m_process);
- str << cmd << QLatin1Char('\n') << endl;
- return true;
-}
-
-bool AssistantClient::isRunning() const
-{
- return m_process && m_process->state() != QProcess::NotRunning;
-}
-
-QString AssistantClient::binary()
-{
- QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator();
-#if !defined(Q_OS_MAC)
- app += QLatin1String("assistant");
-#else
- app += QLatin1String("Assistant.app/Contents/MacOS/Assistant");
-#endif
-
-#if defined(Q_OS_WIN)
- app += QLatin1String(".exe");
-#endif
-
- return app;
-}
-
-bool AssistantClient::ensureRunning(QString *errorMessage)
-{
- if (isRunning())
- return true;
-
- if (!m_process)
- m_process = new QProcess;
-
- const QString app = binary();
- if (!QFileInfo(app).isFile()) {
- *errorMessage = QCoreApplication::translate("AssistantClient", "The binary '%1' does not exist.").arg(app);
- return false;
- }
- if (debugAssistantClient)
- qDebug() << "Running " << app;
- // run
- QStringList args(QLatin1String("-enableRemoteControl"));
- m_process->start(app, args);
- if (!m_process->waitForStarted()) {
- *errorMessage = QCoreApplication::translate("AssistantClient", "Unable to launch assistant (%1).").arg(app);
- return false;
- }
- return true;
-}
-
-QString AssistantClient::documentUrl(const QString &prefix, int qtVersion)
-{
- if (qtVersion == 0)
- qtVersion = QT_VERSION;
- QString rc;
- QTextStream(&rc) << QLatin1String("qthelp://com.trolltech.") << prefix << QLatin1Char('.')
- << (qtVersion >> 16) << ((qtVersion >> 8) & 0xFF) << (qtVersion & 0xFF)
- << QLatin1String("/qdoc/");
- return rc;
-}
-
-QString AssistantClient::designerManualUrl(int qtVersion)
-{
- return documentUrl(QLatin1String("designer"), qtVersion);
-}
-
-QString AssistantClient::qtReferenceManualUrl(int qtVersion)
-{
- return documentUrl(QLatin1String("qt"), qtVersion);
-}
-
-QT_END_NAMESPACE
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ASSISTANTCLIENT_H
-#define ASSISTANTCLIENT_H
-
-#include <QtCore/qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-class QProcess;
-class QString;
-
-class AssistantClient
-{
- AssistantClient(const AssistantClient &);
- AssistantClient &operator=(const AssistantClient &);
-
-public:
- AssistantClient();
- ~AssistantClient();
-
- bool showPage(const QString &path, QString *errorMessage);
- bool activateIdentifier(const QString &identifier, QString *errorMessage);
- bool activateKeyword(const QString &keyword, QString *errorMessage);
-
- bool isRunning() const;
-
- static QString documentUrl(const QString &prefix, int qtVersion = 0);
- // Root of the Qt Designer documentation
- static QString designerManualUrl(int qtVersion = 0);
- // Root of the Qt Reference documentation
- static QString qtReferenceManualUrl(int qtVersion = 0);
-
-private:
- static QString binary();
- bool sendCommand(const QString &cmd, QString *errorMessage);
- bool ensureRunning(QString *errorMessage);
-
- QProcess *m_process;
-};
-
-QT_END_NAMESPACE
-
-#endif // ASSISTANTCLIENT_H
{
QActionGroup *helpActions = createActionGroup(this);
-#ifndef QT_JAMBI_BUILD
- QAction *mainHelpAction = new QAction(tr("Qt Designer &Help"), this);
- mainHelpAction->setObjectName(QLatin1String("__qt_designer_help_action"));
- connect(mainHelpAction, SIGNAL(triggered()), this, SLOT(showDesignerHelp()));
- mainHelpAction->setShortcut(Qt::CTRL + Qt::Key_Question);
- helpActions->addAction(mainHelpAction);
-
- helpActions->addAction(createSeparator(this));
- QAction *widgetHelp = new QAction(tr("Current Widget Help"), this);
- widgetHelp->setObjectName(QLatin1String("__qt_current_widget_help_action"));
- widgetHelp->setShortcut(Qt::Key_F1);
- connect(widgetHelp, SIGNAL(triggered()), this, SLOT(showWidgetSpecificHelp()));
- helpActions->addAction(widgetHelp);
-
- helpActions->addAction(createSeparator(this));
- QAction *whatsNewAction = new QAction(tr("What's New in Qt Designer?"), this);
- whatsNewAction->setObjectName(QLatin1String("__qt_whats_new_in_qt_designer_action"));
- connect(whatsNewAction, SIGNAL(triggered()), this, SLOT(showWhatsNew()));
- helpActions->addAction(whatsNewAction);
-#endif
-
helpActions->addAction(createSeparator(this));
QAction *aboutPluginsAction = new QAction(tr("About Plugins"), this);
aboutPluginsAction->setObjectName(QLatin1String("__qt_about_plugins_action"));
return m_minimizeAction;
}
-void QDesignerActions::showDesignerHelp()
-{
- QString url = AssistantClient::designerManualUrl();
- url += QLatin1String("designer-manual.html");
- showHelp(url);
-}
-
-void QDesignerActions::showWhatsNew()
-{
- QString url = AssistantClient::qtReferenceManualUrl();
- url += QLatin1String("qt4-designer.html");
- showHelp(url);
-}
-
-void QDesignerActions::helpRequested(const QString &manual, const QString &document)
-{
- QString url = AssistantClient::documentUrl(manual);
- url += document;
- showHelp(url);
-}
-
-void QDesignerActions::showHelp(const QString &url)
-{
- QString errorMessage;
- if (!m_assistantClient.showPage(url, &errorMessage))
- QMessageBox::warning(core()->topLevel(), tr("Assistant"), errorMessage);
-}
-
void QDesignerActions::aboutDesigner()
{
VersionDialog mb(core()->topLevel());
return m_editWidgetsAction;
}
-void QDesignerActions::showWidgetSpecificHelp()
-{
- QString helpId;
- if (const qdesigner_internal::QDesignerIntegration *integration = qobject_cast<qdesigner_internal::QDesignerIntegration *>(core()->integration()))
- helpId = integration->contextHelpId();
-
- if (helpId.isEmpty()) {
- showDesignerHelp();
- return;
- }
-
- QString errorMessage;
- const bool rc = m_assistantClient.activateIdentifier(helpId, &errorMessage);
- if (!rc)
- QMessageBox::warning(core()->topLevel(), tr("Assistant"), errorMessage);
-}
-
void QDesignerActions::updateCloseAction()
{
if (m_previewManager->previewCount()) {
#ifndef QDESIGNER_ACTIONS_H
#define QDESIGNER_ACTIONS_H
-#include "assistantclient.h"
#include "qdesigner_settings.h"
#include <QtCore/QObject>
void activeFormWindowChanged(QDesignerFormWindowInterface *formWindow);
void createForm();
void slotOpenForm();
- void helpRequested(const QString &manual, const QString &document);
signals:
void useBigIcons(bool);
void openRecentForm();
void clearRecentFiles();
void closeForm();
- void showDesignerHelp();
- void showWhatsNew();
void aboutDesigner();
- void showWidgetSpecificHelp();
void backupForms();
void showNewFormDialog(const QString &fileName);
void showPreferencesDialog();
void fixActionContext();
void updateRecentFileActions();
void addRecentFile(const QString &fileName);
- void showHelp(const QString &help);
void closePreview();
QRect fixDialogRect(const QRect &rect) const;
QString fixResourceFileBackupPath(QDesignerFormWindowInterface *fwi, const QDir& backupDir);
QDesignerWorkbench *m_workbench;
QDesignerFormEditorInterface *m_core;
QDesignerSettings m_settings;
- AssistantClient m_assistantClient;
QString m_openDirectory;
QString m_saveDirectory;
if (i == QDesignerToolWindow::WidgetBox)
connect(toolWindow, SIGNAL(closeEventReceived(QCloseEvent*)), this, SLOT(handleCloseEvent(QCloseEvent*)));
}
- // Integration
- m_integration = new qdesigner_internal::QDesignerIntegration(m_core, this);
- connect(m_integration, SIGNAL(helpRequested(QString,QString)), m_actionManager, SLOT(helpRequested(QString,QString)));
// remaining view options (config toolbars)
viewMenu->addSeparator();
class QDesignerFormWindowInterface;
class QDesignerFormWindowManagerInterface;
-namespace qdesigner_internal {
-class QDesignerIntegration;
-}
-
class QDesignerWorkbench: public QObject
{
Q_OBJECT
void saveSettings() const;
QDesignerFormEditorInterface *m_core;
- qdesigner_internal::QDesignerIntegration *m_integration;
QDesignerActions *m_actionManager;
QActionGroup *m_windowActions;