mirror of
				https://github.com/arcan1s/awesome-widgets.git
				synced 2025-11-04 06:43:41 +00:00 
			
		
		
		
	Move to QProcess from Task in GPU and player sources
This commit is contained in:
		@ -18,10 +18,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "gpuloadsource.h"
 | 
					#include "gpuloadsource.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <QProcess>
 | 
				
			||||||
#include <QTextCodec>
 | 
					#include <QTextCodec>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <task/taskadds.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "awdebug.h"
 | 
					#include "awdebug.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -32,12 +31,23 @@ GPULoadSource::GPULoadSource(QObject *parent, const QStringList args)
 | 
				
			|||||||
    qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
 | 
					    qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_device = args.at(0);
 | 
					    m_device = args.at(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    m_process = new QProcess(nullptr);
 | 
				
			||||||
 | 
					    // fucking magic from http://doc.qt.io/qt-5/qprocess.html#finished
 | 
				
			||||||
 | 
					    connect(m_process,
 | 
				
			||||||
 | 
					            static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(
 | 
				
			||||||
 | 
					                &QProcess::finished),
 | 
				
			||||||
 | 
					            [this](int, QProcess::ExitStatus) { return updateValue(); });
 | 
				
			||||||
 | 
					    m_process->waitForFinished(0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GPULoadSource::~GPULoadSource()
 | 
					GPULoadSource::~GPULoadSource()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
 | 
					    qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    m_process->kill();
 | 
				
			||||||
 | 
					    m_process->deleteLater();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -45,49 +55,10 @@ QVariant GPULoadSource::data(QString source)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    qCDebug(LOG_ESM) << "Source" << source;
 | 
					    qCDebug(LOG_ESM) << "Source" << source;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (source == QString("gpu/load")) {
 | 
					    if (source == QString("gpu/load"))
 | 
				
			||||||
        float value = 0.0;
 | 
					        run();
 | 
				
			||||||
        if ((m_device != QString("nvidia")) && (m_device != QString("ati")))
 | 
					 | 
				
			||||||
            return value;
 | 
					 | 
				
			||||||
        // build cmd
 | 
					 | 
				
			||||||
        QString cmd = m_device == QString("nvidia")
 | 
					 | 
				
			||||||
                          ? QString("nvidia-smi -q -x")
 | 
					 | 
				
			||||||
                          : QString("aticonfig --od-getclocks");
 | 
					 | 
				
			||||||
        qCInfo(LOG_ESM) << "cmd" << cmd;
 | 
					 | 
				
			||||||
        TaskResult process = runTask(cmd);
 | 
					 | 
				
			||||||
        qCInfo(LOG_ESM) << "Cmd returns" << process.exitCode;
 | 
					 | 
				
			||||||
        qCInfo(LOG_ESM) << "Error" << process.error;
 | 
					 | 
				
			||||||
        // parse
 | 
					 | 
				
			||||||
        QString qoutput
 | 
					 | 
				
			||||||
            = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
 | 
					 | 
				
			||||||
        if (m_device == QString("nvidia")) {
 | 
					 | 
				
			||||||
            for (auto str :
 | 
					 | 
				
			||||||
                 qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
 | 
					 | 
				
			||||||
                if (!str.contains(QString("<gpu_util>")))
 | 
					 | 
				
			||||||
                    continue;
 | 
					 | 
				
			||||||
                QString load = str.remove(QString("<gpu_util>"))
 | 
					 | 
				
			||||||
                                   .remove(QString("</gpu_util>"))
 | 
					 | 
				
			||||||
                                   .remove(QChar('%'));
 | 
					 | 
				
			||||||
                value = load.toFloat();
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        } else if (m_device == QString("ati")) {
 | 
					 | 
				
			||||||
            for (auto str :
 | 
					 | 
				
			||||||
                 qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
 | 
					 | 
				
			||||||
                if (!str.contains(QString("load")))
 | 
					 | 
				
			||||||
                    continue;
 | 
					 | 
				
			||||||
                QString load
 | 
					 | 
				
			||||||
                    = str.split(QChar(' '), QString::SkipEmptyParts)[3].remove(
 | 
					 | 
				
			||||||
                        QChar('%'));
 | 
					 | 
				
			||||||
                value = load.toFloat();
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        // return
 | 
					 | 
				
			||||||
        return value;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return QVariant();
 | 
					    return m_value;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -108,6 +79,20 @@ QVariantMap GPULoadSource::initialData(QString source) const
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void GPULoadSource::run()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if ((m_device != QString("nvidia")) && (m_device != QString("ati")))
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    // build cmd
 | 
				
			||||||
 | 
					    QString cmd = m_device == QString("nvidia")
 | 
				
			||||||
 | 
					                      ? QString("nvidia-smi -q -x")
 | 
				
			||||||
 | 
					                      : QString("aticonfig --od-getclocks");
 | 
				
			||||||
 | 
					    qCInfo(LOG_ESM) << "cmd" << cmd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    m_process->start(cmd);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QStringList GPULoadSource::sources() const
 | 
					QStringList GPULoadSource::sources() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    QStringList sources;
 | 
					    QStringList sources;
 | 
				
			||||||
@ -115,3 +100,39 @@ QStringList GPULoadSource::sources() const
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    return sources;
 | 
					    return sources;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void GPULoadSource::updateValue()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    qCInfo(LOG_LIB) << "Cmd returns" << m_process->exitCode();
 | 
				
			||||||
 | 
					    QString qdebug = QTextCodec::codecForMib(106)
 | 
				
			||||||
 | 
					                         ->toUnicode(m_process->readAllStandardError())
 | 
				
			||||||
 | 
					                         .trimmed();
 | 
				
			||||||
 | 
					    qCInfo(LOG_LIB) << "Error" << qdebug;
 | 
				
			||||||
 | 
					    QString qoutput = QTextCodec::codecForMib(106)
 | 
				
			||||||
 | 
					                          ->toUnicode(m_process->readAllStandardOutput())
 | 
				
			||||||
 | 
					                          .trimmed();
 | 
				
			||||||
 | 
					    qCInfo(LOG_LIB) << "Output" << qoutput;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (m_device == QString("nvidia")) {
 | 
				
			||||||
 | 
					        for (auto str : qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
 | 
				
			||||||
 | 
					            if (!str.contains(QString("<gpu_util>")))
 | 
				
			||||||
 | 
					                continue;
 | 
				
			||||||
 | 
					            QString load = str.remove(QString("<gpu_util>"))
 | 
				
			||||||
 | 
					                               .remove(QString("</gpu_util>"))
 | 
				
			||||||
 | 
					                               .remove(QChar('%'));
 | 
				
			||||||
 | 
					            m_value = load.toFloat();
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    } else if (m_device == QString("ati")) {
 | 
				
			||||||
 | 
					        for (auto str : qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
 | 
				
			||||||
 | 
					            if (!str.contains(QString("load")))
 | 
				
			||||||
 | 
					                continue;
 | 
				
			||||||
 | 
					            QString load
 | 
				
			||||||
 | 
					                = str.split(QChar(' '), QString::SkipEmptyParts)[3].remove(
 | 
				
			||||||
 | 
					                    QChar('%'));
 | 
				
			||||||
 | 
					            m_value = load.toFloat();
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -23,6 +23,8 @@
 | 
				
			|||||||
#include "abstractextsysmonsource.h"
 | 
					#include "abstractextsysmonsource.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class QProcess;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class GPULoadSource : public AbstractExtSysMonSource
 | 
					class GPULoadSource : public AbstractExtSysMonSource
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
@ -30,12 +32,17 @@ public:
 | 
				
			|||||||
    virtual ~GPULoadSource();
 | 
					    virtual ~GPULoadSource();
 | 
				
			||||||
    QVariant data(QString source);
 | 
					    QVariant data(QString source);
 | 
				
			||||||
    QVariantMap initialData(QString source) const;
 | 
					    QVariantMap initialData(QString source) const;
 | 
				
			||||||
    void run(){};
 | 
					    void run();
 | 
				
			||||||
    QStringList sources() const;
 | 
					    QStringList sources() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					private slots:
 | 
				
			||||||
 | 
					    void updateValue();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    // configuration and values
 | 
					    // configuration and values
 | 
				
			||||||
    QString m_device;
 | 
					    QString m_device;
 | 
				
			||||||
 | 
					    QProcess *m_process = nullptr;
 | 
				
			||||||
 | 
					    QVariant m_value;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -18,10 +18,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "gputempsource.h"
 | 
					#include "gputempsource.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <QProcess>
 | 
				
			||||||
#include <QTextCodec>
 | 
					#include <QTextCodec>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <task/taskadds.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "awdebug.h"
 | 
					#include "awdebug.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -33,12 +32,23 @@ GPUTemperatureSource::GPUTemperatureSource(QObject *parent,
 | 
				
			|||||||
    qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
 | 
					    qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_device = args.at(0);
 | 
					    m_device = args.at(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    m_process = new QProcess(nullptr);
 | 
				
			||||||
 | 
					    // fucking magic from http://doc.qt.io/qt-5/qprocess.html#finished
 | 
				
			||||||
 | 
					    connect(m_process,
 | 
				
			||||||
 | 
					            static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(
 | 
				
			||||||
 | 
					                &QProcess::finished),
 | 
				
			||||||
 | 
					            [this](int, QProcess::ExitStatus) { return updateValue(); });
 | 
				
			||||||
 | 
					    m_process->waitForFinished(0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GPUTemperatureSource::~GPUTemperatureSource()
 | 
					GPUTemperatureSource::~GPUTemperatureSource()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
 | 
					    qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    m_process->kill();
 | 
				
			||||||
 | 
					    m_process->deleteLater();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -46,47 +56,10 @@ QVariant GPUTemperatureSource::data(QString source)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    qCDebug(LOG_ESM) << "Source" << source;
 | 
					    qCDebug(LOG_ESM) << "Source" << source;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (source == QString("gpu/temperature")) {
 | 
					    if (source == QString("gpu/temperature"))
 | 
				
			||||||
        float value = 0.0;
 | 
					        run();
 | 
				
			||||||
        if ((m_device != QString("nvidia")) && (m_device != QString("ati")))
 | 
					 | 
				
			||||||
            return value;
 | 
					 | 
				
			||||||
        // build cmd
 | 
					 | 
				
			||||||
        QString cmd = m_device == QString("nvidia")
 | 
					 | 
				
			||||||
                          ? QString("nvidia-smi -q -x")
 | 
					 | 
				
			||||||
                          : QString("aticonfig --od-gettemperature");
 | 
					 | 
				
			||||||
        qCInfo(LOG_ESM) << "cmd" << cmd;
 | 
					 | 
				
			||||||
        TaskResult process = runTask(cmd);
 | 
					 | 
				
			||||||
        qCInfo(LOG_ESM) << "Cmd returns" << process.exitCode;
 | 
					 | 
				
			||||||
        qCInfo(LOG_ESM) << "Error" << process.error;
 | 
					 | 
				
			||||||
        // parse
 | 
					 | 
				
			||||||
        QString qoutput
 | 
					 | 
				
			||||||
            = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
 | 
					 | 
				
			||||||
        if (m_device == QString("nvidia")) {
 | 
					 | 
				
			||||||
            for (auto str :
 | 
					 | 
				
			||||||
                 qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
 | 
					 | 
				
			||||||
                if (!str.contains(QString("<gpu_temp>")))
 | 
					 | 
				
			||||||
                    continue;
 | 
					 | 
				
			||||||
                QString temp = str.remove(QString("<gpu_temp>"))
 | 
					 | 
				
			||||||
                                   .remove(QString("C</gpu_temp>"));
 | 
					 | 
				
			||||||
                value = temp.toFloat();
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        } else if (m_device == QString("ati")) {
 | 
					 | 
				
			||||||
            for (auto str :
 | 
					 | 
				
			||||||
                 qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
 | 
					 | 
				
			||||||
                if (!str.contains(QString("Temperature")))
 | 
					 | 
				
			||||||
                    continue;
 | 
					 | 
				
			||||||
                QString temp
 | 
					 | 
				
			||||||
                    = str.split(QChar(' '), QString::SkipEmptyParts).at(4);
 | 
					 | 
				
			||||||
                value = temp.toFloat();
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        // return
 | 
					 | 
				
			||||||
        return value;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return QVariant();
 | 
					    return m_value;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -107,6 +80,20 @@ QVariantMap GPUTemperatureSource::initialData(QString source) const
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void GPUTemperatureSource::run()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if ((m_device != QString("nvidia")) && (m_device != QString("ati")))
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    // build cmd
 | 
				
			||||||
 | 
					    QString cmd = m_device == QString("nvidia")
 | 
				
			||||||
 | 
					                      ? QString("nvidia-smi -q -x")
 | 
				
			||||||
 | 
					                      : QString("aticonfig --od-gettemperature");
 | 
				
			||||||
 | 
					    qCInfo(LOG_ESM) << "cmd" << cmd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    m_process->start(cmd);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QStringList GPUTemperatureSource::sources() const
 | 
					QStringList GPUTemperatureSource::sources() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    QStringList sources;
 | 
					    QStringList sources;
 | 
				
			||||||
@ -114,3 +101,36 @@ QStringList GPUTemperatureSource::sources() const
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    return sources;
 | 
					    return sources;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void GPUTemperatureSource::updateValue()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    qCInfo(LOG_LIB) << "Cmd returns" << m_process->exitCode();
 | 
				
			||||||
 | 
					    QString qdebug = QTextCodec::codecForMib(106)
 | 
				
			||||||
 | 
					                         ->toUnicode(m_process->readAllStandardError())
 | 
				
			||||||
 | 
					                         .trimmed();
 | 
				
			||||||
 | 
					    qCInfo(LOG_LIB) << "Error" << qdebug;
 | 
				
			||||||
 | 
					    QString qoutput = QTextCodec::codecForMib(106)
 | 
				
			||||||
 | 
					                          ->toUnicode(m_process->readAllStandardOutput())
 | 
				
			||||||
 | 
					                          .trimmed();
 | 
				
			||||||
 | 
					    qCInfo(LOG_LIB) << "Output" << qoutput;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (m_device == QString("nvidia")) {
 | 
				
			||||||
 | 
					        for (auto str : qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
 | 
				
			||||||
 | 
					            if (!str.contains(QString("<gpu_temp>")))
 | 
				
			||||||
 | 
					                continue;
 | 
				
			||||||
 | 
					            QString temp = str.remove(QString("<gpu_temp>"))
 | 
				
			||||||
 | 
					                               .remove(QString("C</gpu_temp>"));
 | 
				
			||||||
 | 
					            m_value = temp.toFloat();
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    } else if (m_device == QString("ati")) {
 | 
				
			||||||
 | 
					        for (auto str : qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
 | 
				
			||||||
 | 
					            if (!str.contains(QString("Temperature")))
 | 
				
			||||||
 | 
					                continue;
 | 
				
			||||||
 | 
					            QString temp = str.split(QChar(' '), QString::SkipEmptyParts).at(4);
 | 
				
			||||||
 | 
					            m_value = temp.toFloat();
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -23,6 +23,8 @@
 | 
				
			|||||||
#include "abstractextsysmonsource.h"
 | 
					#include "abstractextsysmonsource.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class QProcess;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class GPUTemperatureSource : public AbstractExtSysMonSource
 | 
					class GPUTemperatureSource : public AbstractExtSysMonSource
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
@ -30,12 +32,17 @@ public:
 | 
				
			|||||||
    virtual ~GPUTemperatureSource();
 | 
					    virtual ~GPUTemperatureSource();
 | 
				
			||||||
    QVariant data(QString source);
 | 
					    QVariant data(QString source);
 | 
				
			||||||
    QVariantMap initialData(QString source) const;
 | 
					    QVariantMap initialData(QString source) const;
 | 
				
			||||||
    void run(){};
 | 
					    void run();
 | 
				
			||||||
    QStringList sources() const;
 | 
					    QStringList sources() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					private slots:
 | 
				
			||||||
 | 
					    void updateValue();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    // configuration and values
 | 
					    // configuration and values
 | 
				
			||||||
    QString m_device;
 | 
					    QString m_device;
 | 
				
			||||||
 | 
					    QProcess *m_process = nullptr;
 | 
				
			||||||
 | 
					    QVariant m_value;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -351,12 +351,11 @@ QString PlayerSource::buildString(const QString current, const QString value,
 | 
				
			|||||||
                     << "will be stripped after" << s;
 | 
					                     << "will be stripped after" << s;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int index = value.indexOf(current);
 | 
					    int index = value.indexOf(current);
 | 
				
			||||||
    if ((current.isEmpty()) || ((index + s + 1) > value.count())) {
 | 
					    if ((current.isEmpty()) || ((index + s + 1) > value.count()))x
 | 
				
			||||||
        return QString("%1").arg(value.left(s), s, QLatin1Char(' '));
 | 
					        return QString("%1").arg(value.left(s), s, QLatin1Char(' '));
 | 
				
			||||||
    } else {
 | 
					    else
 | 
				
			||||||
        return QString("%1").arg(value.mid(index + 1, s), s, QLatin1Char(' '));
 | 
					        return QString("%1").arg(value.mid(index + 1, s), s, QLatin1Char(' '));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QString PlayerSource::stripString(const QString value, const int s) const
 | 
					QString PlayerSource::stripString(const QString value, const int s) const
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user