mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 23:47:21 +00:00
add documentation to netctlprofile
This commit is contained in:
parent
05f9759d47
commit
bc8655aaeb
@ -14,6 +14,14 @@
|
|||||||
* You should have received a copy of the GNU General Public License *
|
* You should have received a copy of the GNU General Public License *
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
/**
|
||||||
|
* @file netctlprofile.h
|
||||||
|
* Header of netctlgui library
|
||||||
|
* @author Evgeniy Alekseev
|
||||||
|
* @copyright GPLv3
|
||||||
|
* @bug https://github.com/arcan1s/netctl-gui/issues
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef NETCTLPROFILE_H
|
#ifndef NETCTLPROFILE_H
|
||||||
#define NETCTLPROFILE_H
|
#define NETCTLPROFILE_H
|
||||||
@ -23,22 +31,67 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The NetctlProfile class interacts with netctl profiles
|
||||||
|
*/
|
||||||
class NetctlProfile : public QObject
|
class NetctlProfile : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief NetctlProfile class constructor
|
||||||
|
* @param debugCmd show debug messages
|
||||||
|
* @param settings default settings. Needed keys are
|
||||||
|
* PROFILE_DIR (path to directory which contains profiles),
|
||||||
|
* SUDO_PATH (path to sudo command)
|
||||||
|
*/
|
||||||
explicit NetctlProfile(const bool debugCmd = false,
|
explicit NetctlProfile(const bool debugCmd = false,
|
||||||
const QMap<QString, QString> settings = QMap<QString, QString>());
|
const QMap<QString, QString> settings = QMap<QString, QString>());
|
||||||
|
/**
|
||||||
|
* @brief Netctl class destructor
|
||||||
|
*/
|
||||||
~NetctlProfile();
|
~NetctlProfile();
|
||||||
|
/**
|
||||||
|
* @brief function which copies temporary profile to PROFILE_DIR
|
||||||
|
* @param oldPath path to temprorary profile
|
||||||
|
* @return false if components are not found or command exit code is not equal to 0
|
||||||
|
* @return true if the function was completed without errors
|
||||||
|
*/
|
||||||
bool copyProfile(const QString oldPath);
|
bool copyProfile(const QString oldPath);
|
||||||
|
/**
|
||||||
|
* @brief function which creates temporary profile
|
||||||
|
* @param profile profile name
|
||||||
|
* @param settings profile configuration. All available keys will be printed to the profile
|
||||||
|
* @return temporary profile name
|
||||||
|
*/
|
||||||
QString createProfile(const QString profile, const QMap<QString, QString> settings);
|
QString createProfile(const QString profile, const QMap<QString, QString> settings);
|
||||||
|
/**
|
||||||
|
* @brief function which reads settings from profile
|
||||||
|
* @param profile profile name
|
||||||
|
* @return settings from profile
|
||||||
|
*/
|
||||||
QMap<QString, QString> getSettingsFromProfile(const QString profile);
|
QMap<QString, QString> getSettingsFromProfile(const QString profile);
|
||||||
|
/**
|
||||||
|
* @brief function which removes profile
|
||||||
|
* @param profile profile name
|
||||||
|
* @return false if components are not found or command exit code is not equal to 0
|
||||||
|
* @return true if the function was completed without errors
|
||||||
|
*/
|
||||||
bool removeProfile(const QString profile);
|
bool removeProfile(const QString profile);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/**
|
||||||
|
* @brief show debug messages
|
||||||
|
*/
|
||||||
bool debug;
|
bool debug;
|
||||||
|
/**
|
||||||
|
* @brief path to directory which contains profiles. Defaults is /etc/netctl
|
||||||
|
*/
|
||||||
QDir *profileDirectory;
|
QDir *profileDirectory;
|
||||||
|
/**
|
||||||
|
* @brief path to sudo command. Defaults is /usr/bin/kdesu
|
||||||
|
*/
|
||||||
QString sudoCommand;
|
QString sudoCommand;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -14,6 +14,13 @@
|
|||||||
* You should have received a copy of the GNU General Public License *
|
* You should have received a copy of the GNU General Public License *
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
/**
|
||||||
|
* @file main.cpp
|
||||||
|
* Source code of netctlgui library
|
||||||
|
* @author Evgeniy Alekseev
|
||||||
|
* @copyright GPLv3
|
||||||
|
* @bug https://github.com/arcan1s/netctl-gui/issues
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <netctlgui/netctlinteract.h>
|
#include <netctlgui/netctlinteract.h>
|
||||||
@ -22,7 +29,13 @@
|
|||||||
#include <netctlgui/wpasupinteract.h>
|
#include <netctlgui/wpasupinteract.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn main
|
||||||
|
*/
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
/**
|
||||||
|
* @return 0 - exit without errors
|
||||||
|
*/
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,13 @@
|
|||||||
* You should have received a copy of the GNU General Public License *
|
* You should have received a copy of the GNU General Public License *
|
||||||
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
/**
|
||||||
|
* @file netctlprofile.cpp
|
||||||
|
* Source code of netctlgui library
|
||||||
|
* @author Evgeniy Alekseev
|
||||||
|
* @copyright GPLv3
|
||||||
|
* @bug https://github.com/arcan1s/netctl-gui/issues
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@ -25,16 +32,29 @@
|
|||||||
#include <netctlgui/netctlprofile.h>
|
#include <netctlgui/netctlprofile.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class NetctlProfile
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @fn NetctlProfile
|
||||||
|
*/
|
||||||
NetctlProfile::NetctlProfile(const bool debugCmd, const QMap<QString, QString> settings)
|
NetctlProfile::NetctlProfile(const bool debugCmd, const QMap<QString, QString> settings)
|
||||||
: debug(debugCmd)
|
: debug(debugCmd)
|
||||||
{
|
{
|
||||||
if (settings.contains(QString("PROFILE_DIR")))
|
if (settings.contains(QString("PROFILE_DIR")))
|
||||||
profileDirectory = new QDir(settings[QString("PROFILE_DIR")]);
|
profileDirectory = new QDir(settings[QString("PROFILE_DIR")]);
|
||||||
|
else
|
||||||
|
profileDirectory = new QDir(QString("/etc/netctl/"));
|
||||||
if (settings.contains(QString("SUDO_PATH")))
|
if (settings.contains(QString("SUDO_PATH")))
|
||||||
sudoCommand = settings[QString("SUDO_PATH")];
|
sudoCommand = settings[QString("SUDO_PATH")];
|
||||||
|
else
|
||||||
|
sudoCommand = QString("/usr/bin/kdesu");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn ~NetctlProfile
|
||||||
|
*/
|
||||||
NetctlProfile::~NetctlProfile()
|
NetctlProfile::~NetctlProfile()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[NetctlProfile]" << "[~NetctlProfile]";
|
if (debug) qDebug() << "[NetctlProfile]" << "[~NetctlProfile]";
|
||||||
@ -44,6 +64,9 @@ NetctlProfile::~NetctlProfile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn copyProfile
|
||||||
|
*/
|
||||||
bool NetctlProfile::copyProfile(const QString oldPath)
|
bool NetctlProfile::copyProfile(const QString oldPath)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[NetctlProfile]" << "[copyProfile]";
|
if (debug) qDebug() << "[NetctlProfile]" << "[copyProfile]";
|
||||||
@ -71,6 +94,9 @@ bool NetctlProfile::copyProfile(const QString oldPath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn createProfile
|
||||||
|
*/
|
||||||
QString NetctlProfile::createProfile(const QString profile, const QMap<QString, QString> settings)
|
QString NetctlProfile::createProfile(const QString profile, const QMap<QString, QString> settings)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[NetctlProfile]" << "[createProfile]";
|
if (debug) qDebug() << "[NetctlProfile]" << "[createProfile]";
|
||||||
@ -106,6 +132,9 @@ QString NetctlProfile::createProfile(const QString profile, const QMap<QString,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn getSettingsFromProfile
|
||||||
|
*/
|
||||||
QMap<QString, QString> NetctlProfile::getSettingsFromProfile(const QString profile)
|
QMap<QString, QString> NetctlProfile::getSettingsFromProfile(const QString profile)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[NetctlProfile]" << "[getSettingsFromProfile]";
|
if (debug) qDebug() << "[NetctlProfile]" << "[getSettingsFromProfile]";
|
||||||
@ -157,6 +186,9 @@ QMap<QString, QString> NetctlProfile::getSettingsFromProfile(const QString profi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn removeProfile
|
||||||
|
*/
|
||||||
bool NetctlProfile::removeProfile(const QString profile)
|
bool NetctlProfile::removeProfile(const QString profile)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[NetctlProfile]" << "[removeProfile]";
|
if (debug) qDebug() << "[NetctlProfile]" << "[removeProfile]";
|
||||||
|
Loading…
Reference in New Issue
Block a user