diff --git a/applets/systemtray/package/contents/ui/ConfigGeneral.qml b/applets/systemtray/package/contents/ui/ConfigGeneral.qml index be169553d..e17ba0d82 100644 --- a/applets/systemtray/package/contents/ui/ConfigGeneral.qml +++ b/applets/systemtray/package/contents/ui/ConfigGeneral.qml @@ -1,140 +1,125 @@ /* * Copyright 2013 Sebastian Kügler * Copyright 2014 Marco Martin * * 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.Controls 2.3 as QtControls import QtQuick.Layouts 1.0 as QtLayouts 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.kquickcontrolsaddons 2.0 +import org.kde.kirigami 2.5 as Kirigami Item { id: iconsPage signal configurationChanged width: childrenRect.width height: childrenRect.height implicitWidth: mainColumn.implicitWidth implicitHeight: pageColumn.implicitHeight property alias cfg_applicationStatusShown: applicationStatus.checked property alias cfg_communicationsShown: communications.checked property alias cfg_systemServicesShown: systemServices.checked property alias cfg_hardwareControlShown: hardwareControl.checked property alias cfg_miscellaneousShown: miscellaneous.checked property var cfg_extraItems: [] - SystemPalette { - id: palette - } + QtControls.CheckBox { + id: dummyCheckbox + visible: false + } - QtLayouts.ColumnLayout { + Kirigami.FormLayout { id: pageColumn - anchors.left: parent.left - - PlasmaExtras.Heading { - level: 2 - text: i18n("Categories") - color: palette.text + anchors { + left: parent.left + right: parent.right } + Item { - width: height - height: units.gridUnit / 2 - } - QtLayouts.ColumnLayout { - spacing: units.smallSpacing * 2 - QtControls.CheckBox { - id: applicationStatus - text: i18n("Application Status") - } - QtControls.CheckBox { - id: communications - text: i18n("Communications") - } - QtControls.CheckBox { - id: systemServices - text: i18n("System Services") - } - QtControls.CheckBox { - id: hardwareControl - text: i18n("Hardware Control") - } - QtControls.CheckBox { - id: miscellaneous - text: i18n("Miscellaneous") - } + Kirigami.FormData.isSection: true + Kirigami.FormData.label: i18n("Categories") } - Item { - width: height - height: units.gridUnit + QtControls.CheckBox { + id: applicationStatus + text: i18n("Application Status") + } + QtControls.CheckBox { + id: communications + text: i18n("Communications") } - PlasmaExtras.Heading { - level: 2 - text: i18n("Extra Items") - color: palette.text + QtControls.CheckBox { + id: systemServices + text: i18n("System Services") } + QtControls.CheckBox { + id: hardwareControl + text: i18n("Hardware Control") + } + QtControls.CheckBox { + id: miscellaneous + text: i18n("Miscellaneous") + } + + Item { - width: height - height: units.gridUnit / 2 + Kirigami.FormData.isSection: true + Kirigami.FormData.label: i18n("Extra Items") } - QtLayouts.ColumnLayout { - spacing: units.smallSpacing * 2 - QtControls.CheckBox { - id: dummyCheckbox - visible: false - } - Repeater { - model: plasmoid.nativeInterface.availablePlasmoids - delegate: QtControls.CheckBox { - QtLayouts.Layout.minimumWidth: childrenRect.width - checked: cfg_extraItems.indexOf(plugin) != -1 - onCheckedChanged: { - var index = cfg_extraItems.indexOf(plugin); - if (checked) { - if (index == -1) { - cfg_extraItems.push(plugin); - } - } else { - if (index > -1) { - cfg_extraItems.splice(index, 1); - } - } - configurationChanged() // qml cannot detect changes inside an Array - } - QtLayouts.RowLayout { - anchors.verticalCenter: parent.verticalCenter - x: dummyCheckbox.width - QIconItem { - icon: decoration - width: units.iconSizes.small - height: width + + Repeater { + model: plasmoid.nativeInterface.availablePlasmoids + delegate: QtControls.CheckBox { + QtLayouts.Layout.minimumWidth: childrenRect.width + checked: cfg_extraItems.indexOf(plugin) != -1 + implicitWidth: itemLayout.width + itemLayout.x + onCheckedChanged: { + var index = cfg_extraItems.indexOf(plugin); + if (checked) { + if (index == -1) { + cfg_extraItems.push(plugin); } - QtControls.Label { - text: display + } else { + if (index > -1) { + cfg_extraItems.splice(index, 1); } } + configurationChanged() // qml cannot detect changes inside an Array + } + QtLayouts.RowLayout { + id: itemLayout + anchors.verticalCenter: parent.verticalCenter + x: dummyCheckbox.width + QIconItem { + icon: model.decoration + width: units.iconSizes.small + height: width + } + QtControls.Label { + text: model.display + } } } } } } diff --git a/wallpapers/image/imagepackage/contents/ui/config.qml b/wallpapers/image/imagepackage/contents/ui/config.qml index 0013cb672..58a490a56 100644 --- a/wallpapers/image/imagepackage/contents/ui/config.qml +++ b/wallpapers/image/imagepackage/contents/ui/config.qml @@ -1,332 +1,336 @@ /* * Copyright 2013 Marco Martin * Copyright 2014 Kai Uwe Broulik * * 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.5 import QtQuick.Controls 1.0 as QtControls import QtQuick.Controls 2.3 as QtControls2 import QtQuick.Layouts 1.0 import QtQuick.Window 2.0 // for Screen //We need units from it import org.kde.plasma.core 2.0 as Plasmacore import org.kde.plasma.wallpapers.image 2.0 as Wallpaper import org.kde.kquickcontrols 2.0 as KQuickControls import org.kde.kquickcontrolsaddons 2.0 import org.kde.kconfig 1.0 // for KAuthorized import org.kde.draganddrop 2.0 as DragDrop import org.kde.kcm 1.1 as KCM +import org.kde.kirigami 2.5 as Kirigami ColumnLayout { id: root property alias cfg_Color: colorButton.color property string cfg_Image property int cfg_FillMode property alias cfg_Blur: blurRadioButton.checked property var cfg_SlidePaths: "" property int cfg_SlideInterval: 0 function saveConfig() { imageWallpaper.commitDeletion(); } SystemPalette { id: syspal } Wallpaper.Image { id: imageWallpaper targetSize: { if (typeof plasmoid !== "undefined") { return Qt.size(plasmoid.width, plasmoid.height) } // Lock screen configuration case return Qt.size(Screen.width, Screen.height) } onSlidePathsChanged: cfg_SlidePaths = slidePaths } onCfg_SlidePathsChanged: { imageWallpaper.slidePaths = cfg_SlidePaths } property int hoursIntervalValue: Math.floor(cfg_SlideInterval / 3600) property int minutesIntervalValue: Math.floor(cfg_SlideInterval % 3600) / 60 property int secondsIntervalValue: cfg_SlideInterval % 3600 % 60 //Rectangle { color: "orange"; x: formAlignment; width: formAlignment; height: 20 } TextMetrics { id: textMetrics text: "00" } 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.image", "Positioning:") horizontalAlignment: Text.AlignRight } QtControls.ComboBox { id: resizeComboBox - property int textLength: 24 - width: theme.mSize(theme.defaultFont).width * textLength + TextMetrics { + id: resizeTextMetrics + text: resizeComboBox.currentText + } + width: resizeTextMetrics.width + Kirigami.Units.smallSpacing * 2 + Kirigami.Units.gridUnit * 2 model: [ { 'label': i18nd("plasma_wallpaper_org.kde.image", "Scaled and Cropped"), 'fillMode': Image.PreserveAspectCrop }, { 'label': i18nd("plasma_wallpaper_org.kde.image","Scaled"), 'fillMode': Image.Stretch }, { 'label': i18nd("plasma_wallpaper_org.kde.image","Scaled, Keep Proportions"), 'fillMode': Image.PreserveAspectFit }, { 'label': i18nd("plasma_wallpaper_org.kde.image", "Centered"), 'fillMode': Image.Pad }, { 'label': i18nd("plasma_wallpaper_org.kde.image","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; //resizeComboBox.textLength = Math.max(resizeComboBox.textLength, tl+5); } } } } } QtControls.ExclusiveGroup { id: backgroundGroup } Row { id: blurRow spacing: units.largeSpacing / 2 visible: cfg_FillMode === Image.PreserveAspectFit || cfg_FillMode === Image.Pad QtControls.Label { id: blurLabel width: formAlignment - units.largeSpacing anchors.verticalCenter: blurRadioButton.verticalCenter horizontalAlignment: Text.AlignRight text: i18nd("plasma_wallpaper_org.kde.image", "Background:") } QtControls.RadioButton { id: blurRadioButton text: i18nd("plasma_wallpaper_org.kde.image", "Blur") exclusiveGroup: backgroundGroup } } Row { id: colorRow visible: cfg_FillMode === Image.PreserveAspectFit || cfg_FillMode === Image.Pad spacing: units.largeSpacing / 2 QtControls.Label { width: formAlignment - units.largeSpacing } QtControls.RadioButton { id: colorRadioButton text: i18nd("plasma_wallpaper_org.kde.image", "Solid color") exclusiveGroup: backgroundGroup checked: !cfg_Blur } KQuickControls.ColorButton { id: colorButton dialogTitle: i18nd("plasma_wallpaper_org.kde.image", "Select Background Color") } } Component { id: foldersComponent ColumnLayout { anchors.fill: parent Connections { target: root onHoursIntervalValueChanged: hoursInterval.value = root.hoursIntervalValue onMinutesIntervalValueChanged: minutesInterval.value = root.minutesIntervalValue onSecondsIntervalValueChanged: secondsInterval.value = root.secondsIntervalValue } //FIXME: there should be only one spinbox: QtControls spinboxes are still too limited for it tough RowLayout { Layout.fillWidth: true spacing: units.largeSpacing / 2 QtControls.Label { Layout.minimumWidth: formAlignment - units.largeSpacing horizontalAlignment: Text.AlignRight text: i18nd("plasma_wallpaper_org.kde.image","Change every:") } QtControls.SpinBox { id: hoursInterval Layout.minimumWidth: textMetrics.width + units.gridUnit width: units.gridUnit * 3 decimals: 0 value: root.hoursIntervalValue minimumValue: 0 maximumValue: 24 onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value } QtControls.Label { text: i18nd("plasma_wallpaper_org.kde.image","Hours") } Item { Layout.preferredWidth: units.gridUnit } QtControls.SpinBox { id: minutesInterval Layout.minimumWidth: textMetrics.width + units.gridUnit width: units.gridUnit * 3 decimals: 0 value: root.minutesIntervalValue minimumValue: 0 maximumValue: 60 onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value } QtControls.Label { text: i18nd("plasma_wallpaper_org.kde.image","Minutes") } Item { Layout.preferredWidth: units.gridUnit } QtControls.SpinBox { id: secondsInterval Layout.minimumWidth: textMetrics.width + units.gridUnit width: units.gridUnit * 3 decimals: 0 value: root.secondsIntervalValue minimumValue: root.hoursIntervalValue === 0 && root.minutesIntervalValue === 0 ? 1 : 0 maximumValue: 60 onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value } QtControls.Label { text: i18nd("plasma_wallpaper_org.kde.image","Seconds") } } QtControls2.ScrollView { id: foldersScroll Layout.fillHeight: true; Layout.fillWidth: true Component.onCompleted: foldersScroll.background.visible = true; ListView { id: slidePathsView anchors.margins: 4 model: imageWallpaper.slidePaths delegate: QtControls.Label { text: modelData width: slidePathsView.width height: Math.max(paintedHeight, removeButton.height); QtControls.ToolButton { id: removeButton anchors { verticalCenter: parent.verticalCenter right: parent.right } iconName: "list-remove" onClicked: imageWallpaper.removeSlidePath(modelData); } } } } } } Component { id: thumbnailsComponent KCM.GridView { id: wallpapersGrid anchors.fill: parent //that min is needed as the module will be populated in an async way //and only on demand so we can't ensure it already exists view.currentIndex: Math.min(imageWallpaper.wallpaperModel.indexOf(cfg_Image), imageWallpaper.wallpaperModel.count-1) //kill the space for label under thumbnails view.model: imageWallpaper.wallpaperModel view.delegate: WallpaperDelegate { color: cfg_Color } } } DragDrop.DropArea { Layout.fillWidth: true Layout.fillHeight: true onDragEnter: { if (!event.mimeData.hasUrls) { event.ignore(); } } onDrop: { event.mimeData.urls.forEach(function (url) { if (url.indexOf("file://") === 0) { var path = url.substr(7); // 7 is length of "file://" if (configDialog.currentWallpaper === "org.kde.image") { imageWallpaper.addUsersWallpaper(path); } else { imageWallpaper.addSlidePath(path); } } }); } Loader { anchors.fill: parent sourceComponent: (configDialog.currentWallpaper == "org.kde.image") ? thumbnailsComponent : foldersComponent } } RowLayout { id: buttonsRow Layout.alignment: Qt.AlignRight | Qt.AlignVCenter QtControls.Button { visible: (configDialog.currentWallpaper == "org.kde.slideshow") iconName: "list-add" text: i18nd("plasma_wallpaper_org.kde.image","Add Folder...") onClicked: imageWallpaper.showAddSlidePathsDialog() } QtControls.Button { visible: (configDialog.currentWallpaper == "org.kde.image") iconName: "list-add" text: i18nd("plasma_wallpaper_org.kde.image","Add Image...") onClicked: imageWallpaper.showFileDialog(); } QtControls.Button { iconName: "get-hot-new-stuff" text: i18nd("plasma_wallpaper_org.kde.image","Get New Wallpapers...") visible: KAuthorized.authorize("ghns") onClicked: imageWallpaper.getNewWallpaper(this); } } }