mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +00:00
massive changes inside
* use pass by ref instead of by value if possible * use reference in interation over collections * fix no tag inserting
This commit is contained in:
parent
6e99e262d4
commit
6e62ceaac7
@ -55,9 +55,6 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_OPTIMIZATION "-Ofast -DNDEBUG")
|
||||
# linker flags
|
||||
# set(CMAKE_EXE_LINKER_FLAGS "-lc++abi")
|
||||
# set(CMAKE_MODULE_LINKER_FLAGS "-lc++abi")
|
||||
# set(CMAKE_SHARED_LINKER_FLAGS "-lc++abi")
|
||||
else ()
|
||||
message(FATAL_ERROR "Unknown compiler")
|
||||
endif ()
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
|
||||
AWAbstractSelector::AWAbstractSelector(QWidget *parent,
|
||||
const QPair<bool, bool> editable)
|
||||
const QPair<bool, bool> &editable)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::AWAbstractSelector)
|
||||
{
|
||||
@ -56,8 +56,9 @@ QPair<QString, QString> AWAbstractSelector::current() const
|
||||
}
|
||||
|
||||
|
||||
void AWAbstractSelector::init(const QStringList keys, const QStringList values,
|
||||
const QPair<QString, QString> current)
|
||||
void AWAbstractSelector::init(const QStringList &keys,
|
||||
const QStringList &values,
|
||||
const QPair<QString, QString> ¤t)
|
||||
{
|
||||
if ((!keys.contains(current.first)) || (!values.contains(current.second))) {
|
||||
qCWarning(LOG_AW) << "Invalid current value" << current
|
||||
|
@ -33,12 +33,12 @@ class AWAbstractSelector : public QWidget
|
||||
|
||||
public:
|
||||
explicit AWAbstractSelector(QWidget *parent = nullptr,
|
||||
const QPair<bool, bool> editable
|
||||
const QPair<bool, bool> &editable
|
||||
= {false, false});
|
||||
virtual ~AWAbstractSelector();
|
||||
QPair<QString, QString> current() const;
|
||||
void init(const QStringList keys, const QStringList values,
|
||||
const QPair<QString, QString> current);
|
||||
void init(const QStringList &keys, const QStringList &values,
|
||||
const QPair<QString, QString> ¤t);
|
||||
|
||||
signals:
|
||||
void selectionChanged();
|
||||
|
@ -57,7 +57,7 @@ void AWActions::checkUpdates(const bool showAnyway)
|
||||
}
|
||||
|
||||
|
||||
QString AWActions::getFileContent(const QString path) const
|
||||
QString AWActions::getFileContent(const QString &path) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Get content from file" << path;
|
||||
|
||||
@ -81,7 +81,7 @@ bool AWActions::isDebugEnabled() const
|
||||
}
|
||||
|
||||
|
||||
bool AWActions::runCmd(const QString cmd) const
|
||||
bool AWActions::runCmd(const QString &cmd) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Cmd" << cmd;
|
||||
|
||||
@ -114,7 +114,7 @@ void AWActions::showLegacyInfo() const
|
||||
|
||||
|
||||
// HACK: this method uses variables from version.h
|
||||
QString AWActions::getAboutText(const QString type) const
|
||||
QString AWActions::getAboutText(const QString &type) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Type" << type;
|
||||
|
||||
@ -122,7 +122,7 @@ QString AWActions::getAboutText(const QString type) const
|
||||
}
|
||||
|
||||
|
||||
QVariantMap AWActions::getFont(const QVariantMap defaultFont) const
|
||||
QVariantMap AWActions::getFont(const QVariantMap &defaultFont) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Default font is" << defaultFont;
|
||||
|
||||
@ -144,7 +144,7 @@ QVariantMap AWActions::getFont(const QVariantMap defaultFont) const
|
||||
|
||||
|
||||
// to avoid additional object definition this method is static
|
||||
void AWActions::sendNotification(const QString eventId, const QString message)
|
||||
void AWActions::sendNotification(const QString &eventId, const QString &message)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Event" << eventId << "with message" << message;
|
||||
|
||||
|
@ -33,19 +33,20 @@ public:
|
||||
explicit AWActions(QObject *parent = nullptr);
|
||||
virtual ~AWActions();
|
||||
Q_INVOKABLE void checkUpdates(const bool showAnyway = false);
|
||||
Q_INVOKABLE QString getFileContent(const QString path) const;
|
||||
Q_INVOKABLE QString getFileContent(const QString &path) const;
|
||||
Q_INVOKABLE bool isDebugEnabled() const;
|
||||
Q_INVOKABLE bool runCmd(const QString cmd = QString("/usr/bin/true")) const;
|
||||
Q_INVOKABLE bool runCmd(const QString &cmd
|
||||
= QString("/usr/bin/true")) const;
|
||||
Q_INVOKABLE void showLegacyInfo() const;
|
||||
Q_INVOKABLE void showReadme() const;
|
||||
// configuration slots
|
||||
Q_INVOKABLE QString getAboutText(const QString type
|
||||
Q_INVOKABLE QString getAboutText(const QString &type
|
||||
= QString("header")) const;
|
||||
Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont) const;
|
||||
Q_INVOKABLE QVariantMap getFont(const QVariantMap &defaultFont) const;
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE static void sendNotification(const QString eventId,
|
||||
const QString message);
|
||||
Q_INVOKABLE static void sendNotification(const QString &eventId,
|
||||
const QString &message);
|
||||
|
||||
private:
|
||||
AWUpdateHelper *m_updateHelper = nullptr;
|
||||
|
@ -46,15 +46,15 @@ AWBugReporter::~AWBugReporter()
|
||||
void AWBugReporter::doConnect()
|
||||
{
|
||||
// additional method for testing needs
|
||||
connect(this, SIGNAL(replyReceived(const int, const QString)), this,
|
||||
SLOT(showInformation(const int, const QString)));
|
||||
connect(this, SIGNAL(replyReceived(const int, const QString &)), this,
|
||||
SLOT(showInformation(const int, const QString &)));
|
||||
}
|
||||
|
||||
|
||||
QString AWBugReporter::generateText(const QString description,
|
||||
const QString reproduce,
|
||||
const QString expected,
|
||||
const QString logs) const
|
||||
QString AWBugReporter::generateText(const QString &description,
|
||||
const QString &reproduce,
|
||||
const QString &expected,
|
||||
const QString &logs) const
|
||||
{
|
||||
// do not log logs here, it may have quite large size
|
||||
qCDebug(LOG_AW) << "Generate text with description" << description
|
||||
@ -74,7 +74,7 @@ QString AWBugReporter::generateText(const QString description,
|
||||
}
|
||||
|
||||
|
||||
void AWBugReporter::sendBugReport(const QString title, const QString body)
|
||||
void AWBugReporter::sendBugReport(const QString &title, const QString &body)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Send bug report with title" << title << "and body"
|
||||
<< body;
|
||||
@ -126,7 +126,7 @@ void AWBugReporter::issueReplyRecieved(QNetworkReply *reply)
|
||||
}
|
||||
|
||||
|
||||
void AWBugReporter::showInformation(const int number, const QString url)
|
||||
void AWBugReporter::showInformation(const int number, const QString &url)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Created issue with number" << number << "and url"
|
||||
<< url;
|
||||
|
@ -33,18 +33,18 @@ public:
|
||||
explicit AWBugReporter(QObject *parent = nullptr);
|
||||
virtual ~AWBugReporter();
|
||||
Q_INVOKABLE void doConnect();
|
||||
Q_INVOKABLE QString generateText(const QString description,
|
||||
const QString reproduce,
|
||||
const QString expected,
|
||||
const QString logs) const;
|
||||
Q_INVOKABLE void sendBugReport(const QString title, const QString body);
|
||||
Q_INVOKABLE QString generateText(const QString &description,
|
||||
const QString &reproduce,
|
||||
const QString &expected,
|
||||
const QString &logs) const;
|
||||
Q_INVOKABLE void sendBugReport(const QString &title, const QString &body);
|
||||
|
||||
signals:
|
||||
void replyReceived(const int number, const QString url);
|
||||
void replyReceived(const int number, const QString &url);
|
||||
|
||||
private slots:
|
||||
void issueReplyRecieved(QNetworkReply *reply);
|
||||
void showInformation(const int number, const QString url);
|
||||
void showInformation(const int number, const QString &url);
|
||||
void userReplyOnBugReport(QAbstractButton *button);
|
||||
|
||||
private:
|
||||
|
@ -70,7 +70,7 @@ bool AWConfigHelper::dropCache() const
|
||||
|
||||
|
||||
bool AWConfigHelper::exportConfiguration(QObject *nativeConfig,
|
||||
const QString fileName) const
|
||||
const QString &fileName) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Selected filename" << fileName;
|
||||
|
||||
@ -79,7 +79,7 @@ bool AWConfigHelper::exportConfiguration(QObject *nativeConfig,
|
||||
const QQmlPropertyMap *configuration
|
||||
= static_cast<const QQmlPropertyMap *>(nativeConfig);
|
||||
settings.beginGroup(QString("plasmoid"));
|
||||
for (auto key : configuration->keys()) {
|
||||
for (auto &key : configuration->keys()) {
|
||||
QVariant value = configuration->value(key);
|
||||
if (!value.isValid())
|
||||
continue;
|
||||
@ -88,13 +88,13 @@ bool AWConfigHelper::exportConfiguration(QObject *nativeConfig,
|
||||
settings.endGroup();
|
||||
|
||||
// extensions
|
||||
for (auto item : m_dirs) {
|
||||
for (auto &item : m_dirs) {
|
||||
QStringList items
|
||||
= QDir(QString("%1/%2").arg(m_baseDir).arg(item))
|
||||
.entryList(QStringList() << QString("*.desktop"),
|
||||
QDir::Files);
|
||||
settings.beginGroup(item);
|
||||
for (auto it : items)
|
||||
for (auto &it : items)
|
||||
copyExtensions(it, item, settings, false);
|
||||
settings.endGroup();
|
||||
}
|
||||
@ -121,7 +121,7 @@ bool AWConfigHelper::exportConfiguration(QObject *nativeConfig,
|
||||
}
|
||||
|
||||
|
||||
QVariantMap AWConfigHelper::importConfiguration(const QString fileName,
|
||||
QVariantMap AWConfigHelper::importConfiguration(const QString &fileName,
|
||||
const bool importPlasmoid,
|
||||
const bool importExtensions,
|
||||
const bool importAdds) const
|
||||
@ -133,9 +133,9 @@ QVariantMap AWConfigHelper::importConfiguration(const QString fileName,
|
||||
|
||||
// extensions
|
||||
if (importExtensions) {
|
||||
for (auto item : m_dirs) {
|
||||
for (auto &item : m_dirs) {
|
||||
settings.beginGroup(item);
|
||||
for (auto it : settings.childGroups())
|
||||
for (auto &it : settings.childGroups())
|
||||
copyExtensions(it, item, settings, true);
|
||||
settings.endGroup();
|
||||
}
|
||||
@ -161,7 +161,7 @@ QVariantMap AWConfigHelper::importConfiguration(const QString fileName,
|
||||
// plasmoid configuration
|
||||
if (importPlasmoid) {
|
||||
settings.beginGroup(QString("plasmoid"));
|
||||
for (auto key : settings.childKeys())
|
||||
for (auto &key : settings.childKeys())
|
||||
configuration[key] = settings.value(key);
|
||||
settings.endGroup();
|
||||
}
|
||||
@ -207,7 +207,7 @@ QVariantMap AWConfigHelper::readDataEngineConfiguration() const
|
||||
|
||||
|
||||
bool AWConfigHelper::writeDataEngineConfiguration(
|
||||
const QVariantMap configuration) const
|
||||
const QVariantMap &configuration) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Configuration" << configuration;
|
||||
|
||||
@ -238,18 +238,18 @@ bool AWConfigHelper::writeDataEngineConfiguration(
|
||||
}
|
||||
|
||||
|
||||
void AWConfigHelper::copyConfigs(const QString localDir) const
|
||||
void AWConfigHelper::copyConfigs(const QString &localDir) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Local directory" << localDir;
|
||||
|
||||
QStringList dirs = QStandardPaths::locateAll(
|
||||
QStandardPaths::GenericDataLocation, QString("awesomewidgets/configs"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
for (auto dir : dirs) {
|
||||
for (auto &dir : dirs) {
|
||||
if (dir == localDir)
|
||||
continue;
|
||||
QStringList files = QDir(dir).entryList(QDir::Files);
|
||||
for (auto source : files) {
|
||||
for (auto &source : files) {
|
||||
QString destination = QString("%1/%2").arg(localDir).arg(source);
|
||||
bool status = QFile::copy(QString("%1/%2").arg(dir).arg(source),
|
||||
destination);
|
||||
@ -260,7 +260,7 @@ void AWConfigHelper::copyConfigs(const QString localDir) const
|
||||
}
|
||||
|
||||
|
||||
void AWConfigHelper::copyExtensions(const QString item, const QString type,
|
||||
void AWConfigHelper::copyExtensions(const QString &item, const QString &type,
|
||||
QSettings &settings,
|
||||
const bool inverse) const
|
||||
{
|
||||
@ -286,13 +286,13 @@ void AWConfigHelper::copyExtensions(const QString item, const QString type,
|
||||
|
||||
void AWConfigHelper::copySettings(QSettings &from, QSettings &to) const
|
||||
{
|
||||
for (auto key : from.childKeys())
|
||||
for (auto &key : from.childKeys())
|
||||
to.setValue(key, from.value(key));
|
||||
}
|
||||
|
||||
|
||||
void AWConfigHelper::readFile(QSettings &settings, const QString key,
|
||||
const QString fileName) const
|
||||
void AWConfigHelper::readFile(QSettings &settings, const QString &key,
|
||||
const QString &fileName) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Key" << key << "from file" << fileName;
|
||||
|
||||
@ -307,8 +307,8 @@ void AWConfigHelper::readFile(QSettings &settings, const QString key,
|
||||
}
|
||||
|
||||
|
||||
void AWConfigHelper::writeFile(QSettings &settings, const QString key,
|
||||
const QString fileName) const
|
||||
void AWConfigHelper::writeFile(QSettings &settings, const QString &key,
|
||||
const QString &fileName) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Key" << key << "to file" << fileName;
|
||||
|
||||
|
@ -36,26 +36,26 @@ public:
|
||||
Q_INVOKABLE QString configurationDirectory() const;
|
||||
Q_INVOKABLE bool dropCache() const;
|
||||
Q_INVOKABLE bool exportConfiguration(QObject *nativeConfig,
|
||||
const QString fileName) const;
|
||||
Q_INVOKABLE QVariantMap importConfiguration(const QString fileName,
|
||||
const QString &fileName) const;
|
||||
Q_INVOKABLE QVariantMap importConfiguration(const QString &fileName,
|
||||
const bool importPlasmoid,
|
||||
const bool importExtensions,
|
||||
const bool importAdds) const;
|
||||
// dataengine
|
||||
Q_INVOKABLE QVariantMap readDataEngineConfiguration() const;
|
||||
Q_INVOKABLE bool
|
||||
writeDataEngineConfiguration(const QVariantMap configuration) const;
|
||||
writeDataEngineConfiguration(const QVariantMap &configuration) const;
|
||||
|
||||
private:
|
||||
// methods
|
||||
void copyConfigs(const QString localDir) const;
|
||||
void copyExtensions(const QString item, const QString type,
|
||||
void copyConfigs(const QString &localDir) const;
|
||||
void copyExtensions(const QString &item, const QString &type,
|
||||
QSettings &settings, const bool inverse) const;
|
||||
void copySettings(QSettings &from, QSettings &to) const;
|
||||
void readFile(QSettings &settings, const QString key,
|
||||
const QString fileName) const;
|
||||
void writeFile(QSettings &settings, const QString key,
|
||||
const QString fileName) const;
|
||||
void readFile(QSettings &settings, const QString &key,
|
||||
const QString &fileName) const;
|
||||
void writeFile(QSettings &settings, const QString &key,
|
||||
const QString &fileName) const;
|
||||
// properties
|
||||
QString m_baseDir = QString("%1/awesomewidgets")
|
||||
.arg(QStandardPaths::writableLocation(
|
||||
|
@ -57,7 +57,7 @@ AWDataAggregator::~AWDataAggregator()
|
||||
}
|
||||
|
||||
|
||||
QList<float> AWDataAggregator::getData(const QString key) const
|
||||
QList<float> AWDataAggregator::getData(const QString &key) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Key" << key;
|
||||
|
||||
@ -78,7 +78,7 @@ QString AWDataAggregator::htmlImage(const QPixmap &source) const
|
||||
}
|
||||
|
||||
|
||||
void AWDataAggregator::setParameters(QVariantMap settings)
|
||||
void AWDataAggregator::setParameters(const QVariantMap &settings)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Settings" << settings;
|
||||
|
||||
@ -128,7 +128,7 @@ QPixmap AWDataAggregator::tooltipImage()
|
||||
m_toolTipScene->clear();
|
||||
QPen pen;
|
||||
bool down = false;
|
||||
for (auto key : requiredKeys) {
|
||||
for (auto &key : requiredKeys) {
|
||||
// create frame
|
||||
float normX = 100.0f / static_cast<float>(m_values[key].count());
|
||||
float normY = 100.0f / (1.5f * m_boundaries[key]);
|
||||
@ -174,7 +174,7 @@ void AWDataAggregator::dataUpdate(const QVariantHash &values)
|
||||
}
|
||||
|
||||
|
||||
void AWDataAggregator::checkValue(const QString source, const float value,
|
||||
void AWDataAggregator::checkValue(const QString &source, const float value,
|
||||
const float extremum) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Notification source" << source << "with value" << value
|
||||
@ -194,8 +194,8 @@ void AWDataAggregator::checkValue(const QString source, const float value,
|
||||
}
|
||||
|
||||
|
||||
void AWDataAggregator::checkValue(const QString source, const QString current,
|
||||
const QString received) const
|
||||
void AWDataAggregator::checkValue(const QString &source, const QString ¤t,
|
||||
const QString &received) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Notification source" << source << "with current value"
|
||||
<< current << "and received one" << received;
|
||||
@ -218,7 +218,7 @@ void AWDataAggregator::initScene()
|
||||
}
|
||||
|
||||
|
||||
QString AWDataAggregator::notificationText(const QString source,
|
||||
QString AWDataAggregator::notificationText(const QString &source,
|
||||
const float value) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Notification source" << source << "with value" << value;
|
||||
@ -239,8 +239,8 @@ QString AWDataAggregator::notificationText(const QString source,
|
||||
}
|
||||
|
||||
|
||||
QString AWDataAggregator::notificationText(const QString source,
|
||||
const QString value) const
|
||||
QString AWDataAggregator::notificationText(const QString &source,
|
||||
const QString &value) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Notification source" << source << "with value" << value;
|
||||
|
||||
|
@ -35,14 +35,14 @@ class AWDataAggregator : public QObject
|
||||
public:
|
||||
explicit AWDataAggregator(QObject *parent = nullptr);
|
||||
virtual ~AWDataAggregator();
|
||||
QList<float> getData(const QString key) const;
|
||||
QList<float> getData(const QString &key) const;
|
||||
QString htmlImage(const QPixmap &source) const;
|
||||
void setParameters(QVariantMap settings);
|
||||
void setParameters(const QVariantMap &settings);
|
||||
QPixmap tooltipImage();
|
||||
|
||||
signals:
|
||||
void updateData(const QVariantHash &values);
|
||||
void toolTipPainted(const QString image) const;
|
||||
void toolTipPainted(const QString &image) const;
|
||||
|
||||
private slots:
|
||||
void dataUpdate(const QVariantHash &values);
|
||||
@ -51,13 +51,13 @@ private:
|
||||
// ui
|
||||
QGraphicsScene *m_toolTipScene = nullptr;
|
||||
QGraphicsView *m_toolTipView = nullptr;
|
||||
void checkValue(const QString source, const float value,
|
||||
void checkValue(const QString &source, const float value,
|
||||
const float extremum) const;
|
||||
void checkValue(const QString source, const QString current,
|
||||
const QString received) const;
|
||||
void checkValue(const QString &source, const QString ¤t,
|
||||
const QString &received) const;
|
||||
void initScene();
|
||||
QString notificationText(const QString source, const float value) const;
|
||||
QString notificationText(const QString source, const QString value) const;
|
||||
QString notificationText(const QString &source, const float value) const;
|
||||
QString notificationText(const QString &source, const QString &value) const;
|
||||
// main method
|
||||
void setData(const QVariantHash &values);
|
||||
void setData(const QString &source, float value,
|
||||
|
@ -52,8 +52,8 @@ void AWDataEngineAggregator::clear()
|
||||
|
||||
void AWDataEngineAggregator::disconnectSources()
|
||||
{
|
||||
for (auto dataengine : m_dataEngines.values())
|
||||
for (auto source : dataengine->sources())
|
||||
for (auto &dataengine : m_dataEngines.values())
|
||||
for (auto &source : dataengine->sources())
|
||||
dataengine->disconnectSource(source, parent());
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ void AWDataEngineAggregator::initDataEngines(const int interval)
|
||||
}
|
||||
|
||||
|
||||
void AWDataEngineAggregator::dropSource(const QString source)
|
||||
void AWDataEngineAggregator::dropSource(const QString &source)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Source" << source;
|
||||
|
||||
@ -114,7 +114,7 @@ void AWDataEngineAggregator::createQueuedConnection()
|
||||
{
|
||||
// HACK additional method which forces QueuedConnection instead of Auto one
|
||||
// for more details refer to plasma-framework source code
|
||||
for (auto dataEngine : m_dataEngines.keys()) {
|
||||
for (auto &dataEngine : m_dataEngines.keys()) {
|
||||
// different source set for different engines
|
||||
QStringList sources;
|
||||
if (dataEngine == QString("time"))
|
||||
@ -122,7 +122,7 @@ void AWDataEngineAggregator::createQueuedConnection()
|
||||
else
|
||||
sources = m_dataEngines[dataEngine]->sources();
|
||||
// reconnect sources
|
||||
for (auto source : sources) {
|
||||
for (auto &source : sources) {
|
||||
Plasma::DataContainer *container
|
||||
= m_dataEngines[dataEngine]->containerForSource(source);
|
||||
// disconnect old connections first
|
||||
|
@ -40,7 +40,7 @@ signals:
|
||||
void deviceAdded(const QString &source);
|
||||
|
||||
public slots:
|
||||
void dropSource(const QString source);
|
||||
void dropSource(const QString &source);
|
||||
void reconnectSources(const int interval);
|
||||
|
||||
private:
|
||||
|
@ -35,19 +35,19 @@ AWDBusAdaptor::~AWDBusAdaptor()
|
||||
}
|
||||
|
||||
|
||||
QString AWDBusAdaptor::Info(const QString key) const
|
||||
QString AWDBusAdaptor::Info(const QString &key) const
|
||||
{
|
||||
return m_plugin->infoByKey(key);
|
||||
}
|
||||
|
||||
|
||||
QStringList AWDBusAdaptor::Keys(const QString regexp) const
|
||||
QStringList AWDBusAdaptor::Keys(const QString ®exp) const
|
||||
{
|
||||
return m_plugin->dictKeys(true, regexp);
|
||||
}
|
||||
|
||||
|
||||
QString AWDBusAdaptor::Value(const QString key) const
|
||||
QString AWDBusAdaptor::Value(const QString &key) const
|
||||
{
|
||||
return m_plugin->valueByKey(key);
|
||||
}
|
||||
@ -59,7 +59,7 @@ qlonglong AWDBusAdaptor::WhoAmI() const
|
||||
}
|
||||
|
||||
|
||||
void AWDBusAdaptor::SetLogLevel(const QString what, const int level)
|
||||
void AWDBusAdaptor::SetLogLevel(const QString &what, const int level)
|
||||
{
|
||||
qCDebug(LOG_DBUS) << "Set log level" << level << "for" << what;
|
||||
|
||||
@ -69,12 +69,12 @@ void AWDBusAdaptor::SetLogLevel(const QString what, const int level)
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto lev : m_logLevels)
|
||||
for (auto &lev : m_logLevels)
|
||||
SetLogLevel(what, lev, m_logLevels.indexOf(lev) >= level);
|
||||
}
|
||||
|
||||
|
||||
void AWDBusAdaptor::SetLogLevel(const QString what, const QString level,
|
||||
void AWDBusAdaptor::SetLogLevel(const QString &what, const QString &level,
|
||||
const bool enabled)
|
||||
{
|
||||
qCDebug(LOG_DBUS) << "Set log level" << level << "enabled" << enabled
|
||||
|
@ -37,13 +37,13 @@ public:
|
||||
|
||||
public slots:
|
||||
// get methods
|
||||
QString Info(const QString key) const;
|
||||
QStringList Keys(const QString regexp) const;
|
||||
QString Value(const QString key) const;
|
||||
QString Info(const QString &key) const;
|
||||
QStringList Keys(const QString ®exp) const;
|
||||
QString Value(const QString &key) const;
|
||||
qlonglong WhoAmI() const;
|
||||
// set methods
|
||||
void SetLogLevel(const QString what, const int level);
|
||||
void SetLogLevel(const QString what, const QString level,
|
||||
void SetLogLevel(const QString &what, const int level);
|
||||
void SetLogLevel(const QString &what, const QString &level,
|
||||
const bool enabled);
|
||||
|
||||
private:
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "awformatterhelper.h"
|
||||
|
||||
|
||||
AWFormatterConfig::AWFormatterConfig(QWidget *parent, const QStringList keys)
|
||||
AWFormatterConfig::AWFormatterConfig(QWidget *parent, const QStringList &keys)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::AWFormatterConfig)
|
||||
, m_keys(keys)
|
||||
@ -114,7 +114,7 @@ void AWFormatterConfig::addSelector(const QStringList &keys,
|
||||
|
||||
void AWFormatterConfig::clearSelectors()
|
||||
{
|
||||
for (auto selector : m_selectors) {
|
||||
for (auto &selector : m_selectors) {
|
||||
disconnect(selector, SIGNAL(selectionChanged()), this,
|
||||
SLOT(updateUi()));
|
||||
ui->verticalLayout->removeWidget(selector);
|
||||
@ -128,7 +128,7 @@ void AWFormatterConfig::execDialog()
|
||||
{
|
||||
int ret = exec();
|
||||
QHash<QString, QString> data;
|
||||
for (auto selector : m_selectors) {
|
||||
for (auto &selector : m_selectors) {
|
||||
QPair<QString, QString> select = selector->current();
|
||||
if (select.first.isEmpty())
|
||||
continue;
|
||||
@ -175,7 +175,7 @@ void AWFormatterConfig::updateDialog()
|
||||
QHash<QString, QString> appliedFormatters = m_helper->getFormatters();
|
||||
auto keys = initKeys();
|
||||
|
||||
for (auto key : appliedFormatters.keys())
|
||||
for (auto &key : appliedFormatters.keys())
|
||||
addSelector(keys.first, keys.second,
|
||||
QPair<QString, QString>(key, appliedFormatters[key]));
|
||||
// empty one
|
||||
|
@ -35,7 +35,7 @@ class AWFormatterConfig : public QDialog
|
||||
|
||||
public:
|
||||
explicit AWFormatterConfig(QWidget *parent = nullptr,
|
||||
const QStringList keys = QStringList());
|
||||
const QStringList &keys = QStringList());
|
||||
virtual ~AWFormatterConfig();
|
||||
Q_INVOKABLE void showDialog();
|
||||
|
||||
|
@ -34,7 +34,7 @@ AWFormatterConfigFactory::~AWFormatterConfigFactory()
|
||||
}
|
||||
|
||||
|
||||
void AWFormatterConfigFactory::showDialog(const QStringList keys)
|
||||
void AWFormatterConfigFactory::showDialog(const QStringList &keys)
|
||||
{
|
||||
AWFormatterConfig *config = new AWFormatterConfig(nullptr, keys);
|
||||
config->showDialog();
|
||||
|
@ -29,7 +29,7 @@ class AWFormatterConfigFactory : public QObject
|
||||
public:
|
||||
explicit AWFormatterConfigFactory(QObject *parent = nullptr);
|
||||
virtual ~AWFormatterConfigFactory();
|
||||
Q_INVOKABLE void showDialog(const QStringList keys);
|
||||
Q_INVOKABLE void showDialog(const QStringList &keys);
|
||||
|
||||
private:
|
||||
};
|
||||
|
@ -71,7 +71,7 @@ QStringList AWFormatterHelper::definedFormatters() const
|
||||
QHash<QString, QString> AWFormatterHelper::getFormatters() const
|
||||
{
|
||||
QHash<QString, QString> map;
|
||||
for (auto tag : m_formatters.keys())
|
||||
for (auto &tag : m_formatters.keys())
|
||||
map[tag] = m_formatters[tag]->name();
|
||||
|
||||
return map;
|
||||
@ -81,7 +81,7 @@ QHash<QString, QString> AWFormatterHelper::getFormatters() const
|
||||
QList<AbstractExtItem *> AWFormatterHelper::items() const
|
||||
{
|
||||
QList<AbstractExtItem *> converted;
|
||||
for (auto item : m_formattersClasses.values())
|
||||
for (auto &item : m_formattersClasses.values())
|
||||
converted.append(item);
|
||||
|
||||
return converted;
|
||||
@ -94,7 +94,7 @@ QStringList AWFormatterHelper::knownFormatters() const
|
||||
}
|
||||
|
||||
|
||||
bool AWFormatterHelper::removeUnusedFormatters(const QStringList keys) const
|
||||
bool AWFormatterHelper::removeUnusedFormatters(const QStringList &keys) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Remove formatters" << keys;
|
||||
|
||||
@ -107,7 +107,7 @@ bool AWFormatterHelper::removeUnusedFormatters(const QStringList keys) const
|
||||
|
||||
settings.beginGroup(QString("Formatters"));
|
||||
QStringList foundKeys = settings.childKeys();
|
||||
for (auto key : foundKeys) {
|
||||
for (auto &key : foundKeys) {
|
||||
if (keys.contains(key))
|
||||
continue;
|
||||
settings.remove(key);
|
||||
@ -121,7 +121,7 @@ bool AWFormatterHelper::removeUnusedFormatters(const QStringList keys) const
|
||||
|
||||
|
||||
bool AWFormatterHelper::writeFormatters(
|
||||
const QHash<QString, QString> configuration) const
|
||||
const QHash<QString, QString> &configuration) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Write configuration" << configuration;
|
||||
|
||||
@ -133,7 +133,7 @@ bool AWFormatterHelper::writeFormatters(
|
||||
qCInfo(LOG_AW) << "Configuration file" << fileName;
|
||||
|
||||
settings.beginGroup(QString("Formatters"));
|
||||
for (auto key : configuration.keys())
|
||||
for (auto &key : configuration.keys())
|
||||
settings.setValue(key, configuration[key]);
|
||||
settings.endGroup();
|
||||
|
||||
@ -152,7 +152,7 @@ void AWFormatterHelper::editItems()
|
||||
|
||||
|
||||
AWAbstractFormatter::FormatterClass
|
||||
AWFormatterHelper::defineFormatterClass(const QString stringType) const
|
||||
AWFormatterHelper::defineFormatterClass(const QString &stringType) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Define formatter class for" << stringType;
|
||||
|
||||
@ -186,7 +186,7 @@ void AWFormatterHelper::initFormatters()
|
||||
for (int i = m_directories.count() - 1; i >= 0; i--) {
|
||||
QStringList files
|
||||
= QDir(m_directories.at(i)).entryList(QDir::Files, QDir::Name);
|
||||
for (auto file : files) {
|
||||
for (auto &file : files) {
|
||||
if (!file.endsWith(QString(".desktop")))
|
||||
continue;
|
||||
qCInfo(LOG_AW) << "Found file" << file << "in"
|
||||
@ -238,13 +238,13 @@ void AWFormatterHelper::initKeys()
|
||||
QStringList configs = QStandardPaths::locateAll(
|
||||
QStandardPaths::GenericDataLocation, m_filePath);
|
||||
|
||||
for (auto fileName : configs) {
|
||||
for (auto &fileName : configs) {
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
qCInfo(LOG_AW) << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Formatters"));
|
||||
QStringList keys = settings.childKeys();
|
||||
for (auto key : keys) {
|
||||
for (auto &key : keys) {
|
||||
QString name = settings.value(key).toString();
|
||||
qCInfo(LOG_AW) << "Found formatter" << name << "for key" << key
|
||||
<< "in" << settings.fileName();
|
||||
@ -281,7 +281,7 @@ void AWFormatterHelper::installDirectories()
|
||||
|
||||
|
||||
QPair<QString, AWAbstractFormatter::FormatterClass>
|
||||
AWFormatterHelper::readMetadata(const QString filePath) const
|
||||
AWFormatterHelper::readMetadata(const QString &filePath) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Read initial parameters from" << filePath;
|
||||
|
||||
|
@ -38,8 +38,8 @@ public:
|
||||
QHash<QString, QString> getFormatters() const;
|
||||
QList<AbstractExtItem *> items() const;
|
||||
QStringList knownFormatters() const;
|
||||
bool removeUnusedFormatters(const QStringList keys) const;
|
||||
bool writeFormatters(const QHash<QString, QString> configuration) const;
|
||||
bool removeUnusedFormatters(const QStringList &keys) const;
|
||||
bool writeFormatters(const QHash<QString, QString> &configuration) const;
|
||||
|
||||
public slots:
|
||||
void editItems();
|
||||
@ -47,12 +47,12 @@ public slots:
|
||||
private:
|
||||
// methods
|
||||
AWAbstractFormatter::FormatterClass
|
||||
defineFormatterClass(const QString stringType) const;
|
||||
defineFormatterClass(const QString &stringType) const;
|
||||
void initFormatters();
|
||||
void initKeys();
|
||||
void installDirectories();
|
||||
QPair<QString, AWAbstractFormatter::FormatterClass>
|
||||
readMetadata(const QString filePath) const;
|
||||
readMetadata(const QString &filePath) const;
|
||||
// parent methods
|
||||
void doCreateItem();
|
||||
void initItems();
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
bool AWKeyCache::addKeyToCache(const QString type, const QString key)
|
||||
bool AWKeyCache::addKeyToCache(const QString &type, const QString &key)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Key" << key << "with type" << type;
|
||||
|
||||
@ -38,7 +38,7 @@ bool AWKeyCache::addKeyToCache(const QString type, const QString key)
|
||||
|
||||
cache.beginGroup(type);
|
||||
QStringList cachedValues;
|
||||
for (auto number : cache.allKeys())
|
||||
for (auto &number : cache.allKeys())
|
||||
cachedValues.append(cache.value(number).toString());
|
||||
|
||||
if (type == QString("hdd")) {
|
||||
@ -46,7 +46,7 @@ bool AWKeyCache::addKeyToCache(const QString type, const QString key)
|
||||
= QDir(QString("/dev")).entryList(QDir::System, QDir::Name);
|
||||
QStringList devices
|
||||
= allDevices.filter(QRegExp(QString("^[hms]d[a-z]$")));
|
||||
for (auto dev : devices) {
|
||||
for (auto &dev : devices) {
|
||||
QString device = QString("/dev/%1").arg(dev);
|
||||
if (cachedValues.contains(device))
|
||||
continue;
|
||||
@ -59,7 +59,7 @@ bool AWKeyCache::addKeyToCache(const QString type, const QString key)
|
||||
} else if (type == QString("net")) {
|
||||
QList<QNetworkInterface> rawInterfaceList
|
||||
= QNetworkInterface::allInterfaces();
|
||||
for (auto interface : rawInterfaceList) {
|
||||
for (auto &interface : rawInterfaceList) {
|
||||
QString device = interface.name();
|
||||
if (cachedValues.contains(device))
|
||||
continue;
|
||||
@ -95,7 +95,7 @@ QStringList AWKeyCache::getRequiredKeys(const QStringList &keys,
|
||||
QSet<QString> used = QSet<QString>::fromList(keys);
|
||||
used.unite(QSet<QString>::fromList(bars));
|
||||
// insert keys from tooltip
|
||||
for (auto key : tooltip.keys()) {
|
||||
for (auto &key : tooltip.keys()) {
|
||||
if ((key.endsWith(QString("Tooltip"))) && (tooltip[key].toBool())) {
|
||||
key.remove(QString("Tooltip"));
|
||||
used << key;
|
||||
@ -104,7 +104,7 @@ QStringList AWKeyCache::getRequiredKeys(const QStringList &keys,
|
||||
|
||||
// insert depending keys, refer to AWKeys::calculateValues()
|
||||
// hddtotmb*
|
||||
for (auto key : allKeys.filter(QRegExp(QString("^hddtotmb")))) {
|
||||
for (auto &key : allKeys.filter(QRegExp(QString("^hddtotmb")))) {
|
||||
if (!used.contains(key))
|
||||
continue;
|
||||
key.remove(QString("hddtotmb"));
|
||||
@ -113,7 +113,7 @@ QStringList AWKeyCache::getRequiredKeys(const QStringList &keys,
|
||||
<< QString("hddmb%1").arg(index);
|
||||
}
|
||||
// hddtotgb*
|
||||
for (auto key : allKeys.filter(QRegExp(QString("^hddtotgb")))) {
|
||||
for (auto &key : allKeys.filter(QRegExp(QString("^hddtotgb")))) {
|
||||
if (!used.contains(key))
|
||||
continue;
|
||||
key.remove(QString("hddtotgb"));
|
||||
@ -146,12 +146,12 @@ QStringList AWKeyCache::getRequiredKeys(const QStringList &keys,
|
||||
<< QString("upunits") << QString("down")
|
||||
<< QString("downkb") << QString("downtotal")
|
||||
<< QString("downtotalkb") << QString("downunits"));
|
||||
for (auto key : netKeys) {
|
||||
for (auto &key : netKeys) {
|
||||
if (!used.contains(key))
|
||||
continue;
|
||||
QStringList filt
|
||||
= allKeys.filter(QRegExp(QString("^%1[0-9]{1,}").arg(key)));
|
||||
for (auto filtered : filt)
|
||||
for (auto &filtered : filt)
|
||||
used << filtered;
|
||||
}
|
||||
// netdev key
|
||||
@ -177,9 +177,9 @@ QHash<QString, QStringList> AWKeyCache::loadKeysFromCache()
|
||||
QSettings cache(fileName, QSettings::IniFormat);
|
||||
|
||||
QHash<QString, QStringList> devices;
|
||||
for (auto group : cache.childGroups()) {
|
||||
for (auto &group : cache.childGroups()) {
|
||||
cache.beginGroup(group);
|
||||
for (auto key : cache.allKeys())
|
||||
for (auto &key : cache.allKeys())
|
||||
devices[group].append(cache.value(key).toString());
|
||||
cache.endGroup();
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
namespace AWKeyCache
|
||||
{
|
||||
bool addKeyToCache(const QString type, const QString key = QString(""));
|
||||
bool addKeyToCache(const QString &type, const QString &key = QString(""));
|
||||
QStringList getRequiredKeys(const QStringList &keys, const QStringList &bars,
|
||||
const QVariantMap &tooltip,
|
||||
const QStringList &allKeys);
|
||||
|
@ -55,7 +55,7 @@ AWKeyOperations::~AWKeyOperations()
|
||||
}
|
||||
|
||||
|
||||
QStringList AWKeyOperations::devices(const QString type) const
|
||||
QStringList AWKeyOperations::devices(const QString &type) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Looking for type" << type;
|
||||
|
||||
@ -81,7 +81,7 @@ QStringList AWKeyOperations::dictKeys() const
|
||||
{
|
||||
QStringList allKeys;
|
||||
// weather
|
||||
for (auto item : m_extWeather->activeItems()) {
|
||||
for (auto &item : m_extWeather->activeItems()) {
|
||||
allKeys.append(item->tag(QString("weatherId")));
|
||||
allKeys.append(item->tag(QString("weather")));
|
||||
allKeys.append(item->tag(QString("humidity")));
|
||||
@ -136,10 +136,10 @@ QStringList AWKeyOperations::dictKeys() const
|
||||
for (int i = 0; i < allBatteryDevices.count(); i++)
|
||||
allKeys.append(QString("bat%1").arg(i));
|
||||
// package manager
|
||||
for (auto item : m_extUpgrade->activeItems())
|
||||
for (auto &item : m_extUpgrade->activeItems())
|
||||
allKeys.append(item->tag(QString("pkgcount")));
|
||||
// quotes
|
||||
for (auto item : m_extQuotes->activeItems()) {
|
||||
for (auto &item : m_extQuotes->activeItems()) {
|
||||
allKeys.append(item->tag(QString("ask")));
|
||||
allKeys.append(item->tag(QString("askchg")));
|
||||
allKeys.append(item->tag(QString("percaskchg")));
|
||||
@ -151,13 +151,13 @@ QStringList AWKeyOperations::dictKeys() const
|
||||
allKeys.append(item->tag(QString("percpricechg")));
|
||||
}
|
||||
// custom
|
||||
for (auto item : m_extScripts->activeItems())
|
||||
for (auto &item : m_extScripts->activeItems())
|
||||
allKeys.append(item->tag(QString("custom")));
|
||||
// network requests
|
||||
for (auto item : m_extNetRequest->activeItems())
|
||||
for (auto &item : m_extNetRequest->activeItems())
|
||||
allKeys.append(item->tag(QString("response")));
|
||||
// bars
|
||||
for (auto item : m_graphicalItems->activeItems())
|
||||
for (auto &item : m_graphicalItems->activeItems())
|
||||
allKeys.append(item->tag(QString("bar")));
|
||||
// static keys
|
||||
allKeys.append(QString(STATIC_KEYS).split(QChar(',')));
|
||||
@ -172,7 +172,7 @@ QStringList AWKeyOperations::dictKeys() const
|
||||
|
||||
// this method is required to provide GraphicalItem functions (e.g. paint()) to
|
||||
// parent classes
|
||||
GraphicalItem *AWKeyOperations::giByKey(const QString key) const
|
||||
GraphicalItem *AWKeyOperations::giByKey(const QString &key) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Looking for item" << key;
|
||||
|
||||
@ -180,7 +180,7 @@ GraphicalItem *AWKeyOperations::giByKey(const QString key) const
|
||||
}
|
||||
|
||||
|
||||
QString AWKeyOperations::infoByKey(QString key) const
|
||||
QString AWKeyOperations::infoByKey(const QString &key) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Requested key" << key;
|
||||
|
||||
@ -197,22 +197,22 @@ QString AWKeyOperations::infoByKey(QString key) const
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
} else if (key.contains(QRegExp(QString("^hdd[rw]")))) {
|
||||
output = m_devices[QString("disk")]
|
||||
[key.remove(QRegExp(QString("hdd[rw]"))).toInt()];
|
||||
QString index = key;
|
||||
index.remove(QRegExp("hdd[rw]"));
|
||||
output = m_devices["disk"][index.toInt()];
|
||||
} else if (key.contains(QRegExp(
|
||||
QString("^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)")))) {
|
||||
output
|
||||
= m_devices[QString("mount")]
|
||||
[key
|
||||
.remove(QRegExp(QString(
|
||||
"^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)")))
|
||||
.toInt()];
|
||||
QString index = key;
|
||||
index.remove(QRegExp("^hdd(|mb|gb|freemb|freegb|totmb|totgb)"));
|
||||
output = m_devices[QString("mount")][index.toInt()];
|
||||
} else if (key.startsWith(QString("hddtemp"))) {
|
||||
output
|
||||
= m_devices[QString("hdd")][key.remove(QString("hddtemp")).toInt()];
|
||||
QString index = key;
|
||||
index.remove("hddtemp");
|
||||
output = m_devices[QString("hdd")][index.toInt()];
|
||||
} else if (key.contains(QRegExp(QString("^(down|up)[0-9]")))) {
|
||||
output = m_devices[QString("net")]
|
||||
[key.remove(QRegExp(QString("^(down|up)"))).toInt()];
|
||||
QString index = key;
|
||||
index.remove(QRegExp("^(down|up)"));
|
||||
output = m_devices[QString("net")][index.toInt()];
|
||||
} else if (key.startsWith(QString("pkgcount"))) {
|
||||
AbstractExtItem *item = m_extUpgrade->itemByTag(key, stripped);
|
||||
if (item)
|
||||
@ -228,8 +228,9 @@ QString AWKeyOperations::infoByKey(QString key) const
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
} else if (key.startsWith(QString("temp"))) {
|
||||
output
|
||||
= m_devices[QString("temp")][key.remove(QString("temp")).toInt()];
|
||||
QString index = key;
|
||||
index.remove("temp");
|
||||
output = m_devices[QString("temp")][index.toInt()];
|
||||
} else if (key.startsWith(QString("response"))) {
|
||||
AbstractExtItem *item = m_extNetRequest->itemByTag(key, stripped);
|
||||
if (item)
|
||||
@ -248,7 +249,7 @@ QString AWKeyOperations::pattern() const
|
||||
}
|
||||
|
||||
|
||||
void AWKeyOperations::setPattern(const QString currentPattern)
|
||||
void AWKeyOperations::setPattern(const QString ¤tPattern)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Set pattern" << currentPattern;
|
||||
|
||||
@ -256,7 +257,7 @@ void AWKeyOperations::setPattern(const QString currentPattern)
|
||||
}
|
||||
|
||||
|
||||
void AWKeyOperations::editItem(const QString type)
|
||||
void AWKeyOperations::editItem(const QString &type)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Item type" << type;
|
||||
|
||||
@ -302,7 +303,7 @@ void AWKeyOperations::addDevice(const QString &source)
|
||||
}
|
||||
|
||||
|
||||
void AWKeyOperations::addKeyToCache(const QString type, const QString key)
|
||||
void AWKeyOperations::addKeyToCache(const QString &type, const QString &key)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Key" << key << "with type" << type;
|
||||
|
||||
|
@ -46,28 +46,28 @@ class AWKeyOperations : public QObject
|
||||
public:
|
||||
explicit AWKeyOperations(QObject *parent = nullptr);
|
||||
virtual ~AWKeyOperations();
|
||||
QStringList devices(const QString type) const;
|
||||
QStringList devices(const QString &type) const;
|
||||
QHash<QString, QStringList> devices() const;
|
||||
void updateCache();
|
||||
// keys
|
||||
QStringList dictKeys() const;
|
||||
GraphicalItem *giByKey(const QString key) const;
|
||||
GraphicalItem *giByKey(const QString &key) const;
|
||||
// values
|
||||
QString infoByKey(QString key) const;
|
||||
QString infoByKey(const QString &key) const;
|
||||
QString pattern() const;
|
||||
void setPattern(const QString currentPattern);
|
||||
void setPattern(const QString ¤tPattern);
|
||||
// configuration
|
||||
void editItem(const QString type);
|
||||
void editItem(const QString &type);
|
||||
|
||||
signals:
|
||||
void updateKeys(const QStringList currentKeys);
|
||||
void updateKeys(const QStringList ¤tKeys);
|
||||
|
||||
public slots:
|
||||
void addDevice(const QString &source);
|
||||
|
||||
private:
|
||||
// methods
|
||||
void addKeyToCache(const QString type, const QString key = QString(""));
|
||||
void addKeyToCache(const QString &type, const QString &key = QString(""));
|
||||
void reinitKeys();
|
||||
// objects
|
||||
ExtItemAggregator<GraphicalItem> *m_graphicalItems = nullptr;
|
||||
|
@ -97,7 +97,7 @@ bool AWKeys::isDBusActive() const
|
||||
}
|
||||
|
||||
|
||||
void AWKeys::initDataAggregator(const QVariantMap tooltipParams)
|
||||
void AWKeys::initDataAggregator(const QVariantMap &tooltipParams)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Tooltip parameters" << tooltipParams;
|
||||
|
||||
@ -107,7 +107,7 @@ void AWKeys::initDataAggregator(const QVariantMap tooltipParams)
|
||||
}
|
||||
|
||||
|
||||
void AWKeys::initKeys(const QString currentPattern, const int interval,
|
||||
void AWKeys::initKeys(const QString ¤tPattern, const int interval,
|
||||
const int limit, const bool optimize)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Pattern" << currentPattern << "with interval"
|
||||
@ -131,7 +131,7 @@ void AWKeys::initKeys(const QString currentPattern, const int interval,
|
||||
}
|
||||
|
||||
|
||||
void AWKeys::setAggregatorProperty(const QString key, const QVariant value)
|
||||
void AWKeys::setAggregatorProperty(const QString &key, const QVariant &value)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Key" << key << "with value" << value;
|
||||
|
||||
@ -153,7 +153,7 @@ void AWKeys::updateCache()
|
||||
}
|
||||
|
||||
|
||||
QStringList AWKeys::dictKeys(const bool sorted, const QString regexp) const
|
||||
QStringList AWKeys::dictKeys(const bool sorted, const QString ®exp) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Should be sorted" << sorted << "and filter applied"
|
||||
<< regexp;
|
||||
@ -180,7 +180,7 @@ QVariantList AWKeys::getHddDevices() const
|
||||
|
||||
// build model
|
||||
QVariantList devices;
|
||||
for (auto device : hddDevices) {
|
||||
for (auto &device : hddDevices) {
|
||||
QVariantMap model;
|
||||
model[QString("label")] = device;
|
||||
model[QString("name")] = device;
|
||||
@ -191,7 +191,7 @@ QVariantList AWKeys::getHddDevices() const
|
||||
}
|
||||
|
||||
|
||||
QString AWKeys::infoByKey(QString key) const
|
||||
QString AWKeys::infoByKey(const QString &key) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Requested info for key" << key;
|
||||
|
||||
@ -200,7 +200,7 @@ QString AWKeys::infoByKey(QString key) const
|
||||
|
||||
|
||||
// HACK this method requires to define tag value from bar from UI interface
|
||||
QString AWKeys::valueByKey(QString key) const
|
||||
QString AWKeys::valueByKey(const QString &key) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Requested value for key" << key;
|
||||
|
||||
@ -211,7 +211,7 @@ QString AWKeys::valueByKey(QString key) const
|
||||
}
|
||||
|
||||
|
||||
void AWKeys::editItem(const QString type)
|
||||
void AWKeys::editItem(const QString &type)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Item type" << type;
|
||||
|
||||
@ -228,7 +228,7 @@ void AWKeys::dataUpdated(const QString &sourceName,
|
||||
}
|
||||
|
||||
|
||||
void AWKeys::reinitKeys(const QStringList currentKeys)
|
||||
void AWKeys::reinitKeys(const QStringList ¤tKeys)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Update found keys by using list" << currentKeys;
|
||||
|
||||
@ -240,7 +240,7 @@ void AWKeys::reinitKeys(const QStringList currentKeys)
|
||||
m_foundLambdas = AWPatternFunctions::findLambdas(m_keyOperator->pattern());
|
||||
// generate list of required keys for bars
|
||||
QStringList barKeys;
|
||||
for (auto bar : m_foundBars) {
|
||||
for (auto &bar : m_foundBars) {
|
||||
GraphicalItem *item = m_keyOperator->giByKey(bar);
|
||||
if (item->isCustom())
|
||||
item->setUsedKeys(
|
||||
@ -279,7 +279,7 @@ void AWKeys::calculateValues()
|
||||
{
|
||||
// hddtot*
|
||||
QStringList mountDevices = m_keyOperator->devices(QString("mount"));
|
||||
for (auto device : mountDevices) {
|
||||
for (auto &device : mountDevices) {
|
||||
int index = mountDevices.indexOf(device);
|
||||
m_values[QString("hddtotmb%1").arg(index)]
|
||||
= m_values[QString("hddfreemb%1").arg(index)].toFloat()
|
||||
@ -327,7 +327,7 @@ void AWKeys::calculateValues()
|
||||
/ m_values[QString("swaptotmb")].toFloat();
|
||||
|
||||
// lambdas
|
||||
for (auto key : m_foundLambdas)
|
||||
for (auto &key : m_foundLambdas)
|
||||
m_values[key] = AWPatternFunctions::expandLambdas(
|
||||
key, m_aggregator, m_values, m_foundKeys);
|
||||
}
|
||||
@ -360,11 +360,11 @@ QString AWKeys::parsePattern(QString pattern) const
|
||||
pattern.replace(QString("$$"), QString(0x1d));
|
||||
|
||||
// lambdas
|
||||
for (auto key : m_foundLambdas)
|
||||
for (auto &key : m_foundLambdas)
|
||||
pattern.replace(QString("${{%1}}").arg(key), m_values[key].toString());
|
||||
|
||||
// main keys
|
||||
for (auto key : m_foundKeys)
|
||||
for (auto &key : m_foundKeys)
|
||||
pattern.replace(QString("$%1").arg(key), [this](const QString &tag,
|
||||
const QVariant &value) {
|
||||
QString strValue = m_aggregator->formatter(value, tag);
|
||||
@ -375,7 +375,7 @@ QString AWKeys::parsePattern(QString pattern) const
|
||||
}(key, m_values[key]));
|
||||
|
||||
// bars
|
||||
for (auto bar : m_foundBars) {
|
||||
for (auto &bar : m_foundBars) {
|
||||
GraphicalItem *item = m_keyOperator->giByKey(bar);
|
||||
QString image
|
||||
= item->isCustom()
|
||||
|
@ -40,24 +40,24 @@ public:
|
||||
explicit AWKeys(QObject *parent = nullptr);
|
||||
virtual ~AWKeys();
|
||||
bool isDBusActive() const;
|
||||
Q_INVOKABLE void initDataAggregator(const QVariantMap tooltipParams);
|
||||
Q_INVOKABLE void initKeys(const QString currentPattern, const int interval,
|
||||
Q_INVOKABLE void initDataAggregator(const QVariantMap &tooltipParams);
|
||||
Q_INVOKABLE void initKeys(const QString ¤tPattern, const int interval,
|
||||
const int limit, const 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 = false);
|
||||
// additional method to force load keys from Qml UI. Used in some
|
||||
// configuration pages
|
||||
Q_INVOKABLE void updateCache();
|
||||
// keys
|
||||
Q_INVOKABLE QStringList dictKeys(const bool sorted = false,
|
||||
const QString regexp = QString()) const;
|
||||
const QString ®exp = QString()) const;
|
||||
Q_INVOKABLE QVariantList getHddDevices() const;
|
||||
// values
|
||||
Q_INVOKABLE QString infoByKey(QString key) const;
|
||||
Q_INVOKABLE QString valueByKey(QString key) const;
|
||||
Q_INVOKABLE QString infoByKey(const QString &key) const;
|
||||
Q_INVOKABLE QString valueByKey(const QString &key) const;
|
||||
// configuration
|
||||
Q_INVOKABLE void editItem(const QString type);
|
||||
Q_INVOKABLE void editItem(const QString &type);
|
||||
|
||||
public slots:
|
||||
void dataUpdated(const QString &sourceName,
|
||||
@ -66,12 +66,12 @@ public slots:
|
||||
void modelChanged(QString, QAbstractItemModel *){};
|
||||
|
||||
signals:
|
||||
void dropSourceFromDataengine(const QString source);
|
||||
void needTextToBeUpdated(const QString newText) const;
|
||||
void needToolTipToBeUpdated(const QString newText) const;
|
||||
void dropSourceFromDataengine(const QString &source);
|
||||
void needTextToBeUpdated(const QString &newText) const;
|
||||
void needToolTipToBeUpdated(const QString &newText) const;
|
||||
|
||||
private slots:
|
||||
void reinitKeys(const QStringList currentKeys);
|
||||
void reinitKeys(const QStringList ¤tKeys);
|
||||
void updateTextData();
|
||||
|
||||
private:
|
||||
|
@ -136,7 +136,7 @@ QString AWKeysAggregator::formatter(const QVariant &data,
|
||||
case FormatterType::TimeCustom:
|
||||
output = m_customTime;
|
||||
[&output, loc, this](const QDateTime dt) {
|
||||
for (auto key : m_timeKeys)
|
||||
for (auto &key : m_timeKeys)
|
||||
output.replace(QString("$%1").arg(key), loc.toString(dt, key));
|
||||
}(data.toDateTime());
|
||||
break;
|
||||
@ -197,7 +197,7 @@ QStringList AWKeysAggregator::keysFromSource(const QString &source) const
|
||||
}
|
||||
|
||||
|
||||
void AWKeysAggregator::setAcOffline(const QString inactive)
|
||||
void AWKeysAggregator::setAcOffline(const QString &inactive)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Inactive AC string" << inactive;
|
||||
|
||||
@ -205,7 +205,7 @@ void AWKeysAggregator::setAcOffline(const QString inactive)
|
||||
}
|
||||
|
||||
|
||||
void AWKeysAggregator::setAcOnline(const QString active)
|
||||
void AWKeysAggregator::setAcOnline(const QString &active)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Active AC string" << active;
|
||||
|
||||
@ -213,7 +213,7 @@ void AWKeysAggregator::setAcOnline(const QString active)
|
||||
}
|
||||
|
||||
|
||||
void AWKeysAggregator::setCustomTime(const QString customTime)
|
||||
void AWKeysAggregator::setCustomTime(const QString &customTime)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Format" << customTime;
|
||||
|
||||
@ -221,7 +221,7 @@ void AWKeysAggregator::setCustomTime(const QString customTime)
|
||||
}
|
||||
|
||||
|
||||
void AWKeysAggregator::setCustomUptime(const QString customUptime)
|
||||
void AWKeysAggregator::setCustomUptime(const QString &customUptime)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Format" << customUptime;
|
||||
|
||||
@ -229,7 +229,7 @@ void AWKeysAggregator::setCustomUptime(const QString customUptime)
|
||||
}
|
||||
|
||||
|
||||
void AWKeysAggregator::setDevices(const QHash<QString, QStringList> devices)
|
||||
void AWKeysAggregator::setDevices(const QHash<QString, QStringList> &devices)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Devices" << devices;
|
||||
|
||||
@ -237,7 +237,7 @@ void AWKeysAggregator::setDevices(const QHash<QString, QStringList> devices)
|
||||
}
|
||||
|
||||
|
||||
void AWKeysAggregator::setTempUnits(const QString units)
|
||||
void AWKeysAggregator::setTempUnits(const QString &units)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Units" << units;
|
||||
|
||||
@ -596,7 +596,7 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
|
||||
customFormattersKeys = m_customFormatters->definedFormatters();
|
||||
qCInfo(LOG_AW) << "Looking for fprmatters" << foundKeys << "in"
|
||||
<< customFormattersKeys;
|
||||
for (auto key : foundKeys) {
|
||||
for (auto &key : foundKeys) {
|
||||
if (!customFormattersKeys.contains(key))
|
||||
continue;
|
||||
m_formatter[key] = FormatterType::Custom;
|
||||
@ -611,7 +611,7 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
|
||||
});
|
||||
if (!required) {
|
||||
m_map.remove(source);
|
||||
for (auto key : foundKeys)
|
||||
for (auto &key : foundKeys)
|
||||
m_formatter.remove(key);
|
||||
}
|
||||
|
||||
|
@ -74,12 +74,12 @@ public:
|
||||
QString formatter(const QVariant &data, const QString &key) const;
|
||||
QStringList keysFromSource(const QString &source) const;
|
||||
// set methods
|
||||
void setAcOffline(const QString inactive);
|
||||
void setAcOnline(const QString active);
|
||||
void setCustomTime(const QString customTime);
|
||||
void setCustomUptime(const QString customUptime);
|
||||
void setDevices(const QHash<QString, QStringList> devices);
|
||||
void setTempUnits(const QString units);
|
||||
void setAcOffline(const QString &inactive);
|
||||
void setAcOnline(const QString &active);
|
||||
void setCustomTime(const QString &customTime);
|
||||
void setCustomUptime(const QString &customUptime);
|
||||
void setDevices(const QHash<QString, QStringList> &devices);
|
||||
void setTempUnits(const QString &units);
|
||||
void setTranslate(const bool translate);
|
||||
|
||||
public slots:
|
||||
|
@ -35,7 +35,7 @@ QString AWPatternFunctions::expandLambdas(QString code,
|
||||
// apply $this values
|
||||
code.replace(QString("$this"), metadata[code].toString());
|
||||
// parsed values
|
||||
for (auto lambdaKey : usedKeys)
|
||||
for (auto &lambdaKey : usedKeys)
|
||||
code.replace(QString("$%1").arg(lambdaKey),
|
||||
aggregator->formatter(metadata[lambdaKey], lambdaKey));
|
||||
qCInfo(LOG_AW) << "Expression" << code;
|
||||
@ -87,8 +87,8 @@ QString AWPatternFunctions::expandTemplates(QString code)
|
||||
|
||||
|
||||
QList<AWPatternFunctions::AWFunction>
|
||||
AWPatternFunctions::findFunctionCalls(const QString function,
|
||||
const QString code)
|
||||
AWPatternFunctions::findFunctionCalls(const QString &function,
|
||||
const QString &code)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Looking for function" << function << "in" << code;
|
||||
|
||||
@ -135,14 +135,14 @@ AWPatternFunctions::findFunctionCalls(const QString function,
|
||||
}
|
||||
|
||||
|
||||
QString AWPatternFunctions::insertAllKeys(QString code, const QStringList keys)
|
||||
QString AWPatternFunctions::insertAllKeys(QString code, const QStringList &keys)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Looking for keys in code" << code << "using list"
|
||||
<< keys;
|
||||
|
||||
QList<AWPatternFunctions::AWFunction> found
|
||||
= AWPatternFunctions::findFunctionCalls(QString("aw_all"), code);
|
||||
for (auto function : found) {
|
||||
for (auto &function : found) {
|
||||
QString separator
|
||||
= function.args.isEmpty() ? QString(",") : function.args.at(0);
|
||||
QStringList required = keys.filter(QRegExp(function.body));
|
||||
@ -157,14 +157,15 @@ QString AWPatternFunctions::insertAllKeys(QString code, const QStringList keys)
|
||||
}
|
||||
|
||||
|
||||
QString AWPatternFunctions::insertKeyCount(QString code, const QStringList keys)
|
||||
QString AWPatternFunctions::insertKeyCount(QString code,
|
||||
const QStringList &keys)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Looking for count in code" << code << "using list"
|
||||
<< keys;
|
||||
|
||||
QList<AWPatternFunctions::AWFunction> found
|
||||
= AWPatternFunctions::findFunctionCalls(QString("aw_count"), code);
|
||||
for (auto function : found) {
|
||||
for (auto &function : found) {
|
||||
int count = keys.filter(QRegExp(function.body)).count();
|
||||
|
||||
code.replace(function.what, QString::number(count));
|
||||
@ -174,14 +175,15 @@ QString AWPatternFunctions::insertKeyCount(QString code, const QStringList keys)
|
||||
}
|
||||
|
||||
|
||||
QString AWPatternFunctions::insertKeyNames(QString code, const QStringList keys)
|
||||
QString AWPatternFunctions::insertKeyNames(QString code,
|
||||
const QStringList &keys)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Looking for key names in code" << code << "using list"
|
||||
<< keys;
|
||||
|
||||
QList<AWPatternFunctions::AWFunction> found
|
||||
= AWPatternFunctions::findFunctionCalls(QString("aw_names"), code);
|
||||
for (auto function : found) {
|
||||
for (auto &function : found) {
|
||||
QString separator
|
||||
= function.args.isEmpty() ? QString(",") : function.args.at(0);
|
||||
QStringList required = keys.filter(QRegExp(function.body));
|
||||
@ -193,14 +195,14 @@ QString AWPatternFunctions::insertKeyNames(QString code, const QStringList keys)
|
||||
}
|
||||
|
||||
|
||||
QString AWPatternFunctions::insertKeys(QString code, const QStringList keys)
|
||||
QString AWPatternFunctions::insertKeys(QString code, const QStringList &keys)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Looking for keys in code" << code << "using list"
|
||||
<< keys;
|
||||
|
||||
QList<AWPatternFunctions::AWFunction> found
|
||||
= AWPatternFunctions::findFunctionCalls(QString("aw_keys"), code);
|
||||
for (auto function : found) {
|
||||
for (auto &function : found) {
|
||||
QString separator
|
||||
= function.args.isEmpty() ? QString(",") : function.args.at(0);
|
||||
QStringList required = keys.filter(QRegExp(function.body));
|
||||
@ -221,7 +223,7 @@ QString AWPatternFunctions::insertMacros(QString code)
|
||||
|
||||
QList<AWPatternFunctions::AWFunction> found
|
||||
= AWPatternFunctions::findFunctionCalls(QString("aw_macro"), code);
|
||||
for (auto macro : found) {
|
||||
for (auto ¯o : found) {
|
||||
// get macro params
|
||||
if (macro.args.isEmpty()) {
|
||||
qCWarning(LOG_AW) << "No macro name found for" << macro.what;
|
||||
@ -232,7 +234,7 @@ QString AWPatternFunctions::insertMacros(QString code)
|
||||
QList<AWPatternFunctions::AWFunction> macroUsage
|
||||
= AWPatternFunctions::findFunctionCalls(
|
||||
QString("aw_macro_%1").arg(name), code);
|
||||
for (auto function : macroUsage) {
|
||||
for (auto &function : macroUsage) {
|
||||
if (function.args.count() != macro.args.count()) {
|
||||
qCWarning(LOG_AW)
|
||||
<< "Invalid args count found for call" << function.what
|
||||
@ -259,8 +261,8 @@ QString AWPatternFunctions::insertMacros(QString code)
|
||||
}
|
||||
|
||||
|
||||
QStringList AWPatternFunctions::findKeys(const QString code,
|
||||
const QStringList keys,
|
||||
QStringList AWPatternFunctions::findKeys(const QString &code,
|
||||
const QStringList &keys,
|
||||
const bool isBars)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Looking for keys in code" << code << "using list"
|
||||
@ -268,7 +270,7 @@ QStringList AWPatternFunctions::findKeys(const QString code,
|
||||
|
||||
QStringList selectedKeys;
|
||||
QString replacedCode = code;
|
||||
for (auto key : keys)
|
||||
for (auto &key : keys)
|
||||
if ((key.startsWith(QString("bar")) == isBars)
|
||||
&& (replacedCode.contains(QString("$%1").arg(key)))) {
|
||||
qCInfo(LOG_AW) << "Found key" << key << "with bar enabled"
|
||||
@ -283,7 +285,7 @@ QStringList AWPatternFunctions::findKeys(const QString code,
|
||||
}
|
||||
|
||||
|
||||
QStringList AWPatternFunctions::findLambdas(const QString code)
|
||||
QStringList AWPatternFunctions::findLambdas(const QString &code)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Looking for lambdas in code" << code;
|
||||
|
||||
|
@ -38,16 +38,17 @@ QString expandLambdas(QString code, AWKeysAggregator *aggregator,
|
||||
const QVariantHash &metadata,
|
||||
const QStringList &usedKeys);
|
||||
QString expandTemplates(QString code);
|
||||
QList<AWFunction> findFunctionCalls(const QString function, const QString code);
|
||||
QString insertAllKeys(QString code, const QStringList keys);
|
||||
QString insertKeyCount(QString code, const QStringList keys);
|
||||
QString insertKeyNames(QString code, const QStringList keys);
|
||||
QString insertKeys(QString code, const QStringList keys);
|
||||
QList<AWFunction> findFunctionCalls(const QString &function,
|
||||
const QString &code);
|
||||
QString insertAllKeys(QString code, const QStringList &keys);
|
||||
QString insertKeyCount(QString code, const QStringList &keys);
|
||||
QString insertKeyNames(QString code, const QStringList &keys);
|
||||
QString insertKeys(QString code, const QStringList &keys);
|
||||
QString insertMacros(QString code);
|
||||
// find methods
|
||||
QStringList findKeys(const QString code, const QStringList keys,
|
||||
QStringList findKeys(const QString &code, const QStringList &keys,
|
||||
const bool isBars);
|
||||
QStringList findLambdas(const QString code);
|
||||
QStringList findLambdas(const QString &code);
|
||||
};
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
AWTelemetryHandler::AWTelemetryHandler(QObject *parent, const QString clientId)
|
||||
AWTelemetryHandler::AWTelemetryHandler(QObject *parent, const QString &clientId)
|
||||
: QObject(parent)
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
@ -50,7 +50,7 @@ AWTelemetryHandler::~AWTelemetryHandler()
|
||||
}
|
||||
|
||||
|
||||
QStringList AWTelemetryHandler::get(const QString group) const
|
||||
QStringList AWTelemetryHandler::get(const QString &group) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Get stored data for group" << group;
|
||||
|
||||
@ -58,7 +58,7 @@ QStringList AWTelemetryHandler::get(const QString group) const
|
||||
|
||||
QSettings settings(m_localFile, QSettings::IniFormat);
|
||||
settings.beginGroup(group);
|
||||
for (auto key : settings.childKeys())
|
||||
for (auto &key : settings.childKeys())
|
||||
values.append(settings.value(key).toString());
|
||||
settings.endGroup();
|
||||
|
||||
@ -66,7 +66,7 @@ QStringList AWTelemetryHandler::get(const QString group) const
|
||||
}
|
||||
|
||||
|
||||
QString AWTelemetryHandler::getLast(const QString group) const
|
||||
QString AWTelemetryHandler::getLast(const QString &group) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Get last stored data for group" << group;
|
||||
|
||||
@ -75,7 +75,7 @@ QString AWTelemetryHandler::getLast(const QString group) const
|
||||
|
||||
|
||||
void AWTelemetryHandler::init(const int count, const bool enableRemote,
|
||||
const QString clientId)
|
||||
const QString &clientId)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Init telemetry with count" << count << "enable remote"
|
||||
<< enableRemote << "client ID" << clientId;
|
||||
@ -86,7 +86,7 @@ void AWTelemetryHandler::init(const int count, const bool enableRemote,
|
||||
}
|
||||
|
||||
|
||||
bool AWTelemetryHandler::put(const QString group, const QString value) const
|
||||
bool AWTelemetryHandler::put(const QString &group, const QString &value) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Store data with group" << group << "and value" << value;
|
||||
|
||||
@ -95,7 +95,7 @@ bool AWTelemetryHandler::put(const QString group, const QString value) const
|
||||
// values will be stored as num=value inside specified group
|
||||
// load all values to memory
|
||||
QStringList saved;
|
||||
for (auto key : settings.childKeys())
|
||||
for (auto &key : settings.childKeys())
|
||||
saved.append(settings.value(key).toString());
|
||||
// check if this value is already saved
|
||||
if (saved.contains(value)) {
|
||||
@ -110,7 +110,7 @@ bool AWTelemetryHandler::put(const QString group, const QString value) const
|
||||
// clear group
|
||||
settings.remove(QString(""));
|
||||
// and save now
|
||||
for (auto value : saved) {
|
||||
for (auto &value : saved) {
|
||||
QString key = getKey(settings.childKeys().count());
|
||||
settings.setValue(key, value);
|
||||
}
|
||||
@ -123,8 +123,8 @@ bool AWTelemetryHandler::put(const QString group, const QString value) const
|
||||
}
|
||||
|
||||
|
||||
void AWTelemetryHandler::uploadTelemetry(const QString group,
|
||||
const QString value)
|
||||
void AWTelemetryHandler::uploadTelemetry(const QString &group,
|
||||
const QString &value)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Upload data with group" << group << "and value"
|
||||
<< value;
|
||||
|
@ -34,17 +34,18 @@ public:
|
||||
const char *REMOTE_TELEMETRY_URL = "https://arcanis.me/telemetry";
|
||||
|
||||
explicit AWTelemetryHandler(QObject *parent = nullptr,
|
||||
const QString clientId = QString());
|
||||
const QString &clientId = QString());
|
||||
virtual ~AWTelemetryHandler();
|
||||
Q_INVOKABLE QStringList get(const QString group) const;
|
||||
Q_INVOKABLE QString getLast(const QString group) const;
|
||||
Q_INVOKABLE QStringList get(const QString &group) const;
|
||||
Q_INVOKABLE QString getLast(const QString &group) const;
|
||||
Q_INVOKABLE void init(const int count, const bool enableRemote,
|
||||
const QString clientId);
|
||||
Q_INVOKABLE bool put(const QString group, const QString value) const;
|
||||
Q_INVOKABLE void uploadTelemetry(const QString group, const QString value);
|
||||
const QString &clientId);
|
||||
Q_INVOKABLE bool put(const QString &group, const QString &value) const;
|
||||
Q_INVOKABLE void uploadTelemetry(const QString &group,
|
||||
const QString &value);
|
||||
|
||||
signals:
|
||||
void replyReceived(QString message);
|
||||
void replyReceived(const QString &message);
|
||||
|
||||
private slots:
|
||||
void telemetryReplyRecieved(QNetworkReply *reply);
|
||||
|
@ -92,7 +92,7 @@ bool AWUpdateHelper::checkVersion()
|
||||
}
|
||||
|
||||
|
||||
void AWUpdateHelper::showInfo(const QVersionNumber version)
|
||||
void AWUpdateHelper::showInfo(const QVersionNumber &version)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Version" << version;
|
||||
|
||||
@ -105,7 +105,7 @@ void AWUpdateHelper::showInfo(const QVersionNumber version)
|
||||
}
|
||||
|
||||
|
||||
void AWUpdateHelper::showUpdates(const QVersionNumber version)
|
||||
void AWUpdateHelper::showUpdates(const QVersionNumber &version)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Version" << version;
|
||||
|
||||
@ -176,7 +176,7 @@ void AWUpdateHelper::versionReplyRecieved(QNetworkReply *reply,
|
||||
|
||||
// additional method which is used to show message box which does not block UI
|
||||
QMessageBox *
|
||||
AWUpdateHelper::genMessageBox(const QString title, const QString body,
|
||||
AWUpdateHelper::genMessageBox(const QString &title, const QString &body,
|
||||
const QMessageBox::StandardButtons buttons)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Construct message box with title" << title << "and body"
|
||||
|
@ -37,13 +37,13 @@ public:
|
||||
bool checkVersion();
|
||||
|
||||
private slots:
|
||||
void showInfo(const QVersionNumber version);
|
||||
void showUpdates(const QVersionNumber version);
|
||||
void showInfo(const QVersionNumber &version);
|
||||
void showUpdates(const QVersionNumber &version);
|
||||
void userReplyOnUpdates(QAbstractButton *button);
|
||||
void versionReplyRecieved(QNetworkReply *reply, const bool showAnyway);
|
||||
|
||||
private:
|
||||
QMessageBox *genMessageBox(const QString title, const QString body,
|
||||
QMessageBox *genMessageBox(const QString &title, const QString &body,
|
||||
const QMessageBox::StandardButtons buttons);
|
||||
QVersionNumber m_foundVersion;
|
||||
QString m_genericConfig;
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "qcronscheduler.h"
|
||||
|
||||
|
||||
AbstractExtItem::AbstractExtItem(QWidget *parent, const QString filePath)
|
||||
AbstractExtItem::AbstractExtItem(QWidget *parent, const QString &filePath)
|
||||
: QDialog(parent)
|
||||
, m_fileName(filePath)
|
||||
{
|
||||
@ -166,7 +166,7 @@ QString AbstractExtItem::socket() const
|
||||
}
|
||||
|
||||
|
||||
QString AbstractExtItem::tag(const QString _type) const
|
||||
QString AbstractExtItem::tag(const QString &_type) const
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Tag type" << _type;
|
||||
|
||||
@ -190,7 +190,7 @@ void AbstractExtItem::setActive(const bool _state)
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItem::setComment(const QString _comment)
|
||||
void AbstractExtItem::setComment(const QString &_comment)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Comment" << _comment;
|
||||
|
||||
@ -198,7 +198,7 @@ void AbstractExtItem::setComment(const QString _comment)
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItem::setCron(const QString _cron)
|
||||
void AbstractExtItem::setCron(const QString &_cron)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Cron string" << _cron;
|
||||
// deinit module first
|
||||
@ -230,7 +230,7 @@ void AbstractExtItem::setInterval(const int _interval)
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItem::setName(const QString _name)
|
||||
void AbstractExtItem::setName(const QString &_name)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Name" << _name;
|
||||
|
||||
@ -259,7 +259,7 @@ void AbstractExtItem::setNumber(int _number)
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItem::setSocket(const QString _socket)
|
||||
void AbstractExtItem::setSocket(const QString &_socket)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Socket" << _socket;
|
||||
// remove old socket first
|
||||
|
@ -41,10 +41,10 @@ class AbstractExtItem : public QDialog
|
||||
|
||||
public:
|
||||
explicit AbstractExtItem(QWidget *parent,
|
||||
const QString filePath = QString());
|
||||
const QString &filePath = QString());
|
||||
virtual ~AbstractExtItem();
|
||||
virtual void bumpApi(const int _newVer);
|
||||
virtual AbstractExtItem *copy(const QString _fileName, const int _number)
|
||||
virtual AbstractExtItem *copy(const QString &_fileName, const int _number)
|
||||
= 0;
|
||||
virtual void copyDefaults(AbstractExtItem *_other) const;
|
||||
virtual void startTimer();
|
||||
@ -59,17 +59,17 @@ public:
|
||||
QString name() const;
|
||||
int number() const;
|
||||
QString socket() const;
|
||||
QString tag(const QString _type) const;
|
||||
QString tag(const QString &_type) const;
|
||||
virtual QString uniq() const = 0;
|
||||
// set methods
|
||||
void setApiVersion(const int _apiVersion = 0);
|
||||
void setActive(const bool _state = true);
|
||||
void setComment(const QString _comment = QString("empty"));
|
||||
void setCron(const QString _cron = "");
|
||||
void setComment(const QString &_comment = QString("empty"));
|
||||
void setCron(const QString &_cron = "");
|
||||
void setInterval(const int _interval = 1);
|
||||
void setName(const QString _name = QString("none"));
|
||||
void setName(const QString &_name = QString("none"));
|
||||
void setNumber(int _number = -1);
|
||||
void setSocket(const QString _socket = QString(""));
|
||||
void setSocket(const QString &_socket = QString(""));
|
||||
|
||||
signals:
|
||||
void dataReceived(const QVariantHash &data);
|
||||
@ -80,7 +80,7 @@ public slots:
|
||||
virtual void initSocket();
|
||||
virtual void readConfiguration();
|
||||
virtual QVariantHash run() = 0;
|
||||
virtual int showConfiguration(const QVariant args = QVariant()) = 0;
|
||||
virtual int showConfiguration(const QVariant &args = QVariant()) = 0;
|
||||
virtual bool tryDelete() const;
|
||||
virtual void writeConfiguration() const;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
|
||||
AbstractExtItemAggregator::AbstractExtItemAggregator(QWidget *parent,
|
||||
const QString type)
|
||||
const QString &type)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::AbstractExtItemAggregator)
|
||||
, m_type(type)
|
||||
@ -132,7 +132,7 @@ AbstractExtItem *AbstractExtItemAggregator::itemFromWidget()
|
||||
return nullptr;
|
||||
|
||||
AbstractExtItem *found = nullptr;
|
||||
for (auto item : items()) {
|
||||
for (auto &item : items()) {
|
||||
QString fileName = QFileInfo(item->fileName()).fileName();
|
||||
if (fileName != widgetItem->text())
|
||||
continue;
|
||||
@ -150,7 +150,7 @@ AbstractExtItem *AbstractExtItemAggregator::itemFromWidget()
|
||||
void AbstractExtItemAggregator::repaintList()
|
||||
{
|
||||
ui->listWidget->clear();
|
||||
for (auto _item : items()) {
|
||||
for (auto &_item : items()) {
|
||||
QString fileName = QFileInfo(_item->fileName()).fileName();
|
||||
QListWidgetItem *item = new QListWidgetItem(fileName, ui->listWidget);
|
||||
QStringList tooltip;
|
||||
@ -166,7 +166,7 @@ void AbstractExtItemAggregator::repaintList()
|
||||
int AbstractExtItemAggregator::uniqNumber() const
|
||||
{
|
||||
QList<int> tagList;
|
||||
for (auto item : items())
|
||||
for (auto &item : items())
|
||||
tagList.append(item->number());
|
||||
int number = 0;
|
||||
while (tagList.contains(number))
|
||||
@ -188,7 +188,7 @@ QString AbstractExtItemAggregator::type() const
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItemAggregator::setConfigArgs(const QVariant _configArgs)
|
||||
void AbstractExtItemAggregator::setConfigArgs(const QVariant &_configArgs)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Configuration arguments" << _configArgs;
|
||||
|
||||
|
@ -39,7 +39,7 @@ class AbstractExtItemAggregator : public QDialog
|
||||
Q_PROPERTY(QVariant type READ type)
|
||||
|
||||
public:
|
||||
explicit AbstractExtItemAggregator(QWidget *parent, const QString type);
|
||||
explicit AbstractExtItemAggregator(QWidget *parent, const QString &type);
|
||||
virtual ~AbstractExtItemAggregator();
|
||||
// methods
|
||||
void copyItem();
|
||||
@ -75,7 +75,7 @@ public:
|
||||
virtual QList<AbstractExtItem *> items() const = 0;
|
||||
QString type() const;
|
||||
// set methods
|
||||
void setConfigArgs(const QVariant _configArgs);
|
||||
void setConfigArgs(const QVariant &_configArgs);
|
||||
|
||||
private slots:
|
||||
void editItemActivated(QListWidgetItem *);
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
: QObject(parent)
|
||||
, m_number(number){};
|
||||
virtual ~AbstractWeatherProvider(){};
|
||||
virtual void initUrl(const QString city, const QString country,
|
||||
virtual void initUrl(const QString &city, const QString &country,
|
||||
const int ts)
|
||||
= 0;
|
||||
virtual QVariantHash parse(const QVariantMap &json) const = 0;
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
|
||||
AWAbstractFormatter::AWAbstractFormatter(QWidget *parent,
|
||||
const QString filePath)
|
||||
const QString &filePath)
|
||||
: AbstractExtItem(parent, filePath)
|
||||
{
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
@ -87,7 +87,7 @@ AWAbstractFormatter::FormatterClass AWAbstractFormatter::type() const
|
||||
}
|
||||
|
||||
|
||||
void AWAbstractFormatter::setStrType(const QString _type)
|
||||
void AWAbstractFormatter::setStrType(const QString &_type)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Type" << _type;
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
};
|
||||
|
||||
explicit AWAbstractFormatter(QWidget *parent,
|
||||
const QString filePath = QString());
|
||||
const QString &filePath = QString());
|
||||
virtual ~AWAbstractFormatter();
|
||||
virtual QString convert(const QVariant &_value) const = 0;
|
||||
void copyDefaults(AbstractExtItem *_other) const;
|
||||
@ -47,7 +47,7 @@ public:
|
||||
// properties
|
||||
QString strType() const;
|
||||
FormatterClass type() const;
|
||||
void setStrType(const QString type);
|
||||
void setStrType(const QString &type);
|
||||
void setType(const FormatterClass _type = FormatterClass::NoFormat);
|
||||
|
||||
public slots:
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
|
||||
AWDateTimeFormatter::AWDateTimeFormatter(QWidget *parent,
|
||||
const QString filePath)
|
||||
const QString &filePath)
|
||||
: AWAbstractFormatter(parent, filePath)
|
||||
, ui(new Ui::AWDateTimeFormatter)
|
||||
{
|
||||
@ -58,7 +58,7 @@ QString AWDateTimeFormatter::convert(const QVariant &_value) const
|
||||
}
|
||||
|
||||
|
||||
AWDateTimeFormatter *AWDateTimeFormatter::copy(const QString _fileName,
|
||||
AWDateTimeFormatter *AWDateTimeFormatter::copy(const QString &_fileName,
|
||||
const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
@ -86,7 +86,7 @@ bool AWDateTimeFormatter::translateString() const
|
||||
}
|
||||
|
||||
|
||||
void AWDateTimeFormatter::setFormat(const QString _format)
|
||||
void AWDateTimeFormatter::setFormat(const QString &_format)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Set format" << _format;
|
||||
|
||||
@ -119,7 +119,7 @@ void AWDateTimeFormatter::readConfiguration()
|
||||
}
|
||||
|
||||
|
||||
int AWDateTimeFormatter::showConfiguration(const QVariant args)
|
||||
int AWDateTimeFormatter::showConfiguration(const QVariant &args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
|
||||
|
@ -36,19 +36,19 @@ class AWDateTimeFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWDateTimeFormatter(QWidget *parent,
|
||||
const QString filePath = QString());
|
||||
const QString &filePath = QString());
|
||||
virtual ~AWDateTimeFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWDateTimeFormatter *copy(const QString _fileName, const int _number);
|
||||
AWDateTimeFormatter *copy(const QString &_fileName, const int _number);
|
||||
// properties
|
||||
QString format() const;
|
||||
bool translateString() const;
|
||||
void setFormat(const QString _format);
|
||||
void setFormat(const QString &_format);
|
||||
void setTranslateString(const bool _translate);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
int showConfiguration(const QVariant &args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private:
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
AWFloatFormatter::AWFloatFormatter(QWidget *parent, const QString filePath)
|
||||
AWFloatFormatter::AWFloatFormatter(QWidget *parent, const QString &filePath)
|
||||
: AWAbstractFormatter(parent, filePath)
|
||||
, ui(new Ui::AWFloatFormatter)
|
||||
{
|
||||
@ -62,7 +62,7 @@ QString AWFloatFormatter::convert(const QVariant &_value) const
|
||||
}
|
||||
|
||||
|
||||
AWFloatFormatter *AWFloatFormatter::copy(const QString _fileName,
|
||||
AWFloatFormatter *AWFloatFormatter::copy(const QString &_fileName,
|
||||
const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
@ -133,7 +133,7 @@ void AWFloatFormatter::setCount(const int _count)
|
||||
}
|
||||
|
||||
|
||||
void AWFloatFormatter::setFillChar(const QChar _fillChar)
|
||||
void AWFloatFormatter::setFillChar(const QChar &_fillChar)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Set char" << _fillChar;
|
||||
|
||||
@ -214,7 +214,7 @@ void AWFloatFormatter::readConfiguration()
|
||||
}
|
||||
|
||||
|
||||
int AWFloatFormatter::showConfiguration(const QVariant args)
|
||||
int AWFloatFormatter::showConfiguration(const QVariant &args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
|
||||
|
@ -39,10 +39,10 @@ class AWFloatFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWFloatFormatter(QWidget *parent,
|
||||
const QString filePath = QString());
|
||||
const QString &filePath = QString());
|
||||
virtual ~AWFloatFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWFloatFormatter *copy(const QString _fileName, const int _number);
|
||||
AWFloatFormatter *copy(const QString &_fileName, const int _number);
|
||||
// properties
|
||||
int count() const;
|
||||
QChar fillChar() const;
|
||||
@ -52,7 +52,7 @@ public:
|
||||
int precision() const;
|
||||
double summand() const;
|
||||
void setCount(const int _count);
|
||||
void setFillChar(const QChar _fillChar);
|
||||
void setFillChar(const QChar &_fillChar);
|
||||
void setForceWidth(const bool _forceWidth);
|
||||
void setFormat(char _format);
|
||||
void setMultiplier(const double _multiplier);
|
||||
@ -61,7 +61,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
int showConfiguration(const QVariant &args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private:
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
AWJsonFormatter::AWJsonFormatter(QWidget *parent, const QString filePath)
|
||||
AWJsonFormatter::AWJsonFormatter(QWidget *parent, const QString &filePath)
|
||||
: AWAbstractFormatter(parent, filePath)
|
||||
, ui(new Ui::AWJsonFormatter)
|
||||
{
|
||||
@ -65,7 +65,7 @@ QString AWJsonFormatter::convert(const QVariant &_value) const
|
||||
}
|
||||
|
||||
|
||||
AWJsonFormatter *AWJsonFormatter::copy(const QString _fileName,
|
||||
AWJsonFormatter *AWJsonFormatter::copy(const QString &_fileName,
|
||||
const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
@ -86,7 +86,7 @@ QString AWJsonFormatter::path() const
|
||||
}
|
||||
|
||||
|
||||
void AWJsonFormatter::setPath(const QString _path)
|
||||
void AWJsonFormatter::setPath(const QString &_path)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Path" << _path;
|
||||
|
||||
@ -109,7 +109,7 @@ void AWJsonFormatter::readConfiguration()
|
||||
}
|
||||
|
||||
|
||||
int AWJsonFormatter::showConfiguration(const QVariant args)
|
||||
int AWJsonFormatter::showConfiguration(const QVariant &args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
|
||||
@ -190,10 +190,7 @@ void AWJsonFormatter::initPath()
|
||||
for (auto &element : splittedByDot) {
|
||||
bool ok;
|
||||
int number = element.toInt(&ok);
|
||||
if (ok)
|
||||
m_splittedPath.append(number);
|
||||
else
|
||||
m_splittedPath.append(element);
|
||||
m_splittedPath.append(ok ? QVariant(number) : QVariant(element));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,17 +33,17 @@ class AWJsonFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWJsonFormatter(QWidget *parent,
|
||||
const QString filePath = QString());
|
||||
const QString &filePath = QString());
|
||||
virtual ~AWJsonFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWJsonFormatter *copy(const QString _fileName, const int _number);
|
||||
AWJsonFormatter *copy(const QString &_fileName, const int _number);
|
||||
// properties
|
||||
QString path() const;
|
||||
void setPath(const QString _path);
|
||||
void setPath(const QString &_path);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
int showConfiguration(const QVariant &args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private:
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
AWListFormatter::AWListFormatter(QWidget *parent, const QString filePath)
|
||||
AWListFormatter::AWListFormatter(QWidget *parent, const QString &filePath)
|
||||
: AWAbstractFormatter(parent, filePath)
|
||||
, ui(new Ui::AWListFormatter)
|
||||
{
|
||||
@ -59,7 +59,7 @@ QString AWListFormatter::convert(const QVariant &_value) const
|
||||
}
|
||||
|
||||
|
||||
AWListFormatter *AWListFormatter::copy(const QString _fileName,
|
||||
AWListFormatter *AWListFormatter::copy(const QString &_fileName,
|
||||
const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
@ -94,7 +94,7 @@ QString AWListFormatter::separator() const
|
||||
}
|
||||
|
||||
|
||||
void AWListFormatter::setFilter(const QString _filter)
|
||||
void AWListFormatter::setFilter(const QString &_filter)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Filter" << _filter;
|
||||
|
||||
@ -103,7 +103,7 @@ void AWListFormatter::setFilter(const QString _filter)
|
||||
}
|
||||
|
||||
|
||||
void AWListFormatter::setSeparator(const QString _separator)
|
||||
void AWListFormatter::setSeparator(const QString &_separator)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Separtor" << _separator;
|
||||
|
||||
@ -136,7 +136,7 @@ void AWListFormatter::readConfiguration()
|
||||
}
|
||||
|
||||
|
||||
int AWListFormatter::showConfiguration(const QVariant args)
|
||||
int AWListFormatter::showConfiguration(const QVariant &args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
|
||||
|
@ -35,21 +35,21 @@ class AWListFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWListFormatter(QWidget *parent,
|
||||
const QString filePath = QString());
|
||||
const QString &filePath = QString());
|
||||
virtual ~AWListFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWListFormatter *copy(const QString _fileName, const int _number);
|
||||
AWListFormatter *copy(const QString &_fileName, const int _number);
|
||||
// properties
|
||||
QString filter() const;
|
||||
bool isSorted() const;
|
||||
QString separator() const;
|
||||
void setFilter(const QString _filter);
|
||||
void setSeparator(const QString _separator);
|
||||
void setFilter(const QString &_filter);
|
||||
void setSeparator(const QString &_separator);
|
||||
void setSorted(const bool _sorted);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
int showConfiguration(const QVariant &args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private:
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
AWNoFormatter::AWNoFormatter(QWidget *parent, const QString filePath)
|
||||
AWNoFormatter::AWNoFormatter(QWidget *parent, const QString &filePath)
|
||||
: AWAbstractFormatter(parent, filePath)
|
||||
, ui(new Ui::AWNoFormatter)
|
||||
{
|
||||
@ -53,7 +53,7 @@ QString AWNoFormatter::convert(const QVariant &_value) const
|
||||
}
|
||||
|
||||
|
||||
AWNoFormatter *AWNoFormatter::copy(const QString _fileName, const int _number)
|
||||
AWNoFormatter *AWNoFormatter::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
@ -66,7 +66,7 @@ AWNoFormatter *AWNoFormatter::copy(const QString _fileName, const int _number)
|
||||
}
|
||||
|
||||
|
||||
int AWNoFormatter::showConfiguration(const QVariant args)
|
||||
int AWNoFormatter::showConfiguration(const QVariant &args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
|
||||
|
@ -31,13 +31,13 @@ class AWNoFormatter : public AWAbstractFormatter
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AWNoFormatter(QWidget *parent, const QString filePath = QString());
|
||||
explicit AWNoFormatter(QWidget *parent, const QString &filePath = QString());
|
||||
virtual ~AWNoFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWNoFormatter *copy(const QString _fileName, const int _number);
|
||||
AWNoFormatter *copy(const QString &_fileName, const int _number);
|
||||
|
||||
public slots:
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
int showConfiguration(const QVariant &args = QVariant());
|
||||
|
||||
private:
|
||||
Ui::AWNoFormatter *ui = nullptr;
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
AWScriptFormatter::AWScriptFormatter(QWidget *parent, const QString filePath)
|
||||
AWScriptFormatter::AWScriptFormatter(QWidget *parent, const QString &filePath)
|
||||
: AWAbstractFormatter(parent, filePath)
|
||||
, ui(new Ui::AWScriptFormatter)
|
||||
{
|
||||
@ -70,7 +70,7 @@ QString AWScriptFormatter::convert(const QVariant &_value) const
|
||||
}
|
||||
|
||||
|
||||
AWScriptFormatter *AWScriptFormatter::copy(const QString _fileName,
|
||||
AWScriptFormatter *AWScriptFormatter::copy(const QString &_fileName,
|
||||
const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
@ -120,7 +120,7 @@ void AWScriptFormatter::setAppendCode(const bool _appendCode)
|
||||
}
|
||||
|
||||
|
||||
void AWScriptFormatter::setCode(const QString _code)
|
||||
void AWScriptFormatter::setCode(const QString &_code)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Set code" << _code;
|
||||
|
||||
@ -156,7 +156,7 @@ void AWScriptFormatter::readConfiguration()
|
||||
}
|
||||
|
||||
|
||||
int AWScriptFormatter::showConfiguration(const QVariant args)
|
||||
int AWScriptFormatter::showConfiguration(const QVariant &args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
|
||||
|
@ -36,22 +36,22 @@ class AWScriptFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWScriptFormatter(QWidget *parent,
|
||||
const QString filePath = QString());
|
||||
const QString &filePath = QString());
|
||||
virtual ~AWScriptFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWScriptFormatter *copy(const QString _fileName, const int _number);
|
||||
AWScriptFormatter *copy(const QString &_fileName, const int _number);
|
||||
// properties
|
||||
bool appendCode() const;
|
||||
QString code() const;
|
||||
bool hasReturn() const;
|
||||
QString program() const;
|
||||
void setAppendCode(const bool _appendCode);
|
||||
void setCode(const QString _code);
|
||||
void setCode(const QString &_code);
|
||||
void setHasReturn(const bool _hasReturn);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
int showConfiguration(const QVariant &args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private:
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
AWStringFormatter::AWStringFormatter(QWidget *parent, const QString filePath)
|
||||
AWStringFormatter::AWStringFormatter(QWidget *parent, const QString &filePath)
|
||||
: AWAbstractFormatter(parent, filePath)
|
||||
, ui(new Ui::AWStringFormatter)
|
||||
{
|
||||
@ -60,7 +60,7 @@ QString AWStringFormatter::convert(const QVariant &_value) const
|
||||
}
|
||||
|
||||
|
||||
AWStringFormatter *AWStringFormatter::copy(const QString _fileName,
|
||||
AWStringFormatter *AWStringFormatter::copy(const QString &_fileName,
|
||||
const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
@ -103,7 +103,7 @@ void AWStringFormatter::setCount(const int _count)
|
||||
}
|
||||
|
||||
|
||||
void AWStringFormatter::setFillChar(const QChar _fillChar)
|
||||
void AWStringFormatter::setFillChar(const QChar &_fillChar)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Set char" << _fillChar;
|
||||
|
||||
@ -137,7 +137,7 @@ void AWStringFormatter::readConfiguration()
|
||||
}
|
||||
|
||||
|
||||
int AWStringFormatter::showConfiguration(const QVariant args)
|
||||
int AWStringFormatter::showConfiguration(const QVariant &args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
|
||||
|
@ -35,21 +35,21 @@ class AWStringFormatter : public AWAbstractFormatter
|
||||
|
||||
public:
|
||||
explicit AWStringFormatter(QWidget *parent,
|
||||
const QString filePath = QString());
|
||||
const QString &filePath = QString());
|
||||
virtual ~AWStringFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWStringFormatter *copy(const QString _fileName, const int _number);
|
||||
AWStringFormatter *copy(const QString &_fileName, const int _number);
|
||||
// properties
|
||||
int count() const;
|
||||
QChar fillChar() const;
|
||||
bool forceWidth() const;
|
||||
void setCount(const int _count);
|
||||
void setFillChar(const QChar _fillChar);
|
||||
void setFillChar(const QChar &_fillChar);
|
||||
void setForceWidth(const bool _forceWidth);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
int showConfiguration(const QVariant &args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private:
|
||||
|
@ -31,7 +31,7 @@
|
||||
template <class T> class ExtItemAggregator : public AbstractExtItemAggregator
|
||||
{
|
||||
public:
|
||||
explicit ExtItemAggregator(QWidget *parent, const QString type)
|
||||
explicit ExtItemAggregator(QWidget *parent, const QString &type)
|
||||
: AbstractExtItemAggregator(parent, type)
|
||||
{
|
||||
qSetMessagePattern(AWDebug::LOG_FORMAT);
|
||||
@ -66,16 +66,16 @@ public:
|
||||
// HACK as soon as per one widget instance we have two objects each of
|
||||
// them will try to control socket, whereas actually only one of them
|
||||
// should be owner of the socket
|
||||
for (auto item : m_items)
|
||||
for (auto &item : m_items)
|
||||
item->initSocket();
|
||||
}
|
||||
|
||||
T *itemByTag(const QString _tag, const QString _type) const
|
||||
T *itemByTag(const QString &_tag, const QString &_type) const
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Tag" << _tag << "with used type" << _type;
|
||||
|
||||
T *found = nullptr;
|
||||
for (auto item : m_items) {
|
||||
for (auto &item : m_items) {
|
||||
if (item->tag(_type) != _tag)
|
||||
continue;
|
||||
found = static_cast<T *>(item);
|
||||
@ -92,7 +92,7 @@ public:
|
||||
qCDebug(LOG_LIB) << "Number" << _number;
|
||||
|
||||
T *found = nullptr;
|
||||
for (auto item : m_items) {
|
||||
for (auto &item : m_items) {
|
||||
if (item->number() != _number)
|
||||
continue;
|
||||
found = static_cast<T *>(item);
|
||||
@ -129,9 +129,9 @@ private:
|
||||
QStandardPaths::LocateDirectory);
|
||||
QStringList names;
|
||||
QList<AbstractExtItem *> items;
|
||||
for (auto dir : dirs) {
|
||||
for (auto &dir : dirs) {
|
||||
QStringList files = QDir(dir).entryList(QDir::Files, QDir::Name);
|
||||
for (auto file : files) {
|
||||
for (auto &file : files) {
|
||||
if ((!file.endsWith(QString(".desktop")))
|
||||
|| (names.contains(file)))
|
||||
continue;
|
||||
@ -156,7 +156,7 @@ private:
|
||||
m_activeItems.clear();
|
||||
|
||||
m_items = getItems();
|
||||
for (auto item : m_items) {
|
||||
for (auto &item : m_items) {
|
||||
if (!item->isActive())
|
||||
continue;
|
||||
m_activeItems.append(static_cast<T *>(item));
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
ExtNetworkRequest::ExtNetworkRequest(QWidget *parent, const QString filePath)
|
||||
ExtNetworkRequest::ExtNetworkRequest(QWidget *parent, const QString &filePath)
|
||||
: AbstractExtItem(parent, filePath)
|
||||
, ui(new Ui::ExtNetworkRequest)
|
||||
{
|
||||
@ -67,7 +67,7 @@ ExtNetworkRequest::~ExtNetworkRequest()
|
||||
}
|
||||
|
||||
|
||||
ExtNetworkRequest *ExtNetworkRequest::copy(const QString _fileName,
|
||||
ExtNetworkRequest *ExtNetworkRequest::copy(const QString &_fileName,
|
||||
const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
@ -94,7 +94,7 @@ QString ExtNetworkRequest::uniq() const
|
||||
}
|
||||
|
||||
|
||||
void ExtNetworkRequest::setStringUrl(const QString _url)
|
||||
void ExtNetworkRequest::setStringUrl(const QString &_url)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Url" << _url;
|
||||
|
||||
@ -127,7 +127,7 @@ QVariantHash ExtNetworkRequest::run()
|
||||
}
|
||||
|
||||
|
||||
int ExtNetworkRequest::showConfiguration(const QVariant args)
|
||||
int ExtNetworkRequest::showConfiguration(const QVariant &args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
|
||||
|
@ -35,19 +35,19 @@ class ExtNetworkRequest : public AbstractExtItem
|
||||
|
||||
public:
|
||||
explicit ExtNetworkRequest(QWidget *parent,
|
||||
const QString filePath = QString());
|
||||
const QString &filePath = QString());
|
||||
virtual ~ExtNetworkRequest();
|
||||
ExtNetworkRequest *copy(const QString _fileName, const int _number);
|
||||
ExtNetworkRequest *copy(const QString &_fileName, const int _number);
|
||||
// get methods
|
||||
QString stringUrl() const;
|
||||
QString uniq() const;
|
||||
// set methods
|
||||
void setStringUrl(const QString _url = QString("https://httpbin.org/get"));
|
||||
void setStringUrl(const QString &_url = QString("https://httpbin.org/get"));
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
int showConfiguration(const QVariant &args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
ExtQuotes::ExtQuotes(QWidget *parent, const QString filePath)
|
||||
ExtQuotes::ExtQuotes(QWidget *parent, const QString &filePath)
|
||||
: AbstractExtItem(parent, filePath)
|
||||
, ui(new Ui::ExtQuotes)
|
||||
{
|
||||
@ -77,7 +77,7 @@ ExtQuotes::~ExtQuotes()
|
||||
}
|
||||
|
||||
|
||||
ExtQuotes *ExtQuotes::copy(const QString _fileName, const int _number)
|
||||
ExtQuotes *ExtQuotes::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
@ -103,7 +103,7 @@ QString ExtQuotes::uniq() const
|
||||
}
|
||||
|
||||
|
||||
void ExtQuotes::setTicker(const QString _ticker)
|
||||
void ExtQuotes::setTicker(const QString &_ticker)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Ticker" << _ticker;
|
||||
|
||||
@ -136,7 +136,7 @@ QVariantHash ExtQuotes::run()
|
||||
}
|
||||
|
||||
|
||||
int ExtQuotes::showConfiguration(const QVariant args)
|
||||
int ExtQuotes::showConfiguration(const QVariant &args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
|
||||
|
@ -38,19 +38,19 @@ public:
|
||||
const char *YAHOO_QUOTES_QUERY
|
||||
= "select * from yahoo.finance.quotes where symbol='%1'";
|
||||
|
||||
explicit ExtQuotes(QWidget *parent, const QString filePath = QString());
|
||||
explicit ExtQuotes(QWidget *parent, const QString &filePath = QString());
|
||||
virtual ~ExtQuotes();
|
||||
ExtQuotes *copy(const QString _fileName, const int _number);
|
||||
ExtQuotes *copy(const QString &_fileName, const int _number);
|
||||
// get methods
|
||||
QString ticker() const;
|
||||
QString uniq() const;
|
||||
// set methods
|
||||
void setTicker(const QString _ticker = QString("EURUSD=X"));
|
||||
void setTicker(const QString &_ticker = QString("EURUSD=X"));
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
int showConfiguration(const QVariant &args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
ExtScript::ExtScript(QWidget *parent, const QString filePath)
|
||||
ExtScript::ExtScript(QWidget *parent, const QString &filePath)
|
||||
: AbstractExtItem(parent, filePath)
|
||||
, ui(new Ui::ExtScript)
|
||||
{
|
||||
@ -66,7 +66,7 @@ ExtScript::~ExtScript()
|
||||
}
|
||||
|
||||
|
||||
ExtScript *ExtScript::copy(const QString _fileName, const int _number)
|
||||
ExtScript *ExtScript::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
@ -147,7 +147,7 @@ QString ExtScript::strRedirect() const
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::setExecutable(const QString _executable)
|
||||
void ExtScript::setExecutable(const QString &_executable)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Executable" << _executable;
|
||||
|
||||
@ -155,7 +155,7 @@ void ExtScript::setExecutable(const QString _executable)
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::setFilters(const QStringList _filters)
|
||||
void ExtScript::setFilters(const QStringList &_filters)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Filters" << _filters;
|
||||
|
||||
@ -164,7 +164,7 @@ void ExtScript::setFilters(const QStringList _filters)
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::setPrefix(const QString _prefix)
|
||||
void ExtScript::setPrefix(const QString &_prefix)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Prefix" << _prefix;
|
||||
|
||||
@ -180,7 +180,7 @@ void ExtScript::setRedirect(const Redirect _redirect)
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::setStrRedirect(const QString _redirect)
|
||||
void ExtScript::setStrRedirect(const QString &_redirect)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Redirect" << _redirect;
|
||||
|
||||
@ -199,7 +199,7 @@ QString ExtScript::applyFilters(QString _value) const
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Value" << _value;
|
||||
|
||||
for (auto filt : filters()) {
|
||||
for (auto &filt : filters()) {
|
||||
qCInfo(LOG_LIB) << "Found filter" << filt;
|
||||
QVariantMap filter = m_jsonFilters[filt].toMap();
|
||||
if (filter.isEmpty()) {
|
||||
@ -207,7 +207,7 @@ QString ExtScript::applyFilters(QString _value) const
|
||||
<< "Could not find filter" << _value << "in the json";
|
||||
continue;
|
||||
}
|
||||
for (auto f : filter.keys())
|
||||
for (auto &f : filter.keys())
|
||||
_value.replace(f, filter[f].toString());
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ QString ExtScript::applyFilters(QString _value) const
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::updateFilter(const QString _filter, const bool _add)
|
||||
void ExtScript::updateFilter(const QString &_filter, const bool _add)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Should be added filters" << _add << "from" << _filter;
|
||||
|
||||
@ -283,7 +283,7 @@ QVariantHash ExtScript::run()
|
||||
}
|
||||
|
||||
|
||||
int ExtScript::showConfiguration(const QVariant args)
|
||||
int ExtScript::showConfiguration(const QVariant &args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
|
||||
|
@ -44,9 +44,9 @@ public:
|
||||
swap = 3
|
||||
};
|
||||
|
||||
explicit ExtScript(QWidget *parent, const QString filePath = QString());
|
||||
explicit ExtScript(QWidget *parent, const QString &filePath = QString());
|
||||
virtual ~ExtScript();
|
||||
ExtScript *copy(const QString _fileName, const int _number);
|
||||
ExtScript *copy(const QString &_fileName, const int _number);
|
||||
QString jsonFiltersFile() const;
|
||||
// get methods
|
||||
QString executable() const;
|
||||
@ -57,20 +57,20 @@ public:
|
||||
// derivatives
|
||||
QString strRedirect() const;
|
||||
// set methods
|
||||
void setExecutable(const QString _executable = QString("/usr/bin/true"));
|
||||
void setFilters(const QStringList _filters = QStringList());
|
||||
void setPrefix(const QString _prefix = QString(""));
|
||||
void setExecutable(const QString &_executable = QString("/usr/bin/true"));
|
||||
void setFilters(const QStringList &_filters = QStringList());
|
||||
void setPrefix(const QString &_prefix = QString(""));
|
||||
void setRedirect(const Redirect _redirect = Redirect::nothing);
|
||||
void setStrRedirect(const QString _redirect = QString("nothing"));
|
||||
void setStrRedirect(const QString &_redirect = QString("nothing"));
|
||||
// filters
|
||||
QString applyFilters(QString _value) const;
|
||||
void updateFilter(const QString _filter, const bool _add = true);
|
||||
void updateFilter(const QString &_filter, const bool _add = true);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
void readJsonFilters();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
int showConfiguration(const QVariant &args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
ExtUpgrade::ExtUpgrade(QWidget *parent, const QString filePath)
|
||||
ExtUpgrade::ExtUpgrade(QWidget *parent, const QString &filePath)
|
||||
: AbstractExtItem(parent, filePath)
|
||||
, ui(new Ui::ExtUpgrade)
|
||||
{
|
||||
@ -60,7 +60,7 @@ ExtUpgrade::~ExtUpgrade()
|
||||
}
|
||||
|
||||
|
||||
ExtUpgrade *ExtUpgrade::copy(const QString _fileName, const int _number)
|
||||
ExtUpgrade *ExtUpgrade::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
@ -100,7 +100,7 @@ QString ExtUpgrade::uniq() const
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::setExecutable(const QString _executable)
|
||||
void ExtUpgrade::setExecutable(const QString &_executable)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Executable" << _executable;
|
||||
|
||||
@ -108,7 +108,7 @@ void ExtUpgrade::setExecutable(const QString _executable)
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::setFilter(const QString _filter)
|
||||
void ExtUpgrade::setFilter(const QString &_filter)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Filter" << _filter;
|
||||
|
||||
@ -153,7 +153,7 @@ QVariantHash ExtUpgrade::run()
|
||||
}
|
||||
|
||||
|
||||
int ExtUpgrade::showConfiguration(const QVariant args)
|
||||
int ExtUpgrade::showConfiguration(const QVariant &args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
|
||||
|
@ -36,23 +36,23 @@ class ExtUpgrade : public AbstractExtItem
|
||||
Q_PROPERTY(int null READ null WRITE setNull)
|
||||
|
||||
public:
|
||||
explicit ExtUpgrade(QWidget *parent, const QString filePath = QString());
|
||||
explicit ExtUpgrade(QWidget *parent, const QString &filePath = QString());
|
||||
virtual ~ExtUpgrade();
|
||||
ExtUpgrade *copy(const QString _fileName, const int _number);
|
||||
ExtUpgrade *copy(const QString &_fileName, const int _number);
|
||||
// get methods
|
||||
QString executable() const;
|
||||
QString filter() const;
|
||||
int null() const;
|
||||
QString uniq() const;
|
||||
// set methods
|
||||
void setExecutable(const QString _executable = QString("/usr/bin/true"));
|
||||
void setFilter(const QString _filter = QString());
|
||||
void setExecutable(const QString &_executable = QString("/usr/bin/true"));
|
||||
void setFilter(const QString &_filter = QString());
|
||||
void setNull(const int _null = 0);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
int showConfiguration(const QVariant &args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "yahooweatherprovider.h"
|
||||
|
||||
|
||||
ExtWeather::ExtWeather(QWidget *parent, const QString filePath)
|
||||
ExtWeather::ExtWeather(QWidget *parent, const QString &filePath)
|
||||
: AbstractExtItem(parent, filePath)
|
||||
, ui(new Ui::ExtWeather)
|
||||
{
|
||||
@ -77,7 +77,7 @@ ExtWeather::~ExtWeather()
|
||||
}
|
||||
|
||||
|
||||
ExtWeather *ExtWeather::copy(const QString _fileName, const int _number)
|
||||
ExtWeather *ExtWeather::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "number" << _number;
|
||||
|
||||
@ -168,7 +168,7 @@ QString ExtWeather::uniq() const
|
||||
}
|
||||
|
||||
|
||||
void ExtWeather::setCity(const QString _city)
|
||||
void ExtWeather::setCity(const QString &_city)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "City" << _city;
|
||||
|
||||
@ -177,7 +177,7 @@ void ExtWeather::setCity(const QString _city)
|
||||
}
|
||||
|
||||
|
||||
void ExtWeather::setCountry(const QString _country)
|
||||
void ExtWeather::setCountry(const QString &_country)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Country" << _country;
|
||||
|
||||
@ -203,7 +203,7 @@ void ExtWeather::setProvider(const Provider _provider)
|
||||
}
|
||||
|
||||
|
||||
void ExtWeather::setStrProvider(const QString _provider)
|
||||
void ExtWeather::setStrProvider(const QString &_provider)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Provider" << _provider;
|
||||
|
||||
@ -278,7 +278,7 @@ QVariantHash ExtWeather::run()
|
||||
}
|
||||
|
||||
|
||||
int ExtWeather::showConfiguration(const QVariant args)
|
||||
int ExtWeather::showConfiguration(const QVariant &args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
|
||||
|
@ -42,9 +42,9 @@ class ExtWeather : public AbstractExtItem
|
||||
public:
|
||||
enum class Provider { OWM = 0, Yahoo = 1 };
|
||||
|
||||
explicit ExtWeather(QWidget *parent, const QString filePath = QString());
|
||||
explicit ExtWeather(QWidget *parent, const QString &filePath = QString());
|
||||
virtual ~ExtWeather();
|
||||
ExtWeather *copy(const QString _fileName, const int _number);
|
||||
ExtWeather *copy(const QString &_fileName, const int _number);
|
||||
QString jsonMapFile() const;
|
||||
QString weatherFromInt(const int _id) const;
|
||||
// get methods
|
||||
@ -56,18 +56,18 @@ public:
|
||||
int ts() const;
|
||||
QString uniq() const;
|
||||
// set methods
|
||||
void setCity(const QString _city = QString("London"));
|
||||
void setCountry(const QString _country = QString("uk"));
|
||||
void setCity(const QString &_city = QString("London"));
|
||||
void setCountry(const QString &_country = QString("uk"));
|
||||
void setImage(const bool _image = false);
|
||||
void setProvider(const Provider _provider = Provider::OWM);
|
||||
void setStrProvider(const QString _provider = QString("OWM"));
|
||||
void setStrProvider(const QString &_provider = QString("OWM"));
|
||||
void setTs(const int _ts = 0);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
void readJsonMap();
|
||||
QVariantHash run();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
int showConfiguration(const QVariant &args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "graphicalitemhelper.h"
|
||||
|
||||
|
||||
GraphicalItem::GraphicalItem(QWidget *parent, const QString filePath)
|
||||
GraphicalItem::GraphicalItem(QWidget *parent, const QString &filePath)
|
||||
: AbstractExtItem(parent, filePath)
|
||||
, ui(new Ui::GraphicalItem)
|
||||
{
|
||||
@ -64,7 +64,7 @@ GraphicalItem::~GraphicalItem()
|
||||
}
|
||||
|
||||
|
||||
GraphicalItem *GraphicalItem::copy(const QString _fileName, const int _number)
|
||||
GraphicalItem *GraphicalItem::copy(const QString &_fileName, const int _number)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
|
||||
|
||||
@ -283,7 +283,7 @@ QString GraphicalItem::uniq() const
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setBar(const QString _bar)
|
||||
void GraphicalItem::setBar(const QString &_bar)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Bar" << _bar;
|
||||
|
||||
@ -291,7 +291,7 @@ void GraphicalItem::setBar(const QString _bar)
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setActiveColor(const QString _color)
|
||||
void GraphicalItem::setActiveColor(const QString &_color)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Color" << _color;
|
||||
|
||||
@ -317,7 +317,7 @@ void GraphicalItem::setCustom(const bool _custom)
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setInactiveColor(const QString _color)
|
||||
void GraphicalItem::setInactiveColor(const QString &_color)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Color" << _color;
|
||||
|
||||
@ -369,7 +369,7 @@ void GraphicalItem::setType(const Type _type)
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setStrType(const QString _type)
|
||||
void GraphicalItem::setStrType(const QString &_type)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Type" << _type;
|
||||
|
||||
@ -394,7 +394,7 @@ void GraphicalItem::setDirection(const Direction _direction)
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setStrDirection(const QString _direction)
|
||||
void GraphicalItem::setStrDirection(const QString &_direction)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Direction" << _direction;
|
||||
|
||||
@ -405,14 +405,14 @@ void GraphicalItem::setStrDirection(const QString _direction)
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setUsedKeys(const QStringList _usedKeys)
|
||||
void GraphicalItem::setUsedKeys(const QStringList &_usedKeys)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Used keys" << _usedKeys;
|
||||
|
||||
// remove dubs
|
||||
// HACK converting to set may break order
|
||||
usedKeys().clear();
|
||||
for (auto key : _usedKeys) {
|
||||
for (auto &key : _usedKeys) {
|
||||
if (usedKeys().contains(key))
|
||||
continue;
|
||||
usedKeys().append(key);
|
||||
@ -460,7 +460,7 @@ void GraphicalItem::readConfiguration()
|
||||
}
|
||||
|
||||
|
||||
int GraphicalItem::showConfiguration(const QVariant args)
|
||||
int GraphicalItem::showConfiguration(const QVariant &args)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Combobox arguments" << args;
|
||||
QStringList tags = args.toStringList();
|
||||
|
@ -58,9 +58,9 @@ public:
|
||||
Bars = 4
|
||||
};
|
||||
|
||||
explicit GraphicalItem(QWidget *parent, const QString filePath = QString());
|
||||
explicit GraphicalItem(QWidget *parent, const QString &filePath = QString());
|
||||
virtual ~GraphicalItem();
|
||||
GraphicalItem *copy(const QString _fileName, const int _number);
|
||||
GraphicalItem *copy(const QString &_fileName, const int _number);
|
||||
QString image(const QVariant &value);
|
||||
void initScene();
|
||||
// get methods
|
||||
@ -80,26 +80,26 @@ public:
|
||||
QStringList usedKeys() const;
|
||||
QString uniq() const;
|
||||
// set methods
|
||||
void setBar(const QString _bar = QString("cpu"));
|
||||
void setActiveColor(const QString _color = QString("color://0,0,0,130"));
|
||||
void setBar(const QString &_bar = QString("cpu"));
|
||||
void setActiveColor(const QString &_color = QString("color://0,0,0,130"));
|
||||
void setCount(const int _count = 100);
|
||||
void setCustom(const bool _custom = false);
|
||||
void setInactiveColor(const QString _color
|
||||
void setInactiveColor(const QString &_color
|
||||
= QString("color://255,255,255,130"));
|
||||
void setItemHeight(const int _height = 100);
|
||||
void setItemWidth(const int _width = 100);
|
||||
void setMinValue(const float _value = 0.0);
|
||||
void setMaxValue(const float _value = 100.0);
|
||||
void setType(const Type _type = Type::Horizontal);
|
||||
void setStrType(const QString _type = QString("Horizontal"));
|
||||
void setStrType(const QString &_type = QString("Horizontal"));
|
||||
void setDirection(const Direction _direction = Direction::LeftToRight);
|
||||
void setStrDirection(const QString _direction = QString("LeftToRight"));
|
||||
void setUsedKeys(const QStringList _usedKeys = QStringList());
|
||||
void setStrDirection(const QString &_direction = QString("LeftToRight"));
|
||||
void setUsedKeys(const QStringList &_usedKeys = QStringList());
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantHash run() { return QVariantHash(); };
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
int showConfiguration(const QVariant &args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
|
@ -41,8 +41,8 @@ GraphicalItemHelper::~GraphicalItemHelper()
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItemHelper::setParameters(const QString active,
|
||||
const QString inactive, const int width,
|
||||
void GraphicalItemHelper::setParameters(const QString &active,
|
||||
const QString &inactive, const int width,
|
||||
const int height, const int count)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Use active color" << active << ", inactive" << inactive
|
||||
@ -81,7 +81,7 @@ void GraphicalItemHelper::setParameters(const QString active,
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItemHelper::paintBars(const float &value)
|
||||
void GraphicalItemHelper::paintBars(const float value)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Paint with value" << value;
|
||||
|
||||
@ -105,7 +105,7 @@ void GraphicalItemHelper::paintBars(const float &value)
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItemHelper::paintCircle(const float &percent)
|
||||
void GraphicalItemHelper::paintCircle(const float percent)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Paint with percent" << percent;
|
||||
|
||||
@ -128,7 +128,7 @@ void GraphicalItemHelper::paintCircle(const float &percent)
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItemHelper::paintGraph(const float &value)
|
||||
void GraphicalItemHelper::paintGraph(const float value)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Paint with value" << value;
|
||||
|
||||
@ -153,7 +153,7 @@ void GraphicalItemHelper::paintGraph(const float &value)
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItemHelper::paintHorizontal(const float &percent)
|
||||
void GraphicalItemHelper::paintHorizontal(const float percent)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Paint with percent" << percent;
|
||||
|
||||
@ -169,7 +169,7 @@ void GraphicalItemHelper::paintHorizontal(const float &percent)
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItemHelper::paintVertical(const float &percent)
|
||||
void GraphicalItemHelper::paintVertical(const float percent)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Paint with percent" << percent;
|
||||
|
||||
@ -184,8 +184,8 @@ void GraphicalItemHelper::paintVertical(const float &percent)
|
||||
}
|
||||
|
||||
|
||||
float GraphicalItemHelper::getPercents(const float &value, const float &min,
|
||||
const float &max)
|
||||
float GraphicalItemHelper::getPercents(const float value, const float min,
|
||||
const float max)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Get percent value from" << value;
|
||||
// newest Qt crashes here if value is nan
|
||||
@ -224,7 +224,7 @@ QColor GraphicalItemHelper::stringToColor(const QString &color)
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItemHelper::storeValue(const float &value)
|
||||
void GraphicalItemHelper::storeValue(const float value)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Save value to array" << value;
|
||||
|
||||
|
@ -34,21 +34,21 @@ public:
|
||||
QGraphicsScene *scene = nullptr);
|
||||
virtual ~GraphicalItemHelper();
|
||||
// parameters
|
||||
void setParameters(const QString active, const QString inactive,
|
||||
void setParameters(const QString &active, const QString &inactive,
|
||||
const int width, const int height, const int count);
|
||||
// paint methods
|
||||
void paintBars(const float &value);
|
||||
void paintCircle(const float &percent);
|
||||
void paintGraph(const float &value);
|
||||
void paintHorizontal(const float &percent);
|
||||
void paintVertical(const float &percent);
|
||||
void paintBars(const float value);
|
||||
void paintCircle(const float percent);
|
||||
void paintGraph(const float value);
|
||||
void paintHorizontal(const float percent);
|
||||
void paintVertical(const float percent);
|
||||
// additional conversion methods
|
||||
float getPercents(const float &value, const float &min, const float &max);
|
||||
float getPercents(const float value, const float min, const float max);
|
||||
bool isColor(const QString &input);
|
||||
QColor stringToColor(const QString &color);
|
||||
|
||||
private:
|
||||
void storeValue(const float &value);
|
||||
void storeValue(const float value);
|
||||
QGraphicsScene *m_scene = nullptr;
|
||||
int m_count = 100;
|
||||
QPen m_activePen;
|
||||
|
@ -36,7 +36,7 @@ OWMWeatherProvider::~OWMWeatherProvider()
|
||||
}
|
||||
|
||||
|
||||
void OWMWeatherProvider::initUrl(const QString city, const QString country,
|
||||
void OWMWeatherProvider::initUrl(const QString &city, const QString &country,
|
||||
const int ts)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Init query for" << city << country << "with ts" << ts;
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
|
||||
explicit OWMWeatherProvider(QObject *parent, const int number);
|
||||
virtual ~OWMWeatherProvider();
|
||||
void initUrl(const QString city, const QString country, const int);
|
||||
void initUrl(const QString &city, const QString &country, const int);
|
||||
QVariantHash parse(const QVariantMap &json) const;
|
||||
QUrl url() const;
|
||||
|
||||
|
@ -147,7 +147,7 @@ QList<int> QCronScheduler::QCronField::toList()
|
||||
return QList<int>();
|
||||
|
||||
QList<int> output;
|
||||
for (auto i = minValue; i <= maxValue; ++i) {
|
||||
for (auto &i = minValue; i <= maxValue; ++i) {
|
||||
if (i % div != 0)
|
||||
continue;
|
||||
output.append(i);
|
||||
|
@ -35,7 +35,7 @@ YahooWeatherProvider::~YahooWeatherProvider()
|
||||
}
|
||||
|
||||
|
||||
void YahooWeatherProvider::initUrl(const QString city, const QString country,
|
||||
void YahooWeatherProvider::initUrl(const QString &city, const QString &country,
|
||||
const int ts)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Init query for" << city << country << "with ts" << ts;
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
|
||||
explicit YahooWeatherProvider(QObject *parent, const int number);
|
||||
virtual ~YahooWeatherProvider();
|
||||
void initUrl(const QString city, const QString country, const int);
|
||||
void initUrl(const QString &city, const QString &country, const int);
|
||||
QVariantHash parse(const QVariantMap &json) const;
|
||||
QUrl url() const;
|
||||
|
||||
|
@ -72,7 +72,7 @@ int DPAdds::currentDesktop() const
|
||||
}
|
||||
|
||||
|
||||
QStringList DPAdds::dictKeys(const bool sorted, const QString regexp) const
|
||||
QStringList DPAdds::dictKeys(const bool sorted, const QString ®exp) const
|
||||
{
|
||||
qCDebug(LOG_DP) << "Should be sorted" << sorted << "and filter applied"
|
||||
<< regexp;
|
||||
@ -123,9 +123,9 @@ QString DPAdds::toolTipImage(const int desktop) const
|
||||
toolTipView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
toolTipView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
// update
|
||||
float margin = 5.0 * info.desktop.width() / 400.0;
|
||||
toolTipView->resize(info.desktop.width() + 2.0 * margin,
|
||||
info.desktop.height() + 2.0 * margin);
|
||||
float margin = 5.0f * info.desktop.width() / 400.0f;
|
||||
toolTipView->resize(info.desktop.width() + 2.0f * margin,
|
||||
info.desktop.height() + 2.0f * margin);
|
||||
toolTipScene->clear();
|
||||
toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
||||
// borders
|
||||
@ -142,7 +142,7 @@ QString DPAdds::toolTipImage(const int desktop) const
|
||||
QPen pen = QPen();
|
||||
pen.setWidthF(2.0 * info.desktop.width() / 400.0);
|
||||
pen.setColor(QColor(m_tooltipColor));
|
||||
for (auto data : info.windowsData) {
|
||||
for (auto &data : info.windowsData) {
|
||||
QRect rect = data.rect;
|
||||
toolTipScene->addLine(rect.left() + margin, rect.bottom() + margin,
|
||||
rect.left() + margin, rect.top() + margin,
|
||||
@ -194,13 +194,13 @@ QString DPAdds::toolTipImage(const int desktop) const
|
||||
}
|
||||
|
||||
|
||||
QString DPAdds::parsePattern(const QString pattern, const int desktop) const
|
||||
QString DPAdds::parsePattern(const QString &pattern, const int desktop) const
|
||||
{
|
||||
qCDebug(LOG_DP) << "Pattern" << pattern << "for desktop" << desktop;
|
||||
|
||||
QString parsed = pattern;
|
||||
parsed.replace(QString("$$"), QString("$\\$\\"));
|
||||
for (auto key : dictKeys())
|
||||
for (auto &key : dictKeys())
|
||||
parsed.replace(QString("$%1").arg(key), valueByKey(key, desktop));
|
||||
parsed.replace(QString("$\\$\\"), QString("$$"));
|
||||
|
||||
@ -208,7 +208,7 @@ QString DPAdds::parsePattern(const QString pattern, const int desktop) const
|
||||
}
|
||||
|
||||
|
||||
void DPAdds::setMark(const QString newMark)
|
||||
void DPAdds::setMark(const QString &newMark)
|
||||
{
|
||||
qCDebug(LOG_DP) << "Mark" << newMark;
|
||||
|
||||
@ -216,7 +216,7 @@ void DPAdds::setMark(const QString newMark)
|
||||
}
|
||||
|
||||
|
||||
void DPAdds::setToolTipData(const QVariantMap tooltipData)
|
||||
void DPAdds::setToolTipData(const QVariantMap &tooltipData)
|
||||
{
|
||||
qCDebug(LOG_DP) << "Data" << tooltipData;
|
||||
|
||||
@ -226,7 +226,7 @@ void DPAdds::setToolTipData(const QVariantMap tooltipData)
|
||||
}
|
||||
|
||||
|
||||
QString DPAdds::infoByKey(QString key) const
|
||||
QString DPAdds::infoByKey(const QString &key) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Requested info for key" << key;
|
||||
|
||||
@ -234,7 +234,7 @@ QString DPAdds::infoByKey(QString key) const
|
||||
}
|
||||
|
||||
|
||||
QString DPAdds::valueByKey(const QString key, int desktop) const
|
||||
QString DPAdds::valueByKey(const QString &key, int desktop) const
|
||||
{
|
||||
qCDebug(LOG_DP) << "Requested key" << key << "for desktop" << desktop;
|
||||
if (desktop == -1)
|
||||
@ -258,7 +258,7 @@ QString DPAdds::valueByKey(const QString key, int desktop) const
|
||||
|
||||
|
||||
// HACK: this method uses variables from version.h
|
||||
QString DPAdds::getAboutText(const QString type) const
|
||||
QString DPAdds::getAboutText(const QString &type) const
|
||||
{
|
||||
qCDebug(LOG_DP) << "Type" << type;
|
||||
|
||||
@ -266,7 +266,7 @@ QString DPAdds::getAboutText(const QString type) const
|
||||
}
|
||||
|
||||
|
||||
QVariantMap DPAdds::getFont(const QVariantMap defaultFont) const
|
||||
QVariantMap DPAdds::getFont(const QVariantMap &defaultFont) const
|
||||
{
|
||||
qCDebug(LOG_DP) << "Default font is" << defaultFont;
|
||||
|
||||
@ -288,7 +288,7 @@ QVariantMap DPAdds::getFont(const QVariantMap defaultFont) const
|
||||
|
||||
|
||||
// to avoid additional object definition this method is static
|
||||
void DPAdds::sendNotification(const QString eventId, const QString message)
|
||||
void DPAdds::sendNotification(const QString &eventId, const QString &message)
|
||||
{
|
||||
qCDebug(LOG_DP) << "Event" << eventId << "with message" << message;
|
||||
|
||||
@ -316,7 +316,7 @@ DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int desktop) const
|
||||
DesktopWindowsInfo info;
|
||||
info.desktop = KWindowSystem::workArea(desktop);
|
||||
|
||||
for (auto id : KWindowSystem::windows()) {
|
||||
for (auto &id : KWindowSystem::windows()) {
|
||||
KWindowInfo winInfo = KWindowInfo(
|
||||
id,
|
||||
NET::Property::WMDesktop | NET::Property::WMGeometry
|
||||
|
@ -46,27 +46,27 @@ public:
|
||||
Q_INVOKABLE bool isDebugEnabled() const;
|
||||
Q_INVOKABLE int currentDesktop() const;
|
||||
Q_INVOKABLE QStringList dictKeys(const bool sorted = true,
|
||||
const QString regexp = QString()) const;
|
||||
const QString ®exp = QString()) const;
|
||||
Q_INVOKABLE int numberOfDesktops() const;
|
||||
Q_INVOKABLE QString toolTipImage(const int desktop) const;
|
||||
Q_INVOKABLE QString parsePattern(const QString pattern,
|
||||
Q_INVOKABLE QString parsePattern(const QString &pattern,
|
||||
const int desktop) const;
|
||||
// values
|
||||
Q_INVOKABLE void setMark(const QString newMark);
|
||||
Q_INVOKABLE void setToolTipData(const QVariantMap tooltipData);
|
||||
Q_INVOKABLE QString infoByKey(QString key) const;
|
||||
Q_INVOKABLE QString valueByKey(const QString key, int desktop = -1) const;
|
||||
Q_INVOKABLE void setMark(const QString &newMark);
|
||||
Q_INVOKABLE void setToolTipData(const QVariantMap &tooltipData);
|
||||
Q_INVOKABLE QString infoByKey(const QString &key) const;
|
||||
Q_INVOKABLE QString valueByKey(const QString &key, int desktop = -1) const;
|
||||
// configuration slots
|
||||
Q_INVOKABLE QString getAboutText(const QString type = "header") const;
|
||||
Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont) const;
|
||||
Q_INVOKABLE QString getAboutText(const QString &type = "header") const;
|
||||
Q_INVOKABLE QVariantMap getFont(const QVariantMap &defaultFont) const;
|
||||
|
||||
signals:
|
||||
void desktopChanged() const;
|
||||
void windowListChanged() const;
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE static void sendNotification(const QString eventId,
|
||||
const QString message);
|
||||
Q_INVOKABLE static void sendNotification(const QString &eventId,
|
||||
const QString &message);
|
||||
Q_INVOKABLE void setCurrentDesktop(const int desktop) const;
|
||||
|
||||
private:
|
||||
|
@ -42,7 +42,7 @@ ExtendedSysMon::ExtendedSysMon(QObject *parent, const QVariantList &args)
|
||||
|
||||
// init aggregator
|
||||
m_aggregator = new ExtSysMonAggregator(this, m_configuration);
|
||||
for (auto source : m_aggregator->sources())
|
||||
for (auto &source : m_aggregator->sources())
|
||||
setData(source, m_aggregator->initialData(source));
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ ExtendedSysMon::updateConfiguration(QHash<QString, QString> rawConfig) const
|
||||
QChar(','), QString::SkipEmptyParts);
|
||||
QStringList devices;
|
||||
QRegExp diskRegexp = QRegExp("^/dev/[hms]d[a-z]$");
|
||||
for (auto device : deviceList)
|
||||
for (auto &device : deviceList)
|
||||
if ((QFile::exists(device)) && (device.contains(diskRegexp)))
|
||||
devices.append(device);
|
||||
if (devices.isEmpty())
|
||||
@ -166,7 +166,7 @@ ExtendedSysMon::updateConfiguration(QHash<QString, QString> rawConfig) const
|
||||
if (rawConfig[QString("PLAYERSYMBOLS")].toInt() <= 0)
|
||||
rawConfig[QString("PLAYERSYMBOLS")] = QString("10");
|
||||
|
||||
for (auto key : rawConfig.keys())
|
||||
for (auto &key : rawConfig.keys())
|
||||
qCInfo(LOG_ESM) << key << "=" << rawConfig[key];
|
||||
return rawConfig;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
|
||||
ExtSysMonAggregator::ExtSysMonAggregator(QObject *parent,
|
||||
const QHash<QString, QString> config)
|
||||
const QHash<QString, QString> &config)
|
||||
: QObject(parent)
|
||||
{
|
||||
qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
|
||||
@ -52,7 +52,7 @@ ExtSysMonAggregator::~ExtSysMonAggregator()
|
||||
}
|
||||
|
||||
|
||||
QVariant ExtSysMonAggregator::data(const QString source) const
|
||||
QVariant ExtSysMonAggregator::data(const QString &source) const
|
||||
{
|
||||
qCDebug(LOG_ESM) << "Source" << source;
|
||||
|
||||
@ -60,7 +60,7 @@ QVariant ExtSysMonAggregator::data(const QString source) const
|
||||
}
|
||||
|
||||
|
||||
bool ExtSysMonAggregator::hasSource(const QString source) const
|
||||
bool ExtSysMonAggregator::hasSource(const QString &source) const
|
||||
{
|
||||
qCDebug(LOG_ESM) << "Source" << source;
|
||||
|
||||
@ -68,7 +68,7 @@ bool ExtSysMonAggregator::hasSource(const QString source) const
|
||||
}
|
||||
|
||||
|
||||
QVariantMap ExtSysMonAggregator::initialData(const QString source) const
|
||||
QVariantMap ExtSysMonAggregator::initialData(const QString &source) const
|
||||
{
|
||||
qCDebug(LOG_ESM) << "Source" << source;
|
||||
|
||||
@ -83,45 +83,45 @@ QStringList ExtSysMonAggregator::sources() const
|
||||
}
|
||||
|
||||
|
||||
void ExtSysMonAggregator::init(const QHash<QString, QString> config)
|
||||
void ExtSysMonAggregator::init(const QHash<QString, QString> &config)
|
||||
{
|
||||
qCDebug(LOG_ESM) << "Configuration" << config;
|
||||
|
||||
// battery
|
||||
AbstractExtSysMonSource *batteryItem
|
||||
= new BatterySource(this, QStringList() << config[QString("ACPIPATH")]);
|
||||
for (auto source : batteryItem->sources())
|
||||
for (auto &source : batteryItem->sources())
|
||||
m_map[source] = batteryItem;
|
||||
// custom
|
||||
AbstractExtSysMonSource *customItem = new CustomSource(this, QStringList());
|
||||
for (auto source : customItem->sources())
|
||||
for (auto &source : customItem->sources())
|
||||
m_map[source] = customItem;
|
||||
// desktop
|
||||
AbstractExtSysMonSource *desktopItem
|
||||
= new DesktopSource(this, QStringList());
|
||||
for (auto source : desktopItem->sources())
|
||||
for (auto &source : desktopItem->sources())
|
||||
m_map[source] = desktopItem;
|
||||
// gpu load
|
||||
AbstractExtSysMonSource *gpuLoadItem
|
||||
= new GPULoadSource(this, QStringList() << config[QString("GPUDEV")]);
|
||||
for (auto source : gpuLoadItem->sources())
|
||||
for (auto &source : gpuLoadItem->sources())
|
||||
m_map[source] = gpuLoadItem;
|
||||
// gpu temperature
|
||||
AbstractExtSysMonSource *gpuTempItem = new GPUTemperatureSource(
|
||||
this, QStringList() << config[QString("GPUDEV")]);
|
||||
for (auto source : gpuTempItem->sources())
|
||||
for (auto &source : gpuTempItem->sources())
|
||||
m_map[source] = gpuTempItem;
|
||||
// hdd temperature
|
||||
AbstractExtSysMonSource *hddTempItem = new HDDTemperatureSource(
|
||||
this,
|
||||
QStringList() << config[QString("HDDDEV")]
|
||||
<< config[QString("HDDTEMPCMD")]);
|
||||
for (auto source : hddTempItem->sources())
|
||||
for (auto &source : hddTempItem->sources())
|
||||
m_map[source] = hddTempItem;
|
||||
// network
|
||||
AbstractExtSysMonSource *networkItem
|
||||
= new NetworkSource(this, QStringList());
|
||||
for (auto source : networkItem->sources())
|
||||
for (auto &source : networkItem->sources())
|
||||
m_map[source] = networkItem;
|
||||
// player
|
||||
AbstractExtSysMonSource *playerItem = new PlayerSource(
|
||||
@ -130,36 +130,36 @@ void ExtSysMonAggregator::init(const QHash<QString, QString> config)
|
||||
<< config[QString("MPDADDRESS")]
|
||||
<< config[QString("MPDPORT")] << config[QString("MPRIS")]
|
||||
<< config[QString("PLAYERSYMBOLS")]);
|
||||
for (auto source : playerItem->sources())
|
||||
for (auto &source : playerItem->sources())
|
||||
m_map[source] = playerItem;
|
||||
// processes
|
||||
AbstractExtSysMonSource *processesItem
|
||||
= new ProcessesSource(this, QStringList());
|
||||
for (auto source : processesItem->sources())
|
||||
for (auto &source : processesItem->sources())
|
||||
m_map[source] = processesItem;
|
||||
// network request
|
||||
AbstractExtSysMonSource *requestItem
|
||||
= new RequestSource(this, QStringList());
|
||||
for (auto source : requestItem->sources())
|
||||
for (auto &source : requestItem->sources())
|
||||
m_map[source] = requestItem;
|
||||
// quotes
|
||||
AbstractExtSysMonSource *quotesItem = new QuotesSource(this, QStringList());
|
||||
for (auto source : quotesItem->sources())
|
||||
for (auto &source : quotesItem->sources())
|
||||
m_map[source] = quotesItem;
|
||||
// upgrade
|
||||
AbstractExtSysMonSource *upgradeItem
|
||||
= new UpgradeSource(this, QStringList());
|
||||
for (auto source : upgradeItem->sources())
|
||||
for (auto &source : upgradeItem->sources())
|
||||
m_map[source] = upgradeItem;
|
||||
// weather
|
||||
AbstractExtSysMonSource *weatherItem
|
||||
= new WeatherSource(this, QStringList());
|
||||
for (auto source : weatherItem->sources())
|
||||
for (auto &source : weatherItem->sources())
|
||||
m_map[source] = weatherItem;
|
||||
#ifdef BUILD_LOAD
|
||||
// additional load source
|
||||
AbstractExtSysMonSource *loadItem = new LoadSource(this, QStringList());
|
||||
for (auto source : loadItem->sources())
|
||||
for (auto &source : loadItem->sources())
|
||||
m_map[source] = loadItem;
|
||||
#endif /* BUILD_LOAD */
|
||||
}
|
||||
|
@ -29,15 +29,15 @@ class ExtSysMonAggregator : public QObject
|
||||
|
||||
public:
|
||||
explicit ExtSysMonAggregator(QObject *parent,
|
||||
const QHash<QString, QString> config);
|
||||
const QHash<QString, QString> &config);
|
||||
virtual ~ExtSysMonAggregator();
|
||||
QVariant data(const QString source) const;
|
||||
bool hasSource(const QString source) const;
|
||||
QVariantMap initialData(const QString source) const;
|
||||
QVariant data(const QString &source) const;
|
||||
bool hasSource(const QString &source) const;
|
||||
QVariantMap initialData(const QString &source) const;
|
||||
QStringList sources() const;
|
||||
|
||||
private:
|
||||
void init(const QHash<QString, QString> config);
|
||||
void init(const QHash<QString, QString> &config);
|
||||
QHash<QString, AbstractExtSysMonSource *> m_map;
|
||||
};
|
||||
|
||||
|
@ -28,15 +28,15 @@ class AbstractExtSysMonSource : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AbstractExtSysMonSource(QObject *parent, const QStringList)
|
||||
explicit AbstractExtSysMonSource(QObject *parent, const QStringList &)
|
||||
: QObject(parent){};
|
||||
virtual ~AbstractExtSysMonSource(){};
|
||||
virtual QVariant data(QString source) = 0;
|
||||
virtual QVariantMap initialData(QString source) const = 0;
|
||||
virtual QVariant data(const QString &source) = 0;
|
||||
virtual QVariantMap initialData(const QString &source) const = 0;
|
||||
virtual void run() = 0;
|
||||
virtual QStringList sources() const = 0;
|
||||
// used by extensions
|
||||
int index(const QString source) const
|
||||
int index(const QString &source) const
|
||||
{
|
||||
QRegExp rx(QString("\\d+"));
|
||||
rx.indexIn(source);
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
BatterySource::BatterySource(QObject *parent, const QStringList args)
|
||||
BatterySource::BatterySource(QObject *parent, const QStringList &args)
|
||||
: AbstractExtSysMonSource(parent, args)
|
||||
{
|
||||
Q_ASSERT(args.count() == 1);
|
||||
@ -59,7 +59,7 @@ QStringList BatterySource::getSources()
|
||||
}
|
||||
|
||||
|
||||
QVariant BatterySource::data(QString source)
|
||||
QVariant BatterySource::data(const QString &source)
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
@ -70,7 +70,7 @@ QVariant BatterySource::data(QString source)
|
||||
}
|
||||
|
||||
|
||||
QVariantMap BatterySource::initialData(QString source) const
|
||||
QVariantMap BatterySource::initialData(const QString &source) const
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
|
@ -28,11 +28,11 @@ class BatterySource : public AbstractExtSysMonSource
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BatterySource(QObject *parent, const QStringList args);
|
||||
explicit BatterySource(QObject *parent, const QStringList &args);
|
||||
virtual ~BatterySource();
|
||||
QStringList getSources();
|
||||
QVariant data(QString source);
|
||||
QVariantMap initialData(QString source) const;
|
||||
QVariant data(const QString &source);
|
||||
QVariantMap initialData(const QString &source) const;
|
||||
void run();
|
||||
QStringList sources() const;
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "extscript.h"
|
||||
|
||||
|
||||
CustomSource::CustomSource(QObject *parent, const QStringList args)
|
||||
CustomSource::CustomSource(QObject *parent, const QStringList &args)
|
||||
: AbstractExtSysMonSource(parent, args)
|
||||
{
|
||||
Q_ASSERT(args.count() == 0);
|
||||
@ -43,7 +43,7 @@ CustomSource::~CustomSource()
|
||||
}
|
||||
|
||||
|
||||
QVariant CustomSource::data(QString source)
|
||||
QVariant CustomSource::data(const QString &source)
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
@ -52,7 +52,7 @@ QVariant CustomSource::data(QString source)
|
||||
}
|
||||
|
||||
|
||||
QVariantMap CustomSource::initialData(QString source) const
|
||||
QVariantMap CustomSource::initialData(const QString &source) const
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
@ -78,7 +78,7 @@ QStringList CustomSource::sources() const
|
||||
QStringList CustomSource::getSources()
|
||||
{
|
||||
QStringList sources;
|
||||
for (auto item : m_extScripts->activeItems())
|
||||
for (auto &item : m_extScripts->activeItems())
|
||||
sources.append(QString("custom/%1").arg(item->tag(QString("custom"))));
|
||||
|
||||
return sources;
|
||||
|
@ -31,10 +31,10 @@ class CustomSource : public AbstractExtSysMonSource
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CustomSource(QObject *parent, const QStringList args);
|
||||
explicit CustomSource(QObject *parent, const QStringList &args);
|
||||
virtual ~CustomSource();
|
||||
QVariant data(QString source);
|
||||
QVariantMap initialData(QString source) const;
|
||||
QVariant data(const QString &source);
|
||||
QVariantMap initialData(const QString &source) const;
|
||||
void run(){};
|
||||
QStringList sources() const;
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
DesktopSource::DesktopSource(QObject *parent, const QStringList args)
|
||||
DesktopSource::DesktopSource(QObject *parent, const QStringList &args)
|
||||
: AbstractExtSysMonSource(parent, args)
|
||||
{
|
||||
Q_ASSERT(args.count() == 0);
|
||||
@ -37,7 +37,7 @@ DesktopSource::~DesktopSource()
|
||||
}
|
||||
|
||||
|
||||
QVariant DesktopSource::data(QString source)
|
||||
QVariant DesktopSource::data(const QString &source)
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
@ -61,7 +61,7 @@ QVariant DesktopSource::data(QString source)
|
||||
}
|
||||
|
||||
|
||||
QVariantMap DesktopSource::initialData(QString source) const
|
||||
QVariantMap DesktopSource::initialData(const QString &source) const
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
|
@ -28,10 +28,10 @@ class DesktopSource : public AbstractExtSysMonSource
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DesktopSource(QObject *parent, const QStringList args);
|
||||
explicit DesktopSource(QObject *parent, const QStringList &args);
|
||||
virtual ~DesktopSource();
|
||||
QVariant data(QString source);
|
||||
QVariantMap initialData(QString source) const;
|
||||
QVariant data(const QString &source);
|
||||
QVariantMap initialData(const QString &source) const;
|
||||
void run(){};
|
||||
QStringList sources() const;
|
||||
};
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
GPULoadSource::GPULoadSource(QObject *parent, const QStringList args)
|
||||
GPULoadSource::GPULoadSource(QObject *parent, const QStringList &args)
|
||||
: AbstractExtSysMonSource(parent, args)
|
||||
{
|
||||
Q_ASSERT(args.count() == 1);
|
||||
@ -74,7 +74,7 @@ QString GPULoadSource::autoGpu()
|
||||
}
|
||||
|
||||
|
||||
QVariant GPULoadSource::data(QString source)
|
||||
QVariant GPULoadSource::data(const QString &source)
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
@ -85,7 +85,7 @@ QVariant GPULoadSource::data(QString source)
|
||||
}
|
||||
|
||||
|
||||
QVariantMap GPULoadSource::initialData(QString source) const
|
||||
QVariantMap GPULoadSource::initialData(const QString &source) const
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
@ -138,7 +138,7 @@ void GPULoadSource::updateValue()
|
||||
qCInfo(LOG_ESS) << "Output" << qoutput;
|
||||
|
||||
if (m_device == QString("nvidia")) {
|
||||
for (auto str : qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
|
||||
for (auto &str : qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
|
||||
if (!str.contains(QString("<gpu_util>")))
|
||||
continue;
|
||||
QString load = str.remove(QString("<gpu_util>"))
|
||||
@ -148,7 +148,7 @@ void GPULoadSource::updateValue()
|
||||
break;
|
||||
}
|
||||
} else if (m_device == QString("ati")) {
|
||||
for (auto str : qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
|
||||
for (auto &str : qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
|
||||
if (!str.contains(QString("load")))
|
||||
continue;
|
||||
QString load
|
||||
|
@ -30,11 +30,11 @@ class GPULoadSource : public AbstractExtSysMonSource
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GPULoadSource(QObject *parent, const QStringList args);
|
||||
explicit GPULoadSource(QObject *parent, const QStringList &args);
|
||||
virtual ~GPULoadSource();
|
||||
static QString autoGpu();
|
||||
QVariant data(QString source);
|
||||
QVariantMap initialData(QString source) const;
|
||||
QVariant data(const QString &source);
|
||||
QVariantMap initialData(const QString &source) const;
|
||||
void run();
|
||||
QStringList sources() const;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
|
||||
GPUTemperatureSource::GPUTemperatureSource(QObject *parent,
|
||||
const QStringList args)
|
||||
const QStringList &args)
|
||||
: AbstractExtSysMonSource(parent, args)
|
||||
{
|
||||
Q_ASSERT(args.count() == 1);
|
||||
@ -75,7 +75,7 @@ QString GPUTemperatureSource::autoGpu()
|
||||
}
|
||||
|
||||
|
||||
QVariant GPUTemperatureSource::data(QString source)
|
||||
QVariant GPUTemperatureSource::data(const QString &source)
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
@ -86,7 +86,7 @@ QVariant GPUTemperatureSource::data(QString source)
|
||||
}
|
||||
|
||||
|
||||
QVariantMap GPUTemperatureSource::initialData(QString source) const
|
||||
QVariantMap GPUTemperatureSource::initialData(const QString &source) const
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
@ -139,7 +139,7 @@ void GPUTemperatureSource::updateValue()
|
||||
qCInfo(LOG_ESS) << "Output" << qoutput;
|
||||
|
||||
if (m_device == QString("nvidia")) {
|
||||
for (auto str : qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
|
||||
for (auto &str : qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
|
||||
if (!str.contains(QString("<gpu_temp>")))
|
||||
continue;
|
||||
QString temp = str.remove(QString("<gpu_temp>"))
|
||||
@ -148,7 +148,7 @@ void GPUTemperatureSource::updateValue()
|
||||
break;
|
||||
}
|
||||
} else if (m_device == QString("ati")) {
|
||||
for (auto str : qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
|
||||
for (auto &str : qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
|
||||
if (!str.contains(QString("Temperature")))
|
||||
continue;
|
||||
QString temp = str.split(QChar(' '), QString::SkipEmptyParts).at(4);
|
||||
|
@ -30,11 +30,11 @@ class GPUTemperatureSource : public AbstractExtSysMonSource
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GPUTemperatureSource(QObject *parent, const QStringList args);
|
||||
explicit GPUTemperatureSource(QObject *parent, const QStringList &args);
|
||||
virtual ~GPUTemperatureSource();
|
||||
static QString autoGpu();
|
||||
QVariant data(QString source);
|
||||
QVariantMap initialData(QString source) const;
|
||||
QVariant data(const QString &source);
|
||||
QVariantMap initialData(const QString &source) const;
|
||||
void run();
|
||||
QStringList sources() const;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
|
||||
HDDTemperatureSource::HDDTemperatureSource(QObject *parent,
|
||||
const QStringList args)
|
||||
const QStringList &args)
|
||||
: AbstractExtSysMonSource(parent, args)
|
||||
{
|
||||
Q_ASSERT(args.count() == 2);
|
||||
@ -38,7 +38,7 @@ HDDTemperatureSource::HDDTemperatureSource(QObject *parent,
|
||||
m_smartctl = m_cmd.contains(QString("smartctl"));
|
||||
qCInfo(LOG_ESS) << "Parse as smartctl" << m_smartctl;
|
||||
|
||||
for (auto device : m_devices) {
|
||||
for (auto &device : m_devices) {
|
||||
m_processes[device] = new QProcess(nullptr);
|
||||
// fucking magic from http://doc.qt.io/qt-5/qprocess.html#finished
|
||||
connect(m_processes[device],
|
||||
@ -56,7 +56,7 @@ HDDTemperatureSource::~HDDTemperatureSource()
|
||||
{
|
||||
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
|
||||
|
||||
for (auto device : m_devices) {
|
||||
for (auto &device : m_devices) {
|
||||
m_processes[device]->kill();
|
||||
m_processes[device]->deleteLater();
|
||||
}
|
||||
@ -76,11 +76,12 @@ QStringList HDDTemperatureSource::allHdd()
|
||||
}
|
||||
|
||||
|
||||
QVariant HDDTemperatureSource::data(QString source)
|
||||
QVariant HDDTemperatureSource::data(const QString &source)
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
QString device = source.remove(QString("hdd/temperature"));
|
||||
QString device = source;
|
||||
device.remove("hdd/temperature");
|
||||
// run cmd
|
||||
if (m_processes[device]->state() == QProcess::NotRunning)
|
||||
m_processes[device]->start(QString("%1 %2").arg(m_cmd).arg(device));
|
||||
@ -89,11 +90,12 @@ QVariant HDDTemperatureSource::data(QString source)
|
||||
}
|
||||
|
||||
|
||||
QVariantMap HDDTemperatureSource::initialData(QString source) const
|
||||
QVariantMap HDDTemperatureSource::initialData(const QString &source) const
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
QString device = source.remove(QString("hdd/temperature"));
|
||||
QString device = source;
|
||||
device.remove("hdd/temperature");
|
||||
QVariantMap data;
|
||||
data[QString("min")] = 0.0;
|
||||
data[QString("max")] = 0.0;
|
||||
@ -108,7 +110,7 @@ QVariantMap HDDTemperatureSource::initialData(QString source) const
|
||||
QStringList HDDTemperatureSource::sources() const
|
||||
{
|
||||
QStringList sources;
|
||||
for (auto device : m_devices)
|
||||
for (auto &device : m_devices)
|
||||
sources.append(QString("hdd/temperature%1").arg(device));
|
||||
|
||||
return sources;
|
||||
@ -134,7 +136,7 @@ void HDDTemperatureSource::updateValue(const QString &device)
|
||||
// parse
|
||||
if (m_smartctl) {
|
||||
QStringList lines = qoutput.split(QChar('\n'), QString::SkipEmptyParts);
|
||||
for (auto str : lines) {
|
||||
for (auto &str : lines) {
|
||||
if (!str.startsWith(QString("194")))
|
||||
continue;
|
||||
if (str.split(QChar(' '), QString::SkipEmptyParts).count() < 9)
|
||||
|
@ -30,11 +30,11 @@ class HDDTemperatureSource : public AbstractExtSysMonSource
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit HDDTemperatureSource(QObject *parent, const QStringList args);
|
||||
explicit HDDTemperatureSource(QObject *parent, const QStringList &args);
|
||||
virtual ~HDDTemperatureSource();
|
||||
static QStringList allHdd();
|
||||
QVariant data(QString source);
|
||||
QVariantMap initialData(QString source) const;
|
||||
QVariant data(const QString &source);
|
||||
QVariantMap initialData(const QString &source) const;
|
||||
void run(){};
|
||||
QStringList sources() const;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
LoadSource::LoadSource(QObject *parent, const QStringList args)
|
||||
LoadSource::LoadSource(QObject *parent, const QStringList &args)
|
||||
: AbstractExtSysMonSource(parent, args)
|
||||
{
|
||||
Q_ASSERT(args.count() == 0);
|
||||
@ -35,16 +35,17 @@ LoadSource::~LoadSource()
|
||||
}
|
||||
|
||||
|
||||
QVariant LoadSource::data(QString source)
|
||||
QVariant LoadSource::data(const QString &source)
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
source.remove(QString("load/load"));
|
||||
return source.toInt();
|
||||
auto data = source;
|
||||
data.remove("load/load");
|
||||
return data.toInt();
|
||||
}
|
||||
|
||||
|
||||
QVariantMap LoadSource::initialData(QString source) const
|
||||
QVariantMap LoadSource::initialData(const QString &source) const
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
|
@ -28,10 +28,10 @@ class LoadSource : public AbstractExtSysMonSource
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LoadSource(QObject *parent, const QStringList args);
|
||||
explicit LoadSource(QObject *parent, const QStringList &args);
|
||||
virtual ~LoadSource();
|
||||
QVariant data(QString source);
|
||||
QVariantMap initialData(QString source) const;
|
||||
QVariant data(const QString &source);
|
||||
QVariantMap initialData(const QString &source) const;
|
||||
void run(){};
|
||||
QStringList sources() const;
|
||||
};
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
NetworkSource::NetworkSource(QObject *parent, const QStringList args)
|
||||
NetworkSource::NetworkSource(QObject *parent, const QStringList &args)
|
||||
: AbstractExtSysMonSource(parent, args)
|
||||
{
|
||||
Q_ASSERT(args.count() == 0);
|
||||
@ -37,7 +37,7 @@ NetworkSource::~NetworkSource()
|
||||
}
|
||||
|
||||
|
||||
QVariant NetworkSource::data(QString source)
|
||||
QVariant NetworkSource::data(const QString &source)
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
@ -46,7 +46,7 @@ QVariant NetworkSource::data(QString source)
|
||||
QList<QNetworkInterface> rawInterfaceList
|
||||
= QNetworkInterface::allInterfaces();
|
||||
qCInfo(LOG_ESS) << "Devices" << rawInterfaceList;
|
||||
for (auto interface : rawInterfaceList) {
|
||||
for (auto &interface : rawInterfaceList) {
|
||||
if ((interface.flags().testFlag(QNetworkInterface::IsLoopBack))
|
||||
|| (interface.flags().testFlag(
|
||||
QNetworkInterface::IsPointToPoint)))
|
||||
@ -63,7 +63,7 @@ QVariant NetworkSource::data(QString source)
|
||||
}
|
||||
|
||||
|
||||
QVariantMap NetworkSource::initialData(QString source) const
|
||||
QVariantMap NetworkSource::initialData(const QString &source) const
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
|
@ -28,10 +28,10 @@ class NetworkSource : public AbstractExtSysMonSource
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NetworkSource(QObject *parent, const QStringList args);
|
||||
explicit NetworkSource(QObject *parent, const QStringList &args);
|
||||
virtual ~NetworkSource();
|
||||
QVariant data(QString source);
|
||||
QVariantMap initialData(QString source) const;
|
||||
QVariant data(const QString &source);
|
||||
QVariantMap initialData(const QString &source) const;
|
||||
void run(){};
|
||||
QStringList sources() const;
|
||||
};
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "awdebug.h"
|
||||
|
||||
|
||||
PlayerSource::PlayerSource(QObject *parent, const QStringList args)
|
||||
PlayerSource::PlayerSource(QObject *parent, const QStringList &args)
|
||||
: AbstractExtSysMonSource(parent, args)
|
||||
{
|
||||
Q_ASSERT(args.count() == 5);
|
||||
@ -58,7 +58,7 @@ PlayerSource::~PlayerSource()
|
||||
}
|
||||
|
||||
|
||||
QVariant PlayerSource::data(QString source)
|
||||
QVariant PlayerSource::data(const QString &source)
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
@ -77,7 +77,7 @@ QString PlayerSource::getAutoMpris() const
|
||||
return QString();
|
||||
QStringList arguments = listServices.arguments().first().toStringList();
|
||||
|
||||
for (auto arg : arguments) {
|
||||
for (auto &arg : arguments) {
|
||||
if (!arg.startsWith(QString("org.mpris.MediaPlayer2.")))
|
||||
continue;
|
||||
qCInfo(LOG_ESS) << "Service found" << arg;
|
||||
@ -90,7 +90,7 @@ QString PlayerSource::getAutoMpris() const
|
||||
}
|
||||
|
||||
|
||||
QVariantMap PlayerSource::initialData(QString source) const
|
||||
QVariantMap PlayerSource::initialData(const QString &source) const
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << source;
|
||||
|
||||
@ -276,7 +276,7 @@ void PlayerSource::mpdSocketReadyRead()
|
||||
qCInfo(LOG_ESS) << "Output" << qoutput;
|
||||
|
||||
// parse
|
||||
for (auto str : qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
|
||||
for (auto &str : qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
|
||||
if (str.split(QString(": "), QString::SkipEmptyParts).count() == 2) {
|
||||
// "Metadata: data"
|
||||
QString metadata = str.split(QString(": "), QString::SkipEmptyParts)
|
||||
@ -337,7 +337,7 @@ QVariantHash PlayerSource::getPlayerMpdInfo()
|
||||
}
|
||||
|
||||
|
||||
QVariantHash PlayerSource::getPlayerMprisInfo(const QString mpris) const
|
||||
QVariantHash PlayerSource::getPlayerMprisInfo(const QString &mpris) const
|
||||
{
|
||||
qCDebug(LOG_ESS) << "MPRIS" << mpris;
|
||||
|
||||
|
@ -34,11 +34,11 @@ class PlayerSource : public AbstractExtSysMonSource
|
||||
public:
|
||||
const char *MPD_STATUS_REQUEST = "currentsong\nstatus\n";
|
||||
|
||||
explicit PlayerSource(QObject *parent, const QStringList args);
|
||||
explicit PlayerSource(QObject *parent, const QStringList &args);
|
||||
virtual ~PlayerSource();
|
||||
QVariant data(QString source);
|
||||
QVariant data(const QString &source);
|
||||
QString getAutoMpris() const;
|
||||
QVariantMap initialData(QString source) const;
|
||||
QVariantMap initialData(const QString &source) const;
|
||||
void run();
|
||||
QStringList sources() const;
|
||||
// additional method to build dynamic tags
|
||||
@ -56,7 +56,7 @@ private slots:
|
||||
private:
|
||||
inline QVariantHash defaultInfo() const;
|
||||
QVariantHash getPlayerMpdInfo();
|
||||
QVariantHash getPlayerMprisInfo(const QString mpris) const;
|
||||
QVariantHash getPlayerMprisInfo(const QString &mpris) const;
|
||||
QTcpSocket m_mpdSocket;
|
||||
// configuration and values
|
||||
QString m_mpdAddress;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user