Commit 87afa472 authored by hjk's avatar hjk
Browse files

QMakeProjectManager: Some code shuffling



In preparation of moving the .pro editor over to new
editor construction scheme.

Change-Id: I429683c523e22bf874e25528eb7d9c13c7989628
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 49ae9766
...@@ -29,13 +29,18 @@ ...@@ -29,13 +29,18 @@
#include "profileeditor.h" #include "profileeditor.h"
#include "profilecompletionassist.h"
#include "profilehighlighter.h" #include "profilehighlighter.h"
#include "qmakeprojectmanager.h"
#include "qmakeprojectmanagerconstants.h"
#include "qmakeprojectmanagerconstants.h" #include "qmakeprojectmanagerconstants.h"
#include "profileeditorfactory.h"
#include "profilecompletionassist.h"
#include <coreplugin/fileiconprovider.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <qtsupport/qtsupportconstants.h>
#include <texteditor/texteditoractionhandler.h>
#include <QCoreApplication>
#include <QFileInfo> #include <QFileInfo>
#include <QDir> #include <QDir>
#include <QTextBlock> #include <QTextBlock>
...@@ -191,5 +196,36 @@ QString ProFileDocument::suggestedFileName() const ...@@ -191,5 +196,36 @@ QString ProFileDocument::suggestedFileName() const
return fi.fileName(); 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 Internal
} // namespace QmakeProjectManager } // namespace QmakeProjectManager
...@@ -30,16 +30,13 @@ ...@@ -30,16 +30,13 @@
#ifndef PROFILEEDITOR_H #ifndef PROFILEEDITOR_H
#define PROFILEEDITOR_H #define PROFILEEDITOR_H
#include <coreplugin/editormanager/ieditorfactory.h>
#include <texteditor/basetextdocument.h> #include <texteditor/basetextdocument.h>
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
#include <utils/uncommentselection.h>
namespace QmakeProjectManager { namespace QmakeProjectManager {
namespace Internal { namespace Internal {
class ProFileEditorFactory;
class ProFileEditorWidget;
class ProFileEditor : public TextEditor::BaseTextEditor class ProFileEditor : public TextEditor::BaseTextEditor
{ {
Q_OBJECT Q_OBJECT
...@@ -78,6 +75,16 @@ public: ...@@ -78,6 +75,16 @@ public:
bool supportsUtf8Bom() { return false; } bool supportsUtf8Bom() { return false; }
}; };
class ProFileEditorFactory : public Core::IEditorFactory
{
Q_OBJECT
public:
ProFileEditorFactory();
Core::IEditor *createEditor();
};
} // namespace Internal } // namespace Internal
} // namespace QmakeProjectManager } // namespace QmakeProjectManager
......
/****************************************************************************
**
** 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 <qtsupport/qtsupportconstants.h>
#include <coreplugin/fileiconprovider.h>
#include <texteditor/texteditoractionhandler.h>
#include <QCoreApplication>
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();
}
/****************************************************************************
**
** 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 <coreplugin/editormanager/ieditorfactory.h>
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
...@@ -16,7 +16,6 @@ HEADERS += \ ...@@ -16,7 +16,6 @@ HEADERS += \
qmakenodes.h \ qmakenodes.h \
profileeditor.h \ profileeditor.h \
profilehighlighter.h \ profilehighlighter.h \
profileeditorfactory.h \
profilehoverhandler.h \ profilehoverhandler.h \
wizards/qtprojectparameters.h \ wizards/qtprojectparameters.h \
wizards/guiappwizard.h \ wizards/guiappwizard.h \
...@@ -67,7 +66,6 @@ SOURCES += \ ...@@ -67,7 +66,6 @@ SOURCES += \
qmakenodes.cpp \ qmakenodes.cpp \
profileeditor.cpp \ profileeditor.cpp \
profilehighlighter.cpp \ profilehighlighter.cpp \
profileeditorfactory.cpp \
profilehoverhandler.cpp \ profilehoverhandler.cpp \
wizards/qtprojectparameters.cpp \ wizards/qtprojectparameters.cpp \
wizards/guiappwizard.cpp \ wizards/guiappwizard.cpp \
......
...@@ -33,7 +33,6 @@ QtcPlugin { ...@@ -33,7 +33,6 @@ QtcPlugin {
"makestep.cpp", "makestep.h", "makestep.ui", "makestep.cpp", "makestep.h", "makestep.ui",
"profilecompletionassist.cpp", "profilecompletionassist.h", "profilecompletionassist.cpp", "profilecompletionassist.h",
"profileeditor.cpp", "profileeditor.h", "profileeditor.cpp", "profileeditor.h",
"profileeditorfactory.cpp", "profileeditorfactory.h",
"profilehighlighter.cpp", "profilehighlighter.h", "profilehighlighter.cpp", "profilehighlighter.h",
"profilehoverhandler.cpp", "profilehoverhandler.h", "profilehoverhandler.cpp", "profilehoverhandler.h",
"qmakebuildinfo.h", "qmakebuildinfo.h",
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "qmakeprojectmanagerplugin.h" #include "qmakeprojectmanagerplugin.h"
#include "profileeditor.h"
#include "qmakeprojectmanager.h" #include "qmakeprojectmanager.h"
#include "qmakenodes.h" #include "qmakenodes.h"
#include "qmakestep.h" #include "qmakestep.h"
...@@ -43,7 +44,6 @@ ...@@ -43,7 +44,6 @@
#include "wizards/subdirsprojectwizard.h" #include "wizards/subdirsprojectwizard.h"
#include "wizards/qtquickappwizard.h" #include "wizards/qtquickappwizard.h"
#include "customwidgetwizard/customwidgetwizard.h" #include "customwidgetwizard/customwidgetwizard.h"
#include "profileeditorfactory.h"
#include "profilehoverhandler.h" #include "profilehoverhandler.h"
#include "qmakeprojectmanagerconstants.h" #include "qmakeprojectmanagerconstants.h"
#include "qmakeproject.h" #include "qmakeproject.h"
...@@ -90,8 +90,6 @@ QmakeProjectManagerPlugin::~QmakeProjectManagerPlugin() ...@@ -90,8 +90,6 @@ QmakeProjectManagerPlugin::~QmakeProjectManagerPlugin()
//removeObject(m_embeddedPropertiesPage); //removeObject(m_embeddedPropertiesPage);
//delete m_embeddedPropertiesPage; //delete m_embeddedPropertiesPage;
removeObject(m_proFileEditorFactory);
delete m_proFileEditorFactory;
removeObject(m_qmakeProjectManager); removeObject(m_qmakeProjectManager);
delete m_qmakeProjectManager; delete m_qmakeProjectManager;
} }
...@@ -111,12 +109,9 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString ...@@ -111,12 +109,9 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
m_qmakeProjectManager = new QmakeManager(this); m_qmakeProjectManager = new QmakeManager(this);
addObject(m_qmakeProjectManager); addObject(m_qmakeProjectManager);
m_proFileEditorFactory = new ProFileEditorFactory(m_qmakeProjectManager);
ProjectExplorer::KitManager::registerKitInformation(new QmakeKitInformation); ProjectExplorer::KitManager::registerKitInformation(new QmakeKitInformation);
addObject(m_proFileEditorFactory); addAutoReleasedObject(new ProFileEditorFactory);
addAutoReleasedObject(new EmptyProjectWizard); addAutoReleasedObject(new EmptyProjectWizard);
addAutoReleasedObject(new SubdirsProjectWizard); addAutoReleasedObject(new SubdirsProjectWizard);
addAutoReleasedObject(new GuiAppWizard); addAutoReleasedObject(new GuiAppWizard);
......
...@@ -49,13 +49,10 @@ namespace Utils { class ParameterAction; } ...@@ -49,13 +49,10 @@ namespace Utils { class ParameterAction; }
namespace QmakeProjectManager { namespace QmakeProjectManager {
class QmakeManager; class QmakeManager;
class QtVersionManager;
class QmakeProject; class QmakeProject;
namespace Internal { namespace Internal {
class ProFileEditorFactory;
class QmakeProjectManagerPlugin : public ExtensionSystem::IPlugin class QmakeProjectManagerPlugin : public ExtensionSystem::IPlugin
{ {
Q_OBJECT Q_OBJECT
...@@ -82,7 +79,6 @@ private slots: ...@@ -82,7 +79,6 @@ private slots:
private: private:
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer; ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
ProFileEditorFactory *m_proFileEditorFactory;
QmakeManager *m_qmakeProjectManager; QmakeManager *m_qmakeProjectManager;
QmakeProject *m_previousStartupProject; QmakeProject *m_previousStartupProject;
ProjectExplorer::Target *m_previousTarget; ProjectExplorer::Target *m_previousTarget;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment