From 301a908aed18b5078de4659d22d8cace1339337f Mon Sep 17 00:00:00 2001 From: arcan1s Date: Sun, 15 May 2016 01:18:18 +0300 Subject: [PATCH] add formatter configuration to ui --- .../package/contents/ui/widget.qml | 10 +- .../plugin/awabstractselector.cpp | 76 +++++++++ .../plugin/awabstractselector.h | 49 ++++++ .../plugin/awabstractselector.ui | 36 ++++ .../awesome-widget/plugin/awesomewidget.cpp | 5 +- .../plugin/awformatterconfig.cpp | 159 ++++++++++++++++++ .../awesome-widget/plugin/awformatterconfig.h | 61 +++++++ .../plugin/awformatterconfig.ui | 93 ++++++++++ .../plugin/awformatterconfigfactory.cpp | 42 +++++ .../plugin/awformatterconfigfactory.h | 38 +++++ .../plugin/awformatterhelper.cpp | 31 ++-- .../awesome-widget/plugin/awformatterhelper.h | 8 +- .../awesome-widget/plugin/awkeyoperations.cpp | 15 +- sources/desktop-panel/plugin/dpadds.cpp | 16 +- sources/extsysmon/extsysmon.cpp | 4 +- 15 files changed, 604 insertions(+), 39 deletions(-) create mode 100644 sources/awesome-widget/plugin/awabstractselector.cpp create mode 100644 sources/awesome-widget/plugin/awabstractselector.h create mode 100644 sources/awesome-widget/plugin/awabstractselector.ui create mode 100644 sources/awesome-widget/plugin/awformatterconfig.cpp create mode 100644 sources/awesome-widget/plugin/awformatterconfig.h create mode 100644 sources/awesome-widget/plugin/awformatterconfig.ui create mode 100644 sources/awesome-widget/plugin/awformatterconfigfactory.cpp create mode 100644 sources/awesome-widget/plugin/awformatterconfigfactory.h diff --git a/sources/awesome-widget/package/contents/ui/widget.qml b/sources/awesome-widget/package/contents/ui/widget.qml index 86da37c..62c4900 100644 --- a/sources/awesome-widget/package/contents/ui/widget.qml +++ b/sources/awesome-widget/package/contents/ui/widget.qml @@ -31,6 +31,9 @@ Item { AWActions { id: awActions } + AWFormatterConfigFactory { + id: awFormatter + } width: childrenRect.width height: childrenRect.height @@ -320,10 +323,15 @@ Item { height: implicitHeight width: parent.width QtControls.Button { - width: parent.width * 3 / 5 + width: parent.width * 3 / 10 text: i18n("Edit bars") onClicked: awKeys.editItem("graphicalitem") } + QtControls.Button { + width: parent.width * 3 / 10 + text: i18n("Formatters") + onClicked: awFormatter.showDialog(awKeys.dictKeys(true)) + } QtControls.Button { width: parent.width * 2 / 5 text: i18n("Preview") diff --git a/sources/awesome-widget/plugin/awabstractselector.cpp b/sources/awesome-widget/plugin/awabstractselector.cpp new file mode 100644 index 0000000..46215ac --- /dev/null +++ b/sources/awesome-widget/plugin/awabstractselector.cpp @@ -0,0 +1,76 @@ +/*************************************************************************** + * This file is part of awesome-widgets * + * * + * awesome-widgets is free software: you can redistribute it and/or * + * modify it under the terms of the GNU General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * awesome-widgets is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + +#include "awabstractselector.h" +#include "ui_awabstractselector.h" + +#include "awdebug.h" + + +AWAbstractSelector::AWAbstractSelector(QWidget *parent) + : QWidget(parent) + , ui(new Ui::AWAbstractSelector) +{ + qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + + ui->setupUi(this); + + connect(ui->comboBox_key, SIGNAL(currentIndexChanged(int)), this, + SIGNAL(selectionChanged())); + connect(ui->comboBox_value, SIGNAL(currentIndexChanged(int)), this, + SIGNAL(selectionChanged())); +} + + +AWAbstractSelector::~AWAbstractSelector() +{ + qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + + delete ui; +} + + +QPair AWAbstractSelector::current() const +{ + QString key = ui->comboBox_key->currentText(); + QString value = ui->comboBox_value->currentText(); + + return QPair(key, value); +} + + +void AWAbstractSelector::init(const QStringList keys, const QStringList values, + const QPair current) +{ + if ((!keys.contains(current.first)) || (!values.contains(current.second))) { + qCWarning(LOG_AW) << "Invalid current value" << current + << "not found in default ones"; + return; + } + qCDebug(LOG_AW) << "Init selector with keys" << keys << "and values" + << values << "and current ones are" << current; + + // set data + ui->comboBox_key->clear(); + ui->comboBox_key->addItems(keys); + ui->comboBox_value->clear(); + ui->comboBox_value->addItems(values); + + // set current values + ui->comboBox_key->setCurrentText(current.first); + ui->comboBox_value->setCurrentText(current.second); +} diff --git a/sources/awesome-widget/plugin/awabstractselector.h b/sources/awesome-widget/plugin/awabstractselector.h new file mode 100644 index 0000000..2dbc926 --- /dev/null +++ b/sources/awesome-widget/plugin/awabstractselector.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * This file is part of awesome-widgets * + * * + * awesome-widgets is free software: you can redistribute it and/or * + * modify it under the terms of the GNU General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * awesome-widgets is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + + +#ifndef AWABSTRACTSELECTOR_H +#define AWABSTRACTSELECTOR_H + +#include + + +namespace Ui +{ +class AWAbstractSelector; +} + +class AWAbstractSelector : public QWidget +{ + Q_OBJECT + +public: + explicit AWAbstractSelector(QWidget *parent = nullptr); + virtual ~AWAbstractSelector(); + QPair current() const; + void init(const QStringList keys, const QStringList values, + const QPair current); + +signals: + void selectionChanged(); + +private: + Ui::AWAbstractSelector *ui = nullptr; +}; + + +#endif /* AWABSTRACTSELECTOR_H */ diff --git a/sources/awesome-widget/plugin/awabstractselector.ui b/sources/awesome-widget/plugin/awabstractselector.ui new file mode 100644 index 0000000..a871fa1 --- /dev/null +++ b/sources/awesome-widget/plugin/awabstractselector.ui @@ -0,0 +1,36 @@ + + + AWAbstractSelector + + + + 0 + 0 + 400 + 25 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + + + diff --git a/sources/awesome-widget/plugin/awesomewidget.cpp b/sources/awesome-widget/plugin/awesomewidget.cpp index 4235ed5..e327c47 100644 --- a/sources/awesome-widget/plugin/awesomewidget.cpp +++ b/sources/awesome-widget/plugin/awesomewidget.cpp @@ -21,7 +21,7 @@ #include "awactions.h" #include "awconfighelper.h" -#include "awformatterhelper.h" +#include "awformatterconfigfactory.h" #include "awkeys.h" @@ -31,6 +31,7 @@ void AWPlugin::registerTypes(const char *uri) qmlRegisterType(uri, 1, 0, "AWActions"); qmlRegisterType(uri, 1, 0, "AWConfigHelper"); - qmlRegisterType(uri, 1, 0, "AWFormatterHelper"); + qmlRegisterType(uri, 1, 0, + "AWFormatterConfigFactory"); qmlRegisterType(uri, 1, 0, "AWKeys"); } diff --git a/sources/awesome-widget/plugin/awformatterconfig.cpp b/sources/awesome-widget/plugin/awformatterconfig.cpp new file mode 100644 index 0000000..d4dd856 --- /dev/null +++ b/sources/awesome-widget/plugin/awformatterconfig.cpp @@ -0,0 +1,159 @@ +/*************************************************************************** + * This file is part of awesome-widgets * + * * + * awesome-widgets is free software: you can redistribute it and/or * + * modify it under the terms of the GNU General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * awesome-widgets is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + +#include "awformatterconfig.h" +#include "ui_awformatterconfig.h" + +#include + +#include "awabstractselector.h" +#include "awdebug.h" +#include "awformatterhelper.h" + + +AWFormatterConfig::AWFormatterConfig(QWidget *parent, const QStringList keys) + : QDialog(parent) + , ui(new Ui::AWFormatterConfig) + , m_keys(keys) +{ + qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + + ui->setupUi(this); + init(); + + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept())); + connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject())); +} + + +AWFormatterConfig::~AWFormatterConfig() +{ + qCDebug(LOG_AW) << __PRETTY_FUNCTION__; + + clearSelectors(); + + delete m_helper; + delete ui; +} + + +void AWFormatterConfig::showDialog() +{ + clearSelectors(); + QHash appliedFormatters = m_helper->getFormatters(); + auto keys = initKeys(); + + for (auto key : appliedFormatters.keys()) + addSelector(keys.first, keys.second, + QPair(key, appliedFormatters[key])); + // empty one + addSelector(keys.first, keys.second, QPair()); + + // exec dialog + return execDialog(); +} + + +void AWFormatterConfig::updateUi() +{ + QPair current + = static_cast(sender())->current(); + int index + = m_selectors.indexOf(static_cast(sender())); + + if ((current.first.isEmpty()) && (current.second.isEmpty())) { + if (sender() == m_selectors.last()) + return; + AWAbstractSelector *selector = m_selectors.takeAt(index); + ui->verticalLayout->removeWidget(selector); + selector->deleteLater(); + } else { + if (sender() != m_selectors.last()) + return; + auto keys = initKeys(); + addSelector(keys.first, keys.second, QPair()); + } +} + + +void AWFormatterConfig::addSelector(const QStringList &keys, + const QStringList &values, + const QPair ¤t) +{ + qCDebug(LOG_AW) << "Add selector with keys" << keys << "values" << values + << "and current ones" << current; + + AWAbstractSelector *selector + = new AWAbstractSelector(ui->scrollAreaWidgetContents); + selector->init(keys, values, current); + ui->verticalLayout->insertWidget(ui->verticalLayout->count() - 1, selector); + connect(selector, SIGNAL(selectionChanged()), this, SLOT(updateUi())); + m_selectors.append(selector); +} + + +void AWFormatterConfig::clearSelectors() +{ + for (auto selector : m_selectors) + disconnect(selector, SIGNAL(selectionChanged()), this, + SLOT(updateUi())); + m_selectors.clear(); +} + + +void AWFormatterConfig::execDialog() +{ + int ret = exec(); + QHash data; + for (auto selector : m_selectors) { + QPair select = selector->current(); + if ((select.first.isEmpty()) || (select.second.isEmpty())) + continue; + data[select.first] = select.second; + } + + // save configuration if required + switch (ret) { + case 0: + break; + case 1: + default: + m_helper->writeFormatters(data); + break; + } +} + + +void AWFormatterConfig::init() +{ + delete m_helper; + m_helper = new AWFormatterHelper(this); +} + + +QPair AWFormatterConfig::initKeys() const +{ + // we are adding empty string at the start + QStringList keys = QStringList() << QString(""); + keys.append(m_keys); + keys.sort(); + QStringList knownFormatters = QStringList() << QString(""); + knownFormatters.append(m_helper->knownFormatters()); + knownFormatters.sort(); + + return QPair(keys, knownFormatters); +} diff --git a/sources/awesome-widget/plugin/awformatterconfig.h b/sources/awesome-widget/plugin/awformatterconfig.h new file mode 100644 index 0000000..b04cbaa --- /dev/null +++ b/sources/awesome-widget/plugin/awformatterconfig.h @@ -0,0 +1,61 @@ +/*************************************************************************** + * This file is part of awesome-widgets * + * * + * awesome-widgets is free software: you can redistribute it and/or * + * modify it under the terms of the GNU General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * awesome-widgets is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + + +#ifndef AWFORMATTERCONFIG_H +#define AWFORMATTERCONFIG_H + +#include + + +class AWAbstractSelector; +class AWFormatterHelper; +namespace Ui +{ +class AWFormatterConfig; +} + +class AWFormatterConfig : public QDialog +{ + Q_OBJECT + +public: + explicit AWFormatterConfig(QWidget *parent = nullptr, + const QStringList keys = QStringList()); + virtual ~AWFormatterConfig(); + Q_INVOKABLE void showDialog(); + +private slots: + void updateUi(); + +private: + Ui::AWFormatterConfig *ui = nullptr; + AWFormatterHelper *m_helper = nullptr; + QList m_selectors; + // properties + QStringList m_keys; + // methods + void addSelector(const QStringList &keys, const QStringList &values, + const QPair ¤t); + void clearSelectors(); + void execDialog(); + void init(); + QPair initKeys() const; +}; + + +#endif /* AWFORMATTERCONFIG_H */ diff --git a/sources/awesome-widget/plugin/awformatterconfig.ui b/sources/awesome-widget/plugin/awformatterconfig.ui new file mode 100644 index 0000000..4f0fff2 --- /dev/null +++ b/sources/awesome-widget/plugin/awformatterconfig.ui @@ -0,0 +1,93 @@ + + + AWFormatterConfig + + + + 0 + 0 + 400 + 300 + + + + + + + true + + + + + 0 + 0 + 384 + 249 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + AWFormatterConfig + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + AWFormatterConfig + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/sources/awesome-widget/plugin/awformatterconfigfactory.cpp b/sources/awesome-widget/plugin/awformatterconfigfactory.cpp new file mode 100644 index 0000000..d7da52d --- /dev/null +++ b/sources/awesome-widget/plugin/awformatterconfigfactory.cpp @@ -0,0 +1,42 @@ +/*************************************************************************** + * This file is part of awesome-widgets * + * * + * awesome-widgets is free software: you can redistribute it and/or * + * modify it under the terms of the GNU General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * awesome-widgets is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + +#include "awformatterconfigfactory.h" + +#include "awdebug.h" +#include "awformatterconfig.h" + + +AWFormatterConfigFactory::AWFormatterConfigFactory(QObject *parent) + : QObject(parent) +{ + qCDebug(LOG_AW) << __PRETTY_FUNCTION__; +} + + +AWFormatterConfigFactory::~AWFormatterConfigFactory() +{ + qCDebug(LOG_AW) << __PRETTY_FUNCTION__; +} + + +void AWFormatterConfigFactory::showDialog(const QStringList keys) +{ + AWFormatterConfig *config = new AWFormatterConfig(nullptr, keys); + config->showDialog(); + config->deleteLater(); +} diff --git a/sources/awesome-widget/plugin/awformatterconfigfactory.h b/sources/awesome-widget/plugin/awformatterconfigfactory.h new file mode 100644 index 0000000..edfd49f --- /dev/null +++ b/sources/awesome-widget/plugin/awformatterconfigfactory.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * This file is part of awesome-widgets * + * * + * awesome-widgets is free software: you can redistribute it and/or * + * modify it under the terms of the GNU General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * awesome-widgets is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + + +#ifndef AWFORMATTERCONFIGFACTORY_H +#define AWFORMATTERCONFIGFACTORY_H + +#include + + +class AWFormatterConfigFactory : public QObject +{ + Q_OBJECT + +public: + explicit AWFormatterConfigFactory(QObject *parent = nullptr); + virtual ~AWFormatterConfigFactory(); + Q_INVOKABLE void showDialog(const QStringList keys); + +private: +}; + + +#endif /* AWFORMATTERCONFIGFACTORY_H */ diff --git a/sources/awesome-widget/plugin/awformatterhelper.cpp b/sources/awesome-widget/plugin/awformatterhelper.cpp index f6c9e10..7dccc84 100644 --- a/sources/awesome-widget/plugin/awformatterhelper.cpp +++ b/sources/awesome-widget/plugin/awformatterhelper.cpp @@ -66,9 +66,9 @@ QStringList AWFormatterHelper::definedFormatters() const } -QVariantMap AWFormatterHelper::getFormatters() const +QHash AWFormatterHelper::getFormatters() const { - QVariantMap map; + QHash map; for (auto tag : m_formatters.keys()) map[tag] = m_formatters[tag]->name(); @@ -76,14 +76,27 @@ QVariantMap AWFormatterHelper::getFormatters() const } +QList AWFormatterHelper::items() const +{ + QList converted; + for (auto item : m_formattersClasses.values()) + converted.append(item); + + return converted; +} + + QStringList AWFormatterHelper::knownFormatters() const { return m_formattersClasses.keys(); } -bool AWFormatterHelper::writeFormatters(const QVariantMap configuration) const +bool AWFormatterHelper::writeFormatters( + const QHash configuration) const { + qCDebug(LOG_AW) << "Write configuration" << configuration; + QString fileName = QString("%1/awesomewidgets/formatters/formatters.ini") .arg(QStandardPaths::writableLocation( QStandardPaths::GenericDataLocation)); @@ -101,16 +114,6 @@ bool AWFormatterHelper::writeFormatters(const QVariantMap configuration) const } -QList AWFormatterHelper::items() const -{ - QList converted; - for (auto item : m_formattersClasses.values()) - converted.append(item); - - return converted; -} - - AWFormatterHelper::FormatterClass AWFormatterHelper::defineFormatterClass(const QString stringType) const { @@ -121,6 +124,8 @@ AWFormatterHelper::defineFormatterClass(const QString stringType) const formatter = FormatterClass::DateTime; else if (stringType == QString("Float")) formatter = FormatterClass::Float; + else if (stringType == QString("NoFormat")) + ; else if (stringType == QString("Script")) formatter = FormatterClass::Script; else diff --git a/sources/awesome-widget/plugin/awformatterhelper.h b/sources/awesome-widget/plugin/awformatterhelper.h index 36cddcb..81eb324 100644 --- a/sources/awesome-widget/plugin/awformatterhelper.h +++ b/sources/awesome-widget/plugin/awformatterhelper.h @@ -34,11 +34,11 @@ public: explicit AWFormatterHelper(QWidget *parent = nullptr); virtual ~AWFormatterHelper(); QString convert(const QVariant &value, const QString name) const; - Q_INVOKABLE QStringList definedFormatters() const; - Q_INVOKABLE QVariantMap getFormatters() const; - Q_INVOKABLE QStringList knownFormatters() const; - Q_INVOKABLE bool writeFormatters(const QVariantMap configuration) const; + QStringList definedFormatters() const; + QHash getFormatters() const; QList items() const; + QStringList knownFormatters() const; + bool writeFormatters(const QHash configuration) const; private: // methods diff --git a/sources/awesome-widget/plugin/awkeyoperations.cpp b/sources/awesome-widget/plugin/awkeyoperations.cpp index 1e23e18..abab46c 100644 --- a/sources/awesome-widget/plugin/awkeyoperations.cpp +++ b/sources/awesome-widget/plugin/awkeyoperations.cpp @@ -194,14 +194,12 @@ QString AWKeyOperations::infoByKey(QString key) const else if (key.startsWith(QString("custom"))) return extScripts->itemByTag(key, QString("custom"))->uniq(); else if (key.contains(QRegExp(QString("^hdd[rw]")))) - return QString("%1").arg( - m_devices[QString("disk")] - [key.remove(QRegExp(QString("hdd[rw]"))).toInt()]); + return QString("%1").arg(m_devices[QString( + "disk")][key.remove(QRegExp(QString("hdd[rw]"))).toInt()]); else if (key.contains(QRegExp( QString("^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)")))) - return QString("%1").arg( - m_devices[QString("mount")] - [key + return QString("%1").arg(m_devices[QString( + "mount")][key .remove(QRegExp(QString( "^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)"))) .toInt()]); @@ -209,9 +207,8 @@ QString AWKeyOperations::infoByKey(QString key) const return QString("%1").arg( m_devices[QString("hdd")][key.remove(QString("hddtemp")).toInt()]); else if (key.contains(QRegExp(QString("^(down|up)[0-9]")))) - return QString("%1").arg( - m_devices[QString("net")] - [key.remove(QRegExp(QString("^(down|up)"))).toInt()]); + return QString("%1").arg(m_devices[QString( + "net")][key.remove(QRegExp(QString("^(down|up)"))).toInt()]); else if (key.startsWith(QString("pkgcount"))) return extUpgrade->itemByTag(key, QString("pkgcount"))->uniq(); else if (key.contains(QRegExp(QString("(^|perc)(ask|bid|price)(chg|)")))) diff --git a/sources/desktop-panel/plugin/dpadds.cpp b/sources/desktop-panel/plugin/dpadds.cpp index ee25dae..21a551c 100644 --- a/sources/desktop-panel/plugin/dpadds.cpp +++ b/sources/desktop-panel/plugin/dpadds.cpp @@ -156,22 +156,22 @@ QString DPAdds::toolTipImage(const int desktop) const std::for_each(info.desktopsData.cbegin(), info.desktopsData.cend(), [&toolTipScene, &screen](WindowData data) { QPixmap desktop = screen->grabWindow(data.id); - toolTipScene->addPixmap(desktop)->setOffset( - data.rect.left(), data.rect.top()); + toolTipScene->addPixmap(desktop) + ->setOffset(data.rect.left(), data.rect.top()); }); } else if (m_tooltipType == QString("windows")) { QScreen *screen = QGuiApplication::primaryScreen(); std::for_each(info.desktopsData.cbegin(), info.desktopsData.cend(), [&toolTipScene, &screen](WindowData data) { QPixmap desktop = screen->grabWindow(data.id); - toolTipScene->addPixmap(desktop)->setOffset( - data.rect.left(), data.rect.top()); + toolTipScene->addPixmap(desktop) + ->setOffset(data.rect.left(), data.rect.top()); }); std::for_each(info.windowsData.cbegin(), info.windowsData.cend(), [&toolTipScene, &screen](WindowData data) { QPixmap window = screen->grabWindow(data.id); - toolTipScene->addPixmap(window)->setOffset( - data.rect.left(), data.rect.top()); + toolTipScene->addPixmap(window) + ->setOffset(data.rect.left(), data.rect.top()); }); } @@ -232,8 +232,8 @@ QString DPAdds::valueByKey(const QString key, int desktop) const .arg(currentMark, m_mark.count(), QLatin1Char(' ')) .replace(QString(" "), QString(" ")); else if (key == QString("name")) - return KWindowSystem::desktopName(desktop).replace(QString(" "), - QString(" ")); + return KWindowSystem::desktopName(desktop) + .replace(QString(" "), QString(" ")); else if (key == QString("number")) return QString::number(desktop); else if (key == QString("total")) diff --git a/sources/extsysmon/extsysmon.cpp b/sources/extsysmon/extsysmon.cpp index 6b61d34..8727df8 100644 --- a/sources/extsysmon/extsysmon.cpp +++ b/sources/extsysmon/extsysmon.cpp @@ -125,8 +125,8 @@ void ExtendedSysMon::readConfiguration() settings.beginGroup(QString("Configuration")); rawConfig[QString("ACPIPATH")] - = settings - .value(QString("ACPIPATH"), QString("/sys/class/power_supply/")) + = settings.value(QString("ACPIPATH"), + QString("/sys/class/power_supply/")) .toString(); rawConfig[QString("GPUDEV")] = settings.value(QString("GPUDEV"), QString("auto")).toString();