mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
some intermediate commit
This commit is contained in:
parent
0f9d2e52ab
commit
2fa0acf13d
@ -24,6 +24,7 @@
|
|||||||
#include <Plasma/Containment>
|
#include <Plasma/Containment>
|
||||||
#include <Plasma/Corona>
|
#include <Plasma/Corona>
|
||||||
#include <Plasma/Theme>
|
#include <Plasma/Theme>
|
||||||
|
#include <QBuffer>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QGraphicsGridLayout>
|
#include <QGraphicsGridLayout>
|
||||||
@ -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<WId> windows = KWindowSystem::windows();
|
||||||
|
for (int i=0; i<windows.count(); i++) {
|
||||||
|
KWindowInfo winInfo = KWindowSystem::windowInfo(windows[i], NET::Property::WMDesktop | NET::Property::WMGeometry);
|
||||||
|
if (winInfo.isOnDesktop(num)) continue;
|
||||||
|
info.windows.append(winInfo.geometry());
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QList<Plasma::Containment *> DesktopPanel::getPanels()
|
QList<Plasma::Containment *> DesktopPanel::getPanels()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -276,6 +297,17 @@ void DesktopPanel::updateText(const bool first)
|
|||||||
else
|
else
|
||||||
text = formatLine[0] + line + formatLine[1];
|
text = formatLine[0] + line + formatLine[1];
|
||||||
labels[i]->setText(text);
|
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("<html><img src=\"data:image/png;base64,") + byteArray.toBase64() + QString("\"/></html>");
|
||||||
|
labels[i]->setToolTip(url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int height = 0;
|
int height = 0;
|
||||||
int width = 0;
|
int width = 0;
|
||||||
@ -328,6 +360,11 @@ void DesktopPanel::createConfigurationInterface(KConfigDialog *parent)
|
|||||||
uiToggleConfig.setupUi(toggleWidget);
|
uiToggleConfig.setupUi(toggleWidget);
|
||||||
|
|
||||||
uiWidConfig.textEdit_elements->setPlainText(configuration[QString("pattern")]);
|
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)
|
if (configuration[QString("background")].toInt() == 0)
|
||||||
uiWidConfig.checkBox_background->setCheckState(Qt::Unchecked);
|
uiWidConfig.checkBox_background->setCheckState(Qt::Unchecked);
|
||||||
else
|
else
|
||||||
@ -412,6 +449,8 @@ void DesktopPanel::configAccepted()
|
|||||||
KConfigGroup cg = config();
|
KConfigGroup cg = config();
|
||||||
|
|
||||||
cg.writeEntry("pattern", uiWidConfig.textEdit_elements->toPlainText());
|
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("background", QString::number(uiWidConfig.checkBox_background->checkState()));
|
||||||
cg.writeEntry("layout", QString::number(uiWidConfig.checkBox_layout->checkState()));
|
cg.writeEntry("layout", QString::number(uiWidConfig.checkBox_layout->checkState()));
|
||||||
cg.writeEntry("interval", QString::number(uiWidConfig.spinBox_interval->value()));
|
cg.writeEntry("interval", QString::number(uiWidConfig.spinBox_interval->value()));
|
||||||
@ -448,6 +487,8 @@ void DesktopPanel::configChanged()
|
|||||||
KConfigGroup cg = config();
|
KConfigGroup cg = config();
|
||||||
|
|
||||||
configuration[QString("pattern")] = cg.readEntry("pattern", "[$fullmark$number/$total: $name]");
|
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("background")] = cg.readEntry("background", "2");
|
||||||
configuration[QString("desktopcmd")] = cg.readEntry("desktopcmd", "qdbus org.kde.kwin /KWin setCurrentDesktop $number");
|
configuration[QString("desktopcmd")] = cg.readEntry("desktopcmd", "qdbus org.kde.kwin /KWin setCurrentDesktop $number");
|
||||||
configuration[QString("interval")] = cg.readEntry("interval", "1000");
|
configuration[QString("interval")] = cg.readEntry("interval", "1000");
|
||||||
|
@ -60,10 +60,16 @@ class DesktopPanel : public Plasma::Applet
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
QRect desktop;
|
||||||
|
QList<QRect> windows;
|
||||||
|
} DesktopWindowsInfo;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DesktopPanel(QObject *parent, const QVariantList &args);
|
DesktopPanel(QObject *parent, const QVariantList &args);
|
||||||
~DesktopPanel();
|
~DesktopPanel();
|
||||||
void init();
|
void init();
|
||||||
|
DesktopWindowsInfo getInfoByDesktop(const int num);
|
||||||
QString parsePattern(const QString rawLine, const int num);
|
QString parsePattern(const QString rawLine, const int num);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>729</width>
|
<width>725</width>
|
||||||
<height>428</height>
|
<height>424</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@ -20,7 +20,38 @@
|
|||||||
<string notr="true">Widget</string>
|
<string notr="true">Widget</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="4" column="0">
|
<item row="6" column="0">
|
||||||
|
<widget class="QCheckBox" name="checkBox_layout">
|
||||||
|
<property name="text">
|
||||||
|
<string>Vertical layout</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="layout_desktopcmd">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_desktopcmd">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Command to change desktop</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_desktopcmd">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Command which will change the current desktop</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
<layout class="QHBoxLayout" name="layout_interval">
|
<layout class="QHBoxLayout" name="layout_interval">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_interval">
|
<widget class="QLabel" name="label_interval">
|
||||||
@ -75,14 +106,14 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QCheckBox" name="checkBox_background">
|
<widget class="QCheckBox" name="checkBox_background">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Enable background</string>
|
<string>Enable background</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="9" column="0">
|
||||||
<layout class="QHBoxLayout" name="layout_mark">
|
<layout class="QHBoxLayout" name="layout_mark">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_mark">
|
<widget class="QLabel" name="label_mark">
|
||||||
@ -179,37 +210,16 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QCheckBox" name="checkBox_layout">
|
<widget class="QTextEdit" name="textEdit_elements">
|
||||||
<property name="text">
|
<property name="lineWrapMode">
|
||||||
<string>Vertical layout</string>
|
<enum>QTextEdit::NoWrap</enum>
|
||||||
|
</property>
|
||||||
|
<property name="acceptRichText">
|
||||||
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_desktopcmd">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_desktopcmd">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Command to change desktop</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit_desktopcmd">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Command which will change the current desktop</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QHBoxLayout" name="layput_mainFormating">
|
<layout class="QHBoxLayout" name="layput_mainFormating">
|
||||||
<item>
|
<item>
|
||||||
@ -392,16 +402,62 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QTextEdit" name="textEdit_elements">
|
<widget class="QCheckBox" name="checkBox_tooltip">
|
||||||
<property name="lineWrapMode">
|
<property name="text">
|
||||||
<enum>QTextEdit::NoWrap</enum>
|
<string>Enable tooltip</string>
|
||||||
</property>
|
|
||||||
<property name="acceptRichText">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="layout_tooltip">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_tooltip">
|
||||||
|
<property name="text">
|
||||||
|
<string>Tooltip width</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="spacer_tooltip">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBox_tooltip">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>180</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="specialValueText">
|
||||||
|
<string>px</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>25</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
# is this script is active?
|
# is this script active?
|
||||||
ACTIVE=false
|
ACTIVE=false
|
||||||
# update interval in default plasmoid interval
|
# update interval in default plasmoid interval
|
||||||
INTERVAL=1
|
INTERVAL=1
|
||||||
# does this script have output?
|
# 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
|
OUTPUT=true
|
||||||
# prefix to run this script. Usually this field should be blank,
|
# prefix to run this script. Usually this field should be blank,
|
||||||
# but you may want to set command (e.g. script language) directly
|
# but you may want to set command (e.g. script language) directly
|
||||||
|
Loading…
Reference in New Issue
Block a user