~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kcontrol/fonts/fonts.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//-----------------------------------------------------------------------------
 
2
//
 
3
// kdisplay, fonts tab
 
4
//
 
5
// Copyright (c)  Mark Donohoe 1997
 
6
//                Lars Knoll 1999
 
7
 
 
8
#ifndef FONTS_H
 
9
#define FONTS_H
 
10
 
 
11
#include <QLabel>
 
12
#include <QList>
 
13
 
 
14
#include <kcmodule.h>
 
15
#include <kdialog.h>
 
16
#include <kfontdialog.h>
 
17
#include <kfontrequester.h>
 
18
 
 
19
#include "kxftconfig.h"
 
20
 
 
21
class QCheckBox;
 
22
class QComboBox;
 
23
class KDoubleNumInput;
 
24
class FontAASettings;
 
25
 
 
26
class FontUseItem : public KFontRequester
 
27
{
 
28
  Q_OBJECT
 
29
 
 
30
public:
 
31
    FontUseItem(QWidget * parent, const QString &name, const QString &grp, 
 
32
        const QString &key, const QString &rc, const QFont &default_fnt, 
 
33
        bool fixed = false);
 
34
 
 
35
    void readFont();
 
36
    void writeFont();
 
37
    void setDefault();
 
38
    void applyFontDiff(const QFont &fnt, int fontDiffFlags);
 
39
 
 
40
    const QString& rcFile() { return _rcfile; }
 
41
    const QString& rcGroup() { return _rcgroup; }
 
42
    const QString& rcKey() { return _rckey; }
 
43
 
 
44
private:
 
45
    QString _rcfile;
 
46
    QString _rcgroup;
 
47
    QString _rckey;
 
48
    QFont _default;
 
49
};
 
50
 
 
51
class FontAASettings : public KDialog
 
52
{
 
53
  Q_OBJECT
 
54
 
 
55
public:
 
56
 
 
57
#ifdef HAVE_FONTCONFIG
 
58
    FontAASettings(QWidget *parent);
 
59
 
 
60
    bool save( bool useAA );
 
61
    bool load();
 
62
    void defaults();
 
63
    int getIndex(KXftConfig::SubPixel::Type spType);
 
64
    KXftConfig::SubPixel::Type getSubPixelType();
 
65
    int getIndex(KXftConfig::Hint::Style hStyle);
 
66
    KXftConfig::Hint::Style getHintStyle();
 
67
    void enableWidgets();
 
68
    int exec();
 
69
#endif
 
70
 
 
71
protected Q_SLOTS:
 
72
 
 
73
    void changed();
 
74
 
 
75
#ifdef HAVE_FONTCONFIG
 
76
private:
 
77
 
 
78
    QCheckBox *excludeRange;
 
79
    QCheckBox *useSubPixel;
 
80
    KDoubleNumInput *excludeFrom;
 
81
    KDoubleNumInput *excludeTo;
 
82
    QComboBox *subPixelType;
 
83
    QComboBox *hintingStyle;
 
84
    QLabel    *excludeToLabel;
 
85
    bool      changesMade;
 
86
#endif
 
87
};
 
88
 
 
89
/**
 
90
 * The Desktop/fonts tab in kcontrol.
 
91
 */
 
92
class KFonts : public KCModule
 
93
{
 
94
    Q_OBJECT
 
95
 
 
96
public:
 
97
    KFonts(QWidget *parent, const QVariantList &);
 
98
    ~KFonts();
 
99
 
 
100
    virtual void load();
 
101
    virtual void save();
 
102
    virtual void defaults();
 
103
 
 
104
protected Q_SLOTS:
 
105
    void fontSelected();
 
106
    void slotApplyFontDiff(); 
 
107
    void slotUseAntiAliasing();
 
108
    void slotCfgAa();
 
109
 
 
110
private:
 
111
#ifdef HAVE_FONTCONFIG
 
112
    enum AASetting { AAEnabled, AASystem, AADisabled };
 
113
    AASetting useAA, useAA_original;
 
114
    QComboBox *cbAA;
 
115
    QPushButton *aaSettingsButton;
 
116
    FontAASettings *aaSettings;
 
117
#endif
 
118
 
 
119
    enum DPISetting { DPINone, DPI96, DPI120 };
 
120
    DPISetting dpi_original;
 
121
    QComboBox* comboForceDpi;
 
122
    QList<FontUseItem *> fontUseList;
 
123
};
 
124
 
 
125
#endif
 
126