feature/app-split-tunneling (#702)
App Split Tunneling for Windows and Android
This commit is contained in:
parent
e7bd24f065
commit
adab30fc81
48 changed files with 1225 additions and 98 deletions
50
client/ui/controllers/appSplitTunnelingController.cpp
Normal file
50
client/ui/controllers/appSplitTunnelingController.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include "appSplitTunnelingController.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "core/defs.h"
|
||||
|
||||
AppSplitTunnelingController::AppSplitTunnelingController(const std::shared_ptr<Settings> &settings,
|
||||
const QSharedPointer<AppSplitTunnelingModel> &appSplitTunnelingModel, QObject *parent)
|
||||
: QObject(parent), m_settings(settings), m_appSplitTunnelingModel(appSplitTunnelingModel)
|
||||
{
|
||||
}
|
||||
|
||||
void AppSplitTunnelingController::addApp(const QString &appPath)
|
||||
{
|
||||
|
||||
InstalledAppInfo appInfo { "", "", appPath };
|
||||
if (!appPath.isEmpty()) {
|
||||
QFileInfo fileInfo(appPath);
|
||||
appInfo.appName = fileInfo.fileName();
|
||||
}
|
||||
|
||||
if (m_appSplitTunnelingModel->addApp(appInfo)) {
|
||||
emit finished(tr("Application added: %1").arg(appInfo.appName));
|
||||
|
||||
} else {
|
||||
emit errorOccurred(tr("The application has already been added"));
|
||||
}
|
||||
}
|
||||
|
||||
void AppSplitTunnelingController::addApps(QVector<QPair<QString, QString>> apps)
|
||||
{
|
||||
qDebug() << apps;
|
||||
for (const auto &app : apps) {
|
||||
InstalledAppInfo appInfo { app.first, app.second, "" };
|
||||
|
||||
m_appSplitTunnelingModel->addApp(appInfo);
|
||||
}
|
||||
emit finished(tr("The selected applications have been added"));
|
||||
}
|
||||
|
||||
void AppSplitTunnelingController::removeApp(const int index)
|
||||
{
|
||||
auto modelIndex = m_appSplitTunnelingModel->index(index);
|
||||
auto appPath = m_appSplitTunnelingModel->data(modelIndex, AppSplitTunnelingModel::Roles::AppPathRole).toString();
|
||||
m_appSplitTunnelingModel->removeApp(modelIndex);
|
||||
|
||||
QFileInfo fileInfo(appPath);
|
||||
|
||||
emit finished(tr("Application removed: %1").arg(fileInfo.fileName()));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue