2018-05-11 18:42:23 +01:00
|
|
|
// Copyright 2018 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-08-17 23:18:37 +01:00
|
|
|
#include <array>
|
2020-08-18 01:33:22 +01:00
|
|
|
#include <memory>
|
2020-08-17 23:18:37 +01:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace Camera {
|
|
|
|
class CameraInterface;
|
|
|
|
}
|
2018-05-11 18:42:23 +01:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class ConfigureCamera;
|
|
|
|
}
|
|
|
|
|
|
|
|
class ConfigureCamera : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit ConfigureCamera(QWidget* parent = nullptr);
|
2018-12-07 15:44:37 +00:00
|
|
|
~ConfigureCamera() override;
|
2018-05-11 18:42:23 +01:00
|
|
|
|
2019-05-26 05:39:23 +01:00
|
|
|
void ApplyConfiguration();
|
|
|
|
void RetranslateUI();
|
2018-05-11 18:42:23 +01:00
|
|
|
|
|
|
|
void timerEvent(QTimerEvent*) override;
|
|
|
|
|
|
|
|
public slots:
|
2019-05-26 05:39:23 +01:00
|
|
|
/// RecordConfig() and UpdateUiDisplay()
|
|
|
|
void SetConfiguration();
|
|
|
|
void OnToolButtonClicked();
|
2018-05-11 18:42:23 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
enum class CameraPosition { RearRight, Front, RearLeft, RearBoth, Null };
|
|
|
|
static const std::array<std::string, 3> Implementations;
|
|
|
|
/// Record the current configuration
|
2019-05-26 05:39:23 +01:00
|
|
|
void RecordConfig();
|
2018-05-11 18:42:23 +01:00
|
|
|
/// Updates camera mode
|
2019-05-26 05:39:23 +01:00
|
|
|
void UpdateCameraMode();
|
2018-05-11 18:42:23 +01:00
|
|
|
/// Updates image source
|
2019-05-26 05:39:23 +01:00
|
|
|
void UpdateImageSourceUI();
|
|
|
|
void StartPreviewing();
|
|
|
|
void StopPreviewing();
|
|
|
|
void ConnectEvents();
|
|
|
|
CameraPosition GetCameraSelection();
|
|
|
|
int GetSelectedCameraIndex();
|
2018-05-11 18:42:23 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<Ui::ConfigureCamera> ui;
|
|
|
|
std::array<std::string, 3> camera_name;
|
|
|
|
std::array<std::string, 3> camera_config;
|
2018-05-20 02:07:37 +01:00
|
|
|
std::array<int, 3> camera_flip;
|
2018-05-11 18:42:23 +01:00
|
|
|
int timer_id = 0;
|
|
|
|
int preview_width = 0;
|
|
|
|
int preview_height = 0;
|
|
|
|
CameraPosition current_selected = CameraPosition::Front;
|
|
|
|
bool is_previewing = false;
|
|
|
|
std::unique_ptr<Camera::CameraInterface> previewing_camera;
|
|
|
|
};
|