mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-10 04:15:51 +00:00
system source, some code improvements
This commit is contained in:
@ -45,7 +45,7 @@ AbstractExtItem::~AbstractExtItem()
|
||||
|
||||
if (m_socket) {
|
||||
m_socket->close();
|
||||
m_socket->removeServer(socket());
|
||||
QLocalServer::removeServer(socket());
|
||||
m_socket->deleteLater();
|
||||
}
|
||||
}
|
||||
@ -270,7 +270,7 @@ void AbstractExtItem::deinitSocket()
|
||||
return;
|
||||
|
||||
m_socket->close();
|
||||
m_socket->removeServer(socket());
|
||||
QLocalServer::removeServer(socket());
|
||||
delete m_socket;
|
||||
disconnect(m_socket, SIGNAL(newConnection()), this, SLOT(newConnectionReceived()));
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class AbstractExtItem : public QDialog
|
||||
|
||||
public:
|
||||
explicit AbstractExtItem(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AbstractExtItem();
|
||||
~AbstractExtItem() override;
|
||||
virtual void bumpApi(const int _newVer);
|
||||
virtual AbstractExtItem *copy(const QString &_fileName, const int _number) = 0;
|
||||
virtual void copyDefaults(AbstractExtItem *_other) const;
|
||||
|
@ -23,12 +23,13 @@
|
||||
#include <QDir>
|
||||
#include <QInputDialog>
|
||||
#include <QPushButton>
|
||||
#include <utility>
|
||||
|
||||
|
||||
AbstractExtItemAggregator::AbstractExtItemAggregator(QWidget *_parent, const QString &_type)
|
||||
AbstractExtItemAggregator::AbstractExtItemAggregator(QWidget *_parent, QString _type)
|
||||
: QDialog(_parent)
|
||||
, ui(new Ui::AbstractExtItemAggregator)
|
||||
, m_type(_type)
|
||||
, m_type(std::move(_type))
|
||||
{
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
@ -90,7 +91,7 @@ void AbstractExtItemAggregator::deleteItem()
|
||||
if (!source) {
|
||||
qCWarning(LOG_LIB) << "Nothing to delete";
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
if (source->tryDelete()) {
|
||||
initItems();
|
||||
@ -105,7 +106,7 @@ void AbstractExtItemAggregator::editItem()
|
||||
if (!source) {
|
||||
qCWarning(LOG_LIB) << "Nothing to edit";
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
if (source->showConfiguration(configArgs()) == 1) {
|
||||
initItems();
|
||||
@ -154,7 +155,7 @@ void AbstractExtItemAggregator::repaintList()
|
||||
ui->listWidget->clear();
|
||||
for (auto &_item : items()) {
|
||||
QString fileName = QFileInfo(_item->fileName()).fileName();
|
||||
QListWidgetItem *item = new QListWidgetItem(fileName, ui->listWidget);
|
||||
auto *item = new QListWidgetItem(fileName, ui->listWidget);
|
||||
QStringList tooltip;
|
||||
tooltip.append(i18n("Name: %1", _item->name()));
|
||||
tooltip.append(i18n("Comment: %1", _item->comment()));
|
||||
@ -216,11 +217,11 @@ void AbstractExtItemAggregator::editItemActivated(QListWidgetItem *)
|
||||
|
||||
void AbstractExtItemAggregator::editItemButtonPressed(QAbstractButton *_button)
|
||||
{
|
||||
if (static_cast<QPushButton *>(_button) == copyButton)
|
||||
if (dynamic_cast<QPushButton *>(_button) == copyButton)
|
||||
return copyItem();
|
||||
else if (static_cast<QPushButton *>(_button) == createButton)
|
||||
else if (dynamic_cast<QPushButton *>(_button) == createButton)
|
||||
return doCreateItem();
|
||||
else if (static_cast<QPushButton *>(_button) == deleteButton)
|
||||
else if (dynamic_cast<QPushButton *>(_button) == deleteButton)
|
||||
return deleteItem();
|
||||
else if (ui->buttonBox->buttonRole(_button) == QDialogButtonBox::AcceptRole)
|
||||
return editItem();
|
||||
|
@ -39,8 +39,8 @@ class AbstractExtItemAggregator : public QDialog
|
||||
Q_PROPERTY(QVariant type READ type)
|
||||
|
||||
public:
|
||||
explicit AbstractExtItemAggregator(QWidget *_parent, const QString &_type);
|
||||
virtual ~AbstractExtItemAggregator();
|
||||
explicit AbstractExtItemAggregator(QWidget *_parent, QString _type);
|
||||
~AbstractExtItemAggregator() override;
|
||||
// methods
|
||||
void copyItem();
|
||||
template <class T> void createItem()
|
||||
@ -54,7 +54,7 @@ public:
|
||||
if (fileName.isEmpty()) {
|
||||
qCWarning(LOG_LIB) << "Nothing to create";
|
||||
return;
|
||||
};
|
||||
}
|
||||
QString filePath = QString("%1/%2").arg(dir).arg(fileName);
|
||||
|
||||
T *newItem = new T(this, filePath);
|
||||
@ -62,7 +62,7 @@ public:
|
||||
if (newItem->showConfiguration(configArgs()) == 1) {
|
||||
initItems();
|
||||
repaintList();
|
||||
};
|
||||
}
|
||||
};
|
||||
void deleteItem();
|
||||
void editItem();
|
||||
|
@ -31,12 +31,12 @@ class AbstractQuotesProvider : public QObject
|
||||
public:
|
||||
explicit AbstractQuotesProvider(QObject *_parent)
|
||||
: QObject(_parent){};
|
||||
virtual ~AbstractQuotesProvider(){};
|
||||
~AbstractQuotesProvider() override = default;
|
||||
virtual void initUrl(const QString &_asset) = 0;
|
||||
virtual QVariantHash parse(const QByteArray &_source, const QVariantHash &_oldValues) const = 0;
|
||||
QString tag(const QString &_type) const
|
||||
{
|
||||
return static_cast<AbstractExtItem *>(parent())->tag(_type);
|
||||
return dynamic_cast<AbstractExtItem *>(parent())->tag(_type);
|
||||
};
|
||||
virtual QUrl url() const = 0;
|
||||
};
|
||||
|
@ -31,12 +31,12 @@ class AbstractWeatherProvider : public QObject
|
||||
public:
|
||||
explicit AbstractWeatherProvider(QObject *_parent)
|
||||
: QObject(_parent){};
|
||||
virtual ~AbstractWeatherProvider(){};
|
||||
~AbstractWeatherProvider() override = default;
|
||||
virtual void initUrl(const QString &_city, const QString &_country, const int _ts) = 0;
|
||||
virtual QVariantHash parse(const QVariantMap &_json) const = 0;
|
||||
QString tag(const QString &_type) const
|
||||
{
|
||||
return static_cast<AbstractExtItem *>(parent())->tag(_type);
|
||||
return dynamic_cast<AbstractExtItem *>(parent())->tag(_type);
|
||||
};
|
||||
virtual QUrl url() const = 0;
|
||||
};
|
||||
|
@ -39,7 +39,7 @@ void AWAbstractFormatter::copyDefaults(AbstractExtItem *_other) const
|
||||
{
|
||||
AbstractExtItem::copyDefaults(_other);
|
||||
|
||||
static_cast<AWAbstractFormatter *>(_other)->setType(type());
|
||||
dynamic_cast<AWAbstractFormatter *>(_other)->setType(type());
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,10 +31,10 @@ public:
|
||||
enum class FormatterClass { DateTime, Float, List, Script, String, NoFormat, Json };
|
||||
|
||||
explicit AWAbstractFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AWAbstractFormatter();
|
||||
~AWAbstractFormatter() override;
|
||||
virtual QString convert(const QVariant &_value) const = 0;
|
||||
void copyDefaults(AbstractExtItem *_other) const;
|
||||
QString uniq() const;
|
||||
void copyDefaults(AbstractExtItem *_other) const override;
|
||||
QString uniq() const override;
|
||||
// properties
|
||||
QString strType() const;
|
||||
FormatterClass type() const;
|
||||
@ -42,9 +42,9 @@ public:
|
||||
void setType(const FormatterClass _type);
|
||||
|
||||
public slots:
|
||||
virtual void readConfiguration();
|
||||
QVariantHash run() { return QVariantHash(); };
|
||||
virtual void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
QVariantHash run() override { return QVariantHash(); };
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private:
|
||||
// properties
|
||||
|
@ -60,8 +60,7 @@ AWDateTimeFormatter *AWDateTimeFormatter::copy(const QString &_fileName, const i
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
AWDateTimeFormatter *item
|
||||
= new AWDateTimeFormatter(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new AWDateTimeFormatter(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
AWAbstractFormatter::copyDefaults(item);
|
||||
item->setFormat(format());
|
||||
item->setTranslateString(translateString());
|
||||
|
@ -36,9 +36,9 @@ class AWDateTimeFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWDateTimeFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AWDateTimeFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWDateTimeFormatter *copy(const QString &_fileName, const int _number);
|
||||
~AWDateTimeFormatter() override;
|
||||
QString convert(const QVariant &_value) const override;
|
||||
AWDateTimeFormatter *copy(const QString &_fileName, const int _number) override;
|
||||
// properties
|
||||
QString format() const;
|
||||
bool translateString() const;
|
||||
@ -46,14 +46,14 @@ public:
|
||||
void setTranslateString(const bool _translate);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private:
|
||||
Ui::AWDateTimeFormatter *ui = nullptr;
|
||||
void initLocale();
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QLocale m_locale;
|
||||
QString m_format = "";
|
||||
|
@ -64,7 +64,7 @@ AWFloatFormatter *AWFloatFormatter::copy(const QString &_fileName, const int _nu
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
AWFloatFormatter *item = new AWFloatFormatter(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new AWFloatFormatter(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
AWAbstractFormatter::copyDefaults(item);
|
||||
item->setCount(count());
|
||||
item->setFormat(format());
|
||||
|
@ -39,9 +39,9 @@ class AWFloatFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWFloatFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AWFloatFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWFloatFormatter *copy(const QString &_fileName, const int _number);
|
||||
~AWFloatFormatter() override;
|
||||
QString convert(const QVariant &_value) const override;
|
||||
AWFloatFormatter *copy(const QString &_fileName, const int _number) override;
|
||||
// properties
|
||||
int count() const;
|
||||
QChar fillChar() const;
|
||||
@ -59,13 +59,13 @@ public:
|
||||
void setSummand(const double _summand);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private:
|
||||
Ui::AWFloatFormatter *ui = nullptr;
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
int m_count = 0;
|
||||
QChar m_fillChar = QChar();
|
||||
|
@ -68,7 +68,7 @@ AWJsonFormatter *AWJsonFormatter::copy(const QString &_fileName, const int _numb
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
AWJsonFormatter *item = new AWJsonFormatter(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new AWJsonFormatter(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
AWAbstractFormatter::copyDefaults(item);
|
||||
item->setNumber(_number);
|
||||
item->setPath(path());
|
||||
@ -159,7 +159,7 @@ QVariant AWJsonFormatter::getFromJson(const QVariant &_value, const QVariant &_e
|
||||
}
|
||||
|
||||
|
||||
QVariant AWJsonFormatter::getFromList(const QVariant &_value, const int _index) const
|
||||
QVariant AWJsonFormatter::getFromList(const QVariant &_value, const int _index)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Looking for index" << _index << "in" << _value;
|
||||
|
||||
@ -167,7 +167,7 @@ QVariant AWJsonFormatter::getFromList(const QVariant &_value, const int _index)
|
||||
}
|
||||
|
||||
|
||||
QVariant AWJsonFormatter::getFromMap(const QVariant &_value, const QString &_key) const
|
||||
QVariant AWJsonFormatter::getFromMap(const QVariant &_value, const QString &_key)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Looking for key" << _key << "in" << _value;
|
||||
|
||||
|
@ -33,25 +33,25 @@ class AWJsonFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWJsonFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AWJsonFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWJsonFormatter *copy(const QString &_fileName, const int _number);
|
||||
~AWJsonFormatter() override;
|
||||
QString convert(const QVariant &_value) const override;
|
||||
AWJsonFormatter *copy(const QString &_fileName, const int _number) override;
|
||||
// properties
|
||||
QString path() const;
|
||||
void setPath(const QString &_path);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private:
|
||||
Ui::AWJsonFormatter *ui = nullptr;
|
||||
QVariant getFromJson(const QVariant &_value, const QVariant &_element) const;
|
||||
QVariant getFromList(const QVariant &_value, const int _index) const;
|
||||
QVariant getFromMap(const QVariant &_value, const QString &_key) const;
|
||||
static QVariant getFromList(const QVariant &_value, const int _index);
|
||||
static QVariant getFromMap(const QVariant &_value, const QString &_key);
|
||||
void initPath();
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QString m_path;
|
||||
QVariantList m_splittedPath;
|
||||
|
@ -63,7 +63,7 @@ AWListFormatter *AWListFormatter::copy(const QString &_fileName, const int _numb
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
AWListFormatter *item = new AWListFormatter(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new AWListFormatter(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
AWAbstractFormatter::copyDefaults(item);
|
||||
item->setFilter(filter());
|
||||
item->setSeparator(separator());
|
||||
|
@ -35,9 +35,9 @@ class AWListFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWListFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AWListFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWListFormatter *copy(const QString &_fileName, const int _number);
|
||||
~AWListFormatter() override;
|
||||
QString convert(const QVariant &_value) const override;
|
||||
AWListFormatter *copy(const QString &_fileName, const int _number) override;
|
||||
// properties
|
||||
QString filter() const;
|
||||
bool isSorted() const;
|
||||
@ -47,13 +47,13 @@ public:
|
||||
void setSorted(const bool _sorted);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private:
|
||||
Ui::AWListFormatter *ui = nullptr;
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QString m_filter = "";
|
||||
QString m_separator = "";
|
||||
|
@ -57,7 +57,7 @@ AWNoFormatter *AWNoFormatter::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
AWNoFormatter *item = new AWNoFormatter(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new AWNoFormatter(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
AWAbstractFormatter::copyDefaults(item);
|
||||
item->setNumber(_number);
|
||||
|
||||
|
@ -32,16 +32,16 @@ class AWNoFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWNoFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AWNoFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWNoFormatter *copy(const QString &_fileName, const int _number);
|
||||
~AWNoFormatter() override;
|
||||
QString convert(const QVariant &_value) const override;
|
||||
AWNoFormatter *copy(const QString &_fileName, const int _number) override;
|
||||
|
||||
public slots:
|
||||
int showConfiguration(const QVariant &_args);
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
|
||||
private:
|
||||
Ui::AWNoFormatter *ui = nullptr;
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
};
|
||||
|
||||
|
@ -72,7 +72,7 @@ AWScriptFormatter *AWScriptFormatter::copy(const QString &_fileName, const int _
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
AWScriptFormatter *item = new AWScriptFormatter(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new AWScriptFormatter(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
AWAbstractFormatter::copyDefaults(item);
|
||||
item->setAppendCode(appendCode());
|
||||
item->setCode(code());
|
||||
|
@ -36,9 +36,9 @@ class AWScriptFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWScriptFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AWScriptFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWScriptFormatter *copy(const QString &_fileName, const int _number);
|
||||
~AWScriptFormatter() override;
|
||||
QString convert(const QVariant &_value) const override;
|
||||
AWScriptFormatter *copy(const QString &_fileName, const int _number) override;
|
||||
// properties
|
||||
bool appendCode() const;
|
||||
QString code() const;
|
||||
@ -49,14 +49,14 @@ public:
|
||||
void setHasReturn(const bool _hasReturn);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private:
|
||||
Ui::AWScriptFormatter *ui = nullptr;
|
||||
void initProgram();
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
bool m_appendCode = true;
|
||||
QString m_code = "";
|
||||
|
@ -63,7 +63,7 @@ AWStringFormatter *AWStringFormatter::copy(const QString &_fileName, const int _
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
AWStringFormatter *item = new AWStringFormatter(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new AWStringFormatter(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
AWAbstractFormatter::copyDefaults(item);
|
||||
item->setCount(count());
|
||||
item->setFillChar(fillChar());
|
||||
|
@ -35,9 +35,9 @@ class AWStringFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWStringFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~AWStringFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWStringFormatter *copy(const QString &_fileName, const int _number);
|
||||
~AWStringFormatter() override;
|
||||
QString convert(const QVariant &_value) const override;
|
||||
AWStringFormatter *copy(const QString &_fileName, const int _number) override;
|
||||
// properties
|
||||
int count() const;
|
||||
QChar fillChar() const;
|
||||
@ -47,13 +47,13 @@ public:
|
||||
void setForceWidth(const bool _forceWidth);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private:
|
||||
Ui::AWStringFormatter *ui = nullptr;
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
int m_count = 0;
|
||||
QChar m_fillChar = QChar();
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
initItems();
|
||||
};
|
||||
|
||||
virtual ~ExtItemAggregator()
|
||||
~ExtItemAggregator() override
|
||||
{
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
@ -61,7 +61,7 @@ public:
|
||||
qCInfo(LOG_LIB) << "Dialog returns" << ret;
|
||||
};
|
||||
|
||||
void initItems()
|
||||
void initItems() override
|
||||
{
|
||||
m_items.clear();
|
||||
m_activeItems.clear();
|
||||
@ -117,13 +117,13 @@ public:
|
||||
return found;
|
||||
};
|
||||
|
||||
QList<AbstractExtItem *> items() const { return m_items; };
|
||||
QList<AbstractExtItem *> items() const override { return m_items; };
|
||||
|
||||
private:
|
||||
QList<AbstractExtItem *> m_items;
|
||||
QList<T *> m_activeItems;
|
||||
|
||||
void doCreateItem() { return createItem<T>(); }
|
||||
void doCreateItem() override { return createItem<T>(); }
|
||||
|
||||
QList<AbstractExtItem *> getItems()
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ ExtNetworkRequest *ExtNetworkRequest::copy(const QString &_fileName, const int _
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
ExtNetworkRequest *item = new ExtNetworkRequest(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new ExtNetworkRequest(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
copyDefaults(item);
|
||||
item->setNumber(_number);
|
||||
item->setStringUrl(stringUrl());
|
||||
|
@ -35,19 +35,19 @@ class ExtNetworkRequest : public AbstractExtItem
|
||||
|
||||
public:
|
||||
explicit ExtNetworkRequest(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~ExtNetworkRequest();
|
||||
ExtNetworkRequest *copy(const QString &_fileName, const int _number);
|
||||
~ExtNetworkRequest() override;
|
||||
ExtNetworkRequest *copy(const QString &_fileName, const int _number) override;
|
||||
// get methods
|
||||
QString stringUrl() const;
|
||||
QString uniq() const;
|
||||
QString uniq() const override;
|
||||
// set methods
|
||||
void setStringUrl(const QString &_url);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
QVariantHash run() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private slots:
|
||||
void networkReplyReceived(QNetworkReply *_reply);
|
||||
@ -59,7 +59,7 @@ private:
|
||||
bool m_isRunning = false;
|
||||
Ui::ExtNetworkRequest *ui = nullptr;
|
||||
void initUrl();
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QString m_stringUrl = "https://httpbin.org/get";
|
||||
// values
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include "awdebug.h"
|
||||
#include "stooqquotesprovider.h"
|
||||
#include "yahooquotesprovider.h"
|
||||
|
||||
|
||||
ExtQuotes::ExtQuotes(QWidget *_parent, const QString &_filePath)
|
||||
@ -75,7 +74,7 @@ ExtQuotes *ExtQuotes::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
ExtQuotes *item = new ExtQuotes(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new ExtQuotes(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
copyDefaults(item);
|
||||
item->setNumber(_number);
|
||||
item->setTicker(ticker());
|
||||
|
@ -36,19 +36,19 @@ class ExtQuotes : public AbstractExtItem
|
||||
|
||||
public:
|
||||
explicit ExtQuotes(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~ExtQuotes();
|
||||
ExtQuotes *copy(const QString &_fileName, const int _number);
|
||||
~ExtQuotes() override;
|
||||
ExtQuotes *copy(const QString &_fileName, const int _number) override;
|
||||
// get methods
|
||||
QString ticker() const;
|
||||
QString uniq() const;
|
||||
QString uniq() const override;
|
||||
// set methods
|
||||
void setTicker(const QString &_ticker);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
QVariantHash run() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private slots:
|
||||
void quotesReplyReceived(QNetworkReply *_reply);
|
||||
@ -60,7 +60,7 @@ private:
|
||||
bool m_isRunning = false;
|
||||
Ui::ExtQuotes *ui = nullptr;
|
||||
void initProvider();
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QString m_ticker = "EURUSD=X";
|
||||
// values
|
||||
|
@ -67,7 +67,7 @@ ExtScript *ExtScript::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
ExtScript *item = new ExtScript(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new ExtScript(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
copyDefaults(item);
|
||||
item->setExecutable(executable());
|
||||
item->setNumber(_number);
|
||||
@ -79,7 +79,7 @@ ExtScript *ExtScript::copy(const QString &_fileName, const int _number)
|
||||
}
|
||||
|
||||
|
||||
QString ExtScript::jsonFiltersFile() const
|
||||
QString ExtScript::jsonFiltersFile()
|
||||
{
|
||||
QString fileName
|
||||
= QStandardPaths::locate(QStandardPaths::GenericDataLocation,
|
||||
@ -253,7 +253,7 @@ void ExtScript::readJsonFilters()
|
||||
QString jsonText = jsonFile.readAll();
|
||||
jsonFile.close();
|
||||
|
||||
QJsonParseError error;
|
||||
QJsonParseError error{};
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonText.toUtf8(), &error);
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qCWarning(LOG_LIB) << "Parse error" << error.errorString();
|
||||
|
@ -40,15 +40,15 @@ public:
|
||||
enum class Redirect { stdout2stderr = 0, nothing = 1, stderr2stdout = 2, swap = 3 };
|
||||
|
||||
explicit ExtScript(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~ExtScript();
|
||||
ExtScript *copy(const QString &_fileName, const int _number);
|
||||
QString jsonFiltersFile() const;
|
||||
~ExtScript() override;
|
||||
ExtScript *copy(const QString &_fileName, const int _number) override;
|
||||
static QString jsonFiltersFile();
|
||||
// get methods
|
||||
QString executable() const;
|
||||
QStringList filters() const;
|
||||
QString prefix() const;
|
||||
Redirect redirect() const;
|
||||
QString uniq() const;
|
||||
QString uniq() const override;
|
||||
// derivatives
|
||||
QString strRedirect() const;
|
||||
// set methods
|
||||
@ -62,11 +62,11 @@ public:
|
||||
void updateFilter(const QString &_filter, const bool _add);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
void readConfiguration() override;
|
||||
void readJsonFilters();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
QVariantHash run() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private slots:
|
||||
void startProcess();
|
||||
@ -75,7 +75,7 @@ private slots:
|
||||
private:
|
||||
QProcess *m_process = nullptr;
|
||||
Ui::ExtScript *ui = nullptr;
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QString m_executable = "/usr/bin/true";
|
||||
QStringList m_filters = QStringList();
|
||||
|
@ -63,7 +63,7 @@ ExtUpgrade *ExtUpgrade::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
ExtUpgrade *item = new ExtUpgrade(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new ExtUpgrade(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
copyDefaults(item);
|
||||
item->setExecutable(executable());
|
||||
item->setFilter(filter());
|
||||
@ -218,7 +218,7 @@ void ExtUpgrade::updateValue()
|
||||
|
||||
QString qoutput
|
||||
= QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardOutput()).trimmed();
|
||||
m_values[tag("pkgcount")] = [this](QString output) {
|
||||
m_values[tag("pkgcount")] = [this](const QString &output) {
|
||||
return filter().isEmpty()
|
||||
? output.split('\n', QString::SkipEmptyParts).count() - null()
|
||||
: output.split('\n', QString::SkipEmptyParts).filter(QRegExp(filter())).count();
|
||||
|
@ -37,23 +37,23 @@ class ExtUpgrade : public AbstractExtItem
|
||||
|
||||
public:
|
||||
explicit ExtUpgrade(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~ExtUpgrade();
|
||||
ExtUpgrade *copy(const QString &_fileName, const int _number);
|
||||
~ExtUpgrade() override;
|
||||
ExtUpgrade *copy(const QString &_fileName, const int _number) override;
|
||||
// get methods
|
||||
QString executable() const;
|
||||
QString filter() const;
|
||||
int null() const;
|
||||
QString uniq() const;
|
||||
QString uniq() const override;
|
||||
// set methods
|
||||
void setExecutable(const QString &_executable);
|
||||
void setFilter(const QString &_filter);
|
||||
void setNull(const int _null);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
QVariantHash run() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private slots:
|
||||
void startProcess();
|
||||
@ -62,7 +62,7 @@ private slots:
|
||||
private:
|
||||
QProcess *m_process = nullptr;
|
||||
Ui::ExtUpgrade *ui = nullptr;
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QString m_executable = "/usr/bin/true";
|
||||
QString m_filter = "";
|
||||
|
@ -77,7 +77,7 @@ ExtWeather *ExtWeather::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "number" << _number;
|
||||
|
||||
ExtWeather *item = new ExtWeather(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new ExtWeather(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
copyDefaults(item);
|
||||
item->setCity(city());
|
||||
item->setCountry(country());
|
||||
@ -90,7 +90,7 @@ ExtWeather *ExtWeather::copy(const QString &_fileName, const int _number)
|
||||
}
|
||||
|
||||
|
||||
QString ExtWeather::jsonMapFile() const
|
||||
QString ExtWeather::jsonMapFile()
|
||||
{
|
||||
QString fileName
|
||||
= QStandardPaths::locate(QStandardPaths::GenericDataLocation,
|
||||
@ -248,7 +248,7 @@ void ExtWeather::readJsonMap()
|
||||
QString jsonText = jsonFile.readAll();
|
||||
jsonFile.close();
|
||||
|
||||
QJsonParseError error;
|
||||
QJsonParseError error{};
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonText.toUtf8(), &error);
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qCWarning(LOG_LIB) << "Parse error" << error.errorString();
|
||||
@ -345,7 +345,7 @@ void ExtWeather::weatherReplyReceived(QNetworkReply *_reply)
|
||||
}
|
||||
|
||||
m_isRunning = false;
|
||||
QJsonParseError error;
|
||||
QJsonParseError error{};
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(_reply->readAll(), &error);
|
||||
_reply->deleteLater();
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
|
@ -43,9 +43,9 @@ public:
|
||||
enum class Provider { OWM = 0, Yahoo = 1 };
|
||||
|
||||
explicit ExtWeather(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~ExtWeather();
|
||||
ExtWeather *copy(const QString &_fileName, const int _number);
|
||||
QString jsonMapFile() const;
|
||||
~ExtWeather() override;
|
||||
ExtWeather *copy(const QString &_fileName, const int _number) override;
|
||||
static QString jsonMapFile();
|
||||
QString weatherFromInt(const int _id) const;
|
||||
// get methods
|
||||
QString city() const;
|
||||
@ -54,7 +54,7 @@ public:
|
||||
Provider provider() const;
|
||||
QString strProvider() const;
|
||||
int ts() const;
|
||||
QString uniq() const;
|
||||
QString uniq() const override;
|
||||
// set methods
|
||||
void setCity(const QString &_city);
|
||||
void setCountry(const QString &_country);
|
||||
@ -64,11 +64,11 @@ public:
|
||||
void setTs(const int _ts);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
void readConfiguration() override;
|
||||
void readJsonMap();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
QVariantHash run() override;
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private slots:
|
||||
void sendRequest();
|
||||
@ -80,7 +80,7 @@ private:
|
||||
bool m_isRunning = false;
|
||||
Ui::ExtWeather *ui = nullptr;
|
||||
void initProvider();
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QString m_city = "London";
|
||||
QString m_country = "uk";
|
||||
|
@ -75,7 +75,7 @@ GraphicalItem *GraphicalItem::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
GraphicalItem *item = new GraphicalItem(static_cast<QWidget *>(parent()), _fileName);
|
||||
auto *item = new GraphicalItem(dynamic_cast<QWidget *>(parent()), _fileName);
|
||||
copyDefaults(item);
|
||||
item->setActiveColor(activeColor());
|
||||
item->setBar(bar());
|
||||
@ -486,8 +486,8 @@ int GraphicalItem::showConfiguration(const QVariant &_args)
|
||||
setCount(ui->spinBox_count->value());
|
||||
setCustom(ui->checkBox_custom->isChecked());
|
||||
setBar(m_custom ? ui->lineEdit_customValue->text() : ui->comboBox_value->currentText());
|
||||
setMaxValue(ui->doubleSpinBox_max->value());
|
||||
setMinValue(ui->doubleSpinBox_min->value());
|
||||
setMaxValue(static_cast<float>(ui->doubleSpinBox_max->value()));
|
||||
setMinValue(static_cast<float>(ui->doubleSpinBox_min->value()));
|
||||
setActiveColor(ui->lineEdit_activeColor->text());
|
||||
setInactiveColor(ui->lineEdit_inactiveColor->text());
|
||||
setType(static_cast<Type>(ui->comboBox_type->currentIndex()));
|
||||
|
@ -53,8 +53,8 @@ public:
|
||||
enum class Type { Horizontal = 0, Vertical = 1, Circle = 2, Graph = 3, Bars = 4 };
|
||||
|
||||
explicit GraphicalItem(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||
virtual ~GraphicalItem();
|
||||
GraphicalItem *copy(const QString &_fileName, const int _number);
|
||||
~GraphicalItem() override;
|
||||
GraphicalItem *copy(const QString &_fileName, const int _number) override;
|
||||
QString image(const QVariant &value);
|
||||
void initScene();
|
||||
// get methods
|
||||
@ -72,7 +72,7 @@ public:
|
||||
Direction direction() const;
|
||||
QString strDirection() const;
|
||||
QStringList usedKeys() const;
|
||||
QString uniq() const;
|
||||
QString uniq() const override;
|
||||
// set methods
|
||||
void setBar(const QString &_bar);
|
||||
void setActiveColor(const QString &_color);
|
||||
@ -90,10 +90,10 @@ public:
|
||||
void setUsedKeys(const QStringList &_usedKeys);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantHash run() { return QVariantHash(); };
|
||||
int showConfiguration(const QVariant &_args);
|
||||
void writeConfiguration() const;
|
||||
void readConfiguration() override;
|
||||
QVariantHash run() override { return QVariantHash(); };
|
||||
int showConfiguration(const QVariant &_args) override;
|
||||
void writeConfiguration() const override;
|
||||
|
||||
private slots:
|
||||
void changeColor();
|
||||
@ -105,7 +105,7 @@ private:
|
||||
QGraphicsScene *m_scene = nullptr;
|
||||
QGraphicsView *m_view = nullptr;
|
||||
Ui::GraphicalItem *ui = nullptr;
|
||||
void translate();
|
||||
void translate() override;
|
||||
// properties
|
||||
QString m_bar = "cpu";
|
||||
int m_count = 100;
|
||||
|
@ -89,7 +89,7 @@ void GraphicalItemHelper::paintBars(const float _value)
|
||||
|
||||
// default norms
|
||||
float normX = static_cast<float>(m_width) / static_cast<float>(m_values.count());
|
||||
float normY = static_cast<float>(m_height - 1);
|
||||
auto normY = static_cast<float>(m_height - 1);
|
||||
// paint graph
|
||||
for (int i = 0; i < m_values.count(); i++) {
|
||||
float x = i * normX;
|
||||
@ -113,11 +113,11 @@ void GraphicalItemHelper::paintCircle(const float _percent)
|
||||
|
||||
// inactive
|
||||
circle = m_scene->addEllipse(0.0, 0.0, m_width, m_height, m_inactivePen, m_inactivePen.brush());
|
||||
circle->setSpanAngle(-(1.0f - _percent) * 360.0f * 16.0f);
|
||||
circle->setStartAngle(90.0f * 16.0f - _percent * 360.0f * 16.0f);
|
||||
circle->setSpanAngle(static_cast<int>(-(1.0f - _percent) * 360.0f * 16.0f));
|
||||
circle->setStartAngle(static_cast<int>(90.0f * 16.0f - _percent * 360.0f * 16.0f));
|
||||
// active
|
||||
circle = m_scene->addEllipse(0.0, 0.0, m_width, m_height, m_activePen, m_activePen.brush());
|
||||
circle->setSpanAngle(-_percent * 360.0f * 16.0f);
|
||||
circle->setSpanAngle(static_cast<int>(-_percent * 360.0f * 16.0f));
|
||||
circle->setStartAngle(90 * 16);
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ void GraphicalItemHelper::paintGraph(const float _value)
|
||||
|
||||
// default norms
|
||||
float normX = static_cast<float>(m_width) / static_cast<float>(m_values.count());
|
||||
float normY = static_cast<float>(m_height - 1);
|
||||
auto normY = static_cast<float>(m_height - 1);
|
||||
// paint graph
|
||||
for (int i = 0; i < m_values.count() - 1; i++) {
|
||||
// some magic here
|
||||
|
@ -31,7 +31,7 @@ class GraphicalItemHelper : public QObject
|
||||
|
||||
public:
|
||||
explicit GraphicalItemHelper(QObject *_parent = nullptr, QGraphicsScene *_scene = nullptr);
|
||||
virtual ~GraphicalItemHelper();
|
||||
~GraphicalItemHelper() override;
|
||||
// parameters
|
||||
void setParameters(const QString &_active, const QString &_inactive, const int _width,
|
||||
const int _height, const int _count);
|
||||
@ -42,9 +42,9 @@ public:
|
||||
void paintHorizontal(const float _percent);
|
||||
void paintVertical(const float _percent);
|
||||
// additional conversion methods
|
||||
float getPercents(const float _value, const float _min, const float _max);
|
||||
bool isColor(const QString &_input);
|
||||
QColor stringToColor(const QString &_color);
|
||||
static float getPercents(const float _value, const float _min, const float _max);
|
||||
static bool isColor(const QString &_input);
|
||||
static QColor stringToColor(const QString &_color);
|
||||
|
||||
private:
|
||||
void storeValue(const float _value);
|
||||
|
@ -32,10 +32,10 @@ public:
|
||||
const char *OWM_FORECAST_URL = "https://arcanis.me/forecast";
|
||||
|
||||
explicit OWMWeatherProvider(QObject *_parent);
|
||||
virtual ~OWMWeatherProvider();
|
||||
void initUrl(const QString &_city, const QString &_country, const int);
|
||||
QVariantHash parse(const QVariantMap &_json) const;
|
||||
QUrl url() const;
|
||||
~OWMWeatherProvider() override;
|
||||
void initUrl(const QString &_city, const QString &_country, const int) override;
|
||||
QVariantHash parse(const QVariantMap &_json) const override;
|
||||
QUrl url() const override;
|
||||
|
||||
private:
|
||||
QVariantHash parseSingleJson(const QVariantMap &_json) const;
|
||||
|
@ -76,7 +76,7 @@ void QCronScheduler::expired()
|
||||
}
|
||||
|
||||
|
||||
QList<int> QCronScheduler::parseField(const QString &_value, const int _min, const int _max) const
|
||||
QList<int> QCronScheduler::parseField(const QString &_value, const int _min, const int _max)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Parse field" << _value << "with corner values" << _min << _max;
|
||||
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
} QCronField;
|
||||
|
||||
explicit QCronScheduler(QObject *_parent = nullptr);
|
||||
virtual ~QCronScheduler();
|
||||
~QCronScheduler() override;
|
||||
void parse(const QString &_timer);
|
||||
|
||||
signals:
|
||||
@ -56,7 +56,7 @@ private slots:
|
||||
private:
|
||||
QCronRunSchedule m_schedule;
|
||||
QTimer *m_timer = nullptr;
|
||||
QList<int> parseField(const QString &_value, const int _min, const int _max) const;
|
||||
static QList<int> parseField(const QString &_value, const int _min, const int _max);
|
||||
};
|
||||
|
||||
|
||||
|
@ -29,10 +29,10 @@ public:
|
||||
const char *STOOQ_QUOTES_URL = "https://stooq.com/q/l/";
|
||||
|
||||
explicit StooqQuotesProvider(QObject *_parent);
|
||||
virtual ~StooqQuotesProvider();
|
||||
void initUrl(const QString &_asset);
|
||||
QVariantHash parse(const QByteArray &_source, const QVariantHash &_oldValues) const;
|
||||
QUrl url() const;
|
||||
~StooqQuotesProvider() override;
|
||||
void initUrl(const QString &_asset) override;
|
||||
QVariantHash parse(const QByteArray &_source, const QVariantHash &_oldValues) const override;
|
||||
QUrl url() const override;
|
||||
|
||||
private:
|
||||
QUrl m_url;
|
||||
|
@ -56,7 +56,7 @@ QVariantHash YahooQuotesProvider::parse(const QByteArray &_source,
|
||||
|
||||
QVariantHash values;
|
||||
|
||||
QJsonParseError error;
|
||||
QJsonParseError error{};
|
||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(_source, &error);
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qCWarning(LOG_LIB) << "Parse error" << error.errorString();
|
||||
|
@ -30,10 +30,10 @@ public:
|
||||
const char *YAHOO_QUOTES_QUERY = "select * from yahoo.finance.quotes where symbol='%1'";
|
||||
|
||||
explicit YahooQuotesProvider(QObject *_parent);
|
||||
virtual ~YahooQuotesProvider();
|
||||
void initUrl(const QString &_asset);
|
||||
QVariantHash parse(const QByteArray &_source, const QVariantHash &_oldValues) const;
|
||||
QUrl url() const;
|
||||
~YahooQuotesProvider() override;
|
||||
void initUrl(const QString &_asset) override;
|
||||
QVariantHash parse(const QByteArray &_source, const QVariantHash &_oldValues) const override;
|
||||
QUrl url() const override;
|
||||
|
||||
private:
|
||||
QUrl m_url;
|
||||
|
@ -32,10 +32,10 @@ public:
|
||||
"geo.places(1) where text='%1, %2')";
|
||||
|
||||
explicit YahooWeatherProvider(QObject *_parent);
|
||||
virtual ~YahooWeatherProvider();
|
||||
void initUrl(const QString &_city, const QString &_country, const int);
|
||||
QVariantHash parse(const QVariantMap &_json) const;
|
||||
QUrl url() const;
|
||||
~YahooWeatherProvider() override;
|
||||
void initUrl(const QString &_city, const QString &_country, const int) override;
|
||||
QVariantHash parse(const QVariantMap &_json) const override;
|
||||
QUrl url() const override;
|
||||
|
||||
private:
|
||||
QVariantHash parseCurrent(const QVariantMap &_json, const QVariantMap &_atmosphere) const;
|
||||
|
Reference in New Issue
Block a user