mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
some updates
This commit is contained in:
parent
a61cff7caa
commit
9611677254
@ -5,7 +5,7 @@ cmake_policy (SET CMP0002 OLD)
|
|||||||
cmake_policy (SET CMP0011 NEW)
|
cmake_policy (SET CMP0011 NEW)
|
||||||
cmake_policy (SET CMP0015 NEW)
|
cmake_policy (SET CMP0015 NEW)
|
||||||
|
|
||||||
project (awesome-widgets)
|
project (awesomewidgets)
|
||||||
set (PROJECT_AUTHOR "Evgeniy Alekseev")
|
set (PROJECT_AUTHOR "Evgeniy Alekseev")
|
||||||
set (PROJECT_CONTACT "esalexeev@gmail.com")
|
set (PROJECT_CONTACT "esalexeev@gmail.com")
|
||||||
set (PROJECT_LICENSE "GPLv3")
|
set (PROJECT_LICENSE "GPLv3")
|
||||||
|
@ -26,24 +26,6 @@
|
|||||||
<entry name="tempUnits" type="string">
|
<entry name="tempUnits" type="string">
|
||||||
<default>Celsius</default>
|
<default>Celsius</default>
|
||||||
</entry>
|
</entry>
|
||||||
<entry name="tempDevice" type="string">
|
|
||||||
<default></default>
|
|
||||||
</entry>
|
|
||||||
<entry name="fanDevice" type="string">
|
|
||||||
<default></default>
|
|
||||||
</entry>
|
|
||||||
<entry name="mount" type="string">
|
|
||||||
<default>/</default>
|
|
||||||
</entry>
|
|
||||||
<entry name="hdd" type="string">
|
|
||||||
<default>/dev/sda</default>
|
|
||||||
</entry>
|
|
||||||
<entry name="disk" type="string">
|
|
||||||
<default>disk/sda_(8:0)</default>
|
|
||||||
</entry>
|
|
||||||
<entry name="customNetdev" type="string">
|
|
||||||
<default></default>
|
|
||||||
</entry>
|
|
||||||
<entry name="acOnline" type="string">
|
<entry name="acOnline" type="string">
|
||||||
<default>(*)</default>
|
<default>(*)</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -17,8 +17,7 @@
|
|||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Controls 1.3 as QtControls
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
import QtQuick.Layouts 1.0 as QtLayouts
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.private.awesomewidget 1.0
|
||||||
|
|
||||||
@ -31,6 +30,33 @@ Item {
|
|||||||
implicitHeight: pageColumn.implicitHeight
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
property bool debug: AWKeys.isDebugEnabled()
|
property bool debug: AWKeys.isDebugEnabled()
|
||||||
|
property variant settings: {
|
||||||
|
"customTime": plasmoid.configuration.customTime,
|
||||||
|
"customUptime": plasmoid.configuration.customUptime,
|
||||||
|
"tempUnits": plasmoid.configuration.tempUnits,
|
||||||
|
"acOnline": plasmoid.configuration.acOnline,
|
||||||
|
"acOffline": plasmoid.configuration.acOffline
|
||||||
|
}
|
||||||
|
property variant tooltipSettings: {
|
||||||
|
"tooltipNumber": plasmoid.configuration.tooltipNumber,
|
||||||
|
"useTooltipBackground": plasmoid.configuration.useTooltipBackground,
|
||||||
|
"tooltipBackgroung": plasmoid.configuration.tooltipBackgroung,
|
||||||
|
"cpuTooltip": plasmoid.configuration.cpuTooltip,
|
||||||
|
"cpuclTooltip": plasmoid.configuration.cpuclTooltip,
|
||||||
|
"memTooltip": plasmoid.configuration.memTooltip,
|
||||||
|
"swapTooltip": plasmoid.configuration.swapTooltip,
|
||||||
|
"downTooltip": plasmoid.configuration.downTooltip,
|
||||||
|
"upTooltip": plasmoid.configuration.downTooltip,
|
||||||
|
"batteryTooltip": plasmoid.configuration.batteryTooltip,
|
||||||
|
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
||||||
|
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
||||||
|
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
||||||
|
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
||||||
|
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
||||||
|
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
||||||
|
"batteryTooltipColor": plasmoid.configuration.batteryTooltipColor,
|
||||||
|
"batteryInTooltipColor": plasmoid.configuration.batteryInTooltipColor
|
||||||
|
}
|
||||||
|
|
||||||
property alias cfg_background: background.checked
|
property alias cfg_background: background.checked
|
||||||
property alias cfg_customTime: customTime.text
|
property alias cfg_customTime: customTime.text
|
||||||
@ -146,126 +172,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width
|
|
||||||
QtControls.Label {
|
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width * 2 / 5
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("Temperature devices")
|
|
||||||
}
|
|
||||||
QtControls.Button {
|
|
||||||
width: parent.width * 3 / 5
|
|
||||||
text: i18n("Select devices")
|
|
||||||
onClicked: plasmoid.configuration.tempDevice = AWActions.selectDevices(
|
|
||||||
AWActions.getTempDevices(),
|
|
||||||
plasmoid.configuration.tempDevice.split("@@")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width
|
|
||||||
QtControls.Label {
|
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width * 2 / 5
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("Fan devices")
|
|
||||||
}
|
|
||||||
QtControls.Button {
|
|
||||||
width: parent.width * 3 / 5
|
|
||||||
text: i18n("Select devices")
|
|
||||||
onClicked: plasmoid.configuration.fanDevice = AWActions.selectDevice(
|
|
||||||
AWActions.getFanDevices(),
|
|
||||||
plasmoid.configuration.fanDevice.split("@@")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width
|
|
||||||
QtControls.Label {
|
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width * 2 / 5
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("Mount devices")
|
|
||||||
}
|
|
||||||
QtControls.Button {
|
|
||||||
width: parent.width * 3 / 5
|
|
||||||
text: i18n("Select devices")
|
|
||||||
onClicked: plasmoid.configuration.mount = AWActions.selectDevices(
|
|
||||||
AWActions.getMountDevices(),
|
|
||||||
plasmoid.configuration.mount.split("@@")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width
|
|
||||||
QtControls.Label {
|
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width * 2 / 5
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("HDD devices (speed)")
|
|
||||||
}
|
|
||||||
QtControls.Button {
|
|
||||||
width: parent.width * 3 / 5
|
|
||||||
text: i18n("Select devices")
|
|
||||||
onClicked: plasmoid.configuration.disk = AWActions.selectDevices(
|
|
||||||
AWActions.getDiskDevices(),
|
|
||||||
plasmoid.configuration.disk.split("@@")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width
|
|
||||||
QtControls.Label {
|
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width * 2 / 5
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("HDD devices (temp)")
|
|
||||||
}
|
|
||||||
QtControls.Button {
|
|
||||||
width: parent.width * 3 / 5
|
|
||||||
text: i18n("Select devices")
|
|
||||||
onClicked: plasmoid.configuration.hdd = AWActions.selectDevices(
|
|
||||||
AWActions.getHddDevices(),
|
|
||||||
plasmoid.configuration.hdd.split("@@")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width
|
|
||||||
QtControls.Label {
|
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width * 2 / 5
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("Network devices")
|
|
||||||
}
|
|
||||||
QtControls.Button {
|
|
||||||
width: parent.width * 3 / 5
|
|
||||||
text: i18n("Select devices")
|
|
||||||
onClicked: plasmoid.configuration.customNetdev = AWActions.selectDevices(
|
|
||||||
AWActions.getNetworkDevices(),
|
|
||||||
plasmoid.configuration.customNetdev.split("@@")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@ -304,7 +210,7 @@ Item {
|
|||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
height: implicitHeight
|
height: parent.height
|
||||||
width: parent.width * 2 / 5
|
width: parent.width * 2 / 5
|
||||||
horizontalAlignment: Text.AlignRight
|
horizontalAlignment: Text.AlignRight
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
@ -318,11 +224,52 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we need to initializate DataEngines here too
|
||||||
|
// because we need to get keys and values
|
||||||
|
PlasmaCore.DataSource {
|
||||||
|
id: systemmonitorDE
|
||||||
|
engine: "systemmonitor"
|
||||||
|
connectedSources: systemmonitorDE.sources
|
||||||
|
interval: 5000
|
||||||
|
|
||||||
|
onNewData: {
|
||||||
|
if (debug) console.log("[advanced::onNewData] : Update source " + sourceName)
|
||||||
|
|
||||||
|
AWKeys.setDataBySource(sourceName, data, settings)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaCore.DataSource {
|
||||||
|
id: extsysmonDE
|
||||||
|
engine: "extsysmon"
|
||||||
|
connectedSources: ["battery", "custom", "desktop", "netdev", "gpu",
|
||||||
|
"gputemp", "hddtemp", "pkg", "player", "ps", "update"]
|
||||||
|
interval: 5000
|
||||||
|
|
||||||
|
onNewData: {
|
||||||
|
if (debug) console.log("[advanced::onNewData] : Update source " + sourceName)
|
||||||
|
|
||||||
|
AWKeys.setDataBySource(sourceName, data, settings)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaCore.DataSource {
|
||||||
|
id: timeDE
|
||||||
|
engine: "time"
|
||||||
|
connectedSources: ["Local"]
|
||||||
|
interval: 5000
|
||||||
|
|
||||||
|
onNewData: {
|
||||||
|
if (debug) console.log("[advanced::onNewData] : Update source " + sourceName)
|
||||||
|
|
||||||
|
AWKeys.setDataBySource(sourceName, data, settings)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (debug) console.log("[advanced::onCompleted]")
|
if (debug) console.log("[advanced::onCompleted]")
|
||||||
|
|
||||||
// init submodule
|
// init submodule
|
||||||
AWKeys.initKeys(pattern, settings, tooltipSettings)
|
AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ import QtQuick 2.0
|
|||||||
import QtQuick.Controls 1.3 as QtControls
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||||
import QtQuick.Layouts 1.0 as QtLayouts
|
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.private.awesomewidget 1.0
|
||||||
import "."
|
import "."
|
||||||
|
@ -33,37 +33,4 @@ QtObject {
|
|||||||
"right": Text.AlignRight,
|
"right": Text.AlignRight,
|
||||||
"justify": Text.AlignJustify
|
"justify": Text.AlignJustify
|
||||||
}
|
}
|
||||||
property variant settings: {
|
|
||||||
"customTime": plasmoid.configuration.customTime,
|
|
||||||
"customUptime": plasmoid.configuration.customUptime,
|
|
||||||
"tempUnits": plasmoid.configuration.tempUnits,
|
|
||||||
"tempDevice": plasmoid.configuration.tempDevice,
|
|
||||||
"fanDevice": plasmoid.configuration.fanDevice,
|
|
||||||
"mount": plasmoid.configuration.mount,
|
|
||||||
"hdd": plasmoid.configuration.hdd,
|
|
||||||
"disk": plasmoid.configuration.disk,
|
|
||||||
"customNetdev": plasmoid.configuration.customNetdev,
|
|
||||||
"acOnline": plasmoid.configuration.acOnline,
|
|
||||||
"acOffline": plasmoid.configuration.acOffline
|
|
||||||
}
|
|
||||||
property variant tooltipSettings: {
|
|
||||||
"tooltipNumber": plasmoid.configuration.tooltipNumber,
|
|
||||||
"useTooltipBackground": plasmoid.configuration.useTooltipBackground,
|
|
||||||
"tooltipBackgroung": plasmoid.configuration.tooltipBackgroung,
|
|
||||||
"cpuTooltip": plasmoid.configuration.cpuTooltip,
|
|
||||||
"cpuclTooltip": plasmoid.configuration.cpuclTooltip,
|
|
||||||
"memTooltip": plasmoid.configuration.memTooltip,
|
|
||||||
"swapTooltip": plasmoid.configuration.swapTooltip,
|
|
||||||
"downTooltip": plasmoid.configuration.downTooltip,
|
|
||||||
"upTooltip": plasmoid.configuration.downTooltip,
|
|
||||||
"batteryTooltip": plasmoid.configuration.batteryTooltip,
|
|
||||||
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
|
||||||
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
|
||||||
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
|
||||||
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
|
||||||
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
|
||||||
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
|
||||||
"batteryTooltipColor": plasmoid.configuration.batteryTooltipColor,
|
|
||||||
"batteryInTooltipColor": plasmoid.configuration.batteryInTooltipColor
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,33 @@ Item {
|
|||||||
id: main
|
id: main
|
||||||
|
|
||||||
property bool debug: AWKeys.isDebugEnabled()
|
property bool debug: AWKeys.isDebugEnabled()
|
||||||
|
property variant settings: {
|
||||||
|
"customTime": plasmoid.configuration.customTime,
|
||||||
|
"customUptime": plasmoid.configuration.customUptime,
|
||||||
|
"tempUnits": plasmoid.configuration.tempUnits,
|
||||||
|
"acOnline": plasmoid.configuration.acOnline,
|
||||||
|
"acOffline": plasmoid.configuration.acOffline
|
||||||
|
}
|
||||||
|
property variant tooltipSettings: {
|
||||||
|
"tooltipNumber": plasmoid.configuration.tooltipNumber,
|
||||||
|
"useTooltipBackground": plasmoid.configuration.useTooltipBackground,
|
||||||
|
"tooltipBackgroung": plasmoid.configuration.tooltipBackgroung,
|
||||||
|
"cpuTooltip": plasmoid.configuration.cpuTooltip,
|
||||||
|
"cpuclTooltip": plasmoid.configuration.cpuclTooltip,
|
||||||
|
"memTooltip": plasmoid.configuration.memTooltip,
|
||||||
|
"swapTooltip": plasmoid.configuration.swapTooltip,
|
||||||
|
"downTooltip": plasmoid.configuration.downTooltip,
|
||||||
|
"upTooltip": plasmoid.configuration.downTooltip,
|
||||||
|
"batteryTooltip": plasmoid.configuration.batteryTooltip,
|
||||||
|
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
||||||
|
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
||||||
|
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
||||||
|
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
||||||
|
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
||||||
|
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
||||||
|
"batteryTooltipColor": plasmoid.configuration.batteryTooltipColor,
|
||||||
|
"batteryInTooltipColor": plasmoid.configuration.batteryInTooltipColor
|
||||||
|
}
|
||||||
|
|
||||||
signal needUpdate
|
signal needUpdate
|
||||||
|
|
||||||
@ -42,34 +69,34 @@ Item {
|
|||||||
PlasmaCore.DataSource {
|
PlasmaCore.DataSource {
|
||||||
id: systemmonitorDE
|
id: systemmonitorDE
|
||||||
engine: "systemmonitor"
|
engine: "systemmonitor"
|
||||||
connectedSources: systemmonitorDE.sources
|
connectedSources: []
|
||||||
interval: plasmoid.configuration.interval
|
interval: plasmoid.configuration.interval
|
||||||
|
|
||||||
onNewData: {
|
onNewData: {
|
||||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||||
|
|
||||||
if (!AWActions.checkKeys(data)) return
|
AWKeys.setDataBySource(sourceName, data, settings)
|
||||||
if (AWKeys.isReady()) AWKeys.setDataBySource(sourceName, data, general.settings)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onSourceAdded: {
|
onSourceAdded: {
|
||||||
if (debug) console.log("[main::onSourceAdded] : Source " + source)
|
if (debug) console.log("[main::onSourceAdded] : Source " + source)
|
||||||
|
|
||||||
AWActions.addDevice(source)
|
systemmonitorDE.connectSource(source)
|
||||||
|
AWKeys.addDevice(source)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlasmaCore.DataSource {
|
PlasmaCore.DataSource {
|
||||||
id: extsysmonDE
|
id: extsysmonDE
|
||||||
engine: "extsysmon"
|
engine: "extsysmon"
|
||||||
connectedSources: extsysmonDE.sources
|
connectedSources: ["battery", "custom", "desktop", "netdev", "gpu",
|
||||||
|
"gputemp", "hddtemp", "pkg", "player", "ps", "update"]
|
||||||
interval: plasmoid.configuration.interval
|
interval: plasmoid.configuration.interval
|
||||||
|
|
||||||
onNewData: {
|
onNewData: {
|
||||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||||
|
|
||||||
if (!AWActions.checkKeys(data)) return
|
AWKeys.setDataBySource(sourceName, data, settings)
|
||||||
if (AWKeys.isReady()) AWKeys.setDataBySource(sourceName, data, general.settings)
|
|
||||||
// update
|
// update
|
||||||
if (sourceName == "update") needUpdate()
|
if (sourceName == "update") needUpdate()
|
||||||
}
|
}
|
||||||
@ -84,8 +111,7 @@ Item {
|
|||||||
onNewData: {
|
onNewData: {
|
||||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||||
|
|
||||||
if (!AWActions.checkKeys(data)) return
|
AWKeys.setDataBySource(sourceName, data, settings)
|
||||||
if (AWKeys.isReady()) AWKeys.setDataBySource(sourceName, data, general.settings)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,10 +137,11 @@ Item {
|
|||||||
if (debug) console.log("[main::onCompleted]")
|
if (debug) console.log("[main::onCompleted]")
|
||||||
|
|
||||||
// init submodule
|
// init submodule
|
||||||
AWKeys.initKeys(plasmoid.configuration.text, general.settings, general.tooltipSettings)
|
AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings)
|
||||||
// actions
|
// actions
|
||||||
|
plasmoid.setAction("requestKey", i18n("Request key"), "utilities-system-monitor")
|
||||||
plasmoid.setAction("showReadme", i18n("Show README"), "text-x-readme")
|
plasmoid.setAction("showReadme", i18n("Show README"), "text-x-readme")
|
||||||
plasmoid.setAction("updateText", i18n("Update text"), "stock-refresh")
|
plasmoid.setAction("updateText", i18n("Update text"), "view-refresh")
|
||||||
plasmoid.setAction("checkUpdates", i18n("Check updates"), "system-software-update")
|
plasmoid.setAction("checkUpdates", i18n("Check updates"), "system-software-update")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,6 +168,14 @@ Item {
|
|||||||
AWActions.showReadme()
|
AWActions.showReadme()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function action_requestKey() {
|
||||||
|
if (debug) console.log("[main::action_requestKey]")
|
||||||
|
|
||||||
|
var message = AWKeys.graphicalValueByKey();
|
||||||
|
if (message.length == 0) return
|
||||||
|
AWActions.sendNotification("tag", message)
|
||||||
|
}
|
||||||
|
|
||||||
function action_updateText() {
|
function action_updateText() {
|
||||||
if (debug) console.log("[main::action_updateText]")
|
if (debug) console.log("[main::action_updateText]")
|
||||||
}
|
}
|
||||||
|
@ -17,9 +17,7 @@
|
|||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Controls 1.3 as QtControls
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import QtQuick.Layouts 1.0 as QtLayouts
|
|
||||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.private.awesomewidget 1.0
|
||||||
import "."
|
import "."
|
||||||
@ -33,6 +31,33 @@ Item {
|
|||||||
implicitHeight: pageColumn.implicitHeight
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
property bool debug: AWKeys.isDebugEnabled()
|
property bool debug: AWKeys.isDebugEnabled()
|
||||||
|
property variant settings: {
|
||||||
|
"customTime": plasmoid.configuration.customTime,
|
||||||
|
"customUptime": plasmoid.configuration.customUptime,
|
||||||
|
"tempUnits": plasmoid.configuration.tempUnits,
|
||||||
|
"acOnline": plasmoid.configuration.acOnline,
|
||||||
|
"acOffline": plasmoid.configuration.acOffline
|
||||||
|
}
|
||||||
|
property variant tooltipSettings: {
|
||||||
|
"tooltipNumber": plasmoid.configuration.tooltipNumber,
|
||||||
|
"useTooltipBackground": plasmoid.configuration.useTooltipBackground,
|
||||||
|
"tooltipBackgroung": plasmoid.configuration.tooltipBackgroung,
|
||||||
|
"cpuTooltip": plasmoid.configuration.cpuTooltip,
|
||||||
|
"cpuclTooltip": plasmoid.configuration.cpuclTooltip,
|
||||||
|
"memTooltip": plasmoid.configuration.memTooltip,
|
||||||
|
"swapTooltip": plasmoid.configuration.swapTooltip,
|
||||||
|
"downTooltip": plasmoid.configuration.downTooltip,
|
||||||
|
"upTooltip": plasmoid.configuration.downTooltip,
|
||||||
|
"batteryTooltip": plasmoid.configuration.batteryTooltip,
|
||||||
|
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
||||||
|
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
||||||
|
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
||||||
|
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
||||||
|
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
||||||
|
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
||||||
|
"batteryTooltipColor": plasmoid.configuration.batteryTooltipColor,
|
||||||
|
"batteryInTooltipColor": plasmoid.configuration.batteryInTooltipColor
|
||||||
|
}
|
||||||
|
|
||||||
property alias cfg_text: textPattern.text
|
property alias cfg_text: textPattern.text
|
||||||
|
|
||||||
@ -220,10 +245,52 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we need to initializate DataEngines here too
|
||||||
|
// because we need to get keys and values
|
||||||
|
PlasmaCore.DataSource {
|
||||||
|
id: systemmonitorDE
|
||||||
|
engine: "systemmonitor"
|
||||||
|
connectedSources: systemmonitorDE.sources
|
||||||
|
interval: 5000
|
||||||
|
|
||||||
|
onNewData: {
|
||||||
|
if (debug) console.log("[widget::onNewData] : Update source " + sourceName)
|
||||||
|
|
||||||
|
AWKeys.setDataBySource(sourceName, data, settings)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaCore.DataSource {
|
||||||
|
id: extsysmonDE
|
||||||
|
engine: "extsysmon"
|
||||||
|
connectedSources: ["battery", "custom", "desktop", "netdev", "gpu",
|
||||||
|
"gputemp", "hddtemp", "pkg", "player", "ps", "update"]
|
||||||
|
interval: 5000
|
||||||
|
|
||||||
|
onNewData: {
|
||||||
|
if (debug) console.log("[widget::onNewData] : Update source " + sourceName)
|
||||||
|
|
||||||
|
AWKeys.setDataBySource(sourceName, data, settings)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaCore.DataSource {
|
||||||
|
id: timeDE
|
||||||
|
engine: "time"
|
||||||
|
connectedSources: ["Local"]
|
||||||
|
interval: 5000
|
||||||
|
|
||||||
|
onNewData: {
|
||||||
|
if (debug) console.log("[widget::onNewData] : Update source " + sourceName)
|
||||||
|
|
||||||
|
AWKeys.setDataBySource(sourceName, data, settings)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (debug) console.log("[widget::onCompleted]")
|
if (debug) console.log("[widget::onCompleted]")
|
||||||
|
|
||||||
// init submodule
|
// init submodule
|
||||||
AWKeys.initKeys(plasmoid.configuration.text, general.settings, general.tooltipSettings)
|
AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,4 +41,4 @@ target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
|||||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget)
|
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget)
|
||||||
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget)
|
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget)
|
||||||
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
||||||
install (DIRECTORY ${SUBPROJECT_DESKTOPS} DESTINATION ${DATA_INSTALL_DIR}/${PLUGIN_NAME})
|
install (DIRECTORY ${SUBPROJECT_DESKTOPS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||||
|
@ -23,16 +23,12 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QListWidget>
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QNetworkInterface>
|
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QProcessEnvironment>
|
#include <QProcessEnvironment>
|
||||||
#include <QRegExp>
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
@ -60,15 +56,6 @@ AWActions::~AWActions()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool AWActions::checkKeys(const QMap<QString, QVariant> data)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Data" << data;
|
|
||||||
|
|
||||||
return (data.count() != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AWActions::checkUpdates()
|
void AWActions::checkUpdates()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -111,31 +98,6 @@ void AWActions::showReadme()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AWActions::addDevice(const QString source)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Source" << source;
|
|
||||||
|
|
||||||
QRegExp diskRegexp = QRegExp(QString("disk/(?:md|sd|hd)[a-z|0-9]_.*/Rate/(?:rblk)"));
|
|
||||||
QRegExp fanRegexp = QRegExp(QString("lmsensors/.*/fan.*"));
|
|
||||||
QRegExp mountRegexp = QRegExp(QString("partitions/.*/filllevel"));
|
|
||||||
QRegExp tempRegexp = QRegExp(QString("lmsensors/.*temp.*/.*"));
|
|
||||||
|
|
||||||
if (diskRegexp.indexIn(source) > -1) {
|
|
||||||
QStringList splitSource = source.split(QChar('/'));
|
|
||||||
QString device = splitSource[0] + QString("/") + splitSource[1];
|
|
||||||
diskDevices.append(device);
|
|
||||||
} else if (fanRegexp.indexIn(source) > -1)
|
|
||||||
fanDevices.append(source);
|
|
||||||
else if (mountRegexp.indexIn(source) > -1) {
|
|
||||||
QString device = source;
|
|
||||||
device.remove(QString("partitions")).remove(QString("/filllevel"));
|
|
||||||
mountDevices.append(device);
|
|
||||||
} else if (tempRegexp.indexIn(source) > -1)
|
|
||||||
tempDevices.append(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString AWActions::getAboutText(const QString type)
|
QString AWActions::getAboutText(const QString type)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -173,74 +135,6 @@ QString AWActions::getAboutText(const QString type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QStringList AWActions::getDiskDevices()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
diskDevices.sort();
|
|
||||||
|
|
||||||
return diskDevices;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList AWActions::getFanDevices()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
fanDevices.sort();
|
|
||||||
|
|
||||||
return fanDevices;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList AWActions::getHddDevices()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QStringList allDevices = QDir(QString("/dev")).entryList(QDir::System, QDir::Name);
|
|
||||||
QStringList devices = allDevices.filter(QRegExp(QString("^[hms]d[a-z]$")));
|
|
||||||
for (int i=0; i<devices.count(); i++)
|
|
||||||
devices[i] = QString("/dev/") + devices[i];
|
|
||||||
devices.sort();
|
|
||||||
|
|
||||||
return devices;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList AWActions::getMountDevices()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
mountDevices.sort();
|
|
||||||
|
|
||||||
return mountDevices;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList AWActions::getNetworkDevices()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QStringList interfaceList;
|
|
||||||
QList<QNetworkInterface> rawInterfaceList = QNetworkInterface::allInterfaces();
|
|
||||||
for (int i=0; i<rawInterfaceList.count(); i++)
|
|
||||||
interfaceList.append(rawInterfaceList[i].name());
|
|
||||||
interfaceList.sort();
|
|
||||||
|
|
||||||
return interfaceList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList AWActions::getTempDevices()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
tempDevices.sort();
|
|
||||||
|
|
||||||
return tempDevices;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVariant> AWActions::getFont(const QMap<QString, QVariant> defaultFont)
|
QMap<QString, QVariant> AWActions::getFont(const QMap<QString, QVariant> defaultFont)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -308,38 +202,20 @@ QMap<QString, QVariant> AWActions::readDataEngineConfiguration()
|
|||||||
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-extsysmon.conf"));
|
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-extsysmon.conf"));
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||||
QSettings settings(fileName, QSettings::IniFormat);
|
QSettings settings(fileName, QSettings::IniFormat);
|
||||||
QMap<QString, QVariant> rawConfig;
|
QMap<QString, QVariant> configuration;
|
||||||
|
|
||||||
settings.beginGroup(QString("Configuration"));
|
settings.beginGroup(QString("Configuration"));
|
||||||
rawConfig[QString("ACPIPATH")] = settings.value(QString("ACPIPATH"), QString("/sys/class/power_supply/"));
|
configuration[QString("ACPIPATH")] = settings.value(QString("ACPIPATH"), QString("/sys/class/power_supply/"));
|
||||||
rawConfig[QString("GPUDEV")] = settings.value(QString("GPUDEV"), QString("auto"));
|
configuration[QString("GPUDEV")] = settings.value(QString("GPUDEV"), QString("auto"));
|
||||||
rawConfig[QString("HDDDEV")] = settings.value(QString("HDDDEV"), QString("all"));
|
configuration[QString("HDDDEV")] = settings.value(QString("HDDDEV"), QString("all"));
|
||||||
rawConfig[QString("HDDTEMPCMD")] = settings.value(QString("HDDTEMPCMD"), QString("sudo hddtemp"));
|
configuration[QString("HDDTEMPCMD")] = settings.value(QString("HDDTEMPCMD"), QString("sudo hddtemp"));
|
||||||
rawConfig[QString("MPDADDRESS")] = settings.value(QString("MPDADDRESS"), QString("localhost"));
|
configuration[QString("MPDADDRESS")] = settings.value(QString("MPDADDRESS"), QString("localhost"));
|
||||||
rawConfig[QString("MPDPORT")] = settings.value(QString("MPDPORT"), QString("6600"));
|
configuration[QString("MPDPORT")] = settings.value(QString("MPDPORT"), QString("6600"));
|
||||||
rawConfig[QString("MPRIS")] = settings.value(QString("MPRIS"), QString("auto"));
|
configuration[QString("MPRIS")] = settings.value(QString("MPRIS"), QString("auto"));
|
||||||
rawConfig[QString("PKGCMD")] = settings.value(QString("PKGCMD"), QString("pacman -Qu"));
|
configuration[QString("PLAYER")] = settings.value(QString("PLAYER"), QString("mpris"));
|
||||||
rawConfig[QString("PKGNULL")] = settings.value(QString("PKGNULL"), QString("0"));
|
|
||||||
rawConfig[QString("PLAYER")] = settings.value(QString("PLAYER"), QString("mpris"));
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
return updateDataEngineConfiguration(rawConfig);
|
return configuration;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVariant> AWActions::updateDataEngineConfiguration(QMap<QString, QVariant> rawConfig)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
for (int i=rawConfig[QString("PKGNULL")].toString().split(QString(","), QString::SkipEmptyParts).count();
|
|
||||||
i<rawConfig[QString("PKGCMD")].toString().split(QString(","), QString::SkipEmptyParts).count();
|
|
||||||
i++)
|
|
||||||
rawConfig[QString("PKGNULL")].toString() += QString(",0");
|
|
||||||
|
|
||||||
for (int i=0; i<rawConfig.keys().count(); i++)
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" <<
|
|
||||||
rawConfig.keys()[i] << QString("=") << rawConfig[rawConfig.keys()[i]];
|
|
||||||
return rawConfig;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -358,8 +234,6 @@ void AWActions::writeDataEngineConfiguration(const QMap<QString, QVariant> confi
|
|||||||
settings.setValue(QString("MPDADDRESS"), configuration[QString("MPDADDRESS")]);
|
settings.setValue(QString("MPDADDRESS"), configuration[QString("MPDADDRESS")]);
|
||||||
settings.setValue(QString("MPDPORT"), configuration[QString("MPDPORT")]);
|
settings.setValue(QString("MPDPORT"), configuration[QString("MPDPORT")]);
|
||||||
settings.setValue(QString("MPRIS"), configuration[QString("MPRIS")]);
|
settings.setValue(QString("MPRIS"), configuration[QString("MPRIS")]);
|
||||||
settings.setValue(QString("PKGCMD"), configuration[QString("PKGCMD")]);
|
|
||||||
settings.setValue(QString("PKGNULL"), configuration[QString("PKGNULL")]);
|
|
||||||
settings.setValue(QString("PLAYER"), configuration[QString("PLAYER")]);
|
settings.setValue(QString("PLAYER"), configuration[QString("PLAYER")]);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
|
@ -34,22 +34,13 @@ public:
|
|||||||
AWActions(QObject *parent = 0);
|
AWActions(QObject *parent = 0);
|
||||||
~AWActions();
|
~AWActions();
|
||||||
|
|
||||||
Q_INVOKABLE bool checkKeys(const QMap<QString, QVariant> data);
|
|
||||||
Q_INVOKABLE void checkUpdates();
|
Q_INVOKABLE void checkUpdates();
|
||||||
Q_INVOKABLE void runCmd(const QString cmd = QString("/usr/bin/true"));
|
Q_INVOKABLE void runCmd(const QString cmd = QString("/usr/bin/true"));
|
||||||
Q_INVOKABLE void sendNotification(const QString eventId, const QString message);
|
Q_INVOKABLE void sendNotification(const QString eventId, const QString message);
|
||||||
Q_INVOKABLE void showReadme();
|
Q_INVOKABLE void showReadme();
|
||||||
// configuration slots
|
// configuration slots
|
||||||
Q_INVOKABLE void addDevice(const QString source);
|
|
||||||
Q_INVOKABLE QString getAboutText(const QString type = "header");
|
Q_INVOKABLE QString getAboutText(const QString type = "header");
|
||||||
Q_INVOKABLE QStringList getDiskDevices();
|
|
||||||
Q_INVOKABLE QStringList getFanDevices();
|
|
||||||
Q_INVOKABLE QStringList getHddDevices();
|
|
||||||
Q_INVOKABLE QStringList getMountDevices();
|
|
||||||
Q_INVOKABLE QStringList getNetworkDevices();
|
|
||||||
Q_INVOKABLE QStringList getTempDevices();
|
|
||||||
Q_INVOKABLE QMap<QString, QVariant> getFont(const QMap<QString, QVariant> defaultFont);
|
Q_INVOKABLE QMap<QString, QVariant> getFont(const QMap<QString, QVariant> defaultFont);
|
||||||
Q_INVOKABLE QString selectDevices(const QStringList source, const QStringList current);
|
|
||||||
// dataengine
|
// dataengine
|
||||||
Q_INVOKABLE QMap<QString, QVariant> readDataEngineConfiguration();
|
Q_INVOKABLE QMap<QString, QVariant> readDataEngineConfiguration();
|
||||||
Q_INVOKABLE void writeDataEngineConfiguration(const QMap<QString, QVariant> configuration);
|
Q_INVOKABLE void writeDataEngineConfiguration(const QMap<QString, QVariant> configuration);
|
||||||
@ -59,10 +50,8 @@ private slots:
|
|||||||
void versionReplyRecieved(QNetworkReply *reply);
|
void versionReplyRecieved(QNetworkReply *reply);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<QString, QVariant> updateDataEngineConfiguration(QMap<QString, QVariant> rawConfig);
|
|
||||||
// variables
|
// variables
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
QStringList diskDevices, fanDevices, mountDevices, tempDevices;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,12 +66,29 @@ AWKeys::~AWKeys()
|
|||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
delete toolTip;
|
||||||
|
delete createButton;
|
||||||
|
delete copyButton;
|
||||||
|
delete dialogButtons;
|
||||||
|
delete widgetDialog;
|
||||||
delete dialog;
|
delete dialog;
|
||||||
|
|
||||||
|
graphicalItems.clear();
|
||||||
|
extScripts.clear();
|
||||||
|
extUpgrade.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool AWKeys::checkKeys(const QMap<QString, QVariant> data)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Data" << data;
|
||||||
|
|
||||||
|
return (data.count() != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AWKeys::initKeys(const QString pattern,
|
void AWKeys::initKeys(const QString pattern,
|
||||||
const QMap<QString, QVariant> params,
|
|
||||||
const QMap<QString, QVariant> tooltipParams)
|
const QMap<QString, QVariant> tooltipParams)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -80,7 +97,6 @@ void AWKeys::initKeys(const QString pattern,
|
|||||||
extScripts.clear();
|
extScripts.clear();
|
||||||
extUpgrade.clear();
|
extUpgrade.clear();
|
||||||
graphicalItems.clear();
|
graphicalItems.clear();
|
||||||
counts.clear();
|
|
||||||
keys.clear();
|
keys.clear();
|
||||||
foundBars.clear();
|
foundBars.clear();
|
||||||
foundKeys.clear();
|
foundKeys.clear();
|
||||||
@ -90,7 +106,6 @@ void AWKeys::initKeys(const QString pattern,
|
|||||||
extScripts = getExtScripts();
|
extScripts = getExtScripts();
|
||||||
extUpgrade = getExtUpgrade();
|
extUpgrade = getExtUpgrade();
|
||||||
graphicalItems = getGraphicalItems();
|
graphicalItems = getGraphicalItems();
|
||||||
counts = getCounts(params);
|
|
||||||
keys = dictKeys();
|
keys = dictKeys();
|
||||||
foundBars = findGraphicalItems(pattern);
|
foundBars = findGraphicalItems(pattern);
|
||||||
foundKeys = findKeys(pattern);
|
foundKeys = findKeys(pattern);
|
||||||
@ -108,17 +123,10 @@ bool AWKeys::isDebugEnabled()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool AWKeys::isReady()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
return ready;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString AWKeys::parsePattern(const QString pattern)
|
QString AWKeys::parsePattern(const QString pattern)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (!ready) return pattern;
|
||||||
|
|
||||||
QString parsed = pattern;
|
QString parsed = pattern;
|
||||||
parsed.replace(QString("$$"), QString("$\\$\\"));
|
parsed.replace(QString("$$"), QString("$\\$\\"));
|
||||||
@ -140,6 +148,31 @@ QPixmap AWKeys::toolTipImage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AWKeys::addDevice(const QString source)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Source" << source;
|
||||||
|
|
||||||
|
QRegExp diskRegexp = QRegExp(QString("disk/(?:md|sd|hd)[a-z|0-9]_.*/Rate/(?:rblk)"));
|
||||||
|
QRegExp fanRegexp = QRegExp(QString("lmsensors/.*/fan.*"));
|
||||||
|
QRegExp mountRegexp = QRegExp(QString("partitions/.*/filllevel"));
|
||||||
|
QRegExp tempRegexp = QRegExp(QString("lmsensors/.*temp.*/.*"));
|
||||||
|
|
||||||
|
if (diskRegexp.indexIn(source) > -1) {
|
||||||
|
QString device = source;
|
||||||
|
device.remove(QString("/Rate/rblk"));
|
||||||
|
diskDevices.append(device);
|
||||||
|
} else if (fanRegexp.indexIn(source) > -1)
|
||||||
|
fanDevices.append(source);
|
||||||
|
else if (mountRegexp.indexIn(source) > -1) {
|
||||||
|
QString device = source;
|
||||||
|
device.remove(QString("partitions")).remove(QString("/filllevel"));
|
||||||
|
mountDevices.append(device);
|
||||||
|
} else if (tempRegexp.indexIn(source) > -1)
|
||||||
|
tempDevices.append(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QStringList AWKeys::dictKeys()
|
QStringList AWKeys::dictKeys()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -155,17 +188,17 @@ QStringList AWKeys::dictKeys()
|
|||||||
allKeys.append(QString("uptime"));
|
allKeys.append(QString("uptime"));
|
||||||
allKeys.append(QString("cuptime"));
|
allKeys.append(QString("cuptime"));
|
||||||
// cpuclock
|
// cpuclock
|
||||||
for (int i=counts[QString("cpu")].toInt()-1; i>=0; i--)
|
for (int i=numberCpus()-1; i>=0; i--)
|
||||||
allKeys.append(QString("cpucl") + QString::number(i));
|
allKeys.append(QString("cpucl") + QString::number(i));
|
||||||
allKeys.append(QString("cpucl"));
|
allKeys.append(QString("cpucl"));
|
||||||
// cpu
|
// cpu
|
||||||
for (int i=counts[QString("cpu")].toInt()-1; i>=0; i--)
|
for (int i=numberCpus()-1; i>=0; i--)
|
||||||
allKeys.append(QString("cpu") + QString::number(i));
|
allKeys.append(QString("cpu") + QString::number(i));
|
||||||
allKeys.append(QString("cpu"));
|
allKeys.append(QString("cpu"));
|
||||||
// temperature
|
// temperature
|
||||||
for (int i=counts[QString("temp")].toInt()-1; i>=0; i--)
|
for (int i=tempDevices.count()-1; i>=0; i--)
|
||||||
allKeys.append(QString("temp") + QString::number(i));
|
allKeys.append(QString("temp") + QString::number(i));
|
||||||
for (int i=counts[QString("fan")].toInt()-1; i>=0; i--)
|
for (int i=fanDevices.count()-1; i>=0; i--)
|
||||||
allKeys.append(QString("fan") + QString::number(i));
|
allKeys.append(QString("fan") + QString::number(i));
|
||||||
// gputemp
|
// gputemp
|
||||||
allKeys.append(QString("gputemp"));
|
allKeys.append(QString("gputemp"));
|
||||||
@ -190,7 +223,7 @@ QStringList AWKeys::dictKeys()
|
|||||||
allKeys.append(QString("swaptotgb"));
|
allKeys.append(QString("swaptotgb"));
|
||||||
allKeys.append(QString("swap"));
|
allKeys.append(QString("swap"));
|
||||||
// hdd
|
// hdd
|
||||||
for (int i=counts[QString("mount")].toInt()-1; i>=0; i--) {
|
for (int i=mountDevices.count()-1; i>=0; i--) {
|
||||||
allKeys.append(QString("hddmb") + QString::number(i));
|
allKeys.append(QString("hddmb") + QString::number(i));
|
||||||
allKeys.append(QString("hddgb") + QString::number(i));
|
allKeys.append(QString("hddgb") + QString::number(i));
|
||||||
allKeys.append(QString("hddfreemb") + QString::number(i));
|
allKeys.append(QString("hddfreemb") + QString::number(i));
|
||||||
@ -200,12 +233,12 @@ QStringList AWKeys::dictKeys()
|
|||||||
allKeys.append(QString("hdd") + QString::number(i));
|
allKeys.append(QString("hdd") + QString::number(i));
|
||||||
}
|
}
|
||||||
// hdd speed
|
// hdd speed
|
||||||
for (int i=counts[QString("disk")].toInt()-1; i>=0; i--) {
|
for (int i=diskDevices.count()-1; i>=0; i--) {
|
||||||
allKeys.append(QString("hddr") + QString::number(i));
|
allKeys.append(QString("hddr") + QString::number(i));
|
||||||
allKeys.append(QString("hddw") + QString::number(i));
|
allKeys.append(QString("hddw") + QString::number(i));
|
||||||
}
|
}
|
||||||
// hdd temp
|
// hdd temp
|
||||||
for (int i=counts[QString("hddtemp")].toInt()-1; i>=0; i--) {
|
for (int i=getHddDevices.count()-1; i>=0; i--) {
|
||||||
allKeys.append(QString("hddtemp") + QString::number(i));
|
allKeys.append(QString("hddtemp") + QString::number(i));
|
||||||
allKeys.append(QString("hddtemp") + QString::number(i));
|
allKeys.append(QString("hddtemp") + QString::number(i));
|
||||||
}
|
}
|
||||||
@ -215,7 +248,10 @@ QStringList AWKeys::dictKeys()
|
|||||||
allKeys.append(QString("netdev"));
|
allKeys.append(QString("netdev"));
|
||||||
// battery
|
// battery
|
||||||
allKeys.append(QString("ac"));
|
allKeys.append(QString("ac"));
|
||||||
for (int i=counts[QString("bat")].toInt()-1; i>=0; i--)
|
QStringList allBatteryDevices = QDir(QString("/sys/class/power_supply"))
|
||||||
|
.entryList(QDir::Dirs | QDir::NoDotAndDotDot,
|
||||||
|
QDir::Name);
|
||||||
|
for (int i=allBatteryDevices.filter(QRegExp(QString("BAT.*"))).count()-1; i>=0; i--)
|
||||||
allKeys.append(QString("bat") + QString::number(i));
|
allKeys.append(QString("bat") + QString::number(i));
|
||||||
allKeys.append(QString("bat"));
|
allKeys.append(QString("bat"));
|
||||||
// player
|
// player
|
||||||
@ -229,10 +265,10 @@ QStringList AWKeys::dictKeys()
|
|||||||
allKeys.append(QString("pstotal"));
|
allKeys.append(QString("pstotal"));
|
||||||
allKeys.append(QString("ps"));
|
allKeys.append(QString("ps"));
|
||||||
// package manager
|
// package manager
|
||||||
for (int i=counts[QString("pkg")].toInt()-1; i>=0; i--)
|
for (int i=extUpgrade.count()-1; i>=0; i--)
|
||||||
allKeys.append(QString("pkgcount") + QString::number(i));
|
allKeys.append(QString("pkgcount") + QString::number(i));
|
||||||
// custom
|
// custom
|
||||||
for (int i=counts[QString("custom")].toInt()-1; i>=0; i--)
|
for (int i=extScripts.count()-1; i>=0; i--)
|
||||||
allKeys.append(QString("custom") + QString::number(i));
|
allKeys.append(QString("custom") + QString::number(i));
|
||||||
// desktop
|
// desktop
|
||||||
allKeys.append(QString("desktop"));
|
allKeys.append(QString("desktop"));
|
||||||
@ -243,6 +279,74 @@ QStringList AWKeys::dictKeys()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QStringList AWKeys::getDiskDevices()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
diskDevices.sort();
|
||||||
|
|
||||||
|
return diskDevices;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QStringList AWKeys::getFanDevices()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
fanDevices.sort();
|
||||||
|
|
||||||
|
return fanDevices;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QStringList AWKeys::getHddDevices()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QStringList allDevices = QDir(QString("/dev")).entryList(QDir::System, QDir::Name);
|
||||||
|
QStringList devices = allDevices.filter(QRegExp(QString("^[hms]d[a-z]$")));
|
||||||
|
for (int i=0; i<devices.count(); i++)
|
||||||
|
devices[i] = QString("/dev/") + devices[i];
|
||||||
|
devices.sort();
|
||||||
|
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QStringList AWKeys::getMountDevices()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
mountDevices.sort();
|
||||||
|
|
||||||
|
return mountDevices;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QStringList AWKeys::getNetworkDevices()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QStringList interfaceList;
|
||||||
|
QList<QNetworkInterface> rawInterfaceList = QNetworkInterface::allInterfaces();
|
||||||
|
for (int i=0; i<rawInterfaceList.count(); i++)
|
||||||
|
interfaceList.append(rawInterfaceList[i].name());
|
||||||
|
interfaceList.sort();
|
||||||
|
|
||||||
|
return interfaceList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QStringList AWKeys::getTempDevices()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
tempDevices.sort();
|
||||||
|
|
||||||
|
return tempDevices;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void AWKeys::setDataBySource(const QString sourceName,
|
void AWKeys::setDataBySource(const QString sourceName,
|
||||||
const QMap<QString, QVariant> data,
|
const QMap<QString, QVariant> data,
|
||||||
const QMap<QString, QVariant> params)
|
const QMap<QString, QVariant> params)
|
||||||
@ -250,6 +354,10 @@ void AWKeys::setDataBySource(const QString sourceName,
|
|||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Source" << sourceName;
|
if (debug) qDebug() << PDEBUG << ":" << "Source" << sourceName;
|
||||||
|
|
||||||
|
// checking
|
||||||
|
if (!checkKeys(data)) return;
|
||||||
|
if (!ready) return;
|
||||||
|
|
||||||
// regular expressions
|
// regular expressions
|
||||||
QRegExp cpuRegExp = QRegExp(QString("cpu/cpu.*/TotalLoad"));
|
QRegExp cpuRegExp = QRegExp(QString("cpu/cpu.*/TotalLoad"));
|
||||||
QRegExp cpuclRegExp = QRegExp(QString("cpu/cpu.*/clock"));
|
QRegExp cpuclRegExp = QRegExp(QString("cpu/cpu.*/clock"));
|
||||||
@ -307,7 +415,7 @@ void AWKeys::setDataBySource(const QString sourceName,
|
|||||||
// read speed
|
// read speed
|
||||||
QString device = sourceName;
|
QString device = sourceName;
|
||||||
device.remove(QString("/Rate/rblk"));
|
device.remove(QString("/Rate/rblk"));
|
||||||
for (int i=0; i<counts[QString("disk")].toInt(); i++)
|
for (int i=0; i<diskDevices.count(); i++)
|
||||||
if (params[QString("disk")].toString().split(QString("@@"))[i] == device) {
|
if (params[QString("disk")].toString().split(QString("@@"))[i] == device) {
|
||||||
values[QString("hddr") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 0);
|
values[QString("hddr") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 0);
|
||||||
break;
|
break;
|
||||||
@ -316,7 +424,7 @@ void AWKeys::setDataBySource(const QString sourceName,
|
|||||||
// write speed
|
// write speed
|
||||||
QString device = sourceName;
|
QString device = sourceName;
|
||||||
device.remove(QString("/Rate/wblk"));
|
device.remove(QString("/Rate/wblk"));
|
||||||
for (int i=0; i<counts[QString("disk")].toInt(); i++)
|
for (int i=0; i<diskDevices.count(); i++)
|
||||||
if (params[QString("disk")].toString().split(QString("@@"))[i] == device) {
|
if (params[QString("disk")].toString().split(QString("@@"))[i] == device) {
|
||||||
values[QString("hddw") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 0);
|
values[QString("hddw") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 0);
|
||||||
break;
|
break;
|
||||||
@ -332,7 +440,7 @@ void AWKeys::setDataBySource(const QString sourceName,
|
|||||||
// fill level
|
// fill level
|
||||||
QString mount = sourceName;
|
QString mount = sourceName;
|
||||||
mount.remove(QString("partitions")).remove(QString("/filllevel"));
|
mount.remove(QString("partitions")).remove(QString("/filllevel"));
|
||||||
for (int i=0; i<counts[QString("mount")].toInt(); i++)
|
for (int i=0; i<mountDevices.count(); i++)
|
||||||
if (params[QString("mount")].toString().split(QString("@@"))[i] == mount) {
|
if (params[QString("mount")].toString().split(QString("@@"))[i] == mount) {
|
||||||
values[QString("hdd") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
|
values[QString("hdd") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
|
||||||
break;
|
break;
|
||||||
@ -341,7 +449,7 @@ void AWKeys::setDataBySource(const QString sourceName,
|
|||||||
// free space
|
// free space
|
||||||
QString mount = sourceName;
|
QString mount = sourceName;
|
||||||
mount.remove(QString("partitions")).remove(QString("/freespace"));
|
mount.remove(QString("partitions")).remove(QString("/freespace"));
|
||||||
for (int i=0; i<counts[QString("mount")].toInt(); i++)
|
for (int i=0; i<mountDevices.count(); i++)
|
||||||
if (params[QString("mount")].toString().split(QString("@@"))[i] == mount) {
|
if (params[QString("mount")].toString().split(QString("@@"))[i] == mount) {
|
||||||
values[QString("hddfreemb") + QString::number(i)] = QString("%1").arg(
|
values[QString("hddfreemb") + QString::number(i)] = QString("%1").arg(
|
||||||
data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
||||||
@ -353,7 +461,7 @@ void AWKeys::setDataBySource(const QString sourceName,
|
|||||||
// used
|
// used
|
||||||
QString mount = sourceName;
|
QString mount = sourceName;
|
||||||
mount.remove(QString("partitions")).remove(QString("/usedspace"));
|
mount.remove(QString("partitions")).remove(QString("/usedspace"));
|
||||||
for (int i=0; i<counts[QString("mount")].toInt(); i++)
|
for (int i=0; i<mountDevices.count(); i++)
|
||||||
if (params[QString("mount")].toString().split(QString("@@"))[i] == mount) {
|
if (params[QString("mount")].toString().split(QString("@@"))[i] == mount) {
|
||||||
values[QString("hddmb") + QString::number(i)] = QString("%1").arg(
|
values[QString("hddmb") + QString::number(i)] = QString("%1").arg(
|
||||||
data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
||||||
@ -371,7 +479,7 @@ void AWKeys::setDataBySource(const QString sourceName,
|
|||||||
} else if (sourceName == QString("hddtemp")) {
|
} else if (sourceName == QString("hddtemp")) {
|
||||||
// hdd temperature
|
// hdd temperature
|
||||||
for (int i=0; i<data.keys().count(); i++)
|
for (int i=0; i<data.keys().count(); i++)
|
||||||
for (int j=0; j<counts[QString("hddtemp")].toInt(); j++)
|
for (int j=0; j<getHddDevices().count(); j++)
|
||||||
if (data.keys()[i] == params[QString("hdd")].toString().split(QString("@@"))[j]) {
|
if (data.keys()[i] == params[QString("hdd")].toString().split(QString("@@"))[j]) {
|
||||||
values[QString("hddtemp") + QString::number(j)] = QString("%1").arg(
|
values[QString("hddtemp") + QString::number(j)] = QString("%1").arg(
|
||||||
temperature(data[data.keys()[i]].toFloat(), params[QString("tempUnits")].toString()), 4, 'f', 1);
|
temperature(data[data.keys()[i]].toFloat(), params[QString("tempUnits")].toString()), 4, 'f', 1);
|
||||||
@ -405,7 +513,7 @@ void AWKeys::setDataBySource(const QString sourceName,
|
|||||||
// download speed
|
// download speed
|
||||||
QString device = sourceName;
|
QString device = sourceName;
|
||||||
device.remove(QString("network/interfaces/")).remove(QString("/receiver/data"));
|
device.remove(QString("network/interfaces/")).remove(QString("/receiver/data"));
|
||||||
if (device == networkDevice(params[QString("customNetdev")].toString())) {
|
if (device == networkDevice()) {
|
||||||
values[QString("down")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
values[QString("down")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
||||||
toolTip->setData(QString("down"), data[QString("value")].toFloat());
|
toolTip->setData(QString("down"), data[QString("value")].toFloat());
|
||||||
}
|
}
|
||||||
@ -413,7 +521,7 @@ void AWKeys::setDataBySource(const QString sourceName,
|
|||||||
// upload speed
|
// upload speed
|
||||||
QString device = sourceName;
|
QString device = sourceName;
|
||||||
device.remove(QString("network/interfaces/")).remove(QString("/transmitter/data"));
|
device.remove(QString("network/interfaces/")).remove(QString("/transmitter/data"));
|
||||||
if (device == networkDevice(params[QString("customNetdev")].toString())) {
|
if (device == networkDevice()) {
|
||||||
values[QString("up")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
values[QString("up")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
||||||
toolTip->setData(QString("up"), data[QString("value")].toFloat());
|
toolTip->setData(QString("up"), data[QString("value")].toFloat());
|
||||||
}
|
}
|
||||||
@ -453,13 +561,13 @@ void AWKeys::setDataBySource(const QString sourceName,
|
|||||||
} else if (sourceName.contains(tempRegExp)) {
|
} else if (sourceName.contains(tempRegExp)) {
|
||||||
// temperature devices
|
// temperature devices
|
||||||
if (data[QString("units")].toString() == QString("rpm")) {
|
if (data[QString("units")].toString() == QString("rpm")) {
|
||||||
for (int i=0; i<counts[QString("fan")].toInt(); i++)
|
for (int i=0; i<fanDevices.count(); i++)
|
||||||
if (sourceName == params[QString("fanDevice")].toString().split(QString("@@"))[i]) {
|
if (sourceName == params[QString("fanDevice")].toString().split(QString("@@"))[i]) {
|
||||||
values[QString("fan") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 1);
|
values[QString("fan") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i=0; i<counts[QString("temp")].toInt(); i++)
|
for (int i=0; i<tempDevices.count(); i++)
|
||||||
if (sourceName == params[QString("tempDevice")].toString().split(QString("@@"))[i]) {
|
if (sourceName == params[QString("tempDevice")].toString().split(QString("@@"))[i]) {
|
||||||
values[QString("temp") + QString::number(i)] = QString("%1").arg(
|
values[QString("temp") + QString::number(i)] = QString("%1").arg(
|
||||||
temperature(data[QString("value")].toFloat(), params[QString("tempUnits")].toString()), 4, 'f', 1);
|
temperature(data[QString("value")].toFloat(), params[QString("tempUnits")].toString()), 4, 'f', 1);
|
||||||
@ -496,6 +604,23 @@ void AWKeys::setDataBySource(const QString sourceName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString AWKeys::graphicalValueByKey()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
bool ok;
|
||||||
|
QString tag = QInputDialog::getItem(0, i18n("Select tag"),
|
||||||
|
i18n("Tag"), keys, 0, false, &ok);
|
||||||
|
|
||||||
|
if ((!ok) || (tag.isEmpty())) return QString("");
|
||||||
|
QString message = i18n("Tag: %1", tag);
|
||||||
|
message += QString("<br>");
|
||||||
|
message += i18n("Value: %1", valueByKey(tag));
|
||||||
|
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString AWKeys::valueByKey(QString key)
|
QString AWKeys::valueByKey(QString key)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -638,7 +763,7 @@ void AWKeys::copyBar(const QString original)
|
|||||||
if (exit) break;
|
if (exit) break;
|
||||||
}
|
}
|
||||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||||
QString("plasma_applet_awesome-widget/desktops"),
|
QString("awesomewidgets/desktops"),
|
||||||
QStandardPaths::LocateDirectory);
|
QStandardPaths::LocateDirectory);
|
||||||
bool ok;
|
bool ok;
|
||||||
QString name = QInputDialog::getText(0, i18n("Enter file name"),
|
QString name = QInputDialog::getText(0, i18n("Enter file name"),
|
||||||
@ -685,7 +810,7 @@ void AWKeys::copyScript(const QString original)
|
|||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||||
QString("plasma_dataengine_extsysmon/scripts"),
|
QString("awesomewidgets/scripts"),
|
||||||
QStandardPaths::LocateDirectory);
|
QStandardPaths::LocateDirectory);
|
||||||
bool ok;
|
bool ok;
|
||||||
QString name = QInputDialog::getText(0, i18n("Enter file name"),
|
QString name = QInputDialog::getText(0, i18n("Enter file name"),
|
||||||
@ -724,7 +849,7 @@ void AWKeys::copyUpgrade(const QString original)
|
|||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||||
QString("plasma_dataengine_extsysmon/upgrade"),
|
QString("awesomewidgets/upgrade"),
|
||||||
QStandardPaths::LocateDirectory);
|
QStandardPaths::LocateDirectory);
|
||||||
bool ok;
|
bool ok;
|
||||||
QString name = QInputDialog::getText(0, i18n("Enter file name"),
|
QString name = QInputDialog::getText(0, i18n("Enter file name"),
|
||||||
@ -755,13 +880,11 @@ void AWKeys::copyUpgrade(const QString original)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString AWKeys::networkDevice(const QString custom)
|
QString AWKeys::networkDevice()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Custom device" << custom;
|
|
||||||
|
|
||||||
QString device = QString("lo");
|
QString device = QString("lo");
|
||||||
if (custom.isEmpty()) {
|
|
||||||
QList<QNetworkInterface> rawInterfaceList = QNetworkInterface::allInterfaces();
|
QList<QNetworkInterface> rawInterfaceList = QNetworkInterface::allInterfaces();
|
||||||
for (int i=0; i<rawInterfaceList.count(); i++)
|
for (int i=0; i<rawInterfaceList.count(); i++)
|
||||||
if ((rawInterfaceList[i].flags().testFlag(QNetworkInterface::IsUp)) &&
|
if ((rawInterfaceList[i].flags().testFlag(QNetworkInterface::IsUp)) &&
|
||||||
@ -769,9 +892,8 @@ QString AWKeys::networkDevice(const QString custom)
|
|||||||
(!rawInterfaceList[i].flags().testFlag(QNetworkInterface::IsPointToPoint))) {
|
(!rawInterfaceList[i].flags().testFlag(QNetworkInterface::IsPointToPoint))) {
|
||||||
device = rawInterfaceList[i].name();
|
device = rawInterfaceList[i].name();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
device = custom;
|
|
||||||
|
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
@ -842,24 +964,6 @@ QStringList AWKeys::findKeys(const QString pattern)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVariant> AWKeys::getCounts(const QMap<QString, QVariant> params)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QMap<QString, QVariant> awCounts;
|
|
||||||
awCounts[QString("cpu")] = numberCpus();
|
|
||||||
awCounts[QString("custom")] = extScripts.count();
|
|
||||||
awCounts[QString("disk")] = params[QString("disk")].toString().split(QString("@@")).count();
|
|
||||||
awCounts[QString("fan")] = params[QString("fanDevice")].toString().split(QString("@@")).count();
|
|
||||||
awCounts[QString("hddtemp")] = params[QString("hdd")].toString().split(QString("@@")).count();
|
|
||||||
awCounts[QString("mount")] = params[QString("mount")].toString().split(QString("@@")).count();
|
|
||||||
awCounts[QString("pkg")] = extUpgrade.count();
|
|
||||||
awCounts[QString("temp")] = params[QString("tempDevice")].toString().split(QString("@@")).count();
|
|
||||||
|
|
||||||
return awCounts;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QList<ExtScript *> AWKeys::getExtScripts()
|
QList<ExtScript *> AWKeys::getExtScripts()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -867,13 +971,13 @@ QList<ExtScript *> AWKeys::getExtScripts()
|
|||||||
QList<ExtScript *> externalScripts;
|
QList<ExtScript *> externalScripts;
|
||||||
// create directory at $HOME
|
// create directory at $HOME
|
||||||
QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||||
QString("/plasma_dataengine_extsysmon/scripts");
|
QString("/awesomewidgets/scripts");
|
||||||
QDir localDirectory;
|
QDir localDirectory;
|
||||||
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||||
|
|
||||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||||
QString("plasma_dataengine_extsysmon/scripts"),
|
QString("awesomewidgets/scripts"),
|
||||||
QStandardPaths::LocateDirectory);
|
QStandardPaths::LocateDirectory);
|
||||||
QStringList names;
|
QStringList names;
|
||||||
for (int i=0; i<dirs.count(); i++) {
|
for (int i=0; i<dirs.count(); i++) {
|
||||||
@ -898,13 +1002,13 @@ QList<ExtUpgrade *> AWKeys::getExtUpgrade()
|
|||||||
QList<ExtUpgrade *> externalUpgrade;
|
QList<ExtUpgrade *> externalUpgrade;
|
||||||
// create directory at $HOME
|
// create directory at $HOME
|
||||||
QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||||
QString("/plasma_dataengine_extsysmon/upgrade");
|
QString("/awesomewidgets/upgrade");
|
||||||
QDir localDirectory;
|
QDir localDirectory;
|
||||||
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||||
|
|
||||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||||
QString("plasma_dataengine_extsysmon/upgrade"),
|
QString("awesomewidgets/upgrade"),
|
||||||
QStandardPaths::LocateDirectory);
|
QStandardPaths::LocateDirectory);
|
||||||
QStringList names;
|
QStringList names;
|
||||||
for (int i=0; i<dirs.count(); i++) {
|
for (int i=0; i<dirs.count(); i++) {
|
||||||
@ -929,13 +1033,13 @@ QList<GraphicalItem *> AWKeys::getGraphicalItems()
|
|||||||
QList<GraphicalItem *> items;
|
QList<GraphicalItem *> items;
|
||||||
// create directory at $HOME
|
// create directory at $HOME
|
||||||
QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||||
QString("/plasma_applet_awesome-widget/desktops");
|
QString("/awesomewidgets/desktops");
|
||||||
QDir localDirectory;
|
QDir localDirectory;
|
||||||
if (localDirectory.mkpath(localDir))
|
if (localDirectory.mkpath(localDir))
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||||
|
|
||||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||||
QString("plasma_applet_awesome-widget/desktops"),
|
QString("awesomewidgets/desktops"),
|
||||||
QStandardPaths::LocateDirectory);
|
QStandardPaths::LocateDirectory);
|
||||||
QStringList names;
|
QStringList names;
|
||||||
for (int i=0; i<dirs.count(); i++) {
|
for (int i=0; i<dirs.count(); i++) {
|
||||||
|
@ -50,19 +50,26 @@ public:
|
|||||||
AWKeys(QObject *parent = 0);
|
AWKeys(QObject *parent = 0);
|
||||||
~AWKeys();
|
~AWKeys();
|
||||||
|
|
||||||
|
Q_INVOKABLE bool checkKeys(const QMap<QString, QVariant> data);
|
||||||
Q_INVOKABLE void initKeys(const QString pattern,
|
Q_INVOKABLE void initKeys(const QString pattern,
|
||||||
const QMap<QString, QVariant> params,
|
|
||||||
const QMap<QString, QVariant> tooltipParams);
|
const QMap<QString, QVariant> tooltipParams);
|
||||||
Q_INVOKABLE bool isDebugEnabled();
|
Q_INVOKABLE bool isDebugEnabled();
|
||||||
Q_INVOKABLE bool isReady();
|
|
||||||
Q_INVOKABLE QString parsePattern(const QString pattern);
|
Q_INVOKABLE QString parsePattern(const QString pattern);
|
||||||
Q_INVOKABLE QPixmap toolTipImage();
|
Q_INVOKABLE QPixmap toolTipImage();
|
||||||
// keys
|
// keys
|
||||||
|
Q_INVOKABLE void addDevice(const QString source);
|
||||||
Q_INVOKABLE QStringList dictKeys();
|
Q_INVOKABLE QStringList dictKeys();
|
||||||
|
Q_INVOKABLE QStringList getDiskDevices();
|
||||||
|
Q_INVOKABLE QStringList getFanDevices();
|
||||||
|
Q_INVOKABLE QStringList getHddDevices();
|
||||||
|
Q_INVOKABLE QStringList getMountDevices();
|
||||||
|
Q_INVOKABLE QStringList getNetworkDevices();
|
||||||
|
Q_INVOKABLE QStringList getTempDevices();
|
||||||
Q_INVOKABLE void setDataBySource(const QString sourceName,
|
Q_INVOKABLE void setDataBySource(const QString sourceName,
|
||||||
const QMap<QString, QVariant> data,
|
const QMap<QString, QVariant> data,
|
||||||
const QMap<QString, QVariant> params);
|
const QMap<QString, QVariant> params);
|
||||||
// values
|
// values
|
||||||
|
Q_INVOKABLE QString graphicalValueByKey();
|
||||||
Q_INVOKABLE QString valueByKey(QString key);
|
Q_INVOKABLE QString valueByKey(QString key);
|
||||||
// configuration
|
// configuration
|
||||||
Q_INVOKABLE void editItem(const QString type);
|
Q_INVOKABLE void editItem(const QString type);
|
||||||
@ -75,14 +82,13 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// methods
|
// methods
|
||||||
QString networkDevice(const QString custom = QString(""));
|
QString networkDevice();
|
||||||
int numberCpus();
|
int numberCpus();
|
||||||
float temperature(const float temp, const QString units = QString("Celsius"));
|
float temperature(const float temp, const QString units = QString("Celsius"));
|
||||||
// find methods
|
// find methods
|
||||||
QStringList findGraphicalItems(const QString pattern);
|
QStringList findGraphicalItems(const QString pattern);
|
||||||
QStringList findKeys(const QString pattern);
|
QStringList findKeys(const QString pattern);
|
||||||
// get methods
|
// get methods
|
||||||
QMap<QString, QVariant> getCounts(const QMap<QString, QVariant> params);
|
|
||||||
QList<ExtScript *> getExtScripts();
|
QList<ExtScript *> getExtScripts();
|
||||||
QList<ExtUpgrade *> getExtUpgrade();
|
QList<ExtUpgrade *> getExtUpgrade();
|
||||||
QList<GraphicalItem *> getGraphicalItems();
|
QList<GraphicalItem *> getGraphicalItems();
|
||||||
@ -103,8 +109,8 @@ private:
|
|||||||
QList<ExtScript *> extScripts;
|
QList<ExtScript *> extScripts;
|
||||||
QList<ExtUpgrade *> extUpgrade;
|
QList<ExtUpgrade *> extUpgrade;
|
||||||
QStringList foundBars, foundKeys, keys;
|
QStringList foundBars, foundKeys, keys;
|
||||||
QMap<QString, QVariant> counts;
|
|
||||||
QMap<QString, QString> values;
|
QMap<QString, QString> values;
|
||||||
|
QStringList diskDevices, fanDevices, mountDevices, tempDevices;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,5 +69,5 @@ else ()
|
|||||||
endif ()
|
endif ()
|
||||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
|
||||||
install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})
|
install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})
|
||||||
install (DIRECTORY ${SUBPROJECT_SCRIPTS} DESTINATION ${DATA_INSTALL_DIR}/${PLUGIN_NAME})
|
install (DIRECTORY ${SUBPROJECT_SCRIPTS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||||
install (DIRECTORY ${SUBPROJECT_UPGRADE} DESTINATION ${DATA_INSTALL_DIR}/${PLUGIN_NAME})
|
install (DIRECTORY ${SUBPROJECT_UPGRADE} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||||
|
@ -125,20 +125,20 @@ void ExtendedSysMon::initScripts()
|
|||||||
QString localDir;
|
QString localDir;
|
||||||
QStringList dirs;
|
QStringList dirs;
|
||||||
#ifdef BUILD_KDE4
|
#ifdef BUILD_KDE4
|
||||||
localDir = KStandardDirs::locateLocal("data", "plasma_dataengine_extsysmon/scripts");
|
localDir = KStandardDirs::locateLocal("data", "awesomewidgets/scripts");
|
||||||
if (KStandardDirs::makeDir(localDir))
|
if (KStandardDirs::makeDir(localDir))
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||||
|
|
||||||
dirs = KGlobal::dirs()->findDirs("data", "plasma_dataengine_extsysmon/scripts");
|
dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/scripts");
|
||||||
#else
|
#else
|
||||||
localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||||
QString("/plasma_dataengine_extsysmon/scripts");
|
QString("/awesomewidgets/scripts");
|
||||||
QDir localDirectory;
|
QDir localDirectory;
|
||||||
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||||
|
|
||||||
dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||||
QString("plasma_dataengine_extsysmon/scripts"),
|
QString("awesomewidgets/scripts"),
|
||||||
QStandardPaths::LocateDirectory);
|
QStandardPaths::LocateDirectory);
|
||||||
#endif /* BUILD_KDE4 */
|
#endif /* BUILD_KDE4 */
|
||||||
|
|
||||||
@ -166,20 +166,20 @@ void ExtendedSysMon::initUpgrade()
|
|||||||
QString localDir;
|
QString localDir;
|
||||||
QStringList dirs;
|
QStringList dirs;
|
||||||
#ifdef BUILD_KDE4
|
#ifdef BUILD_KDE4
|
||||||
localDir = KStandardDirs::locateLocal("data", "plasma_dataengine_extsysmon/upgrade");
|
localDir = KStandardDirs::locateLocal("data", "awesomewidgets/upgrade");
|
||||||
if (KStandardDirs::makeDir(localDir))
|
if (KStandardDirs::makeDir(localDir))
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||||
|
|
||||||
dirs = KGlobal::dirs()->findDirs("data", "plasma_dataengine_extsysmon/upgrade");
|
dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/upgrade");
|
||||||
#else
|
#else
|
||||||
localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||||
QString("/plasma_dataengine_extsysmon/upgrade");
|
QString("/awesomewidgets/upgrade");
|
||||||
QDir localDirectory;
|
QDir localDirectory;
|
||||||
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||||
|
|
||||||
dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||||
QString("plasma_dataengine_extsysmon/upgrade"),
|
QString("awesomewidgets/upgrade"),
|
||||||
QStandardPaths::LocateDirectory);
|
QStandardPaths::LocateDirectory);
|
||||||
#endif /* BUILD_KDE4 */
|
#endif /* BUILD_KDE4 */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user