port widget to dbus

This commit is contained in:
Evgenii Alekseev 2024-03-08 17:32:07 +02:00
parent 0fcfb7d7e4
commit 423597dbd9
54 changed files with 921 additions and 693 deletions

284
sensors Normal file
View File

@ -0,0 +1,284 @@
cpu
cpu/all
cpu/all/averageFrequency
cpu/all/averageTemperature
cpu/all/coreCount
cpu/all/cpuCount
cpu/all/maximumFrequency
cpu/all/maximumTemperature
cpu/all/minimumFrequency
cpu/all/minimumTemperature
cpu/all/name
cpu/all/system
cpu/all/usage
cpu/all/user
cpu/all/wait
cpu/cpu0
cpu/cpu0/frequency
cpu/cpu0/name
cpu/cpu0/system
cpu/cpu0/temperature
cpu/cpu0/usage
cpu/cpu0/user
cpu/cpu0/wait
cpu/cpu1
cpu/cpu1/frequency
cpu/cpu1/name
cpu/cpu1/system
cpu/cpu1/temperature
cpu/cpu1/usage
cpu/cpu1/user
cpu/cpu1/wait
cpu/cpu10
cpu/cpu10/frequency
cpu/cpu10/name
cpu/cpu10/system
cpu/cpu10/temperature
cpu/cpu10/usage
cpu/cpu10/user
cpu/cpu10/wait
cpu/cpu11
cpu/cpu11/frequency
cpu/cpu11/name
cpu/cpu11/system
cpu/cpu11/temperature
cpu/cpu11/usage
cpu/cpu11/user
cpu/cpu11/wait
cpu/cpu12
cpu/cpu12/frequency
cpu/cpu12/name
cpu/cpu12/system
cpu/cpu12/temperature
cpu/cpu12/usage
cpu/cpu12/user
cpu/cpu12/wait
cpu/cpu13
cpu/cpu13/frequency
cpu/cpu13/name
cpu/cpu13/system
cpu/cpu13/temperature
cpu/cpu13/usage
cpu/cpu13/user
cpu/cpu13/wait
cpu/cpu14
cpu/cpu14/frequency
cpu/cpu14/name
cpu/cpu14/system
cpu/cpu14/temperature
cpu/cpu14/usage
cpu/cpu14/user
cpu/cpu14/wait
cpu/cpu15
cpu/cpu15/frequency
cpu/cpu15/name
cpu/cpu15/system
cpu/cpu15/temperature
cpu/cpu15/usage
cpu/cpu15/user
cpu/cpu15/wait
cpu/cpu16
cpu/cpu16/frequency
cpu/cpu16/name
cpu/cpu16/system
cpu/cpu16/temperature
cpu/cpu16/usage
cpu/cpu16/user
cpu/cpu16/wait
cpu/cpu17
cpu/cpu17/frequency
cpu/cpu17/name
cpu/cpu17/system
cpu/cpu17/temperature
cpu/cpu17/usage
cpu/cpu17/user
cpu/cpu17/wait
cpu/cpu18
cpu/cpu18/frequency
cpu/cpu18/name
cpu/cpu18/system
cpu/cpu18/temperature
cpu/cpu18/usage
cpu/cpu18/user
cpu/cpu18/wait
cpu/cpu19
cpu/cpu19/frequency
cpu/cpu19/name
cpu/cpu19/system
cpu/cpu19/temperature
cpu/cpu19/usage
cpu/cpu19/user
cpu/cpu19/wait
cpu/cpu2
cpu/cpu2/frequency
cpu/cpu2/name
cpu/cpu2/system
cpu/cpu2/temperature
cpu/cpu2/usage
cpu/cpu2/user
cpu/cpu2/wait
cpu/cpu3
cpu/cpu3/frequency
cpu/cpu3/name
cpu/cpu3/system
cpu/cpu3/temperature
cpu/cpu3/usage
cpu/cpu3/user
cpu/cpu3/wait
cpu/cpu4
cpu/cpu4/frequency
cpu/cpu4/name
cpu/cpu4/system
cpu/cpu4/temperature
cpu/cpu4/usage
cpu/cpu4/user
cpu/cpu4/wait
cpu/cpu5
cpu/cpu5/frequency
cpu/cpu5/name
cpu/cpu5/system
cpu/cpu5/temperature
cpu/cpu5/usage
cpu/cpu5/user
cpu/cpu5/wait
cpu/cpu6
cpu/cpu6/frequency
cpu/cpu6/name
cpu/cpu6/system
cpu/cpu6/temperature
cpu/cpu6/usage
cpu/cpu6/user
cpu/cpu6/wait
cpu/cpu7
cpu/cpu7/frequency
cpu/cpu7/name
cpu/cpu7/system
cpu/cpu7/temperature
cpu/cpu7/usage
cpu/cpu7/user
cpu/cpu7/wait
cpu/cpu8
cpu/cpu8/frequency
cpu/cpu8/name
cpu/cpu8/system
cpu/cpu8/temperature
cpu/cpu8/usage
cpu/cpu8/user
cpu/cpu8/wait
cpu/cpu9
cpu/cpu9/frequency
cpu/cpu9/name
cpu/cpu9/system
cpu/cpu9/temperature
cpu/cpu9/usage
cpu/cpu9/user
cpu/cpu9/wait
cpu/loadaverages
cpu/loadaverages/loadaverage1
cpu/loadaverages/loadaverage15
cpu/loadaverages/loadaverage5
disk
disk/52e29d18-ad4d-47ad-98c4-a09ab0914a85
disk/52e29d18-ad4d-47ad-98c4-a09ab0914a85/free
disk/52e29d18-ad4d-47ad-98c4-a09ab0914a85/freePercent
disk/52e29d18-ad4d-47ad-98c4-a09ab0914a85/name
disk/52e29d18-ad4d-47ad-98c4-a09ab0914a85/read
disk/52e29d18-ad4d-47ad-98c4-a09ab0914a85/total
disk/52e29d18-ad4d-47ad-98c4-a09ab0914a85/used
disk/52e29d18-ad4d-47ad-98c4-a09ab0914a85/usedPercent
disk/52e29d18-ad4d-47ad-98c4-a09ab0914a85/write
disk/all
disk/all/free
disk/all/freePercent
disk/all/read
disk/all/total
disk/all/used
disk/all/usedPercent
disk/all/write
disk/d10dd7bf-e382-4e44-83d7-9af6c6df7258
disk/d10dd7bf-e382-4e44-83d7-9af6c6df7258/free
disk/d10dd7bf-e382-4e44-83d7-9af6c6df7258/freePercent
disk/d10dd7bf-e382-4e44-83d7-9af6c6df7258/name
disk/d10dd7bf-e382-4e44-83d7-9af6c6df7258/read
disk/d10dd7bf-e382-4e44-83d7-9af6c6df7258/total
disk/d10dd7bf-e382-4e44-83d7-9af6c6df7258/used
disk/d10dd7bf-e382-4e44-83d7-9af6c6df7258/usedPercent
disk/d10dd7bf-e382-4e44-83d7-9af6c6df7258/write
disk/nvme0n1
disk/nvme0n1/name
disk/nvme0n1/read
disk/nvme0n1/total
disk/nvme0n1/write
gpu
lmsensors
lmsensors/BAT0-acpi-0
lmsensors/BAT0-acpi-0/in0
lmsensors/acpitz-acpi-0
lmsensors/acpitz-acpi-0/temp1
lmsensors/iwlwifi_1-virtual-0
lmsensors/iwlwifi_1-virtual-0/temp1
lmsensors/nvme-pci-0400
lmsensors/nvme-pci-0400/temp1
lmsensors/thinkpad-isa-0000
lmsensors/thinkpad-isa-0000/fan1
lmsensors/thinkpad-isa-0000/fan2
lmsensors/thinkpad-isa-0000/temp1
lmsensors/thinkpad-isa-0000/temp2
lmsensors/thinkpad-isa-0000/temp3
lmsensors/thinkpad-isa-0000/temp4
lmsensors/thinkpad-isa-0000/temp5
lmsensors/thinkpad-isa-0000/temp6
lmsensors/thinkpad-isa-0000/temp7
lmsensors/thinkpad-isa-0000/temp8
lmsensors/ucsi_source_psy_USBC000:001-isa-0000
lmsensors/ucsi_source_psy_USBC000:001-isa-0000/curr1
lmsensors/ucsi_source_psy_USBC000:001-isa-0000/in0
lmsensors/ucsi_source_psy_USBC000:002-isa-0000
lmsensors/ucsi_source_psy_USBC000:002-isa-0000/curr1
lmsensors/ucsi_source_psy_USBC000:002-isa-0000/in0
memory
memory/physical
memory/physical/application
memory/physical/applicationPercent
memory/physical/buffer
memory/physical/bufferPercent
memory/physical/cache
memory/physical/cachePercent
memory/physical/free
memory/physical/freePercent
memory/physical/total
memory/physical/used
memory/physical/usedPercent
memory/swap
memory/swap/free
memory/swap/freePercent
memory/swap/total
memory/swap/used
memory/swap/usedPercent
os
os/kernel
os/kernel/name
os/kernel/prettyName
os/kernel/version
os/plasma
os/plasma/kfVersion
os/plasma/plasmaVersion
os/plasma/qtVersion
os/plasma/windowsystem
os/system
os/system/hostname
os/system/logo
os/system/name
os/system/prettyName
os/system/uptime
os/system/url
os/system/version
power
power/4870
power/4870/capacity
power/4870/charge
power/4870/chargePercentage
power/4870/chargeRate
power/4870/design
power/4870/health
power/4870/name

View File

@ -39,81 +39,6 @@ void CFont::setCurrentColor(const QColor color)
}
int CFont::html2QFont(const int htmlWeight)
{
int weight = 16;
switch(htmlWeight) {
case 100:
weight = 16;
break;
case 200:
case 300:
weight = 25;
break;
case 400:
weight = 50;
break;
case 500:
case 600:
weight = 63;
break;
case 700:
case 800:
weight = 75;
break;
case 900:
weight = 87;
break;
default:
break;
}
return weight;
}
int CFont::qFont2html(const int weight)
{
int htmlWeight = 400;
switch(weight) {
case 16:
htmlWeight = 100;
break;
case 25:
htmlWeight = 300;
break;
case 50:
htmlWeight = 400;
break;
case 63:
htmlWeight = 600;
break;
case 75:
htmlWeight = 800;
break;
case 87:
htmlWeight = 900;
break;
default:
break;
}
return htmlWeight;
}
int CFont::htmlWeight()
{
return CFont::qFont2html(weight());
}
void CFont::setHtmlWeight(const int htmlWeight)
{
setWeight(CFont::html2QFont(htmlWeight));
}
CFont CFont::fromQFont(const QFont font, const QColor color)
{
return CFont(font.family(), font.pointSize(), font.weight(), font.italic(), color);

View File

@ -34,11 +34,6 @@ public:
// color properties
QColor color();
void setCurrentColor(const QColor color);
// html weight properties
static int html2QFont(const int htmlWeight);
static int qFont2html(const int weight);
int htmlWeight();
void setHtmlWeight(const int htmlWeight);
// conversion to QFont
static CFont fromQFont(const QFont font,
const QColor color = QColor(QString("#000000")));

View File

@ -1,7 +1,7 @@
set(SUBPROJECT plasma_applet_awesome-widget)
message(STATUS "Subproject ${SUBPROJECT}")
configure_file(metadata.desktop ${CMAKE_CURRENT_SOURCE_DIR}/package/metadata.desktop)
configure_file(metadata.json ${CMAKE_CURRENT_SOURCE_DIR}/package/metadata.json)
add_subdirectory(plugin)
plasma_install_package(package org.kde.plasma.awesomewidget)

View File

@ -1,26 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
Name=Awesome Widget
Comment=A minimalistic Plasmoid
Comment[en]=A minimalistic Plasmoid
Comment[es]=Un plasmoide minimalista
Comment[es]=Un script Plasmoïde minimaliste
Comment[pt_BR]=Um script Plasmoid
Comment[ru]=Минималистичный плазмоид
Comment[uk]=Мінімалістичний плазмоїд
X-KDE-ServiceTypes=Plasma/Applet
Type=Service
Icon=utilities-system-monitor
X-KDE-ServiceTypes=Plasma/Applet
X-Plasma-API=declarativeappletscript
X-Plasma-MainScript=ui/main.qml
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
X-KDE-PluginInfo-Email=esalexeev@gmail.com
X-KDE-PluginInfo-Name=org.kde.plasma.awesomewidget
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
X-KDE-PluginInfo-Website=https://arcanis.me/projects/awesome-widgets/
X-KDE-PluginInfo-Category=System Information
X-KDE-PluginInfo-License=GPLv3
X-KDE-PluginInfo-EnabledByDefault=true

View File

@ -1,4 +1,5 @@
{
"KPackageStructure": "Plasma/Applet",
"KPlugin": {
"Authors": [
{
@ -18,12 +19,8 @@
"Id": "org.kde.plasma.awesomewidget",
"License": "GPLv3",
"Name": "Awesome Widget",
"ServiceTypes": [
"Plasma/Applet"
],
"Version": "@PROJECT_VERSION@",
"Website": "https://arcanis.me/projects/awesome-widgets/"
},
"X-Plasma-API": "declarativeappletscript",
"X-Plasma-MainScript": "ui/main.qml"
"X-Plasma-API-Minimum-Version": "6.0"
}

View File

@ -15,7 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick 2.15
import org.kde.plasma.configuration 2.0

View File

@ -7,150 +7,150 @@
<group name="Widget">
<!-- widget -->
<entry name="text" type="string">
<entry name="text" type="String">
<default>[cpu: $cpu%] [mem: $mem%] [swap: $swap%] [$netdev: $down/$upKB/s]</default>
</entry>
</group>
<group name="Advanced">
<!-- advanced -->
<entry name="background" type="bool">
<entry name="background" type="Bool">
<default>true</default>
</entry>
<entry name="translateStrings" type="bool">
<entry name="translateStrings" type="Bool">
<default>true</default>
</entry>
<entry name="wrapNewLines" type="bool">
<entry name="wrapNewLines" type="Bool">
<default>false</default>
</entry>
<entry name="wrapText" type="bool">
<entry name="wrapText" type="Bool">
<default>false</default>
</entry>
<entry name="notify" type="bool">
<entry name="notify" type="Bool">
<default>true</default>
</entry>
<entry name="checkUpdates" type="bool">
<entry name="checkUpdates" type="Bool">
<default>true</default>
</entry>
<entry name="optimize" type="bool">
<entry name="optimize" type="Bool">
<default>true</default>
</entry>
<entry name="height" type="int">
<entry name="height" type="Int">
<default>0</default>
</entry>
<entry name="width" type="int">
<entry name="width" type="Int">
<default>0</default>
</entry>
<entry name="interval" type="int">
<entry name="interval" type="Int">
<default>1000</default>
</entry>
<entry name="queueLimit" type="int">
<entry name="queueLimit" type="Int">
<default>0</default>
</entry>
<entry name="tempUnits" type="string">
<entry name="tempUnits" type="String">
<default>Celsius</default>
</entry>
<entry name="customTime" type="string">
<entry name="customTime" type="String">
<default>$hh:$mm</default>
</entry>
<entry name="customUptime" type="string">
<entry name="customUptime" type="String">
<default>$dd,$hh,$mm</default>
</entry>
<entry name="acOnline" type="string">
<entry name="acOnline" type="String">
<default>(*)</default>
</entry>
<entry name="acOffline" type="string">
<entry name="acOffline" type="String">
<default>( )</default>
</entry>
<entry name="telemetryCount" type="int">
<entry name="telemetryCount" type="Int">
<default>100</default>
</entry>
<entry name="telemetryRemote" type="bool">
<entry name="telemetryRemote" type="Bool">
<default>false</default>
</entry>
<entry name="telemetryId" type="string">
<entry name="telemetryId" type="String">
<default></default>
</entry>
</group>
<group name="Tooltip">
<entry name="tooltipNumber" type="int">
<entry name="tooltipNumber" type="Int">
<default>100</default>
</entry>
<entry name="useTooltipBackground" type="bool">
<entry name="useTooltipBackground" type="Bool">
<default>true</default>
</entry>
<entry name="tooltipBackground" type="string">
<entry name="tooltipBackground" type="String">
<default>#ffffff</default>
</entry>
<entry name="cpuTooltip" type="bool">
<entry name="cpuTooltip" type="Bool">
<default>true</default>
</entry>
<entry name="cpuTooltipColor" type="string">
<entry name="cpuTooltipColor" type="String">
<default>#ff0000</default>
</entry>
<entry name="cpuclTooltip" type="bool">
<entry name="cpuclTooltip" type="Bool">
<default>true</default>
</entry>
<entry name="cpuclTooltipColor" type="string">
<entry name="cpuclTooltipColor" type="String">
<default>#00ff00</default>
</entry>
<entry name="memTooltip" type="bool">
<entry name="memTooltip" type="Bool">
<default>true</default>
</entry>
<entry name="memTooltipColor" type="string">
<entry name="memTooltipColor" type="String">
<default>#0000ff</default>
</entry>
<entry name="swapTooltip" type="bool">
<entry name="swapTooltip" type="Bool">
<default>true</default>
</entry>
<entry name="swapTooltipColor" type="string">
<entry name="swapTooltipColor" type="String">
<default>#ffff00</default>
</entry>
<entry name="downkbTooltip" type="bool">
<entry name="downkbTooltip" type="Bool">
<default>true</default>
</entry>
<entry name="downkbTooltipColor" type="string">
<entry name="downkbTooltipColor" type="String">
<default>#00ffff</default>
</entry>
<entry name="upkbTooltipColor" type="string">
<entry name="upkbTooltipColor" type="String">
<default>#ff00ff</default>
</entry>
<entry name="batTooltip" type="bool">
<entry name="batTooltip" type="Bool">
<default>true</default>
</entry>
<entry name="batTooltipColor" type="string">
<entry name="batTooltipColor" type="String">
<default>#008800</default>
</entry>
<entry name="batInTooltipColor" type="string">
<entry name="batInTooltipColor" type="String">
<default>#880000</default>
</entry>
</group>
<group name="Appearance">
<!-- appearance -->
<entry name="textAlign" type="string">
<entry name="textAlign" type="String">
<default>center</default>
</entry>
<entry name="fontFamily" type="string">
<entry name="fontFamily" type="String">
<default>Terminus</default>
</entry>
<entry name="fontSize" type="int">
<entry name="fontSize" type="Int">
<default>12</default>
</entry>
<entry name="fontColor" type="string">
<entry name="fontColor" type="String">
<default>#000000</default>
</entry>
<entry name="fontWeight" type="string">
<entry name="fontWeight" type="String">
<default>normal</default>
</entry>
<entry name="fontStyle" type="string">
<entry name="fontStyle" type="String">
<default>normal</default>
</entry>
<entry name="textStyle" type="string">
<entry name="textStyle" type="String">
<default>normal</default>
</entry>
<entry name="textStyleColor" type="string">
<entry name="textStyleColor" type="String">
<default>#000000</default>
</entry>
</group>

View File

@ -15,7 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick 2.15
import org.kde.plasma.private.awesomewidget 1.0

View File

@ -15,8 +15,8 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Controls 1.3 as QtControls
import QtQuick 2.15
import QtQuick.Controls
import org.kde.plasma.private.awesomewidget 1.0
@ -165,7 +165,7 @@ Item {
]
text: i18n("Temperature units")
value: plasmoid.configuration.tempUnits
onValueEdited: cfg_tempUnits = newValue
onValueEdited: newValue => cfg_tempUnits = newValue
}
LineSelector {
@ -192,13 +192,11 @@ Item {
value: plasmoid.configuration.acOffline
}
QtControls.GroupBox {
height: implicitHeight
GroupBox {
width: parent.width
title: i18n("Actions")
Column {
height: implicitHeight
width: parent.width
ButtonSelector {
value: i18n("Drop key cache")
@ -226,13 +224,11 @@ Item {
}
}
QtControls.GroupBox {
height: implicitHeight
GroupBox {
width: parent.width
title: i18n("Telemetry")
Column {
height: implicitHeight
width: parent.width
CheckBoxSelector {
id: telemetryRemote

View File

@ -15,7 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick 2.15
import org.kde.plasma.private.awesomewidget 1.0
import "."
@ -75,7 +75,7 @@ Item {
model: General.fontWeightModel
text: i18n("Font weight")
value: plasmoid.configuration.fontWeight
onValueEdited: cfg_fontWeight = newValue
onValueEdited: newValue => cfg_fontWeight = newValue
}
ComboBoxSelector {
@ -83,7 +83,7 @@ Item {
model: General.fontStyleModel
text: i18n("Font style")
value: plasmoid.configuration.fontStyle
onValueEdited: cfg_fontStyle = newValue
onValueEdited: newValue => cfg_fontStyle = newValue
}
ColorSelector {
@ -97,7 +97,7 @@ Item {
model: General.textStyleModel
text: i18n("Style")
value: plasmoid.configuration.textStyle
onValueEdited: cfg_textStyle = newValue
onValueEdited: newValue => cfg_textStyle = newValue
}
ColorSelector {

View File

@ -15,9 +15,8 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Controls 1.3 as QtControls
import QtQuick.Dialogs 1.1 as QtDialogs
import QtQuick 2.15
import QtQuick.Controls
import org.kde.plasma.private.awesomewidget 1.0
@ -48,18 +47,18 @@ Item {
Column {
id: pageColumn
anchors.fill: parent
QtControls.GroupBox {
GroupBox {
height: implicitHeight
width: parent.width
title: i18n("ACPI")
LineSelector {
text: i18n("ACPI path")
value: cfg_dataengine["ACPIPATH"]
onValueEdited: cfg_dataengine["ACPIPATH"] = newValue
onValueEdited: newValue => cfg_dataengine["ACPIPATH"] = newValue
}
}
QtControls.GroupBox {
GroupBox {
height: implicitHeight
width: parent.width
title: i18n("GPU")
@ -84,11 +83,11 @@ Item {
]
text: i18n("GPU device")
value: cfg_dataengine["GPUDEV"]
onValueEdited: cfg_dataengine["GPUDEV"] = newValue
onValueEdited: newValue => cfg_dataengine["GPUDEV"] = newValue
}
}
QtControls.GroupBox {
GroupBox {
height: implicitHeight
width: parent.width
title: i18n("HDD temperature")
@ -99,18 +98,18 @@ Item {
id: hdd
text: i18n("HDD")
value: cfg_dataengine["HDDDEV"]
onValueEdited: cfg_dataengine["HDDDEV"] = newValue
onValueEdited: newValue => cfg_dataengine["HDDDEV"] = newValue
}
LineSelector {
text: i18n("hddtemp cmd")
value: cfg_dataengine["HDDTEMPCMD"]
onValueEdited: cfg_dataengine["HDDTEMPCMD"] = newValue
onValueEdited: newValue => cfg_dataengine["HDDTEMPCMD"] = newValue
}
}
}
QtControls.GroupBox {
GroupBox {
height: implicitHeight
width: parent.width
title: i18n("Player")
@ -123,7 +122,7 @@ Item {
stepSize: 1
text: i18n("Player data symbols")
value: cfg_dataengine["PLAYERSYMBOLS"]
onValueEdited: cfg_dataengine["PLAYERSYMBOLS"] = newValue
onValueEdited: newValue => cfg_dataengine["PLAYERSYMBOLS"] = newValue
}
ComboBoxSelector {
@ -143,7 +142,7 @@ Item {
]
text: i18n("Music player")
value: cfg_dataengine["PLAYER"]
onValueEdited: cfg_dataengine["PLAYER"] = newValue
onValueEdited: newValue => cfg_dataengine["PLAYER"] = newValue
}
ComboBoxSelector {
@ -194,7 +193,7 @@ Item {
LineSelector {
text: i18n("MPD address")
value: cfg_dataengine["MPDADDRESS"]
onValueEdited: cfg_dataengine["MPDADDRESS"] = newValue
onValueEdited: newValue => cfg_dataengine["MPDADDRESS"] = newValue
}
IntegerSelector {
@ -203,12 +202,12 @@ Item {
stepSize: 1
text: i18n("MPD port")
value: cfg_dataengine["MPDPORT"]
onValueEdited: cfg_dataengine["MPDPORT"] = newValue
onValueEdited: newValue => cfg_dataengine["MPDPORT"] = newValue
}
}
}
QtControls.GroupBox {
GroupBox {
height: implicitHeight
width: parent.width
title: i18n("Extensions")

View File

@ -15,19 +15,18 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.4
import QtQuick.Controls 1.3 as QtControls
import QtQuick.Dialogs 1.2 as QtDialogs
import QtQuick.Layouts 1.1
import QtQuick 2.15
import QtQuick.Controls
import QtQuick.Dialogs
import QtQuick.Layouts
import org.kde.plasma.core as PlasmaCore
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
import "."
Item {
PlasmoidItem {
id: main
// backend
AWKeys {
@ -74,17 +73,12 @@ Item {
signal sizeUpdate
// init
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
Plasmoid.compactRepresentation: Plasmoid.fullRepresentation
Layout.fillWidth: plasmoid.formFactor != PlasmaCore.Planar
Layout.fillHeight: plasmoid.formFactor != PlasmaCore.Planar
Layout.fillWidth: PlasmoidItem.formFactor != PlasmaCore.Planar
Layout.fillHeight: PlasmoidItem.formFactor != PlasmaCore.Planar
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
Plasmoid.icon: "utilities-system-monitor"
Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground"
Plasmoid.associatedApplication: "ksysguard"
// ui
@ -119,11 +113,11 @@ Item {
}
}
QtDialogs.Dialog {
Dialog {
id: tagSelector
title: i18n("Select tag")
QtControls.ComboBox {
ComboBox {
id: tagSelectorBox
width: parent.width
editable: true
@ -140,17 +134,29 @@ Item {
}
}
Plasmoid.contextualActions: [
PlasmaCore.Action {
text: i18n("Request key")
icon.name: "utilities-system-monitor"
},
PlasmaCore.Action {
text: i18n("Show README")
icon.name: "text-x-readme"
},
PlasmaCore.Action {
text: i18n("Check updates")
icon.name: "system-software-update"
},
PlasmaCore.Action {
text: i18n("Report bug")
icon.name: "tools-report-bug"
}
]
Component.onCompleted: {
if (debug) console.debug()
// actions
// it makes no sense to use this field with optimization enable
if (!plasmoid.configuration.optimize)
plasmoid.setAction("requestKey", i18n("Request key"), "utilities-system-monitor")
plasmoid.setAction("showReadme", i18n("Show README"), "text-x-readme")
plasmoid.setAction("checkUpdates", i18n("Check updates"), "system-software-update")
plasmoid.setAction("reportBug", i18n("Report bug"), "tools-report-bug")
// init submodule
Plasmoid.userConfiguringChanged(false)
// connect data
@ -160,14 +166,14 @@ Item {
if (plasmoid.configuration.checkUpdates) return awActions.checkUpdates(false)
}
onNeedTextUpdate: {
onNeedTextUpdate: newText => {
if (debug) console.debug()
text.text = newText
sizeUpdate()
}
onNeedToolTipUpdate: {
onNeedToolTipUpdate: newText => {
if (debug) console.debug()
tooltip.text = newText

View File

@ -3,25 +3,25 @@
# common QML constants
singleton General 1.0 file:///usr//awesomewidgets/qml/General.qml
singleton General 1.0 file:///usr/share/awesomewidgets/qml/General.qml
# custom QML UI classes
AboutTab file:///usr//awesomewidgets/qml/AboutTab.qml
AWExtensions file:///usr//awesomewidgets/qml/AWExtensions.qml
AWInfoLabel file:///usr//awesomewidgets/qml/AWInfoLabel.qml
AWTagSelector file:///usr//awesomewidgets/qml/AWTagSelector.qml
AWTextEditor file:///usr//awesomewidgets/qml/AWTextEditor.qml
BugReport file:///usr//awesomewidgets/qml/BugReport.qml
ButtonSelector file:///usr//awesomewidgets/qml/ButtonSelector.qml
CheckBoxSelector file:///usr//awesomewidgets/qml/CheckBoxSelector.qml
ColorSelector file:///usr//awesomewidgets/qml/ColorSelector.qml
ComboBoxSelector file:///usr//awesomewidgets/qml/ComboBoxSelector.qml
ExportDialog file:///usr//awesomewidgets/qml/ExportDialog.qml
FontSelector file:///usr//awesomewidgets/qml/FontSelector.qml
HtmlDefaultFunctionsBar file:///usr//awesomewidgets/qml/HtmlDefaultFunctionsBar.qml
HtmlEditorButton file:///usr//awesomewidgets/qml/HtmlEditorButton.qml
HtmlEditorColor file:///usr//awesomewidgets/qml/HtmlEditorColor.qml
HtmlEditorFont file:///usr//awesomewidgets/qml/HtmlEditorFont.qml
ImportDialog file:///usr//awesomewidgets/qml/ImportDialog.qml
IntegerSelector file:///usr//awesomewidgets/qml/IntegerSelector.qml
LineSelector file:///usr//awesomewidgets/qml/LineSelector.qml
AboutTab file:///usr/share/awesomewidgets/qml/AboutTab.qml
AWExtensions file:///usr/share/awesomewidgets/qml/AWExtensions.qml
AWInfoLabel file:///usr/share/awesomewidgets/qml/AWInfoLabel.qml
AWTagSelector file:///usr/share/awesomewidgets/qml/AWTagSelector.qml
AWTextEditor file:///usr/share/awesomewidgets/qml/AWTextEditor.qml
BugReport file:///usr/share/awesomewidgets/qml/BugReport.qml
ButtonSelector file:///usr/share/awesomewidgets/qml/ButtonSelector.qml
CheckBoxSelector file:///usr/share/awesomewidgets/qml/CheckBoxSelector.qml
ColorSelector file:///usr/share/awesomewidgets/qml/ColorSelector.qml
ComboBoxSelector file:///usr/share/awesomewidgets/qml/ComboBoxSelector.qml
ExportDialog file:///usr/share/awesomewidgets/qml/ExportDialog.qml
FontSelector file:///usr/share/awesomewidgets/qml/FontSelector.qml
HtmlDefaultFunctionsBar file:///usr/share/awesomewidgets/qml/HtmlDefaultFunctionsBar.qml
HtmlEditorButton file:///usr/share/awesomewidgets/qml/HtmlEditorButton.qml
HtmlEditorColor file:///usr/share/awesomewidgets/qml/HtmlEditorColor.qml
HtmlEditorFont file:///usr/share/awesomewidgets/qml/HtmlEditorFont.qml
ImportDialog file:///usr/share/awesomewidgets/qml/ImportDialog.qml
IntegerSelector file:///usr/share/awesomewidgets/qml/IntegerSelector.qml
LineSelector file:///usr/share/awesomewidgets/qml/LineSelector.qml

View File

@ -15,8 +15,8 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Controls 1.3 as QtControls
import QtQuick 2.15
import QtQuick.Controls
import org.kde.plasma.private.awesomewidget 1.0
@ -46,7 +46,7 @@ Item {
property alias cfg_memTooltipColor: memTooltipColor.value
property alias cfg_swapTooltip: swapTooltip.checked
property alias cfg_swapTooltipColor: swapTooltipColor.value
property alias cfg_downkbTooltip: downkbTooltip.checked
property alias cfg_downkbTooltip: networkTooltip.checked
property alias cfg_downkbTooltipColor: downkbTooltipColor.value
property alias cfg_upkbTooltipColor: upkbTooltipColor.value
property alias cfg_batTooltip: batTooltip.checked
@ -57,7 +57,8 @@ Item {
Column {
id: pageColumn
anchors.fill: parent
QtControls.Label {
Label {
width: parent.width
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@ -74,80 +75,109 @@ Item {
value: plasmoid.configuration.tooltipNumber
}
QtControls.GroupBox {
GroupBox {
id: useTooltipBackground
height: implicitHeight
width: parent.width
checkable: true
title: i18n("Background")
property alias checked: useTooltipBackgroundLabel.checked
label: CheckBox {
id: useTooltipBackgroundLabel
text: i18n("Background")
}
ColorSelector {
id: tooltipBackground
enabled: useTooltipBackgroundLabel.checked
text: i18n("Background color")
value: plasmoid.configuration.tooltipBackground
}
}
QtControls.GroupBox {
GroupBox {
id: cpuTooltip
height: implicitHeight
width: parent.width
checkable: true
title: i18n("CPU")
property alias checked: cpuTooltipLabel.checked
label: CheckBox {
id: cpuTooltipLabel
text: i18n("CPU")
}
ColorSelector {
id: cpuTooltipColor
enabled: cpuTooltipLabel.checked
text: i18n("CPU color")
value: plasmoid.configuration.cpuTooltipColor
}
}
QtControls.GroupBox {
GroupBox {
id: cpuclTooltip
height: implicitHeight
width: parent.width
checkable: true
title: i18n("CPU clock")
property alias checked: cpuclTooltipLabel.checked
label: CheckBox {
id: cpuclTooltipLabel
text: i18n("CPU clock")
}
ColorSelector {
id: cpuclTooltipColor
enabled: cpuclTooltipLabel.checked
text: i18n("CPU clock color")
value: plasmoid.configuration.cpuclTooltipColor
}
}
QtControls.GroupBox {
GroupBox {
id: memTooltip
height: implicitHeight
width: parent.width
checkable: true
title: i18n("Memory")
property alias checked: memTooltipLabel.checked
label: CheckBox {
id: memTooltipLabel
text: i18n("Memory")
}
ColorSelector {
id: memTooltipColor
enabled: memTooltipLabel.checked
text: i18n("Memory color")
value: plasmoid.configuration.memTooltipColor
}
}
QtControls.GroupBox {
GroupBox {
id: swapTooltip
height: implicitHeight
width: parent.width
checkable: true
title: i18n("Swap")
property alias checked: swapTooltipLabel.checked
label: CheckBox {
id: swapTooltipLabel
text: i18n("Swap")
}
ColorSelector {
id: swapTooltipColor
enabled: swapTooltipLabel.checked
text: i18n("Swap color")
value: plasmoid.configuration.swapTooltipColor
}
}
QtControls.GroupBox {
id: downkbTooltip
height: implicitHeight
GroupBox {
id: networkTooltip
width: parent.width
checkable: true
title: i18n("Network")
property alias checked: networkTooltipLabel.checked
label: CheckBox {
id: networkTooltipLabel
text: i18n("Network")
}
Column {
height: implicitHeight
width: parent.width
enabled: networkTooltipLabel.checked
ColorSelector {
id: downkbTooltipColor
text: i18n("Download speed color")
@ -161,15 +191,19 @@ Item {
}
}
QtControls.GroupBox {
GroupBox {
id: batTooltip
height: implicitHeight
width: parent.width
checkable: true
title: i18n("Battery")
property alias checked: batteryTooltipLabel.checked
label: CheckBox {
id: batteryTooltipLabel
text: i18n("Battery")
}
Column {
height: implicitHeight
width: parent.width
enabled: batteryTooltipLabel.checked
ColorSelector {
id: batTooltipColor
text: i18n("Battery active color")

View File

@ -15,7 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.2
import QtQuick 2.15
import org.kde.plasma.private.awesomewidget 1.0
import "."
@ -90,7 +90,7 @@ Item {
awKeys.setAggregatorProperty("translate", plasmoid.configuration.translateStrings)
}
onNeedTextUpdate: {
onNeedTextUpdate: newText => {
if (lock) return
if (debug) console.debug()

View File

@ -1,26 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
Name=Awesome Widget
Comment=A minimalistic Plasmoid
Comment[en]=A minimalistic Plasmoid
Comment[es]=Un plasmoide minimalista
Comment[es]=Un script Plasmoïde minimaliste
Comment[pt_BR]=Um script Plasmoid
Comment[ru]=Минималистичный плазмоид
Comment[uk]=Мінімалістичний плазмоїд
X-KDE-ServiceTypes=Plasma/Applet
Type=Service
Icon=utilities-system-monitor
X-KDE-ServiceTypes=Plasma/Applet
X-Plasma-API=declarativeappletscript
X-Plasma-MainScript=ui/main.qml
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
X-KDE-PluginInfo-Email=esalexeev@gmail.com
X-KDE-PluginInfo-Name=org.kde.plasma.awesomewidget
X-KDE-PluginInfo-Version=3.5.1
X-KDE-PluginInfo-Website=https://arcanis.me/projects/awesome-widgets/
X-KDE-PluginInfo-Category=System Information
X-KDE-PluginInfo-License=GPLv3
X-KDE-PluginInfo-EnabledByDefault=true

View File

@ -0,0 +1,26 @@
{
"KPackageStructure": "Plasma/Applet",
"KPlugin": {
"Authors": [
{
"Email": "esalexeev@gmail.com",
"Name": "Evgeniy Alekseev aka arcanis"
}
],
"Category": "System Information",
"Description": "A minimalistic Plasmoid",
"Description[en]": "A minimalistic Plasmoid",
"Description[es]": "Un script Plasmoïde minimaliste",
"Description[pt_BR]": "Um script Plasmoid",
"Description[ru]": "Минималистичный плазмоид",
"Description[uk]": "Мінімалістичний плазмоїд",
"EnabledByDefault": true,
"Icon": "utilities-system-monitor",
"Id": "org.kde.plasma.awesomewidget",
"License": "GPLv3",
"Name": "Awesome Widget",
"Version": "3.5.1",
"Website": "https://arcanis.me/projects/awesome-widgets/"
},
"X-Plasma-API-Minimum-Version": "6.0"
}

View File

@ -18,6 +18,6 @@ qt6_wrap_ui(SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
add_library(${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER})
target_link_libraries(${PLUGIN_NAME} ${PROJECT_LIBRARY} ${Qt_LIBRARIES} ${Kf6_LIBRARIES})
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(TARGETS ${PLUGIN_NAME} DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/awesomewidget)
install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/awesomewidget)
install(FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KDE_INSTALL_KNOTIFYRCDIR})

View File

@ -21,7 +21,6 @@
#include <QQmlPropertyMap>
#include <QSettings>
#include <QStandardPaths>
#include <QTextCodec>
#include "awdebug.h"
@ -285,7 +284,6 @@ void AWConfigHelper::writeFile(QSettings &_settings, const QString &_key, const
QFile file(_fileName);
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream out(&file);
out.setCodec("UTF-8");
out << _settings.value(_key).toString().toUtf8();
out.flush();
file.close();

View File

@ -17,7 +17,8 @@
#include "awdataengineaggregator.h"
#include <Plasma/DataContainer>
#include <QDBusConnection>
#include <ksysguard/systemstats/DBusInterface.h>
#include "awdebug.h"
@ -27,20 +28,22 @@ AWDataEngineAggregator::AWDataEngineAggregator(QObject *_parent)
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
m_consumer = new Plasma::DataEngineConsumer();
m_dataEngines["systemmonitor"] = m_consumer->dataEngine("systemmonitor");
m_dataEngines["extsysmon"] = m_consumer->dataEngine("extsysmon");
m_dataEngines["time"] = m_consumer->dataEngine("time");
qDBusRegisterMetaType<KSysGuard::SensorData>();
qDBusRegisterMetaType<KSysGuard::SensorInfo>();
qDBusRegisterMetaType<KSysGuard::SensorDataList>();
qDBusRegisterMetaType<QHash<QString, KSysGuard::SensorInfo>>();
// additional method required by systemmonitor structure
m_newSourceConnection
= connect(m_dataEngines["systemmonitor"], &Plasma::DataEngine::sourceAdded, [this](const QString &source) {
emit(deviceAdded(source));
m_dataEngines["systemmonitor"]->connectSource(source, parent(), 1000);
});
m_interface = new KSysGuard::SystemStats::DBusInterface(
KSysGuard::SystemStats::ServiceName, KSysGuard::SystemStats::ObjectPath, QDBusConnection::sessionBus(), this);
// required to define Qt::QueuedConnection for signal-slot connection
qRegisterMetaType<Plasma::DataEngine::Data>("Plasma::DataEngine::Data");
connect(m_interface, SIGNAL(newSensorData(KSysGuard::SensorDataList)), this,
SLOT(updateData(KSysGuard::SensorDataList)));
connect(m_interface, SIGNAL(sensorMetaDataChanged(const QHash<QString, KSysGuard::SensorInfo> &)), this,
SLOT(updateSensors(const QHash<QString, KSysGuard::SensorInfo> &)));
connect(m_interface, SIGNAL(sensorAdded(const QString &)), this, SLOT(sensorAdded(const QString &)));
connect(m_interface, SIGNAL(sensorRemoved(const QString &)), this, SLOT(sensorRemoved(const QString &)));
loadSources();
}
@ -54,62 +57,63 @@ AWDataEngineAggregator::~AWDataEngineAggregator()
void AWDataEngineAggregator::disconnectSources()
{
for (auto dataEngine : m_dataEngines.values())
for (auto &source : dataEngine->sources())
dataEngine->disconnectSource(source, parent());
disconnect(m_newSourceConnection);
m_interface->unsubscribe(m_sensors.keys());
}
void AWDataEngineAggregator::reconnectSources(const int _interval)
void AWDataEngineAggregator::loadSources()
{
qCDebug(LOG_AW) << "Reconnect sources with interval" << _interval;
auto response = m_interface->allSensors();
response.waitForFinished();
auto sensors = response.value();
updateSensors(sensors);
for (auto &sensor : sensors.keys())
sensorAdded(sensor);
}
void AWDataEngineAggregator::reconnectSources(const int interval)
{
qCDebug(LOG_AW) << "Reconnect all sources with update interval" << interval;
disconnectSources();
m_dataEngines["systemmonitor"]->connectAllSources(parent(), (uint)_interval);
m_dataEngines["extsysmon"]->connectAllSources(parent(), (uint)_interval);
m_dataEngines["time"]->connectSource("Local", parent(), 1000);
m_newSourceConnection = connect(
m_dataEngines["systemmonitor"], &Plasma::DataEngine::sourceAdded, [this, _interval](const QString &source) {
emit(deviceAdded(source));
m_dataEngines["systemmonitor"]->connectSource(source, parent(), (uint)_interval);
});
#ifdef BUILD_FUTURE
createQueuedConnection();
#endif /* BUILD_FUTURE */
m_interface->subscribe(m_sensors.keys());
}
void AWDataEngineAggregator::dropSource(const QString &_source)
{
qCDebug(LOG_AW) << "Source" << _source;
qCDebug(LOG_AW) << "Disconnect source" << _source;
// HACK there is no possibility to check to which dataengine source
// connected we will try to disconnect it from all engines
for (auto dataEngine : m_dataEngines.values())
dataEngine->disconnectSource(_source, parent());
m_interface->unsubscribe({_source});
}
void AWDataEngineAggregator::createQueuedConnection()
void AWDataEngineAggregator::sensorAdded(const QString &_sensor)
{
// HACK additional method which forces QueuedConnection instead of Auto one
// for more details refer to plasma-framework source code
for (auto &dataEngine : m_dataEngines.keys()) {
// different source set for different engines
QStringList sources = dataEngine == "time" ? QStringList() << "Local" : m_dataEngines[dataEngine]->sources();
// reconnect sources
for (auto &source : sources) {
Plasma::DataContainer *container = m_dataEngines[dataEngine]->containerForSource(source);
// disconnect old connections first
disconnect(container, SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data)), parent(),
SLOT(dataUpdated(QString, Plasma::DataEngine::Data)));
// and now reconnect with Qt::QueuedConnection type
connect(container, SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data)), parent(),
SLOT(dataUpdated(QString, Plasma::DataEngine::Data)), Qt::QueuedConnection);
}
}
qCDebug(LOG_AW) << "New sensor added" << _sensor;
m_interface->subscribe({_sensor});
}
void AWDataEngineAggregator::sensorRemoved(const QString &_sensor)
{
qCDebug(LOG_AW) << "Sensor" << _sensor << "has been removed";
m_sensors.remove(_sensor);
m_interface->unsubscribe({_sensor});
}
void AWDataEngineAggregator::updateData(KSysGuard::SensorDataList _data)
{
emit(dataUpdated(m_sensors, _data));
}
void AWDataEngineAggregator::updateSensors(const QHash<QString, KSysGuard::SensorInfo> &_sensors)
{
for (auto sensor = _sensors.cbegin(); sensor != _sensors.cend(); ++sensor)
m_sensors.insert(sensor.key(), sensor.value());
}

View File

@ -19,10 +19,17 @@
#ifndef AWDATAENGINEAGGREGATOR_H
#define AWDATAENGINEAGGREGATOR_H
#include <Plasma/DataEngine>
#include <Plasma/DataEngineConsumer>
#include <ksysguard/systemstats/SensorInfo.h>
#include <QObject>
#include <QHash>
#include <QSet>
namespace KSysGuard::SystemStats
{
class DBusInterface;
}
class AWDataEngineAggregator : public QObject
@ -33,19 +40,23 @@ public:
explicit AWDataEngineAggregator(QObject *_parent = nullptr);
~AWDataEngineAggregator() override;
void disconnectSources();
void reconnectSources(int _interval);
void loadSources();
void reconnectSources(const int interval);
signals:
void dataUpdated(const QHash<QString, KSysGuard::SensorInfo> &_sensors, const KSysGuard::SensorDataList &_data);
void deviceAdded(const QString &_source);
public slots:
void dropSource(const QString &_source);
void sensorAdded(const QString &_sensor);
void sensorRemoved(const QString &_sensor);
void updateData(KSysGuard::SensorDataList _data);
void updateSensors(const QHash<QString, KSysGuard::SensorInfo> &_sensors);
private:
void createQueuedConnection();
Plasma::DataEngineConsumer *m_consumer = nullptr;
QHash<QString, Plasma::DataEngine *> m_dataEngines;
QMetaObject::Connection m_newSourceConnection;
KSysGuard::SystemStats::DBusInterface *m_interface = nullptr;
QHash<QString, KSysGuard::SensorInfo> m_sensors;
};

View File

@ -76,20 +76,20 @@ QStringList AWDataEngineMapper::keysFromSource(const QString &_source) const
// HACK units required to define should the value be calculated as temperature
// or fan data
QStringList AWDataEngineMapper::registerSource(const QString &_source, const QString &_units, const QStringList &_keys)
QStringList AWDataEngineMapper::registerSource(const QString &_source, const KSysGuard::Unit _units, const QStringList &_keys)
{
qCDebug(LOG_AW) << "Source" << _source << "with units" << _units;
// regular expressions
auto cpuRegExp = QRegularExpression("cpu/cpu.*/TotalLoad");
auto cpuclRegExp = QRegularExpression("cpu/cpu.*/clock");
auto hddrRegExp = QRegularExpression("disk/.*/Rate/rblk");
auto hddwRegExp = QRegularExpression("disk/.*/Rate/wblk");
auto mountFillRegExp = QRegularExpression("partitions/.*/filllevel");
auto mountFreeRegExp = QRegularExpression("partitions/.*/freespace");
auto mountUsedRegExp = QRegularExpression("partitions/.*/usedspace");
auto netRegExp = QRegularExpression("network/interfaces/.*/(receiver|transmitter)/data$");
auto netTotalRegExp = QRegularExpression("network/interfaces/.*/(receiver|transmitter)/dataTotal$");
auto cpuRegExp = QRegularExpression("^cpu/cpu.*/usage$");
auto cpuclRegExp = QRegularExpression("^cpu/cpu.*/frequency$");
auto hddrRegExp = QRegularExpression("^disk/.*/read$");
auto hddwRegExp = QRegularExpression("^disk/.*/write$");
auto mountFillRegExp = QRegularExpression("^disk/.*/usedPercent$");
auto mountFreeRegExp = QRegularExpression("^disk/.*/free$");
auto mountUsedRegExp = QRegularExpression("^disk/.*/used$");
auto netRegExp = QRegularExpression("^network/.*/(download|upload)$");
auto netTotalRegExp = QRegularExpression("^network/.*/(totalDownload|totalUpload)$");
if (_source == "battery/ac") {
// AC
@ -102,24 +102,24 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
m_map.insert(_source, key);
m_formatter[key] = _source.contains("rate") ? AWKeysAggregator::FormatterType::Float
: AWKeysAggregator::FormatterType::IntegerThree;
} else if (_source == "cpu/system/TotalLoad") {
} else if (_source == "cpu/all/usage") {
// cpu
m_map.insert(_source, "cpu");
m_formatter["cpu"] = AWKeysAggregator::FormatterType::Float;
} else if (_source.contains(cpuRegExp)) {
// cpus
QString key = _source;
key.remove("cpu/").remove("/TotalLoad");
key.remove("cpu/").remove("/usage");
m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Float;
} else if (_source == "cpu/system/AverageClock") {
} else if (_source == "cpu/all/averageFrequency") {
// cpucl
m_map.insert(_source, "cpucl");
m_formatter["cpucl"] = AWKeysAggregator::FormatterType::Integer;
} else if (_source.contains(cpuclRegExp)) {
// cpucls
QString key = _source;
key.remove("cpu/cpu").remove("/clock");
key.remove("cpu/cpu").remove("/frequency");
key = QString("cpucl%1").arg(key);
m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Integer;
@ -144,7 +144,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
} else if (_source.contains(hddrRegExp)) {
// read speed
QString device = _source;
device.remove("/Rate/rblk");
device.remove("disk/").remove("/read");
int index = m_devices["disk"].indexOf(device);
if (index > -1) {
QString key = QString("hddr%1").arg(index);
@ -154,7 +154,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
} else if (_source.contains(hddwRegExp)) {
// write speed
QString device = _source;
device.remove("/Rate/wblk");
device.remove("disk/").remove("/write");
int index = m_devices["disk"].indexOf(device);
if (index > -1) {
QString key = QString("hddw%1").arg(index);
@ -172,7 +172,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
} else if (_source.contains(mountFillRegExp)) {
// fill level
QString device = _source;
device.remove("partitions").remove("/filllevel");
device.remove("disk/").remove("/usedPercent");
int index = m_devices["mount"].indexOf(device);
if (index > -1) {
QString key = QString("hdd%1").arg(index);
@ -185,7 +185,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
} else if (_source.contains(mountFreeRegExp)) {
// free space
QString device = _source;
device.remove("partitions").remove("/freespace");
device.remove("disk/").remove("/free");
int index = m_devices["mount"].indexOf(device);
if (index > -1) {
// mb
@ -200,7 +200,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
} else if (_source.contains(mountUsedRegExp)) {
// used
QString device = _source;
device.remove("partitions").remove("/usedspace");
device.remove("disk/").remove("/used");
int index = m_devices["mount"].indexOf(device);
if (index > -1) {
// mb
@ -222,14 +222,14 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Temperature;
}
} else if (_source.startsWith("cpu/system/loadavg")) {
} else if (_source.startsWith("cpu/loadaverages/loadaverage")) {
// load average
QString time = _source;
time.remove("cpu/system/loadavg");
time.remove("cpu/loadaverages/loadaverage");
QString key = QString("la%1").arg(time);
m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::FloatTwoSymbols;
} else if (_source == "mem/physical/application") {
} else if (_source == "memory/physical/application") {
// app memory
// mb
m_map.insert(_source, "memmb");
@ -237,7 +237,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
// gb
m_map.insert(_source, "memgb");
m_formatter["memgb"] = AWKeysAggregator::FormatterType::MemGBFormat;
} else if (_source == "mem/physical/free") {
} else if (_source == "memory/physical/free") {
// free memory
// mb
m_map.insert(_source, "memfreemb");
@ -245,7 +245,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
// gb
m_map.insert(_source, "memfreegb");
m_formatter["memfreegb"] = AWKeysAggregator::FormatterType::MemGBFormat;
} else if (_source == "mem/physical/used") {
} else if (_source == "memory/physical/used") {
// used memory
// mb
m_map.insert(_source, "memusedmb");
@ -269,7 +269,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
m_formatter[key] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source.contains(netRegExp)) {
// network speed
QString type = _source.contains("receiver") ? "down" : "up";
QString type = _source.contains("download") ? "down" : "up";
int index = m_devices["net"].indexOf(_source.split('/')[2]);
if (index > -1) {
// kb
@ -287,7 +287,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
}
} else if (_source.contains(netTotalRegExp)) {
// network data total
QString type = _source.contains("receiver") ? "down" : "up";
QString type = _source.contains("download") ? "down" : "up";
int index = m_devices["net"].indexOf(_source.split('/')[2]);
if (index > -1) {
// kb
@ -329,7 +329,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
key.remove("quotes/");
m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Quotes;
} else if (_source == "mem/swap/free") {
} else if (_source == "memory/swap/free") {
// free swap
// mb
m_map.insert(_source, "swapfreemb");
@ -337,7 +337,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
// gb
m_map.insert(_source, "swapfreegb");
m_formatter["swapfreegb"] = AWKeysAggregator::FormatterType::MemGBFormat;
} else if (_source == "mem/swap/used") {
} else if (_source == "memory/swap/used") {
// used swap
// mb
m_map.insert(_source, "swapmb");
@ -349,12 +349,12 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
// temperature
int index = m_devices["temp"].indexOf(_source);
// HACK on DE initialization there are no units key
if (_units.isEmpty())
if (_units == KSysGuard::UnitInvalid)
return QStringList({QString("temp%1").arg(index)});
if (index > -1) {
QString key = QString("temp%1").arg(index);
m_map.insert(_source, key);
m_formatter[key] = _units == "°C" ? AWKeysAggregator::FormatterType::Temperature
m_formatter[key] = _units == KSysGuard::UnitCelsius ? AWKeysAggregator::FormatterType::Temperature
: AWKeysAggregator::FormatterType::Integer;
}
} else if (_source == "Local") {

View File

@ -19,6 +19,8 @@
#ifndef AWDATAENGINEMAPPER_H
#define AWDATAENGINEMAPPER_H
#include <ksysguard/formatter/Unit.h>
#include <QMultiHash>
#include <QObject>
@ -38,7 +40,7 @@ public:
[[nodiscard]] AWKeysAggregator::FormatterType formatter(const QString &_key) const;
[[nodiscard]] QStringList keysFromSource(const QString &_source) const;
// set methods
QStringList registerSource(const QString &_source, const QString &_units, const QStringList &_keys);
QStringList registerSource(const QString &_source, const KSysGuard::Unit _units, const QStringList &_keys);
void setDevices(const QHash<QString, QStringList> &_devices);
private:

View File

@ -58,11 +58,15 @@ AWKeys::AWKeys(QObject *_parent)
// update key data if required
connect(m_keyOperator, SIGNAL(updateKeys(const QStringList &)), this, SLOT(reinitKeys(const QStringList &)));
connect(m_timer, SIGNAL(timeout()), this, SLOT(updateTextData()));
// transfer signal from AWDataAggregator object to QML ui
connect(m_dataAggregator, SIGNAL(toolTipPainted(const QString &)), this,
SIGNAL(needToolTipToBeUpdated(const QString &)));
connect(this, SIGNAL(dropSourceFromDataengine(const QString &)), m_dataEngineAggregator,
SLOT(dropSource(const QString &)));
connect(m_dataEngineAggregator, SIGNAL(dataUpdated(const QHash<QString, KSysGuard::SensorInfo> &, const KSysGuard::SensorDataList &)),
this, SLOT(dataUpdated(const QHash<QString, KSysGuard::SensorInfo> &, const KSysGuard::SensorDataList &)));
// transfer signal from dataengine to update source list
connect(m_dataEngineAggregator, SIGNAL(deviceAdded(const QString &)), m_keyOperator,
SLOT(addDevice(const QString &)));
@ -185,9 +189,9 @@ QString AWKeys::valueByKey(const QString &_key) const
{
qCDebug(LOG_AW) << "Requested value for key" << _key;
QString trueKey = _key.startsWith("bar") ? m_keyOperator->infoByKey(_key) : _key;
auto realKey = _key.startsWith("bar") ? m_keyOperator->infoByKey(_key) : _key;
return m_aggregator->formatter(m_values[trueKey], trueKey, true);
return m_aggregator->formatter(m_values[realKey], realKey, true);
}
@ -199,10 +203,15 @@ void AWKeys::editItem(const QString &_type)
}
void AWKeys::dataUpdated(const QString &_sourceName, const Plasma::DataEngine::Data &_data)
void AWKeys::dataUpdated(const QHash<QString, KSysGuard::SensorInfo> &_sensors, const KSysGuard::SensorDataList &_data)
{
// run concurrent data update
QtConcurrent::run(m_threadPool, this, &AWKeys::setDataBySource, _sourceName, _data);
for (auto &single : _data) {
if (_sensors.contains(single.sensorProperty)) {
setDataBySource(single.sensorProperty, _sensors.value(single.sensorProperty), single);
}
// TODO use QtConcurrent::map or something like that
// QtConcurrent::run(m_threadPool, this, &AWKeys::setDataBySource, "ss", sensor);
}
}
@ -239,7 +248,7 @@ void AWKeys::updateTextData()
// do not do it in parallel to avoid race condition
m_mutex.lock();
calculateValues();
QString text = parsePattern(m_keyOperator->pattern());
auto text = parsePattern(m_keyOperator->pattern());
// update tooltip values under lock
m_dataAggregator->dataUpdate(m_values);
m_mutex.unlock();
@ -257,16 +266,16 @@ void AWKeys::calculateValues()
for (auto &device : mountDevices) {
int index = mountDevices.indexOf(device);
m_values[QString("hddtotmb%1").arg(index)]
= m_values[QString("hddfreemb%1").arg(index)].toFloat() + m_values[QString("hddmb%1").arg(index)].toFloat();
= m_values[QString("hddfreemb%1").arg(index)].toDouble() + m_values[QString("hddmb%1").arg(index)].toDouble();
m_values[QString("hddtotgb%1").arg(index)]
= m_values[QString("hddfreegb%1").arg(index)].toFloat() + m_values[QString("hddgb%1").arg(index)].toFloat();
= m_values[QString("hddfreegb%1").arg(index)].toDouble() + m_values[QString("hddgb%1").arg(index)].toDouble();
}
// memtot*
m_values["memtotmb"] = m_values["memusedmb"].toInt() + m_values["memfreemb"].toInt();
m_values["memtotgb"] = m_values["memusedgb"].toFloat() + m_values["memfreegb"].toFloat();
m_values["memtotmb"] = m_values["memusedmb"].toLongLong() + m_values["memfreemb"].toLongLong();
m_values["memtotgb"] = m_values["memusedgb"].toDouble() + m_values["memfreegb"].toDouble();
// mem
m_values["mem"] = 100.0f * m_values["memmb"].toFloat() / m_values["memtotmb"].toFloat();
m_values["mem"] = 100.0f * m_values["memmb"].toDouble() / m_values["memtotmb"].toDouble();
// up, down, upkb, downkb, upunits, downunits
int netIndex = m_keyOperator->devices("net").indexOf(m_values["netdev"].toString());
@ -282,10 +291,10 @@ void AWKeys::calculateValues()
m_values["upunits"] = m_values[QString("upunits%1").arg(netIndex)];
// swaptot*
m_values["swaptotmb"] = m_values["swapmb"].toInt() + m_values["swapfreemb"].toInt();
m_values["swaptotgb"] = m_values["swapgb"].toFloat() + m_values["swapfreegb"].toFloat();
m_values["swaptotmb"] = m_values["swapmb"].toLongLong() + m_values["swapfreemb"].toLongLong();
m_values["swaptotgb"] = m_values["swapgb"].toDouble() + m_values["swapfreegb"].toDouble();
// swap
m_values["swap"] = 100.0f * m_values["swapmb"].toFloat() / m_values["swaptotmb"].toFloat();
m_values["swap"] = 100.0f * m_values["swapmb"].toDouble() / m_values["swaptotmb"].toDouble();
// user defined keys
for (auto &key : m_keyOperator->userKeys())
@ -323,7 +332,7 @@ void AWKeys::createDBusInterface()
QString AWKeys::parsePattern(QString _pattern) const
{
// screen sign
_pattern.replace("$$", QString(0x1d));
_pattern.replace("$$", QChar(0x1d));
// lambdas
for (auto &key : m_foundLambdas)
@ -343,7 +352,7 @@ QString AWKeys::parsePattern(QString _pattern) const
}
// prepare strings
_pattern.replace(QString(0x1d), "$");
_pattern.replace(QChar(0x1d), "$");
if (m_wrapNewLines)
_pattern.replace("\n", "<br>");
@ -351,25 +360,25 @@ QString AWKeys::parsePattern(QString _pattern) const
}
void AWKeys::setDataBySource(const QString &_sourceName, const QVariantMap &_data)
void AWKeys::setDataBySource(const QString &_source, const KSysGuard::SensorInfo &_sensor, const KSysGuard::SensorData &_data)
{
qCDebug(LOG_AW) << "Source" << _sourceName << "with data" << _data;
qCDebug(LOG_AW) << "Source" << _source << _sensor.name << "with data" << _data.payload;
// first list init
QStringList tags = m_aggregator->keysFromSource(_sourceName);
auto tags = m_aggregator->keysFromSource(_source);
if (tags.isEmpty())
tags = m_aggregator->registerSource(_sourceName, _data["units"].toString(), m_requiredKeys);
tags = m_aggregator->registerSource(_source, _sensor.unit, m_requiredKeys);
// update data or drop source if there are no matches and exit
if (tags.isEmpty()) {
qCInfo(LOG_AW) << "Source" << _sourceName << "not found";
return emit(dropSourceFromDataengine(_sourceName));
qCInfo(LOG_AW) << "Source" << _source << "not found";
return emit(dropSourceFromDataengine(_source));
}
m_mutex.lock();
// HACK workaround for time values which are stored in the different path
std::for_each(tags.cbegin(), tags.cend(), [this, &_data, &_sourceName](const QString &tag) {
m_values[tag] = _sourceName == "Local" ? _data["DateTime"] : _data["value"];
std::for_each(tags.cbegin(), tags.cend(), [this, &_data](const QString &tag) {
m_values[tag] = _data.payload;
});
m_mutex.unlock();
}

View File

@ -19,11 +19,11 @@
#ifndef AWKEYS_H
#define AWKEYS_H
#include <Plasma/DataEngine>
#include <QMutex>
#include <QObject>
#include <ksysguard/systemstats/SensorInfo.h>
class AWDataAggregator;
class AWDataEngineAggregator;
@ -56,9 +56,7 @@ public:
Q_INVOKABLE void editItem(const QString &_type);
public slots:
void dataUpdated(const QString &_sourceName, const Plasma::DataEngine::Data &_data);
// dummy method required by DataEngine connections
static void modelChanged(const QString &, QAbstractItemModel *){};
void dataUpdated(const QHash<QString, KSysGuard::SensorInfo> &_sensors, const KSysGuard::SensorDataList &_data);
signals:
void dropSourceFromDataengine(const QString &_source);
@ -74,7 +72,7 @@ private:
void calculateValues();
void createDBusInterface();
[[nodiscard]] QString parsePattern(QString _pattern) const;
void setDataBySource(const QString &_sourceName, const QVariantMap &_data);
void setDataBySource(const QString &_source, const KSysGuard::SensorInfo &_sensor, const KSysGuard::SensorData &_data);
// objects
AWDataAggregator *m_dataAggregator = nullptr;
AWDataEngineAggregator *m_dataEngineAggregator = nullptr;

View File

@ -64,19 +64,19 @@ QString AWKeysAggregator::formatter(const QVariant &_data, const QString &_key,
// case block
switch (m_mapper->formatter(_key)) {
case FormatterType::Float:
output = QString("%1").arg(_data.toFloat(), 5, 'f', 1);
output = QString("%1").arg(_data.toDouble(), 5, 'f', 1);
break;
case FormatterType::FloatTwoSymbols:
output = QString("%1").arg(_data.toFloat(), 5, 'f', 2);
output = QString("%1").arg(_data.toDouble(), 5, 'f', 2);
break;
case FormatterType::Integer:
output = QString("%1").arg(_data.toFloat(), 4, 'f', 0);
output = QString("%1").arg(_data.toDouble(), 4, 'f', 0);
break;
case FormatterType::IntegerFive:
output = QString("%1").arg(_data.toFloat(), 5, 'f', 0);
output = QString("%1").arg(_data.toDouble(), 5, 'f', 0);
break;
case FormatterType::IntegerThree:
output = QString("%1").arg(_data.toFloat(), 3, 'f', 0);
output = QString("%1").arg(_data.toDouble(), 3, 'f', 0);
break;
case FormatterType::List:
output = _data.toStringList().join(',');
@ -85,10 +85,10 @@ QString AWKeysAggregator::formatter(const QVariant &_data, const QString &_key,
output = _data.toBool() ? m_acOnline : m_acOffline;
break;
case FormatterType::MemGBFormat:
output = QString("%1").arg(_data.toFloat() / (1024.0 * 1024.0), 5, 'f', 1);
output = QString("%1").arg(_data.toDouble() / (1024.0 * 1024.0), 5, 'f', 1);
break;
case FormatterType::MemMBFormat:
output = QString("%1").arg(_data.toFloat() / 1024.0, 5, 'f', 0);
output = QString("%1").arg(_data.toDouble() / 1024.0, 5, 'f', 0);
break;
case FormatterType::NetSmartFormat:
output = [](const float value) {
@ -96,10 +96,10 @@ QString AWKeysAggregator::formatter(const QVariant &_data, const QString &_key,
return QString("%1").arg(value / 1024.0, 4, 'f', 1);
else
return QString("%1").arg(value, 4, 'f', 0);
}(_data.toFloat());
}(_data.toDouble());
break;
case FormatterType::NetSmartUnits:
if (_data.toFloat() > 1024.0)
if (_data.toDouble() > 1024.0)
output = m_translate ? i18n("MB/s") : "MB/s";
else
output = m_translate ? i18n("KB/s") : "KB/s";
@ -110,7 +110,7 @@ QString AWKeysAggregator::formatter(const QVariant &_data, const QString &_key,
output = output.rightJustified(8, QLatin1Char(' '), true);
break;
case FormatterType::Temperature:
output = QString("%1").arg(temperature(_data.toFloat()), 5, 'f', 1);
output = QString("%1").arg(temperature(_data.toDouble()), 5, 'f', 1);
break;
case FormatterType::Time:
output = _data.toDateTime().toString();
@ -150,7 +150,7 @@ QString AWKeysAggregator::formatter(const QVariant &_data, const QString &_key,
source.replace("$m", QString("%1").arg(minutes));
return source;
}(m_mapper->formatter(_key) == FormatterType::Uptime ? "$ddd$hhh$mmm" : m_customUptime,
static_cast<int>(_data.toFloat()));
static_cast<int>(_data.toDouble()));
break;
case FormatterType::NoFormat:
output = _data.toString();
@ -234,7 +234,7 @@ void AWKeysAggregator::setTranslate(const bool _translate)
}
QStringList AWKeysAggregator::registerSource(const QString &_source, const QString &_units, const QStringList &_keys)
QStringList AWKeysAggregator::registerSource(const QString &_source, const KSysGuard::Unit &_units, const QStringList &_keys)
{
qCDebug(LOG_AW) << "Source" << _source << "with units" << _units;

View File

@ -19,6 +19,8 @@
#ifndef AWKEYSAGGREGATOR_H
#define AWKEYSAGGREGATOR_H
#include <ksysguard/formatter/Unit.h>
#include <QHash>
#include <QObject>
@ -81,7 +83,7 @@ public:
void setTranslate(bool _translate);
public slots:
QStringList registerSource(const QString &_source, const QString &_units, const QStringList &_keys);
QStringList registerSource(const QString &_source, const KSysGuard::Unit &_units, const QStringList &_keys);
private:
[[nodiscard]] float temperature(float temp) const;

View File

@ -105,9 +105,9 @@ QList<AWPatternFunctions::AWFunction> AWPatternFunctions::findFunctionCalls(cons
metadata.args = QStringList();
} else {
// replace '$,' to 0x1d
argsString.replace("$,", QString(0x1d));
argsString.replace("$,", QChar(0x1d));
QStringList args = argsString.split(',');
std::for_each(args.begin(), args.end(), [](QString &arg) { arg.replace(QString(0x1d), ","); });
std::for_each(args.begin(), args.end(), [](QString &arg) { arg.replace(QChar(0x1d), ","); });
metadata.args = args;
}
// other variables

View File

@ -24,6 +24,7 @@
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QSettings>
#include <QStandardPaths>
#include "awdebug.h"

View File

@ -3,25 +3,25 @@
# common QML constants
singleton General 1.0 file:///usr//awesomewidgets/qml/General.qml
singleton General 1.0 file:///usr/share/awesomewidgets/qml/General.qml
# custom QML UI classes
AboutTab file:///usr//awesomewidgets/qml/AboutTab.qml
AWExtensions file:///usr//awesomewidgets/qml/AWExtensions.qml
AWInfoLabel file:///usr//awesomewidgets/qml/AWInfoLabel.qml
AWTagSelector file:///usr//awesomewidgets/qml/AWTagSelector.qml
AWTextEditor file:///usr//awesomewidgets/qml/AWTextEditor.qml
BugReport file:///usr//awesomewidgets/qml/BugReport.qml
ButtonSelector file:///usr//awesomewidgets/qml/ButtonSelector.qml
CheckBoxSelector file:///usr//awesomewidgets/qml/CheckBoxSelector.qml
ColorSelector file:///usr//awesomewidgets/qml/ColorSelector.qml
ComboBoxSelector file:///usr//awesomewidgets/qml/ComboBoxSelector.qml
ExportDialog file:///usr//awesomewidgets/qml/ExportDialog.qml
FontSelector file:///usr//awesomewidgets/qml/FontSelector.qml
HtmlDefaultFunctionsBar file:///usr//awesomewidgets/qml/HtmlDefaultFunctionsBar.qml
HtmlEditorButton file:///usr//awesomewidgets/qml/HtmlEditorButton.qml
HtmlEditorColor file:///usr//awesomewidgets/qml/HtmlEditorColor.qml
HtmlEditorFont file:///usr//awesomewidgets/qml/HtmlEditorFont.qml
ImportDialog file:///usr//awesomewidgets/qml/ImportDialog.qml
IntegerSelector file:///usr//awesomewidgets/qml/IntegerSelector.qml
LineSelector file:///usr//awesomewidgets/qml/LineSelector.qml
AboutTab file:///usr/share/awesomewidgets/qml/AboutTab.qml
AWExtensions file:///usr/share/awesomewidgets/qml/AWExtensions.qml
AWInfoLabel file:///usr/share/awesomewidgets/qml/AWInfoLabel.qml
AWTagSelector file:///usr/share/awesomewidgets/qml/AWTagSelector.qml
AWTextEditor file:///usr/share/awesomewidgets/qml/AWTextEditor.qml
BugReport file:///usr/share/awesomewidgets/qml/BugReport.qml
ButtonSelector file:///usr/share/awesomewidgets/qml/ButtonSelector.qml
CheckBoxSelector file:///usr/share/awesomewidgets/qml/CheckBoxSelector.qml
ColorSelector file:///usr/share/awesomewidgets/qml/ColorSelector.qml
ComboBoxSelector file:///usr/share/awesomewidgets/qml/ComboBoxSelector.qml
ExportDialog file:///usr/share/awesomewidgets/qml/ExportDialog.qml
FontSelector file:///usr/share/awesomewidgets/qml/FontSelector.qml
HtmlDefaultFunctionsBar file:///usr/share/awesomewidgets/qml/HtmlDefaultFunctionsBar.qml
HtmlEditorButton file:///usr/share/awesomewidgets/qml/HtmlEditorButton.qml
HtmlEditorColor file:///usr/share/awesomewidgets/qml/HtmlEditorColor.qml
HtmlEditorFont file:///usr/share/awesomewidgets/qml/HtmlEditorFont.qml
ImportDialog file:///usr/share/awesomewidgets/qml/ImportDialog.qml
IntegerSelector file:///usr/share/awesomewidgets/qml/IntegerSelector.qml
LineSelector file:///usr/share/awesomewidgets/qml/LineSelector.qml

View File

@ -22,8 +22,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_D
find_package(KF6 REQUIRED COMPONENTS I18n Notifications Service WindowSystem)
find_package(LibTaskManager REQUIRED)
find_package(Plasma REQUIRED)
find_package(KSysGuard REQUIRED)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings)
set(Kf6_INCLUDE ${KDE_INSTALL_FULL_INCLUDEDIR_KF})
set(Kf6_LIBRARIES KF6::I18n KF6::Notifications KF6::WindowSystem PW::LibTaskManager)
set(Kf6_LIBRARIES KF6::I18n KF6::Notifications KF6::WindowSystem KSysGuard::Sensors KSysGuard::SensorFaces KSysGuard::SystemStats PW::LibTaskManager)

View File

@ -15,9 +15,9 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.2
import QtQuick.Controls 1.3 as QtControls
import QtQuick.Dialogs 1.2 as QtDialogs
import QtQuick 2.15
import QtQuick.Controls
import QtQuick.Dialogs
import org.kde.plasma.private.awesomewidget 1.0
@ -40,25 +40,25 @@ Row {
signal unlock
signal showMessage(string message)
QtControls.Button {
Button {
width: parent.width * 3 / 15
text: i18n("Edit bars")
onClicked: backend.editItem("graphicalitem")
}
QtControls.Button {
Button {
width: parent.width * 3 / 15
text: i18n("Formatters")
onClicked: awPairConfig.showFormatterDialog(backend.dictKeys(true))
}
QtControls.Button {
Button {
width: parent.width * 3 / 15
text: i18n("User keys")
onClicked: awPairConfig.showKeysDialog(backend.dictKeys(true))
}
QtControls.Button {
Button {
width: parent.width * 5 / 15
text: i18n("Preview")
onClicked: {
@ -68,30 +68,31 @@ Row {
}
}
QtControls.Button {
width: parent.width / 15
iconName: "view-history"
menu: QtControls.Menu {
id: historyConfig
Instantiator {
model: awTelemetryHandler.get("awwidgetconfig")
QtControls.MenuItem {
text: modelData
onTriggered: textArea.text = modelData
}
onObjectAdded: historyConfig.insertItem(index, object)
onObjectRemoved: historyConfig.removeItem(object)
}
}
}
// TODO migrate history
// Button {
// width: parent.width / 15
// iconName: "view-history"
// menu: Menu {
// id: historyConfig
// Instantiator {
// model: awTelemetryHandler.get("awwidgetconfig")
// MenuItem {
// text: modelData
// onTriggered: textArea.text = modelData
// }
// onObjectAdded: historyConfig.insertItem(index, object)
// onObjectRemoved: historyConfig.removeItem(object)
// }
// }
// }
QtDialogs.MessageDialog {
MessageDialog {
id: compiledText
modality: Qt.NonModal
title: i18n("Preview")
}
onShowMessage: {
onShowMessage: message => {
compiledText.text = message.split("&nbsp;").join(" ") // replaceAll lols
compiledText.open()
}

View File

@ -15,11 +15,11 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.2
import QtQuick.Controls 1.3 as QtControls
import QtQuick 2.15
import QtQuick.Controls
QtControls.Label {
Label {
width: parent.width
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter

View File

@ -15,8 +15,8 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.2
import QtQuick.Controls 1.3 as QtControls
import QtQuick 2.15
import QtQuick.Controls
Row {
@ -30,7 +30,7 @@ Row {
property var textArea
property alias groups: tagGroups.model
QtControls.ComboBox {
ComboBox {
id: tagGroups
width: parent.width * 2 / 5
textRole: "label"
@ -41,12 +41,12 @@ Row {
}
}
QtControls.ComboBox {
ComboBox {
id: tags
width: parent.width * 1 / 5
}
QtControls.Button {
Button {
width: parent.width * 1 / 5
text: i18n("Add")
@ -57,7 +57,7 @@ Row {
}
}
QtControls.Button {
Button {
width: parent.width * 1 / 5
text: i18n("Show value")

View File

@ -15,8 +15,8 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Controls 1.3 as QtControls
import QtQuick 2.15
import QtQuick.Controls
Item {
@ -26,7 +26,7 @@ Item {
property var backend
property alias text: textArea.text
QtControls.TextArea {
TextArea {
id: textArea
anchors.fill: parent
textFormat: TextEdit.PlainText

View File

@ -15,54 +15,61 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Controls 1.3 as QtControls
import QtQuick.Layouts 1.0 as QtLayouts
import QtQuick 2.15
import QtQuick.Controls
import QtQuick.Layouts
Column {
ColumnLayout {
anchors.fill: parent
property var textProvider
QtControls.TabView {
height: parent.height
TabBar {
id: bar
width: parent.width
TabButton {
text: i18n("About")
}
TabButton {
text: i18n("Acknowledgment")
}
}
QtControls.Tab {
anchors.margins: 10.0
title: i18n("About")
StackLayout {
width: parent.width
currentIndex: bar.currentIndex
QtLayouts.ColumnLayout {
QtControls.Label {
QtLayouts.Layout.fillWidth: true
ColumnLayout {
Label {
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
text: textProvider.getAboutText("header")
}
QtControls.Label {
QtLayouts.Layout.fillWidth: true
Label {
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
text: textProvider.getAboutText("version")
}
QtControls.Label {
QtLayouts.Layout.fillWidth: true
Label {
Layout.fillWidth: true
horizontalAlignment: Text.AlignJustify
text: textProvider.getAboutText("description")
}
QtControls.Label {
QtLayouts.Layout.fillWidth: true
Label {
Layout.fillWidth: true
horizontalAlignment: Text.AlignLeft
textFormat: Text.RichText
text: textProvider.getAboutText("links")
onLinkActivated: Qt.openUrlExternally(link)
}
QtControls.Label {
QtLayouts.Layout.fillHeight: true
QtLayouts.Layout.fillWidth: true
Label {
Layout.fillHeight: true
Layout.fillWidth: true
font.capitalization: Font.SmallCaps
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignBottom
@ -70,22 +77,17 @@ Column {
text: textProvider.getAboutText("copy")
}
}
}
QtControls.Tab {
anchors.margins: 10.0
title: i18n("Acknowledgment")
QtLayouts.ColumnLayout {
QtControls.Label {
QtLayouts.Layout.fillWidth: true
ColumnLayout {
Label {
Layout.fillWidth: true
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignJustify
text: textProvider.getAboutText("translators")
}
QtControls.Label {
QtLayouts.Layout.fillWidth: true
Label {
Layout.fillWidth: true
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignJustify
textFormat: Text.RichText
@ -93,9 +95,9 @@ Column {
onLinkActivated: Qt.openUrlExternally(link)
}
QtControls.Label {
QtLayouts.Layout.fillHeight: true
QtLayouts.Layout.fillWidth: true
Label {
Layout.fillHeight: true
Layout.fillWidth: true
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignJustify
verticalAlignment: Text.AlignTop
@ -105,5 +107,4 @@ Column {
}
}
}
}
}

View File

@ -15,15 +15,15 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Controls 1.3 as QtControls
import QtQuick.Dialogs 1.2 as QtDialogs
import QtQuick.Layouts 1.2 as QtLayouts
import QtQuick 2.15
import QtQuick.Controls
import QtQuick.Dialogs
import QtQuick.Layouts
import org.kde.plasma.private.awesomewidget 1.0
QtDialogs.Dialog {
Dialog {
id: reportDialog
AWActions {
id: awActions
@ -38,85 +38,85 @@ QtDialogs.Dialog {
title: i18n("Report a bug")
standardButtons: QtDialogs.StandardButton.Ok | QtDialogs.StandardButton.Cancel | QtDialogs.StandardButton.Reset
standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel | DialogButtonBox.Reset
QtLayouts.ColumnLayout {
ColumnLayout {
anchors.fill: parent
QtControls.TextField {
TextField {
id: title
QtLayouts.Layout.fillWidth: true
Layout.fillWidth: true
placeholderText: i18n("Report subject")
}
QtLayouts.ColumnLayout {
QtLayouts.Layout.fillWidth: true
ColumnLayout {
Layout.fillWidth: true
QtControls.GroupBox {
QtLayouts.Layout.fillWidth: true
GroupBox {
Layout.fillWidth: true
height: parent.height / 5
title: i18n("Description")
QtControls.TextArea {
TextArea {
id: description
anchors.fill: parent
textFormat: TextEdit.PlainText
}
}
QtControls.GroupBox {
QtLayouts.Layout.fillWidth: true
GroupBox {
Layout.fillWidth: true
height: parent.height / 5
title: i18n("Steps to reproduce")
QtControls.TextArea {
TextArea {
id: reproduce
anchors.fill: parent
textFormat: TextEdit.PlainText
}
}
QtControls.GroupBox {
QtLayouts.Layout.fillWidth: true
GroupBox {
Layout.fillWidth: true
height: parent.height / 5
title: i18n("Expected result")
QtControls.TextArea {
TextArea {
id: expected
anchors.fill: parent
textFormat: TextEdit.PlainText
}
}
QtControls.GroupBox {
QtLayouts.Layout.fillWidth: true
QtLayouts.Layout.alignment: Qt.AlignBottom
GroupBox {
Layout.fillWidth: true
Layout.alignment: Qt.AlignBottom
title: i18n("Logs")
QtLayouts.ColumnLayout {
ColumnLayout {
anchors.fill: parent
QtLayouts.Layout.fillWidth: true
Layout.fillWidth: true
Row {
QtLayouts.Layout.fillWidth: true
QtControls.Label {
Layout.fillWidth: true
Label {
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignJustify
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
text: i18n("Use command")
}
QtControls.TextField {
TextField {
width: parent.width * 3 / 5
readOnly: true
text: "QT_LOGGING_RULES=*=true plasmawindowed org.kde.plasma.awesomewidget"
}
}
QtControls.Button {
QtLayouts.Layout.fillWidth: true
Button {
Layout.fillWidth: true
text: i18n("Load log file")
onClicked: logPath.open()
}
QtControls.TextArea {
TextArea {
id: logBody
QtLayouts.Layout.fillWidth: true
QtLayouts.Layout.alignment: Qt.AlignBottom
Layout.fillWidth: true
Layout.alignment: Qt.AlignBottom
textFormat: TextEdit.PlainText
}
}
QtDialogs.FileDialog {
FileDialog {
id: logPath
title: i18n("Open log file")
onAccepted:

View File

@ -15,28 +15,27 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Controls 1.3 as QtControls
import QtQuick 2.15
import QtQuick.Controls
Row {
height: implicitHeight
width: parent.width
property alias text: label.text
property alias value: button.text
property alias style: button.style
property alias background: button.background
signal buttonActivated
QtControls.Label {
Label {
id: label
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
}
QtControls.Button {
Button {
id: button
width: parent.width * 3 / 5
onClicked: buttonActivated()

View File

@ -9,4 +9,4 @@ configure_file(${SUBPROJECT_QMLDIR_IN} ${CMAKE_CURRENT_SOURCE_DIR}/../awesome-wi
configure_file(${SUBPROJECT_QMLDIR_IN} ${CMAKE_CURRENT_SOURCE_DIR}/../desktop-panel/package/contents/ui/qmldir)
# install
install(FILES ${SUBPROJECT_SOURCE} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}/qml)
install(FILES ${SUBPROJECT_SOURCE} DESTINATION ${KDE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/qml)

View File

@ -15,8 +15,8 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Controls 1.3 as QtControls
import QtQuick 2.15
import QtQuick.Controls
Row {
@ -26,11 +26,11 @@ Row {
property alias text: checkBox.text
property alias checked: checkBox.checked
QtControls.Label {
Label {
height: parent.heigth
width: parent.width * 2 / 5
}
QtControls.CheckBox {
CheckBox {
id: checkBox
width: parent.width * 3 / 5
}

View File

@ -15,32 +15,22 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Controls.Styles 1.3 as QtStyles
import QtQuick.Dialogs 1.1 as QtDialogs
import QtQuick 2.15
import QtQuick.Dialogs
Row {
height: implicitHeight
width: parent.width
ButtonSelector {
// TODO somehow doesn't work
// background: Rectangle {
// color: value
// }
property alias text: selector.text
property alias value: selector.value
ButtonSelector {
id: selector
style: QtStyles.ButtonStyle {
background: Rectangle {
color: value
}
}
onButtonActivated: colorDialog.visible = true
}
QtDialogs.ColorDialog {
ColorDialog {
id: colorDialog
title: i18n("Select a color")
color: value
onAccepted: value = colorDialog.color
selectedColor: value
onAccepted: value = selectedColor
}
}

View File

@ -15,8 +15,8 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Controls 1.3 as QtControls
import QtQuick 2.15
import QtQuick.Controls
Row {
@ -32,14 +32,14 @@ Row {
signal valueEdited(string newValue)
QtControls.Label {
Label {
id: label
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
}
QtControls.ComboBox {
ComboBox {
id: comboBox
width: parent.width * 3 / 5
textRole: 'label'
@ -47,7 +47,7 @@ Row {
Component.onCompleted: {
var total = comboBox.model.length
for (var i = 0; i < total; i++) {
if (comboBox.model[i]["name"] == value)
if (comboBox.model[i]["name"] === value)
comboBox.currentIndex = i
}
}

View File

@ -15,8 +15,8 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Dialogs 1.2 as QtDialogs
import QtQuick 2.15
import QtQuick.Dialogs
import org.kde.plasma.private.awesomewidget 1.0
@ -28,16 +28,15 @@ Item {
id: awConfig
}
QtDialogs.MessageDialog {
MessageDialog {
id: messageDialog
standardButtons: QtDialogs.StandardButton.Ok
}
QtDialogs.FileDialog {
FileDialog {
id: fileDialog
selectExisting: false
fileMode: FileDialog.SaveFile
title: i18n("Export")
folder: awConfig.configurationDirectory()
currentFolder: awConfig.configurationDirectory()
onAccepted: {
var status = awConfig.exportConfiguration(
configuration,

View File

@ -15,8 +15,8 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Dialogs 1.1 as QtDialogs
import QtQuick 2.15
import QtQuick.Dialogs
Row {
@ -35,15 +35,15 @@ Row {
}
}
QtDialogs.FontDialog {
FontDialog {
id: fontDialog
title: i18n("Select a font")
signal setFont
onAccepted: value = fontDialog.font.family
onAccepted: value = selectedFont.family
onSetFont: {
fontDialog.font = Qt.font({
selectedFont = Qt.font({
family: value,
pointSize: 12,
italic: false,

View File

@ -16,8 +16,10 @@
***************************************************************************/
pragma Singleton
import QtQuick 2.0
import QtQuick 2.15
// required by i18n functions
import org.kde.plasma.core as PlasmaCore
QtObject {
property variant fontWeight: {

View File

@ -15,7 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.2
import QtQuick 2.15
Row {
@ -41,35 +41,35 @@ Row {
// new line
HtmlEditorButton {
width: parent.width / 15
iconName: "format-indent-more"
icon.name: "format-indent-more"
textField: textArea
end: "<br>\n"
}
// font properties
HtmlEditorButton {
width: parent.width / 15
iconName: "format-text-bold"
icon.name: "format-text-bold"
textField: textArea
start: "<b>"
end: "</b>"
}
HtmlEditorButton {
width: parent.width / 15
iconName: "format-text-italic"
icon.name: "format-text-italic"
textField: textArea
start: "<i>"
end: "</i>"
}
HtmlEditorButton {
width: parent.width / 15
iconName: "format-text-underline"
icon.name: "format-text-underline"
textField: textArea
start: "<u>"
end: "</u>"
}
HtmlEditorButton {
width: parent.width / 15
iconName: "format-text-strikethrough"
icon.name: "format-text-strikethrough"
textField: textArea
start: "<s>"
end: "</s>"
@ -78,28 +78,28 @@ Row {
// indentation
HtmlEditorButton {
width: parent.width / 15
iconName: "format-justify-left"
icon.name: "format-justify-left"
textField: textArea
start: "<p align=\"left\">"
end: "</p>"
}
HtmlEditorButton {
width: parent.width / 15
iconName: "format-justify-center"
icon.name: "format-justify-center"
textField: textArea
start: "<p align=\"center\">"
end: "</p>"
}
HtmlEditorButton {
width: parent.width / 15
iconName: "format-justify-right"
icon.name: "format-justify-right"
textField: textArea
start: "<p align=\"right\">"
end: "</p>"
}
HtmlEditorButton {
width: parent.width / 15
iconName: "format-justify-fill"
icon.name: "format-justify-fill"
textField: textArea
start: "<p align=\"justify\">"
end: "</p>"

View File

@ -15,11 +15,11 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.2
import QtQuick.Controls 1.3 as QtControls
import QtQuick 2.15
import QtQuick.Controls
QtControls.Button {
Button {
// parent object in which text will be replaced
property var textField
// start and end tags

View File

@ -15,8 +15,8 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.2
import QtQuick.Dialogs 1.1 as QtDialogs
import QtQuick 2.15
import QtQuick.Dialogs
HtmlEditorButton {
@ -24,7 +24,7 @@ HtmlEditorButton {
clickedEvent: function() { return colorDialog.open() }
QtDialogs.ColorDialog {
ColorDialog {
id: colorDialog
title: i18n("Select a color")

View File

@ -15,14 +15,14 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.2
import QtQuick 2.15
import org.kde.plasma.private.awesomewidget 1.0
HtmlEditorButton {
end: "</span>"
iconName: "font"
icon.name: "font"
text: i18n("Font")
// backend

View File

@ -15,9 +15,9 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Controls 1.3 as QtControls
import QtQuick.Dialogs 1.2 as QtDialogs
import QtQuick 2.15
import QtQuick.Controls
import QtQuick.Dialogs
import org.kde.plasma.private.awesomewidget 1.0
@ -29,28 +29,28 @@ Item {
signal configurationReceived(var configuration)
QtDialogs.FileDialog {
FileDialog {
id: fileDialog
title: i18n("Import")
folder: awConfig.configurationDirectory()
currentFolder: awConfig.configurationDirectory()
onAccepted: importSelection.open()
}
QtDialogs.Dialog {
Dialog {
id: importSelection
Column {
QtControls.CheckBox {
CheckBox {
id: importPlasmoid
text: i18n("Import plasmoid settings")
}
QtControls.CheckBox {
CheckBox {
id: importExtensions
text: i18n("Import extensions")
}
QtControls.CheckBox {
CheckBox {
id: importAdds
text: i18n("Import additional files")
}

View File

@ -15,8 +15,8 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Controls 1.3 as QtControls
import QtQuick 2.15
import QtQuick.Controls
Row {
@ -26,22 +26,22 @@ Row {
property alias text: label.text
property alias value: spinBox.value
property alias maximumValue: spinBox.maximumValue
property alias minimumValue: spinBox.minimumValue
property alias maximumValue: spinBox.to
property alias minimumValue: spinBox.from
property alias stepSize: spinBox.stepSize
signal valueEdited(int newValue)
QtControls.Label {
Label {
id: label
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
}
QtControls.SpinBox {
SpinBox {
id: spinBox
width: parent.width * 3 / 5
onEditingFinished: valueEdited(spinBox.value)
onValueModified: valueEdited(spinBox.value)
}
}

View File

@ -15,8 +15,8 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Controls 1.3 as QtControls
import QtQuick 2.15
import QtQuick.Controls
Row {
@ -28,14 +28,14 @@ Row {
signal valueEdited(string newValue)
QtControls.Label {
Label {
id: label
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
}
QtControls.TextField {
TextField {
id: textField
width: parent.width * 3 / 5
onEditingFinished: valueEdited(textField.text)

View File

@ -3,25 +3,25 @@
# common QML constants
singleton General 1.0 file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/General.qml
singleton General 1.0 file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/General.qml
# custom QML UI classes
AboutTab file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/AboutTab.qml
AWExtensions file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/AWExtensions.qml
AWInfoLabel file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/AWInfoLabel.qml
AWTagSelector file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/AWTagSelector.qml
AWTextEditor file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/AWTextEditor.qml
BugReport file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/BugReport.qml
ButtonSelector file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/ButtonSelector.qml
CheckBoxSelector file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/CheckBoxSelector.qml
ColorSelector file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/ColorSelector.qml
ComboBoxSelector file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/ComboBoxSelector.qml
ExportDialog file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/ExportDialog.qml
FontSelector file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/FontSelector.qml
HtmlDefaultFunctionsBar file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/HtmlDefaultFunctionsBar.qml
HtmlEditorButton file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/HtmlEditorButton.qml
HtmlEditorColor file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/HtmlEditorColor.qml
HtmlEditorFont file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/HtmlEditorFont.qml
ImportDialog file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/ImportDialog.qml
IntegerSelector file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/IntegerSelector.qml
LineSelector file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/LineSelector.qml
AboutTab file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/AboutTab.qml
AWExtensions file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/AWExtensions.qml
AWInfoLabel file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/AWInfoLabel.qml
AWTagSelector file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/AWTagSelector.qml
AWTextEditor file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/AWTextEditor.qml
BugReport file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/BugReport.qml
ButtonSelector file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/ButtonSelector.qml
CheckBoxSelector file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/CheckBoxSelector.qml
ColorSelector file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/ColorSelector.qml
ComboBoxSelector file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/ComboBoxSelector.qml
ExportDialog file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/ExportDialog.qml
FontSelector file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/FontSelector.qml
HtmlDefaultFunctionsBar file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/HtmlDefaultFunctionsBar.qml
HtmlEditorButton file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/HtmlEditorButton.qml
HtmlEditorColor file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/HtmlEditorColor.qml
HtmlEditorFont file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/HtmlEditorFont.qml
ImportDialog file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/ImportDialog.qml
IntegerSelector file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/IntegerSelector.qml
LineSelector file://@KDE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/qml/LineSelector.qml