forked from qt-creator/qt-creator
Ios: Only ever show a single dialog for developer mode
It can happen that this is triggered twice for the same device, or for other devices when the dialog is still open. This looks funny and is not necessary, so avoid it. Task-number: QTBUG-121557 Change-Id: I0329104b3825b68b565ca1f8e00d785952c9d767 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "iostr.h"
|
||||
|
||||
#include <coreplugin/helpmanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
#include <projectexplorer/devicesupport/idevicewidget.h>
|
||||
@@ -302,17 +303,22 @@ void IosDeviceManager::deviceInfo(IosToolHandler *, const QString &uid,
|
||||
bool shouldIgnore = newDev->m_ignoreDevice;
|
||||
newDev->m_ignoreDevice = true;
|
||||
if (devStatus == QLatin1String("*off*")) {
|
||||
if (!shouldIgnore && !IosConfigurations::ignoreAllDevices()) {
|
||||
QMessageBox mBox;
|
||||
mBox.setText(Tr::tr("An iOS device in user mode has been detected."));
|
||||
mBox.setInformativeText(Tr::tr("Do you want to see how to set it up for development?"));
|
||||
mBox.setStandardButtons(QMessageBox::NoAll | QMessageBox::No | QMessageBox::Yes);
|
||||
mBox.setDefaultButton(QMessageBox::Yes);
|
||||
int ret = mBox.exec();
|
||||
switch (ret) {
|
||||
if (!m_devModeDialog && !shouldIgnore && !IosConfigurations::ignoreAllDevices()) {
|
||||
m_devModeDialog = new QMessageBox(Core::ICore::dialogParent());
|
||||
m_devModeDialog->setText(
|
||||
Tr::tr("An iOS device in user mode has been detected."));
|
||||
m_devModeDialog->setInformativeText(
|
||||
Tr::tr("Do you want to see how to set it up for development?"));
|
||||
m_devModeDialog->setStandardButtons(QMessageBox::NoAll | QMessageBox::No
|
||||
| QMessageBox::Yes);
|
||||
m_devModeDialog->setDefaultButton(QMessageBox::Yes);
|
||||
m_devModeDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(m_devModeDialog, &QDialog::finished, this, [](int result) {
|
||||
switch (result) {
|
||||
case QMessageBox::Yes:
|
||||
Core::HelpManager::showHelpUrl(
|
||||
QLatin1String("qthelp://org.qt-project.qtcreator/doc/creator-developing-ios.html"));
|
||||
QLatin1String("qthelp://org.qt-project.qtcreator/doc/"
|
||||
"creator-developing-ios.html"));
|
||||
break;
|
||||
case QMessageBox::No:
|
||||
break;
|
||||
@@ -322,6 +328,8 @@ void IosDeviceManager::deviceInfo(IosToolHandler *, const QString &uid,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
m_devModeDialog->show();
|
||||
}
|
||||
}
|
||||
if (!m_userModeDeviceIds.contains(uid))
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#include <projectexplorer/devicesupport/idevice.h>
|
||||
#include <projectexplorer/devicesupport/idevicefactory.h>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
|
||||
namespace Ios {
|
||||
@@ -83,6 +84,7 @@ private:
|
||||
IosDeviceManager(QObject *parent = nullptr);
|
||||
QTimer m_userModeDevicesTimer;
|
||||
QStringList m_userModeDeviceIds;
|
||||
QPointer<QMessageBox> m_devModeDialog;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
Reference in New Issue
Block a user