diff options
author | Tobias Hunger <qt-info@nokia.com> | 2009-11-25 15:57:09 +0100 |
---|---|---|
committer | Tobias Hunger <qt-info@nokia.com> | 2009-11-25 16:02:47 +0100 |
commit | 426890b790789c8a51841480c2cd37418a0244f7 (patch) | |
tree | c32e8a3f814029bb874cf52707d14c0f1df56912 | |
parent | 53a3071580d968478a343e41555639a9a9559257 (diff) | |
download | qt-creator-426890b790789c8a51841480c2cd37418a0244f7.tar.gz |
Change PropertiesPanel interface.
* Rename it to IPropertiesPanel in accordance with new naming standards.
* Do not derive from Context. That is not needed.
* Add an icon() method.
* Fix all usages of this interface.
Reviewed-By: dt
13 files changed, 101 insertions, 75 deletions
diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp index e319388f8b..fac04077b6 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp @@ -37,8 +37,8 @@ #include <extensionsystem/pluginmanager.h> #include <utils/qtcassert.h> -#include <QtCore/QDebug> #include <QtCore/QPair> +#include <QtGui/QApplication> #include <QtGui/QInputDialog> #include <QtGui/QLabel> #include <QtGui/QVBoxLayout> @@ -56,7 +56,7 @@ bool BuildSettingsPanelFactory::supports(Project *project) return project->hasBuildSettings(); } -PropertiesPanel *BuildSettingsPanelFactory::createPanel(Project *project) +IPropertiesPanel *BuildSettingsPanelFactory::createPanel(Project *project) { return new BuildSettingsPanel(project); } @@ -65,9 +65,9 @@ PropertiesPanel *BuildSettingsPanelFactory::createPanel(Project *project) /// BuildSettingsPanel /// -BuildSettingsPanel::BuildSettingsPanel(Project *project) - : PropertiesPanel(), - m_widget(new BuildSettingsWidget(project)) +BuildSettingsPanel::BuildSettingsPanel(Project *project) : + m_widget(new BuildSettingsWidget(project)), + m_icon(":/projectexplorer/images/rebuild.png") { } @@ -78,14 +78,19 @@ BuildSettingsPanel::~BuildSettingsPanel() QString BuildSettingsPanel::name() const { - return tr("Build Settings"); + return QApplication::tr("Build Settings"); } -QWidget *BuildSettingsPanel::widget() +QWidget *BuildSettingsPanel::widget() const { return m_widget; } +QIcon BuildSettingsPanel::icon() const +{ + return m_icon; +} + /// // BuildSettingsSubWidgets /// diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.h b/src/plugins/projectexplorer/buildsettingspropertiespage.h index 583835ecfc..169feeedf7 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.h +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.h @@ -64,22 +64,23 @@ class BuildSettingsPanelFactory : public IPanelFactory { public: bool supports(Project *project); - PropertiesPanel *createPanel(Project *project); + IPropertiesPanel *createPanel(Project *project); }; class BuildSettingsWidget; -class BuildSettingsPanel : public PropertiesPanel +class BuildSettingsPanel : public IPropertiesPanel { - Q_OBJECT public: BuildSettingsPanel(Project *project); ~BuildSettingsPanel(); QString name() const; - QWidget *widget(); + QWidget *widget() const; + QIcon icon() const; private: BuildSettingsWidget *m_widget; + const QIcon m_icon; }; class BuildConfigurationsWidget; diff --git a/src/plugins/projectexplorer/dependenciespanel.cpp b/src/plugins/projectexplorer/dependenciespanel.cpp index 3d4fc5519e..f9608e561c 100644 --- a/src/plugins/projectexplorer/dependenciespanel.cpp +++ b/src/plugins/projectexplorer/dependenciespanel.cpp @@ -38,6 +38,7 @@ #include <QtCore/QDebug> #include <QtCore/QAbstractListModel> #include <QtGui/QLabel> +#include <QtGui/QApplication> #include <QtGui/QHBoxLayout> #include <QtGui/QTreeView> #include <QtGui/QSpacerItem> @@ -275,9 +276,9 @@ void DependenciesWidget::updateDetails() // DependenciesPanel // -DependenciesPanel::DependenciesPanel(SessionManager *session, Project *project) - : PropertiesPanel() - , m_widget(new DependenciesWidget(session, project)) +DependenciesPanel::DependenciesPanel(SessionManager *session, Project *project) : + m_widget(new DependenciesWidget(session, project)), + m_icon(":/projectexplorer/images/session.png") { } @@ -288,14 +289,19 @@ DependenciesPanel::~DependenciesPanel() QString DependenciesPanel::name() const { - return tr("Dependencies"); + return QApplication::tr("Dependencies"); } -QWidget *DependenciesPanel::widget() +QWidget *DependenciesPanel::widget() const { return m_widget; } +QIcon DependenciesPanel::icon() const +{ + return m_icon; +} + // // DependenciesPanelFactory // @@ -310,7 +316,7 @@ bool DependenciesPanelFactory::supports(Project * /* project */) return true; } -PropertiesPanel *DependenciesPanelFactory::createPanel(Project *project) +IPropertiesPanel *DependenciesPanelFactory::createPanel(Project *project) { return new DependenciesPanel(m_session, project); } diff --git a/src/plugins/projectexplorer/dependenciespanel.h b/src/plugins/projectexplorer/dependenciespanel.h index 8e017a178b..bb2697c9d1 100644 --- a/src/plugins/projectexplorer/dependenciespanel.h +++ b/src/plugins/projectexplorer/dependenciespanel.h @@ -53,24 +53,25 @@ public: DependenciesPanelFactory(SessionManager *session); bool supports(Project *project); - PropertiesPanel *createPanel(Project *project); + IPropertiesPanel *createPanel(Project *project); private: SessionManager *m_session; }; -class DependenciesPanel : public PropertiesPanel +class DependenciesPanel : public IPropertiesPanel { - Q_OBJECT public: DependenciesPanel(SessionManager *session, Project *project); ~DependenciesPanel(); QString name() const; - QWidget *widget(); + QWidget *widget() const; + QIcon icon() const; private: DependenciesWidget *m_widget; + const QIcon m_icon; }; // diff --git a/src/plugins/projectexplorer/editorsettingspropertiespage.cpp b/src/plugins/projectexplorer/editorsettingspropertiespage.cpp index 82b185a4ba..0df3c8e044 100644 --- a/src/plugins/projectexplorer/editorsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/editorsettingspropertiespage.cpp @@ -42,14 +42,15 @@ bool EditorSettingsPanelFactory::supports(Project * /*project*/) { return true; } -PropertiesPanel *EditorSettingsPanelFactory::createPanel(Project *project) + +IPropertiesPanel *EditorSettingsPanelFactory::createPanel(Project *project) { return new EditorSettingsPanel(project); } -EditorSettingsPanel::EditorSettingsPanel(Project *project) - : PropertiesPanel(), - m_widget(new EditorSettingsWidget(project)) +EditorSettingsPanel::EditorSettingsPanel(Project *project) : + m_widget(new EditorSettingsWidget(project)), + m_icon(":/projectexplorer/images/rebuild.png") { } @@ -60,14 +61,19 @@ EditorSettingsPanel::~EditorSettingsPanel() QString EditorSettingsPanel::name() const { - return tr("Editor Settings"); + return QApplication::tr("Editor Settings"); } -QWidget *EditorSettingsPanel::widget() +QWidget *EditorSettingsPanel::widget() const { return m_widget; } +QIcon EditorSettingsPanel::icon() const +{ + return m_icon; +} + EditorSettingsWidget::EditorSettingsWidget(Project *project) : QWidget(), m_project(project) diff --git a/src/plugins/projectexplorer/editorsettingspropertiespage.h b/src/plugins/projectexplorer/editorsettingspropertiespage.h index 0988f87e37..dfe497439e 100644 --- a/src/plugins/projectexplorer/editorsettingspropertiespage.h +++ b/src/plugins/projectexplorer/editorsettingspropertiespage.h @@ -41,22 +41,23 @@ class EditorSettingsPanelFactory : public IPanelFactory { public: bool supports(Project *project); - PropertiesPanel *createPanel(Project *project); + IPropertiesPanel *createPanel(Project *project); }; class EditorSettingsWidget; -class EditorSettingsPanel : public PropertiesPanel +class EditorSettingsPanel : public IPropertiesPanel { - Q_OBJECT public: EditorSettingsPanel(Project *project); ~EditorSettingsPanel(); QString name() const; - QWidget *widget(); + QWidget *widget() const; + QIcon icon() const; private: EditorSettingsWidget *m_widget; + const QIcon m_icon; }; class EditorSettingsWidget : public QWidget diff --git a/src/plugins/projectexplorer/iprojectproperties.h b/src/plugins/projectexplorer/iprojectproperties.h index 8f15bd3475..1311a60293 100644 --- a/src/plugins/projectexplorer/iprojectproperties.h +++ b/src/plugins/projectexplorer/iprojectproperties.h @@ -32,29 +32,30 @@ #include "projectexplorer_export.h" -#include <coreplugin/icontext.h> +#include <QtGui/QIcon> namespace ProjectExplorer { class Project; -class PropertiesPanel; -class PROJECTEXPLORER_EXPORT IPanelFactory : public QObject +class PROJECTEXPLORER_EXPORT IPropertiesPanel { - Q_OBJECT public: - virtual bool supports(Project *project) = 0; - virtual PropertiesPanel *createPanel(Project *project) = 0; + IPropertiesPanel() + { } + virtual ~IPropertiesPanel() + { } + + virtual QString name() const = 0; + virtual QIcon icon() const = 0; + virtual QWidget *widget() const = 0; }; -class PROJECTEXPLORER_EXPORT PropertiesPanel : public Core::IContext +class PROJECTEXPLORER_EXPORT IPanelFactory : public QObject { Q_OBJECT public: - virtual void finish() {} - virtual QString name() const = 0; - - // IContext - virtual QList<int> context() const { return QList<int>(); } + virtual bool supports(Project *project) = 0; + virtual IPropertiesPanel *createPanel(Project *project) = 0; }; } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp index aee9b15073..f319864d12 100644 --- a/src/plugins/projectexplorer/projectwindow.cpp +++ b/src/plugins/projectexplorer/projectwindow.cpp @@ -258,7 +258,6 @@ RunConfigurationComboBox::RunConfigurationComboBox(QWidget *parent) connectToProject(p); } - connect(session, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)), this, SLOT(activeRunConfigurationChanged())); @@ -556,7 +555,6 @@ void ProjectLabel::setProject(ProjectExplorer::Project *p) setText(tr("No Project loaded")); } - /// // ProjectPushButton /// @@ -745,9 +743,6 @@ void ProjectWindow::saveStatus() void ProjectWindow::showProperties(Project *project) { - if (debug) - qDebug() << "ProjectWindow - showProperties called"; - // Remove all existing panels: m_panelsWidget->clear(); @@ -755,7 +750,7 @@ void ProjectWindow::showProperties(Project *project) qDeleteAll(m_panels); m_panels.clear(); - // Set up our default panels again: + // Set up our default panels: m_panelsWidget->addWidget(tr("Active Build and Run Configurations"), m_activeConfigurationWidget); m_panelsWidget->addWidget(m_spacerBetween); m_panelsWidget->addWidget(m_projectChooser); @@ -766,9 +761,7 @@ void ProjectWindow::showProperties(Project *project) ExtensionSystem::PluginManager::instance()->getObjects<IPanelFactory>(); foreach (IPanelFactory *panelFactory, pages) { if (panelFactory->supports(project)) { - PropertiesPanel *panel = panelFactory->createPanel(project); - if (debug) - qDebug() << "ProjectWindow - setting up project properties tab " << panel->name(); + IPropertiesPanel *panel = panelFactory->createPanel(project); m_panelsWidget->addWidget(panel->name(), panel->widget()); m_panels.push_back(panel); } diff --git a/src/plugins/projectexplorer/projectwindow.h b/src/plugins/projectexplorer/projectwindow.h index ed7200bcb6..d228f7757f 100644 --- a/src/plugins/projectexplorer/projectwindow.h +++ b/src/plugins/projectexplorer/projectwindow.h @@ -52,8 +52,8 @@ QT_END_NAMESPACE namespace ProjectExplorer { +class IPropertiesPanel; class Project; -class PropertiesPanel; class ProjectExplorerPlugin; class SessionManager; @@ -195,7 +195,7 @@ private: QWidget *m_projectChooser; QLabel *m_noprojectLabel; PanelsWidget *m_panelsWidget; - QList<PropertiesPanel *> m_panels; + QList<IPropertiesPanel *> m_panels; }; diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.cpp b/src/plugins/projectexplorer/runsettingspropertiespage.cpp index e49a59fb1d..ccccca85dd 100644 --- a/src/plugins/projectexplorer/runsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/runsettingspropertiespage.cpp @@ -94,7 +94,7 @@ bool RunSettingsPanelFactory::supports(Project * /* project */) return true; } -PropertiesPanel *RunSettingsPanelFactory::createPanel(Project *project) +IPropertiesPanel *RunSettingsPanelFactory::createPanel(Project *project) { return new RunSettingsPanel(project); } @@ -103,9 +103,9 @@ PropertiesPanel *RunSettingsPanelFactory::createPanel(Project *project) /// RunSettingsPanel /// -RunSettingsPanel::RunSettingsPanel(Project *project) - : PropertiesPanel(), - m_widget(new RunSettingsWidget(project)) +RunSettingsPanel::RunSettingsPanel(Project *project) : + m_widget(new RunSettingsWidget(project)), + m_icon(":/projectexplorer/images/run.png") { } @@ -116,14 +116,19 @@ RunSettingsPanel::~RunSettingsPanel() QString RunSettingsPanel::name() const { - return tr("Run Settings"); + return QApplication::tr("Run Settings"); } -QWidget *RunSettingsPanel::widget() +QWidget *RunSettingsPanel::widget() const { return m_widget; } +QIcon RunSettingsPanel::icon() const +{ + return m_icon; +} + /// /// RunConfigurationsModel /// diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.h b/src/plugins/projectexplorer/runsettingspropertiespage.h index ed497f776d..b53fbd6101 100644 --- a/src/plugins/projectexplorer/runsettingspropertiespage.h +++ b/src/plugins/projectexplorer/runsettingspropertiespage.h @@ -53,20 +53,22 @@ class RunSettingsPanelFactory : public IPanelFactory { public: virtual bool supports(Project *project); - PropertiesPanel *createPanel(Project *project); + IPropertiesPanel *createPanel(Project *project); }; -class RunSettingsPanel : public PropertiesPanel +class RunSettingsPanel : public IPropertiesPanel { - Q_OBJECT public: RunSettingsPanel(Project *project); ~RunSettingsPanel(); QString name() const; - QWidget *widget(); + QWidget *widget() const; + QIcon icon() const; + private: RunSettingsWidget *m_widget; + QIcon m_icon; }; class RunSettingsWidget : public QWidget diff --git a/src/plugins/qt4projectmanager/embeddedpropertiespage.cpp b/src/plugins/qt4projectmanager/embeddedpropertiespage.cpp index 2abc74ae3d..2fa903fe3a 100644 --- a/src/plugins/qt4projectmanager/embeddedpropertiespage.cpp +++ b/src/plugins/qt4projectmanager/embeddedpropertiespage.cpp @@ -54,7 +54,7 @@ bool EmbeddedPropertiesPanelFactory::supports(Project *project) return false; } -ProjectExplorer::PropertiesPanel *EmbeddedPropertiesPanelFactory::createPanel( +ProjectExplorer::IPropertiesPanel *EmbeddedPropertiesPanelFactory::createPanel( ProjectExplorer::Project *project) { return new EmbeddedPropertiesPanel(project); @@ -64,9 +64,9 @@ ProjectExplorer::PropertiesPanel *EmbeddedPropertiesPanelFactory::createPanel( /// EmbeddedPropertiesPanel /// -EmbeddedPropertiesPanel::EmbeddedPropertiesPanel(ProjectExplorer::Project *project) - : PropertiesPanel(), - m_widget(new EmbeddedPropertiesWidget(project)) +EmbeddedPropertiesPanel::EmbeddedPropertiesPanel(ProjectExplorer::Project *project) : + m_widget(new EmbeddedPropertiesWidget(project)), + m_icon(":/projectexplorer/images/rebuild.png") { } @@ -77,15 +77,19 @@ EmbeddedPropertiesPanel::~EmbeddedPropertiesPanel() QString EmbeddedPropertiesPanel::name() const { - return tr("Embedded Linux"); - + return QApplication::tr("Embedded Linux"); } -QWidget *EmbeddedPropertiesPanel::widget() +QWidget *EmbeddedPropertiesPanel::widget() const { return m_widget; } +QIcon EmbeddedPropertiesPanel::icon() const +{ + return m_icon; +} + /// /// EmbeddedPropertiesWidget /// diff --git a/src/plugins/qt4projectmanager/embeddedpropertiespage.h b/src/plugins/qt4projectmanager/embeddedpropertiespage.h index cd35fa5008..06342974c0 100644 --- a/src/plugins/qt4projectmanager/embeddedpropertiespage.h +++ b/src/plugins/qt4projectmanager/embeddedpropertiespage.h @@ -50,21 +50,22 @@ class EmbeddedPropertiesPanelFactory : public ProjectExplorer::IPanelFactory { public: virtual bool supports(ProjectExplorer::Project *project); - ProjectExplorer::PropertiesPanel *createPanel(ProjectExplorer::Project *project); + ProjectExplorer::IPropertiesPanel *createPanel(ProjectExplorer::Project *project); }; -class EmbeddedPropertiesPanel : public ProjectExplorer::PropertiesPanel +class EmbeddedPropertiesPanel : public ProjectExplorer::IPropertiesPanel { - Q_OBJECT public: EmbeddedPropertiesPanel(ProjectExplorer::Project *project); ~EmbeddedPropertiesPanel(); QString name() const; - QWidget *widget(); + QWidget *widget() const; + QIcon icon() const; private: EmbeddedPropertiesWidget *m_widget; + QIcon m_icon; }; class EmbeddedPropertiesWidget : public QWidget |