forked from qt-creator/qt-creator
Revert "ios: disable run button while an application is running"
This reverts commit 96ecfb9e4a500837e048cf29a89fe52d31ec1db9 device changes at the moment do not trigger projectexplorer's slotUpdateRunActions so this reduces the usability if one starts out without device. Change-Id: I9fc4ba14ce45d5000d0a8af5c06e0ca9b3080d86 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
@@ -157,26 +157,7 @@ bool IosRunControlFactory::canRun(RunConfiguration *runConfiguration,
|
|||||||
{
|
{
|
||||||
if (mode != NormalRunMode && mode != DebugRunMode)
|
if (mode != NormalRunMode && mode != DebugRunMode)
|
||||||
return false;
|
return false;
|
||||||
IosRunConfiguration *rc = qobject_cast<IosRunConfiguration *>(runConfiguration);
|
return qobject_cast<IosRunConfiguration *>(runConfiguration);
|
||||||
if (!rc)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
IDevice::ConstPtr device = DeviceKitInformation::device(rc->target()->kit());
|
|
||||||
if (!device || device->deviceState() != IDevice::DeviceReadyToUse)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// The device can only run the same application once, any subsequent runs will
|
|
||||||
// not launch a second instance. Disable the Run button if the application is already
|
|
||||||
// running on the device.
|
|
||||||
if (m_activeRunControls.contains(device->id())) {
|
|
||||||
QPointer<ProjectExplorer::RunControl> activeRunControl = m_activeRunControls[device->id()];
|
|
||||||
if (activeRunControl && activeRunControl.data()->isRunning())
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
m_activeRunControls.remove(device->id());
|
|
||||||
}
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RunControl *IosRunControlFactory::create(RunConfiguration *runConfig,
|
RunControl *IosRunControlFactory::create(RunConfiguration *runConfig,
|
||||||
@@ -185,15 +166,10 @@ RunControl *IosRunControlFactory::create(RunConfiguration *runConfig,
|
|||||||
Q_ASSERT(canRun(runConfig, mode));
|
Q_ASSERT(canRun(runConfig, mode));
|
||||||
IosRunConfiguration *rc = qobject_cast<IosRunConfiguration *>(runConfig);
|
IosRunConfiguration *rc = qobject_cast<IosRunConfiguration *>(runConfig);
|
||||||
Q_ASSERT(rc);
|
Q_ASSERT(rc);
|
||||||
RunControl *res = 0;
|
|
||||||
if (mode == NormalRunMode)
|
if (mode == NormalRunMode)
|
||||||
res = new Ios::Internal::IosRunControl(rc);
|
return new Ios::Internal::IosRunControl(rc);
|
||||||
else
|
else
|
||||||
res = IosDebugSupport::createDebugRunControl(rc, errorMessage);
|
return IosDebugSupport::createDebugRunControl(rc, errorMessage);
|
||||||
IDevice::ConstPtr device = DeviceKitInformation::device(rc->target()->kit());
|
|
||||||
if (device)
|
|
||||||
m_activeRunControls[device->id()] = res;
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -83,8 +83,6 @@ public:
|
|||||||
ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
|
ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
|
||||||
ProjectExplorer::RunMode mode,
|
ProjectExplorer::RunMode mode,
|
||||||
QString *errorMessage) QTC_OVERRIDE;
|
QString *errorMessage) QTC_OVERRIDE;
|
||||||
private:
|
|
||||||
mutable QMap<Core::Id, QPointer<ProjectExplorer::RunControl> > m_activeRunControls;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user