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