forked from qt-creator/qt-creator
QMakeProjectManager: Some code shuffling
In preparation of moving the .pro editor over to new editor construction scheme. Change-Id: I429683c523e22bf874e25528eb7d9c13c7989628 Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -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 <coreplugin/fileiconprovider.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
#include <texteditor/texteditoractionhandler.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#include <QTextBlock>
|
||||
@@ -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
|
||||
|
||||
@@ -30,16 +30,13 @@
|
||||
#ifndef PROFILEEDITOR_H
|
||||
#define PROFILEEDITOR_H
|
||||
|
||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||
#include <texteditor/basetextdocument.h>
|
||||
#include <texteditor/basetexteditor.h>
|
||||
#include <utils/uncommentselection.h>
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -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 <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();
|
||||
}
|
||||
@@ -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 <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 += \
|
||||
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 \
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user