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