diff --git a/PKGBUILD b/PKGBUILD index 1dc202c..7542d03 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -21,7 +21,7 @@ optdepends=("amarok: for music player monitor" makedepends=('automoc4' 'cmake') source=(https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz) install=${pkgname}.install -md5sums=('1d970a31b4fee173a3a4803efd36b4b1') +md5sums=('4a7d526fd418513bc329ff2676f636f5') backup=('usr/share/config/extsysmon.conf') prepare() { diff --git a/readme_diff.patch b/readme_diff.patch index d4024f4..5890b99 100644 --- a/readme_diff.patch +++ b/readme_diff.patch @@ -1,5 +1,5 @@ --- README.md.orig 2014-07-08 12:10:47.217925504 +0400 -+++ README.md 2014-07-09 18:54:32.749203368 +0400 ++++ README.md 2014-07-22 09:48:59.337749400 +0400 @@ -60,6 +60,9 @@ * tag `$ps` - list of running processes * tag `$pkgcountN` - number of packages, which available to upgrade for command N. For example, `$pkgcount0` diff --git a/sources/desktop-panel/desktop-panel.cpp b/sources/desktop-panel/desktop-panel.cpp index 62a64c7..4225489 100644 --- a/sources/desktop-panel/desktop-panel.cpp +++ b/sources/desktop-panel/desktop-panel.cpp @@ -43,6 +43,7 @@ CustomPlasmaLabel::CustomPlasmaLabel(DesktopPanel *wid, const int num) debug = false; if (debug) qDebug() << "[PTM-DP]" << "Init label" << num; + number = num; widget = wid; } @@ -56,6 +57,7 @@ CustomPlasmaLabel::~CustomPlasmaLabel() int CustomPlasmaLabel::getNumber() { if (debug) qDebug() << "[PTM-DP]" << "[" << number << "]" << "[getNumber]"; + return number; } @@ -64,6 +66,7 @@ void CustomPlasmaLabel::mousePressEvent(QGraphicsSceneMouseEvent *event) { if (debug) qDebug() << "[PTM-DP]" << "[" << number << "]" << "[mouseMoveEvent]"; if (debug) qDebug() << "[PTM-DP]" << "[" << number << "]" << "[mouseMoveEvent]" << "Get signal" << event->button(); + if (event->button() == Qt::LeftButton) widget->setCurrentDesktop(number); } @@ -101,6 +104,7 @@ DesktopPanel::~DesktopPanel() void DesktopPanel::init() { if (debug) qDebug() << "[PTM-DP]" << "[init]"; + extsysmonEngine = dataEngine(QString("ext-sysmon")); layout = new QGraphicsLinearLayout(); @@ -117,19 +121,21 @@ void DesktopPanel::init() QStringList DesktopPanel::getDesktopNames() { if (debug) qDebug() << "[PTM-DP]" << "[getDesktopNames]"; + QStringList list; QString fileName = KGlobal::dirs()->findResource("config", "kwinrc"); if (debug) qDebug() << "[PTM-DP]" << "[getDesktopNames]" << ":" << "Configuration file" << fileName; - QFile confFile(fileName); - if (!confFile.open(QIODevice::ReadOnly)) return list; + QFile configFile(fileName); + if (!configFile.open(QIODevice::ReadOnly)) return list; QString fileStr; QStringList value; bool desktopSection = false; while (true) { - fileStr = QString(confFile.readLine()).trimmed(); - if (fileStr[0] == QChar('#')) continue; - if (fileStr[0] == QChar(';')) continue; + 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) { @@ -141,10 +147,10 @@ QStringList DesktopPanel::getDesktopNames() list.append(value.join(QChar('='))); } } - if (confFile.atEnd()) - break; + if (configFile.atEnd()) break; } - confFile.close(); + configFile.close(); + return list; } @@ -177,6 +183,7 @@ QString DesktopPanel::parsePattern(const QString rawLine, const int num) if (debug) qDebug() << "[PTM-DP]" << "[parsePattern]" << "Found total"; line = line.split(QString("$total"))[0] + QString::number(desktopNames.count()) + line.split(QString("$total"))[1]; } + return line; } @@ -206,7 +213,7 @@ void DesktopPanel::reinit() if (configuration[QString("layout")].toInt() == 0) layout->setOrientation(Qt::Horizontal); else - layout->setOrientation(Qt::Horizontal); + layout->setOrientation(Qt::Vertical); // left stretch if (configuration[QString("leftStretch")].toInt() == 2) layout->addStretch(1); @@ -236,6 +243,7 @@ int DesktopPanel::setCurrentDesktop(const int number) command.waitForFinished(-1); int status = command.exitCode(); if (debug) qDebug() << "[PTM-DP]" << "[setCurrentDesktop]" << "Cmd returns " << status; + return status; } @@ -243,6 +251,7 @@ int DesktopPanel::setCurrentDesktop(const int number) void DesktopPanel::updateText() { if (debug) qDebug() << "[PTM-DP]" << "[updateText]"; + if (labels.isEmpty()) return; QString line, text; for (int i=0; idisconnectSource(QString("desktop"), this); KConfigGroup cg = config(); @@ -374,9 +386,10 @@ void DesktopPanel::configAccepted() void DesktopPanel::configChanged() { if (debug) qDebug() << "[PTM-DP]" << "[configChanged]"; + KConfigGroup cg = config(); - configuration[QString("background")] = cg.readEntry("background", "0"); + configuration[QString("background")] = cg.readEntry("background", "2"); configuration[QString("desktopcmd")] = cg.readEntry("desktopcmd", "qdbus org.kde.kwin /KWin setCurrentDesktop $number"); configuration[QString("interval")] = cg.readEntry("interval", "1000"); configuration[QString("layout")] = cg.readEntry("layout", "0"); @@ -394,26 +407,26 @@ void DesktopPanel::configChanged() QString fontColor = cg.readEntry("currentFontColor", "#ff0000"); int fontWeight = cg.readEntry("currentFontWeight", 400); QString fontStyle = cg.readEntry("currentFontStyle", "normal"); - currentFormatLine[0] = ("

");
-    currentFormatLine[1] = ("

"); + ";\">"); + currentFormatLine[1] = ("

"); fontFamily = cg.readEntry("fontFamily", "Terminus"); fontSize = cg.readEntry("fontSize", 10); fontColor = cg.readEntry("fontColor", "#000000"); fontWeight = cg.readEntry("fontWeight", 400); fontStyle = cg.readEntry("fontStyle", "normal"); - formatLine[0] = ("

");
-    formatLine[1] = ("

"); + ";\">"); + formatLine[1] = ("

"); reinit(); } diff --git a/sources/ext-sysmon/extsysmon.cpp b/sources/ext-sysmon/extsysmon.cpp index f6cd8bd..7041de3 100644 --- a/sources/ext-sysmon/extsysmon.cpp +++ b/sources/ext-sysmon/extsysmon.cpp @@ -95,16 +95,17 @@ QStringList ExtendedSysMon::getDesktopNames() QStringList list; QString fileName = KGlobal::dirs()->findResource("config", "kwinrc"); if (debug) qDebug() << "[DE]" << "[getDesktopNames]" << ":" << "Configuration file" << fileName; - QFile confFile(fileName); - if (!confFile.open(QIODevice::ReadOnly)) return list; + QFile configFile(fileName); + if (!configFile.open(QIODevice::ReadOnly)) return list; QString fileStr; QStringList value; bool desktopSection = false; while (true) { - fileStr = QString(confFile.readLine()).trimmed(); - if (fileStr[0] == QChar('#')) continue; - if (fileStr[0] == QChar(';')) continue; + 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) { @@ -116,10 +117,9 @@ QStringList ExtendedSysMon::getDesktopNames() list.append(value.join(QChar('='))); } } - if (confFile.atEnd()) - break; + if (configFile.atEnd()) break; } - confFile.close(); + configFile.close(); return list; } @@ -169,27 +169,27 @@ void ExtendedSysMon::readConfiguration() QString fileName = KGlobal::dirs()->findResource("config", "extsysmon.conf"); if (debug) qDebug() << "[DE]" << "[readConfiguration]" << ":" << "Configuration file" << fileName; - QFile confFile(fileName); - if (!confFile.open(QIODevice::ReadOnly)) { + QFile configFile(fileName); + if (!configFile.open(QIODevice::ReadOnly)) { configuration = updateConfiguration(rawConfig); return; } QString fileStr; QStringList value; while (true) { - fileStr = QString(confFile.readLine()).trimmed(); - if (fileStr[0] == QChar('#')) continue; - if (fileStr[0] == QChar(';')) continue; + 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.contains(QChar('='))) { value.clear(); for (int i=1; i