forked from AdrianTM/mx-boot-options
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmainwindow.h
134 lines (122 loc) · 4.42 KB
/
mainwindow.h
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/**********************************************************************
* mainwindow.h
**********************************************************************
* Copyright (C) 2017 MX Authors
*
* Authors: Adrian, Dolphin Oracle
* MX Linux <http://mxlinux.org>
*
* This is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this package. If not, see <http://www.gnu.org/licenses/>.
**********************************************************************/
#pragma once
#include <QListWidget>
#include <QMessageBox>
#include <QProgressBar>
#include <QTemporaryDir>
#include <QTextEdit>
#include <QTimer>
#include <cmd.h>
#include <dialog.h>
namespace Ui
{
class MainWindow;
}
class MainWindow : public QDialog
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow() override;
private slots:
void cleanup();
void cmdDone();
void cmdStart();
void procTime();
void setConnections();
void btn_bg_file_clicked();
void btn_theme_file_clicked();
void pushAbout_clicked();
void pushApply_clicked();
void pushHelp_clicked();
void pushLog_clicked();
void pushUefi_clicked();
void push_preview_clicked();
void combo_bootsplash_clicked(bool checked);
void combo_bootsplash_toggled(bool checked);
void combo_enable_flatmenus_clicked(bool checked);
void combo_grub_theme_toggled(bool checked);
void combo_save_default_clicked();
void combo_menu_entry_currentIndexChanged();
void combo_theme_activated(int);
void combo_theme_currentIndexChanged(int index);
void lineEdit_kernel_textEdited();
void radio_detailed_msg_toggled(bool checked);
void radio_limited_msg_toggled(bool checked);
void radio_very_detailed_msg_toggled(bool checked);
void spinBoxTimeout_valueChanged(int val);
protected:
void keyPressEvent(QKeyEvent *event) override;
private:
Ui::MainWindow *ui;
Cmd cmd;
QProgressBar *bar {};
QTimer timer;
bool grub_installed {};
bool just_installed {};
bool kernel_options_changed {};
bool messages_changed {};
bool options_changed {};
bool splash_changed {};
bool live = isLive();
const QString kernel_options {readKernelOpts()};
QString boot_location;
QString chroot;
QString user;
QStringList default_grub;
QStringList grub_cfg;
QTemporaryDir tmpdir;
QString readKernelOpts();
QString selectPartiton(const QStringList &list);
QStringList getLinuxPartitions();
bool inVirtualMachine();
bool installSplash();
bool isInstalled(const QString &package);
bool isInstalled(const QStringList &packages);
bool isLive();
bool replaceGrubArg(const QString &key, const QString &item);
static bool isUefi();
static void removeUefiEntry(QListWidget *listEntries, QDialog *uefiDialog);
static void sendMouseEvents();
static void setUefiBootNext(QListWidget *listEntries, QLabel *textBootNext);
static void setUefiTimeout(QDialog *uefiDialog, QLabel *textTimeout);
static void sortUefiBootOrder(const QStringList &order, QListWidget *list);
static void toggleUefiActive(QListWidget *listEntries);
void addGrubLine(const QString &item);
void addUefiEntry(QListWidget *listEntries, QDialog *dialogUefi);
void appendLogWithColors(QTextEdit *textEdit, const QString &logContent);
void createChrootEnv(const QString &root);
void disableGrubLine(const QString &item);
void enableGrubLine(const QString &item);
void loadPlymouthThemes();
void readBootEntries(QListWidget *listEntries, QLabel *textTimeout, QLabel *textBootNext, QLabel *textBootCurrent,
QStringList *bootorder);
void readDefaultGrub();
void readGrubCfg();
void replaceSyslinuxArg(const QString &args);
void saveBootOrder(const QListWidget *list);
void setGeneralConnections();
void setup();
void unmountAndClean(const QStringList &mount_list);
void writeDefaultGrub();
};