mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-07-14 06:15:50 +00:00
detached backend from frontend
This commit is contained in:
59
sources/netctlgui/include/netctlgui/netctlinteract.h
Normal file
59
sources/netctlgui/include/netctlgui/netctlinteract.h
Normal file
@ -0,0 +1,59 @@
|
||||
/***************************************************************************
|
||||
* 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/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef NETCTLINTERACT_H
|
||||
#define NETCTLINTERACT_H
|
||||
|
||||
#include <QDir>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
|
||||
|
||||
class Netctl : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Netctl(const bool debugCmd = false,
|
||||
const QMap<QString, QString> settings = QMap<QString, QString>());
|
||||
~Netctl();
|
||||
// general information
|
||||
QList<QStringList> getProfileList();
|
||||
QStringList getProfileDescriptions(const QStringList profileList);
|
||||
QStringList getProfileStatuses(const QStringList profileList);
|
||||
QString getSsidFromProfile(const QString profile);
|
||||
bool isProfileActive(const QString profile);
|
||||
bool isProfileEnabled(const QString profile);
|
||||
|
||||
public slots:
|
||||
// functions
|
||||
bool enableProfile(const QString profile);
|
||||
bool restartProfile(const QString profile);
|
||||
bool startProfile(const QString profile);
|
||||
|
||||
private:
|
||||
bool debug;
|
||||
QString netctlCommand;
|
||||
QDir *profileDirectory;
|
||||
QString sudoCommand;
|
||||
// functions
|
||||
QString getNetctlOutput(const bool sudo, const QString commandLine, const QString profile);
|
||||
bool netctlCall(const bool sudo, const QString commandLine, const QString profile);
|
||||
};
|
||||
|
||||
|
||||
#endif /* NETCTLINTERACT_H */
|
47
sources/netctlgui/include/netctlgui/netctlprofile.h
Normal file
47
sources/netctlgui/include/netctlgui/netctlprofile.h
Normal file
@ -0,0 +1,47 @@
|
||||
/***************************************************************************
|
||||
* 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/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef NETCTLPROFILE_H
|
||||
#define NETCTLPROFILE_H
|
||||
|
||||
#include <QDir>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
|
||||
|
||||
class NetctlProfile : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NetctlProfile(const bool debugCmd = false,
|
||||
const QMap<QString, QString> settings = QMap<QString, QString>());
|
||||
~NetctlProfile();
|
||||
bool copyProfile(const QString oldPath);
|
||||
bool removeProfile(const QString profile);
|
||||
QString createProfile(const QString profile, const QMap<QString, QString> settings);
|
||||
QString getNameByString(const QString profile);
|
||||
QMap<QString, QString> getSettingsFromProfile(const QString profile);
|
||||
|
||||
private:
|
||||
bool debug;
|
||||
QDir *profileDirectory;
|
||||
QString sudoCommand;
|
||||
};
|
||||
|
||||
|
||||
#endif /* NETCTLPROFILE_H */
|
46
sources/netctlgui/include/netctlgui/sleepthread.h
Normal file
46
sources/netctlgui/include/netctlgui/sleepthread.h
Normal file
@ -0,0 +1,46 @@
|
||||
/***************************************************************************
|
||||
* 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/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef SLEEPTHREAD_H
|
||||
#define SLEEPTHREAD_H
|
||||
|
||||
#include <QThread>
|
||||
|
||||
|
||||
class SleepThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static void usleep(long iSleepTime)
|
||||
{
|
||||
QThread::usleep(iSleepTime);
|
||||
}
|
||||
|
||||
static void sleep(long iSleepTime)
|
||||
{
|
||||
QThread::sleep(iSleepTime);
|
||||
}
|
||||
|
||||
static void msleep(long iSleepTime)
|
||||
{
|
||||
QThread::msleep(iSleepTime);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif /* SLEEPTHREAD_H */
|
66
sources/netctlgui/include/netctlgui/wpasupinteract.h
Normal file
66
sources/netctlgui/include/netctlgui/wpasupinteract.h
Normal file
@ -0,0 +1,66 @@
|
||||
/***************************************************************************
|
||||
* 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/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef WPASUPINTERACT_H
|
||||
#define WPASUPINTERACT_H
|
||||
|
||||
#include <QDir>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
|
||||
|
||||
class Netctl;
|
||||
|
||||
class WpaSup : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WpaSup(const bool debugCmd = false,
|
||||
const QMap<QString, QString> settings = QMap<QString, QString>());
|
||||
~WpaSup();
|
||||
// general information
|
||||
QString existentProfile(const QString profile);
|
||||
QStringList getInterfaceList();
|
||||
bool isProfileActive(const QString profile);
|
||||
bool isProfileExists(const QString profile);
|
||||
|
||||
public slots:
|
||||
// functions
|
||||
QList<QStringList> scanWifi();
|
||||
bool startWpaSupplicant();
|
||||
bool stopWpaSupplicant();
|
||||
|
||||
private:
|
||||
Netctl *netctlCommand;
|
||||
bool debug;
|
||||
QString ctrlDir;
|
||||
QString ctrlGroup;
|
||||
QDir *ifaceDirectory;
|
||||
QString mainInterface;
|
||||
QString pidFile;
|
||||
QString sudoCommand;
|
||||
QString wpaCliPath;
|
||||
QString wpaDrivers;
|
||||
QString wpaSupPath;
|
||||
// functions
|
||||
bool wpaCliCall(const QString commandLine);
|
||||
QString getWpaCliOutput(const QString commandLine);
|
||||
};
|
||||
|
||||
|
||||
#endif /* WPASUPINTERACT_H */
|
Reference in New Issue
Block a user