Commit 9c8079f0 authored by Daniel Molkentin's avatar Daniel Molkentin
Browse files

Keep targets in the minitargetselector sync with the project settings

Task-number: QTCREATORBUG-1097
Reviewed-by: dt
parent a12daa62
......@@ -461,6 +461,8 @@ void MiniProjectTargetSelector::addProject(ProjectExplorer::Project* project)
SLOT(addTarget(ProjectExplorer::Target*)));
connect(project, SIGNAL(removedTarget(ProjectExplorer::Target*)),
SLOT(removeTarget(ProjectExplorer::Target*)));
connect(project, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
SLOT(changeActiveTarget(ProjectExplorer::Target*)));
if (project == ProjectExplorerPlugin::instance()->startupProject()) {
m_projectsBox->setCurrentIndex(pos);
......@@ -546,6 +548,23 @@ void MiniProjectTargetSelector::removeTarget(ProjectExplorer::Target *target)
disconnect(target, SIGNAL(overlayIconChanged()), this, SLOT(updateAction()));
}
void MiniProjectTargetSelector::changeActiveTarget(ProjectExplorer::Target *target)
{
int index = indexFor(target->project());
if (index < 0)
return;
ProjectListWidget *plw = qobject_cast<ProjectListWidget*>(m_widgetStack->widget(index));
for (int i = 0; i < plw->count(); ++i) {
QListWidgetItem *itm = plw->item(i);
MiniTargetWidget *mtw = qobject_cast<MiniTargetWidget*>(plw->itemWidget(itm));
if (mtw->target() == target) {
plw->setCurrentItem(itm);
break;
}
}
}
void MiniProjectTargetSelector::updateAction()
{
Project *project = ProjectExplorerPlugin::instance()->startupProject();
......
......@@ -125,6 +125,7 @@ private slots:
void removeProject(ProjectExplorer::Project *project);
void addTarget(ProjectExplorer::Target *target, bool isActiveTarget = false);
void removeTarget(ProjectExplorer::Target *target);
void changeActiveTarget(ProjectExplorer::Target *target);
void emitStartupProjectChanged(int index);
void changeStartupProject(ProjectExplorer::Project *project);
void updateAction();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment