aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/projectexplorer
diff options
context:
space:
mode:
authordt <qtc-committer@nokia.com>2010-03-26 12:44:55 +0100
committerdt <qtc-committer@nokia.com>2010-03-26 12:53:06 +0100
commit9f0d403ecd440ffe1153a699fc4420deaf349243 (patch)
tree2ff0f49ffeb70214f6c4f044d5c728736e4fa963 /src/plugins/projectexplorer
parent10809cdd99be078eb30f87866977fdb1f49c15d2 (diff)
Sync the active target on the projects page with the active target
Diffstat (limited to 'src/plugins/projectexplorer')
-rw-r--r--src/plugins/projectexplorer/targetselector.cpp19
-rw-r--r--src/plugins/projectexplorer/targetselector.h2
-rw-r--r--src/plugins/projectexplorer/targetsettingspanel.cpp14
-rw-r--r--src/plugins/projectexplorer/targetsettingswidget.cpp5
-rw-r--r--src/plugins/projectexplorer/targetsettingswidget.h1
5 files changed, 10 insertions, 31 deletions
diff --git a/src/plugins/projectexplorer/targetselector.cpp b/src/plugins/projectexplorer/targetselector.cpp
index 2c4ca1421b..a0936ebc07 100644
--- a/src/plugins/projectexplorer/targetselector.cpp
+++ b/src/plugins/projectexplorer/targetselector.cpp
@@ -43,7 +43,6 @@ void TargetSelector::insertTarget(int index, const QString &name)
Target target;
target.name = name;
target.currentSubIndex = 0;
- target.isActive = false;
m_targets.insert(index, target);
@@ -54,15 +53,6 @@ void TargetSelector::insertTarget(int index, const QString &name)
update();
}
-void TargetSelector::markActive(int index)
-{
- QTC_ASSERT(index >= 0 && index < m_targets.count(), return);
-
- for (int i = 0; i < m_targets.count(); ++i)
- m_targets[i].isActive = (i == index);
- update();
-}
-
void TargetSelector::removeTarget(int index)
{
QTC_ASSERT(index >= 0 && index < m_targets.count(), return);
@@ -218,13 +208,8 @@ void TargetSelector::paintEvent(QPaintEvent *event)
p.setPen(QColor(0, 0, 0));
}
p.drawPixmap(x, 1, *pixmap);
- QString targetName;
- if (target.isActive)
- targetName = QChar('*') + target.name + QChar('*');
- else
- targetName = target.name;
- p.drawText(x + (TARGET_WIDTH - fm.width(targetName))/2 + 1, 7 + fm.ascent(),
- targetName);
+ p.drawText(x + (TARGET_WIDTH - fm.width(target.name))/2 + 1, 7 + fm.ascent(),
+ target.name);
x += TARGET_WIDTH;
p.drawLine(x, 1, x, TARGET_HEIGHT);
++x;
diff --git a/src/plugins/projectexplorer/targetselector.h b/src/plugins/projectexplorer/targetselector.h
index c1f42d7e8c..41cb0e681a 100644
--- a/src/plugins/projectexplorer/targetselector.h
+++ b/src/plugins/projectexplorer/targetselector.h
@@ -14,7 +14,6 @@ public:
struct Target {
QString name;
int currentSubIndex;
- bool isActive;
};
explicit TargetSelector(QWidget *parent = 0);
@@ -32,7 +31,6 @@ public:
public slots:
void addTarget(const QString &name);
void insertTarget(int index, const QString &name);
- void markActive(int index);
void removeTarget(int index);
void setCurrentIndex(int index);
void setCurrentSubIndex(int subindex);
diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp
index e18ccb5e5f..be6d51122c 100644
--- a/src/plugins/projectexplorer/targetsettingspanel.cpp
+++ b/src/plugins/projectexplorer/targetsettingspanel.cpp
@@ -123,7 +123,6 @@ void TargetSettingsPanelWidget::setupUi()
this, SLOT(removeTarget()));
if (m_project->activeTarget()) {
- m_selector->markActive(m_targets.indexOf(m_project->activeTarget()));
m_selector->setCurrentIndex(m_targets.indexOf(m_project->activeTarget()));
}
@@ -137,7 +136,7 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd
if (subIndex < -1 || subIndex >= 2)
return;
- Target *target(m_targets.at(targetIndex));
+ Target *target = m_targets.at(targetIndex);
// Target was not actually changed:
if (m_currentTarget == target) {
@@ -156,8 +155,8 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd
return;
}
- PanelsWidget *buildPanel(new PanelsWidget(m_centralWidget));
- PanelsWidget *runPanel(new PanelsWidget(m_centralWidget));
+ PanelsWidget *buildPanel = new PanelsWidget(m_centralWidget);
+ PanelsWidget *runPanel = new PanelsWidget(m_centralWidget);
foreach (ITargetPanelFactory *panelFactory, ExtensionSystem::PluginManager::instance()->getObjects<ITargetPanelFactory>()) {
if (panelFactory->id() == QLatin1String(BUILDSETTINGS_PANEL_ID)) {
@@ -180,6 +179,9 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd
m_panelWidgets[0] = buildPanel;
delete m_panelWidgets[1];
m_panelWidgets[1] = runPanel;
+
+
+ m_project->setActiveTarget(target);
}
void TargetSettingsPanelWidget::addTarget()
@@ -238,8 +240,8 @@ void TargetSettingsPanelWidget::activeTargetChanged(ProjectExplorer::Target *tar
Q_ASSERT(m_project == target->project());
Q_ASSERT(m_selector);
- int index(m_targets.indexOf(target));
- m_selector->markActive(index);
+ int index = m_targets.indexOf(target);
+ m_selector->setCurrentIndex(index);
}
void TargetSettingsPanelWidget::updateTargetAddAndRemoveButtons()
diff --git a/src/plugins/projectexplorer/targetsettingswidget.cpp b/src/plugins/projectexplorer/targetsettingswidget.cpp
index fe4f4216da..8eaae58282 100644
--- a/src/plugins/projectexplorer/targetsettingswidget.cpp
+++ b/src/plugins/projectexplorer/targetsettingswidget.cpp
@@ -41,11 +41,6 @@ void TargetSettingsWidget::insertTarget(int index, const QString &name)
updateTargetSelector();
}
-void TargetSettingsWidget::markActive(int index)
-{
- m_targetSelector->markActive(index);
-}
-
void TargetSettingsWidget::removeTarget(int index)
{
m_targetSelector->removeTarget(index);
diff --git a/src/plugins/projectexplorer/targetsettingswidget.h b/src/plugins/projectexplorer/targetsettingswidget.h
index 2b069de366..fee4e77fb2 100644
--- a/src/plugins/projectexplorer/targetsettingswidget.h
+++ b/src/plugins/projectexplorer/targetsettingswidget.h
@@ -31,7 +31,6 @@ public:
public slots:
void addTarget(const QString &name);
void insertTarget(int index, const QString &name);
- void markActive(int index);
void removeTarget(int index);
void setCurrentIndex(int index);
void setCurrentSubIndex(int index);