]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - LinuxGUI/Ventoy2Disk/QT/ventoy2diskwindow.h
Fix the issue that SLES/OpenSUSE can not boot after install. (#3125)
[Ventoy.git] / LinuxGUI / Ventoy2Disk / QT / ventoy2diskwindow.h
1 #ifndef VENTOY2DISKWINDOW_H
2 #define VENTOY2DISKWINDOW_H
3
4 #include <QMainWindow>
5 #include <QActionGroup>
6 #include <QJsonDocument>
7 #include <QFile>
8 #include <QJsonObject>
9 #include <QJsonArray>
10 #include <QVector>
11 #include <QtGlobal>
12 #include <QDebug>
13 #include <QCloseEvent>
14 #include <QThread>
15 #include "partcfgdialog.h"
16
17 QT_BEGIN_NAMESPACE
18 namespace Ui { class Ventoy2DiskWindow; }
19 QT_END_NAMESPACE
20
21 #define THREAD_TYPE_INSTALL 1
22 #define THREAD_TYPE_UPDATE 2
23
24 #define THREAD_MSG_PROGRESS_BAR 1
25 #define THREAD_MSG_INSTALL_FINISH 2
26 #define THREAD_MSG_UPDATE_FINISH 3
27
28 class MyQThread : public QThread
29 {
30 Q_OBJECT
31 public:
32 quint64 m_reserve_space;
33 int m_index;
34 int m_type;
35 int m_secureboot;
36 int m_align4K;
37 bool m_running;
38 void install_run();
39 void update_run();
40
41 explicit MyQThread(QObject *parent = nullptr);
42 protected:
43 void run();
44 signals:
45 void thread_event(int msg, int data);
46 public slots:
47 };
48
49
50 class Ventoy2DiskWindow : public QMainWindow
51 {
52 Q_OBJECT
53
54 public:
55 Ventoy2DiskWindow(QWidget *parent = nullptr);
56 ~Ventoy2DiskWindow();
57
58 QActionGroup *m_part_group;
59 QActionGroup *m_lang_group;
60 QJsonArray m_lang_array;
61 PartCfgDialog *m_partcfg;
62 MyQThread *m_thread;
63
64 void FillDeviceList(const QString &select);
65 void OnInitWindow(void);
66 void LoadLanguages();
67 int lang_string(const QString &id, QString &str);
68 void update_ui_language();
69 void set_percent(int percent);
70 protected:
71 void showEvent(QShowEvent *ev);
72 void closeEvent(QCloseEvent *event);
73
74 private slots:
75
76 void thread_event(int msg, int data);
77 void part_style_check_action(QAction *act);
78 void lang_check_action(QAction *act);
79
80 void on_ButtonInstall_clicked();
81
82 void on_ButtonUpdate_clicked();
83
84 void on_ButtonRefresh_clicked();
85
86 void on_comboBoxDevice_currentIndexChanged(int index);
87
88 void on_actionPartition_Configuration_triggered();
89
90 void on_actionClear_Ventoy_triggered();
91
92 void on_actionShow_All_Devices_toggled(bool arg1);
93
94 void on_actionSecure_Boot_Support_triggered();
95
96 private:
97 Ui::Ventoy2DiskWindow *ui;
98
99
100 };
101
102 #define _LANG_STR(id) obj.value(id).toString()
103 #define VERSION_FMT "<html><head/><body><p><span style=\" font-size:20pt; font-weight:600; color:#ff0000;\">%s</span></p></body></html>"
104
105 #endif // VENTOY2DISKWINDOW_H