diff --git a/src/plugins/projectexplorer/targetselector.cpp b/src/plugins/projectexplorer/targetselector.cpp index 2c4ca1421b006cc0976ef516eb7429427925c536..a0936ebc07feb2fadf98b54799b209b99f835613 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 c1f42d7e8ca77d7628c33ad478ff20f805ab6fe8..41cb0e681a64dd6facb2783859e7c707e9df233d 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 e18ccb5e5f78eecd901ae8041c1f426983c2230e..be6d51122c36c92714d2e899012ac470460359aa 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 fe4f4216da88097cd55511c64054414540889703..8eaae582827f25d2eb9ffa9625d949137bb6c465 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 2b069de366e62b73ccba8f9b6185deb675725c30..fee4e77fb20cfd97c401b44091bf77de2b1a9572 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);