mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-15 22:59:57 +00:00
finally implement bug reporting (#104)
This commit is contained in:
@ -103,7 +103,7 @@ void BatterySource::run()
|
||||
{
|
||||
// adaptor
|
||||
QFile acFile(QString("%1/AC/online").arg(m_acpiPath));
|
||||
if (acFile.open(QIODevice::ReadOnly))
|
||||
if (acFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
m_values[QString("battery/ac")]
|
||||
= (QString(acFile.readLine()).trimmed().toInt() == 1);
|
||||
acFile.close();
|
||||
@ -116,8 +116,8 @@ void BatterySource::run()
|
||||
QString("%1/BAT%2/energy_now").arg(m_acpiPath).arg(i));
|
||||
QFile fullLevelFile(
|
||||
QString("%1/BAT%2/energy_full").arg(m_acpiPath).arg(i));
|
||||
if ((currentLevelFile.open(QIODevice::ReadOnly))
|
||||
&& (fullLevelFile.open(QIODevice::ReadOnly))) {
|
||||
if ((currentLevelFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
&& (fullLevelFile.open(QIODevice::ReadOnly | QIODevice::Text))) {
|
||||
float batCurrent
|
||||
= QString(currentLevelFile.readLine()).trimmed().toFloat();
|
||||
float batFull
|
||||
|
@ -56,10 +56,14 @@ QString GPULoadSource::autoGpu()
|
||||
{
|
||||
QString gpu = QString("disable");
|
||||
QFile moduleFile(QString("/proc/modules"));
|
||||
if (!moduleFile.open(QIODevice::ReadOnly))
|
||||
if (!moduleFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
qCWarning(LOG_AW) << "Could not open file as text"
|
||||
<< moduleFile.fileName();
|
||||
return gpu;
|
||||
}
|
||||
|
||||
QString output = moduleFile.readAll();
|
||||
moduleFile.close();
|
||||
if (output.contains(QString("fglrx")))
|
||||
gpu = QString("ati");
|
||||
else if (output.contains(QString("nvidia")))
|
||||
|
@ -57,10 +57,14 @@ QString GPUTemperatureSource::autoGpu()
|
||||
{
|
||||
QString gpu = QString("disable");
|
||||
QFile moduleFile(QString("/proc/modules"));
|
||||
if (!moduleFile.open(QIODevice::ReadOnly))
|
||||
if (!moduleFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
qCWarning(LOG_AW) << "Could not open file as text"
|
||||
<< moduleFile.fileName();
|
||||
return gpu;
|
||||
}
|
||||
|
||||
QString output = moduleFile.readAll();
|
||||
moduleFile.close();
|
||||
if (output.contains(QString("fglrx")))
|
||||
gpu = QString("ati");
|
||||
else if (output.contains(QString("nvidia")))
|
||||
|
@ -87,15 +87,17 @@ void ProcessesSource::run()
|
||||
|
||||
for (auto dir : directories) {
|
||||
QFile statusFile(QString("/proc/%1/status").arg(dir));
|
||||
if (!statusFile.open(QIODevice::ReadOnly))
|
||||
if (!statusFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
continue;
|
||||
QFile cmdFile(QString("/proc/%1/cmdline").arg(dir));
|
||||
if (!cmdFile.open(QIODevice::ReadOnly))
|
||||
if (!cmdFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
continue;
|
||||
|
||||
QString output = statusFile.readAll();
|
||||
if (output.contains(QString("running")))
|
||||
running.append(cmdFile.readAll());
|
||||
statusFile.close();
|
||||
cmdFile.close();
|
||||
}
|
||||
|
||||
m_values[QString("ps/running/count")] = running.count();
|
||||
|
Reference in New Issue
Block a user