blob: eba5607689a194cf0a08b678bf0c6f68971990d9 (
plain)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/*********
*
* In the name of the Father, and of the Son, and of the Holy Spirit.
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
#ifndef CFONTCHOOSER_H
#define CFONTCHOOSER_H
#include <QFrame>
#include <QWidget>
class QLabel;
class CListWidget;
class QListWidget;
class QListWidgetItem;
class QString;
class QWebView;
class BtFontChooserWidget : public QFrame {
Q_OBJECT
public: /* Methods: */
BtFontChooserWidget(QWidget *parent = 0);
void setFont(const QFont &font);
void setSampleText(const QString &text);
// Inherited from QWidget:
virtual QSize sizeHint() const;
signals:
void fontSelected(const QFont&);
private: /* Methods: */
void createLayout();
void retranslateUi();
void connectListWidgets();
QString formatAsHtml(const QString& text);
void loadFonts();
void loadSizes(const QString& font, const QString& style);
void loadStyles(const QString& font);
void outputHtmlText();
void restoreListWidgetValue(QListWidget* listWidget, const QString& value);
QString saveListWidgetValue(QListWidget* listWidget);
private slots:
void fontChanged(QListWidgetItem* current, QListWidgetItem* previous);
void setFontStyle(const QString& styleString, QFont* font);
void sizeChanged(QListWidgetItem* current, QListWidgetItem* previous);
void styleChanged(QListWidgetItem* current, QListWidgetItem* previous);
private: /* Fields: */
QLabel *m_fontNameLabel;
CListWidget *m_fontListWidget;
QLabel *m_fontStyleLabel;
CListWidget *m_styleListWidget;
QLabel *m_fontSizeLabel;
CListWidget *m_sizeListWidget;
QWebView *m_fontPreview;
QString m_htmlText;
QFont m_font;
QString m_choosenStyle;
};
#endif
|