chore: initial commit

This commit is contained in:
Alexandre Cavalheiro S. Tiago Da Silva 2021-04-05 10:48:05 -03:00
commit 67c7ccd66b
No known key found for this signature in database
GPG key ID: 03C18A5682B3E189
11102 changed files with 455009 additions and 0 deletions

View file

@ -0,0 +1,83 @@
/********************************************************************
This file is part of the KDE project.
Copyright (C) 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
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 <http://www.gnu.org/licenses/>.
*********************************************************************/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import "../osd"
PlasmaCore.FrameSvgItem {
id: osd
// OSD Timeout in msecs - how long it will stay on the screen
property int timeout: 1800
// This is either a text or a number, if showingProgress is set to true,
// the number will be used as a value for the progress bar
property var osdValue
// Icon name to display
property string icon
// Set to true if the value is meant for progress bar,
// false for displaying the value as normal text
property bool showingProgress: false
objectName: "onScreenDisplay"
visible: false
width: osdItem.width + margins.left + margins.right
height: osdItem.height + margins.top + margins.bottom
imagePath: "widgets/background"
function show() {
osd.visible = true;
hideAnimation.restart();
}
// avoid leaking ColorScope of lock screen theme into the OSD "popup"
PlasmaCore.ColorScope {
width: osdItem.width
height: osdItem.height
anchors.centerIn: parent
colorGroup: PlasmaCore.Theme.NormalColorGroup
OsdItem {
id: osdItem
rootItem: osd
}
}
SequentialAnimation {
id: hideAnimation
// prevent press and hold from flickering
PauseAnimation { duration: 100 }
NumberAnimation {
target: osd
property: "opacity"
from: 1
to: 0
duration: osd.timeout
easing.type: Easing.InQuad
}
ScriptAction {
script: {
osd.visible = false;
osd.opacity = 1;
osd.icon = "";
osd.osdValue = 0;
}
}
}
}

View file

@ -0,0 +1,65 @@
/********************************************************************
This file is part of the KDE project.
Copyright (C) 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
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 <http://www.gnu.org/licenses/>.
*********************************************************************/
import QtQuick 2.5
import QtQuick.Controls 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.private.sessions 2.0
import "../components"
Item {
id: root
property bool viewVisible: false
property bool debug: false
property string notification
property int interfaceVersion: org_kde_plasma_screenlocker_greeter_interfaceVersion ? org_kde_plasma_screenlocker_greeter_interfaceVersion : 0
signal clearPassword()
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true
Loader {
id: mainLoader
anchors.fill: parent
opacity: 0
onItemChanged: opacity = 1
focus: true
Behavior on opacity {
OpacityAnimator {
duration: units.longDuration
easing.type: Easing.InCubic
}
}
}
Connections {
id:loaderConnection
target: org_kde_plasma_screenlocker_greeter_view
onFrameSwapped: {
mainLoader.source = "LockScreenUi.qml";
loaderConnection.target = null;
}
}
Component.onCompleted: {
if (root.interfaceVersion < 2) {
mainLoader.source = "LockScreenUi.qml";
}
}
}

View file

@ -0,0 +1,543 @@
/********************************************************************
This file is part of the KDE project.
Copyright (C) 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
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 <http://www.gnu.org/licenses/>.
*********************************************************************/
import QtQuick 2.8
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
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 org.kde.plasma.private.sessions 2.0
import "../components"
PlasmaCore.ColorScope {
id: lockScreenUi
// 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
readonly property bool lightBackground: Math.max(PlasmaCore.ColorScope.backgroundColor.r, PlasmaCore.ColorScope.backgroundColor.g, PlasmaCore.ColorScope.backgroundColor.b) > 0.5
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
Connections {
target: authenticator
onFailed: {
root.notification = i18nd("plasma_lookandfeel_org.kde.lookandfeel","Unlocking failed");
}
onGraceLockedChanged: {
if (!authenticator.graceLocked) {
root.notification = "";
root.clearPassword();
}
}
onMessage: {
root.notification = msg;
}
onError: {
root.notification = err;
}
}
SessionManagement {
id: sessionManagement
}
Connections {
target: sessionManagement
onAboutToSuspend: {
mainBlock.mainPasswordBox.text = "";
}
}
SessionsModel {
id: sessionsModel
showNewSessionEntry: false
}
PlasmaCore.DataSource {
id: keystateSource
engine: "keystate"
connectedSources: "Caps Lock"
}
Loader {
id: changeSessionComponent
active: false
source: "ChangeSession.qml"
visible: false
}
MouseArea {
id: lockScreenRoot
property bool uiVisible: false
property bool blockUI: mainStack.depth > 1 || mainBlock.mainPasswordBox.text.length > 0 || inputPanel.keyboardActive
x: parent.x
y: parent.y
width: parent.width
height: parent.height
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.onEscapePressed: {
uiVisible = !uiVisible;
if (inputPanel.keyboardActive) {
inputPanel.showHide();
}
if (!uiVisible) {
mainBlock.mainPasswordBox.text = "";
}
}
Keys.onPressed: {
uiVisible = true;
event.accepted = false;
}
Timer {
id: fadeoutTimer
interval: 10000
onTriggered: {
if (!lockScreenRoot.blockUI) {
lockScreenRoot.uiVisible = false;
}
}
}
Component.onCompleted: PropertyAnimation { id: launchAnimation; target: lockScreenRoot; property: "opacity"; from: 0; to: 1; duration: 1000 }
states: [
State {
name: "onOtherSession"
// for slide out animation
PropertyChanges { target: lockScreenRoot; y: lockScreenRoot.height }
// we also change the opacity just to be sure it's not visible even on unexpected screen dimension changes with possible race conditions
PropertyChanges { target: lockScreenRoot; opacity: 0 }
}
]
transitions:
Transition {
// we only animate switchting to another session, because kscreenlocker doesn't get notified when
// coming from another session back and so we wouldn't know when to trigger the animation exactly
from: ""
to: "onOtherSession"
PropertyAnimation { id: stateChangeAnimation; properties: "y"; duration: 300; easing.type: Easing.InQuad}
PropertyAnimation { properties: "opacity"; duration: 300}
onRunningChanged: {
// after the animation has finished switch session: since we only animate the transition TO state "onOtherSession"
// and not the other way around, we don't have to check the state we transitioned into
if (/* lockScreenRoot.state == "onOtherSession" && */ !running) {
mainStack.currentItem.switchSession()
}
}
}
WallpaperFader {
anchors.fill: parent
state: lockScreenRoot.uiVisible ? "on" : "off"
source: wallpaper
mainStack: mainStack
footer: footer
clock: clock
z: -3
}
DropShadow {
id: clockShadow
anchors.fill: clock
source: clock
visible: !softwareRendering
horizontalOffset: 1
verticalOffset: 1
radius: 6
samples: 14
spread: 0.3
color: lockScreenUi.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
property Item shadow: clockShadow
anchors.horizontalCenter: parent.horizontalCenter
y: (mainBlock.userList.y + mainStack.y)/2 - height/2
visible: y > 0
Layout.alignment: Qt.AlignBaseline
}
ListModel {
id: users
Component.onCompleted: {
users.append({name: kscreenlocker_userName,
realName: kscreenlocker_userName,
icon: kscreenlocker_userImage,
})
}
}
StackView {
id: mainStack
anchors.centerIn: parent
height: lockScreenRoot.height + units.gridUnit * 3
width: parent.width / 3
focus: true //StackView is an implicit focus scope, so we need to give this focus so the item inside will have it
initialItem: MainBlock {
id: mainBlock
lockScreenUiVisible: lockScreenRoot.uiVisible
showUserList: userList.y + mainStack.y > 0
Stack.onStatusChanged: {
// prepare for presenting again to the user
if (Stack.status == Stack.Activating) {
mainPasswordBox.remove(0, mainPasswordBox.length)
mainPasswordBox.focus = true
}
}
userListModel: users
notificationMessage: {
var text = ""
if (keystateSource.data["Caps Lock"]["Locked"]) {
text += i18nd("plasma_lookandfeel_org.kde.lookandfeel","Caps Lock is on")
if (root.notification) {
text += " • "
}
}
text += root.notification
return text
}
onLoginRequest: {
root.notification = ""
authenticator.tryUnlock(password)
}
actionItems: [
ActionButton {
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Switch User")
iconSource: "system-switch-user"
onClicked: {
// If there are no existing sessions to switch to, create a new one instead
if (((sessionsModel.showNewSessionEntry && sessionsModel.count === 1) ||
(!sessionsModel.showNewSessionEntry && sessionsModel.count === 0)) &&
sessionsModel.canSwitchUser) {
mainStack.pop({immediate:true})
sessionsModel.startNewSession(true /* lock the screen too */)
lockScreenRoot.state = ''
} else {
mainStack.push(switchSessionPage)
}
}
visible: sessionsModel.canStartNewSession && sessionsModel.canSwitchUser
//Button gets cut off on smaller displays without this.
anchors{
verticalCenter: parent.top
}
}
]
Loader {
Layout.fillWidth: true
Layout.preferredHeight: item ? item.implicitHeight : 0
active: config.showMediaControls
source: "MediaControls.qml"
}
}
Component.onCompleted: {
if (defaultToSwitchUser) { //context property
// If we are in the only session, then going to the session switcher is
// a pointless extra step; instead create a new session immediately
if (((sessionsModel.showNewSessionEntry && sessionsModel.count === 1) ||
(!sessionsModel.showNewSessionEntry && sessionsModel.count === 0)) &&
sessionsModel.canStartNewSession) {
sessionsModel.startNewSession(true /* lock the screen too */)
} else {
mainStack.push({
item: switchSessionPage,
immediate: true});
}
}
}
}
Loader {
id: inputPanel
state: "hidden"
readonly property bool keyboardActive: item ? item.active : false
anchors {
left: parent.left
right: parent.right
}
function showHide() {
state = state == "hidden" ? "visible" : "hidden";
}
Component.onCompleted: inputPanel.source = "../components/VirtualKeyboard.qml"
onKeyboardActiveChanged: {
if (keyboardActive) {
state = "visible";
} else {
state = "hidden";
}
}
states: [
State {
name: "visible"
PropertyChanges {
target: mainStack
y: Math.min(0, lockScreenRoot.height - inputPanel.height - mainBlock.visibleBoundary)
}
PropertyChanges {
target: inputPanel
y: lockScreenRoot.height - inputPanel.height
opacity: 1
}
},
State {
name: "hidden"
PropertyChanges {
target: mainStack
y: 0
}
PropertyChanges {
target: inputPanel
y: lockScreenRoot.height - lockScreenRoot.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: switchSessionPage
SessionManagementScreen {
property var switchSession: finalSwitchSession
Stack.onStatusChanged: {
if (Stack.status == Stack.Activating) {
focus = true
}
}
userListModel: sessionsModel
// initiating animation of lockscreen for session switch
function initSwitchSession() {
lockScreenRoot.state = 'onOtherSession'
}
// initiating session switch and preparing lockscreen for possible return of user
function finalSwitchSession() {
mainStack.pop({immediate:true})
sessionsModel.switchUser(userListCurrentModelData.vtNumber)
lockScreenRoot.state = ''
}
Keys.onLeftPressed: userList.decrementCurrentIndex()
Keys.onRightPressed: userList.incrementCurrentIndex()
Keys.onEnterPressed: initSwitchSession()
Keys.onReturnPressed: initSwitchSession()
Keys.onEscapePressed: mainStack.pop()
ColumnLayout {
Layout.fillWidth: true
spacing: units.largeSpacing
PlasmaComponents.Button {
Layout.fillWidth: true
font.pointSize: theme.defaultFont.pointSize + 1
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Switch to This Session")
onClicked: initSwitchSession()
visible: sessionsModel.count > 0
}
PlasmaComponents.Button {
Layout.fillWidth: true
font.pointSize: theme.defaultFont.pointSize + 1
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Start New Session")
onClicked: {
mainStack.pop({immediate:true})
sessionsModel.startNewSession(true /* lock the screen too */)
lockScreenRoot.state = ''
}
}
}
actionItems: [
ActionButton {
iconSource: "go-previous"
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Back")
onClicked: mainStack.pop()
//Button gets cut off on smaller displays without this.
anchors{
verticalCenter: parent.top
}
}
]
}
}
Loader {
active: root.viewVisible
source: "LockOsd.qml"
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
bottomMargin: units.largeSpacing
}
}
RowLayout {
id: footer
z: -2
anchors {
bottom: parent.bottom
left: parent.left
right: parent.right
margins: units.smallSpacing
}
PlasmaComponents.ToolButton {
text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Button to show/hide virtual keyboard", "Virtual Keyboard")
iconName: inputPanel.keyboardActive ? "input-keyboard-virtual-on" : "input-keyboard-virtual-off"
onClicked: inputPanel.showHide()
visible: inputPanel.status == Loader.Ready
}
KeyboardLayoutButton {
}
Item {
Layout.fillWidth: true
}
Battery {}
}
}
Component.onCompleted: {
// version support checks
if (root.interfaceVersion < 1) {
// ksmserver of 5.4, with greeter of 5.5
root.viewVisible = true;
}
}
}

View file

@ -0,0 +1,139 @@
/*
* Copyright 2016 David Edmundson <davidedmundson@kde.org>
*
* 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.2
import QtQuick.Controls 2.4
import QtQuick.Controls.Styles 1.4
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import "../components"
SessionManagementScreen {
property Item mainPasswordBox: passwordBox
property bool lockScreenUiVisible: false
//the y position that should be ensured visible when the on screen keyboard is visible
property int visibleBoundary: mapFromItem(loginButton, 0, 0).y
onHeightChanged: visibleBoundary = mapFromItem(loginButton, 0, 0).y + loginButton.height + units.smallSpacing
/*
* Login has been requested with the following username and password
* If username field is visible, it will be taken from that, otherwise from the "name" property of the currentIndex
*/
signal loginRequest(string password)
function startLogin() {
var password = passwordBox.text
//this is partly because it looks nicer
//but more importantly it works round a Qt bug that can trigger if the app is closed with a TextField focused
//See https://bugreports.qt.io/browse/QTBUG-55460
loginButton.forceActiveFocus();
loginRequest(password);
}
RowLayout {
Layout.fillWidth: true
TextField {
id: passwordBox
font.pointSize: theme.defaultFont.pointSize + 1
Layout.fillWidth: true
placeholderText: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Password")
focus: true
echoMode: TextInput.Password
inputMethodHints: Qt.ImhHiddenText | Qt.ImhSensitiveData | Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText
enabled: !authenticator.graceLocked
placeholderTextColor: "#C3C7D1"
palette.text: "#C3C7D1"
background: Rectangle {
color: "#272834"
opacity: 0.9
radius: parent.width / 2
height: 30
anchors.fill: parent
anchors.centerIn: parent
}
onAccepted: {
if (lockScreenUiVisible) {
startLogin();
}
}
//if empty and left or right is pressed change selection in user switch
//this cannot be in keys.onLeftPressed as then it doesn't reach the password box
Keys.onPressed: {
if (event.key == Qt.Key_Left && !text) {
userList.decrementCurrentIndex();
event.accepted = true
}
if (event.key == Qt.Key_Right && !text) {
userList.incrementCurrentIndex();
event.accepted = true
}
}
Connections {
target: root
onClearPassword: {
passwordBox.forceActiveFocus()
passwordBox.selectAll()
}
}
}
Button {
id: loginButton
Accessible.name: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Unlock")
implicitHeight: passwordBox.height - units.smallSpacing * 0.5 // otherwise it comes out taller than the password field
text: ">"
Layout.leftMargin: 30
contentItem: Text {
text: loginButton.text
font: loginButton.font
opacity: enabled ? 1.0 : 0.3
color: "#ffffff"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
background: Rectangle {
id: buttonBackground
width: 30
height: 40
radius: width / 2
rotation: -90
anchors.centerIn: parent
color: "#9B79CC"
}
onClicked: startLogin()
}
}
}

View file

@ -0,0 +1,162 @@
/********************************************************************
This file is part of the KDE project.
Copyright (C) 2016 Kai Uwe Broulik <kde@privat.broulik.de>
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 <http://www.gnu.org/licenses/>.
*********************************************************************/
import QtQuick 2.5
import QtQuick.Layouts 1.1
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
Item {
visible: mpris2Source.hasPlayer
implicitHeight: controlsRow.height + controlsRow.y
RowLayout {
id: controlsRow
anchors.bottom: parent.bottom
y: units.smallSpacing // some distance to the password field
width: parent.width
height: units.gridUnit * 3
spacing: 0
enabled: mpris2Source.canControl
PlasmaCore.DataSource {
id: mpris2Source
readonly property string source: "@multiplex"
readonly property var playerData: data[source]
readonly property bool hasPlayer: sources.length > 1 && !!playerData
readonly property string identity: hasPlayer ? playerData.Identity : ""
readonly property bool playing: hasPlayer && playerData.PlaybackStatus === "Playing"
readonly property bool canControl: hasPlayer && playerData.CanControl
readonly property bool canGoBack: hasPlayer && playerData.CanGoPrevious
readonly property bool canGoNext: hasPlayer && playerData.CanGoNext
readonly property var currentMetadata: hasPlayer ? playerData.Metadata : ({})
readonly property string track: {
var xesamTitle = currentMetadata["xesam:title"]
if (xesamTitle) {
return xesamTitle
}
// if no track title is given, print out the file name
var xesamUrl = currentMetadata["xesam:url"] ? currentMetadata["xesam:url"].toString() : ""
if (!xesamUrl) {
return ""
}
var lastSlashPos = xesamUrl.lastIndexOf('/')
if (lastSlashPos < 0) {
return ""
}
var lastUrlPart = xesamUrl.substring(lastSlashPos + 1)
return decodeURIComponent(lastUrlPart)
}
readonly property string artist: currentMetadata["xesam:artist"] || ""
readonly property string albumArt: currentMetadata["mpris:artUrl"] || ""
engine: "mpris2"
connectedSources: [source]
function startOperation(op) {
var service = serviceForSource(source)
var operation = service.operationDescription(op)
return service.startOperationCall(operation)
}
function goPrevious() {
startOperation("Previous");
}
function goNext() {
startOperation("Next");
}
function playPause(source) {
startOperation("PlayPause");
}
}
Image {
id: albumArt
Layout.preferredWidth: height
Layout.fillHeight: true
asynchronous: true
fillMode: Image.PreserveAspectFit
source: mpris2Source.albumArt
sourceSize.height: height
visible: status === Image.Loading || status === Image.Ready
}
Item { // spacer
width: units.smallSpacing
height: 1
}
ColumnLayout {
Layout.fillWidth: true
spacing: 0
PlasmaComponents.Label {
Layout.fillWidth: true
wrapMode: Text.NoWrap
elide: Text.ElideRight
text: mpris2Source.track || i18nd("plasma_lookandfeel_org.kde.lookandfeel", "No media playing")
textFormat: Text.PlainText
font.pointSize: theme.defaultFont.pointSize + 1
maximumLineCount: 1
}
PlasmaExtras.DescriptiveLabel {
Layout.fillWidth: true
wrapMode: Text.NoWrap
elide: Text.ElideRight
// if no artist is given, show player name instead
text: mpris2Source.artist || mpris2Source.identity || ""
textFormat: Text.PlainText
font.pointSize: theme.smallestFont.pointSize + 1
maximumLineCount: 1
}
}
PlasmaComponents.ToolButton {
enabled: mpris2Source.canGoBack
iconName: LayoutMirroring.enabled ? "media-skip-forward" : "media-skip-backward"
onClicked: mpris2Source.goPrevious()
visible: mpris2Source.canGoBack || mpris2Source.canGoNext
Accessible.name: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Previous track")
}
PlasmaComponents.ToolButton {
Layout.fillHeight: true
Layout.preferredWidth: height // make this button bigger
iconName: mpris2Source.playing ? "media-playback-pause" : "media-playback-start"
onClicked: mpris2Source.playPause()
Accessible.name: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Play or Pause media")
}
PlasmaComponents.ToolButton {
enabled: mpris2Source.canGoNext
iconName: LayoutMirroring.enabled ? "media-skip-backward" : "media-skip-forward"
onClicked: mpris2Source.goNext()
visible: mpris2Source.canGoBack || mpris2Source.canGoNext
Accessible.name: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Next track")
}
}
}

View file

@ -0,0 +1,44 @@
import QtQuick 2.5
import QtQuick.Controls 2.5 as QQC2
import QtQuick.Layouts 1.1
ColumnLayout {
property alias cfg_alwaysShowClock: alwaysClock.checked
property alias cfg_showMediaControls: showMediaControls.checked
spacing: 0
RowLayout {
spacing: units.largeSpacing / 2
QQC2.Label {
Layout.minimumWidth: formAlignment - units.largeSpacing //to match wallpaper config...
horizontalAlignment: Text.AlignRight
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Clock:")
}
QQC2.CheckBox {
id: alwaysClock
text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "verb, to show something", "Always show")
}
Item {
Layout.fillWidth: true
}
}
RowLayout {
spacing: units.largeSpacing / 2
QQC2.Label {
Layout.minimumWidth: formAlignment - units.largeSpacing //to match wallpaper config...
horizontalAlignment: Text.AlignRight
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Media controls:")
}
QQC2.CheckBox {
id: showMediaControls
text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "verb, to show something", "Show")
}
Item {
Layout.fillWidth: true
}
}
}

View file

@ -0,0 +1,19 @@
<?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="alwaysShowClock" type="Bool">
<label>If true, the clock is shown even when the computer is idle and the password prompt is hidden.</label>
<default>true</default>
</entry>
<entry name="showMediaControls" type="Bool">
<label>If true, shows any currently playing media along with controls to pause it.</label>
<default>true</default>
</entry>
</group>
</kcfg>