2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2016-01-15 14:57:40 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2013-04-25 16:02:17 +02:00
|
|
|
|
2014-02-05 15:30:52 +01:00
|
|
|
#include "iostoolhandler.h"
|
|
|
|
|
|
2013-04-25 16:02:17 +02:00
|
|
|
#include <projectexplorer/devicesupport/idevice.h>
|
2019-02-20 19:13:28 +01:00
|
|
|
#include <projectexplorer/devicesupport/idevicefactory.h>
|
2014-02-05 15:30:52 +01:00
|
|
|
|
2024-01-29 09:39:20 +01:00
|
|
|
#include <QMessageBox>
|
2014-02-14 01:08:09 +01:00
|
|
|
#include <QTimer>
|
2013-04-25 16:02:17 +02:00
|
|
|
|
|
|
|
|
namespace Ios {
|
|
|
|
|
class IosConfigurations;
|
|
|
|
|
|
|
|
|
|
namespace Internal {
|
|
|
|
|
class IosDeviceManager;
|
|
|
|
|
|
2020-01-21 16:17:59 +01:00
|
|
|
class IosDevice final : public ProjectExplorer::IDevice
|
2013-04-25 16:02:17 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2018-11-12 19:55:59 +01:00
|
|
|
using Dict = QMap<QString, QString>;
|
|
|
|
|
using ConstPtr = QSharedPointer<const IosDevice>;
|
|
|
|
|
using Ptr = QSharedPointer<IosDevice>;
|
2013-04-25 16:02:17 +02:00
|
|
|
|
2015-06-03 15:32:21 +02:00
|
|
|
ProjectExplorer::IDevice::DeviceInfo deviceInformation() const override;
|
|
|
|
|
ProjectExplorer::IDeviceWidget *createWidget() override;
|
2013-04-25 16:02:17 +02:00
|
|
|
|
2020-07-10 14:40:38 +02:00
|
|
|
QString deviceName() const;
|
2013-04-25 16:02:17 +02:00
|
|
|
QString uniqueDeviceID() const;
|
2020-07-10 14:40:38 +02:00
|
|
|
QString uniqueInternalDeviceId() const;
|
2013-12-10 12:53:20 +01:00
|
|
|
QString osVersion() const;
|
2020-07-08 16:14:40 +02:00
|
|
|
QString cpuArchitecture() const;
|
2016-04-19 16:43:30 +02:00
|
|
|
Utils::Port nextPort() const;
|
2013-11-04 15:08:41 +01:00
|
|
|
|
|
|
|
|
static QString name();
|
|
|
|
|
|
2013-04-25 16:02:17 +02:00
|
|
|
protected:
|
2023-08-23 16:53:06 +02:00
|
|
|
void fromMap(const Utils::Store &map) final;
|
|
|
|
|
Utils::Store toMap() const final;
|
2021-12-08 12:39:22 +01:00
|
|
|
|
2013-04-25 16:02:17 +02:00
|
|
|
friend class IosDeviceFactory;
|
|
|
|
|
friend class Ios::Internal::IosDeviceManager;
|
|
|
|
|
IosDevice();
|
2019-02-21 14:36:14 +01:00
|
|
|
IosDevice(const QString &uid);
|
|
|
|
|
|
2019-08-16 10:26:42 +02:00
|
|
|
enum CtorHelper {};
|
|
|
|
|
IosDevice(CtorHelper);
|
|
|
|
|
|
2013-04-25 16:02:17 +02:00
|
|
|
Dict m_extraInfo;
|
2017-12-13 13:00:42 +01:00
|
|
|
bool m_ignoreDevice = false;
|
2014-02-25 16:02:02 +01:00
|
|
|
mutable quint16 m_lastPort;
|
2013-04-25 16:02:17 +02:00
|
|
|
};
|
|
|
|
|
|
2020-01-21 16:17:59 +01:00
|
|
|
class IosDeviceFactory final : public ProjectExplorer::IDeviceFactory
|
2019-02-20 19:13:28 +01:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
IosDeviceFactory();
|
|
|
|
|
|
2023-08-25 13:19:26 +02:00
|
|
|
bool canRestore(const Utils::Store &map) const override;
|
2019-02-20 19:13:28 +01:00
|
|
|
};
|
|
|
|
|
|
2019-02-21 14:36:14 +01:00
|
|
|
class IosDeviceManager : public QObject
|
|
|
|
|
{
|
2013-04-25 16:02:17 +02:00
|
|
|
public:
|
2018-11-12 19:55:59 +01:00
|
|
|
using TranslationMap = QHash<QString, QString>;
|
2013-04-25 16:02:17 +02:00
|
|
|
|
|
|
|
|
static TranslationMap translationMap();
|
|
|
|
|
static IosDeviceManager *instance();
|
|
|
|
|
|
|
|
|
|
void updateAvailableDevices(const QStringList &devices);
|
|
|
|
|
void deviceConnected(const QString &uid, const QString &name = QString());
|
|
|
|
|
void deviceDisconnected(const QString &uid);
|
|
|
|
|
friend class IosConfigurations;
|
|
|
|
|
void updateInfo(const QString &devId);
|
|
|
|
|
void deviceInfo(Ios::IosToolHandler *gatherer, const QString &deviceId,
|
|
|
|
|
const Ios::IosToolHandler::Dict &info);
|
|
|
|
|
void infoGathererFinished(Ios::IosToolHandler *gatherer);
|
|
|
|
|
void monitorAvailableDevices();
|
2022-12-20 13:39:23 +01:00
|
|
|
|
2013-04-25 16:02:17 +02:00
|
|
|
private:
|
2016-06-29 19:35:23 +03:00
|
|
|
void updateUserModeDevices();
|
2018-11-12 19:55:59 +01:00
|
|
|
IosDeviceManager(QObject *parent = nullptr);
|
2014-02-14 01:08:09 +01:00
|
|
|
QTimer m_userModeDevicesTimer;
|
|
|
|
|
QStringList m_userModeDeviceIds;
|
2024-01-29 09:39:20 +01:00
|
|
|
QPointer<QMessageBox> m_devModeDialog;
|
2013-04-25 16:02:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Ios
|