Commit 205268fb authored by Christian Kandeler's avatar Christian Kandeler
Browse files

Maemo: Fix some qemu button behavior glitches.

parent c1789f8b
......@@ -182,8 +182,7 @@ void MaemoQemuManager::qtVersionsChanged(const QList<int> &uniqueIds)
}
}
// make visible only if we have a runtime and a maemo target
m_qemuAction->setVisible(!m_runtimes.isEmpty() && sessionHasMaemoTarget());
showOrHideQemuButton();
}
void MaemoQemuManager::projectAdded(ProjectExplorer::Project *project)
......@@ -211,7 +210,7 @@ void MaemoQemuManager::projectRemoved(ProjectExplorer::Project *project)
foreach (Target *target, project->targets())
targetRemoved(target);
m_qemuAction->setVisible(!m_runtimes.isEmpty() && sessionHasMaemoTarget());
showOrHideQemuButton();
}
void MaemoQemuManager::projectChanged(ProjectExplorer::Project *project)
......@@ -274,7 +273,7 @@ void MaemoQemuManager::targetRemoved(ProjectExplorer::Target *target)
foreach (RunConfiguration *rc, target->runConfigurations())
toggleDeviceConnections(qobject_cast<MaemoRunConfiguration*> (rc), false);
m_qemuAction->setVisible(!m_runtimes.isEmpty() && sessionHasMaemoTarget());
showOrHideQemuButton();
}
void MaemoQemuManager::targetChanged(ProjectExplorer::Target *target)
......@@ -518,9 +517,14 @@ void MaemoQemuManager::toggleStarterButton(Target *target)
if (m_runningQtId == uniqueId)
isRunning = false;
m_qemuAction->setEnabled(m_runtimes.value(uniqueId, MaemoQemuRuntime()).isValid()
&& targetUsesMatchingRuntimeConfig(target) && !isRunning);
m_qemuAction->setVisible(!m_runtimes.isEmpty() && sessionHasMaemoTarget());
const Project * const p
= ProjectExplorerPlugin::instance()->session()->startupProject();
const bool qemuButtonEnabled
= p && p->activeTarget() && MaemoGlobal::isMaemoTargetId(p->activeTarget()->id())
&& m_runtimes.value(uniqueId, MaemoQemuRuntime()).isValid()
&& targetUsesMatchingRuntimeConfig(target) && !isRunning;
m_qemuAction->setEnabled(qemuButtonEnabled);
showOrHideQemuButton();
}
bool MaemoQemuManager::sessionHasMaemoTarget() const
......@@ -580,3 +584,11 @@ void MaemoQemuManager::toggleDeviceConnections(MaemoRunConfiguration *mrc,
this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*)));
}
}
void MaemoQemuManager::showOrHideQemuButton()
{
const bool showButton = !m_runtimes.isEmpty() && sessionHasMaemoTarget();
if (!showButton)
terminateRuntime();
m_qemuAction->setVisible(showButton);
}
......@@ -118,6 +118,7 @@ private:
void notify(const QList<int> uniqueIds);
void toggleDeviceConnections(MaemoRunConfiguration *mrc, bool connect);
void showOrHideQemuButton();
private:
QAction *m_qemuAction;
......
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