diff --git a/src/swiftlauncher/swiftlauncher.cpp b/src/swiftlauncher/swiftlauncher.cpp index 53a0c4b38..e9f59af30 100644 --- a/src/swiftlauncher/swiftlauncher.cpp +++ b/src/swiftlauncher/swiftlauncher.cpp @@ -17,6 +17,7 @@ #include "blackmisc/simulation/fscommon/fscommonutil.h" #include "blackcore/context/contextnetwork.h" #include "blackmisc/network/networkutils.h" +#include "blacksound/audioutilities.h" #include "blackmisc/dbusserver.h" #include "blackmisc/directoryutils.h" #include "blackmisc/icons.h" @@ -43,6 +44,7 @@ using namespace BlackCore; using namespace BlackCore::Context; using namespace BlackCore::Data; using namespace BlackCore::Vatsim; +using namespace BlackSound; using namespace BlackMisc; using namespace BlackMisc::Db; using namespace BlackMisc::Network; @@ -96,6 +98,7 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) : { if (!sGui || sGui->isShuttingDown() || !myself) { return; } this->onCoreModeReleased(); + this->requestMacMicrophoneAccess(); if (sGui->isInstallerOptionSet()) { myself->startWizard(); } }); } @@ -579,3 +582,15 @@ void CSwiftLauncher::showSimulatorConfigDirs() m_textEditDialog->textEdit()->setText(info); m_textEditDialog->show(); } + +void CSwiftLauncher::requestMacMicrophoneAccess() +{ + // needed to be able to start core/GUI which need MIC access + // https://discordapp.com/channels/539048679160676382/567983892791951374/634806582013591603 +#ifdef Q_OS_MAC + const CMacOSMicrophoneAccess::AuthorizationStatus status = m_micAccess.getAuthorizationStatus(); + if (status == CMacOSMicrophoneAccess::Authorized) { return; } + m_micAccess.requestAccess(); + CLogMessage(this).info(u"MacOS requested input device"); +#endif +} diff --git a/src/swiftlauncher/swiftlauncher.h b/src/swiftlauncher/swiftlauncher.h index 2fd7f9d92..d579a8a34 100644 --- a/src/swiftlauncher/swiftlauncher.h +++ b/src/swiftlauncher/swiftlauncher.h @@ -19,6 +19,11 @@ #include "blackcore/coremodeenums.h" #include "blackmisc/db/artifact.h" #include "blackmisc/identifiable.h" + +#ifdef Q_OS_MAC +#include "blackmisc/macos/microphoneaccess.h" +#endif + #include #include #include @@ -95,6 +100,9 @@ private: QScopedPointer m_wizard; QScopedPointer m_textEditDialog; BlackMisc::CData m_setup { this }; //!< setup, i.e. last user selection +#ifdef Q_OS_MAC + BlackMisc::CMacOSMicrophoneAccess m_micAccess; +#endif QString m_executable; QStringList m_executableArgs; @@ -200,6 +208,9 @@ private: //! Show the FSX/P3D config simulator directories void showSimulatorConfigDirs(); + //! Request MacOS microphone request + void requestMacMicrophoneAccess(); + //! Command line static QString toCmdLine(const QString &exe, const QStringList &exeArgs); }; diff --git a/src/swiftlauncher/swiftlauncher.pro b/src/swiftlauncher/swiftlauncher.pro index a658421fd..e609b4d92 100644 --- a/src/swiftlauncher/swiftlauncher.pro +++ b/src/swiftlauncher/swiftlauncher.pro @@ -1,6 +1,6 @@ load(common_pre) -QT += core dbus network widgets +QT += core dbus network widgets multimedia TARGET = swiftlauncher TEMPLATE = app