- Implement `cleanupOldData` in `DatabaseManager` to remove outdated entries and optimize storage. - Introduce `unlockScreen` in `AdbUtils` and integrate it into common scripts for screen unlocking. - Enhance `GeneralLogDAO` to support screenshot storage and retrieval. - Expand `FileLogWindow` with screenshot viewer and horizontal layout. - Add device ID migration logic in `BankProfileDAO` and `MaterialDAO`. - Improve error handling in `EventHandler` by saving and logging screenshots for critical events.
56 lines
1.9 KiB
C++
56 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include <QList>
|
|
#include <QObject>
|
|
|
|
class AdbUtils final : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit AdbUtils(QObject *parent = nullptr);
|
|
|
|
static QString adbPath();
|
|
|
|
static QList<QPair<QString, QString> > getListDevices();
|
|
|
|
static QString tryToGetRunningAppPid(const QString &deviceId, const QString &packageName);
|
|
|
|
static bool tryToStartApplication(const QString &deviceId, const QString &packageName);
|
|
|
|
static bool tryToKillApplication(const QString &deviceId, const QString &packageName);
|
|
|
|
static QString getScreenDumpAsXml(const QString &deviceId, int idx, bool screenshot = false);
|
|
|
|
static bool takeScreenshot(const QString &deviceId, const QString &name);
|
|
|
|
// Захватывает скриншот напрямую в память (PNG-байты), без временного файла
|
|
static QByteArray captureScreenshotBytes(const QString &deviceId);
|
|
|
|
static bool takeXmlDump(const QString &deviceId, const QString &name);
|
|
|
|
static bool makeTap(const QString &deviceId, int x, int y);
|
|
|
|
static bool enableAdbIMEKeyboard(const QString &deviceId);
|
|
|
|
static bool inputAdbIMEText(const QString &deviceId, const QString &text);
|
|
|
|
static bool disableAdbIMEKeyboard(const QString &deviceId);
|
|
|
|
static bool makeSwipe(const QString &deviceId, int x1, int y1, int x2, int y2);
|
|
|
|
static bool inputText(const QString &deviceId, const QString &text);
|
|
|
|
static bool hideKeyboard(const QString &deviceId);
|
|
|
|
static bool goBack(const QString &deviceId);
|
|
|
|
static void unlockScreen(const QString &deviceId, int screenWidth, int screenHeight);
|
|
|
|
static QSet<QString> getListApps(const QString &deviceId);
|
|
|
|
private:
|
|
static QString adbDir();
|
|
static bool startProcess(const QString &program, const QStringList &args,
|
|
QString *stdOut = nullptr, QString *stdErr = nullptr);
|
|
};
|