2021-10-09 16:38:34 +08:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
2021-11-23 17:16:31 +08:00
|
|
|
#include <QDebug>
|
|
|
|
|
#include <QTimer>
|
2021-11-19 13:20:17 +08:00
|
|
|
#include "StdOutRedirector.h"
|
2021-12-07 14:14:20 +08:00
|
|
|
#include "json/cJSON.h"
|
2022-01-11 13:07:42 +08:00
|
|
|
#include "loginwindow.h"
|
2021-12-07 14:14:20 +08:00
|
|
|
|
2021-10-09 16:38:34 +08:00
|
|
|
namespace Ui {
|
2021-11-19 13:20:17 +08:00
|
|
|
class MainWindow;
|
2021-10-09 16:38:34 +08:00
|
|
|
}
|
2021-10-13 17:40:21 +08:00
|
|
|
class GUIMessageDialog;
|
2021-11-23 09:21:36 +08:00
|
|
|
class QTabWidget;
|
2022-01-18 16:40:18 +08:00
|
|
|
class QGestureEvent;
|
|
|
|
|
class QSwipeGesture;
|
2022-01-25 17:07:34 +08:00
|
|
|
class QPanGesture;
|
2022-01-19 14:24:16 +08:00
|
|
|
class QDockWidget;
|
2021-12-07 14:14:20 +08:00
|
|
|
|
2021-10-09 16:38:34 +08:00
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
|
{
|
2021-11-19 13:20:17 +08:00
|
|
|
Q_OBJECT
|
2021-10-09 16:38:34 +08:00
|
|
|
|
|
|
|
|
public:
|
2021-11-19 13:20:17 +08:00
|
|
|
explicit MainWindow(QWidget* parent = nullptr);
|
|
|
|
|
~MainWindow();
|
|
|
|
|
static void QMessageOutput(QtMsgType, const QMessageLogContext&, const QString& msg);
|
|
|
|
|
void centerWidgetHide();
|
|
|
|
|
void centerWidgetShow();
|
|
|
|
|
void requestLogin();
|
|
|
|
|
QTextEdit* getEdit();
|
|
|
|
|
void debugConsoleOn();
|
2022-01-18 16:40:18 +08:00
|
|
|
|
|
|
|
|
void grabGestures(const QList<Qt::GestureType>& gestures);
|
|
|
|
|
public slots:
|
|
|
|
|
void triggerError(const QString&);
|
2021-12-07 14:14:20 +08:00
|
|
|
protected:
|
|
|
|
|
void changeEvent(QEvent* event);
|
2022-01-18 16:40:18 +08:00
|
|
|
bool event(QEvent* event) override;
|
2022-01-12 15:55:10 +08:00
|
|
|
|
2021-10-09 16:38:34 +08:00
|
|
|
private:
|
2022-01-18 16:40:18 +08:00
|
|
|
bool gestureEvent(QGestureEvent* event);
|
|
|
|
|
void swipeTriggered(QSwipeGesture*);
|
2022-01-25 17:07:34 +08:00
|
|
|
void panTriggered(QPanGesture*);
|
2021-12-24 15:34:36 +08:00
|
|
|
void loadStyleSheet(const QString& sheetName);
|
2021-12-07 14:14:20 +08:00
|
|
|
cJSON* json_root = nullptr;
|
|
|
|
|
|
2021-11-19 13:20:17 +08:00
|
|
|
Ui::MainWindow* ui;
|
2022-01-19 14:24:16 +08:00
|
|
|
QDockWidget* dockWidget;
|
2021-11-19 13:20:17 +08:00
|
|
|
GUIMessageDialog* msgDialog = nullptr;
|
|
|
|
|
StdOutRedirector* redir = nullptr;
|
|
|
|
|
QTextEdit* console = nullptr;
|
2021-12-07 14:14:20 +08:00
|
|
|
bool m_bLoaded = false;
|
|
|
|
|
QTabWidget* tab = nullptr;
|
|
|
|
|
int admin_tab_index = -1;
|
2022-01-19 14:24:16 +08:00
|
|
|
LoginWindow* l;
|
|
|
|
|
QThread* t;
|
|
|
|
|
bool debugMode = false;
|
2021-10-09 16:38:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|