mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-14 18:58:36 +12:00
Qt: check microphone permissions
This commit is contained in:
parent
3420cb0365
commit
e5b03d9cbd
2 changed files with 41 additions and 0 deletions
|
@ -81,6 +81,11 @@
|
|||
|
||||
#include "ui_main_window.h"
|
||||
|
||||
#if QT_CONFIG(permissions)
|
||||
#include <QGuiApplication>
|
||||
#include <QPermissions>
|
||||
#endif
|
||||
|
||||
LOG_CHANNEL(gui_log, "GUI");
|
||||
|
||||
extern atomic_t<bool> g_user_asked_for_frame_capture;
|
||||
|
@ -102,6 +107,32 @@ extern void process_qt_events()
|
|||
}
|
||||
}
|
||||
|
||||
extern void check_microphone_permissions()
|
||||
{
|
||||
#if QT_CONFIG(permissions)
|
||||
Emu.BlockingCallFromMainThread([]()
|
||||
{
|
||||
QMicrophonePermission permission;
|
||||
switch (qApp->checkPermission(permission))
|
||||
{
|
||||
case Qt::PermissionStatus::Undetermined:
|
||||
gui_log.notice("Requesting microphone permission");
|
||||
qApp->requestPermission(permission, []()
|
||||
{
|
||||
check_microphone_permissions();
|
||||
});
|
||||
break;
|
||||
case Qt::PermissionStatus::Denied:
|
||||
gui_log.error("RPCS3 has no permissions to access microphones on this device.");
|
||||
break;
|
||||
case Qt::PermissionStatus::Granted:
|
||||
gui_log.notice("Microphone permission granted");
|
||||
break;
|
||||
}
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
main_window::main_window(std::shared_ptr<gui_settings> gui_settings, std::shared_ptr<emu_settings> emu_settings, std::shared_ptr<persistent_settings> persistent_settings, QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::main_window)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue