diff options
author | Daniel Teske <daniel.teske@digia.com> | 2014-07-11 13:20:40 +0200 |
---|---|---|
committer | Daniel Teske <daniel.teske@digia.com> | 2014-07-22 16:40:52 +0200 |
commit | 96d9f05fad69ea6e64d9d265e183191622d473c9 (patch) | |
tree | c9d3c32c9dd06696a480105fc8f76740bdaadb09 /src | |
parent | f42358a16e19bdbb39293960f6fbfb1b54d24f98 (diff) | |
download | qt-creator-96d9f05fad69ea6e64d9d265e183191622d473c9.tar.gz |
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 <tobias.hunger@digia.com>
Diffstat (limited to 'src')
17 files changed, 11 insertions, 79 deletions
diff --git a/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.cpp b/src/plugins/clangcodemodel/clangprojectsettingspropertiespage.cpp index 37760aa4ee..fe994b11b5 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 7f826a4830..623301c8c5 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 976f748240..fa507a3c70 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 35333f8a4d..29b809cc13 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 fede40f9ea..8b320c5047 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 e2cb64a1fc..c5945590ca 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 d07807706f..1fbb99df51 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 7dcea402c4..3116bcb778 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 3382b83ab3..e26311d25e 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 4e06469c68..3848da1024 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 173a9b27e2..369de59dd7 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 +class PROJECTEXPLORER_EXPORT IProjectPanelFactory : public QObject { Q_OBJECT public: - virtual QString id() const = 0; + 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(IPanelFactory *a, IPanelFactory *b) - { return (a->priority() == b->priority() && a->id() < b->id()) + static bool prioritySort(IProjectPanelFactory *a, IProjectPanelFactory *b) + { return (a->priority() == b->priority() && a < b) || a->priority() < b->priority(); } }; -class PROJECTEXPLORER_EXPORT IProjectPanelFactory : public IPanelFactory -{ - Q_OBJECT -public: - virtual bool supports(Project *project) = 0; - virtual PropertiesPanel *createPanel(Project *project) = 0; -}; - -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 180e7a5741..54fb8c9457 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 8241ba3a67..5c11a1527c 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<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>(); - 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<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>(); - 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 6e4c1dd7e5..b9ca7e4d32 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 f1cad07038..90d10d379d 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 5651fee9aa..5ad194c257 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 7f6967ebfd..b50bbe5b0e 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); |