mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +00:00
some refactoring
* massive changes inside includes, drop unused definitions * rewrite some initialization methods to avoid additional freeing/allocation * drop some explicit destructors calls
This commit is contained in:
parent
e90e1da096
commit
d2e6f2fe38
@ -56,7 +56,6 @@ AWAbstractPairConfig::~AWAbstractPairConfig()
|
||||
|
||||
clearSelectors();
|
||||
|
||||
delete m_helper;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QFile>
|
||||
#include <QProcess>
|
||||
#include <QUrl>
|
||||
|
||||
#include <fontdialog/fontdialog.h>
|
||||
|
||||
@ -43,8 +42,6 @@ AWActions::AWActions(QObject *_parent)
|
||||
AWActions::~AWActions()
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
|
||||
delete m_updateHelper;
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,11 +21,9 @@
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonParseError>
|
||||
#include <QMessageBox>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <QDir>
|
||||
#include <QQmlPropertyMap>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "awdebug.h"
|
||||
@ -31,6 +32,10 @@ AWConfigHelper::AWConfigHelper(QObject *_parent)
|
||||
: QObject(_parent)
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
|
||||
m_baseDir = QString("%1/awesomewidgets")
|
||||
.arg(QStandardPaths::writableLocation(
|
||||
QStandardPaths::GenericDataLocation));
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#define AWCONFIGHELPER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QStandardPaths>
|
||||
#include <QVariant>
|
||||
|
||||
|
||||
@ -57,15 +56,9 @@ private:
|
||||
void writeFile(QSettings &_settings, const QString &_key,
|
||||
const QString &_fileName) const;
|
||||
// properties
|
||||
QString m_baseDir = QString("%1/awesomewidgets")
|
||||
.arg(QStandardPaths::writableLocation(
|
||||
QStandardPaths::GenericDataLocation));
|
||||
QStringList m_dirs = QStringList() << "desktops"
|
||||
<< "quotes"
|
||||
<< "scripts"
|
||||
<< "upgrade"
|
||||
<< "weather"
|
||||
<< "formatters";
|
||||
QString m_baseDir;
|
||||
QStringList m_dirs
|
||||
= {"desktops", "quotes", "scripts", "upgrade", "weather", "formatters"};
|
||||
};
|
||||
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
#ifndef AWCUSTOMKEYSHELPER_H
|
||||
#define AWCUSTOMKEYSHELPER_H
|
||||
|
||||
#include <QHash>
|
||||
#include <QObject>
|
||||
|
||||
#include "awabstractpairhelper.h"
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <QBuffer>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsView>
|
||||
#include <QPixmap>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
@ -55,14 +54,6 @@ AWDataAggregator::~AWDataAggregator()
|
||||
}
|
||||
|
||||
|
||||
QList<float> AWDataAggregator::getData(const QString &_key) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Key" << _key;
|
||||
|
||||
return m_values[QString("%1Tooltip").arg(_key)];
|
||||
}
|
||||
|
||||
|
||||
QString AWDataAggregator::htmlImage(const QPixmap &_source) const
|
||||
{
|
||||
QByteArray byteArray;
|
||||
|
@ -35,7 +35,6 @@ class AWDataAggregator : public QObject
|
||||
public:
|
||||
explicit AWDataAggregator(QObject *_parent = nullptr);
|
||||
virtual ~AWDataAggregator();
|
||||
QList<float> getData(const QString &_key) const;
|
||||
QString htmlImage(const QPixmap &_source) const;
|
||||
void setParameters(const QVariantMap &_settings);
|
||||
QPixmap tooltipImage();
|
||||
|
@ -28,6 +28,20 @@ AWDataEngineAggregator::AWDataEngineAggregator(QObject *_parent)
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
|
||||
m_consumer = new Plasma::DataEngineConsumer();
|
||||
m_dataEngines["systemmonitor"] = m_consumer->dataEngine("systemmonitor");
|
||||
m_dataEngines["extsysmon"] = m_consumer->dataEngine("extsysmon");
|
||||
m_dataEngines["time"] = m_consumer->dataEngine("time");
|
||||
|
||||
// additional method required by systemmonitor structure
|
||||
m_newSourceConnection = connect(
|
||||
m_dataEngines["systemmonitor"], &Plasma::DataEngine::sourceAdded,
|
||||
[this](const QString source) {
|
||||
emit(deviceAdded(source));
|
||||
m_dataEngines["systemmonitor"]->connectSource(source, parent(),
|
||||
1000);
|
||||
});
|
||||
|
||||
// required to define Qt::QueuedConnection for signal-slot connection
|
||||
qRegisterMetaType<Plasma::DataEngine::Data>("Plasma::DataEngine::Data");
|
||||
}
|
||||
@ -37,16 +51,7 @@ AWDataEngineAggregator::~AWDataEngineAggregator()
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
void AWDataEngineAggregator::clear()
|
||||
{
|
||||
// disconnect sources first
|
||||
disconnectSources();
|
||||
m_dataEngines.clear();
|
||||
delete m_consumer;
|
||||
}
|
||||
|
||||
|
||||
@ -55,27 +60,31 @@ void AWDataEngineAggregator::disconnectSources()
|
||||
for (auto dataengine : m_dataEngines.values())
|
||||
for (auto &source : dataengine->sources())
|
||||
dataengine->disconnectSource(source, parent());
|
||||
disconnect(m_newSourceConnection);
|
||||
}
|
||||
|
||||
|
||||
void AWDataEngineAggregator::initDataEngines(const int _interval)
|
||||
void AWDataEngineAggregator::reconnectSources(const int _interval)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Init dataengines with interval" << _interval;
|
||||
qCDebug(LOG_AW) << "Reconnect sources with interval" << _interval;
|
||||
|
||||
m_consumer = new Plasma::DataEngineConsumer();
|
||||
m_dataEngines["systemmonitor"] = m_consumer->dataEngine("systemmonitor");
|
||||
m_dataEngines["extsysmon"] = m_consumer->dataEngine("extsysmon");
|
||||
m_dataEngines["time"] = m_consumer->dataEngine("time");
|
||||
disconnectSources();
|
||||
|
||||
// additional method required by systemmonitor structure
|
||||
connect(m_dataEngines["systemmonitor"], &Plasma::DataEngine::sourceAdded,
|
||||
[this, _interval](const QString source) {
|
||||
emit(deviceAdded(source));
|
||||
m_dataEngines["systemmonitor"]->connectSource(source, parent(),
|
||||
_interval);
|
||||
});
|
||||
m_dataEngines["systemmonitor"]->connectAllSources(parent(), _interval);
|
||||
m_dataEngines["extsysmon"]->connectAllSources(parent(), _interval);
|
||||
m_dataEngines["time"]->connectSource("Local", parent(), 1000);
|
||||
|
||||
return reconnectSources(_interval);
|
||||
m_newSourceConnection = connect(
|
||||
m_dataEngines["systemmonitor"], &Plasma::DataEngine::sourceAdded,
|
||||
[this, _interval](const QString source) {
|
||||
emit(deviceAdded(source));
|
||||
m_dataEngines["systemmonitor"]->connectSource(source, parent(),
|
||||
_interval);
|
||||
});
|
||||
|
||||
#ifdef BUILD_FUTURE
|
||||
createQueuedConnection();
|
||||
#endif /* BUILD_FUTURE */
|
||||
}
|
||||
|
||||
|
||||
@ -84,26 +93,12 @@ void AWDataEngineAggregator::dropSource(const QString &_source)
|
||||
qCDebug(LOG_AW) << "Source" << _source;
|
||||
|
||||
// HACK there is no possibility to check to which dataengine source
|
||||
// connected we will try to disconnect it from systemmonitor and extsysmon
|
||||
// connected we will try to disconnect it from all engines
|
||||
for (auto dataengine : m_dataEngines.values())
|
||||
dataengine->disconnectSource(_source, parent());
|
||||
}
|
||||
|
||||
|
||||
void AWDataEngineAggregator::reconnectSources(const int _interval)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Reconnect sources with interval" << _interval;
|
||||
|
||||
m_dataEngines["systemmonitor"]->connectAllSources(parent(), _interval);
|
||||
m_dataEngines["extsysmon"]->connectAllSources(parent(), _interval);
|
||||
m_dataEngines["time"]->connectSource("Local", parent(), 1000);
|
||||
|
||||
#ifdef BUILD_FUTURE
|
||||
createQueuedConnection();
|
||||
#endif /* BUILD_FUTURE */
|
||||
}
|
||||
|
||||
|
||||
void AWDataEngineAggregator::createQueuedConnection()
|
||||
{
|
||||
// HACK additional method which forces QueuedConnection instead of Auto one
|
||||
|
@ -32,21 +32,20 @@ class AWDataEngineAggregator : public QObject
|
||||
public:
|
||||
explicit AWDataEngineAggregator(QObject *_parent = nullptr);
|
||||
virtual ~AWDataEngineAggregator();
|
||||
void clear();
|
||||
void disconnectSources();
|
||||
void initDataEngines(const int _interval);
|
||||
void reconnectSources(const int _interval);
|
||||
|
||||
signals:
|
||||
void deviceAdded(const QString &_source);
|
||||
|
||||
public slots:
|
||||
void dropSource(const QString &_source);
|
||||
void reconnectSources(const int _interval);
|
||||
|
||||
private:
|
||||
void createQueuedConnection();
|
||||
Plasma::DataEngineConsumer *m_consumer = nullptr;
|
||||
QHash<QString, Plasma::DataEngine *> m_dataEngines;
|
||||
QMetaObject::Connection m_newSourceConnection;
|
||||
};
|
||||
|
||||
|
||||
|
@ -48,10 +48,7 @@ public slots:
|
||||
|
||||
private:
|
||||
AWKeys *m_plugin = nullptr;
|
||||
QStringList m_logLevels = QStringList() << "debug"
|
||||
<< "info"
|
||||
<< "warning"
|
||||
<< "critical";
|
||||
QStringList m_logLevels = {"debug", "info", "warning", "critical"};
|
||||
};
|
||||
|
||||
|
||||
|
@ -22,8 +22,8 @@
|
||||
#include "awactions.h"
|
||||
#include "awbugreporter.h"
|
||||
#include "awconfighelper.h"
|
||||
#include "awformatterconfigfactory.h"
|
||||
#include "awkeys.h"
|
||||
#include "awpairconfigfactory.h"
|
||||
#include "awtelemetryhandler.h"
|
||||
|
||||
|
||||
@ -34,8 +34,7 @@ void AWPlugin::registerTypes(const char *uri)
|
||||
qmlRegisterType<AWActions>(uri, 1, 0, "AWActions");
|
||||
qmlRegisterType<AWBugReporter>(uri, 1, 0, "AWBugReporter");
|
||||
qmlRegisterType<AWConfigHelper>(uri, 1, 0, "AWConfigHelper");
|
||||
qmlRegisterType<AWFormatterConfigFactory>(uri, 1, 0,
|
||||
"AWFormatterConfigFactory");
|
||||
qmlRegisterType<AWPairConfigFactory>(uri, 1, 0, "AWPairConfigFactory");
|
||||
qmlRegisterType<AWKeys>(uri, 1, 0, "AWKeys");
|
||||
qmlRegisterType<AWTelemetryHandler>(uri, 1, 0, "AWTelemetryHandler");
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include <QDir>
|
||||
#include <QNetworkInterface>
|
||||
#include <QRegExp>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
|
||||
|
@ -55,15 +55,6 @@ AWKeyOperations::AWKeyOperations(QObject *_parent)
|
||||
AWKeyOperations::~AWKeyOperations()
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
|
||||
// extensions
|
||||
delete m_customKeys;
|
||||
delete m_graphicalItems;
|
||||
delete m_extNetRequest;
|
||||
delete m_extQuotes;
|
||||
delete m_extScripts;
|
||||
delete m_extUpgrade;
|
||||
delete m_extWeather;
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,25 +19,18 @@
|
||||
#ifndef AWKEYOPERATIONS_H
|
||||
#define AWKEYOPERATIONS_H
|
||||
|
||||
#include <Plasma/DataEngine>
|
||||
|
||||
#include <QMutex>
|
||||
#include <QObject>
|
||||
|
||||
#include "extitemaggregator.h"
|
||||
|
||||
|
||||
class AWCustomKeysHelper;
|
||||
class AWDataAggregator;
|
||||
class AWDataEngineAggregator;
|
||||
class AWKeysAggregator;
|
||||
class ExtNetworkRequest;
|
||||
class ExtQuotes;
|
||||
class ExtScript;
|
||||
class ExtUpgrade;
|
||||
class ExtWeather;
|
||||
class GraphicalItem;
|
||||
class QThreadPool;
|
||||
|
||||
class AWKeyOperations : public QObject
|
||||
{
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusError>
|
||||
#include <QRegExp>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
@ -76,24 +75,9 @@ AWKeys::~AWKeys()
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
|
||||
m_timer->stop();
|
||||
delete m_timer;
|
||||
|
||||
// delete dbus session
|
||||
qlonglong id = reinterpret_cast<qlonglong>(this);
|
||||
QDBusConnection::sessionBus().unregisterObject(QString("/%1").arg(id));
|
||||
|
||||
// core
|
||||
delete m_dataEngineAggregator;
|
||||
delete m_threadPool;
|
||||
delete m_aggregator;
|
||||
delete m_dataAggregator;
|
||||
delete m_keyOperator;
|
||||
}
|
||||
|
||||
|
||||
bool AWKeys::isDBusActive() const
|
||||
{
|
||||
return m_dbusActive;
|
||||
}
|
||||
|
||||
|
||||
@ -122,8 +106,7 @@ void AWKeys::initKeys(const QString &_currentPattern, const int _interval,
|
||||
m_aggregator->initFormatters();
|
||||
m_keyOperator->setPattern(_currentPattern);
|
||||
m_keyOperator->updateCache();
|
||||
m_dataEngineAggregator->clear();
|
||||
m_dataEngineAggregator->initDataEngines(_interval);
|
||||
m_dataEngineAggregator->reconnectSources(_interval);
|
||||
|
||||
// timer
|
||||
m_timer->setInterval(_interval);
|
||||
@ -348,13 +331,9 @@ void AWKeys::createDBusInterface()
|
||||
qCWarning(LOG_AW) << "Could not register DBus service, last error"
|
||||
<< bus.lastError().message();
|
||||
if (!bus.registerObject(QString("/%1").arg(id), new AWDBusAdaptor(this),
|
||||
QDBusConnection::ExportAllContents)) {
|
||||
QDBusConnection::ExportAllContents))
|
||||
qCWarning(LOG_AW) << "Could not register DBus object, last error"
|
||||
<< bus.lastError().message();
|
||||
m_dbusActive = false;
|
||||
} else {
|
||||
m_dbusActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include <QObject>
|
||||
|
||||
|
||||
class AWCustomKeysHelper;
|
||||
class AWDataAggregator;
|
||||
class AWDataEngineAggregator;
|
||||
class AWKeyOperations;
|
||||
@ -40,7 +39,6 @@ class AWKeys : public QObject
|
||||
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, const int _limit,
|
||||
@ -89,7 +87,6 @@ private:
|
||||
AWKeyOperations *m_keyOperator = nullptr;
|
||||
QTimer *m_timer = nullptr;
|
||||
// variables
|
||||
bool m_dbusActive = false;
|
||||
QVariantMap m_tooltipParams;
|
||||
QStringList m_foundBars, m_foundKeys, m_foundLambdas, m_requiredKeys;
|
||||
QVariantHash m_values;
|
||||
|
@ -60,8 +60,6 @@ AWKeysAggregator::AWKeysAggregator(QObject *_parent)
|
||||
AWKeysAggregator::~AWKeysAggregator()
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
|
||||
delete m_customFormatters;
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,27 +15,27 @@
|
||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "awformatterconfigfactory.h"
|
||||
#include "awpairconfigfactory.h"
|
||||
|
||||
#include "awcustomkeysconfig.h"
|
||||
#include "awdebug.h"
|
||||
#include "awformatterconfig.h"
|
||||
|
||||
|
||||
AWFormatterConfigFactory::AWFormatterConfigFactory(QObject *_parent)
|
||||
AWPairConfigFactory::AWPairConfigFactory(QObject *_parent)
|
||||
: QObject(_parent)
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
}
|
||||
|
||||
|
||||
AWFormatterConfigFactory::~AWFormatterConfigFactory()
|
||||
AWPairConfigFactory::~AWPairConfigFactory()
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
}
|
||||
|
||||
|
||||
void AWFormatterConfigFactory::showFormatterDialog(const QStringList &_keys)
|
||||
void AWPairConfigFactory::showFormatterDialog(const QStringList &_keys)
|
||||
{
|
||||
AWFormatterConfig *config = new AWFormatterConfig(nullptr, _keys);
|
||||
config->showDialog();
|
||||
@ -43,7 +43,7 @@ void AWFormatterConfigFactory::showFormatterDialog(const QStringList &_keys)
|
||||
}
|
||||
|
||||
|
||||
void AWFormatterConfigFactory::showKeysDialog(const QStringList &_keys)
|
||||
void AWPairConfigFactory::showKeysDialog(const QStringList &_keys)
|
||||
{
|
||||
AWCustomKeysConfig *config = new AWCustomKeysConfig(nullptr, _keys);
|
||||
config->showDialog();
|
@ -16,19 +16,19 @@
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef AWFORMATTERCONFIGFACTORY_H
|
||||
#define AWFORMATTERCONFIGFACTORY_H
|
||||
#ifndef AWPAIRCONFIGFACTORY_H
|
||||
#define AWPAIRCONFIGFACTORY_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
|
||||
class AWFormatterConfigFactory : public QObject
|
||||
class AWPairConfigFactory : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AWFormatterConfigFactory(QObject *_parent = nullptr);
|
||||
virtual ~AWFormatterConfigFactory();
|
||||
explicit AWPairConfigFactory(QObject *_parent = nullptr);
|
||||
virtual ~AWPairConfigFactory();
|
||||
Q_INVOKABLE void showFormatterDialog(const QStringList &_keys);
|
||||
Q_INVOKABLE void showKeysDialog(const QStringList &_keys);
|
||||
|
||||
@ -36,4 +36,4 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#endif /* AWFORMATTERCONFIGFACTORY_H */
|
||||
#endif /* AWPAIRCONFIGFACTORY_H */
|
@ -18,10 +18,8 @@
|
||||
#include "awtelemetryhandler.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonParseError>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
#include <QUuid>
|
||||
|
@ -20,10 +20,8 @@
|
||||
#define AWTELEMETRYHANDLER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
|
||||
class QAbstractButton;
|
||||
class QNetworkReply;
|
||||
|
||||
class AWTelemetryHandler : public QObject
|
||||
|
@ -21,10 +21,8 @@
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonParseError>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QSettings>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <QTime>
|
||||
|
||||
#include "abstractextitemaggregator.h"
|
||||
#include "awdebug.h"
|
||||
#include "qcronscheduler.h"
|
||||
|
||||
|
||||
@ -47,7 +46,7 @@ AbstractExtItem::~AbstractExtItem()
|
||||
if (m_socket) {
|
||||
m_socket->close();
|
||||
m_socket->removeServer(socket());
|
||||
delete m_socket;
|
||||
m_socket->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QInputDialog>
|
||||
#include <QPushButton>
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
@ -18,9 +18,10 @@
|
||||
#ifndef AWDATETIMEFORMATTER_H
|
||||
#define AWDATETIMEFORMATTER_H
|
||||
|
||||
#include "awabstractformatter.h"
|
||||
#include <QLocale>
|
||||
|
||||
#include "awabstractformatter.h"
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDir>
|
||||
#include <QJSEngine>
|
||||
#include <QSettings>
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
@ -21,8 +21,6 @@
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDir>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QSettings>
|
||||
#include <QTextCodec>
|
||||
|
||||
|
@ -22,9 +22,6 @@
|
||||
|
||||
#include <QDir>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonParseError>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QSettings>
|
||||
#include <QUrlQuery>
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <QDir>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonParseError>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
#include <QTextCodec>
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDir>
|
||||
#include <QRegExp>
|
||||
#include <QSettings>
|
||||
#include <QTextCodec>
|
||||
|
||||
|
@ -22,9 +22,6 @@
|
||||
|
||||
#include <QDir>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonParseError>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
|
||||
@ -72,7 +69,6 @@ ExtWeather::~ExtWeather()
|
||||
disconnect(this, SIGNAL(requestDataUpdate()), this, SLOT(sendRequest()));
|
||||
|
||||
m_manager->deleteLater();
|
||||
delete m_providerObject;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,19 @@ GraphicalItem::GraphicalItem(QWidget *_parent, const QString &_filePath)
|
||||
{
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
// init scene
|
||||
m_scene = new QGraphicsScene();
|
||||
m_scene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
||||
// init view
|
||||
m_view = new QGraphicsView(m_scene);
|
||||
m_view->setStyleSheet("background: transparent");
|
||||
m_view->setContentsMargins(0, 0, 0, 0);
|
||||
m_view->setFrameShape(QFrame::NoFrame);
|
||||
m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
// init helper
|
||||
m_helper = new GraphicalItemHelper(this, m_scene);
|
||||
|
||||
if (!_filePath.isEmpty())
|
||||
readConfiguration();
|
||||
ui->setupUi(this);
|
||||
@ -58,9 +71,7 @@ GraphicalItem::~GraphicalItem()
|
||||
{
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
delete m_scene;
|
||||
delete ui;
|
||||
delete m_helper;
|
||||
}
|
||||
|
||||
|
||||
@ -141,24 +152,7 @@ QString GraphicalItem::image(const QVariant &value)
|
||||
|
||||
void GraphicalItem::initScene()
|
||||
{
|
||||
// cleanup
|
||||
delete m_helper;
|
||||
delete m_scene;
|
||||
|
||||
// init scene
|
||||
m_scene = new QGraphicsScene();
|
||||
m_scene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
||||
// init view
|
||||
m_view = new QGraphicsView(m_scene);
|
||||
m_view->setStyleSheet("background: transparent");
|
||||
m_view->setContentsMargins(0, 0, 0, 0);
|
||||
m_view->setFrameShape(QFrame::NoFrame);
|
||||
m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_view->resize(m_width + 5, m_height + 5);
|
||||
|
||||
// init helper
|
||||
m_helper = new GraphicalItemHelper(this, m_scene);
|
||||
m_helper->setParameters(activeColor(), inactiveColor(), itemWidth(),
|
||||
itemHeight(), count());
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#include "graphicalitemhelper.h"
|
||||
|
||||
#include <QColor>
|
||||
#include <QGraphicsEllipseItem>
|
||||
#include <QGraphicsScene>
|
||||
#include <QUrl>
|
||||
|
@ -44,7 +44,6 @@ QCronScheduler::~QCronScheduler()
|
||||
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
|
||||
|
||||
m_timer->stop();
|
||||
delete m_timer;
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,8 +27,6 @@
|
||||
#include <QGraphicsView>
|
||||
#include <QHBoxLayout>
|
||||
#include <QListWidget>
|
||||
#include <QMessageBox>
|
||||
#include <QPixmap>
|
||||
#include <QScreen>
|
||||
|
||||
#include <fontdialog/fontdialog.h>
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "extsysmon.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QRegExp>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
|
||||
@ -50,8 +49,6 @@ ExtendedSysMon::ExtendedSysMon(QObject *_parent, const QVariantList &_args)
|
||||
ExtendedSysMon::~ExtendedSysMon()
|
||||
{
|
||||
qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
|
||||
|
||||
delete m_aggregator;
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,8 +37,6 @@ CustomSource::CustomSource(QObject *_parent, const QStringList &_args)
|
||||
CustomSource::~CustomSource()
|
||||
{
|
||||
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
|
||||
|
||||
delete m_extScripts;
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,8 +37,6 @@ QuotesSource::QuotesSource(QObject *_parent, const QStringList &_args)
|
||||
QuotesSource::~QuotesSource()
|
||||
{
|
||||
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
|
||||
|
||||
delete m_extQuotes;
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,8 +38,6 @@ RequestSource::RequestSource(QObject *_parent, const QStringList &_args)
|
||||
RequestSource::~RequestSource()
|
||||
{
|
||||
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
|
||||
|
||||
delete m_extNetRequest;
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,8 +37,6 @@ UpgradeSource::UpgradeSource(QObject *_parent, const QStringList &_args)
|
||||
UpgradeSource::~UpgradeSource()
|
||||
{
|
||||
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
|
||||
|
||||
delete m_extUpgrade;
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,8 +37,6 @@ WeatherSource::WeatherSource(QObject *_parent, const QStringList &_args)
|
||||
WeatherSource::~WeatherSource()
|
||||
{
|
||||
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
|
||||
|
||||
delete m_extWeather;
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,8 +28,8 @@ Row {
|
||||
|
||||
// backend
|
||||
property var backend
|
||||
AWFormatterConfigFactory {
|
||||
id: awFormatter
|
||||
AWPairConfigFactory {
|
||||
id: awPairConfig
|
||||
}
|
||||
AWTelemetryHandler {
|
||||
id: awTelemetryHandler
|
||||
@ -49,13 +49,13 @@ Row {
|
||||
QtControls.Button {
|
||||
width: parent.width * 3 / 15
|
||||
text: i18n("Formatters")
|
||||
onClicked: awFormatter.showFormatterDialog(backend.dictKeys(true))
|
||||
onClicked: awPairConfig.showFormatterDialog(backend.dictKeys(true))
|
||||
}
|
||||
|
||||
QtControls.Button {
|
||||
width: parent.width * 3 / 15
|
||||
text: i18n("User keys")
|
||||
onClicked: awFormatter.showKeysDialog(backend.dictKeys(true))
|
||||
onClicked: awPairConfig.showKeysDialog(backend.dictKeys(true))
|
||||
}
|
||||
|
||||
QtControls.Button {
|
||||
|
@ -168,9 +168,6 @@ void TestAWKeys::test_valueByKey()
|
||||
|
||||
void TestAWKeys::test_dbus()
|
||||
{
|
||||
if (!plugin->isDBusActive())
|
||||
QSKIP("No DBus session created, skip DBus test");
|
||||
|
||||
// get id
|
||||
qlonglong id = reinterpret_cast<qlonglong>(plugin);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user