From 61fe6bb626ca31733ac8ef3d08e353061398b5d6 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 9 Jan 2021 14:00:29 +0000 Subject: [PATCH] Tweaks to how qjackctl looks and behaves under macOS --- build-jack2.sh | 7 +- .../03_apple-win32-ui-adjustments.patch | 124 ++++++++++++++++++ patches/qjackctl/QjackCtl.icns | 0 3 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 patches/qjackctl/03_apple-win32-ui-adjustments.patch create mode 100644 patches/qjackctl/QjackCtl.icns diff --git a/build-jack2.sh b/build-jack2.sh index f595199..29f4d70 100755 --- a/build-jack2.sh +++ b/build-jack2.sh @@ -147,7 +147,12 @@ if [ -f "${PAWPAW_PREFIX}/bin/moc" ]; then build_autoconf qjackctl "${QJACKCTL_VERSION}" "--enable-jack-version ${qjackctl_extra_args}" - if [ "${WIN32}" -eq 1 ]; then + if [ "${MACOS}" -eq 1 ]; then + cp "${PAWPAW_ROOT}/patches/qjackctl/QjackCtl.icns" "${PAWPAW_BUILDDIR}/qjackctl${name}-${QJACKCTL_VERSION}/src/qjackctl.app/Contents/Resources/QjackCtl.icns" + patch_file qjackctl "${QJACKCTL_VERSION}" "src/qjackctl.app/Contents/Info.plist" 's|Created by Qt/QMake|JACK Audio Connection Kit Qt GUI Interface|' + patch_file qjackctl "${QJACKCTL_VERSION}" "src/qjackctl.app/Contents/Info.plist" 's|com.yourcompany.qjackctl|org.rncbc.QjackCtl|' + patch_file qjackctl "${QJACKCTL_VERSION}" "src/qjackctl.app/Contents/Info.plist" 's||QjackCtl.icns|' + elif [ "${WIN32}" -eq 1 ]; then copy_file qjackctl "${QJACKCTL_VERSION}" "src/release/qjackctl.exe" "${jack2_prefix}/bin/qjackctl.exe" fi fi diff --git a/patches/qjackctl/03_apple-win32-ui-adjustments.patch b/patches/qjackctl/03_apple-win32-ui-adjustments.patch new file mode 100644 index 0000000..4ecd163 --- /dev/null +++ b/patches/qjackctl/03_apple-win32-ui-adjustments.patch @@ -0,0 +1,124 @@ +diff --git a/src/qjackctlAboutForm.cpp b/src/qjackctlAboutForm.cpp +index 6a28439..521b7c9 100644 +--- a/src/qjackctlAboutForm.cpp ++++ b/src/qjackctlAboutForm.cpp +@@ -68,12 +68,12 @@ qjackctlAboutForm::qjackctlAboutForm ( QWidget *pParent ) + list << tr("JACK Session support disabled."); + #endif + #ifndef CONFIG_ALSA_SEQ +-#if !defined(__WIN32__) && !defined(_WIN32) && !defined(WIN32) ++#if !defined(__WIN32__) && !defined(_WIN32) && !defined(WIN32) && !defined(__APPLE__) + list << tr("ALSA/MIDI sequencer support disabled."); + #endif + #endif + #ifndef CONFIG_DBUS +-#if !defined(__WIN32__) && !defined(_WIN32) && !defined(WIN32) ++#if !defined(__WIN32__) && !defined(_WIN32) && !defined(WIN32) && !defined(__APPLE__) + list << tr("D-Bus interface support disabled."); + #endif + #endif +diff --git a/src/qjackctlMainForm.cpp b/src/qjackctlMainForm.cpp +index ee9afa4..f206270 100644 +--- a/src/qjackctlMainForm.cpp ++++ b/src/qjackctlMainForm.cpp +@@ -584,6 +584,26 @@ qjackctlMainForm::qjackctlMainForm ( + QObject::connect(m_ui.ForwardToolButton, + SIGNAL(clicked()), + SLOT(transportForward())); ++ ++#ifdef __APPLE__ ++ // Setup macOS menu bar ++ QMenuBar* const menuBar = new QMenuBar(nullptr); ++ menuBar->setNativeMenuBar(true); ++ ++ QMenu* const menu = menuBar->addMenu("QjackCtl"); ++ ++ QAction* const actQuit = menu->addAction(tr("&Quit")); ++ actQuit->setMenuRole(QAction::QuitRole); ++ QObject::connect(actQuit, SIGNAL(triggered()), SLOT(quitMainForm())); ++ ++ QAction* const actPreferences = menu->addAction(tr("Set&up...")); ++ actPreferences->setMenuRole(QAction::PreferencesRole); ++ QObject::connect(actPreferences, SIGNAL(triggered()), SLOT(showSetupForm())); ++ ++ QAction* const actAbout = menu->addAction(tr("Ab&out...")); ++ actAbout->setMenuRole(QAction::AboutRole); ++ QObject::connect(actAbout, SIGNAL(triggered()), SLOT(showAboutForm())); ++#endif + } + + +@@ -906,6 +926,11 @@ bool qjackctlMainForm::setup ( qjackctlSetup *pSetup ) + // Register the first timer slot. + QTimer::singleShot(QJACKCTL_TIMER_MSECS, this, SLOT(timerSlot())); + ++#ifdef __APPLE__ ++ // increazing height make UI look ugly and it is not really useful ++ setFixedHeight(height()); ++#endif ++ + // We're ready to go... + return true; + } +diff --git a/src/qjackctlSetup.cpp b/src/qjackctlSetup.cpp +index 8294606..487b7de 100644 +--- a/src/qjackctlSetup.cpp ++++ b/src/qjackctlSetup.cpp +@@ -88,6 +88,12 @@ void qjackctlSetup::loadSetup (void) + } + m_settings.endGroup(); + ++#ifdef __APPLE__ ++ // alternative custom defaults, as the mac theme does not look good with our custom widgets ++ sCustomColorTheme = "KXStudio"; ++ sCustomStyleTheme = "Fusion"; ++#endif ++ + m_settings.beginGroup("/Options"); + bSingleton = m_settings.value("/Singleton", true).toBool(); + // sServerName = m_settings.value("/ServerName").toString(); +@@ -118,8 +124,8 @@ void qjackctlSetup::loadSetup (void) + sDisplayFont2 = m_settings.value("/DisplayFont2").toString(); + bDisplayEffect = m_settings.value("/DisplayEffect", true).toBool(); + bDisplayBlink = m_settings.value("/DisplayBlink", true).toBool(); +- sCustomColorTheme = m_settings.value("/CustomColorTheme").toString(); +- sCustomStyleTheme = m_settings.value("/CustomStyleTheme").toString(); ++ sCustomColorTheme = m_settings.value("/CustomColorTheme", sCustomColorTheme).toString(); ++ sCustomStyleTheme = m_settings.value("/CustomStyleTheme", sCustomStyleTheme).toString(); + iJackClientPortAlias = m_settings.value("/JackClientPortAlias", 0).toInt(); + bJackClientPortMetadata = m_settings.value("/JackClientPortMetadata", false).toBool(); + iConnectionsIconSize = m_settings.value("/ConnectionsIconSize", QJACKCTL_ICON_16X16).toInt(); +diff --git a/src/qjackctlSetupForm.cpp b/src/qjackctlSetupForm.cpp +index ee64fa3..703ab52 100644 +--- a/src/qjackctlSetupForm.cpp ++++ b/src/qjackctlSetupForm.cpp +@@ -126,6 +126,29 @@ qjackctlSetupForm::qjackctlSetupForm ( QWidget *pParent ) + m_iDirtySettings = 0; + m_iDirtyOptions = 0; + ++#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__APPLE__) ++ // Remove useless drivers for some systems ++ for (int i = m_ui.DriverComboBox->count(); --i >= 0;) ++ { ++ const QString itemText = m_ui.DriverComboBox->itemText(i); ++ if (itemText == "dummy") ++ continue; ++#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) ++ if (itemText == "portaudio") ++ continue; ++#endif ++#ifdef __APPLE__ ++ if (itemText == "coreaudio") ++ continue; ++#endif ++ if (itemText == "net") ++ continue; ++ if (itemText == "netone") ++ continue; ++ m_ui.DriverComboBox->removeItem(i); ++ } ++#endif ++ + // Save original hard-coded driver names, only really + // useful when (changing (dis)enabling JACK D-BUS... + m_drivers.clear(); diff --git a/patches/qjackctl/QjackCtl.icns b/patches/qjackctl/QjackCtl.icns new file mode 100644 index 0000000..e69de29