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);
colorBox = new QComboBox(this);
connect(colorBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateColor(QString)));
connect(colorBox, &QComboBox::currentTextChanged, this, &CFontDialog::updateColor);
QStringList colorNames = QColor::colorNames();
int index = 0;
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,
Qt::Horizontal, this);
QObject::connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
QObject::connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
QObject::connect(buttons, &QDialogButtonBox::accepted, this, &CFontDialog::accept);
QObject::connect(buttons, &QDialogButtonBox::rejected, this, &CFontDialog::reject);
mainGrid->addWidget(buttons, 1, 0, 1, 5);
italicBox->setHidden(!needItalic);

View File

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

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef AWDEBUG_H
#define AWDEBUG_H
#pragma once
#include <QLoggingCategory>
@ -42,6 +40,3 @@ Q_DECLARE_LOGGING_CATEGORY(LOG_DP)
Q_DECLARE_LOGGING_CATEGORY(LOG_ESM)
Q_DECLARE_LOGGING_CATEGORY(LOG_ESS)
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);
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &AWAbstractPairConfig::accept);
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &AWAbstractPairConfig::reject);
// edit feature
if (m_hasEdit) {
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()
{
QPair<QString, QString> current = dynamic_cast<AWAbstractSelector *>(sender())->current();
int index = m_selectors.indexOf(dynamic_cast<AWAbstractSelector *>(sender()));
auto current = dynamic_cast<AWAbstractSelector *>(sender())->current();
auto index = m_selectors.indexOf(dynamic_cast<AWAbstractSelector *>(sender()));
if ((current.first.isEmpty()) && (current.second.isEmpty())) {
// remove current selector if it is empty and does not last
if (sender() == m_selectors.last())
return;
AWAbstractSelector *selector = m_selectors.takeAt(index);
auto *selector = m_selectors.takeAt(index);
ui->verticalLayout->removeWidget(selector);
selector->deleteLater();
} else {
@ -112,7 +112,7 @@ void AWAbstractPairConfig::addSelector(const QStringList &_keys, const QStringLi
auto *selector = new AWAbstractSelector(ui->scrollAreaWidgetContents, m_editable);
selector->init(_keys, _values, _current);
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);
}
@ -120,7 +120,7 @@ void AWAbstractPairConfig::addSelector(const QStringList &_keys, const QStringLi
void AWAbstractPairConfig::clearSelectors()
{
for (auto &selector : m_selectors) {
disconnect(selector, SIGNAL(selectionChanged()), this, SLOT(updateUi()));
disconnect(selector, &AWAbstractSelector::selectionChanged, this, &AWAbstractPairConfig::updateUi);
ui->verticalLayout->removeWidget(selector);
selector->deleteLater();
}
@ -164,7 +164,7 @@ QPair<QStringList, QStringList> AWAbstractPairConfig::initKeys() const
right.append(m_helper->rightKeys().isEmpty() ? m_keys : m_helper->rightKeys());
right.sort();
return QPair<QStringList, QStringList>(left, right);
return {left, right};
}
@ -175,7 +175,7 @@ void AWAbstractPairConfig::updateDialog()
auto keys = initKeys();
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
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/ *
***************************************************************************/
#ifndef AWABSTRACTPAIRCONFIG_H
#define AWABSTRACTPAIRCONFIG_H
#pragma once
#include <QDialog>
@ -67,6 +65,3 @@ private:
[[nodiscard]] QPair<QStringList, QStringList> initKeys() const;
void updateDialog();
};
#endif /* AWABSTRACTPAIRCONFIG_H */

View File

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

View File

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

View File

@ -44,7 +44,7 @@ AWBugReporter::~AWBugReporter()
void AWBugReporter::doConnect()
{
// 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;
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");
// generate payload
QVariantMap payload;
payload["title"] = _title;
payload["body"] = _body;
payload["labels"] = QStringList() << "from application";
payload["labels"] = QStringList({"from application"});
// 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();
manager->post(request, data);
}
void AWBugReporter::issueReplyRecieved(QNetworkReply *_reply)
void AWBugReporter::issueReplyReceived(QNetworkReply *_reply)
{
if (_reply->error() != QNetworkReply::NoError) {
qCWarning(LOG_AW) << "An error occurs" << _reply->error() << "with message" << _reply->errorString();
@ -98,7 +98,7 @@ void AWBugReporter::issueReplyRecieved(QNetworkReply *_reply)
}
QJsonParseError error{};
QJsonDocument jsonDoc = QJsonDocument::fromJson(_reply->readAll(), &error);
auto jsonDoc = QJsonDocument::fromJson(_reply->readAll(), &error);
if (error.error != QJsonParseError::NoError) {
qCWarning(LOG_AW) << "Parse error" << error.errorString();
return emit(replyReceived(0, ""));
@ -106,9 +106,9 @@ void AWBugReporter::issueReplyRecieved(QNetworkReply *_reply)
_reply->deleteLater();
// convert to map
QVariantMap response = jsonDoc.toVariant().toMap();
QString url = response["html_url"].toString();
int number = response["number"].toInt();
auto response = jsonDoc.toVariant().toMap();
auto url = response["html_url"].toString();
auto number = response["number"].toInt();
return emit(replyReceived(number, url));
}
@ -135,7 +135,7 @@ void AWBugReporter::showInformation(const int _number, const QString &_url)
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;
switch (ret) {

View File

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

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef AWCONFIGHELPER_H
#define AWCONFIGHELPER_H
#pragma once
#include <QObject>
#include <QVariant>
@ -52,6 +50,3 @@ private:
QString m_baseDir;
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/ *
***************************************************************************/
#ifndef AWCUSTOMKEYSCONFIG_H
#define AWCUSTOMKEYSCONFIG_H
#pragma once
#include "awabstractpairconfig.h"
@ -30,6 +28,3 @@ public:
explicit AWCustomKeysConfig(QWidget *_parent = nullptr, const QStringList &_keys = QStringList());
~AWCustomKeysConfig() override;
};
#endif /* AWCUSTOMKEYSCONFIG_H */

View File

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

View File

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

View File

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

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef AWDATAENGINEMAPPER_H
#define AWDATAENGINEMAPPER_H
#pragma once
#include <ksysguard/formatter/Unit.h>
@ -50,6 +48,3 @@ private:
QHash<QString, AWKeysAggregator::FormatterType> m_formatter;
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/ *
***************************************************************************/
#ifndef AWDBUSADAPTOR_H
#define AWDBUSADAPTOR_H
#pragma once
#include <QDBusAbstractAdaptor>
@ -50,6 +48,3 @@ private:
AWKeys *m_plugin = nullptr;
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/ *
***************************************************************************/
#ifndef AWPLUGIN_H
#define AWPLUGIN_H
#pragma once
#include <QQmlExtensionPlugin>
@ -30,6 +28,3 @@ class AWPlugin : public QQmlExtensionPlugin
public:
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/ *
***************************************************************************/
#ifndef AWFORMATTERCONFIG_H
#define AWFORMATTERCONFIG_H
#pragma once
#include "awabstractpairconfig.h"
@ -30,6 +28,3 @@ public:
explicit AWFormatterConfig(QWidget *_parent = nullptr, const QStringList &_keys = QStringList());
~AWFormatterConfig() override;
};
#endif /* AWFORMATTERCONFIG_H */

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef AWFORMATTERHELPER_H
#define AWFORMATTERHELPER_H
#pragma once
#include "abstractextitemaggregator.h"
#include "awabstractformatter.h"
@ -56,6 +54,3 @@ private:
QHash<QString, AWAbstractFormatter *> m_formatters;
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/ *
***************************************************************************/
#ifndef AWKEYCACHE_H
#define AWKEYCACHE_H
#pragma once
#include <QHash>
#include <QString>
@ -31,6 +29,3 @@ QStringList getRequiredKeys(const QStringList &_keys, const QStringList &_bars,
const QStringList &_userKeys, const QStringList &_allKeys);
QHash<QString, QStringList> loadKeysFromCache();
} // namespace AWKeyCache
#endif /* AWKEYCACHE_H */

View File

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

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef AWKEYS_H
#define AWKEYS_H
#pragma once
#include <QMutex>
#include <QObject>
@ -90,6 +88,3 @@ private:
QThreadPool *m_threadPool = nullptr;
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;
break;
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;
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;
case FormatterType::NetSmartFormat:
output = [](const float value) {
if (value > 1024.0)
return QString("%1").arg(value / 1024.0, 4, 'f', 1);
output = [](const double value) {
if (value > MBinBytes)
return QString("%1").arg(value / MBinBytes, 4, 'f', 1);
else
return QString("%1").arg(value, 4, 'f', 0);
return QString("%1").arg(value / KBinBytes, 4, 'f', 0);
}(_data.toDouble());
break;
case FormatterType::NetSmartUnits:
if (_data.toDouble() > 1024.0)
if (_data.toDouble() > MBinBytes)
output = m_translate ? i18n("MB/s") : "MB/s";
else
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)
{
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;
float converted = temp;
auto converted = temp;
if (m_tempUnits == "Celsius") {
} 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") {
converted = temp + 273.15f;
converted = temp + 273.15;
} else if (m_tempUnits == "Reaumur") {
converted = temp * 0.8f;
converted = temp * 0.8;
} else if (m_tempUnits == "cm^-1") {
converted = (temp + 273.15f) * 0.695f;
converted = (temp + 273.15) * 0.695;
} else if (m_tempUnits == "kJ/mol") {
converted = (temp + 273.15f) * 8.31f;
converted = (temp + 273.15) * 8.31;
} else if (m_tempUnits == "kcal/mol") {
converted = (temp + 273.15f) * 1.98f;
converted = (temp + 273.15) * 1.98;
} else {
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/ *
***************************************************************************/
#ifndef AWKEYSAGGREGATOR_H
#define AWKEYSAGGREGATOR_H
#pragma once
#include <ksysguard/formatter/Unit.h>
@ -53,6 +51,7 @@ public:
ACFormat,
MemGBFormat,
MemMBFormat,
MemKBFormat,
NetSmartFormat,
NetSmartUnits,
Quotes,
@ -67,6 +66,10 @@ public:
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);
~AWKeysAggregator() override;
void initFormatters();
@ -83,10 +86,10 @@ public:
void setTranslate(bool _translate);
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:
[[nodiscard]] float temperature(float temp) const;
[[nodiscard]] double temperature(double temp) const;
AWFormatterHelper *m_customFormatters = nullptr;
AWDataEngineMapper *m_mapper = nullptr;
QStringList m_timeKeys;
@ -98,6 +101,3 @@ private:
QString m_tempUnits;
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/ *
***************************************************************************/
#ifndef AWPAIRCONFIGFACTORY_H
#define AWPAIRCONFIGFACTORY_H
#pragma once
#include <QObject>
@ -34,6 +32,3 @@ public:
private:
};
#endif /* AWPAIRCONFIGFACTORY_H */

View File

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

View File

@ -127,7 +127,7 @@ void AWTelemetryHandler::uploadTelemetry(const QString &_group, const QString &_
}
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);
QNetworkRequest request(url);
@ -140,14 +140,14 @@ void AWTelemetryHandler::uploadTelemetry(const QString &_group, const QString &_
payload["metadata"] = _value;
payload["type"] = _group;
// 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();
manager->post(request, data);
}
void AWTelemetryHandler::telemetryReplyRecieved(QNetworkReply *_reply)
void AWTelemetryHandler::telemetryReplyReceived(QNetworkReply *_reply)
{
if (_reply->error() != QNetworkReply::NoError) {
qCWarning(LOG_AW) << "An error occurs" << _reply->error() << "with message" << _reply->errorString();
@ -155,7 +155,7 @@ void AWTelemetryHandler::telemetryReplyRecieved(QNetworkReply *_reply)
}
QJsonParseError error{};
QJsonDocument jsonDoc = QJsonDocument::fromJson(_reply->readAll(), &error);
auto jsonDoc = QJsonDocument::fromJson(_reply->readAll(), &error);
if (error.error != QJsonParseError::NoError) {
qCWarning(LOG_AW) << "Parse error" << error.errorString();
return;
@ -163,8 +163,8 @@ void AWTelemetryHandler::telemetryReplyRecieved(QNetworkReply *_reply)
_reply->deleteLater();
// convert to map
QVariantMap response = jsonDoc.toVariant().toMap();
QString message = response["message"].toString();
auto response = jsonDoc.toVariant().toMap();
auto message = response["message"].toString();
qCInfo(LOG_AW) << "Server reply on telemetry" << message;
return emit(replyReceived(message));

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef AWTELEMETRYHANDLER_H
#define AWTELEMETRYHANDLER_H
#pragma once
#include <QObject>
@ -43,7 +41,7 @@ signals:
void replyReceived(const QString &_message);
private slots:
void telemetryReplyRecieved(QNetworkReply *_reply);
void telemetryReplyReceived(QNetworkReply *_reply);
private:
static QString getKey(int _count);
@ -52,6 +50,3 @@ private:
int m_storeCount = 0;
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
auto *manager = new QNetworkAccessManager(nullptr);
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)));
}
@ -63,7 +63,7 @@ void AWUpdateHelper::checkUpdates(const bool _showAnyway)
bool AWUpdateHelper::checkVersion()
{
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
settings.setValue("Version", QString(VERSION));
settings.sync();
@ -88,7 +88,7 @@ void AWUpdateHelper::showInfo(const QVersionNumber &_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())
text += QString(" (%1)").arg(QString(COMMIT_SHA));
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)
{
QMessageBox::ButtonRole ret = dynamic_cast<QMessageBox *>(sender())->buttonRole(_button);
auto ret = dynamic_cast<QMessageBox *>(sender())->buttonRole(_button);
qCInfo(LOG_AW) << "User select" << 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;
if (_reply->error() != QNetworkReply::NoError) {
@ -134,8 +134,8 @@ void AWUpdateHelper::versionReplyRecieved(QNetworkReply *_reply, const bool _sho
return;
}
QJsonParseError error = QJsonParseError();
QJsonDocument jsonDoc = QJsonDocument::fromJson(_reply->readAll(), &error);
auto error = QJsonParseError();
auto jsonDoc = QJsonDocument::fromJson(_reply->readAll(), &error);
if (error.error != QJsonParseError::NoError) {
qCWarning(LOG_AW) << "Parse error" << error.errorString();
return;
@ -143,13 +143,13 @@ void AWUpdateHelper::versionReplyRecieved(QNetworkReply *_reply, const bool _sho
_reply->deleteLater();
// convert to map
QVariantMap firstRelease = jsonDoc.toVariant().toList().first().toMap();
QString version = firstRelease["tag_name"].toString();
auto firstRelease = jsonDoc.toVariant().toList().first().toMap();
auto version = firstRelease["tag_name"].toString();
version.remove("V.");
m_foundVersion = QVersionNumber::fromString(version);
qCInfo(LOG_AW) << "Update found version to" << m_foundVersion;
QVersionNumber oldVersion = QVersionNumber::fromString(VERSION);
auto oldVersion = QVersionNumber::fromString(VERSION);
if (oldVersion < m_foundVersion)
return showUpdates(m_foundVersion);
else if (_showAnyway)

View File

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

View File

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

View File

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

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef ABSTRACTEXTITEMAGGREGATOR_H
#define ABSTRACTEXTITEMAGGREGATOR_H
#pragma once
#include <QStandardPaths>
@ -80,6 +79,3 @@ private:
// ui methods
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/ *
***************************************************************************/
#ifndef ABSTRACTQUOTESPROVIDER_H
#define ABSTRACTQUOTESPROVIDER_H
#pragma once
#include <QObject>
#include <QUrl>
@ -40,6 +39,3 @@ public:
};
[[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/ *
***************************************************************************/
#ifndef ABSTRACTWEATHERPROVIDER_H
#define ABSTRACTWEATHERPROVIDER_H
#pragma once
#include <QObject>
#include <QUrl>
@ -40,6 +39,3 @@ public:
};
[[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/ *
***************************************************************************/
#ifndef AWABSTRACTFORMATTER_H
#define AWABSTRACTFORMATTER_H
#pragma once
#include <QRegularExpression>
@ -52,6 +51,3 @@ private:
// properties
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/ *
***************************************************************************/
#ifndef AWDATETIMEFORMATTER_H
#define AWDATETIMEFORMATTER_H
#pragma once
#include <QLocale>
@ -52,6 +51,3 @@ private:
QString m_format = "";
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/ *
***************************************************************************/
#ifndef AWFLOATFORMATTER_H
#define AWFLOATFORMATTER_H
#pragma once
#include "awabstractformatter.h"
@ -68,6 +67,3 @@ private:
int m_precision = -1;
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/ *
***************************************************************************/
#ifndef AWJSONFORMATTER_H
#define AWJSONFORMATTER_H
#pragma once
#include "awabstractformatter.h"
@ -49,6 +48,3 @@ private:
QString m_path;
QVariantList m_splittedPath;
};
#endif /* AWJSONFORMATTER_H */

View File

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

View File

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

View File

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

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef AWSTRINGFORMATTER_H
#define AWSTRINGFORMATTER_H
#pragma once
#include "awabstractformatter.h"
@ -52,6 +51,3 @@ private:
QChar m_fillChar = QChar();
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/ *
***************************************************************************/
#ifndef EXTITEMAGGREGATOR_H
#define EXTITEMAGGREGATOR_H
#pragma once
#include <KI18n/KLocalizedString>
@ -150,6 +149,3 @@ private:
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
// in the destructor
m_manager = new QNetworkAccessManager(nullptr);
connect(m_manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(networkReplyReceived(QNetworkReply *)));
connect(this, SIGNAL(requestDataUpdate()), this, SLOT(sendRequest()));
connect(m_manager, &QNetworkAccessManager::finished, this, &ExtNetworkRequest::networkReplyReceived);
connect(this, &ExtNetworkRequest::requestDataUpdate, this, &ExtNetworkRequest::sendRequest);
}
@ -50,8 +49,8 @@ ExtNetworkRequest::~ExtNetworkRequest()
{
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
disconnect(m_manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(networkReplyReceived(QNetworkReply *)));
disconnect(this, SIGNAL(requestDataUpdate()), this, SLOT(sendRequest()));
disconnect(m_manager, &QNetworkAccessManager::finished, this, &ExtNetworkRequest::networkReplyReceived);
disconnect(this, &ExtNetworkRequest::requestDataUpdate, this, &ExtNetworkRequest::sendRequest);
m_manager->deleteLater();
}

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef EXTNETWORKREQUEST_H
#define EXTNETWORKREQUEST_H
#pragma once
#include <QNetworkReply>
@ -59,6 +58,3 @@ private:
// 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/ *
***************************************************************************/
#ifndef EXTQUOTES_H
#define EXTQUOTES_H
#pragma once
#include <QNetworkReply>
@ -61,6 +60,3 @@ private:
// 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_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);
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__;
disconnect(m_process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(updateValue()));
m_process->kill();
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;
return;
}
QString jsonText = jsonFile.readAll();
auto jsonText = jsonFile.readAll();
jsonFile.close();
QJsonParseError error{};
auto jsonDoc = QJsonDocument::fromJson(jsonText.toUtf8(), &error);
auto jsonDoc = QJsonDocument::fromJson(jsonText, &error);
if (error.error != QJsonParseError::NoError) {
qCWarning(LOG_LIB) << "Parse error" << error.errorString();
return;

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef EXTSCRIPT_H
#define EXTSCRIPT_H
#pragma once
#include <QProcess>
@ -76,6 +75,3 @@ private:
QVariantMap m_jsonFilters;
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_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);
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->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/ *
***************************************************************************/
#ifndef EXTUPGRADE_H
#define EXTUPGRADE_H
#pragma once
#include <QProcess>
@ -64,6 +63,3 @@ private:
// internal properties
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
// in the destructor
m_manager = new QNetworkAccessManager(nullptr);
connect(m_manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(weatherReplyReceived(QNetworkReply *)));
connect(this, SIGNAL(requestDataUpdate()), this, SLOT(sendRequest()));
connect(m_manager, &QNetworkAccessManager::finished, this, &ExtWeather::weatherReplyReceived);
connect(this, &ExtWeather::requestDataUpdate, this, &ExtWeather::sendRequest);
}
@ -59,8 +58,8 @@ ExtWeather::~ExtWeather()
{
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
disconnect(m_manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(weatherReplyReceived(QNetworkReply *)));
disconnect(this, SIGNAL(requestDataUpdate()), this, SLOT(sendRequest()));
disconnect(m_manager, &QNetworkAccessManager::finished, this, &ExtWeather::weatherReplyReceived);
disconnect(this, &ExtWeather::requestDataUpdate, this, &ExtWeather::sendRequest);
m_manager->deleteLater();
}
@ -150,7 +149,7 @@ int ExtWeather::ts() 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;
return;
}
QString jsonText = jsonFile.readAll();
auto jsonText = jsonFile.readAll();
jsonFile.close();
QJsonParseError error{};
auto jsonDoc = QJsonDocument::fromJson(jsonText.toUtf8(), &error);
auto jsonDoc = QJsonDocument::fromJson(jsonText, &error);
if (error.error != QJsonParseError::NoError) {
qCWarning(LOG_LIB) << "Parse error" << error.errorString();
return;

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef EXTWEATHER_H
#define EXTWEATHER_H
#pragma once
#include <QNetworkReply>
@ -90,6 +89,3 @@ private:
// 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/ *
***************************************************************************/
#ifndef GRAPHICALITEM_H
#define GRAPHICALITEM_H
#pragma once
#include <QColor>
@ -118,6 +117,3 @@ private:
QStringList m_usedKeys;
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/ *
***************************************************************************/
#ifndef GRAPHICALITEMHELPER_H
#define GRAPHICALITEMHELPER_H
#pragma once
#include <QColor>
#include <QObject>
@ -56,6 +55,3 @@ private:
// list of values which will be used to store data for graph type only
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/ *
***************************************************************************/
#ifndef OWMWEATHERPROVIDER_H
#define OWMWEATHERPROVIDER_H
#pragma once
#include "abstractweatherprovider.h"
@ -42,6 +41,3 @@ private:
int m_ts = 0;
QUrl m_url;
};
#endif /* OWMWEATHERPROVIDER_H */

View File

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

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef QCRONSCHEDULER_H
#define QCRONSCHEDULER_H
#pragma once
#include "QObject"
@ -58,6 +57,3 @@ private:
QTimer *m_timer = nullptr;
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/ *
***************************************************************************/
#ifndef STOOQQUOTESPROVIDER_H
#define STOOQQUOTESPROVIDER_H
#pragma once
#include "abstractquotesprovider.h"
@ -37,6 +36,3 @@ public:
private:
QUrl m_url;
};
#endif /* STOOQQUOTESPROVIDER_H */

View File

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

View File

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

View File

@ -15,9 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef DPPLUGIN_H
#define DPPLUGIN_H
#pragma once
#include <QQmlExtensionPlugin>
@ -30,6 +28,3 @@ class DPPlugin : public QQmlExtensionPlugin
public:
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/ *
***************************************************************************/
#ifndef DPADDS_H
#define DPADDS_H
#pragma once
// ui library required by WId definition
#include <QGuiApplication>
@ -78,6 +76,3 @@ private:
QString m_tooltipColor = "#000000";
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/ *
***************************************************************************/
#ifndef EXTSYSMON_H
#define EXTSYSMON_H
#pragma once
#include <ksysguard/systemstats/SensorPlugin.h>
@ -36,6 +35,3 @@ private:
void readConfiguration();
[[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/ *
***************************************************************************/
#ifndef ABSTRACTEXTSYSMONSOURCE_H
#define ABSTRACTEXTSYSMONSOURCE_H
#pragma once
#include <QObject>
#include <QRegularExpression>
@ -50,6 +49,3 @@ public:
signals:
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/ *
***************************************************************************/
#ifndef BATTERYSOURCE_H
#define BATTERYSOURCE_H
#pragma once
#include <QDateTime>
#include <QObject>
@ -50,6 +49,3 @@ private:
QHash<int, QList<int>> m_trend;
QVariantHash m_values;
};
#endif /* BATTERYSOURCE_H */

View File

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

View File

@ -15,8 +15,7 @@
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef DESKTOPSOURCE_H
#define DESKTOPSOURCE_H
#pragma once
#include <QObject>
@ -42,6 +41,3 @@ public:
private:
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/ *
***************************************************************************/
#ifndef EXTSYSMONSENSOR_H
#define EXTSYSMONSENSOR_H
#pragma once
#include <ksysguard/systemstats/SensorObject.h>
@ -40,6 +39,3 @@ private:
AbstractExtSysMonSource *m_source = 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/ *
***************************************************************************/
#ifndef LOADSOURCE_H
#define LOADSOURCE_H
#pragma once
#include <QObject>
@ -35,6 +34,3 @@ public:
void run() 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/ *
***************************************************************************/
#ifndef NETWORKSOURCE_H
#define NETWORKSOURCE_H
#pragma once
#include <QObject>
@ -45,6 +44,3 @@ private:
QProcess *m_process = nullptr;
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_symbols = _args.at(4).toInt();
connect(&m_mpdSocket, SIGNAL(connected()), this, SLOT(mpdSocketConnected()));
connect(&m_mpdSocket, SIGNAL(readyRead()), this, SLOT(mpdSocketReadyRead()));
connect(&m_mpdSocket, SIGNAL(bytesWritten(qint64)), this, SLOT(mpdSocketWritten(const qint64)));
connect(&m_mpdSocket, &QTcpSocket::connected, this, &PlayerSource::mpdSocketConnected);
connect(&m_mpdSocket, &QTcpSocket::readyRead, this, &PlayerSource::mpdSocketReadyRead);
connect(&m_mpdSocket, &QTcpSocket::bytesWritten, this, &PlayerSource::mpdSocketWritten);
m_mpdCached = defaultInfo();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -42,7 +42,7 @@ void TestBatterySource::cleanupTestCase()
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();
std::for_each(batteries.begin(), batteries.end(), [this](const QString &bat) {
QVariant value = source->data(bat);
if (bat == "battery/ac")
if (bat == "ac")
QCOMPARE(value.type(), QVariant::Bool);
else if (bat.startsWith("battery/batrate") || bat.startsWith("battery/batleft"))
else if (bat.startsWith("batrate") || bat.startsWith("batleft"))
;
else
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/ *
***************************************************************************/
#ifndef TESTBATTERYSOURCE_H
#define TESTBATTERYSOURCE_H
#pragma once
#include <QObject>
#include <QPair>
@ -42,6 +40,3 @@ private:
QString acpiPath = "/sys/class/power_supply/";
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/ *
***************************************************************************/
#ifndef TESTDATETIMEFORMATTER_H
#define TESTDATETIMEFORMATTER_H
#pragma once
#include <QObject>
@ -41,6 +39,3 @@ private:
AWDateTimeFormatter *formatter = nullptr;
QString format;
};
#endif /* TESTDATETIMEFORMATTER_H */

View File

@ -47,7 +47,7 @@ void TestDesktopSource::test_values()
{
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/total/name").toStringList().count() > 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/ *
***************************************************************************/
#ifndef TESTDESKTOPSOURCE_H
#define TESTDESKTOPSOURCE_H
#pragma once
#include <QObject>
@ -39,6 +37,3 @@ private slots:
private:
DesktopSource *source = nullptr;
};
#endif /* TESTDESKTOPSOURCE_H */

View File

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

View File

@ -42,7 +42,7 @@ void TestExtItemAggregator::test_values()
{
QCOMPARE(aggregator->type(), type);
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/ *
***************************************************************************/
#ifndef TESTEXTITEMAGGREGATOR_H
#define TESTEXTITEMAGGREGATOR_H
#pragma once
#include <QObject>
@ -40,6 +38,3 @@ private:
ExtItemAggregator<AWNoFormatter> *aggregator = nullptr;
QString type = "tmp";
};
#endif /* TESTEXTITEMAGGREGATOR_H */

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