mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-05-04 12:23:49 +00:00
Compare commits
2 Commits
0aec0f30f0
...
e6aecaf685
Author | SHA1 | Date | |
---|---|---|---|
e6aecaf685 | |||
423597dbd9 |
@ -21,7 +21,7 @@ import org.kde.plasma.private.awesomewidget 1.0
|
||||
import "."
|
||||
|
||||
|
||||
PlasmoidItem {
|
||||
Item {
|
||||
id: appearancePage
|
||||
// backend
|
||||
AWActions {
|
||||
|
@ -16,13 +16,12 @@
|
||||
***************************************************************************/
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
import QtQuick.Controls
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
PlasmoidItem {
|
||||
Item {
|
||||
id: dataenginePage
|
||||
// backend
|
||||
AWKeys {
|
||||
@ -48,7 +47,7 @@ PlasmoidItem {
|
||||
Column {
|
||||
id: pageColumn
|
||||
anchors.fill: parent
|
||||
QtControls.GroupBox {
|
||||
GroupBox {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
title: i18n("ACPI")
|
||||
@ -59,7 +58,7 @@ PlasmoidItem {
|
||||
}
|
||||
}
|
||||
|
||||
QtControls.GroupBox {
|
||||
GroupBox {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
title: i18n("GPU")
|
||||
@ -88,7 +87,7 @@ PlasmoidItem {
|
||||
}
|
||||
}
|
||||
|
||||
QtControls.GroupBox {
|
||||
GroupBox {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
title: i18n("HDD temperature")
|
||||
@ -110,7 +109,7 @@ PlasmoidItem {
|
||||
}
|
||||
}
|
||||
|
||||
QtControls.GroupBox {
|
||||
GroupBox {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
title: i18n("Player")
|
||||
@ -208,7 +207,7 @@ PlasmoidItem {
|
||||
}
|
||||
}
|
||||
|
||||
QtControls.GroupBox {
|
||||
GroupBox {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
title: i18n("Extensions")
|
||||
|
@ -12,15 +12,10 @@ include_directories(
|
||||
${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_HEADER *.h)
|
||||
file(GLOB SUBPROJECT_CONF *.conf)
|
||||
|
||||
# prepare
|
||||
configure_file(${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||
|
||||
# make
|
||||
add_library(${SUBPROJECT} MODULE ${SUBPROJECT_SOURCE} ${SUBPROJECT_HEADER})
|
||||
target_link_libraries(${SUBPROJECT}
|
||||
@ -28,6 +23,5 @@ target_link_libraries(${SUBPROJECT}
|
||||
${Qt_LIBRARIES} ${Kf6_LIBRARIES})
|
||||
|
||||
# install
|
||||
install(TARGETS ${SUBPROJECT} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine)
|
||||
#install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
|
||||
install(TARGETS ${SUBPROJECT} DESTINATION ${KDE_INSTALL_PLUGINDIR}/ksystemstats)
|
||||
install(FILES ${SUBPROJECT_CONF} DESTINATION ${KDE_INSTALL_CONFDIR})
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "extsysmon.h"
|
||||
|
||||
#include <KPluginFactory>
|
||||
#include <QFile>
|
||||
#include <QRegularExpression>
|
||||
#include <QSettings>
|
||||
@ -29,21 +30,17 @@
|
||||
|
||||
|
||||
ExtendedSysMon::ExtendedSysMon(QObject *_parent, const QVariantList &_args)
|
||||
: Plasma::DataEngine(_parent, _args)
|
||||
: KSysGuard::SensorPlugin(_parent, _args)
|
||||
{
|
||||
Q_UNUSED(_args)
|
||||
qSetMessagePattern(AWDebug::LOG_FORMAT);
|
||||
qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
|
||||
for (auto &metadata : AWDebug::getBuildData())
|
||||
qCDebug(LOG_ESM) << metadata;
|
||||
|
||||
setMinimumPollingInterval(333);
|
||||
readConfiguration();
|
||||
|
||||
// init aggregator
|
||||
m_aggregator = new ExtSysMonAggregator(this, m_configuration);
|
||||
for (auto &source : m_aggregator->sources())
|
||||
setData(source, m_aggregator->initialData(source));
|
||||
m_aggregator = new ExtSysMonAggregator("extsysmon", "extsysmon", this, m_configuration);
|
||||
}
|
||||
|
||||
|
||||
@ -53,35 +50,9 @@ ExtendedSysMon::~ExtendedSysMon()
|
||||
}
|
||||
|
||||
|
||||
QStringList ExtendedSysMon::sources() const
|
||||
void ExtendedSysMon::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;
|
||||
// m_aggregator->update();
|
||||
}
|
||||
|
||||
|
||||
@ -150,6 +121,6 @@ QHash<QString, QString> ExtendedSysMon::updateConfiguration(QHash<QString, QStri
|
||||
}
|
||||
|
||||
|
||||
K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(extsysmon, ExtendedSysMon, "plasma-dataengine-extsysmon.json")
|
||||
K_PLUGIN_CLASS_WITH_JSON(ExtendedSysMon, "metadata.json")
|
||||
|
||||
#include "extsysmon.moc"
|
||||
|
@ -18,12 +18,12 @@
|
||||
#ifndef EXTSYSMON_H
|
||||
#define EXTSYSMON_H
|
||||
|
||||
#include <Plasma/Plasma/DataEngine>
|
||||
#include <ksysguard/systemstats/SensorPlugin.h>
|
||||
|
||||
|
||||
class ExtSysMonAggregator;
|
||||
|
||||
class ExtendedSysMon : public Plasma::DataEngine
|
||||
class ExtendedSysMon : public KSysGuard::SensorPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -31,10 +31,12 @@ public:
|
||||
explicit ExtendedSysMon(QObject *_parent, const QVariantList &_args);
|
||||
~ExtendedSysMon() override;
|
||||
|
||||
protected:
|
||||
[[nodiscard]] QStringList sources() const override;
|
||||
bool sourceRequestEvent(const QString &_source) override;
|
||||
bool updateSourceEvent(const QString &_source) override;
|
||||
[[nodiscard]] QString providerName() const override
|
||||
{
|
||||
return QStringLiteral("extsysmon");
|
||||
}
|
||||
|
||||
void update() override;
|
||||
|
||||
private:
|
||||
// configuration
|
||||
|
@ -35,8 +35,12 @@
|
||||
#include "weathersource.h"
|
||||
|
||||
|
||||
ExtSysMonAggregator::ExtSysMonAggregator(QObject *_parent, const QHash<QString, QString> &_config)
|
||||
: QObject(_parent)
|
||||
ExtSysMonAggregator::ExtSysMonAggregator(
|
||||
const QString &_id,
|
||||
const QString &_name,
|
||||
KSysGuard::SensorContainer *_parent,
|
||||
const QHash<QString, QString> &_config)
|
||||
: KSysGuard::SensorObject(_id, _name, _parent)
|
||||
{
|
||||
qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
|
||||
|
||||
|
@ -19,16 +19,16 @@
|
||||
#define EXTSYSMONAGGREGATOR_H
|
||||
|
||||
#include <QObject>
|
||||
#include <ksysguard/systemstats/SensorObject.h>
|
||||
|
||||
#include "abstractextsysmonsource.h"
|
||||
|
||||
|
||||
class ExtSysMonAggregator : public QObject
|
||||
class ExtSysMonAggregator : public KSysGuard::SensorObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ExtSysMonAggregator(QObject *_parent, const QHash<QString, QString> &_config);
|
||||
explicit ExtSysMonAggregator(const QString &_id, const QString &_name, KSysGuard::SensorContainer *_parent, const QHash<QString, QString> &_config);
|
||||
~ExtSysMonAggregator() override;
|
||||
[[nodiscard]] QVariant data(const QString &_source) const;
|
||||
[[nodiscard]] bool hasSource(const QString &_source) const;
|
||||
|
3
sources/extsysmon/metadata.json
Normal file
3
sources/extsysmon/metadata.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"providerName": "extsysmon"
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
[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
|
@ -1,20 +0,0 @@
|
||||
{
|
||||
"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(KDECompilerSettings)
|
||||
set(Kf6_INCLUDE ${KDE_INSTALL_FULL_INCLUDEDIR_KF})
|
||||
set(Kf6_LIBRARIES KF6::I18n KF6::Notifications KF6::WindowSystem KSysGuard::Sensors KSysGuard::SensorFaces KSysGuard::SystemStats PW::LibTaskManager)
|
||||
set(Kf6_LIBRARIES KF6::CoreAddons KF6::I18n KF6::Notifications KF6::WindowSystem KSysGuard::Sensors KSysGuard::SensorFaces KSysGuard::SystemStats PW::LibTaskManager)
|
||||
|
@ -41,9 +41,9 @@ Row {
|
||||
|
||||
signal setFont
|
||||
|
||||
onAccepted: value = fontDialog.font.family
|
||||
onAccepted: value = selectedFont.family
|
||||
onSetFont: {
|
||||
fontDialog.font = Qt.font({
|
||||
selectedFont = Qt.font({
|
||||
family: value,
|
||||
pointSize: 12,
|
||||
italic: false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user