mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
clang-tidy warning fixes
This commit is contained in:
parent
e81d765098
commit
91abbdcd96
@ -141,15 +141,17 @@ void AWAbstractPairConfig::execDialog()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// save configuration if required
|
// save configuration if required
|
||||||
|
auto status = true;
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
default:
|
default:
|
||||||
m_helper->writeItems(data);
|
status &= m_helper->writeItems(data);
|
||||||
m_helper->removeUnusedKeys(data.keys());
|
status &= m_helper->removeUnusedKeys(data.keys());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
qCDebug(LOG_AW) << "Configuration save status" << status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class AWAbstractPairConfig : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AWAbstractPairConfig(QWidget *_parent = nullptr, const bool _hasEdit = false,
|
explicit AWAbstractPairConfig(QWidget *_parent = nullptr, bool _hasEdit = false,
|
||||||
QStringList _keys = QStringList());
|
QStringList _keys = QStringList());
|
||||||
~AWAbstractPairConfig() override;
|
~AWAbstractPairConfig() override;
|
||||||
template <class T> void initHelper()
|
template <class T> void initHelper()
|
||||||
@ -46,7 +46,7 @@ public:
|
|||||||
}
|
}
|
||||||
void showDialog();
|
void showDialog();
|
||||||
// properties
|
// properties
|
||||||
void setEditable(const bool _first, const bool _second);
|
void setEditable(bool _first, bool _second);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void edit();
|
void edit();
|
||||||
@ -66,7 +66,7 @@ private:
|
|||||||
const QPair<QString, QString> &_current);
|
const QPair<QString, QString> &_current);
|
||||||
void clearSelectors();
|
void clearSelectors();
|
||||||
void execDialog();
|
void execDialog();
|
||||||
QPair<QStringList, QStringList> initKeys() const;
|
[[nodiscard]] QPair<QStringList, QStringList> initKeys() const;
|
||||||
void updateDialog();
|
void updateDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ AWAbstractPairHelper::AWAbstractPairHelper(QString _filePath, QString _section)
|
|||||||
{
|
{
|
||||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
initItems();
|
AWAbstractPairHelper::initItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,14 +27,14 @@ class AWAbstractPairHelper
|
|||||||
public:
|
public:
|
||||||
explicit AWAbstractPairHelper(QString _filePath = "", QString _section = "");
|
explicit AWAbstractPairHelper(QString _filePath = "", QString _section = "");
|
||||||
virtual ~AWAbstractPairHelper();
|
virtual ~AWAbstractPairHelper();
|
||||||
QStringList keys() const;
|
[[nodiscard]] QStringList keys() const;
|
||||||
QHash<QString, QString> pairs() const;
|
[[nodiscard]] QHash<QString, QString> pairs() const;
|
||||||
QStringList values() const;
|
[[nodiscard]] QStringList values() const;
|
||||||
QSet<QString> valuesSet() const;
|
[[nodiscard]] QSet<QString> valuesSet() const;
|
||||||
// read-write methods
|
// read-write methods
|
||||||
virtual void initItems();
|
virtual void initItems();
|
||||||
virtual bool writeItems(const QHash<QString, QString> &_configuration) const;
|
[[nodiscard]] virtual bool writeItems(const QHash<QString, QString> &_configuration) const;
|
||||||
virtual bool removeUnusedKeys(const QStringList &_keys) const;
|
[[nodiscard]] virtual bool removeUnusedKeys(const QStringList &_keys) const;
|
||||||
// configuration related
|
// configuration related
|
||||||
virtual void editPairs() = 0;
|
virtual void editPairs() = 0;
|
||||||
virtual QStringList leftKeys() = 0;
|
virtual QStringList leftKeys() = 0;
|
||||||
|
@ -35,7 +35,7 @@ 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});
|
||||||
~AWAbstractSelector() override;
|
~AWAbstractSelector() override;
|
||||||
QPair<QString, QString> current() const;
|
[[nodiscard]] 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);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class AWActions : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit AWActions(QObject *_parent = nullptr);
|
explicit AWActions(QObject *_parent = nullptr);
|
||||||
~AWActions() override;
|
~AWActions() override;
|
||||||
Q_INVOKABLE void checkUpdates(const bool _showAnyway = false);
|
Q_INVOKABLE void checkUpdates(bool _showAnyway = false);
|
||||||
Q_INVOKABLE static QString getFileContent(const QString &_path);
|
Q_INVOKABLE static QString getFileContent(const QString &_path);
|
||||||
Q_INVOKABLE static bool isDebugEnabled();
|
Q_INVOKABLE static bool isDebugEnabled();
|
||||||
Q_INVOKABLE static bool runCmd(const QString &_cmd, const QStringList &_args);
|
Q_INVOKABLE static bool runCmd(const QString &_cmd, const QStringList &_args);
|
||||||
|
@ -45,7 +45,7 @@ void AWBugReporter::doConnect()
|
|||||||
{
|
{
|
||||||
// additional method for testing needs
|
// additional method for testing needs
|
||||||
connect(this, SIGNAL(replyReceived(const int, const QString &)), this,
|
connect(this, SIGNAL(replyReceived(const int, const QString &)), this,
|
||||||
SLOT(showInformation(const int, const QString &)));
|
SLOT(showInformation(int, const QString &)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ signals:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void issueReplyRecieved(QNetworkReply *_reply);
|
void issueReplyRecieved(QNetworkReply *_reply);
|
||||||
void showInformation(const int _number, const QString &_url);
|
void showInformation(int _number, const QString &_url);
|
||||||
void userReplyOnBugReport(QAbstractButton *_button);
|
void userReplyOnBugReport(QAbstractButton *_button);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -42,7 +42,7 @@ AWConfigHelper::~AWConfigHelper()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString AWConfigHelper::configurationDirectory() const
|
QString AWConfigHelper::configurationDirectory()
|
||||||
{
|
{
|
||||||
// get readable directory
|
// get readable directory
|
||||||
QString localDir
|
QString localDir
|
||||||
|
@ -32,13 +32,13 @@ class AWConfigHelper : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit AWConfigHelper(QObject *_parent = nullptr);
|
explicit AWConfigHelper(QObject *_parent = nullptr);
|
||||||
~AWConfigHelper() override;
|
~AWConfigHelper() override;
|
||||||
Q_INVOKABLE QString configurationDirectory() const;
|
Q_INVOKABLE [[nodiscard]] static QString configurationDirectory();
|
||||||
Q_INVOKABLE static bool dropCache();
|
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 [[nodiscard]] QVariantMap importConfiguration(const QString &_fileName,
|
||||||
const bool _importPlasmoid,
|
bool _importPlasmoid,
|
||||||
const bool _importExtensions,
|
bool _importExtensions,
|
||||||
const bool _importAdds) const;
|
bool _importAdds) const;
|
||||||
// dataengine
|
// dataengine
|
||||||
Q_INVOKABLE static QVariantMap readDataEngineConfiguration();
|
Q_INVOKABLE static QVariantMap readDataEngineConfiguration();
|
||||||
Q_INVOKABLE static bool writeDataEngineConfiguration(const QVariantMap &_configuration);
|
Q_INVOKABLE static bool writeDataEngineConfiguration(const QVariantMap &_configuration);
|
||||||
@ -47,7 +47,7 @@ private:
|
|||||||
// methods
|
// methods
|
||||||
static void copyConfigs(const QString &_localDir);
|
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;
|
bool _inverse) const;
|
||||||
static void copySettings(QSettings &_from, QSettings &_to);
|
static void copySettings(QSettings &_from, QSettings &_to);
|
||||||
static void readFile(QSettings &_settings, const QString &_key, const QString &_fileName);
|
static void readFile(QSettings &_settings, const QString &_key, const QString &_fileName);
|
||||||
static void writeFile(QSettings &_settings, const QString &_key, const QString &_fileName);
|
static void writeFile(QSettings &_settings, const QString &_key, const QString &_fileName);
|
||||||
|
@ -32,9 +32,9 @@ public:
|
|||||||
explicit AWCustomKeysHelper(QObject *_parent = nullptr);
|
explicit AWCustomKeysHelper(QObject *_parent = nullptr);
|
||||||
~AWCustomKeysHelper() override;
|
~AWCustomKeysHelper() override;
|
||||||
// get
|
// get
|
||||||
QString source(const QString &_key) const;
|
[[nodiscard]] QString source(const QString &_key) const;
|
||||||
QStringList sources() const;
|
[[nodiscard]] QStringList sources() const;
|
||||||
QStringList refinedSources() const;
|
[[nodiscard]] QStringList refinedSources() const;
|
||||||
// configuration related
|
// configuration related
|
||||||
void editPairs() override{};
|
void editPairs() override{};
|
||||||
QStringList leftKeys() override;
|
QStringList leftKeys() override;
|
||||||
|
@ -119,7 +119,7 @@ QPixmap AWDataAggregator::tooltipImage()
|
|||||||
// create frame
|
// create frame
|
||||||
float normX = 100.0f / static_cast<float>(m_values[key].count());
|
float normX = 100.0f / static_cast<float>(m_values[key].count());
|
||||||
float normY = 100.0f / (1.5f * m_boundaries[key]);
|
float normY = 100.0f / (1.5f * m_boundaries[key]);
|
||||||
float shift = requiredKeys.indexOf(key) * 100.0f;
|
float shift = static_cast<float>(requiredKeys.indexOf(key)) * 100.0f;
|
||||||
if (down)
|
if (down)
|
||||||
shift -= 100.0;
|
shift -= 100.0;
|
||||||
// apply pen color
|
// apply pen color
|
||||||
|
@ -49,17 +49,17 @@ private:
|
|||||||
// ui
|
// ui
|
||||||
QGraphicsScene *m_toolTipScene = nullptr;
|
QGraphicsScene *m_toolTipScene = nullptr;
|
||||||
QGraphicsView *m_toolTipView = nullptr;
|
QGraphicsView *m_toolTipView = nullptr;
|
||||||
void checkValue(const QString &_source, const float _value, const float _extremum) const;
|
void checkValue(const QString &_source, float _value, float _extremum) const;
|
||||||
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();
|
||||||
static QString notificationText(const QString &_source, const float _value);
|
static QString notificationText(const QString &_source, float _value);
|
||||||
static QString notificationText(const QString &_source, const QString &_value);
|
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, float _extremum = -1.0f);
|
||||||
// different signature for battery device
|
// different signature for battery device
|
||||||
void setData(const bool _dontInvert, const QString &_source, float _value);
|
void setData(bool _dontInvert, const QString &_source, float _value);
|
||||||
// variables
|
// variables
|
||||||
int m_counts = 0;
|
int m_counts = 0;
|
||||||
QVariantHash m_configuration;
|
QVariantHash m_configuration;
|
||||||
|
@ -36,7 +36,7 @@ AWDataEngineAggregator::AWDataEngineAggregator(QObject *_parent)
|
|||||||
// additional method required by systemmonitor structure
|
// additional method required by systemmonitor structure
|
||||||
m_newSourceConnection
|
m_newSourceConnection
|
||||||
= connect(m_dataEngines["systemmonitor"], &Plasma::DataEngine::sourceAdded,
|
= connect(m_dataEngines["systemmonitor"], &Plasma::DataEngine::sourceAdded,
|
||||||
[this](const QString source) {
|
[this](const QString &source) {
|
||||||
emit(deviceAdded(source));
|
emit(deviceAdded(source));
|
||||||
m_dataEngines["systemmonitor"]->connectSource(source, parent(), 1000);
|
m_dataEngines["systemmonitor"]->connectSource(source, parent(), 1000);
|
||||||
});
|
});
|
||||||
@ -56,9 +56,9 @@ AWDataEngineAggregator::~AWDataEngineAggregator()
|
|||||||
|
|
||||||
void AWDataEngineAggregator::disconnectSources()
|
void AWDataEngineAggregator::disconnectSources()
|
||||||
{
|
{
|
||||||
for (auto dataengine : m_dataEngines.values())
|
for (auto dataEngine : m_dataEngines.values())
|
||||||
for (auto &source : dataengine->sources())
|
for (auto &source : dataEngine->sources())
|
||||||
dataengine->disconnectSource(source, parent());
|
dataEngine->disconnectSource(source, parent());
|
||||||
disconnect(m_newSourceConnection);
|
disconnect(m_newSourceConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ void AWDataEngineAggregator::reconnectSources(const int _interval)
|
|||||||
|
|
||||||
m_newSourceConnection = connect(
|
m_newSourceConnection = 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(), (uint)_interval);
|
m_dataEngines["systemmonitor"]->connectSource(source, parent(), (uint)_interval);
|
||||||
});
|
});
|
||||||
@ -92,8 +92,8 @@ void AWDataEngineAggregator::dropSource(const QString &_source)
|
|||||||
|
|
||||||
// HACK there is no possibility to check to which dataengine source
|
// HACK there is no possibility to check to which dataengine source
|
||||||
// connected we will try to disconnect it from all engines
|
// connected we will try to disconnect it from all engines
|
||||||
for (auto dataengine : m_dataEngines.values())
|
for (auto dataEngine : m_dataEngines.values())
|
||||||
dataengine->disconnectSource(_source, parent());
|
dataEngine->disconnectSource(_source, parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
explicit AWDataEngineAggregator(QObject *_parent = nullptr);
|
explicit AWDataEngineAggregator(QObject *_parent = nullptr);
|
||||||
~AWDataEngineAggregator() override;
|
~AWDataEngineAggregator() override;
|
||||||
void disconnectSources();
|
void disconnectSources();
|
||||||
void reconnectSources(const int _interval);
|
void reconnectSources(int _interval);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void deviceAdded(const QString &_source);
|
void deviceAdded(const QString &_source);
|
||||||
|
@ -35,8 +35,8 @@ public:
|
|||||||
explicit AWDataEngineMapper(QObject *_parent = nullptr, AWFormatterHelper *_custom = nullptr);
|
explicit AWDataEngineMapper(QObject *_parent = nullptr, AWFormatterHelper *_custom = nullptr);
|
||||||
~AWDataEngineMapper() override;
|
~AWDataEngineMapper() override;
|
||||||
// get methods
|
// get methods
|
||||||
AWKeysAggregator::FormatterType formatter(const QString &_key) const;
|
[[nodiscard]] AWKeysAggregator::FormatterType formatter(const QString &_key) const;
|
||||||
QStringList keysFromSource(const QString &_source) const;
|
[[nodiscard]] QStringList keysFromSource(const QString &_source) const;
|
||||||
// set methods
|
// set methods
|
||||||
QStringList registerSource(const QString &_source, const QString &_units,
|
QStringList registerSource(const QString &_source, const QString &_units,
|
||||||
const QStringList &_keys);
|
const QStringList &_keys);
|
||||||
|
@ -49,7 +49,7 @@ QStringList AWDBusAdaptor::ActiveServices() const
|
|||||||
QStringList arguments = listServices.arguments().first().toStringList();
|
QStringList arguments = listServices.arguments().first().toStringList();
|
||||||
|
|
||||||
return std::accumulate(arguments.cbegin(), arguments.cend(), QStringList(),
|
return std::accumulate(arguments.cbegin(), arguments.cend(), QStringList(),
|
||||||
[](QStringList &source, QString service) {
|
[](QStringList &source, const QString &service) {
|
||||||
if (service.startsWith(AWDBUS_SERVICE))
|
if (service.startsWith(AWDBUS_SERVICE))
|
||||||
source.append(service);
|
source.append(service);
|
||||||
return source;
|
return source;
|
||||||
|
@ -37,14 +37,14 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// get methods
|
// get methods
|
||||||
QStringList ActiveServices() const;
|
[[nodiscard]] QStringList ActiveServices() const;
|
||||||
QString Info(const QString &key) const;
|
[[nodiscard]] QString Info(const QString &key) const;
|
||||||
QStringList Keys(const QString ®exp) const;
|
[[nodiscard]] QStringList Keys(const QString ®exp) const;
|
||||||
QString Value(const QString &key) const;
|
[[nodiscard]] QString Value(const QString &key) const;
|
||||||
qlonglong WhoAmI() const;
|
[[nodiscard]] qlonglong WhoAmI() const;
|
||||||
// set methods
|
// set methods
|
||||||
void SetLogLevel(const QString &what, const int level);
|
void SetLogLevel(const QString &what, int level);
|
||||||
void SetLogLevel(const QString &what, const QString &level, const bool enabled);
|
void SetLogLevel(const QString &what, const QString &level, bool enabled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AWKeys *m_plugin = nullptr;
|
AWKeys *m_plugin = nullptr;
|
||||||
|
@ -39,7 +39,7 @@ AWFormatterHelper::AWFormatterHelper(QWidget *_parent)
|
|||||||
{
|
{
|
||||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
initItems();
|
AWFormatterHelper::initItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -55,7 +55,6 @@ AWFormatterHelper::~AWFormatterHelper()
|
|||||||
void AWFormatterHelper::initItems()
|
void AWFormatterHelper::initItems()
|
||||||
{
|
{
|
||||||
initFormatters();
|
initFormatters();
|
||||||
AWAbstractPairHelper::initItems();
|
|
||||||
|
|
||||||
// assign internal storage
|
// assign internal storage
|
||||||
m_formatters.clear();
|
m_formatters.clear();
|
||||||
@ -199,7 +198,7 @@ void AWFormatterHelper::initFormatters()
|
|||||||
|
|
||||||
|
|
||||||
QPair<QString, AWAbstractFormatter::FormatterClass>
|
QPair<QString, AWAbstractFormatter::FormatterClass>
|
||||||
AWFormatterHelper::readMetadata(const QString &_filePath) const
|
AWFormatterHelper::readMetadata(const QString &_filePath)
|
||||||
{
|
{
|
||||||
qCDebug(LOG_AW) << "Read initial parameters from" << _filePath;
|
qCDebug(LOG_AW) << "Read initial parameters from" << _filePath;
|
||||||
|
|
||||||
|
@ -34,9 +34,9 @@ public:
|
|||||||
// read-write methods
|
// read-write methods
|
||||||
void initItems() override;
|
void initItems() override;
|
||||||
// methods
|
// methods
|
||||||
QString convert(const QVariant &_value, const QString &_name) const;
|
[[nodiscard]] QString convert(const QVariant &_value, const QString &_name) const;
|
||||||
QStringList definedFormatters() const;
|
[[nodiscard]] QStringList definedFormatters() const;
|
||||||
QList<AbstractExtItem *> items() const override;
|
[[nodiscard]] QList<AbstractExtItem *> items() const override;
|
||||||
// configuration related
|
// configuration related
|
||||||
void editPairs() override;
|
void editPairs() override;
|
||||||
QStringList leftKeys() override;
|
QStringList leftKeys() override;
|
||||||
@ -49,8 +49,8 @@ private:
|
|||||||
// methods
|
// methods
|
||||||
static AWAbstractFormatter::FormatterClass defineFormatterClass(const QString &_stringType);
|
static AWAbstractFormatter::FormatterClass defineFormatterClass(const QString &_stringType);
|
||||||
void initFormatters();
|
void initFormatters();
|
||||||
QPair<QString, AWAbstractFormatter::FormatterClass>
|
[[nodiscard]] static QPair<QString, AWAbstractFormatter::FormatterClass>
|
||||||
readMetadata(const QString &_filePath) const;
|
readMetadata(const QString &_filePath);
|
||||||
// parent methods
|
// parent methods
|
||||||
void doCreateItem() override;
|
void doCreateItem() override;
|
||||||
// properties
|
// properties
|
||||||
|
@ -40,18 +40,18 @@ class AWKeyOperations : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit AWKeyOperations(QObject *_parent = nullptr);
|
explicit AWKeyOperations(QObject *_parent = nullptr);
|
||||||
~AWKeyOperations() override;
|
~AWKeyOperations() override;
|
||||||
QStringList devices(const QString &_type) const;
|
[[nodiscard]] QStringList devices(const QString &_type) const;
|
||||||
QHash<QString, QStringList> devices() const;
|
[[nodiscard]] QHash<QString, QStringList> devices() const;
|
||||||
void updateCache();
|
void updateCache();
|
||||||
// keys
|
// keys
|
||||||
QStringList dictKeys() const;
|
[[nodiscard]] QStringList dictKeys() const;
|
||||||
GraphicalItem *giByKey(const QString &_key) const;
|
[[nodiscard]] GraphicalItem *giByKey(const QString &_key) const;
|
||||||
QStringList requiredUserKeys() const;
|
[[nodiscard]] QStringList requiredUserKeys() const;
|
||||||
QStringList userKeys() const;
|
[[nodiscard]] QStringList userKeys() const;
|
||||||
QString userKeySource(const QString &_key) const;
|
[[nodiscard]] QString userKeySource(const QString &_key) const;
|
||||||
// values
|
// values
|
||||||
QString infoByKey(const QString &_key) const;
|
[[nodiscard]] QString infoByKey(const QString &_key) const;
|
||||||
QString pattern() const;
|
[[nodiscard]] QString pattern() const;
|
||||||
void setPattern(const QString &_currentPattern);
|
void setPattern(const QString &_currentPattern);
|
||||||
// configuration
|
// configuration
|
||||||
void editItem(const QString &_type);
|
void editItem(const QString &_type);
|
||||||
|
@ -76,7 +76,7 @@ AWKeys::~AWKeys()
|
|||||||
|
|
||||||
m_timer->stop();
|
m_timer->stop();
|
||||||
// delete dbus session
|
// delete dbus session
|
||||||
qlonglong id = reinterpret_cast<qlonglong>(this);
|
auto id = reinterpret_cast<qlonglong>(this);
|
||||||
QDBusConnection::sessionBus().unregisterObject(QString("/%1").arg(id));
|
QDBusConnection::sessionBus().unregisterObject(QString("/%1").arg(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ void AWKeys::calculateValues()
|
|||||||
void AWKeys::createDBusInterface()
|
void AWKeys::createDBusInterface()
|
||||||
{
|
{
|
||||||
// get this object id
|
// get this object id
|
||||||
qlonglong id = reinterpret_cast<qlonglong>(this);
|
auto id = reinterpret_cast<qlonglong>(this);
|
||||||
|
|
||||||
// create session
|
// create session
|
||||||
QDBusConnection instanceBus = QDBusConnection::sessionBus();
|
QDBusConnection instanceBus = QDBusConnection::sessionBus();
|
||||||
|
@ -40,19 +40,20 @@ public:
|
|||||||
explicit AWKeys(QObject *_parent = nullptr);
|
explicit AWKeys(QObject *_parent = nullptr);
|
||||||
~AWKeys() override;
|
~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, int _interval, int _limit,
|
||||||
const bool _optimize);
|
bool _optimize);
|
||||||
Q_INVOKABLE void setAggregatorProperty(const QString &_key, const QVariant &_value);
|
Q_INVOKABLE void setAggregatorProperty(const QString &_key, const QVariant &_value);
|
||||||
Q_INVOKABLE void setWrapNewLines(const bool _wrap);
|
Q_INVOKABLE void setWrapNewLines(bool _wrap);
|
||||||
// additional method to force load keys from Qml UI. Used in some
|
// additional method to force load keys from Qml UI. Used in some
|
||||||
// configuration pages
|
// configuration pages
|
||||||
Q_INVOKABLE void updateCache();
|
Q_INVOKABLE void updateCache();
|
||||||
// keys
|
// keys
|
||||||
Q_INVOKABLE QStringList dictKeys(const bool _sorted = false, const QString &_regexp = "") const;
|
Q_INVOKABLE [[nodiscard]] QStringList dictKeys(bool _sorted = false,
|
||||||
Q_INVOKABLE QVariantList getHddDevices() const;
|
const QString &_regexp = "") const;
|
||||||
|
Q_INVOKABLE [[nodiscard]] QVariantList getHddDevices() const;
|
||||||
// values
|
// values
|
||||||
Q_INVOKABLE QString infoByKey(const QString &_key) const;
|
Q_INVOKABLE [[nodiscard]] QString infoByKey(const QString &_key) const;
|
||||||
Q_INVOKABLE QString valueByKey(const QString &_key) const;
|
Q_INVOKABLE [[nodiscard]] QString valueByKey(const QString &_key) const;
|
||||||
// configuration
|
// configuration
|
||||||
Q_INVOKABLE void editItem(const QString &_type);
|
Q_INVOKABLE void editItem(const QString &_type);
|
||||||
|
|
||||||
@ -74,7 +75,7 @@ private:
|
|||||||
// methods
|
// methods
|
||||||
void calculateValues();
|
void calculateValues();
|
||||||
void createDBusInterface();
|
void createDBusInterface();
|
||||||
QString parsePattern(QString _pattern) const;
|
[[nodiscard]] QString parsePattern(QString _pattern) const;
|
||||||
void setDataBySource(const QString &_sourceName, const QVariantMap &_data);
|
void setDataBySource(const QString &_sourceName, const QVariantMap &_data);
|
||||||
// objects
|
// objects
|
||||||
AWDataAggregator *m_dataAggregator = nullptr;
|
AWDataAggregator *m_dataAggregator = nullptr;
|
||||||
|
@ -69,8 +69,9 @@ public:
|
|||||||
~AWKeysAggregator() override;
|
~AWKeysAggregator() override;
|
||||||
void initFormatters();
|
void initFormatters();
|
||||||
// get methods
|
// get methods
|
||||||
QString formatter(const QVariant &_data, const QString &_key, bool replaceSpace) const;
|
[[nodiscard]] QString formatter(const QVariant &_data, const QString &_key,
|
||||||
QStringList keysFromSource(const QString &_source) const;
|
bool replaceSpace) const;
|
||||||
|
[[nodiscard]] QStringList keysFromSource(const QString &_source) const;
|
||||||
// set methods
|
// set methods
|
||||||
void setAcOffline(const QString &_inactive);
|
void setAcOffline(const QString &_inactive);
|
||||||
void setAcOnline(const QString &_active);
|
void setAcOnline(const QString &_active);
|
||||||
@ -78,14 +79,14 @@ public:
|
|||||||
void setCustomUptime(const QString &_customUptime);
|
void setCustomUptime(const QString &_customUptime);
|
||||||
void setDevices(const QHash<QString, QStringList> &_devices);
|
void setDevices(const QHash<QString, QStringList> &_devices);
|
||||||
void setTempUnits(const QString &_units);
|
void setTempUnits(const QString &_units);
|
||||||
void setTranslate(const bool _translate);
|
void setTranslate(bool _translate);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
QStringList registerSource(const QString &_source, const QString &_units,
|
QStringList registerSource(const QString &_source, const QString &_units,
|
||||||
const QStringList &_keys);
|
const QStringList &_keys);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float temperature(const float temp) const;
|
[[nodiscard]] float temperature(float temp) const;
|
||||||
AWFormatterHelper *m_customFormatters = nullptr;
|
AWFormatterHelper *m_customFormatters = nullptr;
|
||||||
AWDataEngineMapper *m_mapper = nullptr;
|
AWDataEngineMapper *m_mapper = nullptr;
|
||||||
QStringList m_timeKeys;
|
QStringList m_timeKeys;
|
||||||
|
@ -44,7 +44,7 @@ QString insertKeyNames(QString _code, const QStringList &_keys);
|
|||||||
QString insertKeys(QString _code, const QStringList &_keys);
|
QString insertKeys(QString _code, const QStringList &_keys);
|
||||||
QString insertMacros(QString _code);
|
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, bool _isBars);
|
||||||
QStringList findLambdas(const QString &_code);
|
QStringList findLambdas(const QString &_code);
|
||||||
} // namespace AWPatternFunctions
|
} // namespace AWPatternFunctions
|
||||||
|
|
||||||
|
@ -33,10 +33,10 @@ public:
|
|||||||
|
|
||||||
explicit AWTelemetryHandler(QObject *_parent = nullptr, const QString &_clientId = "");
|
explicit AWTelemetryHandler(QObject *_parent = nullptr, const QString &_clientId = "");
|
||||||
~AWTelemetryHandler() override;
|
~AWTelemetryHandler() override;
|
||||||
Q_INVOKABLE QStringList get(const QString &_group) const;
|
Q_INVOKABLE [[nodiscard]] QStringList get(const QString &_group) const;
|
||||||
Q_INVOKABLE QString getLast(const QString &_group) const;
|
Q_INVOKABLE [[nodiscard]] QString getLast(const QString &_group) const;
|
||||||
Q_INVOKABLE void init(const int _count, const bool _enableRemote, const QString &_clientId);
|
Q_INVOKABLE void init(int _count, bool _enableRemote, const QString &_clientId);
|
||||||
Q_INVOKABLE bool put(const QString &_group, const QString &_value) const;
|
Q_INVOKABLE [[nodiscard]] bool put(const QString &_group, const QString &_value) const;
|
||||||
Q_INVOKABLE void uploadTelemetry(const QString &_group, const QString &_value);
|
Q_INVOKABLE void uploadTelemetry(const QString &_group, const QString &_value);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -46,7 +46,7 @@ private slots:
|
|||||||
void telemetryReplyRecieved(QNetworkReply *_reply);
|
void telemetryReplyRecieved(QNetworkReply *_reply);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QString getKey(const int _count);
|
static QString getKey(int _count);
|
||||||
QString m_clientId;
|
QString m_clientId;
|
||||||
QString m_localFile;
|
QString m_localFile;
|
||||||
int m_storeCount = 0;
|
int m_storeCount = 0;
|
||||||
|
@ -33,18 +33,18 @@ class AWUpdateHelper : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit AWUpdateHelper(QObject *_parent = nullptr);
|
explicit AWUpdateHelper(QObject *_parent = nullptr);
|
||||||
~AWUpdateHelper() override;
|
~AWUpdateHelper() override;
|
||||||
void checkUpdates(const bool _showAnyway = false);
|
void checkUpdates(bool _showAnyway = false);
|
||||||
bool checkVersion();
|
bool checkVersion();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
static 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, bool _showAnyway);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QMessageBox *genMessageBox(const QString &_title, const QString &_body,
|
static QMessageBox *genMessageBox(const QString &_title, const QString &_body,
|
||||||
const QMessageBox::StandardButtons _buttons);
|
QMessageBox::StandardButtons _buttons);
|
||||||
QVersionNumber m_foundVersion;
|
QVersionNumber m_foundVersion;
|
||||||
QString m_genericConfig;
|
QString m_genericConfig;
|
||||||
};
|
};
|
||||||
|
@ -240,8 +240,7 @@ void AbstractExtItem::setNumber(int _number)
|
|||||||
if (generateNumber) {
|
if (generateNumber) {
|
||||||
_number = []() {
|
_number = []() {
|
||||||
qCWarning(LOG_LIB) << "Number is empty, generate new one";
|
qCWarning(LOG_LIB) << "Number is empty, generate new one";
|
||||||
// we suppose that currentTIme().msec() is always valid time
|
auto n = QRandomGenerator::global()->generate() % 1000;
|
||||||
int n = QRandomGenerator::global()->generate() % 1000;
|
|
||||||
qCInfo(LOG_LIB) << "Generated number is" << n;
|
qCInfo(LOG_LIB) << "Generated number is" << n;
|
||||||
return n;
|
return n;
|
||||||
}();
|
}();
|
||||||
|
@ -42,29 +42,29 @@ class AbstractExtItem : public QDialog
|
|||||||
public:
|
public:
|
||||||
explicit AbstractExtItem(QWidget *_parent = nullptr, const QString &_filePath = "");
|
explicit AbstractExtItem(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||||
~AbstractExtItem() override;
|
~AbstractExtItem() override;
|
||||||
virtual void bumpApi(const int _newVer);
|
virtual void bumpApi(int _newVer);
|
||||||
virtual AbstractExtItem *copy(const QString &_fileName, const int _number) = 0;
|
virtual AbstractExtItem *copy(const QString &_fileName, int _number) = 0;
|
||||||
virtual void copyDefaults(AbstractExtItem *_other) const;
|
virtual void copyDefaults(AbstractExtItem *_other) const;
|
||||||
virtual void startTimer();
|
virtual void startTimer();
|
||||||
QString writtableConfig() const;
|
[[nodiscard]] QString writtableConfig() const;
|
||||||
// get methods
|
// get methods
|
||||||
int apiVersion() const;
|
[[nodiscard]] int apiVersion() const;
|
||||||
QString comment() const;
|
[[nodiscard]] QString comment() const;
|
||||||
QString cron() const;
|
[[nodiscard]] QString cron() const;
|
||||||
QString fileName() const;
|
[[nodiscard]] QString fileName() const;
|
||||||
int interval() const;
|
[[nodiscard]] int interval() const;
|
||||||
bool isActive() const;
|
[[nodiscard]] bool isActive() const;
|
||||||
QString name() const;
|
[[nodiscard]] QString name() const;
|
||||||
int number() const;
|
[[nodiscard]] int number() const;
|
||||||
QString socket() const;
|
[[nodiscard]] QString socket() const;
|
||||||
QString tag(const QString &_type) const;
|
[[nodiscard]] QString tag(const QString &_type) const;
|
||||||
virtual QString uniq() const = 0;
|
[[nodiscard]] virtual QString uniq() const = 0;
|
||||||
// set methods
|
// set methods
|
||||||
void setApiVersion(const int _apiVersion);
|
void setApiVersion(int _apiVersion);
|
||||||
void setActive(const bool _state);
|
void setActive(bool _state);
|
||||||
void setComment(const QString &_comment);
|
void setComment(const QString &_comment);
|
||||||
void setCron(const QString &_cron);
|
void setCron(const QString &_cron);
|
||||||
void setInterval(const int _interval);
|
void setInterval(int _interval);
|
||||||
void setName(const QString &_name);
|
void setName(const QString &_name);
|
||||||
void setNumber(int _number);
|
void setNumber(int _number);
|
||||||
void setSocket(const QString &_socket);
|
void setSocket(const QString &_socket);
|
||||||
@ -79,7 +79,7 @@ public slots:
|
|||||||
virtual void readConfiguration();
|
virtual void readConfiguration();
|
||||||
virtual QVariantHash run() = 0;
|
virtual QVariantHash run() = 0;
|
||||||
virtual int showConfiguration(const QVariant &_args) = 0;
|
virtual int showConfiguration(const QVariant &_args) = 0;
|
||||||
virtual bool tryDelete() const;
|
[[nodiscard]] virtual bool tryDelete() const;
|
||||||
virtual void writeConfiguration() const;
|
virtual void writeConfiguration() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -129,7 +129,7 @@ QString AbstractExtItemAggregator::getName()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AbstractExtItem *AbstractExtItemAggregator::itemFromWidget()
|
AbstractExtItem *AbstractExtItemAggregator::itemFromWidget() const
|
||||||
{
|
{
|
||||||
QListWidgetItem *widgetItem = ui->listWidget->currentItem();
|
QListWidgetItem *widgetItem = ui->listWidget->currentItem();
|
||||||
if (!widgetItem)
|
if (!widgetItem)
|
||||||
@ -150,7 +150,7 @@ AbstractExtItem *AbstractExtItemAggregator::itemFromWidget()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AbstractExtItemAggregator::repaintList()
|
void AbstractExtItemAggregator::repaintList() const
|
||||||
{
|
{
|
||||||
ui->listWidget->clear();
|
ui->listWidget->clear();
|
||||||
for (auto &_item : items()) {
|
for (auto &_item : items()) {
|
||||||
|
@ -68,14 +68,14 @@ public:
|
|||||||
void editItem();
|
void editItem();
|
||||||
QString getName();
|
QString getName();
|
||||||
virtual void initItems() = 0;
|
virtual void initItems() = 0;
|
||||||
AbstractExtItem *itemFromWidget();
|
AbstractExtItem *itemFromWidget() const;
|
||||||
void repaintList();
|
void repaintList() const;
|
||||||
int uniqNumber() const;
|
[[nodiscard]] int uniqNumber() const;
|
||||||
// get methods
|
// get methods
|
||||||
QVariant configArgs() const;
|
[[nodiscard]] QVariant configArgs() const;
|
||||||
QStringList directories() const;
|
[[nodiscard]] QStringList directories() const;
|
||||||
virtual QList<AbstractExtItem *> items() const = 0;
|
[[nodiscard]] virtual QList<AbstractExtItem *> items() const = 0;
|
||||||
QString type() const;
|
[[nodiscard]] QString type() const;
|
||||||
// set methods
|
// set methods
|
||||||
void setConfigArgs(const QVariant &_configArgs);
|
void setConfigArgs(const QVariant &_configArgs);
|
||||||
|
|
||||||
|
@ -33,12 +33,13 @@ public:
|
|||||||
: QObject(_parent){};
|
: QObject(_parent){};
|
||||||
~AbstractQuotesProvider() override = default;
|
~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;
|
[[nodiscard]] virtual QVariantHash parse(const QByteArray &_source,
|
||||||
QString tag(const QString &_type) const
|
const QVariantHash &_oldValues) const = 0;
|
||||||
|
[[nodiscard]] QString tag(const QString &_type) const
|
||||||
{
|
{
|
||||||
return dynamic_cast<AbstractExtItem *>(parent())->tag(_type);
|
return dynamic_cast<AbstractExtItem *>(parent())->tag(_type);
|
||||||
};
|
};
|
||||||
virtual QUrl url() const = 0;
|
[[nodiscard]] virtual QUrl url() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,9 +32,9 @@ public:
|
|||||||
explicit AbstractWeatherProvider(QObject *_parent)
|
explicit AbstractWeatherProvider(QObject *_parent)
|
||||||
: QObject(_parent){};
|
: QObject(_parent){};
|
||||||
~AbstractWeatherProvider() override = default;
|
~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, int _ts) = 0;
|
||||||
virtual QVariantHash parse(const QVariantMap &_json) const = 0;
|
[[nodiscard]] virtual QVariantHash parse(const QVariantMap &_json) const = 0;
|
||||||
QString tag(const QString &_type) const
|
[[nodiscard]] QString tag(const QString &_type) const
|
||||||
{
|
{
|
||||||
return dynamic_cast<AbstractExtItem *>(parent())->tag(_type);
|
return dynamic_cast<AbstractExtItem *>(parent())->tag(_type);
|
||||||
};
|
};
|
||||||
|
@ -32,14 +32,14 @@ public:
|
|||||||
|
|
||||||
explicit AWAbstractFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
explicit AWAbstractFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||||
~AWAbstractFormatter() override;
|
~AWAbstractFormatter() override;
|
||||||
virtual QString convert(const QVariant &_value) const = 0;
|
[[nodiscard]] virtual QString convert(const QVariant &_value) const = 0;
|
||||||
void copyDefaults(AbstractExtItem *_other) const override;
|
void copyDefaults(AbstractExtItem *_other) const override;
|
||||||
QString uniq() const override;
|
[[nodiscard]] QString uniq() const override;
|
||||||
// properties
|
// properties
|
||||||
QString strType() const;
|
[[nodiscard]] QString strType() const;
|
||||||
FormatterClass type() const;
|
[[nodiscard]] FormatterClass type() const;
|
||||||
void setStrType(const QString &_type);
|
void setStrType(const QString &_type);
|
||||||
void setType(const FormatterClass _type);
|
void setType(FormatterClass _type);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void readConfiguration() override;
|
void readConfiguration() override;
|
||||||
|
@ -34,9 +34,9 @@ AWDateTimeFormatter::AWDateTimeFormatter(QWidget *_parent, const QString &_fileP
|
|||||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
if (!_filePath.isEmpty())
|
if (!_filePath.isEmpty())
|
||||||
readConfiguration();
|
AWDateTimeFormatter::readConfiguration();
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
translate();
|
AWDateTimeFormatter::translate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,13 +37,13 @@ class AWDateTimeFormatter : public AWAbstractFormatter
|
|||||||
public:
|
public:
|
||||||
explicit AWDateTimeFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
explicit AWDateTimeFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||||
~AWDateTimeFormatter() override;
|
~AWDateTimeFormatter() override;
|
||||||
QString convert(const QVariant &_value) const override;
|
[[nodiscard]] QString convert(const QVariant &_value) const override;
|
||||||
AWDateTimeFormatter *copy(const QString &_fileName, const int _number) override;
|
AWDateTimeFormatter *copy(const QString &_fileName, int _number) override;
|
||||||
// properties
|
// properties
|
||||||
QString format() const;
|
[[nodiscard]] QString format() const;
|
||||||
bool translateString() const;
|
[[nodiscard]] bool translateString() const;
|
||||||
void setFormat(const QString &_format);
|
void setFormat(const QString &_format);
|
||||||
void setTranslateString(const bool _translate);
|
void setTranslateString(bool _translate);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void readConfiguration() override;
|
void readConfiguration() override;
|
||||||
|
@ -33,9 +33,9 @@ AWFloatFormatter::AWFloatFormatter(QWidget *_parent, const QString &_filePath)
|
|||||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
if (!_filePath.isEmpty())
|
if (!_filePath.isEmpty())
|
||||||
readConfiguration();
|
AWFloatFormatter::readConfiguration();
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
translate();
|
AWFloatFormatter::translate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,23 +40,23 @@ class AWFloatFormatter : public AWAbstractFormatter
|
|||||||
public:
|
public:
|
||||||
explicit AWFloatFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
explicit AWFloatFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||||
~AWFloatFormatter() override;
|
~AWFloatFormatter() override;
|
||||||
QString convert(const QVariant &_value) const override;
|
[[nodiscard]] QString convert(const QVariant &_value) const override;
|
||||||
AWFloatFormatter *copy(const QString &_fileName, const int _number) override;
|
AWFloatFormatter *copy(const QString &_fileName, int _number) override;
|
||||||
// properties
|
// properties
|
||||||
int count() const;
|
[[nodiscard]] int count() const;
|
||||||
QChar fillChar() const;
|
[[nodiscard]] QChar fillChar() const;
|
||||||
bool forceWidth() const;
|
[[nodiscard]] bool forceWidth() const;
|
||||||
char format() const;
|
[[nodiscard]] char format() const;
|
||||||
double multiplier() const;
|
[[nodiscard]] double multiplier() const;
|
||||||
int precision() const;
|
[[nodiscard]] int precision() const;
|
||||||
double summand() const;
|
[[nodiscard]] double summand() const;
|
||||||
void setCount(const int _count);
|
void setCount(int _count);
|
||||||
void setFillChar(const QChar &_fillChar);
|
void setFillChar(const QChar &_fillChar);
|
||||||
void setForceWidth(const bool _forceWidth);
|
void setForceWidth(bool _forceWidth);
|
||||||
void setFormat(char _format);
|
void setFormat(char _format);
|
||||||
void setMultiplier(const double _multiplier);
|
void setMultiplier(double _multiplier);
|
||||||
void setPrecision(const int _precision);
|
void setPrecision(int _precision);
|
||||||
void setSummand(const double _summand);
|
void setSummand(double _summand);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void readConfiguration() override;
|
void readConfiguration() override;
|
||||||
|
@ -34,9 +34,9 @@ AWJsonFormatter::AWJsonFormatter(QWidget *_parent, const QString &_filePath)
|
|||||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
if (!_filePath.isEmpty())
|
if (!_filePath.isEmpty())
|
||||||
readConfiguration();
|
AWJsonFormatter::readConfiguration();
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
translate();
|
AWJsonFormatter::translate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ void AWJsonFormatter::writeConfiguration() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QVariant AWJsonFormatter::getFromJson(const QVariant &_value, const QVariant &_element) const
|
QVariant AWJsonFormatter::getFromJson(const QVariant &_value, const QVariant &_element)
|
||||||
{
|
{
|
||||||
qCDebug(LOG_LIB) << "Looking for element" << _element << "in" << _value;
|
qCDebug(LOG_LIB) << "Looking for element" << _element << "in" << _value;
|
||||||
|
|
||||||
|
@ -34,10 +34,10 @@ class AWJsonFormatter : public AWAbstractFormatter
|
|||||||
public:
|
public:
|
||||||
explicit AWJsonFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
explicit AWJsonFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||||
~AWJsonFormatter() override;
|
~AWJsonFormatter() override;
|
||||||
QString convert(const QVariant &_value) const override;
|
[[nodiscard]] QString convert(const QVariant &_value) const override;
|
||||||
AWJsonFormatter *copy(const QString &_fileName, const int _number) override;
|
AWJsonFormatter *copy(const QString &_fileName, int _number) override;
|
||||||
// properties
|
// properties
|
||||||
QString path() const;
|
[[nodiscard]] QString path() const;
|
||||||
void setPath(const QString &_path);
|
void setPath(const QString &_path);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@ -47,8 +47,8 @@ public slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AWJsonFormatter *ui = nullptr;
|
Ui::AWJsonFormatter *ui = nullptr;
|
||||||
QVariant getFromJson(const QVariant &_value, const QVariant &_element) const;
|
static QVariant getFromJson(const QVariant &_value, const QVariant &_element);
|
||||||
static QVariant getFromList(const QVariant &_value, const int _index);
|
static QVariant getFromList(const QVariant &_value, int _index);
|
||||||
static QVariant getFromMap(const QVariant &_value, const QString &_key);
|
static QVariant getFromMap(const QVariant &_value, const QString &_key);
|
||||||
void initPath();
|
void initPath();
|
||||||
void translate() override;
|
void translate() override;
|
||||||
|
@ -33,9 +33,9 @@ AWListFormatter::AWListFormatter(QWidget *_parent, const QString &_filePath)
|
|||||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
if (!_filePath.isEmpty())
|
if (!_filePath.isEmpty())
|
||||||
readConfiguration();
|
AWListFormatter::readConfiguration();
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
translate();
|
AWListFormatter::translate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,15 +36,15 @@ class AWListFormatter : public AWAbstractFormatter
|
|||||||
public:
|
public:
|
||||||
explicit AWListFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
explicit AWListFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||||
~AWListFormatter() override;
|
~AWListFormatter() override;
|
||||||
QString convert(const QVariant &_value) const override;
|
[[nodiscard]] QString convert(const QVariant &_value) const override;
|
||||||
AWListFormatter *copy(const QString &_fileName, const int _number) override;
|
AWListFormatter *copy(const QString &_fileName, int _number) override;
|
||||||
// properties
|
// properties
|
||||||
QString filter() const;
|
[[nodiscard]] QString filter() const;
|
||||||
bool isSorted() const;
|
[[nodiscard]] bool isSorted() const;
|
||||||
QString separator() const;
|
[[nodiscard]] QString separator() const;
|
||||||
void setFilter(const QString &_filter);
|
void setFilter(const QString &_filter);
|
||||||
void setSeparator(const QString &_separator);
|
void setSeparator(const QString &_separator);
|
||||||
void setSorted(const bool _sorted);
|
void setSorted(bool _sorted);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void readConfiguration() override;
|
void readConfiguration() override;
|
||||||
|
@ -31,9 +31,9 @@ AWNoFormatter::AWNoFormatter(QWidget *_parent, const QString &_filePath)
|
|||||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
if (!_filePath.isEmpty())
|
if (!_filePath.isEmpty())
|
||||||
readConfiguration();
|
AWNoFormatter::readConfiguration();
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
translate();
|
AWNoFormatter::translate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@ class AWNoFormatter : public AWAbstractFormatter
|
|||||||
public:
|
public:
|
||||||
explicit AWNoFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
explicit AWNoFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||||
~AWNoFormatter() override;
|
~AWNoFormatter() override;
|
||||||
QString convert(const QVariant &_value) const override;
|
[[nodiscard]] QString convert(const QVariant &_value) const override;
|
||||||
AWNoFormatter *copy(const QString &_fileName, const int _number) override;
|
AWNoFormatter *copy(const QString &_fileName, int _number) override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
int showConfiguration(const QVariant &_args) override;
|
int showConfiguration(const QVariant &_args) override;
|
||||||
|
@ -34,9 +34,9 @@ AWScriptFormatter::AWScriptFormatter(QWidget *_parent, const QString &_filePath)
|
|||||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
if (!_filePath.isEmpty())
|
if (!_filePath.isEmpty())
|
||||||
readConfiguration();
|
AWScriptFormatter::readConfiguration();
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
translate();
|
AWScriptFormatter::translate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,16 +37,16 @@ class AWScriptFormatter : public AWAbstractFormatter
|
|||||||
public:
|
public:
|
||||||
explicit AWScriptFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
explicit AWScriptFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||||
~AWScriptFormatter() override;
|
~AWScriptFormatter() override;
|
||||||
QString convert(const QVariant &_value) const override;
|
[[nodiscard]] QString convert(const QVariant &_value) const override;
|
||||||
AWScriptFormatter *copy(const QString &_fileName, const int _number) override;
|
AWScriptFormatter *copy(const QString &_fileName, int _number) override;
|
||||||
// properties
|
// properties
|
||||||
bool appendCode() const;
|
[[nodiscard]] bool appendCode() const;
|
||||||
QString code() const;
|
[[nodiscard]] QString code() const;
|
||||||
bool hasReturn() const;
|
[[nodiscard]] bool hasReturn() const;
|
||||||
QString program() const;
|
[[nodiscard]] QString program() const;
|
||||||
void setAppendCode(const bool _appendCode);
|
void setAppendCode(bool _appendCode);
|
||||||
void setCode(const QString &_code);
|
void setCode(const QString &_code);
|
||||||
void setHasReturn(const bool _hasReturn);
|
void setHasReturn(bool _hasReturn);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void readConfiguration() override;
|
void readConfiguration() override;
|
||||||
|
@ -33,9 +33,9 @@ AWStringFormatter::AWStringFormatter(QWidget *_parent, const QString &_filePath)
|
|||||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
if (!_filePath.isEmpty())
|
if (!_filePath.isEmpty())
|
||||||
readConfiguration();
|
AWStringFormatter::readConfiguration();
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
translate();
|
AWStringFormatter::translate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,15 +36,15 @@ class AWStringFormatter : public AWAbstractFormatter
|
|||||||
public:
|
public:
|
||||||
explicit AWStringFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
explicit AWStringFormatter(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||||
~AWStringFormatter() override;
|
~AWStringFormatter() override;
|
||||||
QString convert(const QVariant &_value) const override;
|
[[nodiscard]] QString convert(const QVariant &_value) const override;
|
||||||
AWStringFormatter *copy(const QString &_fileName, const int _number) override;
|
AWStringFormatter *copy(const QString &_fileName, int _number) override;
|
||||||
// properties
|
// properties
|
||||||
int count() const;
|
[[nodiscard]] int count() const;
|
||||||
QChar fillChar() const;
|
[[nodiscard]] QChar fillChar() const;
|
||||||
bool forceWidth() const;
|
[[nodiscard]] bool forceWidth() const;
|
||||||
void setCount(const int _count);
|
void setCount(int _count);
|
||||||
void setFillChar(const QChar &_fillChar);
|
void setFillChar(const QChar &_fillChar);
|
||||||
void setForceWidth(const bool _forceWidth);
|
void setForceWidth(bool _forceWidth);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void readConfiguration() override;
|
void readConfiguration() override;
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
|
|
||||||
qCDebug(LOG_LIB) << "Type" << _type;
|
qCDebug(LOG_LIB) << "Type" << _type;
|
||||||
|
|
||||||
initItems();
|
ExtItemAggregator::initItems();
|
||||||
};
|
};
|
||||||
|
|
||||||
~ExtItemAggregator() override
|
~ExtItemAggregator() override
|
||||||
@ -117,7 +117,7 @@ public:
|
|||||||
return found;
|
return found;
|
||||||
};
|
};
|
||||||
|
|
||||||
QList<AbstractExtItem *> items() const override { return m_items; };
|
[[nodiscard]] QList<AbstractExtItem *> items() const override { return m_items; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<AbstractExtItem *> m_items;
|
QList<AbstractExtItem *> m_items;
|
||||||
|
@ -36,9 +36,9 @@ ExtNetworkRequest::ExtNetworkRequest(QWidget *_parent, const QString &_filePath)
|
|||||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
if (!_filePath.isEmpty())
|
if (!_filePath.isEmpty())
|
||||||
readConfiguration();
|
ExtNetworkRequest::readConfiguration();
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
translate();
|
ExtNetworkRequest::translate();
|
||||||
|
|
||||||
m_values[tag("response")] = "";
|
m_values[tag("response")] = "";
|
||||||
|
|
||||||
|
@ -36,10 +36,10 @@ class ExtNetworkRequest : public AbstractExtItem
|
|||||||
public:
|
public:
|
||||||
explicit ExtNetworkRequest(QWidget *_parent = nullptr, const QString &_filePath = "");
|
explicit ExtNetworkRequest(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||||
~ExtNetworkRequest() override;
|
~ExtNetworkRequest() override;
|
||||||
ExtNetworkRequest *copy(const QString &_fileName, const int _number) override;
|
ExtNetworkRequest *copy(const QString &_fileName, int _number) override;
|
||||||
// get methods
|
// get methods
|
||||||
QString stringUrl() const;
|
[[nodiscard]] QString stringUrl() const;
|
||||||
QString uniq() const override;
|
[[nodiscard]] QString uniq() const override;
|
||||||
// set methods
|
// set methods
|
||||||
void setStringUrl(const QString &_url);
|
void setStringUrl(const QString &_url);
|
||||||
|
|
||||||
|
@ -36,9 +36,9 @@ ExtQuotes::ExtQuotes(QWidget *_parent, const QString &_filePath)
|
|||||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
if (!_filePath.isEmpty())
|
if (!_filePath.isEmpty())
|
||||||
readConfiguration();
|
ExtQuotes::readConfiguration();
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
translate();
|
ExtQuotes::translate();
|
||||||
|
|
||||||
m_values[tag("price")] = 0.0;
|
m_values[tag("price")] = 0.0;
|
||||||
m_values[tag("pricechg")] = 0.0;
|
m_values[tag("pricechg")] = 0.0;
|
||||||
|
@ -37,10 +37,10 @@ class ExtQuotes : public AbstractExtItem
|
|||||||
public:
|
public:
|
||||||
explicit ExtQuotes(QWidget *_parent = nullptr, const QString &_filePath = "");
|
explicit ExtQuotes(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||||
~ExtQuotes() override;
|
~ExtQuotes() override;
|
||||||
ExtQuotes *copy(const QString &_fileName, const int _number) override;
|
ExtQuotes *copy(const QString &_fileName, int _number) override;
|
||||||
// get methods
|
// get methods
|
||||||
QString ticker() const;
|
[[nodiscard]] QString ticker() const;
|
||||||
QString uniq() const override;
|
[[nodiscard]] QString uniq() const override;
|
||||||
// set methods
|
// set methods
|
||||||
void setTicker(const QString &_ticker);
|
void setTicker(const QString &_ticker);
|
||||||
|
|
||||||
|
@ -36,10 +36,10 @@ ExtScript::ExtScript(QWidget *_parent, const QString &_filePath)
|
|||||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
if (!_filePath.isEmpty())
|
if (!_filePath.isEmpty())
|
||||||
readConfiguration();
|
ExtScript::readConfiguration();
|
||||||
readJsonFilters();
|
readJsonFilters();
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
translate();
|
ExtScript::translate();
|
||||||
|
|
||||||
m_values[tag("custom")] = "";
|
m_values[tag("custom")] = "";
|
||||||
|
|
||||||
@ -71,7 +71,6 @@ ExtScript *ExtScript::copy(const QString &_fileName, const int _number)
|
|||||||
copyDefaults(item);
|
copyDefaults(item);
|
||||||
item->setExecutable(executable());
|
item->setExecutable(executable());
|
||||||
item->setNumber(_number);
|
item->setNumber(_number);
|
||||||
item->setPrefix(prefix());
|
|
||||||
item->setRedirect(redirect());
|
item->setRedirect(redirect());
|
||||||
item->setFilters(filters());
|
item->setFilters(filters());
|
||||||
|
|
||||||
@ -102,12 +101,6 @@ QStringList ExtScript::filters() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString ExtScript::prefix() const
|
|
||||||
{
|
|
||||||
return m_prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ExtScript::Redirect ExtScript::redirect() const
|
ExtScript::Redirect ExtScript::redirect() const
|
||||||
{
|
{
|
||||||
return m_redirect;
|
return m_redirect;
|
||||||
@ -159,14 +152,6 @@ void ExtScript::setFilters(const QStringList &_filters)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ExtScript::setPrefix(const QString &_prefix)
|
|
||||||
{
|
|
||||||
qCDebug(LOG_LIB) << "Prefix" << _prefix;
|
|
||||||
|
|
||||||
m_prefix = _prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExtScript::setRedirect(const Redirect _redirect)
|
void ExtScript::setRedirect(const Redirect _redirect)
|
||||||
{
|
{
|
||||||
qCDebug(LOG_LIB) << "Redirect" << static_cast<int>(_redirect);
|
qCDebug(LOG_LIB) << "Redirect" << static_cast<int>(_redirect);
|
||||||
@ -231,11 +216,9 @@ void ExtScript::readConfiguration()
|
|||||||
|
|
||||||
settings.beginGroup("Desktop Entry");
|
settings.beginGroup("Desktop Entry");
|
||||||
setExecutable(settings.value("Exec", executable()).toString());
|
setExecutable(settings.value("Exec", executable()).toString());
|
||||||
setPrefix(settings.value("X-AW-Prefix", prefix()).toString());
|
|
||||||
setStrRedirect(settings.value("X-AW-Redirect", strRedirect()).toString());
|
setStrRedirect(settings.value("X-AW-Redirect", strRedirect()).toString());
|
||||||
// api == 3
|
// api == 3
|
||||||
setFilters(
|
setFilters(settings.value("X-AW-Filters", filters()).toString().split(',', Qt::SkipEmptyParts));
|
||||||
settings.value("X-AW-Filters", filters()).toString().split(',', Qt::SkipEmptyParts));
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
bumpApi(AW_EXTSCRIPT_API);
|
bumpApi(AW_EXTSCRIPT_API);
|
||||||
@ -283,7 +266,6 @@ int ExtScript::showConfiguration(const QVariant &_args)
|
|||||||
ui->lineEdit_comment->setText(comment());
|
ui->lineEdit_comment->setText(comment());
|
||||||
ui->label_numberValue->setText(QString("%1").arg(number()));
|
ui->label_numberValue->setText(QString("%1").arg(number()));
|
||||||
ui->lineEdit_command->setText(executable());
|
ui->lineEdit_command->setText(executable());
|
||||||
ui->lineEdit_prefix->setText(prefix());
|
|
||||||
ui->checkBox_active->setCheckState(isActive() ? Qt::Checked : Qt::Unchecked);
|
ui->checkBox_active->setCheckState(isActive() ? Qt::Checked : Qt::Unchecked);
|
||||||
ui->comboBox_redirect->setCurrentIndex(static_cast<int>(redirect()));
|
ui->comboBox_redirect->setCurrentIndex(static_cast<int>(redirect()));
|
||||||
ui->lineEdit_schedule->setText(cron());
|
ui->lineEdit_schedule->setText(cron());
|
||||||
@ -305,7 +287,6 @@ int ExtScript::showConfiguration(const QVariant &_args)
|
|||||||
setNumber(ui->label_numberValue->text().toInt());
|
setNumber(ui->label_numberValue->text().toInt());
|
||||||
setApiVersion(AW_EXTSCRIPT_API);
|
setApiVersion(AW_EXTSCRIPT_API);
|
||||||
setExecutable(ui->lineEdit_command->text());
|
setExecutable(ui->lineEdit_command->text());
|
||||||
setPrefix(ui->lineEdit_prefix->text());
|
|
||||||
setActive(ui->checkBox_active->checkState() == Qt::Checked);
|
setActive(ui->checkBox_active->checkState() == Qt::Checked);
|
||||||
setRedirect(static_cast<Redirect>(ui->comboBox_redirect->currentIndex()));
|
setRedirect(static_cast<Redirect>(ui->comboBox_redirect->currentIndex()));
|
||||||
setCron(ui->lineEdit_schedule->text());
|
setCron(ui->lineEdit_schedule->text());
|
||||||
@ -330,7 +311,6 @@ void ExtScript::writeConfiguration() const
|
|||||||
|
|
||||||
settings.beginGroup("Desktop Entry");
|
settings.beginGroup("Desktop Entry");
|
||||||
settings.setValue("Exec", executable());
|
settings.setValue("Exec", executable());
|
||||||
settings.setValue("X-AW-Prefix", prefix());
|
|
||||||
settings.setValue("X-AW-Redirect", strRedirect());
|
settings.setValue("X-AW-Redirect", strRedirect());
|
||||||
settings.setValue("X-AW-Filters", filters().join(','));
|
settings.setValue("X-AW-Filters", filters().join(','));
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
@ -341,12 +321,8 @@ void ExtScript::writeConfiguration() const
|
|||||||
|
|
||||||
void ExtScript::startProcess()
|
void ExtScript::startProcess()
|
||||||
{
|
{
|
||||||
QStringList cmdList;
|
qCInfo(LOG_LIB) << "Run cmd" << executable();
|
||||||
if (!prefix().isEmpty())
|
m_process->start("sh", QStringList() << "-c" << executable());
|
||||||
cmdList.append(prefix());
|
|
||||||
cmdList.append(executable());
|
|
||||||
qCInfo(LOG_LIB) << "Run cmd" << cmdList.join(' ');
|
|
||||||
m_process->start("sh", QStringList() << "-c" << cmdList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -387,7 +363,6 @@ void ExtScript::translate()
|
|||||||
ui->label_comment->setText(i18n("Comment"));
|
ui->label_comment->setText(i18n("Comment"));
|
||||||
ui->label_number->setText(i18n("Tag"));
|
ui->label_number->setText(i18n("Tag"));
|
||||||
ui->label_command->setText(i18n("Command"));
|
ui->label_command->setText(i18n("Command"));
|
||||||
ui->label_prefix->setText(i18n("Prefix"));
|
|
||||||
ui->checkBox_active->setText(i18n("Active"));
|
ui->checkBox_active->setText(i18n("Active"));
|
||||||
ui->label_redirect->setText(i18n("Redirect"));
|
ui->label_redirect->setText(i18n("Redirect"));
|
||||||
ui->label_schedule->setText(i18n("Schedule"));
|
ui->label_schedule->setText(i18n("Schedule"));
|
||||||
|
@ -33,7 +33,6 @@ class ExtScript : public AbstractExtItem
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QString executable READ executable WRITE setExecutable)
|
Q_PROPERTY(QString executable READ executable WRITE setExecutable)
|
||||||
Q_PROPERTY(QStringList filters READ filters WRITE setFilters)
|
Q_PROPERTY(QStringList filters READ filters WRITE setFilters)
|
||||||
Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
|
|
||||||
Q_PROPERTY(Redirect redirect READ redirect WRITE setRedirect)
|
Q_PROPERTY(Redirect redirect READ redirect WRITE setRedirect)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -41,25 +40,23 @@ public:
|
|||||||
|
|
||||||
explicit ExtScript(QWidget *_parent = nullptr, const QString &_filePath = "");
|
explicit ExtScript(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||||
~ExtScript() override;
|
~ExtScript() override;
|
||||||
ExtScript *copy(const QString &_fileName, const int _number) override;
|
ExtScript *copy(const QString &_fileName, int _number) override;
|
||||||
static QString jsonFiltersFile();
|
static QString jsonFiltersFile();
|
||||||
// get methods
|
// get methods
|
||||||
QString executable() const;
|
[[nodiscard]] QString executable() const;
|
||||||
QStringList filters() const;
|
[[nodiscard]] QStringList filters() const;
|
||||||
QString prefix() const;
|
[[nodiscard]] Redirect redirect() const;
|
||||||
Redirect redirect() const;
|
[[nodiscard]] QString uniq() const override;
|
||||||
QString uniq() const override;
|
|
||||||
// derivatives
|
// derivatives
|
||||||
QString strRedirect() const;
|
[[nodiscard]] QString strRedirect() const;
|
||||||
// set methods
|
// set methods
|
||||||
void setExecutable(const QString &_executable);
|
void setExecutable(const QString &_executable);
|
||||||
void setFilters(const QStringList &_filters);
|
void setFilters(const QStringList &_filters);
|
||||||
void setPrefix(const QString &_prefix);
|
void setRedirect(Redirect _redirect);
|
||||||
void setRedirect(const Redirect _redirect);
|
|
||||||
void setStrRedirect(const QString &_redirect);
|
void setStrRedirect(const QString &_redirect);
|
||||||
// filters
|
// filters
|
||||||
QString applyFilters(QString _value) const;
|
[[nodiscard]] QString applyFilters(QString _value) const;
|
||||||
void updateFilter(const QString &_filter, const bool _add);
|
void updateFilter(const QString &_filter, bool _add);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void readConfiguration() override;
|
void readConfiguration() override;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>420</width>
|
<width>420</width>
|
||||||
<height>506</height>
|
<height>463</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -104,29 +104,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_prefix">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_prefix">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Prefix</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit_prefix"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_active">
|
<layout class="QHBoxLayout" name="layout_active">
|
||||||
<item>
|
<item>
|
||||||
|
@ -34,9 +34,9 @@ ExtUpgrade::ExtUpgrade(QWidget *_parent, const QString &_filePath)
|
|||||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
if (!_filePath.isEmpty())
|
if (!_filePath.isEmpty())
|
||||||
readConfiguration();
|
ExtUpgrade::readConfiguration();
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
translate();
|
ExtUpgrade::translate();
|
||||||
|
|
||||||
m_values[tag("pkgcount")] = 0;
|
m_values[tag("pkgcount")] = 0;
|
||||||
|
|
||||||
|
@ -38,16 +38,16 @@ class ExtUpgrade : public AbstractExtItem
|
|||||||
public:
|
public:
|
||||||
explicit ExtUpgrade(QWidget *_parent = nullptr, const QString &_filePath = "");
|
explicit ExtUpgrade(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||||
~ExtUpgrade() override;
|
~ExtUpgrade() override;
|
||||||
ExtUpgrade *copy(const QString &_fileName, const int _number) override;
|
ExtUpgrade *copy(const QString &_fileName, int _number) override;
|
||||||
// get methods
|
// get methods
|
||||||
QString executable() const;
|
[[nodiscard]] QString executable() const;
|
||||||
QString filter() const;
|
[[nodiscard]] QString filter() const;
|
||||||
int null() const;
|
[[nodiscard]] int null() const;
|
||||||
QString uniq() const override;
|
[[nodiscard]] 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(int _null);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void readConfiguration() override;
|
void readConfiguration() override;
|
||||||
|
@ -39,10 +39,10 @@ ExtWeather::ExtWeather(QWidget *_parent, const QString &_filePath)
|
|||||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
if (!_filePath.isEmpty())
|
if (!_filePath.isEmpty())
|
||||||
readConfiguration();
|
ExtWeather::readConfiguration();
|
||||||
readJsonMap();
|
readJsonMap();
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
translate();
|
ExtWeather::translate();
|
||||||
|
|
||||||
m_values[tag("weatherId")] = 0;
|
m_values[tag("weatherId")] = 0;
|
||||||
m_values[tag("weather")] = "";
|
m_values[tag("weather")] = "";
|
||||||
|
@ -44,24 +44,24 @@ public:
|
|||||||
|
|
||||||
explicit ExtWeather(QWidget *_parent = nullptr, const QString &_filePath = "");
|
explicit ExtWeather(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||||
~ExtWeather() override;
|
~ExtWeather() override;
|
||||||
ExtWeather *copy(const QString &_fileName, const int _number) override;
|
ExtWeather *copy(const QString &_fileName, int _number) override;
|
||||||
static QString jsonMapFile();
|
static QString jsonMapFile();
|
||||||
QString weatherFromInt(const int _id) const;
|
[[nodiscard]] QString weatherFromInt(int _id) const;
|
||||||
// get methods
|
// get methods
|
||||||
QString city() const;
|
[[nodiscard]] QString city() const;
|
||||||
QString country() const;
|
[[nodiscard]] QString country() const;
|
||||||
bool image() const;
|
[[nodiscard]] bool image() const;
|
||||||
Provider provider() const;
|
[[nodiscard]] Provider provider() const;
|
||||||
QString strProvider() const;
|
[[nodiscard]] QString strProvider() const;
|
||||||
int ts() const;
|
[[nodiscard]] int ts() const;
|
||||||
QString uniq() const override;
|
[[nodiscard]] 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);
|
||||||
void setImage(const bool _image);
|
void setImage(bool _image);
|
||||||
void setProvider(const Provider _provider);
|
void setProvider(Provider _provider);
|
||||||
void setStrProvider(const QString &_provider);
|
void setStrProvider(const QString &_provider);
|
||||||
void setTs(const int _ts);
|
void setTs(int _ts);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void readConfiguration() override;
|
void readConfiguration() override;
|
||||||
|
@ -52,9 +52,9 @@ GraphicalItem::GraphicalItem(QWidget *_parent, const QString &_filePath)
|
|||||||
m_helper = new GraphicalItemHelper(this, m_scene);
|
m_helper = new GraphicalItemHelper(this, m_scene);
|
||||||
|
|
||||||
if (!_filePath.isEmpty())
|
if (!_filePath.isEmpty())
|
||||||
readConfiguration();
|
GraphicalItem::readConfiguration();
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
translate();
|
GraphicalItem::translate();
|
||||||
|
|
||||||
connect(ui->checkBox_custom, SIGNAL(stateChanged(int)), this, SLOT(changeValue(int)));
|
connect(ui->checkBox_custom, SIGNAL(stateChanged(int)), this, SLOT(changeValue(int)));
|
||||||
connect(ui->comboBox_type, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCountState(int)));
|
connect(ui->comboBox_type, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCountState(int)));
|
||||||
|
@ -54,38 +54,38 @@ public:
|
|||||||
|
|
||||||
explicit GraphicalItem(QWidget *_parent = nullptr, const QString &_filePath = "");
|
explicit GraphicalItem(QWidget *_parent = nullptr, const QString &_filePath = "");
|
||||||
~GraphicalItem() override;
|
~GraphicalItem() override;
|
||||||
GraphicalItem *copy(const QString &_fileName, const int _number) override;
|
GraphicalItem *copy(const QString &_fileName, int _number) override;
|
||||||
QString image(const QVariant &value);
|
QString image(const QVariant &value);
|
||||||
void initScene();
|
void initScene();
|
||||||
// get methods
|
// get methods
|
||||||
QString bar() const;
|
[[nodiscard]] QString bar() const;
|
||||||
QString activeColor() const;
|
[[nodiscard]] QString activeColor() const;
|
||||||
int count() const;
|
[[nodiscard]] int count() const;
|
||||||
QString inactiveColor() const;
|
[[nodiscard]] QString inactiveColor() const;
|
||||||
bool isCustom() const;
|
[[nodiscard]] bool isCustom() const;
|
||||||
int itemHeight() const;
|
[[nodiscard]] int itemHeight() const;
|
||||||
int itemWidth() const;
|
[[nodiscard]] int itemWidth() const;
|
||||||
float minValue() const;
|
[[nodiscard]] float minValue() const;
|
||||||
float maxValue() const;
|
[[nodiscard]] float maxValue() const;
|
||||||
Type type() const;
|
[[nodiscard]] Type type() const;
|
||||||
QString strType() const;
|
[[nodiscard]] QString strType() const;
|
||||||
Direction direction() const;
|
[[nodiscard]] Direction direction() const;
|
||||||
QString strDirection() const;
|
[[nodiscard]] QString strDirection() const;
|
||||||
QStringList usedKeys() const;
|
[[nodiscard]] QStringList usedKeys() const;
|
||||||
QString uniq() const override;
|
[[nodiscard]] 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);
|
||||||
void setCount(const int _count);
|
void setCount(int _count);
|
||||||
void setCustom(const bool _custom);
|
void setCustom(bool _custom);
|
||||||
void setInactiveColor(const QString &_color);
|
void setInactiveColor(const QString &_color);
|
||||||
void setItemHeight(const int _height);
|
void setItemHeight(int _height);
|
||||||
void setItemWidth(const int _width);
|
void setItemWidth(int _width);
|
||||||
void setMinValue(const float _value);
|
void setMinValue(float _value);
|
||||||
void setMaxValue(const float _value);
|
void setMaxValue(float _value);
|
||||||
void setType(const Type _type);
|
void setType(Type _type);
|
||||||
void setStrType(const QString &_type);
|
void setStrType(const QString &_type);
|
||||||
void setDirection(const Direction _direction);
|
void setDirection(Direction _direction);
|
||||||
void setStrDirection(const QString &_direction);
|
void setStrDirection(const QString &_direction);
|
||||||
void setUsedKeys(const QStringList &_usedKeys);
|
void setUsedKeys(const QStringList &_usedKeys);
|
||||||
|
|
||||||
@ -97,8 +97,8 @@ public slots:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void changeColor();
|
void changeColor();
|
||||||
void changeCountState(const int _state);
|
void changeCountState(int _state);
|
||||||
void changeValue(const int _state);
|
void changeValue(int _state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GraphicalItemHelper *m_helper = nullptr;
|
GraphicalItemHelper *m_helper = nullptr;
|
||||||
|
@ -92,7 +92,7 @@ void GraphicalItemHelper::paintBars(const float _value)
|
|||||||
auto 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 = static_cast<float>(i) * normX;
|
||||||
float y = 0.5f;
|
float y = 0.5f;
|
||||||
float width = normX;
|
float width = normX;
|
||||||
float height = m_values.at(i) * normY + 0.5f;
|
float height = m_values.at(i) * normY + 0.5f;
|
||||||
@ -137,9 +137,10 @@ void GraphicalItemHelper::paintGraph(const float _value)
|
|||||||
// 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
|
||||||
float x1 = i * normX;
|
auto value = static_cast<float>(i);
|
||||||
|
float x1 = value * normX;
|
||||||
float y1 = m_values.at(i) * normY + 0.5f;
|
float y1 = m_values.at(i) * normY + 0.5f;
|
||||||
float x2 = (i + 1) * normX;
|
float x2 = (value + 1) * normX;
|
||||||
float y2 = m_values.at(i + 1) * normY + 0.5f;
|
float y2 = m_values.at(i + 1) * normY + 0.5f;
|
||||||
m_scene->addLine(x1, y1, x2, y2, m_activePen);
|
m_scene->addLine(x1, y1, x2, y2, m_activePen);
|
||||||
}
|
}
|
||||||
@ -153,10 +154,11 @@ void GraphicalItemHelper::paintHorizontal(const float _percent)
|
|||||||
m_activePen.setWidth(m_height);
|
m_activePen.setWidth(m_height);
|
||||||
m_inactivePen.setWidth(m_height);
|
m_inactivePen.setWidth(m_height);
|
||||||
// inactive
|
// inactive
|
||||||
m_scene->addLine(_percent * m_width + 0.5 * m_height, 0.5 * m_height, m_width + 0.5 * m_height,
|
auto width = static_cast<float>(m_width);
|
||||||
|
m_scene->addLine(_percent * width + 0.5 * m_height, 0.5 * m_height, m_width + 0.5 * m_height,
|
||||||
0.5 * m_height, m_inactivePen);
|
0.5 * m_height, m_inactivePen);
|
||||||
// active
|
// active
|
||||||
m_scene->addLine(-0.5 * m_height, 0.5 * m_height, _percent * m_width - 0.5 * m_height,
|
m_scene->addLine(-0.5 * m_height, 0.5 * m_height, _percent * width - 0.5 * m_height,
|
||||||
0.5 * m_height, m_activePen);
|
0.5 * m_height, m_activePen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,21 +33,21 @@ public:
|
|||||||
explicit GraphicalItemHelper(QObject *_parent = nullptr, QGraphicsScene *_scene = nullptr);
|
explicit GraphicalItemHelper(QObject *_parent = nullptr, QGraphicsScene *_scene = nullptr);
|
||||||
~GraphicalItemHelper() override;
|
~GraphicalItemHelper() override;
|
||||||
// parameters
|
// parameters
|
||||||
void setParameters(const QString &_active, const QString &_inactive, const int _width,
|
void setParameters(const QString &_active, const QString &_inactive, int _width, int _height,
|
||||||
const int _height, const int _count);
|
int _count);
|
||||||
// paint methods
|
// paint methods
|
||||||
void paintBars(const float _value);
|
void paintBars(float _value);
|
||||||
void paintCircle(const float _percent);
|
void paintCircle(float _percent);
|
||||||
void paintGraph(const float _value);
|
void paintGraph(float _value);
|
||||||
void paintHorizontal(const float _percent);
|
void paintHorizontal(float _percent);
|
||||||
void paintVertical(const float _percent);
|
void paintVertical(float _percent);
|
||||||
// additional conversion methods
|
// additional conversion methods
|
||||||
static float getPercents(const float _value, const float _min, const float _max);
|
static float getPercents(float _value, float _min, float _max);
|
||||||
static bool isColor(const QString &_input);
|
static bool isColor(const QString &_input);
|
||||||
static QColor stringToColor(const QString &_color);
|
static QColor stringToColor(const QString &_color);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void storeValue(const float _value);
|
void storeValue(float _value);
|
||||||
QGraphicsScene *m_scene = nullptr;
|
QGraphicsScene *m_scene = nullptr;
|
||||||
int m_count = 100;
|
int m_count = 100;
|
||||||
QPen m_activePen;
|
QPen m_activePen;
|
||||||
|
@ -33,12 +33,12 @@ public:
|
|||||||
|
|
||||||
explicit OWMWeatherProvider(QObject *_parent);
|
explicit OWMWeatherProvider(QObject *_parent);
|
||||||
~OWMWeatherProvider() override;
|
~OWMWeatherProvider() override;
|
||||||
void initUrl(const QString &_city, const QString &_country, const int) override;
|
void initUrl(const QString &_city, const QString &_country, int) override;
|
||||||
QVariantHash parse(const QVariantMap &_json) const override;
|
[[nodiscard]] QVariantHash parse(const QVariantMap &_json) const override;
|
||||||
QUrl url() const override;
|
[[nodiscard]] QUrl url() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVariantHash parseSingleJson(const QVariantMap &_json) const;
|
[[nodiscard]] QVariantHash parseSingleJson(const QVariantMap &_json) const;
|
||||||
int m_ts = 0;
|
int m_ts = 0;
|
||||||
QUrl m_url;
|
QUrl m_url;
|
||||||
};
|
};
|
||||||
|
@ -39,7 +39,7 @@ public:
|
|||||||
int minValue = -1;
|
int minValue = -1;
|
||||||
int maxValue = -1;
|
int maxValue = -1;
|
||||||
int div = 1;
|
int div = 1;
|
||||||
void fromRange(const QString &_range, const int _min, const int _max);
|
void fromRange(const QString &_range, int _min, int _max);
|
||||||
QList<int> toList();
|
QList<int> toList();
|
||||||
} QCronField;
|
} QCronField;
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
QCronRunSchedule m_schedule;
|
QCronRunSchedule m_schedule;
|
||||||
QTimer *m_timer = nullptr;
|
QTimer *m_timer = nullptr;
|
||||||
static QList<int> parseField(const QString &_value, const int _min, const int _max);
|
static QList<int> parseField(const QString &_value, int _min, int _max);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,11 +3,10 @@ Encoding=UTF-8
|
|||||||
Name=aw-get-external-ip
|
Name=aw-get-external-ip
|
||||||
Comment=Custom command to get external IP
|
Comment=Custom command to get external IP
|
||||||
Exec=curl ip4.telize.com
|
Exec=curl ip4.telize.com
|
||||||
X-AW-Prefix=
|
|
||||||
X-AW-Active=false
|
X-AW-Active=false
|
||||||
X-AW-Redirect=nothing
|
X-AW-Redirect=nothing
|
||||||
X-AW-Interval=1
|
X-AW-Interval=1
|
||||||
X-AW-ApiVersion=5
|
X-AW-ApiVersion=6
|
||||||
X-AW-Number=0
|
X-AW-Number=0
|
||||||
X-AW-Filters=
|
X-AW-Filters=
|
||||||
X-AW-Schedule=
|
X-AW-Schedule=
|
||||||
|
@ -31,8 +31,9 @@ public:
|
|||||||
explicit StooqQuotesProvider(QObject *_parent);
|
explicit StooqQuotesProvider(QObject *_parent);
|
||||||
~StooqQuotesProvider() override;
|
~StooqQuotesProvider() override;
|
||||||
void initUrl(const QString &_asset) override;
|
void initUrl(const QString &_asset) override;
|
||||||
QVariantHash parse(const QByteArray &_source, const QVariantHash &_oldValues) const override;
|
[[nodiscard]] QVariantHash parse(const QByteArray &_source,
|
||||||
QUrl url() const override;
|
const QVariantHash &_oldValues) const override;
|
||||||
|
[[nodiscard]] QUrl url() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QUrl m_url;
|
QUrl m_url;
|
||||||
|
@ -32,8 +32,9 @@ public:
|
|||||||
explicit YahooQuotesProvider(QObject *_parent);
|
explicit YahooQuotesProvider(QObject *_parent);
|
||||||
~YahooQuotesProvider() override;
|
~YahooQuotesProvider() override;
|
||||||
void initUrl(const QString &_asset) override;
|
void initUrl(const QString &_asset) override;
|
||||||
QVariantHash parse(const QByteArray &_source, const QVariantHash &_oldValues) const override;
|
[[nodiscard]] QVariantHash parse(const QByteArray &_source,
|
||||||
QUrl url() const override;
|
const QVariantHash &_oldValues) const override;
|
||||||
|
[[nodiscard]] QUrl url() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QUrl m_url;
|
QUrl m_url;
|
||||||
|
@ -33,13 +33,14 @@ public:
|
|||||||
|
|
||||||
explicit YahooWeatherProvider(QObject *_parent);
|
explicit YahooWeatherProvider(QObject *_parent);
|
||||||
~YahooWeatherProvider() override;
|
~YahooWeatherProvider() override;
|
||||||
void initUrl(const QString &_city, const QString &_country, const int) override;
|
void initUrl(const QString &_city, const QString &_country, int) override;
|
||||||
QVariantHash parse(const QVariantMap &_json) const override;
|
[[nodiscard]] QVariantHash parse(const QVariantMap &_json) const override;
|
||||||
QUrl url() const override;
|
[[nodiscard]] QUrl url() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVariantHash parseCurrent(const QVariantMap &_json, const QVariantMap &_atmosphere) const;
|
[[nodiscard]] QVariantHash parseCurrent(const QVariantMap &_json,
|
||||||
QVariantHash parseForecast(const QVariantMap &_json) const;
|
const QVariantMap &_atmosphere) const;
|
||||||
|
[[nodiscard]] QVariantHash parseForecast(const QVariantMap &_json) const;
|
||||||
int m_ts = 0;
|
int m_ts = 0;
|
||||||
QUrl m_url;
|
QUrl m_url;
|
||||||
};
|
};
|
||||||
|
@ -118,34 +118,35 @@ QString DPAdds::toolTipImage(const int _desktop) const
|
|||||||
toolTipView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
toolTipView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
|
||||||
// update
|
// update
|
||||||
float margin = 5.0f * info.desktop.width() / 400.0f;
|
auto width = static_cast<float>(info.desktop.width());
|
||||||
toolTipView->resize(static_cast<int>(info.desktop.width() + 2.0f * margin),
|
auto height = static_cast<float>(info.desktop.height());
|
||||||
static_cast<int>(info.desktop.height() + 2.0f * margin));
|
float margin = 5.0f * width / 400.0f;
|
||||||
|
toolTipView->resize(static_cast<int>(width + 2.0f * margin),
|
||||||
|
static_cast<int>(height + 2.0f * margin));
|
||||||
toolTipScene->clear();
|
toolTipScene->clear();
|
||||||
toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
||||||
// borders
|
// borders
|
||||||
toolTipScene->addLine(0, 0, 0, info.desktop.height() + 2.0 * margin);
|
toolTipScene->addLine(0, 0, 0, height + 2.0 * margin);
|
||||||
toolTipScene->addLine(0, info.desktop.height() + 2.0 * margin,
|
toolTipScene->addLine(0, height + 2.0 * margin, width + 2.0 * margin, height + 2.0 * margin);
|
||||||
info.desktop.width() + 2.0 * margin,
|
toolTipScene->addLine(width + 2.0 * margin, height + 2.0 * margin, width + 2.0 * margin, 0);
|
||||||
info.desktop.height() + 2.0 * margin);
|
toolTipScene->addLine(width + 2.0 * margin, 0, 0, 0);
|
||||||
toolTipScene->addLine(info.desktop.width() + 2.0 * margin, info.desktop.height() + 2.0 * margin,
|
|
||||||
info.desktop.width() + 2.0 * margin, 0);
|
|
||||||
toolTipScene->addLine(info.desktop.width() + 2.0 * margin, 0, 0, 0);
|
|
||||||
|
|
||||||
if (m_tooltipType == "contours") {
|
if (m_tooltipType == "contours") {
|
||||||
QPen pen = QPen();
|
QPen pen = QPen();
|
||||||
pen.setWidthF(2.0 * info.desktop.width() / 400.0);
|
pen.setWidthF(2.0 * width / 400.0);
|
||||||
pen.setColor(QColor(m_tooltipColor));
|
pen.setColor(QColor(m_tooltipColor));
|
||||||
for (auto &data : info.windowsData) {
|
for (auto &data : info.windowsData) {
|
||||||
QRect rect = data.rect;
|
QRect rect = data.rect;
|
||||||
toolTipScene->addLine(rect.left() + margin, rect.bottom() + margin,
|
auto left = static_cast<float>(rect.left());
|
||||||
rect.left() + margin, rect.top() + margin, pen);
|
auto right = static_cast<float>(rect.right());
|
||||||
toolTipScene->addLine(rect.left() + margin, rect.top() + margin, rect.right() + margin,
|
auto top = static_cast<float>(rect.top());
|
||||||
rect.top() + margin, pen);
|
auto bottom = static_cast<float>(rect.bottom());
|
||||||
toolTipScene->addLine(rect.right() + margin, rect.top() + margin, rect.right() + margin,
|
toolTipScene->addLine(left + margin, bottom + margin, left + margin, top + margin, pen);
|
||||||
rect.bottom() + margin, pen);
|
toolTipScene->addLine(left + margin, top + margin, right + margin, top + margin, pen);
|
||||||
toolTipScene->addLine(rect.right() + margin, rect.bottom() + margin,
|
toolTipScene->addLine(right + margin, top + margin, right + margin, bottom + margin,
|
||||||
rect.left() + margin, rect.bottom() + margin, pen);
|
pen);
|
||||||
|
toolTipScene->addLine(right + margin, bottom + margin, left + margin, bottom + margin,
|
||||||
|
pen);
|
||||||
}
|
}
|
||||||
} else if (m_tooltipType == "clean") {
|
} else if (m_tooltipType == "clean") {
|
||||||
QScreen *screen = QGuiApplication::primaryScreen();
|
QScreen *screen = QGuiApplication::primaryScreen();
|
||||||
|
@ -45,15 +45,15 @@ public:
|
|||||||
~DPAdds() override;
|
~DPAdds() override;
|
||||||
Q_INVOKABLE static bool isDebugEnabled();
|
Q_INVOKABLE static bool isDebugEnabled();
|
||||||
Q_INVOKABLE static int currentDesktop();
|
Q_INVOKABLE static int currentDesktop();
|
||||||
Q_INVOKABLE static QStringList dictKeys(const bool _sorted = true, const QString &_regexp = "");
|
Q_INVOKABLE static QStringList dictKeys(bool _sorted = true, const QString &_regexp = "");
|
||||||
Q_INVOKABLE static int numberOfDesktops();
|
Q_INVOKABLE static int numberOfDesktops();
|
||||||
Q_INVOKABLE QString toolTipImage(const int _desktop) const;
|
Q_INVOKABLE [[nodiscard]] QString toolTipImage(int _desktop) const;
|
||||||
Q_INVOKABLE QString parsePattern(const QString &_pattern, const int _desktop) const;
|
Q_INVOKABLE [[nodiscard]] QString parsePattern(const QString &_pattern, 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 static QString infoByKey(const QString &_key);
|
Q_INVOKABLE static QString infoByKey(const QString &_key);
|
||||||
Q_INVOKABLE QString valueByKey(const QString &_key, int _desktop = -1) const;
|
Q_INVOKABLE [[nodiscard]] QString valueByKey(const QString &_key, int _desktop = -1) const;
|
||||||
// configuration slots
|
// configuration slots
|
||||||
Q_INVOKABLE static QString getAboutText(const QString &_type);
|
Q_INVOKABLE static QString getAboutText(const QString &_type);
|
||||||
Q_INVOKABLE static QVariantMap getFont(const QVariantMap &_defaultFont);
|
Q_INVOKABLE static QVariantMap getFont(const QVariantMap &_defaultFont);
|
||||||
@ -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 static void setCurrentDesktop(const int _desktop);
|
Q_INVOKABLE static void setCurrentDesktop(int _desktop);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static DesktopWindowsInfo getInfoByDesktop(const int _desktop);
|
static DesktopWindowsInfo getInfoByDesktop(int _desktop);
|
||||||
// variables
|
// variables
|
||||||
int m_tooltipWidth = 200;
|
int m_tooltipWidth = 200;
|
||||||
QString m_mark = "*";
|
QString m_mark = "*";
|
||||||
|
@ -108,8 +108,7 @@ void ExtendedSysMon::readConfiguration()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QHash<QString, QString>
|
QHash<QString, QString> ExtendedSysMon::updateConfiguration(QHash<QString, QString> _rawConfig)
|
||||||
ExtendedSysMon::updateConfiguration(QHash<QString, QString> _rawConfig) const
|
|
||||||
{
|
{
|
||||||
qCDebug(LOG_ESM) << "Raw configuration" << _rawConfig;
|
qCDebug(LOG_ESM) << "Raw configuration" << _rawConfig;
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
~ExtendedSysMon() override;
|
~ExtendedSysMon() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStringList sources() const override;
|
[[nodiscard]] QStringList sources() const override;
|
||||||
bool sourceRequestEvent(const QString &_source) override;
|
bool sourceRequestEvent(const QString &_source) override;
|
||||||
bool updateSourceEvent(const QString &_source) override;
|
bool updateSourceEvent(const QString &_source) override;
|
||||||
|
|
||||||
@ -42,7 +42,8 @@ private:
|
|||||||
QHash<QString, QString> m_configuration;
|
QHash<QString, QString> m_configuration;
|
||||||
// methods
|
// methods
|
||||||
void readConfiguration();
|
void readConfiguration();
|
||||||
QHash<QString, QString> updateConfiguration(QHash<QString, QString> _rawConfig) const;
|
[[nodiscard]] static QHash<QString, QString>
|
||||||
|
updateConfiguration(QHash<QString, QString> _rawConfig);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,10 +30,10 @@ class ExtSysMonAggregator : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit ExtSysMonAggregator(QObject *_parent, const QHash<QString, QString> &_config);
|
explicit ExtSysMonAggregator(QObject *_parent, const QHash<QString, QString> &_config);
|
||||||
~ExtSysMonAggregator() override;
|
~ExtSysMonAggregator() override;
|
||||||
QVariant data(const QString &_source) const;
|
[[nodiscard]] QVariant data(const QString &_source) const;
|
||||||
bool hasSource(const QString &_source) const;
|
[[nodiscard]] bool hasSource(const QString &_source) const;
|
||||||
QVariantMap initialData(const QString &_source) const;
|
[[nodiscard]] QVariantMap initialData(const QString &_source) const;
|
||||||
QStringList sources() const;
|
[[nodiscard]] QStringList sources() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init(const QHash<QString, QString> &_config);
|
void init(const QHash<QString, QString> &_config);
|
||||||
|
@ -32,9 +32,9 @@ public:
|
|||||||
: QObject(_parent){};
|
: QObject(_parent){};
|
||||||
~AbstractExtSysMonSource() override = default;
|
~AbstractExtSysMonSource() override = default;
|
||||||
virtual QVariant data(const QString &_source) = 0;
|
virtual QVariant data(const QString &_source) = 0;
|
||||||
virtual QVariantMap initialData(const QString &_source) const = 0;
|
[[nodiscard]] virtual QVariantMap initialData(const QString &_source) const = 0;
|
||||||
virtual void run() = 0;
|
virtual void run() = 0;
|
||||||
virtual QStringList sources() const = 0;
|
[[nodiscard]] virtual QStringList sources() const = 0;
|
||||||
// used by extensions
|
// used by extensions
|
||||||
static int index(const QString &_source)
|
static int index(const QString &_source)
|
||||||
{
|
{
|
||||||
|
@ -241,7 +241,8 @@ void BatterySource::calculateRates()
|
|||||||
|
|
||||||
// check time interval
|
// check time interval
|
||||||
auto now = QDateTime::currentDateTimeUtc();
|
auto now = QDateTime::currentDateTimeUtc();
|
||||||
auto interval = (now.toMSecsSinceEpoch() - m_timestamp.toMSecsSinceEpoch()) / 1000.0f;
|
auto interval = m_timestamp.secsTo(now);
|
||||||
|
qCDebug(LOG_AW) << interval;
|
||||||
m_timestamp.swap(now);
|
m_timestamp.swap(now);
|
||||||
|
|
||||||
for (int i = 0; i < m_batteriesCount; i++) {
|
for (int i = 0; i < m_batteriesCount; i++) {
|
||||||
|
@ -35,9 +35,9 @@ public:
|
|||||||
~BatterySource() override;
|
~BatterySource() override;
|
||||||
QStringList getSources();
|
QStringList getSources();
|
||||||
QVariant data(const QString &_source) override;
|
QVariant data(const QString &_source) override;
|
||||||
QVariantMap initialData(const QString &_source) const override;
|
[[nodiscard]] QVariantMap initialData(const QString &_source) const override;
|
||||||
void run() override;
|
void run() override;
|
||||||
QStringList sources() const override;
|
[[nodiscard]] QStringList sources() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static double approximate(const QList<int> &_trend);
|
static double approximate(const QList<int> &_trend);
|
||||||
|
@ -34,9 +34,9 @@ public:
|
|||||||
explicit CustomSource(QObject *_parent, const QStringList &_args);
|
explicit CustomSource(QObject *_parent, const QStringList &_args);
|
||||||
~CustomSource() override;
|
~CustomSource() override;
|
||||||
QVariant data(const QString &_source) override;
|
QVariant data(const QString &_source) override;
|
||||||
QVariantMap initialData(const QString &_source) const override;
|
[[nodiscard]] QVariantMap initialData(const QString &_source) const override;
|
||||||
void run() override{};
|
void run() override{};
|
||||||
QStringList sources() const override;
|
[[nodiscard]] QStringList sources() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList getSources();
|
QStringList getSources();
|
||||||
|
@ -31,9 +31,9 @@ public:
|
|||||||
explicit DesktopSource(QObject *_parent, const QStringList &_args);
|
explicit DesktopSource(QObject *_parent, const QStringList &_args);
|
||||||
~DesktopSource() override;
|
~DesktopSource() override;
|
||||||
QVariant data(const QString &_source) override;
|
QVariant data(const QString &_source) override;
|
||||||
QVariantMap initialData(const QString &_source) const override;
|
[[nodiscard]] QVariantMap initialData(const QString &_source) const override;
|
||||||
void run() override{};
|
void run() override{};
|
||||||
QStringList sources() const override;
|
[[nodiscard]] QStringList sources() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,9 +34,9 @@ public:
|
|||||||
~GPULoadSource() override;
|
~GPULoadSource() override;
|
||||||
static QString autoGpu();
|
static QString autoGpu();
|
||||||
QVariant data(const QString &_source) override;
|
QVariant data(const QString &_source) override;
|
||||||
QVariantMap initialData(const QString &_source) const override;
|
[[nodiscard]] QVariantMap initialData(const QString &_source) const override;
|
||||||
void run() override;
|
void run() override;
|
||||||
QStringList sources() const override;
|
[[nodiscard]] QStringList sources() const override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateValue();
|
void updateValue();
|
||||||
|
@ -84,7 +84,8 @@ void GPUTemperatureSource::run()
|
|||||||
return;
|
return;
|
||||||
// build cmd
|
// build cmd
|
||||||
QString cmd = m_device == "nvidia" ? "nvidia-smi" : "aticonfig";
|
QString cmd = m_device == "nvidia" ? "nvidia-smi" : "aticonfig";
|
||||||
auto args = m_device == "nvidia" ? QStringList({"-q", "-x"}) : QStringList({"--od-gettemperature"});
|
auto args
|
||||||
|
= m_device == "nvidia" ? QStringList({"-q", "-x"}) : QStringList({"--od-gettemperature"});
|
||||||
qCInfo(LOG_ESS) << "cmd" << cmd;
|
qCInfo(LOG_ESS) << "cmd" << cmd;
|
||||||
|
|
||||||
m_process->start(cmd, args);
|
m_process->start(cmd, args);
|
||||||
|
@ -33,9 +33,9 @@ public:
|
|||||||
explicit GPUTemperatureSource(QObject *_parent, const QStringList &_args);
|
explicit GPUTemperatureSource(QObject *_parent, const QStringList &_args);
|
||||||
~GPUTemperatureSource() override;
|
~GPUTemperatureSource() override;
|
||||||
QVariant data(const QString &_source) override;
|
QVariant data(const QString &_source) override;
|
||||||
QVariantMap initialData(const QString &_source) const override;
|
[[nodiscard]] QVariantMap initialData(const QString &_source) const override;
|
||||||
void run() override;
|
void run() override;
|
||||||
QStringList sources() const override;
|
[[nodiscard]] QStringList sources() const override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateValue();
|
void updateValue();
|
||||||
|
@ -32,7 +32,7 @@ HDDTemperatureSource::HDDTemperatureSource(QObject *_parent, const QStringList &
|
|||||||
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
|
||||||
|
|
||||||
m_devices = _args.at(0).split(',', Qt::SkipEmptyParts);
|
m_devices = _args.at(0).split(',', Qt::SkipEmptyParts);
|
||||||
m_cmd = _args.at(1).split(' '); // lets hope no one put cmd with spaces here lol
|
m_cmd = _args.at(1).split(' '); // lets hope no one put cmd with spaces here lol
|
||||||
|
|
||||||
m_smartctl = m_cmd.contains("smartctl");
|
m_smartctl = m_cmd.contains("smartctl");
|
||||||
qCInfo(LOG_ESS) << "Parse as smartctl" << m_smartctl;
|
qCInfo(LOG_ESS) << "Parse as smartctl" << m_smartctl;
|
||||||
|
@ -34,9 +34,9 @@ public:
|
|||||||
~HDDTemperatureSource() override;
|
~HDDTemperatureSource() override;
|
||||||
static QStringList allHdd();
|
static QStringList allHdd();
|
||||||
QVariant data(const QString &_source) override;
|
QVariant data(const QString &_source) override;
|
||||||
QVariantMap initialData(const QString &_source) const override;
|
[[nodiscard]] QVariantMap initialData(const QString &_source) const override;
|
||||||
void run() override{};
|
void run() override{};
|
||||||
QStringList sources() const override;
|
[[nodiscard]] QStringList sources() const override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateValue(const QString &_device);
|
void updateValue(const QString &_device);
|
||||||
|
@ -31,9 +31,9 @@ public:
|
|||||||
explicit LoadSource(QObject *_parent, const QStringList &_args);
|
explicit LoadSource(QObject *_parent, const QStringList &_args);
|
||||||
~LoadSource() override;
|
~LoadSource() override;
|
||||||
QVariant data(const QString &_source) override;
|
QVariant data(const QString &_source) override;
|
||||||
QVariantMap initialData(const QString &_source) const override;
|
[[nodiscard]] QVariantMap initialData(const QString &_source) const override;
|
||||||
void run() override{};
|
void run() override{};
|
||||||
QStringList sources() const override;
|
[[nodiscard]] QStringList sources() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,9 +33,9 @@ public:
|
|||||||
explicit NetworkSource(QObject *_parent, const QStringList &_args);
|
explicit NetworkSource(QObject *_parent, const QStringList &_args);
|
||||||
~NetworkSource() override;
|
~NetworkSource() override;
|
||||||
QVariant data(const QString &_source) override;
|
QVariant data(const QString &_source) override;
|
||||||
QVariantMap initialData(const QString &_source) const override;
|
[[nodiscard]] QVariantMap initialData(const QString &_source) const override;
|
||||||
void run() override;
|
void run() override;
|
||||||
QStringList sources() const override;
|
[[nodiscard]] QStringList sources() const override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateSsid();
|
void updateSsid();
|
||||||
|
@ -311,7 +311,7 @@ QVariantHash PlayerSource::getPlayerMpdInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QVariantHash PlayerSource::getPlayerMprisInfo(const QString &_mpris) const
|
QVariantHash PlayerSource::getPlayerMprisInfo(const QString &_mpris)
|
||||||
{
|
{
|
||||||
qCDebug(LOG_ESS) << "MPRIS" << _mpris;
|
qCDebug(LOG_ESS) << "MPRIS" << _mpris;
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ QVariantHash PlayerSource::getPlayerMprisInfo(const QString &_mpris) const
|
|||||||
qCWarning(LOG_ESS) << "Error message" << response.errorMessage();
|
qCWarning(LOG_ESS) << "Error message" << response.errorMessage();
|
||||||
} else {
|
} else {
|
||||||
// another portion of dirty magic
|
// another portion of dirty magic
|
||||||
QVariantHash map = qdbus_cast<QVariantHash>(
|
auto map = qdbus_cast<QVariantHash>(
|
||||||
response.arguments().first().value<QDBusVariant>().variant().value<QDBusArgument>());
|
response.arguments().first().value<QDBusVariant>().variant().value<QDBusArgument>());
|
||||||
info["player/album"] = map.value("xesam:album", "unknown");
|
info["player/album"] = map.value("xesam:album", "unknown");
|
||||||
// artist is array
|
// artist is array
|
||||||
|
@ -38,24 +38,24 @@ public:
|
|||||||
~PlayerSource() override;
|
~PlayerSource() override;
|
||||||
QVariant data(const QString &_source) override;
|
QVariant data(const QString &_source) override;
|
||||||
static QString getAutoMpris();
|
static QString getAutoMpris();
|
||||||
QVariantMap initialData(const QString &_source) const override;
|
[[nodiscard]] QVariantMap initialData(const QString &_source) const override;
|
||||||
void run() override;
|
void run() override;
|
||||||
QStringList sources() const override;
|
[[nodiscard]] QStringList sources() const override;
|
||||||
// additional method to build dynamic tags
|
// additional method to build dynamic tags
|
||||||
static QString buildString(const QString &_current, const QString &_value, const int _s);
|
static QString buildString(const QString &_current, const QString &_value, int _s);
|
||||||
static QString stripString(const QString &_value, const int _s);
|
static QString stripString(const QString &_value, int _s);
|
||||||
// additional test method
|
// additional test method
|
||||||
bool isMpdSocketConnected() const;
|
[[nodiscard]] bool isMpdSocketConnected() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void mpdSocketConnected();
|
void mpdSocketConnected();
|
||||||
void mpdSocketReadyRead();
|
void mpdSocketReadyRead();
|
||||||
void mpdSocketWritten(const qint64 _bytes);
|
void mpdSocketWritten(qint64 _bytes);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static inline QVariantHash defaultInfo();
|
static inline QVariantHash defaultInfo();
|
||||||
QVariantHash getPlayerMpdInfo();
|
QVariantHash getPlayerMpdInfo();
|
||||||
QVariantHash getPlayerMprisInfo(const QString &_mpris) const;
|
[[nodiscard]] static QVariantHash getPlayerMprisInfo(const QString &_mpris);
|
||||||
QTcpSocket m_mpdSocket;
|
QTcpSocket m_mpdSocket;
|
||||||
// configuration and values
|
// configuration and values
|
||||||
QString m_mpdAddress;
|
QString m_mpdAddress;
|
||||||
|
@ -31,9 +31,9 @@ public:
|
|||||||
explicit ProcessesSource(QObject *_parent, const QStringList &_args);
|
explicit ProcessesSource(QObject *_parent, const QStringList &_args);
|
||||||
~ProcessesSource() override;
|
~ProcessesSource() override;
|
||||||
QVariant data(const QString &_source) override;
|
QVariant data(const QString &_source) override;
|
||||||
QVariantMap initialData(const QString &_source) const override;
|
[[nodiscard]] QVariantMap initialData(const QString &_source) const override;
|
||||||
void run() override;
|
void run() override;
|
||||||
QStringList sources() const override;
|
[[nodiscard]] QStringList sources() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// configuration and values
|
// configuration and values
|
||||||
|
@ -34,9 +34,9 @@ public:
|
|||||||
explicit QuotesSource(QObject *_parent, const QStringList &_args);
|
explicit QuotesSource(QObject *_parent, const QStringList &_args);
|
||||||
~QuotesSource() override;
|
~QuotesSource() override;
|
||||||
QVariant data(const QString &_source) override;
|
QVariant data(const QString &_source) override;
|
||||||
QVariantMap initialData(const QString &_source) const override;
|
[[nodiscard]] QVariantMap initialData(const QString &_source) const override;
|
||||||
void run() override{};
|
void run() override{};
|
||||||
QStringList sources() const override;
|
[[nodiscard]] QStringList sources() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList getSources();
|
QStringList getSources();
|
||||||
|
@ -34,9 +34,9 @@ public:
|
|||||||
explicit RequestSource(QObject *_parent, const QStringList &_args);
|
explicit RequestSource(QObject *_parent, const QStringList &_args);
|
||||||
~RequestSource() override;
|
~RequestSource() override;
|
||||||
QVariant data(const QString &_source) override;
|
QVariant data(const QString &_source) override;
|
||||||
QVariantMap initialData(const QString &_source) const override;
|
[[nodiscard]] QVariantMap initialData(const QString &_source) const override;
|
||||||
void run() override{};
|
void run() override{};
|
||||||
QStringList sources() const override;
|
[[nodiscard]] QStringList sources() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList getSources();
|
QStringList getSources();
|
||||||
|
@ -31,9 +31,9 @@ public:
|
|||||||
explicit SystemInfoSource(QObject *_parent, const QStringList &_args);
|
explicit SystemInfoSource(QObject *_parent, const QStringList &_args);
|
||||||
~SystemInfoSource() override;
|
~SystemInfoSource() override;
|
||||||
QVariant data(const QString &_source) override;
|
QVariant data(const QString &_source) override;
|
||||||
QVariantMap initialData(const QString &_source) const override;
|
[[nodiscard]] QVariantMap initialData(const QString &_source) const override;
|
||||||
void run() override;
|
void run() override;
|
||||||
QStringList sources() const override;
|
[[nodiscard]] QStringList sources() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// configuration and values
|
// configuration and values
|
||||||
|
@ -34,9 +34,9 @@ public:
|
|||||||
explicit UpgradeSource(QObject *_parent, const QStringList &_args);
|
explicit UpgradeSource(QObject *_parent, const QStringList &_args);
|
||||||
~UpgradeSource() override;
|
~UpgradeSource() override;
|
||||||
QVariant data(const QString &_source) override;
|
QVariant data(const QString &_source) override;
|
||||||
QVariantMap initialData(const QString &_source) const override;
|
[[nodiscard]] QVariantMap initialData(const QString &_source) const override;
|
||||||
void run() override{};
|
void run() override{};
|
||||||
QStringList sources() const override;
|
[[nodiscard]] QStringList sources() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList getSources();
|
QStringList getSources();
|
||||||
|
@ -34,9 +34,9 @@ public:
|
|||||||
explicit WeatherSource(QObject *_parent, const QStringList &_args);
|
explicit WeatherSource(QObject *_parent, const QStringList &_args);
|
||||||
~WeatherSource() override;
|
~WeatherSource() override;
|
||||||
QVariant data(const QString &_source) override;
|
QVariant data(const QString &_source) override;
|
||||||
QVariantMap initialData(const QString &_source) const override;
|
[[nodiscard]] QVariantMap initialData(const QString &_source) const override;
|
||||||
void run() override{};
|
void run() override{};
|
||||||
QStringList sources() const override;
|
[[nodiscard]] QStringList sources() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList getSources();
|
QStringList getSources();
|
||||||
|
@ -20,15 +20,13 @@
|
|||||||
|
|
||||||
#include <KWindowSystem>
|
#include <KWindowSystem>
|
||||||
#include <QEventLoop>
|
#include <QEventLoop>
|
||||||
|
#include <QRandomGenerator>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QRandomGenerator>
|
|
||||||
#include <QtTest>
|
#include <QtTest>
|
||||||
|
|
||||||
|
|
||||||
void AWTestLibrary::init()
|
void AWTestLibrary::init() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool AWTestLibrary::isKWinActive()
|
bool AWTestLibrary::isKWinActive()
|
||||||
|
@ -52,10 +52,12 @@ void TestBatterySource::test_battery()
|
|||||||
QSKIP("No battery found, test will be skipped");
|
QSKIP("No battery found, test will be skipped");
|
||||||
|
|
||||||
QStringList batteries = source->sources();
|
QStringList batteries = source->sources();
|
||||||
std::for_each(batteries.begin(), batteries.end(), [this](const QString bat) {
|
std::for_each(batteries.begin(), batteries.end(), [this](const QString &bat) {
|
||||||
QVariant value = source->data(bat);
|
QVariant value = source->data(bat);
|
||||||
if (bat == "battery/ac")
|
if (bat == "battery/ac")
|
||||||
QCOMPARE(value.type(), QVariant::Bool);
|
QCOMPARE(value.type(), QVariant::Bool);
|
||||||
|
else if (bat.startsWith("battery/batrate") || bat.startsWith("battery/batleft"))
|
||||||
|
;
|
||||||
else
|
else
|
||||||
QVERIFY((value.toFloat() >= battery.first) || (std::isnan(value.toFloat())));
|
QVERIFY((value.toFloat() >= battery.first) || (std::isnan(value.toFloat())));
|
||||||
});
|
});
|
||||||
|
@ -31,10 +31,9 @@ void TestExtScript::initTestCase()
|
|||||||
|
|
||||||
extScript = new ExtScript(nullptr);
|
extScript = new ExtScript(nullptr);
|
||||||
extScript->setInterval(1);
|
extScript->setInterval(1);
|
||||||
extScript->setExecutable(randomString);
|
extScript->setExecutable(QString("echo %1").arg(randomString));
|
||||||
extScript->setNumber(0);
|
extScript->setNumber(0);
|
||||||
extScript->setRedirect(ExtScript::Redirect::stderr2stdout);
|
extScript->setRedirect(ExtScript::Redirect::stderr2stdout);
|
||||||
extScript->setPrefix("echo");
|
|
||||||
|
|
||||||
extScript->run();
|
extScript->run();
|
||||||
}
|
}
|
||||||
@ -50,9 +49,8 @@ void TestExtScript::test_values()
|
|||||||
{
|
{
|
||||||
QCOMPARE(extScript->interval(), 1);
|
QCOMPARE(extScript->interval(), 1);
|
||||||
QCOMPARE(extScript->number(), 0);
|
QCOMPARE(extScript->number(), 0);
|
||||||
QCOMPARE(extScript->executable(), randomString);
|
QCOMPARE(extScript->executable(), QString("echo %1").arg(randomString));
|
||||||
QCOMPARE(extScript->strRedirect(), QString("stderr2stdout"));
|
QCOMPARE(extScript->strRedirect(), QString("stderr2stdout"));
|
||||||
QCOMPARE(extScript->prefix(), QString("echo"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -97,7 +95,6 @@ void TestExtScript::test_copy()
|
|||||||
QCOMPARE(newExtScript->interval(), extScript->interval());
|
QCOMPARE(newExtScript->interval(), extScript->interval());
|
||||||
QCOMPARE(newExtScript->executable(), extScript->executable());
|
QCOMPARE(newExtScript->executable(), extScript->executable());
|
||||||
QCOMPARE(newExtScript->strRedirect(), extScript->strRedirect());
|
QCOMPARE(newExtScript->strRedirect(), extScript->strRedirect());
|
||||||
QCOMPARE(newExtScript->prefix(), extScript->prefix());
|
|
||||||
QCOMPARE(newExtScript->filters(), extScript->filters());
|
QCOMPARE(newExtScript->filters(), extScript->filters());
|
||||||
QCOMPARE(newExtScript->number(), 1);
|
QCOMPARE(newExtScript->number(), 1);
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
#include "testfloatformatter.h"
|
#include "testfloatformatter.h"
|
||||||
|
|
||||||
#include <QtTest>
|
|
||||||
#include <QRandomGenerator>
|
#include <QRandomGenerator>
|
||||||
|
#include <QtTest>
|
||||||
|
|
||||||
#include "awfloatformatter.h"
|
#include "awfloatformatter.h"
|
||||||
#include "awtestlibrary.h"
|
#include "awtestlibrary.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user