Compare commits

..

5 Commits

117 changed files with 309 additions and 669 deletions

View File

@ -58,7 +58,7 @@ CFontDialog::CFontDialog(QWidget *parent, bool needWeight, bool needItalic)
setLayout(mainGrid); setLayout(mainGrid);
colorBox = new QComboBox(this); colorBox = new QComboBox(this);
connect(colorBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateColor(QString))); connect(colorBox, &QComboBox::currentTextChanged, this, &CFontDialog::updateColor);
QStringList colorNames = QColor::colorNames(); QStringList colorNames = QColor::colorNames();
int index = 0; int index = 0;
for (int i=0; i<colorNames.count(); i++) { for (int i=0; i<colorNames.count(); i++) {
@ -81,8 +81,8 @@ CFontDialog::CFontDialog(QWidget *parent, bool needWeight, bool needItalic)
buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
Qt::Horizontal, this); Qt::Horizontal, this);
QObject::connect(buttons, SIGNAL(accepted()), this, SLOT(accept())); QObject::connect(buttons, &QDialogButtonBox::accepted, this, &CFontDialog::accept);
QObject::connect(buttons, SIGNAL(rejected()), this, SLOT(reject())); QObject::connect(buttons, &QDialogButtonBox::rejected, this, &CFontDialog::reject);
mainGrid->addWidget(buttons, 1, 0, 1, 5); mainGrid->addWidget(buttons, 1, 0, 1, 5);
italicBox->setHidden(!needItalic); italicBox->setHidden(!needItalic);

View File

@ -15,8 +15,7 @@
* License along with this library. * * License along with this library. *
***************************************************************************/ ***************************************************************************/
#ifndef FONTDIALOG_H #pragma once
#define FONTDIALOG_H
#include <QComboBox> #include <QComboBox>
#include <QDialog> #include <QDialog>
@ -72,6 +71,3 @@ private:
QSpinBox *sizeBox; QSpinBox *sizeBox;
QSpinBox *weightBox; QSpinBox *weightBox;
}; };
#endif /* FONTDIALOG_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWDEBUG_H
#define AWDEBUG_H
#include <QLoggingCategory> #include <QLoggingCategory>
@ -42,6 +40,3 @@ Q_DECLARE_LOGGING_CATEGORY(LOG_DP)
Q_DECLARE_LOGGING_CATEGORY(LOG_ESM) Q_DECLARE_LOGGING_CATEGORY(LOG_ESM)
Q_DECLARE_LOGGING_CATEGORY(LOG_ESS) Q_DECLARE_LOGGING_CATEGORY(LOG_ESS)
Q_DECLARE_LOGGING_CATEGORY(LOG_LIB) Q_DECLARE_LOGGING_CATEGORY(LOG_LIB)
#endif /* AWDEBUG_H */

View File

@ -37,13 +37,13 @@ AWAbstractPairConfig::AWAbstractPairConfig(QWidget *_parent, const bool _hasEdit
ui->setupUi(this); ui->setupUi(this);
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &AWAbstractPairConfig::accept);
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &AWAbstractPairConfig::reject);
// edit feature // edit feature
if (m_hasEdit) { if (m_hasEdit) {
m_editButton = ui->buttonBox->addButton(i18n("Edit"), QDialogButtonBox::ActionRole); m_editButton = ui->buttonBox->addButton(i18n("Edit"), QDialogButtonBox::ActionRole);
connect(m_editButton, SIGNAL(clicked(bool)), this, SLOT(edit())); connect(m_editButton, &QPushButton::clicked, [this]() { return edit(); });
} }
} }
@ -84,14 +84,14 @@ void AWAbstractPairConfig::edit()
void AWAbstractPairConfig::updateUi() void AWAbstractPairConfig::updateUi()
{ {
QPair<QString, QString> current = dynamic_cast<AWAbstractSelector *>(sender())->current(); auto current = dynamic_cast<AWAbstractSelector *>(sender())->current();
int index = m_selectors.indexOf(dynamic_cast<AWAbstractSelector *>(sender())); auto index = m_selectors.indexOf(dynamic_cast<AWAbstractSelector *>(sender()));
if ((current.first.isEmpty()) && (current.second.isEmpty())) { if ((current.first.isEmpty()) && (current.second.isEmpty())) {
// remove current selector if it is empty and does not last // remove current selector if it is empty and does not last
if (sender() == m_selectors.last()) if (sender() == m_selectors.last())
return; return;
AWAbstractSelector *selector = m_selectors.takeAt(index); auto *selector = m_selectors.takeAt(index);
ui->verticalLayout->removeWidget(selector); ui->verticalLayout->removeWidget(selector);
selector->deleteLater(); selector->deleteLater();
} else { } else {
@ -112,7 +112,7 @@ void AWAbstractPairConfig::addSelector(const QStringList &_keys, const QStringLi
auto *selector = new AWAbstractSelector(ui->scrollAreaWidgetContents, m_editable); auto *selector = new AWAbstractSelector(ui->scrollAreaWidgetContents, m_editable);
selector->init(_keys, _values, _current); selector->init(_keys, _values, _current);
ui->verticalLayout->insertWidget(ui->verticalLayout->count() - 1, selector); ui->verticalLayout->insertWidget(ui->verticalLayout->count() - 1, selector);
connect(selector, SIGNAL(selectionChanged()), this, SLOT(updateUi())); connect(selector, &AWAbstractSelector::selectionChanged, this, &AWAbstractPairConfig::updateUi);
m_selectors.append(selector); m_selectors.append(selector);
} }
@ -120,7 +120,7 @@ void AWAbstractPairConfig::addSelector(const QStringList &_keys, const QStringLi
void AWAbstractPairConfig::clearSelectors() void AWAbstractPairConfig::clearSelectors()
{ {
for (auto &selector : m_selectors) { for (auto &selector : m_selectors) {
disconnect(selector, SIGNAL(selectionChanged()), this, SLOT(updateUi())); disconnect(selector, &AWAbstractSelector::selectionChanged, this, &AWAbstractPairConfig::updateUi);
ui->verticalLayout->removeWidget(selector); ui->verticalLayout->removeWidget(selector);
selector->deleteLater(); selector->deleteLater();
} }
@ -164,7 +164,7 @@ QPair<QStringList, QStringList> AWAbstractPairConfig::initKeys() const
right.append(m_helper->rightKeys().isEmpty() ? m_keys : m_helper->rightKeys()); right.append(m_helper->rightKeys().isEmpty() ? m_keys : m_helper->rightKeys());
right.sort(); right.sort();
return QPair<QStringList, QStringList>(left, right); return {left, right};
} }
@ -175,7 +175,7 @@ void AWAbstractPairConfig::updateDialog()
auto keys = initKeys(); auto keys = initKeys();
for (auto &key : m_helper->keys()) for (auto &key : m_helper->keys())
addSelector(keys.first, keys.second, QPair<QString, QString>(key, m_helper->pairs()[key])); addSelector(keys.first, keys.second, QPair<QString, QString>(key, pairs[key]));
// empty one // empty one
addSelector(keys.first, keys.second, QPair<QString, QString>()); addSelector(keys.first, keys.second, QPair<QString, QString>());
} }

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWABSTRACTPAIRCONFIG_H
#define AWABSTRACTPAIRCONFIG_H
#include <QDialog> #include <QDialog>
@ -67,6 +65,3 @@ private:
[[nodiscard]] QPair<QStringList, QStringList> initKeys() const; [[nodiscard]] QPair<QStringList, QStringList> initKeys() const;
void updateDialog(); void updateDialog();
}; };
#endif /* AWABSTRACTPAIRCONFIG_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWABSTRACTPAIRHELPER_H
#define AWABSTRACTPAIRHELPER_H
#include <QHash> #include <QHash>
@ -46,6 +44,3 @@ private:
QString m_filePath; QString m_filePath;
QString m_section; QString m_section;
}; };
#endif /* AWABSTRACTPAIRHELPER_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWABSTRACTSELECTOR_H
#define AWABSTRACTSELECTOR_H
#include <QWidget> #include <QWidget>
@ -43,6 +41,3 @@ signals:
private: private:
Ui::AWAbstractSelector *ui = nullptr; Ui::AWAbstractSelector *ui = nullptr;
}; };
#endif /* AWABSTRACTSELECTOR_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWACTIONS_H
#define AWACTIONS_H
#include <QMap> #include <QMap>
#include <QObject> #include <QObject>
@ -47,6 +45,3 @@ public slots:
private: private:
AWUpdateHelper *m_updateHelper = nullptr; AWUpdateHelper *m_updateHelper = nullptr;
}; };
#endif /* AWACTIONS_H */

View File

@ -44,7 +44,7 @@ AWBugReporter::~AWBugReporter()
void AWBugReporter::doConnect() void AWBugReporter::doConnect()
{ {
// additional method for testing needs // additional method for testing needs
connect(this, SIGNAL(replyReceived(const int, const QString &)), this, SLOT(showInformation(int, const QString &))); connect(this, &AWBugReporter::replyReceived, this, &AWBugReporter::showInformation);
} }
@ -72,25 +72,25 @@ void AWBugReporter::sendBugReport(const QString &_title, const QString &_body)
qCDebug(LOG_AW) << "Send bug report with title" << _title << "and body" << _body; qCDebug(LOG_AW) << "Send bug report with title" << _title << "and body" << _body;
auto *manager = new QNetworkAccessManager(nullptr); auto *manager = new QNetworkAccessManager(nullptr);
connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(issueReplyRecieved(QNetworkReply *))); connect(manager, &QNetworkAccessManager::finished, this, &AWBugReporter::issueReplyReceived);
QNetworkRequest request = QNetworkRequest(QUrl(BUGTRACKER_API)); auto request = QNetworkRequest(QUrl(BUGTRACKER_API));
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
// generate payload // generate payload
QVariantMap payload; QVariantMap payload;
payload["title"] = _title; payload["title"] = _title;
payload["body"] = _body; payload["body"] = _body;
payload["labels"] = QStringList() << "from application"; payload["labels"] = QStringList({"from application"});
// convert to QByteArray to send request // convert to QByteArray to send request
QByteArray data = QJsonDocument::fromVariant(payload).toJson(QJsonDocument::Compact); auto data = QJsonDocument::fromVariant(payload).toJson(QJsonDocument::Compact);
qCInfo(LOG_AW) << "Send request with _body" << data.data() << "and size" << data.size(); qCInfo(LOG_AW) << "Send request with _body" << data.data() << "and size" << data.size();
manager->post(request, data); manager->post(request, data);
} }
void AWBugReporter::issueReplyRecieved(QNetworkReply *_reply) void AWBugReporter::issueReplyReceived(QNetworkReply *_reply)
{ {
if (_reply->error() != QNetworkReply::NoError) { if (_reply->error() != QNetworkReply::NoError) {
qCWarning(LOG_AW) << "An error occurs" << _reply->error() << "with message" << _reply->errorString(); qCWarning(LOG_AW) << "An error occurs" << _reply->error() << "with message" << _reply->errorString();
@ -98,7 +98,7 @@ void AWBugReporter::issueReplyRecieved(QNetworkReply *_reply)
} }
QJsonParseError error{}; QJsonParseError error{};
QJsonDocument jsonDoc = QJsonDocument::fromJson(_reply->readAll(), &error); auto jsonDoc = QJsonDocument::fromJson(_reply->readAll(), &error);
if (error.error != QJsonParseError::NoError) { if (error.error != QJsonParseError::NoError) {
qCWarning(LOG_AW) << "Parse error" << error.errorString(); qCWarning(LOG_AW) << "Parse error" << error.errorString();
return emit(replyReceived(0, "")); return emit(replyReceived(0, ""));
@ -106,9 +106,9 @@ void AWBugReporter::issueReplyRecieved(QNetworkReply *_reply)
_reply->deleteLater(); _reply->deleteLater();
// convert to map // convert to map
QVariantMap response = jsonDoc.toVariant().toMap(); auto response = jsonDoc.toVariant().toMap();
QString url = response["html_url"].toString(); auto url = response["html_url"].toString();
int number = response["number"].toInt(); auto number = response["number"].toInt();
return emit(replyReceived(number, url)); return emit(replyReceived(number, url));
} }
@ -135,7 +135,7 @@ void AWBugReporter::showInformation(const int _number, const QString &_url)
void AWBugReporter::userReplyOnBugReport(QAbstractButton *_button) void AWBugReporter::userReplyOnBugReport(QAbstractButton *_button)
{ {
QMessageBox::ButtonRole ret = dynamic_cast<QMessageBox *>(sender())->buttonRole(_button); auto ret = dynamic_cast<QMessageBox *>(sender())->buttonRole(_button);
qCInfo(LOG_AW) << "User select" << ret; qCInfo(LOG_AW) << "User select" << ret;
switch (ret) { switch (ret) {

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWBUGREPORTER_H
#define AWBUGREPORTER_H
#include <QObject> #include <QObject>
@ -41,13 +39,10 @@ signals:
void replyReceived(int _number, const QString &_url); void replyReceived(int _number, const QString &_url);
private slots: private slots:
void issueReplyRecieved(QNetworkReply *_reply); void issueReplyReceived(QNetworkReply *_reply);
void showInformation(int _number, const QString &_url); void showInformation(int _number, const QString &_url);
void userReplyOnBugReport(QAbstractButton *_button); void userReplyOnBugReport(QAbstractButton *_button);
private: private:
QString m_lastBugUrl; QString m_lastBugUrl;
}; };
#endif /* AWBUGREPORTER_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWCONFIGHELPER_H
#define AWCONFIGHELPER_H
#include <QObject> #include <QObject>
#include <QVariant> #include <QVariant>
@ -52,6 +50,3 @@ private:
QString m_baseDir; QString m_baseDir;
QStringList m_dirs = {"desktops", "quotes", "scripts", "upgrade", "weather", "formatters"}; QStringList m_dirs = {"desktops", "quotes", "scripts", "upgrade", "weather", "formatters"};
}; };
#endif /* AWCONFIGHELPER_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWCUSTOMKEYSCONFIG_H
#define AWCUSTOMKEYSCONFIG_H
#include "awabstractpairconfig.h" #include "awabstractpairconfig.h"
@ -30,6 +28,3 @@ public:
explicit AWCustomKeysConfig(QWidget *_parent = nullptr, const QStringList &_keys = QStringList()); explicit AWCustomKeysConfig(QWidget *_parent = nullptr, const QStringList &_keys = QStringList());
~AWCustomKeysConfig() override; ~AWCustomKeysConfig() override;
}; };
#endif /* AWCUSTOMKEYSCONFIG_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWCUSTOMKEYSHELPER_H
#define AWCUSTOMKEYSHELPER_H
#include <QObject> #include <QObject>
@ -42,6 +40,3 @@ public:
private: private:
}; };
#endif /* AWCUSTOMKEYSHELPER_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWTOOLTIP_H
#define AWTOOLTIP_H
#include <QObject> #include <QObject>
#include <QVariant> #include <QVariant>
@ -68,6 +66,3 @@ private:
bool m_enablePopup = false; bool m_enablePopup = false;
QStringList requiredKeys; QStringList requiredKeys;
}; };
#endif /* AWTOOLTIP_H */

View File

@ -153,7 +153,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const KSy
if (index > -1) { if (index > -1) {
QString key = QString("hddr%1").arg(index); QString key = QString("hddr%1").arg(index);
m_map.insert(_source, key); m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Integer; m_formatter[key] = AWKeysAggregator::FormatterType::MemKBFormat;
} }
} else if (_source.contains(hddwRegExp)) { } else if (_source.contains(hddwRegExp)) {
// write speed // write speed
@ -163,7 +163,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const KSy
if (index > -1) { if (index > -1) {
QString key = QString("hddw%1").arg(index); QString key = QString("hddw%1").arg(index);
m_map.insert(_source, key); m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Integer; m_formatter[key] = AWKeysAggregator::FormatterType::MemKBFormat;
} }
} else if (_source == "gpu/all/usage") { } else if (_source == "gpu/all/usage") {
// gpu load // gpu load
@ -285,7 +285,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const KSy
// kb // kb
auto key = QString("%1kb%2").arg(type).arg(index); auto key = QString("%1kb%2").arg(type).arg(index);
m_map.insert(_source, key); m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Integer; m_formatter[key] = AWKeysAggregator::FormatterType::MemKBFormat;
// smart // smart
key = QString("%1%2").arg(type).arg(index); key = QString("%1%2").arg(type).arg(index);
m_map.insert(_source, key); m_map.insert(_source, key);
@ -303,7 +303,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const KSy
// kb // kb
auto key = QString("%1totkb%2").arg(type).arg(index); auto key = QString("%1totkb%2").arg(type).arg(index);
m_map.insert(_source, key); m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Integer; m_formatter[key] = AWKeysAggregator::FormatterType::MemKBFormat;
// mb // mb
key = QString("%1tot%2").arg(type).arg(index); key = QString("%1tot%2").arg(type).arg(index);
m_map.insert(_source, key); m_map.insert(_source, key);

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWDATAENGINEMAPPER_H
#define AWDATAENGINEMAPPER_H
#include <ksysguard/formatter/Unit.h> #include <ksysguard/formatter/Unit.h>
@ -50,6 +48,3 @@ private:
QHash<QString, AWKeysAggregator::FormatterType> m_formatter; QHash<QString, AWKeysAggregator::FormatterType> m_formatter;
QMultiHash<QString, QString> m_map; QMultiHash<QString, QString> m_map;
}; };
#endif /* AWDATAENGINEMAPPER_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWDBUSADAPTOR_H
#define AWDBUSADAPTOR_H
#include <QDBusAbstractAdaptor> #include <QDBusAbstractAdaptor>
@ -50,6 +48,3 @@ private:
AWKeys *m_plugin = nullptr; AWKeys *m_plugin = nullptr;
QStringList m_logLevels = {"debug", "info", "warning", "critical"}; QStringList m_logLevels = {"debug", "info", "warning", "critical"};
}; };
#endif /* AWDBUSADAPTOR_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWPLUGIN_H
#define AWPLUGIN_H
#include <QQmlExtensionPlugin> #include <QQmlExtensionPlugin>
@ -30,6 +28,3 @@ class AWPlugin : public QQmlExtensionPlugin
public: public:
void registerTypes(const char *uri) override; void registerTypes(const char *uri) override;
}; };
#endif /* AWPLUGIN_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWFORMATTERCONFIG_H
#define AWFORMATTERCONFIG_H
#include "awabstractpairconfig.h" #include "awabstractpairconfig.h"
@ -30,6 +28,3 @@ public:
explicit AWFormatterConfig(QWidget *_parent = nullptr, const QStringList &_keys = QStringList()); explicit AWFormatterConfig(QWidget *_parent = nullptr, const QStringList &_keys = QStringList());
~AWFormatterConfig() override; ~AWFormatterConfig() override;
}; };
#endif /* AWFORMATTERCONFIG_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWFORMATTERHELPER_H
#define AWFORMATTERHELPER_H
#include "abstractextitemaggregator.h" #include "abstractextitemaggregator.h"
#include "awabstractformatter.h" #include "awabstractformatter.h"
@ -56,6 +54,3 @@ private:
QHash<QString, AWAbstractFormatter *> m_formatters; QHash<QString, AWAbstractFormatter *> m_formatters;
QHash<QString, AWAbstractFormatter *> m_formattersClasses; QHash<QString, AWAbstractFormatter *> m_formattersClasses;
}; };
#endif /* AWFORMATTERHELPER_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWKEYCACHE_H
#define AWKEYCACHE_H
#include <QHash> #include <QHash>
#include <QString> #include <QString>
@ -31,6 +29,3 @@ QStringList getRequiredKeys(const QStringList &_keys, const QStringList &_bars,
const QStringList &_userKeys, const QStringList &_allKeys); const QStringList &_userKeys, const QStringList &_allKeys);
QHash<QString, QStringList> loadKeysFromCache(); QHash<QString, QStringList> loadKeysFromCache();
} // namespace AWKeyCache } // namespace AWKeyCache
#endif /* AWKEYCACHE_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWKEYOPERATIONS_H
#define AWKEYOPERATIONS_H
#include <QObject> #include <QObject>
@ -78,6 +76,3 @@ private:
QHash<QString, QStringList> m_devices; QHash<QString, QStringList> m_devices;
QString m_pattern; QString m_pattern;
}; };
#endif /* AWKEYOPERATIONS_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWKEYS_H
#define AWKEYS_H
#include <QMutex> #include <QMutex>
#include <QObject> #include <QObject>
@ -90,6 +88,3 @@ private:
QThreadPool *m_threadPool = nullptr; QThreadPool *m_threadPool = nullptr;
QMutex m_mutex; QMutex m_mutex;
}; };
#endif /* AWKEYS_H */

View File

@ -85,21 +85,24 @@ QString AWKeysAggregator::formatter(const QVariant &_data, const QString &_key,
output = _data.toBool() ? m_acOnline : m_acOffline; output = _data.toBool() ? m_acOnline : m_acOffline;
break; break;
case FormatterType::MemGBFormat: case FormatterType::MemGBFormat:
output = QString("%1").arg(_data.toDouble() / (1024.0 * 1024.0), 5, 'f', 1); output = QString("%1").arg(_data.toDouble() / GBinBytes, 5, 'f', 1);
break; break;
case FormatterType::MemMBFormat: case FormatterType::MemMBFormat:
output = QString("%1").arg(_data.toDouble() / 1024.0, 5, 'f', 0); output = QString("%1").arg(_data.toDouble() / MBinBytes, 5, 'f', 0);
break;
case FormatterType::MemKBFormat:
output = QString("%1").arg(_data.toDouble() / KBinBytes, 5, 'f', 0);
break; break;
case FormatterType::NetSmartFormat: case FormatterType::NetSmartFormat:
output = [](const float value) { output = [](const double value) {
if (value > 1024.0) if (value > MBinBytes)
return QString("%1").arg(value / 1024.0, 4, 'f', 1); return QString("%1").arg(value / MBinBytes, 4, 'f', 1);
else else
return QString("%1").arg(value, 4, 'f', 0); return QString("%1").arg(value / KBinBytes, 4, 'f', 0);
}(_data.toDouble()); }(_data.toDouble());
break; break;
case FormatterType::NetSmartUnits: case FormatterType::NetSmartUnits:
if (_data.toDouble() > 1024.0) if (_data.toDouble() > MBinBytes)
output = m_translate ? i18n("MB/s") : "MB/s"; output = m_translate ? i18n("MB/s") : "MB/s";
else else
output = m_translate ? i18n("KB/s") : "KB/s"; output = m_translate ? i18n("KB/s") : "KB/s";
@ -234,7 +237,7 @@ void AWKeysAggregator::setTranslate(const bool _translate)
} }
QStringList AWKeysAggregator::registerSource(const QString &_source, const KSysGuard::Unit &_units, QStringList AWKeysAggregator::registerSource(const QString &_source, const KSysGuard::Unit _units,
const QStringList &_keys) const QStringList &_keys)
{ {
qCDebug(LOG_AW) << "Source" << _source << "with units" << _units; qCDebug(LOG_AW) << "Source" << _source << "with units" << _units;
@ -243,24 +246,24 @@ QStringList AWKeysAggregator::registerSource(const QString &_source, const KSysG
} }
float AWKeysAggregator::temperature(const float temp) const double AWKeysAggregator::temperature(const double temp) const
{ {
qCDebug(LOG_AW) << "Temperature value" << temp; qCDebug(LOG_AW) << "Temperature value" << temp;
float converted = temp; auto converted = temp;
if (m_tempUnits == "Celsius") { if (m_tempUnits == "Celsius") {
} else if (m_tempUnits == "Fahrenheit") { } else if (m_tempUnits == "Fahrenheit") {
converted = temp * 9.0f / 5.0f + 32.0f; converted = temp * 9.0f / 5.0 + 32.0;
} else if (m_tempUnits == "Kelvin") { } else if (m_tempUnits == "Kelvin") {
converted = temp + 273.15f; converted = temp + 273.15;
} else if (m_tempUnits == "Reaumur") { } else if (m_tempUnits == "Reaumur") {
converted = temp * 0.8f; converted = temp * 0.8;
} else if (m_tempUnits == "cm^-1") { } else if (m_tempUnits == "cm^-1") {
converted = (temp + 273.15f) * 0.695f; converted = (temp + 273.15) * 0.695;
} else if (m_tempUnits == "kJ/mol") { } else if (m_tempUnits == "kJ/mol") {
converted = (temp + 273.15f) * 8.31f; converted = (temp + 273.15) * 8.31;
} else if (m_tempUnits == "kcal/mol") { } else if (m_tempUnits == "kcal/mol") {
converted = (temp + 273.15f) * 1.98f; converted = (temp + 273.15) * 1.98;
} else { } else {
qCWarning(LOG_AW) << "Invalid units" << m_tempUnits; qCWarning(LOG_AW) << "Invalid units" << m_tempUnits;
} }

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWKEYSAGGREGATOR_H
#define AWKEYSAGGREGATOR_H
#include <ksysguard/formatter/Unit.h> #include <ksysguard/formatter/Unit.h>
@ -53,6 +51,7 @@ public:
ACFormat, ACFormat,
MemGBFormat, MemGBFormat,
MemMBFormat, MemMBFormat,
MemKBFormat,
NetSmartFormat, NetSmartFormat,
NetSmartUnits, NetSmartUnits,
Quotes, Quotes,
@ -67,6 +66,10 @@ public:
UptimeCustom UptimeCustom
}; };
static constexpr double KBinBytes = 1024.0;
static constexpr double MBinBytes = 1024.0 * KBinBytes;
static constexpr double GBinBytes = 1024.0 * MBinBytes;
explicit AWKeysAggregator(QObject *_parent = nullptr); explicit AWKeysAggregator(QObject *_parent = nullptr);
~AWKeysAggregator() override; ~AWKeysAggregator() override;
void initFormatters(); void initFormatters();
@ -83,10 +86,10 @@ public:
void setTranslate(bool _translate); void setTranslate(bool _translate);
public slots: public slots:
QStringList registerSource(const QString &_source, const KSysGuard::Unit &_units, const QStringList &_keys); QStringList registerSource(const QString &_source, const KSysGuard::Unit _units, const QStringList &_keys);
private: private:
[[nodiscard]] float temperature(float temp) const; [[nodiscard]] double temperature(double temp) const;
AWFormatterHelper *m_customFormatters = nullptr; AWFormatterHelper *m_customFormatters = nullptr;
AWDataEngineMapper *m_mapper = nullptr; AWDataEngineMapper *m_mapper = nullptr;
QStringList m_timeKeys; QStringList m_timeKeys;
@ -98,6 +101,3 @@ private:
QString m_tempUnits; QString m_tempUnits;
bool m_translate = false; bool m_translate = false;
}; };
#endif /* AWKEYSAGGREGATOR_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWPAIRCONFIGFACTORY_H
#define AWPAIRCONFIGFACTORY_H
#include <QObject> #include <QObject>
@ -34,6 +32,3 @@ public:
private: private:
}; };
#endif /* AWPAIRCONFIGFACTORY_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWPATTERNFUNCTIONS_H
#define AWPATTERNFUNCTIONS_H
#include <QString> #include <QString>
#include <QVariant> #include <QVariant>
@ -47,6 +45,3 @@ QString insertMacros(QString _code);
QStringList findKeys(const QString &_code, const QStringList &_keys, bool _isBars); QStringList findKeys(const QString &_code, const QStringList &_keys, bool _isBars);
QStringList findLambdas(const QString &_code); QStringList findLambdas(const QString &_code);
} // namespace AWPatternFunctions } // namespace AWPatternFunctions
#endif /* AWPATTERNFUNCTIONS_H */

View File

@ -127,7 +127,7 @@ void AWTelemetryHandler::uploadTelemetry(const QString &_group, const QString &_
} }
auto *manager = new QNetworkAccessManager(nullptr); auto *manager = new QNetworkAccessManager(nullptr);
connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(telemetryReplyRecieved(QNetworkReply *))); connect(manager, &QNetworkAccessManager::finished, this, &AWTelemetryHandler::telemetryReplyReceived);
QUrl url(REMOTE_TELEMETRY_URL); QUrl url(REMOTE_TELEMETRY_URL);
QNetworkRequest request(url); QNetworkRequest request(url);
@ -140,14 +140,14 @@ void AWTelemetryHandler::uploadTelemetry(const QString &_group, const QString &_
payload["metadata"] = _value; payload["metadata"] = _value;
payload["type"] = _group; payload["type"] = _group;
// convert to QByteArray to send request // convert to QByteArray to send request
QByteArray data = QJsonDocument::fromVariant(payload).toJson(QJsonDocument::Compact); auto data = QJsonDocument::fromVariant(payload).toJson(QJsonDocument::Compact);
qCInfo(LOG_AW) << "Send request with body" << data.data() << "and size" << data.size(); qCInfo(LOG_AW) << "Send request with body" << data.data() << "and size" << data.size();
manager->post(request, data); manager->post(request, data);
} }
void AWTelemetryHandler::telemetryReplyRecieved(QNetworkReply *_reply) void AWTelemetryHandler::telemetryReplyReceived(QNetworkReply *_reply)
{ {
if (_reply->error() != QNetworkReply::NoError) { if (_reply->error() != QNetworkReply::NoError) {
qCWarning(LOG_AW) << "An error occurs" << _reply->error() << "with message" << _reply->errorString(); qCWarning(LOG_AW) << "An error occurs" << _reply->error() << "with message" << _reply->errorString();
@ -155,7 +155,7 @@ void AWTelemetryHandler::telemetryReplyRecieved(QNetworkReply *_reply)
} }
QJsonParseError error{}; QJsonParseError error{};
QJsonDocument jsonDoc = QJsonDocument::fromJson(_reply->readAll(), &error); auto jsonDoc = QJsonDocument::fromJson(_reply->readAll(), &error);
if (error.error != QJsonParseError::NoError) { if (error.error != QJsonParseError::NoError) {
qCWarning(LOG_AW) << "Parse error" << error.errorString(); qCWarning(LOG_AW) << "Parse error" << error.errorString();
return; return;
@ -163,8 +163,8 @@ void AWTelemetryHandler::telemetryReplyRecieved(QNetworkReply *_reply)
_reply->deleteLater(); _reply->deleteLater();
// convert to map // convert to map
QVariantMap response = jsonDoc.toVariant().toMap(); auto response = jsonDoc.toVariant().toMap();
QString message = response["message"].toString(); auto message = response["message"].toString();
qCInfo(LOG_AW) << "Server reply on telemetry" << message; qCInfo(LOG_AW) << "Server reply on telemetry" << message;
return emit(replyReceived(message)); return emit(replyReceived(message));

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWTELEMETRYHANDLER_H
#define AWTELEMETRYHANDLER_H
#include <QObject> #include <QObject>
@ -43,7 +41,7 @@ signals:
void replyReceived(const QString &_message); void replyReceived(const QString &_message);
private slots: private slots:
void telemetryReplyRecieved(QNetworkReply *_reply); void telemetryReplyReceived(QNetworkReply *_reply);
private: private:
static QString getKey(int _count); static QString getKey(int _count);
@ -52,6 +50,3 @@ private:
int m_storeCount = 0; int m_storeCount = 0;
bool m_uploadEnabled = false; bool m_uploadEnabled = false;
}; };
#endif /* AWTELEMETRYHANDLER_H */

View File

@ -54,7 +54,7 @@ void AWUpdateHelper::checkUpdates(const bool _showAnyway)
// request. In case of automatic check no message will be shown // request. In case of automatic check no message will be shown
auto *manager = new QNetworkAccessManager(nullptr); auto *manager = new QNetworkAccessManager(nullptr);
connect(manager, &QNetworkAccessManager::finished, connect(manager, &QNetworkAccessManager::finished,
[_showAnyway, this](QNetworkReply *reply) { return versionReplyRecieved(reply, _showAnyway); }); [_showAnyway, this](QNetworkReply *reply) { return versionReplyReceived(reply, _showAnyway); });
manager->get(QNetworkRequest(QUrl(VERSION_API))); manager->get(QNetworkRequest(QUrl(VERSION_API)));
} }
@ -63,7 +63,7 @@ void AWUpdateHelper::checkUpdates(const bool _showAnyway)
bool AWUpdateHelper::checkVersion() bool AWUpdateHelper::checkVersion()
{ {
QSettings settings(m_genericConfig, QSettings::IniFormat); QSettings settings(m_genericConfig, QSettings::IniFormat);
QVersionNumber version = QVersionNumber::fromString(settings.value("Version", QString(VERSION)).toString()); auto version = QVersionNumber::fromString(settings.value("Version", QString(VERSION)).toString());
// update version // update version
settings.setValue("Version", QString(VERSION)); settings.setValue("Version", QString(VERSION));
settings.sync(); settings.sync();
@ -88,7 +88,7 @@ void AWUpdateHelper::showInfo(const QVersionNumber &_version)
{ {
qCDebug(LOG_AW) << "Version" << _version; qCDebug(LOG_AW) << "Version" << _version;
QString text = i18n("You are using the actual version %1", _version.toString()); auto text = i18n("You are using the actual version %1", _version.toString());
if (!QString(COMMIT_SHA).isEmpty()) if (!QString(COMMIT_SHA).isEmpty())
text += QString(" (%1)").arg(QString(COMMIT_SHA)); text += QString(" (%1)").arg(QString(COMMIT_SHA));
return genMessageBox(i18n("No new version found"), text, QMessageBox::Ok)->open(); return genMessageBox(i18n("No new version found"), text, QMessageBox::Ok)->open();
@ -112,7 +112,7 @@ void AWUpdateHelper::showUpdates(const QVersionNumber &_version)
void AWUpdateHelper::userReplyOnUpdates(QAbstractButton *_button) void AWUpdateHelper::userReplyOnUpdates(QAbstractButton *_button)
{ {
QMessageBox::ButtonRole ret = dynamic_cast<QMessageBox *>(sender())->buttonRole(_button); auto ret = dynamic_cast<QMessageBox *>(sender())->buttonRole(_button);
qCInfo(LOG_AW) << "User select" << ret; qCInfo(LOG_AW) << "User select" << ret;
switch (ret) { switch (ret) {
@ -126,7 +126,7 @@ void AWUpdateHelper::userReplyOnUpdates(QAbstractButton *_button)
} }
void AWUpdateHelper::versionReplyRecieved(QNetworkReply *_reply, const bool _showAnyway) void AWUpdateHelper::versionReplyReceived(QNetworkReply *_reply, const bool _showAnyway)
{ {
qCDebug(LOG_AW) << "Show message anyway" << _showAnyway; qCDebug(LOG_AW) << "Show message anyway" << _showAnyway;
if (_reply->error() != QNetworkReply::NoError) { if (_reply->error() != QNetworkReply::NoError) {
@ -134,8 +134,8 @@ void AWUpdateHelper::versionReplyRecieved(QNetworkReply *_reply, const bool _sho
return; return;
} }
QJsonParseError error = QJsonParseError(); auto error = QJsonParseError();
QJsonDocument jsonDoc = QJsonDocument::fromJson(_reply->readAll(), &error); auto jsonDoc = QJsonDocument::fromJson(_reply->readAll(), &error);
if (error.error != QJsonParseError::NoError) { if (error.error != QJsonParseError::NoError) {
qCWarning(LOG_AW) << "Parse error" << error.errorString(); qCWarning(LOG_AW) << "Parse error" << error.errorString();
return; return;
@ -143,13 +143,13 @@ void AWUpdateHelper::versionReplyRecieved(QNetworkReply *_reply, const bool _sho
_reply->deleteLater(); _reply->deleteLater();
// convert to map // convert to map
QVariantMap firstRelease = jsonDoc.toVariant().toList().first().toMap(); auto firstRelease = jsonDoc.toVariant().toList().first().toMap();
QString version = firstRelease["tag_name"].toString(); auto version = firstRelease["tag_name"].toString();
version.remove("V."); version.remove("V.");
m_foundVersion = QVersionNumber::fromString(version); m_foundVersion = QVersionNumber::fromString(version);
qCInfo(LOG_AW) << "Update found version to" << m_foundVersion; qCInfo(LOG_AW) << "Update found version to" << m_foundVersion;
QVersionNumber oldVersion = QVersionNumber::fromString(VERSION); auto oldVersion = QVersionNumber::fromString(VERSION);
if (oldVersion < m_foundVersion) if (oldVersion < m_foundVersion)
return showUpdates(m_foundVersion); return showUpdates(m_foundVersion);
else if (_showAnyway) else if (_showAnyway)

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWUPDATEHELPER_H
#define AWUPDATEHELPER_H
#include <QMessageBox> #include <QMessageBox>
#include <QObject> #include <QObject>
@ -40,7 +38,7 @@ private slots:
static void showInfo(const QVersionNumber &_version); static void showInfo(const QVersionNumber &_version);
void showUpdates(const QVersionNumber &_version); void showUpdates(const QVersionNumber &_version);
void userReplyOnUpdates(QAbstractButton *_button); void userReplyOnUpdates(QAbstractButton *_button);
void versionReplyRecieved(QNetworkReply *_reply, bool _showAnyway); void versionReplyReceived(QNetworkReply *_reply, bool _showAnyway);
private: private:
static QMessageBox *genMessageBox(const QString &_title, const QString &_body, static QMessageBox *genMessageBox(const QString &_title, const QString &_body,
@ -48,6 +46,3 @@ private:
QVersionNumber m_foundVersion; QVersionNumber m_foundVersion;
QString m_genericConfig; QString m_genericConfig;
}; };
#endif /* AWUPDATEHELPER_H */

View File

@ -198,7 +198,7 @@ void AbstractExtItem::setCron(const QString &_cron)
qCDebug(LOG_LIB) << "Cron string" << _cron; qCDebug(LOG_LIB) << "Cron string" << _cron;
// deinit module first // deinit module first
if (m_scheduler) { if (m_scheduler) {
disconnect(m_scheduler, SIGNAL(activated()), this, SIGNAL(requestDataUpdate())); disconnect(m_scheduler, &QCronScheduler::activated, this, &AbstractExtItem::requestDataUpdate);
delete m_scheduler; delete m_scheduler;
} }
@ -209,7 +209,7 @@ void AbstractExtItem::setCron(const QString &_cron)
// init scheduler // init scheduler
m_scheduler = new QCronScheduler(this); m_scheduler = new QCronScheduler(this);
m_scheduler->parse(cron()); m_scheduler->parse(cron());
connect(m_scheduler, SIGNAL(activated()), this, SIGNAL(requestDataUpdate())); connect(m_scheduler, &QCronScheduler::activated, this, &AbstractExtItem::requestDataUpdate);
} }
@ -234,7 +234,7 @@ void AbstractExtItem::setName(const QString &_name)
void AbstractExtItem::setNumber(int _number) void AbstractExtItem::setNumber(int _number)
{ {
qCDebug(LOG_LIB) << "Number" << _number; qCDebug(LOG_LIB) << "Number" << _number;
bool generateNumber = (_number == -1); auto generateNumber = (_number == -1);
if (generateNumber) { if (generateNumber) {
_number = []() { _number = []() {
qCWarning(LOG_LIB) << "Number is empty, generate new one"; qCWarning(LOG_LIB) << "Number is empty, generate new one";
@ -267,7 +267,7 @@ void AbstractExtItem::deinitSocket()
m_socket->close(); m_socket->close();
QLocalServer::removeServer(socket()); QLocalServer::removeServer(socket());
disconnect(m_socket, SIGNAL(newConnection()), this, SLOT(newConnectionReceived())); disconnect(m_socket, &QLocalServer::newConnection, this, &AbstractExtItem::newConnectionReceived);
delete m_socket; delete m_socket;
} }
@ -278,9 +278,9 @@ void AbstractExtItem::initSocket()
deinitSocket(); deinitSocket();
m_socket = new QLocalServer(this); m_socket = new QLocalServer(this);
bool listening = m_socket->listen(socket()); auto listening = m_socket->listen(socket());
qCInfo(LOG_LIB) << "Server listening on" << socket() << listening; qCInfo(LOG_LIB) << "Server listening on" << socket() << listening;
connect(m_socket, SIGNAL(newConnection()), this, SLOT(newConnectionReceived())); connect(m_socket, &QLocalServer::newConnection, this, &AbstractExtItem::newConnectionReceived);
} }
@ -303,7 +303,7 @@ void AbstractExtItem::readConfiguration()
bool AbstractExtItem::tryDelete() const bool AbstractExtItem::tryDelete() const
{ {
bool status = QFile::remove(m_fileName); auto status = QFile::remove(m_fileName);
qCInfo(LOG_LIB) << "Remove file" << m_fileName << status; qCInfo(LOG_LIB) << "Remove file" << m_fileName << status;
return status; return status;

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef ABSTRACTEXTITEM_H #pragma once
#define ABSTRACTEXTITEM_H
#include <QVariant> #include <QVariant>
@ -102,6 +101,3 @@ private:
QLocalServer *m_socket = nullptr; QLocalServer *m_socket = nullptr;
QString m_socketFile = ""; QString m_socketFile = "";
}; };
#endif /* ABSTRACTEXTITEM_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef ABSTRACTEXTITEMAGGREGATOR_H #pragma once
#define ABSTRACTEXTITEMAGGREGATOR_H
#include <QStandardPaths> #include <QStandardPaths>
@ -80,6 +79,3 @@ private:
// ui methods // ui methods
virtual void doCreateItem(QListWidget *_widget) = 0; virtual void doCreateItem(QListWidget *_widget) = 0;
}; };
#endif /* ABSTRACTEXTITEMAGGREGATOR_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef ABSTRACTQUOTESPROVIDER_H #pragma once
#define ABSTRACTQUOTESPROVIDER_H
#include <QObject> #include <QObject>
#include <QUrl> #include <QUrl>
@ -40,6 +39,3 @@ public:
}; };
[[nodiscard]] virtual QUrl url() const = 0; [[nodiscard]] virtual QUrl url() const = 0;
}; };
#endif /* ABSTRACTQUOTESPROVIDER_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef ABSTRACTWEATHERPROVIDER_H #pragma once
#define ABSTRACTWEATHERPROVIDER_H
#include <QObject> #include <QObject>
#include <QUrl> #include <QUrl>
@ -40,6 +39,3 @@ public:
}; };
[[nodiscard]] virtual QUrl url() const = 0; [[nodiscard]] virtual QUrl url() const = 0;
}; };
#endif /* ABSTRACTWEATHERPROVIDER_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef AWABSTRACTFORMATTER_H #pragma once
#define AWABSTRACTFORMATTER_H
#include <QRegularExpression> #include <QRegularExpression>
@ -52,6 +51,3 @@ private:
// properties // properties
FormatterClass m_type = FormatterClass::NoFormat; FormatterClass m_type = FormatterClass::NoFormat;
}; };
#endif /* AWABSTRACTFORMATTER_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef AWDATETIMEFORMATTER_H #pragma once
#define AWDATETIMEFORMATTER_H
#include <QLocale> #include <QLocale>
@ -52,6 +51,3 @@ private:
QString m_format = ""; QString m_format = "";
bool m_translate = true; bool m_translate = true;
}; };
#endif /* AWDATETIMEFORMATTER_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef AWFLOATFORMATTER_H #pragma once
#define AWFLOATFORMATTER_H
#include "awabstractformatter.h" #include "awabstractformatter.h"
@ -68,6 +67,3 @@ private:
int m_precision = -1; int m_precision = -1;
double m_summand = 0.0; double m_summand = 0.0;
}; };
#endif /* AWFLOATFORMATTER_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef AWJSONFORMATTER_H #pragma once
#define AWJSONFORMATTER_H
#include "awabstractformatter.h" #include "awabstractformatter.h"
@ -49,6 +48,3 @@ private:
QString m_path; QString m_path;
QVariantList m_splittedPath; QVariantList m_splittedPath;
}; };
#endif /* AWJSONFORMATTER_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef AWLISTFORMATTER_H #pragma once
#define AWLISTFORMATTER_H
#include "awabstractformatter.h" #include "awabstractformatter.h"
@ -53,6 +52,3 @@ private:
bool m_sorted = false; bool m_sorted = false;
QRegularExpression m_regex; QRegularExpression m_regex;
}; };
#endif /* AWLISTFORMATTER_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef AWNOFORMATTER_H #pragma once
#define AWNOFORMATTER_H
#include "awabstractformatter.h" #include "awabstractformatter.h"
@ -37,6 +36,3 @@ private:
void translate(void *_ui) override; void translate(void *_ui) override;
// properties // properties
}; };
#endif /* AWNOFORMATTER_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef AWSCRIPTFORMATTER_H #pragma once
#define AWSCRIPTFORMATTER_H
#include "awabstractformatter.h" #include "awabstractformatter.h"
@ -56,6 +55,3 @@ private:
bool m_hasReturn = false; bool m_hasReturn = false;
QString m_program; QString m_program;
}; };
#endif /* AWSCRIPTFORMATTER_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef AWSTRINGFORMATTER_H #pragma once
#define AWSTRINGFORMATTER_H
#include "awabstractformatter.h" #include "awabstractformatter.h"
@ -52,6 +51,3 @@ private:
QChar m_fillChar = QChar(); QChar m_fillChar = QChar();
bool m_forceWidth = false; bool m_forceWidth = false;
}; };
#endif /* AWSTRINGFORMATTER_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef EXTITEMAGGREGATOR_H #pragma once
#define EXTITEMAGGREGATOR_H
#include <KI18n/KLocalizedString> #include <KI18n/KLocalizedString>
@ -150,6 +149,3 @@ private:
return items; return items;
}; };
}; };
#endif /* EXTITEMAGGREGATOR_H */

View File

@ -40,9 +40,8 @@ ExtNetworkRequest::ExtNetworkRequest(QObject *_parent, const QString &_filePath)
// HACK declare as child of nullptr to avoid crash with plasmawindowed // HACK declare as child of nullptr to avoid crash with plasmawindowed
// in the destructor // in the destructor
m_manager = new QNetworkAccessManager(nullptr); m_manager = new QNetworkAccessManager(nullptr);
connect(m_manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(networkReplyReceived(QNetworkReply *))); connect(m_manager, &QNetworkAccessManager::finished, this, &ExtNetworkRequest::networkReplyReceived);
connect(this, &ExtNetworkRequest::requestDataUpdate, this, &ExtNetworkRequest::sendRequest);
connect(this, SIGNAL(requestDataUpdate()), this, SLOT(sendRequest()));
} }
@ -50,8 +49,8 @@ ExtNetworkRequest::~ExtNetworkRequest()
{ {
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
disconnect(m_manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(networkReplyReceived(QNetworkReply *))); disconnect(m_manager, &QNetworkAccessManager::finished, this, &ExtNetworkRequest::networkReplyReceived);
disconnect(this, SIGNAL(requestDataUpdate()), this, SLOT(sendRequest())); disconnect(this, &ExtNetworkRequest::requestDataUpdate, this, &ExtNetworkRequest::sendRequest);
m_manager->deleteLater(); m_manager->deleteLater();
} }

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef EXTNETWORKREQUEST_H #pragma once
#define EXTNETWORKREQUEST_H
#include <QNetworkReply> #include <QNetworkReply>
@ -59,6 +58,3 @@ private:
// values // values
QVariantHash m_values; QVariantHash m_values;
}; };
#endif /* EXTNETWORKREQUEST_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef EXTQUOTES_H #pragma once
#define EXTQUOTES_H
#include <QNetworkReply> #include <QNetworkReply>
@ -61,6 +60,3 @@ private:
// values // values
QVariantHash m_values; QVariantHash m_values;
}; };
#endif /* EXTQUOTES_H */

View File

@ -40,10 +40,10 @@ ExtScript::ExtScript(QObject *_parent, const QString &_filePath)
m_values[tag("custom")] = ""; m_values[tag("custom")] = "";
m_process = new QProcess(nullptr); m_process = new QProcess(nullptr);
connect(m_process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(updateValue())); connect(m_process, &QProcess::finished, [this]() { return updateValue(); });
m_process->waitForFinished(0); m_process->waitForFinished(0);
connect(this, SIGNAL(requestDataUpdate()), this, SLOT(startProcess())); connect(this, &ExtScript::requestDataUpdate, this, &ExtScript::startProcess);
} }
@ -51,10 +51,9 @@ ExtScript::~ExtScript()
{ {
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
disconnect(m_process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(updateValue()));
m_process->kill(); m_process->kill();
m_process->deleteLater(); m_process->deleteLater();
disconnect(this, SIGNAL(requestDataUpdate()), this, SLOT(startProcess())); disconnect(this, &ExtScript::requestDataUpdate, this, &ExtScript::startProcess);
} }
@ -227,11 +226,11 @@ void ExtScript::readJsonFilters()
qCWarning(LOG_LIB) << "Could not open" << fileName; qCWarning(LOG_LIB) << "Could not open" << fileName;
return; return;
} }
QString jsonText = jsonFile.readAll(); auto jsonText = jsonFile.readAll();
jsonFile.close(); jsonFile.close();
QJsonParseError error{}; QJsonParseError error{};
auto jsonDoc = QJsonDocument::fromJson(jsonText.toUtf8(), &error); auto jsonDoc = QJsonDocument::fromJson(jsonText, &error);
if (error.error != QJsonParseError::NoError) { if (error.error != QJsonParseError::NoError) {
qCWarning(LOG_LIB) << "Parse error" << error.errorString(); qCWarning(LOG_LIB) << "Parse error" << error.errorString();
return; return;

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef EXTSCRIPT_H #pragma once
#define EXTSCRIPT_H
#include <QProcess> #include <QProcess>
@ -76,6 +75,3 @@ private:
QVariantMap m_jsonFilters; QVariantMap m_jsonFilters;
QVariantHash m_values; QVariantHash m_values;
}; };
#endif /* EXTSCRIPT_H */

View File

@ -36,10 +36,10 @@ ExtUpgrade::ExtUpgrade(QObject *_parent, const QString &_filePath)
m_values[tag("pkgcount")] = 0; m_values[tag("pkgcount")] = 0;
m_process = new QProcess(nullptr); m_process = new QProcess(nullptr);
connect(m_process, SIGNAL(finished(int)), this, SLOT(updateValue())); connect(m_process, &QProcess::finished, [this]() { return updateValue(); });
m_process->waitForFinished(0); m_process->waitForFinished(0);
connect(this, SIGNAL(requestDataUpdate()), this, SLOT(startProcess())); connect(this, &ExtUpgrade::requestDataUpdate, this, &ExtUpgrade::startProcess);
} }
@ -49,7 +49,7 @@ ExtUpgrade::~ExtUpgrade()
m_process->kill(); m_process->kill();
m_process->deleteLater(); m_process->deleteLater();
disconnect(this, SIGNAL(requestDataUpdate()), this, SLOT(startProcess())); disconnect(this, &ExtUpgrade::requestDataUpdate, this, &ExtUpgrade::startProcess);
} }

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef EXTUPGRADE_H #pragma once
#define EXTUPGRADE_H
#include <QProcess> #include <QProcess>
@ -64,6 +63,3 @@ private:
// internal properties // internal properties
QVariantHash m_values; QVariantHash m_values;
}; };
#endif /* EXTUPGRADE_H */

View File

@ -49,9 +49,8 @@ ExtWeather::ExtWeather(QObject *_parent, const QString &_filePath)
// HACK declare as child of nullptr to avoid crash with plasmawindowed // HACK declare as child of nullptr to avoid crash with plasmawindowed
// in the destructor // in the destructor
m_manager = new QNetworkAccessManager(nullptr); m_manager = new QNetworkAccessManager(nullptr);
connect(m_manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(weatherReplyReceived(QNetworkReply *))); connect(m_manager, &QNetworkAccessManager::finished, this, &ExtWeather::weatherReplyReceived);
connect(this, &ExtWeather::requestDataUpdate, this, &ExtWeather::sendRequest);
connect(this, SIGNAL(requestDataUpdate()), this, SLOT(sendRequest()));
} }
@ -59,8 +58,8 @@ ExtWeather::~ExtWeather()
{ {
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
disconnect(m_manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(weatherReplyReceived(QNetworkReply *))); disconnect(m_manager, &QNetworkAccessManager::finished, this, &ExtWeather::weatherReplyReceived);
disconnect(this, SIGNAL(requestDataUpdate()), this, SLOT(sendRequest())); disconnect(this, &ExtWeather::requestDataUpdate, this, &ExtWeather::sendRequest);
m_manager->deleteLater(); m_manager->deleteLater();
} }
@ -150,7 +149,7 @@ int ExtWeather::ts() const
QString ExtWeather::uniq() const QString ExtWeather::uniq() const
{ {
return QString("%1 (%2) at %3").arg(city()).arg(country()).arg(ts()); return QString("%1 (%2) at %3").arg(city(), country()).arg(ts());
} }
@ -237,11 +236,11 @@ void ExtWeather::readJsonMap()
qCWarning(LOG_LIB) << "Could not open" << fileName; qCWarning(LOG_LIB) << "Could not open" << fileName;
return; return;
} }
QString jsonText = jsonFile.readAll(); auto jsonText = jsonFile.readAll();
jsonFile.close(); jsonFile.close();
QJsonParseError error{}; QJsonParseError error{};
auto jsonDoc = QJsonDocument::fromJson(jsonText.toUtf8(), &error); auto jsonDoc = QJsonDocument::fromJson(jsonText, &error);
if (error.error != QJsonParseError::NoError) { if (error.error != QJsonParseError::NoError) {
qCWarning(LOG_LIB) << "Parse error" << error.errorString(); qCWarning(LOG_LIB) << "Parse error" << error.errorString();
return; return;

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef EXTWEATHER_H #pragma once
#define EXTWEATHER_H
#include <QNetworkReply> #include <QNetworkReply>
@ -90,6 +89,3 @@ private:
// values // values
QVariantHash m_values; QVariantHash m_values;
}; };
#endif /* EXTWEATHER_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef GRAPHICALITEM_H #pragma once
#define GRAPHICALITEM_H
#include <QColor> #include <QColor>
@ -118,6 +117,3 @@ private:
QStringList m_usedKeys; QStringList m_usedKeys;
int m_width = 100; int m_width = 100;
}; };
#endif /* GRAPHICALITEM_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef GRAPHICALITEMHELPER_H #pragma once
#define GRAPHICALITEMHELPER_H
#include <QColor> #include <QColor>
#include <QObject> #include <QObject>
@ -56,6 +55,3 @@ private:
// list of values which will be used to store data for graph type only // list of values which will be used to store data for graph type only
QList<float> m_values; QList<float> m_values;
}; };
#endif /* GRAPHICALITEMHELPER_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef OWMWEATHERPROVIDER_H #pragma once
#define OWMWEATHERPROVIDER_H
#include "abstractweatherprovider.h" #include "abstractweatherprovider.h"
@ -42,6 +41,3 @@ private:
int m_ts = 0; int m_ts = 0;
QUrl m_url; QUrl m_url;
}; };
#endif /* OWMWEATHERPROVIDER_H */

View File

@ -33,7 +33,7 @@ QCronScheduler::QCronScheduler(QObject *_parent)
m_timer->setSingleShot(false); m_timer->setSingleShot(false);
m_timer->setInterval(60 * 1000); m_timer->setInterval(60 * 1000);
connect(m_timer, SIGNAL(timeout()), this, SLOT(expired())); connect(m_timer, &QTimer::timeout, this, &QCronScheduler::expired);
m_timer->start(); m_timer->start();
} }

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef QCRONSCHEDULER_H #pragma once
#define QCRONSCHEDULER_H
#include "QObject" #include "QObject"
@ -58,6 +57,3 @@ private:
QTimer *m_timer = nullptr; QTimer *m_timer = nullptr;
static QList<int> parseField(const QString &_value, int _min, int _max); static QList<int> parseField(const QString &_value, int _min, int _max);
}; };
#endif /* QCRONSCHEDULER_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef STOOQQUOTESPROVIDER_H #pragma once
#define STOOQQUOTESPROVIDER_H
#include "abstractquotesprovider.h" #include "abstractquotesprovider.h"
@ -37,6 +36,3 @@ public:
private: private:
QUrl m_url; QUrl m_url;
}; };
#endif /* STOOQQUOTESPROVIDER_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef YAHOOQUOTESPROVIDER_H #pragma once
#define YAHOOQUOTESPROVIDER_H
#include "abstractquotesprovider.h" #include "abstractquotesprovider.h"
@ -38,6 +37,3 @@ public:
private: private:
QUrl m_url; QUrl m_url;
}; };
#endif /* YAHOOQUOTESPROVIDER_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef YAHOOWEATHERPROVIDER_H #pragma once
#define YAHOOWEATHERPROVIDER_H
#include "abstractweatherprovider.h" #include "abstractweatherprovider.h"
@ -43,6 +42,3 @@ private:
int m_ts = 0; int m_ts = 0;
QUrl m_url; QUrl m_url;
}; };
#endif /* YAHOOWEATHERPROVIDER_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef DPPLUGIN_H
#define DPPLUGIN_H
#include <QQmlExtensionPlugin> #include <QQmlExtensionPlugin>
@ -30,6 +28,3 @@ class DPPlugin : public QQmlExtensionPlugin
public: public:
void registerTypes(const char *uri) override; void registerTypes(const char *uri) override;
}; };
#endif /* DPPLUGIN_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef DPADDS_H
#define DPADDS_H
// ui library required by WId definition // ui library required by WId definition
#include <QGuiApplication> #include <QGuiApplication>
@ -78,6 +76,3 @@ private:
QString m_tooltipColor = "#000000"; QString m_tooltipColor = "#000000";
QString m_tooltipType = "none"; QString m_tooltipType = "none";
}; };
#endif /* DPADDS_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef EXTSYSMON_H #pragma once
#define EXTSYSMON_H
#include <ksysguard/systemstats/SensorPlugin.h> #include <ksysguard/systemstats/SensorPlugin.h>
@ -36,6 +35,3 @@ private:
void readConfiguration(); void readConfiguration();
[[nodiscard]] static QHash<QString, QString> updateConfiguration(QHash<QString, QString> _rawConfig); [[nodiscard]] static QHash<QString, QString> updateConfiguration(QHash<QString, QString> _rawConfig);
}; };
#endif /* EXTSYSMON_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef ABSTRACTEXTSYSMONSOURCE_H #pragma once
#define ABSTRACTEXTSYSMONSOURCE_H
#include <QObject> #include <QObject>
#include <QRegularExpression> #include <QRegularExpression>
@ -50,6 +49,3 @@ public:
signals: signals:
void dataReceived(const QVariantHash &); void dataReceived(const QVariantHash &);
}; };
#endif /* ABSTRACTEXTSYSMONSOURCE_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef BATTERYSOURCE_H #pragma once
#define BATTERYSOURCE_H
#include <QDateTime> #include <QDateTime>
#include <QObject> #include <QObject>
@ -50,6 +49,3 @@ private:
QHash<int, QList<int>> m_trend; QHash<int, QList<int>> m_trend;
QVariantHash m_values; QVariantHash m_values;
}; };
#endif /* BATTERYSOURCE_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef CUSTOMSOURCE_H #pragma once
#define CUSTOMSOURCE_H
#include <QObject> #include <QObject>
@ -44,6 +43,3 @@ private:
ExtItemAggregator<ExtScript> *m_extScripts = nullptr; ExtItemAggregator<ExtScript> *m_extScripts = nullptr;
QStringList m_sources; QStringList m_sources;
}; };
#endif /* CUSTOMSOURCE_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef DESKTOPSOURCE_H #pragma once
#define DESKTOPSOURCE_H
#include <QObject> #include <QObject>
@ -42,6 +41,3 @@ public:
private: private:
TaskManager::VirtualDesktopInfo *m_vdi = nullptr; TaskManager::VirtualDesktopInfo *m_vdi = nullptr;
}; };
#endif /* DESKTOPSOURCE_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef EXTSYSMONSENSOR_H #pragma once
#define EXTSYSMONSENSOR_H
#include <ksysguard/systemstats/SensorObject.h> #include <ksysguard/systemstats/SensorObject.h>
@ -40,6 +39,3 @@ private:
AbstractExtSysMonSource *m_source = nullptr; AbstractExtSysMonSource *m_source = nullptr;
QTimer *m_timer = nullptr; QTimer *m_timer = nullptr;
}; };
#endif /* EXTSYSMONSENSOR_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef LOADSOURCE_H #pragma once
#define LOADSOURCE_H
#include <QObject> #include <QObject>
@ -35,6 +34,3 @@ public:
void run() override{}; void run() override{};
[[nodiscard]] QStringList sources() const override; [[nodiscard]] QStringList sources() const override;
}; };
#endif /* LOADSOURCE_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef NETWORKSOURCE_H #pragma once
#define NETWORKSOURCE_H
#include <QObject> #include <QObject>
@ -45,6 +44,3 @@ private:
QProcess *m_process = nullptr; QProcess *m_process = nullptr;
static QString getCurrentDevice(); static QString getCurrentDevice();
}; };
#endif /* NETWORKSOURCE_H */

View File

@ -42,9 +42,9 @@ PlayerSource::PlayerSource(QObject *_parent, const QStringList &_args)
m_mpris = _args.at(3); m_mpris = _args.at(3);
m_symbols = _args.at(4).toInt(); m_symbols = _args.at(4).toInt();
connect(&m_mpdSocket, SIGNAL(connected()), this, SLOT(mpdSocketConnected())); connect(&m_mpdSocket, &QTcpSocket::connected, this, &PlayerSource::mpdSocketConnected);
connect(&m_mpdSocket, SIGNAL(readyRead()), this, SLOT(mpdSocketReadyRead())); connect(&m_mpdSocket, &QTcpSocket::readyRead, this, &PlayerSource::mpdSocketReadyRead);
connect(&m_mpdSocket, SIGNAL(bytesWritten(qint64)), this, SLOT(mpdSocketWritten(const qint64))); connect(&m_mpdSocket, &QTcpSocket::bytesWritten, this, &PlayerSource::mpdSocketWritten);
m_mpdCached = defaultInfo(); m_mpdCached = defaultInfo();
} }

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef PLAYERSOURCE_H #pragma once
#define PLAYERSOURCE_H
#include <QMutex> #include <QMutex>
#include <QObject> #include <QObject>
@ -68,6 +67,3 @@ private:
QStringList m_metadata = QStringList({"album", "artist", "title"}); QStringList m_metadata = QStringList({"album", "artist", "title"});
QVariantHash m_values; QVariantHash m_values;
}; };
#endif /* PLAYERSOURCE_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef PROCESSESSOURCE_H #pragma once
#define PROCESSESSOURCE_H
#include <QObject> #include <QObject>
@ -39,6 +38,3 @@ private:
// configuration and values // configuration and values
QVariantHash m_values; QVariantHash m_values;
}; };
#endif /* PROCESSESSOURCE_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef QUOTESSOURCE_H #pragma once
#define QUOTESSOURCE_H
#include <QObject> #include <QObject>
@ -45,6 +44,3 @@ private:
QStringList m_sources; QStringList m_sources;
QVariantHash m_values; QVariantHash m_values;
}; };
#endif /* QUOTESSOURCE_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef REQUESTSOURCE_H #pragma once
#define REQUESTSOURCE_H
#include <QObject> #include <QObject>
@ -45,6 +44,3 @@ private:
QStringList m_sources; QStringList m_sources;
QVariantHash m_values; QVariantHash m_values;
}; };
#endif /* REQUESTSOURCE_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef SYSTEMINFOSOURCE_H #pragma once
#define SYSTEMINFOSOURCE_H
#include <QObject> #include <QObject>
@ -44,6 +43,3 @@ private:
static QVariant sendDBusRequest(const QString &destination, const QString &path, const QString &interface, static QVariant sendDBusRequest(const QString &destination, const QString &path, const QString &interface,
const QString &method, const QVariantList &args = QVariantList()); const QString &method, const QVariantList &args = QVariantList());
}; };
#endif /* SYSTEMINFOSOURCE_H */

View File

@ -20,7 +20,6 @@
#include <QObject> #include <QObject>
#include "abstractextsysmonsource.h" #include "abstractextsysmonsource.h"
#include "extitemaggregator.h"
class TimeSource : public AbstractExtSysMonSource class TimeSource : public AbstractExtSysMonSource

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef UPGRADESOURCE_H #pragma once
#define UPGRADESOURCE_H
#include <QObject> #include <QObject>
@ -44,6 +43,3 @@ private:
ExtItemAggregator<ExtUpgrade> *m_extUpgrade = nullptr; ExtItemAggregator<ExtUpgrade> *m_extUpgrade = nullptr;
QStringList m_sources; QStringList m_sources;
}; };
#endif /* UPGRADESOURCE_H */

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#ifndef WEATHERSOURCE_H #pragma once
#define WEATHERSOURCE_H
#include <QObject> #include <QObject>
@ -45,6 +44,3 @@ private:
QStringList m_sources; QStringList m_sources;
QVariantHash m_values; QVariantHash m_values;
}; };
#endif /* WEATHERSOURCE_H */

View File

@ -35,7 +35,7 @@ bool AWTestLibrary::isKWinActive()
KWindowSystem::setShowingDesktop(true); KWindowSystem::setShowingDesktop(true);
spy.wait(5000); spy.wait(5000);
bool state = KWindowSystem::showingDesktop(); auto state = KWindowSystem::showingDesktop();
KWindowSystem::setShowingDesktop(false); KWindowSystem::setShowingDesktop(false);
return state; return state;
@ -50,11 +50,11 @@ char AWTestLibrary::randomChar()
QPair<QString, QString> AWTestLibrary::randomFilenames() QPair<QString, QString> AWTestLibrary::randomFilenames()
{ {
QString fileName = QString("%1/").arg(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); auto fileName = QString("%1/").arg(QStandardPaths::writableLocation(QStandardPaths::TempLocation));
QString writeFileName auto writeFileName
= QString("%1/awesomewidgets/tmp/").arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)); = QString("%1/awesomewidgets/tmp/").arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
QString name = randomString(1, 20); auto name = randomString(1, 20);
fileName += name; fileName += name;
writeFileName += name; writeFileName += name;
@ -72,8 +72,8 @@ QString AWTestLibrary::randomString(const int _min, const int _max)
{ {
QString output; QString output;
int count = _min + randomInt(_max - _min); auto count = _min + randomInt(_max - _min);
for (int i = 0; i < count; i++) for (auto i = 0; i < count; i++)
output += randomChar(); output += randomChar();
return output; return output;
@ -84,8 +84,8 @@ QStringList AWTestLibrary::randomStringList(const int _max)
{ {
QStringList output; QStringList output;
int count = 1 + randomInt(_max); auto count = 1 + randomInt(_max);
for (int i = 0; i < count; i++) for (auto i = 0; i < count; i++)
output.append(randomString()); output.append(randomString());
return output; return output;
@ -96,9 +96,9 @@ QStringList AWTestLibrary::randomSelect(const QStringList &_available)
{ {
QSet<QString> output; QSet<QString> output;
int count = 1 + randomInt(_available.count()); auto count = 1 + randomInt(_available.count());
for (int i = 0; i < count; i++) { for (auto i = 0; i < count; i++) {
int index = randomInt(_available.count()); auto index = randomInt(_available.count());
output << _available.at(index); output << _available.at(index);
} }

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef AWTESTLIBRARY_H
#define AWTESTLIBRARY_H
#include <QPair> #include <QPair>
#include <QStringList> #include <QStringList>
@ -34,6 +32,3 @@ QString randomString(const int _min = 1, const int _max = 100);
QStringList randomStringList(const int _max = 100); QStringList randomStringList(const int _max = 100);
QStringList randomSelect(const QStringList &_available); QStringList randomSelect(const QStringList &_available);
} // namespace AWTestLibrary } // namespace AWTestLibrary
#endif /* AWTESTLIBRARY_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef TESTABSTRACTEXTITEM_H
#define TESTABSTRACTEXTITEM_H
#include <QObject> #include <QObject>
@ -49,6 +47,3 @@ private:
QString fileName; QString fileName;
QString writeFileName; QString writeFileName;
}; };
#endif /* TESTABSTRACTEXTITEM_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef TESTABSTRACTFORMATTER_H
#define TESTABSTRACTFORMATTER_H
#include <QObject> #include <QObject>
@ -40,6 +38,3 @@ private slots:
private: private:
AWNoFormatter *formatter = nullptr; AWNoFormatter *formatter = nullptr;
}; };
#endif /* TESTABSTRACTFORMATTER_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef TESTAWBUGREPORTER_H
#define TESTAWBUGREPORTER_H
#include <QObject> #include <QObject>
@ -40,6 +38,3 @@ private:
AWBugReporter *plugin = nullptr; AWBugReporter *plugin = nullptr;
QStringList data; QStringList data;
}; };
#endif /* TESTAWBUGREPORTER_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef TESTAWCONFIGHELPER_H
#define TESTAWCONFIGHELPER_H
#include <QObject> #include <QObject>
#include <QQmlPropertyMap> #include <QQmlPropertyMap>
@ -47,6 +45,3 @@ private:
QQmlPropertyMap map; QQmlPropertyMap map;
QVariantMap deConfig; QVariantMap deConfig;
}; };
#endif /* TESTAWCONFIGHELPER_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef TESTAWKEYCACHE_H
#define TESTAWKEYCACHE_H
#include <QObject> #include <QObject>
@ -34,6 +32,3 @@ private slots:
private: private:
}; };
#endif /* TESTAWKEYCACHE_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef TESTAWKEYS_H
#define TESTAWKEYS_H
#include <QObject> #include <QObject>
@ -47,6 +45,3 @@ private:
QString pattern; QString pattern;
int interval = 1000; int interval = 1000;
}; };
#endif /* TESTAWKEYS_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef TESTAWPATTERNFUNCTIONS_H
#define TESTAWPATTERNFUNCTIONS_H
#include <QObject> #include <QObject>
@ -38,6 +36,3 @@ private slots:
private: private:
}; };
#endif /* TESTAWPATTERNFUNCTIONS_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef TESTAWTELEMETRYHANDLER_H
#define TESTAWTELEMETRYHANDLER_H
#include <QObject> #include <QObject>
@ -46,6 +44,3 @@ private:
QString telemetryStatus = "saved"; QString telemetryStatus = "saved";
QString telemetryValidGroup = "awwidgetconfig"; QString telemetryValidGroup = "awwidgetconfig";
}; };
#endif /* TESTAWTELEMETRYHANDLER_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef TESTAWUPDATEHELPER_H
#define TESTAWUPDATEHELPER_H
#include <QObject> #include <QObject>
@ -38,6 +36,3 @@ private slots:
private: private:
AWUpdateHelper *plugin = nullptr; AWUpdateHelper *plugin = nullptr;
}; };
#endif /* TESTAWUPDATEHELPER_H */

View File

@ -42,7 +42,7 @@ void TestBatterySource::cleanupTestCase()
void TestBatterySource::test_sources() void TestBatterySource::test_sources()
{ {
// //
QVERIFY(source->sources().count() >= 6); QVERIFY(source->sources().length() >= 6);
} }
@ -54,9 +54,9 @@ void TestBatterySource::test_battery()
QStringList batteries = source->sources(); QStringList batteries = source->sources();
std::for_each(batteries.begin(), batteries.end(), [this](const QString &bat) { std::for_each(batteries.begin(), batteries.end(), [this](const QString &bat) {
QVariant value = source->data(bat); QVariant value = source->data(bat);
if (bat == "battery/ac") if (bat == "ac")
QCOMPARE(value.type(), QVariant::Bool); QCOMPARE(value.type(), QVariant::Bool);
else if (bat.startsWith("battery/batrate") || bat.startsWith("battery/batleft")) else if (bat.startsWith("batrate") || bat.startsWith("batleft"))
; ;
else else
QVERIFY((value.toFloat() >= battery.first) || (std::isnan(value.toFloat()))); QVERIFY((value.toFloat() >= battery.first) || (std::isnan(value.toFloat())));

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef TESTBATTERYSOURCE_H
#define TESTBATTERYSOURCE_H
#include <QObject> #include <QObject>
#include <QPair> #include <QPair>
@ -42,6 +40,3 @@ private:
QString acpiPath = "/sys/class/power_supply/"; QString acpiPath = "/sys/class/power_supply/";
QPair<int, int> battery = QPair<int, int>(0, 100); QPair<int, int> battery = QPair<int, int>(0, 100);
}; };
#endif /* TESTBATTERYSOURCE_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef TESTDATETIMEFORMATTER_H
#define TESTDATETIMEFORMATTER_H
#include <QObject> #include <QObject>
@ -41,6 +39,3 @@ private:
AWDateTimeFormatter *formatter = nullptr; AWDateTimeFormatter *formatter = nullptr;
QString format; QString format;
}; };
#endif /* TESTDATETIMEFORMATTER_H */

View File

@ -47,7 +47,7 @@ void TestDesktopSource::test_values()
{ {
QSKIP("Tests are failing with current api"); QSKIP("Tests are failing with current api");
QVERIFY(source->data("desktop/current/name").toString().count() > 0); QVERIFY(source->data("desktop/current/name").toString().length() > 0);
QVERIFY(source->data("desktop/current/number").toInt() >= 0); QVERIFY(source->data("desktop/current/number").toInt() >= 0);
QVERIFY(source->data("desktop/total/name").toStringList().count() > 0); QVERIFY(source->data("desktop/total/name").toStringList().count() > 0);
QVERIFY(source->data("desktop/total/number").toInt() > 0); QVERIFY(source->data("desktop/total/number").toInt() > 0);

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef TESTDESKTOPSOURCE_H
#define TESTDESKTOPSOURCE_H
#include <QObject> #include <QObject>
@ -39,6 +37,3 @@ private slots:
private: private:
DesktopSource *source = nullptr; DesktopSource *source = nullptr;
}; };
#endif /* TESTDESKTOPSOURCE_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef TESTDPPLUGIN_H
#define TESTDPPLUGIN_H
#include <QObject> #include <QObject>
@ -44,6 +42,3 @@ private:
bool m_isKwinActive = false; bool m_isKwinActive = false;
QString pattern = "$"; QString pattern = "$";
}; };
#endif /* TESTDPPLUGIN_H */

View File

@ -42,7 +42,7 @@ void TestExtItemAggregator::test_values()
{ {
QCOMPARE(aggregator->type(), type); QCOMPARE(aggregator->type(), type);
QCOMPARE(aggregator->uniqNumber(), 0); QCOMPARE(aggregator->uniqNumber(), 0);
QCOMPARE(aggregator->items().count(), 0); QCOMPARE(aggregator->items().length(), 0);
} }

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
#pragma once
#ifndef TESTEXTITEMAGGREGATOR_H
#define TESTEXTITEMAGGREGATOR_H
#include <QObject> #include <QObject>
@ -40,6 +38,3 @@ private:
ExtItemAggregator<AWNoFormatter> *aggregator = nullptr; ExtItemAggregator<AWNoFormatter> *aggregator = nullptr;
QString type = "tmp"; QString type = "tmp";
}; };
#endif /* TESTEXTITEMAGGREGATOR_H */

Some files were not shown because too many files have changed in this diff Show More