lay base for camera settings dialog

This commit is contained in:
Arisotura 2022-04-26 15:36:59 +02:00 committed by Nadia Holmquist Pedersen
parent ed616ea43e
commit b1f03e71b3
7 changed files with 304 additions and 3 deletions

View File

@ -109,9 +109,8 @@ void IRQ(u32 param)
{
Camera* activecam = nullptr;
// TODO: check which camera has priority if both are activated
// (or does it just jumble both data sources together, like it
// does for, say, overlapping VRAM?)
// TODO: cameras don't have any priority!
// activating both together will jumble the image data together
if (Camera0->IsActivated()) activecam = Camera0;
else if (Camera1->IsActivated()) activecam = Camera1;

View File

@ -14,6 +14,7 @@ set(SOURCES_QT_SDL
InputConfig/MapButton.h
InputConfig/resources/ds.qrc
VideoSettingsDialog.cpp
CameraSettingsDialog.cpp
AudioSettingsDialog.cpp
FirmwareSettingsDialog.cpp
PathSettingsDialog.cpp

View File

@ -0,0 +1,63 @@
/*
Copyright 2016-2022 melonDS team
This file is part of melonDS.
melonDS is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with melonDS. If not, see http://www.gnu.org/licenses/.
*/
#include <stdio.h>
#include <QFileDialog>
#include "types.h"
#include "Platform.h"
#include "Config.h"
#include "CameraSettingsDialog.h"
#include "ui_CameraSettingsDialog.h"
CameraSettingsDialog* CameraSettingsDialog::currentDlg = nullptr;
extern std::string EmuDirectory;
CameraSettingsDialog::CameraSettingsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::CameraSettingsDialog)
{
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
//
}
CameraSettingsDialog::~CameraSettingsDialog()
{
delete ui;
}
void CameraSettingsDialog::on_CameraSettingsDialog_accepted()
{
//
Config::Save();
closeDlg();
}
void CameraSettingsDialog::on_CameraSettingsDialog_rejected()
{
//
closeDlg();
}
//

View File

@ -0,0 +1,69 @@
/*
Copyright 2016-2022 melonDS team
This file is part of melonDS.
melonDS is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with melonDS. If not, see http://www.gnu.org/licenses/.
*/
#ifndef CAMERASETTINGSDIALOG_H
#define CAMERASETTINGSDIALOG_H
#include <QDialog>
#include <QButtonGroup>
namespace Ui { class CameraSettingsDialog; }
class CameraSettingsDialog;
class CameraSettingsDialog : public QDialog
{
Q_OBJECT
public:
explicit CameraSettingsDialog(QWidget* parent);
~CameraSettingsDialog();
static CameraSettingsDialog* currentDlg;
static CameraSettingsDialog* openDlg(QWidget* parent)
{
if (currentDlg)
{
currentDlg->activateWindow();
return currentDlg;
}
currentDlg = new CameraSettingsDialog(parent);
currentDlg->show();
return currentDlg;
}
static void closeDlg()
{
currentDlg = nullptr;
}
signals:
//
private slots:
void on_CameraSettingsDialog_accepted();
void on_CameraSettingsDialog_rejected();
//
private:
Ui::CameraSettingsDialog* ui;
//
};
#endif // CAMERASETTINGSDIALOG_H

View File

@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CameraSettingsDialog</class>
<widget class="QDialog" name="CameraSettingsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>607</width>
<height>455</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Camera settings - melonDS</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Configure emulated camera:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cbCameraSel"/>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Picture source</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="2">
<widget class="QLineEdit" name="txtSrcImagePath"/>
</item>
<item row="0" column="0" colspan="4">
<widget class="QRadioButton" name="rbPictureNone">
<property name="text">
<string>None (blank)</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="btnSrcImageBrowse">
<property name="text">
<string>Browse...</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="rbPictureCamera">
<property name="text">
<string>Physical camera:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="rbPictureImg">
<property name="text">
<string>Image file:</string>
</property>
</widget>
</item>
<item row="2" column="2" colspan="2">
<widget class="QComboBox" name="cbPhysicalCamera"/>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Picture settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>SHITPISS</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="2" rowspan="2">
<widget class="QGroupBox" name="grpPreview">
<property name="title">
<string>Preview</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>CameraSettingsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>CameraSettingsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -54,6 +54,7 @@
#include "EmuSettingsDialog.h"
#include "InputConfig/InputConfigDialog.h"
#include "VideoSettingsDialog.h"
#include "CameraSettingsDialog.h"
#include "AudioSettingsDialog.h"
#include "FirmwareSettingsDialog.h"
#include "PathSettingsDialog.h"
@ -1592,6 +1593,9 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
actVideoSettings = menu->addAction("Video settings");
connect(actVideoSettings, &QAction::triggered, this, &MainWindow::onOpenVideoSettings);
actCameraSettings = menu->addAction("Camera settings");
connect(actCameraSettings, &QAction::triggered, this, &MainWindow::onOpenCameraSettings);
actAudioSettings = menu->addAction("Audio settings");
connect(actAudioSettings, &QAction::triggered, this, &MainWindow::onOpenAudioSettings);
@ -2805,6 +2809,12 @@ void MainWindow::onOpenVideoSettings()
connect(dlg, &VideoSettingsDialog::updateVideoSettings, this, &MainWindow::onUpdateVideoSettings);
}
void MainWindow::onOpenCameraSettings()
{
CameraSettingsDialog* dlg = CameraSettingsDialog::openDlg(this);
//connect(dlg, &CameraSettingsDialog::updateCameraSettings, this, &MainWindow::onUpdateCameraSettings);
}
void MainWindow::onOpenAudioSettings()
{
AudioSettingsDialog* dlg = AudioSettingsDialog::openDlg(this);

View File

@ -277,6 +277,7 @@ private slots:
void onOpenInputConfig();
void onInputConfigFinished(int res);
void onOpenVideoSettings();
void onOpenCameraSettings();
void onOpenAudioSettings();
void onOpenFirmwareSettings();
void onOpenPathSettings();
@ -365,6 +366,7 @@ public:
QAction* actPowerManagement;
QAction* actInputConfig;
QAction* actVideoSettings;
QAction* actCameraSettings;
QAction* actAudioSettings;
QAction* actWifiSettings;
QAction* actFirmwareSettings;