export all the font properties in Theme
This commit is contained in:
parent
b44e60daa3
commit
8c4c66a69d
@ -21,6 +21,109 @@
|
||||
|
||||
#include <plasma/theme.h>
|
||||
|
||||
class FontProxySingleton
|
||||
{
|
||||
public:
|
||||
FontProxy self;
|
||||
};
|
||||
|
||||
K_GLOBAL_STATIC(FontProxySingleton, privateFontProxySingleton)
|
||||
|
||||
FontProxy::FontProxy(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
|
||||
this, SLOT(boldChanged()));
|
||||
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
|
||||
this, SLOT(capitalizationChanged()));
|
||||
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
|
||||
this, SLOT(familyChanged()));
|
||||
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
|
||||
this, SLOT(italicChanged()));
|
||||
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
|
||||
this, SLOT(letterSpacingChanged()));
|
||||
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
|
||||
this, SLOT(pixelSizeChanged()));
|
||||
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
|
||||
this, SLOT(pointSizeChanged()));
|
||||
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
|
||||
this, SLOT(strikeOutChanged()));
|
||||
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
|
||||
this, SLOT(underlineChanged()));
|
||||
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
|
||||
this, SLOT(weightChanged()));
|
||||
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
|
||||
this, SLOT(wordSpacingChanged()));
|
||||
}
|
||||
|
||||
FontProxy::~FontProxy()
|
||||
{
|
||||
}
|
||||
|
||||
FontProxy *FontProxy::self()
|
||||
{
|
||||
return &privateFontProxySingleton->self;
|
||||
}
|
||||
|
||||
bool FontProxy::bold() const
|
||||
{
|
||||
return Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont).bold();
|
||||
}
|
||||
|
||||
FontProxy::Capitalization FontProxy::capitalization() const
|
||||
{
|
||||
return (FontProxy::Capitalization)Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont).capitalization();
|
||||
}
|
||||
|
||||
QString FontProxy::family() const
|
||||
{
|
||||
return Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont).family();
|
||||
}
|
||||
|
||||
bool FontProxy::italic() const
|
||||
{
|
||||
return Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont).italic();
|
||||
}
|
||||
|
||||
qreal FontProxy::letterSpacing() const
|
||||
{
|
||||
return Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont).letterSpacing();
|
||||
}
|
||||
|
||||
int FontProxy::pixelSize() const
|
||||
{
|
||||
return Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont).pixelSize();
|
||||
}
|
||||
|
||||
qreal FontProxy::pointSize() const
|
||||
{
|
||||
return Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont).pointSize();
|
||||
}
|
||||
|
||||
bool FontProxy::strikeOut() const
|
||||
{
|
||||
return Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont).strikeOut();
|
||||
}
|
||||
|
||||
bool FontProxy::underline() const
|
||||
{
|
||||
return Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont).underline();
|
||||
}
|
||||
|
||||
FontProxy::Weight FontProxy::weight() const
|
||||
{
|
||||
return (FontProxy::Weight)Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont).weight();
|
||||
}
|
||||
|
||||
qreal FontProxy::wordSpacing() const
|
||||
{
|
||||
return Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont).wordSpacing();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//********** Theme *************
|
||||
|
||||
ThemeProxy::ThemeProxy(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
@ -36,9 +139,9 @@ QString ThemeProxy::themeName() const
|
||||
return Plasma::Theme::defaultTheme()->themeName();
|
||||
}
|
||||
|
||||
QFont ThemeProxy::font() const
|
||||
QObject *ThemeProxy::font() const
|
||||
{
|
||||
return Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
|
||||
return FontProxy::self();
|
||||
}
|
||||
|
||||
bool ThemeProxy::windowTranslucencyEnabled() const
|
||||
|
@ -25,17 +25,84 @@
|
||||
#include <QFont>
|
||||
#include <QColor>
|
||||
|
||||
class FontProxy : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool bold READ bold NOTIFY boldChanged)
|
||||
Q_PROPERTY(Capitalization capitalization READ capitalization NOTIFY capitalizationChanged )
|
||||
Q_PROPERTY(QString family READ family NOTIFY familyChanged )
|
||||
Q_PROPERTY(bool italic READ italic NOTIFY italicChanged )
|
||||
Q_PROPERTY(qreal letterSpacing READ letterSpacing NOTIFY letterSpacingChanged )
|
||||
Q_PROPERTY(int pixelSize READ pixelSize NOTIFY pixelSizeChanged )
|
||||
Q_PROPERTY(qreal pointSize READ pointSize NOTIFY pointSizeChanged )
|
||||
Q_PROPERTY(bool strikeOut READ strikeOut NOTIFY strikeOutChanged )
|
||||
Q_PROPERTY(bool underline READ underline NOTIFY underlineChanged )
|
||||
Q_PROPERTY(Weight weight READ weight NOTIFY weightChanged )
|
||||
Q_PROPERTY(qreal wordSpacing READ wordSpacing NOTIFY wordSpacingChanged )
|
||||
|
||||
Q_ENUMS(Capitalization)
|
||||
Q_ENUMS(Weight)
|
||||
|
||||
public:
|
||||
enum Capitalization {
|
||||
MixedCase = 0,
|
||||
AllUppercase = 1,
|
||||
AllLowercase = 2,
|
||||
SmallCaps = 3,
|
||||
Capitalize = 4
|
||||
};
|
||||
|
||||
enum Weight {
|
||||
Light = 25,
|
||||
Normal = 50,
|
||||
DemiBold = 63,
|
||||
Bold = 75,
|
||||
Black = 87
|
||||
};
|
||||
|
||||
FontProxy(QObject *parent = 0);
|
||||
~FontProxy();
|
||||
static FontProxy *self();
|
||||
|
||||
bool bold() const;
|
||||
Capitalization capitalization() const;
|
||||
QString family() const;
|
||||
bool italic() const;
|
||||
qreal letterSpacing() const;
|
||||
int pixelSize() const;
|
||||
qreal pointSize() const;
|
||||
bool strikeOut() const;
|
||||
bool underline() const;
|
||||
Weight weight() const;
|
||||
qreal wordSpacing() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void boldChanged();
|
||||
void capitalizationChanged();
|
||||
void familyChanged();
|
||||
void italicChanged();
|
||||
void letterSpacingChanged();
|
||||
void pixelSizeChanged();
|
||||
void pointSizeChanged();
|
||||
void strikeOutChanged();
|
||||
void underlineChanged();
|
||||
void weightChanged();
|
||||
void wordSpacingChanged();
|
||||
};
|
||||
|
||||
class ThemeProxy : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QString themeName READ themeName NOTIFY themeChanged)
|
||||
Q_PROPERTY(QFont font READ font NOTIFY themeChanged)
|
||||
Q_PROPERTY(bool windowTranslucentEnabled READ windowTranslucencyEnabled NOTIFY themeChanged)
|
||||
Q_PROPERTY(KUrl homepage READ homepage NOTIFY themeChanged)
|
||||
Q_PROPERTY(bool useGlobalSettings READ useGlobalSettings NOTIFY themeChanged)
|
||||
Q_PROPERTY(QString wallpaperPath READ wallpaperPath NOTIFY themeChanged)
|
||||
|
||||
//fonts
|
||||
Q_PROPERTY(QObject *font READ font CONSTANT)
|
||||
|
||||
// colors
|
||||
Q_PROPERTY(QColor textColor READ textColor NOTIFY themeChanged)
|
||||
Q_PROPERTY(QColor highlightColor READ highlightColor NOTIFY themeChanged)
|
||||
@ -58,7 +125,7 @@ public:
|
||||
~ThemeProxy();
|
||||
|
||||
QString themeName() const;
|
||||
QFont font() const;
|
||||
QObject *font() const;
|
||||
bool windowTranslucencyEnabled() const;
|
||||
KUrl homepage() const;
|
||||
bool useGlobalSettings() const;
|
||||
|
@ -2,22 +2,23 @@ plugin plasmacomponentsplugin
|
||||
|
||||
BusyIndicator 0.1 BusyIndicator.qml
|
||||
Button 0.1 Button.qml
|
||||
ButtonColumn 0.1 ButtonColumn.qml
|
||||
ButtonGroup 0.1 ButtonGroup.js
|
||||
ButtonRow 0.1 ButtonRow.qml
|
||||
ButtonColumn 0.1 ButtonColumn.qml
|
||||
CheckBox 0.1 CheckBox.qml
|
||||
FlashingLabel 0.1 FlashingLabel.qml
|
||||
Frame 0.1 Frame.qml
|
||||
IconWidget 0.1 IconWidget.qml
|
||||
Highlight 0.1 Highlight.qml
|
||||
PushButton 0.1 PushButton.qml
|
||||
IconWidget 0.1 IconWidget.qml
|
||||
Label 0.1 Label.qml
|
||||
ProgressBar 0.1 ProgressBar.qml
|
||||
PushButton 0.1 PushButton.qml
|
||||
RadioButton 0.1 RadioButton.qml
|
||||
ScrollBar 0.1 ScrollBar.qml
|
||||
ScrollDecorator 0.1 ScrollDecorator.qml
|
||||
Slider 0.1 Slider.qml
|
||||
Switch 0.1 Switch.qml
|
||||
TextField 0.1 TextField.qml
|
||||
TextArea 0.1 TextArea.qml
|
||||
TextField 0.1 TextField.qml
|
||||
ToolBar 0.1 ToolBar.qml
|
||||
ToolButton 0.1 ToolButton.qml
|
@ -23,7 +23,7 @@ import org.kde.plasma.components 0.1 as PlasmaComponents
|
||||
Column {
|
||||
spacing: 20
|
||||
|
||||
Text {
|
||||
PlasmaComponents.Label {
|
||||
font.pixelSize: 20
|
||||
text: "Slider"
|
||||
}
|
||||
@ -37,9 +37,9 @@ Column {
|
||||
}
|
||||
spacing: 10
|
||||
|
||||
Text { text: "Color Selector"; font.pixelSize: 20 }
|
||||
PlasmaComponents.Label { text: "Color Selector"; font.pixelSize: 20 }
|
||||
|
||||
Text { text: "Red" }
|
||||
PlasmaComponents.Label { text: "Red" }
|
||||
|
||||
PlasmaComponents.Slider {
|
||||
id: redSlider
|
||||
@ -53,7 +53,7 @@ Column {
|
||||
Keys.onTabPressed: greenSlider.forceActiveFocus()
|
||||
}
|
||||
|
||||
Text { text: "Green" }
|
||||
PlasmaComponents.Label { text: "Green" }
|
||||
|
||||
PlasmaComponents.Slider {
|
||||
id: greenSlider
|
||||
@ -67,7 +67,7 @@ Column {
|
||||
Keys.onTabPressed: blueSlider.forceActiveFocus()
|
||||
}
|
||||
|
||||
Text { text: "Blue" }
|
||||
PlasmaComponents.Label { text: "Blue" }
|
||||
|
||||
PlasmaComponents.Slider {
|
||||
id: blueSlider
|
||||
@ -90,7 +90,7 @@ Column {
|
||||
}
|
||||
}
|
||||
|
||||
Text { text: "Disabled Horizontal Slider" }
|
||||
PlasmaComponents.Label { text: "Disabled Horizontal Slider" }
|
||||
|
||||
PlasmaComponents.Slider {
|
||||
id: horizontalSlider
|
||||
@ -100,7 +100,7 @@ Column {
|
||||
enabled: false
|
||||
}
|
||||
|
||||
Text { text: "Inverted Horizontal Slider" }
|
||||
PlasmaComponents.Label { text: "Inverted Horizontal Slider" }
|
||||
|
||||
PlasmaComponents.Slider {
|
||||
id: invHorizontalSlider
|
||||
@ -111,7 +111,7 @@ Column {
|
||||
enabled: true
|
||||
}
|
||||
|
||||
Text { text: "Vertical Slider" }
|
||||
PlasmaComponents.Label { text: "Vertical Slider" }
|
||||
|
||||
Row {
|
||||
spacing: 30
|
||||
@ -126,7 +126,7 @@ Column {
|
||||
inverted: true
|
||||
animated: true
|
||||
}
|
||||
Text { text: verticalSlider.value }
|
||||
PlasmaComponents.Label { text: verticalSlider.value }
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user