Skip to content
Snippets Groups Projects
Commit 83edceaf authored by kh1's avatar kh1
Browse files

Fix missing update notification if a device config get's added/removed.

Task-number: QTCREATORBUG-1686
Reviewed-by: ck
parent 38b2ffce
No related branches found
No related tags found
No related merge requests found
......@@ -321,7 +321,7 @@ void MaemoRunConfiguration::updateDeviceConfigurations()
} else {
m_devConfig = configManager.find(m_devConfig.internalId);
}
emit deviceConfigurationsUpdated();
emit deviceConfigurationsUpdated(target());
}
} // namespace Internal
......
......@@ -93,7 +93,7 @@ public:
virtual QVariantMap toMap() const;
signals:
void deviceConfigurationsUpdated();
void deviceConfigurationsUpdated(ProjectExplorer::Target *target);
void deviceConfigurationChanged(ProjectExplorer::Target *target);
void targetInformationChanged() const;
......
......@@ -89,7 +89,7 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
mainLayout->addRow(tr("Arguments:"), m_argsLineEdit);
resetDeviceConfigurations();
connect(m_runConfiguration, SIGNAL(deviceConfigurationsUpdated()),
connect(m_runConfiguration, SIGNAL(deviceConfigurationsUpdated(ProjectExplorer::Target *)),
this, SLOT(resetDeviceConfigurations()));
connect(m_configNameLineEdit, SIGNAL(textEdited(QString)), this,
......
......@@ -199,7 +199,7 @@ void QemuRuntimeManager::projectRemoved(ProjectExplorer::Project *project)
void QemuRuntimeManager::projectChanged(ProjectExplorer::Project *project)
{
if (project)
toogleStarterButton(project->activeTarget());
toggleStarterButton(project->activeTarget());
}
bool targetIsMaemo(const QString &id)
......@@ -231,13 +231,8 @@ void QemuRuntimeManager::targetAdded(ProjectExplorer::Target *target)
// handle the qt version changes the build configuration uses
connect(target, SIGNAL(environmentChanged()), this, SLOT(environmentChanged()));
foreach (RunConfiguration *runConfig, target->runConfigurations()) {
MaemoRunConfiguration *mrc = qobject_cast<MaemoRunConfiguration *> (runConfig);
if (mrc) { // handle device configuration change too
connect(mrc, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*)));
}
}
foreach (RunConfiguration *rc, target->runConfigurations())
toggleDeviceConnections(qobject_cast<MaemoRunConfiguration*> (rc), true);
m_qemuAction->setVisible(!m_runtimes.isEmpty() && sessionHasMaemoTarget());
}
......@@ -262,44 +257,29 @@ void QemuRuntimeManager::targetRemoved(ProjectExplorer::Target *target)
disconnect(target, SIGNAL(environmentChanged()), this, SLOT(environmentChanged()));
foreach (RunConfiguration *runConfig, target->runConfigurations()) {
MaemoRunConfiguration *mrc = qobject_cast<MaemoRunConfiguration *> (runConfig);
if (mrc) {
disconnect(mrc, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*)));
}
}
foreach (RunConfiguration *rc, target->runConfigurations())
toggleDeviceConnections(qobject_cast<MaemoRunConfiguration*> (rc), false);
m_qemuAction->setVisible(!m_runtimes.isEmpty() && sessionHasMaemoTarget());
}
void QemuRuntimeManager::targetChanged(ProjectExplorer::Target *target)
{
if (target)
toogleStarterButton(target);
toggleStarterButton(target);
}
void QemuRuntimeManager::runConfigurationAdded(ProjectExplorer::RunConfiguration *rc)
{
if (!rc || !targetIsMaemo(rc->target()->id()))
return;
MaemoRunConfiguration *mrc = qobject_cast<MaemoRunConfiguration *> (rc);
if (mrc) { // handle device configuration change too
connect(mrc, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*)));
}
toggleDeviceConnections(qobject_cast<MaemoRunConfiguration*> (rc), true);
}
void QemuRuntimeManager::runConfigurationRemoved(ProjectExplorer::RunConfiguration *rc)
{
if (!rc || rc->target()->id() != QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))
return;
MaemoRunConfiguration *mrc = qobject_cast<MaemoRunConfiguration *> (rc);
if (mrc) {
disconnect(mrc, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*)));
}
toggleDeviceConnections(qobject_cast<MaemoRunConfiguration*> (rc), false);
}
void QemuRuntimeManager::runConfigurationChanged(ProjectExplorer::RunConfiguration *rc)
......@@ -327,7 +307,7 @@ void QemuRuntimeManager::buildConfigurationRemoved(ProjectExplorer::BuildConfigu
void QemuRuntimeManager::buildConfigurationChanged(ProjectExplorer::BuildConfiguration *bc)
{
if (bc)
toogleStarterButton(bc->target());
toggleStarterButton(bc->target());
}
void QemuRuntimeManager::environmentChanged()
......@@ -335,7 +315,7 @@ void QemuRuntimeManager::environmentChanged()
// likely to happen when the qt version changes the build config is using
if (ProjectExplorerPlugin *explorer = ProjectExplorerPlugin::instance()) {
if (Project *project = explorer->session()->startupProject())
toogleStarterButton(project->activeTarget());
toggleStarterButton(project->activeTarget());
}
}
......@@ -492,7 +472,7 @@ void QemuRuntimeManager::updateStarterIcon(bool running)
state));
}
void QemuRuntimeManager::toogleStarterButton(Target *target)
void QemuRuntimeManager::toggleStarterButton(Target *target)
{
if (m_needsSetup)
setupRuntimes();
......@@ -619,3 +599,22 @@ QString QemuRuntimeManager::runtimeForQtVersion(const QString &qmakeCommand) con
}
return QString();
}
void QemuRuntimeManager::toggleDeviceConnections(MaemoRunConfiguration *mrc,
bool _connect)
{
if (!mrc)
return;
if (_connect) { // handle device configuration changes
connect(mrc, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*)));
connect(mrc, SIGNAL(deviceConfigurationsUpdated(ProjectExplorer::Target*)),
this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*)));
} else {
disconnect(mrc, SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*)));
disconnect(mrc, SIGNAL(deviceConfigurationsUpdated(ProjectExplorer::Target*)),
this, SLOT(deviceConfigurationChanged(ProjectExplorer::Target*)));
}
}
......@@ -51,6 +51,7 @@ namespace ProjectExplorer {
namespace Qt4ProjectManager {
class QtVersion;
namespace Internal {
class MaemoRunConfiguration;
struct Runtime
{
......@@ -115,7 +116,7 @@ private:
bool sessionHasMaemoTarget() const;
void updateStarterIcon(bool running);
void toogleStarterButton(ProjectExplorer::Target *target);
void toggleStarterButton(ProjectExplorer::Target *target);
bool targetUsesRuntimeConfig(ProjectExplorer::Target *target);
QString maddeRoot(const QString &qmake) const;
......@@ -124,6 +125,8 @@ private:
bool fillRuntimeInformation(Runtime *runtime) const;
QString runtimeForQtVersion(const QString &qmakeCommand) const;
void toggleDeviceConnections(MaemoRunConfiguration *mrc, bool connect);
private:
QAction *m_qemuAction;
QProcess *m_qemuProcess;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment