-
Notifications
You must be signed in to change notification settings - Fork 17
/
mainwindow.h
92 lines (84 loc) · 3.4 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
/**********************************************************************
* Copyright (C) 2014 MX Authors
*
* Authors: Adrian
* MX Linux <http://mxlinux.org>
*
* This file is part of MX Tools.
*
* MX Tools 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.
*
* MX Tools 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 MX Tools. If not, see <http://www.gnu.org/licenses/>.
**********************************************************************/
#pragma once
#include <QMessageBox>
#include <QMultiMap>
#include <QSettings>
#include <flatbutton.h>
namespace Ui
{
class MainWindow;
}
class MainWindow : public QDialog
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow() override;
private slots:
static void pushHelp_clicked();
void btn_clicked();
void checkHide_clicked(bool checked);
void closeEvent(QCloseEvent * /*unused*/) override;
void pushAbout_clicked();
void resizeEvent(QResizeEvent *event) override;
void textSearch_textChanged(const QString &arg1);
private:
Ui::MainWindow *ui;
FlatButton *btn {};
QMultiMap<QString, QMultiMap<QString, QStringList>> info_map;
QMultiMap<QString, QStringList> category_map;
QSettings settings;
QStringList live_list;
QStringList maintenance_list;
QStringList setup_list;
QStringList software_list;
QStringList utilities_list;
const QMap<QString, QStringList *> categories {{"MX-Live", &live_list},
{"MX-Maintenance", &maintenance_list},
{"MX-Setup", &setup_list},
{"MX-Software", &software_list},
{"MX-Utilities", &utilities_list}};
enum Info { Name, Comment, IconName, Exec, Category, Terminal };
int col_count = 0;
int icon_size = 32;
int max_col = 0;
int max_elements = 0;
[[nodiscard]] QString getTranslation(const QString &text, const QString &key, const QString &lang_region,
const QString &lang);
[[nodiscard]] QString getValueFromText(const QString &text, const QString &key);
[[nodiscard]] QIcon findIcon(const QString &icon_name);
[[nodiscard]] QStringList listDesktopFiles(const QString &search_string, const QString &location);
static void fixExecItem(QString *item);
static void hideShowIcon(const QString &file_name, bool hide);
static void removeEnvExclusive(QStringList *list, const QStringList &termsToRemove);
void addButtons(const QMultiMap<QString, QMultiMap<QString, QStringList>> &info_map);
void checkHideToolsInMenu();
void clearGrid();
void filterDesktopEnvironmentItems();
void filterLiveEnvironmentItems();
void initializeCategoryLists();
void populateCategoryMap();
void readInfo(const QMultiMap<QString, QStringList> &category_map);
void restoreWindowGeometry();
void setConnections();
};