From 4ad5274322189b5011e3dee3567a58c2ef639ca1 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 7 Oct 2023 20:12:20 +0200 Subject: [PATCH] Fix Linux build, still WIP anyhow Signed-off-by: falkTX --- PawPaw | 2 +- systray/main.cpp | 9 ++++++--- systray/mod-app.hpp | 18 ++++++++++++------ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/PawPaw b/PawPaw index e73506c..6d87b92 160000 --- a/PawPaw +++ b/PawPaw @@ -1 +1 @@ -Subproject commit e73506c75cdac82ac445da9f04379c260808d94c +Subproject commit 6d87b92873420e70549d040e85b85f0bb1f75d33 diff --git a/systray/main.cpp b/systray/main.cpp index 321b48d..5864c31 100644 --- a/systray/main.cpp +++ b/systray/main.cpp @@ -14,11 +14,14 @@ static const WCHAR* user_files_dir = nullptr; #include #endif -#ifdef __APPLE__ +#if defined(__APPLE__) #include -#define MAX_PATH PATH_MAX +#elif defined(__linux__) +#include #endif +#include + QString getUserFilesDir() { #ifdef _WIN32 @@ -39,7 +42,7 @@ void writeMidiChannelsToProfile(int pedalboard, int snapshot) std::wcscat(path, L"\\profile5.json"); QFile jsonFile(QString::fromWCharArray(path)); #else - char path[MAX_PATH + 256] = {}; + char path[PATH_MAX + 256] = {}; std::strcpy(path, getenv("MOD_DATA_DIR")); std::strcat(path, "/profile5.json"); QFile jsonFile(QString::fromUtf8(path)); diff --git a/systray/mod-app.hpp b/systray/mod-app.hpp index 02e037c..6411247 100644 --- a/systray/mod-app.hpp +++ b/systray/mod-app.hpp @@ -116,7 +116,9 @@ class AppWindow : public QMainWindow systray = new QSystemTrayIcon(icon, this); systray->setContextMenu(sysmenu); - // systray->setIcon(QPixmap(":/mod-logo.svg")); + #ifndef Q_OS_WIN + systray->setIcon(QPixmap(":/mod-logo.svg")); + #endif connect(systray, &QSystemTrayIcon::messageClicked, this, &AppWindow::messageClicked); connect(systray, &QSystemTrayIcon::activated, this, &AppWindow::iconActivated); @@ -153,7 +155,7 @@ class AppWindow : public QMainWindow { printf("--------------------------------------------------------\n"); - #ifdef Q_OS_WIN + #ifdef Q_OS_WIN SetEnvironmentVariableW(L"JACK_NO_AUDIO_RESERVATION", L"1"); SetEnvironmentVariableW(L"JACK_NO_START_SERVER", L"1"); @@ -211,16 +213,20 @@ class AppWindow : public QMainWindow } Pa_Terminate(); - - if (ui.cb_device->count()) - ui.b_start->setEnabled(true); } - #else + #else setenv("JACK_NO_AUDIO_RESERVATION", "1", 1); setenv("JACK_NO_START_SERVER", "1", 1); + #ifdef Q_OS_MAC + // TODO + #else // TODO #endif + #endif + + if (ui.cb_device->count()) + ui.b_start->setEnabled(true); printf("--------------------------------------------------------\n"); }