Commit 5bf0e705 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Nate Graham
Browse files

Port SDDM theme to PlasmaComponents 3.0

parent 35f75865
Pipeline #146422 passed with stage
in 11 minutes and 30 seconds
import QtQuick 2.15
// Don't bump them any further, these are the latest.
import QtQuick.Controls 1.6 as QQC
import QtQuick.Controls.Styles 1.4 as QQCS
import org.kde.plasma.core 2.0 as PlasmaCore
QQCS.MenuStyle {
frame: Rectangle {
color: PlasmaCore.ColorScope.backgroundColor
border.color: Qt.tint(PlasmaCore.ColorScope.textColor, Qt.rgba(color.r, color.g, color.b, 0.7))
border.width: 1
}
itemDelegate.label: QQC.Label {
height: contentHeight * 1.2
verticalAlignment: Text.AlignVCenter
color: styleData.selected ? PlasmaCore.ColorScope.highlightedTextColor : PlasmaCore.ColorScope.textColor
font.pointSize: config.fontSize
text: styleData.text
}
itemDelegate.background: Rectangle {
visible: styleData.selected
color: PlasmaCore.ColorScope.highlightColor
}
}
/*
SPDX-FileCopyrightText: 2016 David Edmundson <davidedmundson@kde.org>
SPDX-FileCopyrightText: 2022 Aleix Pol Gonzalez <aleixpol@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.15
import QtQuick.Controls 1.6 as QQC // Don't bump it any further, this is the latest.
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents // Because PC3 ToolButton can't take a menu
import org.kde.plasma.components 3.0 as PlasmaComponents
PlasmaComponents.ToolButton {
id: keyboardButton
id: root
property int currentIndex: -1
property int currentIndex: keyboard.currentLayout
onCurrentIndexChanged: keyboard.currentLayout = currentIndex
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Keyboard Layout: %1", instantiator.objectAt(currentIndex).shortName)
implicitWidth: minimumWidth
visible: menu.items.length > 1
visible: menu.count > 1
Component.onCompleted: {
currentIndex = Qt.binding(() => keyboard.currentLayout);
}
checkable: true
checked: menu.opened
onToggled: {
if (checked) {
menu.popup(root, 0, 0)
} else {
menu.dismiss()
}
}
PlasmaComponents.Menu {
id: menu
PlasmaCore.ColorScope.colorGroup: PlasmaCore.Theme.NormalColorGroup
PlasmaCore.ColorScope.inherit: false
menu: QQC.Menu {
id: keyboardMenu
style: BreezeMenuStyle {}
Instantiator {
id: instantiator
model: keyboard.layouts
onObjectAdded: keyboardMenu.insertItem(index, object)
onObjectRemoved: keyboardMenu.removeItem(object)
delegate: QQC.MenuItem {
onObjectAdded: menu.insertItem(index, object)
onObjectRemoved: menu.removeItem(object)
delegate: PlasmaComponents.MenuItem {
text: modelData.longName
property string shortName: modelData.shortName
onTriggered: {
......
......@@ -6,7 +6,6 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 1.6 // Don't bump it any further, this is the latest.
import QtQuick.Controls 2.15 as QQC2
import QtGraphicalEffects 1.15
......
/*
SPDX-FileCopyrightText: 2016 David Edmundson <davidedmundson@kde.org>
SPDX-FileCopyrightText: 2022 Aleix Pol Gonzalez <aleixpol@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.15
import QtQuick.Controls 1.6 as QQC // Don't bump it any further, this is the latest.
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents // Because PC3 ToolButton can't take a menu
import org.kde.plasma.components 3.0 as PlasmaComponents
PlasmaComponents.ToolButton {
id: root
property int currentIndex: -1
implicitWidth: minimumWidth
visible: menu.items.length > 1
visible: menu.count > 1
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Desktop Session: %1", instantiator.objectAt(currentIndex).text || "")
Component.onCompleted: {
currentIndex = sessionModel.lastIndex
}
checkable: true
checked: menu.opened
onToggled: {
if (checked) {
menu.popup(root, 0, 0)
} else {
menu.dismiss()
}
}
PlasmaComponents.Menu {
PlasmaCore.ColorScope.colorGroup: PlasmaCore.Theme.NormalColorGroup
PlasmaCore.ColorScope.inherit: false
menu: QQC.Menu {
id: menu
style: BreezeMenuStyle {}
Instantiator {
id: instantiator
model: sessionModel
onObjectAdded: menu.insertItem(index, object)
onObjectRemoved: menu.removeItem( object )
delegate: QQC.MenuItem {
delegate: PlasmaComponents.MenuItem {
text: model.name
onTriggered: {
root.currentIndex = model.index
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment