Merge branch 'master' into plasma/viranch/qml-qmenu

This commit is contained in:
Marco Martin 2011-10-28 16:24:08 +02:00
commit a8aa755fe9
22 changed files with 531 additions and 49 deletions

View File

@ -19,7 +19,128 @@
#include "theme_p.h"
#include <plasma/theme.h>
class FontProxySingleton
{
public:
FontProxySingleton()
: defaultFont(Plasma::Theme::DefaultFont),
desktopFont(Plasma::Theme::DesktopFont),
smallestFont(Plasma::Theme::SmallestFont)
{
}
FontProxy defaultFont;
FontProxy desktopFont;
FontProxy smallestFont;
};
K_GLOBAL_STATIC(FontProxySingleton, privateFontProxySingleton)
FontProxy::FontProxy(Plasma::Theme::FontRole role, QObject *parent)
: QObject(parent),
m_fontRole(role)
{
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
this, SIGNAL(boldChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
this, SIGNAL(capitalizationChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
this, SIGNAL(familyChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
this, SIGNAL(italicChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
this, SIGNAL(letterSpacingChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
this, SIGNAL(pixelSizeChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
this, SIGNAL(pointSizeChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
this, SIGNAL(strikeoutChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
this, SIGNAL(underlineChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
this, SIGNAL(weightChanged()));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
this, SIGNAL(wordSpacingChanged()));
}
FontProxy::~FontProxy()
{
}
FontProxy *FontProxy::defaultFont()
{
return &privateFontProxySingleton->defaultFont;
}
FontProxy *FontProxy::desktopFont()
{
return &privateFontProxySingleton->desktopFont;
}
FontProxy *FontProxy::smallestFont()
{
return &privateFontProxySingleton->smallestFont;
}
bool FontProxy::bold() const
{
return Plasma::Theme::defaultTheme()->font(m_fontRole).bold();
}
FontProxy::Capitalization FontProxy::capitalization() const
{
return (FontProxy::Capitalization)Plasma::Theme::defaultTheme()->font(m_fontRole).capitalization();
}
QString FontProxy::family() const
{
return Plasma::Theme::defaultTheme()->font(m_fontRole).family();
}
bool FontProxy::italic() const
{
return Plasma::Theme::defaultTheme()->font(m_fontRole).italic();
}
qreal FontProxy::letterSpacing() const
{
return Plasma::Theme::defaultTheme()->font(m_fontRole).letterSpacing();
}
int FontProxy::pixelSize() const
{
return Plasma::Theme::defaultTheme()->font(m_fontRole).pixelSize();
}
qreal FontProxy::pointSize() const
{
return Plasma::Theme::defaultTheme()->font(m_fontRole).pointSize();
}
bool FontProxy::strikeout() const
{
return Plasma::Theme::defaultTheme()->font(m_fontRole).strikeOut();
}
bool FontProxy::underline() const
{
return Plasma::Theme::defaultTheme()->font(m_fontRole).underline();
}
FontProxy::Weight FontProxy::weight() const
{
return (FontProxy::Weight)Plasma::Theme::defaultTheme()->font(m_fontRole).weight();
}
qreal FontProxy::wordSpacing() const
{
return Plasma::Theme::defaultTheme()->font(m_fontRole).wordSpacing();
}
//********** Theme *************
ThemeProxy::ThemeProxy(QObject *parent)
: QObject(parent)
@ -36,9 +157,19 @@ QString ThemeProxy::themeName() const
return Plasma::Theme::defaultTheme()->themeName();
}
QFont ThemeProxy::font() const
QObject *ThemeProxy::defaultFont() const
{
return Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
return FontProxy::defaultFont();
}
QObject *ThemeProxy::desktopFont() const
{
return FontProxy::desktopFont();
}
QObject *ThemeProxy::smallestFont() const
{
return FontProxy::smallestFont();
}
bool ThemeProxy::windowTranslucencyEnabled() const

View File

@ -25,17 +25,93 @@
#include <QFont>
#include <QColor>
#include <Plasma/Theme>
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(Plasma::Theme::FontRole role, QObject *parent = 0);
~FontProxy();
static FontProxy *defaultFont();
static FontProxy *desktopFont();
static FontProxy *smallestFont();
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();
private:
Plasma::Theme::FontRole m_fontRole;
};
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 *defaultFont READ defaultFont CONSTANT)
Q_PROPERTY(QObject *desktopFont READ desktopFont CONSTANT)
Q_PROPERTY(QObject *smallestFont READ smallestFont CONSTANT)
// colors
Q_PROPERTY(QColor textColor READ textColor NOTIFY themeChanged)
Q_PROPERTY(QColor highlightColor READ highlightColor NOTIFY themeChanged)
@ -58,7 +134,9 @@ public:
~ThemeProxy();
QString themeName() const;
QFont font() const;
QObject *defaultFont() const;
QObject *desktopFont() const;
QObject *smallestFont() const;
bool windowTranslucencyEnabled() const;
KUrl homepage() const;
bool useGlobalSettings() const;

View File

@ -3,6 +3,7 @@ project(plasmacomponents)
set(plasmacomponents_SRCS
plasmacomponentsplugin.cpp
qrangemodel.cpp
enums.cpp
)
INCLUDE_DIRECTORIES(

View File

@ -0,0 +1,24 @@
/*
* Copyright (C) 2011 by Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "enums.h"
#include "enums.moc"

View File

@ -0,0 +1,71 @@
/*
* Copyright (C) 2011 by Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef ENUMS_H
#define ENUMS_H
#include <QObject>
#include <QtDeclarative/qdeclarative.h>
class DialogStatus : public QObject
{
Q_OBJECT
Q_ENUMS(Status)
public:
enum Status {
Opening,
Open,
Closing,
Closed
};
};
class PageOrientation : public QObject
{
Q_OBJECT
Q_ENUMS(Orientation)
public:
enum Orientation {
Automatic,
LockPortrait,
LockLandscape,
LockPrevious,
Manual
};
};
class PageStatus : public QObject
{
Q_OBJECT
Q_ENUMS(Status)
public:
enum Status {
Inactive,
Activating,
Active,
Deactivating
};
};
#endif // ENUMS_H

View File

@ -23,12 +23,21 @@
#include "qrangemodel.h"
#include "enums.h"
void PlasmaComponentsPlugin::registerTypes(const char *uri)
{
Q_ASSERT(uri == QLatin1String("org.kde.plasma.components"));
qmlRegisterType<Plasma::QRangeModel>(uri, 0, 1, "RangeModel");
qmlRegisterUncreatableType<DialogStatus>(uri, 0, 1, "DialogStatus", "");
qmlRegisterUncreatableType<PageOrientation>(uri, 0, 1, "PageOrientation", "");
qmlRegisterUncreatableType<PageStatus>(uri, 0, 1, "PageStatus", "");
}

View File

@ -126,6 +126,15 @@ Item {
left: icon.right
right: parent.right
}
font.capitalization: theme.defaultFont.capitalization
font.family: theme.defaultFont.family
font.italic: theme.defaultFont.italic
font.letterSpacing: theme.defaultFont.letterSpacing
font.pointSize: theme.defaultFont.pointSize
font.strikeout: theme.defaultFont.strikeout
font.underline: theme.defaultFont.underline
font.weight: theme.defaultFont.weight
font.wordSpacing: theme.defaultFont.wordSpacing
color: theme.buttonTextColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter

View File

@ -32,6 +32,16 @@ DualStateButton {
id: fontMetricText
text: "M"
visible: false
font.capitalization: theme.defaultFont.capitalization
font.family: theme.defaultFont.family
font.italic: theme.defaultFont.italic
font.letterSpacing: theme.defaultFont.letterSpacing
font.pointSize: theme.defaultFont.pointSize
font.strikeout: theme.defaultFont.strikeout
font.underline: theme.defaultFont.underline
font.weight: theme.defaultFont.weight
font.wordSpacing: theme.defaultFont.wordSpacing
color: theme.textColor
}
PlasmaCore.SvgItem {
svg: PlasmaCore.Svg {

View File

@ -0,0 +1,42 @@
/*
* Copyright (C) 2011 by Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 1.0
import org.kde.plasma.core 0.1 as PlasmaCore
Text {
id: root
font.capitalization: theme.defaultFont.capitalization
font.family: theme.defaultFont.family
font.italic: theme.defaultFont.italic
font.letterSpacing: theme.defaultFont.letterSpacing
font.pointSize: theme.defaultFont.pointSize
font.strikeout: theme.defaultFont.strikeout
font.underline: theme.defaultFont.underline
font.weight: theme.defaultFont.weight
font.wordSpacing: theme.defaultFont.wordSpacing
color: theme.textColor
wrapMode: Text.Wrap
PlasmaCore.Theme {
id: theme
}
}

View File

@ -37,6 +37,16 @@ DualStateButton {
id: fontMetricText
text: "M"
visible: false
font.capitalization: theme.defaultFont.capitalization
font.family: theme.defaultFont.family
font.italic: theme.defaultFont.italic
font.letterSpacing: theme.defaultFont.letterSpacing
font.pointSize: theme.defaultFont.pointSize
font.strikeout: theme.defaultFont.strikeout
font.underline: theme.defaultFont.underline
font.weight: theme.defaultFont.weight
font.wordSpacing: theme.defaultFont.wordSpacing
color: theme.textColor
}
PlasmaCore.SvgItem {
svg: PlasmaCore.Svg {

View File

@ -26,6 +26,7 @@ Item {
// Common API
property Flickable flickableItem: null
property bool interactive
// Plasma API
property int orientation: Qt.Horizontal

View File

@ -89,6 +89,10 @@ Item {
opacity: enabled ? 1.0 : 0.5
PlasmaCore.Theme {
id: theme
}
PlasmaCore.FrameSvgItem {
id: hover
@ -161,6 +165,16 @@ Item {
clip: true
wrapMode: TextEdit.Wrap
enabled: textArea.enabled
font.capitalization: theme.defaultFont.capitalization
font.family: theme.defaultFont.family
font.italic: theme.defaultFont.italic
font.letterSpacing: theme.defaultFont.letterSpacing
font.pointSize: theme.defaultFont.pointSize
font.strikeout: theme.defaultFont.strikeout
font.underline: theme.defaultFont.underline
font.weight: theme.defaultFont.weight
font.wordSpacing: theme.defaultFont.wordSpacing
color: theme.viewTextColor
onCursorPositionChanged: {
if (cursorRectangle.x < flickArea.contentX) {

View File

@ -138,10 +138,19 @@ Item {
text: placeholderText
visible: textInput.text == "" && !textField.activeFocus
// XXX: using textColor and low opacity for theming placeholderText
color: theme.textColor
color: theme.viewTextColor
opacity: 0.5
elide: Text.ElideRight
clip: true
font.capitalization: theme.defaultFont.capitalization
font.family: theme.defaultFont.family
font.italic: theme.defaultFont.italic
font.letterSpacing: theme.defaultFont.letterSpacing
font.pointSize: theme.defaultFont.pointSize
font.strikeout: theme.defaultFont.strikeout
font.underline: theme.defaultFont.underline
font.weight: theme.defaultFont.weight
font.wordSpacing: theme.defaultFont.wordSpacing
}
TextInput {

View File

@ -17,13 +17,14 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 1.0
import QtQuick 1.1
import org.kde.plasma.core 0.1 as PlasmaCore
PlasmaCore.FrameSvgItem {
id: toolBar
imagePath: "widgets/frame"
prefix: "raised"
width: parent.width
height: 48 + margins.top + margins.bottom
// The current set of tools; null if none.

View File

@ -136,6 +136,15 @@ Item {
left: icon.right
right: parent.right
}
font.capitalization: theme.defaultFont.capitalization
font.family: theme.defaultFont.family
font.italic: theme.defaultFont.italic
font.letterSpacing: theme.defaultFont.letterSpacing
font.pointSize: theme.defaultFont.pointSize
font.strikeout: theme.defaultFont.strikeout
font.underline: theme.defaultFont.underline
font.weight: theme.defaultFont.weight
font.wordSpacing: theme.defaultFont.wordSpacing
color: theme.buttonTextColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter

View File

@ -2,22 +2,41 @@ 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
ListItem 0.1 ToolButton.qml
Window 0.1 Window.qml
Menu 0.1 Menu.qml
MenuItem 0.1 MenuItem.qml
MenuLayout 0.1 MenuLayout.qml
Page 0.1 Page.qml
PageStack 0.1 PageStack.qml
SelectionDialog 0.1 SelectionDialog.qml
Dialog 0.1 Dialog.qml
QueryDialog 0.1 QueryDialog.qml
ContextMenu 0.1 ContextMenu.qml
TabBar 0.1 TabBar.qml
TabBarLayout 0.1 TabBarLayout.qml
TabButton 0.1 TabButton.qml
TabGroup 0.1 TabGroup.qml
SectionScroller 0.1 SectionScroller.qml
CommonDialog 0.1 CommonDialog.qml

View File

@ -4,23 +4,37 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Components project on Qt Labs.
** This file is part of the Qt Components project.
**
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions contained
** in the Technology Preview License Agreement accompanying this package.
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/

View File

@ -4,23 +4,37 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Components project on Qt Labs.
** This file is part of the Qt Components project.
**
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions contained
** in the Technology Preview License Agreement accompanying this package.
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/

View File

@ -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 }
}
}

View File

@ -151,4 +151,4 @@ Icon=text-x-script
X-KDE-Library=plasma_appletscript_simple_javascript
X-Plasma-API=javascript
X-Plasma-ComponentTypes=Applet
X-KDE-PluginInfo-Version=4
X-KDE-PluginInfo-Version=5

View File

@ -248,6 +248,21 @@ QRectF AppletInterface::rect() const
return applet()->contentsRect();
}
void AppletInterface::setActionSeparator(const QString &name)
{
Plasma::Applet *a = applet();
QAction *action = a->action(name);
if (action) {
action->setSeparator(true);
} else {
action = new QAction(this);
action->setSeparator(true);
a->addAction(name, action);
m_actions.append(name);
}
}
void AppletInterface::setAction(const QString &name, const QString &text, const QString &icon, const QString &shortcut)
{
Plasma::Applet *a = applet();

View File

@ -256,6 +256,7 @@ enum IntervalAlignment {
Q_INVOKABLE QSizeF size() const;
Q_INVOKABLE QRectF rect() const;
Q_INVOKABLE void setActionSeparator(const QString &name);
Q_INVOKABLE void setAction(const QString &name, const QString &text,
const QString &icon = QString(), const QString &shortcut = QString());