end work on interfaces

This commit is contained in:
arcan1s
2015-03-14 06:42:06 +03:00
parent ef2694d7a7
commit f80d6aae6b
38 changed files with 676 additions and 569 deletions

View File

@ -27,8 +27,5 @@
#define NETCTLGUI_H
#include "netctlinterface.h"
#include "netctlinteract.h"
#include "netctlprofile.h"
#include "wpasupinteract.h"
#endif /* NETCTLGUI_H */

View File

@ -50,6 +50,8 @@ class NetctlProfile;
* whether profile is active
* @var netctlProfileInfo::enabled
* whether profile is enabled
* @var netctlProfileInfo::netctlAuto
* whether profile is from netctl-auto
*/
typedef struct
{
@ -60,6 +62,7 @@ typedef struct
QString type;
bool active = false;
bool enabled = false;
bool netctlAuto = false;
} netctlProfileInfo;
/**

View File

@ -30,10 +30,10 @@
#include <QMap>
#include <QObject>
#include "netctlinteract.h"
#include "netctlprofile.h"
#include "wpasupinteract.h"
class Netctl;
class NetctlProfile;
class WpaSup;
/**
* @enum InterfaceAnswer
@ -51,6 +51,43 @@ enum InterfaceAnswer {
Error
};
/**
* @struct netctlCurrent
* @brief current status structure
* @var netctlCurrent::current
* current profiles
* @var netctlCurrent::enables
* are current profiles enabled
* @var netctlCurrent::netctlAuto
* is netctl-auto active
* @var netctlCurrent::profiles
* list of profiles
*/
typedef struct
{
QStringList current;
QList<bool> enables;
QStringList profiles;
bool netctlAuto = false;
} netctlCurrent;
/**
* @struct netctlInformation
* @brief general information structure
* @var netctlCurrent::netctlProfiles
* list of profiles
* @var netctlCurrent::netctlAutoProfiles
* list of netctl-auto profiles
* @var netctlCurrent::netctlAuto
* is netctl-auto active
*/
typedef struct
{
QList<netctlProfileInfo> netctlProfiles;
QList<netctlProfileInfo> netctlAutoProfiles;
bool netctlAuto = false;
} netctlInformation;
/**
* @brief The NetctlInterface class provides complex methods to get access to library
*/
@ -70,6 +107,7 @@ public:
* @brief NetctlInterface class destructor
*/
~NetctlInterface();
// control methods
/**
* @brief method which enables or disables selected profile and returns its status
* @remark netctl-auto only
@ -127,6 +165,14 @@ public:
* @return InterfaceAnswer::Error if an error occurs
*/
InterfaceAnswer enableProfile(const QString profile);
/**
* @brief method which removes selected profile
* @remark netctl independ
* @param profile profile name
* @return InterfaceAnswer::True if profile does not exists anymore
* @return InterfaceAnswer::Error if an error occurs
*/
InterfaceAnswer removeProfile(const QString profile);
/**
* @brief method which restarts selected profile and returns its status
* @remark netctl only
@ -161,6 +207,25 @@ public:
* @return InterfaceAnswer::Error if an error occurs
*/
InterfaceAnswer switchToProfile(const QString profile);
// information
/**
* @brief method which returns general information
* @remark both netctl and netctl-auto
* @return netctlInformation structure
*/
netctlInformation information();
/**
* @brief method which reads settings from profile
* @param profile profile name
* @return settings from profile
*/
QMap<QString, QString> profileSettings(const QString profile);
/**
* @brief method which returns current status
* @remark both netctl and netctl-auto
* @return netctlCurrent structure
*/
netctlCurrent status();
private:
/**