plasma: add labels for potd wallpaper configuration widgets

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-04-09 08:29:50 +03:00
parent ef3b17cf74
commit c6d3f7f04a
6 changed files with 32 additions and 16 deletions

View file

@ -349,7 +349,7 @@ void PagerApplet::createConfigurationInterface(KConfigDialog *parent)
QGridLayout* widgetlayout = new QGridLayout(widget); QGridLayout* widgetlayout = new QGridLayout(widget);
QLabel* pagermodelabel = new QLabel(widget); QLabel* pagermodelabel = new QLabel(widget);
pagermodelabel->setText(i18n("Text:")); pagermodelabel->setText(i18n("Text:"));
widgetlayout->addWidget(pagermodelabel, 0, 0, Qt::AlignRight); widgetlayout->addWidget(pagermodelabel, 0, 0, Qt::AlignRight | Qt::AlignVCenter);
m_pagermodebox = new QComboBox(widget); m_pagermodebox = new QComboBox(widget);
m_pagermodebox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); m_pagermodebox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
m_pagermodebox->addItem(i18n("Desktop number"), static_cast<int>(PagerApplet::ShowNumber)); m_pagermodebox->addItem(i18n("Desktop number"), static_cast<int>(PagerApplet::ShowNumber));

View file

@ -833,14 +833,14 @@ void SystemMonitor::createConfigurationInterface(KConfigDialog *parent)
QGridLayout* widgetlayout = new QGridLayout(widget); QGridLayout* widgetlayout = new QGridLayout(widget);
QLabel* hostnamelabel = new QLabel(widget); QLabel* hostnamelabel = new QLabel(widget);
hostnamelabel->setText(i18n("Hostname:")); hostnamelabel->setText(i18n("Hostname:"));
widgetlayout->addWidget(hostnamelabel, 0, 0, Qt::AlignRight); widgetlayout->addWidget(hostnamelabel, 0, 0, Qt::AlignRight | Qt::AlignVCenter);
m_hostnameedit = new KLineEdit(widget); m_hostnameedit = new KLineEdit(widget);
m_hostnameedit->setText(m_hostname); m_hostnameedit->setText(m_hostname);
widgetlayout->addWidget(m_hostnameedit, 0, 1); widgetlayout->addWidget(m_hostnameedit, 0, 1);
QLabel* portlabel = new QLabel(widget); QLabel* portlabel = new QLabel(widget);
portlabel->setText(i18n("Port:")); portlabel->setText(i18n("Port:"));
widgetlayout->addWidget(portlabel, 1, 0, Qt::AlignRight); widgetlayout->addWidget(portlabel, 1, 0, Qt::AlignRight | Qt::AlignVCenter);
m_portbox = new KIntNumInput(widget); m_portbox = new KIntNumInput(widget);
m_portbox->setMinimum(s_port); m_portbox->setMinimum(s_port);
m_portbox->setMaximum(USHRT_MAX); m_portbox->setMaximum(USHRT_MAX);
@ -850,7 +850,7 @@ void SystemMonitor::createConfigurationInterface(KConfigDialog *parent)
QLabel* updatelabel = new QLabel(widget); QLabel* updatelabel = new QLabel(widget);
updatelabel->setText(i18n("Update interval:")); updatelabel->setText(i18n("Update interval:"));
widgetlayout->addWidget(updatelabel, 2, 0, Qt::AlignRight); widgetlayout->addWidget(updatelabel, 2, 0, Qt::AlignRight | Qt::AlignVCenter);
m_updateedit = new KTimeEdit(widget); m_updateedit = new KTimeEdit(widget);
m_updateedit->setMinimumTime(QTime(0, 0, 1)); m_updateedit->setMinimumTime(QTime(0, 0, 1));
m_updateedit->setTime(QTime(0, 0, 0).addSecs(m_update)); m_updateedit->setTime(QTime(0, 0, 0).addSecs(m_update));
@ -858,7 +858,7 @@ void SystemMonitor::createConfigurationInterface(KConfigDialog *parent)
QLabel* cpulabel = new QLabel(widget); QLabel* cpulabel = new QLabel(widget);
cpulabel->setText(i18n("CPU color:")); cpulabel->setText(i18n("CPU color:"));
widgetlayout->addWidget(cpulabel, 3, 0, Qt::AlignRight); widgetlayout->addWidget(cpulabel, 3, 0, Qt::AlignRight | Qt::AlignVCenter);
const QColor defaultcpucolor = kCPUVisualizerColor(); const QColor defaultcpucolor = kCPUVisualizerColor();
QColor cpucolor = m_cpucolor; QColor cpucolor = m_cpucolor;
if (!cpucolor.isValid()) { if (!cpucolor.isValid()) {
@ -871,7 +871,7 @@ void SystemMonitor::createConfigurationInterface(KConfigDialog *parent)
QLabel* receiverlabel = new QLabel(widget); QLabel* receiverlabel = new QLabel(widget);
receiverlabel->setText(i18n("Receiver color:")); receiverlabel->setText(i18n("Receiver color:"));
widgetlayout->addWidget(receiverlabel, 4, 0, Qt::AlignRight); widgetlayout->addWidget(receiverlabel, 4, 0, Qt::AlignRight | Qt::AlignVCenter);
const QColor defaultreceivercolor = kNetReceiverVisualizerColor(); const QColor defaultreceivercolor = kNetReceiverVisualizerColor();
QColor receivercolor = m_receivercolor; QColor receivercolor = m_receivercolor;
if (!receivercolor.isValid()) { if (!receivercolor.isValid()) {
@ -884,7 +884,7 @@ void SystemMonitor::createConfigurationInterface(KConfigDialog *parent)
QLabel* transmitterlabel = new QLabel(widget); QLabel* transmitterlabel = new QLabel(widget);
transmitterlabel->setText(i18n("Transmitter color:")); transmitterlabel->setText(i18n("Transmitter color:"));
widgetlayout->addWidget(transmitterlabel, 5, 0, Qt::AlignRight); widgetlayout->addWidget(transmitterlabel, 5, 0, Qt::AlignRight | Qt::AlignVCenter);
const QColor defaulttransmittercolor = kNetTransmitterVisualizerColor(); const QColor defaulttransmittercolor = kNetTransmitterVisualizerColor();
QColor transmittercolor = m_transmittercolor; QColor transmittercolor = m_transmittercolor;
if (!transmittercolor.isValid()) { if (!transmittercolor.isValid()) {

View file

@ -371,7 +371,7 @@ void TasksApplet::createConfigurationInterface(KConfigDialog *parent)
QGridLayout* widgetlayout = new QGridLayout(widget); QGridLayout* widgetlayout = new QGridLayout(widget);
QLabel* tooltipmodelabel = new QLabel(widget); QLabel* tooltipmodelabel = new QLabel(widget);
tooltipmodelabel->setText(i18n("Tooltip:")); tooltipmodelabel->setText(i18n("Tooltip:"));
widgetlayout->addWidget(tooltipmodelabel, 0, 0, Qt::AlignRight); widgetlayout->addWidget(tooltipmodelabel, 0, 0, Qt::AlignRight | Qt::AlignVCenter);
m_tooltipmodebox = new QComboBox(widget); m_tooltipmodebox = new QComboBox(widget);
m_tooltipmodebox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); m_tooltipmodebox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
m_tooltipmodebox->addItem(i18n("Task name"), static_cast<int>(TasksApplet::ToolTipPreview)); m_tooltipmodebox->addItem(i18n("Task name"), static_cast<int>(TasksApplet::ToolTipPreview));

View file

@ -784,7 +784,7 @@ void WeatherApplet::createConfigurationInterface(KConfigDialog *parent)
QGridLayout* widgetlayout = new QGridLayout(widget); QGridLayout* widgetlayout = new QGridLayout(widget);
QLabel* tempunitlabel = new QLabel(widget); QLabel* tempunitlabel = new QLabel(widget);
tempunitlabel->setText(i18n("Temperature unit:")); tempunitlabel->setText(i18n("Temperature unit:"));
widgetlayout->addWidget(tempunitlabel, 0, 0, Qt::AlignRight); widgetlayout->addWidget(tempunitlabel, 0, 0, Qt::AlignRight | Qt::AlignVCenter);
m_tempunitbox = new QComboBox(widget); m_tempunitbox = new QComboBox(widget);
m_tempunitbox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); m_tempunitbox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
for (int i = 0; i < KTemperature::UnitCount; i++) { for (int i = 0; i < KTemperature::UnitCount; i++) {
@ -795,7 +795,7 @@ void WeatherApplet::createConfigurationInterface(KConfigDialog *parent)
widgetlayout->addWidget(m_tempunitbox, 0, 1); widgetlayout->addWidget(m_tempunitbox, 0, 1);
QLabel* locationlabel = new QLabel(widget); QLabel* locationlabel = new QLabel(widget);
locationlabel->setText(i18n("Location:")); locationlabel->setText(i18n("Location:"));
widgetlayout->addWidget(locationlabel, 1, 0, Qt::AlignRight); widgetlayout->addWidget(locationlabel, 1, 0, Qt::AlignRight | Qt::AlignVCenter);
m_locationbox = new QComboBox(widget); m_locationbox = new QComboBox(widget);
m_locationbox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); m_locationbox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
QMap<QString,QString> sortedzones; QMap<QString,QString> sortedzones;

View file

@ -22,7 +22,8 @@
#include <QImageWriter> #include <QImageWriter>
#include <QFileInfo> #include <QFileInfo>
#include <QJsonDocument> #include <QJsonDocument>
#include <QHBoxLayout> #include <QGridLayout>
#include <QLabel>
#include <KStandardDirs> #include <KStandardDirs>
#include <KIO/Job> #include <KIO/Job>
#include <KIO/StoredTransferJob> #include <KIO/StoredTransferJob>
@ -62,7 +63,8 @@ PoTD::PoTD(QObject *parent, const QVariantList &args)
m_downloading(false), m_downloading(false),
m_providerbox(nullptr), m_providerbox(nullptr),
m_resizemethodbox(nullptr), m_resizemethodbox(nullptr),
m_colorbutton(nullptr) m_colorbutton(nullptr),
m_spacer(nullptr)
{ {
m_timer = new QTimer(this); m_timer = new QTimer(this);
m_timer->setInterval(10000); m_timer->setInterval(10000);
@ -123,9 +125,12 @@ void PoTD::paint(QPainter *painter, const QRectF &exposedRect)
QWidget* PoTD::createConfigurationInterface(QWidget *parent) QWidget* PoTD::createConfigurationInterface(QWidget *parent)
{ {
QWidget* potdconfigwidget = new QWidget(parent); QWidget* potdconfigwidget = new QWidget(parent);
QHBoxLayout* potdconfiglayout = new QHBoxLayout(potdconfigwidget); QGridLayout* potdconfiglayout = new QGridLayout(potdconfigwidget);
potdconfigwidget->setLayout(potdconfiglayout); potdconfigwidget->setLayout(potdconfiglayout);
QLabel* providerlabel = new QLabel(potdconfigwidget);
providerlabel->setText(i18n("Provider:"));
potdconfiglayout->addWidget(providerlabel, 0, 0, Qt::AlignRight | Qt::AlignVCenter);
m_providerbox = new QComboBox(potdconfigwidget); m_providerbox = new QComboBox(potdconfigwidget);
m_providerbox->addItem(i18n("Pexels"), "pexels"); m_providerbox->addItem(i18n("Pexels"), "pexels");
m_providerbox->addItem(i18n("Flickr"), "flickr"); m_providerbox->addItem(i18n("Flickr"), "flickr");
@ -139,8 +144,11 @@ QWidget* PoTD::createConfigurationInterface(QWidget *parent)
m_providerbox, SIGNAL(currentIndexChanged(int)), m_providerbox, SIGNAL(currentIndexChanged(int)),
this, SLOT(slotProviderChanged(int)) this, SLOT(slotProviderChanged(int))
); );
potdconfiglayout->addWidget(m_providerbox); potdconfiglayout->addWidget(m_providerbox, 0, 1);
QLabel* resizemodelabel = new QLabel(potdconfigwidget);
resizemodelabel->setText(i18n("Positioning:"));
potdconfiglayout->addWidget(resizemodelabel, 1, 0, Qt::AlignRight | Qt::AlignVCenter);
m_resizemethodbox = new QComboBox(potdconfigwidget); m_resizemethodbox = new QComboBox(potdconfigwidget);
m_resizemethodbox->addItem(i18n("Scaled & Cropped"), Plasma::Wallpaper::ResizeMethod::ScaledAndCroppedResize); m_resizemethodbox->addItem(i18n("Scaled & Cropped"), Plasma::Wallpaper::ResizeMethod::ScaledAndCroppedResize);
m_resizemethodbox->addItem(i18n("Scaled"), Plasma::Wallpaper::ResizeMethod::ScaledResize); m_resizemethodbox->addItem(i18n("Scaled"), Plasma::Wallpaper::ResizeMethod::ScaledResize);
@ -158,12 +166,18 @@ QWidget* PoTD::createConfigurationInterface(QWidget *parent)
m_resizemethodbox, SIGNAL(currentIndexChanged(int)), m_resizemethodbox, SIGNAL(currentIndexChanged(int)),
this, SLOT(slotResizeMethodChanged(int)) this, SLOT(slotResizeMethodChanged(int))
); );
potdconfiglayout->addWidget(m_resizemethodbox); potdconfiglayout->addWidget(m_resizemethodbox, 1, 1);
QLabel* colorlabel = new QLabel(potdconfigwidget);
colorlabel->setText(i18n("Color:"));
potdconfiglayout->addWidget(colorlabel, 2, 0, Qt::AlignRight | Qt::AlignVCenter);
m_colorbutton = new KColorButton(potdconfigwidget); m_colorbutton = new KColorButton(potdconfigwidget);
m_colorbutton->setColor(m_color); m_colorbutton->setColor(m_color);
connect(m_colorbutton, SIGNAL(changed(QColor)), this, SLOT(slotColorChanged(QColor))); connect(m_colorbutton, SIGNAL(changed(QColor)), this, SLOT(slotColorChanged(QColor)));
potdconfiglayout->addWidget(m_colorbutton); potdconfiglayout->addWidget(m_colorbutton, 2, 1);
m_spacer = new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Expanding);
potdconfiglayout->addItem(m_spacer, 3, 0, 1, 2);
connect(this, SIGNAL(settingsChanged(bool)), parent, SLOT(settingsChanged(bool))); connect(this, SIGNAL(settingsChanged(bool)), parent, SLOT(settingsChanged(bool)));
return potdconfigwidget; return potdconfigwidget;

View file

@ -24,6 +24,7 @@
#include <QColor> #include <QColor>
#include <QTimer> #include <QTimer>
#include <QComboBox> #include <QComboBox>
#include <QSpacerItem>
#include <Plasma/Wallpaper> #include <Plasma/Wallpaper>
#include <KJob> #include <KJob>
#include <KColorButton> #include <KColorButton>
@ -71,6 +72,7 @@ private:
QComboBox* m_providerbox; QComboBox* m_providerbox;
QComboBox* m_resizemethodbox; QComboBox* m_resizemethodbox;
KColorButton* m_colorbutton; KColorButton* m_colorbutton;
QSpacerItem* m_spacer;
}; };
K_EXPORT_PLASMA_WALLPAPER(potd, PoTD) K_EXPORT_PLASMA_WALLPAPER(potd, PoTD)