2024-08-14 13:48:27 -04:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
2024-08-14 14:54:24 -04:00
|
|
|
#include <QLineEdit>
|
2024-08-14 13:48:27 -04:00
|
|
|
#include <QMainWindow>
|
2024-08-15 12:23:36 -04:00
|
|
|
#include <QNetworkReply>
|
2024-08-14 13:48:27 -04:00
|
|
|
#include <QProgressBar>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QSlider>
|
2024-08-14 14:54:24 -04:00
|
|
|
#include <QTextEdit>
|
2024-08-14 13:48:27 -04:00
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
2024-08-15 12:23:36 -04:00
|
|
|
#include <utils/pendingauthobject.h>
|
|
|
|
|
2024-08-14 13:48:27 -04:00
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2024-08-14 15:23:01 -04:00
|
|
|
enum MessageType {Normal, System, Error};
|
2024-08-15 12:23:36 -04:00
|
|
|
enum AppState {Unauthed, NonConnected, Sane, PendingPassword, PendingOTP};
|
2024-08-14 13:48:27 -04:00
|
|
|
MainWindow(QWidget *parent = nullptr);
|
|
|
|
~MainWindow();
|
2024-08-14 16:15:26 -04:00
|
|
|
private slots:
|
|
|
|
void handleOutput();
|
2024-08-15 12:23:36 -04:00
|
|
|
void handleHttpReply(QNetworkReply* reply);
|
2024-08-14 13:48:27 -04:00
|
|
|
private:
|
2024-08-14 16:15:26 -04:00
|
|
|
AppState state = Unauthed;
|
2024-08-15 12:23:36 -04:00
|
|
|
PendingAuthObject m_pendingAuthObject;
|
2024-08-14 13:48:27 -04:00
|
|
|
QVBoxLayout *m_layout;
|
2024-08-14 14:54:24 -04:00
|
|
|
QTextEdit *m_chatlog;
|
|
|
|
QLineEdit *m_box;
|
|
|
|
QPushButton *m_send;
|
2024-08-15 12:23:36 -04:00
|
|
|
QNetworkAccessManager *m_netmgr;
|
|
|
|
void addMessage(QString content, MainWindow::MessageType type = Normal);
|
2024-08-14 13:48:27 -04:00
|
|
|
};
|
|
|
|
#endif // MAINWINDOW_H
|