#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QDebug>
#include <QTimer>
#include "StdOutRedirector.h"
#include "json/cJSON.h"
#include "loginwindow.h"

namespace Ui {
	class MainWindow;
}
class GUIMessageDialog;
class QTabWidget;


class MainWindow : public QMainWindow
{
	Q_OBJECT

public:
	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();

protected:
	void changeEvent(QEvent* event);

private:
	void loadStyleSheet(const QString& sheetName);
	cJSON* json_root = nullptr;

	Ui::MainWindow* ui;
	GUIMessageDialog* msgDialog = nullptr;
	StdOutRedirector* redir = nullptr;
	QTextEdit* console = nullptr;
	bool m_bLoaded = false;
	QTabWidget* tab = nullptr;
	int admin_tab_index = -1;
    LoginWindow* l;
};

#endif // MAINWINDOW_H
