more correct methods naming, prepare to move to templates

This commit is contained in:
arcan1s 2015-07-25 00:03:45 +03:00
parent 4742617e3e
commit 3b6df44489
17 changed files with 144 additions and 161 deletions

View File

@ -67,7 +67,7 @@ void AWActions::checkUpdates()
} }
bool AWActions::dropCache() bool AWActions::dropCache() const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
@ -78,7 +78,7 @@ bool AWActions::dropCache()
} }
bool AWActions::isDebugEnabled() bool AWActions::isDebugEnabled() const
{ {
if (debug) qDebug() << PDEBUG; 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;
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd; 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; if (debug) qDebug() << PDEBUG;
} }
void AWActions::showReadme() void AWActions::showReadme() const
{ {
if (debug) qDebug() << PDEBUG; 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;
if (debug) qDebug() << PDEBUG << ":" << "Type" << type; 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; 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; 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; 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; 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; 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; if (debug) qDebug() << PDEBUG;

View File

@ -35,25 +35,25 @@ public:
~AWActions(); ~AWActions();
Q_INVOKABLE void checkUpdates(); Q_INVOKABLE void checkUpdates();
Q_INVOKABLE bool dropCache(); Q_INVOKABLE bool dropCache() const;
Q_INVOKABLE bool isDebugEnabled(); Q_INVOKABLE bool isDebugEnabled() const;
Q_INVOKABLE void runCmd(const QString cmd = QString("/usr/bin/true")); Q_INVOKABLE void runCmd(const QString cmd = QString("/usr/bin/true")) const;
Q_INVOKABLE void sendEmail(); Q_INVOKABLE void sendEmail() const;
Q_INVOKABLE void showReadme(); Q_INVOKABLE void showReadme() const;
// configuration slots // configuration slots
Q_INVOKABLE QString getAboutText(const QString type = QString("header")); Q_INVOKABLE QString getAboutText(const QString type = QString("header")) const;
Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont); Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont) const;
// dataengine // dataengine
Q_INVOKABLE QVariantMap readDataEngineConfiguration(); Q_INVOKABLE QVariantMap readDataEngineConfiguration() const;
Q_INVOKABLE void writeDataEngineConfiguration(const QVariantMap configuration); Q_INVOKABLE void writeDataEngineConfiguration(const QVariantMap configuration) const;
public slots: public slots:
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message, Q_INVOKABLE static void sendNotification(const QString eventId, const QString message,
const bool enablePopup = false); const bool enablePopup = false);
private slots: private slots:
void showUpdates(QString version); void showUpdates(QString version) const;
void versionReplyRecieved(QNetworkReply *reply); void versionReplyRecieved(QNetworkReply *reply) const;
private: private:
// variables // variables

View File

@ -139,7 +139,7 @@ void AWKeys::setWrapNewLines(const bool wrap)
} }
QString AWKeys::parsePattern() QString AWKeys::parsePattern() const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
if (keys.isEmpty()) return pattern; if (keys.isEmpty()) return pattern;
@ -158,7 +158,7 @@ QString AWKeys::parsePattern()
} }
QSize AWKeys::toolTipSize() QSize AWKeys::toolTipSize() const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
if (toolTip == nullptr) return QSize(); 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; 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; 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; 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;
if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key; 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;
if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key; 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; 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;
if (debug) qDebug() << PDEBUG << ":" << "Data" << data; 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;
if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key; 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; 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; 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(debug) qDebug() << PDEBUG;
if (toolTip == nullptr) return QString(""); if (toolTip == nullptr) return QString("");
@ -1459,7 +1459,7 @@ QString AWKeys::toolTipImage()
} }
QStringList AWKeys::findGraphicalItems() QStringList AWKeys::findGraphicalItems() const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
@ -1479,7 +1479,7 @@ QStringList AWKeys::findGraphicalItems()
} }
QStringList AWKeys::findKeys() QStringList AWKeys::findKeys() const
{ {
QStringList selectedKeys; QStringList selectedKeys;
for (int i=0; i<keys.count(); i++) { for (int i=0; i<keys.count(); i++) {
@ -1649,7 +1649,7 @@ QList<GraphicalItem *> AWKeys::getGraphicalItems()
} }
GraphicalItem *AWKeys::getItemByTag(const QString tag) GraphicalItem *AWKeys::getItemByTag(const QString tag) const
{ {
if (debug) qDebug() << PDEBUG; 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; if (debug) qDebug() << PDEBUG;

View File

@ -57,29 +57,29 @@ public:
Q_INVOKABLE void initTooltip(const QVariantMap tooltipParams); Q_INVOKABLE void initTooltip(const QVariantMap tooltipParams);
Q_INVOKABLE void setPopupEnabled(const bool popup = false); Q_INVOKABLE void setPopupEnabled(const bool popup = false);
Q_INVOKABLE void setWrapNewLines(const bool wrap = false); Q_INVOKABLE void setWrapNewLines(const bool wrap = false);
Q_INVOKABLE QString parsePattern(); Q_INVOKABLE QString parsePattern() const;
Q_INVOKABLE QSize toolTipSize(); Q_INVOKABLE QSize toolTipSize() const;
// keys // keys
Q_INVOKABLE void addDevice(const QString source); Q_INVOKABLE void addDevice(const QString source);
Q_INVOKABLE QStringList dictKeys(const bool sorted = false); Q_INVOKABLE QStringList dictKeys(const bool sorted = false) const;
Q_INVOKABLE QStringList getHddDevices(); Q_INVOKABLE QStringList getHddDevices() const;
Q_INVOKABLE void setDataBySource(const QString sourceName, const QVariantMap data, Q_INVOKABLE void setDataBySource(const QString sourceName, const QVariantMap data,
const QVariantMap params); const QVariantMap params);
// values // values
Q_INVOKABLE void graphicalValueByKey(); Q_INVOKABLE void graphicalValueByKey() const;
Q_INVOKABLE QString infoByKey(QString key); Q_INVOKABLE QString infoByKey(QString key) const;
Q_INVOKABLE QString valueByKey(QString key); Q_INVOKABLE QString valueByKey(QString key) const;
// configuration // configuration
Q_INVOKABLE void editItem(const QString type); Q_INVOKABLE void editItem(const QString type);
signals: signals:
void dropSourceFromDataengine(const QString source); void dropSourceFromDataengine(const QString source);
void needTextToBeUpdated(const QString newText); void needTextToBeUpdated(const QString newText) const;
void needToolTipToBeUpdated(const QString newText); void needToolTipToBeUpdated(const QString newText) const;
void needToBeUpdated(); void needToBeUpdated();
private slots: private slots:
void dataUpdate(); void dataUpdate() const;
void loadKeysFromCache(); void loadKeysFromCache();
void reinitKeys(); void reinitKeys();
// editor // editor
@ -93,22 +93,22 @@ private slots:
private: private:
// methods // methods
void addKeyToCache(const QString type, const QString key = QString("")); void addKeyToCache(const QString type, const QString key = QString(""));
bool checkKeys(const QVariantMap data); bool checkKeys(const QVariantMap data) const;
QString htmlValue(QString key); QString htmlValue(QString key) const;
int numberCpus(); int numberCpus() const;
float temperature(const float temp, const QString units); float temperature(const float temp, const QString units) const;
QString toolTipImage(); QString toolTipImage() const;
// find methods // find methods
QStringList findGraphicalItems(); QStringList findGraphicalItems() const;
QStringList findKeys(); QStringList findKeys() const;
// get methods // get methods
QList<ExtQuotes *> getExtQuotes(); QList<ExtQuotes *> getExtQuotes();
QList<ExtScript *> getExtScripts(); QList<ExtScript *> getExtScripts();
QList<ExtUpgrade *> getExtUpgrade(); QList<ExtUpgrade *> getExtUpgrade();
QList<ExtWeather *> getExtWeather(); QList<ExtWeather *> getExtWeather();
QList<GraphicalItem *> getGraphicalItems(); QList<GraphicalItem *> getGraphicalItems();
GraphicalItem *getItemByTag(const QString tag); GraphicalItem *getItemByTag(const QString tag) const;
QStringList getTimeKeys(); QStringList getTimeKeys() const;
AWToolTip *toolTip = nullptr; AWToolTip *toolTip = nullptr;
// graphical elements // graphical elements
QDialog *dialog = nullptr; QDialog *dialog = nullptr;

View File

@ -76,7 +76,7 @@ AWToolTip::~AWToolTip()
} }
QSize AWToolTip::getSize() QSize AWToolTip::getSize() const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;

View File

@ -35,7 +35,7 @@ public:
AWToolTip(QObject *parent = nullptr, QVariantMap settings = QVariantMap()); AWToolTip(QObject *parent = nullptr, QVariantMap settings = QVariantMap());
~AWToolTip(); ~AWToolTip();
QSize getSize(); QSize getSize() const;
QPixmap image(); QPixmap image();
void setData(const QString source, float value, void setData(const QString source, float value,
const bool ac = true); const bool ac = true);

View File

@ -59,7 +59,7 @@ DPAdds::~DPAdds()
} }
bool DPAdds::isDebugEnabled() bool DPAdds::isDebugEnabled() const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
@ -67,7 +67,7 @@ bool DPAdds::isDebugEnabled()
} }
int DPAdds::currentDesktop() int DPAdds::currentDesktop() const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
@ -75,7 +75,7 @@ int DPAdds::currentDesktop()
} }
QStringList DPAdds::dictKeys() QStringList DPAdds::dictKeys() const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
@ -89,7 +89,7 @@ QStringList DPAdds::dictKeys()
} }
int DPAdds::numberOfDesktops() int DPAdds::numberOfDesktops() const
{ {
if (debug) qDebug() << PDEBUG; 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;
if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop; 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; 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;
if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key; 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;
if (debug) qDebug() << PDEBUG << ":" << "Type" << type; 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; 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 (debug) qDebug() << PDEBUG;
if (panelsToControl.isEmpty()) return; 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;
if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop; 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;
if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop; 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;
if (debug) qDebug() << PDEBUG << ":" << "Window" << window; 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;
if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop; if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
@ -452,7 +452,7 @@ DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int desktop)
} }
QList<Plasma::Containment *> DPAdds::getPanels() QList<Plasma::Containment *> DPAdds::getPanels() const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
@ -467,7 +467,7 @@ QList<Plasma::Containment *> 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;
if (debug) qDebug() << PDEBUG << ":" << "Location" << location; if (debug) qDebug() << PDEBUG << ":" << "Location" << location;

View File

@ -46,39 +46,39 @@ public:
DPAdds(QObject *parent = nullptr); DPAdds(QObject *parent = nullptr);
~DPAdds(); ~DPAdds();
Q_INVOKABLE bool isDebugEnabled(); Q_INVOKABLE bool isDebugEnabled() const;
Q_INVOKABLE int currentDesktop(); Q_INVOKABLE int currentDesktop() const;
Q_INVOKABLE QStringList dictKeys(); Q_INVOKABLE QStringList dictKeys() const;
Q_INVOKABLE int numberOfDesktops(); Q_INVOKABLE int numberOfDesktops() const;
Q_INVOKABLE QString toolTipImage(const int desktop); Q_INVOKABLE QString toolTipImage(const int desktop) const;
Q_INVOKABLE QString parsePattern(const QString pattern, const int desktop); Q_INVOKABLE QString parsePattern(const QString pattern, const int desktop) const;
// values // values
Q_INVOKABLE void setMark(const QString newMark); Q_INVOKABLE void setMark(const QString newMark);
Q_INVOKABLE void setPanelsToControl(const QString newPanels); Q_INVOKABLE void setPanelsToControl(const QString newPanels);
Q_INVOKABLE void setToolTipData(const QVariantMap tooltipData); 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 // configuration slots
Q_INVOKABLE QString editPanelsToContol(const QString current); Q_INVOKABLE QString editPanelsToContol(const QString current);
Q_INVOKABLE QString getAboutText(const QString type = "header"); Q_INVOKABLE QString getAboutText(const QString type = "header") const;
Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont); Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont) const;
signals: signals:
void desktopChanged(); void desktopChanged() const;
void windowListChanged(); void windowListChanged() const;
public slots: public slots:
Q_INVOKABLE void changePanelsState(); Q_INVOKABLE void changePanelsState() const;
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message); 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: private slots:
void changeDesktop(const int desktop); void changeDesktop(const int desktop) const;
void changeWindowList(const WId window); void changeWindowList(const WId window) const;
private: private:
DesktopWindowsInfo getInfoByDesktop(const int desktop); DesktopWindowsInfo getInfoByDesktop(const int desktop) const;
QList<Plasma::Containment *> getPanels(); QList<Plasma::Containment *> getPanels() const;
QString panelLocationToStr(Plasma::Types::Location location); QString panelLocationToStr(Plasma::Types::Location location) const;
// variables // variables
bool debug = false; bool debug = false;
int oldState, tooltipWidth = 200; int oldState, tooltipWidth = 200;

View File

@ -2,6 +2,7 @@
set (SUBPROJECT plasma_dataengine_extsysmon) set (SUBPROJECT plasma_dataengine_extsysmon)
set (PLUGIN_NAME ${SUBPROJECT}) set (PLUGIN_NAME ${SUBPROJECT})
message (STATUS "Subproject ${SUBPROJECT}") message (STATUS "Subproject ${SUBPROJECT}")
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.awesomewidget\")
# find required libaries # find required libaries
find_package (Qt5 REQUIRED COMPONENTS DBus Network Widgets) find_package (Qt5 REQUIRED COMPONENTS DBus Network Widgets)

View File

@ -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) void AbstractExtItem::setInterval(const int _interval)
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;

View File

@ -19,6 +19,7 @@
#define ABSTRACTEXTITEM_H #define ABSTRACTEXTITEM_H
#include <QDialog> #include <QDialog>
#include <QInputDialog>
#include <QVariant> #include <QVariant>
@ -28,15 +29,14 @@ class AbstractExtItem : public QDialog
Q_PROPERTY(bool active READ isActive WRITE setActive) Q_PROPERTY(bool active READ isActive WRITE setActive)
Q_PROPERTY(int apiVersion READ apiVersion WRITE setApiVersion) Q_PROPERTY(int apiVersion READ apiVersion WRITE setApiVersion)
Q_PROPERTY(QString comment READ comment WRITE setComment) Q_PROPERTY(QString comment READ comment WRITE setComment)
Q_PROPERTY(QStringList directories READ directories WRITE setDirectories) Q_PROPERTY(QStringList directories READ directories)
Q_PROPERTY(QString fileName READ fileName WRITE setFileName) Q_PROPERTY(QString fileName READ fileName)
Q_PROPERTY(int interval READ interval WRITE setInterval) Q_PROPERTY(int interval READ interval WRITE setInterval)
Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(int number READ number WRITE setNumber) Q_PROPERTY(int number READ number WRITE setNumber)
public: public:
explicit AbstractExtItem(QWidget *parent = nullptr, explicit AbstractExtItem(QWidget *parent = nullptr, const QString desktopName = QString(),
const QString desktopName = QString(),
const QStringList directories = QStringList(), const QStringList directories = QStringList(),
const bool debugCmd = false); const bool debugCmd = false);
virtual ~AbstractExtItem(); virtual ~AbstractExtItem();
@ -54,8 +54,6 @@ public:
void setApiVersion(const int _apiVersion = 0); void setApiVersion(const int _apiVersion = 0);
void setActive(const bool _state = true); void setActive(const bool _state = true);
void setComment(const QString _comment = QString("empty")); void setComment(const QString _comment = QString("empty"));
void setDirectories(const QStringList _directories);
void setFileName(const QString _fileName);
void setInterval(const int _interval = 1); void setInterval(const int _interval = 1);
void setName(const QString _name = QString("none")); void setName(const QString _name = QString("none"));
void setNumber(int _number = -1); void setNumber(int _number = -1);

View File

@ -37,7 +37,8 @@ class ExtQuotes : public AbstractExtItem
public: public:
explicit ExtQuotes(QWidget *parent = nullptr, const QString quotesName = QString(), 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(); ~ExtQuotes();
// get methods // get methods
QString ticker() const; QString ticker() const;

View File

@ -45,7 +45,8 @@ public:
}; };
explicit ExtScript(QWidget *parent = nullptr, const QString scriptName = QString(), 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(); ~ExtScript();
// get methods // get methods
QString executable() const; QString executable() const;

View File

@ -75,7 +75,7 @@ ExtendedSysMon::~ExtendedSysMon()
} }
QString ExtendedSysMon::getAllHdd() QStringList ExtendedSysMon::getAllHdd() const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
@ -85,11 +85,11 @@ QString ExtendedSysMon::getAllHdd()
devices[i] = QString("/dev/%1").arg(devices[i]); devices[i] = QString("/dev/%1").arg(devices[i]);
if (debug) qDebug() << PDEBUG << ":" << "Device list" << devices; if (debug) qDebug() << PDEBUG << ":" << "Device list" << devices;
return devices.join(QChar(',')); return devices;
} }
QString ExtendedSysMon::getAutoGpu() QString ExtendedSysMon::getAutoGpu() const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
@ -108,7 +108,7 @@ QString ExtendedSysMon::getAutoGpu()
} }
QString ExtendedSysMon::getAutoMpris() QString ExtendedSysMon::getAutoMpris() const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
@ -293,7 +293,7 @@ void ExtendedSysMon::readConfiguration()
} }
QMap<QString, QString> ExtendedSysMon::updateConfiguration(QMap<QString, QString> rawConfig) QMap<QString, QString> ExtendedSysMon::updateConfiguration(QMap<QString, QString> rawConfig) const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
@ -306,7 +306,7 @@ QMap<QString, QString> ExtendedSysMon::updateConfiguration(QMap<QString, QString
(rawConfig[QString("GPUDEV")] != QString("nvidia"))) (rawConfig[QString("GPUDEV")] != QString("nvidia")))
rawConfig[QString("GPUDEV")] = getAutoGpu(); rawConfig[QString("GPUDEV")] = getAutoGpu();
// hdddev // hdddev
allHddDevices = getAllHdd().split(QChar(','), QString::SkipEmptyParts); QStringList allHddDevices = getAllHdd();
if (rawConfig[QString("HDDDEV")] == QString("all")) if (rawConfig[QString("HDDDEV")] == QString("all"))
rawConfig[QString("HDDDEV")] = allHddDevices.join(QChar(',')); rawConfig[QString("HDDDEV")] = allHddDevices.join(QChar(','));
else if (rawConfig[QString("HDDDEV")] == QString("disable")) else if (rawConfig[QString("HDDDEV")] == QString("disable"))
@ -336,7 +336,7 @@ QMap<QString, QString> ExtendedSysMon::updateConfiguration(QMap<QString, QString
} }
QVariantMap ExtendedSysMon::getBattery(const QString acpiPath) QVariantMap ExtendedSysMon::getBattery(const QString acpiPath) const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "ACPI path" << acpiPath; if (debug) qDebug() << PDEBUG << ":" << "ACPI path" << acpiPath;
@ -379,7 +379,7 @@ QVariantMap ExtendedSysMon::getBattery(const QString acpiPath)
} }
QVariantMap ExtendedSysMon::getCurrentDesktop() QVariantMap ExtendedSysMon::getCurrentDesktop() const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
@ -398,7 +398,7 @@ QVariantMap ExtendedSysMon::getCurrentDesktop()
} }
float ExtendedSysMon::getGpu(const QString device) float ExtendedSysMon::getGpu(const QString device) const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Device" << device; if (debug) qDebug() << PDEBUG << ":" << "Device" << device;
@ -441,7 +441,7 @@ float ExtendedSysMon::getGpu(const QString device)
} }
float ExtendedSysMon::getGpuTemp(const QString device) float ExtendedSysMon::getGpuTemp(const QString device) const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Device" << device; if (debug) qDebug() << PDEBUG << ":" << "Device" << device;
@ -482,7 +482,7 @@ float ExtendedSysMon::getGpuTemp(const QString device)
} }
float ExtendedSysMon::getHddTemp(const QString cmd, const QString device) float ExtendedSysMon::getHddTemp(const QString cmd, const QString device) const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd; if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
@ -516,7 +516,7 @@ float ExtendedSysMon::getHddTemp(const QString cmd, const QString device)
} }
QString ExtendedSysMon::getNetworkDevice() QString ExtendedSysMon::getNetworkDevice() const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
@ -535,7 +535,7 @@ QString ExtendedSysMon::getNetworkDevice()
QVariantMap ExtendedSysMon::getPlayerInfo(const QString playerName, const QString mpdAddress, QVariantMap ExtendedSysMon::getPlayerInfo(const QString playerName, const QString mpdAddress,
const QString mpdPort, QString mpris) const QString mpdPort, QString mpris) const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "player" << playerName; if (debug) qDebug() << PDEBUG << ":" << "player" << playerName;
@ -563,7 +563,7 @@ QVariantMap ExtendedSysMon::getPlayerInfo(const QString playerName, const QStrin
} }
QVariantMap ExtendedSysMon::getPlayerMpdInfo(const QString mpdAddress, const QString mpdPort) QVariantMap ExtendedSysMon::getPlayerMpdInfo(const QString mpdAddress, const QString mpdPort) const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "MPD" << QString("%1:%2").arg(mpdAddress).arg(mpdPort); if (debug) qDebug() << PDEBUG << ":" << "MPD" << QString("%1:%2").arg(mpdAddress).arg(mpdPort);
@ -604,7 +604,7 @@ QVariantMap ExtendedSysMon::getPlayerMpdInfo(const QString mpdAddress, const QSt
} }
QVariantMap ExtendedSysMon::getPlayerMprisInfo(const QString mpris) QVariantMap ExtendedSysMon::getPlayerMprisInfo(const QString mpris) const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << "MPRIS" << mpris; if (debug) qDebug() << PDEBUG << "MPRIS" << mpris;
@ -654,7 +654,7 @@ QVariantMap ExtendedSysMon::getPlayerMprisInfo(const QString mpris)
} }
QVariantMap ExtendedSysMon::getPsStats() QVariantMap ExtendedSysMon::getPsStats() const
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
@ -712,14 +712,12 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
} else if (source == QString("gputemp")) { } else if (source == QString("gputemp")) {
setData(source, QString("value"), getGpuTemp(configuration[QString("GPUDEV")])); setData(source, QString("value"), getGpuTemp(configuration[QString("GPUDEV")]));
} else if (source == QString("hddtemp")) { } else if (source == QString("hddtemp")) {
// fill empty list
for (int i=0; i<allHddDevices.count(); i++)
setData(source, allHddDevices[i], 0.0);
QStringList deviceList = configuration[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts); QStringList deviceList = configuration[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts);
for (int i=0; i<deviceList.count(); i++) { QStringList allHddDevices = getAllHdd();
setData(source, deviceList[i], for (int i=0; i<allHddDevices.count(); i++)
getHddTemp(configuration[QString("HDDTEMPCMD")], deviceList[i])); setData(source, allHddDevices[i], deviceList.contains(allHddDevices[i]) ?
} getHddTemp(configuration[QString("HDDTEMPCMD")], allHddDevices[i]) :
0.0);
} else if (source == QString("netdev")) { } else if (source == QString("netdev")) {
setData(source, QString("value"), getNetworkDevice()); setData(source, QString("value"), getNetworkDevice());
} else if (source == QString("pkg")) { } else if (source == QString("pkg")) {

View File

@ -34,20 +34,20 @@ public:
explicit ExtendedSysMon(QObject *parent, const QVariantList &args); explicit ExtendedSysMon(QObject *parent, const QVariantList &args);
~ExtendedSysMon(); ~ExtendedSysMon();
// update functions // update functions
QVariantMap getBattery(const QString acpiPath); QVariantMap getBattery(const QString acpiPath) const;
QVariantMap getCurrentDesktop(); QVariantMap getCurrentDesktop() const;
float getGpu(const QString device); float getGpu(const QString device) const;
float getGpuTemp(const QString device); float getGpuTemp(const QString device) const;
float getHddTemp(const QString cmd, const QString device); float getHddTemp(const QString cmd, const QString device) const;
QString getNetworkDevice(); QString getNetworkDevice() const;
QVariantMap getPlayerInfo(const QString playerName, QVariantMap getPlayerInfo(const QString playerName,
const QString mpdAddress = QString(), const QString mpdAddress = QString(),
const QString mpdPort = QString(), const QString mpdPort = QString(),
const QString mpris = QString()); const QString mpris = QString()) const;
QVariantMap getPlayerMpdInfo(const QString mpdAddress = QString(), QVariantMap getPlayerMpdInfo(const QString mpdAddress = QString(),
const QString mpdPort = QString()); const QString mpdPort = QString()) const;
QVariantMap getPlayerMprisInfo(const QString mpris = QString()); QVariantMap getPlayerMprisInfo(const QString mpris = QString()) const;
QVariantMap getPsStats(); QVariantMap getPsStats() const;
protected: protected:
bool sourceRequestEvent(const QString &source); bool sourceRequestEvent(const QString &source);
@ -63,16 +63,15 @@ private:
QList<ExtWeather *> externalWeather; QList<ExtWeather *> externalWeather;
bool debug; bool debug;
// reread configuration // reread configuration
QStringList allHddDevices; QStringList getAllHdd() const;
QString getAllHdd(); QString getAutoGpu() const;
QString getAutoGpu(); QString getAutoMpris() const;
QString getAutoMpris();
void initQuotes(); void initQuotes();
void initScripts(); void initScripts();
void initUpgrade(); void initUpgrade();
void initWeather(); void initWeather();
void readConfiguration(); void readConfiguration();
QMap<QString, QString> updateConfiguration(QMap<QString, QString> rawConfig); QMap<QString, QString> updateConfiguration(QMap<QString, QString> rawConfig) const;
}; };

View File

@ -35,7 +35,8 @@ class ExtUpgrade : public AbstractExtItem
public: public:
explicit ExtUpgrade(QWidget *parent = nullptr, const QString upgradeName = QString(), 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(); ~ExtUpgrade();
// get methods // get methods
QString executable() const; QString executable() const;

View File

@ -40,7 +40,8 @@ class ExtWeather : public AbstractExtItem
public: public:
explicit ExtWeather(QWidget *parent = nullptr, const QString weatherName = QString(), 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(); ~ExtWeather();
QString weatherFromInt(const int _id) const; QString weatherFromInt(const int _id) const;
// get methods // get methods