summaryrefslogtreecommitdiff
path: root/src/plugins/autotoolsprojectmanager
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2017-03-03 18:16:34 +0100
committerhjk <hjk@qt.io>2017-03-09 10:41:33 +0000
commitc1bfc5d8ec99e7874208ad2f4dc312b73f1817cd (patch)
tree140e487fb3758bd9edf96ff91f597b3729f380bb /src/plugins/autotoolsprojectmanager
parent57144e28da79bc8e9df00b0c7dfc5d054d066877 (diff)
downloadqt-creator-c1bfc5d8ec99e7874208ad2f4dc312b73f1817cd.tar.gz
ProjectExplorer: Follow up on too-much-magic in IProjectManager
Use a ProjectManager::registerProjectType<Project>(MimeType) function, removing cryptic IProjectManager object ownership. Change-Id: I212cd25bd4ee757022a8cb0decb4b8de3a112d12 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/autotoolsprojectmanager')
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsmanager.cpp48
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsmanager.h52
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsproject.cpp3
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsproject.h2
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp4
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsprojectfile.h2
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro2
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs2
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp9
9 files changed, 11 insertions, 113 deletions
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsmanager.cpp b/src/plugins/autotoolsprojectmanager/autotoolsmanager.cpp
deleted file mode 100644
index 6e19e8516a..0000000000
--- a/src/plugins/autotoolsprojectmanager/autotoolsmanager.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Openismus GmbH.
-** Author: Peter Penz (ppenz@openismus.com)
-** Author: Patricia Santana Cruz (patriciasantanacruz@gmail.com)
-** Contact: https://www.qt.io/licensing/
-**
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#include "autotoolsmanager.h"
-#include "autotoolsproject.h"
-#include "autotoolsprojectconstants.h"
-
-using namespace ProjectExplorer;
-
-namespace AutotoolsProjectManager {
-namespace Internal {
-
-Project *AutotoolsManager::openProject(const QString &fileName)
-{
- return new AutotoolsProject(fileName);
-}
-
-QString AutotoolsManager::mimeType() const
-{
- return QLatin1String(Constants::MAKEFILE_MIMETYPE);
-}
-
-} // namespace Internal
-} // namespace AutotoolsProjectManager
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsmanager.h b/src/plugins/autotoolsprojectmanager/autotoolsmanager.h
deleted file mode 100644
index 500a2599dd..0000000000
--- a/src/plugins/autotoolsprojectmanager/autotoolsmanager.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Openismus GmbH.
-** Author: Peter Penz (ppenz@openismus.com)
-** Author: Patricia Santana Cruz (patriciasantanacruz@gmail.com)
-** Contact: https://www.qt.io/licensing/
-**
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#pragma once
-
-#include <projectexplorer/iprojectmanager.h>
-
-namespace AutotoolsProjectManager {
-namespace Internal {
-
-/**
- * @brief Implementation of ProjectExplorer::IProjectManager interface.
- *
- * An autotools project is identified by the MIME type text/x-makefile.
- * The project is represented by an instance of ProjectExplorer::Project,
- * which gets created by AutotoolsManager::openProject().
- */
-class AutotoolsManager : public ProjectExplorer::IProjectManager
-{
- Q_OBJECT
-
-public:
- ProjectExplorer::Project *openProject(const QString &fileName) override;
- QString mimeType() const override;
-};
-
-} // namespace Internal
-} // namespace AutotoolsProjectManager
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
index 1b986bd7ed..1733d5ec5d 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
+++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
@@ -28,7 +28,6 @@
#include "autotoolsproject.h"
#include "autotoolsbuildconfiguration.h"
#include "autotoolsprojectconstants.h"
-#include "autotoolsmanager.h"
#include "autotoolsprojectnode.h"
#include "autotoolsprojectfile.h"
#include "autotoolsopenprojectwizard.h"
@@ -69,7 +68,7 @@ using namespace AutotoolsProjectManager;
using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer;
-AutotoolsProject::AutotoolsProject(const QString &fileName) :
+AutotoolsProject::AutotoolsProject(const Utils::FileName &fileName) :
m_fileWatcher(new Utils::FileSystemWatcher(this)),
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
{
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.h b/src/plugins/autotoolsprojectmanager/autotoolsproject.h
index 501fb9f98e..8b2d5ab788 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsproject.h
+++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.h
@@ -54,7 +54,7 @@ class AutotoolsProject : public ProjectExplorer::Project
Q_OBJECT
public:
- AutotoolsProject(const QString &fileName);
+ explicit AutotoolsProject(const Utils::FileName &fileName);
~AutotoolsProject() override;
QString displayName() const override;
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp b/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp
index 096ed7301a..49a3d1e6ff 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp
+++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp
@@ -32,11 +32,11 @@
namespace AutotoolsProjectManager {
namespace Internal {
-AutotoolsProjectFile::AutotoolsProjectFile(const QString &fileName)
+AutotoolsProjectFile::AutotoolsProjectFile(const Utils::FileName &fileName)
{
setId("Autotools.ProjectFile");
setMimeType(QLatin1String(Constants::MAKEFILE_MIMETYPE));
- setFilePath(Utils::FileName::fromString(fileName));
+ setFilePath(fileName);
}
} // namespace Internal
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.h b/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.h
index 2e1d9b54e9..8c41e19bd5 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.h
+++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.h
@@ -45,7 +45,7 @@ namespace Internal {
class AutotoolsProjectFile : public Core::IDocument
{
public:
- AutotoolsProjectFile(const QString &fileName);
+ AutotoolsProjectFile(const Utils::FileName &fileName);
};
} // namespace Internal
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro
index 2c259f6c61..3e30bf328c 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro
+++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro
@@ -2,7 +2,6 @@ include(../../qtcreatorplugin.pri)
HEADERS = autotoolsprojectplugin.h\
autotoolsopenprojectwizard.h\
- autotoolsmanager.h\
autotoolsprojectfile.h\
autotoolsprojectnode.h\
autotoolsproject.h\
@@ -17,7 +16,6 @@ HEADERS = autotoolsprojectplugin.h\
makefileparser.h
SOURCES = autotoolsprojectplugin.cpp\
autotoolsopenprojectwizard.cpp\
- autotoolsmanager.cpp\
autotoolsprojectfile.cpp\
autotoolsprojectnode.cpp\
autotoolsproject.cpp\
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs
index af646ffa2e..8c76c5d41f 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs
+++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs
@@ -20,8 +20,6 @@ QtcPlugin {
"autotoolsbuildconfiguration.h",
"autotoolsbuildsettingswidget.cpp",
"autotoolsbuildsettingswidget.h",
- "autotoolsmanager.cpp",
- "autotoolsmanager.h",
"autotoolsopenprojectwizard.cpp",
"autotoolsopenprojectwizard.h",
"autotoolsproject.cpp",
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp b/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp
index d5815515af..c323754a65 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp
+++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp
@@ -26,13 +26,15 @@
****************************************************************************/
#include "autotoolsprojectplugin.h"
-#include "autotoolsmanager.h"
+#include "autotoolsproject.h"
+#include "autotoolsprojectconstants.h"
#include "autotoolsbuildconfiguration.h"
#include "makestep.h"
#include "autogenstep.h"
#include "autoreconfstep.h"
#include "configurestep.h"
-#include "autotoolsprojectconstants.h"
+
+#include <projectexplorer/projectmanager.h>
#include <QStringList>
#include <QtPlugin>
@@ -53,7 +55,8 @@ bool AutotoolsProjectPlugin::initialize(const QStringList &arguments,
addAutoReleasedObject(new AutogenStepFactory);
addAutoReleasedObject(new ConfigureStepFactory);
addAutoReleasedObject(new AutoreconfStepFactory);
- addAutoReleasedObject(new AutotoolsManager);
+
+ ProjectExplorer::ProjectManager::registerProjectType<AutotoolsProject>(Constants::MAKEFILE_MIMETYPE);
return true;
}