2022-06-08 17:06:38 +08:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
|
|
|
|
|
#include "utilities/StdOutRedirector.h"
|
|
|
|
|
#include "json/cJSON.h"
|
|
|
|
|
|
|
|
|
|
namespace Ui
|
|
|
|
|
{
|
|
|
|
|
class MainWindow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class GUIMessageDialog;
|
|
|
|
|
class QTabWidget;
|
|
|
|
|
class QGestureEvent;
|
|
|
|
|
class QSwipeGesture;
|
|
|
|
|
class QPanGesture;
|
|
|
|
|
class QDockWidget;
|
|
|
|
|
class LoginDialog;
|
|
|
|
|
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit MainWindow(QWidget* aParent = nullptr);
|
2022-07-13 10:51:27 +08:00
|
|
|
~MainWindow() override;
|
2022-06-08 17:06:38 +08:00
|
|
|
static void QMessageOutput(QtMsgType aType, const QMessageLogContext& aContext, const QString& aMessage);
|
|
|
|
|
void centerWidgetHide();
|
|
|
|
|
void centerWidgetShow();
|
|
|
|
|
void requestLogin();
|
|
|
|
|
QTextEdit* getEdit();
|
|
|
|
|
void debugConsoleOn();
|
|
|
|
|
void grabGestures(const QList<Qt::GestureType>& aGestures);
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
void triggerError(const QString&);
|
2022-08-10 15:28:59 +08:00
|
|
|
void triggerInfo(const QPair<QString,unsigned int>&);
|
2022-06-08 17:06:38 +08:00
|
|
|
|
|
|
|
|
protected:
|
2022-07-13 10:29:09 +08:00
|
|
|
void changeEvent(QEvent* aEvent) override;
|
2022-06-08 17:06:38 +08:00
|
|
|
bool event(QEvent* aEvent) override;
|
|
|
|
|
|
2022-07-12 16:13:09 +08:00
|
|
|
void keyPressEvent(QKeyEvent *event) override;
|
|
|
|
|
|
2022-06-08 17:06:38 +08:00
|
|
|
private:
|
|
|
|
|
void initializeTabWidget();
|
|
|
|
|
void initializeLayout();
|
|
|
|
|
bool gestureEvent(QGestureEvent* aGestureEvent);
|
|
|
|
|
void swipeTriggered(QSwipeGesture* aSwipeGesture);
|
|
|
|
|
void panTriggered(QPanGesture* aPanGesture);
|
|
|
|
|
void loadStyleSheet(const QString& aSheetName);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Ui::MainWindow* mUI;
|
|
|
|
|
QDockWidget* mDebugConsoleWidget;
|
|
|
|
|
QTextEdit* mDebugMessageConsole;
|
|
|
|
|
QTabWidget* mTabWidget;
|
|
|
|
|
int mAdminTabIndex;
|
|
|
|
|
LoginDialog* mLoginDialog;
|
|
|
|
|
QThread* mThread;
|
|
|
|
|
bool mIsDebugMode;
|
2022-07-13 11:34:26 +08:00
|
|
|
|
|
|
|
|
void switchToScanTab();
|
|
|
|
|
|
|
|
|
|
void reloadLanguage() ;
|
|
|
|
|
|
|
|
|
|
void resetRoleLayout();
|
2022-06-08 17:06:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|