Merge pull request #5786 from vitor-k/macos-perms

Request Camera Permission on MacOS
This commit is contained in:
bunnei 2022-02-05 02:58:38 -07:00 committed by GitHub
commit e3804a4c06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 220 additions and 5 deletions

View file

@ -15,6 +15,10 @@
#include "core/settings.h"
#include "ui_configure_audio.h"
#if defined(__APPLE__)
#include "citra_qt/macos_authorization.h"
#endif
constexpr int DEFAULT_INPUT_DEVICE_INDEX = 0;
ConfigureAudio::ConfigureAudio(QWidget* parent)
@ -148,6 +152,11 @@ void ConfigureAudio::UpdateAudioOutputDevices(int sink_index) {
}
void ConfigureAudio::UpdateAudioInputDevices(int index) {
#if defined(__APPLE__)
if (index == 1) {
AppleAuthorization::CheckAuthorizationForMicrophone();
}
#endif
if (Settings::values.mic_input_device != Frontend::Mic::default_device_name) {
ui->input_device_combo_box->setCurrentText(
QString::fromStdString(Settings::values.mic_input_device));

View file

@ -17,6 +17,10 @@
#include "core/settings.h"
#include "ui_configure_camera.h"
#if defined(__APPLE__)
#include "citra_qt/macos_authorization.h"
#endif
const std::array<std::string, 3> ConfigureCamera::Implementations = {
"blank", /* Blank */
"image", /* Image */
@ -46,9 +50,15 @@ ConfigureCamera::~ConfigureCamera() {
void ConfigureCamera::ConnectEvents() {
connect(ui->image_source,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this] {
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
[this](int index) {
StopPreviewing();
UpdateImageSourceUI();
#if defined(__APPLE__)
if (index == 2) {
AppleAuthorization::CheckAuthorizationForCamera();
}
#endif
});
connect(ui->camera_selection,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this] {