diff --git a/applets/appmenu/package/contents/ui/main.qml b/applets/appmenu/package/contents/ui/main.qml index 4ddbdbf19..8780afd6f 100644 --- a/applets/appmenu/package/contents/ui/main.qml +++ b/applets/appmenu/package/contents/ui/main.qml @@ -1,164 +1,164 @@ /* * Copyright 2013 Heena Mahour * Copyright 2013 Sebastian Kügler * Copyright 2016 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, see . */ import QtQuick 2.0 import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.8 import org.kde.plasma.plasmoid 2.0 import org.kde.kquickcontrolsaddons 2.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.private.appmenu 1.0 as AppMenuPrivate Item { id: root readonly property bool vertical: plasmoid.formFactor === PlasmaCore.Types.Vertical readonly property bool view: plasmoid.configuration.compactView readonly property bool menuAvailable: appMenuModel.menuAvailable readonly property bool kcmAuthorized: KCMShell.authorize(["style.desktop"]).length > 0 onViewChanged: { plasmoid.nativeInterface.view = view } Plasmoid.preferredRepresentation: (plasmoid.configuration.compactView || vertical) ? Plasmoid.compactRepresentation : Plasmoid.fullRepresentation Plasmoid.compactRepresentation: PlasmaComponents.ToolButton { readonly property int fakeIndex: 0 Layout.fillWidth: false Layout.fillHeight: false Layout.minimumWidth: implicitWidth Layout.maximumWidth: implicitWidth enabled: menuAvailable checkable: menuAvailable && plasmoid.nativeInterface.currentIndex === fakeIndex checked: checkable iconSource: "application-menu" onClicked: plasmoid.nativeInterface.trigger(this, 0); } Plasmoid.fullRepresentation: GridLayout { id: buttonGrid Plasmoid.status: { if (menuAvailable && plasmoid.nativeInterface.currentIndex > -1 && buttonRepeater.count > 0) { return PlasmaCore.Types.NeedsAttentionStatus; } else { //when we're not enabled set to active to show the configure button return buttonRepeater.count > 0 ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.HiddenStatus; } } Layout.minimumWidth: implicitWidth Layout.minimumHeight: implicitHeight flow: root.vertical ? GridLayout.TopToBottom : GridLayout.LeftToRight rowSpacing: units.smallSpacing columnSpacing: units.smallSpacing Component.onCompleted: { plasmoid.nativeInterface.buttonGrid = buttonGrid // using a Connections {} doesn't work for some reason in Qt >= 5.8 plasmoid.nativeInterface.requestActivateIndex.connect(function (index) { var idx = Math.max(0, Math.min(buttonRepeater.count - 1, index)) var button = buttonRepeater.itemAt(index) if (button) { button.clicked() } }); plasmoid.activated.connect(function () { var button = buttonRepeater.itemAt(0); if (button) { button.clicked(); } }); } // So we can show mnemonic underlines only while Alt is pressed PlasmaCore.DataSource { id: keystateSource engine: "keystate" connectedSources: ["Alt"] } PlasmaComponents.ToolButton { id: noMenuPlaceholder visible: buttonRepeater.count == 0 text: plasmoid.title Layout.preferredWidth: minimumWidth Layout.fillWidth: root.vertical Layout.fillHeight: !root.vertical } Repeater { id: buttonRepeater model: appMenuModel.visible ? appMenuModel : null PlasmaComponents.ToolButton { readonly property int buttonIndex: index Layout.preferredWidth: minimumWidth Layout.fillWidth: root.vertical Layout.fillHeight: !root.vertical text: { var text = activeMenu; var alt = keystateSource.data.Alt; if (!alt || !alt.Pressed) { // StyleHelpers.removeMnemonics text = text.replace(/([^&]*)&(.)([^&]*)/g, function (match, p1, p2, p3) { return p1.concat(p2, p3); }); } return text; } // fake highlighted checkable: plasmoid.nativeInterface.currentIndex === index checked: checkable visible: text !== "" onClicked: { plasmoid.nativeInterface.trigger(this, index) checked = Qt.binding(function() { return plasmoid.nativeInterface.currentIndex === index; }); } // QMenu opens on press, so we'll replicate that here MouseArea { anchors.fill: parent onPressed: parent.clicked() } } } } AppMenuPrivate.AppMenuModel { id: appMenuModel screenGeometry: plasmoid.screenGeometry onRequestActivateIndex: plasmoid.nativeInterface.requestActivateIndex(index) Component.onCompleted: { plasmoid.nativeInterface.model = appMenuModel } } } diff --git a/applets/digital-clock/package/contents/ui/configTimeZones.qml b/applets/digital-clock/package/contents/ui/configTimeZones.qml index aacd5f00b..1170e13b0 100644 --- a/applets/digital-clock/package/contents/ui/configTimeZones.qml +++ b/applets/digital-clock/package/contents/ui/configTimeZones.qml @@ -1,134 +1,107 @@ /* * Copyright 2013 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) 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.0 -import QtQuick.Controls 1.2 as QtControls +import QtQuick 2.13 +import QtQuick.Controls 2.13 as QQC2 import QtQuick.Layouts 1.0 import QtQuick.Dialogs 1.1 import org.kde.plasma.private.digitalclock 1.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.kirigami 2.5 as Kirigami ColumnLayout { id: timeZonesPage property alias cfg_selectedTimeZones: timeZones.selectedTimeZones property alias cfg_wheelChangesTimezone: enableWheelCheckBox.checked TimeZoneModel { id: timeZones onSelectedTimeZonesChanged: { if (selectedTimeZones.length === 0) { messageWidget.visible = true; timeZones.selectLocalTimeZone(); } } } - // This is just for getting the column width - QtControls.CheckBox { - id: checkbox - visible: false - } - Kirigami.InlineMessage { id: messageWidget - Layout.fillWidth: true - + Layout.margins: Kirigami.Units.smallSpacing type: Kirigami.MessageType.Warning text: i18n("At least one time zone needs to be enabled. 'Local' was enabled automatically.") - showCloseButton: true } - QtControls.TextField { + QQC2.TextField { id: filter Layout.fillWidth: true placeholderText: i18n("Search Time Zones") } - QtControls.TableView { - id: timeZoneView - - signal toggleCurrent - + Item { Layout.fillWidth: true Layout.fillHeight: true - Keys.onSpacePressed: toggleCurrent() + QQC2.ScrollView { + anchors.fill: parent + clip: true + Component.onCompleted: background.visible = true // enable border - model: TimeZoneFilterProxy { - sourceModel: timeZones - filterString: filter.text - } + ListView { + id: listView + focus: true // keyboard navigation + activeFocusOnTab: true // keyboard navigation - QtControls.TableViewColumn { - role: "checked" - width: checkbox.width - delegate: - QtControls.CheckBox { - id: checkBox - anchors.centerIn: parent - checked: styleData.value - activeFocusOnTab: false // only let the TableView as a whole get focus - onClicked: { - //needed for model's setData to be called - model.checked = checked; - } + model: TimeZoneFilterProxy { + sourceModel: timeZones + filterString: filter.text + } - Connections { - target: timeZoneView - onToggleCurrent: { - if (styleData.row === timeZoneView.currentRow) { - model.checked = !checkBox.checked - } - } + delegate: QQC2.CheckDelegate { + id: checkbox + focus: true // keyboard navigation + width: parent.width + text: !city || city.indexOf("UTC") === 0 ? comment : comment ? i18n("%1, %2 (%3)", city, region, comment) : i18n("%1, %2", city, region) + checked: model.checked + onToggled: { + model.checked = checkbox.checked + listView.currentIndex = index // highlight + listView.forceActiveFocus() // keyboard navigation } + highlighted: ListView.isCurrentItem } - - resizable: false - movable: false - } - QtControls.TableViewColumn { - role: "city" - title: i18n("City") - } - QtControls.TableViewColumn { - role: "region" - title: i18n("Region") - } - QtControls.TableViewColumn { - role: "comment" - title: i18n("Comment") + } } } RowLayout { Layout.fillWidth: true - QtControls.CheckBox { + QQC2.CheckBox { id: enableWheelCheckBox text: i18n("Switch time zone with mouse wheel") } } + } diff --git a/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml b/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml index 3f025ffaf..3570c30d6 100644 --- a/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml +++ b/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml @@ -1,173 +1,177 @@ /* * Copyright 2013 Bhushan Shah * * 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.4 as QQC1 import QtQuick.Controls 2.5 as QQC2 import QtQuick.Layouts 1.3 import org.kde.kirigami 2.5 as Kirigami import org.kde.plasma.core 2.0 as PlasmaCore Item { id: iconsPage width: childrenRect.width height: childrenRect.height implicitWidth: formLayout.implicitWidth implicitHeight: formLayout.implicitHeight property var cfg_sources: [] function sourcesChanged() { if (! cfg_sources) { cfg_sources = [] } if (cfg_sources.length == 0) { for (var i in dataSourcesColumn.children) { var child = dataSourcesColumn.children[i]; if (child.checked !== undefined) { child.checked = sourceDefaultEnable(child.source); } } } else { for (var i in dataSourcesColumn.children) { var child = dataSourcesColumn.children[i]; if (child.checked !== undefined) { child.checked = cfg_sources.indexOf(child.source) !== -1; } } } } function sourceDefaultEnable(source) { return true; } onCfg_sourcesChanged: { sourcesChanged(); } property int cfg_updateInterval signal sourceAdded(string source) function addSource(source, friendlyName) { var found = false; for (var i = 0; i < sourcesModel.count; ++i) { var obj = sourcesModel.get(i); if (obj.source === source) { found = true; break; } } if (found) { return; } sourcesModel.append( {"source": encodeURIComponent(source), "friendlyName": friendlyName}); } PlasmaCore.DataSource { id: smSource engine: "systemmonitor" onSourceAdded: { iconsPage.sourceAdded(source); } onSourceRemoved: { for (var i = sourcesModel.count - 1; i >= 0; --i) { var obj = sourcesModel.get(i); if (obj.source === source) { sourcesModel.remove(i); } } } } Component.onCompleted: { for (var i in smSource.sources) { var source = smSource.sources[i]; iconsPage.sourceAdded(source); } sourcesChanged(); } ListModel { id: sourcesModel } Kirigami.FormLayout { id: formLayout anchors.left: parent.left anchors.right: parent.right - // QQC2 SpinBox doesn't cleanly support non-integer values, which can be - // worked around, but the code is messy and the user experience is - // somewhat poor. So for now, we stick with the QQC1 SpinBox - QQC1.SpinBox { + QQC2.SpinBox { id: updateIntervalSpinBox - Kirigami.FormData.label: i18n("Update interval:") - decimals: 1 - suffix: i18ncp("Suffix for spinbox (seconds)", " second", - " seconds") - maximumValue: 1000 - stepSize: 0.1 - onValueChanged: cfg_updateInterval = value * 1000 - Component.onCompleted: value = cfg_updateInterval / 1000 + from: 100 + stepSize: 100 + to: 1000000 + editable: true + validator: DoubleValidator { + bottom: spinbox.from + top: spinbox.to + } + textFromValue: function(value) { + var seconds = value / 1000 + return i18n("%1 seconds", seconds.toFixed(1)) + } + valueFromText: function(text) { + return parseFloat(text) * 1000 + } + value: cfg_updateInterval + onValueModified: cfg_updateInterval = value } - Item { Kirigami.FormData.isSection: true } ColumnLayout { id: dataSourcesColumn Kirigami.FormData.label: i18n("Show:") Kirigami.FormData.buddyFor: children[1] // 0 is the Repeater Repeater { id: repeater model: sourcesModel QQC2.CheckBox { id: checkBox text: model.friendlyName property string source: model.source onCheckedChanged: { if (checked) { if (cfg_sources.indexOf(model.source) == -1) { cfg_sources.push(model.source); } } else { var idx = cfg_sources.indexOf(model.source); if (idx !== -1) { cfg_sources.splice(idx, 1); } } cfg_sourcesChanged(); } } } } } } diff --git a/sddm-theme/KeyboardButton.qml b/sddm-theme/KeyboardButton.qml index 7d8f60a00..611758cec 100644 --- a/sddm-theme/KeyboardButton.qml +++ b/sddm-theme/KeyboardButton.qml @@ -1,114 +1,114 @@ import QtQuick 2.6 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 3.0 as PlasmaComponents import QtQuick.Controls 2.5 as QQC2 import QtGraphicalEffects 1.0 PlasmaComponents.ToolButton { id: keyboardButton property int currentIndex: -1 text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Keyboard Layout: %1", instantiator.objectAt(currentIndex).shortName) font.pointSize: config.fontSize visible: keyboardMenu.count > 1 Component.onCompleted: currentIndex = Qt.binding(function() {return keyboard.currentLayout}); onClicked: { keyboardMenu.popup(x, y) } QQC2.Menu { id: keyboardMenu - + property int largestWidth: 9999 - + Component.onCompleted: { var trueWidth = 0; for (var i = 0; i < keyboardMenu.count; i++) { trueWidth = Math.max(trueWidth, keyboardMenu.itemAt(i).textWidth) } keyboardMenu.largestWidth = trueWidth } background: Rectangle { implicitHeight: 40 implicitWidth: keyboardMenu.largestWidth > keyboardButton.implicitWidth ? keyboardMenu.largestWidth : keyboardButton.implicitWidth color: PlasmaCore.ColorScope.backgroundColor property color borderColor: PlasmaCore.Colorscope.textColor border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) border.width: 1 layer.enabled: true layer.effect: DropShadow { transparentBorder: true radius: 8 samples: 8 horizontalOffset: 0 verticalOffset: 2 color: Qt.rgba(0, 0, 0, 0.3) } } Instantiator { id: instantiator model: keyboard.layouts onObjectAdded: keyboardMenu.addItem( object ) onObjectRemoved: keyboardMenu.removeItem( object ) delegate: QQC2.MenuItem { id: menuItem property string name: modelData.longName property string shortName: modelData.shortName - + property real textWidth: text.contentWidth + 20 implicitWidth: text.contentWidth + 20 implicitHeight: Math.round(text.contentHeight * 1.6) - + contentItem: QQC2.Label { id: text font.pointSize: config.fontSize text: modelData.longName color: menuItem.highlighted ? PlasmaCore.ColorScope.highlightedTextColor : PlasmaCore.ColorScope.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter elide: Text.ElideRight } background: Rectangle { color: PlasmaCore.ColorScope.highlightColor opacity: menuItem.highlighted ? 1 : 0 MouseArea { anchors.fill: parent hoverEnabled: true onContainsMouseChanged: menuItem.highlighted = containsMouse onClicked: { keyboardMenu.dismiss() keyboard.currentLayout = model.index } } } } } enter: Transition { NumberAnimation { property: "opacity" from: 0 to: 1 duration: 150 } } exit: Transition { NumberAnimation { property: "opacity" from: 1 to: 0 duration: 150 } } } } diff --git a/sddm-theme/Main.qml b/sddm-theme/Main.qml index ebf030903..0ddc31081 100644 --- a/sddm-theme/Main.qml +++ b/sddm-theme/Main.qml @@ -1,522 +1,521 @@ /* * Copyright 2016 David Edmundson * * 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 02110-1301, USA. */ import QtQuick 2.8 import QtQuick.Layouts 1.1 -import QtQuick.Controls 2.0 +import QtQuick.Controls 2.0 as QQC2 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 "components" PlasmaCore.ColorScope { id: root // If we're using software rendering, draw outlines instead of shadows // See https://bugs.kde.org/show_bug.cgi?id=398317 readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software colorGroup: PlasmaCore.Theme.ComplementaryColorGroup readonly property bool lightBackground: Math.max(PlasmaCore.ColorScope.backgroundColor.r, PlasmaCore.ColorScope.backgroundColor.g, PlasmaCore.ColorScope.backgroundColor.b) > 0.5 width: 1600 height: 900 property string notificationMessage LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft LayoutMirroring.childrenInherit: true PlasmaCore.DataSource { id: keystateSource engine: "keystate" connectedSources: "Caps Lock" } Item { id: wallpaper anchors.fill: parent Repeater { model: screenModel Background { x: geometry.x; y: geometry.y; width: geometry.width; height: geometry.height sceneBackgroundType: config.type sceneBackgroundColor: config.color sceneBackgroundImage: config.background } } } MouseArea { id: loginScreenRoot anchors.fill: parent property bool uiVisible: true property bool blockUI: mainStack.depth > 1 || userListComponent.mainPasswordBox.text.length > 0 || inputPanel.keyboardActive || config.type !== "image" hoverEnabled: true drag.filterChildren: true onPressed: uiVisible = true; onPositionChanged: uiVisible = true; onUiVisibleChanged: { if (blockUI) { fadeoutTimer.running = false; } else if (uiVisible) { fadeoutTimer.restart(); } } onBlockUIChanged: { if (blockUI) { fadeoutTimer.running = false; uiVisible = true; } else { fadeoutTimer.restart(); } } Keys.onPressed: { uiVisible = true; event.accepted = false; } //takes one full minute for the ui to disappear Timer { id: fadeoutTimer running: true interval: 60000 onTriggered: { if (!loginScreenRoot.blockUI) { loginScreenRoot.uiVisible = false; } } } WallpaperFader { visible: config.type === "image" anchors.fill: parent state: loginScreenRoot.uiVisible ? "on" : "off" source: wallpaper mainStack: mainStack footer: footer clock: clock } DropShadow { id: clockShadow anchors.fill: clock source: clock visible: !softwareRendering horizontalOffset: 1 verticalOffset: 1 radius: 6 samples: 14 spread: 0.3 color: root.lightBackground ? PlasmaCore.ColorScope.backgroundColor : "black" // black matches Breeze window decoration and desktopcontainment Behavior on opacity { OpacityAnimator { duration: 1000 easing.type: Easing.InOutQuad } } } Clock { id: clock visible: y > 0 property Item shadow: clockShadow y: (userListComponent.userList.y + mainStack.y)/2 - height/2 anchors.horizontalCenter: parent.horizontalCenter } - StackView { id: mainStack anchors { left: parent.left right: parent.right } height: root.height + units.gridUnit * 3 focus: true //StackView is an implicit focus scope, so we need to give this focus so the item inside will have it Timer { //SDDM has a bug in 0.13 where even though we set the focus on the right item within the window, the window doesn't have focus //it is fixed in 6d5b36b28907b16280ff78995fef764bb0c573db which will be 0.14 //we need to call "window->activate()" *After* it's been shown. We can't control that in QML so we use a shoddy timer //it's been this way for all Plasma 5.x without a huge problem running: true repeat: false interval: 200 onTriggered: mainStack.forceActiveFocus() } initialItem: Login { id: userListComponent userListModel: userModel loginScreenUiVisible: loginScreenRoot.uiVisible userListCurrentIndex: userModel.lastIndex >= 0 ? userModel.lastIndex : 0 lastUserName: userModel.lastUser showUserList: { if ( !userListModel.hasOwnProperty("count") || !userListModel.hasOwnProperty("disableAvatarsThreshold")) return (userList.y + mainStack.y) > 0 if ( userListModel.count === 0 ) return false if ( userListModel.hasOwnProperty("containsAllUsers") && !userListModel.containsAllUsers ) return false return userListModel.count <= userListModel.disableAvatarsThreshold && (userList.y + mainStack.y) > 0 } notificationMessage: { var text = "" if (keystateSource.data["Caps Lock"]["Locked"]) { text += i18nd("plasma_lookandfeel_org.kde.lookandfeel","Caps Lock is on") if (root.notificationMessage) { text += " • " } } text += root.notificationMessage return text } actionItems: [ ActionButton { iconSource: "system-suspend" text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel","Suspend to RAM","Sleep") onClicked: sddm.suspend() enabled: sddm.canSuspend visible: !inputPanel.keyboardActive }, ActionButton { iconSource: "system-reboot" text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Restart") onClicked: sddm.reboot() enabled: sddm.canReboot visible: !inputPanel.keyboardActive }, ActionButton { iconSource: "system-shutdown" text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Shut Down") onClicked: sddm.powerOff() enabled: sddm.canPowerOff visible: !inputPanel.keyboardActive }, ActionButton { iconSource: "system-user-prompt" text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "For switching to a username and password prompt", "Other...") onClicked: mainStack.push(userPromptComponent) enabled: true visible: !userListComponent.showUsernamePrompt && !inputPanel.keyboardActive }] onLoginRequest: { root.notificationMessage = "" sddm.login(username, password, sessionButton.currentIndex) } } Behavior on opacity { OpacityAnimator { duration: units.longDuration } } } Loader { id: inputPanel state: "hidden" property bool keyboardActive: item ? item.active : false onKeyboardActiveChanged: { if (keyboardActive) { state = "visible" } else { state = "hidden"; } } source: "components/VirtualKeyboard.qml" anchors { left: parent.left right: parent.right } function showHide() { state = state == "hidden" ? "visible" : "hidden"; } states: [ State { name: "visible" PropertyChanges { target: mainStack y: Math.min(0, root.height - inputPanel.height - userListComponent.visibleBoundary) } PropertyChanges { target: inputPanel y: root.height - inputPanel.height opacity: 1 } }, State { name: "hidden" PropertyChanges { target: mainStack y: 0 } PropertyChanges { target: inputPanel y: root.height - root.height/4 opacity: 0 } } ] transitions: [ Transition { from: "hidden" to: "visible" SequentialAnimation { ScriptAction { script: { inputPanel.item.activated = true; Qt.inputMethod.show(); } } ParallelAnimation { NumberAnimation { target: mainStack property: "y" duration: units.longDuration easing.type: Easing.InOutQuad } NumberAnimation { target: inputPanel property: "y" duration: units.longDuration easing.type: Easing.OutQuad } OpacityAnimator { target: inputPanel duration: units.longDuration easing.type: Easing.OutQuad } } } }, Transition { from: "visible" to: "hidden" SequentialAnimation { ParallelAnimation { NumberAnimation { target: mainStack property: "y" duration: units.longDuration easing.type: Easing.InOutQuad } NumberAnimation { target: inputPanel property: "y" duration: units.longDuration easing.type: Easing.InQuad } OpacityAnimator { target: inputPanel duration: units.longDuration easing.type: Easing.InQuad } } ScriptAction { script: { Qt.inputMethod.hide(); } } } } ] } Component { id: userPromptComponent Login { showUsernamePrompt: true notificationMessage: root.notificationMessage loginScreenUiVisible: loginScreenRoot.uiVisible // using a model rather than a QObject list to avoid QTBUG-75900 userListModel: ListModel { ListElement { name: "" iconSource: "" } Component.onCompleted: { // as we can't bind inside ListElement setProperty(0, "name", i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Type in Username and Password")); } } onLoginRequest: { root.notificationMessage = "" sddm.login(username, password, sessionButton.currentIndex) } actionItems: [ ActionButton { iconSource: "system-suspend" text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel","Suspend to RAM","Sleep") onClicked: sddm.suspend() enabled: sddm.canSuspend visible: !inputPanel.keyboardActive }, ActionButton { iconSource: "system-reboot" text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Restart") onClicked: sddm.reboot() enabled: sddm.canReboot visible: !inputPanel.keyboardActive }, ActionButton { iconSource: "system-shutdown" text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Shut Down") onClicked: sddm.powerOff() enabled: sddm.canPowerOff visible: !inputPanel.keyboardActive }, ActionButton { iconSource: "system-user-list" text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","List Users") onClicked: mainStack.pop() visible: !inputPanel.keyboardActive } ] } } Image { id: logo visible: config.showlogo == "shown" source: config.logo anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: footer.top anchors.bottomMargin: units.largeSpacing asynchronous: true sourceSize.height: height opacity: loginScreenRoot.uiVisible ? 0 : 1 fillMode: Image.PreserveAspectFit height: Math.round(units.gridUnit * 3.5) Behavior on opacity { OpacityAnimator { duration: units.longDuration easing.type: Easing.InOutQuad } } } DropShadow { id: logoShadow anchors.fill: logo - source: logo + source: logo visible: !softwareRendering && config.showlogo == "shown" horizontalOffset: 1 verticalOffset: 1 radius: 6 samples: 14 spread: 0.3 color: "black" // matches Breeze window decoration and desktopcontainment opacity: loginScreenRoot.uiVisible ? 0 : 1 Behavior on opacity { OpacityAnimator { duration: units.longDuration easing.type: Easing.InOutQuad } } } //Footer RowLayout { id: footer anchors { bottom: parent.bottom left: parent.left right: parent.right margins: units.smallSpacing } Behavior on opacity { OpacityAnimator { duration: units.longDuration } } PlasmaComponents.ToolButton { text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Button to show/hide virtual keyboard", "Virtual Keyboard") font.pointSize: config.fontSize iconName: inputPanel.keyboardActive ? "input-keyboard-virtual-on" : "input-keyboard-virtual-off" onClicked: inputPanel.showHide() visible: inputPanel.status == Loader.Ready } KeyboardButton { } SessionButton { id: sessionButton } Item { Layout.fillWidth: true } Battery { } } } Connections { target: sddm onLoginFailed: { notificationMessage = i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Login Failed") footer.enabled = true mainStack.enabled = true userListComponent.userList.opacity = 1 } onLoginSucceeded: { //note SDDM will kill the greeter at some random point after this //there is no certainty any transition will finish, it depends on the time it //takes to complete the init mainStack.opacity = 0 footer.opacity = 0 } } onNotificationMessageChanged: { if (notificationMessage) { notificationResetTimer.start(); } } Timer { id: notificationResetTimer interval: 3000 onTriggered: notificationMessage = "" } } diff --git a/sddm-theme/SessionButton.qml b/sddm-theme/SessionButton.qml index 24d052f29..be84d3a5f 100644 --- a/sddm-theme/SessionButton.qml +++ b/sddm-theme/SessionButton.qml @@ -1,133 +1,133 @@ /* * Copyright 2016 David Edmundson * * 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 02110-1301, USA. */ import QtQuick 2.6 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 3.0 as PlasmaComponents import QtQuick.Controls 2.5 as QQC2 import QtGraphicalEffects 1.0 PlasmaComponents.ToolButton { id: sessionButton property int currentIndex: -1 visible: sessionMenu.count > 1 text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Desktop Session: %1", instantiator.objectAt(currentIndex).name || "Error") font.pointSize: config.fontSize Component.onCompleted: { currentIndex = sessionModel.lastIndex } onClicked: { sessionMenu.popup(x, y) } QQC2.Menu { id: sessionMenu - + property int largestWidth: 9999 Component.onCompleted: { var trueWidth = 0; for (var i = 0; i < sessionMenu.count; i++) { trueWidth = Math.max(trueWidth, sessionMenu.itemAt(i).textWidth) } sessionMenu.largestWidth = trueWidth } - + background: Rectangle { implicitHeight: 40 implicitWidth: sessionMenu.largestWidth > sessionButton.implicitWidth ? sessionMenu.largestWidth : sessionButton.implicitWidth color: PlasmaCore.ColorScope.backgroundColor property color borderColor: PlasmaCore.Colorscope.textColor border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) border.width: 1 layer.enabled: true layer.effect: DropShadow { transparentBorder: true radius: 8 samples: 8 horizontalOffset: 0 verticalOffset: 2 color: Qt.rgba(0, 0, 0, 0.3) } } Instantiator { id: instantiator model: sessionModel onObjectAdded: sessionMenu.addItem( object ) onObjectRemoved: sessionMenu.removeItem( object ) delegate: QQC2.MenuItem { id: menuItem property string name: model.name property real textWidth: text.contentWidth + 20 implicitWidth: text.contentWidth + 20 implicitHeight: Math.round(text.contentHeight * 1.6) contentItem: QQC2.Label { id: text font.pointSize: config.fontSize text: model.name color: menuItem.highlighted ? PlasmaCore.ColorScope.highlightedTextColor : PlasmaCore.ColorScope.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter elide: Text.ElideRight } background: Rectangle { color: PlasmaCore.ColorScope.highlightColor opacity: menuItem.highlighted ? 1 : 0 MouseArea { anchors.fill: parent hoverEnabled: true onContainsMouseChanged: menuItem.highlighted = containsMouse onClicked: { sessionMenu.dismiss() sessionButton.currentIndex = model.index } } } } } enter: Transition { NumberAnimation { property: "opacity" from: 0 to: 1 duration: 150 } } exit: Transition { NumberAnimation { property: "opacity" from: 1 to: 0 duration: 150 } } } } diff --git a/wallpapers/image/imagepackage/platformcontents/phone/ui/config.qml b/wallpapers/image/imagepackage/platformcontents/phone/ui/config.qml index 24e8112ab..9bcf33d95 100644 --- a/wallpapers/image/imagepackage/platformcontents/phone/ui/config.qml +++ b/wallpapers/image/imagepackage/platformcontents/phone/ui/config.qml @@ -1,88 +1,88 @@ /* * Copyright 2013 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 //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.kquickcontrolsaddons 2.0 -import QtQuick.Controls 1.0 as QtControls +import QtQuick.Controls 2.8 as QQC2 Item { id: root anchors { top: parent.top left: parent.left right: parent.right bottom: parent.bottom } property string cfg_Image Wallpaper.Image { id: imageWallpaper targetSize: Qt.size(plasmoid.width, plasmoid.height) } //Rectangle { color: "orange"; x: formAlignment; width: formAlignment; height: 20 } - QtControls.ScrollView { + QQC2.ScrollView { anchors.fill: parent frameVisible: true GridView { id: wallpapersGrid model: imageWallpaper.wallpaperModel currentIndex: -1 cellWidth: Math.floor(wallpapersGrid.width / Math.max(Math.floor(wallpapersGrid.width / (units.gridUnit*12)), 3)) cellHeight: cellWidth / (plasmoid.width / plasmoid.height) anchors.margins: 4 boundsBehavior: Flickable.DragAndOvershootBounds delegate: WallpaperDelegate {} onCountChanged: { wallpapersGrid.currentIndex = imageWallpaper.wallpaperModel.indexOf(cfg_Image); wallpapersGrid.positionViewAtIndex(wallpapersGrid.currentIndex, GridView.Visible) } Connections { target: imageWallpaper onCustomWallpaperPicked: wallpapersGrid.currentIndex = 0 } } } - QtControls.Button { + QQC2.Button { anchors { bottom: parent.bottom horizontalCenter: parent.horizontalCenter } iconName: "list-add" text: i18nd("plasma_wallpaper_org.kde.image","Add Custom Wallpaper") onClicked: customWallpaperLoader.source = Qt.resolvedUrl("customwallpaper.qml") } Loader { id: customWallpaperLoader anchors.fill: parent } } diff --git a/wallpapers/image/imagepackage/platformcontents/phone/ui/customwallpaper.qml b/wallpapers/image/imagepackage/platformcontents/phone/ui/customwallpaper.qml index 53e5ed284..8943d1d69 100644 --- a/wallpapers/image/imagepackage/platformcontents/phone/ui/customwallpaper.qml +++ b/wallpapers/image/imagepackage/platformcontents/phone/ui/customwallpaper.qml @@ -1,88 +1,88 @@ /* * Copyright 2015 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 Qt.labs.folderlistmodel 2.1 //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.kquickcontrolsaddons 2.0 -import QtQuick.Controls 1.0 as QtControls +import QtQuick.Controls 2.8 as QQC2 Rectangle { id: root color: syspal.window anchors.fill: parent SystemPalette {id: syspal} - QtControls.ScrollView { + QQC2.ScrollView { anchors.fill: parent frameVisible: true GridView { id: customGrid model: FolderListModel { folder: imageWallpaper.photosPath nameFilters: ["*.jpg", "*.png", "*.jpeg"] showDirs: false } currentIndex: -1 cellWidth: Math.floor(customGrid.width / Math.max(Math.floor(customGrid.width / (units.gridUnit*12)), 3)) cellHeight: cellWidth / (imageWallpaper.width / imageWallpaper.height) anchors.margins: 4 boundsBehavior: Flickable.DragAndOvershootBounds delegate: MouseArea { width: customGrid.cellWidth height: customGrid.cellHeight onClicked: { imageWallpaper.addUsersWallpaper(model.fileURL); customWallpaperLoader.source = ""; } Rectangle { color: "white" anchors { fill: parent margins: units.smallSpacing } Image { anchors { fill: parent margins: units.smallSpacing * 2 } source: model.fileURL } } } } } - QtControls.Button { + QQC2.Button { anchors { bottom: parent.bottom horizontalCenter: parent.horizontalCenter } width: height iconName: "go-previous" onClicked: customWallpaperLoader.source = "" } }