port widget to dbus

This commit is contained in:
Evgenii Alekseev 2024-03-08 17:32:07 +02:00
parent 0fcfb7d7e4
commit 3b4901515b
51 changed files with 723 additions and 516 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) CFont CFont::fromQFont(const QFont font, const QColor color)
{ {
return CFont(font.family(), font.pointSize(), font.weight(), font.italic(), color); return CFont(font.family(), font.pointSize(), font.weight(), font.italic(), color);

View File

@ -34,11 +34,6 @@ public:
// color properties // color properties
QColor color(); QColor color();
void setCurrentColor(const 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 // conversion to QFont
static CFont fromQFont(const QFont font, static CFont fromQFont(const QFont font,
const QColor color = QColor(QString("#000000"))); const QColor color = QColor(QString("#000000")));

View File

@ -1,7 +1,7 @@
set(SUBPROJECT plasma_applet_awesome-widget) set(SUBPROJECT plasma_applet_awesome-widget)
message(STATUS "Subproject ${SUBPROJECT}") 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) add_subdirectory(plugin)
plasma_install_package(package org.kde.plasma.awesomewidget) 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": { "KPlugin": {
"Authors": [ "Authors": [
{ {
@ -18,12 +19,8 @@
"Id": "org.kde.plasma.awesomewidget", "Id": "org.kde.plasma.awesomewidget",
"License": "GPLv3", "License": "GPLv3",
"Name": "Awesome Widget", "Name": "Awesome Widget",
"ServiceTypes": [
"Plasma/Applet"
],
"Version": "@PROJECT_VERSION@", "Version": "@PROJECT_VERSION@",
"Website": "https://arcanis.me/projects/awesome-widgets/" "Website": "https://arcanis.me/projects/awesome-widgets/"
}, },
"X-Plasma-API": "declarativeappletscript", "X-Plasma-API-Minimum-Version": "6.0"
"X-Plasma-MainScript": "ui/main.qml"
} }

View File

@ -20,7 +20,7 @@ import QtQuick 2.0
import org.kde.plasma.private.awesomewidget 1.0 import org.kde.plasma.private.awesomewidget 1.0
Item { PlasmoidItem {
id: aboutPage id: aboutPage
// backend // backend
AWActions { AWActions {

View File

@ -21,7 +21,7 @@ import QtQuick.Controls 1.3 as QtControls
import org.kde.plasma.private.awesomewidget 1.0 import org.kde.plasma.private.awesomewidget 1.0
Item { PlasmoidItem {
id: advancedPage id: advancedPage
// backend // backend
AWActions { AWActions {

View File

@ -21,7 +21,7 @@ import org.kde.plasma.private.awesomewidget 1.0
import "." import "."
Item { PlasmoidItem {
id: appearancePage id: appearancePage
// backend // backend
AWActions { AWActions {

View File

@ -22,7 +22,7 @@ import QtQuick.Dialogs 1.1 as QtDialogs
import org.kde.plasma.private.awesomewidget 1.0 import org.kde.plasma.private.awesomewidget 1.0
Item { PlasmoidItem {
id: dataenginePage id: dataenginePage
// backend // backend
AWKeys { AWKeys {

View File

@ -15,19 +15,18 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
import QtQuick 2.4 import QtQuick 2.15
import QtQuick.Controls 1.3 as QtControls import QtQuick.Controls
import QtQuick.Dialogs 1.2 as QtDialogs import QtQuick.Dialogs
import QtQuick.Layouts 1.1 import QtQuick.Layouts
import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.plasmoid 2.0 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 org.kde.plasma.private.awesomewidget 1.0
import "." import "."
Item { PlasmoidItem {
id: main id: main
// backend // backend
AWKeys { AWKeys {
@ -74,17 +73,12 @@ Item {
signal sizeUpdate signal sizeUpdate
// init Layout.fillWidth: PlasmoidItem.formFactor != PlasmaCore.Planar
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation Layout.fillHeight: PlasmoidItem.formFactor != PlasmaCore.Planar
Plasmoid.compactRepresentation: Plasmoid.fullRepresentation
Layout.fillWidth: plasmoid.formFactor != PlasmaCore.Planar
Layout.fillHeight: plasmoid.formFactor != PlasmaCore.Planar
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
Plasmoid.icon: "utilities-system-monitor" Plasmoid.icon: "utilities-system-monitor"
Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground" Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground"
Plasmoid.associatedApplication: "ksysguard"
// ui // ui
@ -119,11 +113,11 @@ Item {
} }
} }
QtDialogs.Dialog { Dialog {
id: tagSelector id: tagSelector
title: i18n("Select tag") title: i18n("Select tag")
QtControls.ComboBox { ComboBox {
id: tagSelectorBox id: tagSelectorBox
width: parent.width width: parent.width
editable: true 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: { Component.onCompleted: {
if (debug) console.debug() 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 // init submodule
Plasmoid.userConfiguringChanged(false) Plasmoid.userConfiguringChanged(false)
// connect data // connect data
@ -160,14 +166,14 @@ Item {
if (plasmoid.configuration.checkUpdates) return awActions.checkUpdates(false) if (plasmoid.configuration.checkUpdates) return awActions.checkUpdates(false)
} }
onNeedTextUpdate: { onNeedTextUpdate: newText => {
if (debug) console.debug() if (debug) console.debug()
text.text = newText text.text = newText
sizeUpdate() sizeUpdate()
} }
onNeedToolTipUpdate: { onNeedToolTipUpdate: newText => {
if (debug) console.debug() if (debug) console.debug()
tooltip.text = newText tooltip.text = newText

View File

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

View File

@ -21,7 +21,7 @@ import QtQuick.Controls 1.3 as QtControls
import org.kde.plasma.private.awesomewidget 1.0 import org.kde.plasma.private.awesomewidget 1.0
Item { PlasmoidItem {
id: tooltipPage id: tooltipPage
// backend // backend
AWActions { AWActions {

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

View File

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

View File

@ -17,7 +17,8 @@
#include "awdataengineaggregator.h" #include "awdataengineaggregator.h"
#include <Plasma/DataContainer> #include <QDBusConnection>
#include <ksysguard/systemstats/DBusInterface.h>
#include "awdebug.h" #include "awdebug.h"
@ -27,20 +28,22 @@ AWDataEngineAggregator::AWDataEngineAggregator(QObject *_parent)
{ {
qCDebug(LOG_AW) << __PRETTY_FUNCTION__; qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
m_consumer = new Plasma::DataEngineConsumer(); qDBusRegisterMetaType<KSysGuard::SensorData>();
m_dataEngines["systemmonitor"] = m_consumer->dataEngine("systemmonitor"); qDBusRegisterMetaType<KSysGuard::SensorInfo>();
m_dataEngines["extsysmon"] = m_consumer->dataEngine("extsysmon"); qDBusRegisterMetaType<KSysGuard::SensorDataList>();
m_dataEngines["time"] = m_consumer->dataEngine("time"); qDBusRegisterMetaType<QHash<QString, KSysGuard::SensorInfo>>();
// additional method required by systemmonitor structure m_interface = new KSysGuard::SystemStats::DBusInterface(
m_newSourceConnection KSysGuard::SystemStats::ServiceName, KSysGuard::SystemStats::ObjectPath, QDBusConnection::sessionBus(), this);
= connect(m_dataEngines["systemmonitor"], &Plasma::DataEngine::sourceAdded, [this](const QString &source) {
emit(deviceAdded(source));
m_dataEngines["systemmonitor"]->connectSource(source, parent(), 1000);
});
// required to define Qt::QueuedConnection for signal-slot connection connect(m_interface, SIGNAL(newSensorData(KSysGuard::SensorDataList)), this,
qRegisterMetaType<Plasma::DataEngine::Data>("Plasma::DataEngine::Data"); SLOT(updateData(KSysGuard::SensorDataList)));
connect(m_interface, SIGNAL(sensorMetaDataChanged(const QHash<QString, KSysGuard::SensorInfo> &)), this,
SLOT(updateSensor(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() void AWDataEngineAggregator::disconnectSources()
{ {
for (auto dataEngine : m_dataEngines.values()) m_interface->unsubscribe(m_sensors.keys());
for (auto &source : dataEngine->sources())
dataEngine->disconnectSource(source, parent());
disconnect(m_newSourceConnection);
} }
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(); disconnectSources();
m_interface->subscribe(m_sensors.keys());
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 */
} }
void AWDataEngineAggregator::dropSource(const QString &_source) 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 m_interface->unsubscribe({_source});
// connected we will try to disconnect it from all engines
for (auto dataEngine : m_dataEngines.values())
dataEngine->disconnectSource(_source, parent());
} }
void AWDataEngineAggregator::createQueuedConnection() void AWDataEngineAggregator::sensorAdded(const QString &_sensor)
{ {
// HACK additional method which forces QueuedConnection instead of Auto one qCDebug(LOG_AW) << "New sensor added" << _sensor;
// for more details refer to plasma-framework source code
for (auto &dataEngine : m_dataEngines.keys()) { m_interface->subscribe({_sensor});
// 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);
} }
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 #ifndef AWDATAENGINEAGGREGATOR_H
#define AWDATAENGINEAGGREGATOR_H #define AWDATAENGINEAGGREGATOR_H
#include <Plasma/DataEngine> #include <ksysguard/systemstats/SensorInfo.h>
#include <Plasma/DataEngineConsumer>
#include <QObject> #include <QObject>
#include <QHash>
#include <QSet>
namespace KSysGuard::SystemStats
{
class DBusInterface;
}
class AWDataEngineAggregator : public QObject class AWDataEngineAggregator : public QObject
@ -33,19 +40,23 @@ public:
explicit AWDataEngineAggregator(QObject *_parent = nullptr); explicit AWDataEngineAggregator(QObject *_parent = nullptr);
~AWDataEngineAggregator() override; ~AWDataEngineAggregator() override;
void disconnectSources(); void disconnectSources();
void reconnectSources(int _interval); void loadSources();
void reconnectSources(const int interval);
signals: signals:
void dataUpdated(const QHash<QString, KSysGuard::SensorInfo> &_sensors, const KSysGuard::SensorDataList &_data);
void deviceAdded(const QString &_source); void deviceAdded(const QString &_source);
public slots: public slots:
void dropSource(const QString &_source); 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: private:
void createQueuedConnection(); KSysGuard::SystemStats::DBusInterface *m_interface = nullptr;
Plasma::DataEngineConsumer *m_consumer = nullptr; QHash<QString, KSysGuard::SensorInfo> m_sensors;
QHash<QString, Plasma::DataEngine *> m_dataEngines;
QMetaObject::Connection m_newSourceConnection;
}; };

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

View File

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

View File

@ -58,11 +58,15 @@ AWKeys::AWKeys(QObject *_parent)
// update key data if required // update key data if required
connect(m_keyOperator, SIGNAL(updateKeys(const QStringList &)), this, SLOT(reinitKeys(const QStringList &))); connect(m_keyOperator, SIGNAL(updateKeys(const QStringList &)), this, SLOT(reinitKeys(const QStringList &)));
connect(m_timer, SIGNAL(timeout()), this, SLOT(updateTextData())); connect(m_timer, SIGNAL(timeout()), this, SLOT(updateTextData()));
// transfer signal from AWDataAggregator object to QML ui // transfer signal from AWDataAggregator object to QML ui
connect(m_dataAggregator, SIGNAL(toolTipPainted(const QString &)), this, connect(m_dataAggregator, SIGNAL(toolTipPainted(const QString &)), this,
SIGNAL(needToolTipToBeUpdated(const QString &))); SIGNAL(needToolTipToBeUpdated(const QString &)));
connect(this, SIGNAL(dropSourceFromDataengine(const QString &)), m_dataEngineAggregator, connect(this, SIGNAL(dropSourceFromDataengine(const QString &)), m_dataEngineAggregator,
SLOT(dropSource(const QString &))); 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 // transfer signal from dataengine to update source list
connect(m_dataEngineAggregator, SIGNAL(deviceAdded(const QString &)), m_keyOperator, connect(m_dataEngineAggregator, SIGNAL(deviceAdded(const QString &)), m_keyOperator,
SLOT(addDevice(const QString &))); SLOT(addDevice(const QString &)));
@ -185,9 +189,9 @@ QString AWKeys::valueByKey(const QString &_key) const
{ {
qCDebug(LOG_AW) << "Requested value for key" << _key; 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 for (auto &single : _data) {
QtConcurrent::run(m_threadPool, this, &AWKeys::setDataBySource, _sourceName, _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 // do not do it in parallel to avoid race condition
m_mutex.lock(); m_mutex.lock();
calculateValues(); calculateValues();
QString text = parsePattern(m_keyOperator->pattern()); auto text = parsePattern(m_keyOperator->pattern());
// update tooltip values under lock // update tooltip values under lock
m_dataAggregator->dataUpdate(m_values); m_dataAggregator->dataUpdate(m_values);
m_mutex.unlock(); m_mutex.unlock();
@ -257,16 +266,16 @@ void AWKeys::calculateValues()
for (auto &device : mountDevices) { for (auto &device : mountDevices) {
int index = mountDevices.indexOf(device); int index = mountDevices.indexOf(device);
m_values[QString("hddtotmb%1").arg(index)] 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("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* // memtot*
m_values["memtotmb"] = m_values["memusedmb"].toInt() + m_values["memfreemb"].toInt(); m_values["memtotmb"] = m_values["memusedmb"].toLongLong() + m_values["memfreemb"].toLongLong();
m_values["memtotgb"] = m_values["memusedgb"].toFloat() + m_values["memfreegb"].toFloat(); m_values["memtotgb"] = m_values["memusedgb"].toDouble() + m_values["memfreegb"].toDouble();
// mem // 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 // up, down, upkb, downkb, upunits, downunits
int netIndex = m_keyOperator->devices("net").indexOf(m_values["netdev"].toString()); 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)]; m_values["upunits"] = m_values[QString("upunits%1").arg(netIndex)];
// swaptot* // swaptot*
m_values["swaptotmb"] = m_values["swapmb"].toInt() + m_values["swapfreemb"].toInt(); m_values["swaptotmb"] = m_values["swapmb"].toLongLong() + m_values["swapfreemb"].toLongLong();
m_values["swaptotgb"] = m_values["swapgb"].toFloat() + m_values["swapfreegb"].toFloat(); m_values["swaptotgb"] = m_values["swapgb"].toDouble() + m_values["swapfreegb"].toDouble();
// swap // 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 // user defined keys
for (auto &key : m_keyOperator->userKeys()) for (auto &key : m_keyOperator->userKeys())
@ -323,7 +332,7 @@ void AWKeys::createDBusInterface()
QString AWKeys::parsePattern(QString _pattern) const QString AWKeys::parsePattern(QString _pattern) const
{ {
// screen sign // screen sign
_pattern.replace("$$", QString(0x1d)); _pattern.replace("$$", QChar(0x1d));
// lambdas // lambdas
for (auto &key : m_foundLambdas) for (auto &key : m_foundLambdas)
@ -343,7 +352,7 @@ QString AWKeys::parsePattern(QString _pattern) const
} }
// prepare strings // prepare strings
_pattern.replace(QString(0x1d), "$"); _pattern.replace(QChar(0x1d), "$");
if (m_wrapNewLines) if (m_wrapNewLines)
_pattern.replace("\n", "<br>"); _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 // first list init
QStringList tags = m_aggregator->keysFromSource(_sourceName); auto tags = m_aggregator->keysFromSource(_source);
if (tags.isEmpty()) 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 // update data or drop source if there are no matches and exit
if (tags.isEmpty()) { if (tags.isEmpty()) {
qCInfo(LOG_AW) << "Source" << _sourceName << "not found"; qCInfo(LOG_AW) << "Source" << _source << "not found";
return emit(dropSourceFromDataengine(_sourceName)); return emit(dropSourceFromDataengine(_source));
} }
m_mutex.lock(); m_mutex.lock();
// HACK workaround for time values which are stored in the different path // 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) { std::for_each(tags.cbegin(), tags.cend(), [this, &_data](const QString &tag) {
m_values[tag] = _sourceName == "Local" ? _data["DateTime"] : _data["value"]; m_values[tag] = _data.payload;
}); });
m_mutex.unlock(); m_mutex.unlock();
} }

View File

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

View File

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

View File

@ -19,6 +19,8 @@
#ifndef AWKEYSAGGREGATOR_H #ifndef AWKEYSAGGREGATOR_H
#define AWKEYSAGGREGATOR_H #define AWKEYSAGGREGATOR_H
#include <ksysguard/formatter/Unit.h>
#include <QHash> #include <QHash>
#include <QObject> #include <QObject>
@ -81,7 +83,7 @@ public:
void setTranslate(bool _translate); void setTranslate(bool _translate);
public slots: 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: private:
[[nodiscard]] float temperature(float temp) const; [[nodiscard]] float temperature(float temp) const;

View File

@ -105,9 +105,9 @@ QList<AWPatternFunctions::AWFunction> AWPatternFunctions::findFunctionCalls(cons
metadata.args = QStringList(); metadata.args = QStringList();
} else { } else {
// replace '$,' to 0x1d // replace '$,' to 0x1d
argsString.replace("$,", QString(0x1d)); argsString.replace("$,", QChar(0x1d));
QStringList args = argsString.split(','); 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; metadata.args = args;
} }
// other variables // other variables

View File

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

View File

@ -3,25 +3,25 @@
# common QML constants # 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 # custom QML UI classes
AboutTab file:///usr//awesomewidgets/qml/AboutTab.qml AboutTab file:///usr/share/awesomewidgets/qml/AboutTab.qml
AWExtensions file:///usr//awesomewidgets/qml/AWExtensions.qml AWExtensions file:///usr/share/awesomewidgets/qml/AWExtensions.qml
AWInfoLabel file:///usr//awesomewidgets/qml/AWInfoLabel.qml AWInfoLabel file:///usr/share/awesomewidgets/qml/AWInfoLabel.qml
AWTagSelector file:///usr//awesomewidgets/qml/AWTagSelector.qml AWTagSelector file:///usr/share/awesomewidgets/qml/AWTagSelector.qml
AWTextEditor file:///usr//awesomewidgets/qml/AWTextEditor.qml AWTextEditor file:///usr/share/awesomewidgets/qml/AWTextEditor.qml
BugReport file:///usr//awesomewidgets/qml/BugReport.qml BugReport file:///usr/share/awesomewidgets/qml/BugReport.qml
ButtonSelector file:///usr//awesomewidgets/qml/ButtonSelector.qml ButtonSelector file:///usr/share/awesomewidgets/qml/ButtonSelector.qml
CheckBoxSelector file:///usr//awesomewidgets/qml/CheckBoxSelector.qml CheckBoxSelector file:///usr/share/awesomewidgets/qml/CheckBoxSelector.qml
ColorSelector file:///usr//awesomewidgets/qml/ColorSelector.qml ColorSelector file:///usr/share/awesomewidgets/qml/ColorSelector.qml
ComboBoxSelector file:///usr//awesomewidgets/qml/ComboBoxSelector.qml ComboBoxSelector file:///usr/share/awesomewidgets/qml/ComboBoxSelector.qml
ExportDialog file:///usr//awesomewidgets/qml/ExportDialog.qml ExportDialog file:///usr/share/awesomewidgets/qml/ExportDialog.qml
FontSelector file:///usr//awesomewidgets/qml/FontSelector.qml FontSelector file:///usr/share/awesomewidgets/qml/FontSelector.qml
HtmlDefaultFunctionsBar file:///usr//awesomewidgets/qml/HtmlDefaultFunctionsBar.qml HtmlDefaultFunctionsBar file:///usr/share/awesomewidgets/qml/HtmlDefaultFunctionsBar.qml
HtmlEditorButton file:///usr//awesomewidgets/qml/HtmlEditorButton.qml HtmlEditorButton file:///usr/share/awesomewidgets/qml/HtmlEditorButton.qml
HtmlEditorColor file:///usr//awesomewidgets/qml/HtmlEditorColor.qml HtmlEditorColor file:///usr/share/awesomewidgets/qml/HtmlEditorColor.qml
HtmlEditorFont file:///usr//awesomewidgets/qml/HtmlEditorFont.qml HtmlEditorFont file:///usr/share/awesomewidgets/qml/HtmlEditorFont.qml
ImportDialog file:///usr//awesomewidgets/qml/ImportDialog.qml ImportDialog file:///usr/share/awesomewidgets/qml/ImportDialog.qml
IntegerSelector file:///usr//awesomewidgets/qml/IntegerSelector.qml IntegerSelector file:///usr/share/awesomewidgets/qml/IntegerSelector.qml
LineSelector file:///usr//awesomewidgets/qml/LineSelector.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(KF6 REQUIRED COMPONENTS I18n Notifications Service WindowSystem)
find_package(LibTaskManager REQUIRED) find_package(LibTaskManager REQUIRED)
find_package(Plasma REQUIRED) find_package(Plasma REQUIRED)
find_package(KSysGuard REQUIRED)
include(KDEInstallDirs) include(KDEInstallDirs)
include(KDECMakeSettings) include(KDECMakeSettings)
include(KDECompilerSettings) include(KDECompilerSettings)
set(Kf6_INCLUDE ${KDE_INSTALL_FULL_INCLUDEDIR_KF}) 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/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
import QtQuick 2.2 import QtQuick 2.15
import QtQuick.Controls 1.3 as QtControls import QtQuick.Controls
import QtQuick.Dialogs 1.2 as QtDialogs import QtQuick.Dialogs
import org.kde.plasma.private.awesomewidget 1.0 import org.kde.plasma.private.awesomewidget 1.0
@ -40,25 +40,25 @@ Row {
signal unlock signal unlock
signal showMessage(string message) signal showMessage(string message)
QtControls.Button { Button {
width: parent.width * 3 / 15 width: parent.width * 3 / 15
text: i18n("Edit bars") text: i18n("Edit bars")
onClicked: backend.editItem("graphicalitem") onClicked: backend.editItem("graphicalitem")
} }
QtControls.Button { Button {
width: parent.width * 3 / 15 width: parent.width * 3 / 15
text: i18n("Formatters") text: i18n("Formatters")
onClicked: awPairConfig.showFormatterDialog(backend.dictKeys(true)) onClicked: awPairConfig.showFormatterDialog(backend.dictKeys(true))
} }
QtControls.Button { Button {
width: parent.width * 3 / 15 width: parent.width * 3 / 15
text: i18n("User keys") text: i18n("User keys")
onClicked: awPairConfig.showKeysDialog(backend.dictKeys(true)) onClicked: awPairConfig.showKeysDialog(backend.dictKeys(true))
} }
QtControls.Button { Button {
width: parent.width * 5 / 15 width: parent.width * 5 / 15
text: i18n("Preview") text: i18n("Preview")
onClicked: { onClicked: {
@ -68,14 +68,14 @@ Row {
} }
} }
QtControls.Button { Button {
width: parent.width / 15 width: parent.width / 15
iconName: "view-history" iconName: "view-history"
menu: QtControls.Menu { menu: Menu {
id: historyConfig id: historyConfig
Instantiator { Instantiator {
model: awTelemetryHandler.get("awwidgetconfig") model: awTelemetryHandler.get("awwidgetconfig")
QtControls.MenuItem { MenuItem {
text: modelData text: modelData
onTriggered: textArea.text = modelData onTriggered: textArea.text = modelData
} }
@ -85,7 +85,7 @@ Row {
} }
} }
QtDialogs.MessageDialog { MessageDialog {
id: compiledText id: compiledText
modality: Qt.NonModal modality: Qt.NonModal
title: i18n("Preview") title: i18n("Preview")

View File

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

View File

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

View File

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

View File

@ -15,9 +15,9 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
import QtQuick 2.0 import QtQuick 2.15
import QtQuick.Controls 1.3 as QtControls import QtQuick.Controls
import QtQuick.Layouts 1.0 as QtLayouts import QtQuick.Layouts
Column { Column {
@ -25,44 +25,44 @@ Column {
property var textProvider property var textProvider
QtControls.TabView { TabView {
height: parent.height height: parent.height
width: parent.width width: parent.width
QtControls.Tab { Tab {
anchors.margins: 10.0 anchors.margins: 10.0
title: i18n("About") title: i18n("About")
QtLayouts.ColumnLayout { ColumnLayout {
QtControls.Label { Label {
QtLayouts.Layout.fillWidth: true Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: textProvider.getAboutText("header") text: textProvider.getAboutText("header")
} }
QtControls.Label { Label {
QtLayouts.Layout.fillWidth: true Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: textProvider.getAboutText("version") text: textProvider.getAboutText("version")
} }
QtControls.Label { Label {
QtLayouts.Layout.fillWidth: true Layout.fillWidth: true
horizontalAlignment: Text.AlignJustify horizontalAlignment: Text.AlignJustify
text: textProvider.getAboutText("description") text: textProvider.getAboutText("description")
} }
QtControls.Label { Label {
QtLayouts.Layout.fillWidth: true Layout.fillWidth: true
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
textFormat: Text.RichText textFormat: Text.RichText
text: textProvider.getAboutText("links") text: textProvider.getAboutText("links")
onLinkActivated: Qt.openUrlExternally(link) onLinkActivated: Qt.openUrlExternally(link)
} }
QtControls.Label { Label {
QtLayouts.Layout.fillHeight: true Layout.fillHeight: true
QtLayouts.Layout.fillWidth: true Layout.fillWidth: true
font.capitalization: Font.SmallCaps font.capitalization: Font.SmallCaps
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignBottom verticalAlignment: Text.AlignBottom
@ -72,20 +72,20 @@ Column {
} }
} }
QtControls.Tab { Tab {
anchors.margins: 10.0 anchors.margins: 10.0
title: i18n("Acknowledgment") title: i18n("Acknowledgment")
QtLayouts.ColumnLayout { ColumnLayout {
QtControls.Label { Label {
QtLayouts.Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignJustify horizontalAlignment: Text.AlignJustify
text: textProvider.getAboutText("translators") text: textProvider.getAboutText("translators")
} }
QtControls.Label { Label {
QtLayouts.Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignJustify horizontalAlignment: Text.AlignJustify
textFormat: Text.RichText textFormat: Text.RichText
@ -93,9 +93,9 @@ Column {
onLinkActivated: Qt.openUrlExternally(link) onLinkActivated: Qt.openUrlExternally(link)
} }
QtControls.Label { Label {
QtLayouts.Layout.fillHeight: true Layout.fillHeight: true
QtLayouts.Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignJustify horizontalAlignment: Text.AlignJustify
verticalAlignment: Text.AlignTop verticalAlignment: Text.AlignTop

View File

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

View File

@ -15,8 +15,8 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
import QtQuick 2.0 import QtQuick 2.15
import QtQuick.Controls 1.3 as QtControls import QtQuick.Controls
Row { Row {
@ -29,14 +29,14 @@ Row {
signal buttonActivated signal buttonActivated
QtControls.Label { Label {
id: label id: label
height: parent.height height: parent.height
width: parent.width * 2 / 5 width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
QtControls.Button { Button {
id: button id: button
width: parent.width * 3 / 5 width: parent.width * 3 / 5
onClicked: buttonActivated() 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) configure_file(${SUBPROJECT_QMLDIR_IN} ${CMAKE_CURRENT_SOURCE_DIR}/../desktop-panel/package/contents/ui/qmldir)
# install # 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/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
import QtQuick 2.0 import QtQuick 2.15
import QtQuick.Controls 1.3 as QtControls import QtQuick.Controls
Row { Row {
@ -26,11 +26,11 @@ Row {
property alias text: checkBox.text property alias text: checkBox.text
property alias checked: checkBox.checked property alias checked: checkBox.checked
QtControls.Label { Label {
height: parent.heigth height: parent.heigth
width: parent.width * 2 / 5 width: parent.width * 2 / 5
} }
QtControls.CheckBox { CheckBox {
id: checkBox id: checkBox
width: parent.width * 3 / 5 width: parent.width * 3 / 5
} }

View File

@ -15,9 +15,9 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
import QtQuick 2.0 import QtQuick 2.15
import QtQuick.Controls.Styles 1.3 as QtStyles import QtQuick.Controls.Styles
import QtQuick.Dialogs 1.1 as QtDialogs import QtQuick.Dialogs
Row { Row {
@ -29,7 +29,7 @@ Row {
ButtonSelector { ButtonSelector {
id: selector id: selector
style: QtStyles.ButtonStyle { style: ButtonStyle {
background: Rectangle { background: Rectangle {
color: value color: value
} }
@ -37,7 +37,7 @@ Row {
onButtonActivated: colorDialog.visible = true onButtonActivated: colorDialog.visible = true
} }
QtDialogs.ColorDialog { ColorDialog {
id: colorDialog id: colorDialog
title: i18n("Select a color") title: i18n("Select a color")
color: value color: value

View File

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

View File

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

View File

@ -15,8 +15,8 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
import QtQuick 2.0 import QtQuick 2.15
import QtQuick.Dialogs 1.1 as QtDialogs import QtQuick.Dialogs
Row { Row {
@ -35,7 +35,7 @@ Row {
} }
} }
QtDialogs.FontDialog { FontDialog {
id: fontDialog id: fontDialog
title: i18n("Select a font") title: i18n("Select a font")

View File

@ -16,7 +16,7 @@
***************************************************************************/ ***************************************************************************/
pragma Singleton pragma Singleton
import QtQuick 2.0 import QtQuick 2.15
QtObject { QtObject {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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