move the controls to an independent style
* Adapt the existing controls to be generic enough to work on stock QtQuickControls * Add missing styles needed for the set to be complete (and applications actually work) The full list of controls styles is now: ApplicationWindowStyle BusyIndicatorStyle ButtonStyle CalendarStyle CheckBoxStyle ComboBoxStyle MenuBarStyle MenuStyle ProgressBarStyle RadioButtonStyle ScrollViewStyle SliderStyle SpinBoxStyle StatusBarStyle SwitchStyle TabViewStyle TableViewStyle TextAreaStyle TextFieldStyle ToolBarStyle ToolButtonStyle GroupBoxStyle Change-Id: Ic5d33bc20c7456d1478c07aca33bda63378d5c05
This commit is contained in:
parent
cf3898f7a9
commit
7d52397115
@ -4,3 +4,5 @@ add_subdirectory(plasmacomponents)
|
||||
add_subdirectory(plasmaextracomponents)
|
||||
add_subdirectory(platformcomponents)
|
||||
add_subdirectory(calendar)
|
||||
|
||||
install(DIRECTORY plasmastyle/ DESTINATION ${QML_INSTALL_DIR}/QtQuick/Controls/Styles/Plasma)
|
||||
|
@ -101,29 +101,39 @@ void IconItem::setSource(const QVariant &source)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_svgIcon) {
|
||||
m_svgIcon = new Plasma::Svg(this);
|
||||
m_svgIcon->setColorGroup(m_colorGroup);
|
||||
}
|
||||
//try as a svg icon
|
||||
m_svgIcon->setImagePath("icons/" + source.toString().split("-").first());
|
||||
|
||||
m_svgIcon->setContainsMultipleImages(true);
|
||||
|
||||
//success?
|
||||
if (m_svgIcon->isValid() && m_svgIcon->hasElement(m_source.toString())) {
|
||||
//If a url in the form file:// is passed, take the image pointed by that from disk
|
||||
QUrl url = QUrl(source.toString());
|
||||
if (url.isLocalFile()) {
|
||||
m_icon = QIcon();
|
||||
connect(m_svgIcon, SIGNAL(repaintNeeded()), this, SLOT(loadPixmap()));
|
||||
|
||||
//ok, svg not available
|
||||
} else {
|
||||
m_icon = QIcon::fromTheme(source.toString());
|
||||
m_imageIcon = QImage(url.path());
|
||||
m_pixmapIcon = QPixmap();
|
||||
delete m_svgIcon;
|
||||
m_svgIcon = 0;
|
||||
}
|
||||
} else {
|
||||
if (!m_svgIcon) {
|
||||
m_svgIcon = new Plasma::Svg(this);
|
||||
m_svgIcon->setColorGroup(m_colorGroup);
|
||||
}
|
||||
//try as a svg icon
|
||||
m_svgIcon->setImagePath("icons/" + source.toString().split("-").first());
|
||||
|
||||
m_imageIcon = QImage();
|
||||
m_pixmapIcon = QPixmap();
|
||||
m_svgIcon->setContainsMultipleImages(true);
|
||||
|
||||
//success?
|
||||
if (m_svgIcon->isValid() && m_svgIcon->hasElement(m_source.toString())) {
|
||||
m_icon = QIcon();
|
||||
connect(m_svgIcon, SIGNAL(repaintNeeded()), this, SLOT(loadPixmap()));
|
||||
|
||||
//ok, svg not available
|
||||
} else {
|
||||
m_icon = QIcon::fromTheme(source.toString());
|
||||
delete m_svgIcon;
|
||||
m_svgIcon = 0;
|
||||
m_imageIcon = QImage();
|
||||
m_pixmapIcon = QPixmap();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else if (source.canConvert<QPixmap>()) {
|
||||
m_icon = QIcon();
|
||||
|
@ -27,52 +27,3 @@ install(TARGETS plasmacomponentsplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/pl
|
||||
|
||||
install(DIRECTORY qml/ DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/components)
|
||||
|
||||
|
||||
|
||||
#The platform specific stuff, overwrites a copy of the desktop one
|
||||
#it does install some files on top of the old ones, has to be done file by file since if some component from the generic set is more recent than the specifc ones, it wouldn't be overwritten
|
||||
|
||||
install(TARGETS plasmacomponentsplugin DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
|
||||
install(FILES qml/BusyIndicator.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/ButtonColumn.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/ButtonGroup.js DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/Button.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/ButtonRow.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/CheckBox.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/CommonDialog.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/Dialog.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/Highlight.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/Label.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/ListItem.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/Page.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/PageStack.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/ProgressBar.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/QueryDialog.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/RadioButton.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/SelectionDialog.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/Slider.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/TabBar.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/TabButton.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/TabGroup.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
#install(FILES qml/TextArea.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
#install(FILES qml/TextField.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/ToolBarLayout.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/ToolBar.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
install(FILES qml/ToolButton.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
|
||||
|
||||
#Now install the private stuff!
|
||||
install(FILES qml/private/DualStateButton.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components/private)
|
||||
install(FILES qml/private/InlineDialog.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components/private)
|
||||
install(FILES qml/private/PageStack.js DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components/private)
|
||||
install(FILES qml/private/TabGroup.js DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components/private)
|
||||
install(FILES qml/private/ScrollBarDelegate.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components/private)
|
||||
install(FILES qml/private/ScrollDecoratorDelegate.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components/private)
|
||||
install(FILES qml/private/SectionScroller.js DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components/private)
|
||||
install(FILES qml/private/AppManager.js DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components/private)
|
||||
install(FILES qml/private/TabBarLayout.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components/private)
|
||||
install(FILES qml/private/TextFieldFocus.qml DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components/private)
|
||||
|
||||
#install platform overrides
|
||||
install(DIRECTORY platformcomponents/touch/ DESTINATION ${QML_INSTALL_DIR}/../platformqml/touch/org/kde/plasma/components)
|
||||
|
@ -1,23 +0,0 @@
|
||||
function placeEditBubble(mouse) {
|
||||
// Find the root item, then map our cursor position to it
|
||||
// in order to check if the edit bubble could end up off-screen
|
||||
var rootItem = parent;
|
||||
while (rootItem.parent) {
|
||||
rootItem = rootItem.parent;
|
||||
}
|
||||
var distanceToTop = mouseEventListener.mapToItem(rootItem, mouse.x, mouse.y);
|
||||
//print( " distanceToTop: " + distanceToTop.x);
|
||||
if (distanceToTop.x < editBubble.width/2) {
|
||||
// hitting the left edge
|
||||
//editBubble.x = mouse.x
|
||||
|
||||
} else {
|
||||
editBubble.x = mouse.x-(editBubble.width/2)
|
||||
}
|
||||
if (distanceToTop.y > editBubble.height) {
|
||||
editBubble.y = mouse.y-editBubble.height-8
|
||||
} else {
|
||||
//editBubble.y = mouse.y-(editBubble.width/2)
|
||||
}
|
||||
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011 by Sebastian Kügler <sebas@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 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.kquickcontrolsaddons 2.0
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: editBubble
|
||||
objectName: "editBubble"
|
||||
property int iconSize: 32;
|
||||
|
||||
imagePath: "dialogs/background"
|
||||
width: 4*iconSize
|
||||
height: 2*iconSize
|
||||
z: 100000
|
||||
//anchors { top: parent.bottom; right: parent.right; topMargin: -(iconSize/4); }
|
||||
|
||||
// fully dynamic show / hide
|
||||
//state: (textInput.activeFocus && (textInput.selectedText != "" || textInput.canPaste)) ? "expanded" : "collapsed";
|
||||
// state controlled externally
|
||||
state: "collapsed"
|
||||
|
||||
Row {
|
||||
id: buttonRow
|
||||
spacing: iconSize
|
||||
anchors { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter; margins: 8; }
|
||||
height: editBubble.iconSize
|
||||
PlasmaCore.IconItem {
|
||||
id: copyIcon
|
||||
source: "edit-copy"
|
||||
width: editBubble.iconSize
|
||||
height: editBubble.iconSize
|
||||
enabled: textInput.selectedText != ""
|
||||
MouseArea {
|
||||
anchors.centerIn: parent
|
||||
width: 2*parent.width
|
||||
height: 2*parent.height
|
||||
onClicked: { textField.copy(); editBubble.state = "collapsed"; }
|
||||
onPressed: PropertyAnimation { target: copyIcon; properties: "scale";
|
||||
from: 1.0; to: 0.9;
|
||||
duration: units.shortDuration * 3; easing.type: Easing.OutExpo; }
|
||||
onReleased: PropertyAnimation { target: copyIcon; properties: "scale";
|
||||
from: 0.9; to: 1.0;
|
||||
duration: units.shortDuration * 3; easing.type: Easing.OutExpo; }
|
||||
}
|
||||
}
|
||||
PlasmaCore.IconItem {
|
||||
id: pasteIcon
|
||||
source: "edit-paste"
|
||||
width: editBubble.iconSize
|
||||
height: editBubble.iconSize
|
||||
enabled: textInput.canPaste
|
||||
MouseArea {
|
||||
anchors.centerIn: parent;
|
||||
width: 2*parent.width
|
||||
height: 2*parent.height
|
||||
onClicked: { textField.paste(); editBubble.state = "collapsed"; }
|
||||
onPressed: PropertyAnimation { target: pasteIcon; properties: "scale";
|
||||
from: 1.0; to: 0.9;
|
||||
duration: units.shortDuration * 3; easing.type: Easing.OutExpo; }
|
||||
onReleased: PropertyAnimation { target: pasteIcon; properties: "scale";
|
||||
from: 0.9; to: 1.0;
|
||||
duration: units.shortDuration * 3; easing.type: Easing.OutExpo; }
|
||||
}
|
||||
}
|
||||
}
|
||||
states: [
|
||||
State {
|
||||
id: expanded
|
||||
name: "expanded";
|
||||
PropertyChanges { target: editBubble; opacity: 1.0; scale: 1.0 }
|
||||
},
|
||||
State {
|
||||
id: collapsed
|
||||
name: "collapsed";
|
||||
PropertyChanges { target: editBubble; opacity: 0; scale: 0.9 }
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
from: "collapsed"; to: "expanded"
|
||||
ParallelAnimation {
|
||||
PropertyAnimation { properties: "opacity"; duration: units.shortDuration * 3; easing.type: Easing.InExpo; }
|
||||
PropertyAnimation { properties: "scale"; duration: units.shortDuration * 3; easing.type: Easing.InExpo; }
|
||||
}
|
||||
},
|
||||
Transition {
|
||||
from: "expanded"; to: "collapsed"
|
||||
ParallelAnimation {
|
||||
PropertyAnimation { properties: "opacity"; duration: units.shortDuration * 3; easing.type: Easing.OutExpo; }
|
||||
PropertyAnimation { properties: "scale"; duration: units.shortDuration * 2; easing.type: Easing.OutExpo; }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,145 +0,0 @@
|
||||
/*
|
||||
* 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import "." 2.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
default property alias content: menuColumn.children
|
||||
property Item visualParent
|
||||
property int status: DialogStatus.Closed
|
||||
|
||||
onVisualParentChanged: {
|
||||
//if is a menuitem move to menuColumn
|
||||
if (visualParent.separator !== undefined) {
|
||||
var obj = arrowComponent.createObject(visualParent)
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: arrowComponent
|
||||
PlasmaCore.SvgItem {
|
||||
svg: PlasmaCore.Svg {imagePath: "widgets/arrows"}
|
||||
elementId: "right-arrow"
|
||||
width: naturalSize.width
|
||||
height: naturalSize.height
|
||||
anchors {
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
function open()
|
||||
{
|
||||
var parent = root.visualParent ? root.visualParent : root.parent
|
||||
var pos = dialog.popupPosition(parent, Qt.AlignCenter)
|
||||
dialog.x = pos.x
|
||||
dialog.y = pos.y
|
||||
|
||||
dialog.visible = true
|
||||
dialog.requestActivate()
|
||||
}
|
||||
|
||||
function close()
|
||||
{
|
||||
dialog.visible = false
|
||||
}
|
||||
|
||||
function addMenuItem(item)
|
||||
{
|
||||
item.parent = menuColumn
|
||||
}
|
||||
|
||||
onChildrenChanged: {
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
var item = children[i]
|
||||
//if is a menuitem move to menuColumn
|
||||
if (item.separator !== undefined) {
|
||||
item.parent = menuColumn
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
visible: false
|
||||
|
||||
PlasmaCore.Dialog {
|
||||
id: dialog
|
||||
visible: false
|
||||
windowFlags: Qt.Popup
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
status = DialogStatus.Open
|
||||
} else {
|
||||
status = DialogStatus.Closed
|
||||
}
|
||||
}
|
||||
|
||||
mainItem: Item {
|
||||
id: contentItem
|
||||
|
||||
width: Math.max(menuColumn.width, theme.mSize(theme.defaultFont).width * 12)
|
||||
height: Math.min(menuColumn.height, theme.mSize(theme.defaultFont).height * 25)
|
||||
|
||||
|
||||
|
||||
Flickable {
|
||||
id: listView
|
||||
anchors.fill: parent
|
||||
|
||||
clip: true
|
||||
|
||||
Column {
|
||||
id: menuColumn
|
||||
spacing: 4
|
||||
onChildrenChanged: {
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
if (children[i].clicked != undefined)
|
||||
children[i].clicked.connect(root.close)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar {
|
||||
id: scrollBar
|
||||
flickableItem: listView
|
||||
visible: listView.contentHeight > contentItem.height
|
||||
//platformInverted: root.platformInverted
|
||||
anchors { top: listView.top; right: listView.right }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onStatusChanged: {
|
||||
if (status == DialogStatus.Opening) {
|
||||
if (listView.currentItem != null) {
|
||||
listView.currentItem.focus = false
|
||||
}
|
||||
listView.currentIndex = -1
|
||||
listView.positionViewAtIndex(0, ListView.Beginning)
|
||||
}
|
||||
else if (status == DialogStatus.Open) {
|
||||
listView.focus = true
|
||||
}
|
||||
}
|
||||
}
|
@ -1,156 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Components project.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "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.
|
||||
**
|
||||
** 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$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property alias text: textArea.text
|
||||
|
||||
signal clicked
|
||||
|
||||
property bool checkable: false
|
||||
property alias font: textArea.font
|
||||
|
||||
implicitWidth: textArea.paintedWidth + iconItem.width*2 + 6
|
||||
implicitHeight: Math.max(units.iconSizes.small, textArea.paintedHeight + 6)
|
||||
width: Math.max(implicitWidth, parent.width)
|
||||
|
||||
property bool separator: false
|
||||
onSeparatorChanged: {
|
||||
if (separator) {
|
||||
internal.separatorItem = separatorComponent.createObject(root)
|
||||
} else {
|
||||
internal.separatorItem.destroy()
|
||||
}
|
||||
}
|
||||
property alias icon: iconItem.source
|
||||
|
||||
enabled: !separator
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
id: iconItem
|
||||
width: parent.height
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
Label {
|
||||
id: textArea
|
||||
anchors.centerIn: parent
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
QtObject {
|
||||
id: internal
|
||||
property Item separatorItem
|
||||
}
|
||||
Component {
|
||||
id: separatorComponent
|
||||
PlasmaCore.FrameSvgItem {
|
||||
imagePath: "widgets/viewitem"
|
||||
prefix: "normal"
|
||||
height: text ? parent.height : margins.top+margins.bottom
|
||||
anchors {
|
||||
right: parent.right
|
||||
left: parent.left
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
|
||||
property bool canceled: false
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
onPressed: {
|
||||
canceled = false
|
||||
}
|
||||
onClicked: {
|
||||
if (!canceled)
|
||||
root.clicked()
|
||||
}
|
||||
onExited: canceled = true
|
||||
}
|
||||
|
||||
Keys.onPressed: {
|
||||
event.accepted = true
|
||||
switch (event.key) {
|
||||
case Qt.Key_Select:
|
||||
case Qt.Key_Enter:
|
||||
case Qt.Key_Return: {
|
||||
if (!event.isAutoRepeat) {
|
||||
root.clicked()
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
case Qt.Key_Up: {
|
||||
if (ListView.view != null)
|
||||
ListView.view.decrementCurrentIndex()
|
||||
else
|
||||
event.accepted = false
|
||||
break
|
||||
}
|
||||
|
||||
case Qt.Key_Down: {
|
||||
if (ListView.view != null)
|
||||
ListView.view.incrementCurrentIndex()
|
||||
else
|
||||
event.accepted = false
|
||||
break
|
||||
}
|
||||
default: {
|
||||
event.accepted = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,139 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
|
||||
* Copyright (C) 2011 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 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import "private" as Private
|
||||
|
||||
|
||||
/**
|
||||
* A generic ScrollBar/ScrollDecorator component:
|
||||
* Always prefer this to ScrollDecorator that is not available on desktop.
|
||||
* By default, this component will look and behave like a scroll decorator on touchscreens
|
||||
*/
|
||||
// TODO: add support mouse wheel events
|
||||
Item {
|
||||
id: scrollbar
|
||||
|
||||
// Common API
|
||||
property Flickable flickableItem: null
|
||||
property int orientation: Qt.Vertical
|
||||
property bool interactive: false
|
||||
|
||||
// Plasma API
|
||||
property bool inverted: false
|
||||
property alias stepSize: range.stepSize
|
||||
property bool pressed: internalLoader.item.mouseArea?internalLoader.item.mouseArea.pressed:false
|
||||
property real scrollButtonInterval: 50
|
||||
|
||||
implicitWidth: internalLoader.isVertical ? (interactive ? 22 : 12) : 200
|
||||
implicitHeight: internalLoader.isVertical ? 200 : (interactive ? 22 : 12)
|
||||
// TODO: needs to define if there will be specific graphics for
|
||||
// disabled scroll bars
|
||||
opacity: enabled ? 1.0 : 0.5
|
||||
|
||||
visible: flickableItem && internalLoader.handleEnabled
|
||||
|
||||
anchors {
|
||||
right: internalLoader.anchorableWithFlickable ? flickableItem.right : undefined
|
||||
left: (orientation == Qt.Vertical) ? undefined : (internalLoader.anchorableWithFlickable ? flickableItem.left : undefined)
|
||||
top: (orientation == Qt.Vertical) ? (internalLoader.anchorableWithFlickable ? flickableItem.top : undefined) : undefined
|
||||
bottom: internalLoader.anchorableWithFlickable ? flickableItem.bottom : undefined
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: internalLoader
|
||||
anchors.fill: parent
|
||||
//property bool handleEnabled: internalLoader.isVertical ? item.handle.height < item.contents.height : item.handle.width < item.contents.width
|
||||
property bool handleEnabled: internalLoader.isVertical ? flickableItem.contentHeight > flickableItem.height : flickableItem.contentWidth > flickableItem.width
|
||||
property bool isVertical: orientation == Qt.Vertical
|
||||
property bool anchorableWithFlickable: scrollbar.parent == flickableItem || scrollbar.parent == flickableItem.parent
|
||||
|
||||
function incrementValue(increment)
|
||||
{
|
||||
if (!flickableItem)
|
||||
return;
|
||||
|
||||
if (internalLoader.isVertical) {
|
||||
flickableItem.contentY = Math.max(0, Math.min(flickableItem.contentHeight,
|
||||
flickableItem.contentY + increment))
|
||||
} else {
|
||||
flickableItem.contentX = Math.max(0, Math.min(flickableItem.contentWidth,
|
||||
flickableItem.contentX + increment))
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.RangeModel {
|
||||
id: range
|
||||
|
||||
minimumValue: 0
|
||||
maximumValue: {
|
||||
var diff;
|
||||
if (internalLoader.isVertical) {
|
||||
diff = flickableItem.contentHeight - flickableItem.height
|
||||
} else {
|
||||
diff = flickableItem.contentWidth - flickableItem.width
|
||||
}
|
||||
|
||||
return Math.max(0, diff)
|
||||
}
|
||||
|
||||
stepSize: 10
|
||||
inverted: scrollbar.inverted
|
||||
positionAtMinimum: 0
|
||||
positionAtMaximum: {
|
||||
if (internalLoader.isVertical) {
|
||||
internalLoader.item.contents.height - internalLoader.item.handle.height
|
||||
} else {
|
||||
internalLoader.item.contents.width - internalLoader.item.handle.width
|
||||
}
|
||||
}
|
||||
value: internalLoader.isVertical ? flickableItem.contentY : flickableItem.contentX
|
||||
onValueChanged: {
|
||||
if (flickableItem.moving) {
|
||||
return
|
||||
}
|
||||
|
||||
if (internalLoader.isVertical) {
|
||||
flickableItem.contentY = value
|
||||
} else {
|
||||
flickableItem.contentX = value
|
||||
}
|
||||
}
|
||||
|
||||
position: internalLoader.isVertical ? internalLoader.item.handle.y : internalLoader.item.handle.x
|
||||
|
||||
onPositionChanged: {
|
||||
if (internalLoader.item.mouseArea && internalLoader.item.mouseArea.pressed) {
|
||||
return
|
||||
}
|
||||
|
||||
if (internalLoader.isVertical) {
|
||||
internalLoader.item.handle.y = position
|
||||
} else {
|
||||
internalLoader.item.handle.x = position
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
source: interactive ? "private/ScrollBarDelegate.qml" : "private/ScrollDecoratorDelegate.qml"
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
/**
|
||||
* Just provided for compatibility
|
||||
* Use ScrollBar instead. will behave like a ScrollDecorator on touchscreens
|
||||
*/
|
||||
ScrollBar {
|
||||
interactive: false
|
||||
}
|
@ -1,238 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Components project.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "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.
|
||||
**
|
||||
** 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$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import "private/SectionScroller.js" as Sections
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
/**
|
||||
* It's similar to a ScrollBar or a ScrollDecorator.
|
||||
* It's interactive and works on ListViews that have section.property set,
|
||||
* so its contents are categorized.
|
||||
* An indicator will say to what category the user scrolled to.
|
||||
*
|
||||
* Useful for things like address books or things sorted by date.
|
||||
* Don't use with models too big (thousands of items) because implies
|
||||
* loading all the items to memory, as well loses precision.
|
||||
*/
|
||||
Item {
|
||||
id: root
|
||||
|
||||
/**
|
||||
* The listview this scroll indicator will work on
|
||||
*/
|
||||
property ListView listView
|
||||
|
||||
onListViewChanged: {
|
||||
if (listView && listView.model)
|
||||
internal.initDirtyObserver();
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: listView
|
||||
onModelChanged: {
|
||||
if (listView && listView.model) {
|
||||
internal.initDirtyObserver()
|
||||
}
|
||||
}
|
||||
onMovementStarted: root.opacity = 1
|
||||
onMovementEnded: {
|
||||
if (!dragArea.pressed) {
|
||||
fadeTimer.restart()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
width: 48
|
||||
opacity: 0
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: units.longDuration
|
||||
}
|
||||
}
|
||||
|
||||
anchors {
|
||||
right: listView.right
|
||||
top: listView.top
|
||||
bottom: listView.bottom
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: fadeTimer
|
||||
interval: 4000
|
||||
repeat: false
|
||||
running: false
|
||||
onTriggered: {
|
||||
root.opacity = 0
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.RangeModel {
|
||||
id: range
|
||||
|
||||
minimumValue: 0
|
||||
maximumValue: Math.max(0, listView.contentHeight - listView.height)
|
||||
stepSize: 0
|
||||
//inverted: true
|
||||
positionAtMinimum: handle.height / 2
|
||||
positionAtMaximum: root.height - handle.height - handle.height / 2
|
||||
value: listView.contentY
|
||||
onValueChanged: {
|
||||
if (listView.moving) {
|
||||
return
|
||||
} else {
|
||||
listView.contentY = value
|
||||
}
|
||||
}
|
||||
//position: handle.y
|
||||
onPositionChanged: {
|
||||
if (!dragArea.pressed) {
|
||||
handle.y = position
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Qt.rgba(0,0,0,0.3)
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: handle
|
||||
width: 6
|
||||
height: 6
|
||||
color: theme.textColor
|
||||
opacity: 0.7
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
border {
|
||||
width: 1
|
||||
color: theme.backgroundColor
|
||||
}
|
||||
onYChanged: {
|
||||
if (dragArea.pressed) {
|
||||
range.position = y
|
||||
}
|
||||
sectionLabel.text = Sections.closestSection(y/listView.height)
|
||||
}
|
||||
}
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: tooltip
|
||||
imagePath: "widgets/tooltip"
|
||||
width: sectionLabel.paintedWidth + margins.left + margins.right
|
||||
height: sectionLabel.paintedHeight + margins.top + margins.bottom
|
||||
Label {
|
||||
id: sectionLabel
|
||||
font.pointSize: theme.defaultFont.pointSize * 1.5
|
||||
x: parent.margins.left
|
||||
y: parent.margins.top
|
||||
}
|
||||
y: Math.min(root.height-height, Math.max(0, handle.y - height/2))
|
||||
anchors {
|
||||
//verticalCenter: handle.verticalCenter
|
||||
right: parent.left
|
||||
}
|
||||
opacity: dragArea.pressed?1:0
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: units.longDuration
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: dragArea
|
||||
anchors.fill: parent
|
||||
//enabled: scrollbar.enabled
|
||||
drag {
|
||||
target: handle
|
||||
axis: Drag.YAxis
|
||||
minimumY: range.positionAtMinimum
|
||||
maximumY: range.positionAtMaximum
|
||||
}
|
||||
onPressed: {
|
||||
mouse.accepted = true
|
||||
handle.y = mouse.y
|
||||
fadeTimer.running = false
|
||||
}
|
||||
onReleased: fadeTimer.restart()
|
||||
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: dirtyTimer
|
||||
interval: 250
|
||||
onTriggered: {
|
||||
Sections.initSectionData(listView);
|
||||
internal.modelDirty = false;
|
||||
tooltip.visible = Sections._sections.length > 1
|
||||
}
|
||||
}
|
||||
QtObject {
|
||||
id: internal
|
||||
|
||||
property bool modelDirty: false
|
||||
function initDirtyObserver() {
|
||||
Sections.initSectionData(listView);
|
||||
tooltip.visible = Sections._sections.length > 1
|
||||
function dirtyObserver() {
|
||||
if (!internal.modelDirty) {
|
||||
internal.modelDirty = true;
|
||||
dirtyTimer.running = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (listView.model.countChanged)
|
||||
listView.model.countChanged.connect(dirtyObserver);
|
||||
|
||||
if (listView.model.itemsChanged)
|
||||
listView.model.itemsChanged.connect(dirtyObserver);
|
||||
|
||||
if (listView.model.itemsInserted)
|
||||
listView.model.itemsInserted.connect(dirtyObserver);
|
||||
|
||||
if (listView.model.itemsMoved)
|
||||
listView.model.itemsMoved.connect(dirtyObserver);
|
||||
|
||||
if (listView.model.itemsRemoved)
|
||||
listView.model.itemsRemoved.connect(dirtyObserver);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,307 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Marco Martin <mart@kde.org>
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Components project.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "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.
|
||||
**
|
||||
** 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$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import "private/AppManager.js" as Utils
|
||||
import "." 2.0
|
||||
|
||||
/**Documented API
|
||||
Inherits:
|
||||
Item
|
||||
|
||||
Imports:
|
||||
QtQuick 2.0
|
||||
org.kde.plasma.core
|
||||
|
||||
Description:
|
||||
Provides a top-level window for short-term tasks and brief interaction with the user.
|
||||
Is intended to be for interaction more complex and bigger in size then Dialog. On the desktop its looks is almost identical to Dialog, on touch interfaces is an almost fullscreen sliding Sheet. It is provided mostly for compatibility with mobile implementations
|
||||
|
||||
Properties:
|
||||
list<Item> content:
|
||||
A list of items in the dialog's content area. You can use any component that is based on Item. For example, you can use ListView, so that the user can select from a list of names.
|
||||
|
||||
int status:
|
||||
Indicates the dialog's phase in its life cycle. The values are as follows:
|
||||
- DialogStatus.Opening - the dialog is opening
|
||||
- DialogStatus.Open - the dialog is open and visible to the user
|
||||
- DialogStatus.Closing - the dialog is closing
|
||||
- DialogStatus.Closed - the dialog is closed and not visible to the user
|
||||
The dialog's initial status is DialogStatus.Closed.
|
||||
|
||||
string title:
|
||||
The title text of this Sheet.
|
||||
|
||||
Item acceptButton:
|
||||
button that when pressed will close the dialog, representing the user accepting it, accepted() will be called
|
||||
|
||||
Item rejectButton:
|
||||
button that when pressed will close the dialog, representing the user rejecting it, rejected() will be called
|
||||
|
||||
string acceptButtonText:
|
||||
Text of the accept button
|
||||
|
||||
string rejectButtonText:
|
||||
Text of the reject button
|
||||
|
||||
Item visualParent:
|
||||
The item that is dimmed when the dialog opens. By default the root parent object is visualParent.
|
||||
|
||||
Signals:
|
||||
accepted():
|
||||
This signal is emitted when the user accepts the dialog's request or the accept() method is called.
|
||||
See also rejected().
|
||||
|
||||
clickedOutside(): This signal is emitted when the user taps in the area that is inside the dialog's visual parent area but outside the dialog's area. Normally the visual parent is the root object. In that case this signal is emitted if the user taps anywhere outside the dialog's area.
|
||||
See also visualParent.
|
||||
|
||||
rejected():
|
||||
This signal is emitted when the user rejects the dialog's request or the reject() method is called.
|
||||
See also accepted().
|
||||
|
||||
Methods:
|
||||
void accept():
|
||||
Accepts the dialog's request without any user interaction. The method emits the accepted() signal and closes the dialog.
|
||||
See also reject().
|
||||
|
||||
void close():
|
||||
Closes the dialog without any user interaction.
|
||||
|
||||
void open():
|
||||
Shows the dialog to the user.
|
||||
|
||||
void reject():
|
||||
Rejects the dialog's request without any user interaction. The method emits the rejected() signal and closes the dialog.
|
||||
See also accept().
|
||||
**/
|
||||
|
||||
Item {
|
||||
id: root
|
||||
width: 800
|
||||
height: 600
|
||||
onHeightChanged:print(height)
|
||||
|
||||
property alias title: titleLabel.text
|
||||
property alias content: contentItem.children
|
||||
// property alias visualParent: dialog.visualParent
|
||||
property int status: DialogStatus.Closed
|
||||
property alias acceptButtonText: acceptButton.text
|
||||
property alias rejectButtonText: rejectButton.text
|
||||
property alias acceptButton: acceptButton
|
||||
property alias rejectButton: rejectButton
|
||||
|
||||
|
||||
property alias privateTitleHeight: titleBar.height
|
||||
|
||||
signal accepted
|
||||
signal rejected
|
||||
signal clickedOutside
|
||||
|
||||
function open()
|
||||
{
|
||||
status = DialogStatus.Opening
|
||||
delayOpenTimer.restart()
|
||||
}
|
||||
|
||||
function accept()
|
||||
{
|
||||
if (status == DialogStatus.Open) {
|
||||
status = DialogStatus.Closing
|
||||
accepted()
|
||||
dialog.state = "closed"
|
||||
}
|
||||
}
|
||||
|
||||
function reject()
|
||||
{
|
||||
if (status == DialogStatus.Open) {
|
||||
status = DialogStatus.Closing
|
||||
dialog.state = "closed"
|
||||
rejected()
|
||||
}
|
||||
}
|
||||
|
||||
function close()
|
||||
{
|
||||
dialog.state = "closed"
|
||||
}
|
||||
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
clickedOutside()
|
||||
close()
|
||||
}
|
||||
}
|
||||
Timer {
|
||||
id: delayOpenTimer
|
||||
running: false
|
||||
interval: 100
|
||||
onTriggered: dialog.state = ""
|
||||
}
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: dialog
|
||||
anchors {
|
||||
fill: parent
|
||||
leftMargin: 50
|
||||
topMargin: 50
|
||||
rightMargin: 50
|
||||
bottomMargin: 0
|
||||
}
|
||||
imagePath: "dialogs/background"
|
||||
enabledBorders: "LeftBorder|TopBorder|RightBorder"
|
||||
|
||||
state: "closed"
|
||||
|
||||
//state: "Hidden"
|
||||
|
||||
MouseArea {
|
||||
id: mainItem
|
||||
x: dialog.margins.left
|
||||
y: dialog.margins.top
|
||||
width: parent.width - dialog.margins.left - dialog.margins.right
|
||||
height: parent.height - dialog.margins.top - dialog.margins.bottom
|
||||
|
||||
onClicked: mouse.accepted = true
|
||||
|
||||
// Consume all key events that are not processed by children
|
||||
Keys.onPressed: event.accepted = true
|
||||
Keys.onReleased: event.accepted = true
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: titleBar
|
||||
imagePath: "widgets/extender-dragger"
|
||||
prefix: "root"
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
//FIXME: +5 because of Plasma::Dialog margins
|
||||
height: Math.max(titleLabel.paintedHeight, acceptButton.height) + margins.top + margins.bottom
|
||||
|
||||
Item {
|
||||
id: titleLayoutHelper
|
||||
|
||||
anchors {
|
||||
right: parent.right
|
||||
left: parent.left
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
leftMargin: parent.margins.left
|
||||
rightMargin: parent.margins.right
|
||||
topMargin: parent.margins.top
|
||||
bottomMargin: parent.margins.bottom
|
||||
}
|
||||
|
||||
Button {
|
||||
id: acceptButton
|
||||
onClicked: accept()
|
||||
visible: text !== ""
|
||||
anchors {
|
||||
left: parent.left
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
Label {
|
||||
id: titleLabel
|
||||
elide: Text.ElideRight
|
||||
height: paintedHeight
|
||||
font.pointSize: theme.defaultFont.pointSize * 1.1
|
||||
font.weight: Font.Bold
|
||||
style: Text.Raised
|
||||
styleColor: Qt.rgba(1,1,1,0.8)
|
||||
anchors {
|
||||
left: acceptButton.visible ? acceptButton.right : parent.left
|
||||
//still depends from acceptButton to make text more centered
|
||||
right: acceptButton.visible ? rejectButton.left : parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
Button {
|
||||
id: rejectButton
|
||||
onClicked: reject()
|
||||
visible: text !== ""
|
||||
anchors {
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: contentItem
|
||||
|
||||
clip: true
|
||||
onChildrenRectChanged: mainItem.width = childrenRect.width
|
||||
anchors {
|
||||
top: titleBar.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "closed"
|
||||
PropertyChanges {
|
||||
target: root
|
||||
status: DialogStatus.Closed
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: ""
|
||||
PropertyChanges {
|
||||
target: root
|
||||
status: DialogStatus.Open
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
|
||||
*
|
||||
* 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 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import "private" as Private
|
||||
|
||||
/**
|
||||
* A boolean toggle button with the visual representation of a "realistic"
|
||||
* switch with a movable toggle showing the state of the Switch. Generally
|
||||
* easier to use on touch devices than a CheckBox due to the larger surface
|
||||
* space and more evident state visualization.
|
||||
*
|
||||
* You can bind the Switch component, for example, to a feature that the
|
||||
* application has to enable or disable depending on the user's input.
|
||||
*
|
||||
* All elements of this component are defined in DualStateButton, its base component.
|
||||
*/
|
||||
Private.DualStateButton {
|
||||
id: switchItem
|
||||
|
||||
view: PlasmaCore.FrameSvgItem {
|
||||
imagePath: "widgets/slider"
|
||||
prefix: "groove"
|
||||
width: height * 2
|
||||
height: Math.max(theme.mSize(theme.defaultFont).height + margins.top + margins.bottom,
|
||||
button.margins.top + button.margins.bottom)
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: highlight
|
||||
imagePath: "widgets/slider"
|
||||
prefix: "groove-highlight"
|
||||
anchors.fill: parent
|
||||
|
||||
opacity: checked ? 1 : 0
|
||||
Behavior on opacity {
|
||||
PropertyAnimation { duration: units.shortDuration * 2 }
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
imagePath: "widgets/button"
|
||||
prefix: "shadow"
|
||||
anchors {
|
||||
fill: button
|
||||
leftMargin: -margins.left
|
||||
topMargin: -margins.top
|
||||
rightMargin: -margins.right
|
||||
bottomMargin: -margins.bottom
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: button
|
||||
imagePath: "widgets/button"
|
||||
prefix: "normal"
|
||||
anchors {
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
width: height
|
||||
x: checked ? width : 0
|
||||
Behavior on x {
|
||||
PropertyAnimation { duration: units.shortDuration * 2 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,248 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
|
||||
*
|
||||
* 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 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.kquickcontrolsaddons 2.0
|
||||
import "EditBubble.js" as EditBubbleHelper
|
||||
|
||||
Item {
|
||||
id: textArea
|
||||
|
||||
// Common API
|
||||
property alias font: textEdit.font // alias to textEdit.font
|
||||
property int inputMethodHints
|
||||
property bool errorHighlight
|
||||
property alias cursorPosition: textEdit.cursorPosition
|
||||
property alias horizontalAlignment: textEdit.horizontalAlignment
|
||||
property alias verticalAlignment: textEdit.verticalAlignment
|
||||
property alias readOnly: textEdit.readOnly
|
||||
property alias selectedText: textEdit.selectedText // read-only
|
||||
property alias selectionEnd: textEdit.selectionEnd // read-only
|
||||
property alias selectionStart: textEdit.selectionStart // read-only
|
||||
property alias text: textEdit.text
|
||||
property alias textFormat: textEdit.textFormat // enumeration
|
||||
property alias wrapMode: textEdit.wrapMode // enumeration
|
||||
property string placeholderText
|
||||
|
||||
property alias textField: textArea
|
||||
|
||||
// functions
|
||||
function copy() {
|
||||
textEdit.copy();
|
||||
}
|
||||
|
||||
function paste() {
|
||||
textEdit.paste();
|
||||
}
|
||||
|
||||
function cut() {
|
||||
textEdit.cut();
|
||||
}
|
||||
|
||||
function select(start, end) {
|
||||
textEdit.select(start, end);
|
||||
}
|
||||
|
||||
function selectAll() {
|
||||
textEdit.selectAll();
|
||||
}
|
||||
|
||||
function selectWord() {
|
||||
textEdit.selectWord();
|
||||
}
|
||||
|
||||
function positionAt(pos) {
|
||||
textEdit.positionAt(pos);
|
||||
}
|
||||
|
||||
function positionToRectangle(pos) {
|
||||
textEdit.positionToRectangle(pos);
|
||||
}
|
||||
|
||||
// Plasma API
|
||||
property alias interactive: flickArea.interactive
|
||||
property alias contentMaxWidth: textEdit.width
|
||||
property alias contentMaxHeight: textEdit.height
|
||||
property alias textInput: textEdit
|
||||
|
||||
// Set active focus to it's internal textInput.
|
||||
// Overriding QtQuick.Item forceActiveFocus function.
|
||||
function forceActiveFocus() {
|
||||
textEdit.forceActiveFocus();
|
||||
}
|
||||
|
||||
// Overriding QtQuick.Item activeFocus property.
|
||||
property alias activeFocus: textEdit.activeFocus
|
||||
|
||||
opacity: enabled ? 1.0 : 0.5
|
||||
|
||||
TextFieldFocus {
|
||||
id: hover
|
||||
state: textArea.activeFocus ? "focus" : (mouseWatcher.containsMouse ? "hover" : "hidden")
|
||||
anchors.fill: base
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseWatcher
|
||||
anchors.fill: hover
|
||||
hoverEnabled: true
|
||||
}
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: base
|
||||
|
||||
// TODO: see what is the best policy for margins
|
||||
anchors {
|
||||
fill: parent
|
||||
}
|
||||
imagePath: "widgets/lineedit"
|
||||
prefix: "base"
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: flickArea
|
||||
anchors {
|
||||
fill: parent
|
||||
leftMargin: 2 * base.margins.left
|
||||
rightMargin: 2 * base.margins.right + (verticalScroll.visible ? verticalScroll.width : 0)
|
||||
topMargin: 2 * base.margins.top
|
||||
bottomMargin: 2 * base.margins.bottom + (horizontalScroll.visible ? verticalScroll.width : 0)
|
||||
}
|
||||
interactive: !verticalScroll.interactive //textArea.activeFocus
|
||||
contentWidth: {
|
||||
if (textEdit.wrapMode == TextEdit.NoWrap)
|
||||
return textEdit.paintedWidth;
|
||||
|
||||
return Math.min(textEdit.paintedWidth, textEdit.width);
|
||||
}
|
||||
contentHeight: Math.min(textEdit.paintedHeight, textEdit.height)
|
||||
clip: true
|
||||
MouseEventListener {
|
||||
id: mouseEventListener
|
||||
//anchors.fill: parent
|
||||
onPressed: forceActiveFocus();
|
||||
//onPressed: print(" MouseEventListener Pressed");
|
||||
onPressAndHold: {
|
||||
print(" *** MouseEventListener PressAndHold");
|
||||
//forceActiveFocus();
|
||||
EditBubbleHelper.placeEditBubble(mouse);
|
||||
editBubble.state = (textInput.activeFocus && (textInput.selectedText != "" || textInput.canPaste)) ? "expanded" : "collapsed";
|
||||
}
|
||||
onPositionChanged: {
|
||||
EditBubbleHelper.placeEditBubble(mouse);
|
||||
}
|
||||
}
|
||||
|
||||
TextEdit {
|
||||
id: textEdit
|
||||
parent: mouseEventListener
|
||||
width: flickArea.width
|
||||
height: flickArea.height
|
||||
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.buttonTextColor
|
||||
selectByMouse: verticalScroll.interactive
|
||||
|
||||
onCursorPositionChanged: {
|
||||
if (cursorRectangle.x < flickArea.contentX) {
|
||||
flickArea.contentX = cursorRectangle.x;
|
||||
return;
|
||||
}
|
||||
|
||||
if (cursorRectangle.x > flickArea.contentX +
|
||||
flickArea.width - cursorRectangle.width) {
|
||||
flickArea.contentX = cursorRectangle.x -
|
||||
cursorRectangle.width;
|
||||
return;
|
||||
}
|
||||
|
||||
if (cursorRectangle.y < flickArea.contentY) {
|
||||
flickArea.contentY = cursorRectangle.y;
|
||||
return;
|
||||
}
|
||||
|
||||
if (cursorRectangle.y > flickArea.contentY +
|
||||
flickArea.height - cursorRectangle.height) {
|
||||
flickArea.contentY = cursorRectangle.y -
|
||||
cursorRectangle.height;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Proxying keys events is not required by the
|
||||
// common API but is desired in the plasma API.
|
||||
Keys.onPressed: textArea.Keys.pressed(event);
|
||||
Keys.onReleased: textArea.Keys.released(event);
|
||||
|
||||
Text {
|
||||
anchors.fill: parent
|
||||
text: textArea.placeholderText
|
||||
visible: textEdit.text == "" && !textArea.activeFocus
|
||||
opacity: 0.5
|
||||
color: theme.buttonTextColor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar {
|
||||
id: horizontalScroll
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
right: flickArea.right
|
||||
}
|
||||
enabled: parent.enabled
|
||||
flickableItem: flickArea
|
||||
orientation: Qt.Horizontal
|
||||
stepSize: textEdit.font.pixelSize
|
||||
}
|
||||
|
||||
ScrollBar {
|
||||
id: verticalScroll
|
||||
anchors {
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
bottom: flickArea.bottom
|
||||
}
|
||||
enabled: parent.enabled
|
||||
flickableItem: flickArea
|
||||
orientation: Qt.Vertical
|
||||
stepSize: textEdit.font.pixelSize
|
||||
}
|
||||
|
||||
EditBubble { id: editBubble; iconSize: 32; }
|
||||
|
||||
onActiveFocusChanged: {
|
||||
if (!activeFocus) {
|
||||
editBubble.state = "collapsed";
|
||||
//print("Hiding...");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,216 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
|
||||
*
|
||||
* 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 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.kquickcontrolsaddons 2.0
|
||||
import "EditBubble.js" as EditBubbleHelper
|
||||
|
||||
Item {
|
||||
id: textField
|
||||
|
||||
// Common API
|
||||
property bool errorHighlight: false // TODO
|
||||
property string placeholderText
|
||||
property alias inputMethodHints: textInput.inputMethodHints
|
||||
property alias font: textInput.font
|
||||
|
||||
property alias cursorPosition: textInput.cursorPosition
|
||||
property alias readOnly: textInput.readOnly
|
||||
property alias echoMode: textInput.echoMode // Supports TextInput.Normal,TextInput.Password, TextInput.NoEcho, TextInput.PasswordEchoOnEdit
|
||||
property alias passwordCharacter: textInput.passwordCharacter
|
||||
|
||||
property alias acceptableInput: textInput.acceptableInput // read-only
|
||||
property alias inputMask: textInput.inputMask
|
||||
property alias validator: textInput.validator
|
||||
property alias selectedText: textInput.selectedText // read-only
|
||||
property alias selectionEnd: textInput.selectionEnd // read-only
|
||||
property alias selectionStart: textInput.selectionStart // read-only
|
||||
property alias text: textInput.text
|
||||
property alias maximumLength: textInput.maximumLength
|
||||
|
||||
//Plasma api
|
||||
property bool clearButtonShown: false
|
||||
|
||||
function copy() {
|
||||
textInput.copy();
|
||||
}
|
||||
|
||||
function paste() {
|
||||
textInput.paste();
|
||||
}
|
||||
|
||||
function cut() {
|
||||
textInput.cut();
|
||||
}
|
||||
|
||||
function select(start, end) {
|
||||
textInput.select(start, end);
|
||||
}
|
||||
|
||||
function selectAll() {
|
||||
textInput.selectAll();
|
||||
}
|
||||
|
||||
function selectWord() {
|
||||
textInput.selectWord();
|
||||
}
|
||||
|
||||
function positionAt(pos) {
|
||||
textInput.positionAt(pos);
|
||||
}
|
||||
|
||||
function positionToRectangle(pos) {
|
||||
textInput.positionToRectangle(pos);
|
||||
}
|
||||
|
||||
|
||||
// Set active focus to it's internal textInput.
|
||||
// Overriding QtQuick.Item forceActiveFocus function.
|
||||
function forceActiveFocus() {
|
||||
textInput.forceActiveFocus();
|
||||
}
|
||||
|
||||
|
||||
// TODO: fix default size
|
||||
implicitWidth: theme.mSize(theme.defaultFont).width*12
|
||||
implicitHeight: theme.mSize(theme.defaultFont).height*1.6
|
||||
// TODO: needs to define if there will be specific graphics for
|
||||
// disabled text fields
|
||||
opacity: enabled ? 1.0 : 0.5
|
||||
|
||||
TextFieldFocus {
|
||||
id: hover
|
||||
state: textInput.activeFocus ? "focus" : (mouseWatcher.containsMouse ? "hover" : "hidden")
|
||||
anchors.fill: base
|
||||
}
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: base
|
||||
|
||||
// TODO: see what is the correct policy for margins
|
||||
anchors.fill: parent
|
||||
imagePath: "widgets/lineedit"
|
||||
prefix: "base"
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseWatcher
|
||||
anchors.fill: hover
|
||||
hoverEnabled: false
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
leftMargin: 2 * base.margins.left
|
||||
rightMargin: 2 * base.margins.right
|
||||
}
|
||||
text: placeholderText
|
||||
visible: textInput.text == "" && !textField.activeFocus
|
||||
// XXX: using textColor and low opacity for theming placeholderText
|
||||
color: theme.buttonTextColor
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
EditBubble { id: editBubble; iconSize: 32 }
|
||||
|
||||
TextInput {
|
||||
id: textInput
|
||||
parent: mouseEventListener
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
// TODO: see what is the correct policy for margins
|
||||
leftMargin: 2 * base.margins.left
|
||||
rightMargin: 2 * base.margins.right
|
||||
}
|
||||
selectByMouse: true
|
||||
passwordCharacter: "•"
|
||||
color: theme.buttonTextColor
|
||||
enabled: textField.enabled
|
||||
clip: true
|
||||
|
||||
// Proxying keys events is not required by the
|
||||
// common API but is desired in the plasma API.
|
||||
Keys.forwardTo: textField
|
||||
}
|
||||
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
parent: mouseEventListener // reparent to the MouseFilter for MouseArea to work
|
||||
id: clearButton
|
||||
source: "edit-clear-locationbar-rtl"
|
||||
height: Math.max(textInput.height, units.iconSizes.medium)
|
||||
width: height
|
||||
opacity: (textInput.text != "" && clearButtonShown) ? 1 : 0
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
anchors {
|
||||
right: parent.right
|
||||
rightMargin: y
|
||||
verticalCenter: textInput.verticalCenter
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
textInput.text = ""
|
||||
textInput.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseEventListener {
|
||||
id: mouseEventListener
|
||||
anchors.fill: parent
|
||||
onPressAndHold: {
|
||||
EditBubbleHelper.placeEditBubble(mouse);
|
||||
editBubble.state = (textInput.activeFocus && (textInput.selectedText != "" || textInput.canPaste)) ? "expanded" : "collapsed";
|
||||
}
|
||||
onPositionChanged: {
|
||||
EditBubbleHelper.placeEditBubble(mouse);
|
||||
}
|
||||
}
|
||||
|
||||
onActiveFocusChanged: {
|
||||
if (!activeFocus) {
|
||||
editBubble.state = "collapsed";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
|
||||
* 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
Item {
|
||||
id: main
|
||||
state: parent.state
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: hover
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
leftMargin: -margins.left
|
||||
topMargin: -margins.top
|
||||
rightMargin: -margins.right
|
||||
bottomMargin: -margins.bottom
|
||||
}
|
||||
opacity: 0
|
||||
imagePath: "widgets/lineedit"
|
||||
prefix: "hover"
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "focus"
|
||||
PropertyChanges {
|
||||
target: hover
|
||||
opacity: 1
|
||||
prefix: "focus"
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "hidden"
|
||||
PropertyChanges {
|
||||
target: hover
|
||||
opacity: 0
|
||||
prefix: "hover"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
PropertyAnimation {
|
||||
properties: "opacity"
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.OutQuad
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the Qt Components project.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "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.
|
||||
**
|
||||
** 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$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property bool inPortrait: height > width
|
||||
signal orientationChangeAboutToStart
|
||||
signal orientationChangeStarted
|
||||
signal orientationChangeFinished
|
||||
|
||||
width: 800
|
||||
height: 480
|
||||
|
||||
Connections {
|
||||
target: root
|
||||
onInPortraitChanged: {
|
||||
root.orientationChangeFinished()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
|
||||
* 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
Item {
|
||||
id: main
|
||||
state: parent.state
|
||||
property bool hasOverState: false
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: shadow
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
leftMargin: -margins.left
|
||||
topMargin: -margins.top
|
||||
rightMargin: -margins.right
|
||||
bottomMargin: -margins.bottom
|
||||
}
|
||||
imagePath: "widgets/button"
|
||||
prefix: "shadow"
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "shadow"
|
||||
PropertyChanges {
|
||||
target: shadow
|
||||
opacity: 1
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "hidden"
|
||||
PropertyChanges {
|
||||
target: shadow
|
||||
opacity: 0
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
PropertyAnimation {
|
||||
properties: "opacity"
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.OutQuad
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2012 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.
|
||||
*/
|
||||
|
||||
var mouseOverEnabled = false
|
@ -1,104 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
|
||||
* 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
Item {
|
||||
id: main
|
||||
state: parent.state
|
||||
property alias imagePath: shadowSvg.imagePath
|
||||
property string hoverElement: "hover"
|
||||
property string focusElement: "focus"
|
||||
property alias shadowElement: shadow.elementId
|
||||
property bool hasOverState: false
|
||||
|
||||
PlasmaCore.Svg {
|
||||
id: shadowSvg
|
||||
imagePath: "widgets/actionbutton"
|
||||
}
|
||||
|
||||
PlasmaCore.SvgItem {
|
||||
id: hover
|
||||
svg: shadowSvg
|
||||
elementId: "hover"
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
opacity: 0
|
||||
}
|
||||
|
||||
PlasmaCore.SvgItem {
|
||||
id: shadow
|
||||
svg: shadowSvg
|
||||
elementId: "shadow"
|
||||
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "shadow"
|
||||
PropertyChanges {
|
||||
target: shadow
|
||||
opacity: 1
|
||||
}
|
||||
PropertyChanges {
|
||||
target: hover
|
||||
opacity: 0
|
||||
elementId: hoverElement
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "focus"
|
||||
PropertyChanges {
|
||||
target: shadow
|
||||
opacity: 0
|
||||
}
|
||||
PropertyChanges {
|
||||
target: hover
|
||||
opacity: 1
|
||||
elementId: focusElement
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "hidden"
|
||||
PropertyChanges {
|
||||
target: shadow
|
||||
opacity: 0
|
||||
}
|
||||
PropertyChanges {
|
||||
target: hover
|
||||
opacity: 0
|
||||
elementId: hoverElement
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
PropertyAnimation {
|
||||
properties: "opacity"
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.OutQuad
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
module org.kde.plasma.components
|
||||
plugin plasmacomponentsplugin
|
||||
|
||||
BusyIndicator 2.0 BusyIndicator.qml
|
||||
Button 2.0 Button.qml
|
||||
ButtonColumn 2.0 ButtonColumn.qml
|
||||
ButtonGroup 2.0 ButtonGroup.js
|
||||
ButtonRow 2.0 ButtonRow.qml
|
||||
CheckBox 2.0 CheckBox.qml
|
||||
CommonDialog 2.0 CommonDialog.qml
|
||||
ContextMenu 2.0 Menu.qml
|
||||
Dialog 2.0 Dialog.qml
|
||||
Highlight 2.0 Highlight.qml
|
||||
Label 2.0 Label.qml
|
||||
ListItem 2.0 ListItem.qml
|
||||
Menu 2.0 Menu.qml
|
||||
MenuItem 2.0 MenuItem.qml
|
||||
Page 2.0 Page.qml
|
||||
PageStack 2.0 PageStack.qml
|
||||
ProgressBar 2.0 ProgressBar.qml
|
||||
QueryDialog 2.0 QueryDialog.qml
|
||||
RadioButton 2.0 RadioButton.qml
|
||||
ScrollBar 2.0 ScrollBar.qml
|
||||
ScrollDecorator 2.0 ScrollDecorator.qml
|
||||
SectionScroller 2.0 SectionScroller.qml
|
||||
SelectionDialog 2.0 SelectionDialog.qml
|
||||
Slider 2.0 Slider.qml
|
||||
Switch 2.0 Switch.qml
|
||||
TabBar 2.0 TabBar.qml
|
||||
TabButton 2.0 TabButton.qml
|
||||
TabGroup 2.0 TabGroup.qml
|
||||
TextArea 2.0 TextArea.qml
|
||||
TextField 2.0 TextField.qml
|
||||
ToolBar 2.0 ToolBar.qml
|
||||
ToolBarLayout 2.0 ToolBarLayout.qml
|
||||
ToolButton 2.0 ToolButton.qml
|
||||
Window 2.0 Window.qml
|
@ -21,7 +21,7 @@
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.2
|
||||
import "styles" as Styles
|
||||
import QtQuick.Controls.Styles.Plasma 2.0 as Styles
|
||||
|
||||
/**
|
||||
* A simple busy indicator,
|
||||
|
@ -30,7 +30,7 @@
|
||||
*/
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.2 as QtControls
|
||||
import "styles" as Styles
|
||||
import QtQuick.Controls.Styles.Plasma 2.0 as Styles
|
||||
|
||||
/**
|
||||
* The push button is perhaps the most commonly used widget in any graphical user interface.
|
||||
|
@ -21,7 +21,7 @@
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.2 as QtControls
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import "styles" as Styles
|
||||
import QtQuick.Controls.Styles.Plasma 2.0 as Styles
|
||||
|
||||
/**
|
||||
* A check box is a component that can be switched on (checked) or off
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
import QtQuick.Controls 1.1
|
||||
import "styles" as Styles
|
||||
import QtQuick.Controls.Styles.Plasma 2.0 as Styles
|
||||
|
||||
/**
|
||||
* This is a combobox which uses the plasma theme.
|
||||
|
@ -23,7 +23,7 @@ import QtQuick.Controls 1.1
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
import "styles" as Styles
|
||||
import QtQuick.Controls.Styles.Plasma 2.0 as Styles
|
||||
|
||||
/**
|
||||
* Simple progressBar using the plasma theme.
|
||||
|
@ -21,7 +21,7 @@
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.2 as QtControls
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import "styles" as Styles
|
||||
import QtQuick.Controls.Styles.Plasma 2.0 as Styles
|
||||
|
||||
/**
|
||||
* A radio button component consists of a radio button and a line of text. Only
|
||||
|
@ -22,7 +22,7 @@ import QtQuick 2.1
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import "private" as Private
|
||||
import QtQuick.Controls 1.2 as QtControls
|
||||
import "styles" as Styles
|
||||
import QtQuick.Controls.Styles.Plasma 2.0 as Styles
|
||||
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.2 as QtControls
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import "styles" as Styles
|
||||
import QtQuick.Controls.Styles.Plasma 2.0 as Styles
|
||||
|
||||
/**
|
||||
@class TextArea
|
||||
|
@ -21,7 +21,7 @@
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.2 as QtControls
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import "styles" as Styles
|
||||
import QtQuick.Controls.Styles.Plasma 2.0 as Styles
|
||||
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.2 as QtControls
|
||||
import "styles" as Styles
|
||||
import QtQuick.Controls.Styles.Plasma 2.0 as Styles
|
||||
|
||||
/**
|
||||
* A plasma theme based toolbutton.
|
||||
|
@ -1,134 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 by David Edmundson <davidedmundson@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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls.Styles 1.1 as QtQuickControlStyle
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import "../private" as Private
|
||||
|
||||
QtQuickControlStyle.ComboBoxStyle {
|
||||
drowDownButtonWidth: units.iconSizes.small
|
||||
|
||||
label: PlasmaComponents.Label {
|
||||
text: control.currentText
|
||||
elide: Text.ElideRight
|
||||
verticalAlignment: Text.AlignTop
|
||||
}
|
||||
|
||||
background: Item {
|
||||
|
||||
//size copied from Plasma Button
|
||||
//for some reason the logic there is:
|
||||
// maximum of
|
||||
// the calculated height + frame margins
|
||||
// Or 1.6 letters tall no matter how big the margins are
|
||||
|
||||
//QtQuickControls tries to be helpful and adds on the margin sizes for us
|
||||
//to compensate, we have to subtract our margins here in order to do the max 1.6 lines high tall feature
|
||||
implicitHeight: Math.max(theme.mSize(theme.defaultFont).height*1.6 - surfaceNormal.margins.top - surfaceNormal.margins.bottom,
|
||||
theme.mSize(theme.defaultFont).height)
|
||||
|
||||
implicitWidth: theme.mSize(theme.defaultFont).width*12
|
||||
|
||||
Private.ButtonShadow {
|
||||
anchors.fill: parent
|
||||
state: {
|
||||
if (control.pressed) {
|
||||
return "hidden"
|
||||
} else if (control.hovered) {
|
||||
return "hover"
|
||||
} else if (control.activeFocus) {
|
||||
return "focus"
|
||||
} else {
|
||||
return "shadow"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//This code is duplicated here and Button and ToolButton
|
||||
//maybe we can make an AbstractButton class?
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: surfaceNormal
|
||||
anchors.fill: parent
|
||||
imagePath: "widgets/button"
|
||||
prefix: "normal"
|
||||
}
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: surfacePressed
|
||||
anchors.fill: parent
|
||||
imagePath: "widgets/button"
|
||||
prefix: "pressed"
|
||||
opacity: 0
|
||||
}
|
||||
|
||||
state: control.pressed ? "pressed" : "normal"
|
||||
|
||||
states: [
|
||||
State { name: "normal" },
|
||||
State { name: "pressed"
|
||||
PropertyChanges {
|
||||
target: surfaceNormal
|
||||
opacity: 0
|
||||
}
|
||||
PropertyChanges {
|
||||
target: surfacePressed
|
||||
opacity: 1
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
to: "normal"
|
||||
//Cross fade from pressed to normal
|
||||
ParallelAnimation {
|
||||
NumberAnimation { target: surfaceNormal; property: "opacity"; to: 1; duration: 100 }
|
||||
NumberAnimation { target: surfacePressed; property: "opacity"; to: 0; duration: 100 }
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
PlasmaCore.SvgItem {
|
||||
width: drowDownButtonWidth
|
||||
height: drowDownButtonWidth
|
||||
anchors {
|
||||
right: parent.right
|
||||
rightMargin: surfaceNormal.margins.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
svg: PlasmaCore.Svg {
|
||||
imagePath: "widgets/arrows"
|
||||
colorGroup: PlasmaCore.Theme.ButtonColorGroup
|
||||
}
|
||||
elementId: "down-arrow"
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
padding.top = surfaceNormal.margins.top
|
||||
padding.left = surfaceNormal.margins.left
|
||||
padding.right = surfaceNormal.margins.right
|
||||
padding.bottom = surfaceNormal.margins.bottom
|
||||
}
|
||||
}
|
||||
}
|
@ -19,7 +19,7 @@
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1 as QtQuickControls
|
||||
import "../components/styles" as Styles
|
||||
import QtQuick.Controls.Styles.Plasma 2.0 as Styles
|
||||
|
||||
/**
|
||||
* This item takes a Flickable and automatically puts scrollbars in adjusting
|
||||
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2014 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.3
|
||||
import QtQuick.Controls.Styles 1.3 as QtQuickControlStyle
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
|
||||
QtQuickControlStyle.ApplicationWindowStyle {
|
||||
|
||||
property Component background: Rectangle {
|
||||
visible: !styleData.hasColor
|
||||
color: PlasmaCore.ColorScope.backgroundColor
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@ BusyIndicatorStyle {
|
||||
anchors.centerIn: parent
|
||||
width: Math.min(control.width, control.height)
|
||||
height: width
|
||||
smooth: !control.running || control.smoothAnimation
|
||||
smooth: !control.running || (control.hasOwnProperty("smoothAnimation") && control.smoothAnimation)
|
||||
|
||||
Connections {
|
||||
target: control
|
@ -21,12 +21,13 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls.Styles 1.1 as QtQuickControlStyle
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls.Private 1.0 as QtQuickControlsPrivate
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import "../private" as Private
|
||||
import "private" as Private
|
||||
|
||||
QtQuickControlStyle.ButtonStyle {
|
||||
id: style
|
||||
@ -71,8 +72,8 @@ QtQuickControlStyle.ButtonStyle {
|
||||
PlasmaComponents.Label {
|
||||
id: label
|
||||
Layout.minimumWidth: implicitWidth
|
||||
text: control.text
|
||||
font: control.font
|
||||
text: QtQuickControlsPrivate.StyleHelpers.stylizeMnemonics(control.text)
|
||||
font: control.font || theme.defaultFont
|
||||
visible: control.text != ""
|
||||
Layout.fillWidth: true
|
||||
height: parent.height
|
127
src/declarativeimports/plasmastyle/CalendarStyle.qml
Normal file
127
src/declarativeimports/plasmastyle/CalendarStyle.qml
Normal file
@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
* Copyright 2014 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls.Styles 1.1 as QtQuickControlStyle
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
|
||||
QtQuickControlStyle.CalendarStyle {
|
||||
id: styleRoot
|
||||
|
||||
gridColor: Qt.rgba(PlasmaCore.ColorScope.textColor.r, PlasmaCore.ColorScope.textColor.g, PlasmaCore.ColorScope.textColor.b, 0.4)
|
||||
|
||||
gridVisible: true
|
||||
|
||||
|
||||
background: Item {
|
||||
implicitWidth: Math.max(250, Math.round(units.gridUnit * 14))
|
||||
implicitHeight: Math.max(250, Math.round(units.gridUnit * 14))
|
||||
}
|
||||
|
||||
navigationBar: Item {
|
||||
height: Math.round(units.gridUnit * 2.73)
|
||||
|
||||
PlasmaComponents.ToolButton {
|
||||
id: previousMonth
|
||||
width: parent.height
|
||||
height: width
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
iconSource: "go-previous"
|
||||
onClicked: control.showPreviousMonth()
|
||||
}
|
||||
PlasmaExtras.Heading {
|
||||
id: dateText
|
||||
text: styleData.title
|
||||
elide: Text.ElideRight
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font.pixelSize: units.gridUnit * 1.25
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: previousMonth.right
|
||||
anchors.leftMargin: 2
|
||||
anchors.right: nextMonth.left
|
||||
anchors.rightMargin: 2
|
||||
}
|
||||
PlasmaComponents.ToolButton {
|
||||
id: nextMonth
|
||||
width: parent.height
|
||||
height: width
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
iconSource: "go-next"
|
||||
onClicked: control.showNextMonth()
|
||||
}
|
||||
}
|
||||
|
||||
dayDelegate: Rectangle {
|
||||
//FIXME: this stuff should depend from localization
|
||||
property int daysInAWeek: 7
|
||||
property int weeksOnACalendarMonth: 6
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: (!addExtraMargin || control.weekNumbersVisible) && styleData.index % daysInAWeek === 0 ? 0 : -1
|
||||
anchors.rightMargin: !addExtraMargin && styleData.index % daysInAWeek === daysInAWeek - 1 ? 0 : -1
|
||||
anchors.bottomMargin: !addExtraMargin && styleData.index >= daysInAWeek * (weeksOnACalendarMonth - 1) ? 0 : -1
|
||||
anchors.topMargin: styleData.selected ? -1 : 0
|
||||
color: styleData.date !== undefined && styleData.selected ? selectedDateColor : "transparent"
|
||||
|
||||
readonly property bool addExtraMargin: control.frameVisible && styleData.selected
|
||||
readonly property color sameMonthDateTextColor: PlasmaCore.ColorScope.textColor
|
||||
readonly property color selectedDateColor: theme.highlightColor
|
||||
readonly property color selectedDateTextColor: PlasmaCore.ColorScope.textColor
|
||||
readonly property color differentMonthDateTextColor: Qt.rgba(PlasmaCore.ColorScope.textColor.r, PlasmaCore.ColorScope.textColor.g, PlasmaCore.ColorScope.textColor.b, 0.4)
|
||||
readonly property color invalidDateColor: Qt.rgba(PlasmaCore.ColorScope.textColor.r, PlasmaCore.ColorScope.textColor.g, PlasmaCore.ColorScope.textColor.b, 0.2)
|
||||
PlasmaComponents.Label {
|
||||
id: dayDelegateText
|
||||
text: styleData.date.getDate()
|
||||
anchors.centerIn: parent
|
||||
horizontalAlignment: Text.AlignRight
|
||||
font.pixelSize: Math.min(parent.height/3, parent.width/3)
|
||||
color: {
|
||||
var theColor = invalidDateColor;
|
||||
if (styleData.valid) {
|
||||
// Date is within the valid range.
|
||||
theColor = styleData.visibleMonth ? sameMonthDateTextColor : differentMonthDateTextColor;
|
||||
if (styleData.selected)
|
||||
theColor = selectedDateTextColor;
|
||||
}
|
||||
theColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dayOfWeekDelegate: Item {
|
||||
implicitHeight: Math.round(units.gridUnit * 2.25)
|
||||
PlasmaComponents.Label {
|
||||
text: control.__locale.dayName(styleData.dayOfWeek, control.dayOfWeekFormat)
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
||||
weekNumberDelegate: Item {
|
||||
implicitWidth: Math.round(units.gridUnit * 2)
|
||||
PlasmaComponents.Label {
|
||||
text: styleData.weekNumber
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@ import QtQuick.Controls.Styles 1.1 as QtQuickControlStyle
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import "../private" as Private
|
||||
import "private" as Private
|
||||
|
||||
QtQuickControlStyle.CheckBoxStyle {
|
||||
id: checkboxStyle
|
134
src/declarativeimports/plasmastyle/ComboBoxStyle.qml
Normal file
134
src/declarativeimports/plasmastyle/ComboBoxStyle.qml
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (C) 2014 by David Edmundson <davidedmundson@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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls.Styles 1.1 as QtQuickControlStyle
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import "private" as Private
|
||||
|
||||
QtQuickControlStyle.ComboBoxStyle {
|
||||
drowDownButtonWidth: units.iconSizes.small
|
||||
|
||||
label: PlasmaComponents.Label {
|
||||
text: control.currentText
|
||||
elide: Text.ElideRight
|
||||
verticalAlignment: Text.AlignTop
|
||||
}
|
||||
|
||||
background: Item {
|
||||
|
||||
//size copied from Plasma Button
|
||||
//for some reason the logic there is:
|
||||
// maximum of
|
||||
// the calculated height + frame margins
|
||||
// Or 1.6 letters tall no matter how big the margins are
|
||||
|
||||
//QtQuickControls tries to be helpful and adds on the margin sizes for us
|
||||
//to compensate, we have to subtract our margins here in order to do the max 1.6 lines high tall feature
|
||||
implicitHeight: Math.max(theme.mSize(theme.defaultFont).height*1.6 - surfaceNormal.margins.top - surfaceNormal.margins.bottom,
|
||||
theme.mSize(theme.defaultFont).height)
|
||||
|
||||
implicitWidth: theme.mSize(theme.defaultFont).width*12
|
||||
|
||||
Private.ButtonShadow {
|
||||
anchors.fill: parent
|
||||
state: {
|
||||
if (control.pressed) {
|
||||
return "hidden"
|
||||
} else if (control.hovered) {
|
||||
return "hover"
|
||||
} else if (control.activeFocus) {
|
||||
return "focus"
|
||||
} else {
|
||||
return "shadow"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//This code is duplicated here and Button and ToolButton
|
||||
//maybe we can make an AbstractButton class?
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: surfaceNormal
|
||||
anchors.fill: parent
|
||||
imagePath: "widgets/button"
|
||||
prefix: "normal"
|
||||
}
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: surfacePressed
|
||||
anchors.fill: parent
|
||||
imagePath: "widgets/button"
|
||||
prefix: "pressed"
|
||||
opacity: 0
|
||||
}
|
||||
|
||||
state: control.pressed ? "pressed" : "normal"
|
||||
|
||||
states: [
|
||||
State { name: "normal" },
|
||||
State { name: "pressed"
|
||||
PropertyChanges {
|
||||
target: surfaceNormal
|
||||
opacity: 0
|
||||
}
|
||||
PropertyChanges {
|
||||
target: surfacePressed
|
||||
opacity: 1
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
to: "normal"
|
||||
//Cross fade from pressed to normal
|
||||
ParallelAnimation {
|
||||
NumberAnimation { target: surfaceNormal; property: "opacity"; to: 1; duration: 100 }
|
||||
NumberAnimation { target: surfacePressed; property: "opacity"; to: 0; duration: 100 }
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
PlasmaCore.SvgItem {
|
||||
width: drowDownButtonWidth
|
||||
height: drowDownButtonWidth
|
||||
anchors {
|
||||
right: parent.right
|
||||
rightMargin: surfaceNormal.margins.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
svg: PlasmaCore.Svg {
|
||||
imagePath: "widgets/arrows"
|
||||
colorGroup: PlasmaCore.Theme.ButtonColorGroup
|
||||
}
|
||||
elementId: "down-arrow"
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
padding.top = surfaceNormal.margins.top
|
||||
padding.left = surfaceNormal.margins.left
|
||||
padding.right = surfaceNormal.margins.right
|
||||
padding.bottom = surfaceNormal.margins.bottom
|
||||
}
|
||||
}
|
||||
}
|
25
src/declarativeimports/plasmastyle/FocusFrameStyle.qml
Normal file
25
src/declarativeimports/plasmastyle/FocusFrameStyle.qml
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2014 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
|
||||
//FocusFrameStyle is not exported
|
||||
Item {
|
||||
property int margin: 0
|
||||
}
|
69
src/declarativeimports/plasmastyle/GroupBoxStyle.qml
Normal file
69
src/declarativeimports/plasmastyle/GroupBoxStyle.qml
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright 2014 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Private 1.0
|
||||
import QtQuick.Controls.Styles 1.2 as QtQuickControlStyle
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
//GroupBoxStyle is not exported
|
||||
Style {
|
||||
id: styleRoot
|
||||
|
||||
property color textColor: theme.textColor
|
||||
|
||||
property Component checkbox: PlasmaComponents.CheckBox {
|
||||
checked: control.checked
|
||||
}
|
||||
|
||||
property Component panel: Item {
|
||||
anchors.fill: parent
|
||||
Loader {
|
||||
id: checkboxloader
|
||||
anchors.left: parent.left
|
||||
sourceComponent: control.checkable ? checkbox : null
|
||||
anchors.verticalCenter: label.verticalCenter
|
||||
width: item ? item.implicitWidth : 0
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: label
|
||||
anchors.top: parent.top
|
||||
anchors.left: checkboxloader.right
|
||||
anchors.margins: units.smallSpacing
|
||||
text: control.title
|
||||
}
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: frame
|
||||
anchors.fill: parent
|
||||
imagePath: "widgets/frame"
|
||||
prefix: "plain"
|
||||
visible: !control.flat
|
||||
Component.onCompleted: {
|
||||
styleRoot.padding.left = frame.margins.left
|
||||
styleRoot.padding.top = frame.margins.top + label.height
|
||||
styleRoot.padding.right = frame.margins.right
|
||||
styleRoot.padding.bottom = frame.margins.bottom
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
58
src/declarativeimports/plasmastyle/MenuBarStyle.qml
Normal file
58
src/declarativeimports/plasmastyle/MenuBarStyle.qml
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2014 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls.Styles 1.2 as QtQuickControlStyle
|
||||
import QtQuick.Controls.Private 1.0 as QtQuickControlsPrivate
|
||||
import QtQuick.Controls 1.2
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import "." as Style
|
||||
|
||||
QtQuickControlStyle.MenuBarStyle {
|
||||
id: styleRoot
|
||||
|
||||
function formatMnemonic(text, underline) {
|
||||
return underline ? QtQuickControlsPrivate.StyleHelpers.stylizeMnemonics(text) : StyleHelpers.removeMnemonics(text)
|
||||
}
|
||||
|
||||
background: Item {
|
||||
Accessible.role: Accessible.MenuBar
|
||||
}
|
||||
|
||||
itemDelegate: PlasmaCore.FrameSvgItem {
|
||||
imagePath: "widgets/tabbar"
|
||||
prefix: styleData.open || styleData.selected ? "north-active-tab" : ""
|
||||
property string plainText: QtQuickControlsPrivate.StyleHelpers.removeMnemonics(styleData.text)
|
||||
implicitWidth: text.implicitWidth + units.smallSpacing * 3
|
||||
implicitHeight: text.implicitHeight + units.smallSpacing * 2
|
||||
enabled: styleData.enabled
|
||||
|
||||
Accessible.role: Accessible.MenuItem
|
||||
Accessible.name: plainText
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: text
|
||||
text: formatMnemonic(styleData.text, styleData.underlineMnemonic)
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
||||
menuStyle: Style.MenuStyle { }
|
||||
}
|
108
src/declarativeimports/plasmastyle/MenuStyle.qml
Normal file
108
src/declarativeimports/plasmastyle/MenuStyle.qml
Normal file
@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright 2014 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Window 2.1
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Private 1.0
|
||||
import QtQuick.Controls.Styles 1.2 as QtQuickControlStyle
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
QtQuickControlStyle.MenuStyle {
|
||||
id: styleRoot
|
||||
|
||||
__menuItemType: "menuitem"
|
||||
|
||||
submenuOverlap: 0
|
||||
submenuPopupDelay: 0
|
||||
__maxPopupHeight: 0
|
||||
|
||||
frame: StyleItem {
|
||||
elementType: "menu"
|
||||
|
||||
Rectangle {
|
||||
visible: anchors.margins > 0
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: pixelMetric("menupanelwidth")
|
||||
}
|
||||
color: theme.backgroundColor
|
||||
}
|
||||
|
||||
Accessible.role: Accessible.PopupMenu
|
||||
|
||||
Component.onCompleted: {
|
||||
var menuHMargin = pixelMetric("menuhmargin")
|
||||
var menuVMargin = pixelMetric("menuvmargin")
|
||||
var menuPanelWidth = pixelMetric("menupanelwidth")
|
||||
styleRoot.padding.left = menuHMargin + menuPanelWidth
|
||||
styleRoot.padding.right = menuHMargin + menuPanelWidth
|
||||
styleRoot.padding.top = menuVMargin + menuPanelWidth
|
||||
styleRoot.padding.bottom = menuVMargin + menuPanelWidth
|
||||
styleRoot.submenuOverlap = 2 * menuPanelWidth
|
||||
styleRoot.submenuPopupDelay = styleHint("submenupopupdelay")
|
||||
}
|
||||
|
||||
readonly property int desktopAvailableHeight: Screen.desktopAvailableHeight
|
||||
Binding {
|
||||
target: styleRoot
|
||||
property: "__maxPopupHeight"
|
||||
value: desktopAvailableHeight * 0.99
|
||||
}
|
||||
}
|
||||
|
||||
__scrollerStyle: null
|
||||
|
||||
itemDelegate.background: PlasmaComponents.Highlight {
|
||||
visible: styleData.selected && styleData.enabled
|
||||
}
|
||||
itemDelegate.label: PlasmaComponents.Label {
|
||||
text: formatMnemonic(styleData.text, styleData.underlineMnemonic)
|
||||
}
|
||||
itemDelegate.submenuIndicator: PlasmaComponents.Label {
|
||||
text: __mirrored ? "\u25c2" : "\u25b8" // BLACK LEFT/RIGHT-POINTING SMALL TRIANGLE
|
||||
style: styleData.selected ? Text.Normal : Text.Raised
|
||||
styleColor: Qt.lighter(color, 4)
|
||||
}
|
||||
|
||||
itemDelegate.shortcut: PlasmaComponents.Label {
|
||||
text: styleData.shortcut
|
||||
}
|
||||
|
||||
itemDelegate.checkmarkIndicator: Loader {
|
||||
sourceComponent: styleData.exclusive ? exclusiveCheckMark : nonExclusiveCheckMark
|
||||
Component {
|
||||
id: exclusiveCheckMark
|
||||
PlasmaComponents.RadioButton {
|
||||
width: parent.height
|
||||
height: parent.height
|
||||
checked: styleData.checked
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: nonExclusiveCheckMark
|
||||
PlasmaComponents.CheckBox {
|
||||
width: parent.height
|
||||
height: parent.height
|
||||
checked: styleData.checked
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -43,10 +43,12 @@ ProgressBarStyle {
|
||||
}
|
||||
|
||||
background: Item {
|
||||
implicitWidth: units.gridUnit * 14
|
||||
implicitHeight: theme.mSize(theme.defaultFont).height * 1.6
|
||||
PlasmaCore.FrameSvgItem {
|
||||
anchors.centerIn: parent
|
||||
width: parent.width
|
||||
height: style.implicitHeight
|
||||
height: implicitHeight
|
||||
imagePath: style.imagePath
|
||||
prefix: "bar-inactive"
|
||||
}
|
||||
@ -60,10 +62,11 @@ ProgressBarStyle {
|
||||
prefix: "bar-active"
|
||||
|
||||
width: control.indeterminate ? units.gridUnit * 2 : Math.max(margins.left + margins.right, parent.width)
|
||||
height: style.implicitHeight
|
||||
height: implicitHeight
|
||||
visible: control.indeterminate || currentProgress > 0
|
||||
|
||||
SequentialAnimation {
|
||||
id: anim
|
||||
loops: Animation.Infinite
|
||||
|
||||
running: control.indeterminate && control.visible
|
||||
@ -80,6 +83,12 @@ ProgressBarStyle {
|
||||
// The progress Item's width might be left over from the previous state
|
||||
// so we use the control.width/height directly instead
|
||||
to: control.width - units.gridUnit * 2
|
||||
onToChanged: {
|
||||
//the animation won't update the boundaries automatically
|
||||
if (anim.running) {
|
||||
anim.restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
PropertyAnimation {
|
||||
target: progressSvg
|
@ -22,7 +22,7 @@ import QtQuick.Controls.Styles 1.1 as QtQuickControlStyle
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import "../private" as Private
|
||||
import "private" as Private
|
||||
|
||||
QtQuickControlStyle.RadioButtonStyle {
|
||||
id: radiobuttonStyle
|
||||
@ -42,8 +42,8 @@ QtQuickControlStyle.RadioButtonStyle {
|
||||
}
|
||||
elementId: "normal"
|
||||
|
||||
width: theme.mSize(theme.defaultFont).height + margins.left
|
||||
height: theme.mSize(theme.defaultFont).height + margins.top
|
||||
width: height
|
||||
height: theme.mSize(theme.defaultFont).height * 1.6
|
||||
|
||||
PlasmaCore.SvgItem {
|
||||
id: checkmark
|
@ -25,7 +25,7 @@ import QtQuick.Controls 1.1
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import "../private" as Private
|
||||
import "private" as Private
|
||||
|
||||
QtQuickControlStyle.SliderStyle {
|
||||
id: styleItem
|
90
src/declarativeimports/plasmastyle/SpinBoxStyle.qml
Normal file
90
src/declarativeimports/plasmastyle/SpinBoxStyle.qml
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright 2014 by Marco Martin <mart@kde.org>
|
||||
* Copyright 2014 by David Edmundson <davidedmundson@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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls.Styles 1.1 as QtQuickControlStyle
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import "private" as Private
|
||||
|
||||
QtQuickControlStyle.SpinBoxStyle {
|
||||
id: styleRoot
|
||||
|
||||
horizontalAlignment: Qt.AlignRight
|
||||
|
||||
textColor: theme.viewTextColor
|
||||
selectionColor: theme.viewFocusColor
|
||||
selectedTextColor: theme.viewBackgroundColor
|
||||
|
||||
|
||||
renderType: Text.NativeRendering
|
||||
|
||||
PlasmaCore.Svg {
|
||||
id: arrowSvg
|
||||
imagePath: "widgets/arrows"
|
||||
colorGroup: PlasmaCore.Theme.ButtonColorGroup
|
||||
}
|
||||
|
||||
incrementControl: PlasmaCore.SvgItem {
|
||||
anchors {
|
||||
fill: parent
|
||||
margins : 1
|
||||
leftMargin: -1
|
||||
rightMargin: 3
|
||||
}
|
||||
svg: arrowSvg
|
||||
elementId: "up-arrow"
|
||||
opacity: control.enabled ? (styleData.upPressed ? 1 : 0.6) : 0.5
|
||||
}
|
||||
|
||||
decrementControl: PlasmaCore.SvgItem {
|
||||
anchors {
|
||||
fill: parent
|
||||
margins : 1
|
||||
leftMargin: -1
|
||||
rightMargin: 3
|
||||
}
|
||||
svg: arrowSvg
|
||||
elementId: "down-arrow"
|
||||
opacity: control.enabled ? (styleData.downPressed ? 1 : 0.6) : 0.5
|
||||
}
|
||||
|
||||
|
||||
background: Item {
|
||||
implicitHeight: theme.mSize(theme.defaultFont).height * 1.6
|
||||
implicitWidth: theme.mSize(theme.defaultFont).width * 12
|
||||
|
||||
Private.TextFieldFocus {
|
||||
id: hover
|
||||
state: control.activeFocus ? "focus" : (control.hovered ? "hover" : "hidden")
|
||||
anchors.fill: base
|
||||
}
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: base
|
||||
anchors.fill: parent
|
||||
imagePath: "widgets/lineedit"
|
||||
prefix: "base"
|
||||
}
|
||||
}
|
||||
}
|
47
src/declarativeimports/plasmastyle/StatusBarStyle.qml
Normal file
47
src/declarativeimports/plasmastyle/StatusBarStyle.qml
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2014 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls.Styles 1.2 as QtQuickControlStyle
|
||||
import QtQuick.Controls 1.2
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
QtQuickControlStyle.StatusBarStyle {
|
||||
|
||||
padding {
|
||||
left: units.smallSpacing
|
||||
right: units.smallSpacing
|
||||
top: units.smallSpacing
|
||||
bottom: units.smallSpacing/2
|
||||
}
|
||||
|
||||
|
||||
background: Item {
|
||||
implicitHeight: 16
|
||||
implicitWidth: 200
|
||||
|
||||
Rectangle {
|
||||
anchors.top: parent.top
|
||||
width: parent.width
|
||||
height: 1
|
||||
color: theme.textColor
|
||||
opacity: 0.1
|
||||
}
|
||||
}
|
||||
}
|
60
src/declarativeimports/plasmastyle/SwitchStyle.qml
Normal file
60
src/declarativeimports/plasmastyle/SwitchStyle.qml
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2014 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls.Styles 1.2 as QtQuickControlStyle
|
||||
import QtQuick.Controls 1.2
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
QtQuickControlStyle.SwitchStyle {
|
||||
id: styleRoot
|
||||
|
||||
handle: PlasmaCore.FrameSvgItem {
|
||||
opacity: control.enabled ? 1.0 : 0.6
|
||||
width: height
|
||||
imagePath: "widgets/button"
|
||||
prefix: "shadow"
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: button
|
||||
imagePath: "widgets/button"
|
||||
prefix: "normal"
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
groove: PlasmaCore.FrameSvgItem {
|
||||
imagePath: "widgets/slider"
|
||||
prefix: "groove"
|
||||
implicitHeight: theme.mSize(theme.defaultFont).height
|
||||
implicitWidth: height * 2
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: highlight
|
||||
imagePath: "widgets/slider"
|
||||
prefix: "groove-highlight"
|
||||
anchors.fill: parent
|
||||
|
||||
opacity: checked ? 1 : 0
|
||||
Behavior on opacity {
|
||||
PropertyAnimation { duration: units.shortDuration * 2 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
77
src/declarativeimports/plasmastyle/TabViewStyle.qml
Normal file
77
src/declarativeimports/plasmastyle/TabViewStyle.qml
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright 2014 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Private 1.0
|
||||
import QtQuick.Controls.Styles 1.2 as QtQuickControlStyle
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
|
||||
QtQuickControlStyle.TabViewStyle {
|
||||
tabsMovable: false
|
||||
|
||||
tabsAlignment: Qt.AlignLeft
|
||||
|
||||
tabOverlap: 1
|
||||
|
||||
frameOverlap: 2
|
||||
|
||||
/*! This defines the tab frame. */
|
||||
property Component frame: Item {}
|
||||
|
||||
|
||||
property Component tab: Item {
|
||||
property int totalOverlap: tabOverlap * (control.count - 1)
|
||||
property real maxTabWidth: control.count > 0 ? (styleData.availableWidth + totalOverlap) / control.count : 0
|
||||
|
||||
implicitWidth: Math.round(Math.min(maxTabWidth, textitem.implicitWidth + 20))
|
||||
implicitHeight: Math.round(textitem.implicitHeight + 10)
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
anchors.fill: parent
|
||||
opacity: styleData.selected ? 1 : (styleData.hovered ? 0.4 : 0)
|
||||
imagePath: "widgets/tabbar"
|
||||
prefix: control.tabPosition === Qt.TopEdge ? "north-active-tab" : "south-active-tab"
|
||||
Behavior on opacity {
|
||||
PropertyAnimation {
|
||||
duration: units.longDuration
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: textitem
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 4
|
||||
anchors.rightMargin: 4
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: styleData.title
|
||||
elide: Text.ElideMiddle
|
||||
}
|
||||
}
|
||||
|
||||
property Component leftCorner: null
|
||||
|
||||
property Component rightCorner: null
|
||||
|
||||
property Component tabBar: null
|
||||
}
|
168
src/declarativeimports/plasmastyle/TableViewStyle.qml
Normal file
168
src/declarativeimports/plasmastyle/TableViewStyle.qml
Normal file
@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Copyright 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
* Copyright 2014 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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls.Styles 1.2 as QtQuickControlStyle
|
||||
import QtQuick.Controls 1.2
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
QtQuickControlStyle.TableViewStyle {
|
||||
id: styleRoot
|
||||
|
||||
textColor: PlasmaCore.ColorScope.textColor
|
||||
backgroundColor: control.backgroundVisible ? theme.viewBackgroundColor : "transparent"
|
||||
alternateBackgroundColor: Qt.darker(theme.viewBackgroundColor, 1.05)
|
||||
highlightedTextColor: theme.viewTextColor
|
||||
activateItemOnSingleClick: false
|
||||
|
||||
|
||||
property real scrollbarWidthHint: Math.round( (scrollbarSvg.hasElement("hint-scrollbar-size") ? scrollbarSvg.elementSize("hint-scrollbar-size").width : scrollbarSvg.elementSize("arrow-up").width) * units.devicePixelRatio)
|
||||
|
||||
headerDelegate: PlasmaCore.FrameSvgItem {
|
||||
imagePath: "widgets/button"
|
||||
prefix: "normal"
|
||||
enabledBorders: PlasmaCore.FrameSvgItem.TopEdge | PlasmaCore.FrameSvgItem.BottomEdge
|
||||
|
||||
height: textItem.implicitHeight * 1.2
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: textItem
|
||||
anchors.fill: parent
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: styleData.textAlignment
|
||||
anchors.leftMargin: 12
|
||||
color: theme.buttonTextColor
|
||||
text: styleData.value
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
Rectangle {
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 1
|
||||
anchors.topMargin: 1
|
||||
width: 1
|
||||
color: Qt.rgba(PlasmaCore.ColorScope.textColor.r, PlasmaCore.ColorScope.textColor.g, PlasmaCore.ColorScope.textColor.b, 0.2)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rowDelegate: Rectangle {
|
||||
height: Math.round(units.gridUnit * 1.2)
|
||||
property color selectedColor: styleData.hasActiveFocus ? theme.viewHoverColor: theme.viewFocusColor
|
||||
|
||||
color: styleData.selected ? selectedColor :
|
||||
!styleData.alternate ? alternateBackgroundColor : theme.viewBackgroundColor
|
||||
}
|
||||
|
||||
|
||||
itemDelegate: Item {
|
||||
height: Math.max(16, label.implicitHeight)
|
||||
property int implicitWidth: label.implicitWidth + 20
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: label
|
||||
objectName: "label"
|
||||
width: parent.width
|
||||
anchors.leftMargin: 12
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
horizontalAlignment: styleData.textAlignment
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.verticalCenterOffset: 1
|
||||
elide: styleData.elideMode
|
||||
text: styleData.value !== undefined ? styleData.value : ""
|
||||
color: theme.viewTextColor
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
frame: Item {
|
||||
|
||||
}
|
||||
|
||||
scrollBarBackground: PlasmaCore.FrameSvgItem {
|
||||
imagePath:"widgets/scrollbar"
|
||||
prefix: styleData.horizontal ? "background-horizontal" : "background-vertical"
|
||||
implicitWidth: scrollbarWidthHint
|
||||
}
|
||||
|
||||
handle: PlasmaCore.FrameSvgItem {
|
||||
imagePath:"widgets/scrollbar"
|
||||
implicitWidth: scrollbarWidthHint
|
||||
implicitHeight: scrollbarWidthHint
|
||||
|
||||
prefix: {
|
||||
if (styleData.hovered) {
|
||||
return "sunken-slider"
|
||||
}
|
||||
if (styleData.pressed) {
|
||||
return "mouseover-slider"
|
||||
} else {
|
||||
return "slider"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
incrementControl: PlasmaCore.SvgItem {
|
||||
svg: scrollbarSvg
|
||||
visible: scrollbarSvg.arrowPresent
|
||||
//if there is no arrow we don't want to waste space, a tiny margin does look better though
|
||||
implicitWidth: scrollbarSvg.arrowPresent ? scrollbarWidthHint : units.smallSpacing
|
||||
implicitHeight: scrollbarSvg.arrowPresent ? scrollbarWidthHint : units.smallSpacing
|
||||
elementId: {
|
||||
if (styleData.pressed) {
|
||||
return styleData.horizontal ? "sunken-arrow-right" : "sunken-arrow-down"
|
||||
}
|
||||
if (styleData.hovered) {
|
||||
return styleData.horizontal ? "mouseover-arrow-right" : "mouseover-arrow-down"
|
||||
} else {
|
||||
return styleData.horizontal ? "arrow-right" : "arrow-down"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
decrementControl: PlasmaCore.SvgItem {
|
||||
svg: scrollbarSvg
|
||||
visible: scrollbarSvg.arrowPresent
|
||||
implicitWidth: scrollbarSvg.arrowPresent ? scrollbarWidthHint : units.smallSpacing
|
||||
implicitHeight: scrollbarSvg.arrowPresent ? scrollbarWidthHint : units.smallSpacing
|
||||
elementId: {
|
||||
if (styleData.pressed) {
|
||||
return styleData.horizontal ? "sunken-arrow-left" : "sunken-arrow-up"
|
||||
}
|
||||
if (styleData.hovered) {
|
||||
return styleData.horizontal ? "mouseover-arrow-left" : "mouseover-arrow-up"
|
||||
} else {
|
||||
return styleData.horizontal ? "arrow-left" : "arrow-up"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaCore.Svg {
|
||||
id: scrollbarSvg
|
||||
imagePath: "widgets/scrollbar"
|
||||
property bool arrowPresent: scrollbarSvg.hasElement("arrow-up")
|
||||
//new theme may be different
|
||||
onRepaintNeeded: arrowPresent = scrollbarSvg.hasElement("arrow-up")
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import QtQuick.Controls 1.1
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import "../private" as Private
|
||||
import "private" as Private
|
||||
|
||||
QtQuickControlStyle.TextAreaStyle {
|
||||
id: style
|
@ -23,7 +23,7 @@ import QtQuick.Controls.Styles 1.1 as QtQuickControlStyle
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import "../private" as Private
|
||||
import "private" as Private
|
||||
|
||||
QtQuickControlStyle.TextFieldStyle {
|
||||
id: root
|
32
src/declarativeimports/plasmastyle/ToolBarStyle.qml
Normal file
32
src/declarativeimports/plasmastyle/ToolBarStyle.qml
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2014 by Marco Martin <mart@kde.org>
|
||||
* Copyright 2014 by David Edmundson <davidedmundson@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 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls.Styles 1.1 as QtQuickControlStyle
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
QtQuickControlStyle.ToolBarStyle {
|
||||
|
||||
background: PlasmaCore.FrameSvgItem {
|
||||
imagePath: "widgets/toolbar"
|
||||
}
|
||||
}
|
@ -21,19 +21,20 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls.Styles 1.1 as QtQuickControlStyle
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls.Private 1.0 as QtQuickControlsPrivate
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import "../private" as Private
|
||||
import "private" as Private
|
||||
|
||||
QtQuickControlStyle.ButtonStyle {
|
||||
id: style
|
||||
|
||||
property int minimumWidth
|
||||
property int minimumHeight
|
||||
|
||||
property bool flat: control.flat !== undefined ? control.flat : !(control.pressed || (control.checkable && control.checked))
|
||||
label: Item {
|
||||
//wrapper is needed as we are adjusting the preferredHeight of the layout from the default
|
||||
//and the implicitHeight is implicitly read only
|
||||
@ -76,18 +77,18 @@ QtQuickControlStyle.ButtonStyle {
|
||||
Layout.minimumHeight: Layout.minimumWidth
|
||||
Layout.maximumHeight: Layout.minimumWidth
|
||||
active: control.hovered
|
||||
colorGroup: control.hovered || !control.flat ? PlasmaCore.Theme.ButtonColorGroup : PlasmaCore.Theme.NormalColorGroup
|
||||
colorGroup: control.hovered || !style.flat ? PlasmaCore.Theme.ButtonColorGroup : PlasmaCore.Theme.NormalColorGroup
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: label
|
||||
Layout.minimumWidth: implicitWidth
|
||||
text: control.text
|
||||
font: control.font
|
||||
text: QtQuickControlsPrivate.StyleHelpers.stylizeMnemonics(control.text)
|
||||
font: control.font || theme.defaultFont
|
||||
visible: control.text != ""
|
||||
Layout.fillWidth: true
|
||||
height: parent.height
|
||||
color: control.hovered || !control.flat ? theme.buttonTextColor : PlasmaCore.ColorScope.textColor
|
||||
color: control.hovered || !style.flat ? theme.buttonTextColor : PlasmaCore.ColorScope.textColor
|
||||
horizontalAlignment: icon.valid ? Text.AlignLeft : Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
@ -108,7 +109,7 @@ QtQuickControlStyle.ButtonStyle {
|
||||
anchors.fill: parent
|
||||
svg: PlasmaCore.Svg {
|
||||
imagePath: "widgets/arrows"
|
||||
colorGroup: control.hovered || !control.flat ? PlasmaCore.Theme.ButtonColorGroup : PlasmaCore.Theme.NormalColorGroup
|
||||
colorGroup: control.hovered || !style.flat ? PlasmaCore.Theme.ButtonColorGroup : PlasmaCore.Theme.NormalColorGroup
|
||||
}
|
||||
elementId: "down-arrow"
|
||||
}
|
||||
@ -118,7 +119,7 @@ QtQuickControlStyle.ButtonStyle {
|
||||
}
|
||||
|
||||
background: {
|
||||
if (control.text.length == 0 && control.width == control.height && (control.parent && control.parent.checkedButton === undefined) && !control.flat) {
|
||||
if (control.text.length == 0 && control.width == control.height && (control.parent && control.parent.checkedButton === undefined) && !style.flat) {
|
||||
return roundButtonComponent
|
||||
} else {
|
||||
return buttonComponent
|
||||
@ -141,7 +142,7 @@ QtQuickControlStyle.ButtonStyle {
|
||||
property alias hasOverState: roundShadow.hasOverState
|
||||
Private.RoundShadow {
|
||||
id: roundShadow
|
||||
visible: !flat
|
||||
visible: !style.flat
|
||||
anchors.fill: parent
|
||||
state: {
|
||||
if (control.pressed) {
|
||||
@ -168,7 +169,7 @@ QtQuickControlStyle.ButtonStyle {
|
||||
width: Math.floor(parent.height/2) * 2
|
||||
height: width
|
||||
//internal: if there is no hover status, don't paint on mouse over in touchscreens
|
||||
opacity: (control.pressed || control.checked || !control.flat || (roundShadow.hasOverState && control.hovered)) ? 1 : 0
|
||||
opacity: (control.pressed || control.checked || !style.flat || (roundShadow.hasOverState && control.hovered)) ? 1 : 0
|
||||
Behavior on opacity {
|
||||
PropertyAnimation { duration: units.longDuration }
|
||||
}
|
||||
@ -226,7 +227,7 @@ QtQuickControlStyle.ButtonStyle {
|
||||
prefix: "normal"
|
||||
|
||||
enabledBorders: {
|
||||
if (control.flat || !control.parent ||
|
||||
if (style.flat || !control.parent ||
|
||||
control.parent.width < control.parent.implicitWidth ||
|
||||
control.parent.checkedButton === undefined ||
|
||||
!bordersSvg.hasElement("pressed-hint-compose-over-border")) {
|
||||
@ -352,7 +353,7 @@ QtQuickControlStyle.ButtonStyle {
|
||||
State { name: "normal"
|
||||
PropertyChanges {
|
||||
target: surfaceNormal
|
||||
opacity: control.flat ? 0 : 1
|
||||
opacity: style.flat ? 0 : 1
|
||||
}
|
||||
PropertyChanges {
|
||||
target: surfacePressed
|
24
src/declarativeimports/plasmastyle/qmldir
Normal file
24
src/declarativeimports/plasmastyle/qmldir
Normal file
@ -0,0 +1,24 @@
|
||||
module QtQuick.Controls.Styles.Plasma
|
||||
ApplicationWindowStyle 1.3 ApplicationWindowStyle.qml
|
||||
BusyIndicatorStyle 2.0 BusyIndicatorStyle.qml
|
||||
ButtonStyle 2.0 ButtonStyle.qml
|
||||
CalendarStyle 2.0 CalendarStyle.qml
|
||||
CheckBoxStyle 2.0 CheckBoxStyle.qml
|
||||
ComboBoxStyle 2.0 ComboBoxStyle.qml
|
||||
MenuBarStyle 2.0 MenuBarStyle.qml
|
||||
MenuStyle 2.0 MenuStyle.qml
|
||||
ProgressBarStyle 2.0 ProgressBarStyle.qml
|
||||
RadioButtonStyle 2.0 RadioButtonStyle.qml
|
||||
ScrollViewStyle 2.0 ScrollViewStyle.qml
|
||||
SliderStyle 2.0 SliderStyle.qml
|
||||
SpinBoxStyle 2.0 SpinBoxStyle.qml
|
||||
StatusBarStyle 2.0 StatusBarStyle.qml
|
||||
SwitchStyle 2.0 SwitchStyle.qml
|
||||
TabViewStyle 2.0 TabViewStyle.qml
|
||||
TableViewStyle 2.0 TableViewStyle.qml
|
||||
TextAreaStyle 2.0 TextAreaStyle.qml
|
||||
TextFieldStyle 2.0 TextFieldStyle.qml
|
||||
ToolBarStyle 2.0 ToolBarStyle.qml
|
||||
ToolButtonStyle 2.0 ToolButtonStyle.qml
|
||||
GroupBoxStyle 2.0 GroupBoxStyle.qml
|
||||
|
Loading…
Reference in New Issue
Block a user