forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -38,14 +38,6 @@
|
|||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace ClangCodeModel::Internal;
|
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
|
QString ClangProjectSettingsPanelFactory::displayName() const
|
||||||
{
|
{
|
||||||
return ClangProjectSettingsWidget::tr("Clang Settings");
|
return ClangProjectSettingsWidget::tr("Clang Settings");
|
||||||
|
@@ -42,7 +42,6 @@ namespace Internal {
|
|||||||
class ClangProjectSettingsPanelFactory: public ProjectExplorer::IProjectPanelFactory
|
class ClangProjectSettingsPanelFactory: public ProjectExplorer::IProjectPanelFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QString id() const;
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
int priority() const;
|
int priority() const;
|
||||||
bool supports(ProjectExplorer::Project *project);
|
bool supports(ProjectExplorer::Project *project);
|
||||||
|
@@ -62,16 +62,6 @@ QString BuildSettingsPanelFactory::id() const
|
|||||||
return QLatin1String(BUILDSETTINGS_PANEL_ID);
|
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)
|
bool BuildSettingsPanelFactory::supports(Target *target)
|
||||||
{
|
{
|
||||||
return IBuildConfigurationFactory::find(target);
|
return IBuildConfigurationFactory::find(target);
|
||||||
|
@@ -56,8 +56,6 @@ class BuildSettingsPanelFactory : public ITargetPanelFactory
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QString id() const;
|
QString id() const;
|
||||||
QString displayName() const;
|
|
||||||
int priority() const;
|
|
||||||
|
|
||||||
bool supports(Target *target);
|
bool supports(Target *target);
|
||||||
PropertiesPanel *createPanel(Target *target);
|
PropertiesPanel *createPanel(Target *target);
|
||||||
|
@@ -38,11 +38,6 @@ using namespace TextEditor;
|
|||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace ProjectExplorer::Internal;
|
using namespace ProjectExplorer::Internal;
|
||||||
|
|
||||||
QString CodeStyleSettingsPanelFactory::id() const
|
|
||||||
{
|
|
||||||
return QLatin1String(CODESTYLESETTINGS_PANEL_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CodeStyleSettingsPanelFactory::displayName() const
|
QString CodeStyleSettingsPanelFactory::displayName() const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("CodeStyleSettingsPanelFactory", "Code Style");
|
return QCoreApplication::translate("CodeStyleSettingsPanelFactory", "Code Style");
|
||||||
|
@@ -39,12 +39,9 @@ class EditorConfiguration;
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
const char CODESTYLESETTINGS_PANEL_ID[] = "ProjectExplorer.CodeStyleSettingsPanel";
|
|
||||||
|
|
||||||
class CodeStyleSettingsPanelFactory : public IProjectPanelFactory
|
class CodeStyleSettingsPanelFactory : public IProjectPanelFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QString id() const;
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
int priority() const;
|
int priority() const;
|
||||||
PropertiesPanel *createPanel(Project *project);
|
PropertiesPanel *createPanel(Project *project);
|
||||||
|
@@ -235,11 +235,6 @@ DependenciesWidget::DependenciesWidget(Project *project, QWidget *parent)
|
|||||||
// DependenciesPanelFactory
|
// DependenciesPanelFactory
|
||||||
//
|
//
|
||||||
|
|
||||||
QString DependenciesPanelFactory::id() const
|
|
||||||
{
|
|
||||||
return QLatin1String("ProjectExplorer.DependenciesPanel");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString DependenciesPanelFactory::displayName() const
|
QString DependenciesPanelFactory::displayName() const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("DependenciesPanelFactory", "Dependencies");
|
return QCoreApplication::translate("DependenciesPanelFactory", "Dependencies");
|
||||||
|
@@ -49,7 +49,6 @@ class DependenciesPanelFactory : public IProjectPanelFactory
|
|||||||
public:
|
public:
|
||||||
DependenciesPanelFactory() {}
|
DependenciesPanelFactory() {}
|
||||||
|
|
||||||
QString id() const;
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
int priority() const;
|
int priority() const;
|
||||||
bool supports(Project *project);
|
bool supports(Project *project);
|
||||||
|
@@ -37,11 +37,6 @@
|
|||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace ProjectExplorer::Internal;
|
using namespace ProjectExplorer::Internal;
|
||||||
|
|
||||||
QString EditorSettingsPanelFactory::id() const
|
|
||||||
{
|
|
||||||
return QLatin1String(EDITORSETTINGS_PANEL_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString EditorSettingsPanelFactory::displayName() const
|
QString EditorSettingsPanelFactory::displayName() const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("EditorSettingsPanelFactory", "Editor");
|
return QCoreApplication::translate("EditorSettingsPanelFactory", "Editor");
|
||||||
|
@@ -39,12 +39,9 @@ class EditorConfiguration;
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
const char EDITORSETTINGS_PANEL_ID[] = "ProjectExplorer.EditorSettingsPanel";
|
|
||||||
|
|
||||||
class EditorSettingsPanelFactory : public IProjectPanelFactory
|
class EditorSettingsPanelFactory : public IProjectPanelFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QString id() const;
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
int priority() const;
|
int priority() const;
|
||||||
PropertiesPanel *createPanel(Project *project);
|
PropertiesPanel *createPanel(Project *project);
|
||||||
|
@@ -66,32 +66,28 @@ private:
|
|||||||
QIcon m_icon;
|
QIcon m_icon;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT IPanelFactory : public QObject
|
class PROJECTEXPLORER_EXPORT IProjectPanelFactory : 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
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
virtual bool supports(Project *project) = 0;
|
virtual bool supports(Project *project) = 0;
|
||||||
virtual PropertiesPanel *createPanel(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
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
virtual bool supports(Target *target) = 0;
|
virtual bool supports(Target *target) = 0;
|
||||||
virtual PropertiesPanel *createPanel(Target *target) = 0;
|
virtual PropertiesPanel *createPanel(Target *target) = 0;
|
||||||
|
|
||||||
|
virtual QString id() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -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_SETTING[] = "GenericProject/ShowFileFilter";
|
||||||
const char SHOW_FILE_FILTER_DEFAULT[] = "*.c; *.cc; *.cpp; *.cp; *.cxx; *.c++; *.h; *.hh; *.hpp; *.hxx;";
|
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
|
} // namespace Constants
|
||||||
|
|
||||||
// Run modes
|
// Run modes
|
||||||
|
@@ -340,7 +340,7 @@ void ProjectWindow::registerProject(ProjectExplorer::Project *project)
|
|||||||
|
|
||||||
// Add the project specific pages
|
// Add the project specific pages
|
||||||
QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>();
|
QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>();
|
||||||
Utils::sort(factories, &IPanelFactory::prioritySort);
|
Utils::sort(factories, &IProjectPanelFactory::prioritySort);
|
||||||
foreach (IProjectPanelFactory *panelFactory, factories) {
|
foreach (IProjectPanelFactory *panelFactory, factories) {
|
||||||
if (panelFactory->supports(project))
|
if (panelFactory->supports(project))
|
||||||
subtabs << panelFactory->displayName();
|
subtabs << panelFactory->displayName();
|
||||||
@@ -399,7 +399,7 @@ void ProjectWindow::showProperties(int index, int subIndex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>();
|
QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>();
|
||||||
Utils::sort(factories, &IPanelFactory::prioritySort);
|
Utils::sort(factories, &IProjectPanelFactory::prioritySort);
|
||||||
foreach (IProjectPanelFactory *panelFactory, factories) {
|
foreach (IProjectPanelFactory *panelFactory, factories) {
|
||||||
if (panelFactory->supports(project)) {
|
if (panelFactory->supports(project)) {
|
||||||
if (subIndex == pos) {
|
if (subIndex == pos) {
|
||||||
|
@@ -91,16 +91,6 @@ QString RunSettingsPanelFactory::id() const
|
|||||||
return QLatin1String(RUNSETTINGS_PANEL_ID);
|
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)
|
bool RunSettingsPanelFactory::supports(Target *target)
|
||||||
{
|
{
|
||||||
Q_UNUSED(target);
|
Q_UNUSED(target);
|
||||||
|
@@ -62,8 +62,6 @@ class RunSettingsPanelFactory : public ITargetPanelFactory
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QString id() const;
|
QString id() const;
|
||||||
QString displayName() const;
|
|
||||||
int priority() const;
|
|
||||||
bool supports(Target *target);
|
bool supports(Target *target);
|
||||||
PropertiesPanel *createPanel(Target *target);
|
PropertiesPanel *createPanel(Target *target);
|
||||||
};
|
};
|
||||||
|
@@ -52,11 +52,6 @@ UnconfiguredProjectPanel::UnconfiguredProjectPanel()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString UnconfiguredProjectPanel::id() const
|
|
||||||
{
|
|
||||||
return QLatin1String(Constants::UNCONFIGURED_PANEL_PAGE_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UnconfiguredProjectPanel::displayName() const
|
QString UnconfiguredProjectPanel::displayName() const
|
||||||
{
|
{
|
||||||
return tr("Configure Project");
|
return tr("Configure Project");
|
||||||
|
@@ -47,7 +47,6 @@ class UnconfiguredProjectPanel : public IProjectPanelFactory
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
UnconfiguredProjectPanel();
|
UnconfiguredProjectPanel();
|
||||||
virtual QString id() const;
|
|
||||||
virtual QString displayName() const;
|
virtual QString displayName() const;
|
||||||
int priority() const;
|
int priority() const;
|
||||||
virtual bool supports(Project *project);
|
virtual bool supports(Project *project);
|
||||||
|
Reference in New Issue
Block a user