add netctlgui.h

rewrited some functions
This commit is contained in:
arcan1s
2014-07-21 10:25:10 +04:00
parent 79e7aa1926
commit 4600aae8bc
10 changed files with 138 additions and 154 deletions

View File

@ -0,0 +1,35 @@
/***************************************************************************
* This file is part of netctl-gui *
* *
* netctl-gui is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* netctl-gui is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
/**
* @file netctlgui.h
* Header of netctlgui library
* @author Evgeniy Alekseev
* @copyright GPLv3
* @bug https://github.com/arcan1s/netctl-gui/issues
*/
#ifndef NETCTLGUI_H
#define NETCTLGUI_H
#include "netctlinteract.h"
#include "netctlprofile.h"
#include "sleepthread.h"
#include "wpasupinteract.h"
#endif /* NETCTLGUI_H */

View File

@ -31,6 +31,8 @@
#include <QObject>
class WpaSup;
/**
* @brief The Netctl class interacts with netctl
*/
@ -59,6 +61,11 @@ public:
*/
~Netctl();
// general information
/**
* @brief method which gets interface list from PREFERED_IFACE and IFACE_DIR
* @return interface list. If PREFERED_IFACE is not empty it will be first element
*/
QStringList getInterfaceList();
/**
* @brief method which returns profile informations from netctl
* @return list of profiles. Available information is [NAME, DESCRIPTION, STATUS]:
@ -101,12 +108,6 @@ public:
* "inactive (enabled)", "inactive (static)"
*/
QStringList getProfileStatuses(const QStringList profileList);
/**
* @brief method which gets ESSID from profile
* @param profile profile name
* @return ESSID name or null string
*/
QString getSsidFromProfile(const QString profile);
/**
* @brief method which checks if profile is active
* @param profile profile name
@ -265,11 +266,6 @@ private:
* @return netctl output
*/
QString getNetctlOutput(const bool sudo, const QString commandLine, const QString profile = 0);
/**
* @brief method which gets interface list from PREFERED_IFACE and IFACE_DIR
* @return first element from interface list. If PREFERED_IFACE is not empty it will be first element
*/
QString getWifiInterface();
/**
* @brief method which calls netctl
* @param sudo set true if sudo is needed

View File

@ -72,6 +72,13 @@ public:
* @return settings from profile
*/
QMap<QString, QString> getSettingsFromProfile(const QString profile);
/**
* @brief method which return value from profile by key
* @param profile profile name
* @param key required key
* @return value by key
*/
QString getValueFromProfile(const QString profile, const QString key);
/**
* @brief method which removes profile
* @param profile profile name

View File

@ -32,6 +32,7 @@
class Netctl;
class NetctlProfile;
/**
* @brief The WpaSup class interacts with wpa_supplicant
@ -47,8 +48,6 @@ public:
* @param settings default settings. Needed keys are
* CTRL_DIR (path to ctrl_directory),
* CTRL_GROUP (group which is owner of CTRL_DIR),
* IFACE_DIR (path to directory with interfaces),
* PREFERED_IFACE (prefered interface for WiFi),
* PID_FILE (wpa_supplicant PID file),
* SUDO_PATH (path to sudo command),
* WPACLI_PATH (path to wpa_cli command),
@ -68,11 +67,6 @@ public:
* @return profile name
*/
QString existentProfile(const QString essid);
/**
* @brief method which gets interface list from PREFERED_IFACE and IFACE_DIR
* @return interface list. If PREFERED_IFACE is not empty it will be first element
*/
QStringList getInterfaceList();
/**
* @brief method which checks profile status by ESSID
* @param essid ESSID name
@ -117,6 +111,10 @@ private:
* @brief Netctl class
*/
Netctl *netctlCommand;
/**
* @brief NetctlProfile class
*/
NetctlProfile *netctlProfile;
/**
* @brief show debug messages
*/
@ -129,14 +127,6 @@ private:
* @brief group which is owner of CTRL_DIR. Default is "users"
*/
QString ctrlGroup;
/**
* @brief directory with interfaces. Default is "/sys/class/net/"
*/
QDir *ifaceDirectory;
/**
* @brief prefered interface for WiFi. Default is ""
*/
QString mainInterface;
/**
* @brief wpa_supplicant PID file. Default is "/run/wpa_supplicant_netctl-gui.pid"
*/