mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-05-04 20:33:48 +00:00
Compare commits
1 Commits
e6aecaf685
...
0aec0f30f0
Author | SHA1 | Date | |
---|---|---|---|
0aec0f30f0 |
@ -21,7 +21,7 @@ import org.kde.plasma.private.awesomewidget 1.0
|
|||||||
import "."
|
import "."
|
||||||
|
|
||||||
|
|
||||||
Item {
|
PlasmoidItem {
|
||||||
id: appearancePage
|
id: appearancePage
|
||||||
// backend
|
// backend
|
||||||
AWActions {
|
AWActions {
|
||||||
|
@ -16,12 +16,13 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
|
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 {
|
||||||
@ -47,7 +48,7 @@ Item {
|
|||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
GroupBox {
|
QtControls.GroupBox {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
title: i18n("ACPI")
|
title: i18n("ACPI")
|
||||||
@ -58,7 +59,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupBox {
|
QtControls.GroupBox {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
title: i18n("GPU")
|
title: i18n("GPU")
|
||||||
@ -87,7 +88,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupBox {
|
QtControls.GroupBox {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
title: i18n("HDD temperature")
|
title: i18n("HDD temperature")
|
||||||
@ -109,7 +110,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupBox {
|
QtControls.GroupBox {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
title: i18n("Player")
|
title: i18n("Player")
|
||||||
@ -207,7 +208,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupBox {
|
QtControls.GroupBox {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
title: i18n("Extensions")
|
title: i18n("Extensions")
|
||||||
|
@ -12,10 +12,15 @@ include_directories(
|
|||||||
${Kf6_INCLUDE}
|
${Kf6_INCLUDE}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
file(GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
||||||
|
file(RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
||||||
file(GLOB SUBPROJECT_SOURCE *.cpp ${CMAKE_SOURCE_DIR}/*.cpp)
|
file(GLOB SUBPROJECT_SOURCE *.cpp ${CMAKE_SOURCE_DIR}/*.cpp)
|
||||||
file(GLOB SUBPROJECT_HEADER *.h)
|
file(GLOB SUBPROJECT_HEADER *.h)
|
||||||
file(GLOB SUBPROJECT_CONF *.conf)
|
file(GLOB SUBPROJECT_CONF *.conf)
|
||||||
|
|
||||||
|
# prepare
|
||||||
|
configure_file(${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||||
|
|
||||||
# make
|
# make
|
||||||
add_library(${SUBPROJECT} MODULE ${SUBPROJECT_SOURCE} ${SUBPROJECT_HEADER})
|
add_library(${SUBPROJECT} MODULE ${SUBPROJECT_SOURCE} ${SUBPROJECT_HEADER})
|
||||||
target_link_libraries(${SUBPROJECT}
|
target_link_libraries(${SUBPROJECT}
|
||||||
@ -23,5 +28,6 @@ target_link_libraries(${SUBPROJECT}
|
|||||||
${Qt_LIBRARIES} ${Kf6_LIBRARIES})
|
${Qt_LIBRARIES} ${Kf6_LIBRARIES})
|
||||||
|
|
||||||
# install
|
# install
|
||||||
install(TARGETS ${SUBPROJECT} DESTINATION ${KDE_INSTALL_PLUGINDIR}/ksystemstats)
|
install(TARGETS ${SUBPROJECT} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine)
|
||||||
|
#install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
|
||||||
install(FILES ${SUBPROJECT_CONF} DESTINATION ${KDE_INSTALL_CONFDIR})
|
install(FILES ${SUBPROJECT_CONF} DESTINATION ${KDE_INSTALL_CONFDIR})
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
#include "extsysmon.h"
|
#include "extsysmon.h"
|
||||||
|
|
||||||
#include <KPluginFactory>
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
@ -30,17 +29,21 @@
|
|||||||
|
|
||||||
|
|
||||||
ExtendedSysMon::ExtendedSysMon(QObject *_parent, const QVariantList &_args)
|
ExtendedSysMon::ExtendedSysMon(QObject *_parent, const QVariantList &_args)
|
||||||
: KSysGuard::SensorPlugin(_parent, _args)
|
: Plasma::DataEngine(_parent, _args)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(_args)
|
||||||
qSetMessagePattern(AWDebug::LOG_FORMAT);
|
qSetMessagePattern(AWDebug::LOG_FORMAT);
|
||||||
qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
|
||||||
for (auto &metadata : AWDebug::getBuildData())
|
for (auto &metadata : AWDebug::getBuildData())
|
||||||
qCDebug(LOG_ESM) << metadata;
|
qCDebug(LOG_ESM) << metadata;
|
||||||
|
|
||||||
|
setMinimumPollingInterval(333);
|
||||||
readConfiguration();
|
readConfiguration();
|
||||||
|
|
||||||
// init aggregator
|
// init aggregator
|
||||||
m_aggregator = new ExtSysMonAggregator("extsysmon", "extsysmon", this, m_configuration);
|
m_aggregator = new ExtSysMonAggregator(this, m_configuration);
|
||||||
|
for (auto &source : m_aggregator->sources())
|
||||||
|
setData(source, m_aggregator->initialData(source));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -50,9 +53,35 @@ ExtendedSysMon::~ExtendedSysMon()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ExtendedSysMon::update()
|
QStringList ExtendedSysMon::sources() const
|
||||||
{
|
{
|
||||||
// m_aggregator->update();
|
return m_aggregator->sources();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ExtendedSysMon::sourceRequestEvent(const QString &_source)
|
||||||
|
{
|
||||||
|
qCDebug(LOG_ESM) << "Source" << _source;
|
||||||
|
|
||||||
|
return updateSourceEvent(_source);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ExtendedSysMon::updateSourceEvent(const QString &_source)
|
||||||
|
{
|
||||||
|
qCDebug(LOG_ESM) << "Source" << _source;
|
||||||
|
|
||||||
|
if (m_aggregator->hasSource(_source)) {
|
||||||
|
QVariant data = m_aggregator->data(_source);
|
||||||
|
if (data.isNull())
|
||||||
|
return false;
|
||||||
|
setData(_source, "value", data);
|
||||||
|
} else {
|
||||||
|
qCWarning(LOG_ESM) << "Unknown source" << _source;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -121,6 +150,6 @@ QHash<QString, QString> ExtendedSysMon::updateConfiguration(QHash<QString, QStri
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
K_PLUGIN_CLASS_WITH_JSON(ExtendedSysMon, "metadata.json")
|
K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(extsysmon, ExtendedSysMon, "plasma-dataengine-extsysmon.json")
|
||||||
|
|
||||||
#include "extsysmon.moc"
|
#include "extsysmon.moc"
|
||||||
|
@ -18,12 +18,12 @@
|
|||||||
#ifndef EXTSYSMON_H
|
#ifndef EXTSYSMON_H
|
||||||
#define EXTSYSMON_H
|
#define EXTSYSMON_H
|
||||||
|
|
||||||
#include <ksysguard/systemstats/SensorPlugin.h>
|
#include <Plasma/Plasma/DataEngine>
|
||||||
|
|
||||||
|
|
||||||
class ExtSysMonAggregator;
|
class ExtSysMonAggregator;
|
||||||
|
|
||||||
class ExtendedSysMon : public KSysGuard::SensorPlugin
|
class ExtendedSysMon : public Plasma::DataEngine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -31,12 +31,10 @@ public:
|
|||||||
explicit ExtendedSysMon(QObject *_parent, const QVariantList &_args);
|
explicit ExtendedSysMon(QObject *_parent, const QVariantList &_args);
|
||||||
~ExtendedSysMon() override;
|
~ExtendedSysMon() override;
|
||||||
|
|
||||||
[[nodiscard]] QString providerName() const override
|
protected:
|
||||||
{
|
[[nodiscard]] QStringList sources() const override;
|
||||||
return QStringLiteral("extsysmon");
|
bool sourceRequestEvent(const QString &_source) override;
|
||||||
}
|
bool updateSourceEvent(const QString &_source) override;
|
||||||
|
|
||||||
void update() override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// configuration
|
// configuration
|
||||||
|
@ -35,12 +35,8 @@
|
|||||||
#include "weathersource.h"
|
#include "weathersource.h"
|
||||||
|
|
||||||
|
|
||||||
ExtSysMonAggregator::ExtSysMonAggregator(
|
ExtSysMonAggregator::ExtSysMonAggregator(QObject *_parent, const QHash<QString, QString> &_config)
|
||||||
const QString &_id,
|
: QObject(_parent)
|
||||||
const QString &_name,
|
|
||||||
KSysGuard::SensorContainer *_parent,
|
|
||||||
const QHash<QString, QString> &_config)
|
|
||||||
: KSysGuard::SensorObject(_id, _name, _parent)
|
|
||||||
{
|
{
|
||||||
qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
|
@ -19,16 +19,16 @@
|
|||||||
#define EXTSYSMONAGGREGATOR_H
|
#define EXTSYSMONAGGREGATOR_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <ksysguard/systemstats/SensorObject.h>
|
|
||||||
|
|
||||||
#include "abstractextsysmonsource.h"
|
#include "abstractextsysmonsource.h"
|
||||||
|
|
||||||
class ExtSysMonAggregator : public KSysGuard::SensorObject
|
|
||||||
|
class ExtSysMonAggregator : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ExtSysMonAggregator(const QString &_id, const QString &_name, KSysGuard::SensorContainer *_parent, const QHash<QString, QString> &_config);
|
explicit ExtSysMonAggregator(QObject *_parent, const QHash<QString, QString> &_config);
|
||||||
~ExtSysMonAggregator() override;
|
~ExtSysMonAggregator() override;
|
||||||
[[nodiscard]] QVariant data(const QString &_source) const;
|
[[nodiscard]] QVariant data(const QString &_source) const;
|
||||||
[[nodiscard]] bool hasSource(const QString &_source) const;
|
[[nodiscard]] bool hasSource(const QString &_source) const;
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"providerName": "extsysmon"
|
|
||||||
}
|
|
16
sources/extsysmon/plasma-dataengine-extsysmon.desktop
Normal file
16
sources/extsysmon/plasma-dataengine-extsysmon.desktop
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
|
Name=Extended SystemMonitor
|
||||||
|
Comment=Adds some additional functions to System DataEngine
|
||||||
|
ServiceTypes=Plasma/DataEngine
|
||||||
|
Type=Service
|
||||||
|
Icon=utilities-system-monitor
|
||||||
|
|
||||||
|
X-KDE-Library=plasma_dataengine_extsysmon
|
||||||
|
|
||||||
|
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||||
|
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||||
|
X-KDE-PluginInfo-Name=extsysmon
|
||||||
|
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
|
||||||
|
X-KDE-PluginInfo-Category=System Information
|
||||||
|
X-KDE-PluginInfo-License=GPL3
|
20
sources/extsysmon/plasma-dataengine-extsysmon.json
Normal file
20
sources/extsysmon/plasma-dataengine-extsysmon.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"KPlugin": {
|
||||||
|
"Authors": [
|
||||||
|
{
|
||||||
|
"Email": "esalexeev@gmail.com",
|
||||||
|
"Name": "Evgeniy Alekseev aka arcanis"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Category": "System Information",
|
||||||
|
"Description": "Adds some additional functions to System DataEngine",
|
||||||
|
"Icon": "utilities-system-monitor",
|
||||||
|
"Id": "extsysmon",
|
||||||
|
"License": "GPL3",
|
||||||
|
"Name": "Extended SystemMonitor",
|
||||||
|
"ServiceTypes": [
|
||||||
|
"Plasma/DataEngine"
|
||||||
|
],
|
||||||
|
"Version": "@PROJECT_VERSION@"
|
||||||
|
}
|
||||||
|
}
|
@ -27,4 +27,4 @@ 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::CoreAddons KF6::I18n KF6::Notifications KF6::WindowSystem KSysGuard::Sensors KSysGuard::SensorFaces KSysGuard::SystemStats PW::LibTaskManager)
|
set(Kf6_LIBRARIES KF6::I18n KF6::Notifications KF6::WindowSystem KSysGuard::Sensors KSysGuard::SensorFaces KSysGuard::SystemStats PW::LibTaskManager)
|
||||||
|
@ -41,9 +41,9 @@ Row {
|
|||||||
|
|
||||||
signal setFont
|
signal setFont
|
||||||
|
|
||||||
onAccepted: value = selectedFont.family
|
onAccepted: value = fontDialog.font.family
|
||||||
onSetFont: {
|
onSetFont: {
|
||||||
selectedFont = Qt.font({
|
fontDialog.font = Qt.font({
|
||||||
family: value,
|
family: value,
|
||||||
pointSize: 12,
|
pointSize: 12,
|
||||||
italic: false,
|
italic: false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user