diff --git a/applets/binary-clock/package/contents/ui/configGeneral.qml b/applets/binary-clock/package/contents/ui/configGeneral.qml index fc9f80407..007e0d1ea 100644 --- a/applets/binary-clock/package/contents/ui/configGeneral.qml +++ b/applets/binary-clock/package/contents/ui/configGeneral.qml @@ -1,135 +1,96 @@ /* * Copyright 2014 Joseph Wenninger * * Based on analog-clock configGeneral.qml: * Copyright 2013 David Edmundson * * This program 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. * * 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 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 1.0 as QtControls -import QtQuick.Dialogs 1.1 import QtQuick.Layouts 1.1 +import org.kde.kquickcontrols 2.0 as KQuickControls QtControls.GroupBox { width: childrenRect.width height: childrenRect.height flat: true title: i18n("Appearance") property alias cfg_showGrid: showGridCheckBox.checked property alias cfg_showOffLeds: showOffLedsCheckBox.checked property alias cfg_showSeconds: showSecondsCheckBox.checked property alias cfg_showBcdFormat: showBcdFormatCheckBox.checked property alias cfg_useCustomColorForActive: useCustomColorForActiveCheckBox.checked property alias cfg_customColorForActive: customColorForActive.color property alias cfg_useCustomColorForInactive: useCustomColorForInactiveCheckBox.checked property alias cfg_customColorForInactive: customColorForInactive.color property alias cfg_useCustomColorForGrid: useCustomColorForGridCheckBox.checked property alias cfg_customColorForGrid: customColorForGrid.color - ColorDialog { - property var element; - id: colorDialog - visible: false - modality: Qt.WindowModal - title: "Choose a color" - showAlphaChannel: true - onAccepted: { element.color=color } - onRejected: { } - } - - ColumnLayout { QtControls.CheckBox { id: showGridCheckBox text: i18n("Draw grid") } QtControls.CheckBox { id: showOffLedsCheckBox text: i18n("Show inactive LEDs:") } QtControls.CheckBox { id: showSecondsCheckBox text: i18n("Display seconds") } QtControls.CheckBox { id: showBcdFormatCheckBox text: i18n("Display in BCD format (decimal)") } QtControls.Label { text: i18n("Colors:") } GridLayout { columns: 2; QtControls.CheckBox { id: useCustomColorForActiveCheckBox text: i18n("Use custom color for active LEDs") } - Rectangle { - width:20 - height:20 - id:customColorForActive - MouseArea { - anchors.fill: parent - onClicked: { - colorDialog.element=parent; - colorDialog.color=parent.color; - colorDialog.open(); - } - } + KQuickControls.ColorButton { + id: customColorForActive + enabled: useCustomColorForActiveCheckBox.checked } QtControls.CheckBox { id: useCustomColorForInactiveCheckBox text: i18n("Use custom color for inactive LEDs") } - Rectangle { - width:20 - height:20 + KQuickControls.ColorButton { id:customColorForInactive - MouseArea { - anchors.fill: parent - onClicked: { - colorDialog.element=parent; - colorDialog.color=parent.color; - colorDialog.open(); - } - } + enabled: useCustomColorForInactiveCheckBox.checked } QtControls.CheckBox { id: useCustomColorForGridCheckBox text: i18n("Use custom color for grid") } - Rectangle { - width:20 - height:20 + KQuickControls.ColorButton { id:customColorForGrid - MouseArea { - anchors.fill: parent - onClicked: { - colorDialog.element=parent; - colorDialog.color=parent.color; - colorDialog.open(); - } - } + enabled: useCustomColorForGridCheckBox.checked } } } } diff --git a/applets/systemloadviewer/package/contents/ui/ColorPicker.qml b/applets/systemloadviewer/package/contents/ui/ColorPicker.qml deleted file mode 100644 index 22ef04d1c..000000000 --- a/applets/systemloadviewer/package/contents/ui/ColorPicker.qml +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2014 Martin Yrjölä - * - * This program 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) version 3 or any later version - * accepted by the membership of KDE e.V. (or its successor approved - * by the membership of KDE e.V.), which shall act as a proxy - * defined in Section 14 of version 3 of the license. - * - * 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 General Public License - * along with this program. If not, see - */ - -import QtQuick 2.2 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.2 as QtControls -import QtQuick.Dialogs 1.0 as QtDialogs -import org.kde.plasma.core 2.0 as PlasmaCore - -Item { - id: colorPicker - - property alias chosenColor: colorDialog.color - - width: childrenRect.width - height: childrenRect.height - Layout.alignment: Qt.AlignVCenter - - Rectangle { - color: colorDialog.color - radius: width / 2 - height: 20 - width: height - opacity: enabled ? 1 : 0.5 - border { - width: mouseArea.containsMouse ? 3 : 1 - color: Qt.darker(colorDialog.color, 1.5) - } - - QtDialogs.ColorDialog { - id: colorDialog - } - } - - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - onClicked: { - colorDialog.open() - } - } -} diff --git a/applets/systemloadviewer/package/contents/ui/ColorSettings.qml b/applets/systemloadviewer/package/contents/ui/ColorSettings.qml index 2bbe4bf48..bd7aa88bb 100644 --- a/applets/systemloadviewer/package/contents/ui/ColorSettings.qml +++ b/applets/systemloadviewer/package/contents/ui/ColorSettings.qml @@ -1,170 +1,171 @@ /* * Copyright (C) 2014 Martin Yrjölä * * This program 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) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * 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 General Public License * along with this program. If not, see */ import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Layouts 1.0 +import org.kde.kquickcontrols 2.0 as KQuickControls ColumnLayout { id: colorSettings - property alias cfg_memApplicationColor: memApplicationColorPicker.chosenColor - property alias cfg_memBuffersColor: memBuffersColorPicker.chosenColor - property alias cfg_memCachedColor: memCachedColorPicker.chosenColor - property alias cfg_cpuUserColor: cpuUserColorPicker.chosenColor - property alias cfg_cpuIOWaitColor: cpuIOWaitColorPicker.chosenColor - property alias cfg_cpuSysColor: cpuSysColorPicker.chosenColor - property alias cfg_cpuNiceColor: cpuNiceColorPicker.chosenColor - property alias cfg_swapUsedColor: swapUsedColorPicker.chosenColor - property alias cfg_cacheDirtyColor: cacheDirtyColorPicker.chosenColor - property alias cfg_cacheWritebackColor: cacheWritebackColorPicker.chosenColor + property alias cfg_memApplicationColor: memApplicationColorPicker.color + property alias cfg_memBuffersColor: memBuffersColorPicker.color + property alias cfg_memCachedColor: memCachedColorPicker.color + property alias cfg_cpuUserColor: cpuUserColorPicker.color + property alias cfg_cpuIOWaitColor: cpuIOWaitColorPicker.color + property alias cfg_cpuSysColor: cpuSysColorPicker.color + property alias cfg_cpuNiceColor: cpuNiceColorPicker.color + property alias cfg_swapUsedColor: swapUsedColorPicker.color + property alias cfg_cacheDirtyColor: cacheDirtyColorPicker.color + property alias cfg_cacheWritebackColor: cacheWritebackColorPicker.color property alias cfg_setColorsManually: setColorsManuallyGroupBox.checked GroupBox { id: setColorsManuallyGroupBox Layout.fillWidth: true title: i18n("Set colors manually") checkable: true flat: true GridLayout { columns: 2 Label { text: i18n("CPU") Layout.columnSpan: 2 font.bold: true } Label { text: i18n("User:") Layout.alignment: Qt.AlignRight } - ColorPicker { + KQuickControls.ColorButton { id: cpuUserColorPicker } Label { text: i18n("IOWait:") Layout.alignment: Qt.AlignRight } - ColorPicker { + KQuickControls.ColorButton { id: cpuIOWaitColorPicker } Label { text: i18n("Sys:") Layout.alignment: Qt.AlignRight } - ColorPicker { + KQuickControls.ColorButton { id: cpuSysColorPicker } Label { text: i18n("Nice:") Layout.alignment: Qt.AlignRight } - ColorPicker { + KQuickControls.ColorButton { id: cpuNiceColorPicker } Label { text: i18n("Memory") Layout.columnSpan: 2 font.bold: true } Label { text: i18n("Application:") Layout.alignment: Qt.AlignRight } - ColorPicker { + KQuickControls.ColorButton { id: memApplicationColorPicker } Label { text: i18n("Buffers:") Layout.alignment: Qt.AlignRight } - ColorPicker { + KQuickControls.ColorButton { id: memBuffersColorPicker } Label { text: i18n("Cached:") Layout.alignment: Qt.AlignRight } - ColorPicker { + KQuickControls.ColorButton { id: memCachedColorPicker } Label { text: i18n("Swap") Layout.columnSpan: 2 font.bold: true } Label { text: i18n("Used swap:") Layout.alignment: Qt.AlignRight } - ColorPicker { + KQuickControls.ColorButton { id: swapUsedColorPicker } Label { text: i18n("Cache") Layout.columnSpan: 2 font.bold: true } Label { text: i18n("Dirty memory:") Layout.alignment: Qt.AlignRight } - ColorPicker { + KQuickControls.ColorButton { id: cacheDirtyColorPicker } Label { text: i18n("Writeback memory:") Layout.alignment: Qt.AlignRight } - ColorPicker { + KQuickControls.ColorButton { id: cacheWritebackColorPicker } } } Item { Layout.fillHeight: true } } diff --git a/wallpapers/potd/contents/ui/config.qml b/wallpapers/potd/contents/ui/config.qml index b58fc3d1c..29ec7fb30 100644 --- a/wallpapers/potd/contents/ui/config.qml +++ b/wallpapers/potd/contents/ui/config.qml @@ -1,172 +1,154 @@ /* * Copyright 2016 Weng Xuetian * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.5 import QtQuick.Layouts 1.0 import QtQuick.Controls 1.0 as QtControls -import QtQuick.Dialogs 1.1 as QtDialogs +import org.kde.kquickcontrols 2.0 as KQuickControls import org.kde.plasma.core 2.0 as PlasmaCore ColumnLayout { id: root property string cfg_Provider property int cfg_FillMode - property alias cfg_Color: colorDialog.color + property alias cfg_Color: colorButton.color ListModel { id: providerModel } function populateProviders() { providerModel.clear(); var providers = engine.data["Providers"]; if (providers) { var provider; for (provider in providers) { providerModel.append({'id': provider, 'name': providers[provider]}) } } } PlasmaCore.DataSource { id: engine engine: "potd" connectedSources: ["Providers"] onDataChanged: populateProviders() } Component.onCompleted: { populateProviders() for (var i = 0; i < providerModel.count; i++) { if (providerModel.get(i)["id"] == wallpaper.configuration.Provider) { providerComboBox.currentIndex = i; break; } } } Row { spacing: units.largeSpacing / 2 QtControls.Label { width: formAlignment - units.largeSpacing horizontalAlignment: Text.AlignRight text: i18nd("plasma_wallpaper_org.kde.potd", "Providers:") anchors.verticalCenter: providerComboBox.verticalCenter } QtControls.ComboBox { id: providerComboBox property int textLength: 24 width: theme.mSize(theme.defaultFont).width * textLength model: providerModel textRole: "name" onCurrentIndexChanged: { cfg_Provider = providerModel.get(currentIndex)["id"] } } } Row { //x: formAlignment - positionLabel.paintedWidth spacing: units.largeSpacing / 2 QtControls.Label { id: positionLabel width: formAlignment - units.largeSpacing anchors { verticalCenter: resizeComboBox.verticalCenter } text: i18nd("plasma_wallpaper_org.kde.potd", "Positioning:") horizontalAlignment: Text.AlignRight } QtControls.ComboBox { id: resizeComboBox property int textLength: 24 width: theme.mSize(theme.defaultFont).width * textLength model: [ { 'label': i18nd("plasma_wallpaper_org.kde.potd", "Scaled and Cropped"), 'fillMode': Image.PreserveAspectCrop }, { 'label': i18nd("plasma_wallpaper_org.kde.potd", "Scaled"), 'fillMode': Image.Stretch }, { 'label': i18nd("plasma_wallpaper_org.kde.potd", "Scaled, Keep Proportions"), 'fillMode': Image.PreserveAspectFit }, { 'label': i18nd("plasma_wallpaper_org.kde.potd", "Centered"), 'fillMode': Image.Pad }, { 'label': i18nd("plasma_wallpaper_org.kde.potd", "Tiled"), 'fillMode': Image.Tile } ] textRole: "label" onCurrentIndexChanged: cfg_FillMode = model[currentIndex]["fillMode"] Component.onCompleted: setMethod(); function setMethod() { for (var i = 0; i < model.length; i++) { if (model[i]["fillMode"] == wallpaper.configuration.FillMode) { resizeComboBox.currentIndex = i; var tl = model[i]["label"].length; } } } } } - QtDialogs.ColorDialog { - id: colorDialog - modality: Qt.WindowModal - showAlphaChannel: false - title: i18nd("plasma_wallpaper_org.kde.potd", "Select Background Color") - } - Row { id: colorRow spacing: units.largeSpacing / 2 QtControls.Label { width: formAlignment - units.largeSpacing anchors.verticalCenter: colorButton.verticalCenter horizontalAlignment: Text.AlignRight text: i18nd("plasma_wallpaper_org.kde.potd", "Background Color:") } - QtControls.Button { + KQuickControls.ColorButton { id: colorButton - width: units.gridUnit * 3 - text: " " // needed to it gets a proper height... - onClicked: colorDialog.open() - - Rectangle { - id: colorRect - anchors.centerIn: parent - width: parent.width - 2 * units.smallSpacing - height: theme.mSize(theme.defaultFont).height - color: colorDialog.color - } } } Item { // tighten layout Layout.fillHeight: true } }