mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-07 23:45:12 +00:00
Move permissions to own file
This commit is contained in:
parent
3c576da42f
commit
4df1f9fb18
8 changed files with 93 additions and 65 deletions
|
|
@ -1,16 +1,12 @@
|
|||
#include "stdafx.h"
|
||||
#include "qt_camera_handler.h"
|
||||
#include "permissions.h"
|
||||
#include "Emu/system_config.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Io/camera_config.h"
|
||||
|
||||
#include <QMediaDevices>
|
||||
|
||||
#if QT_CONFIG(permissions)
|
||||
#include <QGuiApplication>
|
||||
#include <QPermissions>
|
||||
#endif
|
||||
|
||||
LOG_CHANNEL(camera_log, "Camera");
|
||||
|
||||
qt_camera_handler::qt_camera_handler() : camera_handler_base()
|
||||
|
|
@ -215,25 +211,10 @@ void qt_camera_handler::start_camera()
|
|||
return;
|
||||
}
|
||||
|
||||
#if QT_CONFIG(permissions)
|
||||
const QCameraPermission permission;
|
||||
switch (qApp->checkPermission(permission))
|
||||
if (!gui::utils::check_camera_permission(this, [this](){ start_camera(); }, nullptr))
|
||||
{
|
||||
case Qt::PermissionStatus::Undetermined:
|
||||
camera_log.notice("Requesting camera permission");
|
||||
qApp->requestPermission(permission, this, [this]()
|
||||
{
|
||||
start_camera();
|
||||
});
|
||||
return;
|
||||
case Qt::PermissionStatus::Denied:
|
||||
camera_log.error("RPCS3 has no permissions to access cameras on this device.");
|
||||
return;
|
||||
case Qt::PermissionStatus::Granted:
|
||||
camera_log.notice("Camera permission granted");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Start camera. We will start receiving frames now.
|
||||
set_expected_state(camera_handler_state::running);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue