/*************************************************************************** * This file is part of pytextmonitor * * * * pytextmonitor is free software: you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * pytextmonitor is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with pytextmonitor. If not, see http://www.gnu.org/licenses/ * ***************************************************************************/ #include "desktop-panel.h" #include "ui_appearance.h" #include "ui_widget.h" #include #include #include #include #include #include #include #include #include #include CustomPlasmaLabel::CustomPlasmaLabel(DesktopPanel *wid, const int num) : Plasma::Label(wid) { // debug QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); QString debugEnv = environment.value(QString("PTM_DEBUG"), QString("no")); if (debugEnv == QString("yes")) debug = true; else debug = false; if (debug) qDebug() << "[PTM-DP]" << "Init label" << num; number = num; widget = wid; } CustomPlasmaLabel::~CustomPlasmaLabel() { } int CustomPlasmaLabel::getNumber() { if (debug) qDebug() << "[PTM-DP]" << "[" << number << "]" << "[getNumber]"; return number; } 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); } DesktopPanel::DesktopPanel(QObject *parent, const QVariantList &args) : Plasma::Applet(parent, args) { // debug QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); QString debugEnv = environment.value(QString("PTM_DEBUG"), QString("no")); if (debugEnv == QString("yes")) debug = true; else debug = false; setHasConfigurationInterface(true); // text format init currentFormatLine.append(QString("")); currentFormatLine.append(QString("")); formatLine.append(QString("")); formatLine.append(QString("")); } DesktopPanel::~DesktopPanel() { // for (int i=0; isetContentsMargins(1, 1, 1, 1); setLayout(layout); currentDesktop = 1; // read variables configChanged(); } 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; QString fileStr; QStringList value; bool desktopSection = false; while (true) { fileStr = QString(confFile.readLine()).trimmed(); if (fileStr[0] == QChar('#')) continue; if (fileStr[0] == QChar(';')) 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; i
");
    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] = ("

"); reinit(); } #include "desktop-panel.moc"