Commit f6419fc9 authored by Marco Martin's avatar Marco Martin

remove quicksettings applet

not used anymore since ages
parent e0636b46
...@@ -3,4 +3,3 @@ plasma_install_package(clock org.kde.phone.clock) ...@@ -3,4 +3,3 @@ plasma_install_package(clock org.kde.phone.clock)
plasma_install_package(notifications org.kde.phone.notifications) plasma_install_package(notifications org.kde.phone.notifications)
add_subdirectory(battery) add_subdirectory(battery)
add_subdirectory(quicksettings)
set(quicksettings_SRCS
quicksettings.cpp
)
add_library(plasma_applet_quicksettings MODULE ${quicksettings_SRCS})
kcoreaddons_desktop_to_json(plasma_applet_quicksettings package/metadata.desktop)
target_link_libraries(plasma_applet_quicksettings
Qt5::Gui
KF5::Plasma
KF5::I18n)
install(TARGETS plasma_applet_quicksettings DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
#install(FILES plasma-quicksettings-default.desktop DESTINATION ${SERVICES_INSTALL_DIR})
plasma_install_package(package org.kde.phone.quicksettings)
#! /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
/*
* 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.4
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: delegateRoot
implicitWidth: delegate.implicitWidth
implicitHeight: delegate.implicitHeight + (slider.opacity > 0 ? slider.height : 0)
property int screenBrightness
readonly property int maximumScreenBrightness: pmSource.data["PowerDevil"] ? pmSource.data["PowerDevil"]["Maximum Screen Brightness"] || 0 : 0
PlasmaCore.DataSource {
id: pmSource
engine: "powermanagement"
connectedSources: ["PowerDevil"]
onDataChanged: {
delegateRoot.screenBrightness = source.data["PowerDevil"]["Screen Brightness"];
}
}
Delegate {
id: delegate
toggled: slider.opacity > 0
function toggle() {
slider.opacity = slider.opacity > 0 ? 0 : 1;
}
}
PlasmaComponents.Slider {
id: slider
anchors.top: delegate.bottom
width: flow.width
opacity: 0
x: -delegateRoot.parent.x
value: screenBrightness
minimumValue: maximumValue > 100 ? 1 : 0
maximumValue: delegateRoot.maximumScreenBrightness
Behavior on opacity {
OpacityAnimator {
duration: units.shortDuration
easing.type: Easing.InOutQuad
}
}
}
onScreenBrightnessChanged: {
var service = pmSource.serviceForSource("PowerDevil");
var operation = service.operationDescription("setBrightness");
operation.brightness = slider.value;
operation.silent = true
service.startOperationCall(operation);
}
}
/*
* 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.large
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 (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.settingsCommand) {
plasmoid.nativeInterface.executeCommand(model.settingsCommand);
} else if (model.toggleFunction) {
root[model.toggleFunction]();
}
}
}
}
}
}
/*
* 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: root
function toggleAirplane() {
print("toggle airplane mode")
}
Plasmoid.preferredRepresentation: plasmoid.fullRepresentation
Layout.minimumHeight: flow.implicitHeight + units.largeSpacing*2
ListModel {
id: settingsModel
ListElement {
text: "Settings"
icon: "configure"
enabled: false
settingsCommand: "active-settings"
toggleFunction: ""
delegate: ""
}
ListElement {
text: "Mobile network"
icon: "network-mobile-80"
enabled: true
settingsCommand: ""
}
ListElement {
text: "Airplane mode"
icon: "flightmode-on"
enabled: false
settingsCommand: ""
toggleFunction: "toggleAirplane"
}
ListElement {
text: "Bluetooth"
icon: "preferences-system-bluetooth"
enabled: false
settingsCommand: ""
}
ListElement {
text: "Wireless"
icon: "network-wireless-on"
enabled: true
settingsCommand: "active-settings -m org.kde.plasma.phone.settings.wifi"
}
ListElement {
text: "Alarms"
icon: "korgac"
enabled: false
settingsCommand: ""
}
ListElement {
text: "Notifications"
icon: "preferences-desktop-notification"
enabled: true
settingsCommand: ""
}
ListElement {
text: "Brightness"
icon: "video-display-brightness"
enabled: false
settingsCommand: "active-settings -m org.kde.active.settings.powermanagement"
delegate: "BrightnessDelegate"
}
ListElement {
text: "Flashlight"
icon: "package_games_puzzle"
enabled: false
settingsCommand: ""
}
ListElement {
text: "Location"
icon: "plasmaapplet-location"
enabled: false
settingsCommand: ""
}
}
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"
}
}
}
}
[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-Library=plasma_applet_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=
/***************************************************************************
* 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 "quicksettings.h"
#include <QDebug>
#include <QProcess>
QuickSettings::QuickSettings(QObject *parent, const QVariantList &args)
: Plasma::Applet(parent, args)
{
setHasConfigurationInterface(true);
}
QuickSettings::~QuickSettings()
{
}
void QuickSettings::executeCommand(const QString &command)
{
qWarning()<<"Executing"<<command;
QProcess::startDetached(command);
}
K_EXPORT_PLASMA_APPLET_WITH_JSON(quicksettings, QuickSettings, "metadata.json")
#include "quicksettings.moc"
/***************************************************************************
* 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 QUICKSETTINGS_H
#define QUICKSETTINGS_H
#include <Plasma/Applet>
class QuickSettings : public Plasma::Applet
{
Q_OBJECT
public:
QuickSettings( QObject *parent, const QVariantList &args );
~QuickSettings();
public Q_SLOTS:
void executeCommand(const QString &command);
private:
};
#endif
Markdown is supported
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