mirror of
				https://github.com/arcan1s/awesome-widgets.git
				synced 2025-10-31 21:23:41 +00:00 
			
		
		
		
	Compare commits
	
		
			3 Commits
		
	
	
		
			3.5.1
			...
			cee37c6a4a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| cee37c6a4a | |||
| 0fcfb7d7e4 | |||
| 5fd3a4a21a | 
							
								
								
									
										75
									
								
								sources/3rdparty/fontdialog/fontdialog.cpp
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										75
									
								
								sources/3rdparty/fontdialog/fontdialog.cpp
									
									
									
									
										vendored
									
									
								
							| @ -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); | ||||||
|  | |||||||
							
								
								
									
										5
									
								
								sources/3rdparty/fontdialog/fontdialog.h
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								sources/3rdparty/fontdialog/fontdialog.h
									
									
									
									
										vendored
									
									
								
							| @ -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"))); | ||||||
|  | |||||||
							
								
								
									
										29
									
								
								sources/awesome-widget/metadata.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								sources/awesome-widget/metadata.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,29 @@ | |||||||
|  | { | ||||||
|  |     "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", | ||||||
|  |         "ServiceTypes": [ | ||||||
|  |             "Plasma/Applet" | ||||||
|  |         ], | ||||||
|  |         "Version": "@PROJECT_VERSION@", | ||||||
|  |         "Website": "https://arcanis.me/projects/awesome-widgets/" | ||||||
|  |     }, | ||||||
|  |     "X-Plasma-API": "declarativeappletscript", | ||||||
|  |     "X-Plasma-MainScript": "ui/main.qml" | ||||||
|  | } | ||||||
| @ -3,25 +3,25 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
| # common QML constants | # common QML constants | ||||||
| singleton General 1.0 file:///usr/share/awesomewidgets/qml/General.qml | singleton General 1.0 file:///usr//awesomewidgets/qml/General.qml | ||||||
|  |  | ||||||
| # custom QML UI classes | # custom QML UI classes | ||||||
| AboutTab file:///usr/share/awesomewidgets/qml/AboutTab.qml | AboutTab file:///usr//awesomewidgets/qml/AboutTab.qml | ||||||
| AWExtensions file:///usr/share/awesomewidgets/qml/AWExtensions.qml | AWExtensions file:///usr//awesomewidgets/qml/AWExtensions.qml | ||||||
| AWInfoLabel file:///usr/share/awesomewidgets/qml/AWInfoLabel.qml | AWInfoLabel file:///usr//awesomewidgets/qml/AWInfoLabel.qml | ||||||
| AWTagSelector file:///usr/share/awesomewidgets/qml/AWTagSelector.qml | AWTagSelector file:///usr//awesomewidgets/qml/AWTagSelector.qml | ||||||
| AWTextEditor file:///usr/share/awesomewidgets/qml/AWTextEditor.qml | AWTextEditor file:///usr//awesomewidgets/qml/AWTextEditor.qml | ||||||
| BugReport file:///usr/share/awesomewidgets/qml/BugReport.qml | BugReport file:///usr//awesomewidgets/qml/BugReport.qml | ||||||
| ButtonSelector file:///usr/share/awesomewidgets/qml/ButtonSelector.qml | ButtonSelector file:///usr//awesomewidgets/qml/ButtonSelector.qml | ||||||
| CheckBoxSelector file:///usr/share/awesomewidgets/qml/CheckBoxSelector.qml | CheckBoxSelector file:///usr//awesomewidgets/qml/CheckBoxSelector.qml | ||||||
| ColorSelector file:///usr/share/awesomewidgets/qml/ColorSelector.qml | ColorSelector file:///usr//awesomewidgets/qml/ColorSelector.qml | ||||||
| ComboBoxSelector file:///usr/share/awesomewidgets/qml/ComboBoxSelector.qml | ComboBoxSelector file:///usr//awesomewidgets/qml/ComboBoxSelector.qml | ||||||
| ExportDialog file:///usr/share/awesomewidgets/qml/ExportDialog.qml | ExportDialog file:///usr//awesomewidgets/qml/ExportDialog.qml | ||||||
| FontSelector file:///usr/share/awesomewidgets/qml/FontSelector.qml | FontSelector file:///usr//awesomewidgets/qml/FontSelector.qml | ||||||
| HtmlDefaultFunctionsBar file:///usr/share/awesomewidgets/qml/HtmlDefaultFunctionsBar.qml | HtmlDefaultFunctionsBar file:///usr//awesomewidgets/qml/HtmlDefaultFunctionsBar.qml | ||||||
| HtmlEditorButton file:///usr/share/awesomewidgets/qml/HtmlEditorButton.qml | HtmlEditorButton file:///usr//awesomewidgets/qml/HtmlEditorButton.qml | ||||||
| HtmlEditorColor file:///usr/share/awesomewidgets/qml/HtmlEditorColor.qml | HtmlEditorColor file:///usr//awesomewidgets/qml/HtmlEditorColor.qml | ||||||
| HtmlEditorFont file:///usr/share/awesomewidgets/qml/HtmlEditorFont.qml | HtmlEditorFont file:///usr//awesomewidgets/qml/HtmlEditorFont.qml | ||||||
| ImportDialog file:///usr/share/awesomewidgets/qml/ImportDialog.qml | ImportDialog file:///usr//awesomewidgets/qml/ImportDialog.qml | ||||||
| IntegerSelector file:///usr/share/awesomewidgets/qml/IntegerSelector.qml | IntegerSelector file:///usr//awesomewidgets/qml/IntegerSelector.qml | ||||||
| LineSelector file:///usr/share/awesomewidgets/qml/LineSelector.qml | LineSelector file:///usr//awesomewidgets/qml/LineSelector.qml | ||||||
|  | |||||||
| @ -7,17 +7,17 @@ include_directories( | |||||||
|         ${CMAKE_CURRENT_SOURCE_DIR}/../../${PROJECT_LIBRARY}/ |         ${CMAKE_CURRENT_SOURCE_DIR}/../../${PROJECT_LIBRARY}/ | ||||||
|         ${PROJECT_TRDPARTY_DIR} |         ${PROJECT_TRDPARTY_DIR} | ||||||
|         ${Qt_INCLUDE} |         ${Qt_INCLUDE} | ||||||
|         ${Kf5_INCLUDE} |         ${Kf6_INCLUDE} | ||||||
| ) | ) | ||||||
|  |  | ||||||
| file(GLOB SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp ${CMAKE_SOURCE_DIR}/*.cpp) | file(GLOB SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp ${CMAKE_SOURCE_DIR}/*.cpp) | ||||||
| file(GLOB SUBPROJECT_UI *.ui) | file(GLOB SUBPROJECT_UI *.ui) | ||||||
| file(GLOB SUBPROJECT_NOTIFY *.notifyrc) | file(GLOB SUBPROJECT_NOTIFY *.notifyrc) | ||||||
|  |  | ||||||
| qt5_wrap_ui(SUBPROJECT_UI_HEADER ${SUBPROJECT_UI}) | 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} ${Kf5_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 ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget) | ||||||
| install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget) | install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget) | ||||||
| install(FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR}) | install(FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KDE_INSTALL_KNOTIFYRCDIR}) | ||||||
|  | |||||||
| @ -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(); | ||||||
|  | |||||||
| @ -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,19 @@ 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) { |     connect(m_interface, SIGNAL(newSensorData(KSysGuard::SensorDataList)), this, | ||||||
|               emit(deviceAdded(source)); |             SLOT(updateData(KSysGuard::SensorDataList))); | ||||||
|               m_dataEngines["systemmonitor"]->connectSource(source, parent(), 1000); |     connect(m_interface, SIGNAL(sensorAdded(const QString &)), this, SLOT(sensorAdded(const QString &))); | ||||||
|           }); |     connect(m_interface, SIGNAL(sensorMetaDataChanged(const QHash<QString, KSysGuard::SensorInfo> &)), this, | ||||||
|  |             SLOT(updateSensor(const QHash<QString, KSysGuard::SensorInfo> &))); | ||||||
|     // required to define Qt::QueuedConnection for signal-slot connection |     connect(m_interface, SIGNAL(sensorRemoved(const QString &)), this, SLOT(sensorRemoved(const QString &))); | ||||||
|     qRegisterMetaType<Plasma::DataEngine::Data>("Plasma::DataEngine::Data"); |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| @ -54,62 +54,5 @@ AWDataEngineAggregator::~AWDataEngineAggregator() | |||||||
|  |  | ||||||
| void AWDataEngineAggregator::disconnectSources() | void AWDataEngineAggregator::disconnectSources() | ||||||
| { | { | ||||||
|     for (auto dataEngine : m_dataEngines.values()) |     m_interface->unsubscribe(m_sensors.values()); | ||||||
|         for (auto &source : dataEngine->sources()) |  | ||||||
|             dataEngine->disconnectSource(source, parent()); |  | ||||||
|     disconnect(m_newSourceConnection); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void AWDataEngineAggregator::reconnectSources(const int _interval) |  | ||||||
| { |  | ||||||
|     qCDebug(LOG_AW) << "Reconnect sources with interval" << _interval; |  | ||||||
|  |  | ||||||
|     disconnectSources(); |  | ||||||
|  |  | ||||||
|     m_dataEngines["systemmonitor"]->connectAllSources(parent(), (uint)_interval); |  | ||||||
|     m_dataEngines["extsysmon"]->connectAllSources(parent(), (uint)_interval); |  | ||||||
|     m_dataEngines["time"]->connectSource("Local", parent(), 1000); |  | ||||||
|  |  | ||||||
|     m_newSourceConnection = connect( |  | ||||||
|         m_dataEngines["systemmonitor"], &Plasma::DataEngine::sourceAdded, [this, _interval](const QString &source) { |  | ||||||
|             emit(deviceAdded(source)); |  | ||||||
|             m_dataEngines["systemmonitor"]->connectSource(source, parent(), (uint)_interval); |  | ||||||
|         }); |  | ||||||
|  |  | ||||||
| #ifdef BUILD_FUTURE |  | ||||||
|     createQueuedConnection(); |  | ||||||
| #endif /* BUILD_FUTURE */ |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void AWDataEngineAggregator::dropSource(const QString &_source) |  | ||||||
| { |  | ||||||
|     qCDebug(LOG_AW) << "Source" << _source; |  | ||||||
|  |  | ||||||
|     // HACK there is no possibility to check to which dataengine source |  | ||||||
|     // connected we will try to disconnect it from all engines |  | ||||||
|     for (auto dataEngine : m_dataEngines.values()) |  | ||||||
|         dataEngine->disconnectSource(_source, parent()); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void AWDataEngineAggregator::createQueuedConnection() |  | ||||||
| { |  | ||||||
|     // HACK additional method which forces QueuedConnection instead of Auto one |  | ||||||
|     // for more details refer to plasma-framework source code |  | ||||||
|     for (auto &dataEngine : m_dataEngines.keys()) { |  | ||||||
|         // different source set for different engines |  | ||||||
|         QStringList sources = dataEngine == "time" ? QStringList() << "Local" : m_dataEngines[dataEngine]->sources(); |  | ||||||
|         // reconnect sources |  | ||||||
|         for (auto &source : sources) { |  | ||||||
|             Plasma::DataContainer *container = m_dataEngines[dataEngine]->containerForSource(source); |  | ||||||
|             // disconnect old connections first |  | ||||||
|             disconnect(container, SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data)), parent(), |  | ||||||
|                        SLOT(dataUpdated(QString, Plasma::DataEngine::Data))); |  | ||||||
|             // and now reconnect with Qt::QueuedConnection type |  | ||||||
|             connect(container, SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data)), parent(), |  | ||||||
|                     SLOT(dataUpdated(QString, Plasma::DataEngine::Data)), Qt::QueuedConnection); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -19,10 +19,16 @@ | |||||||
| #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 <QSet> | ||||||
|  |  | ||||||
|  |  | ||||||
|  | namespace KSysGuard::SystemStats | ||||||
|  | { | ||||||
|  |     class DBusInterface; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
| class AWDataEngineAggregator : public QObject | class AWDataEngineAggregator : public QObject | ||||||
| @ -33,19 +39,20 @@ public: | |||||||
|     explicit AWDataEngineAggregator(QObject *_parent = nullptr); |     explicit AWDataEngineAggregator(QObject *_parent = nullptr); | ||||||
|     ~AWDataEngineAggregator() override; |     ~AWDataEngineAggregator() override; | ||||||
|     void disconnectSources(); |     void disconnectSources(); | ||||||
|     void reconnectSources(int _interval); |  | ||||||
|  |  | ||||||
| signals: | signals: | ||||||
|     void deviceAdded(const QString &_source); |     void deviceAdded(const QString &_source); | ||||||
|  |  | ||||||
| public slots: | public slots: | ||||||
|     void dropSource(const QString &_source); |     void sensorAdded(const QString &_sensor); | ||||||
|  |     void sensorRemoved(const QString &_sensor); | ||||||
|  |     void updateData(KSysGuard::SensorDataList _data); | ||||||
|  |     void updateSensor(const QHash<QString, KSysGuard::SensorInfo> &_sensor); | ||||||
|  |  | ||||||
| private: | private: | ||||||
|     void createQueuedConnection(); |     void createQueuedConnection(); | ||||||
|     Plasma::DataEngineConsumer *m_consumer = nullptr; |     KSysGuard::SystemStats::DBusInterface *m_interface = nullptr; | ||||||
|     QHash<QString, Plasma::DataEngine *> m_dataEngines; |     QSet<QString> m_sensors; | ||||||
|     QMetaObject::Connection m_newSourceConnection; |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | |||||||
| @ -17,7 +17,7 @@ | |||||||
|  |  | ||||||
| #include "awdataenginemapper.h" | #include "awdataenginemapper.h" | ||||||
|  |  | ||||||
| #include <QRegExp> | #include <QRegularExpression> | ||||||
|  |  | ||||||
| #include "awdebug.h" | #include "awdebug.h" | ||||||
| #include "awformatterhelper.h" | #include "awformatterhelper.h" | ||||||
| @ -81,15 +81,15 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt | |||||||
|     qCDebug(LOG_AW) << "Source" << _source << "with units" << _units; |     qCDebug(LOG_AW) << "Source" << _source << "with units" << _units; | ||||||
|  |  | ||||||
|     // regular expressions |     // regular expressions | ||||||
|     QRegExp cpuRegExp = QRegExp("cpu/cpu.*/TotalLoad"); |     auto cpuRegExp = QRegularExpression("cpu/cpu.*/TotalLoad"); | ||||||
|     QRegExp cpuclRegExp = QRegExp("cpu/cpu.*/clock"); |     auto cpuclRegExp = QRegularExpression("cpu/cpu.*/clock"); | ||||||
|     QRegExp hddrRegExp = QRegExp("disk/.*/Rate/rblk"); |     auto hddrRegExp = QRegularExpression("disk/.*/Rate/rblk"); | ||||||
|     QRegExp hddwRegExp = QRegExp("disk/.*/Rate/wblk"); |     auto hddwRegExp = QRegularExpression("disk/.*/Rate/wblk"); | ||||||
|     QRegExp mountFillRegExp = QRegExp("partitions/.*/filllevel"); |     auto mountFillRegExp = QRegularExpression("partitions/.*/filllevel"); | ||||||
|     QRegExp mountFreeRegExp = QRegExp("partitions/.*/freespace"); |     auto mountFreeRegExp = QRegularExpression("partitions/.*/freespace"); | ||||||
|     QRegExp mountUsedRegExp = QRegExp("partitions/.*/usedspace"); |     auto mountUsedRegExp = QRegularExpression("partitions/.*/usedspace"); | ||||||
|     QRegExp netRegExp = QRegExp("network/interfaces/.*/(receiver|transmitter)/data$"); |     auto netRegExp = QRegularExpression("network/interfaces/.*/(receiver|transmitter)/data$"); | ||||||
|     QRegExp netTotalRegExp = QRegExp("network/interfaces/.*/(receiver|transmitter)/dataTotal$"); |     auto netTotalRegExp = QRegularExpression("network/interfaces/.*/(receiver|transmitter)/dataTotal$"); | ||||||
|  |  | ||||||
|     if (_source == "battery/ac") { |     if (_source == "battery/ac") { | ||||||
|         // AC |         // AC | ||||||
|  | |||||||
| @ -20,6 +20,7 @@ | |||||||
|  |  | ||||||
| #include <QDir> | #include <QDir> | ||||||
| #include <QNetworkInterface> | #include <QNetworkInterface> | ||||||
|  | #include <QRegularExpression> | ||||||
| #include <QSettings> | #include <QSettings> | ||||||
| #include <QStandardPaths> | #include <QStandardPaths> | ||||||
|  |  | ||||||
| @ -42,7 +43,7 @@ bool AWKeyCache::addKeyToCache(const QString &_type, const QString &_key) | |||||||
|  |  | ||||||
|     if (_type == "hdd") { |     if (_type == "hdd") { | ||||||
|         QStringList allDevices = QDir("/dev").entryList(QDir::System, QDir::Name); |         QStringList allDevices = QDir("/dev").entryList(QDir::System, QDir::Name); | ||||||
|         QStringList devices = allDevices.filter(QRegExp("^[hms]d[a-z]$")); |         QStringList devices = allDevices.filter(QRegularExpression("^[hms]d[a-z]$")); | ||||||
|         for (auto &dev : devices) { |         for (auto &dev : devices) { | ||||||
|             QString device = QString("/dev/%1").arg(dev); |             QString device = QString("/dev/%1").arg(dev); | ||||||
|             if (cachedValues.contains(device)) |             if (cachedValues.contains(device)) | ||||||
| @ -93,7 +94,7 @@ QStringList AWKeyCache::getRequiredKeys(const QStringList &_keys, const QStringL | |||||||
|  |  | ||||||
|     // insert depending keys, refer to AWKeys::calculateValues() |     // insert depending keys, refer to AWKeys::calculateValues() | ||||||
|     // hddtotmb* |     // hddtotmb* | ||||||
|     for (auto &key : _allKeys.filter(QRegExp("^hddtotmb"))) { |     for (auto &key : _allKeys.filter(QRegularExpression("^hddtotmb"))) { | ||||||
|         if (!used.contains(key)) |         if (!used.contains(key)) | ||||||
|             continue; |             continue; | ||||||
|         key.remove("hddtotmb"); |         key.remove("hddtotmb"); | ||||||
| @ -101,7 +102,7 @@ QStringList AWKeyCache::getRequiredKeys(const QStringList &_keys, const QStringL | |||||||
|         used << QString("hddfreemb%1").arg(index) << QString("hddmb%1").arg(index); |         used << QString("hddfreemb%1").arg(index) << QString("hddmb%1").arg(index); | ||||||
|     } |     } | ||||||
|     // hddtotgb* |     // hddtotgb* | ||||||
|     for (auto &key : _allKeys.filter(QRegExp("^hddtotgb"))) { |     for (auto &key : _allKeys.filter(QRegularExpression("^hddtotgb"))) { | ||||||
|         if (!used.contains(key)) |         if (!used.contains(key)) | ||||||
|             continue; |             continue; | ||||||
|         key.remove("hddtotgb"); |         key.remove("hddtotgb"); | ||||||
| @ -138,7 +139,7 @@ QStringList AWKeyCache::getRequiredKeys(const QStringList &_keys, const QStringL | |||||||
|     for (auto &key : netKeys) { |     for (auto &key : netKeys) { | ||||||
|         if (!used.contains(key)) |         if (!used.contains(key)) | ||||||
|             continue; |             continue; | ||||||
|         QStringList filt = _allKeys.filter(QRegExp(QString("^%1[0-9]{1,}").arg(key))); |         QStringList filt = _allKeys.filter(QRegularExpression(QString("^%1[0-9]{1,}").arg(key))); | ||||||
|         for (auto &filtered : filt) |         for (auto &filtered : filt) | ||||||
|             used << filtered; |             used << filtered; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -18,7 +18,7 @@ | |||||||
| #include "awkeyoperations.h" | #include "awkeyoperations.h" | ||||||
|  |  | ||||||
| #include <QDir> | #include <QDir> | ||||||
| #include <QRegExp> | #include <QRegularExpression> | ||||||
| #include <QThread> | #include <QThread> | ||||||
|  |  | ||||||
| #include "awcustomkeyshelper.h" | #include "awcustomkeyshelper.h" | ||||||
| @ -206,7 +206,7 @@ QString AWKeyOperations::infoByKey(const QString &_key) const | |||||||
|     qCDebug(LOG_AW) << "Requested key" << _key; |     qCDebug(LOG_AW) << "Requested key" << _key; | ||||||
|  |  | ||||||
|     QString stripped = _key; |     QString stripped = _key; | ||||||
|     stripped.remove(QRegExp("\\d+")); |     stripped.remove(QRegularExpression("\\d+")); | ||||||
|     QString output; |     QString output; | ||||||
|  |  | ||||||
|     if (_key.startsWith("bar")) { |     if (_key.startsWith("bar")) { | ||||||
| @ -217,31 +217,31 @@ QString AWKeyOperations::infoByKey(const QString &_key) const | |||||||
|         AbstractExtItem *item = m_extScripts->itemByTag(_key, stripped); |         AbstractExtItem *item = m_extScripts->itemByTag(_key, stripped); | ||||||
|         if (item) |         if (item) | ||||||
|             output = item->uniq(); |             output = item->uniq(); | ||||||
|     } else if (_key.contains(QRegExp("^hdd[rw]"))) { |     } else if (_key.contains(QRegularExpression("^hdd[rw]"))) { | ||||||
|         QString index = _key; |         QString index = _key; | ||||||
|         index.remove(QRegExp("hdd[rw]")); |         index.remove(QRegularExpression("hdd[rw]")); | ||||||
|         output = m_devices["disk"][index.toInt()]; |         output = m_devices["disk"][index.toInt()]; | ||||||
|     } else if (_key.contains(QRegExp("^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)"))) { |     } else if (_key.contains(QRegularExpression("^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)"))) { | ||||||
|         QString index = _key; |         QString index = _key; | ||||||
|         index.remove(QRegExp("^hdd(|mb|gb|freemb|freegb|totmb|totgb)")); |         index.remove(QRegularExpression("^hdd(|mb|gb|freemb|freegb|totmb|totgb)")); | ||||||
|         output = m_devices["mount"][index.toInt()]; |         output = m_devices["mount"][index.toInt()]; | ||||||
|     } else if (_key.startsWith("hddtemp")) { |     } else if (_key.startsWith("hddtemp")) { | ||||||
|         QString index = _key; |         QString index = _key; | ||||||
|         index.remove("hddtemp"); |         index.remove("hddtemp"); | ||||||
|         output = m_devices["hdd"][index.toInt()]; |         output = m_devices["hdd"][index.toInt()]; | ||||||
|     } else if (_key.contains(QRegExp("^(down|up)[0-9]"))) { |     } else if (_key.contains(QRegularExpression("^(down|up)[0-9]"))) { | ||||||
|         QString index = _key; |         QString index = _key; | ||||||
|         index.remove(QRegExp("^(down|up)")); |         index.remove(QRegularExpression("^(down|up)")); | ||||||
|         output = m_devices["net"][index.toInt()]; |         output = m_devices["net"][index.toInt()]; | ||||||
|     } else if (_key.startsWith("pkgcount")) { |     } else if (_key.startsWith("pkgcount")) { | ||||||
|         AbstractExtItem *item = m_extUpgrade->itemByTag(_key, stripped); |         AbstractExtItem *item = m_extUpgrade->itemByTag(_key, stripped); | ||||||
|         if (item) |         if (item) | ||||||
|             output = item->uniq(); |             output = item->uniq(); | ||||||
|     } else if (_key.contains(QRegExp("(^|perc)(ask|bid|price)(chg|)"))) { |     } else if (_key.contains(QRegularExpression("(^|perc)(ask|bid|price)(chg|)"))) { | ||||||
|         AbstractExtItem *item = m_extQuotes->itemByTag(_key, stripped); |         AbstractExtItem *item = m_extQuotes->itemByTag(_key, stripped); | ||||||
|         if (item) |         if (item) | ||||||
|             output = item->uniq(); |             output = item->uniq(); | ||||||
|     } else if (_key.contains(QRegExp("(weather|weatherId|humidity|pressure|temperature)"))) { |     } else if (_key.contains(QRegularExpression("(weather|weatherId|humidity|pressure|temperature)"))) { | ||||||
|         AbstractExtItem *item = m_extWeather->itemByTag(_key, stripped); |         AbstractExtItem *item = m_extWeather->itemByTag(_key, stripped); | ||||||
|         if (item) |         if (item) | ||||||
|             output = item->uniq(); |             output = item->uniq(); | ||||||
| @ -280,7 +280,7 @@ void AWKeyOperations::editItem(const QString &_type) | |||||||
|     qCDebug(LOG_AW) << "Item type" << _type; |     qCDebug(LOG_AW) << "Item type" << _type; | ||||||
|  |  | ||||||
|     if (_type == "graphicalitem") { |     if (_type == "graphicalitem") { | ||||||
|         QStringList keys = dictKeys().filter(QRegExp("^(cpu(?!cl).*|gpu$|mem$|swap$|hdd[0-9].*|bat.*)")); |         QStringList keys = dictKeys().filter(QRegularExpression("^(cpu(?!cl).*|gpu$|mem$|swap$|hdd[0-9].*|bat.*)")); | ||||||
|         keys.sort(); |         keys.sort(); | ||||||
|         m_graphicalItems->setConfigArgs(keys); |         m_graphicalItems->setConfigArgs(keys); | ||||||
|         return m_graphicalItems->editItems(); |         return m_graphicalItems->editItems(); | ||||||
| @ -302,8 +302,8 @@ void AWKeyOperations::addDevice(const QString &_source) | |||||||
| { | { | ||||||
|     qCDebug(LOG_AW) << "Source" << _source; |     qCDebug(LOG_AW) << "Source" << _source; | ||||||
|  |  | ||||||
|     QRegExp diskRegexp = QRegExp("disk/(?:md|sd|hd)[a-z|0-9]_.*/Rate/(?:rblk)"); |     auto diskRegexp = QRegularExpression("disk/(?:md|sd|hd)[a-z|0-9]_.*/Rate/(?:rblk)"); | ||||||
|     QRegExp mountRegexp = QRegExp("partitions/.*/filllevel"); |     auto mountRegexp = QRegularExpression("partitions/.*/filllevel"); | ||||||
|  |  | ||||||
|     if (_source.contains(diskRegexp)) { |     if (_source.contains(diskRegexp)) { | ||||||
|         QString device = _source; |         QString device = _source; | ||||||
|  | |||||||
| @ -148,7 +148,7 @@ QStringList AWKeys::dictKeys(const bool _sorted, const QString &_regexp) const | |||||||
|     if (_sorted) |     if (_sorted) | ||||||
|         allKeys.sort(); |         allKeys.sort(); | ||||||
|  |  | ||||||
|     return allKeys.filter(QRegExp(_regexp)); |     return allKeys.filter(QRegularExpression(_regexp)); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| @ -199,10 +199,11 @@ void AWKeys::editItem(const QString &_type) | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void AWKeys::dataUpdated(const QString &_sourceName, const Plasma::DataEngine::Data &_data) | void AWKeys::dataUpdated(const KSysGuard::SensorDataList &_data) | ||||||
| { | { | ||||||
|     // run concurrent data update |     // TODO use QtConcurrent::map or something like that | ||||||
|     QtConcurrent::run(m_threadPool, this, &AWKeys::setDataBySource, _sourceName, _data); |     for (auto &sensor : _data) | ||||||
|  |         QtConcurrent::run(m_threadPool, this, &AWKeys::setDataBySource, sensor); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| @ -351,9 +352,9 @@ QString AWKeys::parsePattern(QString _pattern) const | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void AWKeys::setDataBySource(const QString &_sourceName, const QVariantMap &_data) | void AWKeys::setDataBySource(const QString &_sourceName, const KSysGuard::SensorData &_data) | ||||||
| { | { | ||||||
|     qCDebug(LOG_AW) << "Source" << _sourceName << "with data" << _data; |     qCDebug(LOG_AW) << "Source" << _sourceName << "with data" << _data.payload; | ||||||
|  |  | ||||||
|     // first list init |     // first list init | ||||||
|     QStringList tags = m_aggregator->keysFromSource(_sourceName); |     QStringList tags = m_aggregator->keysFromSource(_sourceName); | ||||||
|  | |||||||
| @ -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 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 KSysGuard::SensorData &_data); | ||||||
|     // objects |     // objects | ||||||
|     AWDataAggregator *m_dataAggregator = nullptr; |     AWDataAggregator *m_dataAggregator = nullptr; | ||||||
|     AWDataEngineAggregator *m_dataEngineAggregator = nullptr; |     AWDataEngineAggregator *m_dataEngineAggregator = nullptr; | ||||||
|  | |||||||
| @ -130,7 +130,7 @@ QString AWPatternFunctions::insertAllKeys(QString _code, const QStringList &_key | |||||||
|     QList<AWPatternFunctions::AWFunction> found = AWPatternFunctions::findFunctionCalls("aw_all", _code); |     QList<AWPatternFunctions::AWFunction> found = AWPatternFunctions::findFunctionCalls("aw_all", _code); | ||||||
|     for (auto &function : found) { |     for (auto &function : found) { | ||||||
|         QString separator = function.args.isEmpty() ? "," : function.args.at(0); |         QString separator = function.args.isEmpty() ? "," : function.args.at(0); | ||||||
|         QStringList required = _keys.filter(QRegExp(function.body)); |         QStringList required = _keys.filter(QRegularExpression(function.body)); | ||||||
|         std::for_each(required.begin(), required.end(), [](QString &value) { value = QString("%1: $%1").arg(value); }); |         std::for_each(required.begin(), required.end(), [](QString &value) { value = QString("%1: $%1").arg(value); }); | ||||||
|  |  | ||||||
|         _code.replace(function.what, required.join(separator)); |         _code.replace(function.what, required.join(separator)); | ||||||
| @ -146,7 +146,7 @@ QString AWPatternFunctions::insertKeyCount(QString _code, const QStringList &_ke | |||||||
|  |  | ||||||
|     QList<AWPatternFunctions::AWFunction> found = AWPatternFunctions::findFunctionCalls("aw_count", _code); |     QList<AWPatternFunctions::AWFunction> found = AWPatternFunctions::findFunctionCalls("aw_count", _code); | ||||||
|     for (auto &function : found) { |     for (auto &function : found) { | ||||||
|         int count = _keys.filter(QRegExp(function.body)).count(); |         int count = _keys.filter(QRegularExpression(function.body)).count(); | ||||||
|  |  | ||||||
|         _code.replace(function.what, QString::number(count)); |         _code.replace(function.what, QString::number(count)); | ||||||
|     } |     } | ||||||
| @ -162,7 +162,7 @@ QString AWPatternFunctions::insertKeyNames(QString _code, const QStringList &_ke | |||||||
|     QList<AWPatternFunctions::AWFunction> found = AWPatternFunctions::findFunctionCalls("aw_names", _code); |     QList<AWPatternFunctions::AWFunction> found = AWPatternFunctions::findFunctionCalls("aw_names", _code); | ||||||
|     for (auto &function : found) { |     for (auto &function : found) { | ||||||
|         QString separator = function.args.isEmpty() ? "," : function.args.at(0); |         QString separator = function.args.isEmpty() ? "," : function.args.at(0); | ||||||
|         QStringList required = _keys.filter(QRegExp(function.body)); |         QStringList required = _keys.filter(QRegularExpression(function.body)); | ||||||
|  |  | ||||||
|         _code.replace(function.what, required.join(separator)); |         _code.replace(function.what, required.join(separator)); | ||||||
|     } |     } | ||||||
| @ -178,7 +178,7 @@ QString AWPatternFunctions::insertKeys(QString _code, const QStringList &_keys) | |||||||
|     QList<AWPatternFunctions::AWFunction> found = AWPatternFunctions::findFunctionCalls("aw_keys", _code); |     QList<AWPatternFunctions::AWFunction> found = AWPatternFunctions::findFunctionCalls("aw_keys", _code); | ||||||
|     for (auto &function : found) { |     for (auto &function : found) { | ||||||
|         QString separator = function.args.isEmpty() ? "," : function.args.at(0); |         QString separator = function.args.isEmpty() ? "," : function.args.at(0); | ||||||
|         QStringList required = _keys.filter(QRegExp(function.body)); |         QStringList required = _keys.filter(QRegularExpression(function.body)); | ||||||
|         std::for_each(required.begin(), required.end(), [](QString &value) { value = QString("$%1").arg(value); }); |         std::for_each(required.begin(), required.end(), [](QString &value) { value = QString("$%1").arg(value); }); | ||||||
|  |  | ||||||
|         _code.replace(function.what, required.join(separator)); |         _code.replace(function.what, required.join(separator)); | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ include_directories( | |||||||
|         ${CMAKE_BINARY_DIR} |         ${CMAKE_BINARY_DIR} | ||||||
|         ${PROJECT_TRDPARTY_DIR} |         ${PROJECT_TRDPARTY_DIR} | ||||||
|         ${Qt_INCLUDE} |         ${Qt_INCLUDE} | ||||||
|         ${Kf5_INCLUDE} |         ${Kf6_INCLUDE} | ||||||
| ) | ) | ||||||
|  |  | ||||||
| file(GLOB SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/qreplytimeout/*.cpp ${CMAKE_SOURCE_DIR}/*.cpp) | file(GLOB SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/qreplytimeout/*.cpp ${CMAKE_SOURCE_DIR}/*.cpp) | ||||||
| @ -28,9 +28,9 @@ file(RELATIVE_PATH SUBPROJECT_WEATHER_JSON ${CMAKE_SOURCE_DIR} ${SUBPROJECT_WEAT | |||||||
| # prepare | # prepare | ||||||
| configure_file(${SUBPROJECT_WEATHER_JSON_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_WEATHER_JSON}) | configure_file(${SUBPROJECT_WEATHER_JSON_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_WEATHER_JSON}) | ||||||
|  |  | ||||||
| qt5_wrap_ui(SUBPROJECT_UI_HEADER ${SUBPROJECT_UI}) | qt6_wrap_ui(SUBPROJECT_UI_HEADER ${SUBPROJECT_UI}) | ||||||
| add_library(${SUBPROJECT} STATIC ${SUBPROJECT_SOURCE} ${SUBPROJECT_HEADER} ${SUBPROJECT_UI_HEADER}) | add_library(${SUBPROJECT} STATIC ${SUBPROJECT_SOURCE} ${SUBPROJECT_HEADER} ${SUBPROJECT_UI_HEADER}) | ||||||
| target_link_libraries(${SUBPROJECT} ${Qt_LIBRARIES} ${Kf5_LIBRARIES}) | target_link_libraries(${SUBPROJECT} ${Qt_LIBRARIES} ${Kf6_LIBRARIES}) | ||||||
|  |  | ||||||
| # install | # install | ||||||
| install(DIRECTORY ${SUBPROJECT_CONFIGS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}) | install(DIRECTORY ${SUBPROJECT_CONFIGS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}) | ||||||
| @ -41,5 +41,5 @@ install(DIRECTORY ${SUBPROJECT_SCRIPTS} DESTINATION ${DATA_INSTALL_DIR}/${PROJEC | |||||||
| install(DIRECTORY ${SUBPROJECT_REQUESTS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}) | install(DIRECTORY ${SUBPROJECT_REQUESTS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}) | ||||||
| install(DIRECTORY ${SUBPROJECT_UPGRADE} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}) | install(DIRECTORY ${SUBPROJECT_UPGRADE} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}) | ||||||
| install(DIRECTORY ${SUBPROJECT_WEATHER} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}) | install(DIRECTORY ${SUBPROJECT_WEATHER} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}) | ||||||
| install(FILES ${SUBPROJECT_INI} DESTINATION ${CONFIG_INSTALL_DIR}) | install(FILES ${SUBPROJECT_INI} DESTINATION ${KDE_INSTALL_CONFDIR}) | ||||||
| install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_WEATHER_JSON} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}/weather) | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_WEATHER_JSON} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}/weather) | ||||||
|  | |||||||
| @ -99,7 +99,7 @@ QString AbstractExtItem::writtableConfig() const | |||||||
| { | { | ||||||
|     QString path = m_fileName; |     QString path = m_fileName; | ||||||
|     QString name = QFileInfo(path).fileName(); |     QString name = QFileInfo(path).fileName(); | ||||||
|     path.remove(path.count() - name.count() - 1, name.count() + 1); |     path.remove(path.length() - name.length() - 1, name.length() + 1); | ||||||
|     QString dir = QFileInfo(path).fileName(); |     QString dir = QFileInfo(path).fileName(); | ||||||
|  |  | ||||||
|     return QString("%1/awesomewidgets/%2/%3") |     return QString("%1/awesomewidgets/%2/%3") | ||||||
|  | |||||||
| @ -18,6 +18,8 @@ | |||||||
| #ifndef AWABSTRACTFORMATTER_H | #ifndef AWABSTRACTFORMATTER_H | ||||||
| #define AWABSTRACTFORMATTER_H | #define AWABSTRACTFORMATTER_H | ||||||
|  |  | ||||||
|  | #include <QRegularExpression> | ||||||
|  |  | ||||||
| #include "abstractextitem.h" | #include "abstractextitem.h" | ||||||
|  |  | ||||||
|  |  | ||||||
|  | |||||||
| @ -53,7 +53,7 @@ QString AWJsonFormatter::convert(const QVariant &_value) const | |||||||
|     qCDebug(LOG_LIB) << "Convert value" << _value; |     qCDebug(LOG_LIB) << "Convert value" << _value; | ||||||
|  |  | ||||||
|     // check if _value is string and parse first if required |     // check if _value is string and parse first if required | ||||||
|     QJsonDocument json = _value.type() == QVariant::String ? QJsonDocument::fromJson(_value.toString().toUtf8()) |     QJsonDocument json = _value.userType() == QMetaType::QString ? QJsonDocument::fromJson(_value.toString().toUtf8()) | ||||||
|                                                            : QJsonDocument::fromVariant(_value); |                                                            : QJsonDocument::fromVariant(_value); | ||||||
|     QVariant converted = json.toVariant(); |     QVariant converted = json.toVariant(); | ||||||
|     for (auto &element : m_splittedPath) |     for (auto &element : m_splittedPath) | ||||||
| @ -147,9 +147,9 @@ QVariant AWJsonFormatter::getFromJson(const QVariant &_value, const QVariant &_e | |||||||
| { | { | ||||||
|     qCDebug(LOG_LIB) << "Looking for element" << _element << "in" << _value; |     qCDebug(LOG_LIB) << "Looking for element" << _element << "in" << _value; | ||||||
|  |  | ||||||
|     if (_element.type() == QVariant::String) { |     if (_element.userType() == QMetaType::QString) { | ||||||
|         return getFromMap(_value, _element.toString()); |         return getFromMap(_value, _element.toString()); | ||||||
|     } else if (_element.type() == QVariant::Int) { |     } else if (_element.userType() == QMetaType::Int) { | ||||||
|         return getFromList(_value, _element.toInt()); |         return getFromList(_value, _element.toInt()); | ||||||
|     } else { |     } else { | ||||||
|         qCWarning(LOG_LIB) << "Unknown type" << _element.typeName(); |         qCWarning(LOG_LIB) << "Unknown type" << _element.typeName(); | ||||||
|  | |||||||
| @ -97,7 +97,7 @@ void AWListFormatter::setFilter(const QString &_filter) | |||||||
|     qCDebug(LOG_LIB) << "Filter" << _filter; |     qCDebug(LOG_LIB) << "Filter" << _filter; | ||||||
|  |  | ||||||
|     m_filter = _filter; |     m_filter = _filter; | ||||||
|     m_regex = QRegExp(m_filter); |     m_regex = QRegularExpression(m_filter); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | |||||||
| @ -58,7 +58,7 @@ private: | |||||||
|     QString m_filter = ""; |     QString m_filter = ""; | ||||||
|     QString m_separator = ""; |     QString m_separator = ""; | ||||||
|     bool m_sorted = false; |     bool m_sorted = false; | ||||||
|     QRegExp m_regex; |     QRegularExpression m_regex; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | |||||||
| @ -20,9 +20,7 @@ | |||||||
|  |  | ||||||
| #include <KI18n/KLocalizedString> | #include <KI18n/KLocalizedString> | ||||||
|  |  | ||||||
| #include <QDir> |  | ||||||
| #include <QSettings> | #include <QSettings> | ||||||
| #include <QTextCodec> |  | ||||||
|  |  | ||||||
| #include <qreplytimeout/qreplytimeout.h> | #include <qreplytimeout/qreplytimeout.h> | ||||||
|  |  | ||||||
| @ -174,7 +172,7 @@ void ExtNetworkRequest::networkReplyReceived(QNetworkReply *_reply) | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     m_isRunning = false; |     m_isRunning = false; | ||||||
|     m_values[tag("response")] = QTextCodec::codecForMib(106)->toUnicode(_reply->readAll()).trimmed(); |     m_values[tag("response")] = QString::fromUtf8(_reply->readAll()).trimmed(); | ||||||
|  |  | ||||||
|     emit(dataReceived(m_values)); |     emit(dataReceived(m_values)); | ||||||
| } | } | ||||||
|  | |||||||
| @ -24,7 +24,6 @@ | |||||||
| #include <QJsonDocument> | #include <QJsonDocument> | ||||||
| #include <QSettings> | #include <QSettings> | ||||||
| #include <QStandardPaths> | #include <QStandardPaths> | ||||||
| #include <QTextCodec> |  | ||||||
|  |  | ||||||
| #include "awdebug.h" | #include "awdebug.h" | ||||||
|  |  | ||||||
| @ -325,9 +324,9 @@ void ExtScript::startProcess() | |||||||
| void ExtScript::updateValue() | void ExtScript::updateValue() | ||||||
| { | { | ||||||
|     qCInfo(LOG_LIB) << "Cmd returns" << m_process->exitCode(); |     qCInfo(LOG_LIB) << "Cmd returns" << m_process->exitCode(); | ||||||
|     QString qdebug = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardError()).trimmed(); |     QString qdebug = QString::fromUtf8(m_process->readAllStandardError()).trimmed(); | ||||||
|     qCInfo(LOG_LIB) << "Error" << qdebug; |     qCInfo(LOG_LIB) << "Error" << qdebug; | ||||||
|     QString qoutput = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardOutput()).trimmed(); |     QString qoutput = QString::fromUtf8(m_process->readAllStandardOutput()).trimmed(); | ||||||
|     qCInfo(LOG_LIB) << "Output" << qoutput; |     qCInfo(LOG_LIB) << "Output" << qoutput; | ||||||
|     QString strValue; |     QString strValue; | ||||||
|  |  | ||||||
|  | |||||||
| @ -21,7 +21,6 @@ | |||||||
| #include <KI18n/KLocalizedString> | #include <KI18n/KLocalizedString> | ||||||
|  |  | ||||||
| #include <QSettings> | #include <QSettings> | ||||||
| #include <QTextCodec> |  | ||||||
|  |  | ||||||
| #include "awdebug.h" | #include "awdebug.h" | ||||||
|  |  | ||||||
| @ -214,10 +213,10 @@ void ExtUpgrade::updateValue() | |||||||
|     qCInfo(LOG_LIB) << "Cmd returns" << m_process->exitCode(); |     qCInfo(LOG_LIB) << "Cmd returns" << m_process->exitCode(); | ||||||
|     qCInfo(LOG_LIB) << "Error" << m_process->readAllStandardError(); |     qCInfo(LOG_LIB) << "Error" << m_process->readAllStandardError(); | ||||||
|  |  | ||||||
|     QString qoutput = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardOutput()).trimmed(); |     QString qoutput = QString::fromUtf8(m_process->readAllStandardOutput()).trimmed(); | ||||||
|     m_values[tag("pkgcount")] = [this](const QString &output) { |     m_values[tag("pkgcount")] = [this](const QString &output) { | ||||||
|         return filter().isEmpty() ? output.split('\n', Qt::SkipEmptyParts).count() - null() |         return filter().isEmpty() ? output.split('\n', Qt::SkipEmptyParts).count() - null() | ||||||
|                                   : output.split('\n', Qt::SkipEmptyParts).filter(QRegExp(filter())).count(); |                                   : output.split('\n', Qt::SkipEmptyParts).filter(QRegularExpression(filter())).count(); | ||||||
|     }(qoutput); |     }(qoutput); | ||||||
|  |  | ||||||
|     emit(dataReceived(m_values)); |     emit(dataReceived(m_values)); | ||||||
|  | |||||||
| @ -99,7 +99,7 @@ QVariantHash OWMWeatherProvider::parseSingleJson(const QVariantMap &_json) const | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     // timestamp |     // timestamp | ||||||
|     output[tag("timestamp")] = QDateTime::fromTime_t(_json["dt"].toUInt()).toUTC(); |     output[tag("timestamp")] = QDateTime::fromSecsSinceEpoch(_json["dt"].toUInt()).toUTC(); | ||||||
|  |  | ||||||
|     return output; |     return output; | ||||||
| } | } | ||||||
|  | |||||||
| @ -17,7 +17,6 @@ | |||||||
|  |  | ||||||
| #include "stooqquotesprovider.h" | #include "stooqquotesprovider.h" | ||||||
|  |  | ||||||
| #include <QTextCodec> |  | ||||||
| #include <QUrlQuery> | #include <QUrlQuery> | ||||||
|  |  | ||||||
| #include "awdebug.h" | #include "awdebug.h" | ||||||
| @ -55,7 +54,7 @@ QVariantHash StooqQuotesProvider::parse(const QByteArray &_source, const QVarian | |||||||
|  |  | ||||||
|     QVariantHash values; |     QVariantHash values; | ||||||
|  |  | ||||||
|     QStringList sourceValues = QTextCodec::codecForMib(106)->toUnicode(_source).trimmed().split(','); |     QStringList sourceValues = QString::fromUtf8(_source).trimmed().split(','); | ||||||
|     if (sourceValues.count() != 2) { |     if (sourceValues.count() != 2) { | ||||||
|         qCWarning(LOG_LIB) << "Parse error" << sourceValues; |         qCWarning(LOG_LIB) << "Parse error" << sourceValues; | ||||||
|         return values; |         return values; | ||||||
|  | |||||||
							
								
								
									
										29
									
								
								sources/desktop-panel/metadata.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								sources/desktop-panel/metadata.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,29 @@ | |||||||
|  | { | ||||||
|  |     "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.desktoppanel", | ||||||
|  |         "License": "GPLv3", | ||||||
|  |         "Name": "Desktop Panel", | ||||||
|  |         "ServiceTypes": [ | ||||||
|  |             "Plasma/Applet" | ||||||
|  |         ], | ||||||
|  |         "Version": "@PROJECT_VERSION@", | ||||||
|  |         "Website": "https://arcanis.me/projects/awesome-widgets/" | ||||||
|  |     }, | ||||||
|  |     "X-Plasma-API": "declarativeappletscript", | ||||||
|  |     "X-Plasma-MainScript": "ui/main.qml" | ||||||
|  | } | ||||||
| @ -3,25 +3,25 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
| # common QML constants | # common QML constants | ||||||
| singleton General 1.0 file:///usr/share/awesomewidgets/qml/General.qml | singleton General 1.0 file:///usr//awesomewidgets/qml/General.qml | ||||||
|  |  | ||||||
| # custom QML UI classes | # custom QML UI classes | ||||||
| AboutTab file:///usr/share/awesomewidgets/qml/AboutTab.qml | AboutTab file:///usr//awesomewidgets/qml/AboutTab.qml | ||||||
| AWExtensions file:///usr/share/awesomewidgets/qml/AWExtensions.qml | AWExtensions file:///usr//awesomewidgets/qml/AWExtensions.qml | ||||||
| AWInfoLabel file:///usr/share/awesomewidgets/qml/AWInfoLabel.qml | AWInfoLabel file:///usr//awesomewidgets/qml/AWInfoLabel.qml | ||||||
| AWTagSelector file:///usr/share/awesomewidgets/qml/AWTagSelector.qml | AWTagSelector file:///usr//awesomewidgets/qml/AWTagSelector.qml | ||||||
| AWTextEditor file:///usr/share/awesomewidgets/qml/AWTextEditor.qml | AWTextEditor file:///usr//awesomewidgets/qml/AWTextEditor.qml | ||||||
| BugReport file:///usr/share/awesomewidgets/qml/BugReport.qml | BugReport file:///usr//awesomewidgets/qml/BugReport.qml | ||||||
| ButtonSelector file:///usr/share/awesomewidgets/qml/ButtonSelector.qml | ButtonSelector file:///usr//awesomewidgets/qml/ButtonSelector.qml | ||||||
| CheckBoxSelector file:///usr/share/awesomewidgets/qml/CheckBoxSelector.qml | CheckBoxSelector file:///usr//awesomewidgets/qml/CheckBoxSelector.qml | ||||||
| ColorSelector file:///usr/share/awesomewidgets/qml/ColorSelector.qml | ColorSelector file:///usr//awesomewidgets/qml/ColorSelector.qml | ||||||
| ComboBoxSelector file:///usr/share/awesomewidgets/qml/ComboBoxSelector.qml | ComboBoxSelector file:///usr//awesomewidgets/qml/ComboBoxSelector.qml | ||||||
| ExportDialog file:///usr/share/awesomewidgets/qml/ExportDialog.qml | ExportDialog file:///usr//awesomewidgets/qml/ExportDialog.qml | ||||||
| FontSelector file:///usr/share/awesomewidgets/qml/FontSelector.qml | FontSelector file:///usr//awesomewidgets/qml/FontSelector.qml | ||||||
| HtmlDefaultFunctionsBar file:///usr/share/awesomewidgets/qml/HtmlDefaultFunctionsBar.qml | HtmlDefaultFunctionsBar file:///usr//awesomewidgets/qml/HtmlDefaultFunctionsBar.qml | ||||||
| HtmlEditorButton file:///usr/share/awesomewidgets/qml/HtmlEditorButton.qml | HtmlEditorButton file:///usr//awesomewidgets/qml/HtmlEditorButton.qml | ||||||
| HtmlEditorColor file:///usr/share/awesomewidgets/qml/HtmlEditorColor.qml | HtmlEditorColor file:///usr//awesomewidgets/qml/HtmlEditorColor.qml | ||||||
| HtmlEditorFont file:///usr/share/awesomewidgets/qml/HtmlEditorFont.qml | HtmlEditorFont file:///usr//awesomewidgets/qml/HtmlEditorFont.qml | ||||||
| ImportDialog file:///usr/share/awesomewidgets/qml/ImportDialog.qml | ImportDialog file:///usr//awesomewidgets/qml/ImportDialog.qml | ||||||
| IntegerSelector file:///usr/share/awesomewidgets/qml/IntegerSelector.qml | IntegerSelector file:///usr//awesomewidgets/qml/IntegerSelector.qml | ||||||
| LineSelector file:///usr/share/awesomewidgets/qml/LineSelector.qml | LineSelector file:///usr//awesomewidgets/qml/LineSelector.qml | ||||||
|  | |||||||
| @ -6,15 +6,15 @@ include_directories( | |||||||
|         ${CMAKE_BINARY_DIR} |         ${CMAKE_BINARY_DIR} | ||||||
|         ${PROJECT_TRDPARTY_DIR} |         ${PROJECT_TRDPARTY_DIR} | ||||||
|         ${Qt_INCLUDE} |         ${Qt_INCLUDE} | ||||||
|         ${Kf5_INCLUDE} |         ${Kf6_INCLUDE} | ||||||
| ) | ) | ||||||
|  |  | ||||||
| file(GLOB SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp ${CMAKE_SOURCE_DIR}/*.cpp) | file(GLOB SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp ${CMAKE_SOURCE_DIR}/*.cpp) | ||||||
| file(GLOB SUBPROJECT_NOTIFY *.notifyrc) | file(GLOB SUBPROJECT_NOTIFY *.notifyrc) | ||||||
|  |  | ||||||
| add_library(${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE}) | add_library(${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE}) | ||||||
| target_link_libraries(${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES}) | target_link_libraries(${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf6_LIBRARIES}) | ||||||
|  |  | ||||||
| install(TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/desktoppanel) | install(TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/desktoppanel) | ||||||
| install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/desktoppanel) | install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/desktoppanel) | ||||||
| install(FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR}) | install(FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KDE_INSTALL_KNOTIFYRCDIR}) | ||||||
|  | |||||||
| @ -92,7 +92,7 @@ QStringList DPAdds::dictKeys(const bool _sorted, const QString &_regexp) | |||||||
|     if (_sorted) |     if (_sorted) | ||||||
|         allKeys.sort(); |         allKeys.sort(); | ||||||
|  |  | ||||||
|     return allKeys.filter(QRegExp(_regexp)); |     return allKeys.filter(QRegularExpression(_regexp)); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ include_directories( | |||||||
|         ${CMAKE_CURRENT_SOURCE_DIR}/../${PROJECT_MONITORSOURCES}/ |         ${CMAKE_CURRENT_SOURCE_DIR}/../${PROJECT_MONITORSOURCES}/ | ||||||
|         ${PROJECT_TRDPARTY_DIR} |         ${PROJECT_TRDPARTY_DIR} | ||||||
|         ${Qt_INCLUDE} |         ${Qt_INCLUDE} | ||||||
|         ${Kf5_INCLUDE} |         ${Kf6_INCLUDE} | ||||||
| ) | ) | ||||||
|  |  | ||||||
| file(GLOB SUBPROJECT_DESKTOP_IN *.desktop) | file(GLOB SUBPROJECT_DESKTOP_IN *.desktop) | ||||||
| @ -25,11 +25,9 @@ configure_file(${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT | |||||||
| add_library(${SUBPROJECT} MODULE ${SUBPROJECT_SOURCE} ${SUBPROJECT_HEADER}) | add_library(${SUBPROJECT} MODULE ${SUBPROJECT_SOURCE} ${SUBPROJECT_HEADER}) | ||||||
| target_link_libraries(${SUBPROJECT}  | target_link_libraries(${SUBPROJECT}  | ||||||
|         ${PROJECT_LIBRARY} ${PROJECT_MONITORSOURCES}  |         ${PROJECT_LIBRARY} ${PROJECT_MONITORSOURCES}  | ||||||
|         ${Qt_LIBRARIES} ${Kf5_LIBRARIES}) |         ${Qt_LIBRARIES} ${Kf6_LIBRARIES}) | ||||||
| kcoreaddons_desktop_to_json(${SUBPROJECT} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} |  | ||||||
|                             SERVICE_TYPES plasma-dataengine.desktop) |  | ||||||
|  |  | ||||||
| # install | # install | ||||||
| install(TARGETS ${SUBPROJECT} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine) | install(TARGETS ${SUBPROJECT} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine) | ||||||
| install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR}) | #install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR}) | ||||||
| install(FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR}) | install(FILES ${SUBPROJECT_CONF} DESTINATION ${KDE_INSTALL_CONFDIR}) | ||||||
|  | |||||||
| @ -18,6 +18,7 @@ | |||||||
| #include "extsysmon.h" | #include "extsysmon.h" | ||||||
|  |  | ||||||
| #include <QFile> | #include <QFile> | ||||||
|  | #include <QRegularExpression> | ||||||
| #include <QSettings> | #include <QSettings> | ||||||
| #include <QStandardPaths> | #include <QStandardPaths> | ||||||
|  |  | ||||||
| @ -127,7 +128,7 @@ QHash<QString, QString> ExtendedSysMon::updateConfiguration(QHash<QString, QStri | |||||||
|     } else { |     } else { | ||||||
|         QStringList deviceList = _rawConfig["HDDDEV"].split(',', Qt::SkipEmptyParts); |         QStringList deviceList = _rawConfig["HDDDEV"].split(',', Qt::SkipEmptyParts); | ||||||
|         QStringList devices; |         QStringList devices; | ||||||
|         QRegExp diskRegexp = QRegExp("^/dev/[hms]d[a-z]$"); |         auto diskRegexp = QRegularExpression("^/dev/[hms]d[a-z]$"); | ||||||
|         for (auto &device : deviceList) |         for (auto &device : deviceList) | ||||||
|             if ((QFile::exists(device)) && (device.contains(diskRegexp))) |             if ((QFile::exists(device)) && (device.contains(diskRegexp))) | ||||||
|                 devices.append(device); |                 devices.append(device); | ||||||
|  | |||||||
| @ -18,7 +18,7 @@ | |||||||
| #ifndef EXTSYSMON_H | #ifndef EXTSYSMON_H | ||||||
| #define EXTSYSMON_H | #define EXTSYSMON_H | ||||||
|  |  | ||||||
| #include <Plasma/DataEngine> | #include <Plasma/Plasma/DataEngine> | ||||||
|  |  | ||||||
|  |  | ||||||
| class ExtSysMonAggregator; | class ExtSysMonAggregator; | ||||||
|  | |||||||
							
								
								
									
										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@" | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -8,11 +8,11 @@ include_directories( | |||||||
|         ${CMAKE_CURRENT_SOURCE_DIR}/../${PROJECT_LIBRARY}/ |         ${CMAKE_CURRENT_SOURCE_DIR}/../${PROJECT_LIBRARY}/ | ||||||
|         ${PROJECT_TRDPARTY_DIR} |         ${PROJECT_TRDPARTY_DIR} | ||||||
|         ${Qt_INCLUDE} |         ${Qt_INCLUDE} | ||||||
|         ${Kf5_INCLUDE} |         ${Kf6_INCLUDE} | ||||||
| ) | ) | ||||||
|  |  | ||||||
| file(GLOB SUBPROJECT_SOURCE *.cpp) | file(GLOB SUBPROJECT_SOURCE *.cpp) | ||||||
| file(GLOB SUBPROJECT_HEADER *.h) | file(GLOB SUBPROJECT_HEADER *.h) | ||||||
|  |  | ||||||
| add_library(${SUBPROJECT} STATIC ${SUBPROJECT_SOURCE} ${SUBPROJECT_HEADER}) | add_library(${SUBPROJECT} STATIC ${SUBPROJECT_SOURCE} ${SUBPROJECT_HEADER}) | ||||||
| target_link_libraries(${SUBPROJECT} ${PROJECT_LIBRARY} ${Qt_LIBRARIES} ${Kf5_LIBRARIES}) | target_link_libraries(${SUBPROJECT} ${PROJECT_LIBRARY} ${Qt_LIBRARIES} ${Kf6_LIBRARIES}) | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ | |||||||
| #define ABSTRACTEXTSYSMONSOURCE_H | #define ABSTRACTEXTSYSMONSOURCE_H | ||||||
|  |  | ||||||
| #include <QObject> | #include <QObject> | ||||||
| #include <QRegExp> | #include <QRegularExpression> | ||||||
| #include <QVariant> | #include <QVariant> | ||||||
|  |  | ||||||
|  |  | ||||||
| @ -38,9 +38,8 @@ public: | |||||||
|     // used by extensions |     // used by extensions | ||||||
|     static int index(const QString &_source) |     static int index(const QString &_source) | ||||||
|     { |     { | ||||||
|         QRegExp rx("\\d+"); |         QRegularExpression rx("\\d+"); | ||||||
|         rx.indexIn(_source); |         return rx.match(_source).captured().toInt(); | ||||||
|         return rx.cap().toInt(); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
| signals: | signals: | ||||||
|  | |||||||
| @ -20,7 +20,6 @@ | |||||||
|  |  | ||||||
| #include <QFile> | #include <QFile> | ||||||
| #include <QProcess> | #include <QProcess> | ||||||
| #include <QTextCodec> |  | ||||||
|  |  | ||||||
| #include "awdebug.h" | #include "awdebug.h" | ||||||
|  |  | ||||||
| @ -124,9 +123,9 @@ QStringList GPULoadSource::sources() const | |||||||
| void GPULoadSource::updateValue() | void GPULoadSource::updateValue() | ||||||
| { | { | ||||||
|     qCInfo(LOG_ESS) << "Cmd returns" << m_process->exitCode(); |     qCInfo(LOG_ESS) << "Cmd returns" << m_process->exitCode(); | ||||||
|     QString qdebug = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardError()).trimmed(); |     QString qdebug = QString::fromUtf8(m_process->readAllStandardError()).trimmed(); | ||||||
|     qCInfo(LOG_ESS) << "Error" << qdebug; |     qCInfo(LOG_ESS) << "Error" << qdebug; | ||||||
|     QString qoutput = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardOutput()).trimmed(); |     QString qoutput = QString::fromUtf8(m_process->readAllStandardOutput()).trimmed(); | ||||||
|     qCInfo(LOG_ESS) << "Output" << qoutput; |     qCInfo(LOG_ESS) << "Output" << qoutput; | ||||||
|  |  | ||||||
|     if (m_device == "nvidia") { |     if (m_device == "nvidia") { | ||||||
|  | |||||||
| @ -20,7 +20,6 @@ | |||||||
|  |  | ||||||
| #include <QFile> | #include <QFile> | ||||||
| #include <QProcess> | #include <QProcess> | ||||||
| #include <QTextCodec> |  | ||||||
|  |  | ||||||
| #include "awdebug.h" | #include "awdebug.h" | ||||||
|  |  | ||||||
| @ -103,9 +102,9 @@ QStringList GPUTemperatureSource::sources() const | |||||||
| void GPUTemperatureSource::updateValue() | void GPUTemperatureSource::updateValue() | ||||||
| { | { | ||||||
|     qCInfo(LOG_ESS) << "Cmd returns" << m_process->exitCode(); |     qCInfo(LOG_ESS) << "Cmd returns" << m_process->exitCode(); | ||||||
|     QString qdebug = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardError()).trimmed(); |     QString qdebug = QString::fromUtf8(m_process->readAllStandardError()).trimmed(); | ||||||
|     qCInfo(LOG_ESS) << "Error" << qdebug; |     qCInfo(LOG_ESS) << "Error" << qdebug; | ||||||
|     QString qoutput = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardOutput()).trimmed(); |     QString qoutput = QString::fromUtf8(m_process->readAllStandardOutput()).trimmed(); | ||||||
|     qCInfo(LOG_ESS) << "Output" << qoutput; |     qCInfo(LOG_ESS) << "Output" << qoutput; | ||||||
|  |  | ||||||
|     if (m_device == "nvidia") { |     if (m_device == "nvidia") { | ||||||
|  | |||||||
| @ -20,7 +20,6 @@ | |||||||
|  |  | ||||||
| #include <QDir> | #include <QDir> | ||||||
| #include <QProcess> | #include <QProcess> | ||||||
| #include <QTextCodec> |  | ||||||
|  |  | ||||||
| #include "awdebug.h" | #include "awdebug.h" | ||||||
|  |  | ||||||
| @ -61,7 +60,7 @@ HDDTemperatureSource::~HDDTemperatureSource() | |||||||
| QStringList HDDTemperatureSource::allHdd() | QStringList HDDTemperatureSource::allHdd() | ||||||
| { | { | ||||||
|     QStringList allDevices = QDir("/dev").entryList(QDir::System, QDir::Name); |     QStringList allDevices = QDir("/dev").entryList(QDir::System, QDir::Name); | ||||||
|     QStringList devices = allDevices.filter(QRegExp("^[hms]d[a-z]$")); |     QStringList devices = allDevices.filter(QRegularExpression("^[hms]d[a-z]$")); | ||||||
|     for (int i = 0; i < devices.count(); i++) |     for (int i = 0; i < devices.count(); i++) | ||||||
|         devices[i] = QString("/dev/%1").arg(devices.at(i)); |         devices[i] = QString("/dev/%1").arg(devices.at(i)); | ||||||
|  |  | ||||||
| @ -120,9 +119,9 @@ void HDDTemperatureSource::updateValue(const QString &_device) | |||||||
|     qCDebug(LOG_ESS) << "Called with device" << _device; |     qCDebug(LOG_ESS) << "Called with device" << _device; | ||||||
|  |  | ||||||
|     qCInfo(LOG_ESS) << "Cmd returns" << m_processes[_device]->exitCode(); |     qCInfo(LOG_ESS) << "Cmd returns" << m_processes[_device]->exitCode(); | ||||||
|     QString qdebug = QTextCodec::codecForMib(106)->toUnicode(m_processes[_device]->readAllStandardError()).trimmed(); |     QString qdebug = QString::fromUtf8(m_processes[_device]->readAllStandardError()).trimmed(); | ||||||
|     qCInfo(LOG_ESS) << "Error" << qdebug; |     qCInfo(LOG_ESS) << "Error" << qdebug; | ||||||
|     QString qoutput = QTextCodec::codecForMib(106)->toUnicode(m_processes[_device]->readAllStandardOutput()).trimmed(); |     QString qoutput = QString::fromUtf8(m_processes[_device]->readAllStandardOutput()).trimmed(); | ||||||
|     qCInfo(LOG_ESS) << "Output" << qoutput; |     qCInfo(LOG_ESS) << "Output" << qoutput; | ||||||
|  |  | ||||||
|     // parse |     // parse | ||||||
|  | |||||||
| @ -20,7 +20,6 @@ | |||||||
|  |  | ||||||
| #include <QNetworkInterface> | #include <QNetworkInterface> | ||||||
| #include <QProcess> | #include <QProcess> | ||||||
| #include <QTextCodec> |  | ||||||
|  |  | ||||||
| #include "awdebug.h" | #include "awdebug.h" | ||||||
|  |  | ||||||
| @ -101,9 +100,9 @@ QStringList NetworkSource::sources() const | |||||||
| void NetworkSource::updateSsid() | void NetworkSource::updateSsid() | ||||||
| { | { | ||||||
|     qCInfo(LOG_ESS) << "Cmd returns" << m_process->exitCode(); |     qCInfo(LOG_ESS) << "Cmd returns" << m_process->exitCode(); | ||||||
|     QString qdebug = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardError()).trimmed(); |     QString qdebug = QString::fromUtf8(m_process->readAllStandardError()).trimmed(); | ||||||
|     qCInfo(LOG_ESS) << "Error" << qdebug; |     qCInfo(LOG_ESS) << "Error" << qdebug; | ||||||
|     QString qoutput = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardOutput()).trimmed(); |     QString qoutput = QString::fromUtf8(m_process->readAllStandardOutput()).trimmed(); | ||||||
|     qCInfo(LOG_ESS) << "Output" << qoutput; |     qCInfo(LOG_ESS) << "Output" << qoutput; | ||||||
|  |  | ||||||
|     m_values["network/current/ssid"] = qoutput; |     m_values["network/current/ssid"] = qoutput; | ||||||
|  | |||||||
| @ -23,7 +23,6 @@ | |||||||
| #include <QDBusConnectionInterface> | #include <QDBusConnectionInterface> | ||||||
| #include <QDBusMessage> | #include <QDBusMessage> | ||||||
| #include <QProcess> | #include <QProcess> | ||||||
| #include <QTextCodec> |  | ||||||
|  |  | ||||||
| #include "awdebug.h" | #include "awdebug.h" | ||||||
|  |  | ||||||
| @ -219,7 +218,7 @@ QString PlayerSource::buildString(const QString &_current, const QString &_value | |||||||
|     qCDebug(LOG_ESS) << "Current value" << _current << "received" << _value << "will be stripped after" << _s; |     qCDebug(LOG_ESS) << "Current value" << _current << "received" << _value << "will be stripped after" << _s; | ||||||
|  |  | ||||||
|     int index = _value.indexOf(_current); |     int index = _value.indexOf(_current); | ||||||
|     if ((_current.isEmpty()) || ((index + _s + 1) > _value.count())) |     if ((_current.isEmpty()) || ((index + _s + 1) > _value.length())) | ||||||
|         return QString("%1").arg(_value.left(_s), -_s, QLatin1Char(' ')); |         return QString("%1").arg(_value.left(_s), -_s, QLatin1Char(' ')); | ||||||
|     else |     else | ||||||
|         return QString("%1").arg(_value.mid(index + 1, _s), -_s, QLatin1Char(' ')); |         return QString("%1").arg(_value.mid(index + 1, _s), -_s, QLatin1Char(' ')); | ||||||
| @ -230,7 +229,7 @@ QString PlayerSource::stripString(const QString &_value, const int _s) | |||||||
| { | { | ||||||
|     qCDebug(LOG_ESS) << "New value" << _value << "will be stripped after" << _s; |     qCDebug(LOG_ESS) << "New value" << _value << "will be stripped after" << _s; | ||||||
|  |  | ||||||
|     return _value.count() > _s ? QString("%1\u2026").arg(_value.left(_s - 1)) |     return _value.length() > _s ? QString("%1\u2026").arg(_value.left(_s - 1)) | ||||||
|                                 : _value.leftJustified(_s, QLatin1Char(' ')); |                                 : _value.leftJustified(_s, QLatin1Char(' ')); | ||||||
| } | } | ||||||
|  |  | ||||||
| @ -249,7 +248,7 @@ void PlayerSource::mpdSocketConnected() | |||||||
|  |  | ||||||
| void PlayerSource::mpdSocketReadyRead() | void PlayerSource::mpdSocketReadyRead() | ||||||
| { | { | ||||||
|     QString qoutput = QTextCodec::codecForMib(106)->toUnicode(m_mpdSocket.readAll()).trimmed(); |     QString qoutput = QString::fromUtf8(m_mpdSocket.readAll()).trimmed(); | ||||||
|     qCInfo(LOG_ESS) << "Output" << qoutput; |     qCInfo(LOG_ESS) << "Output" << qoutput; | ||||||
|  |  | ||||||
|     // parse |     // parse | ||||||
|  | |||||||
| @ -80,7 +80,7 @@ QVariantMap ProcessesSource::initialData(const QString &_source) const | |||||||
| void ProcessesSource::run() | void ProcessesSource::run() | ||||||
| { | { | ||||||
|     QStringList allDirectories = QDir("/proc").entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); |     QStringList allDirectories = QDir("/proc").entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); | ||||||
|     QStringList directories = allDirectories.filter(QRegExp("(\\d+)")); |     QStringList directories = allDirectories.filter(QRegularExpression("(\\d+)")); | ||||||
|     QStringList running; |     QStringList running; | ||||||
|  |  | ||||||
|     for (auto &dir : directories) { |     for (auto &dir : directories) { | ||||||
|  | |||||||
| @ -2,28 +2,29 @@ | |||||||
| find_package(Gettext REQUIRED) | find_package(Gettext REQUIRED) | ||||||
|  |  | ||||||
| # main qt libraries | # main qt libraries | ||||||
| find_package(Qt5 5.6.0 REQUIRED COMPONENTS Core DBus Network Qml Test Widgets) | find_package(Qt6 6.6.0 REQUIRED COMPONENTS Core DBus Network Qml Test Widgets) | ||||||
| add_definitions( | add_definitions( | ||||||
|         ${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5Network_DEFINITIONS} |         ${Qt6Core_DEFINITIONS} ${Qt6DBus_DEFINITIONS} ${Qt6Network_DEFINITIONS} | ||||||
|         ${Qt5Qml_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} |         ${Qt6Qml_DEFINITIONS} ${Qt6Widgets_DEFINITIONS} | ||||||
| ) | ) | ||||||
| set(Qt_INCLUDE | set(Qt_INCLUDE | ||||||
|         ${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} |         ${Qt6Core_INCLUDE_DIRS} ${Qt6DBus_INCLUDE_DIRS} ${Qt6Network_INCLUDE_DIRS} | ||||||
|         ${Qt5Qml_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} |         ${Qt6Qml_INCLUDE_DIRS} ${Qt6Widgets_INCLUDE_DIRS} | ||||||
| ) | ) | ||||||
| set(Qt_LIBRARIES | set(Qt_LIBRARIES | ||||||
|         ${Qt5Core_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Network_LIBRARIES} |         ${Qt6Core_LIBRARIES} ${Qt6DBus_LIBRARIES} ${Qt6Network_LIBRARIES} | ||||||
|         ${Qt5Qml_LIBRARIES} ${Qt5Widgets_LIBRARIES} |         ${Qt6Qml_LIBRARIES} ${Qt6Widgets_LIBRARIES} | ||||||
| ) | ) | ||||||
|  |  | ||||||
| # kf5 libraries | # kf6 libraries | ||||||
| find_package(ECM 0.0.11 REQUIRED NO_MODULE) | find_package(ECM 0.0.11 REQUIRED NO_MODULE) | ||||||
| set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) | ||||||
| find_package(KF5 REQUIRED COMPONENTS I18n Notifications Plasma 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(KSysGuard REQUIRED) | ||||||
| include(KDEInstallDirs) | include(KDEInstallDirs) | ||||||
| include(KDECMakeSettings) | include(KDECMakeSettings) | ||||||
| include(KDECompilerSettings) | include(KDECompilerSettings) | ||||||
| set(Kf5_INCLUDE ${I18n_INCLUDE_DIR} ${Notifications_INCLUDE_DIR} ${Plasma_INCLUDE_DIR}) | set(Kf6_INCLUDE ${KDE_INSTALL_FULL_INCLUDEDIR_KF}) | ||||||
| set(Kf5_LIBRARIES KF5::I18n KF5::Notifications KF5::Plasma KF5::WindowSystem PW::LibTaskManager) | set(Kf6_LIBRARIES KF6::I18n KF6::Notifications KF6::WindowSystem KSysGuard::Sensors KSysGuard::SensorFaces PW::LibTaskManager) | ||||||
|  |  | ||||||
|  | |||||||
| @ -13,16 +13,16 @@ include_directories( | |||||||
|         ${PROJECT_TRDPARTY_DIR} |         ${PROJECT_TRDPARTY_DIR} | ||||||
|         ${Qt_INCLUDE} |         ${Qt_INCLUDE} | ||||||
|         ${Qt5Test_INCLUDE_DIRS} |         ${Qt5Test_INCLUDE_DIRS} | ||||||
|         ${Kf5_INCLUDE} |         ${Kf6_INCLUDE} | ||||||
| ) | ) | ||||||
|  |  | ||||||
| # library | # library | ||||||
| set(AWTESTLIBRARY_HEADERS awtestlibrary.h) | set(AWTESTLIBRARY_HEADERS awtestlibrary.h) | ||||||
| set(AWTESTLIBRARY_SOURCES awtestlibrary.cpp) | set(AWTESTLIBRARY_SOURCES awtestlibrary.cpp) | ||||||
| add_library(${SUBPROJECT}-awtest STATIC ${AWTESTLIBRARY_SOURCES} ${AWTESTLIBRARY_HEADERS}) | add_library(${SUBPROJECT}-awtest STATIC ${AWTESTLIBRARY_SOURCES} ${AWTESTLIBRARY_HEADERS}) | ||||||
| target_link_libraries(${SUBPROJECT}-awtest ${Qt_LIBRARIES} ${Qt5Test_LIBRARIES} ${Kf5_LIBRARIES}) | target_link_libraries(${SUBPROJECT}-awtest ${Qt_LIBRARIES} ${Qt5Test_LIBRARIES} ${Kf6_LIBRARIES}) | ||||||
| set(LIBRARY_TEST_SET ${SUBPROJECT}-awtest ${PROJECT_LIBRARY} ${PROJECT_MONITORSOURCES} | set(LIBRARY_TEST_SET ${SUBPROJECT}-awtest ${PROJECT_LIBRARY} ${PROJECT_MONITORSOURCES} | ||||||
|         ${Qt_LIBRARIES} ${Kf5_LIBRARIES} ${Qt5Test_LIBRARIES}) |         ${Qt_LIBRARIES} ${Kf6_LIBRARIES} ${Qt5Test_LIBRARIES}) | ||||||
|  |  | ||||||
| # modules | # modules | ||||||
| set(TEST_MODULES | set(TEST_MODULES | ||||||
|  | |||||||
| @ -18,6 +18,7 @@ | |||||||
|  |  | ||||||
| #include "testawpatternfunctions.h" | #include "testawpatternfunctions.h" | ||||||
|  |  | ||||||
|  | #include <QRegularExpression> | ||||||
| #include <QtTest> | #include <QtTest> | ||||||
|  |  | ||||||
| #include "awpatternfunctions.h" | #include "awpatternfunctions.h" | ||||||
| @ -57,7 +58,7 @@ void TestAWPatternFunctions::test_findKeys() | |||||||
|     QStringList allKeys; |     QStringList allKeys; | ||||||
|     for (int i = 0; i < count; i++) { |     for (int i = 0; i < count; i++) { | ||||||
|         auto key = AWTestLibrary::randomString(1, 20); |         auto key = AWTestLibrary::randomString(1, 20); | ||||||
|         while (allKeys.indexOf(QRegExp(QString("^%1.*").arg(key))) != -1) |         while (allKeys.indexOf(QRegularExpression(QString("^%1.*").arg(key))) != -1) | ||||||
|             key = AWTestLibrary::randomString(1, 20); |             key = AWTestLibrary::randomString(1, 20); | ||||||
|         allKeys.append(key); |         allKeys.append(key); | ||||||
|     } |     } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user