Commit 18d8494c authored by Marco Martin's avatar Marco Martin

kill systemloadviewer applet

parent 62730341
......@@ -20,9 +20,6 @@ add_subdirectory(nightcolor)
add_subdirectory(notes)
add_subdirectory(quicklaunch)
add_subdirectory(quickshare)
if(NOT WIN32)
add_subdirectory(systemloadviewer)
endif(NOT WIN32)
add_subdirectory(timer)
add_subdirectory(userswitcher)
add_subdirectory(weather)
......
plasma_install_package(package org.kde.plasma.systemloadviewer)
#! /usr/bin/env bash
$XGETTEXT `find . -name \*.qml` -o $podir/plasma_applet_org.kde.plasma.systemloadviewer.pot
/*
* SPDX-FileCopyrightText: 2014 Martin Yrjölä <martin.yrjola@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.2
import org.kde.plasma.configuration 2.0
ConfigModel {
ConfigCategory {
name: i18nc("@title", "General")
icon: "preferences-desktop-plasma"
source: "GeneralSettings.qml"
}
ConfigCategory {
name: i18nc("@title", "Colors")
icon: "preferences-desktop-color"
source: "ColorSettings.qml"
}
}
<?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="memApplicationColor" type="Color">
<default>blue</default>
</entry>
<entry name="memBuffersColor" type="Color">
<default>yellow</default>
</entry>
<entry name="cacheDirtyColor" type="Color">
<default>blue</default>
</entry>
<entry name="cacheWritebackColor" type="Color">
<default>yellow</default>
</entry>
<entry name="swapUsedColor" type="Color">
<default>turquoise</default>
</entry>
<entry name="cpuUserColor" type="Color">
<default>blue</default>
</entry>
<entry name="cpuIOWaitColor" type="Color">
<default>green</default>
</entry>
<entry name="cpuSysColor" type="Color">
<default>red</default>
</entry>
<entry name="cpuNiceColor" type="Color">
<default>yellow</default>
</entry>
<entry name="cpuActivated" type="Bool">
<default>true</default>
</entry>
<entry name="cpuAllActivated" type="Bool">
<default>false</default>
</entry>
<entry name="memoryActivated" type="Bool">
<default>true</default>
</entry>
<entry name="swapActivated" type="Bool">
<default>true</default>
</entry>
<entry name="cacheActivated" type="Bool">
<default>false</default>
</entry>
<entry name="setColorsManually" type="Bool">
<default>false</default>
</entry>
<entry name="updateInterval" type="Double">
<default>1.0</default>
</entry>
<entry name="monitorType" type="Enum">
<choices>
<choice name="Bar"/>
<choice name="Circular"/>
<choice name="Compact Bar"/>
</choices>
<default>0</default>
</entry>
</group>
</kcfg>
/*
* SPDX-FileCopyrightText: 2014 Martin Yrjölä <martin.yrjola@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.2
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
Item {
id: barMonitor
property var colors
property var proportions
Layout.fillHeight: true
Layout.fillWidth: true
Rectangle {
id: barBorder
anchors.fill: parent
color: "transparent"
radius: 3
opacity: .4
border {
color: PlasmaCore.ColorScope.textColor
width: 1
}
}
Repeater {
id: barRepeater
model: proportions.length
ConditionallyRoundedRectangle {
color: barMonitor.colors[index]
height: (barBorder.height - barBorder.border.width) * barMonitor.proportions[index]
borderRectangle: barBorder
// Bars should always be below border
z: -1
anchors {
bottom: index == 0 ? barBorder.bottom : barRepeater.itemAt(index-1).top
bottomMargin: index == 0 ? barBorder.border.width : 0
}
}
}
}
/*
* SPDX-FileCopyrightText: 2014 Martin Yrjölä <martin.yrjola@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
Item {
property alias colors: canvas.colors
property alias proportions: canvas.proportions
Layout.fillHeight: true
Layout.fillWidth: true
onProportionsChanged: {
canvas.requestPaint()
}
Canvas {
id: canvas
readonly property int lineWidth: 1
readonly property bool fill: true
readonly property bool stroke: true
readonly property real alpha: 1.0
property var proportions
property var colors
// This fixes edge bleeding
readonly property double filler: 0.01
width: parent.width
height: Math.min(parent.height, parent.width)
antialiasing: true
onPaint: {
var ctx = getContext("2d");
ctx.save();
ctx.clearRect(0,0,canvas.width, canvas.height);
ctx.strokeStyle = canvas.strokeStyle;
ctx.globalAlpha = canvas.alpha
// Start from 6 o'clock
var currentRadian = Math.PI/2
// Draw the sectors
for (var i = 0; i < proportions.length; i++) {
var radians = proportions[i] * 2 * Math.PI
ctx.fillStyle = colors[i]
ctx.beginPath();
ctx.arc(width/2, height/2, height/2.1, currentRadian, currentRadian + radians + filler, false)
ctx.arc(width/2, height/2, height/4, currentRadian + radians + filler, currentRadian, true)
currentRadian += radians - filler
ctx.closePath();
ctx.fill();
}
// Draw border
ctx.fillStyle = "transparent"
ctx.strokeStyle = PlasmaCore.ColorScope.textColor
ctx.lineWidth = canvas.lineWidth
ctx.globalAlpha = .4
ctx.beginPath();
ctx.arc(width/2, height/2, height/2.1, Math.PI/2, 5*Math.PI/2, false)
ctx.moveTo(width/2,height/2+height/4);
ctx.arc(width/2, height/2, height/4, Math.PI/2, 5*Math.PI/2, false)
ctx.fillRule = Qt.OddEvenFill
ctx.fill();
ctx.stroke();
ctx.restore();
}
}
}
/*
* SPDX-FileCopyrightText: 2014 Martin Yrjölä <martin.yrjola@gmail.com>
* SPDX-FileCopyrightText: 2019 Nate Graham <nate@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.5
import QtQuick.Controls 2.5 as QQC2
import org.kde.kirigami 2.5 as Kirigami
import org.kde.kquickcontrols 2.0 as KQuickControls
Kirigami.FormLayout {
id: colorSettings
property alias cfg_memApplicationColor: memApplicationColorPicker.color
property alias cfg_memBuffersColor: memBuffersColorPicker.color
property alias cfg_cpuUserColor: cpuUserColorPicker.color
property alias cfg_cpuIOWaitColor: cpuIOWaitColorPicker.color
property alias cfg_cpuSysColor: cpuSysColorPicker.color
property alias cfg_cpuNiceColor: cpuNiceColorPicker.color
property alias cfg_swapUsedColor: swapUsedColorPicker.color
property alias cfg_cacheDirtyColor: cacheDirtyColorPicker.color
property alias cfg_cacheWritebackColor: cacheWritebackColorPicker.color
property alias cfg_setColorsManually: setColorsManually.checked
QQC2.CheckBox {
id: setColorsManually
text: i18nc("@option:check", "Set Colors Manually")
}
Item {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18nc("@title:group", "CPU")
enabled: setColorsManually.checked
}
KQuickControls.ColorButton {
id: cpuUserColorPicker
Kirigami.FormData.label: i18nc("@label:chooser", "User:")
enabled: setColorsManually.checked
}
KQuickControls.ColorButton {
id: cpuIOWaitColorPicker
Kirigami.FormData.label: i18nc("@label:chooser", "IOWait:")
enabled: setColorsManually.checked
}
KQuickControls.ColorButton {
id: cpuSysColorPicker
Kirigami.FormData.label: i18nc("@label:chooser", "Sys:")
enabled: setColorsManually.checked
}
KQuickControls.ColorButton {
id: cpuNiceColorPicker
Kirigami.FormData.label: i18nc("@label:chooser", "Nice:")
enabled: setColorsManually.checked
}
Item {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18nc("@title:group", "Memory")
enabled: setColorsManually.checked
}
KQuickControls.ColorButton {
id: memApplicationColorPicker
Kirigami.FormData.label: i18nc("@label:chooser", "Application:")
enabled: setColorsManually.checked
}
KQuickControls.ColorButton {
id: memBuffersColorPicker
Kirigami.FormData.label: i18nc("@label:chooser", "Buffers:")
enabled: setColorsManually.checked
}
Item {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18nc("@title:group", "Swap")
enabled: setColorsManually.checked
}
KQuickControls.ColorButton {
id: swapUsedColorPicker
Kirigami.FormData.label: i18nc("@label:chooser", "Used swap:")
enabled: setColorsManually.checked
}
Item {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18nc("@title:group", "Cache")
enabled: setColorsManually.checked
}
KQuickControls.ColorButton {
id: cacheDirtyColorPicker
Kirigami.FormData.label: i18nc("@label:chooser", "Dirty memory:")
enabled: setColorsManually.checked
}
KQuickControls.ColorButton {
id: cacheWritebackColorPicker
Kirigami.FormData.label: i18nc("@label:chooser", "Writeback memory:")
enabled: setColorsManually.checked
}
}
/*
* SPDX-FileCopyrightText: 2014 Martin Yrjölä <martin.yrjola@gmail.com>
* SPDX-FileCopyrightText: 2015 Joshua Worth <joshua@worth.id.au>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.2
import QtQuick.Layouts 1.1
import QtGraphicalEffects 1.0
Item {
id: barMonitor
property var colors
property var proportions: []
Layout.fillHeight: true
Layout.fillWidth: true
Rectangle {
id: barBorder
anchors.fill: parent
opacity: 0
}
Repeater {
id: barRepeater
model: proportions.length
Rectangle {
color: barMonitor.colors[index]
height: barBorder.height * barMonitor.proportions[index]
width: barBorder.width
anchors {
bottom: index == 0 ? barBorder.bottom : barRepeater.itemAt(index-1).top
bottomMargin: index == 0 ? barBorder.border.width : 0
}
LinearGradient {
anchors.fill: parent
end: Qt.point(width, 0)
gradient: Gradient {
GradientStop { position: 0.0; color: "#60ffffff" }
GradientStop { position: 1.0; color: "transparent" }
}
}
}
}
}
/*
* SPDX-FileCopyrightText: 2014 Martin Yrjölä <martin.yrjola@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.2
import QtQuick.Layouts 1.1
import org.kde.plasma.extras 2.0 as PlasmaExtras
Item {
property var colors
property var proportions
Layout.fillWidth: true
Layout.fillHeight: true
Loader {
id: loader
active: visible
anchors.fill: parent
source: switch (plasmoid.configuration.monitorType) {
default: case 0: "BarMonitor.qml"; break;
case 1: "CircularMonitor.qml"; break;
case 2: "CompactBarMonitor.qml"; break;
}
onLoaded: {
loader.item.colors = Qt.binding(function() { return colors })
loader.item.proportions = Qt.binding(function() { return proportions })
}
}
}
/*
* SPDX-FileCopyrightText: 2014 Martin Yrjölä <martin.yrjola@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.2
Rectangle {
property Rectangle borderRectangle
readonly property real borderHeight: borderRectangle.height
radius: borderRectangle.radius
anchors.horizontalCenter: borderRectangle.horizontalCenter
// Rectangles without rounded corners on the top and bottom if needed
Rectangle {
width: parent.width
color: parent.color
height: Math.min(parent.radius,
parent.height,
parent.borderHeight - parent.y - parent.radius / 2)
visible: (parent.y - parent.radius > 0) && (
parent.borderHeight - parent.y > parent.radius)
anchors {
top: parent.top
left: parent.left
}
}
Rectangle {
width: parent.width
color: parent.color
height: Math.min(parent.radius, parent.height)
visible: parent.y + parent.height < parent.borderHeight - parent.radius
anchors {
bottom: parent.bottom
left: parent.left
}
}
onHeightChanged: {
width = borderRectangle.width - borderRectangle.border.width * 2
if (borderHeight - y < radius) {
width = width - (radius * 2) + (borderHeight-y)*2
}
}
}
/*
* SPDX-FileCopyrightText: 2014 Martin Yrjölä <martin.yrjola@gmail.com>
* SPDX-FileCopyrightText: 2019 Nate Graham <nate@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQuick 2.5
import QtQuick.Controls 1.4 as QQC1
import QtQuick.Controls 2.5 as QQC2
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.5 as Kirigami
Kirigami.FormLayout {
id: generalSettings
property alias cfg_cpuActivated: cpuActivatedCheckBox.checked
property alias cfg_cpuAllActivated: cpuAllActivatedCheckBox.checked
property alias cfg_memoryActivated: memoryActivatedCheckBox.checked
property alias cfg_swapActivated: swapActivatedCheckBox.checked
property alias cfg_cacheActivated: cacheActivatedCheckBox.checked
property alias cfg_updateInterval: updateIntervalSpinBox.value
property int cfg_monitorType: plasmoid.configuration.monitorType
QQC2.ButtonGroup {
id: monitorTypeGroup
}
QQC2.CheckBox {
id: cpuActivatedCheckBox
Kirigami.FormData.label: i18nc("@label", "Show:")
text: i18nc("@option:check", "CPU monitor")
onCheckedChanged: if (!checked) {cpuAllActivatedCheckBox.checked = false;}
}
RowLayout {
Layout.fillWidth: true
Item {
width: Kirigami.Units.gridUnit
}
QQC2.CheckBox {
id: cpuAllActivatedCheckBox
Layout.fillWidth: true
text: i18nc("@option:check", "CPUs separately")
enabled: cpuActivatedCheckBox.checked && cfg_monitorType === 2
}
}
QQC2.CheckBox {
id: memoryActivatedCheckBox
text: i18nc("@option:check", "Memory monitor")
}
QQC2.CheckBox {
id: swapActivatedCheckBox
text: i18nc("@option:check", "Swap monitor")
}
QQC2.CheckBox {
id: cacheActivatedCheckBox
text: i18nc("@option:check", "Cache monitor")
}
Item {
Kirigami.FormData.isSection: true
}
QQC2.RadioButton {
id: barMonitorRadio
QQC2.ButtonGroup.group: monitorTypeGroup
Kirigami.FormData.label: i18nc("@label", "Monitor type:")
text: i18nc("@option:radio", "Bar")
checked: cfg_monitorType == 0
onClicked: if (checked) {cfg_monitorType = 0; cpuAllActivatedCheckBox.checked = false;}
}
QQC2.RadioButton {
id: circularMonitorRadio
QQC2.ButtonGroup.group: monitorTypeGroup
text: i18nc("@option:radio", "Circular")
checked: cfg_monitorType == 1
onClicked: if (checked) {cfg_monitorType = 1; cpuAllActivatedCheckBox.checked = false;}
}