1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
---|---|
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #include "customicons.h" |
6 | #include <QIcon> |
7 | #include <QMimeDatabase> |
8 | |
9 | namespace { |
10 | QFileIconProvider provider; |
11 | QMimeDatabase mimeDatabase; |
12 | } |
13 | |
14 | QIcon CustomIcons::icon(QFileIconProvider::IconType type) |
15 | { |
16 | return provider.icon(type); |
17 | } |
18 | |
19 | QIcon CustomIcons::icon(CustomIcons::CustomIconType type) |
20 | { |
21 | switch (type) { |
22 | case CustomIcons::Exe: |
23 | return QIcon::fromTheme("application/x-executable"); |
24 | case CustomIcons::Lib: |
25 | return QIcon::fromTheme("application/x-sharedlib"); |
26 | } |
27 | return {}; |
28 | } |
29 | |
30 | QIcon CustomIcons::icon(const QFileInfo &info) |
31 | { |
32 | return provider.icon(info); |
33 | } |
34 | |
35 | QString CustomIcons::type(const QFileInfo &info) |
36 | { |
37 | return provider.type(info); |
38 | } |
39 | |
40 | void CustomIcons::setOptions(QFileIconProvider::Options options) |
41 | { |
42 | return provider.setOptions(options); |
43 | } |
44 | |
45 | QFileIconProvider::Options CustomIcons::options() |
46 | { |
47 | return provider.options(); |
48 | } |
49 |