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 "iostr.h"
|
||||||
|
|
||||||
#include <coreplugin/helpmanager.h>
|
#include <coreplugin/helpmanager.h>
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||||
#include <projectexplorer/devicesupport/idevicewidget.h>
|
#include <projectexplorer/devicesupport/idevicewidget.h>
|
||||||
@@ -302,26 +303,33 @@ void IosDeviceManager::deviceInfo(IosToolHandler *, const QString &uid,
|
|||||||
bool shouldIgnore = newDev->m_ignoreDevice;
|
bool shouldIgnore = newDev->m_ignoreDevice;
|
||||||
newDev->m_ignoreDevice = true;
|
newDev->m_ignoreDevice = true;
|
||||||
if (devStatus == QLatin1String("*off*")) {
|
if (devStatus == QLatin1String("*off*")) {
|
||||||
if (!shouldIgnore && !IosConfigurations::ignoreAllDevices()) {
|
if (!m_devModeDialog && !shouldIgnore && !IosConfigurations::ignoreAllDevices()) {
|
||||||
QMessageBox mBox;
|
m_devModeDialog = new QMessageBox(Core::ICore::dialogParent());
|
||||||
mBox.setText(Tr::tr("An iOS device in user mode has been detected."));
|
m_devModeDialog->setText(
|
||||||
mBox.setInformativeText(Tr::tr("Do you want to see how to set it up for development?"));
|
Tr::tr("An iOS device in user mode has been detected."));
|
||||||
mBox.setStandardButtons(QMessageBox::NoAll | QMessageBox::No | QMessageBox::Yes);
|
m_devModeDialog->setInformativeText(
|
||||||
mBox.setDefaultButton(QMessageBox::Yes);
|
Tr::tr("Do you want to see how to set it up for development?"));
|
||||||
int ret = mBox.exec();
|
m_devModeDialog->setStandardButtons(QMessageBox::NoAll | QMessageBox::No
|
||||||
switch (ret) {
|
| QMessageBox::Yes);
|
||||||
case QMessageBox::Yes:
|
m_devModeDialog->setDefaultButton(QMessageBox::Yes);
|
||||||
Core::HelpManager::showHelpUrl(
|
m_devModeDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
QLatin1String("qthelp://org.qt-project.qtcreator/doc/creator-developing-ios.html"));
|
connect(m_devModeDialog, &QDialog::finished, this, [](int result) {
|
||||||
break;
|
switch (result) {
|
||||||
case QMessageBox::No:
|
case QMessageBox::Yes:
|
||||||
break;
|
Core::HelpManager::showHelpUrl(
|
||||||
case QMessageBox::NoAll:
|
QLatin1String("qthelp://org.qt-project.qtcreator/doc/"
|
||||||
IosConfigurations::setIgnoreAllDevices(true);
|
"creator-developing-ios.html"));
|
||||||
break;
|
break;
|
||||||
default:
|
case QMessageBox::No:
|
||||||
break;
|
break;
|
||||||
}
|
case QMessageBox::NoAll:
|
||||||
|
IosConfigurations::setIgnoreAllDevices(true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
m_devModeDialog->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!m_userModeDeviceIds.contains(uid))
|
if (!m_userModeDeviceIds.contains(uid))
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
#include <projectexplorer/devicesupport/idevice.h>
|
#include <projectexplorer/devicesupport/idevice.h>
|
||||||
#include <projectexplorer/devicesupport/idevicefactory.h>
|
#include <projectexplorer/devicesupport/idevicefactory.h>
|
||||||
|
|
||||||
|
#include <QMessageBox>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
namespace Ios {
|
namespace Ios {
|
||||||
@@ -83,6 +84,7 @@ private:
|
|||||||
IosDeviceManager(QObject *parent = nullptr);
|
IosDeviceManager(QObject *parent = nullptr);
|
||||||
QTimer m_userModeDevicesTimer;
|
QTimer m_userModeDevicesTimer;
|
||||||
QStringList m_userModeDeviceIds;
|
QStringList m_userModeDeviceIds;
|
||||||
|
QPointer<QMessageBox> m_devModeDialog;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user