-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathwidget.h
49 lines (37 loc) · 1.21 KB
/
widget.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
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include <QMimeDatabase>
#include <QMultiHash>
class QFileInfo;
class QTreeWidget;
class QListWidget;
class QPushButton;
class Widget : public QWidget
{
Q_OBJECT
public:
Widget(QWidget *parent = nullptr);
~Widget();
private slots:
void onMimetypeSelected();
void onSetDefaultClicked();
private:
void loadDesktopFile(const QFileInfo &fileInfo);
void setDefault(const QString &appName, const QSet<QString> &mimetypes, const QSet<QString> &unselectedMimetypes);
void loadIcons(const QString &path);
QMultiHash<QString, QString> m_supportedMimetypes;
QMultiHash<QString, QString> m_childMimeTypes;
QHash<QString, QSet<QString>> m_applications;
QHash<QString, QString> m_applicationIcons;
QHash<QString, QString> m_applicationNames;
QHash<QString, QString> m_desktopFileNames;
QHash<QString, QString> m_appIdToDesktopFile;
QHash<QString, QIcon> m_mimeTypeIcons; // for preloading icons, because that's (a bit) slooow
QHash<QString, QString> m_iconPaths;
QTreeWidget *m_applicationList;
QMimeDatabase m_mimeDb;
QListWidget *m_mimetypeList;
QPushButton *m_setDefaultButton;
};
#endif // WIDGET_H