mirror of
https://gitgud.io/wackyideas/aerothemeplasma.git
synced 2024-08-15 00:43:43 +00:00
Very early KDE 6 release.
This commit is contained in:
parent
7cc4ccabbc
commit
686046d4f7
6272 changed files with 140920 additions and 529657 deletions
|
@ -0,0 +1,10 @@
|
|||
import QtQuick 2.12
|
||||
import org.kde.plasma.configuration 2.0
|
||||
|
||||
ConfigModel {
|
||||
ConfigCategory {
|
||||
name: i18n("General")
|
||||
icon: "configure"
|
||||
source: "configGeneral.qml"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
|
||||
<kcfgfile name=""/>
|
||||
|
||||
<group name="General">
|
||||
<entry name="displayStyle" type="Enum">
|
||||
<label>Whether to show text, a flag, or both on the compact representation.</label>
|
||||
<choices>
|
||||
<choice name="Label"/>
|
||||
<choice name="Flag"/>
|
||||
<choice name="LabelOverFlag"/>
|
||||
</choices>
|
||||
<default>0</default>
|
||||
</entry>
|
||||
</group>
|
||||
|
||||
</kcfg>
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2021 Andrey Butirsky <butirsky@gmail.com>
|
||||
SPDX-FileCopyrightText: 2022 Nate Graham <nate@kde.org>
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Controls 2.15
|
||||
|
||||
import org.kde.kirigami 2.20 as Kirigami
|
||||
import org.kde.plasma.workspace.keyboardlayout 1.0
|
||||
import org.kde.plasma.workspace.components 2.0 as WorkspaceComponents
|
||||
import org.kde.plasma.private.kcm_keyboard as KCMKeyboard
|
||||
import org.kde.kcmutils
|
||||
|
||||
SimpleKCM {
|
||||
id: root
|
||||
|
||||
property int cfg_displayStyle
|
||||
|
||||
readonly property string layoutShortName: keyboardLayout.layoutsList.length ? keyboardLayout.layoutsList[keyboardLayout.layout].shortName
|
||||
: ""
|
||||
readonly property string displayName: keyboardLayout.layoutsList.length ? keyboardLayout.layoutsList[keyboardLayout.layout].displayName
|
||||
: ""
|
||||
KeyboardLayout { id: keyboardLayout }
|
||||
|
||||
Kirigami.FormLayout {
|
||||
RadioButton {
|
||||
id: showLabel
|
||||
Kirigami.FormData.label: i18n("Display style:")
|
||||
text: root.displayName.length > 0 ? root.displayName: root.layoutShortName
|
||||
checked: cfg_displayStyle === 0
|
||||
onToggled: cfg_displayStyle = 0;
|
||||
}
|
||||
|
||||
RadioButton {
|
||||
id: showFlag
|
||||
checked: cfg_displayStyle === 1
|
||||
onToggled: cfg_displayStyle = 1;
|
||||
contentItem: Item {
|
||||
implicitWidth: childrenRect.width + showFlag.indicator.width
|
||||
implicitHeight: childrenRect.height
|
||||
|
||||
// Deliberately using this instead of Image to preserve visual fidelity
|
||||
// with what the widget will show
|
||||
Kirigami.Icon {
|
||||
id: flagImage
|
||||
width: Kirigami.Units.iconSizes.medium
|
||||
height: Kirigami.Units.iconSizes.medium
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
source: KCMKeyboard.Flags.getIcon(root.layoutShortName)
|
||||
visible: valid
|
||||
}
|
||||
RowLayout {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Kirigami.Units.smallSpacing
|
||||
width: visible ? implicitWidth : 0
|
||||
height: visible ? implicitHeight : 0
|
||||
visible: !flagImage.visible
|
||||
|
||||
Kirigami.Icon {
|
||||
implicitWidth: Kirigami.Units.iconSizes.smallMedium
|
||||
implicitHeight: Kirigami.Units.iconSizes.smallMedium
|
||||
source: "emblem-warning"
|
||||
}
|
||||
Label {
|
||||
text: i18nc("@info:placeholder Make this translation as short as possible", "No flag available")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RadioButton {
|
||||
id: showLabelOverFlag
|
||||
checked: cfg_displayStyle === 2
|
||||
onToggled: cfg_displayStyle = 2;
|
||||
contentItem: Item {
|
||||
implicitWidth: childrenRect.width + showLabelOverFlag.indicator.width
|
||||
implicitHeight: childrenRect.height
|
||||
|
||||
// Deliberately using this instead of Image to preserve visual fidelity
|
||||
// with what the widget will show
|
||||
Kirigami.Icon {
|
||||
width: Kirigami.Units.iconSizes.medium
|
||||
height: Kirigami.Units.iconSizes.medium
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
source: KCMKeyboard.Flags.getIcon(root.layoutShortName)
|
||||
visible: valid
|
||||
|
||||
WorkspaceComponents.BadgeOverlay {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
|
||||
text: showLabel.text
|
||||
icon: parent
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.Separator {
|
||||
Kirigami.FormData.isSection: true
|
||||
}
|
||||
|
||||
Button {
|
||||
Kirigami.FormData.label: i18n("Layouts:")
|
||||
text: i18n("Configure…")
|
||||
icon.name: "configure"
|
||||
onClicked: KCMLauncher.openSystemSettings("kcm_keyboard", "--tab=layouts")
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
// hide Keyboard Shortcuts tab
|
||||
var appletConfiguration = app
|
||||
while (appletConfiguration.parent) {
|
||||
appletConfiguration = appletConfiguration.parent
|
||||
}
|
||||
if (appletConfiguration && typeof appletConfiguration.globalConfigModel !== "undefined") {
|
||||
appletConfiguration.globalConfigModel.removeCategoryAt(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2020 Andrey Butirsky <butirsky@gmail.com>
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import QtQuick 2.15
|
||||
import Qt.labs.platform 1.1
|
||||
|
||||
import org.kde.plasma.plasmoid 2.0
|
||||
import org.kde.plasma.core as PlasmaCore
|
||||
import org.kde.plasma.components 3.0 as PlasmaComponents3
|
||||
import org.kde.plasma.workspace.components 2.0
|
||||
import org.kde.plasma.private.kcm_keyboard as KCMKeyboard
|
||||
import org.kde.kirigami 2.20 as Kirigami
|
||||
import org.kde.ksvg as KSvg
|
||||
import QtQuick.Layouts
|
||||
|
||||
PlasmoidItem {
|
||||
id: root
|
||||
|
||||
signal layoutSelected(int layoutIndex)
|
||||
|
||||
preferredRepresentation: fullRepresentation
|
||||
toolTipMainText: Plasmoid.title
|
||||
toolTipSubText: fullRepresentationItem ? fullRepresentationItem.layoutNames.longName : ""
|
||||
|
||||
fullRepresentation: KeyboardLayoutSwitcher {
|
||||
id: switcher
|
||||
|
||||
hoverEnabled: true
|
||||
Plasmoid.status: hasMultipleKeyboardLayouts ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.HiddenStatus
|
||||
|
||||
property int widgetWidth: 24
|
||||
Layout.minimumWidth: widgetWidth
|
||||
Layout.maximumWidth: widgetWidth
|
||||
Layout.preferredWidth: widgetWidth
|
||||
|
||||
PlasmaCore.ToolTipArea {
|
||||
anchors.fill: parent
|
||||
mainText: root.toolTipMainText
|
||||
subText: root.toolTipSubText
|
||||
}
|
||||
|
||||
Instantiator {
|
||||
id: actionsInstantiator
|
||||
model: switcher.keyboardLayout.layoutsList
|
||||
delegate: PlasmaCore.Action {
|
||||
text: modelData.longName
|
||||
icon.icon: KCMKeyboard.Flags.getIcon(modelData.shortName)
|
||||
onTriggered: {
|
||||
layoutSelected(index);
|
||||
}
|
||||
}
|
||||
onObjectAdded: (index, object) => {
|
||||
Plasmoid.contextualActions.push(object)
|
||||
}
|
||||
onObjectRemoved: (index, object) => {
|
||||
Plasmoid.contextualActions.splice(Plasmoid.contextualActions.indexOf(object), 1)
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: switcher.keyboardLayout
|
||||
|
||||
function onLayoutChanged() {
|
||||
root.Plasmoid.activated();
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: root
|
||||
|
||||
function onLayoutSelected(layoutIndex) {
|
||||
switcher.keyboardLayout.layout = layoutIndex;
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.Icon {
|
||||
id: flag
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
visible: valid && (Plasmoid.configuration.displayStyle === 1 || Plasmoid.configuration.displayStyle === 2)
|
||||
|
||||
active: containsMouse
|
||||
source: KCMKeyboard.Flags.getIcon(layoutNames.shortName)
|
||||
|
||||
BadgeOverlay {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
|
||||
visible: !countryCode.visible && Plasmoid.configuration.displayStyle === 2
|
||||
|
||||
text: countryCode.text
|
||||
icon: flag
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents3.Label {
|
||||
id: countryCode
|
||||
anchors.fill: parent
|
||||
visible: Plasmoid.configuration.displayStyle === 0 || !flag.valid
|
||||
|
||||
|
||||
anchors.bottomMargin: Kirigami.Units.smallSpacing*2
|
||||
anchors.topMargin: Kirigami.Units.smallSpacing*2 - Kirigami.Units.smallSpacing/2
|
||||
|
||||
minimumPointSize: 8
|
||||
font.pointSize: countryCode.height * 0.75
|
||||
font.capitalization: Font.AllUppercase
|
||||
fontSizeMode: Text.Fit
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: layoutNames.displayName || layoutNames.shortName
|
||||
|
||||
rightPadding: Kirigami.Units.smallSpacing
|
||||
leftPadding: Kirigami.Units.smallSpacing
|
||||
}
|
||||
MouseArea {
|
||||
id: ma
|
||||
property int margin: Kirigami.Units.smallSpacing/2+((0.4*switcher.height) - 9)
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: margin
|
||||
anchors.bottomMargin: margin
|
||||
hoverEnabled: true
|
||||
propagateComposedEvents: true
|
||||
onClicked: (mouse) => {
|
||||
mouse.accepted = false;
|
||||
}
|
||||
}
|
||||
KSvg.FrameSvgItem {
|
||||
id: decorationButton
|
||||
z: -1
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: ma.margin
|
||||
anchors.bottomMargin: ma.margin
|
||||
imagePath: Qt.resolvedUrl("svgs/button.svg")
|
||||
visible: ma.containsMouse
|
||||
prefix: {
|
||||
var x = "keyboard-";
|
||||
if(ma.containsMouse && !ma.containsPress) return x+"hover";
|
||||
else if(ma.containsMouse && ma.containsPress) return x+"pressed";
|
||||
else return "keyboard-hover";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function actionTriggered(actionName) {
|
||||
const layoutIndex = parseInt(actionName);
|
||||
if (!isNaN(layoutIndex)) {
|
||||
layoutSelected(layoutIndex);
|
||||
}
|
||||
}
|
||||
}
|
5410
plasma/plasmoids/org.kde.plasma.keyboardlayout/contents/ui/svgs/button.svg
Executable file
5410
plasma/plasmoids/org.kde.plasma.keyboardlayout/contents/ui/svgs/button.svg
Executable file
File diff suppressed because it is too large
Load diff
After Width: | Height: | Size: 203 KiB |
Loading…
Add table
Add a link
Reference in a new issue