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");
|
QLatin1String devStatusKey = QLatin1String("developerStatus");
|
||||||
if (info.contains(devStatusKey)) {
|
if (info.contains(devStatusKey)) {
|
||||||
QString devStatus = info.value(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);
|
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;
|
QMessageBox mBox;
|
||||||
mBox.setText(tr("An iOS device in user mode has been detected."));
|
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?"));
|
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"));
|
QLatin1String("qthelp://org.qt-project.qtcreator/doc/creator-developing-ios.html"));
|
||||||
break;
|
break;
|
||||||
case QMessageBox::No:
|
case QMessageBox::No:
|
||||||
newDev->m_ignoreDevice = true;
|
|
||||||
break;
|
break;
|
||||||
case QMessageBox::NoAll:
|
case QMessageBox::NoAll:
|
||||||
IosConfigurations::setIgnoreAllDevices(true);
|
IosConfigurations::setIgnoreAllDevices(true);
|
||||||
@@ -336,10 +341,10 @@ void IosDeviceManager::deviceInfo(IosToolHandler *, const QString &uid,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (devStatus == QLatin1String("Development")) {
|
}
|
||||||
devManager->setDeviceState(newDev->id(), IDevice::DeviceReadyToUse);
|
if (!m_userModeDeviceIds.contains(uid))
|
||||||
} else {
|
m_userModeDeviceIds.append(uid);
|
||||||
devManager->setDeviceState(newDev->id(), IDevice::DeviceConnected);
|
m_userModeDevicesTimer.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -497,6 +502,16 @@ void IosDeviceManager::monitorAvailableDevices()
|
|||||||
IosDeviceManager::IosDeviceManager(QObject *parent) :
|
IosDeviceManager::IosDeviceManager(QObject *parent) :
|
||||||
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()
|
IosDeviceManager *IosDeviceManager::instance()
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
namespace ProjectExplorer{
|
namespace ProjectExplorer{
|
||||||
class Kit;
|
class Kit;
|
||||||
@@ -100,8 +102,12 @@ public slots:
|
|||||||
const Ios::IosToolHandler::Dict &info);
|
const Ios::IosToolHandler::Dict &info);
|
||||||
void infoGathererFinished(Ios::IosToolHandler *gatherer);
|
void infoGathererFinished(Ios::IosToolHandler *gatherer);
|
||||||
void monitorAvailableDevices();
|
void monitorAvailableDevices();
|
||||||
|
private slots:
|
||||||
|
void updateUserModeDevices();
|
||||||
private:
|
private:
|
||||||
IosDeviceManager(QObject *parent = 0);
|
IosDeviceManager(QObject *parent = 0);
|
||||||
|
QTimer m_userModeDevicesTimer;
|
||||||
|
QStringList m_userModeDeviceIds;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace IosKitInformation {
|
namespace IosKitInformation {
|
||||||
|
|||||||
Reference in New Issue
Block a user