mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-22 03:45:51 +08:00
first commit
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#ifndef APPCONTEXT_H
|
||||
#define APPCONTEXT_H
|
||||
|
||||
#include "iDescriptor.h"
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMessage>
|
||||
#include <QObject>
|
||||
|
||||
class AppContext : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static AppContext *sharedInstance();
|
||||
iDescriptorDevice *getDevice(const std::string &udid);
|
||||
QList<iDescriptorDevice *> getAllDevices();
|
||||
explicit AppContext(QObject *parent = nullptr);
|
||||
void handleDBusSignal(const QDBusMessage &msg);
|
||||
bool noDevicesConnected() const;
|
||||
std::string addDevice(iDescriptorDevice *device);
|
||||
|
||||
std::string addRecoveryDevice(RecoveryDeviceInfo *deviceInfo);
|
||||
// std::string addRecoveryDevice(const RecoveryDeviceInfo& deviceInfo);
|
||||
void removeRecoveryDevice(const QString &udid);
|
||||
|
||||
// Returns whether there are any devices connected (regular or recovery)
|
||||
bool noDevicesConnected();
|
||||
~AppContext();
|
||||
|
||||
private:
|
||||
QMap<std::string, iDescriptorDevice *> m_devices;
|
||||
QMap<std::string, RecoveryDeviceInfo *> m_recoveryDevices;
|
||||
signals:
|
||||
void deviceAdded(iDescriptorDevice *device);
|
||||
void deviceRemoved(const std::string &udid);
|
||||
void recoveryDeviceAdded(RecoveryDeviceInfo *deviceInfo);
|
||||
void recoveryDeviceRemoved(const QString &udid);
|
||||
void systemSleepStarting();
|
||||
void systemWakeup();
|
||||
public slots:
|
||||
void removeDevice(QString udid);
|
||||
void addDevice(QString udid, idevice_connection_type connType);
|
||||
};
|
||||
|
||||
#endif // APPCONTEXT_H
|
||||
Reference in New Issue
Block a user