]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/viewmodes/dolphinfontrequester.h
Build with QT_NO_KEYWORDS
[dolphin.git] / src / settings / viewmodes / dolphinfontrequester.h
1 /*
2 * SPDX-FileCopyrightText: 2008 Peter Penz <peter.penz19@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #ifndef DOLPHINFONTREQUESTER_H
8 #define DOLPHINFONTREQUESTER_H
9
10 #include <QFont>
11 #include <QWidget>
12
13 class QComboBox;
14 class QPushButton;
15
16 /**
17 * @brief Allows to select between using the system font or a custom font.
18 */
19 class DolphinFontRequester : public QWidget
20 {
21 Q_OBJECT
22
23 public:
24 enum Mode
25 {
26 SystemFont = 0,
27 CustomFont = 1
28 };
29
30 explicit DolphinFontRequester(QWidget* parent);
31 ~DolphinFontRequester() override;
32
33 void setMode(Mode mode);
34 Mode mode() const;
35
36 /**
37 * Returns the custom font (see DolphinFontRequester::customFont()),
38 * if the mode is \a CustomFont, otherwise the system font is
39 * returned.
40 */
41 QFont currentFont() const;
42
43 void setCustomFont(const QFont& font);
44 QFont customFont() const;
45
46 Q_SIGNALS:
47 /** Is emitted, if the font has been changed. */
48 void changed();
49
50 private Q_SLOTS:
51 void openFontDialog();
52 void changeMode(int index);
53
54 private:
55 QComboBox* m_modeCombo;
56 QPushButton* m_chooseFontButton;
57
58 Mode m_mode;
59 QFont m_customFont;
60 };
61
62 #endif