From 97704287ae6dd5c9a667104386f83d4f6257ede7 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 16 Oct 2016 19:07:03 +0000 Subject: [PATCH] remove assistant leftovers from designer Signed-off-by: Ivailo Monev --- src/tools/designer/CMakeLists.txt | 2 - src/tools/designer/assistantclient.cpp | 175 ----------------------------- src/tools/designer/assistantclient.h | 83 -------------- src/tools/designer/qdesigner_actions.cpp | 66 ----------- src/tools/designer/qdesigner_actions.h | 7 -- src/tools/designer/qdesigner_workbench.cpp | 3 - src/tools/designer/qdesigner_workbench.h | 5 - 7 files changed, 341 deletions(-) delete mode 100644 src/tools/designer/assistantclient.cpp delete mode 100644 src/tools/designer/assistantclient.h diff --git a/src/tools/designer/CMakeLists.txt b/src/tools/designer/CMakeLists.txt index 6dae58e83..8a0b80c24 100644 --- a/src/tools/designer/CMakeLists.txt +++ b/src/tools/designer/CMakeLists.txt @@ -45,7 +45,6 @@ set(DESIGNERBIN_HEADERS ${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} ) @@ -65,7 +64,6 @@ set(DESIGNERBIN_SOURCES ${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 diff --git a/src/tools/designer/assistantclient.cpp b/src/tools/designer/assistantclient.cpp deleted file mode 100644 index c6ae30e79..000000000 --- a/src/tools/designer/assistantclient.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/**************************************************************************** -** -** 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 -#include -#include -#include -#include -#include -#include -#include -#include - -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 diff --git a/src/tools/designer/assistantclient.h b/src/tools/designer/assistantclient.h deleted file mode 100644 index 2b753a715..000000000 --- a/src/tools/designer/assistantclient.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** 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 - -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 diff --git a/src/tools/designer/qdesigner_actions.cpp b/src/tools/designer/qdesigner_actions.cpp index d06708c47..de7aa9dcd 100644 --- a/src/tools/designer/qdesigner_actions.cpp +++ b/src/tools/designer/qdesigner_actions.cpp @@ -444,27 +444,6 @@ QActionGroup *QDesignerActions::createHelpActions() { 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")); @@ -1042,34 +1021,6 @@ QAction *QDesignerActions::minimizeAction() const 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()); @@ -1087,23 +1038,6 @@ QAction *QDesignerActions::editWidgets() const return m_editWidgetsAction; } -void QDesignerActions::showWidgetSpecificHelp() -{ - QString helpId; - if (const qdesigner_internal::QDesignerIntegration *integration = qobject_cast(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()) { diff --git a/src/tools/designer/qdesigner_actions.h b/src/tools/designer/qdesigner_actions.h index e659a5ebb..9d7d1b548 100644 --- a/src/tools/designer/qdesigner_actions.h +++ b/src/tools/designer/qdesigner_actions.h @@ -42,7 +42,6 @@ #ifndef QDESIGNER_ACTIONS_H #define QDESIGNER_ACTIONS_H -#include "assistantclient.h" #include "qdesigner_settings.h" #include @@ -121,7 +120,6 @@ public slots: void activeFormWindowChanged(QDesignerFormWindowInterface *formWindow); void createForm(); void slotOpenForm(); - void helpRequested(const QString &manual, const QString &document); signals: void useBigIcons(bool); @@ -138,10 +136,7 @@ private slots: void openRecentForm(); void clearRecentFiles(); void closeForm(); - void showDesignerHelp(); - void showWhatsNew(); void aboutDesigner(); - void showWidgetSpecificHelp(); void backupForms(); void showNewFormDialog(const QString &fileName); void showPreferencesDialog(); @@ -158,7 +153,6 @@ private: 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); @@ -172,7 +166,6 @@ private: QDesignerWorkbench *m_workbench; QDesignerFormEditorInterface *m_core; QDesignerSettings m_settings; - AssistantClient m_assistantClient; QString m_openDirectory; QString m_saveDirectory; diff --git a/src/tools/designer/qdesigner_workbench.cpp b/src/tools/designer/qdesigner_workbench.cpp index b98748fda..081ccd6f2 100644 --- a/src/tools/designer/qdesigner_workbench.cpp +++ b/src/tools/designer/qdesigner_workbench.cpp @@ -230,9 +230,6 @@ QDesignerWorkbench::QDesignerWorkbench() : 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(); diff --git a/src/tools/designer/qdesigner_workbench.h b/src/tools/designer/qdesigner_workbench.h index 9d0861e47..a88ef73bb 100644 --- a/src/tools/designer/qdesigner_workbench.h +++ b/src/tools/designer/qdesigner_workbench.h @@ -76,10 +76,6 @@ class QDesignerFormEditorInterface; class QDesignerFormWindowInterface; class QDesignerFormWindowManagerInterface; -namespace qdesigner_internal { -class QDesignerIntegration; -} - class QDesignerWorkbench: public QObject { Q_OBJECT @@ -161,7 +157,6 @@ private: void saveSettings() const; QDesignerFormEditorInterface *m_core; - qdesigner_internal::QDesignerIntegration *m_integration; QDesignerActions *m_actionManager; QActionGroup *m_windowActions; -- 2.11.0