diff --git a/sources/awesome-widget/advanced.ui b/sources/awesome-widget/advanced.ui
index 8768e2b..3268e7a 100644
--- a/sources/awesome-widget/advanced.ui
+++ b/sources/awesome-widget/advanced.ui
@@ -43,7 +43,7 @@
0
0
677
- 665
+ 590
@@ -54,13 +54,6 @@
- -
-
-
- Vertical layout
-
-
-
-
@@ -68,20 +61,6 @@
- -
-
-
- Add stretch to left/top of the layout
-
-
-
- -
-
-
- Add stretch to right/bottom of the layout
-
-
-
-
-
diff --git a/sources/awesome-widget/awesome-widget.cpp b/sources/awesome-widget/awesome-widget.cpp
index b1ddfd3..113c1f0 100644
--- a/sources/awesome-widget/awesome-widget.cpp
+++ b/sources/awesome-widget/awesome-widget.cpp
@@ -21,7 +21,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -194,12 +194,11 @@ void AwesomeWidget::init()
// body
createActions();
- mainLayout = new QGraphicsLinearLayout();
+ mainLayout = new QGraphicsGridLayout();
mainLayout->setContentsMargins(1, 1, 1, 1);
- mainLayout->setOrientation(Qt::Horizontal);
setLayout(mainLayout);
textLabel = new CustomLabel(this, debug);
- textLabel->setWordWrap(false);
+ mainLayout->addItem(textLabel, 0, 0);
// read variables
configChanged();
diff --git a/sources/awesome-widget/awesome-widget.h b/sources/awesome-widget/awesome-widget.h
index 77ebcdd..8d1c8f5 100644
--- a/sources/awesome-widget/awesome-widget.h
+++ b/sources/awesome-widget/awesome-widget.h
@@ -31,7 +31,7 @@
class CustomLabel;
-class QGraphicsLinearLayout;
+class QGraphicsGridLayout;
class QGraphicsScene;
class AwesomeWidget : public Plasma::Applet
@@ -90,11 +90,10 @@ protected:
private:
// functions
void createActions();
- void initValues();
QStringList findKeys();
QStringList getKeys();
// ui
- QGraphicsLinearLayout *mainLayout = nullptr;
+ QGraphicsGridLayout *mainLayout = nullptr;
CustomLabel *textLabel = nullptr;
QTimer *timer;
QList contextMenu;
diff --git a/sources/awesome-widget/configuration.cpp b/sources/awesome-widget/configuration.cpp
index fbe8255..b686c0e 100644
--- a/sources/awesome-widget/configuration.cpp
+++ b/sources/awesome-widget/configuration.cpp
@@ -150,22 +150,10 @@ void AwesomeWidget::createConfigurationInterface(KConfigDialog *parent)
uiAdvancedConfig.checkBox_background->setCheckState(Qt::Unchecked);
else
uiAdvancedConfig.checkBox_background->setCheckState(Qt::Checked);
- if (configuration[QString("layout")].toInt() == 0)
- uiAdvancedConfig.checkBox_layout->setCheckState(Qt::Unchecked);
- else
- uiAdvancedConfig.checkBox_layout->setCheckState(Qt::Checked);
if (configuration[QString("popup")].toInt() == 0)
uiAdvancedConfig.checkBox_popup->setCheckState(Qt::Unchecked);
else
uiAdvancedConfig.checkBox_popup->setCheckState(Qt::Checked);
- if (configuration[QString("leftStretch")].toInt() == 0)
- uiAdvancedConfig.checkBox_leftStretch->setCheckState(Qt::Unchecked);
- else
- uiAdvancedConfig.checkBox_leftStretch->setCheckState(Qt::Checked);
- if (configuration[QString("rightStretch")].toInt() == 0)
- uiAdvancedConfig.checkBox_rightStretch->setCheckState(Qt::Unchecked);
- else
- uiAdvancedConfig.checkBox_rightStretch->setCheckState(Qt::Checked);
uiAdvancedConfig.lineEdit_timeFormat->setText(configuration[QString("customTime")]);
uiAdvancedConfig.lineEdit_uptimeFormat->setText(configuration[QString("customUptime")]);
uiAdvancedConfig.comboBox_tempUnits->setCurrentIndex(
@@ -422,10 +410,7 @@ void AwesomeWidget::configAccepted()
// advanced
cg.writeEntry("background", QString::number(uiAdvancedConfig.checkBox_background->checkState()));
- cg.writeEntry("layout", QString::number(uiAdvancedConfig.checkBox_layout->checkState()));
cg.writeEntry("popup", QString::number(uiAdvancedConfig.checkBox_popup->checkState()));
- cg.writeEntry("leftStretch", QString::number(uiAdvancedConfig.checkBox_leftStretch->checkState()));
- cg.writeEntry("rightStretch", QString::number(uiAdvancedConfig.checkBox_rightStretch->checkState()));
cg.writeEntry("customTime", uiAdvancedConfig.lineEdit_timeFormat->text());
cg.writeEntry("customUptime", uiAdvancedConfig.lineEdit_uptimeFormat->text());
cg.writeEntry("tempUnits", uiAdvancedConfig.comboBox_tempUnits->currentText());
@@ -523,10 +508,7 @@ void AwesomeWidget::configChanged()
// advanced
configuration[QString("background")] = cg.readEntry("background", "2");
- configuration[QString("layout")] = cg.readEntry("layout", "2");
configuration[QString("popup")] = cg.readEntry("popup", "2");
- configuration[QString("leftStretch")] = cg.readEntry("leftStretch", "2");
- configuration[QString("rightStretch")] = cg.readEntry("rightStretch", "2");
configuration[QString("customTime")] = cg.readEntry("customTime", "$hh:$mm");
configuration[QString("customUptime")] = cg.readEntry("customUptime", "$dd,$hh,$mm");
configuration[QString("tempUnits")] = cg.readEntry("tempUnits", "Celsius");
diff --git a/sources/awesome-widget/reinit.cpp b/sources/awesome-widget/reinit.cpp
index 8e3214b..caa30ef 100644
--- a/sources/awesome-widget/reinit.cpp
+++ b/sources/awesome-widget/reinit.cpp
@@ -19,7 +19,7 @@
#include
#include
-#include
+#include
#include
#include
@@ -27,48 +27,22 @@
#include
-void AwesomeWidget::initValues()
-{
- if (debug) qDebug() << PDEBUG;
-}
-
-
void AwesomeWidget::reinit()
{
if (debug) qDebug() << PDEBUG;
- mainLayout->removeItem(textLabel);
- if (textLabel != nullptr) delete textLabel;
- setLayout(0);
-
- mainLayout = new QGraphicsLinearLayout();
- mainLayout->setContentsMargins(1, 1, 1, 1);
- if (configuration[QString("layout")].toInt() == 0)
- mainLayout->setOrientation(Qt::Horizontal);
- else
- mainLayout->setOrientation(Qt::Vertical);
- setLayout(mainLayout);
-
if (configuration[QString("background")].toInt() == 0)
setBackgroundHints(NoBackground);
else
setBackgroundHints(DefaultBackground);
- if (configuration[QString("leftStretch")].toInt() == 2)
- mainLayout->addStretch(1);
- textLabel = new CustomLabel(this, debug);
if (configuration[QString("popup")].toInt() == 0)
textLabel->setPopupEnabled(false);
else
textLabel->setPopupEnabled(true);
- mainLayout->addItem(textLabel);
updateText(true);
- if (configuration[QString("rightStretch")].toInt() == 2)
- mainLayout->addStretch(1);
- resize(10, 10);
keys = getKeys();
foundKeys = findKeys();
- initValues();
updateNetworkDevice();
connectToEngine();
}