mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-16 07:09:58 +00:00
port library
This commit is contained in:
@ -8,11 +8,11 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../${PROJECT_LIBRARY}/
|
||||
${PROJECT_TRDPARTY_DIR}
|
||||
${Qt_INCLUDE}
|
||||
${Kf5_INCLUDE}
|
||||
${Kf6_INCLUDE}
|
||||
)
|
||||
|
||||
file(GLOB SUBPROJECT_SOURCE *.cpp)
|
||||
file(GLOB SUBPROJECT_HEADER *.h)
|
||||
|
||||
add_library(${SUBPROJECT} STATIC ${SUBPROJECT_SOURCE} ${SUBPROJECT_HEADER})
|
||||
target_link_libraries(${SUBPROJECT} ${PROJECT_LIBRARY} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||
target_link_libraries(${SUBPROJECT} ${PROJECT_LIBRARY} ${Qt_LIBRARIES} ${Kf6_LIBRARIES})
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define ABSTRACTEXTSYSMONSOURCE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QVariant>
|
||||
|
||||
|
||||
@ -38,9 +38,8 @@ public:
|
||||
// used by extensions
|
||||
static int index(const QString &_source)
|
||||
{
|
||||
QRegExp rx("\\d+");
|
||||
rx.indexIn(_source);
|
||||
return rx.cap().toInt();
|
||||
QRegularExpression rx("\\d+");
|
||||
return rx.match(_source).captured().toInt();
|
||||
}
|
||||
|
||||
signals:
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include <QFile>
|
||||
#include <QProcess>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
||||
@ -124,9 +123,9 @@ QStringList GPULoadSource::sources() const
|
||||
void GPULoadSource::updateValue()
|
||||
{
|
||||
qCInfo(LOG_ESS) << "Cmd returns" << m_process->exitCode();
|
||||
QString qdebug = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardError()).trimmed();
|
||||
QString qdebug = QString::fromUtf8(m_process->readAllStandardError()).trimmed();
|
||||
qCInfo(LOG_ESS) << "Error" << qdebug;
|
||||
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardOutput()).trimmed();
|
||||
QString qoutput = QString::fromUtf8(m_process->readAllStandardOutput()).trimmed();
|
||||
qCInfo(LOG_ESS) << "Output" << qoutput;
|
||||
|
||||
if (m_device == "nvidia") {
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include <QFile>
|
||||
#include <QProcess>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
||||
@ -103,9 +102,9 @@ QStringList GPUTemperatureSource::sources() const
|
||||
void GPUTemperatureSource::updateValue()
|
||||
{
|
||||
qCInfo(LOG_ESS) << "Cmd returns" << m_process->exitCode();
|
||||
QString qdebug = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardError()).trimmed();
|
||||
QString qdebug = QString::fromUtf8(m_process->readAllStandardError()).trimmed();
|
||||
qCInfo(LOG_ESS) << "Error" << qdebug;
|
||||
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardOutput()).trimmed();
|
||||
QString qoutput = QString::fromUtf8(m_process->readAllStandardOutput()).trimmed();
|
||||
qCInfo(LOG_ESS) << "Output" << qoutput;
|
||||
|
||||
if (m_device == "nvidia") {
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include <QDir>
|
||||
#include <QProcess>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
||||
@ -61,7 +60,7 @@ HDDTemperatureSource::~HDDTemperatureSource()
|
||||
QStringList HDDTemperatureSource::allHdd()
|
||||
{
|
||||
QStringList allDevices = QDir("/dev").entryList(QDir::System, QDir::Name);
|
||||
QStringList devices = allDevices.filter(QRegExp("^[hms]d[a-z]$"));
|
||||
QStringList devices = allDevices.filter(QRegularExpression("^[hms]d[a-z]$"));
|
||||
for (int i = 0; i < devices.count(); i++)
|
||||
devices[i] = QString("/dev/%1").arg(devices.at(i));
|
||||
|
||||
@ -120,9 +119,9 @@ void HDDTemperatureSource::updateValue(const QString &_device)
|
||||
qCDebug(LOG_ESS) << "Called with device" << _device;
|
||||
|
||||
qCInfo(LOG_ESS) << "Cmd returns" << m_processes[_device]->exitCode();
|
||||
QString qdebug = QTextCodec::codecForMib(106)->toUnicode(m_processes[_device]->readAllStandardError()).trimmed();
|
||||
QString qdebug = QString::fromUtf8(m_processes[_device]->readAllStandardError()).trimmed();
|
||||
qCInfo(LOG_ESS) << "Error" << qdebug;
|
||||
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(m_processes[_device]->readAllStandardOutput()).trimmed();
|
||||
QString qoutput = QString::fromUtf8(m_processes[_device]->readAllStandardOutput()).trimmed();
|
||||
qCInfo(LOG_ESS) << "Output" << qoutput;
|
||||
|
||||
// parse
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include <QNetworkInterface>
|
||||
#include <QProcess>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
||||
@ -101,9 +100,9 @@ QStringList NetworkSource::sources() const
|
||||
void NetworkSource::updateSsid()
|
||||
{
|
||||
qCInfo(LOG_ESS) << "Cmd returns" << m_process->exitCode();
|
||||
QString qdebug = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardError()).trimmed();
|
||||
QString qdebug = QString::fromUtf8(m_process->readAllStandardError()).trimmed();
|
||||
qCInfo(LOG_ESS) << "Error" << qdebug;
|
||||
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardOutput()).trimmed();
|
||||
QString qoutput = QString::fromUtf8(m_process->readAllStandardOutput()).trimmed();
|
||||
qCInfo(LOG_ESS) << "Output" << qoutput;
|
||||
|
||||
m_values["network/current/ssid"] = qoutput;
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <QDBusConnectionInterface>
|
||||
#include <QDBusMessage>
|
||||
#include <QProcess>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
||||
@ -219,7 +218,7 @@ QString PlayerSource::buildString(const QString &_current, const QString &_value
|
||||
qCDebug(LOG_ESS) << "Current value" << _current << "received" << _value << "will be stripped after" << _s;
|
||||
|
||||
int index = _value.indexOf(_current);
|
||||
if ((_current.isEmpty()) || ((index + _s + 1) > _value.count()))
|
||||
if ((_current.isEmpty()) || ((index + _s + 1) > _value.length()))
|
||||
return QString("%1").arg(_value.left(_s), -_s, QLatin1Char(' '));
|
||||
else
|
||||
return QString("%1").arg(_value.mid(index + 1, _s), -_s, QLatin1Char(' '));
|
||||
@ -230,8 +229,8 @@ QString PlayerSource::stripString(const QString &_value, const int _s)
|
||||
{
|
||||
qCDebug(LOG_ESS) << "New value" << _value << "will be stripped after" << _s;
|
||||
|
||||
return _value.count() > _s ? QString("%1\u2026").arg(_value.left(_s - 1))
|
||||
: _value.leftJustified(_s, QLatin1Char(' '));
|
||||
return _value.length() > _s ? QString("%1\u2026").arg(_value.left(_s - 1))
|
||||
: _value.leftJustified(_s, QLatin1Char(' '));
|
||||
}
|
||||
|
||||
|
||||
@ -249,7 +248,7 @@ void PlayerSource::mpdSocketConnected()
|
||||
|
||||
void PlayerSource::mpdSocketReadyRead()
|
||||
{
|
||||
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(m_mpdSocket.readAll()).trimmed();
|
||||
QString qoutput = QString::fromUtf8(m_mpdSocket.readAll()).trimmed();
|
||||
qCInfo(LOG_ESS) << "Output" << qoutput;
|
||||
|
||||
// parse
|
||||
|
@ -80,7 +80,7 @@ QVariantMap ProcessesSource::initialData(const QString &_source) const
|
||||
void ProcessesSource::run()
|
||||
{
|
||||
QStringList allDirectories = QDir("/proc").entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
|
||||
QStringList directories = allDirectories.filter(QRegExp("(\\d+)"));
|
||||
QStringList directories = allDirectories.filter(QRegularExpression("(\\d+)"));
|
||||
QStringList running;
|
||||
|
||||
for (auto &dir : directories) {
|
||||
|
Reference in New Issue
Block a user