Deleted `CommonBirbankScript` and its associated derived classes (`GetLastDaysHistoryBirbankScript`, `LoginAndCheckAccountsBirbankScript`, `PayByCardBirbankScript`). Removed dependencies on these scripts, including XML parsing, account handling, and transaction workflows related to the Birbank app.
46 lines
913 B
C++
46 lines
913 B
C++
#pragma once
|
|
#include <QJsonArray>
|
|
#include <QMap>
|
|
#include <QObject>
|
|
#include <QTimer>
|
|
|
|
#include "db/AccountInfo.h"
|
|
#include "db/EventInfo.h"
|
|
|
|
class NetworkService;
|
|
|
|
class EventHandler final : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit EventHandler(QObject *parent = nullptr);
|
|
|
|
~EventHandler() override;
|
|
|
|
public slots:
|
|
void start();
|
|
|
|
void stop();
|
|
|
|
signals:
|
|
void finished();
|
|
|
|
private slots:
|
|
void onTasksReceived(const QJsonArray &tasks);
|
|
|
|
private:
|
|
bool m_running = true;
|
|
QMap<QString, QThread *> m_threads;
|
|
QMap<QString, QTimer *> m_timers;
|
|
QTimer *m_pollTimer = nullptr;
|
|
NetworkService *m_network = nullptr;
|
|
|
|
void clearAll();
|
|
|
|
void updateEventThread(const QString &key, const EventInfo &event, const QString &result);
|
|
|
|
void startThreadForTask(const AccountInfo &account, const EventInfo &event);
|
|
|
|
void processNextTask(const QString &deviceId);
|
|
};
|