mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 15:37:23 +00:00
end of plasmoid creating
This commit is contained in:
parent
40b05e2ea5
commit
a514fe459f
2
PKGBUILD
2
PKGBUILD
@ -12,7 +12,7 @@ depends=('kdebase-workspace')
|
|||||||
makedepends=('cmake' 'automoc4')
|
makedepends=('cmake' 'automoc4')
|
||||||
source=(https://github.com/arcan1s/netctlplasmoid/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
|
source=(https://github.com/arcan1s/netctlplasmoid/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
|
||||||
install=${pkgname}.install
|
install=${pkgname}.install
|
||||||
md5sums=('d3ab03ddea1e4793cfc5f35a0f7a5ff1')
|
md5sums=('5ac750e391936a6f3494a819b7b4d0b2')
|
||||||
_cmakekeys="-DCMAKE_INSTALL_PREFIX=$(kde4-config --prefix)
|
_cmakekeys="-DCMAKE_INSTALL_PREFIX=$(kde4-config --prefix)
|
||||||
-DBUILD_GUI:BOOL=1
|
-DBUILD_GUI:BOOL=1
|
||||||
-DBUILD_PLASMOID:BOOL=1
|
-DBUILD_PLASMOID:BOOL=1
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tabConfiguration">
|
<widget class="QWidget" name="tabConfiguration">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@ -196,7 +196,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox_showBigInterface">
|
<widget class="QCheckBox" name="checkBox_showBigInterface">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Show big interface</string>
|
<string>Show more detailed interface</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -537,6 +537,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="line_appearance">
|
<widget class="Line" name="line_appearance">
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="midLineWidth">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -23,12 +23,11 @@
|
|||||||
#include <KFileDialog>
|
#include <KFileDialog>
|
||||||
#include <KNotification>
|
#include <KNotification>
|
||||||
#include <KUrl>
|
#include <KUrl>
|
||||||
#include <Plasma/DataEngine>
|
|
||||||
#include <plasma/theme.h>
|
#include <plasma/theme.h>
|
||||||
|
|
||||||
#include <QGraphicsLinearLayout>
|
#include <QGraphicsLinearLayout>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QProcess>
|
#include <cstdio>
|
||||||
|
|
||||||
|
|
||||||
Netctl::Netctl(QObject *parent, const QVariantList &args) :
|
Netctl::Netctl(QObject *parent, const QVariantList &args) :
|
||||||
@ -44,14 +43,23 @@ Netctl::Netctl(QObject *parent, const QVariantList &args) :
|
|||||||
|
|
||||||
Netctl::~Netctl()
|
Netctl::~Netctl()
|
||||||
{
|
{
|
||||||
|
delete startProfileMenu;
|
||||||
|
delete startProfile;
|
||||||
|
delete stopProfile;
|
||||||
|
delete restartProfile;
|
||||||
|
delete enableProfileAutoload;
|
||||||
|
|
||||||
delete iconWidget;
|
delete iconWidget;
|
||||||
delete iconFrame;
|
delete iconFrame;
|
||||||
delete textFrame;
|
delete textFrame;
|
||||||
|
|
||||||
|
delete netctlEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Netctl::init()
|
void Netctl::init()
|
||||||
{
|
{
|
||||||
|
netctlEngine = dataEngine(QString("netctl"));
|
||||||
createActions();
|
createActions();
|
||||||
// generate ui
|
// generate ui
|
||||||
// main layout
|
// main layout
|
||||||
@ -80,12 +88,11 @@ void Netctl::init()
|
|||||||
|
|
||||||
// read variables
|
// read variables
|
||||||
configChanged();
|
configChanged();
|
||||||
resize(150,64);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// context menu
|
// context menu
|
||||||
void Netctl::startProfileSlot(QAction *action)
|
void Netctl::startProfileSlot(QAction *profile)
|
||||||
{
|
{
|
||||||
QProcess command;
|
QProcess command;
|
||||||
QString commandLine;
|
QString commandLine;
|
||||||
@ -93,9 +100,9 @@ void Netctl::startProfileSlot(QAction *action)
|
|||||||
if (status)
|
if (status)
|
||||||
commandLine = netctlPath + QString(" stop ") + profileName + QString(" && ");
|
commandLine = netctlPath + QString(" stop ") + profileName + QString(" && ");
|
||||||
if (useSudo)
|
if (useSudo)
|
||||||
commandLine = sudoPath + QString(" \"") + commandLine + netctlPath + QString(" start ") + action->text().mid(1) + QString("\"");
|
commandLine = sudoPath + QString(" \"") + commandLine + netctlPath + QString(" start ") + profile->text().mid(1) + QString("\"");
|
||||||
else
|
else
|
||||||
commandLine = commandLine + netctlPath + QString(" start ") + action->text().mid(1);
|
commandLine = commandLine + netctlPath + QString(" start ") + profile->text().mid(1);
|
||||||
command.startDetached(commandLine);
|
command.startDetached(commandLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +198,6 @@ QList<QAction*> Netctl::contextualActions()
|
|||||||
startProfileMenu->addAction(profile);
|
startProfileMenu->addAction(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return menuActions;
|
return menuActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,12 +210,12 @@ void Netctl::showGui()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Netctl::sendNotification(const QString eventId, const int num)
|
void Netctl::sendNotification(const QString eventId, const QString message)
|
||||||
{
|
{
|
||||||
KNotification *notification = new KNotification(eventId);
|
KNotification *notification = new KNotification(eventId);
|
||||||
notification->setComponentData(KComponentData("plasma_applet_netctl"));
|
notification->setComponentData(KComponentData("plasma_applet_netctl"));
|
||||||
notification->setTitle(QString(i18n("Netctl plasmoid")));
|
notification->setTitle(eventId);
|
||||||
notification->setText("test");
|
notification->setText(message);
|
||||||
notification->sendEvent();
|
notification->sendEvent();
|
||||||
delete notification;
|
delete notification;
|
||||||
}
|
}
|
||||||
@ -218,7 +224,6 @@ void Netctl::sendNotification(const QString eventId, const int num)
|
|||||||
// data engine interaction
|
// data engine interaction
|
||||||
void Netctl::connectToEngine()
|
void Netctl::connectToEngine()
|
||||||
{
|
{
|
||||||
Plasma::DataEngine *netctlEngine = dataEngine(QString("netctl"));
|
|
||||||
netctlEngine->connectSource(QString("profiles"), this, autoUpdateInterval);
|
netctlEngine->connectSource(QString("profiles"), this, autoUpdateInterval);
|
||||||
netctlEngine->connectSource(QString("statusBool"), this, autoUpdateInterval);
|
netctlEngine->connectSource(QString("statusBool"), this, autoUpdateInterval);
|
||||||
netctlEngine->connectSource(QString("currentProfile"), this, autoUpdateInterval);
|
netctlEngine->connectSource(QString("currentProfile"), this, autoUpdateInterval);
|
||||||
@ -237,7 +242,6 @@ void Netctl::connectToEngine()
|
|||||||
|
|
||||||
void Netctl::disconnectFromEngine()
|
void Netctl::disconnectFromEngine()
|
||||||
{
|
{
|
||||||
Plasma::DataEngine *netctlEngine = dataEngine(QString("netctl"));
|
|
||||||
netctlEngine->disconnectSource(QString("profiles"), this);
|
netctlEngine->disconnectSource(QString("profiles"), this);
|
||||||
netctlEngine->disconnectSource(QString("statusBool"), this);
|
netctlEngine->disconnectSource(QString("statusBool"), this);
|
||||||
netctlEngine->disconnectSource(QString("currentProfile"), this);
|
netctlEngine->disconnectSource(QString("currentProfile"), this);
|
||||||
@ -455,7 +459,7 @@ void Netctl::configChanged()
|
|||||||
showIntIp = cg.readEntry("showIntIp", true);
|
showIntIp = cg.readEntry("showIntIp", true);
|
||||||
|
|
||||||
fontFamily = cg.readEntry("fontFamily", "Terminus");
|
fontFamily = cg.readEntry("fontFamily", "Terminus");
|
||||||
fontSize = cg.readEntry("fontSize", 12);
|
fontSize = cg.readEntry("fontSize", 10);
|
||||||
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");
|
||||||
|
@ -19,9 +19,11 @@
|
|||||||
#define NETCTL_PLASMOID_H
|
#define NETCTL_PLASMOID_H
|
||||||
|
|
||||||
#include <Plasma/Applet>
|
#include <Plasma/Applet>
|
||||||
|
#include <Plasma/DataEngine>
|
||||||
#include <Plasma/Frame>
|
#include <Plasma/Frame>
|
||||||
#include <Plasma/IconWidget>
|
#include <Plasma/IconWidget>
|
||||||
#include <Plasma/Label>
|
#include <Plasma/Label>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
#include <ui_configwindow.h>
|
#include <ui_configwindow.h>
|
||||||
|
|
||||||
@ -39,7 +41,7 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
// events
|
// events
|
||||||
void showGui();
|
void showGui();
|
||||||
void sendNotification(const QString eventId, const int num);
|
void sendNotification(const QString eventId, const QString message);
|
||||||
// dataengine
|
// dataengine
|
||||||
void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data);
|
void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data);
|
||||||
// configuration interface
|
// configuration interface
|
||||||
@ -55,7 +57,7 @@ private slots:
|
|||||||
void selectActiveIcon();
|
void selectActiveIcon();
|
||||||
void selectInactiveIcon();
|
void selectInactiveIcon();
|
||||||
// context menu
|
// context menu
|
||||||
void startProfileSlot(QAction *action);
|
void startProfileSlot(QAction *profile);
|
||||||
void stopProfileSlot();
|
void stopProfileSlot();
|
||||||
void restartProfileSlot();
|
void restartProfileSlot();
|
||||||
void enableProfileAutoloadSlot();
|
void enableProfileAutoloadSlot();
|
||||||
@ -90,8 +92,11 @@ private:
|
|||||||
QAction *restartProfile;
|
QAction *restartProfile;
|
||||||
QAction *enableProfileAutoload;
|
QAction *enableProfileAutoload;
|
||||||
// data engine
|
// data engine
|
||||||
|
Plasma::DataEngine *netctlEngine;
|
||||||
void connectToEngine();
|
void connectToEngine();
|
||||||
void disconnectFromEngine();
|
void disconnectFromEngine();
|
||||||
|
// notification
|
||||||
|
|
||||||
// configuration interface
|
// configuration interface
|
||||||
Ui::ConfigWindow uiConfig;
|
Ui::ConfigWindow uiConfig;
|
||||||
// configuration
|
// configuration
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
[Global]
|
[Global]
|
||||||
IconName=netctl-gui
|
IconName=netctl-gui
|
||||||
Name=Netctl plasmoid
|
Name=Netctl plasmoid
|
||||||
Comment=Netctl plasmoid
|
Comment=Netctl plasmoid popups
|
||||||
|
|
||||||
[Event/NewEvent]
|
[Event/Error]
|
||||||
Name=New event
|
Name=Error
|
||||||
Comment=Comment
|
Comment=There is an error from netctl plasmoid
|
||||||
|
Action=Popup
|
||||||
|
|
||||||
|
[Event/Info]
|
||||||
|
Name=Information
|
||||||
|
Comment=There is an information from netctl plasmoid
|
||||||
Action=Popup
|
Action=Popup
|
||||||
|
Loading…
Reference in New Issue
Block a user