rewrite gui to use pdebug

This commit is contained in:
arcan1s
2014-08-13 07:12:32 +04:00
parent dba3eeabaa
commit 5c8dca22d0
18 changed files with 315 additions and 253 deletions

View File

@ -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;
}

View File

@ -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;
};

View File

@ -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;
}

View File

@ -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;
};

View File

@ -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();