diff --git a/sources/desktop-panel/desktop-panel.cpp b/sources/desktop-panel/desktop-panel.cpp index ff53b50..afaa978 100644 --- a/sources/desktop-panel/desktop-panel.cpp +++ b/sources/desktop-panel/desktop-panel.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -117,6 +118,26 @@ void DesktopPanel::init() } +DesktopPanel::DesktopWindowsInfo DesktopPanel::getInfoByDesktop(const int num) +{ + if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG << ":" << "Number" << num; + + + DesktopWindowsInfo info; + info.desktop = KWindowSystem::workArea(num); + + QList windows = KWindowSystem::windows(); + for (int i=0; i DesktopPanel::getPanels() { if (debug) qDebug() << PDEBUG; @@ -276,6 +297,17 @@ void DesktopPanel::updateText(const bool first) else text = formatLine[0] + line + formatLine[1]; labels[i]->setText(text); + + // update tooltip + if (configuration[QString("tooltip")].toInt() == 2) { + QPixmap pixmap("/home/arcanis/testicon.jpg"); + pixmap.scaledToWidth(configuration[QString("tooltipWidth")].toInt()); + QByteArray byteArray; + QBuffer buffer(&byteArray); + pixmap.save(&buffer, "PNG"); + QString url = QString(""); + labels[i]->setToolTip(url); + } } int height = 0; int width = 0; @@ -328,6 +360,11 @@ void DesktopPanel::createConfigurationInterface(KConfigDialog *parent) uiToggleConfig.setupUi(toggleWidget); uiWidConfig.textEdit_elements->setPlainText(configuration[QString("pattern")]); + if (configuration[QString("tooltip")].toInt() == 0) + uiWidConfig.checkBox_tooltip->setCheckState(Qt::Unchecked); + else + uiWidConfig.checkBox_tooltip->setCheckState(Qt::Checked); + uiWidConfig.spinBox_tooltip->setValue(configuration[QString("tooltipWidth")].toInt()); if (configuration[QString("background")].toInt() == 0) uiWidConfig.checkBox_background->setCheckState(Qt::Unchecked); else @@ -412,6 +449,8 @@ void DesktopPanel::configAccepted() KConfigGroup cg = config(); cg.writeEntry("pattern", uiWidConfig.textEdit_elements->toPlainText()); + cg.writeEntry("tooltip", QString::number(uiWidConfig.checkBox_tooltip->checkState())); + cg.writeEntry("tooltipWidth", QString::number(uiWidConfig.spinBox_tooltip->value())); cg.writeEntry("background", QString::number(uiWidConfig.checkBox_background->checkState())); cg.writeEntry("layout", QString::number(uiWidConfig.checkBox_layout->checkState())); cg.writeEntry("interval", QString::number(uiWidConfig.spinBox_interval->value())); @@ -448,6 +487,8 @@ void DesktopPanel::configChanged() KConfigGroup cg = config(); configuration[QString("pattern")] = cg.readEntry("pattern", "[$fullmark$number/$total: $name]"); + configuration[QString("tooltip")] = cg.readEntry("tooltip", "2"); + configuration[QString("tooltipWidth")] = cg.readEntry("tooltipWidth", "200"); 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"); diff --git a/sources/desktop-panel/desktop-panel.h b/sources/desktop-panel/desktop-panel.h index df7d4ff..828f0f7 100644 --- a/sources/desktop-panel/desktop-panel.h +++ b/sources/desktop-panel/desktop-panel.h @@ -60,10 +60,16 @@ class DesktopPanel : public Plasma::Applet { Q_OBJECT + typedef struct { + QRect desktop; + QList windows; + } DesktopWindowsInfo; + public: DesktopPanel(QObject *parent, const QVariantList &args); ~DesktopPanel(); void init(); + DesktopWindowsInfo getInfoByDesktop(const int num); QString parsePattern(const QString rawLine, const int num); public slots: diff --git a/sources/desktop-panel/widget.ui b/sources/desktop-panel/widget.ui index 2fe3faf..fadfda5 100644 --- a/sources/desktop-panel/widget.ui +++ b/sources/desktop-panel/widget.ui @@ -6,8 +6,8 @@ 0 0 - 729 - 428 + 725 + 424 @@ -20,7 +20,38 @@ Widget - + + + + Vertical layout + + + + + + + + + + 200 + 0 + + + + Command to change desktop + + + + + + + Command which will change the current desktop + + + + + + @@ -75,14 +106,14 @@ - + Enable background - + @@ -179,37 +210,16 @@ - - - - Vertical layout + + + + QTextEdit::NoWrap + + + false - - - - - - - 200 - 0 - - - - Command to change desktop - - - - - - - Command which will change the current desktop - - - - - @@ -392,16 +402,62 @@ - - - - QTextEdit::NoWrap - - - false + + + + Enable tooltip + + + + + + Tooltip width + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 180 + 0 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + px + + + 100 + + + 1000 + + + 25 + + + + + diff --git a/sources/ext-sysmon/scripts/aw-script-template.conf b/sources/ext-sysmon/scripts/aw-script-template.conf index 041912e..ca472a1 100644 --- a/sources/ext-sysmon/scripts/aw-script-template.conf +++ b/sources/ext-sysmon/scripts/aw-script-template.conf @@ -1,9 +1,9 @@ -# is this script is active? +# is this script active? ACTIVE=false # update interval in default plasmoid interval INTERVAL=1 # does this script have output? -# set to 'false' if it is an action and will not show in the plasmoid +# set to 'false' if it is an action and will not show text in the plasmoid OUTPUT=true # prefix to run this script. Usually this field should be blank, # but you may want to set command (e.g. script language) directly