mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
some work on configuration interface
correct file locations create configuration slots TODO сделать этот ебаный коннектор или выкинуть его нахуй
This commit is contained in:
parent
b1abf74e89
commit
4966a0a5bf
@ -19,8 +19,6 @@ import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Layouts 1.0 as QtLayouts
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: aboutPage
|
||||
@ -29,7 +27,8 @@ Item {
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
Loader { id: connector; source: "connector.qml" }
|
||||
property bool debug: connector.item.debug
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
@ -44,20 +43,20 @@ Item {
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: AWActions.getAboutText("header")
|
||||
text: connector.item.getAboutText("header")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignJustify
|
||||
text: AWActions.getAboutText("description")
|
||||
text: connector.item.getAboutText("description")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
textFormat: Text.RichText
|
||||
text: AWActions.getAboutText("links")
|
||||
text: connector.item.getAboutText("links")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
@ -65,7 +64,7 @@ Item {
|
||||
font.capitalization: Font.SmallCaps
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
textFormat: Text.RichText
|
||||
text: AWActions.getAboutText("copy")
|
||||
text: connector.item.getAboutText("copy")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -78,14 +77,14 @@ Item {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: Text.AlignJustify
|
||||
text: AWActions.getAboutText("translators")
|
||||
text: connector.item.getAboutText("translators")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignJustify
|
||||
textFormat: Text.RichText
|
||||
text: AWActions.getAboutText("3rdparty")
|
||||
text: connector.item.getAboutText("3rdparty")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,6 @@ import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Layouts 1.0 as QtLayouts
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: advancedPage
|
||||
@ -30,12 +28,15 @@ Item {
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
Loader { id: connector; source: "connector.qml" }
|
||||
property bool debug: connector.item.debug
|
||||
|
||||
property alias cfg_background: background.checked
|
||||
property alias cfg_customTime: customTime.text
|
||||
property alias cfg_customUptime: customUptime.text
|
||||
property string cfg_tempUnits: tempUnits.currentText
|
||||
property alias cfg_acOnline: acOnline.text
|
||||
property alias cfg_acOffline: acOffline.text
|
||||
|
||||
|
||||
Column {
|
||||
@ -157,8 +158,160 @@ Item {
|
||||
QtControls.Button {
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Select devices")
|
||||
onClicked: plasmoid.configuration.customNetdev = AWActions.selectDevices(AWActions.getNetworkDevices(),
|
||||
plasmoid.configuration.customNetdev.split("@@"))
|
||||
onClicked: plasmoid.configuration.tempDevice = connector.item.selectDevices(
|
||||
connector.item.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 = connector.item.selectDevice(
|
||||
connector.item.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 = connector.item.selectDevices(connector.item.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 = connector.item.selectDevices(
|
||||
connector.item.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 = connector.item.selectDevices(
|
||||
connector.item.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 = connector.item.selectDevices(
|
||||
connector.item.getNetworkDevices(),
|
||||
plasmoid.configuration.customNetdev.split("@@")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("AC online tag")
|
||||
}
|
||||
QtControls.TextField {
|
||||
id: acOnline
|
||||
width: parent.width * 3 / 5
|
||||
text: plasmoid.configuration.acOnline
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("AC offline tag")
|
||||
}
|
||||
QtControls.TextField {
|
||||
id: acOffline
|
||||
width: parent.width * 3 / 5
|
||||
text: plasmoid.configuration.acOffline
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: implicitHeight
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Bars")
|
||||
}
|
||||
QtControls.Button {
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Edit bars")
|
||||
onClicked: connector.item.editItem("graphicalitem")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,6 @@ import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
import QtQuick.Layouts 1.0 as QtLayouts
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: appearancePage
|
||||
@ -31,7 +29,8 @@ Item {
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
Loader { id: connector; source: "connector.qml" }
|
||||
property bool debug: connector.item.debug
|
||||
property variant weight: {
|
||||
25: 0,
|
||||
50: 1,
|
||||
|
163
sources/awesome-widget-kf5/package/contents/ui/connector.qml
Normal file
163
sources/awesome-widget-kf5/package/contents/ui/connector.qml
Normal file
@ -0,0 +1,163 @@
|
||||
/***************************************************************************
|
||||
* This file is part of awesome-widgets *
|
||||
* *
|
||||
* awesome-widgets 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 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
QtObject {
|
||||
id: connector
|
||||
|
||||
// variables
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
property variant fontWeight: {
|
||||
"light": Font.Light,
|
||||
"normal": Font.Normal,
|
||||
"demibold": Font.DemiBold,
|
||||
"bold": Font.Bold,
|
||||
"black": Font.Black
|
||||
}
|
||||
property variant align: {
|
||||
"left": Text.AlignLeft,
|
||||
"center": Text.AlignHCenter,
|
||||
"right": Text.AlignRight,
|
||||
"justify": Text.AlignJustify
|
||||
}
|
||||
// external
|
||||
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
|
||||
}
|
||||
property string pattern: plasmoid.configuration.text
|
||||
|
||||
Component.onCompleted: {
|
||||
if (debug) console.log("[connector::onCompleted]")
|
||||
|
||||
// init submodule
|
||||
AWKeys.initKeys(pattern, settings, tooltipSettings)
|
||||
}
|
||||
|
||||
function addDevice(source) {
|
||||
AWActions.addDevice(source)
|
||||
}
|
||||
|
||||
function checkKeys(data) {
|
||||
return AWActions.checkKeys(data)
|
||||
}
|
||||
|
||||
function checkUpdates() {
|
||||
AWActions.checkUpdates()
|
||||
}
|
||||
|
||||
function dictKeys() {
|
||||
return AWKeys.dictKeys()
|
||||
}
|
||||
|
||||
function editItem(type) {
|
||||
AWKeys.editItem(type)
|
||||
}
|
||||
|
||||
function getAboutText(type) {
|
||||
AWActions.getAboutText(type)
|
||||
}
|
||||
|
||||
function getDiskDevices() {
|
||||
return AWActions.getDiskDevices()
|
||||
}
|
||||
|
||||
function getFanDevices() {
|
||||
return AWActions.getFanDevices()
|
||||
}
|
||||
|
||||
function getFont(defaultFont) {
|
||||
return AWActions.getFont(defaultFont)
|
||||
}
|
||||
|
||||
function getHddDevices() {
|
||||
return AWActions.getHddDevices()
|
||||
}
|
||||
|
||||
function getMountDevices() {
|
||||
return AWActions.getMountDevices()
|
||||
}
|
||||
|
||||
function getNetworkDevices() {
|
||||
return AWActions.getNetworkDevices()
|
||||
}
|
||||
|
||||
function getTempDevices() {
|
||||
return AWActions.getTempDevices()
|
||||
}
|
||||
|
||||
function isReady() {
|
||||
return AWKeys.isReady()
|
||||
}
|
||||
|
||||
function parsePattern() {
|
||||
return AWKeys.parsePattern(pattern)
|
||||
}
|
||||
|
||||
function selectDevice(all, current) {
|
||||
return AWActions.selectDevices(all, current)
|
||||
}
|
||||
|
||||
function sendNotification(event, message) {
|
||||
AWActions.sendNotification(event, message)
|
||||
}
|
||||
|
||||
function setDataBySource(sourceName, data) {
|
||||
AWKeys.setDataBySource(sourceName, data, settings)
|
||||
}
|
||||
|
||||
function showValue(tag) {
|
||||
return AWKeys.valueByKey(tag)
|
||||
}
|
||||
|
||||
function showReadme() {
|
||||
AWActions.showReadme()
|
||||
}
|
||||
}
|
@ -21,64 +21,13 @@ import org.kde.plasma.plasmoid 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: main
|
||||
|
||||
// variables
|
||||
// internal
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
property variant fontWeight: {
|
||||
"light": Font.Light,
|
||||
"normal": Font.Normal,
|
||||
"demibold": Font.DemiBold,
|
||||
"bold": Font.Bold,
|
||||
"black": Font.Black
|
||||
}
|
||||
property variant align: {
|
||||
"left": Text.AlignLeft,
|
||||
"center": Text.AlignHCenter,
|
||||
"right": Text.AlignRight,
|
||||
"justify": Text.AlignJustify
|
||||
}
|
||||
// external
|
||||
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
|
||||
}
|
||||
property string pattern: plasmoid.configuration.text
|
||||
// signals
|
||||
Loader { id: connector; source: "connector.qml" }
|
||||
property bool debug: connector.item.debug
|
||||
|
||||
signal needUpdate
|
||||
|
||||
// init
|
||||
@ -96,14 +45,14 @@ Item {
|
||||
onNewData: {
|
||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||
|
||||
if (!AWActions.checkKeys(data)) return
|
||||
if (AWKeys.isReady()) AWKeys.setDataBySource(sourceName, data, settings)
|
||||
if (!connector.item.checkKeys(data)) return
|
||||
if (connector.item.isReady()) connector.item.setDataBySource(sourceName, data)
|
||||
}
|
||||
|
||||
onSourceAdded: {
|
||||
if (debug) console.log("[main::onSourceAdded] : Source " + source)
|
||||
|
||||
AWActions.addDevice(source)
|
||||
connector.item.addDevice(source)
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,8 +65,8 @@ Item {
|
||||
onNewData: {
|
||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||
|
||||
if (!AWActions.checkKeys(data)) return
|
||||
if (AWKeys.isReady()) AWKeys.setDataBySource(sourceName, data, settings)
|
||||
if (!connector.item.checkKeys(data)) return
|
||||
if (connector.item.isReady()) connector.item.setDataBySource(sourceName, data)
|
||||
// update
|
||||
if (sourceName == "update") needUpdate()
|
||||
}
|
||||
@ -132,8 +81,8 @@ Item {
|
||||
onNewData: {
|
||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||
|
||||
if (!AWActions.checkKeys(data)) return
|
||||
if (AWKeys.isReady()) AWKeys.setDataBySource(sourceName, data, settings)
|
||||
if (!connector.item.checkKeys(data)) return
|
||||
if (connector.item.isReady()) connector.item.setDataBySource(sourceName, data)
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,8 +97,8 @@ Item {
|
||||
font.family: plasmoid.configuration.fontFamily
|
||||
font.italic: plasmoid.configuration.fontStyle == "italic" ? true : false
|
||||
font.pointSize: plasmoid.configuration.fontSize
|
||||
font.weight: fontWeight[plasmoid.configuration.fontWeight]
|
||||
horizontalAlignment: align[plasmoid.configuration.textAlign]
|
||||
font.weight: connector.item.fontWeight[plasmoid.configuration.fontWeight]
|
||||
horizontalAlignment: connector.item.align[plasmoid.configuration.textAlign]
|
||||
textFormat: Text.RichText
|
||||
text: plasmoid.configuration.text
|
||||
}
|
||||
@ -158,8 +107,6 @@ Item {
|
||||
Component.onCompleted: {
|
||||
if (debug) console.log("[main::onCompleted]")
|
||||
|
||||
// init submodule
|
||||
AWKeys.initKeys(pattern, settings, tooltipSettings)
|
||||
// actions
|
||||
plasmoid.setAction("showReadme", i18n("Show README"), "text-x-readme")
|
||||
plasmoid.setAction("updateText", i18n("Update text"), "stock-refresh")
|
||||
@ -169,7 +116,7 @@ Item {
|
||||
onNeedUpdate: {
|
||||
if (debug) console.log("[main::onNeedUpdate]")
|
||||
|
||||
text.text = AWKeys.parsePattern(pattern)
|
||||
text.text = connector.item.parsePattern()
|
||||
// update geometry
|
||||
text.update()
|
||||
height = text.contentHeight
|
||||
@ -180,13 +127,13 @@ Item {
|
||||
function action_checkUpdates() {
|
||||
if (debug) console.log("[main::action_checkUpdates]")
|
||||
|
||||
AWActions.checkUpdates()
|
||||
connector.item.checkUpdates()
|
||||
}
|
||||
|
||||
function action_showReadme() {
|
||||
if (debug) console.log("[main::action_showReadme]")
|
||||
|
||||
AWActions.showReadme()
|
||||
connector.item.showReadme()
|
||||
}
|
||||
|
||||
function action_updateText() {
|
||||
|
@ -21,8 +21,6 @@ import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
import QtQuick.Layouts 1.0 as QtLayouts
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: widgetPage
|
||||
@ -31,7 +29,8 @@ Item {
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
Loader { id: connector; source: "connector.qml" }
|
||||
property bool debug: connector.item.debug
|
||||
|
||||
property alias cfg_text: textPattern.text
|
||||
|
||||
@ -60,7 +59,7 @@ Item {
|
||||
"family": plasmoid.configuration.fontFamily,
|
||||
"size": plasmoid.configuration.fontSize
|
||||
}
|
||||
var font = AWActions.getFont(defaultFont)
|
||||
var font = connector.item.getFont(defaultFont)
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
@ -183,7 +182,7 @@ Item {
|
||||
|
||||
QtControls.ComboBox {
|
||||
id: tags
|
||||
model: AWKeys.dictKeys()
|
||||
model: connector.item.dictKeys()
|
||||
}
|
||||
QtControls.Button {
|
||||
text: i18n("Add")
|
||||
@ -203,8 +202,10 @@ Item {
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Show tag button")
|
||||
|
||||
var message = i18n("Tag: %1<br>Value: %2", tags.currentText, AWKeys.valueByKey(tags.currentText))
|
||||
AWActions.sendNotification("tag", message)
|
||||
var message = i18n("Tag: %1", tags.currentText)
|
||||
message += "<br>"
|
||||
message += i18n("Value: %1", connector.item.showValue(tags.currentText))
|
||||
connector.item.sendNotification("tag", message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -267,11 +267,13 @@ QString AWActions::selectDevices(const QStringList source, const QStringList cur
|
||||
QDialog *dialog = new QDialog(0);
|
||||
QListWidget *widget = new QListWidget(dialog);
|
||||
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
|
||||
Qt::Horizontal, dialog);
|
||||
Qt::Vertical, dialog);
|
||||
QHBoxLayout *layout = new QHBoxLayout(dialog);
|
||||
layout->addWidget(widget);
|
||||
layout->addWidget(buttons);
|
||||
dialog->setLayout(layout);
|
||||
connect(buttons, SIGNAL(accepted()), dialog, SLOT(accept()));
|
||||
connect(buttons, SIGNAL(rejected()), dialog, SLOT(reject()));
|
||||
|
||||
// fill
|
||||
for (int i=0; i<source.count(); i++) {
|
||||
@ -286,6 +288,7 @@ QString AWActions::selectDevices(const QStringList source, const QStringList cur
|
||||
// exec
|
||||
QStringList selected;
|
||||
int ret = dialog->exec();
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Dialog returns" << ret;
|
||||
if (ret == QDialog::Accepted) {
|
||||
for (int i=0; i<widget->count(); i++)
|
||||
if (widget->item(i)->checkState() == Qt::Checked)
|
||||
|
@ -17,9 +17,13 @@
|
||||
|
||||
#include "awkeys.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QHBoxLayout>
|
||||
#include <QInputDialog>
|
||||
#include <QNetworkInterface>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QRegExp>
|
||||
@ -42,12 +46,27 @@ AWKeys::AWKeys(QObject *parent)
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||
debug = (debugEnv == QString("yes"));
|
||||
|
||||
dialog = new QDialog(0);
|
||||
widgetDialog = new QListWidget(dialog);
|
||||
dialogButtons = new QDialogButtonBox(QDialogButtonBox::Open | QDialogButtonBox::Close,
|
||||
Qt::Vertical, dialog);
|
||||
copyButton = dialogButtons->addButton(i18n("Copy"), QDialogButtonBox::ActionRole);
|
||||
createButton = dialogButtons->addButton(i18n("Create"), QDialogButtonBox::ActionRole);
|
||||
QHBoxLayout *layout = new QHBoxLayout(dialog);
|
||||
layout->addWidget(widgetDialog);
|
||||
layout->addWidget(dialogButtons);
|
||||
dialog->setLayout(layout);
|
||||
connect(dialogButtons, SIGNAL(clicked(QAbstractButton *)), this, SLOT(editItemButtonPressed(QAbstractButton *)));
|
||||
connect(dialogButtons, SIGNAL(rejected()), dialog, SLOT(reject()));
|
||||
}
|
||||
|
||||
|
||||
AWKeys::~AWKeys()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
delete dialog;
|
||||
}
|
||||
|
||||
|
||||
@ -224,55 +243,6 @@ QStringList AWKeys::dictKeys()
|
||||
}
|
||||
|
||||
|
||||
QStringList AWKeys::extScriptsInfo()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QStringList info;
|
||||
for (int i=0; i<extScripts.count(); i++) {
|
||||
info.append(extScripts[i]->fileName());
|
||||
info.append(extScripts[i]->name());
|
||||
info.append(extScripts[i]->comment());
|
||||
info.append(extScripts[i]->executable());
|
||||
info.append(QVariant(extScripts[i]->isActive()).toString());
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
QStringList AWKeys::extUpgradeInfo()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QStringList info;
|
||||
for (int i=0; i<extUpgrade.count(); i++) {
|
||||
info.append(extUpgrade[i]->fileName());
|
||||
info.append(extUpgrade[i]->name());
|
||||
info.append(extUpgrade[i]->comment());
|
||||
info.append(extUpgrade[i]->executable());
|
||||
info.append(QVariant(extUpgrade[i]->isActive()).toString());
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
QStringList AWKeys::graphicalItemsInfo()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QStringList info;
|
||||
for (int i=0; i<graphicalItems.count(); i++) {
|
||||
info.append(graphicalItems[i]->fileName());
|
||||
info.append(graphicalItems[i]->name() + graphicalItems[i]->bar());
|
||||
info.append(graphicalItems[i]->comment());
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
void AWKeys::setDataBySource(const QString sourceName,
|
||||
const QMap<QString, QVariant> data,
|
||||
const QMap<QString, QVariant> params)
|
||||
@ -537,6 +507,254 @@ QString AWKeys::valueByKey(QString key)
|
||||
}
|
||||
|
||||
|
||||
void AWKeys::editItem(const QString type)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
widgetDialog->clear();
|
||||
if (type == QString("graphicalitem")) {
|
||||
requestedItem = RequestedGraphicalItem;
|
||||
for (int i=0; i<graphicalItems.count(); i++) {
|
||||
QListWidgetItem *item = new QListWidgetItem(graphicalItems[i]->fileName());
|
||||
QStringList tooltip;
|
||||
tooltip.append(i18n("Tag: %1", graphicalItems[i]->name() + graphicalItems[i]->bar()));
|
||||
tooltip.append(i18n("Comment: %1", graphicalItems[i]->comment()));
|
||||
item->setToolTip(tooltip.join(QChar('\n')));
|
||||
widgetDialog->addItem(item);
|
||||
}
|
||||
} else if (type == QString("extscript")) {
|
||||
requestedItem = RequestedExtScript;
|
||||
for (int i=0; i<extScripts.count(); i++) {
|
||||
QListWidgetItem *item = new QListWidgetItem(extScripts[i]->fileName());
|
||||
QStringList tooltip;
|
||||
tooltip.append(i18n("Name: %1", extScripts[i]->name()));
|
||||
tooltip.append(i18n("Comment: %1", extScripts[i]->comment()));
|
||||
tooltip.append(i18n("Exec: %1", extScripts[i]->executable()));
|
||||
item->setToolTip(tooltip.join(QChar('\n')));
|
||||
widgetDialog->addItem(item);
|
||||
}
|
||||
} else if (type == QString("extupgrade")) {
|
||||
requestedItem = RequestedExtUpgrade;
|
||||
for (int i=0; i<extUpgrade.count(); i++) {
|
||||
QListWidgetItem *item = new QListWidgetItem(extUpgrade[i]->fileName());
|
||||
QStringList tooltip;
|
||||
tooltip.append(i18n("Name: %1", extUpgrade[i]->name()));
|
||||
tooltip.append(i18n("Comment: %1", extUpgrade[i]->comment()));
|
||||
tooltip.append(i18n("Exec: %1", extUpgrade[i]->executable()));
|
||||
item->setToolTip(tooltip.join(QChar('\n')));
|
||||
widgetDialog->addItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
int ret = dialog->exec();
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Dialog returns" << ret;
|
||||
requestedItem = Nothing;
|
||||
}
|
||||
|
||||
|
||||
void AWKeys::editItemButtonPressed(QAbstractButton *button)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QListWidgetItem *item = widgetDialog->currentItem();
|
||||
if (dynamic_cast<QPushButton *>(button) == copyButton) {
|
||||
if (item == nullptr) return;
|
||||
QString current = item->text();
|
||||
switch (requestedItem) {
|
||||
case RequestedExtScript:
|
||||
copyScript(current);
|
||||
break;
|
||||
case RequestedExtUpgrade:
|
||||
copyUpgrade(current);
|
||||
break;
|
||||
case RequestedGraphicalItem:
|
||||
copyBar(current);
|
||||
break;
|
||||
case Nothing:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (dynamic_cast<QPushButton *>(button) == createButton) {
|
||||
switch (requestedItem) {
|
||||
case RequestedExtScript:
|
||||
copyScript(QString(""));
|
||||
break;
|
||||
case RequestedExtUpgrade:
|
||||
copyUpgrade(QString(""));
|
||||
break;
|
||||
case RequestedGraphicalItem:
|
||||
copyBar(QString(""));
|
||||
break;
|
||||
case Nothing:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (dialogButtons->buttonRole(button) == QDialogButtonBox::AcceptRole) {
|
||||
if (item == nullptr) return;
|
||||
QString current = item->text();
|
||||
switch (requestedItem) {
|
||||
case RequestedExtScript:
|
||||
for (int i=0; i<extScripts.count(); i++) {
|
||||
if (extScripts[i]->fileName() != current) continue;
|
||||
extScripts[i]->showConfiguration();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RequestedExtUpgrade:
|
||||
for (int i=0; i<extUpgrade.count(); i++) {
|
||||
if (extUpgrade[i]->fileName() != current) continue;
|
||||
extUpgrade[i]->showConfiguration();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RequestedGraphicalItem:
|
||||
for (int i=0; i<graphicalItems.count(); i++) {
|
||||
if (graphicalItems[i]->fileName() != current) continue;
|
||||
graphicalItems[i]->showConfiguration();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case Nothing:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AWKeys::copyBar(const QString original)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
int number = 0;
|
||||
while (true) {
|
||||
bool exit = true;
|
||||
for (int i=0; i<graphicalItems.count(); i++)
|
||||
if (graphicalItems[i]->name() == QString("bar%1").arg(number)) {
|
||||
number++;
|
||||
exit = false;
|
||||
break;
|
||||
}
|
||||
if (exit) break;
|
||||
}
|
||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("plasma_applet_awesome-widget/desktops"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
bool ok;
|
||||
QString name = QInputDialog::getText(0, i18n("Enter file name"),
|
||||
i18n("File name"), QLineEdit::Normal,
|
||||
QString(""), &ok);
|
||||
if ((!ok) || (name.isEmpty())) return;
|
||||
if (!name.endsWith(QString(".desktop"))) name += QString(".desktop");
|
||||
QStringList bars;
|
||||
bars.append(keys.filter((QRegExp(QString("cpu(?!cl).*")))));
|
||||
bars.append(keys.filter((QRegExp(QString("^gpu$")))));
|
||||
bars.append(keys.filter((QRegExp(QString("^mem$")))));
|
||||
bars.append(keys.filter((QRegExp(QString("^swap$")))));
|
||||
bars.append(keys.filter((QRegExp(QString("^hdd[0-9].*")))));
|
||||
bars.append(keys.filter((QRegExp(QString("^bat.*")))));
|
||||
|
||||
int originalItem = -1;
|
||||
for (int i=0; i<graphicalItems.count(); i++) {
|
||||
if ((graphicalItems[i]->fileName() != original) ||
|
||||
(graphicalItems[i]->fileName() != name))
|
||||
continue;
|
||||
originalItem = i;
|
||||
break;
|
||||
}
|
||||
GraphicalItem *item = new GraphicalItem(0, name, dirs, debug);
|
||||
item->setName(QString("bar%1").arg(number));
|
||||
if (originalItem != -1) {
|
||||
item->setComment(graphicalItems[originalItem]->comment());
|
||||
item->setBar(graphicalItems[originalItem]->bar());
|
||||
item->setActiveColor(graphicalItems[originalItem]->activeColor());
|
||||
item->setInactiveColor(graphicalItems[originalItem]->inactiveColor());
|
||||
item->setType(graphicalItems[originalItem]->type());
|
||||
item->setDirection(graphicalItems[originalItem]->direction());
|
||||
item->setHeight(graphicalItems[originalItem]->height());
|
||||
item->setWidth(graphicalItems[originalItem]->width());
|
||||
}
|
||||
|
||||
item->showConfiguration(bars);
|
||||
delete item;
|
||||
}
|
||||
|
||||
|
||||
void AWKeys::copyScript(const QString original)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("plasma_dataengine_extsysmon/scripts"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
bool ok;
|
||||
QString name = QInputDialog::getText(0, i18n("Enter file name"),
|
||||
i18n("File name"), QLineEdit::Normal,
|
||||
QString(""), &ok);
|
||||
if ((!ok) || (name.isEmpty())) return;
|
||||
if (!name.endsWith(QString(".desktop"))) name += QString(".desktop");
|
||||
|
||||
int originalItem = -1;
|
||||
for (int i=0; i<extScripts.count(); i++) {
|
||||
if ((extScripts[i]->fileName() != original) ||
|
||||
(extScripts[i]->fileName() != name))
|
||||
continue;
|
||||
originalItem = i;
|
||||
break;
|
||||
}
|
||||
ExtScript *script = new ExtScript(0, name, dirs, debug);
|
||||
if (originalItem != -1) {
|
||||
script->setActive(extScripts[originalItem]->isActive());
|
||||
script->setComment(extScripts[originalItem]->comment());
|
||||
script->setExecutable(extScripts[originalItem]->executable());
|
||||
script->setHasOutput(extScripts[originalItem]->hasOutput());
|
||||
script->setInterval(extScripts[originalItem]->interval());
|
||||
script->setName(extScripts[originalItem]->name());
|
||||
script->setPrefix(extScripts[originalItem]->prefix());
|
||||
script->setRedirect(extScripts[originalItem]->redirect());
|
||||
}
|
||||
|
||||
script->showConfiguration();
|
||||
delete script;
|
||||
}
|
||||
|
||||
|
||||
void AWKeys::copyUpgrade(const QString original)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("plasma_dataengine_extsysmon/upgrade"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
bool ok;
|
||||
QString name = QInputDialog::getText(0, i18n("Enter file name"),
|
||||
i18n("File name"), QLineEdit::Normal,
|
||||
QString(""), &ok);
|
||||
if ((!ok) || (name.isEmpty())) return;
|
||||
if (!name.endsWith(QString(".desktop"))) name += QString(".desktop");
|
||||
|
||||
int originalItem = -1;
|
||||
for (int i=0; i<extUpgrade.count(); i++) {
|
||||
if ((extUpgrade[i]->fileName() != original) ||
|
||||
(extUpgrade[i]->fileName() != name))
|
||||
continue;
|
||||
originalItem = i;
|
||||
break;
|
||||
}
|
||||
ExtUpgrade *uprade = new ExtUpgrade(0, name, dirs, debug);
|
||||
if (originalItem != -1) {
|
||||
uprade->setActive(extUpgrade[originalItem]->isActive());
|
||||
uprade->setComment(extUpgrade[originalItem]->comment());
|
||||
uprade->setExecutable(extUpgrade[originalItem]->executable());
|
||||
uprade->setName(extUpgrade[originalItem]->name());
|
||||
uprade->setNull(extUpgrade[originalItem]->null());
|
||||
}
|
||||
|
||||
uprade->showConfiguration();
|
||||
delete uprade;
|
||||
}
|
||||
|
||||
|
||||
QString AWKeys::networkDevice(const QString custom)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -648,13 +866,13 @@ QList<ExtScript *> AWKeys::getExtScripts()
|
||||
|
||||
QList<ExtScript *> externalScripts;
|
||||
// create directory at $HOME
|
||||
QString localDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation) +
|
||||
QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||
QString("/plasma_dataengine_extsysmon/scripts");
|
||||
QDir localDirectory;
|
||||
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
|
||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::DataLocation,
|
||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("plasma_dataengine_extsysmon/scripts"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
QStringList names;
|
||||
@ -679,13 +897,13 @@ QList<ExtUpgrade *> AWKeys::getExtUpgrade()
|
||||
|
||||
QList<ExtUpgrade *> externalUpgrade;
|
||||
// create directory at $HOME
|
||||
QString localDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation) +
|
||||
QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||
QString("/plasma_dataengine_extsysmon/upgrade");
|
||||
QDir localDirectory;
|
||||
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
|
||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::DataLocation,
|
||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("plasma_dataengine_extsysmon/upgrade"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
QStringList names;
|
||||
@ -710,13 +928,13 @@ QList<GraphicalItem *> AWKeys::getGraphicalItems()
|
||||
|
||||
QList<GraphicalItem *> items;
|
||||
// create directory at $HOME
|
||||
QString localDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation) +
|
||||
QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||
QString("/plasma_applet_awesome-widget/desktops");
|
||||
QDir localDirectory;
|
||||
if (localDirectory.mkpath(localDir))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
|
||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::DataLocation,
|
||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("plasma_applet_awesome-widget/desktops"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
QStringList names;
|
||||
|
@ -19,10 +19,14 @@
|
||||
#ifndef AWKEYS_H
|
||||
#define AWKEYS_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QListWidget>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QPixmap>
|
||||
#include <QPushButton>
|
||||
#include <QVariant>
|
||||
|
||||
|
||||
@ -35,6 +39,13 @@ class AWKeys : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
enum RequestedItem {
|
||||
Nothing,
|
||||
RequestedGraphicalItem,
|
||||
RequestedExtScript,
|
||||
RequestedExtUpgrade
|
||||
};
|
||||
|
||||
public:
|
||||
AWKeys(QObject *parent = 0);
|
||||
~AWKeys();
|
||||
@ -48,14 +59,19 @@ public:
|
||||
Q_INVOKABLE QPixmap toolTipImage();
|
||||
// keys
|
||||
Q_INVOKABLE QStringList dictKeys();
|
||||
Q_INVOKABLE QStringList extScriptsInfo();
|
||||
Q_INVOKABLE QStringList extUpgradeInfo();
|
||||
Q_INVOKABLE QStringList graphicalItemsInfo();
|
||||
Q_INVOKABLE void setDataBySource(const QString sourceName,
|
||||
const QMap<QString, QVariant> data,
|
||||
const QMap<QString, QVariant> params);
|
||||
// values
|
||||
Q_INVOKABLE QString valueByKey(QString key);
|
||||
// configuration
|
||||
Q_INVOKABLE void editItem(const QString type);
|
||||
|
||||
private slots:
|
||||
void editItemButtonPressed(QAbstractButton *button);
|
||||
void copyBar(const QString original);
|
||||
void copyScript(const QString original);
|
||||
void copyUpgrade(const QString original);
|
||||
|
||||
private:
|
||||
// methods
|
||||
@ -73,6 +89,13 @@ private:
|
||||
GraphicalItem *getItemByTag(const QString tag);
|
||||
QStringList getTimeKeys();
|
||||
AWToolTip *toolTip = nullptr;
|
||||
// graphical elements
|
||||
QDialog *dialog = nullptr;
|
||||
QListWidget *widgetDialog = nullptr;
|
||||
QDialogButtonBox *dialogButtons = nullptr;
|
||||
QPushButton *copyButton = nullptr;
|
||||
QPushButton *createButton = nullptr;
|
||||
RequestedItem requestedItem = Nothing;
|
||||
// variables
|
||||
bool debug = false;
|
||||
bool ready = false;
|
||||
|
@ -125,7 +125,7 @@ QString GraphicalItem::image(const float value)
|
||||
}
|
||||
|
||||
// convert
|
||||
QPixmap pixmap = QPixmap::grabWidget(view).transformed(QTransform().scale(scale[0], scale[1]));
|
||||
QPixmap pixmap = view->grab().transformed(QTransform().scale(scale[0], scale[1]));
|
||||
QByteArray byteArray;
|
||||
QBuffer buffer(&byteArray);
|
||||
pixmap.save(&buffer, "PNG");
|
||||
|
@ -131,13 +131,13 @@ void ExtendedSysMon::initScripts()
|
||||
|
||||
dirs = KGlobal::dirs()->findDirs("data", "plasma_dataengine_extsysmon/scripts");
|
||||
#else
|
||||
localDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation) +
|
||||
localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||
QString("/plasma_dataengine_extsysmon/scripts");
|
||||
QDir localDirectory;
|
||||
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
|
||||
dirs = QStandardPaths::locateAll(QStandardPaths::DataLocation,
|
||||
dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("plasma_dataengine_extsysmon/scripts"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
#endif /* BUILD_KDE4 */
|
||||
@ -172,13 +172,13 @@ void ExtendedSysMon::initUpgrade()
|
||||
|
||||
dirs = KGlobal::dirs()->findDirs("data", "plasma_dataengine_extsysmon/upgrade");
|
||||
#else
|
||||
localDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation) +
|
||||
localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||
QString("/plasma_dataengine_extsysmon/upgrade");
|
||||
QDir localDirectory;
|
||||
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
|
||||
dirs = QStandardPaths::locateAll(QStandardPaths::DataLocation,
|
||||
dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("plasma_dataengine_extsysmon/upgrade"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
#endif /* BUILD_KDE4 */
|
||||
|
Loading…
Reference in New Issue
Block a user