mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
merge quicksettings and the panel
use plasmoids
This commit is contained in:
parent
834812e5d9
commit
da77551aff
13 changed files with 458 additions and 28 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
|
|
||||||
plasma_install_package(panel org.kde.phone.panel)
|
add_subdirectory(panel)
|
||||||
|
|
||||||
add_subdirectory(homescreen)
|
add_subdirectory(homescreen)
|
||||||
add_subdirectory(taskpanel)
|
add_subdirectory(taskpanel)
|
||||||
|
|
|
||||||
19
containments/panel/CMakeLists.txt
Normal file
19
containments/panel/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
set(phonepanel_SRCS
|
||||||
|
phonepanel.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(plasma_applet_phonepanel MODULE ${phonepanel_SRCS})
|
||||||
|
|
||||||
|
kcoreaddons_desktop_to_json(plasma_applet_phonepanel package/metadata.desktop)
|
||||||
|
|
||||||
|
target_link_libraries(plasma_applet_phonepanel
|
||||||
|
Qt5::Gui
|
||||||
|
KF5::Plasma
|
||||||
|
KF5::I18n)
|
||||||
|
|
||||||
|
|
||||||
|
install(TARGETS plasma_applet_phonepanel DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
|
||||||
|
#install(FILES plasma-phonepanel-default.desktop DESTINATION ${SERVICES_INSTALL_DIR})
|
||||||
|
|
||||||
|
plasma_install_package(package org.kde.phone.panel)
|
||||||
|
|
||||||
|
|
@ -30,6 +30,7 @@ FullScreenPanel {
|
||||||
property int offset: 0
|
property int offset: 0
|
||||||
property int peekHeight
|
property int peekHeight
|
||||||
property bool userInteracting: false
|
property bool userInteracting: false
|
||||||
|
property bool expanded: false
|
||||||
|
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
property alias contents: contentArea.data
|
property alias contents: contentArea.data
|
||||||
|
|
@ -47,7 +48,9 @@ FullScreenPanel {
|
||||||
closeAnim.running = true;
|
closeAnim.running = true;
|
||||||
}
|
}
|
||||||
function updateState() {
|
function updateState() {
|
||||||
if (offset < peekHeight / 2) {
|
if (expanded) {
|
||||||
|
openAnim.running = true;
|
||||||
|
} else if (offset < peekHeight / 2) {
|
||||||
close();
|
close();
|
||||||
} else if (offset < peekHeight) {
|
} else if (offset < peekHeight) {
|
||||||
open();
|
open();
|
||||||
|
|
@ -70,6 +73,8 @@ FullScreenPanel {
|
||||||
window.width = Screen.width;
|
window.width = Screen.width;
|
||||||
window.height = Screen.height;
|
window.height = Screen.height;
|
||||||
window.requestActivate();
|
window.requestActivate();
|
||||||
|
} else {
|
||||||
|
window.expanded = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SequentialAnimation {
|
SequentialAnimation {
|
||||||
|
|
@ -130,6 +135,7 @@ FullScreenPanel {
|
||||||
Flickable {
|
Flickable {
|
||||||
id: mainFlickable
|
id: mainFlickable
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
interactive: !window.expanded
|
||||||
Binding {
|
Binding {
|
||||||
target: mainFlickable
|
target: mainFlickable
|
||||||
property: "contentY"
|
property: "contentY"
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.1
|
import QtQuick 2.1
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.3
|
||||||
|
|
||||||
import org.kde.plasma.plasmoid 2.0
|
import org.kde.plasma.plasmoid 2.0
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
|
@ -27,6 +27,8 @@ import org.kde.plasma.workspace.components 2.0 as PlasmaWorkspace
|
||||||
|
|
||||||
import "LayoutManager.js" as LayoutManager
|
import "LayoutManager.js" as LayoutManager
|
||||||
|
|
||||||
|
import "quicksettings"
|
||||||
|
|
||||||
PlasmaCore.ColorScope {
|
PlasmaCore.ColorScope {
|
||||||
id: root
|
id: root
|
||||||
width: 480
|
width: 480
|
||||||
|
|
@ -44,13 +46,6 @@ PlasmaCore.ColorScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
function addApplet(applet, x, y) {
|
function addApplet(applet, x, y) {
|
||||||
if (applet.pluginName == "org.kde.phone.quicksettings") {
|
|
||||||
applet.parent = quickSettingsParent;
|
|
||||||
quickSettingsParent.applet = applet;
|
|
||||||
applet.anchors.fill = quickSettingsParent;
|
|
||||||
applet.visible = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var container = appletContainerComponent.createObject(appletIconsRow)
|
var container = appletContainerComponent.createObject(appletIconsRow)
|
||||||
print("Applet added: " + applet + " " + applet.title)
|
print("Applet added: " + applet + " " + applet.title)
|
||||||
container.width = units.iconSizes.medium
|
container.width = units.iconSizes.medium
|
||||||
|
|
@ -65,6 +60,13 @@ PlasmaCore.ColorScope {
|
||||||
applet.fullRepresentationItem.parent = notificationsParent;
|
applet.fullRepresentationItem.parent = notificationsParent;
|
||||||
notificationsParent.applet = applet;
|
notificationsParent.applet = applet;
|
||||||
applet.fullRepresentationItem.anchors.fill = notificationsParent;
|
applet.fullRepresentationItem.anchors.fill = notificationsParent;
|
||||||
|
} else if (applet.pluginName != "org.kde.phone.quicksettings") {
|
||||||
|
applet.expanded = true
|
||||||
|
applet.expanded = false
|
||||||
|
quickSettings.addPlasmoid(applet.icon, applet.title, fullRepsLayout.count);
|
||||||
|
applet.fullRepresentationItem.parent = fullRepsLayout;
|
||||||
|
fullRepsLayout.currentIndex = 0
|
||||||
|
applet.fullRepresentationItem.anchors.fill = fullRepsLayout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -206,22 +208,32 @@ PlasmaCore.ColorScope {
|
||||||
height: plasmoid.availableScreenRect.height
|
height: plasmoid.availableScreenRect.height
|
||||||
peekHeight: quickSettingsParent.height + notificationsParent.minimumHeight + root.height
|
peekHeight: quickSettingsParent.height + notificationsParent.minimumHeight + root.height
|
||||||
headerHeight: root.height
|
headerHeight: root.height
|
||||||
|
onExpandedChanged: {
|
||||||
|
modeSwitchAnim.running = false;
|
||||||
|
modeSwitchAnim.to = expanded ? width : 0
|
||||||
|
modeSwitchAnim.running = true;
|
||||||
|
}
|
||||||
contents: Item {
|
contents: Item {
|
||||||
id: panelContents
|
id: panelContents
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
implicitHeight: quickSettingsParent.height + notificationsParent.height + root.height
|
implicitHeight: slidingPanel.expanded ? (slidingPanel.height-slidingPanel.headerHeight)*0.8 : (quickSettingsParent.height + notificationsParent.height + root.height)
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: quickSettingsParent
|
id: quickSettingsParent
|
||||||
parent: slidingPanel.fixedArea
|
parent: slidingPanel.fixedArea
|
||||||
color: PlasmaCore.ColorScope.backgroundColor
|
color: PlasmaCore.ColorScope.backgroundColor
|
||||||
z: 2
|
z: 2
|
||||||
anchors {
|
width: parent.width
|
||||||
left: parent.left
|
x: -modeFlick.contentX
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
y: Math.min(0, slidingPanel.offset - height - root.height)
|
y: Math.min(0, slidingPanel.offset - height - root.height)
|
||||||
property var applet
|
height: quickSettings.Layout.minimumHeight
|
||||||
height: applet ? applet.fullRepresentationItem.Layout.minimumHeight : 0
|
QuickSettings {
|
||||||
|
id: quickSettings
|
||||||
|
anchors.fill: parent
|
||||||
|
onPlasmoidTriggered: {
|
||||||
|
fullRepsLayout.currentIndex = id;
|
||||||
|
slidingPanel.expanded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
|
|
@ -234,17 +246,54 @@ PlasmaCore.ColorScope {
|
||||||
visible: slidingPanel.offset + slidingPanel.headerHeight < panelContents.height
|
visible: slidingPanel.offset + slidingPanel.headerHeight < panelContents.height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Item {
|
PropertyAnimation {
|
||||||
id: notificationsParent
|
id: modeSwitchAnim
|
||||||
anchors {
|
target: modeFlick
|
||||||
left: parent.left
|
duration: units.longDuration
|
||||||
bottom: parent.bottom
|
easing.type: Easing.InOutQuad
|
||||||
right: parent.right
|
properties: "contentX"
|
||||||
bottomMargin: root.height
|
from: modeFlick.contentX
|
||||||
|
to: 0
|
||||||
|
}
|
||||||
|
Flickable {
|
||||||
|
id: modeFlick
|
||||||
|
anchors.fill: parent
|
||||||
|
contentWidth: width * 2
|
||||||
|
contentHeight: height
|
||||||
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
interactive: slidingPanel.expanded
|
||||||
|
onFlickEnded: movementEnded()
|
||||||
|
onMovementEnded: {
|
||||||
|
slidingPanel.expanded = (contentX > panelContents.width/2);
|
||||||
|
modeSwitchAnim.running = false;
|
||||||
|
modeSwitchAnim.to = slidingPanel.expanded ? width : 0
|
||||||
|
modeSwitchAnim.running = true;
|
||||||
|
}
|
||||||
|
Item {
|
||||||
|
width: modeFlick.width
|
||||||
|
height: modeFlick.height
|
||||||
|
Item {
|
||||||
|
id: notificationsParent
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
bottom: parent.bottom
|
||||||
|
right: parent.right
|
||||||
|
bottomMargin: root.height
|
||||||
|
}
|
||||||
|
property var applet
|
||||||
|
height: applet ? applet.fullRepresentationItem.Layout.maximumHeight : 0
|
||||||
|
property int minimumHeight: applet ? applet.fullRepresentationItem.Layout.minimumHeight : 0
|
||||||
|
}
|
||||||
|
StackLayout {
|
||||||
|
id: fullRepsLayout
|
||||||
|
anchors {
|
||||||
|
left: notificationsParent.right
|
||||||
|
bottom: parent.bottom
|
||||||
|
}
|
||||||
|
width: panelContents.width
|
||||||
|
height: panelContents.height
|
||||||
|
}
|
||||||
}
|
}
|
||||||
property var applet
|
|
||||||
height: applet ? applet.fullRepresentationItem.Layout.maximumHeight : 0
|
|
||||||
property int minimumHeight: applet ? applet.fullRepresentationItem.Layout.minimumHeight : 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2015 Marco Martin <notmart@gmail.com>
|
||||||
|
*
|
||||||
|
* 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 Library 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.1
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: delegateRoot
|
||||||
|
property bool toggled: model.enabled
|
||||||
|
spacing: units.smallSpacing
|
||||||
|
implicitWidth: flow.width / 2 - units.largeSpacing / 2
|
||||||
|
Rectangle {
|
||||||
|
Layout.minimumWidth: units.iconSizes.medium
|
||||||
|
Layout.minimumHeight: width
|
||||||
|
color: toggled ?
|
||||||
|
Qt.rgba(PlasmaCore.ColorScope.highlightColor.r, PlasmaCore.ColorScope.highlightColor.g, PlasmaCore.ColorScope.highlightColor.b, iconMouseArea.pressed ? 0.5 : 0.3) :
|
||||||
|
Qt.rgba(PlasmaCore.ColorScope.textColor.r, PlasmaCore.ColorScope.textColor.g, PlasmaCore.ColorScope.textColor.b, iconMouseArea.pressed ? 0.5 : 0.2)
|
||||||
|
|
||||||
|
PlasmaCore.IconItem {
|
||||||
|
colorGroup: PlasmaCore.ColorScope.colorGroup
|
||||||
|
anchors {
|
||||||
|
fill: parent
|
||||||
|
margins: units.smallSpacing
|
||||||
|
}
|
||||||
|
source: model.icon
|
||||||
|
MouseArea {
|
||||||
|
id: iconMouseArea
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
if (model.plasmoidId > -1) {
|
||||||
|
root.plasmoidTriggered(model.plasmoidId);
|
||||||
|
} else if (delegateRoot.toggle) {
|
||||||
|
delegateRoot.toggle();
|
||||||
|
} else if (model.toggleFunction) {
|
||||||
|
root[model.toggleFunction]();
|
||||||
|
} else if (model.settingsCommand) {
|
||||||
|
plasmoid.nativeInterface.executeCommand(model.settingsCommand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
color: Qt.rgba(PlasmaCore.ColorScope.textColor.r, PlasmaCore.ColorScope.textColor.g, PlasmaCore.ColorScope.textColor.b, labelMouseArea.pressed ? 0.5 : 0.2)
|
||||||
|
PlasmaComponents.Label {
|
||||||
|
anchors {
|
||||||
|
fill: parent
|
||||||
|
margins: units.smallSpacing
|
||||||
|
}
|
||||||
|
text: model.text
|
||||||
|
elide: Text.ElideRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
MouseArea {
|
||||||
|
id: labelMouseArea
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
if (model.plasmoidId > -1) {
|
||||||
|
root.plasmoidTriggered(model.plasmoidId);
|
||||||
|
} else if (model.settingsCommand) {
|
||||||
|
plasmoid.nativeInterface.executeCommand(model.settingsCommand);
|
||||||
|
} else if (model.toggleFunction) {
|
||||||
|
root[model.toggleFunction]();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,181 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2015 Marco Martin <notmart@gmail.com>
|
||||||
|
*
|
||||||
|
* 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 Library 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.1
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
function toggleAirplane() {
|
||||||
|
print("toggle airplane mode")
|
||||||
|
}
|
||||||
|
|
||||||
|
function addPlasmoid(icon, text, id) {
|
||||||
|
settingsModel.append({"icon": icon, "text": text, "plasmoidId": id, "enabled": false})
|
||||||
|
}
|
||||||
|
|
||||||
|
signal plasmoidTriggered(var id)
|
||||||
|
Layout.minimumHeight: flow.implicitHeight + units.largeSpacing*2
|
||||||
|
|
||||||
|
property int screenBrightness
|
||||||
|
readonly property int maximumScreenBrightness: pmSource.data["PowerDevil"] ? pmSource.data["PowerDevil"]["Maximum Screen Brightness"] || 0 : 0
|
||||||
|
onScreenBrightnessChanged: {
|
||||||
|
var service = pmSource.serviceForSource("PowerDevil");
|
||||||
|
var operation = service.operationDescription("setBrightness");
|
||||||
|
operation.brightness = screenBrightness;
|
||||||
|
operation.silent = true
|
||||||
|
service.startOperationCall(operation);
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaCore.DataSource {
|
||||||
|
id: pmSource
|
||||||
|
engine: "powermanagement"
|
||||||
|
connectedSources: ["PowerDevil"]
|
||||||
|
onSourceAdded: {
|
||||||
|
if (source === "PowerDevil") {
|
||||||
|
disconnectSource(source);
|
||||||
|
connectSource(source);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onDataChanged: {
|
||||||
|
root.screenBrightness = pmSource.data["PowerDevil"]["Screen Brightness"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ListModel {
|
||||||
|
id: settingsModel
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
text: "Settings"
|
||||||
|
icon: "configure"
|
||||||
|
enabled: false
|
||||||
|
settingsCommand: "plasma-settings"
|
||||||
|
toggleFunction: ""
|
||||||
|
delegate: ""
|
||||||
|
plasmoidId: -1
|
||||||
|
}
|
||||||
|
/* ListElement {
|
||||||
|
text: "Mobile network"
|
||||||
|
icon: "network-mobile-80"
|
||||||
|
enabled: true
|
||||||
|
settingsCommand: ""
|
||||||
|
plasmoidId: -1
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "Airplane mode"
|
||||||
|
icon: "flightmode-on"
|
||||||
|
enabled: false
|
||||||
|
settingsCommand: ""
|
||||||
|
toggleFunction: "toggleAirplane"
|
||||||
|
plasmoidId: -1
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "Bluetooth"
|
||||||
|
icon: "preferences-system-bluetooth"
|
||||||
|
enabled: false
|
||||||
|
settingsCommand: ""
|
||||||
|
plasmoidId: -1
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "Wireless"
|
||||||
|
icon: "network-wireless-on"
|
||||||
|
enabled: true
|
||||||
|
settingsCommand: "plasmawindowed org.kde.plasma.networkmanagement"
|
||||||
|
plasmoidId: -1
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "Alarms"
|
||||||
|
icon: "korgac"
|
||||||
|
enabled: false
|
||||||
|
settingsCommand: "ktimer"
|
||||||
|
plasmoidId: -1
|
||||||
|
}*/
|
||||||
|
ListElement {
|
||||||
|
text: "Flashlight"
|
||||||
|
icon: "package_games_puzzle"
|
||||||
|
enabled: false
|
||||||
|
settingsCommand: ""
|
||||||
|
plasmoidId: -1
|
||||||
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "Location"
|
||||||
|
icon: "plasmaapplet-location"
|
||||||
|
enabled: false
|
||||||
|
settingsCommand: ""
|
||||||
|
plasmoidId: -1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Flow {
|
||||||
|
id: flow
|
||||||
|
anchors {
|
||||||
|
fill: parent
|
||||||
|
margins: units.largeSpacing
|
||||||
|
}
|
||||||
|
spacing: units.largeSpacing
|
||||||
|
Repeater {
|
||||||
|
model: settingsModel
|
||||||
|
delegate: Loader {
|
||||||
|
width: item ? item.implicitWidth : 0
|
||||||
|
height: item ? item.implicitHeight : 0
|
||||||
|
source: Qt.resolvedUrl((model.delegate ? model.delegate : "Delegate") + ".qml")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
move: Transition {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: units.shortDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
properties: "x,y"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RowLayout {
|
||||||
|
width: flow.width
|
||||||
|
PlasmaCore.IconItem {
|
||||||
|
Layout.preferredWidth: units.iconSizes.small
|
||||||
|
Layout.preferredHeight: Layout.preferredWidth
|
||||||
|
//TODO: needs brightness
|
||||||
|
source: "contrast"
|
||||||
|
}
|
||||||
|
PlasmaComponents.Slider {
|
||||||
|
id: brightnessSlider
|
||||||
|
Layout.fillWidth: true
|
||||||
|
value: root.screenBrightness
|
||||||
|
onValueChanged: {
|
||||||
|
if (pressed) {
|
||||||
|
root.screenBrightness = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
minimumValue: maximumValue > 100 ? 1 : 0
|
||||||
|
maximumValue: root.maximumScreenBrightness
|
||||||
|
stepSize: 1
|
||||||
|
}
|
||||||
|
PlasmaCore.IconItem {
|
||||||
|
Layout.preferredWidth: units.iconSizes.small
|
||||||
|
Layout.preferredHeight: Layout.preferredWidth
|
||||||
|
//TODO: needs brightness
|
||||||
|
source: "contrast"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -28,6 +28,7 @@ X-KDE-PluginInfo-Author=Marco Martin
|
||||||
X-KDE-PluginInfo-Category=Containments
|
X-KDE-PluginInfo-Category=Containments
|
||||||
X-KDE-PluginInfo-Email=mart@kde.org
|
X-KDE-PluginInfo-Email=mart@kde.org
|
||||||
X-KDE-PluginInfo-License=GPLv2+
|
X-KDE-PluginInfo-License=GPLv2+
|
||||||
|
X-KDE-Library=plasma_applet_phonepanel
|
||||||
X-KDE-PluginInfo-Name=org.kde.phone.panel
|
X-KDE-PluginInfo-Name=org.kde.phone.panel
|
||||||
X-KDE-PluginInfo-Version=
|
X-KDE-PluginInfo-Version=
|
||||||
X-KDE-PluginInfo-Website=
|
X-KDE-PluginInfo-Website=
|
||||||
43
containments/panel/phonepanel.cpp
Normal file
43
containments/panel/phonepanel.cpp
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2015 Marco Martin <mart@kde.org> *
|
||||||
|
* *
|
||||||
|
* 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 02110-1301 USA . *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "phonepanel.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
|
PhonePanel::PhonePanel(QObject *parent, const QVariantList &args)
|
||||||
|
: Plasma::Containment(parent, args)
|
||||||
|
{
|
||||||
|
//setHasConfigurationInterface(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
PhonePanel::~PhonePanel()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhonePanel::executeCommand(const QString &command)
|
||||||
|
{
|
||||||
|
qWarning()<<"Executing"<<command;
|
||||||
|
QProcess::startDetached(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
K_EXPORT_PLASMA_APPLET_WITH_JSON(quicksettings, PhonePanel, "metadata.json")
|
||||||
|
|
||||||
|
#include "phonepanel.moc"
|
||||||
43
containments/panel/phonepanel.h
Normal file
43
containments/panel/phonepanel.h
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2015 Marco Martin <mart@kde.org> *
|
||||||
|
*
|
||||||
|
* *
|
||||||
|
* 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 02110-1301 USA . *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef PHONEPANEL_H
|
||||||
|
#define PHONEPANEL_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <Plasma/Containment>
|
||||||
|
|
||||||
|
|
||||||
|
class PhonePanel : public Plasma::Containment
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
PhonePanel( QObject *parent, const QVariantList &args );
|
||||||
|
~PhonePanel();
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void executeCommand(const QString &command);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in a new issue