2023-07-31 16:55:36 +02:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
2023-08-02 15:29:10 +02:00
|
|
|
#include <QTimer>
|
2023-08-22 09:27:59 +02:00
|
|
|
#include <QStatusBar>
|
2023-07-31 16:55:36 +02:00
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
namespace Ui { class MainWindow; }
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
2023-08-02 15:29:10 +02:00
|
|
|
#include "worker.h"
|
2023-09-09 15:01:03 +02:00
|
|
|
#include "update.h"
|
|
|
|
#include "update_dc_event.h"
|
|
|
|
|
|
|
|
#define EMERGENCY_LEAVE_BL 0
|
2023-08-02 15:29:10 +02:00
|
|
|
|
2023-09-06 09:07:45 +02:00
|
|
|
class hwinf;
|
2023-07-31 16:55:36 +02:00
|
|
|
class MainWindow : public QMainWindow {
|
|
|
|
Q_OBJECT
|
|
|
|
|
2023-08-05 18:50:50 +02:00
|
|
|
protected:
|
|
|
|
void customEvent(QEvent *event) override;
|
|
|
|
|
2023-07-31 16:55:36 +02:00
|
|
|
public:
|
2023-11-06 16:23:43 +01:00
|
|
|
MainWindow(Worker *worker, QWidget *parent = nullptr);
|
2023-07-31 16:55:36 +02:00
|
|
|
~MainWindow();
|
|
|
|
|
2023-08-06 20:44:26 +02:00
|
|
|
static const int START_PROGRESS_LOOP = -1;
|
|
|
|
static const int STOP_PROGRESS_LOOP = -2;
|
2023-09-09 15:01:03 +02:00
|
|
|
static const int BL_START_COUNT = 5;
|
|
|
|
static const int BL_CHECK_COUNT = 5;
|
|
|
|
static const int BL_IS_UP_COUNT = 5;
|
|
|
|
static const int BL_STOP_COUNT = 5;
|
2023-08-06 20:44:26 +02:00
|
|
|
|
2023-09-09 15:01:03 +02:00
|
|
|
UpdateDcEvent::UpdateStep updateStep() const { return m_updateStep; }
|
|
|
|
void setUpdateStep(UpdateDcEvent::UpdateStep updateStep) { m_updateStep = updateStep; }
|
2023-08-06 20:44:26 +02:00
|
|
|
|
2023-08-02 15:29:10 +02:00
|
|
|
public slots:
|
2023-08-06 14:14:47 +02:00
|
|
|
void onAppendText(QString, QString suffix = "");
|
2023-08-18 11:48:29 +02:00
|
|
|
void onReplaceLast(QStringList, QString suffix = "");
|
2023-08-07 13:53:48 +02:00
|
|
|
void onReplaceLast(QString, QString suffix = "");
|
2023-08-02 15:29:10 +02:00
|
|
|
void onShowErrorMessage(QString, QString);
|
2023-09-09 15:01:03 +02:00
|
|
|
void onShowStatusMessage(QString, QString);
|
2023-10-23 16:16:11 +02:00
|
|
|
void onShowErrorMessage(QStringList);
|
|
|
|
void onShowStatusMessage(QStringList);
|
2023-08-02 15:29:10 +02:00
|
|
|
void onStopStartTimer();
|
|
|
|
void onRestartExitTimer();
|
2023-08-02 17:51:35 +02:00
|
|
|
void onEnableExit();
|
|
|
|
void onDisableExit();
|
2023-09-09 15:01:03 +02:00
|
|
|
#if EMERGENCY_LEAVE_BL==1
|
|
|
|
void emergencyLeaveBL();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
#if EMERGENCY_LEAVE_BL==1
|
|
|
|
void leaveBL();
|
|
|
|
#endif
|
2023-08-02 15:29:10 +02:00
|
|
|
|
2023-07-31 16:55:36 +02:00
|
|
|
private slots:
|
2023-08-02 15:29:10 +02:00
|
|
|
void onQuit();
|
2023-07-31 16:55:36 +02:00
|
|
|
|
|
|
|
private:
|
2023-08-18 11:46:57 +02:00
|
|
|
void scrollDownTextEdit();
|
2023-09-09 15:01:03 +02:00
|
|
|
void onShowMessage(QString, QString);
|
2023-08-18 11:46:57 +02:00
|
|
|
|
2023-07-31 16:55:36 +02:00
|
|
|
Ui::MainWindow *ui;
|
|
|
|
Worker *m_worker;
|
2023-09-09 15:01:03 +02:00
|
|
|
int const m_width;
|
2023-08-02 15:29:10 +02:00
|
|
|
QTimer *m_startTimer;
|
|
|
|
QTimer *m_exitTimer;
|
2023-08-06 20:44:26 +02:00
|
|
|
bool m_progressRunning;
|
2023-10-20 13:55:18 +02:00
|
|
|
//int m_progressValue;
|
2023-09-09 15:01:03 +02:00
|
|
|
UpdateDcEvent::UpdateStep m_updateStep;
|
2024-11-22 12:55:27 +01:00
|
|
|
QTimer *m_statusTimer;
|
2023-07-31 16:55:36 +02:00
|
|
|
};
|
|
|
|
#endif // MAINWINDOW_H
|