mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 15:37:23 +00:00
plasmoid is now popupapplet
This commit is contained in:
parent
e9c10e262e
commit
c1e23d38a9
@ -12,6 +12,7 @@ Ver.1.2.0:
|
||||
+ [gui] more command line options
|
||||
+ [gui] added workaround for wireless-wep example
|
||||
+ [gui] added shell completions
|
||||
+ [gui] added "Report a bug" action
|
||||
+ [lib] detached backend from frontend
|
||||
+ [lib] added error checking
|
||||
+ [lib] added doxygen documentation
|
||||
@ -30,6 +31,7 @@ Ver.1.2.0:
|
||||
* [lib] rewrited getSettingsFromProfile() function
|
||||
* [plasmoid] edited configuration interface
|
||||
* [plasmoid] changed double click event to click event
|
||||
* [plasmoid] change class from Applet to PopupApplet
|
||||
|
||||
Ver.1.1.0 (netctl-1.7 update):
|
||||
+ [gui] added frequency
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
|
||||
Netctl::Netctl(QObject *parent, const QVariantList &args)
|
||||
: Plasma::Applet(parent, args)
|
||||
: Plasma::PopupApplet(parent, args)
|
||||
{
|
||||
// debug
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
@ -46,8 +46,8 @@ Netctl::Netctl(QObject *parent, const QVariantList &args)
|
||||
else
|
||||
debug = false;
|
||||
|
||||
setBackgroundHints(DefaultBackground);
|
||||
setHasConfigurationInterface(true);
|
||||
this->setBackgroundHints(DefaultBackground);
|
||||
this->setHasConfigurationInterface(true);
|
||||
// text format init
|
||||
formatLine.append(QString(""));
|
||||
formatLine.append(QString(""));
|
||||
@ -62,6 +62,8 @@ Netctl::~Netctl()
|
||||
// delete switchToProfileMenu;
|
||||
// delete iconWidget;
|
||||
// delete textLabel;
|
||||
// delete fullSpaceLayout;
|
||||
// delete graphicsWidget;
|
||||
// delete netctlEngine;
|
||||
}
|
||||
|
||||
@ -79,10 +81,12 @@ void Netctl::init()
|
||||
netctlEngine = dataEngine(QString("netctl"));
|
||||
createActions();
|
||||
// generate ui
|
||||
graphicsWidget = new QGraphicsWidget();
|
||||
this->setGraphicsWidget(graphicsWidget);
|
||||
// main layout
|
||||
fullSpaceLayout = new QGraphicsLinearLayout();
|
||||
fullSpaceLayout = new QGraphicsLinearLayout(graphicsWidget);
|
||||
fullSpaceLayout->setContentsMargins(1, 1, 1, 1);
|
||||
setLayout(fullSpaceLayout);
|
||||
graphicsWidget->setLayout(fullSpaceLayout);
|
||||
|
||||
// frames
|
||||
// icon
|
||||
@ -183,6 +187,22 @@ QMap<QString, QString> Netctl::updateDataEngineConfiguration(const QMap<QString,
|
||||
}
|
||||
|
||||
|
||||
void Netctl::updateIcon()
|
||||
{
|
||||
if (debug) qDebug() << "[PLASMOID]" << "[updateIcon]";
|
||||
if (debug) qDebug() << "[PLASMOID]" << "[updateIcon]" << ":" << "Status" << status;
|
||||
|
||||
QString icon;
|
||||
if (status)
|
||||
icon = paths[QString("active")];
|
||||
else
|
||||
icon = paths[QString("inactive")];
|
||||
|
||||
iconWidget->setIcon(icon);
|
||||
this->setPopupIcon(KIcon(icon));
|
||||
}
|
||||
|
||||
|
||||
void Netctl::updateInterface(bool setShown)
|
||||
{
|
||||
if (debug) qDebug() << "[PLASMOID]" << "[updateInterface]";
|
||||
@ -522,20 +542,19 @@ void Netctl::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Da
|
||||
if (!status)
|
||||
sendNotification(QString("Info"), i18n("Network is up"));
|
||||
status = true;
|
||||
iconWidget->setIcon(paths[QString("active")]);
|
||||
}
|
||||
else {
|
||||
if (status)
|
||||
sendNotification(QString("Info"), i18n("Network is down"));
|
||||
status = false;
|
||||
iconWidget->setIcon(paths[QString("inactive")]);
|
||||
}
|
||||
updateIcon();
|
||||
}
|
||||
else if (sourceName == QString("statusString")) {
|
||||
info[QString("status")] = QString("(") + value + QString(")");
|
||||
}
|
||||
|
||||
update();
|
||||
this->update();
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <Plasma/Frame>
|
||||
#include <Plasma/IconWidget>
|
||||
#include <Plasma/Label>
|
||||
#include <Plasma/PopupApplet>
|
||||
#include <QProcess>
|
||||
|
||||
#include <ui_about.h>
|
||||
@ -33,7 +34,7 @@
|
||||
|
||||
class QGraphicsLinearLayout;
|
||||
|
||||
class Netctl : public Plasma::Applet
|
||||
class Netctl : public Plasma::PopupApplet
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -62,6 +63,7 @@ public slots:
|
||||
|
||||
private slots:
|
||||
// ui
|
||||
void updateIcon();
|
||||
void updateInterface(bool setHidden);
|
||||
// configuration interface
|
||||
void selectActiveIcon();
|
||||
@ -90,6 +92,7 @@ protected:
|
||||
|
||||
private:
|
||||
// ui
|
||||
QGraphicsWidget *graphicsWidget;
|
||||
QGraphicsLinearLayout *fullSpaceLayout;
|
||||
// icon
|
||||
Plasma::IconWidget *iconWidget;
|
||||
|
Loading…
Reference in New Issue
Block a user