[AFV] Ref T730, request mic.access on MacOS for launcher

* needed to start the mic.access depending applications GUI/core
* see https://discordapp.com/channels/539048679160676382/567983892791951374/634806582013591603
This commit is contained in:
Klaus Basan
2019-10-19 00:03:09 +02:00
parent 88ff7ff758
commit 57909d97dc
3 changed files with 27 additions and 1 deletions

View File

@@ -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
}

View File

@@ -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 <QDialog>
#include <QTimer>
#include <QScopedPointer>
@@ -95,6 +100,9 @@ private:
QScopedPointer<BlackGui::Components::CConfigurationWizard> m_wizard;
QScopedPointer<BlackGui::Components::CTextEditDialog> m_textEditDialog;
BlackMisc::CData<BlackCore::Data::TLauncherSetup> 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);
};

View File

@@ -1,6 +1,6 @@
load(common_pre)
QT += core dbus network widgets
QT += core dbus network widgets multimedia
TARGET = swiftlauncher
TEMPLATE = app