From 3b6df444898e39f9a40f92dd763480a0a09fc389 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Sat, 25 Jul 2015 00:03:45 +0300 Subject: [PATCH] more correct methods naming, prepare to move to templates --- sources/awesome-widget/plugin/awactions.cpp | 25 ++++++------ sources/awesome-widget/plugin/awactions.h | 22 +++++------ sources/awesome-widget/plugin/awkeys.cpp | 34 ++++++++-------- sources/awesome-widget/plugin/awkeys.h | 38 +++++++++--------- sources/awesome-widget/plugin/awtooltip.cpp | 2 +- sources/awesome-widget/plugin/awtooltip.h | 2 +- sources/desktop-panel/plugin/dpadds.cpp | 32 +++++++-------- sources/desktop-panel/plugin/dpadds.h | 36 ++++++++--------- sources/extsysmon/CMakeLists.txt | 1 + sources/extsysmon/abstractextitem.cpp | 18 --------- sources/extsysmon/abstractextitem.h | 10 ++--- sources/extsysmon/extquotes.h | 3 +- sources/extsysmon/extscript.h | 3 +- sources/extsysmon/extsysmon.cpp | 44 ++++++++++----------- sources/extsysmon/extsysmon.h | 29 +++++++------- sources/extsysmon/extupgrade.h | 3 +- sources/extsysmon/extweather.h | 3 +- 17 files changed, 144 insertions(+), 161 deletions(-) diff --git a/sources/awesome-widget/plugin/awactions.cpp b/sources/awesome-widget/plugin/awactions.cpp index 54c83bf..0fb24ff 100644 --- a/sources/awesome-widget/plugin/awactions.cpp +++ b/sources/awesome-widget/plugin/awactions.cpp @@ -67,7 +67,7 @@ void AWActions::checkUpdates() } -bool AWActions::dropCache() +bool AWActions::dropCache() const { if (debug) qDebug() << PDEBUG; @@ -78,7 +78,7 @@ bool AWActions::dropCache() } -bool AWActions::isDebugEnabled() +bool AWActions::isDebugEnabled() const { if (debug) qDebug() << PDEBUG; @@ -86,7 +86,7 @@ bool AWActions::isDebugEnabled() } -void AWActions::runCmd(const QString cmd) +void AWActions::runCmd(const QString cmd) const { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd; @@ -98,13 +98,13 @@ void AWActions::runCmd(const QString cmd) } -void AWActions::sendEmail() +void AWActions::sendEmail() const { if (debug) qDebug() << PDEBUG; } -void AWActions::showReadme() +void AWActions::showReadme() const { if (debug) qDebug() << PDEBUG; @@ -112,7 +112,7 @@ void AWActions::showReadme() } -QString AWActions::getAboutText(const QString type) +QString AWActions::getAboutText(const QString type) const { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Type" << type; @@ -151,7 +151,7 @@ QString AWActions::getAboutText(const QString type) } -QVariantMap AWActions::getFont(const QVariantMap defaultFont) +QVariantMap AWActions::getFont(const QVariantMap defaultFont) const { if (debug) qDebug() << PDEBUG; @@ -169,7 +169,7 @@ QVariantMap AWActions::getFont(const QVariantMap defaultFont) } -QVariantMap AWActions::readDataEngineConfiguration() +QVariantMap AWActions::readDataEngineConfiguration() const { if (debug) qDebug() << PDEBUG; @@ -193,7 +193,7 @@ QVariantMap AWActions::readDataEngineConfiguration() } -void AWActions::writeDataEngineConfiguration(const QVariantMap configuration) +void AWActions::writeDataEngineConfiguration(const QVariantMap configuration) const { if (debug) qDebug() << PDEBUG; @@ -216,7 +216,8 @@ void AWActions::writeDataEngineConfiguration(const QVariantMap configuration) } -void AWActions::sendNotification(const QString eventId, const QString message, const bool enablePopup) +void AWActions::sendNotification(const QString eventId, const QString message, + const bool enablePopup) { if ((eventId == QString("event")) && (!enablePopup)) return; @@ -225,7 +226,7 @@ void AWActions::sendNotification(const QString eventId, const QString message, c } -void AWActions::showUpdates(QString version) +void AWActions::showUpdates(QString version) const { if (debug) qDebug() << PDEBUG; @@ -244,7 +245,7 @@ void AWActions::showUpdates(QString version) } -void AWActions::versionReplyRecieved(QNetworkReply *reply) +void AWActions::versionReplyRecieved(QNetworkReply *reply) const { if (debug) qDebug() << PDEBUG; diff --git a/sources/awesome-widget/plugin/awactions.h b/sources/awesome-widget/plugin/awactions.h index 828e273..d338950 100644 --- a/sources/awesome-widget/plugin/awactions.h +++ b/sources/awesome-widget/plugin/awactions.h @@ -35,25 +35,25 @@ public: ~AWActions(); Q_INVOKABLE void checkUpdates(); - Q_INVOKABLE bool dropCache(); - Q_INVOKABLE bool isDebugEnabled(); - Q_INVOKABLE void runCmd(const QString cmd = QString("/usr/bin/true")); - Q_INVOKABLE void sendEmail(); - Q_INVOKABLE void showReadme(); + Q_INVOKABLE bool dropCache() const; + Q_INVOKABLE bool isDebugEnabled() const; + Q_INVOKABLE void runCmd(const QString cmd = QString("/usr/bin/true")) const; + Q_INVOKABLE void sendEmail() const; + Q_INVOKABLE void showReadme() const; // configuration slots - Q_INVOKABLE QString getAboutText(const QString type = QString("header")); - Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont); + Q_INVOKABLE QString getAboutText(const QString type = QString("header")) const; + Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont) const; // dataengine - Q_INVOKABLE QVariantMap readDataEngineConfiguration(); - Q_INVOKABLE void writeDataEngineConfiguration(const QVariantMap configuration); + Q_INVOKABLE QVariantMap readDataEngineConfiguration() const; + Q_INVOKABLE void writeDataEngineConfiguration(const QVariantMap configuration) const; public slots: Q_INVOKABLE static void sendNotification(const QString eventId, const QString message, const bool enablePopup = false); private slots: - void showUpdates(QString version); - void versionReplyRecieved(QNetworkReply *reply); + void showUpdates(QString version) const; + void versionReplyRecieved(QNetworkReply *reply) const; private: // variables diff --git a/sources/awesome-widget/plugin/awkeys.cpp b/sources/awesome-widget/plugin/awkeys.cpp index 18f6e52..bd99daa 100644 --- a/sources/awesome-widget/plugin/awkeys.cpp +++ b/sources/awesome-widget/plugin/awkeys.cpp @@ -139,7 +139,7 @@ void AWKeys::setWrapNewLines(const bool wrap) } -QString AWKeys::parsePattern() +QString AWKeys::parsePattern() const { if (debug) qDebug() << PDEBUG; if (keys.isEmpty()) return pattern; @@ -158,7 +158,7 @@ QString AWKeys::parsePattern() } -QSize AWKeys::toolTipSize() +QSize AWKeys::toolTipSize() const { if (debug) qDebug() << PDEBUG; if (toolTip == nullptr) return QSize(); @@ -190,7 +190,7 @@ void AWKeys::addDevice(const QString source) } -QStringList AWKeys::dictKeys(const bool sorted) +QStringList AWKeys::dictKeys(const bool sorted) const { if (debug) qDebug() << PDEBUG; @@ -339,7 +339,7 @@ QStringList AWKeys::dictKeys(const bool sorted) } -QStringList AWKeys::getHddDevices() +QStringList AWKeys::getHddDevices() const { if (debug) qDebug() << PDEBUG; @@ -689,7 +689,7 @@ void AWKeys::setDataBySource(const QString sourceName, const QVariantMap data, } -void AWKeys::graphicalValueByKey() +void AWKeys::graphicalValueByKey() const { if (debug) qDebug() << PDEBUG; @@ -706,7 +706,7 @@ void AWKeys::graphicalValueByKey() } -QString AWKeys::infoByKey(QString key) +QString AWKeys::infoByKey(QString key) const { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key; @@ -742,7 +742,7 @@ QString AWKeys::infoByKey(QString key) } -QString AWKeys::valueByKey(QString key) +QString AWKeys::valueByKey(QString key) const { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key; @@ -822,7 +822,7 @@ void AWKeys::editItem(const QString type) } -void AWKeys::dataUpdate() +void AWKeys::dataUpdate() const { if (debug) qDebug() << PDEBUG; @@ -1390,7 +1390,7 @@ void AWKeys::addKeyToCache(const QString type, const QString key) } -bool AWKeys::checkKeys(const QVariantMap data) +bool AWKeys::checkKeys(const QVariantMap data) const { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Data" << data; @@ -1399,7 +1399,7 @@ bool AWKeys::checkKeys(const QVariantMap data) } -QString AWKeys::htmlValue(QString key) +QString AWKeys::htmlValue(QString key) const { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key; @@ -1411,7 +1411,7 @@ QString AWKeys::htmlValue(QString key) } -int AWKeys::numberCpus() +int AWKeys::numberCpus() const { if (debug) qDebug() << PDEBUG; @@ -1419,7 +1419,7 @@ int AWKeys::numberCpus() } -float AWKeys::temperature(const float temp, const QString units) +float AWKeys::temperature(const float temp, const QString units) const { if (debug) qDebug() << PDEBUG; @@ -1443,7 +1443,7 @@ float AWKeys::temperature(const float temp, const QString units) } -QString AWKeys::toolTipImage() +QString AWKeys::toolTipImage() const { if(debug) qDebug() << PDEBUG; if (toolTip == nullptr) return QString(""); @@ -1459,7 +1459,7 @@ QString AWKeys::toolTipImage() } -QStringList AWKeys::findGraphicalItems() +QStringList AWKeys::findGraphicalItems() const { if (debug) qDebug() << PDEBUG; @@ -1479,7 +1479,7 @@ QStringList AWKeys::findGraphicalItems() } -QStringList AWKeys::findKeys() +QStringList AWKeys::findKeys() const { QStringList selectedKeys; for (int i=0; i AWKeys::getGraphicalItems() } -GraphicalItem *AWKeys::getItemByTag(const QString tag) +GraphicalItem *AWKeys::getItemByTag(const QString tag) const { if (debug) qDebug() << PDEBUG; @@ -1664,7 +1664,7 @@ GraphicalItem *AWKeys::getItemByTag(const QString tag) } -QStringList AWKeys::getTimeKeys() +QStringList AWKeys::getTimeKeys() const { if (debug) qDebug() << PDEBUG; diff --git a/sources/awesome-widget/plugin/awkeys.h b/sources/awesome-widget/plugin/awkeys.h index 01cfd0a..959e17e 100644 --- a/sources/awesome-widget/plugin/awkeys.h +++ b/sources/awesome-widget/plugin/awkeys.h @@ -57,29 +57,29 @@ public: Q_INVOKABLE void initTooltip(const QVariantMap tooltipParams); Q_INVOKABLE void setPopupEnabled(const bool popup = false); Q_INVOKABLE void setWrapNewLines(const bool wrap = false); - Q_INVOKABLE QString parsePattern(); - Q_INVOKABLE QSize toolTipSize(); + Q_INVOKABLE QString parsePattern() const; + Q_INVOKABLE QSize toolTipSize() const; // keys Q_INVOKABLE void addDevice(const QString source); - Q_INVOKABLE QStringList dictKeys(const bool sorted = false); - Q_INVOKABLE QStringList getHddDevices(); + Q_INVOKABLE QStringList dictKeys(const bool sorted = false) const; + Q_INVOKABLE QStringList getHddDevices() const; Q_INVOKABLE void setDataBySource(const QString sourceName, const QVariantMap data, const QVariantMap params); // values - Q_INVOKABLE void graphicalValueByKey(); - Q_INVOKABLE QString infoByKey(QString key); - Q_INVOKABLE QString valueByKey(QString key); + Q_INVOKABLE void graphicalValueByKey() const; + Q_INVOKABLE QString infoByKey(QString key) const; + Q_INVOKABLE QString valueByKey(QString key) const; // configuration Q_INVOKABLE void editItem(const QString type); signals: void dropSourceFromDataengine(const QString source); - void needTextToBeUpdated(const QString newText); - void needToolTipToBeUpdated(const QString newText); + void needTextToBeUpdated(const QString newText) const; + void needToolTipToBeUpdated(const QString newText) const; void needToBeUpdated(); private slots: - void dataUpdate(); + void dataUpdate() const; void loadKeysFromCache(); void reinitKeys(); // editor @@ -93,22 +93,22 @@ private slots: private: // methods void addKeyToCache(const QString type, const QString key = QString("")); - bool checkKeys(const QVariantMap data); - QString htmlValue(QString key); - int numberCpus(); - float temperature(const float temp, const QString units); - QString toolTipImage(); + bool checkKeys(const QVariantMap data) const; + QString htmlValue(QString key) const; + int numberCpus() const; + float temperature(const float temp, const QString units) const; + QString toolTipImage() const; // find methods - QStringList findGraphicalItems(); - QStringList findKeys(); + QStringList findGraphicalItems() const; + QStringList findKeys() const; // get methods QList getExtQuotes(); QList getExtScripts(); QList getExtUpgrade(); QList getExtWeather(); QList getGraphicalItems(); - GraphicalItem *getItemByTag(const QString tag); - QStringList getTimeKeys(); + GraphicalItem *getItemByTag(const QString tag) const; + QStringList getTimeKeys() const; AWToolTip *toolTip = nullptr; // graphical elements QDialog *dialog = nullptr; diff --git a/sources/awesome-widget/plugin/awtooltip.cpp b/sources/awesome-widget/plugin/awtooltip.cpp index d0e5dd8..2b4b97b 100644 --- a/sources/awesome-widget/plugin/awtooltip.cpp +++ b/sources/awesome-widget/plugin/awtooltip.cpp @@ -76,7 +76,7 @@ AWToolTip::~AWToolTip() } -QSize AWToolTip::getSize() +QSize AWToolTip::getSize() const { if (debug) qDebug() << PDEBUG; diff --git a/sources/awesome-widget/plugin/awtooltip.h b/sources/awesome-widget/plugin/awtooltip.h index ad1ab16..6389a3e 100644 --- a/sources/awesome-widget/plugin/awtooltip.h +++ b/sources/awesome-widget/plugin/awtooltip.h @@ -35,7 +35,7 @@ public: AWToolTip(QObject *parent = nullptr, QVariantMap settings = QVariantMap()); ~AWToolTip(); - QSize getSize(); + QSize getSize() const; QPixmap image(); void setData(const QString source, float value, const bool ac = true); diff --git a/sources/desktop-panel/plugin/dpadds.cpp b/sources/desktop-panel/plugin/dpadds.cpp index 090beac..c106592 100644 --- a/sources/desktop-panel/plugin/dpadds.cpp +++ b/sources/desktop-panel/plugin/dpadds.cpp @@ -59,7 +59,7 @@ DPAdds::~DPAdds() } -bool DPAdds::isDebugEnabled() +bool DPAdds::isDebugEnabled() const { if (debug) qDebug() << PDEBUG; @@ -67,7 +67,7 @@ bool DPAdds::isDebugEnabled() } -int DPAdds::currentDesktop() +int DPAdds::currentDesktop() const { if (debug) qDebug() << PDEBUG; @@ -75,7 +75,7 @@ int DPAdds::currentDesktop() } -QStringList DPAdds::dictKeys() +QStringList DPAdds::dictKeys() const { if (debug) qDebug() << PDEBUG; @@ -89,7 +89,7 @@ QStringList DPAdds::dictKeys() } -int DPAdds::numberOfDesktops() +int DPAdds::numberOfDesktops() const { if (debug) qDebug() << PDEBUG; @@ -97,7 +97,7 @@ int DPAdds::numberOfDesktops() } -QString DPAdds::toolTipImage(const int desktop) +QString DPAdds::toolTipImage(const int desktop) const { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop; @@ -180,7 +180,7 @@ QString DPAdds::toolTipImage(const int desktop) } -QString DPAdds::parsePattern(const QString pattern, const int desktop) +QString DPAdds::parsePattern(const QString pattern, const int desktop) const { if (debug) qDebug() << PDEBUG; @@ -231,7 +231,7 @@ void DPAdds::setToolTipData(const QVariantMap tooltipData) } -QString DPAdds::valueByKey(const QString key, int desktop) +QString DPAdds::valueByKey(const QString key, int desktop) const { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key; @@ -302,7 +302,7 @@ QString DPAdds::editPanelsToContol(const QString current) } -QString DPAdds::getAboutText(const QString type) +QString DPAdds::getAboutText(const QString type) const { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Type" << type; @@ -341,7 +341,7 @@ QString DPAdds::getAboutText(const QString type) } -QVariantMap DPAdds::getFont(const QVariantMap defaultFont) +QVariantMap DPAdds::getFont(const QVariantMap defaultFont) const { if (debug) qDebug() << PDEBUG; @@ -359,7 +359,7 @@ QVariantMap DPAdds::getFont(const QVariantMap defaultFont) } -void DPAdds::changePanelsState() +void DPAdds::changePanelsState() const { if (debug) qDebug() << PDEBUG; if (panelsToControl.isEmpty()) return; @@ -393,7 +393,7 @@ void DPAdds::sendNotification(const QString eventId, const QString message) } -void DPAdds::setCurrentDesktop(const int desktop) +void DPAdds::setCurrentDesktop(const int desktop) const { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop; @@ -402,7 +402,7 @@ void DPAdds::setCurrentDesktop(const int desktop) } -void DPAdds::changeDesktop(const int desktop) +void DPAdds::changeDesktop(const int desktop) const { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop; @@ -411,7 +411,7 @@ void DPAdds::changeDesktop(const int desktop) } -void DPAdds::changeWindowList(const WId window) +void DPAdds::changeWindowList(const WId window) const { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Window" << window; @@ -420,7 +420,7 @@ void DPAdds::changeWindowList(const WId window) } -DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int desktop) +DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int desktop) const { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop; @@ -452,7 +452,7 @@ DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int desktop) } -QList DPAdds::getPanels() +QList DPAdds::getPanels() const { if (debug) qDebug() << PDEBUG; @@ -467,7 +467,7 @@ QList DPAdds::getPanels() } -QString DPAdds::panelLocationToStr(Plasma::Types::Location location) +QString DPAdds::panelLocationToStr(Plasma::Types::Location location) const { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Location" << location; diff --git a/sources/desktop-panel/plugin/dpadds.h b/sources/desktop-panel/plugin/dpadds.h index d1027ba..8cdb0ac 100644 --- a/sources/desktop-panel/plugin/dpadds.h +++ b/sources/desktop-panel/plugin/dpadds.h @@ -46,39 +46,39 @@ public: DPAdds(QObject *parent = nullptr); ~DPAdds(); - Q_INVOKABLE bool isDebugEnabled(); - Q_INVOKABLE int currentDesktop(); - Q_INVOKABLE QStringList dictKeys(); - Q_INVOKABLE int numberOfDesktops(); - Q_INVOKABLE QString toolTipImage(const int desktop); - Q_INVOKABLE QString parsePattern(const QString pattern, const int desktop); + Q_INVOKABLE bool isDebugEnabled() const; + Q_INVOKABLE int currentDesktop() const; + Q_INVOKABLE QStringList dictKeys() const; + Q_INVOKABLE int numberOfDesktops() const; + Q_INVOKABLE QString toolTipImage(const int desktop) const; + Q_INVOKABLE QString parsePattern(const QString pattern, const int desktop) const; // values Q_INVOKABLE void setMark(const QString newMark); Q_INVOKABLE void setPanelsToControl(const QString newPanels); Q_INVOKABLE void setToolTipData(const QVariantMap tooltipData); - Q_INVOKABLE QString valueByKey(const QString key, int desktop = -1); + Q_INVOKABLE QString valueByKey(const QString key, int desktop = -1) const; // configuration slots Q_INVOKABLE QString editPanelsToContol(const QString current); - Q_INVOKABLE QString getAboutText(const QString type = "header"); - Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont); + Q_INVOKABLE QString getAboutText(const QString type = "header") const; + Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont) const; signals: - void desktopChanged(); - void windowListChanged(); + void desktopChanged() const; + void windowListChanged() const; public slots: - Q_INVOKABLE void changePanelsState(); + Q_INVOKABLE void changePanelsState() const; Q_INVOKABLE static void sendNotification(const QString eventId, const QString message); - Q_INVOKABLE void setCurrentDesktop(const int desktop); + Q_INVOKABLE void setCurrentDesktop(const int desktop) const; private slots: - void changeDesktop(const int desktop); - void changeWindowList(const WId window); + void changeDesktop(const int desktop) const; + void changeWindowList(const WId window) const; private: - DesktopWindowsInfo getInfoByDesktop(const int desktop); - QList getPanels(); - QString panelLocationToStr(Plasma::Types::Location location); + DesktopWindowsInfo getInfoByDesktop(const int desktop) const; + QList getPanels() const; + QString panelLocationToStr(Plasma::Types::Location location) const; // variables bool debug = false; int oldState, tooltipWidth = 200; diff --git a/sources/extsysmon/CMakeLists.txt b/sources/extsysmon/CMakeLists.txt index 581ee20..ff38802 100644 --- a/sources/extsysmon/CMakeLists.txt +++ b/sources/extsysmon/CMakeLists.txt @@ -2,6 +2,7 @@ set (SUBPROJECT plasma_dataengine_extsysmon) set (PLUGIN_NAME ${SUBPROJECT}) message (STATUS "Subproject ${SUBPROJECT}") +add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.awesomewidget\") # find required libaries find_package (Qt5 REQUIRED COMPONENTS DBus Network Widgets) diff --git a/sources/extsysmon/abstractextitem.cpp b/sources/extsysmon/abstractextitem.cpp index 1943475..cc585d6 100644 --- a/sources/extsysmon/abstractextitem.cpp +++ b/sources/extsysmon/abstractextitem.cpp @@ -145,24 +145,6 @@ void AbstractExtItem::setComment(const QString _comment) } -void AbstractExtItem::setDirectories(QStringList _directories) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Directories" << _directories; - - m_dirs = _directories; -} - - -void AbstractExtItem::setFileName(const QString _fileName) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Filename" << _fileName; - - m_fileName = _fileName; -} - - void AbstractExtItem::setInterval(const int _interval) { if (debug) qDebug() << PDEBUG; diff --git a/sources/extsysmon/abstractextitem.h b/sources/extsysmon/abstractextitem.h index c628eff..fe2813d 100644 --- a/sources/extsysmon/abstractextitem.h +++ b/sources/extsysmon/abstractextitem.h @@ -19,6 +19,7 @@ #define ABSTRACTEXTITEM_H #include +#include #include @@ -28,15 +29,14 @@ class AbstractExtItem : public QDialog Q_PROPERTY(bool active READ isActive WRITE setActive) Q_PROPERTY(int apiVersion READ apiVersion WRITE setApiVersion) Q_PROPERTY(QString comment READ comment WRITE setComment) - Q_PROPERTY(QStringList directories READ directories WRITE setDirectories) - Q_PROPERTY(QString fileName READ fileName WRITE setFileName) + Q_PROPERTY(QStringList directories READ directories) + Q_PROPERTY(QString fileName READ fileName) Q_PROPERTY(int interval READ interval WRITE setInterval) Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(int number READ number WRITE setNumber) public: - explicit AbstractExtItem(QWidget *parent = nullptr, - const QString desktopName = QString(), + explicit AbstractExtItem(QWidget *parent = nullptr, const QString desktopName = QString(), const QStringList directories = QStringList(), const bool debugCmd = false); virtual ~AbstractExtItem(); @@ -54,8 +54,6 @@ public: void setApiVersion(const int _apiVersion = 0); void setActive(const bool _state = true); void setComment(const QString _comment = QString("empty")); - void setDirectories(const QStringList _directories); - void setFileName(const QString _fileName); void setInterval(const int _interval = 1); void setName(const QString _name = QString("none")); void setNumber(int _number = -1); diff --git a/sources/extsysmon/extquotes.h b/sources/extsysmon/extquotes.h index e6260fd..ba5bd51 100644 --- a/sources/extsysmon/extquotes.h +++ b/sources/extsysmon/extquotes.h @@ -37,7 +37,8 @@ class ExtQuotes : public AbstractExtItem public: explicit ExtQuotes(QWidget *parent = nullptr, const QString quotesName = QString(), - const QStringList directories = QStringList(), const bool debugCmd = false); + const QStringList directories = QStringList(), + const bool debugCmd = false); ~ExtQuotes(); // get methods QString ticker() const; diff --git a/sources/extsysmon/extscript.h b/sources/extsysmon/extscript.h index 42882cf..dd8ab45 100644 --- a/sources/extsysmon/extscript.h +++ b/sources/extsysmon/extscript.h @@ -45,7 +45,8 @@ public: }; explicit ExtScript(QWidget *parent = nullptr, const QString scriptName = QString(), - const QStringList directories = QStringList(), const bool debugCmd = false); + const QStringList directories = QStringList(), + const bool debugCmd = false); ~ExtScript(); // get methods QString executable() const; diff --git a/sources/extsysmon/extsysmon.cpp b/sources/extsysmon/extsysmon.cpp index c5a1377..24fd076 100644 --- a/sources/extsysmon/extsysmon.cpp +++ b/sources/extsysmon/extsysmon.cpp @@ -75,7 +75,7 @@ ExtendedSysMon::~ExtendedSysMon() } -QString ExtendedSysMon::getAllHdd() +QStringList ExtendedSysMon::getAllHdd() const { if (debug) qDebug() << PDEBUG; @@ -85,11 +85,11 @@ QString ExtendedSysMon::getAllHdd() devices[i] = QString("/dev/%1").arg(devices[i]); if (debug) qDebug() << PDEBUG << ":" << "Device list" << devices; - return devices.join(QChar(',')); + return devices; } -QString ExtendedSysMon::getAutoGpu() +QString ExtendedSysMon::getAutoGpu() const { if (debug) qDebug() << PDEBUG; @@ -108,7 +108,7 @@ QString ExtendedSysMon::getAutoGpu() } -QString ExtendedSysMon::getAutoMpris() +QString ExtendedSysMon::getAutoMpris() const { if (debug) qDebug() << PDEBUG; @@ -293,7 +293,7 @@ void ExtendedSysMon::readConfiguration() } -QMap ExtendedSysMon::updateConfiguration(QMap rawConfig) +QMap ExtendedSysMon::updateConfiguration(QMap rawConfig) const { if (debug) qDebug() << PDEBUG; @@ -306,7 +306,7 @@ QMap ExtendedSysMon::updateConfiguration(QMap ExtendedSysMon::updateConfiguration(QMap externalWeather; bool debug; // reread configuration - QStringList allHddDevices; - QString getAllHdd(); - QString getAutoGpu(); - QString getAutoMpris(); + QStringList getAllHdd() const; + QString getAutoGpu() const; + QString getAutoMpris() const; void initQuotes(); void initScripts(); void initUpgrade(); void initWeather(); void readConfiguration(); - QMap updateConfiguration(QMap rawConfig); + QMap updateConfiguration(QMap rawConfig) const; }; diff --git a/sources/extsysmon/extupgrade.h b/sources/extsysmon/extupgrade.h index b9e42a2..b1fe5e9 100644 --- a/sources/extsysmon/extupgrade.h +++ b/sources/extsysmon/extupgrade.h @@ -35,7 +35,8 @@ class ExtUpgrade : public AbstractExtItem public: explicit ExtUpgrade(QWidget *parent = nullptr, const QString upgradeName = QString(), - const QStringList directories = QStringList(), const bool debugCmd = false); + const QStringList directories = QStringList(), + const bool debugCmd = false); ~ExtUpgrade(); // get methods QString executable() const; diff --git a/sources/extsysmon/extweather.h b/sources/extsysmon/extweather.h index 005d615..80762a6 100644 --- a/sources/extsysmon/extweather.h +++ b/sources/extsysmon/extweather.h @@ -40,7 +40,8 @@ class ExtWeather : public AbstractExtItem public: explicit ExtWeather(QWidget *parent = nullptr, const QString weatherName = QString(), - const QStringList directories = QStringList(), const bool debugCmd = false); + const QStringList directories = QStringList(), + const bool debugCmd = false); ~ExtWeather(); QString weatherFromInt(const int _id) const; // get methods