]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/viewmodes/dolphinfontrequester.h
Fix build for KIO version < 6.14
[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 { SystemFont = 0, CustomFont = 1 };
25
26 explicit DolphinFontRequester(QWidget *parent);
27 ~DolphinFontRequester() override;
28
29 void setMode(Mode mode);
30 Mode mode() const;
31
32 /**
33 * Returns the custom font (see DolphinFontRequester::customFont()),
34 * if the mode is \a CustomFont, otherwise the system font is
35 * returned.
36 */
37 QFont currentFont() const;
38
39 void setCustomFont(const QFont &font);
40 QFont customFont() const;
41
42 Q_SIGNALS:
43 /** Is emitted, if the font has been changed. */
44 void changed();
45
46 private Q_SLOTS:
47 void openFontDialog();
48 void changeMode(int index);
49
50 private:
51 QComboBox *m_modeCombo;
52 QPushButton *m_chooseFontButton;
53
54 Mode m_mode;
55 QFont m_customFont;
56 };
57
58 #endif