-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.h
More file actions
81 lines (66 loc) · 2.03 KB
/
MainWindow.h
File metadata and controls
81 lines (66 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#pragma once
#include <QMainWindow>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QCheckBox>
#include <QProcess>
#include <QScrollArea>
#include <QLineEdit>
#include <QSettings>
#include <QQueue>
#include <QRegularExpression>
#include <QProgressBar>
#include <QTimer>
#include "BankWidget.h"
class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow(QWidget* parent=nullptr);
private slots:
void writeSlot(int bank, const QByteArray& img512k);
void writeAllMonolithic();
void saveMonolithic();
void identify();
void erase();
void readDump();
void terminal();
void onProcReadyRead();
void onProcFinished(int, QProcess::ExitStatus);
void onProcError(QProcess::ProcessError);
void refreshDevices();
// NEU: echter Slot für den Watchdog
void onWatchdogTimeout();
private:
struct Cmd {
QStringList args;
bool log = true;
QString label;
int timeoutMs = 0; // 0 = kein Timeout
};
void enqueue(const QStringList& args, const QString& label = QString(), bool log=true, int timeoutMs=0);
void runNext();
QByteArray buildMonolithic2MiB() const;
QString timestampedDumpName() const;
QString mxprogPath() const;
QString selectedDeviceArg() const;
QString discoverMxprog() const;
void loadSettings();
void saveSettings() const;
void resetProgressTracking();
void appendSmart(const QString& chunk);
QWidget* m_central = nullptr;
QLineEdit* m_mxprogEdit = nullptr;
QComboBox* m_deviceCombo = nullptr;
QCheckBox* m_chkErase = nullptr;
QCheckBox* m_chkVerify = nullptr;
QPlainTextEdit* m_log = nullptr;
QVector<BankWidget*> m_banks;
QProcess* m_proc = nullptr;
QQueue<Cmd> m_queue;
bool m_running = false;
QProgressBar* m_progBar = nullptr;
int m_progressBlock = -1;
bool m_prevWasBlank = false;
QRegularExpression m_rePercent{R"(^\d+%$)"};
QTimer* m_watchdog = nullptr;
};