diff --git a/src/plugins/qmakeprojectmanager/profileeditor.cpp b/src/plugins/qmakeprojectmanager/profileeditor.cpp index 14ccf433fb3..772ccae5ca4 100644 --- a/src/plugins/qmakeprojectmanager/profileeditor.cpp +++ b/src/plugins/qmakeprojectmanager/profileeditor.cpp @@ -29,13 +29,18 @@ #include "profileeditor.h" -#include "profilehighlighter.h" -#include "qmakeprojectmanagerconstants.h" -#include "profileeditorfactory.h" #include "profilecompletionassist.h" +#include "profilehighlighter.h" +#include "qmakeprojectmanager.h" +#include "qmakeprojectmanagerconstants.h" +#include "qmakeprojectmanagerconstants.h" +#include #include +#include +#include +#include #include #include #include @@ -191,5 +196,36 @@ QString ProFileDocument::suggestedFileName() const return fi.fileName(); } + +// +// ProFileEditorFactory +// + +ProFileEditorFactory::ProFileEditorFactory() +{ + setId(QmakeProjectManager::Constants::PROFILE_EDITOR_ID); + setDisplayName(qApp->translate("OpenWith::Editors", QmakeProjectManager::Constants::PROFILE_EDITOR_DISPLAY_NAME)); + addMimeType(QmakeProjectManager::Constants::PROFILE_MIMETYPE); + addMimeType(QmakeProjectManager::Constants::PROINCLUDEFILE_MIMETYPE); + addMimeType(QmakeProjectManager::Constants::PROFEATUREFILE_MIMETYPE); + addMimeType(QmakeProjectManager::Constants::PROCONFIGURATIONFILE_MIMETYPE); + addMimeType(QmakeProjectManager::Constants::PROCACHEFILE_MIMETYPE); + addMimeType(QmakeProjectManager::Constants::PROSTASHFILE_MIMETYPE); + new TextEditor::TextEditorActionHandler(this, Constants::C_PROFILEEDITOR, + TextEditor::TextEditorActionHandler::UnCommentSelection + | TextEditor::TextEditorActionHandler::JumpToFileUnderCursor); + + Core::FileIconProvider::registerIconOverlayForSuffix(QtSupport::Constants::ICON_QT_PROJECT, "pro"); + Core::FileIconProvider::registerIconOverlayForSuffix(QtSupport::Constants::ICON_QT_PROJECT, "pri"); + Core::FileIconProvider::registerIconOverlayForSuffix(QtSupport::Constants::ICON_QT_PROJECT, "prf"); +} + +Core::IEditor *ProFileEditorFactory::createEditor() +{ + ProFileEditorWidget *editor = new ProFileEditorWidget; + editor->setTextDocument(TextEditor::BaseTextDocumentPtr(new ProFileDocument)); + return editor->editor(); +} + } // namespace Internal } // namespace QmakeProjectManager diff --git a/src/plugins/qmakeprojectmanager/profileeditor.h b/src/plugins/qmakeprojectmanager/profileeditor.h index ce27b4bd9c5..ff9b212d403 100644 --- a/src/plugins/qmakeprojectmanager/profileeditor.h +++ b/src/plugins/qmakeprojectmanager/profileeditor.h @@ -30,16 +30,13 @@ #ifndef PROFILEEDITOR_H #define PROFILEEDITOR_H +#include #include #include -#include namespace QmakeProjectManager { namespace Internal { -class ProFileEditorFactory; -class ProFileEditorWidget; - class ProFileEditor : public TextEditor::BaseTextEditor { Q_OBJECT @@ -78,6 +75,16 @@ public: bool supportsUtf8Bom() { return false; } }; +class ProFileEditorFactory : public Core::IEditorFactory +{ + Q_OBJECT + +public: + ProFileEditorFactory(); + + Core::IEditor *createEditor(); +}; + } // namespace Internal } // namespace QmakeProjectManager diff --git a/src/plugins/qmakeprojectmanager/profileeditorfactory.cpp b/src/plugins/qmakeprojectmanager/profileeditorfactory.cpp deleted file mode 100644 index eec75c7857d..00000000000 --- a/src/plugins/qmakeprojectmanager/profileeditorfactory.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "profileeditorfactory.h" - -#include "qmakeprojectmanager.h" -#include "qmakeprojectmanagerconstants.h" -#include "profileeditor.h" - -#include -#include -#include - -#include - -using namespace QmakeProjectManager; -using namespace QmakeProjectManager::Internal; - -ProFileEditorFactory::ProFileEditorFactory(QmakeManager *manager) : - m_manager(manager) -{ - setId(QmakeProjectManager::Constants::PROFILE_EDITOR_ID); - setDisplayName(qApp->translate("OpenWith::Editors", QmakeProjectManager::Constants::PROFILE_EDITOR_DISPLAY_NAME)); - addMimeType(QmakeProjectManager::Constants::PROFILE_MIMETYPE); - addMimeType(QmakeProjectManager::Constants::PROINCLUDEFILE_MIMETYPE); - addMimeType(QmakeProjectManager::Constants::PROFEATUREFILE_MIMETYPE); - addMimeType(QmakeProjectManager::Constants::PROCONFIGURATIONFILE_MIMETYPE); - addMimeType(QmakeProjectManager::Constants::PROCACHEFILE_MIMETYPE); - addMimeType(QmakeProjectManager::Constants::PROSTASHFILE_MIMETYPE); - new TextEditor::TextEditorActionHandler(this, Constants::C_PROFILEEDITOR, - TextEditor::TextEditorActionHandler::UnCommentSelection - | TextEditor::TextEditorActionHandler::JumpToFileUnderCursor); - - Core::FileIconProvider::registerIconOverlayForSuffix(QtSupport::Constants::ICON_QT_PROJECT, "pro"); - Core::FileIconProvider::registerIconOverlayForSuffix(QtSupport::Constants::ICON_QT_PROJECT, "pri"); - Core::FileIconProvider::registerIconOverlayForSuffix(QtSupport::Constants::ICON_QT_PROJECT, "prf"); -} - -Core::IEditor *ProFileEditorFactory::createEditor() -{ - ProFileEditorWidget *editor = new ProFileEditorWidget; - editor->setTextDocument(TextEditor::BaseTextDocumentPtr(new ProFileDocument)); - return editor->editor(); -} diff --git a/src/plugins/qmakeprojectmanager/profileeditorfactory.h b/src/plugins/qmakeprojectmanager/profileeditorfactory.h deleted file mode 100644 index d42deadfbcf..00000000000 --- a/src/plugins/qmakeprojectmanager/profileeditorfactory.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef PROFILEEDITORFACTORY_H -#define PROFILEEDITORFACTORY_H - -#include - -namespace QmakeProjectManager { - -class QmakeManager; - -namespace Internal { - -class ProFileEditorFactory : public Core::IEditorFactory -{ - Q_OBJECT - -public: - ProFileEditorFactory(QmakeManager *parent); - - Core::IEditor *createEditor(); - - QmakeManager *qmakeProjectManager() const { return m_manager; } - -private: - QmakeManager *m_manager; -}; - -} // namespace Internal -} // namespace QmakeProjectManager - -#endif // PROFILEEDITORFACTORY_H diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro index db881dfdd67..c9da3d35cce 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro @@ -16,7 +16,6 @@ HEADERS += \ qmakenodes.h \ profileeditor.h \ profilehighlighter.h \ - profileeditorfactory.h \ profilehoverhandler.h \ wizards/qtprojectparameters.h \ wizards/guiappwizard.h \ @@ -67,7 +66,6 @@ SOURCES += \ qmakenodes.cpp \ profileeditor.cpp \ profilehighlighter.cpp \ - profileeditorfactory.cpp \ profilehoverhandler.cpp \ wizards/qtprojectparameters.cpp \ wizards/guiappwizard.cpp \ diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs index 9372bfa867c..5e073230131 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs @@ -33,7 +33,6 @@ QtcPlugin { "makestep.cpp", "makestep.h", "makestep.ui", "profilecompletionassist.cpp", "profilecompletionassist.h", "profileeditor.cpp", "profileeditor.h", - "profileeditorfactory.cpp", "profileeditorfactory.h", "profilehighlighter.cpp", "profilehighlighter.h", "profilehoverhandler.cpp", "profilehoverhandler.h", "qmakebuildinfo.h", diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp index 83df8908f64..71cade577d5 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp @@ -29,6 +29,7 @@ #include "qmakeprojectmanagerplugin.h" +#include "profileeditor.h" #include "qmakeprojectmanager.h" #include "qmakenodes.h" #include "qmakestep.h" @@ -43,7 +44,6 @@ #include "wizards/subdirsprojectwizard.h" #include "wizards/qtquickappwizard.h" #include "customwidgetwizard/customwidgetwizard.h" -#include "profileeditorfactory.h" #include "profilehoverhandler.h" #include "qmakeprojectmanagerconstants.h" #include "qmakeproject.h" @@ -90,8 +90,6 @@ QmakeProjectManagerPlugin::~QmakeProjectManagerPlugin() //removeObject(m_embeddedPropertiesPage); //delete m_embeddedPropertiesPage; - removeObject(m_proFileEditorFactory); - delete m_proFileEditorFactory; removeObject(m_qmakeProjectManager); delete m_qmakeProjectManager; } @@ -111,12 +109,9 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString m_qmakeProjectManager = new QmakeManager(this); addObject(m_qmakeProjectManager); - m_proFileEditorFactory = new ProFileEditorFactory(m_qmakeProjectManager); - ProjectExplorer::KitManager::registerKitInformation(new QmakeKitInformation); - addObject(m_proFileEditorFactory); - + addAutoReleasedObject(new ProFileEditorFactory); addAutoReleasedObject(new EmptyProjectWizard); addAutoReleasedObject(new SubdirsProjectWizard); addAutoReleasedObject(new GuiAppWizard); diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.h b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.h index 1d9688881ab..5393ec0cdf3 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.h +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.h @@ -49,13 +49,10 @@ namespace Utils { class ParameterAction; } namespace QmakeProjectManager { class QmakeManager; -class QtVersionManager; class QmakeProject; namespace Internal { -class ProFileEditorFactory; - class QmakeProjectManagerPlugin : public ExtensionSystem::IPlugin { Q_OBJECT @@ -82,7 +79,6 @@ private slots: private: ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer; - ProFileEditorFactory *m_proFileEditorFactory; QmakeManager *m_qmakeProjectManager; QmakeProject *m_previousStartupProject; ProjectExplorer::Target *m_previousTarget;