mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-02 18:31:50 -04:00
40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
#include "singleapplication.h"
|
|
#include "gpclient.h"
|
|
#include "enhancedwebview.h"
|
|
|
|
#include <QStandardPaths>
|
|
#include <plog/Log.h>
|
|
#include <plog/Appenders/ColorConsoleAppender.h>
|
|
|
|
static const QString version = "v1.3.0";
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
const QDir path = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/GlobalProtect-openconnect";
|
|
const QString logFile = path.path() + "/gpclient.log";
|
|
if (!path.exists()) {
|
|
path.mkpath(".");
|
|
}
|
|
|
|
static plog::ColorConsoleAppender<plog::TxtFormatter> consoleAppender;
|
|
plog::init(plog::debug, logFile.toUtf8()).addAppender(&consoleAppender);
|
|
|
|
PLOGI << "GlobalProtect started, version: " << version;
|
|
|
|
QString port = QString::fromLocal8Bit(qgetenv(ENV_CDP_PORT));
|
|
|
|
if (port == "") {
|
|
qputenv(ENV_CDP_PORT, "12315");
|
|
}
|
|
|
|
SingleApplication app(argc, argv);
|
|
app.setQuitOnLastWindowClosed(false);
|
|
|
|
GPClient w;
|
|
w.show();
|
|
|
|
QObject::connect(&app, &SingleApplication::instanceStarted, &w, &GPClient::activate);
|
|
|
|
return app.exec();
|
|
}
|