mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 16:07:19 +00:00
change layout to gridlayout
remove deprecated functions
This commit is contained in:
parent
f91c80b5b1
commit
ce761db924
@ -43,7 +43,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>677</width>
|
<width>677</width>
|
||||||
<height>665</height>
|
<height>590</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||||
@ -54,13 +54,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_layout">
|
|
||||||
<property name="text">
|
|
||||||
<string>Vertical layout</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox_popup">
|
<widget class="QCheckBox" name="checkBox_popup">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -68,20 +61,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_leftStretch">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add stretch to left/top of the layout</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_rightStretch">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add stretch to right/bottom of the layout</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_timeFormat">
|
<layout class="QHBoxLayout" name="layout_timeFormat">
|
||||||
<item>
|
<item>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include <Plasma/ToolTipManager>
|
#include <Plasma/ToolTipManager>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QGraphicsLinearLayout>
|
#include <QGraphicsGridLayout>
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QNetworkInterface>
|
#include <QNetworkInterface>
|
||||||
@ -194,12 +194,11 @@ void AwesomeWidget::init()
|
|||||||
|
|
||||||
// body
|
// body
|
||||||
createActions();
|
createActions();
|
||||||
mainLayout = new QGraphicsLinearLayout();
|
mainLayout = new QGraphicsGridLayout();
|
||||||
mainLayout->setContentsMargins(1, 1, 1, 1);
|
mainLayout->setContentsMargins(1, 1, 1, 1);
|
||||||
mainLayout->setOrientation(Qt::Horizontal);
|
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
textLabel = new CustomLabel(this, debug);
|
textLabel = new CustomLabel(this, debug);
|
||||||
textLabel->setWordWrap(false);
|
mainLayout->addItem(textLabel, 0, 0);
|
||||||
|
|
||||||
// read variables
|
// read variables
|
||||||
configChanged();
|
configChanged();
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class CustomLabel;
|
class CustomLabel;
|
||||||
class QGraphicsLinearLayout;
|
class QGraphicsGridLayout;
|
||||||
class QGraphicsScene;
|
class QGraphicsScene;
|
||||||
|
|
||||||
class AwesomeWidget : public Plasma::Applet
|
class AwesomeWidget : public Plasma::Applet
|
||||||
@ -90,11 +90,10 @@ protected:
|
|||||||
private:
|
private:
|
||||||
// functions
|
// functions
|
||||||
void createActions();
|
void createActions();
|
||||||
void initValues();
|
|
||||||
QStringList findKeys();
|
QStringList findKeys();
|
||||||
QStringList getKeys();
|
QStringList getKeys();
|
||||||
// ui
|
// ui
|
||||||
QGraphicsLinearLayout *mainLayout = nullptr;
|
QGraphicsGridLayout *mainLayout = nullptr;
|
||||||
CustomLabel *textLabel = nullptr;
|
CustomLabel *textLabel = nullptr;
|
||||||
QTimer *timer;
|
QTimer *timer;
|
||||||
QList<QAction *> contextMenu;
|
QList<QAction *> contextMenu;
|
||||||
|
@ -150,22 +150,10 @@ void AwesomeWidget::createConfigurationInterface(KConfigDialog *parent)
|
|||||||
uiAdvancedConfig.checkBox_background->setCheckState(Qt::Unchecked);
|
uiAdvancedConfig.checkBox_background->setCheckState(Qt::Unchecked);
|
||||||
else
|
else
|
||||||
uiAdvancedConfig.checkBox_background->setCheckState(Qt::Checked);
|
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)
|
if (configuration[QString("popup")].toInt() == 0)
|
||||||
uiAdvancedConfig.checkBox_popup->setCheckState(Qt::Unchecked);
|
uiAdvancedConfig.checkBox_popup->setCheckState(Qt::Unchecked);
|
||||||
else
|
else
|
||||||
uiAdvancedConfig.checkBox_popup->setCheckState(Qt::Checked);
|
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_timeFormat->setText(configuration[QString("customTime")]);
|
||||||
uiAdvancedConfig.lineEdit_uptimeFormat->setText(configuration[QString("customUptime")]);
|
uiAdvancedConfig.lineEdit_uptimeFormat->setText(configuration[QString("customUptime")]);
|
||||||
uiAdvancedConfig.comboBox_tempUnits->setCurrentIndex(
|
uiAdvancedConfig.comboBox_tempUnits->setCurrentIndex(
|
||||||
@ -422,10 +410,7 @@ void AwesomeWidget::configAccepted()
|
|||||||
|
|
||||||
// advanced
|
// advanced
|
||||||
cg.writeEntry("background", QString::number(uiAdvancedConfig.checkBox_background->checkState()));
|
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("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("customTime", uiAdvancedConfig.lineEdit_timeFormat->text());
|
||||||
cg.writeEntry("customUptime", uiAdvancedConfig.lineEdit_uptimeFormat->text());
|
cg.writeEntry("customUptime", uiAdvancedConfig.lineEdit_uptimeFormat->text());
|
||||||
cg.writeEntry("tempUnits", uiAdvancedConfig.comboBox_tempUnits->currentText());
|
cg.writeEntry("tempUnits", uiAdvancedConfig.comboBox_tempUnits->currentText());
|
||||||
@ -523,10 +508,7 @@ void AwesomeWidget::configChanged()
|
|||||||
|
|
||||||
// advanced
|
// advanced
|
||||||
configuration[QString("background")] = cg.readEntry("background", "2");
|
configuration[QString("background")] = cg.readEntry("background", "2");
|
||||||
configuration[QString("layout")] = cg.readEntry("layout", "2");
|
|
||||||
configuration[QString("popup")] = cg.readEntry("popup", "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("customTime")] = cg.readEntry("customTime", "$hh:$mm");
|
||||||
configuration[QString("customUptime")] = cg.readEntry("customUptime", "$dd,$hh,$mm");
|
configuration[QString("customUptime")] = cg.readEntry("customUptime", "$dd,$hh,$mm");
|
||||||
configuration[QString("tempUnits")] = cg.readEntry("tempUnits", "Celsius");
|
configuration[QString("tempUnits")] = cg.readEntry("tempUnits", "Celsius");
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include <KNotification>
|
#include <KNotification>
|
||||||
#include <Plasma/ToolTipManager>
|
#include <Plasma/ToolTipManager>
|
||||||
#include <QGraphicsLinearLayout>
|
#include <QGraphicsGridLayout>
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
@ -27,48 +27,22 @@
|
|||||||
#include <pdebug/pdebug.h>
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::initValues()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::reinit()
|
void AwesomeWidget::reinit()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
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)
|
if (configuration[QString("background")].toInt() == 0)
|
||||||
setBackgroundHints(NoBackground);
|
setBackgroundHints(NoBackground);
|
||||||
else
|
else
|
||||||
setBackgroundHints(DefaultBackground);
|
setBackgroundHints(DefaultBackground);
|
||||||
if (configuration[QString("leftStretch")].toInt() == 2)
|
|
||||||
mainLayout->addStretch(1);
|
|
||||||
textLabel = new CustomLabel(this, debug);
|
|
||||||
if (configuration[QString("popup")].toInt() == 0)
|
if (configuration[QString("popup")].toInt() == 0)
|
||||||
textLabel->setPopupEnabled(false);
|
textLabel->setPopupEnabled(false);
|
||||||
else
|
else
|
||||||
textLabel->setPopupEnabled(true);
|
textLabel->setPopupEnabled(true);
|
||||||
mainLayout->addItem(textLabel);
|
|
||||||
updateText(true);
|
updateText(true);
|
||||||
if (configuration[QString("rightStretch")].toInt() == 2)
|
|
||||||
mainLayout->addStretch(1);
|
|
||||||
resize(10, 10);
|
|
||||||
|
|
||||||
keys = getKeys();
|
keys = getKeys();
|
||||||
foundKeys = findKeys();
|
foundKeys = findKeys();
|
||||||
initValues();
|
|
||||||
updateNetworkDevice();
|
updateNetworkDevice();
|
||||||
connectToEngine();
|
connectToEngine();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user