mirror of
https://github.com/PabloMK7/citra.git
synced 2025-09-11 21:30:05 +00:00
qt: Migrate to Qt6. (#6418)
This commit is contained in:
parent
70335a7f4d
commit
2273df4d70
32 changed files with 299 additions and 464 deletions
|
@ -2,16 +2,16 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <QCameraInfo>
|
||||
#include <QCameraDevice>
|
||||
#include <QDirIterator>
|
||||
#include <QFileDialog>
|
||||
#include <QImageReader>
|
||||
#include <QMediaDevices>
|
||||
#include <QMessageBox>
|
||||
#include <QWidget>
|
||||
#include "citra_qt/configuration/configure_camera.h"
|
||||
#include "common/settings.h"
|
||||
#include "core/frontend/camera/factory.h"
|
||||
#include "core/frontend/camera/interface.h"
|
||||
#include "core/hle/service/cam/cam.h"
|
||||
#include "ui_configure_camera.h"
|
||||
|
||||
|
@ -32,9 +32,9 @@ ConfigureCamera::ConfigureCamera(QWidget* parent)
|
|||
camera_name = Settings::values.camera_name;
|
||||
camera_config = Settings::values.camera_config;
|
||||
camera_flip = Settings::values.camera_flip;
|
||||
QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
|
||||
for (const QCameraInfo& cameraInfo : cameras) {
|
||||
ui->system_camera->addItem(cameraInfo.deviceName());
|
||||
const QList<QCameraDevice> cameras = QMediaDevices::videoInputs();
|
||||
for (const QCameraDevice& camera : cameras) {
|
||||
ui->system_camera->addItem(camera.description());
|
||||
}
|
||||
UpdateCameraMode();
|
||||
SetConfiguration();
|
||||
|
|
|
@ -579,7 +579,7 @@ void ConfigureInput::AutoMap() {
|
|||
void ConfigureInput::HandleClick(QPushButton* button,
|
||||
std::function<void(const Common::ParamPackage&)> new_input_setter,
|
||||
InputCommon::Polling::DeviceType type) {
|
||||
previous_key_code = QKeySequence(button->text())[0];
|
||||
previous_key_code = QKeySequence(button->text())[0].toCombined();
|
||||
button->setText(tr("[press key]"));
|
||||
button->setFocus();
|
||||
|
||||
|
|
|
@ -234,6 +234,8 @@ void ConfigureMotionTouch::ConnectEvents() {
|
|||
&ConfigureMotionTouch::OnConfigureTouchCalibration);
|
||||
connect(ui->touch_from_button_config_btn, &QPushButton::clicked, this,
|
||||
&ConfigureMotionTouch::OnConfigureTouchFromButton);
|
||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this,
|
||||
&ConfigureMotionTouch::ApplyConfiguration);
|
||||
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, [this] {
|
||||
if (CanCloseDialog()) {
|
||||
reject();
|
||||
|
|
|
@ -324,22 +324,4 @@
|
|||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ConfigureMotionTouch</receiver>
|
||||
<slot>ApplyConfiguration()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>220</x>
|
||||
<y>380</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>220</x>
|
||||
<y>200</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
|
|
@ -283,7 +283,7 @@ void ConfigureSystem::SetConfiguration() {
|
|||
|
||||
ui->combo_init_clock->setCurrentIndex(static_cast<u8>(Settings::values.init_clock.GetValue()));
|
||||
QDateTime date_time;
|
||||
date_time.setTime_t(Settings::values.init_time.GetValue());
|
||||
date_time.setSecsSinceEpoch(Settings::values.init_time.GetValue());
|
||||
ui->edit_init_time->setDateTime(date_time);
|
||||
|
||||
long long init_time_offset = Settings::values.init_time_offset.GetValue();
|
||||
|
@ -406,7 +406,7 @@ void ConfigureSystem::ApplyConfiguration() {
|
|||
|
||||
Settings::values.init_clock =
|
||||
static_cast<Settings::InitClock>(ui->combo_init_clock->currentIndex());
|
||||
Settings::values.init_time = ui->edit_init_time->dateTime().toTime_t();
|
||||
Settings::values.init_time = ui->edit_init_time->dateTime().toSecsSinceEpoch();
|
||||
|
||||
s64 time_offset_time = ui->edit_init_time_offset_time->time().msecsSinceStartOfDay() / 1000;
|
||||
s64 time_offset_days = ui->edit_init_time_offset_days->value() * 86400;
|
||||
|
|
|
@ -509,7 +509,8 @@ void TouchScreenPreview::mouseMoveEvent(QMouseEvent* event) {
|
|||
if (!coord_label) {
|
||||
return;
|
||||
}
|
||||
const auto pos = MapToDeviceCoords(event->x(), event->y());
|
||||
const auto point = event->position().toPoint();
|
||||
const auto pos = MapToDeviceCoords(point.x(), point.y());
|
||||
if (pos) {
|
||||
coord_label->setText(QStringLiteral("X: %1, Y: %2").arg(pos->x()).arg(pos->y()));
|
||||
} else {
|
||||
|
@ -527,7 +528,8 @@ void TouchScreenPreview::mousePressEvent(QMouseEvent* event) {
|
|||
if (event->button() != Qt::MouseButton::LeftButton) {
|
||||
return;
|
||||
}
|
||||
const auto pos = MapToDeviceCoords(event->x(), event->y());
|
||||
const auto point = event->position().toPoint();
|
||||
const auto pos = MapToDeviceCoords(point.x(), point.y());
|
||||
if (pos) {
|
||||
emit DotAdded(*pos);
|
||||
}
|
||||
|
@ -543,7 +545,7 @@ bool TouchScreenPreview::eventFilter(QObject* obj, QEvent* event) {
|
|||
emit DotSelected(obj->property(PropId).toInt());
|
||||
|
||||
drag_state.dot = qobject_cast<QLabel*>(obj);
|
||||
drag_state.start_pos = mouse_event->globalPos();
|
||||
drag_state.start_pos = mouse_event->globalPosition().toPoint();
|
||||
return true;
|
||||
}
|
||||
case QEvent::Type::MouseMove: {
|
||||
|
@ -552,14 +554,13 @@ bool TouchScreenPreview::eventFilter(QObject* obj, QEvent* event) {
|
|||
}
|
||||
const auto mouse_event = static_cast<QMouseEvent*>(event);
|
||||
if (!drag_state.active) {
|
||||
drag_state.active =
|
||||
(mouse_event->globalPos() - drag_state.start_pos).manhattanLength() >=
|
||||
QApplication::startDragDistance();
|
||||
drag_state.active = (mouse_event->globalPosition().toPoint() - drag_state.start_pos)
|
||||
.manhattanLength() >= QApplication::startDragDistance();
|
||||
if (!drag_state.active) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
auto current_pos = mapFromGlobal(mouse_event->globalPos());
|
||||
auto current_pos = mapFromGlobal(mouse_event->globalPosition().toPoint());
|
||||
current_pos.setX(std::clamp(current_pos.x(), contentsMargins().left(),
|
||||
contentsMargins().left() + contentsRect().width() - 1));
|
||||
current_pos.setY(std::clamp(current_pos.y(), contentsMargins().top(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue