summaryrefslogtreecommitdiff
path: root/src/settings/FontColorSettingsDialog.h
blob: 273f61c222f31c55721c624af5aa9020e7a7bc57 (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
#ifndef FONTCOLORSETTINGSDIALOG_H
#define FONTCOLORSETTINGSDIALOG_H

#include "../field-styles/FieldStyleFactory.h"

#include <QtWidgets>

class ColorBox;

class FontColorSettingsDialog : public QDialog
{
    Q_OBJECT

public:
    FontColorSettingsDialog(QWidget *parent = 0);
    ~FontColorSettingsDialog();

    const FieldStyleFactory* styleFactory() const { return m_styleFactory; }

private:
    void initData();
    QHBoxLayout* createBgColorSelector();
    QLabel* createStylesList();
    QPushButton* createRestoreButton();
    QVBoxLayout* createStyleControls();
    void createKeywordBox( QVBoxLayout* aStyleLt );
    QLabel* createStylePreview();
    void updatePreview();

private slots:
    void updateStyleControls( const QModelIndex& aIndex );
    void setBgColor(QColor aColor);
    void setFontFamily(QFont aFont);
    void setFontSize(int aSize);
    void setBoldFont(int aState);
    void setItalicFont(int aState);
    void setStyleColor(QColor aColor);
    void setPrefix(const QString aText);
    void setSuffix(const QString aText);
    void setKeywordStyle(bool aNewKeywordStyleState);
    void setKeywordBoldFont(int aState);
    void setKeywordItalicFont(int aState);
    void setKeywordColor(QColor aColor);
    void dialogButtonClicked( QAbstractButton* aButton );

private:    
    static const int StyleListMaxWidth = 150;
    static const int SizeSelectorMaxWidth = 50;
    static const int StyleEditMaxWidth = 40;

    FieldStyleFactory* m_styleFactory;
    FieldStyle* m_curStyle;

    ColorBox* m_bgColorSelector;
    QListView* m_stylesListView;
    QFontComboBox* m_fontSelector;
    QSpinBox* m_sizeSelector;
    QCheckBox* m_boldCB;
    QCheckBox* m_italicCB;
    ColorBox* m_fontColorSelector;
    QLineEdit* m_prefixEdit;
    QLineEdit* m_suffixEdit;
    QGroupBox* m_keywordBox;
    QCheckBox* m_keywordBoldCB;
    QCheckBox* m_keywordItalicCB;
    ColorBox* m_keywordColorSelector;
    QTableView* m_stylesPreview;
    QDialogButtonBox* m_okCancelBox;
};

#endif