1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Designer of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | |
29 | #ifndef QDESIGNER_APPFONTWIDGET_H |
30 | #define QDESIGNER_APPFONTWIDGET_H |
31 | |
32 | #include <QtWidgets/qgroupbox.h> |
33 | #include <QtWidgets/qdialog.h> |
34 | |
35 | QT_BEGIN_NAMESPACE |
36 | |
37 | class AppFontModel; |
38 | |
39 | class QTreeView; |
40 | class QToolButton; |
41 | class QItemSelection; |
42 | class QDesignerSettingsInterface; |
43 | |
44 | // AppFontWidget: Manages application fonts which the user can load and |
45 | // provides API for saving/restoring them. |
46 | |
47 | class AppFontWidget : public QGroupBox |
48 | { |
49 | Q_DISABLE_COPY_MOVE(AppFontWidget) |
50 | Q_OBJECT |
51 | public: |
52 | explicit AppFontWidget(QWidget *parent = nullptr); |
53 | |
54 | QStringList fontFiles() const; |
55 | |
56 | static void save(QDesignerSettingsInterface *s, const QString &prefix); |
57 | static void restore(const QDesignerSettingsInterface *s, const QString &prefix); |
58 | |
59 | private slots: |
60 | void addFiles(); |
61 | void slotRemoveFiles(); |
62 | void slotRemoveAll(); |
63 | void selectionChanged(const QItemSelection & selected, const QItemSelection & deselected); |
64 | |
65 | private: |
66 | QTreeView *m_view; |
67 | QToolButton *m_addButton; |
68 | QToolButton *m_removeButton; |
69 | QToolButton *m_removeAllButton; |
70 | AppFontModel *m_model; |
71 | }; |
72 | |
73 | // AppFontDialog: Non modal dialog for AppFontWidget which has Qt::WA_DeleteOnClose set. |
74 | |
75 | class AppFontDialog : public QDialog |
76 | { |
77 | Q_DISABLE_COPY_MOVE(AppFontDialog) |
78 | Q_OBJECT |
79 | public: |
80 | explicit AppFontDialog(QWidget *parent = nullptr); |
81 | |
82 | private: |
83 | AppFontWidget *m_appFontWidget; |
84 | }; |
85 | |
86 | QT_END_NAMESPACE |
87 | |
88 | #endif // QDESIGNER_APPFONTWIDGET_H |
89 | |