From 96d9f05fad69ea6e64d9d265e183191622d473c9 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Fri, 11 Jul 2014 13:20:40 +0200 Subject: [PATCH] ProjectExplorer: Remove IPanelFactory This was the common base class of IProjectPanelFactory and ITargetPanelFactory. Nothing was using the IPanelFactory interface, and there's actually no common interface between those classes. Of the old interface IPanelFactory: id() => only used in ITargetPanelFactory displayName() => only used in IProjectPanelFactory priority() => only used in IProjectPanelFactory This removes lots of boiler plate code for the unused functions. Change-Id: I8488a4e5134fd451907f02c45b7847673e4dc714 Reviewed-by: Tobias Hunger --- .../clangprojectsettingspropertiespage.cpp | 8 ------- .../clangprojectsettingspropertiespage.h | 1 - .../buildsettingspropertiespage.cpp | 10 -------- .../buildsettingspropertiespage.h | 2 -- .../codestylesettingspropertiespage.cpp | 5 ---- .../codestylesettingspropertiespage.h | 3 --- .../projectexplorer/dependenciespanel.cpp | 5 ---- .../projectexplorer/dependenciespanel.h | 1 - .../editorsettingspropertiespage.cpp | 5 ---- .../editorsettingspropertiespage.h | 3 --- .../projectexplorer/iprojectproperties.h | 24 ++++++++----------- .../projectexplorerconstants.h | 3 --- src/plugins/projectexplorer/projectwindow.cpp | 4 ++-- .../runsettingspropertiespage.cpp | 10 -------- .../runsettingspropertiespage.h | 2 -- .../unconfiguredprojectpanel.cpp | 5 ---- .../unconfiguredprojectpanel.h | 1 - 17 files changed, 12 insertions(+), 80 deletions(-) diff --git a/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.cpp b/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.cpp index 37760aa4eeb..fe994b11b54 100644 --- a/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.cpp +++ b/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.cpp @@ -38,14 +38,6 @@ using namespace ProjectExplorer; using namespace ClangCodeModel::Internal; -static const char CLANGPROJECTSETTINGS_PANEL_ID[] = "ClangCodeModel.ProjectPanel"; - - -QString ClangProjectSettingsPanelFactory::id() const -{ - return QLatin1String(CLANGPROJECTSETTINGS_PANEL_ID); -} - QString ClangProjectSettingsPanelFactory::displayName() const { return ClangProjectSettingsWidget::tr("Clang Settings"); diff --git a/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.h b/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.h index 7f826a4830d..623301c8c54 100644 --- a/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.h +++ b/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.h @@ -42,7 +42,6 @@ namespace Internal { class ClangProjectSettingsPanelFactory: public ProjectExplorer::IProjectPanelFactory { public: - QString id() const; QString displayName() const; int priority() const; bool supports(ProjectExplorer::Project *project); diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp index 976f748240f..fa507a3c70c 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp @@ -62,16 +62,6 @@ QString BuildSettingsPanelFactory::id() const return QLatin1String(BUILDSETTINGS_PANEL_ID); } -QString BuildSettingsPanelFactory::displayName() const -{ - return QCoreApplication::translate("BuildSettingsPanelFactory", "Build Settings"); -} - -int BuildSettingsPanelFactory::priority() const -{ - return 10; -} - bool BuildSettingsPanelFactory::supports(Target *target) { return IBuildConfigurationFactory::find(target); diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.h b/src/plugins/projectexplorer/buildsettingspropertiespage.h index 35333f8a4d4..29b809cc138 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.h +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.h @@ -56,8 +56,6 @@ class BuildSettingsPanelFactory : public ITargetPanelFactory { public: QString id() const; - QString displayName() const; - int priority() const; bool supports(Target *target); PropertiesPanel *createPanel(Target *target); diff --git a/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp b/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp index fede40f9eaf..8b320c5047f 100644 --- a/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp @@ -38,11 +38,6 @@ using namespace TextEditor; using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; -QString CodeStyleSettingsPanelFactory::id() const -{ - return QLatin1String(CODESTYLESETTINGS_PANEL_ID); -} - QString CodeStyleSettingsPanelFactory::displayName() const { return QCoreApplication::translate("CodeStyleSettingsPanelFactory", "Code Style"); diff --git a/src/plugins/projectexplorer/codestylesettingspropertiespage.h b/src/plugins/projectexplorer/codestylesettingspropertiespage.h index e2cb64a1fc4..c5945590cab 100644 --- a/src/plugins/projectexplorer/codestylesettingspropertiespage.h +++ b/src/plugins/projectexplorer/codestylesettingspropertiespage.h @@ -39,12 +39,9 @@ class EditorConfiguration; namespace Internal { -const char CODESTYLESETTINGS_PANEL_ID[] = "ProjectExplorer.CodeStyleSettingsPanel"; - class CodeStyleSettingsPanelFactory : public IProjectPanelFactory { public: - QString id() const; QString displayName() const; int priority() const; PropertiesPanel *createPanel(Project *project); diff --git a/src/plugins/projectexplorer/dependenciespanel.cpp b/src/plugins/projectexplorer/dependenciespanel.cpp index d07807706fd..1fbb99df51c 100644 --- a/src/plugins/projectexplorer/dependenciespanel.cpp +++ b/src/plugins/projectexplorer/dependenciespanel.cpp @@ -235,11 +235,6 @@ DependenciesWidget::DependenciesWidget(Project *project, QWidget *parent) // DependenciesPanelFactory // -QString DependenciesPanelFactory::id() const -{ - return QLatin1String("ProjectExplorer.DependenciesPanel"); -} - QString DependenciesPanelFactory::displayName() const { return QCoreApplication::translate("DependenciesPanelFactory", "Dependencies"); diff --git a/src/plugins/projectexplorer/dependenciespanel.h b/src/plugins/projectexplorer/dependenciespanel.h index 7dcea402c45..3116bcb7786 100644 --- a/src/plugins/projectexplorer/dependenciespanel.h +++ b/src/plugins/projectexplorer/dependenciespanel.h @@ -49,7 +49,6 @@ class DependenciesPanelFactory : public IProjectPanelFactory public: DependenciesPanelFactory() {} - QString id() const; QString displayName() const; int priority() const; bool supports(Project *project); diff --git a/src/plugins/projectexplorer/editorsettingspropertiespage.cpp b/src/plugins/projectexplorer/editorsettingspropertiespage.cpp index 3382b83ab3f..e26311d25ec 100644 --- a/src/plugins/projectexplorer/editorsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/editorsettingspropertiespage.cpp @@ -37,11 +37,6 @@ using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; -QString EditorSettingsPanelFactory::id() const -{ - return QLatin1String(EDITORSETTINGS_PANEL_ID); -} - QString EditorSettingsPanelFactory::displayName() const { return QCoreApplication::translate("EditorSettingsPanelFactory", "Editor"); diff --git a/src/plugins/projectexplorer/editorsettingspropertiespage.h b/src/plugins/projectexplorer/editorsettingspropertiespage.h index 4e06469c686..3848da10248 100644 --- a/src/plugins/projectexplorer/editorsettingspropertiespage.h +++ b/src/plugins/projectexplorer/editorsettingspropertiespage.h @@ -39,12 +39,9 @@ class EditorConfiguration; namespace Internal { -const char EDITORSETTINGS_PANEL_ID[] = "ProjectExplorer.EditorSettingsPanel"; - class EditorSettingsPanelFactory : public IProjectPanelFactory { public: - QString id() const; QString displayName() const; int priority() const; PropertiesPanel *createPanel(Project *project); diff --git a/src/plugins/projectexplorer/iprojectproperties.h b/src/plugins/projectexplorer/iprojectproperties.h index 173a9b27e2e..369de59dd7b 100644 --- a/src/plugins/projectexplorer/iprojectproperties.h +++ b/src/plugins/projectexplorer/iprojectproperties.h @@ -66,32 +66,28 @@ private: QIcon m_icon; }; -class PROJECTEXPLORER_EXPORT IPanelFactory : public QObject -{ - Q_OBJECT -public: - virtual QString id() const = 0; - virtual QString displayName() const = 0; - virtual int priority() const = 0; - static bool prioritySort(IPanelFactory *a, IPanelFactory *b) - { return (a->priority() == b->priority() && a->id() < b->id()) - || a->priority() < b->priority(); } -}; - -class PROJECTEXPLORER_EXPORT IProjectPanelFactory : public IPanelFactory +class PROJECTEXPLORER_EXPORT IProjectPanelFactory : public QObject { Q_OBJECT public: virtual bool supports(Project *project) = 0; virtual PropertiesPanel *createPanel(Project *project) = 0; + + virtual QString displayName() const = 0; + virtual int priority() const = 0; + static bool prioritySort(IProjectPanelFactory *a, IProjectPanelFactory *b) + { return (a->priority() == b->priority() && a < b) + || a->priority() < b->priority(); } }; -class PROJECTEXPLORER_EXPORT ITargetPanelFactory : public IPanelFactory +class PROJECTEXPLORER_EXPORT ITargetPanelFactory : public QObject { Q_OBJECT public: virtual bool supports(Target *target) = 0; virtual PropertiesPanel *createPanel(Target *target) = 0; + + virtual QString id() const = 0; }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h index 180e7a57417..54fb8c9457b 100644 --- a/src/plugins/projectexplorer/projectexplorerconstants.h +++ b/src/plugins/projectexplorer/projectexplorerconstants.h @@ -258,9 +258,6 @@ const char HIDE_FILE_FILTER_DEFAULT[] = "Makefile*; *.o; *.lo; *.la; *.obj; *~; const char SHOW_FILE_FILTER_SETTING[] = "GenericProject/ShowFileFilter"; const char SHOW_FILE_FILTER_DEFAULT[] = "*.c; *.cc; *.cpp; *.cp; *.cxx; *.c++; *.h; *.hh; *.hpp; *.hxx;"; -// Unconfigured Panel -const char UNCONFIGURED_PANEL_PAGE_ID[] = "UnconfiguredPanel"; - } // namespace Constants // Run modes diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp index 8241ba3a677..5c11a1527cf 100644 --- a/src/plugins/projectexplorer/projectwindow.cpp +++ b/src/plugins/projectexplorer/projectwindow.cpp @@ -340,7 +340,7 @@ void ProjectWindow::registerProject(ProjectExplorer::Project *project) // Add the project specific pages QList factories = ExtensionSystem::PluginManager::getObjects(); - Utils::sort(factories, &IPanelFactory::prioritySort); + Utils::sort(factories, &IProjectPanelFactory::prioritySort); foreach (IProjectPanelFactory *panelFactory, factories) { if (panelFactory->supports(project)) subtabs << panelFactory->displayName(); @@ -399,7 +399,7 @@ void ProjectWindow::showProperties(int index, int subIndex) } QList factories = ExtensionSystem::PluginManager::getObjects(); - Utils::sort(factories, &IPanelFactory::prioritySort); + Utils::sort(factories, &IProjectPanelFactory::prioritySort); foreach (IProjectPanelFactory *panelFactory, factories) { if (panelFactory->supports(project)) { if (subIndex == pos) { diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.cpp b/src/plugins/projectexplorer/runsettingspropertiespage.cpp index 6e4c1dd7e57..b9ca7e4d323 100644 --- a/src/plugins/projectexplorer/runsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/runsettingspropertiespage.cpp @@ -91,16 +91,6 @@ QString RunSettingsPanelFactory::id() const return QLatin1String(RUNSETTINGS_PANEL_ID); } -QString RunSettingsPanelFactory::displayName() const -{ - return RunSettingsWidget::tr("Run Settings"); -} - -int RunSettingsPanelFactory::priority() const -{ - return 20; -} - bool RunSettingsPanelFactory::supports(Target *target) { Q_UNUSED(target); diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.h b/src/plugins/projectexplorer/runsettingspropertiespage.h index f1cad07038e..90d10d379d2 100644 --- a/src/plugins/projectexplorer/runsettingspropertiespage.h +++ b/src/plugins/projectexplorer/runsettingspropertiespage.h @@ -62,8 +62,6 @@ class RunSettingsPanelFactory : public ITargetPanelFactory { public: QString id() const; - QString displayName() const; - int priority() const; bool supports(Target *target); PropertiesPanel *createPanel(Target *target); }; diff --git a/src/plugins/projectexplorer/unconfiguredprojectpanel.cpp b/src/plugins/projectexplorer/unconfiguredprojectpanel.cpp index 5651fee9aaa..5ad194c2578 100644 --- a/src/plugins/projectexplorer/unconfiguredprojectpanel.cpp +++ b/src/plugins/projectexplorer/unconfiguredprojectpanel.cpp @@ -52,11 +52,6 @@ UnconfiguredProjectPanel::UnconfiguredProjectPanel() { } -QString UnconfiguredProjectPanel::id() const -{ - return QLatin1String(Constants::UNCONFIGURED_PANEL_PAGE_ID); -} - QString UnconfiguredProjectPanel::displayName() const { return tr("Configure Project"); diff --git a/src/plugins/projectexplorer/unconfiguredprojectpanel.h b/src/plugins/projectexplorer/unconfiguredprojectpanel.h index 7f6967ebfdd..b50bbe5b0ea 100644 --- a/src/plugins/projectexplorer/unconfiguredprojectpanel.h +++ b/src/plugins/projectexplorer/unconfiguredprojectpanel.h @@ -47,7 +47,6 @@ class UnconfiguredProjectPanel : public IProjectPanelFactory Q_OBJECT public: UnconfiguredProjectPanel(); - virtual QString id() const; virtual QString displayName() const; int priority() const; virtual bool supports(Project *project);