From 51c7299ad04eb3147a30677a7c70e903ff7b2c0a Mon Sep 17 00:00:00 2001 From: arcan1s Date: Fri, 13 May 2016 13:23:25 +0300 Subject: [PATCH] changes in Extensions ABI * rewrite aggregator to normal qt ui * use X-AW prefix for formatters options * fix logging * use nullptr in headers --- .../awesome-widget/plugin/awconfighelper.cpp | 4 +- .../plugin/awformatterhelper.cpp | 17 +++-- sources/awesomewidgets/abstractextitem.cpp | 2 +- .../abstractextitemaggregator.cpp | 40 +++++------- .../abstractextitemaggregator.h | 27 ++++---- .../abstractextitemaggregator.ui | 64 +++++++++++++++++++ .../awesomewidgets/awabstractformatter.cpp | 12 ++-- .../awesomewidgets/awdatetimeformatter.cpp | 14 ++-- sources/awesomewidgets/awdatetimeformatter.h | 2 +- sources/awesomewidgets/awfloatformatter.cpp | 47 +++++++------- sources/awesomewidgets/awfloatformatter.h | 2 +- sources/awesomewidgets/awnoformatter.cpp | 8 +-- sources/awesomewidgets/awnoformatter.h | 2 +- sources/awesomewidgets/awscriptformatter.cpp | 36 ++++++----- sources/awesomewidgets/awscriptformatter.h | 2 +- sources/awesomewidgets/extitemaggregator.h | 2 +- sources/awesomewidgets/extquotes.h | 4 +- sources/awesomewidgets/extscript.h | 2 +- sources/awesomewidgets/extupgrade.h | 2 +- sources/awesomewidgets/extweather.h | 4 +- sources/awesomewidgets/graphicalitem.h | 2 +- sources/extsysmon/sources/customsource.h | 2 +- sources/extsysmon/sources/quotessource.h | 2 +- sources/extsysmon/sources/upgradesource.h | 2 +- sources/extsysmon/sources/weathersource.h | 2 +- 25 files changed, 186 insertions(+), 117 deletions(-) create mode 100644 sources/awesomewidgets/abstractextitemaggregator.ui diff --git a/sources/awesome-widget/plugin/awconfighelper.cpp b/sources/awesome-widget/plugin/awconfighelper.cpp index a7b26be..db8dbf4 100644 --- a/sources/awesome-widget/plugin/awconfighelper.cpp +++ b/sources/awesome-widget/plugin/awconfighelper.cpp @@ -295,7 +295,7 @@ void AWConfigHelper::readFile(QSettings &settings, const QString key, file.close(); settings.setValue(key, text); } else { - qCWarning(LOG_LIB) << "Could not open" << file.fileName(); + qCWarning(LOG_AW) << "Could not open" << file.fileName(); } } @@ -316,6 +316,6 @@ void AWConfigHelper::writeFile(QSettings &settings, const QString key, out.flush(); file.close(); } else { - qCWarning(LOG_LIB) << "Could not open" << file.fileName(); + qCWarning(LOG_AW) << "Could not open" << file.fileName(); } } diff --git a/sources/awesome-widget/plugin/awformatterhelper.cpp b/sources/awesome-widget/plugin/awformatterhelper.cpp index 3a42a58..168f092 100644 --- a/sources/awesome-widget/plugin/awformatterhelper.cpp +++ b/sources/awesome-widget/plugin/awformatterhelper.cpp @@ -119,8 +119,8 @@ void AWFormatterHelper::initFormatters() for (auto file : files) { if (!file.endsWith(QString(".desktop"))) continue; - qCInfo(LOG_LIB) << "Found file" << file << "in" - << m_directories.at(i); + qCInfo(LOG_AW) << "Found file" << file << "in" + << m_directories.at(i); QString filePath = QString("%1/%2").arg(m_directories.at(i)).arg(file); auto metadata = readMetadata(filePath); @@ -161,6 +161,10 @@ void AWFormatterHelper::initKeys() for (auto key : keys) { QString name = settings.value(key).toString(); qCInfo(LOG_AW) << "Found formatter" << name << "for key" << key; + if (!m_formattersClasses.contains(name)) { + qCWarning(LOG_AW) << "Invalid formatter" << name << "found in" + << key; + } m_formatters[key] = m_formattersClasses[name]; } settings.endGroup(); @@ -175,7 +179,7 @@ void AWFormatterHelper::installDirectories() QStandardPaths::GenericDataLocation)); QDir localDirectory; if (localDirectory.mkpath(localDir)) - qCInfo(LOG_LIB) << "Created directory" << localDir; + qCInfo(LOG_AW) << "Created directory" << localDir; m_directories = QStandardPaths::locateAll( QStandardPaths::GenericDataLocation, @@ -196,7 +200,7 @@ AWFormatterHelper::readMetadata(const QString filePath) const settings.beginGroup(QString("Desktop Entry")); QString name = settings.value(QString("Name"), filePath).toString(); QString type - = settings.value(QString("Type"), QString("NoFormat")).toString(); + = settings.value(QString("X-AW-Type"), QString("NoFormat")).toString(); FormatterClass formatter = defineFormatterClass(type); settings.endGroup(); @@ -212,9 +216,12 @@ void AWFormatterHelper::doCreateItem() bool ok; QString select = QInputDialog::getItem( this, i18n("Select type"), i18n("Type:"), selection, 0, false, &ok); - if (!ok) + if (!ok) { + qCWarning(LOG_AW) << "No type selected"; return; + } + qCInfo(LOG_AW) << "Selected type" << select; FormatterClass formatter = defineFormatterClass(select); switch (formatter) { case FormatterClass::DateTime: diff --git a/sources/awesomewidgets/abstractextitem.cpp b/sources/awesomewidgets/abstractextitem.cpp index 7ec998f..b4fa77d 100644 --- a/sources/awesomewidgets/abstractextitem.cpp +++ b/sources/awesomewidgets/abstractextitem.cpp @@ -198,7 +198,7 @@ void AbstractExtItem::readConfiguration() bool AbstractExtItem::tryDelete() const { bool status = QFile::remove(m_fileName); - qCInfo(LOG_AW) << "Remove file" << m_fileName << status; + qCInfo(LOG_LIB) << "Remove file" << m_fileName << status; return status; } diff --git a/sources/awesomewidgets/abstractextitemaggregator.cpp b/sources/awesomewidgets/abstractextitemaggregator.cpp index 122ab07..90704cf 100644 --- a/sources/awesomewidgets/abstractextitemaggregator.cpp +++ b/sources/awesomewidgets/abstractextitemaggregator.cpp @@ -16,41 +16,35 @@ ***************************************************************************/ #include "abstractextitemaggregator.h" +#include "ui_abstractextitemaggregator.h" #include #include -#include #include -#include +#include AbstractExtItemAggregator::AbstractExtItemAggregator(QWidget *parent, const QString type) - : QWidget(parent) + : QDialog(parent) + , ui(new Ui::AbstractExtItemAggregator) , m_type(type) { qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; - dialog = new QDialog(this); - widgetDialog = new QListWidget(dialog); - dialogButtons = new QDialogButtonBox( - QDialogButtonBox::Open | QDialogButtonBox::Close, Qt::Vertical, dialog); + ui->setupUi(this); copyButton - = dialogButtons->addButton(i18n("Copy"), QDialogButtonBox::ActionRole); - createButton = dialogButtons->addButton(i18n("Create"), + = ui->buttonBox->addButton(i18n("Copy"), QDialogButtonBox::ActionRole); + createButton = ui->buttonBox->addButton(i18n("Create"), QDialogButtonBox::ActionRole); - deleteButton = dialogButtons->addButton(i18n("Remove"), + deleteButton = ui->buttonBox->addButton(i18n("Remove"), QDialogButtonBox::ActionRole); - QHBoxLayout *layout = new QHBoxLayout(dialog); - layout->addWidget(widgetDialog); - layout->addWidget(dialogButtons); - dialog->setLayout(layout); - connect(dialogButtons, SIGNAL(clicked(QAbstractButton *)), this, + connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(editItemButtonPressed(QAbstractButton *))); - connect(dialogButtons, SIGNAL(rejected()), dialog, SLOT(reject())); - connect(widgetDialog, SIGNAL(itemActivated(QListWidgetItem *)), this, + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + connect(ui->listWidget, SIGNAL(itemActivated(QListWidgetItem *)), this, SLOT(editItemActivated(QListWidgetItem *))); } @@ -59,7 +53,7 @@ AbstractExtItemAggregator::~AbstractExtItemAggregator() { qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; - delete dialog; + delete ui; } @@ -133,7 +127,7 @@ QString AbstractExtItemAggregator::getName() AbstractExtItem *AbstractExtItemAggregator::itemFromWidget() { - QListWidgetItem *widgetItem = widgetDialog->currentItem(); + QListWidgetItem *widgetItem = ui->listWidget->currentItem(); if (widgetItem == nullptr) return nullptr; @@ -155,16 +149,16 @@ AbstractExtItem *AbstractExtItemAggregator::itemFromWidget() void AbstractExtItemAggregator::repaintList() { - widgetDialog->clear(); + ui->listWidget->clear(); for (auto _item : items()) { QString fileName = QFileInfo(_item->fileName()).fileName(); - QListWidgetItem *item = new QListWidgetItem(fileName, widgetDialog); + QListWidgetItem *item = new QListWidgetItem(fileName, ui->listWidget); QStringList tooltip; tooltip.append(i18n("Name: %1", _item->name())); tooltip.append(i18n("Comment: %1", _item->comment())); tooltip.append(i18n("Identity: %1", _item->uniq())); item->setToolTip(tooltip.join(QChar('\n'))); - widgetDialog->addItem(item); + ui->listWidget->addItem(item); } } @@ -216,6 +210,6 @@ void AbstractExtItemAggregator::editItemButtonPressed(QAbstractButton *button) return doCreateItem(); else if (static_cast(button) == deleteButton) return deleteItem(); - else if (dialogButtons->buttonRole(button) == QDialogButtonBox::AcceptRole) + else if (ui->buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) return editItem(); } diff --git a/sources/awesomewidgets/abstractextitemaggregator.h b/sources/awesomewidgets/abstractextitemaggregator.h index 29d0cb8..cb1cb52 100644 --- a/sources/awesomewidgets/abstractextitemaggregator.h +++ b/sources/awesomewidgets/abstractextitemaggregator.h @@ -19,18 +19,20 @@ #define ABSTRACTEXTITEMAGGREGATOR_H #include -#include -#include -#include #include -#include #include "abstractextitem.h" #include "awdebug.h" -// additional class since QObject macro does not allow class templates -class AbstractExtItemAggregator : public QWidget +class QAbstractButton; +class QListWidgetItem; +namespace Ui +{ +class AbstractExtItemAggregator; +} + +class AbstractExtItemAggregator : public QDialog { Q_OBJECT Q_PROPERTY(QVariant configArgs READ configArgs WRITE setConfigArgs) @@ -68,13 +70,6 @@ public: AbstractExtItem *itemFromWidget(); void repaintList(); int uniqNumber() const; - // ui - QDialog *dialog = nullptr; - QListWidget *widgetDialog = nullptr; - QDialogButtonBox *dialogButtons = nullptr; - QPushButton *copyButton = nullptr; - QPushButton *createButton = nullptr; - QPushButton *deleteButton = nullptr; // get methods QVariant configArgs() const; virtual QList items() const = 0; @@ -87,6 +82,12 @@ private slots: void editItemButtonPressed(QAbstractButton *button); private: + // ui + Ui::AbstractExtItemAggregator *ui = nullptr; + QPushButton *copyButton = nullptr; + QPushButton *createButton = nullptr; + QPushButton *deleteButton = nullptr; + // properties QVariant m_configArgs; QString m_type; // ui methods diff --git a/sources/awesomewidgets/abstractextitemaggregator.ui b/sources/awesomewidgets/abstractextitemaggregator.ui new file mode 100644 index 0000000..f0c541d --- /dev/null +++ b/sources/awesomewidgets/abstractextitemaggregator.ui @@ -0,0 +1,64 @@ + + + AbstractExtItemAggregator + + + + 0 + 0 + 400 + 300 + + + + + + + + + + Qt::Vertical + + + QDialogButtonBox::Close|QDialogButtonBox::Open + + + + + + + + + buttonBox + accepted() + AbstractExtItemAggregator + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + AbstractExtItemAggregator + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/sources/awesomewidgets/awabstractformatter.cpp b/sources/awesomewidgets/awabstractformatter.cpp index e44c240..18e39ea 100644 --- a/sources/awesomewidgets/awabstractformatter.cpp +++ b/sources/awesomewidgets/awabstractformatter.cpp @@ -26,13 +26,13 @@ AWAbstractFormatter::AWAbstractFormatter(QWidget *parent, const QString filePath) : AbstractExtItem(parent, filePath) { - qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; } AWAbstractFormatter::~AWAbstractFormatter() { - qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; } @@ -58,7 +58,7 @@ QString AWAbstractFormatter::type() const void AWAbstractFormatter::setType(const QString _type) { - qCDebug(LOG_AW) << "Type" << _type; + qCDebug(LOG_LIB) << "Type" << _type; m_type = _type; } @@ -71,7 +71,7 @@ void AWAbstractFormatter::readConfiguration() QSettings settings(fileName(), QSettings::IniFormat); settings.beginGroup(QString("Desktop Entry")); - setType(settings.value(QString("Type"), m_type).toString()); + setType(settings.value(QString("X-AW-Type"), m_type).toString()); settings.endGroup(); } @@ -81,10 +81,10 @@ void AWAbstractFormatter::writeConfiguration() const AbstractExtItem::writeConfiguration(); QSettings settings(writtableConfig(), QSettings::IniFormat); - qCInfo(LOG_AW) << "Configuration file" << settings.fileName(); + qCInfo(LOG_LIB) << "Configuration file" << settings.fileName(); settings.beginGroup(QString("Desktop Entry")); - settings.setValue(QString("Type"), m_type); + settings.setValue(QString("X-AW-Type"), m_type); settings.endGroup(); settings.sync(); diff --git a/sources/awesomewidgets/awdatetimeformatter.cpp b/sources/awesomewidgets/awdatetimeformatter.cpp index 96e28dd..24c1aa4 100644 --- a/sources/awesomewidgets/awdatetimeformatter.cpp +++ b/sources/awesomewidgets/awdatetimeformatter.cpp @@ -33,7 +33,7 @@ AWDateTimeFormatter::AWDateTimeFormatter(QWidget *parent, : AWAbstractFormatter(parent, filePath) , ui(new Ui::AWDateTimeFormatter) { - qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; readConfiguration(); ui->setupUi(this); @@ -45,7 +45,7 @@ AWDateTimeFormatter::AWDateTimeFormatter(const QString format, QWidget *parent) : AWAbstractFormatter(parent) , ui(new Ui::AWDateTimeFormatter) { - qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; setFormat(format); @@ -56,7 +56,7 @@ AWDateTimeFormatter::AWDateTimeFormatter(const QString format, QWidget *parent) AWDateTimeFormatter::~AWDateTimeFormatter() { - qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; delete ui; } @@ -64,7 +64,7 @@ AWDateTimeFormatter::~AWDateTimeFormatter() QString AWDateTimeFormatter::convert(const QVariant &_value) const { - qCDebug(LOG_AW) << "Convert value" << _value; + qCDebug(LOG_LIB) << "Convert value" << _value; return _value.toDateTime().toString(m_format); } @@ -93,7 +93,7 @@ QString AWDateTimeFormatter::format() const void AWDateTimeFormatter::setFormat(const QString _format) { - qCDebug(LOG_AW) << "Set format" << _format; + qCDebug(LOG_LIB) << "Set format" << _format; m_format = _format; } @@ -106,7 +106,7 @@ void AWDateTimeFormatter::readConfiguration() QSettings settings(fileName(), QSettings::IniFormat); settings.beginGroup(QString("Desktop Entry")); - setFormat(settings.value(QString("Format"), m_format).toString()); + setFormat(settings.value(QString("X-AW-Format"), m_format).toString()); settings.endGroup(); } @@ -141,7 +141,7 @@ void AWDateTimeFormatter::writeConfiguration() const qCInfo(LOG_LIB) << "Configuration file" << settings.fileName(); settings.beginGroup(QString("Desktop Entry")); - settings.setValue(QString("Format"), m_format); + settings.setValue(QString("X-AW-Format"), m_format); settings.endGroup(); settings.sync(); diff --git a/sources/awesomewidgets/awdatetimeformatter.h b/sources/awesomewidgets/awdatetimeformatter.h index 29d2c82..d908a73 100644 --- a/sources/awesomewidgets/awdatetimeformatter.h +++ b/sources/awesomewidgets/awdatetimeformatter.h @@ -47,7 +47,7 @@ public slots: void writeConfiguration() const; private: - Ui::AWDateTimeFormatter *ui; + Ui::AWDateTimeFormatter *ui = nullptr; void translate(); // properties QString m_format = QString(); diff --git a/sources/awesomewidgets/awfloatformatter.cpp b/sources/awesomewidgets/awfloatformatter.cpp index 9b37d29..6bd3fb8 100644 --- a/sources/awesomewidgets/awfloatformatter.cpp +++ b/sources/awesomewidgets/awfloatformatter.cpp @@ -31,7 +31,7 @@ AWFloatFormatter::AWFloatFormatter(QWidget *parent, const QString filePath) : AWAbstractFormatter(parent, filePath) , ui(new Ui::AWFloatFormatter) { - qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; readConfiguration(); ui->setupUi(this); @@ -46,7 +46,7 @@ AWFloatFormatter::AWFloatFormatter(const int count, const QChar fillChar, : AWAbstractFormatter(parent) , ui(new Ui::AWFloatFormatter) { - qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; setCount(count); setFillChar(fillChar); @@ -62,7 +62,7 @@ AWFloatFormatter::AWFloatFormatter(const int count, const QChar fillChar, AWFloatFormatter::~AWFloatFormatter() { - qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; delete ui; } @@ -70,7 +70,7 @@ AWFloatFormatter::~AWFloatFormatter() QString AWFloatFormatter::convert(const QVariant &_value) const { - qCDebug(LOG_AW) << "Convert value" << _value; + qCDebug(LOG_LIB) << "Convert value" << _value; return QString("%1").arg(_value.toDouble() * m_multiplier + m_summand, m_count, m_format, m_precision, m_fillChar); @@ -135,7 +135,7 @@ double AWFloatFormatter::summand() const void AWFloatFormatter::setCount(const int _count) { - qCDebug(LOG_AW) << "Set width" << _count; + qCDebug(LOG_LIB) << "Set width" << _count; m_count = _count; } @@ -143,7 +143,7 @@ void AWFloatFormatter::setCount(const int _count) void AWFloatFormatter::setFillChar(const QChar _fillChar) { - qCDebug(LOG_AW) << "Set char" << _fillChar; + qCDebug(LOG_LIB) << "Set char" << _fillChar; m_fillChar = _fillChar; } @@ -151,11 +151,11 @@ void AWFloatFormatter::setFillChar(const QChar _fillChar) void AWFloatFormatter::setFormat(char _format) { - qCDebug(LOG_AW) << "Set format" << _format; + qCDebug(LOG_LIB) << "Set format" << _format; // http://doc.qt.io/qt-5/qstring.html#argument-formats if ((_format != 'e') && (_format != 'E') && (_format != 'f') && (_format != 'g') && (_format != 'G')) { - qCWarning(LOG_AW) << "Invalid format" << _format; + qCWarning(LOG_LIB) << "Invalid format" << _format; _format = 'f'; } @@ -165,7 +165,7 @@ void AWFloatFormatter::setFormat(char _format) void AWFloatFormatter::setMultiplier(const double _multiplier) { - qCDebug(LOG_AW) << "Set multiplier" << _multiplier; + qCDebug(LOG_LIB) << "Set multiplier" << _multiplier; m_multiplier = _multiplier; } @@ -173,7 +173,7 @@ void AWFloatFormatter::setMultiplier(const double _multiplier) void AWFloatFormatter::setPrecision(const int _precision) { - qCDebug(LOG_AW) << "Set precision" << _precision; + qCDebug(LOG_LIB) << "Set precision" << _precision; m_precision = _precision; } @@ -181,7 +181,7 @@ void AWFloatFormatter::setPrecision(const int _precision) void AWFloatFormatter::setSummand(const double _summand) { - qCDebug(LOG_AW) << "Set summand" << _summand; + qCDebug(LOG_LIB) << "Set summand" << _summand; m_summand = _summand; } @@ -194,17 +194,18 @@ void AWFloatFormatter::readConfiguration() QSettings settings(fileName(), QSettings::IniFormat); settings.beginGroup(QString("Desktop Entry")); - setCount(settings.value(QString("Width"), m_count).toInt()); + setCount(settings.value(QString("X-AW-Width"), m_count).toInt()); setFillChar( - settings.value(QString("FillChar"), m_fillChar).toString().at(0)); - setFormat(settings.value(QString("Format"), QString(m_format)) + settings.value(QString("X-AW-FillChar"), m_fillChar).toString().at(0)); + setFormat(settings.value(QString("X-AW-Format"), QString(m_format)) .toString() .at(0) .toLatin1()); setMultiplier( - settings.value(QString("Multiplier"), m_multiplier).toDouble()); - setPrecision(settings.value(QString("Precision"), m_precision).toInt()); - setSummand(settings.value(QString("Summand"), m_summand).toDouble()); + settings.value(QString("X-AW-Multiplier"), m_multiplier).toDouble()); + setPrecision( + settings.value(QString("X-AW-Precision"), m_precision).toInt()); + setSummand(settings.value(QString("X-AW-Summand"), m_summand).toDouble()); settings.endGroup(); } @@ -250,12 +251,12 @@ void AWFloatFormatter::writeConfiguration() const qCInfo(LOG_LIB) << "Configuration file" << settings.fileName(); settings.beginGroup(QString("Desktop Entry")); - settings.setValue(QString("Width"), m_count); - settings.setValue(QString("FillChar"), m_fillChar); - settings.setValue(QString("Format"), m_format); - settings.setValue(QString("Multiplier"), m_multiplier); - settings.setValue(QString("Precision"), m_precision); - settings.setValue(QString("Summand"), m_summand); + settings.setValue(QString("X-AW-Width"), m_count); + settings.setValue(QString("X-AW-FillChar"), m_fillChar); + settings.setValue(QString("X-AW-Format"), m_format); + settings.setValue(QString("X-AW-Multiplier"), m_multiplier); + settings.setValue(QString("X-AW-Precision"), m_precision); + settings.setValue(QString("X-AW-Summand"), m_summand); settings.endGroup(); settings.sync(); diff --git a/sources/awesomewidgets/awfloatformatter.h b/sources/awesomewidgets/awfloatformatter.h index 921ea70..1087214 100644 --- a/sources/awesomewidgets/awfloatformatter.h +++ b/sources/awesomewidgets/awfloatformatter.h @@ -65,7 +65,7 @@ public slots: void writeConfiguration() const; private: - Ui::AWFloatFormatter *ui; + Ui::AWFloatFormatter *ui = nullptr; void translate(); // properties int m_count = 0; diff --git a/sources/awesomewidgets/awnoformatter.cpp b/sources/awesomewidgets/awnoformatter.cpp index 7f727ad..dd801d4 100644 --- a/sources/awesomewidgets/awnoformatter.cpp +++ b/sources/awesomewidgets/awnoformatter.cpp @@ -28,7 +28,7 @@ AWNoFormatter::AWNoFormatter(QWidget *parent, const QString filePath) : AWAbstractFormatter(parent, filePath) , ui(new Ui::AWNoFormatter) { - qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; readConfiguration(); ui->setupUi(this); @@ -40,7 +40,7 @@ AWNoFormatter::AWNoFormatter(QWidget *parent) : AWAbstractFormatter(parent) , ui(new Ui::AWNoFormatter) { - qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; ui->setupUi(this); translate(); @@ -49,7 +49,7 @@ AWNoFormatter::AWNoFormatter(QWidget *parent) AWNoFormatter::~AWNoFormatter() { - qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; delete ui; } @@ -57,7 +57,7 @@ AWNoFormatter::~AWNoFormatter() QString AWNoFormatter::convert(const QVariant &_value) const { - qCDebug(LOG_AW) << "Convert value" << _value; + qCDebug(LOG_LIB) << "Convert value" << _value; return _value.toString(); } diff --git a/sources/awesomewidgets/awnoformatter.h b/sources/awesomewidgets/awnoformatter.h index 31121bc..d8efab5 100644 --- a/sources/awesomewidgets/awnoformatter.h +++ b/sources/awesomewidgets/awnoformatter.h @@ -41,7 +41,7 @@ public slots: int showConfiguration(const QVariant args = QVariant()); private: - Ui::AWNoFormatter *ui; + Ui::AWNoFormatter *ui = nullptr; void translate(); // properties }; diff --git a/sources/awesomewidgets/awscriptformatter.cpp b/sources/awesomewidgets/awscriptformatter.cpp index bc7909d..a97ff41 100644 --- a/sources/awesomewidgets/awscriptformatter.cpp +++ b/sources/awesomewidgets/awscriptformatter.cpp @@ -32,7 +32,7 @@ AWScriptFormatter::AWScriptFormatter(QWidget *parent, const QString filePath) : AWAbstractFormatter(parent, filePath) , ui(new Ui::AWScriptFormatter) { - qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; readConfiguration(); ui->setupUi(this); @@ -45,7 +45,7 @@ AWScriptFormatter::AWScriptFormatter(const bool appendCode, const QString code, : AWAbstractFormatter(parent) , ui(new Ui::AWScriptFormatter) { - qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; setAppendCode(appendCode); setCode(code); @@ -59,7 +59,7 @@ AWScriptFormatter::AWScriptFormatter(const bool appendCode, const QString code, AWScriptFormatter::~AWScriptFormatter() { - qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + qCDebug(LOG_LIB) << __PRETTY_FUNCTION__; delete ui; } @@ -67,7 +67,7 @@ AWScriptFormatter::~AWScriptFormatter() QString AWScriptFormatter::convert(const QVariant &_value) const { - qCDebug(LOG_AW) << "Convert value" << _value; + qCDebug(LOG_LIB) << "Convert value" << _value; // init engine QJSEngine engine; @@ -76,9 +76,9 @@ QString AWScriptFormatter::convert(const QVariant &_value) const QJSValue result = fn.call(args); if (result.isError()) { - qCWarning(LOG_AW) << "Uncaught exception at line" - << result.property("lineNumber").toInt() << ":" - << result.toString(); + qCWarning(LOG_LIB) << "Uncaught exception at line" + << result.property("lineNumber").toInt() << ":" + << result.toString(); return QString(); } else { return result.toString(); @@ -129,7 +129,7 @@ QString AWScriptFormatter::program() const void AWScriptFormatter::setAppendCode(const bool _appendCode) { - qCDebug(LOG_AW) << "Set append code" << _appendCode; + qCDebug(LOG_LIB) << "Set append code" << _appendCode; m_appendCode = _appendCode; } @@ -137,7 +137,7 @@ void AWScriptFormatter::setAppendCode(const bool _appendCode) void AWScriptFormatter::setCode(const QString _code) { - qCDebug(LOG_AW) << "Set code" << _code; + qCDebug(LOG_LIB) << "Set code" << _code; m_code = _code; } @@ -145,7 +145,7 @@ void AWScriptFormatter::setCode(const QString _code) void AWScriptFormatter::setHasReturn(const bool _hasReturn) { - qCDebug(LOG_AW) << "Set has return" << _hasReturn; + qCDebug(LOG_LIB) << "Set has return" << _hasReturn; m_hasReturn = _hasReturn; } @@ -158,9 +158,11 @@ void AWScriptFormatter::readConfiguration() QSettings settings(fileName(), QSettings::IniFormat); settings.beginGroup(QString("Desktop Entry")); - setAppendCode(settings.value(QString("AppendCode"), m_appendCode).toBool()); - setCode(settings.value(QString("Code"), m_code).toString()); - setHasReturn(settings.value(QString("HasReturn"), m_hasReturn).toBool()); + setAppendCode( + settings.value(QString("X-AW-AppendCode"), m_appendCode).toBool()); + setCode(settings.value(QString("X-AW-Code"), m_code).toString()); + setHasReturn( + settings.value(QString("X-AW-HasReturn"), m_hasReturn).toBool()); settings.endGroup(); initProgram(); @@ -204,9 +206,9 @@ void AWScriptFormatter::writeConfiguration() const qCInfo(LOG_LIB) << "Configuration file" << settings.fileName(); settings.beginGroup(QString("Desktop Entry")); - settings.setValue(QString("AppendCode"), m_appendCode); - settings.setValue(QString("Code"), m_code); - settings.setValue(QString("HasReturn"), m_hasReturn); + settings.setValue(QString("X-AW-AppendCode"), m_appendCode); + settings.setValue(QString("X-AW-Code"), m_code); + settings.setValue(QString("X-AW-HasReturn"), m_hasReturn); settings.endGroup(); settings.sync(); @@ -223,7 +225,7 @@ void AWScriptFormatter::initProgram() else m_program = m_code; - qCInfo(LOG_AW) << "Create JS engine with code" << m_program; + qCInfo(LOG_LIB) << "Create JS engine with code" << m_program; } diff --git a/sources/awesomewidgets/awscriptformatter.h b/sources/awesomewidgets/awscriptformatter.h index 0b8d786..3af8ade 100644 --- a/sources/awesomewidgets/awscriptformatter.h +++ b/sources/awesomewidgets/awscriptformatter.h @@ -56,7 +56,7 @@ public slots: void writeConfiguration() const; private: - Ui::AWScriptFormatter *ui; + Ui::AWScriptFormatter *ui = nullptr; void initProgram(); void translate(); // properties diff --git a/sources/awesomewidgets/extitemaggregator.h b/sources/awesomewidgets/extitemaggregator.h index 5527d07..7549383 100644 --- a/sources/awesomewidgets/extitemaggregator.h +++ b/sources/awesomewidgets/extitemaggregator.h @@ -57,7 +57,7 @@ public: void editItems() { repaintList(); - int ret = dialog->exec(); + int ret = exec(); qCInfo(LOG_LIB) << "Dialog returns" << ret; }; diff --git a/sources/awesomewidgets/extquotes.h b/sources/awesomewidgets/extquotes.h index 16c3fe7..38e0057 100644 --- a/sources/awesomewidgets/extquotes.h +++ b/sources/awesomewidgets/extquotes.h @@ -58,10 +58,10 @@ private slots: void quotesReplyReceived(QNetworkReply *reply); private: - QNetworkAccessManager *m_manager; + QNetworkAccessManager *m_manager = nullptr; QUrl m_url; bool isRunning = false; - Ui::ExtQuotes *ui; + Ui::ExtQuotes *ui = nullptr; void translate(); // properties QString m_ticker = QString("EURUSD=X"); diff --git a/sources/awesomewidgets/extscript.h b/sources/awesomewidgets/extscript.h index a6be0bd..e4e8a45 100644 --- a/sources/awesomewidgets/extscript.h +++ b/sources/awesomewidgets/extscript.h @@ -73,7 +73,7 @@ private slots: private: QProcess *process = nullptr; - Ui::ExtScript *ui; + Ui::ExtScript *ui = nullptr; void translate(); // properties QString m_executable = QString("/usr/bin/true"); diff --git a/sources/awesomewidgets/extupgrade.h b/sources/awesomewidgets/extupgrade.h index 709d4d7..ad981a9 100644 --- a/sources/awesomewidgets/extupgrade.h +++ b/sources/awesomewidgets/extupgrade.h @@ -61,7 +61,7 @@ private slots: private: QProcess *process = nullptr; - Ui::ExtUpgrade *ui; + Ui::ExtUpgrade *ui = nullptr; void translate(); // properties QString m_executable = QString("/usr/bin/true"); diff --git a/sources/awesomewidgets/extweather.h b/sources/awesomewidgets/extweather.h index e4d91ee..0f4d87d 100644 --- a/sources/awesomewidgets/extweather.h +++ b/sources/awesomewidgets/extweather.h @@ -70,10 +70,10 @@ private slots: void weatherReplyReceived(QNetworkReply *reply); private: - QNetworkAccessManager *m_manager; + QNetworkAccessManager *m_manager = nullptr; QUrl m_url; bool isRunning = false; - Ui::ExtWeather *ui; + Ui::ExtWeather *ui = nullptr; void translate(); // properties QString m_city = QString("London"); diff --git a/sources/awesomewidgets/graphicalitem.h b/sources/awesomewidgets/graphicalitem.h index 3938c1a..c504996 100644 --- a/sources/awesomewidgets/graphicalitem.h +++ b/sources/awesomewidgets/graphicalitem.h @@ -105,7 +105,7 @@ private: GraphicalItemHelper *m_helper = nullptr; QGraphicsScene *m_scene = nullptr; QGraphicsView *m_view = nullptr; - Ui::GraphicalItem *ui; + Ui::GraphicalItem *ui = nullptr; void initScene(); void translate(); // properties diff --git a/sources/extsysmon/sources/customsource.h b/sources/extsysmon/sources/customsource.h index 91ee081..3230de2 100644 --- a/sources/extsysmon/sources/customsource.h +++ b/sources/extsysmon/sources/customsource.h @@ -39,7 +39,7 @@ public: private: QStringList getSources(); // configuration and values - ExtItemAggregator *extScripts; + ExtItemAggregator *extScripts = nullptr; QStringList m_sources; }; diff --git a/sources/extsysmon/sources/quotessource.h b/sources/extsysmon/sources/quotessource.h index ae09f0b..edb3490 100644 --- a/sources/extsysmon/sources/quotessource.h +++ b/sources/extsysmon/sources/quotessource.h @@ -39,7 +39,7 @@ public: private: QStringList getSources(); // configuration and values - ExtItemAggregator *extQuotes; + ExtItemAggregator *extQuotes = nullptr; QStringList m_sources; QVariantHash m_values; }; diff --git a/sources/extsysmon/sources/upgradesource.h b/sources/extsysmon/sources/upgradesource.h index d020151..8bf6a81 100644 --- a/sources/extsysmon/sources/upgradesource.h +++ b/sources/extsysmon/sources/upgradesource.h @@ -39,7 +39,7 @@ public: private: QStringList getSources(); // configuration and values - ExtItemAggregator *extUpgrade; + ExtItemAggregator *extUpgrade = nullptr; QStringList m_sources; }; diff --git a/sources/extsysmon/sources/weathersource.h b/sources/extsysmon/sources/weathersource.h index 50b9f83..88520f6 100644 --- a/sources/extsysmon/sources/weathersource.h +++ b/sources/extsysmon/sources/weathersource.h @@ -39,7 +39,7 @@ public: private: QStringList getSources(); // configuration and values - ExtItemAggregator *extWeather; + ExtItemAggregator *extWeather = nullptr; QStringList m_sources; QVariantHash m_values; };