forked from qt-creator/qt-creator
ios: detect switch usermode -> dev mode
this does polling, but only with devices in user mode connected... Change-Id: I828715a2b4a35f8f9b3bdbcf0da9a74990f3047f Reviewed-by: Daniel Teske <daniel.teske@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
@@ -312,9 +312,15 @@ void IosDeviceManager::deviceInfo(IosToolHandler *, const QString &uid,
|
||||
QLatin1String devStatusKey = QLatin1String("developerStatus");
|
||||
if (info.contains(devStatusKey)) {
|
||||
QString devStatus = info.value(devStatusKey);
|
||||
if (devStatus == QLatin1String("*off*")) {
|
||||
if (devStatus == QLatin1String("Development")) {
|
||||
devManager->setDeviceState(newDev->id(), IDevice::DeviceReadyToUse);
|
||||
m_userModeDeviceIds.removeOne(uid);
|
||||
} else {
|
||||
devManager->setDeviceState(newDev->id(), IDevice::DeviceConnected);
|
||||
if (!newDev->m_ignoreDevice && !IosConfigurations::ignoreAllDevices()) {
|
||||
bool shouldIgnore = newDev->m_ignoreDevice;
|
||||
newDev->m_ignoreDevice = true;
|
||||
if (devStatus == QLatin1String("*off*")) {
|
||||
if (!shouldIgnore && !IosConfigurations::ignoreAllDevices()) {
|
||||
QMessageBox mBox;
|
||||
mBox.setText(tr("An iOS device in user mode has been detected."));
|
||||
mBox.setInformativeText(tr("Do you want to see how to set it up for development?"));
|
||||
@@ -327,7 +333,6 @@ void IosDeviceManager::deviceInfo(IosToolHandler *, const QString &uid,
|
||||
QLatin1String("qthelp://org.qt-project.qtcreator/doc/creator-developing-ios.html"));
|
||||
break;
|
||||
case QMessageBox::No:
|
||||
newDev->m_ignoreDevice = true;
|
||||
break;
|
||||
case QMessageBox::NoAll:
|
||||
IosConfigurations::setIgnoreAllDevices(true);
|
||||
@@ -336,10 +341,10 @@ void IosDeviceManager::deviceInfo(IosToolHandler *, const QString &uid,
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (devStatus == QLatin1String("Development")) {
|
||||
devManager->setDeviceState(newDev->id(), IDevice::DeviceReadyToUse);
|
||||
} else {
|
||||
devManager->setDeviceState(newDev->id(), IDevice::DeviceConnected);
|
||||
}
|
||||
if (!m_userModeDeviceIds.contains(uid))
|
||||
m_userModeDeviceIds.append(uid);
|
||||
m_userModeDevicesTimer.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -497,6 +502,16 @@ void IosDeviceManager::monitorAvailableDevices()
|
||||
IosDeviceManager::IosDeviceManager(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
m_userModeDevicesTimer.setSingleShot(true);
|
||||
m_userModeDevicesTimer.setInterval(8000);
|
||||
connect(&m_userModeDevicesTimer, SIGNAL(timeout()),
|
||||
SLOT(updateUserModeDevices()));
|
||||
}
|
||||
|
||||
void IosDeviceManager::updateUserModeDevices()
|
||||
{
|
||||
foreach (const QString &uid, m_userModeDeviceIds)
|
||||
updateInfo(uid);
|
||||
}
|
||||
|
||||
IosDeviceManager *IosDeviceManager::instance()
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QSharedPointer>
|
||||
#include <QStringList>
|
||||
#include <QTimer>
|
||||
|
||||
namespace ProjectExplorer{
|
||||
class Kit;
|
||||
@@ -100,8 +102,12 @@ public slots:
|
||||
const Ios::IosToolHandler::Dict &info);
|
||||
void infoGathererFinished(Ios::IosToolHandler *gatherer);
|
||||
void monitorAvailableDevices();
|
||||
private slots:
|
||||
void updateUserModeDevices();
|
||||
private:
|
||||
IosDeviceManager(QObject *parent = 0);
|
||||
QTimer m_userModeDevicesTimer;
|
||||
QStringList m_userModeDeviceIds;
|
||||
};
|
||||
|
||||
namespace IosKitInformation {
|
||||
|
||||
Reference in New Issue
Block a user