mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 07:27:21 +00:00
system source, some code improvements
This commit is contained in:
parent
c05a87a540
commit
276248a748
1
.gitignore
vendored
1
.gitignore
vendored
@ -47,3 +47,4 @@ pkg
|
||||
|
||||
# clion settings
|
||||
.idea
|
||||
cmake-build*
|
||||
|
0
.vscode/temp.sql
vendored
0
.vscode/temp.sql
vendored
@ -1,20 +1,19 @@
|
||||
---
|
||||
Language: Cpp
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: true
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignEscapedNewlinesLeft: false
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: false
|
||||
AlwaysBreakTemplateDeclarations: No
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BreakBeforeBinaryOperators: All
|
||||
|
@ -1,26 +0,0 @@
|
||||
[Buildset]
|
||||
BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x1e\x00a\x00w\x00e\x00s\x00o\x00m\x00e\x00-\x00w\x00i\x00d\x00g\x00e\x00t\x00s)
|
||||
|
||||
[CMake]
|
||||
Build Directory Count=1
|
||||
Current Build Directory Index=0
|
||||
ProjectRootRelative=./
|
||||
|
||||
[CMake][CMake Build Directory 0]
|
||||
Build Directory Path=file:///home/arcanis/Documents/github/awesome-widgets/build
|
||||
Build Type=Optimization
|
||||
CMake Binary=file:///usr/bin/cmake
|
||||
Environment Profile=
|
||||
Extra Arguments=
|
||||
Install Directory=file:///usr
|
||||
|
||||
[Defines And Includes][Compiler]
|
||||
Name=GCC
|
||||
Path=gcc
|
||||
Type=GCC
|
||||
|
||||
[Launch]
|
||||
Launch Configurations=
|
||||
|
||||
[Project]
|
||||
VersionControlSupport=kdevgit
|
@ -1,23 +0,0 @@
|
||||
[Buildset]
|
||||
BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x1e\x00a\x00w\x00e\x00s\x00o\x00m\x00e\x00-\x00w\x00i\x00d\x00g\x00e\x00t\x00s)
|
||||
|
||||
[CMake]
|
||||
Build Directory Count=1
|
||||
Current Build Directory Index=0
|
||||
ProjectRootRelative=./
|
||||
|
||||
[CMake][CMake Build Directory 0]
|
||||
Build Directory Path=file:///home/arcanis/Documents/github/awesome-widgets/build
|
||||
Build Type=Release
|
||||
CMake Binary=file:///usr/bin/cmake
|
||||
Environment Profile=
|
||||
Extra Arguments=
|
||||
Install Directory=file:///usr
|
||||
|
||||
[Defines And Includes][Compiler]
|
||||
Name=GCC
|
||||
Path=gcc
|
||||
Type=GCC
|
||||
|
||||
[Project]
|
||||
VersionControlSupport=kdevgit
|
@ -12,7 +12,7 @@ QReplyTimeout::QReplyTimeout(QNetworkReply *reply, const int timeout)
|
||||
|
||||
void QReplyTimeout::timeout()
|
||||
{
|
||||
QNetworkReply *reply = static_cast<QNetworkReply *>(parent());
|
||||
auto *reply = dynamic_cast<QNetworkReply *>(parent());
|
||||
if (reply->isRunning())
|
||||
reply->close();
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 2.8.12)
|
||||
cmake_policy(SET CMP0011 NEW)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
if (POLICY CMP0063)
|
||||
cmake_policy(SET CMP0063 OLD)
|
||||
cmake_policy(SET CMP0063 NEW)
|
||||
endif ()
|
||||
if (POLICY CMP0071)
|
||||
cmake_policy(SET CMP0071 NEW)
|
||||
|
@ -35,7 +35,7 @@ QString AWDebug::getAboutText(const QString &_type)
|
||||
if (_type == "header") {
|
||||
text = NAME;
|
||||
} else if (_type == "version") {
|
||||
text = i18n("Version %1 (build date %2)", VERSION, BUILD_DATE);
|
||||
text = i18np("Version %1 (build date %2)", VERSION, BUILD_DATE);
|
||||
if (!QString(COMMIT_SHA).isEmpty())
|
||||
text += QString(" (%1)").arg(COMMIT_SHA);
|
||||
} else if (_type == "description") {
|
||||
@ -60,7 +60,7 @@ QString AWDebug::getAboutText(const QString &_type)
|
||||
.arg(DATE)
|
||||
.arg(EMAIL)
|
||||
.arg(AUTHOR)
|
||||
+ i18n("This software is licensed under %1", LICENSE) + "</small>";
|
||||
+ i18nc("This software is licensed under %1", LICENSE) + "</small>";
|
||||
} else if (_type == "translators") {
|
||||
QStringList translatorList = QString(TRANSLATORS).split(',');
|
||||
for (auto &translator : translatorList)
|
||||
|
@ -33,7 +33,7 @@ const char LOG_FORMAT[] = "[%{time "
|
||||
|
||||
QString getAboutText(const QString &_type);
|
||||
QStringList getBuildData();
|
||||
}
|
||||
} // namespace AWDebug
|
||||
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(LOG_AW)
|
||||
|
@ -15,7 +15,6 @@ Icon=utilities-system-monitor
|
||||
X-KDE-ServiceTypes=Plasma/Applet
|
||||
X-Plasma-API=declarativeappletscript
|
||||
X-Plasma-MainScript=ui/main.qml
|
||||
X-Plasma-RemoteLocation=
|
||||
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||
|
@ -15,7 +15,6 @@ Icon=utilities-system-monitor
|
||||
X-KDE-ServiceTypes=Plasma/Applet
|
||||
X-Plasma-API=declarativeappletscript
|
||||
X-Plasma-MainScript=ui/main.qml
|
||||
X-Plasma-RemoteLocation=
|
||||
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||
|
@ -21,17 +21,17 @@
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QPushButton>
|
||||
#include <utility>
|
||||
|
||||
#include "awabstractselector.h"
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
AWAbstractPairConfig::AWAbstractPairConfig(QWidget *_parent, const bool _hasEdit,
|
||||
const QStringList &_keys)
|
||||
AWAbstractPairConfig::AWAbstractPairConfig(QWidget *_parent, const bool _hasEdit, QStringList _keys)
|
||||
: QDialog(_parent)
|
||||
, ui(new Ui::AWAbstractPairConfig)
|
||||
, m_hasEdit(_hasEdit)
|
||||
, m_keys(_keys)
|
||||
, m_keys(std::move(_keys))
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
|
||||
@ -84,8 +84,8 @@ void AWAbstractPairConfig::edit()
|
||||
|
||||
void AWAbstractPairConfig::updateUi()
|
||||
{
|
||||
QPair<QString, QString> current = static_cast<AWAbstractSelector *>(sender())->current();
|
||||
int index = m_selectors.indexOf(static_cast<AWAbstractSelector *>(sender()));
|
||||
QPair<QString, QString> current = dynamic_cast<AWAbstractSelector *>(sender())->current();
|
||||
int 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
|
||||
@ -110,7 +110,7 @@ void AWAbstractPairConfig::addSelector(const QStringList &_keys, const QStringLi
|
||||
qCDebug(LOG_AW) << "Add selector with keys" << _keys << "values" << _values
|
||||
<< "and current ones" << _current;
|
||||
|
||||
AWAbstractSelector *selector = new AWAbstractSelector(ui->scrollAreaWidgetContents, m_editable);
|
||||
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()));
|
||||
|
@ -36,12 +36,12 @@ class AWAbstractPairConfig : public QDialog
|
||||
|
||||
public:
|
||||
explicit AWAbstractPairConfig(QWidget *_parent = nullptr, const bool _hasEdit = false,
|
||||
const QStringList &_keys = QStringList());
|
||||
virtual ~AWAbstractPairConfig();
|
||||
QStringList _keys = QStringList());
|
||||
~AWAbstractPairConfig() override;
|
||||
template <class T> void initHelper()
|
||||
{
|
||||
if (m_helper)
|
||||
delete m_helper;
|
||||
|
||||
delete m_helper;
|
||||
m_helper = new T(this);
|
||||
}
|
||||
void showDialog();
|
||||
|
@ -19,13 +19,14 @@
|
||||
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
#include <utility>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
AWAbstractPairHelper::AWAbstractPairHelper(const QString &_filePath, const QString &_section)
|
||||
: m_filePath(_filePath)
|
||||
, m_section(_section)
|
||||
AWAbstractPairHelper::AWAbstractPairHelper(QString _filePath, QString _section)
|
||||
: m_filePath(std::move(_filePath))
|
||||
, m_section(std::move(_section))
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
class AWAbstractPairHelper
|
||||
{
|
||||
public:
|
||||
explicit AWAbstractPairHelper(const QString &_filePath = "", const QString &_section = "");
|
||||
explicit AWAbstractPairHelper(QString _filePath = "", QString _section = "");
|
||||
virtual ~AWAbstractPairHelper();
|
||||
QStringList keys() const;
|
||||
QHash<QString, QString> pairs() const;
|
||||
|
@ -34,7 +34,7 @@ class AWAbstractSelector : public QWidget
|
||||
public:
|
||||
explicit AWAbstractSelector(QWidget *_parent = nullptr,
|
||||
const QPair<bool, bool> &_editable = {false, false});
|
||||
virtual ~AWAbstractSelector();
|
||||
~AWAbstractSelector() override;
|
||||
QPair<QString, QString> current() const;
|
||||
void init(const QStringList &_keys, const QStringList &_values,
|
||||
const QPair<QString, QString> &_current);
|
||||
|
@ -55,7 +55,7 @@ void AWActions::checkUpdates(const bool _showAnyway)
|
||||
}
|
||||
|
||||
|
||||
QString AWActions::getFileContent(const QString &_path) const
|
||||
QString AWActions::getFileContent(const QString &_path)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Get content from file" << _path;
|
||||
|
||||
@ -72,13 +72,13 @@ QString AWActions::getFileContent(const QString &_path) const
|
||||
|
||||
|
||||
// HACK: since QML could not use QLoggingCategory I need this hack
|
||||
bool AWActions::isDebugEnabled() const
|
||||
bool AWActions::isDebugEnabled()
|
||||
{
|
||||
return LOG_AW().isDebugEnabled();
|
||||
}
|
||||
|
||||
|
||||
bool AWActions::runCmd(const QString &_cmd) const
|
||||
bool AWActions::runCmd(const QString &_cmd)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Cmd" << _cmd;
|
||||
|
||||
@ -89,15 +89,15 @@ bool AWActions::runCmd(const QString &_cmd) const
|
||||
|
||||
|
||||
// HACK: this method uses variable from version.h
|
||||
void AWActions::showReadme() const
|
||||
void AWActions::showReadme()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl(HOMEPAGE));
|
||||
}
|
||||
|
||||
|
||||
void AWActions::showLegacyInfo() const
|
||||
void AWActions::showLegacyInfo()
|
||||
{
|
||||
QMessageBox *msgBox = new QMessageBox(nullptr);
|
||||
auto *msgBox = new QMessageBox(nullptr);
|
||||
msgBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||
msgBox->setModal(false);
|
||||
msgBox->setWindowTitle(i18n("Not supported"));
|
||||
@ -110,7 +110,7 @@ void AWActions::showLegacyInfo() const
|
||||
|
||||
|
||||
// HACK: this method uses variables from version.h
|
||||
QString AWActions::getAboutText(const QString &_type) const
|
||||
QString AWActions::getAboutText(const QString &_type)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Type" << _type;
|
||||
|
||||
@ -118,7 +118,7 @@ QString AWActions::getAboutText(const QString &_type) const
|
||||
}
|
||||
|
||||
|
||||
QVariantMap AWActions::getFont(const QVariantMap &_defaultFont) const
|
||||
QVariantMap AWActions::getFont(const QVariantMap &_defaultFont)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Default font is" << _defaultFont;
|
||||
|
||||
|
@ -31,16 +31,16 @@ class AWActions : public QObject
|
||||
|
||||
public:
|
||||
explicit AWActions(QObject *_parent = nullptr);
|
||||
virtual ~AWActions();
|
||||
~AWActions() override;
|
||||
Q_INVOKABLE void checkUpdates(const bool _showAnyway = false);
|
||||
Q_INVOKABLE QString getFileContent(const QString &_path) const;
|
||||
Q_INVOKABLE bool isDebugEnabled() const;
|
||||
Q_INVOKABLE bool runCmd(const QString &_cmd) const;
|
||||
Q_INVOKABLE void showLegacyInfo() const;
|
||||
Q_INVOKABLE void showReadme() const;
|
||||
Q_INVOKABLE static QString getFileContent(const QString &_path);
|
||||
Q_INVOKABLE static bool isDebugEnabled();
|
||||
Q_INVOKABLE static bool runCmd(const QString &_cmd);
|
||||
Q_INVOKABLE static void showLegacyInfo();
|
||||
Q_INVOKABLE static void showReadme();
|
||||
// configuration slots
|
||||
Q_INVOKABLE QString getAboutText(const QString &_type) const;
|
||||
Q_INVOKABLE QVariantMap getFont(const QVariantMap &_defaultFont) const;
|
||||
Q_INVOKABLE static QString getAboutText(const QString &_type);
|
||||
Q_INVOKABLE static QVariantMap getFont(const QVariantMap &_defaultFont);
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE static void sendNotification(const QString &_eventId, const QString &_message);
|
||||
|
@ -50,7 +50,7 @@ void AWBugReporter::doConnect()
|
||||
|
||||
|
||||
QString AWBugReporter::generateText(const QString &_description, const QString &_reproduce,
|
||||
const QString &_expected, const QString &_logs) const
|
||||
const QString &_expected, const QString &_logs)
|
||||
{
|
||||
// do not log _logs here, it may have quite large size
|
||||
qCDebug(LOG_AW) << "Generate text with description" << _description << "steps" << _reproduce
|
||||
@ -72,7 +72,7 @@ void AWBugReporter::sendBugReport(const QString &_title, const QString &_body)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Send bug report with title" << _title << "and body" << _body;
|
||||
|
||||
QNetworkAccessManager *manager = new QNetworkAccessManager(nullptr);
|
||||
auto *manager = new QNetworkAccessManager(nullptr);
|
||||
connect(manager, SIGNAL(finished(QNetworkReply *)), this,
|
||||
SLOT(issueReplyRecieved(QNetworkReply *)));
|
||||
|
||||
@ -100,7 +100,7 @@ void AWBugReporter::issueReplyRecieved(QNetworkReply *_reply)
|
||||
return emit(replyReceived(0, ""));
|
||||
}
|
||||
|
||||
QJsonParseError error;
|
||||
QJsonParseError error{};
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(_reply->readAll(), &error);
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qCWarning(LOG_AW) << "Parse error" << error.errorString();
|
||||
@ -124,7 +124,7 @@ void AWBugReporter::showInformation(const int _number, const QString &_url)
|
||||
// cache url first
|
||||
m_lastBugUrl = _url;
|
||||
|
||||
QMessageBox *msgBox = new QMessageBox(nullptr);
|
||||
auto *msgBox = new QMessageBox(nullptr);
|
||||
msgBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||
msgBox->setModal(false);
|
||||
msgBox->setWindowTitle(i18n("Issue created"));
|
||||
@ -138,7 +138,7 @@ void AWBugReporter::showInformation(const int _number, const QString &_url)
|
||||
|
||||
void AWBugReporter::userReplyOnBugReport(QAbstractButton *_button)
|
||||
{
|
||||
QMessageBox::ButtonRole ret = static_cast<QMessageBox *>(sender())->buttonRole(_button);
|
||||
QMessageBox::ButtonRole ret = dynamic_cast<QMessageBox *>(sender())->buttonRole(_button);
|
||||
qCInfo(LOG_AW) << "User select" << ret;
|
||||
|
||||
switch (ret) {
|
||||
|
@ -31,10 +31,10 @@ class AWBugReporter : public QObject
|
||||
|
||||
public:
|
||||
explicit AWBugReporter(QObject *_parent = nullptr);
|
||||
virtual ~AWBugReporter();
|
||||
~AWBugReporter() override;
|
||||
Q_INVOKABLE void doConnect();
|
||||
Q_INVOKABLE QString generateText(const QString &_description, const QString &_reproduce,
|
||||
const QString &_expected, const QString &_logs) const;
|
||||
Q_INVOKABLE static QString generateText(const QString &_description, const QString &_reproduce,
|
||||
const QString &_expected, const QString &_logs);
|
||||
Q_INVOKABLE void sendBugReport(const QString &_title, const QString &_body);
|
||||
|
||||
signals:
|
||||
|
@ -17,8 +17,6 @@
|
||||
|
||||
#include "awconfighelper.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDir>
|
||||
#include <QQmlPropertyMap>
|
||||
#include <QSettings>
|
||||
@ -62,7 +60,7 @@ QString AWConfigHelper::configurationDirectory() const
|
||||
}
|
||||
|
||||
|
||||
bool AWConfigHelper::dropCache() const
|
||||
bool AWConfigHelper::dropCache()
|
||||
{
|
||||
QString fileName
|
||||
= QString("%1/awesomewidgets.ndx")
|
||||
@ -78,7 +76,7 @@ bool AWConfigHelper::exportConfiguration(QObject *_nativeConfig, const QString &
|
||||
|
||||
QSettings settings(_fileName, QSettings::IniFormat);
|
||||
// plasmoid configuration
|
||||
const QQmlPropertyMap *configuration = static_cast<const QQmlPropertyMap *>(_nativeConfig);
|
||||
const auto *configuration = dynamic_cast<const QQmlPropertyMap *>(_nativeConfig);
|
||||
settings.beginGroup("plasmoid");
|
||||
for (auto &key : configuration->keys()) {
|
||||
QVariant value = configuration->value(key);
|
||||
@ -173,7 +171,7 @@ QVariantMap AWConfigHelper::importConfiguration(const QString &_fileName,
|
||||
}
|
||||
|
||||
|
||||
QVariantMap AWConfigHelper::readDataEngineConfiguration() const
|
||||
QVariantMap AWConfigHelper::readDataEngineConfiguration()
|
||||
{
|
||||
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation,
|
||||
"plasma-dataengine-extsysmon.conf");
|
||||
@ -199,7 +197,7 @@ QVariantMap AWConfigHelper::readDataEngineConfiguration() const
|
||||
}
|
||||
|
||||
|
||||
bool AWConfigHelper::writeDataEngineConfiguration(const QVariantMap &_configuration) const
|
||||
bool AWConfigHelper::writeDataEngineConfiguration(const QVariantMap &_configuration)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Configuration" << _configuration;
|
||||
|
||||
@ -226,7 +224,7 @@ bool AWConfigHelper::writeDataEngineConfiguration(const QVariantMap &_configurat
|
||||
}
|
||||
|
||||
|
||||
void AWConfigHelper::copyConfigs(const QString &_localDir) const
|
||||
void AWConfigHelper::copyConfigs(const QString &_localDir)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Local directory" << _localDir;
|
||||
|
||||
@ -268,15 +266,14 @@ void AWConfigHelper::copyExtensions(const QString &_item, const QString &_type,
|
||||
}
|
||||
|
||||
|
||||
void AWConfigHelper::copySettings(QSettings &_from, QSettings &_to) const
|
||||
void AWConfigHelper::copySettings(QSettings &_from, QSettings &_to)
|
||||
{
|
||||
for (auto &key : _from.childKeys())
|
||||
_to.setValue(key, _from.value(key));
|
||||
}
|
||||
|
||||
|
||||
void AWConfigHelper::readFile(QSettings &_settings, const QString &_key,
|
||||
const QString &_fileName) const
|
||||
void AWConfigHelper::readFile(QSettings &_settings, const QString &_key, const QString &_fileName)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Key" << _key << "from file" << _fileName;
|
||||
|
||||
@ -291,8 +288,7 @@ void AWConfigHelper::readFile(QSettings &_settings, const QString &_key,
|
||||
}
|
||||
|
||||
|
||||
void AWConfigHelper::writeFile(QSettings &_settings, const QString &_key,
|
||||
const QString &_fileName) const
|
||||
void AWConfigHelper::writeFile(QSettings &_settings, const QString &_key, const QString &_fileName)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Key" << _key << "to file" << _fileName;
|
||||
|
||||
|
@ -31,26 +31,26 @@ class AWConfigHelper : public QObject
|
||||
|
||||
public:
|
||||
explicit AWConfigHelper(QObject *_parent = nullptr);
|
||||
virtual ~AWConfigHelper();
|
||||
~AWConfigHelper() override;
|
||||
Q_INVOKABLE QString configurationDirectory() const;
|
||||
Q_INVOKABLE bool dropCache() const;
|
||||
Q_INVOKABLE static bool dropCache();
|
||||
Q_INVOKABLE bool exportConfiguration(QObject *_nativeConfig, const QString &_fileName) const;
|
||||
Q_INVOKABLE QVariantMap importConfiguration(const QString &_fileName,
|
||||
const bool _importPlasmoid,
|
||||
const bool _importExtensions,
|
||||
const bool _importAdds) const;
|
||||
// dataengine
|
||||
Q_INVOKABLE QVariantMap readDataEngineConfiguration() const;
|
||||
Q_INVOKABLE bool writeDataEngineConfiguration(const QVariantMap &_configuration) const;
|
||||
Q_INVOKABLE static QVariantMap readDataEngineConfiguration();
|
||||
Q_INVOKABLE static bool writeDataEngineConfiguration(const QVariantMap &_configuration);
|
||||
|
||||
private:
|
||||
// methods
|
||||
void copyConfigs(const QString &_localDir) const;
|
||||
static void copyConfigs(const QString &_localDir);
|
||||
void copyExtensions(const QString &_item, const QString &_type, QSettings &_settings,
|
||||
const bool _inverse) const;
|
||||
void copySettings(QSettings &_from, QSettings &_to) const;
|
||||
void readFile(QSettings &_settings, const QString &_key, const QString &_fileName) const;
|
||||
void writeFile(QSettings &_settings, const QString &_key, const QString &_fileName) const;
|
||||
static void copySettings(QSettings &_from, QSettings &_to);
|
||||
static void readFile(QSettings &_settings, const QString &_key, const QString &_fileName);
|
||||
static void writeFile(QSettings &_settings, const QString &_key, const QString &_fileName);
|
||||
// properties
|
||||
QString m_baseDir;
|
||||
QStringList m_dirs = {"desktops", "quotes", "scripts", "upgrade", "weather", "formatters"};
|
||||
|
@ -29,7 +29,7 @@ class AWCustomKeysConfig : public AWAbstractPairConfig
|
||||
public:
|
||||
explicit AWCustomKeysConfig(QWidget *_parent = nullptr,
|
||||
const QStringList &_keys = QStringList());
|
||||
virtual ~AWCustomKeysConfig();
|
||||
~AWCustomKeysConfig() override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -30,15 +30,15 @@ class AWCustomKeysHelper : public QObject, public AWAbstractPairHelper
|
||||
|
||||
public:
|
||||
explicit AWCustomKeysHelper(QObject *_parent = nullptr);
|
||||
virtual ~AWCustomKeysHelper();
|
||||
~AWCustomKeysHelper() override;
|
||||
// get
|
||||
QString source(const QString &_key) const;
|
||||
QStringList sources() const;
|
||||
QStringList refinedSources() const;
|
||||
// configuration related
|
||||
virtual void editPairs(){};
|
||||
virtual QStringList leftKeys();
|
||||
virtual QStringList rightKeys();
|
||||
void editPairs() override{};
|
||||
QStringList leftKeys() override;
|
||||
QStringList rightKeys() override;
|
||||
|
||||
private:
|
||||
};
|
||||
|
@ -54,7 +54,7 @@ AWDataAggregator::~AWDataAggregator()
|
||||
}
|
||||
|
||||
|
||||
QString AWDataAggregator::htmlImage(const QPixmap &_source) const
|
||||
QString AWDataAggregator::htmlImage(const QPixmap &_source)
|
||||
{
|
||||
QByteArray byteArray;
|
||||
QBuffer buffer(&byteArray);
|
||||
@ -195,7 +195,7 @@ void AWDataAggregator::initScene()
|
||||
}
|
||||
|
||||
|
||||
QString AWDataAggregator::notificationText(const QString &_source, const float _value) const
|
||||
QString AWDataAggregator::notificationText(const QString &_source, const float _value)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Notification source" << _source << "with value" << _value;
|
||||
|
||||
@ -215,7 +215,7 @@ QString AWDataAggregator::notificationText(const QString &_source, const float _
|
||||
}
|
||||
|
||||
|
||||
QString AWDataAggregator::notificationText(const QString &_source, const QString &_value) const
|
||||
QString AWDataAggregator::notificationText(const QString &_source, const QString &_value)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Notification source" << _source << "with value" << _value;
|
||||
|
||||
@ -246,10 +246,7 @@ void AWDataAggregator::setData(const QVariantHash &_values)
|
||||
m_currentNetworkDevice = value;
|
||||
}(_values["netdev"].toString());
|
||||
// additional check for GPU load
|
||||
[this](const float value) {
|
||||
checkValue("gpu", value, 90.0);
|
||||
m_currentGPULoad = value;
|
||||
}(_values["gpu"].toFloat());
|
||||
[this](const float value) { checkValue("gpu", value, 90.0); }(_values["gpu"].toFloat());
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,8 +34,8 @@ class AWDataAggregator : public QObject
|
||||
|
||||
public:
|
||||
explicit AWDataAggregator(QObject *_parent = nullptr);
|
||||
virtual ~AWDataAggregator();
|
||||
QString htmlImage(const QPixmap &_source) const;
|
||||
~AWDataAggregator() override;
|
||||
static QString htmlImage(const QPixmap &_source);
|
||||
void setParameters(const QVariantMap &_settings);
|
||||
QPixmap tooltipImage();
|
||||
|
||||
@ -53,8 +53,8 @@ private:
|
||||
void checkValue(const QString &_source, const QString &_current,
|
||||
const QString &_received) const;
|
||||
void initScene();
|
||||
QString notificationText(const QString &_source, const float _value) const;
|
||||
QString notificationText(const QString &_source, const QString &_value) const;
|
||||
static QString notificationText(const QString &_source, const float _value);
|
||||
static QString notificationText(const QString &_source, const QString &_value);
|
||||
// main method
|
||||
void setData(const QVariantHash &_values);
|
||||
void setData(const QString &_source, float _value, const float _extremum = -1.0f);
|
||||
@ -63,7 +63,6 @@ private:
|
||||
// variables
|
||||
int m_counts = 0;
|
||||
QVariantHash m_configuration;
|
||||
float m_currentGPULoad = 0.0f;
|
||||
QString m_currentNetworkDevice = "lo";
|
||||
QHash<QString, float> m_boundaries;
|
||||
QHash<QString, QList<float>> m_values;
|
||||
|
@ -69,16 +69,16 @@ void AWDataEngineAggregator::reconnectSources(const int _interval)
|
||||
|
||||
disconnectSources();
|
||||
|
||||
m_dataEngines["systemmonitor"]->connectAllSources(parent(), _interval);
|
||||
m_dataEngines["extsysmon"]->connectAllSources(parent(), _interval);
|
||||
m_dataEngines["systemmonitor"]->connectAllSources(parent(), (uint)_interval);
|
||||
m_dataEngines["extsysmon"]->connectAllSources(parent(), (uint)_interval);
|
||||
m_dataEngines["time"]->connectSource("Local", parent(), 1000);
|
||||
|
||||
m_newSourceConnection
|
||||
= connect(m_dataEngines["systemmonitor"], &Plasma::DataEngine::sourceAdded,
|
||||
[this, _interval](const QString source) {
|
||||
emit(deviceAdded(source));
|
||||
m_dataEngines["systemmonitor"]->connectSource(source, parent(), _interval);
|
||||
});
|
||||
m_newSourceConnection = connect(
|
||||
m_dataEngines["systemmonitor"], &Plasma::DataEngine::sourceAdded,
|
||||
[this, _interval](const QString source) {
|
||||
emit(deviceAdded(source));
|
||||
m_dataEngines["systemmonitor"]->connectSource(source, parent(), (uint)_interval);
|
||||
});
|
||||
|
||||
#ifdef BUILD_FUTURE
|
||||
createQueuedConnection();
|
||||
|
@ -31,7 +31,7 @@ class AWDataEngineAggregator : public QObject
|
||||
|
||||
public:
|
||||
explicit AWDataEngineAggregator(QObject *_parent = nullptr);
|
||||
virtual ~AWDataEngineAggregator();
|
||||
~AWDataEngineAggregator() override;
|
||||
void disconnectSources();
|
||||
void reconnectSources(const int _interval);
|
||||
|
||||
|
@ -33,7 +33,7 @@ class AWDataEngineMapper : public QObject
|
||||
|
||||
public:
|
||||
explicit AWDataEngineMapper(QObject *_parent = nullptr, AWFormatterHelper *_custom = nullptr);
|
||||
virtual ~AWDataEngineMapper();
|
||||
~AWDataEngineMapper() override;
|
||||
// get methods
|
||||
AWKeysAggregator::FormatterType formatter(const QString &_key) const;
|
||||
QStringList keysFromSource(const QString &_source) const;
|
||||
|
@ -33,7 +33,7 @@ class AWDBusAdaptor : public QDBusAbstractAdaptor
|
||||
|
||||
public:
|
||||
explicit AWDBusAdaptor(AWKeys *_parent = nullptr);
|
||||
virtual ~AWDBusAdaptor();
|
||||
~AWDBusAdaptor() override;
|
||||
|
||||
public slots:
|
||||
// get methods
|
||||
|
@ -28,7 +28,7 @@ class AWPlugin : public QQmlExtensionPlugin
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
|
||||
|
||||
public:
|
||||
void registerTypes(const char *uri);
|
||||
void registerTypes(const char *uri) override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@ class AWFormatterConfig : public AWAbstractPairConfig
|
||||
public:
|
||||
explicit AWFormatterConfig(QWidget *_parent = nullptr,
|
||||
const QStringList &_keys = QStringList());
|
||||
virtual ~AWFormatterConfig();
|
||||
~AWFormatterConfig() override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -122,7 +122,7 @@ void AWFormatterHelper::editItems()
|
||||
|
||||
|
||||
AWAbstractFormatter::FormatterClass
|
||||
AWFormatterHelper::defineFormatterClass(const QString &_stringType) const
|
||||
AWFormatterHelper::defineFormatterClass(const QString &_stringType)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Define formatter class for" << _stringType;
|
||||
|
||||
|
@ -30,29 +30,29 @@ class AWFormatterHelper : public AbstractExtItemAggregator, public AWAbstractPai
|
||||
|
||||
public:
|
||||
explicit AWFormatterHelper(QWidget *_parent = nullptr);
|
||||
virtual ~AWFormatterHelper();
|
||||
~AWFormatterHelper() override;
|
||||
// read-write methods
|
||||
void initItems();
|
||||
void initItems() override;
|
||||
// methods
|
||||
QString convert(const QVariant &_value, const QString &_name) const;
|
||||
QStringList definedFormatters() const;
|
||||
QList<AbstractExtItem *> items() const;
|
||||
QList<AbstractExtItem *> items() const override;
|
||||
// configuration related
|
||||
virtual void editPairs();
|
||||
virtual QStringList leftKeys();
|
||||
virtual QStringList rightKeys();
|
||||
void editPairs() override;
|
||||
QStringList leftKeys() override;
|
||||
QStringList rightKeys() override;
|
||||
|
||||
public slots:
|
||||
void editItems();
|
||||
|
||||
private:
|
||||
// methods
|
||||
AWAbstractFormatter::FormatterClass defineFormatterClass(const QString &_stringType) const;
|
||||
static AWAbstractFormatter::FormatterClass defineFormatterClass(const QString &_stringType);
|
||||
void initFormatters();
|
||||
QPair<QString, AWAbstractFormatter::FormatterClass>
|
||||
readMetadata(const QString &_filePath) const;
|
||||
// parent methods
|
||||
void doCreateItem();
|
||||
void doCreateItem() override;
|
||||
// properties
|
||||
QHash<QString, AWAbstractFormatter *> m_formatters;
|
||||
QHash<QString, AWAbstractFormatter *> m_formattersClasses;
|
||||
|
@ -15,6 +15,7 @@
|
||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "awkeycache.h"
|
||||
|
||||
#include <QDir>
|
||||
|
@ -31,7 +31,7 @@ QStringList getRequiredKeys(const QStringList &_keys, const QStringList &_bars,
|
||||
const QVariantMap &_tooltip, const QStringList &_userKeys,
|
||||
const QStringList &_allKeys);
|
||||
QHash<QString, QStringList> loadKeysFromCache();
|
||||
};
|
||||
} // namespace AWKeyCache
|
||||
|
||||
|
||||
#endif /* AWKEYCACHE_H */
|
||||
|
@ -39,7 +39,7 @@ class AWKeyOperations : public QObject
|
||||
|
||||
public:
|
||||
explicit AWKeyOperations(QObject *_parent = nullptr);
|
||||
virtual ~AWKeyOperations();
|
||||
~AWKeyOperations() override;
|
||||
QStringList devices(const QString &_type) const;
|
||||
QHash<QString, QStringList> devices() const;
|
||||
void updateCache();
|
||||
|
@ -345,10 +345,9 @@ QString AWKeys::parsePattern(QString _pattern) const
|
||||
// bars
|
||||
for (auto &bar : m_foundBars) {
|
||||
GraphicalItem *item = m_keyOperator->giByKey(bar);
|
||||
QString image = item->isCustom()
|
||||
? item->image(AWPatternFunctions::expandLambdas(
|
||||
item->bar(), m_aggregator, m_values, item->usedKeys()))
|
||||
: item->image(m_values[item->bar()]);
|
||||
QString image = item->isCustom() ? item->image(AWPatternFunctions::expandLambdas(
|
||||
item->bar(), m_aggregator, m_values, item->usedKeys()))
|
||||
: item->image(m_values[item->bar()]);
|
||||
_pattern.replace(QString("$%1").arg(bar), image);
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ class AWKeys : public QObject
|
||||
|
||||
public:
|
||||
explicit AWKeys(QObject *_parent = nullptr);
|
||||
virtual ~AWKeys();
|
||||
~AWKeys() override;
|
||||
Q_INVOKABLE void initDataAggregator(const QVariantMap &_tooltipParams);
|
||||
Q_INVOKABLE void initKeys(const QString &_currentPattern, const int _interval, const int _limit,
|
||||
const bool _optimize);
|
||||
@ -59,7 +59,7 @@ public:
|
||||
public slots:
|
||||
void dataUpdated(const QString &_sourceName, const Plasma::DataEngine::Data &_data);
|
||||
// dummy method required by DataEngine connections
|
||||
void modelChanged(QString, QAbstractItemModel *){};
|
||||
static void modelChanged(QString, QAbstractItemModel *){};
|
||||
|
||||
signals:
|
||||
void dropSourceFromDataengine(const QString &_source);
|
||||
|
@ -117,7 +117,7 @@ QString AWKeysAggregator::formatter(const QVariant &_data, const QString &_key)
|
||||
break;
|
||||
case FormatterType::TimeCustom:
|
||||
output = m_customTime;
|
||||
[&output, loc, this](const QDateTime dt) {
|
||||
[&output, loc, this](const QDateTime &dt) {
|
||||
for (auto &key : m_timeKeys)
|
||||
output.replace(QString("$%1").arg(key), loc.toString(dt, key));
|
||||
}(_data.toDateTime());
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
};
|
||||
|
||||
explicit AWKeysAggregator(QObject *_parent = nullptr);
|
||||
virtual ~AWKeysAggregator();
|
||||
~AWKeysAggregator() override;
|
||||
void initFormatters();
|
||||
// get methods
|
||||
QString formatter(const QVariant &_data, const QString &_key) const;
|
||||
|
@ -37,7 +37,7 @@ AWPairConfigFactory::~AWPairConfigFactory()
|
||||
|
||||
void AWPairConfigFactory::showFormatterDialog(const QStringList &_keys)
|
||||
{
|
||||
AWFormatterConfig *config = new AWFormatterConfig(nullptr, _keys);
|
||||
auto *config = new AWFormatterConfig(nullptr, _keys);
|
||||
config->showDialog();
|
||||
config->deleteLater();
|
||||
}
|
||||
@ -45,7 +45,7 @@ void AWPairConfigFactory::showFormatterDialog(const QStringList &_keys)
|
||||
|
||||
void AWPairConfigFactory::showKeysDialog(const QStringList &_keys)
|
||||
{
|
||||
AWCustomKeysConfig *config = new AWCustomKeysConfig(nullptr, _keys);
|
||||
auto *config = new AWCustomKeysConfig(nullptr, _keys);
|
||||
config->showDialog();
|
||||
config->deleteLater();
|
||||
}
|
||||
|
@ -28,9 +28,9 @@ class AWPairConfigFactory : public QObject
|
||||
|
||||
public:
|
||||
explicit AWPairConfigFactory(QObject *_parent = nullptr);
|
||||
virtual ~AWPairConfigFactory();
|
||||
Q_INVOKABLE void showFormatterDialog(const QStringList &_keys);
|
||||
Q_INVOKABLE void showKeysDialog(const QStringList &_keys);
|
||||
~AWPairConfigFactory() override;
|
||||
Q_INVOKABLE static void showFormatterDialog(const QStringList &_keys);
|
||||
Q_INVOKABLE static void showKeysDialog(const QStringList &_keys);
|
||||
|
||||
private:
|
||||
};
|
||||
|
@ -54,7 +54,7 @@ QString AWPatternFunctions::expandTemplates(QString _code)
|
||||
qCDebug(LOG_AW) << "Expand templates in" << _code;
|
||||
|
||||
// match the following construction $template{{some code here}}
|
||||
QRegularExpression templatesRegexp("\\$template\\{\\{(?<body>.*?)\\}\\}");
|
||||
QRegularExpression templatesRegexp(R"(\$template\{\{(?<body>.*?)\}\})");
|
||||
templatesRegexp.setPatternOptions(QRegularExpression::DotMatchesEverythingOption);
|
||||
|
||||
QRegularExpressionMatchIterator it = templatesRegexp.globalMatch(_code);
|
||||
@ -92,8 +92,7 @@ AWPatternFunctions::findFunctionCalls(const QString &_function, const QString &_
|
||||
// in this field if they are not screened by $, i.e. '$,'
|
||||
// * body depends on the function name, double brackets should be screened
|
||||
// by using $, e.g. ${
|
||||
QRegularExpression regex(
|
||||
QString("\\$%1\\<(?<args>.*?)\\>\\{\\{(?<body>.*?)\\}\\}").arg(_function));
|
||||
QRegularExpression regex(QString(R"(\$%1\<(?<args>.*?)\>\{\{(?<body>.*?)\}\})").arg(_function));
|
||||
regex.setPatternOptions(QRegularExpression::DotMatchesEverythingOption);
|
||||
|
||||
QList<AWPatternFunctions::AWFunction> foundFunctions;
|
||||
@ -266,7 +265,7 @@ QStringList AWPatternFunctions::findLambdas(const QString &_code)
|
||||
|
||||
QStringList selectedKeys;
|
||||
// match the following construction ${{some code here}}
|
||||
QRegularExpression lambdaRegexp("\\$\\{\\{(?<body>.*?)\\}\\}");
|
||||
QRegularExpression lambdaRegexp(R"(\$\{\{(?<body>.*?)\}\})");
|
||||
lambdaRegexp.setPatternOptions(QRegularExpression::DotMatchesEverythingOption);
|
||||
|
||||
QRegularExpressionMatchIterator it = lambdaRegexp.globalMatch(_code);
|
||||
|
@ -46,7 +46,7 @@ QString insertMacros(QString _code);
|
||||
// find methods
|
||||
QStringList findKeys(const QString &_code, const QStringList &_keys, const bool _isBars);
|
||||
QStringList findLambdas(const QString &_code);
|
||||
};
|
||||
} // namespace AWPatternFunctions
|
||||
|
||||
|
||||
#endif /* AWPATTERNFUNCTIONS_H */
|
||||
|
@ -126,7 +126,7 @@ void AWTelemetryHandler::uploadTelemetry(const QString &_group, const QString &_
|
||||
return;
|
||||
}
|
||||
|
||||
QNetworkAccessManager *manager = new QNetworkAccessManager(nullptr);
|
||||
auto *manager = new QNetworkAccessManager(nullptr);
|
||||
connect(manager, SIGNAL(finished(QNetworkReply *)), this,
|
||||
SLOT(telemetryReplyRecieved(QNetworkReply *)));
|
||||
|
||||
@ -156,7 +156,7 @@ void AWTelemetryHandler::telemetryReplyRecieved(QNetworkReply *_reply)
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonParseError error;
|
||||
QJsonParseError error{};
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(_reply->readAll(), &error);
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qCWarning(LOG_AW) << "Parse error" << error.errorString();
|
||||
@ -173,7 +173,7 @@ void AWTelemetryHandler::telemetryReplyRecieved(QNetworkReply *_reply)
|
||||
}
|
||||
|
||||
|
||||
QString AWTelemetryHandler::getKey(const int _count) const
|
||||
QString AWTelemetryHandler::getKey(const int _count)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Get key for keys count" << _count;
|
||||
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
const char *REMOTE_TELEMETRY_URL = "https://arcanis.me/telemetry";
|
||||
|
||||
explicit AWTelemetryHandler(QObject *_parent = nullptr, const QString &_clientId = "");
|
||||
virtual ~AWTelemetryHandler();
|
||||
~AWTelemetryHandler() override;
|
||||
Q_INVOKABLE QStringList get(const QString &_group) const;
|
||||
Q_INVOKABLE QString getLast(const QString &_group) const;
|
||||
Q_INVOKABLE void init(const int _count, const bool _enableRemote, const QString &_clientId);
|
||||
@ -46,7 +46,7 @@ private slots:
|
||||
void telemetryReplyRecieved(QNetworkReply *_reply);
|
||||
|
||||
private:
|
||||
QString getKey(const int _count) const;
|
||||
static QString getKey(const int _count);
|
||||
QString m_clientId;
|
||||
QString m_localFile;
|
||||
int m_storeCount = 0;
|
||||
|
@ -52,7 +52,7 @@ void AWUpdateHelper::checkUpdates(const bool _showAnyway)
|
||||
|
||||
// showAnyway options requires to show message if no updates found on direct
|
||||
// request. In case of automatic check no message will be shown
|
||||
QNetworkAccessManager *manager = new QNetworkAccessManager(nullptr);
|
||||
auto *manager = new QNetworkAccessManager(nullptr);
|
||||
connect(manager, &QNetworkAccessManager::finished, [_showAnyway, this](QNetworkReply *reply) {
|
||||
return versionReplyRecieved(reply, _showAnyway);
|
||||
});
|
||||
@ -72,7 +72,7 @@ bool AWUpdateHelper::checkVersion()
|
||||
qCInfo(LOG_AW) << "Found version" << version << "actual one is" << m_foundVersion;
|
||||
|
||||
if ((version != m_foundVersion) && (!QString(CHANGELOG).isEmpty())) {
|
||||
genMessageBox(i18n("Changelog of %1", VERSION), QString(CHANGELOG).replace('@', '\n'),
|
||||
genMessageBox(i18nc("Changelog of %1", VERSION), QString(CHANGELOG).replace('@', '\n'),
|
||||
QMessageBox::Ok)
|
||||
->open();
|
||||
return true;
|
||||
@ -103,7 +103,7 @@ void AWUpdateHelper::showUpdates(const QVersionNumber &_version)
|
||||
qCDebug(LOG_AW) << "Version" << _version;
|
||||
|
||||
QString text;
|
||||
text += i18n("Current version : %1", VERSION);
|
||||
text += i18nc("Current version : %1", VERSION);
|
||||
text += QString(COMMIT_SHA).isEmpty() ? "\n" : QString(" (%1)\n").arg(QString(COMMIT_SHA));
|
||||
text += i18n("New version : %1", _version.toString()) + "\n\n";
|
||||
text += i18n("Click \"Ok\" to download");
|
||||
@ -115,7 +115,7 @@ void AWUpdateHelper::showUpdates(const QVersionNumber &_version)
|
||||
|
||||
void AWUpdateHelper::userReplyOnUpdates(QAbstractButton *_button)
|
||||
{
|
||||
QMessageBox::ButtonRole ret = static_cast<QMessageBox *>(sender())->buttonRole(_button);
|
||||
QMessageBox::ButtonRole ret = dynamic_cast<QMessageBox *>(sender())->buttonRole(_button);
|
||||
qCInfo(LOG_AW) << "User select" << ret;
|
||||
|
||||
switch (ret) {
|
||||
@ -138,7 +138,7 @@ void AWUpdateHelper::versionReplyRecieved(QNetworkReply *_reply, const bool _sho
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonParseError error;
|
||||
QJsonParseError error = QJsonParseError();
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(_reply->readAll(), &error);
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qCWarning(LOG_AW) << "Parse error" << error.errorString();
|
||||
@ -167,7 +167,7 @@ QMessageBox *AWUpdateHelper::genMessageBox(const QString &_title, const QString
|
||||
{
|
||||
qCDebug(LOG_AW) << "Construct message box with title" << _title << "and body" << _body;
|
||||
|
||||
QMessageBox *msgBox = new QMessageBox(nullptr);
|
||||
auto *msgBox = new QMessageBox(nullptr);
|
||||
msgBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||
msgBox->setModal(false);
|
||||
msgBox->setWindowTitle(_title);
|
||||
|
@ -32,19 +32,19 @@ class AWUpdateHelper : public QObject
|
||||
|
||||
public:
|
||||
explicit AWUpdateHelper(QObject *_parent = nullptr);
|
||||
virtual ~AWUpdateHelper();
|
||||
~AWUpdateHelper() override;
|
||||
void checkUpdates(const bool _showAnyway = false);
|
||||
bool checkVersion();
|
||||
|
||||
private slots:
|
||||
void showInfo(const QVersionNumber &_version);
|
||||
static void showInfo(const QVersionNumber &_version);
|
||||
void showUpdates(const QVersionNumber &_version);
|
||||
void userReplyOnUpdates(QAbstractButton *_button);
|
||||
void versionReplyRecieved(QNetworkReply *_reply, const bool _showAnyway);
|
||||
|
||||
private:
|
||||
QMessageBox *genMessageBox(const QString &_title, const QString &_body,
|
||||
const QMessageBox::StandardButtons _buttons);
|
||||
static QMessageBox *genMessageBox(const QString &_title, const QString &_body,
|
||||
const QMessageBox::StandardButtons _buttons);
|
||||
QVersionNumber m_foundVersion;
|
||||
QString m_genericConfig;
|
||||
};
|
||||
|
@ -45,7 +45,7 @@ AbstractExtItem::~AbstractExtItem()
|
||||
|
||||
if (m_socket) {
|
||||
m_socket->close();
|
||||
m_socket->removeServer(socket());
|
||||
QLocalServer::removeServer(socket());
|
||||
m_socket->deleteLater();
|
||||
}
|
||||
}
|
||||
@ -270,7 +270,7 @@ void AbstractExtItem::deinitSocket()
|
||||
return;
|
||||
|
||||
m_socket->close();
|
||||
m_socket->removeServer(socket());
|
||||
QLocalServer::removeServer(socket());
|
||||
delete m_socket;
|
||||
disconnect(m_socket, SIGNAL(newConnection()), this, SLOT(newConnectionReceived()));
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class AbstractExtItem : public QDialog
|
||||
|
||||
public:
|
||||
explicit AbstractExtItem(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AbstractExtItem();
|
||||
~AbstractExtItem() override;
|
||||
virtual void bumpApi(const int _newVer);
|
||||
virtual AbstractExtItem *copy(const QString &_fileName, const int _number) = 0;
|
||||
virtual void copyDefaults(AbstractExtItem *_other) const;
|
||||
|
@ -23,12 +23,13 @@
|
||||
#include <QDir>
|
||||
#include <QInputDialog>
|
||||
#include <QPushButton>
|
||||
#include <utility>
|
||||
|
||||
|
||||
AbstractExtItemAggregator::AbstractExtItemAggregator(QWidget *_parent, const QString &_type)
|
||||
AbstractExtItemAggregator::AbstractExtItemAggregator(QWidget *_parent, QString _type)
|
||||
: QDialog(_parent)
|
||||
, ui(new Ui::AbstractExtItemAggregator)
|
||||
, m_type(_type)
|
||||
, m_type(std::move(_type))
|
||||
{
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
@ -90,7 +91,7 @@ void AbstractExtItemAggregator::deleteItem()
|
||||
if (!source) {
|
||||
qCWarning(LOG_LIB) << "Nothing to delete";
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
if (source->tryDelete()) {
|
||||
initItems();
|
||||
@ -105,7 +106,7 @@ void AbstractExtItemAggregator::editItem()
|
||||
if (!source) {
|
||||
qCWarning(LOG_LIB) << "Nothing to edit";
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
if (source->showConfiguration(configArgs()) == 1) {
|
||||
initItems();
|
||||
@ -154,7 +155,7 @@ void AbstractExtItemAggregator::repaintList()
|
||||
ui->listWidget->clear();
|
||||
for (auto &_item : items()) {
|
||||
QString fileName = QFileInfo(_item->fileName()).fileName();
|
||||
QListWidgetItem *item = new QListWidgetItem(fileName, ui->listWidget);
|
||||
auto *item = new QListWidgetItem(fileName, ui->listWidget);
|
||||
QStringList tooltip;
|
||||
tooltip.append(i18n("Name: %1", _item->name()));
|
||||
tooltip.append(i18n("Comment: %1", _item->comment()));
|
||||
@ -216,11 +217,11 @@ void AbstractExtItemAggregator::editItemActivated(QListWidgetItem *)
|
||||
|
||||
void AbstractExtItemAggregator::editItemButtonPressed(QAbstractButton *_button)
|
||||
{
|
||||
if (static_cast<QPushButton *>(_button) == copyButton)
|
||||
if (dynamic_cast<QPushButton *>(_button) == copyButton)
|
||||
return copyItem();
|
||||
else if (static_cast<QPushButton *>(_button) == createButton)
|
||||
else if (dynamic_cast<QPushButton *>(_button) == createButton)
|
||||
return doCreateItem();
|
||||
else if (static_cast<QPushButton *>(_button) == deleteButton)
|
||||
else if (dynamic_cast<QPushButton *>(_button) == deleteButton)
|
||||
return deleteItem();
|
||||
else if (ui->buttonBox->buttonRole(_button) == QDialogButtonBox::AcceptRole)
|
||||
return editItem();
|
||||
|
@ -39,8 +39,8 @@ class AbstractExtItemAggregator : public QDialog
|
||||
Q_PROPERTY(QVariant type READ type)
|
||||
|
||||
public:
|
||||
explicit AbstractExtItemAggregator(QWidget *_parent, const QString &_type);
|
||||
virtual ~AbstractExtItemAggregator();
|
||||
explicit AbstractExtItemAggregator(QWidget *_parent, QString _type);
|
||||
~AbstractExtItemAggregator() override;
|
||||
// methods
|
||||
void copyItem();
|
||||
template <class T> void createItem()
|
||||
@ -54,7 +54,7 @@ public:
|
||||
if (fileName.isEmpty()) {
|
||||
qCWarning(LOG_LIB) << "Nothing to create";
|
||||
return;
|
||||
};
|
||||
}
|
||||
QString filePath = QString("%1/%2").arg(dir).arg(fileName);
|
||||
|
||||
T *newItem = new T(this, filePath);
|
||||
@ -62,7 +62,7 @@ public:
|
||||
if (newItem->showConfiguration(configArgs()) == 1) {
|
||||
initItems();
|
||||
repaintList();
|
||||
};
|
||||
}
|
||||
};
|
||||
void deleteItem();
|
||||
void editItem();
|
||||
|
@ -31,12 +31,12 @@ class AbstractQuotesProvider : public QObject
|
||||
public:
|
||||
explicit AbstractQuotesProvider(QObject *_parent)
|
||||
: QObject(_parent){};
|
||||
virtual ~AbstractQuotesProvider(){};
|
||||
~AbstractQuotesProvider() override = default;
|
||||
virtual void initUrl(const QString &_asset) = 0;
|
||||
virtual QVariantHash parse(const QByteArray &_source, const QVariantHash &_oldValues) const = 0;
|
||||
QString tag(const QString &_type) const
|
||||
{
|
||||
return static_cast<AbstractExtItem *>(parent())->tag(_type);
|
||||
return dynamic_cast<AbstractExtItem *>(parent())->tag(_type);
|
||||
};
|
||||
virtual QUrl url() const = 0;
|
||||
};
|
||||
|
@ -31,12 +31,12 @@ class AbstractWeatherProvider : public QObject
|
||||
public:
|
||||
explicit AbstractWeatherProvider(QObject *_parent)
|
||||
: QObject(_parent){};
|
||||
virtual ~AbstractWeatherProvider(){};
|
||||
~AbstractWeatherProvider() override = default;
|
||||
virtual void initUrl(const QString &_city, const QString &_country, const int _ts) = 0;
|
||||
virtual QVariantHash parse(const QVariantMap &_json) const = 0;
|
||||
QString tag(const QString &_type) const
|
||||
{
|
||||
return static_cast<AbstractExtItem *>(parent())->tag(_type);
|
||||
return dynamic_cast<AbstractExtItem *>(parent())->tag(_type);
|
||||
};
|
||||
virtual QUrl url() const = 0;
|
||||
};
|
||||
|
@ -39,7 +39,7 @@ void AWAbstractFormatter::copyDefaults(AbstractExtItem *_other) const
|
||||
{
|
||||
AbstractExtItem::copyDefaults(_other);
|
||||
|
||||
static_cast<AWAbstractFormatter *>(_other)->setType(type());
|
||||
dynamic_cast<AWAbstractFormatter *>(_other)->setType(type());
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,10 +31,10 @@ public:
|
||||
enum class FormatterClass { DateTime, Float, List, Script, String, NoFormat, Json };
|
||||
|
||||
explicit AWAbstractFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AWAbstractFormatter();
|
||||
~AWAbstractFormatter() override;
|
||||
virtual QString convert(const QVariant &_value) const = 0;
|
||||
void copyDefaults(AbstractExtItem *_other) const;
|
||||
QString uniq() const;
|
||||
void copyDefaults(AbstractExtItem *_other) const override;
|
||||
QString uniq() const override;
|
||||
// properties
|
||||
QString strType() const;
|
||||
FormatterClass type() const;
|
||||
@ -42,9 +42,9 @@ public:
|
||||
void setType(const FormatterClass _type);
|
||||
|
||||
public slots:
|
||||
virtual void readConfiguration();
|
||||
QVariantHash run() { return QVariantHash(); };
|
||||
virtual void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
QVariantHash run() override { return QVariantHash(); };
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private:
|
||||
// properties
|
||||
|
@ -60,8 +60,7 @@ AWDateTimeFormatter *AWDateTimeFormatter::copy(const QString &_fileName, const i
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
AWDateTimeFormatter *item
|
||||
= new AWDateTimeFormatter(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new AWDateTimeFormatter(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
AWAbstractFormatter::copyDefaults(item);
|
||||
item->setFormat(format());
|
||||
item->setTranslateString(translateString());
|
||||
|
@ -36,9 +36,9 @@ class AWDateTimeFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWDateTimeFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AWDateTimeFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWDateTimeFormatter *copy(const QString &_fileName, const int _number);
|
||||
~AWDateTimeFormatter() override;
|
||||
QString convert(const QVariant &_value) const override;
|
||||
AWDateTimeFormatter *copy(const QString &_fileName, const int _number) override;
|
||||
// properties
|
||||
QString format() const;
|
||||
bool translateString() const;
|
||||
@ -46,14 +46,14 @@ public:
|
||||
void setTranslateString(const bool _translate);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private:
|
||||
Ui::AWDateTimeFormatter *ui = nullptr;
|
||||
void initLocale();
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QLocale m_locale;
|
||||
QString m_format = "";
|
||||
|
@ -64,7 +64,7 @@ AWFloatFormatter *AWFloatFormatter::copy(const QString &_fileName, const int _nu
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
AWFloatFormatter *item = new AWFloatFormatter(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new AWFloatFormatter(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
AWAbstractFormatter::copyDefaults(item);
|
||||
item->setCount(count());
|
||||
item->setFormat(format());
|
||||
|
@ -39,9 +39,9 @@ class AWFloatFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWFloatFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AWFloatFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWFloatFormatter *copy(const QString &_fileName, const int _number);
|
||||
~AWFloatFormatter() override;
|
||||
QString convert(const QVariant &_value) const override;
|
||||
AWFloatFormatter *copy(const QString &_fileName, const int _number) override;
|
||||
// properties
|
||||
int count() const;
|
||||
QChar fillChar() const;
|
||||
@ -59,13 +59,13 @@ public:
|
||||
void setSummand(const double _summand);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private:
|
||||
Ui::AWFloatFormatter *ui = nullptr;
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
int m_count = 0;
|
||||
QChar m_fillChar = QChar();
|
||||
|
@ -68,7 +68,7 @@ AWJsonFormatter *AWJsonFormatter::copy(const QString &_fileName, const int _numb
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
AWJsonFormatter *item = new AWJsonFormatter(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new AWJsonFormatter(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
AWAbstractFormatter::copyDefaults(item);
|
||||
item->setNumber(_number);
|
||||
item->setPath(path());
|
||||
@ -159,7 +159,7 @@ QVariant AWJsonFormatter::getFromJson(const QVariant &_value, const QVariant &_e
|
||||
}
|
||||
|
||||
|
||||
QVariant AWJsonFormatter::getFromList(const QVariant &_value, const int _index) const
|
||||
QVariant AWJsonFormatter::getFromList(const QVariant &_value, const int _index)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Looking for index" << _index << "in" << _value;
|
||||
|
||||
@ -167,7 +167,7 @@ QVariant AWJsonFormatter::getFromList(const QVariant &_value, const int _index)
|
||||
}
|
||||
|
||||
|
||||
QVariant AWJsonFormatter::getFromMap(const QVariant &_value, const QString &_key) const
|
||||
QVariant AWJsonFormatter::getFromMap(const QVariant &_value, const QString &_key)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Looking for key" << _key << "in" << _value;
|
||||
|
||||
|
@ -33,25 +33,25 @@ class AWJsonFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWJsonFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AWJsonFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWJsonFormatter *copy(const QString &_fileName, const int _number);
|
||||
~AWJsonFormatter() override;
|
||||
QString convert(const QVariant &_value) const override;
|
||||
AWJsonFormatter *copy(const QString &_fileName, const int _number) override;
|
||||
// properties
|
||||
QString path() const;
|
||||
void setPath(const QString &_path);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private:
|
||||
Ui::AWJsonFormatter *ui = nullptr;
|
||||
QVariant getFromJson(const QVariant &_value, const QVariant &_element) const;
|
||||
QVariant getFromList(const QVariant &_value, const int _index) const;
|
||||
QVariant getFromMap(const QVariant &_value, const QString &_key) const;
|
||||
static QVariant getFromList(const QVariant &_value, const int _index);
|
||||
static QVariant getFromMap(const QVariant &_value, const QString &_key);
|
||||
void initPath();
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QString m_path;
|
||||
QVariantList m_splittedPath;
|
||||
|
@ -63,7 +63,7 @@ AWListFormatter *AWListFormatter::copy(const QString &_fileName, const int _numb
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
AWListFormatter *item = new AWListFormatter(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new AWListFormatter(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
AWAbstractFormatter::copyDefaults(item);
|
||||
item->setFilter(filter());
|
||||
item->setSeparator(separator());
|
||||
|
@ -35,9 +35,9 @@ class AWListFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWListFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AWListFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWListFormatter *copy(const QString &_fileName, const int _number);
|
||||
~AWListFormatter() override;
|
||||
QString convert(const QVariant &_value) const override;
|
||||
AWListFormatter *copy(const QString &_fileName, const int _number) override;
|
||||
// properties
|
||||
QString filter() const;
|
||||
bool isSorted() const;
|
||||
@ -47,13 +47,13 @@ public:
|
||||
void setSorted(const bool _sorted);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private:
|
||||
Ui::AWListFormatter *ui = nullptr;
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QString m_filter = "";
|
||||
QString m_separator = "";
|
||||
|
@ -57,7 +57,7 @@ AWNoFormatter *AWNoFormatter::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
AWNoFormatter *item = new AWNoFormatter(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new AWNoFormatter(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
AWAbstractFormatter::copyDefaults(item);
|
||||
item->setNumber(_number);
|
||||
|
||||
|
@ -32,16 +32,16 @@ class AWNoFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWNoFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AWNoFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWNoFormatter *copy(const QString &_fileName, const int _number);
|
||||
~AWNoFormatter() override;
|
||||
QString convert(const QVariant &_value) const override;
|
||||
AWNoFormatter *copy(const QString &_fileName, const int _number) override;
|
||||
|
||||
public slots:
|
||||
int showConfiguration(const QVariant &_args);
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
|
||||
private:
|
||||
Ui::AWNoFormatter *ui = nullptr;
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
};
|
||||
|
||||
|
@ -72,7 +72,7 @@ AWScriptFormatter *AWScriptFormatter::copy(const QString &_fileName, const int _
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
AWScriptFormatter *item = new AWScriptFormatter(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new AWScriptFormatter(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
AWAbstractFormatter::copyDefaults(item);
|
||||
item->setAppendCode(appendCode());
|
||||
item->setCode(code());
|
||||
|
@ -36,9 +36,9 @@ class AWScriptFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWScriptFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AWScriptFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWScriptFormatter *copy(const QString &_fileName, const int _number);
|
||||
~AWScriptFormatter() override;
|
||||
QString convert(const QVariant &_value) const override;
|
||||
AWScriptFormatter *copy(const QString &_fileName, const int _number) override;
|
||||
// properties
|
||||
bool appendCode() const;
|
||||
QString code() const;
|
||||
@ -49,14 +49,14 @@ public:
|
||||
void setHasReturn(const bool _hasReturn);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private:
|
||||
Ui::AWScriptFormatter *ui = nullptr;
|
||||
void initProgram();
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
bool m_appendCode = true;
|
||||
QString m_code = "";
|
||||
|
@ -63,7 +63,7 @@ AWStringFormatter *AWStringFormatter::copy(const QString &_fileName, const int _
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
AWStringFormatter *item = new AWStringFormatter(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new AWStringFormatter(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
AWAbstractFormatter::copyDefaults(item);
|
||||
item->setCount(count());
|
||||
item->setFillChar(fillChar());
|
||||
|
@ -35,9 +35,9 @@ class AWStringFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWStringFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AWStringFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWStringFormatter *copy(const QString &_fileName, const int _number);
|
||||
~AWStringFormatter() override;
|
||||
QString convert(const QVariant &_value) const override;
|
||||
AWStringFormatter *copy(const QString &_fileName, const int _number) override;
|
||||
// properties
|
||||
int count() const;
|
||||
QChar fillChar() const;
|
||||
@ -47,13 +47,13 @@ public:
|
||||
void setForceWidth(const bool _forceWidth);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private:
|
||||
Ui::AWStringFormatter *ui = nullptr;
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
int m_count = 0;
|
||||
QChar m_fillChar = QChar();
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
initItems();
|
||||
};
|
||||
|
||||
virtual ~ExtItemAggregator()
|
||||
~ExtItemAggregator() override
|
||||
{
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
@ -61,7 +61,7 @@ public:
|
||||
qCInfo(LOG_LIB) << "Dialog returns" << ret;
|
||||
};
|
||||
|
||||
void initItems()
|
||||
void initItems() override
|
||||
{
|
||||
m_items.clear();
|
||||
m_activeItems.clear();
|
||||
@ -117,13 +117,13 @@ public:
|
||||
return found;
|
||||
};
|
||||
|
||||
QList<AbstractExtItem *> items() const { return m_items; };
|
||||
QList<AbstractExtItem *> items() const override { return m_items; };
|
||||
|
||||
private:
|
||||
QList<AbstractExtItem *> m_items;
|
||||
QList<T *> m_activeItems;
|
||||
|
||||
void doCreateItem() { return createItem<T>(); }
|
||||
void doCreateItem() override { return createItem<T>(); }
|
||||
|
||||
QList<AbstractExtItem *> getItems()
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ ExtNetworkRequest *ExtNetworkRequest::copy(const QString &_fileName, const int _
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
ExtNetworkRequest *item = new ExtNetworkRequest(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new ExtNetworkRequest(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
copyDefaults(item);
|
||||
item->setNumber(_number);
|
||||
item->setStringUrl(stringUrl());
|
||||
|
@ -35,19 +35,19 @@ class ExtNetworkRequest : public AbstractExtItem
|
||||
|
||||
public:
|
||||
explicit ExtNetworkRequest(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~ExtNetworkRequest();
|
||||
ExtNetworkRequest *copy(const QString &_fileName, const int _number);
|
||||
~ExtNetworkRequest() override;
|
||||
ExtNetworkRequest *copy(const QString &_fileName, const int _number) override;
|
||||
// get methods
|
||||
QString stringUrl() const;
|
||||
QString uniq() const;
|
||||
QString uniq() const override;
|
||||
// set methods
|
||||
void setStringUrl(const QString &_url);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
QVariantHash run() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private slots:
|
||||
void networkReplyReceived(QNetworkReply *_reply);
|
||||
@ -59,7 +59,7 @@ private:
|
||||
bool m_isRunning = false;
|
||||
Ui::ExtNetworkRequest *ui = nullptr;
|
||||
void initUrl();
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QString m_stringUrl = "https://httpbin.org/get";
|
||||
// values
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include "awdebug.h"
|
||||
#include "stooqquotesprovider.h"
|
||||
#include "yahooquotesprovider.h"
|
||||
|
||||
|
||||
ExtQuotes::ExtQuotes(QWidget *_parent, const QString &_filePath)
|
||||
@ -75,7 +74,7 @@ ExtQuotes *ExtQuotes::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
ExtQuotes *item = new ExtQuotes(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new ExtQuotes(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
copyDefaults(item);
|
||||
item->setNumber(_number);
|
||||
item->setTicker(ticker());
|
||||
|
@ -36,19 +36,19 @@ class ExtQuotes : public AbstractExtItem
|
||||
|
||||
public:
|
||||
explicit ExtQuotes(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~ExtQuotes();
|
||||
ExtQuotes *copy(const QString &_fileName, const int _number);
|
||||
~ExtQuotes() override;
|
||||
ExtQuotes *copy(const QString &_fileName, const int _number) override;
|
||||
// get methods
|
||||
QString ticker() const;
|
||||
QString uniq() const;
|
||||
QString uniq() const override;
|
||||
// set methods
|
||||
void setTicker(const QString &_ticker);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
QVariantHash run() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private slots:
|
||||
void quotesReplyReceived(QNetworkReply *_reply);
|
||||
@ -60,7 +60,7 @@ private:
|
||||
bool m_isRunning = false;
|
||||
Ui::ExtQuotes *ui = nullptr;
|
||||
void initProvider();
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QString m_ticker = "EURUSD=X";
|
||||
// values
|
||||
|
@ -67,7 +67,7 @@ ExtScript *ExtScript::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
ExtScript *item = new ExtScript(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new ExtScript(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
copyDefaults(item);
|
||||
item->setExecutable(executable());
|
||||
item->setNumber(_number);
|
||||
@ -79,7 +79,7 @@ ExtScript *ExtScript::copy(const QString &_fileName, const int _number)
|
||||
}
|
||||
|
||||
|
||||
QString ExtScript::jsonFiltersFile() const
|
||||
QString ExtScript::jsonFiltersFile()
|
||||
{
|
||||
QString fileName
|
||||
= QStandardPaths::locate(QStandardPaths::GenericDataLocation,
|
||||
@ -253,7 +253,7 @@ void ExtScript::readJsonFilters()
|
||||
QString jsonText = jsonFile.readAll();
|
||||
jsonFile.close();
|
||||
|
||||
QJsonParseError error;
|
||||
QJsonParseError error{};
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonText.toUtf8(), &error);
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qCWarning(LOG_LIB) << "Parse error" << error.errorString();
|
||||
|
@ -40,15 +40,15 @@ public:
|
||||
enum class Redirect { stdout2stderr = 0, nothing = 1, stderr2stdout = 2, swap = 3 };
|
||||
|
||||
explicit ExtScript(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~ExtScript();
|
||||
ExtScript *copy(const QString &_fileName, const int _number);
|
||||
QString jsonFiltersFile() const;
|
||||
~ExtScript() override;
|
||||
ExtScript *copy(const QString &_fileName, const int _number) override;
|
||||
static QString jsonFiltersFile();
|
||||
// get methods
|
||||
QString executable() const;
|
||||
QStringList filters() const;
|
||||
QString prefix() const;
|
||||
Redirect redirect() const;
|
||||
QString uniq() const;
|
||||
QString uniq() const override;
|
||||
// derivatives
|
||||
QString strRedirect() const;
|
||||
// set methods
|
||||
@ -62,11 +62,11 @@ public:
|
||||
void updateFilter(const QString &_filter, const bool _add);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
void readConfiguration() override;
|
||||
void readJsonFilters();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
QVariantHash run() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private slots:
|
||||
void startProcess();
|
||||
@ -75,7 +75,7 @@ private slots:
|
||||
private:
|
||||
QProcess *m_process = nullptr;
|
||||
Ui::ExtScript *ui = nullptr;
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QString m_executable = "/usr/bin/true";
|
||||
QStringList m_filters = QStringList();
|
||||
|
@ -63,7 +63,7 @@ ExtUpgrade *ExtUpgrade::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
ExtUpgrade *item = new ExtUpgrade(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new ExtUpgrade(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
copyDefaults(item);
|
||||
item->setExecutable(executable());
|
||||
item->setFilter(filter());
|
||||
@ -218,7 +218,7 @@ void ExtUpgrade::updateValue()
|
||||
|
||||
QString qoutput
|
||||
= QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardOutput()).trimmed();
|
||||
m_values[tag("pkgcount")] = [this](QString output) {
|
||||
m_values[tag("pkgcount")] = [this](const QString &output) {
|
||||
return filter().isEmpty()
|
||||
? output.split('\n', QString::SkipEmptyParts).count() - null()
|
||||
: output.split('\n', QString::SkipEmptyParts).filter(QRegExp(filter())).count();
|
||||
|
@ -37,23 +37,23 @@ class ExtUpgrade : public AbstractExtItem
|
||||
|
||||
public:
|
||||
explicit ExtUpgrade(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~ExtUpgrade();
|
||||
ExtUpgrade *copy(const QString &_fileName, const int _number);
|
||||
~ExtUpgrade() override;
|
||||
ExtUpgrade *copy(const QString &_fileName, const int _number) override;
|
||||
// get methods
|
||||
QString executable() const;
|
||||
QString filter() const;
|
||||
int null() const;
|
||||
QString uniq() const;
|
||||
QString uniq() const override;
|
||||
// set methods
|
||||
void setExecutable(const QString &_executable);
|
||||
void setFilter(const QString &_filter);
|
||||
void setNull(const int _null);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
QVariantHash run() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private slots:
|
||||
void startProcess();
|
||||
@ -62,7 +62,7 @@ private slots:
|
||||
private:
|
||||
QProcess *m_process = nullptr;
|
||||
Ui::ExtUpgrade *ui = nullptr;
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QString m_executable = "/usr/bin/true";
|
||||
QString m_filter = "";
|
||||
|
@ -77,7 +77,7 @@ ExtWeather *ExtWeather::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "number" << _number;
|
||||
|
||||
ExtWeather *item = new ExtWeather(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new ExtWeather(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
copyDefaults(item);
|
||||
item->setCity(city());
|
||||
item->setCountry(country());
|
||||
@ -90,7 +90,7 @@ ExtWeather *ExtWeather::copy(const QString &_fileName, const int _number)
|
||||
}
|
||||
|
||||
|
||||
QString ExtWeather::jsonMapFile() const
|
||||
QString ExtWeather::jsonMapFile()
|
||||
{
|
||||
QString fileName
|
||||
= QStandardPaths::locate(QStandardPaths::GenericDataLocation,
|
||||
@ -248,7 +248,7 @@ void ExtWeather::readJsonMap()
|
||||
QString jsonText = jsonFile.readAll();
|
||||
jsonFile.close();
|
||||
|
||||
QJsonParseError error;
|
||||
QJsonParseError error{};
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonText.toUtf8(), &error);
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qCWarning(LOG_LIB) << "Parse error" << error.errorString();
|
||||
@ -345,7 +345,7 @@ void ExtWeather::weatherReplyReceived(QNetworkReply *_reply)
|
||||
}
|
||||
|
||||
m_isRunning = false;
|
||||
QJsonParseError error;
|
||||
QJsonParseError error{};
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(_reply->readAll(), &error);
|
||||
_reply->deleteLater();
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
|
@ -43,9 +43,9 @@ public:
|
||||
enum class Provider { OWM = 0, Yahoo = 1 };
|
||||
|
||||
explicit ExtWeather(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~ExtWeather();
|
||||
ExtWeather *copy(const QString &_fileName, const int _number);
|
||||
QString jsonMapFile() const;
|
||||
~ExtWeather() override;
|
||||
ExtWeather *copy(const QString &_fileName, const int _number) override;
|
||||
static QString jsonMapFile();
|
||||
QString weatherFromInt(const int _id) const;
|
||||
// get methods
|
||||
QString city() const;
|
||||
@ -54,7 +54,7 @@ public:
|
||||
Provider provider() const;
|
||||
QString strProvider() const;
|
||||
int ts() const;
|
||||
QString uniq() const;
|
||||
QString uniq() const override;
|
||||
// set methods
|
||||
void setCity(const QString &_city);
|
||||
void setCountry(const QString &_country);
|
||||
@ -64,11 +64,11 @@ public:
|
||||
void setTs(const int _ts);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
void readConfiguration() override;
|
||||
void readJsonMap();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
QVariantHash run() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private slots:
|
||||
void sendRequest();
|
||||
@ -80,7 +80,7 @@ private:
|
||||
bool m_isRunning = false;
|
||||
Ui::ExtWeather *ui = nullptr;
|
||||
void initProvider();
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QString m_city = "London";
|
||||
QString m_country = "uk";
|
||||
|
@ -75,7 +75,7 @@ GraphicalItem *GraphicalItem::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
GraphicalItem *item = new GraphicalItem(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new GraphicalItem(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
copyDefaults(item);
|
||||
item->setActiveColor(activeColor());
|
||||
item->setBar(bar());
|
||||
@ -486,8 +486,8 @@ int GraphicalItem::showConfiguration(const QVariant &_args)
|
||||
setCount(ui->spinBox_count->value());
|
||||
setCustom(ui->checkBox_custom->isChecked());
|
||||
setBar(m_custom ? ui->lineEdit_customValue->text() : ui->comboBox_value->currentText());
|
||||
setMaxValue(ui->doubleSpinBox_max->value());
|
||||
setMinValue(ui->doubleSpinBox_min->value());
|
||||
setMaxValue(static_cast<float>(ui->doubleSpinBox_max->value()));
|
||||
setMinValue(static_cast<float>(ui->doubleSpinBox_min->value()));
|
||||
setActiveColor(ui->lineEdit_activeColor->text());
|
||||
setInactiveColor(ui->lineEdit_inactiveColor->text());
|
||||
setType(static_cast<Type>(ui->comboBox_type->currentIndex()));
|
||||
|
@ -53,8 +53,8 @@ public:
|
||||
enum class Type { Horizontal = 0, Vertical = 1, Circle = 2, Graph = 3, Bars = 4 };
|
||||
|
||||
explicit GraphicalItem(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~GraphicalItem();
|
||||
GraphicalItem *copy(const QString &_fileName, const int _number);
|
||||
~GraphicalItem() override;
|
||||
GraphicalItem *copy(const QString &_fileName, const int _number) override;
|
||||
QString image(const QVariant &value);
|
||||
void initScene();
|
||||
// get methods
|
||||
@ -72,7 +72,7 @@ public:
|
||||
Direction direction() const;
|
||||
QString strDirection() const;
|
||||
QStringList usedKeys() const;
|
||||
QString uniq() const;
|
||||
QString uniq() const override;
|
||||
// set methods
|
||||
void setBar(const QString &_bar);
|
||||
void setActiveColor(const QString &_color);
|
||||
@ -90,10 +90,10 @@ public:
|
||||
void setUsedKeys(const QStringList &_usedKeys);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantHash run() { return QVariantHash(); };
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
QVariantHash run() override { return QVariantHash(); };
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private slots:
|
||||
void changeColor();
|
||||
@ -105,7 +105,7 @@ private:
|
||||
QGraphicsScene *m_scene = nullptr;
|
||||
QGraphicsView *m_view = nullptr;
|
||||
Ui::GraphicalItem *ui = nullptr;
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QString m_bar = "cpu";
|
||||
int m_count = 100;
|
||||
|
@ -89,7 +89,7 @@ void GraphicalItemHelper::paintBars(const float _value)
|
||||
|
||||
// default norms
|
||||
float normX = static_cast<float>(m_width) / static_cast<float>(m_values.count());
|
||||
float normY = static_cast<float>(m_height - 1);
|
||||
auto normY = static_cast<float>(m_height - 1);
|
||||
// paint graph
|
||||
for (int i = 0; i < m_values.count(); i++) {
|
||||
float x = i * normX;
|
||||
@ -113,11 +113,11 @@ void GraphicalItemHelper::paintCircle(const float _percent)
|
||||
|
||||
// inactive
|
||||
circle = m_scene->addEllipse(0.0, 0.0, m_width, m_height, m_inactivePen, m_inactivePen.brush());
|
||||
circle->setSpanAngle(-(1.0f - _percent) * 360.0f * 16.0f);
|
||||
circle->setStartAngle(90.0f * 16.0f - _percent * 360.0f * 16.0f);
|
||||
circle->setSpanAngle(static_cast<int>(-(1.0f - _percent) * 360.0f * 16.0f));
|
||||
circle->setStartAngle(static_cast<int>(90.0f * 16.0f - _percent * 360.0f * 16.0f));
|
||||
// active
|
||||
circle = m_scene->addEllipse(0.0, 0.0, m_width, m_height, m_activePen, m_activePen.brush());
|
||||
circle->setSpanAngle(-_percent * 360.0f * 16.0f);
|
||||
circle->setSpanAngle(static_cast<int>(-_percent * 360.0f * 16.0f));
|
||||
circle->setStartAngle(90 * 16);
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ void GraphicalItemHelper::paintGraph(const float _value)
|
||||
|
||||
// default norms
|
||||
float normX = static_cast<float>(m_width) / static_cast<float>(m_values.count());
|
||||
float normY = static_cast<float>(m_height - 1);
|
||||
auto normY = static_cast<float>(m_height - 1);
|
||||
// paint graph
|
||||
for (int i = 0; i < m_values.count() - 1; i++) {
|
||||
// some magic here
|
||||
|
@ -31,7 +31,7 @@ class GraphicalItemHelper : public QObject
|
||||
|
||||
public:
|
||||
explicit GraphicalItemHelper(QObject *_parent = nullptr, QGraphicsScene *_scene = nullptr);
|
||||
virtual ~GraphicalItemHelper();
|
||||
~GraphicalItemHelper() override;
|
||||
// parameters
|
||||
void setParameters(const QString &_active, const QString &_inactive, const int _width,
|
||||
const int _height, const int _count);
|
||||
@ -42,9 +42,9 @@ public:
|
||||
void paintHorizontal(const float _percent);
|
||||
void paintVertical(const float _percent);
|
||||
// additional conversion methods
|
||||
float getPercents(const float _value, const float _min, const float _max);
|
||||
bool isColor(const QString &_input);
|
||||
QColor stringToColor(const QString &_color);
|
||||
static float getPercents(const float _value, const float _min, const float _max);
|
||||
static bool isColor(const QString &_input);
|
||||
static QColor stringToColor(const QString &_color);
|
||||
|
||||
private:
|
||||
void storeValue(const float _value);
|
||||
|
@ -32,10 +32,10 @@ public:
|
||||
const char *OWM_FORECAST_URL = "https://arcanis.me/forecast";
|
||||
|
||||
explicit OWMWeatherProvider(QObject *_parent);
|
||||
virtual ~OWMWeatherProvider();
|
||||
void initUrl(const QString &_city, const QString &_country, const int);
|
||||
QVariantHash parse(const QVariantMap &_json) const;
|
||||
QUrl url() const;
|
||||
~OWMWeatherProvider() override;
|
||||
void initUrl(const QString &_city, const QString &_country, const int) override;
|
||||
QVariantHash parse(const QVariantMap &_json) const override;
|
||||
QUrl url() const override;
|
||||
|
||||
private:
|
||||
QVariantHash parseSingleJson(const QVariantMap &_json) const;
|
||||
|
@ -76,7 +76,7 @@ void QCronScheduler::expired()
|
||||
}
|
||||
|
||||
|
||||
QList<int> QCronScheduler::parseField(const QString &_value, const int _min, const int _max) const
|
||||
QList<int> QCronScheduler::parseField(const QString &_value, const int _min, const int _max)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Parse field" << _value << "with corner values" << _min << _max;
|
||||
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
} QCronField;
|
||||
|
||||
explicit QCronScheduler(QObject *_parent = nullptr);
|
||||
virtual ~QCronScheduler();
|
||||
~QCronScheduler() override;
|
||||
void parse(const QString &_timer);
|
||||
|
||||
signals:
|
||||
@ -56,7 +56,7 @@ private slots:
|
||||
private:
|
||||
QCronRunSchedule m_schedule;
|
||||
QTimer *m_timer = nullptr;
|
||||
QList<int> parseField(const QString &_value, const int _min, const int _max) const;
|
||||
static QList<int> parseField(const QString &_value, const int _min, const int _max);
|
||||
};
|
||||
|
||||
|
||||
|
@ -29,10 +29,10 @@ public:
|
||||
const char *STOOQ_QUOTES_URL = "https://stooq.com/q/l/";
|
||||
|
||||
explicit StooqQuotesProvider(QObject *_parent);
|
||||
virtual ~StooqQuotesProvider();
|
||||
void initUrl(const QString &_asset);
|
||||
QVariantHash parse(const QByteArray &_source, const QVariantHash &_oldValues) const;
|
||||
QUrl url() const;
|
||||
~StooqQuotesProvider() override;
|
||||
void initUrl(const QString &_asset) override;
|
||||
QVariantHash parse(const QByteArray &_source, const QVariantHash &_oldValues) const override;
|
||||
QUrl url() const override;
|
||||
|
||||
private:
|
||||
QUrl m_url;
|
||||
|
@ -56,7 +56,7 @@ QVariantHash YahooQuotesProvider::parse(const QByteArray &_source,
|
||||
|
||||
QVariantHash values;
|
||||
|
||||
QJsonParseError error;
|
||||
QJsonParseError error{};
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(_source, &error);
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qCWarning(LOG_LIB) << "Parse error" << error.errorString();
|
||||
|
@ -30,10 +30,10 @@ public:
|
||||
const char *YAHOO_QUOTES_QUERY = "select * from yahoo.finance.quotes where symbol='%1'";
|
||||
|
||||
explicit YahooQuotesProvider(QObject *_parent);
|
||||
virtual ~YahooQuotesProvider();
|
||||
void initUrl(const QString &_asset);
|
||||
QVariantHash parse(const QByteArray &_source, const QVariantHash &_oldValues) const;
|
||||
QUrl url() const;
|
||||
~YahooQuotesProvider() override;
|
||||
void initUrl(const QString &_asset) override;
|
||||
QVariantHash parse(const QByteArray &_source, const QVariantHash &_oldValues) const override;
|
||||
QUrl url() const override;
|
||||
|
||||
private:
|
||||
QUrl m_url;
|
||||
|
@ -32,10 +32,10 @@ public:
|
||||
"geo.places(1) where text='%1, %2')";
|
||||
|
||||
explicit YahooWeatherProvider(QObject *_parent);
|
||||
virtual ~YahooWeatherProvider();
|
||||
void initUrl(const QString &_city, const QString &_country, const int);
|
||||
QVariantHash parse(const QVariantMap &_json) const;
|
||||
QUrl url() const;
|
||||
~YahooWeatherProvider() override;
|
||||
void initUrl(const QString &_city, const QString &_country, const int) override;
|
||||
QVariantHash parse(const QVariantMap &_json) const override;
|
||||
QUrl url() const override;
|
||||
|
||||
private:
|
||||
QVariantHash parseCurrent(const QVariantMap &_json, const QVariantMap &_atmosphere) const;
|
||||
|
@ -15,7 +15,6 @@ Icon=utilities-system-monitor
|
||||
X-KDE-ServiceTypes=Plasma/Applet
|
||||
X-Plasma-API=declarativeappletscript
|
||||
X-Plasma-MainScript=ui/main.qml
|
||||
X-Plasma-RemoteLocation=
|
||||
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||
|
@ -15,7 +15,6 @@ Icon=utilities-system-monitor
|
||||
X-KDE-ServiceTypes=Plasma/Applet
|
||||
X-Plasma-API=declarativeappletscript
|
||||
X-Plasma-MainScript=ui/main.qml
|
||||
X-Plasma-RemoteLocation=
|
||||
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||
|
@ -28,7 +28,7 @@ class DPPlugin : public QQmlExtensionPlugin
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
|
||||
|
||||
public:
|
||||
void registerTypes(const char *uri);
|
||||
void registerTypes(const char *uri) override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -56,19 +56,19 @@ DPAdds::~DPAdds()
|
||||
|
||||
|
||||
// HACK: since QML could not use QLoggingCategory I need this hack
|
||||
bool DPAdds::isDebugEnabled() const
|
||||
bool DPAdds::isDebugEnabled()
|
||||
{
|
||||
return LOG_DP().isDebugEnabled();
|
||||
}
|
||||
|
||||
|
||||
int DPAdds::currentDesktop() const
|
||||
int DPAdds::currentDesktop()
|
||||
{
|
||||
return KWindowSystem::currentDesktop();
|
||||
}
|
||||
|
||||
|
||||
QStringList DPAdds::dictKeys(const bool _sorted, const QString &_regexp) const
|
||||
QStringList DPAdds::dictKeys(const bool _sorted, const QString &_regexp)
|
||||
{
|
||||
qCDebug(LOG_DP) << "Should be sorted" << _sorted << "and filter applied" << _regexp;
|
||||
|
||||
@ -85,7 +85,7 @@ QStringList DPAdds::dictKeys(const bool _sorted, const QString &_regexp) const
|
||||
}
|
||||
|
||||
|
||||
int DPAdds::numberOfDesktops() const
|
||||
int DPAdds::numberOfDesktops()
|
||||
{
|
||||
return KWindowSystem::numberOfDesktops();
|
||||
}
|
||||
@ -104,13 +104,13 @@ QString DPAdds::toolTipImage(const int _desktop) const
|
||||
if (m_tooltipType == "names") {
|
||||
QStringList windowList;
|
||||
std::for_each(info.windowsData.cbegin(), info.windowsData.cend(),
|
||||
[&windowList](WindowData data) { windowList.append(data.name); });
|
||||
[&windowList](const WindowData &data) { windowList.append(data.name); });
|
||||
return QString("<ul><li>%1</li></ul>").arg(windowList.join("</li><li>"));
|
||||
}
|
||||
|
||||
// init
|
||||
QGraphicsScene *toolTipScene = new QGraphicsScene();
|
||||
QGraphicsView *toolTipView = new QGraphicsView(toolTipScene);
|
||||
auto *toolTipScene = new QGraphicsScene();
|
||||
auto *toolTipView = new QGraphicsView(toolTipScene);
|
||||
toolTipView->setStyleSheet("background: transparent");
|
||||
toolTipView->setContentsMargins(0, 0, 0, 0);
|
||||
toolTipView->setFrameShape(QFrame::NoFrame);
|
||||
@ -119,8 +119,8 @@ QString DPAdds::toolTipImage(const int _desktop) const
|
||||
|
||||
// update
|
||||
float margin = 5.0f * info.desktop.width() / 400.0f;
|
||||
toolTipView->resize(info.desktop.width() + 2.0f * margin,
|
||||
info.desktop.height() + 2.0f * margin);
|
||||
toolTipView->resize(static_cast<int>(info.desktop.width() + 2.0f * margin),
|
||||
static_cast<int>(info.desktop.height() + 2.0f * margin));
|
||||
toolTipScene->clear();
|
||||
toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
||||
// borders
|
||||
@ -215,7 +215,7 @@ void DPAdds::setToolTipData(const QVariantMap &_tooltipData)
|
||||
}
|
||||
|
||||
|
||||
QString DPAdds::infoByKey(const QString &_key) const
|
||||
QString DPAdds::infoByKey(const QString &_key)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Requested info for key" << _key;
|
||||
|
||||
@ -246,7 +246,7 @@ QString DPAdds::valueByKey(const QString &_key, int _desktop) const
|
||||
|
||||
|
||||
// HACK: this method uses variables from version.h
|
||||
QString DPAdds::getAboutText(const QString &_type) const
|
||||
QString DPAdds::getAboutText(const QString &_type)
|
||||
{
|
||||
qCDebug(LOG_DP) << "Type" << _type;
|
||||
|
||||
@ -254,7 +254,7 @@ QString DPAdds::getAboutText(const QString &_type) const
|
||||
}
|
||||
|
||||
|
||||
QVariantMap DPAdds::getFont(const QVariantMap &_defaultFont) const
|
||||
QVariantMap DPAdds::getFont(const QVariantMap &_defaultFont)
|
||||
{
|
||||
qCDebug(LOG_DP) << "Default font is" << _defaultFont;
|
||||
|
||||
@ -285,7 +285,7 @@ void DPAdds::sendNotification(const QString &_eventId, const QString &_message)
|
||||
|
||||
|
||||
// slot for mouse click
|
||||
void DPAdds::setCurrentDesktop(const int _desktop) const
|
||||
void DPAdds::setCurrentDesktop(const int _desktop)
|
||||
{
|
||||
qCDebug(LOG_DP) << "Desktop" << _desktop;
|
||||
|
||||
@ -293,7 +293,7 @@ void DPAdds::setCurrentDesktop(const int _desktop) const
|
||||
}
|
||||
|
||||
|
||||
DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int _desktop) const
|
||||
DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int _desktop)
|
||||
{
|
||||
qCDebug(LOG_DP) << "Desktop" << _desktop;
|
||||
|
||||
|
@ -42,21 +42,21 @@ class DPAdds : public QObject
|
||||
|
||||
public:
|
||||
explicit DPAdds(QObject *_parent = nullptr);
|
||||
virtual ~DPAdds();
|
||||
Q_INVOKABLE bool isDebugEnabled() const;
|
||||
Q_INVOKABLE int currentDesktop() const;
|
||||
Q_INVOKABLE QStringList dictKeys(const bool _sorted = true, const QString &_regexp = "") const;
|
||||
Q_INVOKABLE int numberOfDesktops() const;
|
||||
~DPAdds() override;
|
||||
Q_INVOKABLE static bool isDebugEnabled();
|
||||
Q_INVOKABLE static int currentDesktop();
|
||||
Q_INVOKABLE static QStringList dictKeys(const bool _sorted = true, const QString &_regexp = "");
|
||||
Q_INVOKABLE static int numberOfDesktops();
|
||||
Q_INVOKABLE QString toolTipImage(const int _desktop) const;
|
||||
Q_INVOKABLE QString parsePattern(const QString &_pattern, const int _desktop) const;
|
||||
// values
|
||||
Q_INVOKABLE void setMark(const QString &_newMark);
|
||||
Q_INVOKABLE void setToolTipData(const QVariantMap &_tooltipData);
|
||||
Q_INVOKABLE QString infoByKey(const QString &_key) const;
|
||||
Q_INVOKABLE static QString infoByKey(const QString &_key);
|
||||
Q_INVOKABLE QString valueByKey(const QString &_key, int _desktop = -1) const;
|
||||
// configuration slots
|
||||
Q_INVOKABLE QString getAboutText(const QString &_type) const;
|
||||
Q_INVOKABLE QVariantMap getFont(const QVariantMap &_defaultFont) const;
|
||||
Q_INVOKABLE static QString getAboutText(const QString &_type);
|
||||
Q_INVOKABLE static QVariantMap getFont(const QVariantMap &_defaultFont);
|
||||
|
||||
signals:
|
||||
void desktopChanged() const;
|
||||
@ -64,10 +64,10 @@ signals:
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE static void sendNotification(const QString &_eventId, const QString &_message);
|
||||
Q_INVOKABLE void setCurrentDesktop(const int _desktop) const;
|
||||
Q_INVOKABLE static void setCurrentDesktop(const int _desktop);
|
||||
|
||||
private:
|
||||
DesktopWindowsInfo getInfoByDesktop(const int _desktop) const;
|
||||
static DesktopWindowsInfo getInfoByDesktop(const int _desktop);
|
||||
// variables
|
||||
int m_tooltipWidth = 200;
|
||||
QString m_mark = "*";
|
||||
|
@ -29,12 +29,12 @@ class ExtendedSysMon : public Plasma::DataEngine
|
||||
|
||||
public:
|
||||
explicit ExtendedSysMon(QObject *_parent, const QVariantList &_args);
|
||||
virtual ~ExtendedSysMon();
|
||||
~ExtendedSysMon() override;
|
||||
|
||||
protected:
|
||||
QStringList sources() const;
|
||||
bool sourceRequestEvent(const QString &_source);
|
||||
bool updateSourceEvent(const QString &_source);
|
||||
QStringList sources() const override;
|
||||
bool sourceRequestEvent(const QString &_source) override;
|
||||
bool updateSourceEvent(const QString &_source) override;
|
||||
|
||||
private:
|
||||
// configuration
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "processessource.h"
|
||||
#include "quotessource.h"
|
||||
#include "requestsource.h"
|
||||
#include "systeminfosource.h"
|
||||
#include "upgradesource.h"
|
||||
#include "weathersource.h"
|
||||
|
||||
@ -135,6 +136,10 @@ void ExtSysMonAggregator::init(const QHash<QString, QString> &_config)
|
||||
AbstractExtSysMonSource *quotesItem = new QuotesSource(this, QStringList());
|
||||
for (auto &source : quotesItem->sources())
|
||||
m_map[source] = quotesItem;
|
||||
// system
|
||||
AbstractExtSysMonSource *systemItem = new SystemInfoSource(this, QStringList());
|
||||
for (auto &source : systemItem->sources())
|
||||
m_map[source] = systemItem;
|
||||
// upgrade
|
||||
AbstractExtSysMonSource *upgradeItem = new UpgradeSource(this, QStringList());
|
||||
for (auto &source : upgradeItem->sources())
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user