| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #ifndef APPEVENT_H
- #define APPEVENT_H
- #include <QObject>
- #include <QVariant>
- class AppEvent : public QObject
- {
- Q_OBJECT
- explicit AppEvent(QObject *parent = nullptr);
- ~AppEvent();
- public:
- static AppEvent *instance(); // 静态方法返回单例实例
- static qint64 time();
- static QString formatElapsedTime(qint64 ms);
- static void captureDesktop(const QString &path);
- static void saveTimeFile(qint64 elapsed, const QString &path);
- QString machineCode() const;
- //判断是否登录
- bool isLogin();
- void setJwtToken(const QString &token);
- QString jwtToken() const;
- bool isRefreshToken() const;
- void setRefreshTime(qint64 time) const;
- void startExam(int time);
- qint64 maxExamTime();
- void setMaxExamTime(qint64 time);
- // 配置
- bool setConfigValue(const QString &key, const QVariant &value);
- QVariant configValue(const QString &key);
- QVariant configReadValue(const QString &key, bool *isok = nullptr);
- bool configLoadJson(const QJsonObject &object);
- bool configLoad();
- bool configSave();
- QJsonObject config() const;
- void serverLink(bool);
- void unLockScreen();
- signals:
- void startExamSignals(int time);
- void serverLinkSignals(int time);
- void unLockScreenSignals();
- private:
- class AppEventPrivate *d;
- };
- #endif // APPEVENT_H
|