Commit 83edceaf authored by kh1's avatar kh1

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

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