Skip to content

Commit

Permalink
Fix Linux build, still WIP anyhow
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Oct 7, 2023
1 parent f4147f7 commit 4ad5274
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion PawPaw
9 changes: 6 additions & 3 deletions systray/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ static const WCHAR* user_files_dir = nullptr;
#include <dlfcn.h>
#endif

#ifdef __APPLE__
#if defined(__APPLE__)
#include <sys/syslimits.h>
#define MAX_PATH PATH_MAX
#elif defined(__linux__)
#include <linux/limits.h>
#endif

#include <cstring>

QString getUserFilesDir()
{
#ifdef _WIN32
Expand All @@ -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));
Expand Down
18 changes: 12 additions & 6 deletions systray/mod-app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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");
}
Expand Down

0 comments on commit 4ad5274

Please sign in to comment.