diff --git a/Makefile b/Makefile index 9a5b492..3f4ca90 100644 --- a/Makefile +++ b/Makefile @@ -74,6 +74,12 @@ TARGETS += build/Qt5Core.dll TARGETS += build/Qt5Gui.dll TARGETS += build/Qt5Svg.dll TARGETS += build/Qt5Widgets.dll +TARGETS += build/bearer/qgenericbearer.dll +TARGETS += build/generic/qtuiotouchplugin.dll +TARGETS += build/iconengines/qsvgicon.dll +TARGETS += build/imageformats/qsvg.dll +TARGETS += build/platforms/qwindows.dll +TARGETS += build/styles/qwindowsvistastyle.dll else TARGETS += build/libjack.so.0 TARGETS += build/libjackserver.so.0 @@ -210,6 +216,30 @@ build/Qt5%.dll: $(PAWPAW_PREFIX)/bin/Qt5%.dll @mkdir -p build ln -sf $(abspath $<) $@ +build/bearer/q%.dll: $(PAWPAW_PREFIX)/lib/qt5/plugins/bearer/q%.dll + @mkdir -p build/bearer + ln -sf $(abspath $<) $@ + +build/generic/q%.dll: $(PAWPAW_PREFIX)/lib/qt5/plugins/generic/q%.dll + @mkdir -p build/generic + ln -sf $(abspath $<) $@ + +build/iconengines/q%.dll: $(PAWPAW_PREFIX)/lib/qt5/plugins/iconengines/q%.dll + @mkdir -p build/iconengines + ln -sf $(abspath $<) $@ + +build/imageformats/q%.dll: $(PAWPAW_PREFIX)/lib/qt5/plugins/imageformats/q%.dll + @mkdir -p build/imageformats + ln -sf $(abspath $<) $@ + +build/platforms/q%.dll: $(PAWPAW_PREFIX)/lib/qt5/plugins/platforms/q%.dll + @mkdir -p build/platforms + ln -sf $(abspath $<) $@ + +build/styles/q%.dll: $(PAWPAW_PREFIX)/lib/qt5/plugins/styles/q%.dll + @mkdir -p build/styles + ln -sf $(abspath $<) $@ + build/libjack%: $(PAWPAW_PREFIX)/lib/libjack% @mkdir -p build ln -sf $(abspath $<) $@ @@ -246,10 +276,6 @@ build/default.pedalboard: mod-ui/default.pedalboard @mkdir -p build ln -sf $(abspath $<) $@ -build/jackd.bat: utils/jackd.bat - @mkdir -p build - ln -sf $(abspath $<) $@ - build/html: mod-ui/html @mkdir -p build ln -sf $(abspath $<) $@ @@ -287,7 +313,7 @@ mod-midi-merger/build/mod-midi-merger-standalone$(APP_EXT): mod-midi-merger/buil mod-midi-merger/build/Makefile: $(BOOTSTRAP_FILES) ./utils/run.sh $(PAWPAW_TARGET) cmake -S mod-midi-merger -B mod-midi-merger/build -mod-ui/utils/libmod_utils.so: $(BOOTSTRAP_FILES) +mod-ui/utils/libmod_utils.so: $(BOOTSTRAP_FILES) mod-ui/utils/utils_lilv.cpp ./utils/run.sh $(PAWPAW_TARGET) $(MAKE) -C mod-ui/utils systray/mod-app$(APP_EXT): systray/main.cpp systray/mod-app.hpp diff --git a/mod-ui b/mod-ui index 18438b7..9b445f5 160000 --- a/mod-ui +++ b/mod-ui @@ -1 +1 @@ -Subproject commit 18438b725d5fd1a184246af1a1de2857664f4f17 +Subproject commit 9b445f58b3502549ca7d76985e9b0527da3af459 diff --git a/systray/Makefile b/systray/Makefile index 5b53034..9c066e3 100644 --- a/systray/Makefile +++ b/systray/Makefile @@ -11,15 +11,18 @@ TARGET_MACHINE := $(shell $(CC) -dumpmachine) ifneq (,$(findstring linux,$(TARGET_MACHINE))) LINUX = true +WINDOWS = false PAWPAW_TARGET = linux-$(shell uname -m) else ifneq (,$(findstring apple,$(TARGET_MACHINE))) MACOS = true +WINDOWS = false PAWPAW_TARGET = macos-universal-10.15 else ifneq (,$(findstring mingw,$(TARGET_MACHINE))) WINDOWS = true PAWPAW_TARGET = win64 else ifneq (,$(findstring wasm,$(TARGET_MACHINE))) WASM = true +WINDOWS = false PAWPAW_TARGET = wasm else $(error unknown target, cannot continue) @@ -39,15 +42,17 @@ TARGET = mod-app.exe EXTRAS = Qt5Core.dll Qt5Gui.dll Qt5Svg.dll Qt5Widgets.dll CXXFLAGS += $(shell pkg-config --cflags portaudio-2.0) LDFLAGS += $(shell pkg-config --libs portaudio-2.0) +LDFLAGS += -Wl,-subsystem,windows +WINDRES = $(subst gcc,windres,$(CC)) else TARGET = mod-app endif -# ifeq ($(shell pkg-config --exists Qt5Core Qt5Gui Qt5Svg Qt5Widgets && echo true),true) -# QT5_HOSTBINS = $(shell pkg-config --variable=host_bins Qt5Core) -# QT5_FLAGS = $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Svg Qt5Widgets) -# QT5_LIBS = $(shell pkg-config --libs Qt5Core Qt5Gui Qt5Svg Qt5Widgets) -# else +ifeq ($(shell pkg-config --exists Qt5Core Qt5Gui Qt5Svg Qt5Widgets && echo true)$(WINDOWS),truefalse) +QT5_HOSTBINS = $(shell pkg-config --variable=host_bins Qt5Core) +QT5_FLAGS = $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Svg Qt5Widgets) +QT5_LIBS = $(shell pkg-config --libs Qt5Core Qt5Gui Qt5Svg Qt5Widgets) +else QT5_PREFIX = $(shell pkg-config --variable=prefix Qt5OpenGLExtensions) QT5_HOSTBINS = $(QT5_PREFIX)/bin QT5_FLAGS = -DQT_CORE_LIB -DQT_GUI_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -I$(QT5_PREFIX)/include/qt5 @@ -56,7 +61,13 @@ QT5_LIBS = -F$(QT5_PREFIX)/lib -framework QtCore -framework QtGui -framework else QT5_LIBS = -L$(QT5_PREFIX)/lib -lQt5Core -lQt5Gui -lQt5Svg -lQt5Widgets endif -# endif +endif + +OBJS = main.cpp.o + +ifeq ($(WINDOWS),true) +OBJS += mod-app.rc.o +endif # --------------------------------------------------------------------------------------------------------------------- @@ -65,12 +76,15 @@ all: $(TARGET) $(EXTRAS) clean: rm -f $(TARGET) $(EXTRAS) qrc_mod-app.hpp ui_mod-app.hpp -$(TARGET): main.cpp.o +$(TARGET): $(OBJS) $(CXX) $^ $(LDFLAGS) $(QT5_LIBS) -o $@ main.cpp.o: main.cpp mod-app.hpp qrc_mod-app.hpp ui_mod-app.hpp $(CXX) $< $(CXXFLAGS) $(QT5_FLAGS) -c -o $@ +mod-app.rc.o: mod-app.rc mod-logo.ico + $(WINDRES) $< -O coff -o $@ + qrc_mod-app.hpp: mod-app.qrc $(QT5_HOSTBINS)/rcc $< -o $@ diff --git a/systray/main.cpp b/systray/main.cpp index b85ebb0..9441b3b 100644 --- a/systray/main.cpp +++ b/systray/main.cpp @@ -29,12 +29,15 @@ int main(int argc, char* argv[]) if (wchar_t* const wcc = wcsrchr(wc, '\\')) *wcc = 0; - SetCurrentDirectoryW(wc); - const QString cwd(QString::fromWCharArray(wc)); + SetCurrentDirectoryW(wc); - std::wcscat(wc, L"\\plugins"); - SetEnvironmentVariableW(L"LV2_PATH", wc); + WCHAR lv2path[(MAX_PATH + 256) * 2] = {}; + std::wcscat(lv2path, wc); + std::wcscat(lv2path, L"\\data\\lv2;"); + std::wcscat(lv2path, wc); + std::wcscat(lv2path, L"\\plugins"); + SetEnvironmentVariableW(L"LV2_PATH", lv2path); #else // TODO const QString cwd; diff --git a/systray/mod-app.hpp b/systray/mod-app.hpp index 461fc18..c056bce 100644 --- a/systray/mod-app.hpp +++ b/systray/mod-app.hpp @@ -41,6 +41,12 @@ class AppProcess : public QProcess if (! waitForFinished(500)) kill(); } + +public slots: + void startSlot() + { + start(); + } }; class AppWindow : public QMainWindow @@ -90,11 +96,13 @@ class AppWindow : public QMainWindow sysmenu = new QMenu(this); sysmenu->addAction(openAction); + sysmenu->addAction(settingsAction); sysmenu->addSeparator(); sysmenu->addAction(quitAction); systray = new QSystemTrayIcon(icon, this); systray->setContextMenu(sysmenu); + // systray->setIcon(QPixmap(":/mod-logo.svg")); connect(systray, &QSystemTrayIcon::messageClicked, this, &AppWindow::messageClicked); connect(systray, &QSystemTrayIcon::activated, this, &AppWindow::iconActivated); @@ -207,23 +215,23 @@ class AppWindow : public QMainWindow void timerEvent(QTimerEvent* const event) override { - if (event->timerId() == timerId) + if (timerId != 0 && event->timerId() == timerId) { - if (startingHost || stoppingHost || processHost.state() != QProcess::NotRunning) + // if (startingHost || stoppingHost || processHost.state() != QProcess::NotRunning) { const QByteArray text = processHost.readAll().trimmed(); if (! text.isEmpty()) ui.text_host->appendPlainText(text); } - if (startingUI || stoppingUI || processUI.state() != QProcess::NotRunning) + // if (startingUI || stoppingUI || processUI.state() != QProcess::NotRunning) { const QByteArray text = processUI.readAll().trimmed(); if (! text.isEmpty()) ui.text_ui->appendPlainText(text); } - startingHost = startingUI = false; + // startingHost = startingUI = false; } QMainWindow::timerEvent(event); @@ -266,15 +274,15 @@ class AppWindow : public QMainWindow if (settings.contains("Geometry")) restoreGeometry(settings.value("Geometry").toByteArray()); - if (settings.value("FirstRun", true).toBool()) +// if (settings.value("FirstRun", true).toBool()) { setStopped(); QTimer::singleShot(0, this, &QMainWindow::show); } - else - { - QTimer::singleShot(100, this, &AppWindow::start); - } +// else +// { +// QTimer::singleShot(100, this, &AppWindow::start); +// } QTimer::singleShot(1, systray, &QSystemTrayIcon::show); } @@ -286,7 +294,7 @@ class AppWindow : public QMainWindow ui.b_start->setEnabled(false); ui.b_stop->setEnabled(true); ui.b_opengui->setEnabled(true); - systray->setToolTip(tr("Running")); + systray->setToolTip(tr("MOD App: Running")); } void setStopped() @@ -296,7 +304,7 @@ class AppWindow : public QMainWindow ui.b_start->setEnabled(true); ui.b_stop->setEnabled(false); ui.b_opengui->setEnabled(false); - systray->setToolTip(tr("Stopped")); + systray->setToolTip(tr("MOD App: Stopped")); } QString getProcessErrorAsString(QProcess::ProcessError error) @@ -359,7 +367,7 @@ private slots: "-R", "-S", #if defined(Q_OS_WIN) - // "-X", "winmme", +// "-X", "winmme", #elif defined(Q_OS_MAC) "-X", "coremidi", #endif @@ -431,8 +439,7 @@ private slots: processUI.terminate(); } - // setRunning(); - + setStopped(); showErrorMessage(tr("Could not start MOD Host.\n") + getProcessErrorAsString(error)); } @@ -451,26 +458,29 @@ private slots: processHost.terminate(); } + setStopped(); showErrorMessage(tr("Could not start MOD UI.\n") + getProcessErrorAsString(error)); } void hostStartSuccess() { printf("----------- %s %d\n", __FUNCTION__, __LINE__); + startingHost = false; startingUI = true; - processUI.start(); + QTimer::singleShot(1000, &processUI, &AppProcess::startSlot); } void uiStartSuccess() { printf("----------- %s %d\n", __FUNCTION__, __LINE__); + startingUI = false; setRunning(); } void hostFinished(int exitCode, QProcess::ExitStatus exitStatus) { printf("----------- %s %d\n", __FUNCTION__, __LINE__); - stoppingHost = false; + startingHost = stoppingHost = false; stopUIIfNeeded(); setStopped(); } @@ -478,7 +488,7 @@ private slots: void uiFinished(int exitCode, QProcess::ExitStatus exitStatus) { printf("----------- %s %d\n", __FUNCTION__, __LINE__); - stoppingUI = false; + startingUI = stoppingUI = false; stopHostIfNeeded(); } diff --git a/systray/mod-app.rc b/systray/mod-app.rc new file mode 100644 index 0000000..8bd9db1 --- /dev/null +++ b/systray/mod-app.rc @@ -0,0 +1,2 @@ +id ICON "mod-logo.ico" +401 ICON "mod-logo.ico" diff --git a/systray/mod-logo.ico b/systray/mod-logo.ico new file mode 100644 index 0000000..258c712 Binary files /dev/null and b/systray/mod-logo.ico differ diff --git a/utils/jack-session.conf b/utils/jack-session.conf index da8d521..76ac792 100644 --- a/utils/jack-session.conf +++ b/utils/jack-session.conf @@ -1,3 +1,3 @@ l mod-midi-merger mod-midi-merger l mod-midi-broadcaster mod-midi-broadcaster -l mod-host mod-host 5555 +l mod-host mod-host 18182 diff --git a/utils/mod-ui-wrapper.py b/utils/mod-ui-wrapper.py index 4d4b1e5..3480902 100644 --- a/utils/mod-ui-wrapper.py +++ b/utils/mod-ui-wrapper.py @@ -14,15 +14,19 @@ sys.path = [ROOT] + sys.path -os.environ['LV2_PATH'] = os.path.join(ROOT, 'plugins') +os.environ['LV2_PATH'] = os.path.join(DATA_DIR, 'lv2') + os.path.pathsep + os.path.join(ROOT, 'plugins') +os.environ['MOD_APP'] = '1' os.environ['MOD_DATA_DIR'] = DATA_DIR os.environ['MOD_DEFAULT_PEDALBOARD'] = os.path.join(ROOT, 'default.pedalboard') os.environ['MOD_DEV_ENVIRONMENT'] = '0' +os.environ['MOD_DEVICE_HOST_PORT'] = '18182' os.environ['MOD_DEVICE_WEBSERVER_PORT'] = '18181' os.environ['MOD_LOG'] = os.environ.get("MOD_LOG", '1') os.environ['MOD_KEY_PATH'] = os.path.join(DATA_DIR, 'keys') os.environ['MOD_HTML_DIR'] = os.path.join(ROOT, 'html') os.environ['MOD_USER_FILES_DIR'] = os.path.join(DATA_DIR, 'user-files') +os.environ['MOD_USER_PEDALBOARDS_DIR'] = os.path.join(DATA_DIR, 'pedalboards') +os.environ['MOD_USER_PLUGINS_DIR'] = os.path.join(DATA_DIR, 'lv2') os.makedirs(os.path.join(DATA_DIR, 'user-files', 'Audio Loops'), exist_ok=True) os.makedirs(os.path.join(DATA_DIR, 'user-files', 'Audio Recordings'), exist_ok=True)