mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 15:37:23 +00:00
fixed plasmoid
This commit is contained in:
parent
4428b8a087
commit
35199f160b
@ -24,7 +24,9 @@
|
|||||||
#include <KNotification>
|
#include <KNotification>
|
||||||
#include <QGraphicsLinearLayout>
|
#include <QGraphicsLinearLayout>
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
|
#include <Plasma/Frame>
|
||||||
#include <plasma/theme.h>
|
#include <plasma/theme.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
Netctl::Netctl(QObject *parent, const QVariantList &args) :
|
Netctl::Netctl(QObject *parent, const QVariantList &args) :
|
||||||
@ -32,30 +34,48 @@ Netctl::Netctl(QObject *parent, const QVariantList &args) :
|
|||||||
{
|
{
|
||||||
setBackgroundHints(DefaultBackground);
|
setBackgroundHints(DefaultBackground);
|
||||||
setHasConfigurationInterface(true);
|
setHasConfigurationInterface(true);
|
||||||
|
// text format init
|
||||||
|
formatLine.append("");
|
||||||
|
formatLine.append("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Netctl::~Netctl()
|
Netctl::~Netctl()
|
||||||
{
|
{
|
||||||
delete main_label;
|
delete iconWidget;
|
||||||
|
delete textLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Netctl::init()
|
void Netctl::init()
|
||||||
{
|
{
|
||||||
// generate ui
|
// generate ui
|
||||||
// layout
|
// main layout
|
||||||
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(this);
|
QGraphicsLinearLayout *fullSpaceLayout = new QGraphicsLinearLayout();
|
||||||
layout->setOrientation(Qt::Vertical);
|
fullSpaceLayout->setContentsMargins(0,0,0,0);
|
||||||
|
setLayout(fullSpaceLayout);
|
||||||
|
|
||||||
|
// frame
|
||||||
|
Plasma::Frame *frame = new Plasma::Frame();
|
||||||
|
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout();
|
||||||
|
layout->setContentsMargins(0,0,0,0);
|
||||||
|
frame->setLayout(layout);
|
||||||
|
fullSpaceLayout->addItem(frame);
|
||||||
|
|
||||||
|
// icon
|
||||||
|
iconWidget = new Plasma::IconWidget(KIcon("/home/arcanis/Documents/github/netctlplasmoid/sources/icons/network-idle-64x64.png"), QString(), this);
|
||||||
|
iconWidget->setIcon(KIcon("/home/arcanis/Documents/github/netctlplasmoid/sources/icons/network-idle-64x64.png"));
|
||||||
|
// connect(shutdownIcon.iconWidget, SIGNAL(clicked()), this, SLOT(onShutdown()));
|
||||||
|
layout->addItem(iconWidget);
|
||||||
|
|
||||||
// label
|
// label
|
||||||
layout->addStretch(1);
|
textLabel = new Plasma::Label(this);
|
||||||
main_label = new Plasma::Label(this);
|
textLabel->setText("test1\ntest2\ntest3");
|
||||||
main_label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
fullSpaceLayout->addItem(textLabel);
|
||||||
main_label->setToolTip(qApp->translate("tooltip", "Click here to update message"));
|
|
||||||
layout->addItem(main_label);
|
|
||||||
layout->addStretch(1);
|
|
||||||
// read variables
|
// read variables
|
||||||
configChanged();
|
configChanged();
|
||||||
|
this->resize(-1,48);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -170,8 +190,8 @@ void Netctl::configChanged()
|
|||||||
fontColor = cg.readEntry("fontColor", "#000000");
|
fontColor = cg.readEntry("fontColor", "#000000");
|
||||||
fontWeight = cg.readEntry("fontWeight", 400);
|
fontWeight = cg.readEntry("fontWeight", 400);
|
||||||
fontStyle = cg.readEntry("fontStyle", "normal");
|
fontStyle = cg.readEntry("fontStyle", "normal");
|
||||||
activeIconPath = cg.readEntry("activeIconPath", "/usr/share/icons/hicolor/48x48/apps/network-idle-64x64.png");
|
activeIconPath = cg.readEntry("activeIconPath", "/usr/share/icons/hicolor/64x64/apps/network-idle.png");
|
||||||
inactiveIconPath = cg.readEntry("inactiveIconPath", "/usr/share/icons/hicolor/48x48/apps/network-offline-64x64.png");
|
inactiveIconPath = cg.readEntry("inactiveIconPath", "/usr/share/icons/hicolor/64x64/apps/network-offline.png");
|
||||||
|
|
||||||
formatLine[0] = ("<p align=\"justify\"><span style=\" font-family:'" + fontFamily + \
|
formatLine[0] = ("<p align=\"justify\"><span style=\" font-family:'" + fontFamily + \
|
||||||
"'; font-style:" + fontStyle + \
|
"'; font-style:" + fontStyle + \
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <Plasma/Applet>
|
#include <Plasma/Applet>
|
||||||
#include <Plasma/Label>
|
#include <Plasma/Label>
|
||||||
|
#include <plasma/widgets/iconwidget.h>
|
||||||
|
|
||||||
#include <ui_configwindow.h>
|
#include <ui_configwindow.h>
|
||||||
|
|
||||||
@ -47,7 +48,8 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// ui
|
// ui
|
||||||
Plasma::Label *main_label;
|
Plasma::IconWidget *iconWidget;
|
||||||
|
Plasma::Label *textLabel;
|
||||||
QStringList formatLine;
|
QStringList formatLine;
|
||||||
// configuration
|
// configuration
|
||||||
int autoUpdateInterval;
|
int autoUpdateInterval;
|
||||||
|
Loading…
Reference in New Issue
Block a user