From 81105fb12df47ee9733c3f8d26b229f46a90cbd6 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Thu, 28 Aug 2014 23:00:08 +0400 Subject: [PATCH] remove dublicates --- CHANGELOG | 1 + CHANGELOG-RU | 1 + sources/desktop-panel/desktop-panel.cpp | 50 ++++--------------------- sources/desktop-panel/desktop-panel.h | 1 - sources/ext-sysmon/extsysmon.cpp | 27 +++++-------- 5 files changed, 19 insertions(+), 61 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9f2bd86..60ca3bf 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ Ver.1.11.0: + added PTM desktop panel + added desktop label (tags $name, $number, $total) + added ability to interact with players using mpris +* rewrite to use submodules * rewrite dataengine to use tasks * fix nvidia temperature definition diff --git a/CHANGELOG-RU b/CHANGELOG-RU index 474fa0d..e1f0c17 100644 --- a/CHANGELOG-RU +++ b/CHANGELOG-RU @@ -4,6 +4,7 @@ + добавлен виджет PTM desktop panel + добавлено поле текущий рабочий стол (теги $name, $number, $total) + добавлена возможность взаимодействия с плеерами через mpris +* добавлено использование сабмодулей * dataengine переписан с использованием tasks * фикс чтения температуры nvidia diff --git a/sources/desktop-panel/desktop-panel.cpp b/sources/desktop-panel/desktop-panel.cpp index 45cd1e9..d96f1b1 100644 --- a/sources/desktop-panel/desktop-panel.cpp +++ b/sources/desktop-panel/desktop-panel.cpp @@ -122,43 +122,6 @@ void DesktopPanel::init() } -QStringList DesktopPanel::getDesktopNames() -{ - if (debug) qDebug() << PDEBUG; - - QStringList list; - QString fileName = KGlobal::dirs()->findResource("config", "kwinrc"); - if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName; - QFile configFile(fileName); - if (!configFile.open(QIODevice::ReadOnly)) return list; - - QString fileStr; - QStringList value; - bool desktopSection = false; - while (true) { - fileStr = QString(configFile.readLine()).trimmed(); - if ((fileStr.isEmpty()) && (!configFile.atEnd())) continue; - if ((fileStr[0] == QChar('#')) && (!configFile.atEnd())) continue; - if ((fileStr[0] == QChar(';')) && (!configFile.atEnd())) continue; - if (fileStr[0] == QChar('[')) desktopSection = false; - if (fileStr == QString("[Desktops]")) desktopSection = true; - if (desktopSection) { - if (fileStr.contains(QChar('='))) { - value.clear(); - for (int i=1; iview()->isVisible(); int winId = panels[i]->view()->winId(); @@ -337,6 +301,10 @@ void DesktopPanel::dataUpdated(const QString &sourceName, const Plasma::DataEngi return; if (sourceName == QString("desktop")) { currentDesktop = data[QString("currentNumber")].toInt(); + if (desktopNames.isEmpty()) { + desktopNames = data[QString("list")].toString().split(QString(";;")); + reinit(); + } updateText(); } } @@ -484,8 +452,6 @@ void DesktopPanel::configChanged() configuration[QString("pattern")] = cg.readEntry("pattern", "[$mark$number/$total: $name]"); configuration[QString("rightStretch")] = cg.readEntry("rightStretch", "2"); - desktopNames = getDesktopNames(); - extsysmonEngine->connectSource(QString("desktop"), this, configuration[QString("interval")].toInt()); QString fontFamily = cg.readEntry("currentFontFamily", "Terminus"); diff --git a/sources/desktop-panel/desktop-panel.h b/sources/desktop-panel/desktop-panel.h index b63b486..d80574d 100644 --- a/sources/desktop-panel/desktop-panel.h +++ b/sources/desktop-panel/desktop-panel.h @@ -81,7 +81,6 @@ protected: private: // functions - QStringList getDesktopNames(); QList getPanels(); QString panelLocationToStr(Plasma::Location loc); void updateText(); diff --git a/sources/ext-sysmon/extsysmon.cpp b/sources/ext-sysmon/extsysmon.cpp index 6bc45a2..3f3a24a 100644 --- a/sources/ext-sysmon/extsysmon.cpp +++ b/sources/ext-sysmon/extsysmon.cpp @@ -454,8 +454,7 @@ QMap ExtendedSysMon::getPlayerInfo(const QString playerName, else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("time")) { info[QString("duration")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed().split(QString(":"))[0]; info[QString("progress")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed().split(QString(":"))[1]; - } - else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Title")) + } else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Title")) info[QString("title")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed(); } } @@ -471,8 +470,7 @@ QMap ExtendedSysMon::getPlayerInfo(const QString playerName, info[QString("duration")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed(); else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("title")) info[QString("title")] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed(); - } - else { + } else { int time = qstr.toInt() / 1000; info[QString("progress")] = QString::number(time); } @@ -550,38 +548,31 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source) setData(source, QString("custom") + QString::number(i), getCustomCmd(configuration[QString("CUSTOM")].split(QString("@@"), QString::SkipEmptyParts)[i])); } - } - else if (source == QString("desktop")) { + } else if (source == QString("desktop")) { QMap desktop = getCurrentDesktop(configuration[QString("DESKTOPCMD")]); for (int i=0; i player = getPlayerInfo(configuration[QString("PLAYER")], configuration[QString("MPDADDRESS")], configuration[QString("MPDPORT")], configuration[QString("MPRIS")]); for (int i=0; i ps = getPsStats(); for (int i=0; i