GenericProject: Modernize

* Use pragma once
* Use overrides
* Clean up here and there (mostly in the headers)

Change-Id: Ib33b6a6aa1a285d281f3d8b940fe654af3941554
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Tobias Hunger
2016-02-04 13:08:13 +01:00
parent eb07fd92b2
commit ff303ee994
16 changed files with 44 additions and 97 deletions

View File

@@ -34,8 +34,6 @@
#include <utils/wizard.h> #include <utils/wizard.h>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QLineEdit>
#include <QPushButton>
namespace GenericProjectManager { namespace GenericProjectManager {
namespace Internal { namespace Internal {

View File

@@ -23,19 +23,11 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef FILESSELECTIONWIZARDPAGE_H #pragma once
#define FILESSELECTIONWIZARDPAGE_H
#include <QWizardPage>
#include <utils/fileutils.h> #include <utils/fileutils.h>
QT_BEGIN_NAMESPACE #include <QWizardPage>
class QVBoxLayout;
class QLabel;
class QTreeView;
class QLineEdit;
QT_END_NAMESPACE
namespace ProjectExplorer { class SelectableFilesWidget; } namespace ProjectExplorer { class SelectableFilesWidget; }
@@ -50,9 +42,9 @@ class FilesSelectionWizardPage : public QWizardPage
public: public:
FilesSelectionWizardPage(GenericProjectWizardDialog *genericProjectWizard, QWidget *parent = 0); FilesSelectionWizardPage(GenericProjectWizardDialog *genericProjectWizard, QWidget *parent = 0);
bool isComplete() const; bool isComplete() const override;
void initializePage(); void initializePage() override;
void cleanupPage(); void cleanupPage() override;
Utils::FileNameList selectedFiles() const; Utils::FileNameList selectedFiles() const;
Utils::FileNameList selectedPaths() const; Utils::FileNameList selectedPaths() const;
@@ -63,5 +55,3 @@ private:
} // namespace Internal } // namespace Internal
} // namespace GenericProjectManager } // namespace GenericProjectManager
#endif // FILESSELECTIONWIZARDPAGE_H

View File

@@ -51,13 +51,11 @@ const char GENERIC_BC_ID[] = "GenericProjectManager.GenericBuildConfiguration";
GenericBuildConfiguration::GenericBuildConfiguration(Target *parent) GenericBuildConfiguration::GenericBuildConfiguration(Target *parent)
: BuildConfiguration(parent, Core::Id(GENERIC_BC_ID)) : BuildConfiguration(parent, Core::Id(GENERIC_BC_ID))
{ { }
}
GenericBuildConfiguration::GenericBuildConfiguration(Target *parent, Core::Id id) GenericBuildConfiguration::GenericBuildConfiguration(Target *parent, Core::Id id)
: BuildConfiguration(parent, id) : BuildConfiguration(parent, id)
{ { }
}
GenericBuildConfiguration::GenericBuildConfiguration(Target *parent, GenericBuildConfiguration *source) : GenericBuildConfiguration::GenericBuildConfiguration(Target *parent, GenericBuildConfiguration *source) :
BuildConfiguration(parent, source) BuildConfiguration(parent, source)

View File

@@ -23,8 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef GENERICBUILDCONFIGURATION_H #pragma once
#define GENERICBUILDCONFIGURATION_H
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/namedwidget.h> #include <projectexplorer/namedwidget.h>
@@ -93,16 +92,13 @@ class GenericBuildSettingsWidget : public ProjectExplorer::NamedWidget
public: public:
GenericBuildSettingsWidget(GenericBuildConfiguration *bc); GenericBuildSettingsWidget(GenericBuildConfiguration *bc);
private slots: private:
void buildDirectoryChanged(); void buildDirectoryChanged();
void environmentHasChanged(); void environmentHasChanged();
private:
Utils::PathChooser *m_pathChooser; Utils::PathChooser *m_pathChooser;
GenericBuildConfiguration *m_buildConfiguration; GenericBuildConfiguration *m_buildConfiguration;
}; };
} // namespace Internal } // namespace Internal
} // namespace GenericProjectManager } // namespace GenericProjectManager
#endif // GENERICBUILDCONFIGURATION_H

View File

@@ -60,15 +60,13 @@ const char MAKE_COMMAND_KEY[] = "GenericProjectManager.GenericMakeStep.MakeComma
const char CLEAN_KEY[] = "GenericProjectManager.GenericMakeStep.Clean"; const char CLEAN_KEY[] = "GenericProjectManager.GenericMakeStep.Clean";
GenericMakeStep::GenericMakeStep(BuildStepList *parent) : GenericMakeStep::GenericMakeStep(BuildStepList *parent) :
AbstractProcessStep(parent, Id(GENERIC_MS_ID)), AbstractProcessStep(parent, Id(GENERIC_MS_ID))
m_clean(false)
{ {
ctor(); ctor();
} }
GenericMakeStep::GenericMakeStep(BuildStepList *parent, const Id id) : GenericMakeStep::GenericMakeStep(BuildStepList *parent, const Id id) :
AbstractProcessStep(parent, id), AbstractProcessStep(parent, id)
m_clean(false)
{ {
ctor(); ctor();
} }
@@ -218,8 +216,8 @@ void GenericMakeStep::setBuildTarget(const QString &target, bool on)
// GenericMakeStepConfigWidget // GenericMakeStepConfigWidget
// //
GenericMakeStepConfigWidget::GenericMakeStepConfigWidget(GenericMakeStep *makeStep) GenericMakeStepConfigWidget::GenericMakeStepConfigWidget(GenericMakeStep *makeStep) :
: m_makeStep(makeStep) m_makeStep(makeStep)
{ {
m_ui = new Ui::GenericMakeStep; m_ui = new Ui::GenericMakeStep;
m_ui->setupUi(this); m_ui->setupUi(this);

View File

@@ -23,20 +23,18 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef GENERICMAKESTEP_H #pragma once
#define GENERICMAKESTEP_H
#include <projectexplorer/abstractprocessstep.h> #include <projectexplorer/abstractprocessstep.h>
QT_BEGIN_NAMESPACE QT_FORWARD_DECLARE_CLASS(QListWidgetItem);
class QListWidgetItem;
QT_END_NAMESPACE
namespace GenericProjectManager { namespace GenericProjectManager {
namespace Internal { namespace Internal {
class GenericMakeStepConfigWidget; class GenericMakeStepConfigWidget;
class GenericMakeStepFactory; class GenericMakeStepFactory;
namespace Ui { class GenericMakeStep; } namespace Ui { class GenericMakeStep; }
class GenericMakeStep : public ProjectExplorer::AbstractProcessStep class GenericMakeStep : public ProjectExplorer::AbstractProcessStep
@@ -75,7 +73,7 @@ private:
QStringList m_buildTargets; QStringList m_buildTargets;
QString m_makeArguments; QString m_makeArguments;
QString m_makeCommand; QString m_makeCommand;
bool m_clean; bool m_clean = false;
}; };
class GenericMakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget class GenericMakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
@@ -83,10 +81,11 @@ class GenericMakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidge
Q_OBJECT Q_OBJECT
public: public:
GenericMakeStepConfigWidget(GenericMakeStep *makeStep); explicit GenericMakeStepConfigWidget(GenericMakeStep *makeStep);
~GenericMakeStepConfigWidget(); ~GenericMakeStepConfigWidget() override;
QString displayName() const;
QString summaryText() const; QString displayName() const override;
QString summaryText() const override;
private slots: private slots:
void itemChanged(QListWidgetItem *item); void itemChanged(QListWidgetItem *item);
@@ -124,5 +123,3 @@ public:
} // namespace Internal } // namespace Internal
} // namespace GenericProjectManager } // namespace GenericProjectManager
#endif // GENERICMAKESTEP_H

View File

@@ -23,8 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef GENERICPROJECT_H #pragma once
#define GENERICPROJECT_H
#include "genericprojectmanager.h" #include "genericprojectmanager.h"
#include "genericprojectnodes.h" #include "genericprojectnodes.h"
@@ -128,5 +127,3 @@ private:
} // namespace Internal } // namespace Internal
} // namespace GenericProjectManager } // namespace GenericProjectManager
#endif // GENERICPROJECT_H

View File

@@ -23,8 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef GENERICPROJECTCONSTANTS_H #pragma once
#define GENERICPROJECTCONSTANTS_H
namespace GenericProjectManager { namespace GenericProjectManager {
namespace Constants { namespace Constants {
@@ -35,14 +34,8 @@ const char GENERICMIMETYPE[] = "text/x-generic-project"; // ### FIXME
// Contexts // Contexts
const char FILES_EDITOR_ID[] = "QT4.FilesEditor"; const char FILES_EDITOR_ID[] = "QT4.FilesEditor";
const char FILES_MIMETYPE[] = "application/vnd.qtcreator.generic.files";
const char INCLUDES_MIMETYPE[] = "application/vnd.qtcreator.generic.includes";
const char CONFIG_MIMETYPE[] = "application/vnd.qtcreator.generic.config";
// Project // Project
const char GENERICPROJECT_ID[] = "GenericProjectManager.GenericProject"; const char GENERICPROJECT_ID[] = "GenericProjectManager.GenericProject";
} // namespace Constants } // namespace Constants
} // namespace GenericProjectManager } // namespace GenericProjectManager
#endif // GENERICPROJECTCONSTANTS_H

View File

@@ -46,9 +46,9 @@ ProjectFilesFactory::ProjectFilesFactory()
{ {
setId(Constants::FILES_EDITOR_ID); setId(Constants::FILES_EDITOR_ID);
setDisplayName(QCoreApplication::translate("OpenWith::Editors", ".files Editor")); setDisplayName(QCoreApplication::translate("OpenWith::Editors", ".files Editor"));
addMimeType(Constants::FILES_MIMETYPE); addMimeType("application/vnd.qtcreator.generic.files");
addMimeType(Constants::INCLUDES_MIMETYPE); addMimeType("application/vnd.qtcreator.generic.includes");
addMimeType(Constants::CONFIG_MIMETYPE); addMimeType("application/vnd.qtcreator.generic.config");
setDocumentCreator([]() { return new TextDocument(Constants::FILES_EDITOR_ID); }); setDocumentCreator([]() { return new TextDocument(Constants::FILES_EDITOR_ID); });
setEditorActionHandlers(TextEditorActionHandler::None); setEditorActionHandlers(TextEditorActionHandler::None);

View File

@@ -23,8 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef GENERICPROJECTFILESEDITOR_H #pragma once
#define GENERICPROJECTFILESEDITOR_H
#include <texteditor/texteditor.h> #include <texteditor/texteditor.h>
@@ -39,5 +38,3 @@ public:
} // namespace Internal } // namespace Internal
} // namespace GenericProjectManager } // namespace GenericProjectManager
#endif // GENERICPROJECTFILESEDITOR_H

View File

@@ -37,9 +37,6 @@
namespace GenericProjectManager { namespace GenericProjectManager {
namespace Internal { namespace Internal {
Manager::Manager()
{ }
QString Manager::mimeType() const QString Manager::mimeType() const
{ {
return QLatin1String(Constants::GENERICMIMETYPE); return QLatin1String(Constants::GENERICMIMETYPE);

View File

@@ -23,8 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef GENERICPROJECTMANAGER_H #pragma once
#define GENERICPROJECTMANAGER_H
#include <projectexplorer/iprojectmanager.h> #include <projectexplorer/iprojectmanager.h>
@@ -38,10 +37,8 @@ class Manager : public ProjectExplorer::IProjectManager
Q_OBJECT Q_OBJECT
public: public:
Manager(); virtual QString mimeType() const override;
virtual ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString) override;
virtual QString mimeType() const;
virtual ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString);
void registerProject(GenericProject *project); void registerProject(GenericProject *project);
void unregisterProject(GenericProject *project); void unregisterProject(GenericProject *project);
@@ -52,5 +49,3 @@ private:
} // namespace Internal } // namespace Internal
} // namespace GenericProjectManager } // namespace GenericProjectManager
#endif // GENERICPROJECTMANAGER_H

View File

@@ -37,9 +37,9 @@ using namespace ProjectExplorer;
namespace GenericProjectManager { namespace GenericProjectManager {
namespace Internal { namespace Internal {
GenericProjectNode::GenericProjectNode(GenericProject *project) GenericProjectNode::GenericProjectNode(GenericProject *project) :
: ProjectNode(project->projectFilePath()) ProjectNode(project->projectFilePath()),
, m_project(project) m_project(project)
{ {
setDisplayName(project->projectFilePath().toFileInfo().completeBaseName()); setDisplayName(project->projectFilePath().toFileInfo().completeBaseName());
} }

View File

@@ -23,8 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef GENERICPROJECTNODE_H #pragma once
#define GENERICPROJECTNODE_H
#include <projectexplorer/projectnodes.h> #include <projectexplorer/projectnodes.h>
@@ -42,7 +41,7 @@ class GenericProject;
class GenericProjectNode : public ProjectExplorer::ProjectNode class GenericProjectNode : public ProjectExplorer::ProjectNode
{ {
public: public:
GenericProjectNode(GenericProject *project); explicit GenericProjectNode(GenericProject *project);
bool showInSimpleTree() const override; bool showInSimpleTree() const override;
@@ -61,10 +60,8 @@ private:
void removeEmptySubFolders(FolderNode *gparent, FolderNode *parent); void removeEmptySubFolders(FolderNode *gparent, FolderNode *parent);
private: private:
GenericProject *m_project; GenericProject *const m_project;
}; };
} // namespace Internal } // namespace Internal
} // namespace GenericProjectManager } // namespace GenericProjectManager
#endif // GENERICPROJECTNODE_H

View File

@@ -23,8 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef GENERICPROJECTPLUGIN_H #pragma once
#define GENERICPROJECTPLUGIN_H
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
@@ -45,11 +44,8 @@ class GenericProjectPlugin : public ExtensionSystem::IPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "GenericProjectManager.json") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "GenericProjectManager.json")
public: public:
bool initialize(const QStringList &arguments, QString *errorString); bool initialize(const QStringList &arguments, QString *errorString) override;
void extensionsInitialized() {} void extensionsInitialized() override { }
private slots:
void editFiles();
#ifdef WITH_TESTS #ifdef WITH_TESTS
private slots: private slots:
@@ -57,9 +53,10 @@ private slots:
void test_mixed1(); void test_mixed1();
void test_mixed2(); void test_mixed2();
#endif // WITH_TESTS #endif // WITH_TESTS
private:
void editFiles();
}; };
} // namespace Internal } // namespace Internal
} // namespace GenericProject } // namespace GenericProject
#endif // GENERICPROJECTPLUGIN_H

View File

@@ -23,8 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef GENERICPROJECTWIZARD_H #pragma once
#define GENERICPROJECTWIZARD_H
#include <coreplugin/basefilewizard.h> #include <coreplugin/basefilewizard.h>
#include <coreplugin/basefilewizardfactory.h> #include <coreplugin/basefilewizardfactory.h>
@@ -72,5 +71,3 @@ protected:
} // namespace Internal } // namespace Internal
} // namespace GenericProjectManager } // namespace GenericProjectManager
#endif // GENERICPROJECTWIZARD_H