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