Commit ff303ee9 authored by Tobias Hunger's avatar Tobias Hunger

GenericProject: Modernize

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

Change-Id: Ib33b6a6aa1a285d281f3d8b940fe654af3941554
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent eb07fd92
......@@ -34,8 +34,6 @@
#include <utils/wizard.h>
#include <QVBoxLayout>
#include <QLineEdit>
#include <QPushButton>
namespace GenericProjectManager {
namespace Internal {
......
......@@ -23,19 +23,11 @@
**
****************************************************************************/
#ifndef FILESSELECTIONWIZARDPAGE_H
#define FILESSELECTIONWIZARDPAGE_H
#include <QWizardPage>
#pragma once
#include <utils/fileutils.h>
QT_BEGIN_NAMESPACE
class QVBoxLayout;
class QLabel;
class QTreeView;
class QLineEdit;
QT_END_NAMESPACE
#include <QWizardPage>
namespace ProjectExplorer { class SelectableFilesWidget; }
......@@ -50,9 +42,9 @@ class FilesSelectionWizardPage : public QWizardPage
public:
FilesSelectionWizardPage(GenericProjectWizardDialog *genericProjectWizard, QWidget *parent = 0);
bool isComplete() const;
void initializePage();
void cleanupPage();
bool isComplete() const override;
void initializePage() override;
void cleanupPage() override;
Utils::FileNameList selectedFiles() const;
Utils::FileNameList selectedPaths() const;
......@@ -63,5 +55,3 @@ private:
} // namespace Internal
} // namespace GenericProjectManager
#endif // FILESSELECTIONWIZARDPAGE_H
......@@ -51,13 +51,11 @@ const char GENERIC_BC_ID[] = "GenericProjectManager.GenericBuildConfiguration";
GenericBuildConfiguration::GenericBuildConfiguration(Target *parent)
: BuildConfiguration(parent, Core::Id(GENERIC_BC_ID))
{
}
{ }
GenericBuildConfiguration::GenericBuildConfiguration(Target *parent, Core::Id id)
: BuildConfiguration(parent, id)
{
}
{ }
GenericBuildConfiguration::GenericBuildConfiguration(Target *parent, GenericBuildConfiguration *source) :
BuildConfiguration(parent, source)
......
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef GENERICBUILDCONFIGURATION_H
#define GENERICBUILDCONFIGURATION_H
#pragma once
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/namedwidget.h>
......@@ -93,16 +92,13 @@ class GenericBuildSettingsWidget : public ProjectExplorer::NamedWidget
public:
GenericBuildSettingsWidget(GenericBuildConfiguration *bc);
private slots:
private:
void buildDirectoryChanged();
void environmentHasChanged();
private:
Utils::PathChooser *m_pathChooser;
GenericBuildConfiguration *m_buildConfiguration;
};
} // namespace Internal
} // namespace GenericProjectManager
#endif // GENERICBUILDCONFIGURATION_H
......@@ -60,15 +60,13 @@ const char MAKE_COMMAND_KEY[] = "GenericProjectManager.GenericMakeStep.MakeComma
const char CLEAN_KEY[] = "GenericProjectManager.GenericMakeStep.Clean";
GenericMakeStep::GenericMakeStep(BuildStepList *parent) :
AbstractProcessStep(parent, Id(GENERIC_MS_ID)),
m_clean(false)
AbstractProcessStep(parent, Id(GENERIC_MS_ID))
{
ctor();
}
GenericMakeStep::GenericMakeStep(BuildStepList *parent, const Id id) :
AbstractProcessStep(parent, id),
m_clean(false)
AbstractProcessStep(parent, id)
{
ctor();
}
......@@ -218,8 +216,8 @@ void GenericMakeStep::setBuildTarget(const QString &target, bool on)
// GenericMakeStepConfigWidget
//
GenericMakeStepConfigWidget::GenericMakeStepConfigWidget(GenericMakeStep *makeStep)
: m_makeStep(makeStep)
GenericMakeStepConfigWidget::GenericMakeStepConfigWidget(GenericMakeStep *makeStep) :
m_makeStep(makeStep)
{
m_ui = new Ui::GenericMakeStep;
m_ui->setupUi(this);
......
......@@ -23,20 +23,18 @@
**
****************************************************************************/
#ifndef GENERICMAKESTEP_H
#define GENERICMAKESTEP_H
#pragma once
#include <projectexplorer/abstractprocessstep.h>
QT_BEGIN_NAMESPACE
class QListWidgetItem;
QT_END_NAMESPACE
QT_FORWARD_DECLARE_CLASS(QListWidgetItem);
namespace GenericProjectManager {
namespace Internal {
class GenericMakeStepConfigWidget;
class GenericMakeStepFactory;
namespace Ui { class GenericMakeStep; }
class GenericMakeStep : public ProjectExplorer::AbstractProcessStep
......@@ -75,7 +73,7 @@ private:
QStringList m_buildTargets;
QString m_makeArguments;
QString m_makeCommand;
bool m_clean;
bool m_clean = false;
};
class GenericMakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
......@@ -83,10 +81,11 @@ class GenericMakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidge
Q_OBJECT
public:
GenericMakeStepConfigWidget(GenericMakeStep *makeStep);
~GenericMakeStepConfigWidget();
QString displayName() const;
QString summaryText() const;
explicit GenericMakeStepConfigWidget(GenericMakeStep *makeStep);
~GenericMakeStepConfigWidget() override;
QString displayName() const override;
QString summaryText() const override;
private slots:
void itemChanged(QListWidgetItem *item);
......@@ -124,5 +123,3 @@ public:
} // namespace Internal
} // namespace GenericProjectManager
#endif // GENERICMAKESTEP_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef GENERICPROJECT_H
#define GENERICPROJECT_H
#pragma once
#include "genericprojectmanager.h"
#include "genericprojectnodes.h"
......@@ -128,5 +127,3 @@ private:
} // namespace Internal
} // namespace GenericProjectManager
#endif // GENERICPROJECT_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef GENERICPROJECTCONSTANTS_H
#define GENERICPROJECTCONSTANTS_H
#pragma once
namespace GenericProjectManager {
namespace Constants {
......@@ -35,14 +34,8 @@ const char GENERICMIMETYPE[] = "text/x-generic-project"; // ### FIXME
// Contexts
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
const char GENERICPROJECT_ID[] = "GenericProjectManager.GenericProject";
} // namespace Constants
} // namespace GenericProjectManager
#endif // GENERICPROJECTCONSTANTS_H
......@@ -46,9 +46,9 @@ ProjectFilesFactory::ProjectFilesFactory()
{
setId(Constants::FILES_EDITOR_ID);
setDisplayName(QCoreApplication::translate("OpenWith::Editors", ".files Editor"));
addMimeType(Constants::FILES_MIMETYPE);
addMimeType(Constants::INCLUDES_MIMETYPE);
addMimeType(Constants::CONFIG_MIMETYPE);
addMimeType("application/vnd.qtcreator.generic.files");
addMimeType("application/vnd.qtcreator.generic.includes");
addMimeType("application/vnd.qtcreator.generic.config");
setDocumentCreator([]() { return new TextDocument(Constants::FILES_EDITOR_ID); });
setEditorActionHandlers(TextEditorActionHandler::None);
......
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef GENERICPROJECTFILESEDITOR_H
#define GENERICPROJECTFILESEDITOR_H
#pragma once
#include <texteditor/texteditor.h>
......@@ -39,5 +38,3 @@ public:
} // namespace Internal
} // namespace GenericProjectManager
#endif // GENERICPROJECTFILESEDITOR_H
......@@ -37,9 +37,6 @@
namespace GenericProjectManager {
namespace Internal {
Manager::Manager()
{ }
QString Manager::mimeType() const
{
return QLatin1String(Constants::GENERICMIMETYPE);
......
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef GENERICPROJECTMANAGER_H
#define GENERICPROJECTMANAGER_H
#pragma once
#include <projectexplorer/iprojectmanager.h>
......@@ -38,10 +37,8 @@ class Manager : public ProjectExplorer::IProjectManager
Q_OBJECT
public:
Manager();
virtual QString mimeType() const;
virtual ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString);
virtual QString mimeType() const override;
virtual ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString) override;
void registerProject(GenericProject *project);
void unregisterProject(GenericProject *project);
......@@ -52,5 +49,3 @@ private:
} // namespace Internal
} // namespace GenericProjectManager
#endif // GENERICPROJECTMANAGER_H
......@@ -37,9 +37,9 @@ using namespace ProjectExplorer;
namespace GenericProjectManager {
namespace Internal {
GenericProjectNode::GenericProjectNode(GenericProject *project)
: ProjectNode(project->projectFilePath())
, m_project(project)
GenericProjectNode::GenericProjectNode(GenericProject *project) :
ProjectNode(project->projectFilePath()),
m_project(project)
{
setDisplayName(project->projectFilePath().toFileInfo().completeBaseName());
}
......
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef GENERICPROJECTNODE_H
#define GENERICPROJECTNODE_H
#pragma once
#include <projectexplorer/projectnodes.h>
......@@ -42,7 +41,7 @@ class GenericProject;
class GenericProjectNode : public ProjectExplorer::ProjectNode
{
public:
GenericProjectNode(GenericProject *project);
explicit GenericProjectNode(GenericProject *project);
bool showInSimpleTree() const override;
......@@ -61,10 +60,8 @@ private:
void removeEmptySubFolders(FolderNode *gparent, FolderNode *parent);
private:
GenericProject *m_project;
GenericProject *const m_project;
};
} // namespace Internal
} // namespace GenericProjectManager
#endif // GENERICPROJECTNODE_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef GENERICPROJECTPLUGIN_H
#define GENERICPROJECTPLUGIN_H
#pragma once
#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")
public:
bool initialize(const QStringList &arguments, QString *errorString);
void extensionsInitialized() {}
private slots:
void editFiles();
bool initialize(const QStringList &arguments, QString *errorString) override;
void extensionsInitialized() override { }
#ifdef WITH_TESTS
private slots:
......@@ -57,9 +53,10 @@ private slots:
void test_mixed1();
void test_mixed2();
#endif // WITH_TESTS
private:
void editFiles();
};
} // namespace Internal
} // namespace GenericProject
#endif // GENERICPROJECTPLUGIN_H
......@@ -23,8 +23,7 @@
**
****************************************************************************/
#ifndef GENERICPROJECTWIZARD_H
#define GENERICPROJECTWIZARD_H
#pragma once
#include <coreplugin/basefilewizard.h>
#include <coreplugin/basefilewizardfactory.h>
......@@ -72,5 +71,3 @@ protected:
} // namespace Internal
} // namespace GenericProjectManager
#endif // GENERICPROJECTWIZARD_H
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