summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorkali <kali@win>2021-12-14 18:18:16 +0100
committerkali kaneko (leap communications) <kali@leap.se>2021-12-14 18:21:32 +0100
commit5d9788388c9cf176a331d1fddc708420d88c4ce5 (patch)
treec85e59d6e63c72201d63067a82a7e6ef07603046 /gui
parenta36b1312503d0f5d3e27bd4e296c0c9adb5e492b (diff)
[pkg] bugfixes windows
Diffstat (limited to 'gui')
-rwxr-xr-xgui/build.sh7
-rw-r--r--gui/handlers.h4
-rw-r--r--gui/main.cpp19
-rw-r--r--gui/main.qml13
4 files changed, 32 insertions, 11 deletions
diff --git a/gui/build.sh b/gui/build.sh
index 18d97e1..a9a95fd 100755
--- a/gui/build.sh
+++ b/gui/build.sh
@@ -39,6 +39,11 @@ then
MAKEFLAGS=
fi
+if [ "$CC" == "cc" ]
+then
+ CC="gcc"
+fi
+
if [ "$XBUILD" == "$WIN64" ]
then
# TODO allow to override vars
@@ -60,7 +65,7 @@ function init {
function buildGoLib {
echo "[+] Using go in" $GO "[`go version`]"
- $GO generate -mod=vendor ./pkg/config/version/genver/gen.go || echo "[!] Error on go generate"
+ "$GO" generate -mod=vendor ./pkg/config/version/genver/gen.go || echo "[!] Error on go generate"
if [ "$PLATFORM" == "Darwin" ]
then
diff --git a/gui/handlers.h b/gui/handlers.h
index 82678c0..60ec9d8 100644
--- a/gui/handlers.h
+++ b/gui/handlers.h
@@ -6,6 +6,10 @@
#include "qjsonmodel.h"
#include "lib/libgoshim.h"
+#if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN) || defined(__MINGW32__)
+#define OS_WIN
+#endif
+
GoString toGoStr(QString s);
class QJsonWatch : public QObject {
diff --git a/gui/main.cpp b/gui/main.cpp
index 976f2cd..fe96caa 100644
--- a/gui/main.cpp
+++ b/gui/main.cpp
@@ -46,13 +46,14 @@ QString getAppName(QJsonValue info, QString provider) {
return "BitmaskVPN";
}
-void catchUnixSignals(std::initializer_list<int> quitSignals) {
- auto handler = [](int sig) -> void {
- printf("\nCatched signal(%d): quitting\n", sig);
- Quit();
- QApplication::quit();
- };
+auto handler = [](int sig) -> void {
+ printf("\nCatched signal(%d): quitting\n", sig);
+ Quit();
+ QApplication::quit();
+};
+#ifndef OS_WIN
+void catchUnixSignals(std::initializer_list<int> quitSignals) {
sigset_t blocking_mask;
sigemptyset(&blocking_mask);
for (auto sig : quitSignals)
@@ -66,6 +67,7 @@ void catchUnixSignals(std::initializer_list<int> quitSignals) {
for (auto sig : quitSignals)
sigaction(sig, &sa, nullptr);
}
+#endif
int main(int argc, char **argv) {
Backend backend;
@@ -80,7 +82,12 @@ int main(int argc, char **argv) {
app.setQuitOnLastWindowClosed(false);
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
+#ifdef OS_WIN
+ signal(SIGINT, handler);
+ signal(SIGTERM, handler);
+#else
catchUnixSignals({SIGINT, SIGTERM});
+#endif
/* load providers json */
QFile providerJson (":/providers.json");
diff --git a/gui/main.qml b/gui/main.qml
index 56220f5..f6660df 100644
--- a/gui/main.qml
+++ b/gui/main.qml
@@ -156,17 +156,22 @@ ApplicationWindow {
}
function loadTheme() {
- let arr = flavor.split("/")
+ var arr
+ if (Qt.platform.os == "windows") {
+ arr = flavor.split("\\")
+ } else {
+ arr = flavor.split("/")
+ }
var providerFlavor = arr[arr.length-1]
console.debug("flavor: " + providerFlavor)
- if (providerFlavor == "riseup-vpn") {
+ if (providerFlavor.startsWith("riseup-vpn")) {
return "themes/Riseup.qml"
- } else if (providerFlavor== "calyx-vpn") {
+ } else if (providerFlavor.startsWith("calyx-vpn")) {
return "themes/Calyx.qml"
} else {
// we should do a Default theme, with a fallback
// mechanism
- return "Riseup.qml"
+ return "themes/Riseup.qml"
}
}