From 0f7e41ab7ea10c6925190de7a89155e3dab36a0e Mon Sep 17 00:00:00 2001 From: audoban Date: Sun, 8 Jan 2017 15:41:42 -0500 Subject: [PATCH] config ui simplified --- .../configuration/AppearanceConfig.qml | 403 +++++------- .../contents/configuration/BehaviorConfig.qml | 592 +++++++----------- shell/contents/configuration/Header.qml | 7 +- .../configuration/LatteDockConfiguration.qml | 242 +++++++ .../LatteDockConfiguration.qml.cmake | 252 ++++---- .../contents/configuration/LatteTextField.qml | 97 --- shell/contents/configuration/TasksConfig.qml | 266 ++++---- shell/contents/controls/SpinBox.qml | 40 ++ 8 files changed, 906 insertions(+), 993 deletions(-) create mode 100644 shell/contents/configuration/LatteDockConfiguration.qml delete mode 100644 shell/contents/configuration/LatteTextField.qml create mode 100644 shell/contents/controls/SpinBox.qml diff --git a/shell/contents/configuration/AppearanceConfig.qml b/shell/contents/configuration/AppearanceConfig.qml index b5455186a..d4259486b 100644 --- a/shell/contents/configuration/AppearanceConfig.qml +++ b/shell/contents/configuration/AppearanceConfig.qml @@ -25,374 +25,281 @@ import QtGraphicalEffects 1.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents - import org.kde.plasma.plasmoid 2.0 import org.kde.latte 0.1 as Latte -PlasmaComponents.Page{ - width: dialog.width - 2*dialog.windowSpace - - property int pageHeight: mainColumn.height +PlasmaComponents.Page { + Layout.maximumWidth: content.width + units.smallSpacing * 2 + Layout.maximumHeight: content.height + units.smallSpacing * 2 + + ColumnLayout { + id: content - Column{ - id:mainColumn - spacing: 1.5*theme.defaultFont.pointSize - width: parent.width + width: dialog.maxWidth + spacing: units.largeSpacing + anchors.centerIn: parent - //////////////// Applets Size - Column{ - width:parent.width - spacing: 0.8*theme.defaultFont.pointSize + //! BEGIN: Applet Size + ColumnLayout { + Layout.fillWidth: true + spacing: units.smallSpacing - Header{ + Header { text: i18n("Applets Size") } - RowLayout{ - width: parent.width - - property int step: 8 - - PlasmaComponents.Slider{ - id:appletsSizeSlider - - valueIndicatorText: i18n("Applets Size") - valueIndicatorVisible: true + RowLayout { + Layout.fillWidth: true + spacing: units.smallSpacing + PlasmaComponents.Slider { + id: appletsSizeSlider + Layout.fillWidth: true + value: plasmoid.configuration.iconSize minimumValue: 16 maximumValue: 128 - - stepSize: parent.step - - Layout.fillWidth:true - - property bool inStartup:true - - property int tempValue: value - - Component.onCompleted: { - value = plasmoid.configuration.iconSize; - inStartup = false; - } - - onPressedChanged: { + stepSize: 8 + + function updateIconSize() { if (!pressed) { - plasmoid.configuration.iconSize = value; + if (panelSizeSlider.value > value + 4) + panelSizeSlider.value = value + 4 + plasmoid.configuration.iconSize = value } } - - onTempValueChanged:{ - if(!inStartup && !pressed){ - plasmoid.configuration.iconSize = value; - } + + onPressedChanged: { + updateIconSize() + } + + Component.onCompleted: { + valueChanged.connect(updateIconSize) } } - PlasmaComponents.Label{ + PlasmaComponents.Label { text: appletsSizeSlider.value + " px." - Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4 + horizontalAlignment: Text.AlignRight + Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 5 } } } + //! END: Applet Size - /********** Zoom On Hover ****************/ - Column{ - width: parent.width - spacing: 0.8*theme.defaultFont.pointSize + //! BEGIN: Zoom On Hover + ColumnLayout { + Layout.fillWidth: true + spacing: units.smallSpacing enabled: plasmoid.configuration.durationTime > 0 - Header{ + + Header { text: i18n("Zoom On Hover") } - RowLayout{ - width: parent.width + RowLayout { + Layout.fillWidth: true + spacing: units.smallSpacing - PlasmaComponents.Slider{ - id:zoomSlider + PlasmaComponents.Slider { + Layout.fillWidth: true + id: zoomSlider valueIndicatorText: i18n("Zoom Factor") valueIndicatorVisible: true + value: Number(1 + plasmoid.configuration.zoomLevel / 20).toFixed(2) minimumValue: 1 maximumValue: 2 - stepSize: 0.05 - Layout.fillWidth:true - - property bool inStartup:true - - property real tempValue: value - - Component.onCompleted: { - value = Number(1 + plasmoid.configuration.zoomLevel/20).toFixed(2) - inStartup = false; - // console.log("Slider:"+value); - } - - onPressedChanged: { + function updateZoomLevel() { if (!pressed) { - var result = Math.round((value - 1)*20) + var result = Math.round((value - 1) * 20) plasmoid.configuration.zoomLevel = result } } - - onTempValueChanged:{ - if(!inStartup && !pressed){ - var result = Math.round((value - 1)*20) - plasmoid.configuration.zoomLevel = result - } + + onPressedChanged: { + updateZoomLevel() + } + + Component.onCompleted: { + valueChanged.connect(updateZoomLevel) } - } - PlasmaComponents.Label{ - enabled: showBackground.checked - //text: " "+Number(zoomSlider.value).toFixed(2) - text: " "+Number((zoomSlider.value*100)-100).toFixed(0)+"%" - - Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4 + PlasmaComponents.Label { + text: Number( + (zoomSlider.value * 100) - 100).toFixed(0) + "%" + horizontalAlignment: Text.AlignRight + Layout.minimumWidth: theme.mSize( + theme.defaultFont).width * 5 } - } } + //! END: Zoom On Hover - /**Animations Speed***/ + //! BEGIN: Animations + ColumnLayout { + Layout.fillWidth: true + spacing: units.smallSpacing - Column{ - width:parent.width - spacing: 0.8*theme.defaultFont.pointSize - - Header{ + Header { text: i18n("Animations") } - Flow{ - width: parent.width + RowLayout { + Layout.fillWidth: true spacing: 2 - property bool inStartup: true property int duration: plasmoid.configuration.durationTime - onDurationChanged: updateDurationVisual(); - - Component.onCompleted: { - updateDurationVisual(); - inStartup = false; - } - - function updateDurationVisual(){ - if(duration === 0){ - firstDuration.checked = true; - secondDuration.checked = false; - thirdDuration.checked = false; - fourthDuration.checked = false; - } - else if(duration === 1){ - firstDuration.checked = false; - secondDuration.checked = true; - thirdDuration.checked = false; - fourthDuration.checked = false; - } - else if(duration === 2){ - firstDuration.checked = false; - secondDuration.checked = false; - thirdDuration.checked = true; - fourthDuration.checked = false; - } - else if(duration === 3){ - firstDuration.checked = false; - secondDuration.checked = false; - thirdDuration.checked = false; - fourthDuration.checked = true; + ExclusiveGroup { + id: animationsGroup + onCurrentChanged: { + if (current.checked) + plasmoid.configuration.durationTime = current.duration } } - - PlasmaComponents.Button{ - id: firstDuration - checkable: true + PlasmaComponents.Button { + Layout.fillWidth: true text: i18n("None") - width: (parent.width / 4) - 2 + checked: parent.duration === duration + checkable: true + exclusiveGroup: animationsGroup - onCheckedChanged: { - if(checked && !parent.inStartup){ - plasmoid.configuration.durationTime = 0; - } - } - onClicked: checked=true; + readonly property int duration: 0 } - PlasmaComponents.Button{ - id: secondDuration - checkable: true + PlasmaComponents.Button { + Layout.fillWidth: true text: i18n("x1") - width: (parent.width / 4) - 2 + checked: parent.duration === duration + checkable: true + exclusiveGroup: animationsGroup - onCheckedChanged: { - if(checked && !parent.inStartup){ - plasmoid.configuration.durationTime = 1; - } - } - onClicked: checked=true; + readonly property int duration: 1 } - PlasmaComponents.Button{ - id: thirdDuration - checkable: true + PlasmaComponents.Button { + Layout.fillWidth: true text: i18n("x2") - width: (parent.width / 4) - 2 + checked: parent.duration === duration + checkable: true + exclusiveGroup: animationsGroup - onCheckedChanged: { - if(checked && !parent.inStartup){ - plasmoid.configuration.durationTime = 2; - } - } - onClicked: checked=true; + readonly property int duration: 2 } - - PlasmaComponents.Button{ - id: fourthDuration - checkable: true + PlasmaComponents.Button { + Layout.fillWidth: true text: i18n("x3") - width: (parent.width/4) - 1 + checked: parent.duration === duration + checkable: true + exclusiveGroup: animationsGroup - onCheckedChanged: { - if(checked && !parent.inStartup){ - plasmoid.configuration.durationTime = 3; - } - } - onClicked: checked=true; + readonly property int duration: 3 } } } + //! END: Animations + //! BEGIN: Background + ColumnLayout { + Layout.fillWidth: true + spacing: units.smallSpacing - Column{ - width: parent.width - spacing: 0.8*theme.defaultFont.pointSize - Header{ + Header { text: i18n("Background") } - PlasmaComponents.CheckBox{ + PlasmaComponents.CheckBox { id: showBackground text: i18n("Show Panel Background") + checked: plasmoid.configuration.useThemePanel - property bool inStartup: true - onCheckedChanged:{ - if(!inStartup) - plasmoid.configuration.useThemePanel = checked; - } - - Component.onCompleted: { - checked = plasmoid.configuration.useThemePanel; - inStartup = false; + onClicked: { + plasmoid.configuration.useThemePanel = checked } } - RowLayout{ - width: parent.width + RowLayout { + Layout.fillWidth: true - PlasmaComponents.Slider{ - id:panelSizeSlider + PlasmaComponents.Slider { + id: panelSizeSlider + Layout.fillWidth: true enabled: showBackground.checked - valueIndicatorText: i18n("Size") - valueIndicatorVisible: true + value: plasmoid.configuration.panelSize minimumValue: 0 - maximumValue: 256 - + maximumValue: plasmoid.configuration.iconSize + 4 stepSize: 2 - Layout.fillWidth:true - - property bool inStartup: true - property int tempValue: value - - Component.onCompleted: { - value = plasmoid.configuration.panelSize - inStartup = false; + function updatePanelSize() { + if (!pressed) + plasmoid.configuration.panelSize = value } onPressedChanged: { - if (!pressed) { - plasmoid.configuration.panelSize = value; - } + updatePanelSize() } - - onTempValueChanged:{ - if(!inStartup && !pressed){ - plasmoid.configuration.panelSize = value; - } + + Component.onCompleted: { + valueChanged.connect(updatePanelSize) } } - PlasmaComponents.Label{ + PlasmaComponents.Label { enabled: showBackground.checked text: panelSizeSlider.value + " px." - Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4 + horizontalAlignment: Text.AlignRight + Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 5 } - } } + //! END: Background - /******Shadows**********/ - Column{ - width: parent.width - spacing: 0.8*theme.defaultFont.pointSize - Header{ + //! BEGIN: Shadows + Column { + Layout.fillWidth: true + spacing: units.smallSpacing + + Header { text: i18n("Shadows") } - RowLayout { - width: parent.width - - ExclusiveGroup { - id: shadowsGroup - property bool inStartup: true - - onCurrentChanged: { - if (!inStartup) { - if (current === noneShadow){ - plasmoid.configuration.shadows = 0; /*No Shadows*/ - } else if (current === lockedAppletsShadow){ - plasmoid.configuration.shadows = 1; /*Locked Applets Shadows*/ - } else if (current === allAppletsShadow){ - plasmoid.configuration.shadows = 2; /*All Applets Shadows*/ - } - } - } + PlasmaComponents.ButtonRow { + Layout.fillWidth: true + spacing: units.smallSpacing + exclusive: true - Component.onCompleted: { - if (plasmoid.configuration.shadows === 0 /*No Shadows*/){ - noneShadow.checked = true; - } else if (plasmoid.configuration.shadows === 1 /*Locked Applets*/) { - lockedAppletsShadow.checked = true; - } else if (plasmoid.configuration.shadows === 2 /*All Applets*/) { - allAppletsShadow.checked = true; - } + property int shadows: plasmoid.configuration.shadows - inStartup = false; - } + onCheckedButtonChanged: { + if (checkedButton.checked) + plasmoid.configuration.shadows = checkedButton.shadow } PlasmaComponents.RadioButton { - id: noneShadow text: i18n("None") - exclusiveGroup: shadowsGroup + checked: parent.shadows === shadow + + readonly property int shadow: 0 } PlasmaComponents.RadioButton { - id: lockedAppletsShadow text: i18n("Only for locked applets") - exclusiveGroup: shadowsGroup + checked: parent.shadows === shadow + + readonly property int shadow: 1 } PlasmaComponents.RadioButton { - id: allAppletsShadow text: i18n("All applets") - exclusiveGroup: shadowsGroup - } + checked: parent.shadows === shadow + readonly property int shadow: 2 + } } } + //! END: Shadows } } diff --git a/shell/contents/configuration/BehaviorConfig.qml b/shell/contents/configuration/BehaviorConfig.qml index ee895f904..d4ce60ce7 100644 --- a/shell/contents/configuration/BehaviorConfig.qml +++ b/shell/contents/configuration/BehaviorConfig.qml @@ -25,476 +25,328 @@ import QtGraphicalEffects 1.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents - import org.kde.plasma.plasmoid 2.0 import org.kde.latte 0.1 as Latte - -PlasmaComponents.Page{ - width: dialog.width - 2*dialog.windowSpace - - property int pageHeight: mainColumn.height - - Column{ - id: mainColumn - spacing: 1.5*theme.defaultFont.pointSize - width: parent.width - - Column{ - width:parent.width - spacing: 0.8*theme.defaultFont.pointSize - - Header{ +import "../controls" as ExtraControls + +PlasmaComponents.Page { + Layout.maximumWidth: content.width + units.smallSpacing * 2 + Layout.maximumHeight: content.height + units.smallSpacing * 2 + + ColumnLayout { + id: content + + width: dialog.maxWidth + spacing: units.largeSpacing + anchors.centerIn: parent + + //! BEGIN: Location + ColumnLayout { + Layout.fillWidth: true + spacing: units.smallSpacing + + Header { text: i18n("Location") } - Flow{ - width: parent.width - spacing: 2 - - property bool inStartup: true - property int dockLocation: dock.location - - onDockLocationChanged: updateDockLocationVisual(); + RowLayout { + id: locationLayout + Layout.fillWidth: true + spacing: 1 property int docksCount: dock.docksCount onDocksCountChanged: { - lockReservedEdges(); - updateDockLocationVisual(); + lockReservedEdges() } - Component.onCompleted: { - lockReservedEdges(); - updateDockLocationVisual(); - inStartup = false; + ExclusiveGroup { + id: locationGroup + onCurrentChanged: { + if (current.checked) { + dock.location = current.edge + locationLayout.lockReservedEdges() + } + } } + Component.onCompleted: lockReservedEdges() + function lockReservedEdges() { - var edges = dock.freeEdges(); - - firstLocation.enabled = false; - secondLocation.enabled = false; - thirdLocation.enabled = false; - fourthLocation.enabled = false; - - for (var i=0; i +* Michail Vourlakos +* +* This file is part of Latte-Dock +* +* Latte-Dock is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* Latte-Dock 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 General Public License +* along with this program. If not, see . +*/ +import QtQuick 2.0 +import QtQuick.Controls 1.4 +import QtQuick.Layouts 1.3 +import QtGraphicalEffects 1.0 + +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 + +import org.kde.plasma.plasmoid 2.0 + +import org.kde.kquickcontrolsaddons 2.0 as KQuickControlAddons + +import org.kde.latte 0.1 as Latte + +PlasmaCore.FrameSvgItem { + id: dialog + imagePath: "dialogs/background" + + //old way to count the dialog width + //Math.max(420,appearancePage.noneShadow.width + appearancePage.lockedAppletsShadow.width + appearancePage.allAppletsShadow.width) + width: content.width + units.largeSpacing * 2 + height: content.height + units.smallSpacing * 2 + + property bool panelIsVertical: plasmoid.formFactor === PlasmaCore.Types.Vertical + + property int windowSpace: 8 + + FontLoader { + id: tangerineFont + name: "Tangerine" + source: "../fonts/tangerine.ttf" + } + + ColumnLayout { + id: content + + Layout.minimumWidth: width + Layout.minimumHeight: height + width: implicitWidth + height: implicitHeight + + anchors.centerIn: parent + spacing: units.smallSpacing + + RowLayout { + id: header + Layout.fillWidth: true + spacing: 0 + + KQuickControlAddons.QIconItem { + id: logo + + Layout.alignment: Qt.AlignLeft | Qt.AlignHCenter + Layout.fillWidth: false + width: 1.5 * latteTxt.font.pixelSize + height: width + + icon: "latte-dock" + } + + PlasmaComponents.Label { + id: latteTxt + Layout.alignment: Qt.AlignLeft | Qt.AlignHCenter + Layout.fillWidth: false + + text: i18n("atte") + font.family: tangerineFont.name + font.pointSize: 2 * theme.defaultFont.pointSize + font.italic: true + Layout.alignment: Qt.AlignLeft + } + + PlasmaComponents.Label { + id: verLabel + font.family: "monospace" + font.pointSize: 0.8 * theme.defaultFont.pointSize + font.bold: true + opacity: 0.4 + + Layout.topMargin: 1.4 * units.iconSizes.small + Layout.alignment: Qt.AlignRight | Qt.AlignTop + horizontalAlignment: Text.AlignRight + Layout.fillWidth: true + + text: i18n("ver:") + "@VERSION@" + } + + PlasmaComponents.ToolButton { + id: pinButton + + Layout.fillWidth: false + Layout.alignment: Qt.AlignRight | Qt.AlignVCenter + + iconSource: "window-pin" + checkable: true + + width: Math.round(units.gridUnit * 1.25) + height: width + + property bool inStartup: true + + onCheckedChanged: { + if (!inStartup) { + plasmoid.configuration.configurationSticker = checked + dockConfig.setSticker(checked) + } + } + + Component.onCompleted: { + checked = plasmoid.configuration.configurationSticker + dockConfig.setSticker(plasmoid.configuration.configurationSticker) + inStartup = false + } + } + } + + PlasmaComponents.TabBar { + id: tabBar + Layout.fillWidth: true + + PlasmaComponents.TabButton { + text: i18n("Behavior") + tab: behaviorPage + } + PlasmaComponents.TabButton { + text: i18n("Appearance") + tab: appearancePage + } + PlasmaComponents.TabButton { + text: i18n("Tasks") + tab: tasksPage + + visible: dock.tasksPresent() + } + } + + Rectangle { + id: pagesBackground + Layout.fillWidth: true + height: childrenRect.height + + property color bC: theme.backgroundColor + property color transparentBack: Qt.rgba(bC.r, bC.g, bC.b, 0.7) + + color: transparentBack + + border.width: 1 + border.color: theme.backgroundColor + + PlasmaExtras.ScrollArea { + anchors.fill: parent + anchors.margins: 3 + verticalScrollBarPolicy: Qt.ScrollBarAlwaysOff + + PlasmaComponents.TabGroup { + width: pagesBackground.width - 6 + //FIXME: this creates a binding loop but I havent found any alternative yet + height: currentTab.childrenRect.height + + privateContents: [ + BehaviorConfig { + id: behaviorPage + }, + AppearanceConfig { + id: appearancePage + }, + TasksConfig { + id: tasksPage + } + ] + } + } + } + + RowLayout { + id: actionButtons + + Layout.fillWidth: true + Layout.alignment: Qt.AlignCenter + + spacing: units.largeSpacing + + PlasmaComponents.Button { + Layout.alignment: Qt.AlignLeft + Layout.fillWidth: true + + text: i18n("Add") + iconSource: "list-add" + + onClicked: dock.addNewDock() + + Component.onCompleted: { + var edges = dock.freeEdges() + if (edges.length === 0) { + enabled = false + } + } + } + PlasmaComponents.Button { + Layout.fillWidth: true + Layout.alignment: Qt.AlignHCenter + + text: i18n("Remove") + iconSource: "edit-delete" + visible: dock.docksCount > 1 ? true : false + + onClicked: dock.removeDock() + } + + PlasmaComponents.Button { + Layout.fillWidth: true + Layout.alignment: Qt.AlignRight + + text: i18n("Quit") + iconSource: "window-close" + + onClicked: dock.closeApplication() + } + } + } +} diff --git a/shell/contents/configuration/LatteDockConfiguration.qml.cmake b/shell/contents/configuration/LatteDockConfiguration.qml.cmake index f46e2b51c..4909ecdfc 100644 --- a/shell/contents/configuration/LatteDockConfiguration.qml.cmake +++ b/shell/contents/configuration/LatteDockConfiguration.qml.cmake @@ -37,199 +37,211 @@ PlasmaCore.FrameSvgItem { id: dialog imagePath: "dialogs/background" - //old way to count the dialog width - //Math.max(420,appearancePage.noneShadow.width + appearancePage.lockedAppletsShadow.width + appearancePage.allAppletsShadow.width) - width: 33*theme.defaultFont.pixelSize - height: 37*theme.defaultFont.pixelSize + property int maxWidth: 420 //Math.max(420, behaviorPage.width, appearancePage.width, tasksPage.width) + property int maxHeight: 400 + width: content.width + units.smallSpacing * 2 + height: content.height + units.smallSpacing * 2 property bool panelIsVertical: plasmoid.formFactor === PlasmaCore.Types.Vertical - property int windowSpace:8 - - FontLoader { id: tangerineFont; name: "Tangerine"; source: "../fonts/tangerine.ttf" } - - PlasmaComponents.ToolButton{ - id: pinButton - anchors.right: parent.right - anchors.top: parent.top - - checkable: true - - iconSource: "window-pin" - - width: Math.round(units.gridUnit * 1.25) - height: width - - property bool inStartup: true - - onCheckedChanged: { - if (!inStartup) { - plasmoid.configuration.configurationSticker = checked; - dockConfig.setSticker(checked); - } - } - - Component.onCompleted: { - checked = plasmoid.configuration.configurationSticker; - dockConfig.setSticker(plasmoid.configuration.configurationSticker); - inStartup = false; - } + FontLoader { + id: tangerineFont + name: "Tangerine" + source: "../fonts/tangerine.ttf" } - ColumnLayout{ - width: parent.width - 2*windowSpace - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - anchors.topMargin: windowSpace + ColumnLayout { + id: content + + Layout.minimumWidth: width + Layout.minimumHeight: height + Layout.preferredWidth: width + Layout.preferredHeight: height + height: header.height + tabBar.height + pagesBackground.height + actionButtons.height + spacing * 3 - spacing: 0 + anchors.centerIn: parent + spacing: units.smallSpacing - RowLayout{ + RowLayout { id: header Layout.fillWidth: true spacing: 0 - KQuickControlAddons.QIconItem{ - id:logo - - width: 1.5*latteTxt.font.pixelSize + KQuickControlAddons.QIconItem { + id: logo + + Layout.alignment: Qt.AlignLeft | Qt.AlignHCenter + Layout.fillWidth: false + width: 1.5 * latteTxt.font.pixelSize height: width icon: "latte-dock" } - PlasmaComponents.Label{ + PlasmaComponents.Label { id: latteTxt + Layout.alignment: Qt.AlignLeft | Qt.AlignHCenter + Layout.fillWidth: false + text: i18n("atte") font.family: tangerineFont.name font.pointSize: 2 * theme.defaultFont.pointSize font.italic: true - Layout.alignment: Qt.AlignLeft } - PlasmaComponents.Label{ + PlasmaComponents.Label { id: verLabel font.family: "monospace" font.pointSize: 0.8 * theme.defaultFont.pointSize font.bold: true opacity: 0.4 - Layout.topMargin: 1.4 * units.iconSizes.small - Layout.alignment: Qt.AlignRight | Qt.AlignTop + Layout.rightMargin: units.smallSpacing + Layout.alignment: Qt.AlignRight | Qt.AlignHCenter horizontalAlignment: Text.AlignRight Layout.fillWidth: true - text: i18n("ver:") +"@VERSION@" + text: i18n("ver:") + "@VERSION@" + } + + PlasmaComponents.ToolButton { + id: pinButton + + Layout.fillWidth: false + Layout.fillHeight: false + Layout.preferredWidth: width + Layout.preferredHeight: height + Layout.alignment: Qt.AlignRight | Qt.AlignVCenter + + iconSource: "window-pin" + checkable: true + + width: Math.round(units.gridUnit * 1.25) + height: width + + property bool inStartup: true + + onClicked: { + plasmoid.configuration.configurationSticker = checked + dockConfig.setSticker(checked) + } + + Component.onCompleted: { + checked = plasmoid.configuration.configurationSticker + dockConfig.setSticker(plasmoid.configuration.configurationSticker) + } } } - PlasmaComponents.TabBar{ - id:tabBar + PlasmaComponents.TabBar { + id: tabBar Layout.fillWidth: true - PlasmaComponents.TabButton{ + PlasmaComponents.TabButton { text: i18n("Behavior") tab: behaviorPage } - PlasmaComponents.TabButton{ + PlasmaComponents.TabButton { text: i18n("Appearance") tab: appearancePage } - PlasmaComponents.TabButton{ + PlasmaComponents.TabButton { text: i18n("Tasks") tab: tasksPage - visible: dock.tasksPresent(); + visible: dock.tasksPresent() } } - Rectangle{ + Rectangle { id: pagesBackground Layout.fillWidth: true - height: 28*theme.defaultFont.pixelSize - + Layout.fillHeight: false + Layout.minimumWidth: maxWidth + Layout.maximumHeight: height + width: maxWidth + units.smallSpacing * 4 + height: behaviorPage.Layout.maximumHeight + units.smallSpacing * 2 + property color bC: theme.backgroundColor - property color transparentBack: Qt.rgba(bC.r,bC.g,bC.b,0.7) + property color transparentBack: Qt.rgba(bC.r, bC.g, bC.b, 0.7) color: transparentBack border.width: 1 border.color: theme.backgroundColor - - PlasmaExtras.ScrollArea{ + PlasmaExtras.ScrollArea { + id: scrollArea + anchors.fill: parent - anchors.margins: 3 - - PlasmaComponents.TabGroup{ - width: pagesBackground.width - 6 - height: currentTab.pageHeight - - privateContents: [ - BehaviorConfig{ - id: behaviorPage - }, - AppearanceConfig{ - id: appearancePage - }, - TasksConfig{ - id: tasksPage - } - ] + verticalScrollBarPolicy: Qt.ScrollBarAlwaysOn + horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff + + PlasmaComponents.TabGroup { + id: tabGroup + + width: currentTab.Layout.maximumWidth + height: currentTab.Layout.maximumHeight + + BehaviorConfig { + id: behaviorPage + } + + AppearanceConfig { + id: appearancePage + } + + TasksConfig { + id: tasksPage + } } } } - } - Row{ - id: actionButtons - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: parent.bottom - anchors.bottomMargin: windowSpace + RowLayout { + id: actionButtons - spacing: 2 - width: parent.width - 2*windowSpace + Layout.fillWidth: true + Layout.alignment: Qt.AlignCenter - PlasmaComponents.Button{ - enabled: true - text: i18n("Add") - iconSource: "list-add" + spacing: units.largeSpacing - width: parent.width/4 - 2 + PlasmaComponents.Button { + Layout.alignment: Qt.AlignLeft + Layout.fillWidth: true + + text: i18n("Add") + iconSource: "list-add" - onClicked: dock.addNewDock(); + onClicked: dock.addNewDock() - Component.onCompleted: { - var edges = dock.freeEdges(); - if (edges.length === 0) { - enabled = false; + Component.onCompleted: { + var edges = dock.freeEdges() + if (edges.length === 0) { + enabled = false + } } } - } - PlasmaComponents.Button{ - enabled: true - text: i18n("Remove") - iconSource: "edit-delete" - width: parent.width/4 - 2 - opacity: dock.docksCount > 1 ? 1 : 0 - - onClicked: dock.removeDock(); - } + PlasmaComponents.Button { + Layout.fillWidth: true + Layout.alignment: Qt.AlignHCenter - Item{ - width: parent.width/4 - 2 - height: 1 - } + text: i18n("Remove") + iconSource: "edit-delete" + visible: dock.docksCount > 1 ? true : false - PlasmaComponents.Button{ - enabled: true - text: i18n("Quit") - iconSource: "window-close" - width: parent.width/4 - 2 + onClicked: dock.removeDock() + } + + PlasmaComponents.Button { + Layout.fillWidth: true + Layout.alignment: Qt.AlignRight - onClicked: dock.closeApplication(); + text: i18n("Quit") + iconSource: "window-close" + + onClicked: dock.closeApplication() + } } } } - - diff --git a/shell/contents/configuration/LatteTextField.qml b/shell/contents/configuration/LatteTextField.qml deleted file mode 100644 index 9e2b08013..000000000 --- a/shell/contents/configuration/LatteTextField.qml +++ /dev/null @@ -1,97 +0,0 @@ -/* -* Copyright 2016 Smith AR -* Michail Vourlakos -* -* This file is part of Latte-Dock -* -* Latte-Dock is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License, or (at your option) any later version. -* -* Latte-Dock 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 General Public License -* along with this program. If not, see . -*/ - -import QtQuick 2.0 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 1.4 - -import org.kde.plasma.components 2.0 as PlasmaComponents - -PlasmaComponents.TextField{ - id: textField - validator: IntValidator {bottom: minValue; top: maxValue;} - text: value === 0 ? "" : value - font.italic: true - placeholderText: i18n("") - - property int step: 100 - property int value: 0 - - property int minValue: 0 - property int maxValue: 3000 - - - function confirmValue(val){ - var fixedVal = Math.min(maxValue, val); - - if (fixedVal < minValue) { - return minValue; - } else { - return fixedVal; - } - } - - onTextChanged: text !== "" ? value = parseInt(text) : value = 0; - - - Row{ - // width: 4 * theme.defaultFont.pixelSize - anchors.right: parent.right - anchors.rightMargin: 2 - anchors.verticalCenter: parent.verticalCenter - PlasmaComponents.Label{ - text: i18n("ms.") - font.italic: true - opacity: (value === 0) ? 0 : 0.6 - } - PlasmaComponents.Label{ - text: " " - font.italic: true - } - PlasmaComponents.Button{ - width: 2*theme.defaultFont.pixelSize - 4 - height: width - text:"-" - onClicked: value = confirmValue(value - step); - } - PlasmaComponents.Button{ - width: 2*theme.defaultFont.pixelSize - 4 - height: width - text:"+" - onClicked: value = confirmValue(value + step); - } - } - - MouseArea{ - anchors.fill: parent - acceptedButtons: Qt.MiddleButton - - onWheel: { - var angle = wheel.angleDelta.y / 8 - - if (angle>0) { - value = confirmValue(value + step); - } else if (angle<0){ - value = confirmValue(value - step); - } - } - } - -} diff --git a/shell/contents/configuration/TasksConfig.qml b/shell/contents/configuration/TasksConfig.qml index 7efe0f3c9..252bcbe2f 100644 --- a/shell/contents/configuration/TasksConfig.qml +++ b/shell/contents/configuration/TasksConfig.qml @@ -17,7 +17,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - import QtQuick 2.0 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.3 @@ -25,199 +24,158 @@ import QtGraphicalEffects 1.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents - import org.kde.plasma.plasmoid 2.0 import org.kde.latte 0.1 as Latte -PlasmaComponents.Page{ - width: dialog.width - 2*dialog.windowSpace - - property int pageHeight: mainColumn.height - - Column{ - id: mainColumn - spacing: 1.5*theme.defaultFont.pointSize - width: parent.width - - /******Appearance******/ - Column{ - width:parent.width - spacing: 0.8*theme.defaultFont.pointSize - - Header{ +PlasmaComponents.Page { + Layout.maximumWidth: content.width + units.smallSpacing * 2 + Layout.maximumHeight: content.height + units.smallSpacing * 2 + + ColumnLayout { + id: content + width: dialog.maxWidth + spacing: units.largeSpacing + anchors.centerIn: parent + + //! BEGIN: Tasks Appearance + ColumnLayout { + spacing: units.smallSpacing + + Header { text: i18n("Appearance") } - Row{ - Item{ - width: 2*theme.defaultFont.pixelSize - height: 1 - } - - Column{ - spacing: 0.4*theme.defaultFont.pixelSize - - PlasmaComponents.CheckBox { - id: showGlow - text: i18n("Show glow around windows points") + PlasmaComponents.CheckBox { + id: showGlow + text: i18n("Show glow around windows points") + checked: plasmoid.configuration.showGlow - onCheckedChanged: { - plasmoid.configuration.showGlow = checked; - } - - Component.onCompleted: checked = plasmoid.configuration.showGlow; - } - - PlasmaComponents.CheckBox { - id: threeColorsWindows - text: i18n("Different color for minimized windows") - - onCheckedChanged: { - plasmoid.configuration.threeColorsWindows = checked; - } - - Component.onCompleted: checked = plasmoid.configuration.threeColorsWindows; - } + onClicked: { + plasmoid.configuration.showGlow = checked + } + } - PlasmaComponents.CheckBox { - id: dotsOnActive - text: i18n("Dots on active window") + PlasmaComponents.CheckBox { + id: threeColorsWindows + text: i18n("Different color for minimized windows") + checked: plasmoid.configuration.threeColorsWindows - onCheckedChanged: { - plasmoid.configuration.dotsOnActive = checked; - } + onClicked: { + plasmoid.configuration.threeColorsWindows = checked + } + } - Component.onCompleted: checked = plasmoid.configuration.dotsOnActive; - } + PlasmaComponents.CheckBox { + id: dotsOnActive + text: i18n("Dots on active window") + checked: plasmoid.configuration.dotsOnActive - PlasmaComponents.CheckBox { - id: reverseLinesPosition - text: i18n("Reverse position for lines and dots") + onClicked: { + plasmoid.configuration.dotsOnActive = checked + } + } - onCheckedChanged: { - plasmoid.configuration.reverseLinesPosition = checked; - } + PlasmaComponents.CheckBox { + id: reverseLinesPosition + text: i18n("Reverse position for lines and dots") + checked: plasmoid.configuration.reverseLinesPosition - Component.onCompleted: checked = plasmoid.configuration.reverseLinesPosition; - } + onClicked: { + plasmoid.configuration.reverseLinesPosition = checked } } } + //! END: Tasks Appearance - /*********Behavior************/ - Column{ - width:parent.width - spacing: 0.8*theme.defaultFont.pointSize + //! BEGIN: Tasks Interaction + ColumnLayout { + spacing: units.smallSpacing - Header{ + Header { text: i18n("Interaction") } - Row{ - Item{ - width: 2*theme.defaultFont.pixelSize - height: 1 - } - Column{ - spacing: 0.4*theme.defaultFont.pixelSize - - PlasmaComponents.CheckBox { - id: showPreviewsChk - text: i18n("Preview windows on hovering") - - onCheckedChanged: { - plasmoid.configuration.showToolTips = checked; - } - - Component.onCompleted: checked = plasmoid.configuration.showToolTips; - } + PlasmaComponents.CheckBox { + id: showPreviewsChk + text: i18n("Preview windows on hovering") + checked: plasmoid.configuration.showToolTips - PlasmaComponents.CheckBox { - id: highlightWindowsChk - text: i18n("Highlight windows on hovering") - - onCheckedChanged: { - plasmoid.configuration.highlightWindows = checked; - } - - Component.onCompleted: checked = plasmoid.configuration.highlightWindows; - } + onClicked: { + plasmoid.configuration.showToolTips = checked + } + } - PlasmaComponents.CheckBox { - id: windowActionsChk - text: i18n("Show window actions in the context menu") + PlasmaComponents.CheckBox { + id: highlightWindowsChk + text: i18n("Highlight windows on hovering") + checked: plasmoid.configuration.highlightWindows - onCheckedChanged: { - plasmoid.configuration.showWindowActions = checked; - } + onClicked: { + plasmoid.configuration.highlightWindows = checked + } + } - Component.onCompleted: checked = plasmoid.configuration.showWindowActions; - } + PlasmaComponents.CheckBox { + id: windowActionsChk + text: i18n("Show window actions in the context menu") + checked: plasmoid.configuration.showWindowActions - PlasmaComponents.CheckBox { - id: smartLaunchersChk - text: i18n("Show progress information in task buttons") + onClicked: { + plasmoid.configuration.showWindowActions = checked + } + } - onCheckedChanged: { - plasmoid.configuration.smartLaunchersEnabled = checked; - } + PlasmaComponents.CheckBox { + id: smartLaunchersChk + text: i18n("Show progress information in task buttons") + checked: plasmoid.configuration.smartLaunchersEnabled - Component.onCompleted: checked = plasmoid.configuration.smartLaunchersEnabled; - } + onClicked: { + plasmoid.configuration.smartLaunchersEnabled = checked } } } + //! END: Tasks Interaction - /*******Filters*******/ - Column{ - width:parent.width - spacing: 0.8*theme.defaultFont.pointSize - - Header{ + //! BEGIN: Tasks Filters + ColumnLayout { + spacing: units.smallSpacing + + Header { text: i18n("Filters") } - Row{ - Item{ - width: 2*theme.defaultFont.pixelSize - height: 1 + PlasmaComponents.CheckBox { + id: showOnlyCurrentScreen + text: i18n("Show only tasks from the current screen") + checked: plasmoid.configuration.showOnlyCurrentScreen + + onClicked: { + plasmoid.configuration.showOnlyCurrentScreen = checked } + } + + PlasmaComponents.CheckBox { + id: showOnlyCurrentDesktop + text: i18n("Show only tasks from the current desktop") + checked: plasmoid.configuration.showOnlyCurrentDesktop + + onClicked: { + plasmoid.configuration.showOnlyCurrentDesktop = checked + } + } - Column{ - spacing: 0.4*theme.defaultFont.pixelSize - - PlasmaComponents.CheckBox { - id: showOnlyCurrentScreen - text: i18n("Show only tasks from the current screen") - onCheckedChanged: { - plasmoid.configuration.showOnlyCurrentScreen = checked; - } - - Component.onCompleted: checked = plasmoid.configuration.showOnlyCurrentScreen; - } - - PlasmaComponents.CheckBox { - id: showOnlyCurrentDesktop - text: i18n("Show only tasks from the current desktop") - onCheckedChanged: { - plasmoid.configuration.showOnlyCurrentDesktop = checked; - } - - Component.onCompleted: checked = plasmoid.configuration.showOnlyCurrentDesktop; - } - - PlasmaComponents.CheckBox { - id: showOnlyCurrentActivity - text: i18n("Show only tasks from the current activity") - onCheckedChanged: { - plasmoid.configuration.showOnlyCurrentActivity = checked; - } - - Component.onCompleted: checked = plasmoid.configuration.showOnlyCurrentActivity; - } + PlasmaComponents.CheckBox { + id: showOnlyCurrentActivity + text: i18n("Show only tasks from the current activity") + checked: plasmoid.configuration.showOnlyCurrentActivity + + onClicked: { + plasmoid.configuration.showOnlyCurrentActivity = checked } } } + //! END: Tasks Filters } } diff --git a/shell/contents/controls/SpinBox.qml b/shell/contents/controls/SpinBox.qml new file mode 100644 index 000000000..da6d93a1b --- /dev/null +++ b/shell/contents/controls/SpinBox.qml @@ -0,0 +1,40 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.4 as Controls +import QtQuick.Controls.Styles.Plasma 2.0 as Styles +import org.kde.plasma.core 2.0 as PlasmaCore + +Controls.SpinBox { + implicitWidth: theme.mSize(theme.defaultFont).width * 10 + + style: Styles.SpinBoxStyle { + PlasmaCore.Svg { + id: arrowSvg + imagePath: "widgets/arrows" + colorGroup: PlasmaCore.Theme.ButtonColorGroup + } + incrementControl: PlasmaCore.SvgItem { + implicitWidth: theme.mSize(theme.defaultFont).width * 1.8 + anchors { + centerIn: parent + margins: 1 + leftMargin: 0 + rightMargin: 3 + } + svg: arrowSvg + elementId: "up-arrow" + opacity: control.enabled ? (styleData.upPressed ? 1 : 0.6) : 0.5 + } + decrementControl: PlasmaCore.SvgItem { + implicitWidth: theme.mSize(theme.defaultFont).width * 1.8 + anchors { + centerIn: parent + margins: 1 + leftMargin: 0 + rightMargin: 3 + } + svg: arrowSvg + elementId: "down-arrow" + opacity: control.enabled ? (styleData.upPressed ? 1 : 0.6) : 0.5 + } + } +}