diff --git a/sources/CMakeLists.txt b/sources/CMakeLists.txt
index eeda57a..9ffb346 100644
--- a/sources/CMakeLists.txt
+++ b/sources/CMakeLists.txt
@@ -43,6 +43,7 @@ if (BUILD_KDE4)
add_subdirectory (desktop-panel-kde4)
else ()
add_subdirectory (awesome-widget-kf5)
+ add_subdirectory (desktop-panel-kf5)
endif ()
# translations
diff --git a/sources/awesome-widget-kde4/awesome-widget.cpp b/sources/awesome-widget-kde4/awesome-widget.cpp
index 685ce1f..0d908e3 100644
--- a/sources/awesome-widget-kde4/awesome-widget.cpp
+++ b/sources/awesome-widget-kde4/awesome-widget.cpp
@@ -492,7 +492,7 @@ void AwesomeWidget::showUpdates(QString version)
text += i18n("New version : %1", version) + QString("\n\n");
text += i18n("Click \"Ok\" to download");
int select = QMessageBox::information(0, i18n("There are updates"), text, QMessageBox::Ok | QMessageBox::Cancel);
- switch(select) {
+ switch (select) {
case QMessageBox::Ok:
QDesktopServices::openUrl(QString(RELEASES) + version);
break;
diff --git a/sources/awesome-widget-kde4/graphicalitem.cpp b/sources/awesome-widget-kde4/graphicalitem.cpp
deleted file mode 100644
index 1df9aaf..0000000
--- a/sources/awesome-widget-kde4/graphicalitem.cpp
+++ /dev/null
@@ -1,517 +0,0 @@
-/***************************************************************************
- * This file is part of awesome-widgets *
- * *
- * awesome-widgets 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. *
- * *
- * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
- ***************************************************************************/
-
-#include "graphicalitem.h"
-#include "ui_graphicalitem.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-#include "version.h"
-
-
-GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName, const QStringList directories, const bool debugCmd)
- : QDialog(parent),
- m_fileName(desktopName),
- m_dirs(directories),
- debug(debugCmd),
- ui(new Ui::GraphicalItem)
-{
- readConfiguration();
-
- ui->setupUi(this);
- connect(ui->pushButton_activeColor, SIGNAL(clicked()), this, SLOT(changeColor()));
- connect(ui->pushButton_inactiveColor, SIGNAL(clicked()), this, SLOT(changeColor()));
-}
-
-
-GraphicalItem::~GraphicalItem()
-{
- if (debug) qDebug() << PDEBUG;
-
- delete ui;
-}
-
-
-QString GraphicalItem::image(const float value)
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Value" << value;
- if (m_bar == QString("none")) return QString("");
-
- QColor active = stringToColor(m_activeColor);
- QColor inactive = stringToColor(m_inactiveColor);
- float percent = value / 100.0;
- int scale[2] = {1, 1};
- QPen pen = QPen();
- QGraphicsScene *scene = new QGraphicsScene();
- scene->setBackgroundBrush(QBrush(Qt::NoBrush));
- QGraphicsView *view = new QGraphicsView(scene);
- view->setStyleSheet(QString("background: transparent"));
- view->setContentsMargins(0, 0, 0, 0);
- view->setFrameShape(QFrame::NoFrame);
- view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- view->resize(m_width + 5.0, m_height + 5.0);
-
- // paint
- switch(m_type) {
- case Vertical:
- pen.setWidth(m_width);
- // inactive
- pen.setColor(inactive);
- scene->addLine(0.5 * m_width, -0.5 * m_width, 0.5 * m_width,
- (1.0 - percent) * m_height - 0.5 * m_width, pen);
- // active
- pen.setColor(active);
- scene->addLine(0.5 * m_width, (1.0 - percent) * m_height + 0.5 * m_width,
- 0.5 * m_width, m_height + 0.5 * m_width, pen);
- // scale
- scale[1] = -2 * static_cast(m_direction) + 1;
- break;
- case Circle:
- QGraphicsEllipseItem *circle;
- pen.setWidth(1.0);
- // inactive
- pen.setColor(inactive);
- circle = scene->addEllipse(0.0, 0.0, m_width, m_height, pen, QBrush(inactive, Qt::SolidPattern));
- circle->setSpanAngle(- (1.0 - percent) * 360.0 * 16.0);
- circle->setStartAngle(90.0 * 16.0 - percent * 360.0 * 16.0);
- // active
- pen.setColor(active);
- circle = scene->addEllipse(0.0, 0.0, m_width, m_height, pen, QBrush(active, Qt::SolidPattern));
- circle->setSpanAngle(- percent * 360.0 * 16.0);
- circle->setStartAngle(90.0 * 16.0);
- // scale
- scale[0] = -2 * static_cast(m_direction) + 1;
- break;
- default:
- pen.setWidth(m_height);
- // inactive
- pen.setColor(inactive);
- scene->addLine(percent * m_width + 0.5 * m_height, 0.5 * m_height,
- m_width + 0.5 * m_height, 0.5 * m_height, pen);
- // active
- pen.setColor(active);
- scene->addLine(-0.5 * m_height, 0.5 * m_height,
- percent * m_width - 0.5 * m_height, 0.5 * m_height, pen);
- // scale
- scale[0] = -2 * static_cast(m_direction) + 1;
- break;
- }
-
- // convert
- QPixmap pixmap = QPixmap::grabWidget(view).transformed(QTransform().scale(scale[0], scale[1]));
- QByteArray byteArray;
- QBuffer buffer(&byteArray);
- pixmap.save(&buffer, "PNG");
- QString url = QString("
").arg(QString(byteArray.toBase64()));
- delete view;
- delete scene;
-
- return url;
-}
-
-
-QString GraphicalItem::fileName()
-{
- if (debug) qDebug() << PDEBUG;
-
- return m_fileName;
-}
-
-
-int GraphicalItem::apiVersion()
-{
- if (debug) qDebug() << PDEBUG;
-
- return m_apiVersion;
-}
-
-
-QString GraphicalItem::name()
-{
- if (debug) qDebug() << PDEBUG;
-
- return m_name;
-}
-
-
-QString GraphicalItem::comment()
-{
- if (debug) qDebug() << PDEBUG;
-
- return m_comment;
-}
-
-
-QString GraphicalItem::bar()
-{
- if (debug) qDebug() << PDEBUG;
-
- return m_bar;
-}
-
-
-QString GraphicalItem::activeColor()
-{
- if (debug) qDebug() << PDEBUG;
-
- return m_activeColor;
-}
-
-
-QString GraphicalItem::inactiveColor()
-{
- if (debug) qDebug() << PDEBUG;
-
- return m_inactiveColor;
-}
-
-
-GraphicalItem::Type GraphicalItem::type()
-{
- if (debug) qDebug() << PDEBUG;
-
- return m_type;
-}
-
-
-QString GraphicalItem::strType()
-{
- if (debug) qDebug() << PDEBUG;
-
- QString value;
- switch(m_type) {
- case Vertical:
- value = QString("Vertical");
- break;
- case Circle:
- value = QString("Circle");
- break;
- default:
- value = QString("Horizontal");
- break;
- }\
-
- return value;
-}
-
-
-GraphicalItem::Direction GraphicalItem::direction()
-{
- if (debug) qDebug() << PDEBUG;
-
- return m_direction;
-}
-
-
-QString GraphicalItem::strDirection()
-{
- if (debug) qDebug() << PDEBUG;
-
- QString value;
- switch (m_direction) {
- case RightToLeft:
- value = QString("RightToLeft");
- break;
- default:
- value = QString("LeftToRight");
- break;
- }
-
- return value;
-}
-
-
-int GraphicalItem::height()
-{
- if (debug) qDebug() << PDEBUG;
-
- return m_height;
-}
-
-
-int GraphicalItem::width()
-{
- if (debug) qDebug() << PDEBUG;
-
- return m_width;
-}
-
-
-void GraphicalItem::setApiVersion(const int _apiVersion)
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Version" << _apiVersion;
-
- m_apiVersion = _apiVersion;
-}
-
-
-void GraphicalItem::setName(const QString _name)
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Name" << _name;
-
- m_name = _name;
-}
-
-
-void GraphicalItem::setComment(const QString _comment)
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Comment" << _comment;
-
- m_comment = _comment;
-}
-
-
-void GraphicalItem::setBar(const QString _bar)
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Bar" << _bar;
-
- if ((!_bar.contains(QRegExp(QString("cpu(?!cl).*")))) &&
- (!_bar.contains(QRegExp(QString("gpu")))) &&
- (!_bar.contains(QRegExp(QString("mem")))) &&
- (!_bar.contains(QRegExp(QString("swap")))) &&
- (!_bar.contains(QRegExp(QString("hdd[0-9].*")))) &&
- (!_bar.contains(QRegExp(QString("bat.*")))))
- m_bar = QString("none");
- else
- m_bar = _bar;
-}
-
-
-void GraphicalItem::setActiveColor(const QString _color)
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Color" << _color;
-
- m_activeColor = _color;
-}
-
-
-void GraphicalItem::setInactiveColor(const QString _color)
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Color" << _color;
-
- m_inactiveColor = _color;
-}
-
-
-void GraphicalItem::setType(const Type _type)
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Type" << _type;
-
- m_type = _type;
-}
-
-
-void GraphicalItem::setStrType(const QString _type)
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Type" << _type;
-
- if (_type == QString("Vertical"))
- setType(Vertical);
- else if (_type == QString("Circle"))
- setType(Circle);
- else
- setType(Horizontal);
-}
-
-
-void GraphicalItem::setDirection(const Direction _direction)
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Direction" << _direction;
-
- m_direction = _direction;
-}
-
-
-void GraphicalItem::setStrDirection(const QString _direction)
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Direction" << _direction;
-
- if (_direction == QString("RightToLeft"))
- setDirection(RightToLeft);
- else
- setDirection(LeftToRight);
-}
-
-
-void GraphicalItem::setHeight(const int _height)
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Height" << _height;
- if (_height <= 0) return;
-
- m_height = _height;
-}
-
-
-void GraphicalItem::setWidth(const int _width)
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Width" << _width;
- if (_width <= 0) return;
-
- m_width = _width;
-}
-
-
-void GraphicalItem::readConfiguration()
-{
- if (debug) qDebug() << PDEBUG;
-
- for (int i=m_dirs.count()-1; i>=0; i--) {
- if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
- QSettings settings(m_dirs[i] + QDir::separator() + m_fileName, QSettings::IniFormat);
-
- settings.beginGroup(QString("Desktop Entry"));
- setName(settings.value(QString("Name"), m_name).toString());
- setComment(settings.value(QString("Comment"), m_comment).toString());
- setApiVersion(settings.value(QString("X-AW-ApiVersion"), AWGIAPI).toInt());
- setBar(settings.value(QString("X-AW-Value"), m_bar).toString());
- setActiveColor(settings.value(QString("X-AW-ActiveColor"), m_activeColor).toString());
- setInactiveColor(settings.value(QString("X-AW-InactiveColor"), m_inactiveColor).toString());
- setStrType(settings.value(QString("X-AW-Type"), strType()).toString());
- setStrDirection(settings.value(QString("X-AW-Direction"), strDirection()).toString());
- setHeight(settings.value(QString("X-AW-Height"), m_height).toInt());
- setWidth(settings.value(QString("X-AW-Width"), m_width).toInt());
- settings.endGroup();
- }
-}
-
-
-void GraphicalItem::showConfiguration(const QStringList tags)
-{
- if (debug) qDebug() << PDEBUG;
-
- ui->label_nameValue->setText(m_name);
- ui->lineEdit_comment->setText(m_comment);
- ui->comboBox_value->addItems(tags);
- ui->comboBox_value->addItem(m_bar);
- ui->comboBox_value->setCurrentIndex(ui->comboBox_value->count() - 1);
- ui->pushButton_activeColor->setText(m_activeColor);
- ui->pushButton_inactiveColor->setText(m_inactiveColor);
- ui->comboBox_type->setCurrentIndex(static_cast(m_type));
- ui->comboBox_direction->setCurrentIndex(static_cast(m_direction));
- ui->spinBox_height->setValue(m_height);
- ui->spinBox_width->setValue(m_width);
-
- int ret = exec();
- if (ret != 1) return;
-
- setName(ui->label_nameValue->text());
- setComment(ui->lineEdit_comment->text());
- setApiVersion(AWGIAPI);
- setBar(ui->comboBox_value->currentText());
- setActiveColor(ui->pushButton_activeColor->text().remove(QChar('&')));
- setInactiveColor(ui->pushButton_inactiveColor->text().remove(QChar('&')));
- setStrType(ui->comboBox_type->currentText());
- setStrDirection(ui->comboBox_direction->currentText());
- setHeight(ui->spinBox_height->value());
- setWidth(ui->spinBox_width->value());
-
- writeConfiguration();
-}
-
-
-void GraphicalItem::tryDelete()
-{
- if (debug) qDebug() << PDEBUG;
-
- for (int i=0; itext());
- QColor newColor = QColorDialog::getColor(color, 0, i18n("Select color"),
- QColorDialog::ShowAlphaChannel);
- if (!newColor.isValid()) return;
-
- QStringList colorText;
- colorText.append(QString("%1").arg(newColor.red()));
- colorText.append(QString("%1").arg(newColor.green()));
- colorText.append(QString("%1").arg(newColor.blue()));
- colorText.append(QString("%1").arg(newColor.alpha()));
- dynamic_cast(sender())->setText(colorText.join(QChar(',')));
-}
-
-
-QColor GraphicalItem::stringToColor(const QString _color)
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Color" << _color;
-
- QColor qcolor;
- QStringList listColor = _color.split(QChar(','));
- while (listColor.count() < 4)
- listColor.append(QString("0"));
- qcolor.setRed(listColor[0].toInt());
- qcolor.setGreen(listColor[1].toInt());
- qcolor.setBlue(listColor[2].toInt());
- qcolor.setAlpha(listColor[3].toInt());
-
- return qcolor;
-}
diff --git a/sources/awesome-widget-kf5/package/contents/config/main.xml b/sources/awesome-widget-kf5/package/contents/config/main.xml
index 0045137..e49a2bd 100644
--- a/sources/awesome-widget-kf5/package/contents/config/main.xml
+++ b/sources/awesome-widget-kf5/package/contents/config/main.xml
@@ -80,13 +80,13 @@
#ff00ff
-
+
true
-
+
#008800
-
+
#880000
diff --git a/sources/awesome-widget-kf5/package/contents/ui/advanced.qml b/sources/awesome-widget-kf5/package/contents/ui/advanced.qml
index 2ee6c94..1c1890a 100644
--- a/sources/awesome-widget-kf5/package/contents/ui/advanced.qml
+++ b/sources/awesome-widget-kf5/package/contents/ui/advanced.qml
@@ -47,15 +47,15 @@ Item {
"swapTooltip": plasmoid.configuration.swapTooltip,
"downTooltip": plasmoid.configuration.downTooltip,
"upTooltip": plasmoid.configuration.downTooltip,
- "batteryTooltip": plasmoid.configuration.batteryTooltip,
+ "batTooltip": plasmoid.configuration.batTooltip,
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
"memTooltipColor": plasmoid.configuration.memTooltipColor,
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
"downTooltipColor": plasmoid.configuration.downTooltipColor,
"upTooltipColor": plasmoid.configuration.upTooltipColor,
- "batteryTooltipColor": plasmoid.configuration.batteryTooltipColor,
- "batteryInTooltipColor": plasmoid.configuration.batteryInTooltipColor
+ "batTooltipColor": plasmoid.configuration.batTooltipColor,
+ "batInTooltipColor": plasmoid.configuration.batInTooltipColor
}
property alias cfg_background: background.checked
diff --git a/sources/awesome-widget-kf5/package/contents/ui/appearance.qml b/sources/awesome-widget-kf5/package/contents/ui/appearance.qml
index d7be19b..0ca5464 100644
--- a/sources/awesome-widget-kf5/package/contents/ui/appearance.qml
+++ b/sources/awesome-widget-kf5/package/contents/ui/appearance.qml
@@ -21,7 +21,6 @@ import QtQuick.Controls.Styles 1.3 as QtStyles
import QtQuick.Dialogs 1.1 as QtDialogs
import org.kde.plasma.private.awesomewidget 1.0
-import "."
Item {
diff --git a/sources/awesome-widget-kf5/package/contents/ui/dataengine.qml b/sources/awesome-widget-kf5/package/contents/ui/dataengine.qml
index 5fec953..4e18e59 100644
--- a/sources/awesome-widget-kf5/package/contents/ui/dataengine.qml
+++ b/sources/awesome-widget-kf5/package/contents/ui/dataengine.qml
@@ -22,7 +22,6 @@ import QtQuick.Layouts 1.0 as QtLayouts
import QtQuick.Controls.Styles 1.3 as QtStyles
import org.kde.plasma.private.awesomewidget 1.0
-import "."
Item {
@@ -43,15 +42,15 @@ Item {
"swapTooltip": plasmoid.configuration.swapTooltip,
"downTooltip": plasmoid.configuration.downTooltip,
"upTooltip": plasmoid.configuration.downTooltip,
- "batteryTooltip": plasmoid.configuration.batteryTooltip,
+ "batTooltip": plasmoid.configuration.batTooltip,
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
"memTooltipColor": plasmoid.configuration.memTooltipColor,
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
"downTooltipColor": plasmoid.configuration.downTooltipColor,
"upTooltipColor": plasmoid.configuration.upTooltipColor,
- "batteryTooltipColor": plasmoid.configuration.batteryTooltipColor,
- "batteryInTooltipColor": plasmoid.configuration.batteryInTooltipColor
+ "batTooltipColor": plasmoid.configuration.batTooltipColor,
+ "batInTooltipColor": plasmoid.configuration.batInTooltipColor
}
property variant cfg_dataengine: AWActions.readDataEngineConfiguration()
diff --git a/sources/awesome-widget-kf5/package/contents/ui/main.qml b/sources/awesome-widget-kf5/package/contents/ui/main.qml
index fa1c910..b672611 100644
--- a/sources/awesome-widget-kf5/package/contents/ui/main.qml
+++ b/sources/awesome-widget-kf5/package/contents/ui/main.qml
@@ -47,15 +47,15 @@ Item {
"swapTooltip": plasmoid.configuration.swapTooltip,
"downTooltip": plasmoid.configuration.downTooltip,
"upTooltip": plasmoid.configuration.downTooltip,
- "batteryTooltip": plasmoid.configuration.batteryTooltip,
+ "batTooltip": plasmoid.configuration.batTooltip,
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
"memTooltipColor": plasmoid.configuration.memTooltipColor,
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
"downTooltipColor": plasmoid.configuration.downTooltipColor,
"upTooltipColor": plasmoid.configuration.upTooltipColor,
- "batteryTooltipColor": plasmoid.configuration.batteryTooltipColor,
- "batteryInTooltipColor": plasmoid.configuration.batteryInTooltipColor
+ "batTooltipColor": plasmoid.configuration.batTooltipColor,
+ "batInTooltipColor": plasmoid.configuration.batInTooltipColor
}
signal needUpdate
@@ -111,7 +111,7 @@ Item {
id: timeDE
engine: "time"
connectedSources: ["Local"]
- interval: plasmoid.configuration.interval
+ interval: 1000
onNewData: {
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
diff --git a/sources/awesome-widget-kf5/package/contents/ui/tooltip.qml b/sources/awesome-widget-kf5/package/contents/ui/tooltip.qml
index 879e88c..b4bc184 100644
--- a/sources/awesome-widget-kf5/package/contents/ui/tooltip.qml
+++ b/sources/awesome-widget-kf5/package/contents/ui/tooltip.qml
@@ -21,7 +21,6 @@ import QtQuick.Controls.Styles 1.3 as QtStyles
import QtQuick.Dialogs 1.1 as QtDialogs
import org.kde.plasma.private.awesomewidget 1.0
-import "."
Item {
@@ -47,9 +46,9 @@ Item {
property alias cfg_downTooltip: downTooltip.checked
property alias cfg_downTooltipColor: downTooltipColor.text
property alias cfg_upTooltipColor: upTooltipColor.text
- property alias cfg_batteryTooltip: batteryTooltip.checked
- property alias cfg_batteryTooltipColor: batteryTooltipColor.text
- property alias cfg_batteryInTooltipColor: batteryInTooltipColor.text
+ property alias cfg_batTooltip: batTooltip.checked
+ property alias cfg_batTooltipColor: batTooltipColor.text
+ property alias cfg_batInTooltipColor: batInTooltipColor.text
Column {
@@ -430,13 +429,13 @@ Item {
width: parent.width
QtControls.Label {
height: parent.height
- width: parent.width * 2 / 5 - batteryTooltip.width
+ width: parent.width * 2 / 5 - batTooltip.width
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Battery active color")
}
QtControls.CheckBox {
- id: batteryTooltip
+ id: batTooltip
height: parent.height
width: implicitWidth
style: QtStyles.CheckBoxStyle {
@@ -458,22 +457,22 @@ Item {
}
}
QtControls.Button {
- id: batteryTooltipColor
+ id: batTooltipColor
width: parent.width * 3 / 5
style: QtStyles.ButtonStyle {
background: Rectangle {
- color: plasmoid.configuration.batteryTooltipColor
+ color: plasmoid.configuration.batTooltipColor
}
}
- text: plasmoid.configuration.batteryTooltipColor
- onClicked: batteryTooltipColorDialog.visible = true
+ text: plasmoid.configuration.batTooltipColor
+ onClicked: batTooltipColorDialog.visible = true
}
QtDialogs.ColorDialog {
- id: batteryTooltipColorDialog
+ id: batTooltipColorDialog
title: i18n("Select a color")
- color: batteryTooltipColor.text
- onAccepted: batteryTooltipColor.text = batteryTooltipColorDialog.color
+ color: batTooltipColor.text
+ onAccepted: batTooltipColor.text = batTooltipColorDialog.color
}
}
@@ -488,22 +487,22 @@ Item {
text: i18n("Battery inactive color")
}
QtControls.Button {
- id: batteryInTooltipColor
+ id: batInTooltipColor
width: parent.width * 3 / 5
style: QtStyles.ButtonStyle {
background: Rectangle {
- color: plasmoid.configuration.batteryInTooltipColor
+ color: plasmoid.configuration.batInTooltipColor
}
}
- text: plasmoid.configuration.batteryInTooltipColor
- onClicked: batteryInTooltipColorDialog.visible = true
+ text: plasmoid.configuration.batInTooltipColor
+ onClicked: batInTooltipColorDialog.visible = true
}
QtDialogs.ColorDialog {
- id: batteryInTooltipColorDialog
+ id: batInTooltipColorDialog
title: i18n("Select a color")
- color: batteryInTooltipColor.text
- onAccepted: batteryInTooltipColor.text = batteryInTooltipColorDialog.color
+ color: batInTooltipColor.text
+ onAccepted: batInTooltipColor.text = batInTooltipColorDialog.color
}
}
}
diff --git a/sources/awesome-widget-kf5/package/contents/ui/widget.qml b/sources/awesome-widget-kf5/package/contents/ui/widget.qml
index b0810c7..a996815 100644
--- a/sources/awesome-widget-kf5/package/contents/ui/widget.qml
+++ b/sources/awesome-widget-kf5/package/contents/ui/widget.qml
@@ -20,7 +20,6 @@ import QtQuick.Controls 1.3 as QtControls
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.private.awesomewidget 1.0
-import "."
Item {
@@ -48,15 +47,15 @@ Item {
"swapTooltip": plasmoid.configuration.swapTooltip,
"downTooltip": plasmoid.configuration.downTooltip,
"upTooltip": plasmoid.configuration.downTooltip,
- "batteryTooltip": plasmoid.configuration.batteryTooltip,
+ "batTooltip": plasmoid.configuration.batTooltip,
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
"memTooltipColor": plasmoid.configuration.memTooltipColor,
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
"downTooltipColor": plasmoid.configuration.downTooltipColor,
"upTooltipColor": plasmoid.configuration.upTooltipColor,
- "batteryTooltipColor": plasmoid.configuration.batteryTooltipColor,
- "batteryInTooltipColor": plasmoid.configuration.batteryInTooltipColor
+ "batTooltipColor": plasmoid.configuration.batTooltipColor,
+ "batInTooltipColor": plasmoid.configuration.batInTooltipColor
}
property alias cfg_text: textPattern.text
diff --git a/sources/awesome-widget-kf5/plugin/awtooltip.cpp b/sources/awesome-widget-kf5/plugin/awtooltip.cpp
index af97ee3..0540902 100644
--- a/sources/awesome-widget-kf5/plugin/awtooltip.cpp
+++ b/sources/awesome-widget-kf5/plugin/awtooltip.cpp
@@ -51,7 +51,7 @@ AWToolTip::AWToolTip(QObject *parent,
counts += configuration[QString("memTooltip")].toInt();
counts += configuration[QString("swapTooltip")].toInt();
counts += configuration[QString("downTooltip")].toInt();
- counts += configuration[QString("batteryTooltip")].toInt();
+ counts += configuration[QString("batTooltip")].toInt();
boundaries[QString("cpuTooltip")] = 100.0;
boundaries[QString("cpuclTooltip")] = 4000.0;
@@ -108,10 +108,7 @@ QPixmap AWToolTip::image()
for (int i=0; i(data[requiredKeys[i]].count());
float normY = 100.0 / (1.5 * boundaries[requiredKeys[i]]);
- if (requiredKeys[i] == QString("batTooltip"))
- isBattery = true;
- else
- isBattery = false;
+ isBattery = (requiredKeys[i] == QString("batTooltip"));
if (!isBattery) pen.setColor(QColor(configuration[requiredKeys[i] + QString("Color")].toString()));
float shift = i * 100.0;
if (down) shift -= 100.0;
@@ -122,9 +119,9 @@ QPixmap AWToolTip::image()
float y2 = - fabs(data[requiredKeys[i]][j+1]) * normY + 5.0;
if (isBattery) {
if (data[requiredKeys[i]][j+1] > 0)
- pen.setColor(QColor(configuration[QString("batteryColor")].toString()));
+ pen.setColor(QColor(configuration[QString("batTooltipColor")].toString()));
else
- pen.setColor(QColor(configuration[QString("batteryInColor")].toString()));
+ pen.setColor(QColor(configuration[QString("batInTooltipColor")].toString()));
}
toolTipScene->addLine(x1, y1, x2, y2, pen);
}
diff --git a/sources/awesome-widget-kf5/plugin/graphicalitem.cpp b/sources/awesome-widget-kf5/plugin/graphicalitem.cpp
index 1085239..e44be2a 100644
--- a/sources/awesome-widget-kf5/plugin/graphicalitem.cpp
+++ b/sources/awesome-widget-kf5/plugin/graphicalitem.cpp
@@ -79,7 +79,7 @@ QString GraphicalItem::image(const float value)
view->resize(m_width + 5.0, m_height + 5.0);
// paint
- switch(m_type) {
+ switch (m_type) {
case Vertical:
pen.setWidth(m_width);
// inactive
@@ -206,7 +206,7 @@ QString GraphicalItem::strType()
if (debug) qDebug() << PDEBUG;
QString value;
- switch(m_type) {
+ switch (m_type) {
case Vertical:
value = QString("Vertical");
break;
diff --git a/sources/desktop-panel-kde4/desktop-panel.cpp b/sources/desktop-panel-kde4/desktop-panel.cpp
index bd2bd2c..178a866 100644
--- a/sources/desktop-panel-kde4/desktop-panel.cpp
+++ b/sources/desktop-panel-kde4/desktop-panel.cpp
@@ -188,7 +188,7 @@ QString DesktopPanel::panelLocationToStr(Plasma::Location loc)
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Location" << loc;
- switch(loc) {
+ switch (loc) {
case Plasma::TopEdge:
return i18n("Top Edge");
case Plasma::BottomEdge:
diff --git a/sources/desktop-panel-kf5/CMakeLists.txt b/sources/desktop-panel-kf5/CMakeLists.txt
new file mode 100644
index 0000000..4173e9c
--- /dev/null
+++ b/sources/desktop-panel-kf5/CMakeLists.txt
@@ -0,0 +1,16 @@
+# set project name
+set (SUBPROJECT plasma_applet_desktop-panel)
+message (STATUS "Subproject ${SUBPROJECT}")
+
+find_package (ECM 0.0.12 REQUIRED NO_MODULE)
+set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
+
+find_package (Qt5 REQUIRED COMPONENTS Core Qml)
+find_package (KF5 REQUIRED COMPONENTS I18n Notifications Plasma Service WindowSystem)
+
+include (KDEInstallDirs)
+include (KDECMakeSettings)
+include (KDECompilerSettings)
+
+add_subdirectory (plugin)
+plasma_install_package (package org.kde.plasma.desktoppanel)
diff --git a/sources/desktop-panel-kf5/package/contents/config/config.qml b/sources/desktop-panel-kf5/package/contents/config/config.qml
new file mode 100644
index 0000000..5f62ce6
--- /dev/null
+++ b/sources/desktop-panel-kf5/package/contents/config/config.qml
@@ -0,0 +1,47 @@
+/***************************************************************************
+ * This file is part of awesome-widgets *
+ * *
+ * awesome-widgets 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. *
+ * *
+ * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
+ ***************************************************************************/
+
+import QtQuick 2.0
+
+import org.kde.plasma.configuration 2.0
+
+
+ConfigModel {
+ ConfigCategory {
+ name: i18n("Widget")
+ icon: "utilities-system-monitor"
+ source: "widget.qml"
+ }
+
+ ConfigCategory {
+ name: i18n("Advanced")
+ icon: "system-run"
+ source: "advanced.qml"
+ }
+
+ ConfigCategory {
+ name: i18n("Appearance")
+ icon: "preferences-desktop-theme"
+ source: "appearance.qml"
+ }
+
+ ConfigCategory {
+ name: i18n("About")
+ icon: "help-about"
+ source: "about.qml"
+ }
+}
diff --git a/sources/desktop-panel-kf5/package/contents/config/main.xml b/sources/desktop-panel-kf5/package/contents/config/main.xml
new file mode 100644
index 0000000..d779b52
--- /dev/null
+++ b/sources/desktop-panel-kf5/package/contents/config/main.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+ [$fullmark$number/$total: $name]
+
+
+
+
+
+
+ windows
+
+
+ 200
+
+
+ #ffffff
+
+
+ true
+
+
+ false
+
+
+ ¤
+
+
+ -1
+
+
+
+
+
+
+ center
+
+
+ Terminus
+
+
+ 12
+
+
+ #000000
+
+
+ normal
+
+
+ normal
+
+
+
+ center
+
+
+ Terminus
+
+
+ 12
+
+
+ #ff0000
+
+
+ normal
+
+
+ normal
+
+
+
+
diff --git a/sources/desktop-panel-kf5/package/contents/ui/about.qml b/sources/desktop-panel-kf5/package/contents/ui/about.qml
new file mode 100644
index 0000000..746ed6f
--- /dev/null
+++ b/sources/desktop-panel-kf5/package/contents/ui/about.qml
@@ -0,0 +1,99 @@
+/***************************************************************************
+ * This file is part of awesome-widgets *
+ * *
+ * awesome-widgets 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. *
+ * *
+ * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
+ ***************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Controls 1.3 as QtControls
+import QtQuick.Layouts 1.0 as QtLayouts
+
+import org.kde.plasma.private.desktoppanel 1.0
+
+
+Item {
+ id: aboutPage
+ width: childrenRect.width
+ height: childrenRect.height
+ implicitWidth: pageColumn.implicitWidth
+ implicitHeight: pageColumn.implicitHeight
+
+ property bool debug: DPAdds.isDebugEnabled()
+
+
+ Column {
+ id: pageColumn
+ width: units.gridUnit * 25
+ QtControls.TabView {
+ height: parent.height
+ width: parent.width
+ QtControls.Tab {
+ title: i18n("About")
+
+ QtLayouts.ColumnLayout {
+ QtControls.Label {
+ QtLayouts.Layout.fillWidth: true
+ horizontalAlignment: Text.AlignHCenter
+ text: DPAdds.getAboutText("header")
+ }
+
+ QtControls.Label {
+ QtLayouts.Layout.fillWidth: true
+ horizontalAlignment: Text.AlignJustify
+ text: DPAdds.getAboutText("description")
+ }
+
+ QtControls.Label {
+ QtLayouts.Layout.fillWidth: true
+ horizontalAlignment: Text.AlignLeft
+ textFormat: Text.RichText
+ text: DPAdds.getAboutText("links")
+ }
+
+ QtControls.Label {
+ QtLayouts.Layout.fillWidth: true
+ font.capitalization: Font.SmallCaps
+ horizontalAlignment: Text.AlignHCenter
+ textFormat: Text.RichText
+ text: DPAdds.getAboutText("copy")
+ }
+ }
+ }
+
+ QtControls.Tab {
+ title: i18n("Acknowledgment")
+
+ QtLayouts.ColumnLayout {
+ QtControls.Label {
+ QtLayouts.Layout.fillWidth: true
+ wrapMode: Text.WordWrap
+ horizontalAlignment: Text.AlignJustify
+ text: DPAdds.getAboutText("translators")
+ }
+
+ QtControls.Label {
+ QtLayouts.Layout.fillWidth: true
+ horizontalAlignment: Text.AlignJustify
+ textFormat: Text.RichText
+ text: DPAdds.getAboutText("3rdparty")
+ }
+ }
+ }
+ }
+ }
+
+ Component.onCompleted: {
+ if (debug) console.log("[about::onCompleted]")
+ }
+}
diff --git a/sources/desktop-panel-kf5/package/contents/ui/advanced.qml b/sources/desktop-panel-kf5/package/contents/ui/advanced.qml
new file mode 100644
index 0000000..1c1890a
--- /dev/null
+++ b/sources/desktop-panel-kf5/package/contents/ui/advanced.qml
@@ -0,0 +1,275 @@
+/***************************************************************************
+ * This file is part of awesome-widgets *
+ * *
+ * awesome-widgets 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. *
+ * *
+ * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
+ ***************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Controls 1.3 as QtControls
+import org.kde.plasma.core 2.0 as PlasmaCore
+
+import org.kde.plasma.private.awesomewidget 1.0
+
+
+Item {
+ id: advancedPage
+ width: childrenRect.width
+ height: childrenRect.height
+ implicitWidth: pageColumn.implicitWidth
+ implicitHeight: pageColumn.implicitHeight
+
+ property bool debug: AWKeys.isDebugEnabled()
+ property variant settings: {
+ "customTime": plasmoid.configuration.customTime,
+ "customUptime": plasmoid.configuration.customUptime,
+ "tempUnits": plasmoid.configuration.tempUnits,
+ "acOnline": plasmoid.configuration.acOnline,
+ "acOffline": plasmoid.configuration.acOffline
+ }
+ property variant tooltipSettings: {
+ "tooltipNumber": plasmoid.configuration.tooltipNumber,
+ "useTooltipBackground": plasmoid.configuration.useTooltipBackground,
+ "tooltipBackgroung": plasmoid.configuration.tooltipBackgroung,
+ "cpuTooltip": plasmoid.configuration.cpuTooltip,
+ "cpuclTooltip": plasmoid.configuration.cpuclTooltip,
+ "memTooltip": plasmoid.configuration.memTooltip,
+ "swapTooltip": plasmoid.configuration.swapTooltip,
+ "downTooltip": plasmoid.configuration.downTooltip,
+ "upTooltip": plasmoid.configuration.downTooltip,
+ "batTooltip": plasmoid.configuration.batTooltip,
+ "cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
+ "cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
+ "memTooltipColor": plasmoid.configuration.memTooltipColor,
+ "swapTooltipColor": plasmoid.configuration.swapTooltipColor,
+ "downTooltipColor": plasmoid.configuration.downTooltipColor,
+ "upTooltipColor": plasmoid.configuration.upTooltipColor,
+ "batTooltipColor": plasmoid.configuration.batTooltipColor,
+ "batInTooltipColor": plasmoid.configuration.batInTooltipColor
+ }
+
+ property alias cfg_background: background.checked
+ property alias cfg_customTime: customTime.text
+ property alias cfg_customUptime: customUptime.text
+ property string cfg_tempUnits: tempUnits.currentText
+ property alias cfg_acOnline: acOnline.text
+ property alias cfg_acOffline: acOffline.text
+
+
+ Column {
+ id: pageColumn
+ width: units.gridUnit * 25
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Label {
+ height: parent.heigth
+ width: parent.width * 2 / 5
+ }
+ QtControls.CheckBox {
+ id: background
+ width: parent.width * 3 / 5
+ text: i18n("Enable background")
+ }
+ }
+
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Label {
+ height: parent.height
+ width: parent.width * 2 / 5
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
+ text: i18n("Custom time format")
+ }
+ QtControls.TextField {
+ id: customTime
+ width: parent.width * 3 / 5
+ text: plasmoid.configuration.customTime
+ }
+ }
+
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Label {
+ height: parent.height
+ width: parent.width * 2 / 5
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
+ text: i18n("Custom uptime format")
+ }
+ QtControls.TextField {
+ id: customUptime
+ width: parent.width * 3 / 5
+ text: plasmoid.configuration.customUptime
+ }
+ }
+
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Label {
+ height: parent.height
+ width: parent.width * 2 / 5
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
+ text: i18n("Temperature units")
+ }
+ QtControls.ComboBox {
+ id: tempUnits
+ width: parent.width * 3 / 5
+ textRole: "label"
+ model: [
+ {
+ 'label': i18n("Celsius"),
+ 'name': "Celsius"
+ },
+ {
+ 'label': i18n("Fahrenheit"),
+ 'name': "Fahrenheit"
+ },
+ {
+ 'label': i18n("Kelvin"),
+ 'name': "Kelvin"
+ },
+ {
+ 'label': i18n("Reaumur"),
+ 'name': "Reaumur"
+ },
+ {
+ 'label': i18n("cm^-1"),
+ 'name': "cm^-1"
+ },
+ {
+ 'label': i18n("kJ/mol"),
+ 'name': "kJ/mol"
+ },
+ {
+ 'label': i18n("kcal/mol"),
+ 'name': "kcal/mol"
+ }
+ ]
+ onCurrentIndexChanged: cfg_tempUnits = model[currentIndex]["name"]
+ Component.onCompleted: {
+ for (var i = 0; i < model.length; i++) {
+ if (model[i]["name"] == plasmoid.configuration.tempUnits) {
+ tempUnits.currentIndex = i;
+ }
+ }
+ }
+ }
+ }
+
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Label {
+ height: parent.height
+ width: parent.width * 2 / 5
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
+ text: i18n("AC online tag")
+ }
+ QtControls.TextField {
+ id: acOnline
+ width: parent.width * 3 / 5
+ text: plasmoid.configuration.acOnline
+ }
+ }
+
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Label {
+ height: parent.height
+ width: parent.width * 2 / 5
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
+ text: i18n("AC offline tag")
+ }
+ QtControls.TextField {
+ id: acOffline
+ width: parent.width * 3 / 5
+ text: plasmoid.configuration.acOffline
+ }
+ }
+
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Label {
+ height: parent.height
+ width: parent.width * 2 / 5
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
+ text: i18n("Bars")
+ }
+ QtControls.Button {
+ width: parent.width * 3 / 5
+ text: i18n("Edit bars")
+ onClicked: AWKeys.editItem("graphicalitem")
+ }
+ }
+ }
+
+ // we need to initializate DataEngines here too
+ // because we need to get keys and values
+ PlasmaCore.DataSource {
+ id: systemmonitorDE
+ engine: "systemmonitor"
+ connectedSources: systemmonitorDE.sources
+ interval: 5000
+
+ onNewData: {
+ if (debug) console.log("[advanced::onNewData] : Update source " + sourceName)
+
+ AWKeys.setDataBySource(sourceName, data, settings)
+ }
+ }
+
+ PlasmaCore.DataSource {
+ id: extsysmonDE
+ engine: "extsysmon"
+ connectedSources: ["battery", "custom", "desktop", "netdev", "gpu",
+ "gputemp", "hddtemp", "pkg", "player", "ps", "update"]
+ interval: 5000
+
+ onNewData: {
+ if (debug) console.log("[advanced::onNewData] : Update source " + sourceName)
+
+ AWKeys.setDataBySource(sourceName, data, settings)
+ }
+ }
+
+ PlasmaCore.DataSource {
+ id: timeDE
+ engine: "time"
+ connectedSources: ["Local"]
+ interval: 5000
+
+ onNewData: {
+ if (debug) console.log("[advanced::onNewData] : Update source " + sourceName)
+
+ AWKeys.setDataBySource(sourceName, data, settings)
+ }
+ }
+
+ Component.onCompleted: {
+ if (debug) console.log("[advanced::onCompleted]")
+
+ // init submodule
+ AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings)
+ }
+}
diff --git a/sources/desktop-panel-kf5/package/contents/ui/appearance.qml b/sources/desktop-panel-kf5/package/contents/ui/appearance.qml
new file mode 100644
index 0000000..45b62e5
--- /dev/null
+++ b/sources/desktop-panel-kf5/package/contents/ui/appearance.qml
@@ -0,0 +1,402 @@
+/***************************************************************************
+ * This file is part of awesome-widgets *
+ * *
+ * awesome-widgets 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. *
+ * *
+ * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
+ ***************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Controls 1.3 as QtControls
+import QtQuick.Layouts 1.0 as QtLayouts
+import QtQuick.Controls.Styles 1.3 as QtStyles
+import QtQuick.Dialogs 1.1 as QtDialogs
+
+import org.kde.plasma.private.desktoppanel 1.0
+
+
+Item {
+ id: appearancePage
+ width: childrenRect.width
+ height: childrenRect.height
+ implicitWidth: pageColumn.implicitWidth
+ implicitHeight: pageColumn.implicitHeight
+
+ property bool debug: DPAdds.isDebugEnabled()
+ property variant weight: {
+ 25: 0,
+ 50: 1,
+ 63: 3,
+ 75: 4,
+ 87: 5
+ }
+
+ property alias cfg_fontFamily: selectFont.text
+ property alias cfg_fontSize: fontSize.value
+ property string cfg_fontWeight: fontWeight.currentText
+ property string cfg_fontStyle: fontStyle.currentText
+ property alias cfg_fontColor: selectColor.text
+ property alias cfg_currentFontFamily: currentSelectFont.text
+ property alias cfg_currentFontSize: currentFontSize.value
+ property string cfg_currentFontWeight: currentFontWeight.currentText
+ property string cfg_currentFontStyle: currentFontStyle.currentText
+ property alias cfg_currentFontColor: currentSelectColor.text
+
+
+ Column {
+ id: pageColumn
+ width: units.gridUnit * 25
+ QtControls.TabView {
+ height: parent.height
+ width: parent.width
+ QtControls.Tab {
+ title: i18n("Active desktop")
+
+ QtLayouts.ColumnLayout {
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Label {
+ height: parent.height
+ width: parent.width / 3
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
+ text: i18n("Font")
+ }
+ QtControls.Button {
+ id: currentSelectFont
+ width: parent.width * 2 / 3
+ text: plasmoid.configuration.currentFontFamily
+ onClicked: currentFontDialog.visible = true
+ }
+ }
+
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Label {
+ height: parent.height
+ width: parent.width / 3
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
+ text: i18n("Font size")
+ }
+ QtControls.SpinBox {
+ id: currentFontSize
+ width: parent.width * 2 / 3
+ minimumValue: 8
+ maximumValue: 32
+ stepSize: 1
+ value: plasmoid.configuration.currentFontSize
+ }
+ }
+
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Label {
+ height: parent.height
+ width: parent.width / 3
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
+ text: i18n("Font weight")
+ }
+ QtControls.ComboBox {
+ id: currentFontWeight
+ width: parent.width * 2 / 3
+ textRole: "label"
+ model: [
+ {
+ 'label': i18n("light"),
+ 'name': "light"
+ },
+ {
+ 'label': i18n("normal"),
+ 'name': "normal"
+ },
+ {
+ 'label': i18n("demi bold"),
+ 'name': "demibold"
+ },
+ {
+ 'label': i18n("bold"),
+ 'name': "bold"
+ },
+ {
+ 'label': i18n("black"),
+ 'name': "black"
+ }
+ ]
+ onCurrentIndexChanged: cfg_currentFontWeight = model[currentIndex]["name"]
+ Component.onCompleted: {
+ for (var i = 0; i < model.length; i++) {
+ if (model[i]["name"] == plasmoid.configuration.currentFontWeight) {
+ currentFontWeight.currentIndex = i;
+ }
+ }
+ }
+ }
+ }
+
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Label {
+ height: parent.height
+ width: parent.width / 3
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
+ text: i18n("Font style")
+ }
+ QtControls.ComboBox {
+ id: currentFontStyle
+ width: parent.width * 2 / 3
+ textRole: "label"
+ model: [
+ {
+ 'label': i18n("normal"),
+ 'name': "normal"
+ },
+ {
+ 'label': i18n("italic"),
+ 'name': "italic"
+ }
+ ]
+ onCurrentIndexChanged: cfg_currentFontStyle = model[currentIndex]["name"]
+ Component.onCompleted: {
+ for (var i = 0; i < model.length; i++) {
+ if (model[i]["name"] == plasmoid.configuration.currentFontStyle) {
+ currentFontStyle.currentIndex = i;
+ }
+ }
+ }
+ }
+ }
+
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Label {
+ height: parent.height
+ width: parent.width / 3
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
+ text: i18n("Font color")
+ }
+ QtControls.Button {
+ id: currentSelectColor
+ width: parent.width * 2 / 3
+ style: QtStyles.ButtonStyle {
+ background: Rectangle {
+ color: plasmoid.configuration.currentFontColor
+ }
+ }
+ text: plasmoid.configuration.currentFontColor
+ onClicked: currentColorDialog.visible = true
+ }
+ }
+ }
+
+ QtDialogs.ColorDialog {
+ id: currentColorDialog
+ title: i18n("Select a color")
+ color: currentSelectColor.text
+ onAccepted: currentSelectColor.text = currentColorDialog.color
+ }
+
+ QtDialogs.FontDialog {
+ id: currentFontDialog
+ title: i18n("Select a font")
+ font: Qt.font({ family: currentSelectFont.text, pointSize: currentFontSize.value, weight: Font.Normal })
+ onAccepted: {
+ currentSelectFont.text = currentFontDialog.font.family
+ currentFontSize.value = currentFontDialog.font.pointSize
+ currentFontStyle.currentIndex = currentFontDialog.font.italic ? 1 : 0
+ currentFontWeight.currentIndex = weight[currentFontDialog.font.weight]
+ }
+ }
+ }
+
+ QtControls.Tab {
+ title: i18n("Inactive desktop")
+
+ QtLayouts.ColumnLayout {
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Label {
+ height: parent.height
+ width: parent.width / 3
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
+ text: i18n("Font")
+ }
+ QtControls.Button {
+ id: selectFont
+ width: parent.width * 2 / 3
+ text: plasmoid.configuration.fontFamily
+ onClicked: fontDialog.visible = true
+ }
+ }
+
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Label {
+ height: parent.height
+ width: parent.width / 3
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
+ text: i18n("Font size")
+ }
+ QtControls.SpinBox {
+ id: fontSize
+ width: parent.width * 2 / 3
+ minimumValue: 8
+ maximumValue: 32
+ stepSize: 1
+ value: plasmoid.configuration.fontSize
+ }
+ }
+
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Label {
+ height: parent.height
+ width: parent.width / 3
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
+ text: i18n("Font weight")
+ }
+ QtControls.ComboBox {
+ id: fontWeight
+ width: parent.width * 2 / 3
+ textRole: "label"
+ model: [
+ {
+ 'label': i18n("light"),
+ 'name': "light"
+ },
+ {
+ 'label': i18n("normal"),
+ 'name': "normal"
+ },
+ {
+ 'label': i18n("demi bold"),
+ 'name': "demibold"
+ },
+ {
+ 'label': i18n("bold"),
+ 'name': "bold"
+ },
+ {
+ 'label': i18n("black"),
+ 'name': "black"
+ }
+ ]
+ onCurrentIndexChanged: cfg_fontWeight = model[currentIndex]["name"]
+ Component.onCompleted: {
+ for (var i = 0; i < model.length; i++) {
+ if (model[i]["name"] == plasmoid.configuration.fontWeight) {
+ fontWeight.currentIndex = i;
+ }
+ }
+ }
+ }
+ }
+
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Label {
+ height: parent.height
+ width: parent.width / 3
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
+ text: i18n("Font style")
+ }
+ QtControls.ComboBox {
+ id: fontStyle
+ width: parent.width * 2 / 3
+ textRole: "label"
+ model: [
+ {
+ 'label': i18n("normal"),
+ 'name': "normal"
+ },
+ {
+ 'label': i18n("italic"),
+ 'name': "italic"
+ }
+ ]
+ onCurrentIndexChanged: cfg_fontStyle = model[currentIndex]["name"]
+ Component.onCompleted: {
+ for (var i = 0; i < model.length; i++) {
+ if (model[i]["name"] == plasmoid.configuration.fontStyle) {
+ fontStyle.currentIndex = i;
+ }
+ }
+ }
+ }
+ }
+
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Label {
+ height: parent.height
+ width: parent.width / 3
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignVCenter
+ text: i18n("Font color")
+ }
+ QtControls.Button {
+ id: selectColor
+ width: parent.width * 2 / 3
+ style: QtStyles.ButtonStyle {
+ background: Rectangle {
+ color: plasmoid.configuration.fontColor
+ }
+ }
+ text: plasmoid.configuration.fontColor
+ onClicked: colorDialog.visible = true
+ }
+ }
+ }
+
+ QtDialogs.ColorDialog {
+ id: colorDialog
+ title: i18n("Select a color")
+ color: selectColor.text
+ onAccepted: selectColor.text = colorDialog.color
+ }
+
+ QtDialogs.FontDialog {
+ id: fontDialog
+ title: i18n("Select a font")
+ font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal })
+ onAccepted: {
+ selectFont.text = fontDialog.font.family
+ fontSize.value = fontDialog.font.pointSize
+ fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0
+ fontWeight.currentIndex = weight[fontDialog.font.weight]
+ }
+ }
+ }
+ }
+ }
+
+ Component.onCompleted: {
+ if (debug) console.log("[appearance::onCompleted]")
+ }
+}
diff --git a/sources/desktop-panel-kf5/package/contents/ui/general.qml b/sources/desktop-panel-kf5/package/contents/ui/general.qml
new file mode 100644
index 0000000..dc26a78
--- /dev/null
+++ b/sources/desktop-panel-kf5/package/contents/ui/general.qml
@@ -0,0 +1,36 @@
+/***************************************************************************
+ * This file is part of awesome-widgets *
+ * *
+ * awesome-widgets 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. *
+ * *
+ * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
+ ***************************************************************************/
+
+pragma Singleton
+import QtQuick 2.0
+
+
+QtObject {
+ property variant fontWeight: {
+ "light": Font.Light,
+ "normal": Font.Normal,
+ "demibold": Font.DemiBold,
+ "bold": Font.Bold,
+ "black": Font.Black
+ }
+ property variant align: {
+ "left": Text.AlignLeft,
+ "center": Text.AlignHCenter,
+ "right": Text.AlignRight,
+ "justify": Text.AlignJustify
+ }
+}
diff --git a/sources/desktop-panel-kf5/package/contents/ui/main.qml b/sources/desktop-panel-kf5/package/contents/ui/main.qml
new file mode 100644
index 0000000..a9e9b11
--- /dev/null
+++ b/sources/desktop-panel-kf5/package/contents/ui/main.qml
@@ -0,0 +1,85 @@
+/***************************************************************************
+ * This file is part of awesome-widgets *
+ * *
+ * awesome-widgets 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. *
+ * *
+ * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
+ ***************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 1.3 as QtControls
+import QtQuick.Layouts 1.1
+import org.kde.plasma.plasmoid 2.0
+import org.kde.plasma.core 2.0 as PlasmaCore
+import org.kde.plasma.components 2.0 as PlasmaComponents
+
+import org.kde.plasma.private.desktoppanel 1.0
+import "."
+
+
+Item {
+ id: main
+
+ property bool debug: DPAdds.isDebugEnabled()
+ property variant settings: {
+ }
+
+
+ // init
+ Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
+ Plasmoid.compactRepresentation: Plasmoid.fullRepresentation
+
+ Layout.fillWidth: plasmoid.formFactor != PlasmaCore.Planar
+ Layout.fillHeight: plasmoid.formFactor != PlasmaCore.Planar
+ Layout.minimumHeight: text.height
+ Layout.minimumWidth: text.width
+
+ Plasmoid.icon: "utilities-system-monitor"
+ Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground"
+
+
+ // ui
+ Grid {
+ columns: 1
+
+ Text {
+ id: text
+ height: contentHeight
+ width: contentWidth
+ textFormat: Text.RichText
+ wrapMode: Text.NoWrap
+
+ horizontalAlignment: general.align[plasmoid.configuration.textAlign]
+ verticalAlignment: Text.AlignVCenter
+
+ color: plasmoid.configuration.fontColor
+ font.family: plasmoid.configuration.fontFamily
+ font.italic: plasmoid.configuration.fontStyle == "italic" ? true : false
+ font.pointSize: plasmoid.configuration.fontSize
+ font.weight: general.fontWeight[plasmoid.configuration.fontWeight]
+
+ text: plasmoid.configuration.text
+
+ PlasmaCore.ToolTipArea {
+ id: rootTooltip
+ mainItem: Text {
+ id: tooltip
+ textFormat: Text.RichText
+ }
+ }
+ }
+ }
+
+ Component.onCompleted: {
+ if (debug) console.log("[main::onCompleted]")
+ }
+}
diff --git a/sources/desktop-panel-kf5/package/contents/ui/qmldir b/sources/desktop-panel-kf5/package/contents/ui/qmldir
new file mode 100644
index 0000000..dda3998
--- /dev/null
+++ b/sources/desktop-panel-kf5/package/contents/ui/qmldir
@@ -0,0 +1 @@
+singleton general general.qml
diff --git a/sources/desktop-panel-kf5/package/contents/ui/widget.qml b/sources/desktop-panel-kf5/package/contents/ui/widget.qml
new file mode 100644
index 0000000..a9a4ad6
--- /dev/null
+++ b/sources/desktop-panel-kf5/package/contents/ui/widget.qml
@@ -0,0 +1,234 @@
+/***************************************************************************
+ * This file is part of awesome-widgets *
+ * *
+ * awesome-widgets 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. *
+ * *
+ * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
+ ***************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Controls 1.3 as QtControls
+
+import org.kde.plasma.private.desktoppanel 1.0
+
+
+Item {
+ id: widgetPage
+ width: childrenRect.width
+ height: childrenRect.height
+ implicitWidth: pageColumn.implicitWidth
+ implicitHeight: pageColumn.implicitHeight
+
+ property bool debug: DPAdds.isDebugEnabled()
+
+ property alias cfg_text: textPattern.text
+
+
+ Column {
+ id: pageColumn
+ width: units.gridUnit * 25
+ QtControls.Label {
+ width: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ wrapMode: Text.WordWrap
+ text: i18n("Detailed information may be found on project homepage")
+ }
+
+ Row {
+ height: implicitHeight
+ width: parent.width
+ QtControls.Button {
+ text: i18n("Font")
+ iconName: "font"
+
+ onClicked: {
+ if (debug) console.log("[widget::onClicked] : Font button")
+
+ var defaultFont = {
+ "color": plasmoid.configuration.fontColor,
+ "family": plasmoid.configuration.fontFamily,
+ "size": plasmoid.configuration.fontSize
+ }
+ var font = DPAdds.getFont(defaultFont)
+ var pos = textPattern.cursorPosition
+ var selected = textPattern.selectedText
+ textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
+ textPattern.insert(pos, "" +
+ selected + "")
+ }
+ }
+ QtControls.Button {
+ iconName: "format-indent-more"
+
+ onClicked: {
+ if (debug) console.log("[widget::onClicked] : Indent button")
+
+ var pos = textPattern.cursorPosition
+ var selected = textPattern.selectedText
+ textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
+ textPattern.insert(pos, selected + "
\n")
+ }
+ }
+
+ QtControls.Button {
+ iconName: "format-text-bold"
+
+ onClicked: {
+ if (debug) console.log("[widget::onClicked] : Bold button")
+
+ var pos = textPattern.cursorPosition
+ var selected = textPattern.selectedText
+ textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
+ textPattern.insert(pos, "" + selected + "")
+ }
+ }
+ QtControls.Button {
+ iconName: "format-text-italic"
+
+ onClicked: {
+ if (debug) console.log("[widget::onClicked] : Italic button")
+
+ var pos = textPattern.cursorPosition
+ var selected = textPattern.selectedText
+ textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
+ textPattern.insert(pos, "" + selected + "")
+ }
+ }
+ QtControls.Button {
+ iconName: "format-text-underline"
+
+ onClicked: {
+ if (debug) console.log("[widget::onClicked] : Underline button")
+
+ var pos = textPattern.cursorPosition
+ var selected = textPattern.selectedText
+ textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
+ textPattern.insert(pos, "" + selected + "")
+ }
+ }
+ QtControls.Button {
+ iconName: "format-text-strikethrough"
+
+ onClicked: {
+ if (debug) console.log("[widget::onClicked] : Strike button")
+
+ var pos = textPattern.cursorPosition
+ var selected = textPattern.selectedText
+ textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
+ textPattern.insert(pos, "" + selected + "")
+ }
+ }
+
+ QtControls.Button {
+ iconName: "format-justify-left"
+
+ onClicked: {
+ if (debug) console.log("[widget::onClicked] : Left button")
+
+ var pos = textPattern.cursorPosition
+ var selected = textPattern.selectedText
+ textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
+ textPattern.insert(pos, "" + selected + "
" + selected + "
" + selected + "" + selected + ""
+ message += i18n("Value: %1", DPAdds.valueByKey(tags.currentText))
+ message += "
"
+ message += i18n("Info: %1", DPAdds.infoByKey(tags.currentText))
+ DPAdds.sendNotification("tag", message)
+ }
+ }
+ }
+
+ QtControls.TextArea {
+ id: textPattern
+ width: parent.width
+ textFormat: TextEdit.PlainText
+ text: plasmoid.configuration.text
+ }
+ }
+
+
+ Component.onCompleted: {
+ if (debug) console.log("[widget::onCompleted]")
+ }
+}
diff --git a/sources/desktop-panel-kf5/package/metadata.desktop b/sources/desktop-panel-kf5/package/metadata.desktop
new file mode 100644
index 0000000..87fa8fa
--- /dev/null
+++ b/sources/desktop-panel-kf5/package/metadata.desktop
@@ -0,0 +1,28 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Desktop Panel
+Comment=A minimalistic Plasmoid
+Comment[en]=A minimalistic Plasmoid
+Comment[es]=Un plasmoide minimalista
+Comment[es]=Un script Plasmoïde minimaliste
+Comment[pt_BR]=Um script Plasmoid
+Comment[ru]=Минималистичный плазмоид
+Comment[uk]=Мінімалістичний плазмоїд
+X-KDE-ServiceTypes=Plasma/Applet
+Type=Service
+Icon=utilities-system-monitor
+
+X-KDE-ServiceTypes=Plasma/Applet
+X-Plasma-API=declarativeappletscript
+X-Plasma-MainScript=ui/main.qml
+X-Plasma-RemoteLocation=
+
+X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
+X-KDE-PluginInfo-Email=esalexeev@gmail.com
+X-KDE-PluginInfo-Name=org.kde.plasma.desktoppanel
+X-KDE-PluginInfo-Version=@PROJECT_VERSION@
+X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
+X-KDE-PluginInfo-Category=System Information
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPLv3
+X-KDE-PluginInfo-EnabledByDefault=true
diff --git a/sources/desktop-panel-kf5/plugin/CMakeLists.txt b/sources/desktop-panel-kf5/plugin/CMakeLists.txt
new file mode 100644
index 0000000..fafa007
--- /dev/null
+++ b/sources/desktop-panel-kf5/plugin/CMakeLists.txt
@@ -0,0 +1,33 @@
+set (PLUGIN_NAME dpplugin)
+
+add_definitions (${Qt5Core_DEFINITIONS})
+set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
+ ${Qt5Qml_INCLUDE_DIRS})
+set (Qt_LIBRARIES ${Qt5Core_LIBRARIES}
+ ${Qt5Qml_LIBRARIES})
+set (Kf5_INCLUDE ${I18n_INCLUDE_DIR}
+ ${Notifications_INCLUDE_DIR}
+ ${Plasma_INCLUDE_DIR})
+set (Kf5_LIBRARIES KF5::I18n
+ KF5::Notifications
+ KF5::Plasma
+ KF5::WindowSystem)
+
+include_directories (${CMAKE_SOURCE_DIR}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}/../
+ ${PROJECT_TRDPARTY_DIR}
+ ${Qt_INCLUDE}
+ ${Kf5_INCLUDE})
+
+file (GLOB SUBPROJECT_SOURCE *.cpp)
+file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
+file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp)
+
+add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE})
+target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
+
+install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/desktoppanel)
+install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/desktoppanel)
+install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
diff --git a/sources/desktop-panel-kf5/plugin/desktoppanel.cpp b/sources/desktop-panel-kf5/plugin/desktoppanel.cpp
new file mode 100644
index 0000000..2e40bf0
--- /dev/null
+++ b/sources/desktop-panel-kf5/plugin/desktoppanel.cpp
@@ -0,0 +1,39 @@
+/***************************************************************************
+ * This file is part of awesome-widgets *
+ * *
+ * awesome-widgets 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. *
+ * *
+ * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
+ ***************************************************************************/
+
+#include "desktoppanel.h"
+
+#include
+
+#include "dpadds.h"
+
+
+static QObject *dpadds_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(engine);
+ Q_UNUSED(scriptEngine);
+
+ return new DPAdds();
+}
+
+
+void DPPlugin::registerTypes(const char *uri)
+{
+ Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.desktoppanel"));
+
+ qmlRegisterSingletonType(uri, 1, 0, "DPAdds", dpadds_singletontype_provider);
+}
diff --git a/sources/desktop-panel-kf5/plugin/desktoppanel.h b/sources/desktop-panel-kf5/plugin/desktoppanel.h
new file mode 100644
index 0000000..0887bcb
--- /dev/null
+++ b/sources/desktop-panel-kf5/plugin/desktoppanel.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+ * This file is part of awesome-widgets *
+ * *
+ * awesome-widgets 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. *
+ * *
+ * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
+ ***************************************************************************/
+
+
+#ifndef DPPLUGIN_H
+#define DPPLUGIN_H
+
+#include
+
+
+class QQmlEngine;
+
+class DPPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ void registerTypes(const char *uri);
+};
+
+
+#endif /* DPPLUGIN_H */
diff --git a/sources/desktop-panel-kf5/plugin/dpadds.cpp b/sources/desktop-panel-kf5/plugin/dpadds.cpp
new file mode 100644
index 0000000..862156d
--- /dev/null
+++ b/sources/desktop-panel-kf5/plugin/dpadds.cpp
@@ -0,0 +1,425 @@
+/***************************************************************************
+ * This file is part of awesome-widgets *
+ * *
+ * awesome-widgets 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. *
+ * *
+ * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
+ ***************************************************************************/
+
+#include "dpadds.h"
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include "version.h"
+
+
+DPAdds::DPAdds(QObject *parent)
+ : QObject(parent)
+{
+ // debug
+ QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
+ QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
+ debug = (debugEnv == QString("yes"));
+
+ connect(KWindowSystem::self(), SIGNAL(currentDesktopChanged(int)), this, SLOT(changeDesktop(int)));
+}
+
+
+DPAdds::~DPAdds()
+{
+ if (debug) qDebug() << PDEBUG;
+}
+
+
+bool DPAdds::isDebugEnabled()
+{
+ if (debug) qDebug() << PDEBUG;
+
+ return debug;
+}
+
+
+QStringList DPAdds::dictKeys()
+{
+ if (debug) qDebug() << PDEBUG;
+
+ QStringList allKeys;
+ allKeys.append(QString("mark"));
+ allKeys.append(QString("name"));
+ allKeys.append(QString("number"));
+ allKeys.append(QString("total"));
+
+ return allKeys;
+}
+
+
+QString DPAdds::toolTipImage(const int desktop)
+{
+ if (debug) qDebug() << PDEBUG;
+ if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
+
+ // prepare
+ // clear
+ QGraphicsScene *toolTipScene = new QGraphicsScene();
+ QGraphicsView *toolTipView = new QGraphicsView(toolTipScene);
+ DesktopWindowsInfo info = getInfoByDesktop(desktop);
+ float margin = 5.0 * info.desktop.width() / 400.0;
+ toolTipView->resize(info.desktop.width() + 2.0 * margin, info.desktop.height() + 2.0 * margin);
+ toolTipScene->clear();
+ toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush));
+ // borders
+ toolTipScene->addLine(0, 0, 0, info.desktop.height() + 2.0 * margin);
+ toolTipScene->addLine(0, info.desktop.height() + 2.0 * margin,
+ info.desktop.width() + 2.0 * margin, info.desktop.height() + 2.0 * margin);
+ toolTipScene->addLine(info.desktop.width() + 2.0 * margin, info.desktop.height() + 2.0 * margin,
+ info.desktop.width() + 2.0 * margin, 0);
+ toolTipScene->addLine(info.desktop.width() + 2.0 * margin, 0, 0, 0);
+
+ if (tooltipType == QString("contours")) {
+ QPen pen = QPen();
+ pen.setWidthF(2.0 * info.desktop.width() / 400.0);
+ pen.setColor(QColor(tooltipColor));
+ for (int i=0; iaddLine(info.windows[i].left() + margin, info.windows[i].bottom() + margin,
+ info.windows[i].left() + margin, info.windows[i].top() + margin, pen);
+ toolTipScene->addLine(info.windows[i].left() + margin, info.windows[i].top() + margin,
+ info.windows[i].right() + margin, info.windows[i].top() + margin, pen);
+ toolTipScene->addLine(info.windows[i].right() + margin, info.windows[i].top() + margin,
+ info.windows[i].right() + margin, info.windows[i].bottom() + margin, pen);
+ toolTipScene->addLine(info.windows[i].right() + margin, info.windows[i].bottom() + margin,
+ info.windows[i].left() + margin, info.windows[i].bottom() + margin, pen);
+ }
+ } else if (tooltipType == QString("clean")) {
+// toolTip.setWindowsToPreview(info.desktopId);
+ } else if (tooltipType == QString("windows")) {
+// toolTip.setWindowsToPreview(info.winId);
+ }
+
+ QPixmap image = toolTipView->grab().scaledToWidth(tooltipWidth);
+ QByteArray byteArray;
+ QBuffer buffer(&byteArray);
+ image.save(&buffer, "PNG");
+
+ return QString("
").arg(QString(byteArray.toBase64()));
+}
+
+
+QString DPAdds::parsePattern(const QString pattern, const int desktop)
+{
+ if (debug) qDebug() << PDEBUG;
+
+ QString parsed = pattern;
+ QStringList keys = dictKeys();
+ parsed.replace(QString(" "), QString(" "));
+ parsed.replace(QString("$$"), QString("$\\$\\"));
+ for (int i=0; i tooltipData)
+{
+ if (debug) qDebug() << PDEBUG;
+ if (debug) qDebug() << PDEBUG << ":" << "Data" << tooltipData;
+
+ tooltipColor = tooltipData[QString("tooltipColor")].toString();
+ tooltipType = tooltipData[QString("tooltipType")].toString();
+ tooltipWidth = tooltipData[QString("tooltipWidth")].toInt();
+}
+
+
+QString DPAdds::valueByKey(const QString key, const int desktop)
+{
+ if (debug) qDebug() << PDEBUG;
+ if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key;
+
+ QString currentMark;
+ if (KWindowSystem::currentDesktop() == desktop)
+ currentMark = mark;
+ else
+ currentMark = QString("");
+ if (key == QString("mark"))
+ return QString("%1").arg(currentMark, currentMark.count(), QLatin1Char(' '));
+ else if (key == QString("name"))
+ return KWindowSystem::desktopName(desktop);
+ else if (key == QString("number"))
+ return QString::number(desktop);
+ else if (key == QString("total"))
+ return QString::number(KWindowSystem::numberOfDesktops());
+ else
+ return QString();
+}
+
+
+QString DPAdds::editPanelsToContol(const QString current)
+{
+ if (debug) qDebug() << PDEBUG;
+
+ // paint
+ QDialog *dialog = new QDialog(0);
+ QListWidget *widget = new QListWidget(dialog);
+ QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Open | QDialogButtonBox::Close,
+ Qt::Vertical, dialog);
+ QHBoxLayout *layout = new QHBoxLayout(dialog);
+ layout->addWidget(widget);
+ layout->addWidget(buttons);
+ dialog->setLayout(layout);
+ connect(buttons, SIGNAL(rejected()), dialog, SLOT(reject()));
+ connect(buttons, SIGNAL(accepted()), dialog, SLOT(accept()));
+
+ // fill
+ QList panels = getPanels();
+ for (int i=0; ilocation()), widget);
+ if ((current.split(QChar(',')).contains(QString::number(i))) ||
+ (current == QString("-1")))
+ item->setCheckState(Qt::Checked);
+ else
+ item->setCheckState(Qt::Unchecked);
+ }
+
+ // exec
+ QString value;
+ QStringList indexes;
+ int ret = dialog->exec();
+ switch (ret) {
+ case QDialog::Accepted:
+ for (int i=0; icount(); i++)
+ if (widget->item(i)->checkState() == Qt::Checked)
+ indexes.append(QString::number(i));
+ if (indexes.count() == widget->count())
+ value = QString("-1");
+ else
+ value = indexes.join(QChar(','));
+ break;
+ default:
+ value = current;
+ break;
+ }
+
+ return value;
+}
+
+
+QString DPAdds::getAboutText(const QString type)
+{
+ if (debug) qDebug() << PDEBUG;
+ if (debug) qDebug() << PDEBUG << ":" << "Type" << type;
+
+ QString text;
+ if (type == QString("header"))
+ text = QString(NAME);
+ else if (type == QString("description"))
+ text = i18n("A set of minimalistic plasmoid widgets");
+ else if (type == QString("links"))
+ text = i18n("Links:") + QString("
") +
+ QString("%2
").arg(QString(HOMEPAGE)).arg(i18n("Homepage")) +
+ QString("%2
").arg(QString(REPOSITORY)).arg(i18n("Repository")) +
+ QString("%2
").arg(QString(BUGTRACKER)).arg(i18n("Bugtracker")) +
+ QString("%2
").arg(QString(TRANSLATION)).arg(i18n("Translation issue")) +
+ QString("%2
").arg(QString(AUR_PACKAGES)).arg(i18n("AUR packages")) +
+ QString("%2").arg(QString(OPENSUSE_PACKAGES)).arg(i18n("openSUSE packages"));
+ else if (type == QString("copy"))
+ text = QString("© %1 %3
").arg(QString(DATE)).arg(QString(EMAIL)).arg(QString(AUTHOR)) +
+ i18n("This software is licensed under %1", QString(LICENSE)) + QString("");
+ else if (type == QString("translators"))
+ text = i18n("Translators: %1", QString(TRANSLATORS));
+ else if (type == QString("3rdparty")) {
+ QStringList trdPartyList = QString(TRDPARTY_LICENSE).split(QChar(';'), QString::SkipEmptyParts);
+ for (int i=0; i%1 (%2 license)")
+ .arg(trdPartyList[i].split(QChar(','))[0])
+ .arg(trdPartyList[i].split(QChar(','))[1])
+ .arg(trdPartyList[i].split(QChar(','))[2]);
+ text = i18n("This software uses: %1", trdPartyList.join(QString(", ")));
+ }
+
+ return text;
+}
+
+
+QMap DPAdds::getFont(const QMap defaultFont)
+{
+ if (debug) qDebug() << PDEBUG;
+
+ QMap fontMap;
+ CFont defaultCFont = CFont(defaultFont[QString("family")].toString(),
+ defaultFont[QString("size")].toInt(),
+ 400, false, defaultFont[QString("color")].toString());
+ CFont font = CFontDialog::getFont(i18n("Select font"), defaultCFont,
+ false, false);
+ fontMap[QString("color")] = font.color().name();
+ fontMap[QString("family")] = font.family();
+ fontMap[QString("size")] = font.pointSize();
+
+ return fontMap;
+}
+
+
+void DPAdds::changePanelsState()
+{
+ if (debug) qDebug() << PDEBUG;
+ if (panelsToControl.isEmpty()) return;
+
+ QList panels = getPanels();
+// for (int i=0; iview()->isVisible();
+// int winId = panels[i]->view()->winId();
+// if (wasVisible) {
+// if (debug) qDebug() << PDEBUG << ":" << "Hide panel";
+// KWindowInfo oldInfo = KWindowSystem::windowInfo(winId, NET::WMState);
+// oldState = oldInfo.state();
+// panels[i]->view()->setVisible(false);
+// } else {
+// if (debug) qDebug() << PDEBUG << ":" << "Show panel";
+// panels[i]->view()->setVisible(true);
+// KWindowSystem::clearState(winId, NET::KeepAbove);
+// KWindowSystem::setState(winId, oldState | NET::StaysOnTop);
+// KWindowSystem::setOnAllDesktops(winId, true);
+// }
+// }
+ panels.clear();
+}
+
+
+void DPAdds::sendNotification(const QString eventId, const QString message)
+{
+ KNotification *notification = KNotification::event(eventId, QString("Desktop Panel ::: ") + eventId, message);
+ notification->setComponentName(QString("plasma-applet-org.kde.plasma.desktop-panel"));
+}
+
+
+void DPAdds::setCurrentDesktop(const int desktop)
+{
+ if (debug) qDebug() << PDEBUG;
+ if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
+
+ KWindowSystem::setCurrentDesktop(desktop);
+}
+
+
+void DPAdds::changeDesktop(const int desktop)
+{
+ if (debug) qDebug() << PDEBUG;
+ if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
+
+ emit(desktopChanged());
+}
+
+
+DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int desktop)
+{
+ if (debug) qDebug() << PDEBUG;
+ if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
+
+
+ DesktopWindowsInfo info;
+ info.desktop = KWindowSystem::workArea(desktop);
+
+ QList windows = KWindowSystem::windows();
+ for (int i=0; i DPAdds::getPanels()
+{
+ if (debug) qDebug() << PDEBUG;
+
+ Plasma::Containment *containment = new Plasma::Containment(this, QVariantList());
+ QList panels;
+ for (int i=0; icorona()->containments().count(); i++)
+ if (containment->corona()->containments()[i]->containmentType() ==
+ Plasma::Types::ContainmentType::PanelContainment)
+ panels.append(containment->corona()->containments()[i]);
+ delete containment;
+
+ return panels;
+}
+
+
+QString DPAdds::panelLocationToStr(Plasma::Types::Location location)
+{
+ if (debug) qDebug() << PDEBUG;
+ if (debug) qDebug() << PDEBUG << ":" << "Location" << location;
+
+ switch (location) {
+ case Plasma::Types::Location::TopEdge:
+ return i18n("Top Edge");
+ case Plasma::Types::Location::BottomEdge:
+ return i18n("Bottom Edge");
+ case Plasma::Types::Location::LeftEdge:
+ return i18n("Left Edge");
+ case Plasma::Types::Location::RightEdge:
+ return i18n("Right Edge");
+ default:
+ return i18n("Unknown location (%1)", location);
+ }
+}
diff --git a/sources/desktop-panel-kf5/plugin/dpadds.h b/sources/desktop-panel-kf5/plugin/dpadds.h
new file mode 100644
index 0000000..9fd8633
--- /dev/null
+++ b/sources/desktop-panel-kf5/plugin/dpadds.h
@@ -0,0 +1,81 @@
+/***************************************************************************
+ * This file is part of awesome-widgets *
+ * *
+ * awesome-widgets 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. *
+ * *
+ * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
+ ***************************************************************************/
+
+
+#ifndef DPADDS_H
+#define DPADDS_H
+
+#include
+
+#include
+#include
+#include
+
+
+class DPAdds : public QObject
+{
+ Q_OBJECT
+
+ typedef struct {
+ QRect desktop;
+ QList desktopId;
+ QList windows;
+ QList winId;
+ } DesktopWindowsInfo;
+
+public:
+ DPAdds(QObject *parent = 0);
+ ~DPAdds();
+
+ Q_INVOKABLE bool isDebugEnabled();
+ Q_INVOKABLE QStringList dictKeys();
+ Q_INVOKABLE QString toolTipImage(const int desktop);
+ Q_INVOKABLE QString parsePattern(const QString pattern, const int desktop);
+ // values
+ Q_INVOKABLE void setMark(const QString newMark);
+ Q_INVOKABLE void setPanelsToControl(const QString newPanels);
+ Q_INVOKABLE void setToolTipData(const QMap tooltipData);
+ Q_INVOKABLE QString valueByKey(const QString key, const int desktop);
+ // configuration slots
+ Q_INVOKABLE QString editPanelsToContol(const QString current);
+ Q_INVOKABLE QString getAboutText(const QString type = "header");
+ Q_INVOKABLE QMap getFont(const QMap defaultFont);
+
+signals:
+ void desktopChanged();
+
+public slots:
+ Q_INVOKABLE void changePanelsState();
+ Q_INVOKABLE static void sendNotification(const QString eventId, const QString message);
+ Q_INVOKABLE void setCurrentDesktop(const int desktop);
+
+private slots:
+ void changeDesktop(const int desktop);
+
+private:
+ DesktopWindowsInfo getInfoByDesktop(const int desktop);
+ QList getPanels();
+ QString panelLocationToStr(Plasma::Types::Location location);
+ // variables
+ bool debug = false;
+ int oldState, tooltipWidth;
+ QString mark, tooltipColor, tooltipType;
+ QList panelsToControl;
+};
+
+
+#endif /* DPADDS_H */
diff --git a/sources/desktop-panel-kf5/plugin/plasma-applet-org.kde.plasma.desktop-panel.notifyrc b/sources/desktop-panel-kf5/plugin/plasma-applet-org.kde.plasma.desktop-panel.notifyrc
new file mode 100644
index 0000000..30b8a0e
--- /dev/null
+++ b/sources/desktop-panel-kf5/plugin/plasma-applet-org.kde.plasma.desktop-panel.notifyrc
@@ -0,0 +1,24 @@
+[Global]
+IconName=system
+Name=Desktop Panel
+Comment=Desktop panel notifications
+
+[info]
+Name=Information
+Comment=Information
+Action=Popup
+
+[Event/event]
+Name=Event
+Comment=Some event occurs
+Action=Popup
+
+[Event/system]
+Name=System information
+Comment=System information
+Action=Popup
+
+[Event/tag]
+Name=Tag information
+Comment=Tag information
+Action=Popup
diff --git a/sources/desktop-panel-kf5/plugin/qmldir b/sources/desktop-panel-kf5/plugin/qmldir
new file mode 100644
index 0000000..b49440a
--- /dev/null
+++ b/sources/desktop-panel-kf5/plugin/qmldir
@@ -0,0 +1,3 @@
+module org.kde.plasma.private.desktoppanel
+
+plugin dpplugin