mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-05-04 20:33:48 +00:00
Compare commits
1 Commits
cee37c6a4a
...
803d6d631a
Author | SHA1 | Date | |
---|---|---|---|
803d6d631a |
75
sources/3rdparty/fontdialog/fontdialog.cpp
vendored
75
sources/3rdparty/fontdialog/fontdialog.cpp
vendored
@ -39,6 +39,81 @@ void CFont::setCurrentColor(const QColor color)
|
||||
}
|
||||
|
||||
|
||||
int CFont::html2QFont(const int htmlWeight)
|
||||
{
|
||||
int weight = 16;
|
||||
switch(htmlWeight) {
|
||||
case 100:
|
||||
weight = 16;
|
||||
break;
|
||||
case 200:
|
||||
case 300:
|
||||
weight = 25;
|
||||
break;
|
||||
case 400:
|
||||
weight = 50;
|
||||
break;
|
||||
case 500:
|
||||
case 600:
|
||||
weight = 63;
|
||||
break;
|
||||
case 700:
|
||||
case 800:
|
||||
weight = 75;
|
||||
break;
|
||||
case 900:
|
||||
weight = 87;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return weight;
|
||||
}
|
||||
|
||||
|
||||
int CFont::qFont2html(const int weight)
|
||||
{
|
||||
int htmlWeight = 400;
|
||||
switch(weight) {
|
||||
case 16:
|
||||
htmlWeight = 100;
|
||||
break;
|
||||
case 25:
|
||||
htmlWeight = 300;
|
||||
break;
|
||||
case 50:
|
||||
htmlWeight = 400;
|
||||
break;
|
||||
case 63:
|
||||
htmlWeight = 600;
|
||||
break;
|
||||
case 75:
|
||||
htmlWeight = 800;
|
||||
break;
|
||||
case 87:
|
||||
htmlWeight = 900;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return htmlWeight;
|
||||
}
|
||||
|
||||
|
||||
int CFont::htmlWeight()
|
||||
{
|
||||
return CFont::qFont2html(weight());
|
||||
}
|
||||
|
||||
|
||||
void CFont::setHtmlWeight(const int htmlWeight)
|
||||
{
|
||||
setWeight(CFont::html2QFont(htmlWeight));
|
||||
}
|
||||
|
||||
|
||||
CFont CFont::fromQFont(const QFont font, const QColor color)
|
||||
{
|
||||
return CFont(font.family(), font.pointSize(), font.weight(), font.italic(), color);
|
||||
|
5
sources/3rdparty/fontdialog/fontdialog.h
vendored
5
sources/3rdparty/fontdialog/fontdialog.h
vendored
@ -34,6 +34,11 @@ public:
|
||||
// color properties
|
||||
QColor color();
|
||||
void setCurrentColor(const QColor color);
|
||||
// html weight properties
|
||||
static int html2QFont(const int htmlWeight);
|
||||
static int qFont2html(const int weight);
|
||||
int htmlWeight();
|
||||
void setHtmlWeight(const int htmlWeight);
|
||||
// conversion to QFont
|
||||
static CFont fromQFont(const QFont font,
|
||||
const QColor color = QColor(QString("#000000")));
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <QQmlPropertyMap>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
||||
@ -284,6 +285,7 @@ void AWConfigHelper::writeFile(QSettings &_settings, const QString &_key, const
|
||||
QFile file(_fileName);
|
||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
QTextStream out(&file);
|
||||
out.setCodec("UTF-8");
|
||||
out << _settings.value(_key).toString().toUtf8();
|
||||
out.flush();
|
||||
file.close();
|
||||
|
@ -17,8 +17,7 @@
|
||||
|
||||
#include "awdataengineaggregator.h"
|
||||
|
||||
#include <QDBusConnection>
|
||||
#include <ksysguard/systemstats/DBusInterface.h>
|
||||
#include <Plasma/DataContainer>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
||||
@ -28,19 +27,20 @@ AWDataEngineAggregator::AWDataEngineAggregator(QObject *_parent)
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
|
||||
qDBusRegisterMetaType<KSysGuard::SensorData>();
|
||||
qDBusRegisterMetaType<KSysGuard::SensorInfo>();
|
||||
qDBusRegisterMetaType<KSysGuard::SensorDataList>();
|
||||
qDBusRegisterMetaType<QHash<QString, KSysGuard::SensorInfo>>();
|
||||
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");
|
||||
|
||||
m_interface = new KSysGuard::SystemStats::DBusInterface(
|
||||
KSysGuard::SystemStats::ServiceName, KSysGuard::SystemStats::ObjectPath, QDBusConnection::sessionBus(), this);
|
||||
connect(m_interface, SIGNAL(newSensorData(KSysGuard::SensorDataList)), this,
|
||||
SLOT(updateData(KSysGuard::SensorDataList)));
|
||||
connect(m_interface, SIGNAL(sensorAdded(const QString &)), this, SLOT(sensorAdded(const QString &)));
|
||||
connect(m_interface, SIGNAL(sensorMetaDataChanged(const QHash<QString, KSysGuard::SensorInfo> &)), this,
|
||||
SLOT(updateSensor(const QHash<QString, KSysGuard::SensorInfo> &)));
|
||||
connect(m_interface, SIGNAL(sensorRemoved(const QString &)), this, SLOT(sensorRemoved(const QString &)));
|
||||
// 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");
|
||||
}
|
||||
|
||||
|
||||
@ -54,5 +54,62 @@ AWDataEngineAggregator::~AWDataEngineAggregator()
|
||||
|
||||
void AWDataEngineAggregator::disconnectSources()
|
||||
{
|
||||
m_interface->unsubscribe(m_sensors.values());
|
||||
for (auto dataEngine : m_dataEngines.values())
|
||||
for (auto &source : dataEngine->sources())
|
||||
dataEngine->disconnectSource(source, parent());
|
||||
disconnect(m_newSourceConnection);
|
||||
}
|
||||
|
||||
|
||||
void AWDataEngineAggregator::reconnectSources(const int _interval)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Reconnect sources with interval" << _interval;
|
||||
|
||||
disconnectSources();
|
||||
|
||||
m_dataEngines["systemmonitor"]->connectAllSources(parent(), (uint)_interval);
|
||||
m_dataEngines["extsysmon"]->connectAllSources(parent(), (uint)_interval);
|
||||
m_dataEngines["time"]->connectSource("Local", parent(), 1000);
|
||||
|
||||
m_newSourceConnection = connect(
|
||||
m_dataEngines["systemmonitor"], &Plasma::DataEngine::sourceAdded, [this, _interval](const QString &source) {
|
||||
emit(deviceAdded(source));
|
||||
m_dataEngines["systemmonitor"]->connectSource(source, parent(), (uint)_interval);
|
||||
});
|
||||
|
||||
#ifdef BUILD_FUTURE
|
||||
createQueuedConnection();
|
||||
#endif /* BUILD_FUTURE */
|
||||
}
|
||||
|
||||
|
||||
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 all engines
|
||||
for (auto dataEngine : m_dataEngines.values())
|
||||
dataEngine->disconnectSource(_source, parent());
|
||||
}
|
||||
|
||||
|
||||
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()) {
|
||||
// different source set for different engines
|
||||
QStringList sources = dataEngine == "time" ? QStringList() << "Local" : m_dataEngines[dataEngine]->sources();
|
||||
// reconnect sources
|
||||
for (auto &source : sources) {
|
||||
Plasma::DataContainer *container = m_dataEngines[dataEngine]->containerForSource(source);
|
||||
// disconnect old connections first
|
||||
disconnect(container, SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data)), parent(),
|
||||
SLOT(dataUpdated(QString, Plasma::DataEngine::Data)));
|
||||
// and now reconnect with Qt::QueuedConnection type
|
||||
connect(container, SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data)), parent(),
|
||||
SLOT(dataUpdated(QString, Plasma::DataEngine::Data)), Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,16 +19,10 @@
|
||||
#ifndef AWDATAENGINEAGGREGATOR_H
|
||||
#define AWDATAENGINEAGGREGATOR_H
|
||||
|
||||
#include <ksysguard/systemstats/SensorInfo.h>
|
||||
#include <Plasma/DataEngine>
|
||||
#include <Plasma/DataEngineConsumer>
|
||||
|
||||
#include <QObject>
|
||||
#include <QSet>
|
||||
|
||||
|
||||
namespace KSysGuard::SystemStats
|
||||
{
|
||||
class DBusInterface;
|
||||
}
|
||||
|
||||
|
||||
class AWDataEngineAggregator : public QObject
|
||||
@ -39,20 +33,19 @@ public:
|
||||
explicit AWDataEngineAggregator(QObject *_parent = nullptr);
|
||||
~AWDataEngineAggregator() override;
|
||||
void disconnectSources();
|
||||
void reconnectSources(int _interval);
|
||||
|
||||
signals:
|
||||
void deviceAdded(const QString &_source);
|
||||
|
||||
public slots:
|
||||
void sensorAdded(const QString &_sensor);
|
||||
void sensorRemoved(const QString &_sensor);
|
||||
void updateData(KSysGuard::SensorDataList _data);
|
||||
void updateSensor(const QHash<QString, KSysGuard::SensorInfo> &_sensor);
|
||||
void dropSource(const QString &_source);
|
||||
|
||||
private:
|
||||
void createQueuedConnection();
|
||||
KSysGuard::SystemStats::DBusInterface *m_interface = nullptr;
|
||||
QSet<QString> m_sensors;
|
||||
Plasma::DataEngineConsumer *m_consumer = nullptr;
|
||||
QHash<QString, Plasma::DataEngine *> m_dataEngines;
|
||||
QMetaObject::Connection m_newSourceConnection;
|
||||
};
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "awdataenginemapper.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include <QRegExp>
|
||||
|
||||
#include "awdebug.h"
|
||||
#include "awformatterhelper.h"
|
||||
@ -81,15 +81,15 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
|
||||
qCDebug(LOG_AW) << "Source" << _source << "with units" << _units;
|
||||
|
||||
// regular expressions
|
||||
auto cpuRegExp = QRegularExpression("cpu/cpu.*/TotalLoad");
|
||||
auto cpuclRegExp = QRegularExpression("cpu/cpu.*/clock");
|
||||
auto hddrRegExp = QRegularExpression("disk/.*/Rate/rblk");
|
||||
auto hddwRegExp = QRegularExpression("disk/.*/Rate/wblk");
|
||||
auto mountFillRegExp = QRegularExpression("partitions/.*/filllevel");
|
||||
auto mountFreeRegExp = QRegularExpression("partitions/.*/freespace");
|
||||
auto mountUsedRegExp = QRegularExpression("partitions/.*/usedspace");
|
||||
auto netRegExp = QRegularExpression("network/interfaces/.*/(receiver|transmitter)/data$");
|
||||
auto netTotalRegExp = QRegularExpression("network/interfaces/.*/(receiver|transmitter)/dataTotal$");
|
||||
QRegExp cpuRegExp = QRegExp("cpu/cpu.*/TotalLoad");
|
||||
QRegExp cpuclRegExp = QRegExp("cpu/cpu.*/clock");
|
||||
QRegExp hddrRegExp = QRegExp("disk/.*/Rate/rblk");
|
||||
QRegExp hddwRegExp = QRegExp("disk/.*/Rate/wblk");
|
||||
QRegExp mountFillRegExp = QRegExp("partitions/.*/filllevel");
|
||||
QRegExp mountFreeRegExp = QRegExp("partitions/.*/freespace");
|
||||
QRegExp mountUsedRegExp = QRegExp("partitions/.*/usedspace");
|
||||
QRegExp netRegExp = QRegExp("network/interfaces/.*/(receiver|transmitter)/data$");
|
||||
QRegExp netTotalRegExp = QRegExp("network/interfaces/.*/(receiver|transmitter)/dataTotal$");
|
||||
|
||||
if (_source == "battery/ac") {
|
||||
// AC
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include <QDir>
|
||||
#include <QNetworkInterface>
|
||||
#include <QRegularExpression>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
|
||||
@ -43,7 +42,7 @@ bool AWKeyCache::addKeyToCache(const QString &_type, const QString &_key)
|
||||
|
||||
if (_type == "hdd") {
|
||||
QStringList allDevices = QDir("/dev").entryList(QDir::System, QDir::Name);
|
||||
QStringList devices = allDevices.filter(QRegularExpression("^[hms]d[a-z]$"));
|
||||
QStringList devices = allDevices.filter(QRegExp("^[hms]d[a-z]$"));
|
||||
for (auto &dev : devices) {
|
||||
QString device = QString("/dev/%1").arg(dev);
|
||||
if (cachedValues.contains(device))
|
||||
@ -94,7 +93,7 @@ QStringList AWKeyCache::getRequiredKeys(const QStringList &_keys, const QStringL
|
||||
|
||||
// insert depending keys, refer to AWKeys::calculateValues()
|
||||
// hddtotmb*
|
||||
for (auto &key : _allKeys.filter(QRegularExpression("^hddtotmb"))) {
|
||||
for (auto &key : _allKeys.filter(QRegExp("^hddtotmb"))) {
|
||||
if (!used.contains(key))
|
||||
continue;
|
||||
key.remove("hddtotmb");
|
||||
@ -102,7 +101,7 @@ QStringList AWKeyCache::getRequiredKeys(const QStringList &_keys, const QStringL
|
||||
used << QString("hddfreemb%1").arg(index) << QString("hddmb%1").arg(index);
|
||||
}
|
||||
// hddtotgb*
|
||||
for (auto &key : _allKeys.filter(QRegularExpression("^hddtotgb"))) {
|
||||
for (auto &key : _allKeys.filter(QRegExp("^hddtotgb"))) {
|
||||
if (!used.contains(key))
|
||||
continue;
|
||||
key.remove("hddtotgb");
|
||||
@ -139,7 +138,7 @@ QStringList AWKeyCache::getRequiredKeys(const QStringList &_keys, const QStringL
|
||||
for (auto &key : netKeys) {
|
||||
if (!used.contains(key))
|
||||
continue;
|
||||
QStringList filt = _allKeys.filter(QRegularExpression(QString("^%1[0-9]{1,}").arg(key)));
|
||||
QStringList filt = _allKeys.filter(QRegExp(QString("^%1[0-9]{1,}").arg(key)));
|
||||
for (auto &filtered : filt)
|
||||
used << filtered;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "awkeyoperations.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegExp>
|
||||
#include <QThread>
|
||||
|
||||
#include "awcustomkeyshelper.h"
|
||||
@ -206,7 +206,7 @@ QString AWKeyOperations::infoByKey(const QString &_key) const
|
||||
qCDebug(LOG_AW) << "Requested key" << _key;
|
||||
|
||||
QString stripped = _key;
|
||||
stripped.remove(QRegularExpression("\\d+"));
|
||||
stripped.remove(QRegExp("\\d+"));
|
||||
QString output;
|
||||
|
||||
if (_key.startsWith("bar")) {
|
||||
@ -217,31 +217,31 @@ QString AWKeyOperations::infoByKey(const QString &_key) const
|
||||
AbstractExtItem *item = m_extScripts->itemByTag(_key, stripped);
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
} else if (_key.contains(QRegularExpression("^hdd[rw]"))) {
|
||||
} else if (_key.contains(QRegExp("^hdd[rw]"))) {
|
||||
QString index = _key;
|
||||
index.remove(QRegularExpression("hdd[rw]"));
|
||||
index.remove(QRegExp("hdd[rw]"));
|
||||
output = m_devices["disk"][index.toInt()];
|
||||
} else if (_key.contains(QRegularExpression("^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)"))) {
|
||||
} else if (_key.contains(QRegExp("^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)"))) {
|
||||
QString index = _key;
|
||||
index.remove(QRegularExpression("^hdd(|mb|gb|freemb|freegb|totmb|totgb)"));
|
||||
index.remove(QRegExp("^hdd(|mb|gb|freemb|freegb|totmb|totgb)"));
|
||||
output = m_devices["mount"][index.toInt()];
|
||||
} else if (_key.startsWith("hddtemp")) {
|
||||
QString index = _key;
|
||||
index.remove("hddtemp");
|
||||
output = m_devices["hdd"][index.toInt()];
|
||||
} else if (_key.contains(QRegularExpression("^(down|up)[0-9]"))) {
|
||||
} else if (_key.contains(QRegExp("^(down|up)[0-9]"))) {
|
||||
QString index = _key;
|
||||
index.remove(QRegularExpression("^(down|up)"));
|
||||
index.remove(QRegExp("^(down|up)"));
|
||||
output = m_devices["net"][index.toInt()];
|
||||
} else if (_key.startsWith("pkgcount")) {
|
||||
AbstractExtItem *item = m_extUpgrade->itemByTag(_key, stripped);
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
} else if (_key.contains(QRegularExpression("(^|perc)(ask|bid|price)(chg|)"))) {
|
||||
} else if (_key.contains(QRegExp("(^|perc)(ask|bid|price)(chg|)"))) {
|
||||
AbstractExtItem *item = m_extQuotes->itemByTag(_key, stripped);
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
} else if (_key.contains(QRegularExpression("(weather|weatherId|humidity|pressure|temperature)"))) {
|
||||
} else if (_key.contains(QRegExp("(weather|weatherId|humidity|pressure|temperature)"))) {
|
||||
AbstractExtItem *item = m_extWeather->itemByTag(_key, stripped);
|
||||
if (item)
|
||||
output = item->uniq();
|
||||
@ -280,7 +280,7 @@ void AWKeyOperations::editItem(const QString &_type)
|
||||
qCDebug(LOG_AW) << "Item type" << _type;
|
||||
|
||||
if (_type == "graphicalitem") {
|
||||
QStringList keys = dictKeys().filter(QRegularExpression("^(cpu(?!cl).*|gpu$|mem$|swap$|hdd[0-9].*|bat.*)"));
|
||||
QStringList keys = dictKeys().filter(QRegExp("^(cpu(?!cl).*|gpu$|mem$|swap$|hdd[0-9].*|bat.*)"));
|
||||
keys.sort();
|
||||
m_graphicalItems->setConfigArgs(keys);
|
||||
return m_graphicalItems->editItems();
|
||||
@ -302,8 +302,8 @@ void AWKeyOperations::addDevice(const QString &_source)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Source" << _source;
|
||||
|
||||
auto diskRegexp = QRegularExpression("disk/(?:md|sd|hd)[a-z|0-9]_.*/Rate/(?:rblk)");
|
||||
auto mountRegexp = QRegularExpression("partitions/.*/filllevel");
|
||||
QRegExp diskRegexp = QRegExp("disk/(?:md|sd|hd)[a-z|0-9]_.*/Rate/(?:rblk)");
|
||||
QRegExp mountRegexp = QRegExp("partitions/.*/filllevel");
|
||||
|
||||
if (_source.contains(diskRegexp)) {
|
||||
QString device = _source;
|
||||
|
@ -148,7 +148,7 @@ QStringList AWKeys::dictKeys(const bool _sorted, const QString &_regexp) const
|
||||
if (_sorted)
|
||||
allKeys.sort();
|
||||
|
||||
return allKeys.filter(QRegularExpression(_regexp));
|
||||
return allKeys.filter(QRegExp(_regexp));
|
||||
}
|
||||
|
||||
|
||||
@ -199,11 +199,10 @@ void AWKeys::editItem(const QString &_type)
|
||||
}
|
||||
|
||||
|
||||
void AWKeys::dataUpdated(const KSysGuard::SensorDataList &_data)
|
||||
void AWKeys::dataUpdated(const QString &_sourceName, const Plasma::DataEngine::Data &_data)
|
||||
{
|
||||
// TODO use QtConcurrent::map or something like that
|
||||
for (auto &sensor : _data)
|
||||
QtConcurrent::run(m_threadPool, this, &AWKeys::setDataBySource, sensor);
|
||||
// run concurrent data update
|
||||
QtConcurrent::run(m_threadPool, this, &AWKeys::setDataBySource, _sourceName, _data);
|
||||
}
|
||||
|
||||
|
||||
@ -352,9 +351,9 @@ QString AWKeys::parsePattern(QString _pattern) const
|
||||
}
|
||||
|
||||
|
||||
void AWKeys::setDataBySource(const QString &_sourceName, const KSysGuard::SensorData &_data)
|
||||
void AWKeys::setDataBySource(const QString &_sourceName, const QVariantMap &_data)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Source" << _sourceName << "with data" << _data.payload;
|
||||
qCDebug(LOG_AW) << "Source" << _sourceName << "with data" << _data;
|
||||
|
||||
// first list init
|
||||
QStringList tags = m_aggregator->keysFromSource(_sourceName);
|
||||
|
@ -19,11 +19,11 @@
|
||||
#ifndef AWKEYS_H
|
||||
#define AWKEYS_H
|
||||
|
||||
#include <Plasma/DataEngine>
|
||||
|
||||
#include <QMutex>
|
||||
#include <QObject>
|
||||
|
||||
#include <ksysguard/systemstats/SensorInfo.h>
|
||||
|
||||
|
||||
class AWDataAggregator;
|
||||
class AWDataEngineAggregator;
|
||||
@ -56,7 +56,9 @@ public:
|
||||
Q_INVOKABLE void editItem(const QString &_type);
|
||||
|
||||
public slots:
|
||||
void dataUpdated(const KSysGuard::SensorDataList &_data);
|
||||
void dataUpdated(const QString &_sourceName, const Plasma::DataEngine::Data &_data);
|
||||
// dummy method required by DataEngine connections
|
||||
static void modelChanged(const QString &, QAbstractItemModel *){};
|
||||
|
||||
signals:
|
||||
void dropSourceFromDataengine(const QString &_source);
|
||||
@ -72,7 +74,7 @@ private:
|
||||
void calculateValues();
|
||||
void createDBusInterface();
|
||||
[[nodiscard]] QString parsePattern(QString _pattern) const;
|
||||
void setDataBySource(const KSysGuard::SensorData &_data);
|
||||
void setDataBySource(const QString &_sourceName, const QVariantMap &_data);
|
||||
// objects
|
||||
AWDataAggregator *m_dataAggregator = nullptr;
|
||||
AWDataEngineAggregator *m_dataEngineAggregator = nullptr;
|
||||
|
@ -130,7 +130,7 @@ QString AWPatternFunctions::insertAllKeys(QString _code, const QStringList &_key
|
||||
QList<AWPatternFunctions::AWFunction> found = AWPatternFunctions::findFunctionCalls("aw_all", _code);
|
||||
for (auto &function : found) {
|
||||
QString separator = function.args.isEmpty() ? "," : function.args.at(0);
|
||||
QStringList required = _keys.filter(QRegularExpression(function.body));
|
||||
QStringList required = _keys.filter(QRegExp(function.body));
|
||||
std::for_each(required.begin(), required.end(), [](QString &value) { value = QString("%1: $%1").arg(value); });
|
||||
|
||||
_code.replace(function.what, required.join(separator));
|
||||
@ -146,7 +146,7 @@ QString AWPatternFunctions::insertKeyCount(QString _code, const QStringList &_ke
|
||||
|
||||
QList<AWPatternFunctions::AWFunction> found = AWPatternFunctions::findFunctionCalls("aw_count", _code);
|
||||
for (auto &function : found) {
|
||||
int count = _keys.filter(QRegularExpression(function.body)).count();
|
||||
int count = _keys.filter(QRegExp(function.body)).count();
|
||||
|
||||
_code.replace(function.what, QString::number(count));
|
||||
}
|
||||
@ -162,7 +162,7 @@ QString AWPatternFunctions::insertKeyNames(QString _code, const QStringList &_ke
|
||||
QList<AWPatternFunctions::AWFunction> found = AWPatternFunctions::findFunctionCalls("aw_names", _code);
|
||||
for (auto &function : found) {
|
||||
QString separator = function.args.isEmpty() ? "," : function.args.at(0);
|
||||
QStringList required = _keys.filter(QRegularExpression(function.body));
|
||||
QStringList required = _keys.filter(QRegExp(function.body));
|
||||
|
||||
_code.replace(function.what, required.join(separator));
|
||||
}
|
||||
@ -178,7 +178,7 @@ QString AWPatternFunctions::insertKeys(QString _code, const QStringList &_keys)
|
||||
QList<AWPatternFunctions::AWFunction> found = AWPatternFunctions::findFunctionCalls("aw_keys", _code);
|
||||
for (auto &function : found) {
|
||||
QString separator = function.args.isEmpty() ? "," : function.args.at(0);
|
||||
QStringList required = _keys.filter(QRegularExpression(function.body));
|
||||
QStringList required = _keys.filter(QRegExp(function.body));
|
||||
std::for_each(required.begin(), required.end(), [](QString &value) { value = QString("$%1").arg(value); });
|
||||
|
||||
_code.replace(function.what, required.join(separator));
|
||||
|
@ -92,7 +92,7 @@ QStringList DPAdds::dictKeys(const bool _sorted, const QString &_regexp)
|
||||
if (_sorted)
|
||||
allKeys.sort();
|
||||
|
||||
return allKeys.filter(QRegularExpression(_regexp));
|
||||
return allKeys.filter(QRegExp(_regexp));
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "extsysmon.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QRegularExpression>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
|
||||
@ -128,7 +127,7 @@ QHash<QString, QString> ExtendedSysMon::updateConfiguration(QHash<QString, QStri
|
||||
} else {
|
||||
QStringList deviceList = _rawConfig["HDDDEV"].split(',', Qt::SkipEmptyParts);
|
||||
QStringList devices;
|
||||
auto diskRegexp = QRegularExpression("^/dev/[hms]d[a-z]$");
|
||||
QRegExp diskRegexp = QRegExp("^/dev/[hms]d[a-z]$");
|
||||
for (auto &device : deviceList)
|
||||
if ((QFile::exists(device)) && (device.contains(diskRegexp)))
|
||||
devices.append(device);
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
static int index(const QString &_source)
|
||||
{
|
||||
QRegularExpression rx("\\d+");
|
||||
return rx.match(_source).captured().toInt();
|
||||
return rx.globalMatch(_source).next().captured(1).toInt();
|
||||
}
|
||||
|
||||
signals:
|
||||
|
@ -22,9 +22,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_D
|
||||
find_package(KF6 REQUIRED COMPONENTS I18n Notifications Service WindowSystem)
|
||||
find_package(LibTaskManager REQUIRED)
|
||||
find_package(Plasma REQUIRED)
|
||||
find_package(KSysGuard REQUIRED)
|
||||
include(KDEInstallDirs)
|
||||
include(KDECMakeSettings)
|
||||
include(KDECompilerSettings)
|
||||
set(Kf6_INCLUDE ${KDE_INSTALL_FULL_INCLUDEDIR_KF})
|
||||
set(Kf6_LIBRARIES KF6::I18n KF6::Notifications KF6::WindowSystem KSysGuard::Sensors KSysGuard::SensorFaces PW::LibTaskManager)
|
||||
set(Kf6_LIBRARIES KF6::I18n KF6::Notifications KF6::WindowSystem PW::LibTaskManager)
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#include "testawpatternfunctions.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include <QtTest>
|
||||
|
||||
#include "awpatternfunctions.h"
|
||||
@ -58,7 +57,7 @@ void TestAWPatternFunctions::test_findKeys()
|
||||
QStringList allKeys;
|
||||
for (int i = 0; i < count; i++) {
|
||||
auto key = AWTestLibrary::randomString(1, 20);
|
||||
while (allKeys.indexOf(QRegularExpression(QString("^%1.*").arg(key))) != -1)
|
||||
while (allKeys.indexOf(QRegExp(QString("^%1.*").arg(key))) != -1)
|
||||
key = AWTestLibrary::randomString(1, 20);
|
||||
allKeys.append(key);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user