an applet for quick settings

intended for the top panel
This commit is contained in:
Marco Martin 2015-04-11 16:01:06 +02:00
parent 2d909f69f4
commit e1133e04b6
6 changed files with 206 additions and 2 deletions

View file

@ -1,3 +1,4 @@
plasma_install_package(clock org.kde.phone.clock)
plasma_install_package(notifications org.kde.phone.notifications)
plasma_install_package(quicksettings org.kde.phone.quicksettings)

View file

@ -0,0 +1,4 @@
#! /usr/bin/env bash
$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp
$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.phone.quicksettings.pot
rm -f rc.cpp

View file

@ -0,0 +1,69 @@
/*
* 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 {
spacing: units.smallSpacing
width: parent.width / 2 - units.largeSpacing / 2
Rectangle {
Layout.minimumWidth: units.iconSizes.large
Layout.minimumHeight: width
color: model.enabled ?
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: print("action of mouse area")
}
}
}
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: print("execute active-settings -m " + model.settingsModule)
}
}
}
}

View file

@ -0,0 +1,110 @@
/*
* 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
import org.kde.plasma.plasmoid 2.0
Item {
id: bigClock
/*Layout.minimumWidth: implicitWidth
Layout.minimumHeight: implicitHeight*/
Plasmoid.preferredRepresentation: plasmoid.fullRepresentation
ListModel {
id: settingsModel
ListElement {
text: "Settings"
icon: "configure"
enabled: false
settingsModule: ""
}
ListElement {
text: "Mobile network"
icon: "network-mobile-80"
enabled: true
settingsModule: ""
}
ListElement {
text: "Airplane mode"
icon: "flightmode-on"
enabled: false
settingsModule: ""
}
ListElement {
text: "Bluetooth"
icon: "preferences-system-bluetooth"
enabled: false
settingsModule: ""
}
ListElement {
text: "Wireless"
icon: "network-wireless-on"
enabled: true
settingsModule: "org.kde.satellite.settings.wifi"
}
ListElement {
text: "Alarms"
icon: "korgac"
enabled: false
settingsModule: ""
}
ListElement {
text: "Notifications"
icon: "preferences-desktop-notification"
enabled: true
settingsModule: ""
}
ListElement {
text: "Brightness"
icon: "video-display-brightness"
enabled: false
settingsModule: "org.kde.active.settings.powermanagement"
}
ListElement {
text: "Flashlight"
icon: "package_games_puzzle"
enabled: false
settingsModule: ""
}
ListElement {
text: "Location"
icon: "plasmaapplet-location"
enabled: false
settingsModule: ""
}
}
Flow {
anchors {
fill: parent
margins: units.largeSpacing
}
spacing: units.largeSpacing
Repeater {
model: settingsModel
delegate: Delegate {}
}
}
}

View file

@ -0,0 +1,21 @@
[Desktop Entry]
Encoding=UTF-8
Name=Quick Settings
Comment=A panel to quickly access most important settings
Icon=systemsettings
Type=Service
X-KDE-ParentApp=
X-KDE-PluginInfo-Author=Marco Martin
X-KDE-PluginInfo-Email=mart@kde.org
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-Name=org.kde.phone.quicksettings
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-Website=plasma.kde.org
X-KDE-ServiceTypes=Plasma/Applet
X-Plasma-API=declarativeappletscript
X-KDE-PluginInfo-Category=Settings
X-Plasma-MainScript=ui/main.qml
X-Plasma-RemoteLocation=

View file

@ -17,5 +17,4 @@ for (var j = 0; j < desktopsArray.length; j++) {
desktopsForActivity(id)[0].addWidget("org.kde.phone.notifications");
var panel = new Panel("org.kde.phone.panel");
panel.addWidget("org.kde.plasma.battery");
panel.addWidget("org.kde.plasma.devicenotifier");
panel.addWidget("org.kde.phone.quicksettings");