mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-07-09 20:05:53 +00:00
rewrite gui to use pdebug
This commit is contained in:
@ -24,22 +24,23 @@
|
||||
#include "version.h"
|
||||
|
||||
|
||||
ControlAdaptor::ControlAdaptor(NetctlHelper *parent, const QMap<QString, QString> configuration)
|
||||
ControlAdaptor::ControlAdaptor(NetctlHelper *parent, const bool debugCmd, const QMap<QString, QString> configuration)
|
||||
: QDBusAbstractAdaptor(parent),
|
||||
debug(debugCmd),
|
||||
helper(parent)
|
||||
|
||||
{
|
||||
netctlCommand = new Netctl(false, configuration);
|
||||
netctlProfile = new NetctlProfile(false, configuration);
|
||||
wpaCommand = new WpaSup(false, configuration);
|
||||
netctlCommand = new Netctl(debug, configuration);
|
||||
netctlProfile = new NetctlProfile(debug, configuration);
|
||||
wpaCommand = new WpaSup(debug, configuration);
|
||||
}
|
||||
|
||||
|
||||
ControlAdaptor::~ControlAdaptor()
|
||||
{
|
||||
delete netctlCommand;
|
||||
delete netctlProfile;
|
||||
delete wpaCommand;
|
||||
if (netctlCommand != nullptr) delete netctlCommand;
|
||||
if (netctlProfile != nullptr) delete netctlProfile;
|
||||
if (wpaCommand != nullptr) delete wpaCommand;
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,6 +32,7 @@ class ControlAdaptor : public QDBusAbstractAdaptor
|
||||
|
||||
public:
|
||||
explicit ControlAdaptor(NetctlHelper *parent = 0,
|
||||
const bool debugCmd = false,
|
||||
const QMap<QString, QString> configuration = QMap<QString, QString>());
|
||||
~ControlAdaptor();
|
||||
|
||||
@ -65,10 +66,11 @@ public slots:
|
||||
QStringList WiFi();
|
||||
|
||||
private:
|
||||
bool debug;
|
||||
NetctlHelper *helper;
|
||||
Netctl *netctlCommand;
|
||||
NetctlProfile *netctlProfile;
|
||||
WpaSup *wpaCommand;
|
||||
Netctl *netctlCommand = nullptr;
|
||||
NetctlProfile *netctlProfile = nullptr;
|
||||
WpaSup *wpaCommand = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
@ -18,20 +18,21 @@
|
||||
#include "netctladaptor.h"
|
||||
|
||||
|
||||
NetctlAdaptor::NetctlAdaptor(QObject *parent, const QMap<QString, QString> configuration)
|
||||
: QDBusAbstractAdaptor(parent)
|
||||
NetctlAdaptor::NetctlAdaptor(QObject *parent, const bool debugCmd, const QMap<QString, QString> configuration)
|
||||
: QDBusAbstractAdaptor(parent),
|
||||
debug(debugCmd)
|
||||
{
|
||||
netctlCommand = new Netctl(false, configuration);
|
||||
netctlProfile = new NetctlProfile(false, configuration);
|
||||
wpaCommand = new WpaSup(false, configuration);
|
||||
netctlCommand = new Netctl(debug, configuration);
|
||||
netctlProfile = new NetctlProfile(debug, configuration);
|
||||
wpaCommand = new WpaSup(debug, configuration);
|
||||
}
|
||||
|
||||
|
||||
NetctlAdaptor::~NetctlAdaptor()
|
||||
{
|
||||
delete netctlCommand;
|
||||
delete netctlProfile;
|
||||
delete wpaCommand;
|
||||
if (netctlCommand != nullptr) delete netctlCommand;
|
||||
if (netctlProfile != nullptr) delete netctlProfile;
|
||||
if (wpaCommand != nullptr) delete wpaCommand;
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,6 +31,7 @@ class NetctlAdaptor : public QDBusAbstractAdaptor
|
||||
|
||||
public:
|
||||
explicit NetctlAdaptor(QObject *parent = 0,
|
||||
const bool debugCmd = false,
|
||||
const QMap<QString, QString> configuration = QMap<QString, QString>());
|
||||
~NetctlAdaptor();
|
||||
|
||||
@ -54,9 +55,10 @@ public slots:
|
||||
QStringList WirelessInterfaces();
|
||||
|
||||
private:
|
||||
Netctl *netctlCommand;
|
||||
NetctlProfile *netctlProfile;
|
||||
WpaSup *wpaCommand;
|
||||
bool debug;
|
||||
Netctl *netctlCommand = nullptr;
|
||||
NetctlProfile *netctlProfile = nullptr;
|
||||
WpaSup *wpaCommand = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
@ -74,14 +74,14 @@ void NetctlHelper::createInterface()
|
||||
return quitHelper();
|
||||
}
|
||||
if (!bus.registerObject(DBUS_LIB_PATH,
|
||||
new NetctlAdaptor(this, configuration),
|
||||
new NetctlAdaptor(this, debug, configuration),
|
||||
QDBusConnection::ExportAllContents)) {
|
||||
if (debug) qDebug() << "[NetctlHelper]" << "[createInterface]" << ":" << "Could not register library object";
|
||||
if (debug) qDebug() << "[NetctlHelper]" << "[createInterface]" << ":" << bus.lastError().message();
|
||||
return quitHelper();
|
||||
}
|
||||
if (!bus.registerObject(DBUS_CTRL_PATH,
|
||||
new ControlAdaptor(this, configuration),
|
||||
new ControlAdaptor(this, debug, configuration),
|
||||
QDBusConnection::ExportAllContents)) {
|
||||
if (debug) qDebug() << "[NetctlHelper]" << "[createInterface]" << ":" << "Could not register control object";
|
||||
if (debug) qDebug() << "[NetctlHelper]" << "[createInterface]" << ":" << bus.lastError().message();
|
||||
|
Reference in New Issue
Block a user