mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-03-06 21:00:31 +01:00
Initial IR settings UI setup
This commit is contained in:
parent
73db5c95c8
commit
9c7b95d6ba
10 changed files with 485 additions and 1 deletions
|
@ -100,7 +100,7 @@ int H8300::configureSerialPort(){
|
|||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
//This should be configures in options
|
||||
const char *portname = "/dev/ttyUSB0";
|
||||
const char *portname = "/dev/ttyUSB1";
|
||||
|
||||
//sudo chmod 666 /dev/ttyUSB0
|
||||
fd = open(portname, O_RDWR | O_NOCTTY | O_NDELAY);
|
||||
|
|
BIN
src/frontend/qt_sdl/.IRSettings.cpp.swp
Normal file
BIN
src/frontend/qt_sdl/.IRSettings.cpp.swp
Normal file
Binary file not shown.
BIN
src/frontend/qt_sdl/.IRSettings.h.swp
Normal file
BIN
src/frontend/qt_sdl/.IRSettings.h.swp
Normal file
Binary file not shown.
|
@ -27,6 +27,7 @@ set(SOURCES_QT_SDL
|
|||
PathSettingsDialog.cpp
|
||||
MPSettingsDialog.cpp
|
||||
WifiSettingsDialog.cpp
|
||||
IRSettingsDialog.cpp
|
||||
InterfaceSettingsDialog.cpp
|
||||
ROMInfoDialog.cpp
|
||||
RAMInfoDialog.cpp
|
||||
|
@ -57,6 +58,7 @@ set(SOURCES_QT_SDL
|
|||
|
||||
LANDialog.cpp
|
||||
NetplayDialog.cpp
|
||||
|
||||
)
|
||||
|
||||
option(USE_QT6 "Use Qt 6 instead of Qt 5" ON)
|
||||
|
|
124
src/frontend/qt_sdl/IRSettingsDialog.cpp
Normal file
124
src/frontend/qt_sdl/IRSettingsDialog.cpp
Normal file
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
Copyright 2016-2024 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/.
|
||||
|
||||
@BarretKlics
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "types.h"
|
||||
#include "Platform.h"
|
||||
#include "Config.h"
|
||||
#include "main.h"
|
||||
|
||||
#include "IRSettingsDialog.h"
|
||||
#include "ui_IRSettingsDialog.h"
|
||||
|
||||
|
||||
IRSettingsDialog* IRSettingsDialog::currentDlg = nullptr;
|
||||
|
||||
bool IRSettingsDialog::needsReset = false;
|
||||
|
||||
void NetInit();
|
||||
|
||||
IRSettingsDialog::IRSettingsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::IRSettingsDialog)
|
||||
{
|
||||
|
||||
|
||||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
emuInstance = ((MainWindow*)parent)->getEmuInstance();
|
||||
auto& cfg = emuInstance->getGlobalConfig();
|
||||
|
||||
|
||||
|
||||
|
||||
//ui->groupBoxSerial->setEnabled(false);
|
||||
ui->groupBoxUDP->setEnabled(false);
|
||||
|
||||
// connect(ui->rbSerialMode, &QRadioButton::toggled, this, &IRSettingsDialog::toggleSerialSettings);
|
||||
connect(ui->rbUDPMode, &QRadioButton::toggled, this, &IRSettingsDialog::toggleUDPSettings);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void IRSettingsDialog::toggleSerialSettings(bool checked)
|
||||
{
|
||||
// ui->groupBoxSerial->setEnabled(checked);
|
||||
|
||||
}
|
||||
void IRSettingsDialog::toggleUDPSettings(bool checked){
|
||||
|
||||
ui->groupBoxUDP->setEnabled(checked);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
IRSettingsDialog::~IRSettingsDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void IRSettingsDialog::done(int r)
|
||||
{
|
||||
if (!((MainWindow*)parent())->getEmuInstance())
|
||||
{
|
||||
QDialog::done(r);
|
||||
closeDlg();
|
||||
return;
|
||||
}
|
||||
|
||||
needsReset = false;
|
||||
|
||||
if (r == QDialog::Accepted)
|
||||
{
|
||||
/*
|
||||
auto& cfg = emuInstance->getGlobalConfig();
|
||||
|
||||
cfg.SetBool("LAN.IPMode", ui->rbIPMode->isChecked());
|
||||
|
||||
int sel = ui->cbxIPAdapter->currentIndex();
|
||||
if (sel < 0 || sel >= adapters.size()) sel = 0;
|
||||
if (adapters.empty())
|
||||
{
|
||||
//cfg.SetString("LAN.Device", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
//cfg.SetString("LAN.Device", adapters[sel].DeviceName);
|
||||
}
|
||||
*/
|
||||
Config::Save();
|
||||
}
|
||||
|
||||
//Config::Table cfg = Config::GetGlobalTable();
|
||||
//std::string devicename = cfg.GetString("LAN.Device");
|
||||
|
||||
//NetInit();
|
||||
|
||||
QDialog::done(r);
|
||||
|
||||
closeDlg();
|
||||
}
|
||||
|
||||
|
||||
|
74
src/frontend/qt_sdl/IRSettingsDialog.h
Normal file
74
src/frontend/qt_sdl/IRSettingsDialog.h
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
Copyright 2016-2024 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/.
|
||||
|
||||
|
||||
@BarretKlics
|
||||
*/
|
||||
|
||||
#ifndef IRSETTINGSDIALOG_H
|
||||
#define IRSETTINGSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <vector>
|
||||
|
||||
namespace Ui { class IRSettingsDialog; }
|
||||
class IRSettingsDialog;
|
||||
|
||||
class EmuInstance;
|
||||
|
||||
class IRSettingsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit IRSettingsDialog(QWidget* parent);
|
||||
~IRSettingsDialog();
|
||||
|
||||
static IRSettingsDialog* currentDlg;
|
||||
static IRSettingsDialog* openDlg(QWidget* parent)
|
||||
{
|
||||
if (currentDlg)
|
||||
{
|
||||
currentDlg->activateWindow();
|
||||
return currentDlg;
|
||||
}
|
||||
|
||||
currentDlg = new IRSettingsDialog(parent);
|
||||
currentDlg->open();
|
||||
return currentDlg;
|
||||
}
|
||||
static void closeDlg()
|
||||
{
|
||||
currentDlg = nullptr;
|
||||
}
|
||||
|
||||
static bool needsReset;
|
||||
|
||||
private slots:
|
||||
void done(int r);
|
||||
void toggleSerialSettings(bool checked);
|
||||
void toggleUDPSettings(bool checked);
|
||||
|
||||
private:
|
||||
Ui::IRSettingsDialog* ui;
|
||||
EmuInstance* emuInstance;
|
||||
|
||||
// void updateAdapterControls();
|
||||
// std::vector<melonDS::AdapterData> adapters;
|
||||
};
|
||||
|
||||
#endif // IRSETTINGSDIALOG_H
|
258
src/frontend/qt_sdl/IRSettingsDialog.ui
Normal file
258
src/frontend/qt_sdl/IRSettingsDialog.ui
Normal file
|
@ -0,0 +1,258 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>IRSettingsDialog</class>
|
||||
<widget class="QDialog" name="IRSettingsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>570</width>
|
||||
<height>516</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>IR settings - melonDS</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetFixedSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelMainDescription">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLabel {
|
||||
margin-bottom: 12px;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>These settings control how melonDS emulates the H8/300 processor in games that support IR peripherals.</p><p>The settings you select here should be based off what peripheral you are using, and if you are emulating it and if so, what features that emulator supports.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="modeSelect">
|
||||
<property name="title">
|
||||
<string>IR Mode</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="rbSerialMode">
|
||||
<property name="whatsThis">
|
||||
<string><html><head/><body><p>Serial mode should be used if you have a physical IrDa adapter connected to this machine.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Serial</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="rbUDPMode">
|
||||
<property name="whatsThis">
|
||||
<string><html><head/><body><p>IP Mode bypasses the serial connection entirely. This is designed to increase stability for use with other IR peripheral emulators that support this feature.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>UDP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxUDP2">
|
||||
<property name="title">
|
||||
<string>UDP Mode Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="lblIPaddr">
|
||||
<property name="text">
|
||||
<string>[PLACEHOLDER]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QComboBox" name="cbxPortSelector">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><html><head/><body><p>Selects the network adapter through which to route network traffic under direct mode.</p></body></html></string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelIP">
|
||||
<property name="text">
|
||||
<string>IP address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelPort">
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelRunning">
|
||||
<property name="text">
|
||||
<string>Running:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="lblRunningStatus">
|
||||
<property name="text">
|
||||
<string>[PLACEHOLDER]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBoxUDP">
|
||||
<property name="title">
|
||||
<string>UDP Mode Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="lblIPaddr">
|
||||
<property name="text">
|
||||
<string>[PLACEHOLDER]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QComboBox" name="cbxPortSelector">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><html><head/><body><p>Selects the network adapter through which to route network traffic under direct mode.</p></body></html></string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelIP">
|
||||
<property name="text">
|
||||
<string>IP address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelPort">
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelRunning">
|
||||
<property name="text">
|
||||
<string>Running:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="lblRunningStatus">
|
||||
<property name="text">
|
||||
<string>[PLACEHOLDER]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</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>IRSettingsDialog</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>IRSettingsDialog</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>
|
|
@ -48,6 +48,8 @@ void NetInit();
|
|||
|
||||
WifiSettingsDialog::WifiSettingsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::WifiSettingsDialog)
|
||||
{
|
||||
|
||||
printf("Hi I am wifi settings");
|
||||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include "PathSettingsDialog.h"
|
||||
#include "MPSettingsDialog.h"
|
||||
#include "WifiSettingsDialog.h"
|
||||
#include "IRSettingsDialog.h"
|
||||
#include "InterfaceSettingsDialog.h"
|
||||
#include "ROMInfoDialog.h"
|
||||
#include "RAMInfoDialog.h"
|
||||
|
@ -634,6 +635,9 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
|||
actWifiSettings = menu->addAction("Wifi settings");
|
||||
connect(actWifiSettings, &QAction::triggered, this, &MainWindow::onOpenWifiSettings);
|
||||
|
||||
actIRSettings = menu->addAction("IR settings");
|
||||
connect(actIRSettings, &QAction::triggered, this, &MainWindow::onOpenIRSettings);
|
||||
|
||||
actFirmwareSettings = menu->addAction("Firmware settings");
|
||||
connect(actFirmwareSettings, &QAction::triggered, this, &MainWindow::onOpenFirmwareSettings);
|
||||
|
||||
|
@ -778,6 +782,7 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
|||
actVideoSettings->setEnabled(false);
|
||||
actMPSettings->setEnabled(false);
|
||||
actWifiSettings->setEnabled(false);
|
||||
actIRSettings->setEnabled(false);
|
||||
actInterfaceSettings->setEnabled(false);
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
@ -1986,6 +1991,22 @@ void MainWindow::onWifiSettingsFinished(int res)
|
|||
emuThread->emuUnpause();
|
||||
}
|
||||
|
||||
void MainWindow::onOpenIRSettings()
|
||||
{
|
||||
emuThread->emuPause();
|
||||
|
||||
IRSettingsDialog* dlg = IRSettingsDialog::openDlg(this);
|
||||
connect(dlg, &IRSettingsDialog::finished, this, &MainWindow::onIRSettingsFinished);
|
||||
}
|
||||
|
||||
void MainWindow::onIRSettingsFinished(int res)
|
||||
{
|
||||
if (IRSettingsDialog::needsReset)
|
||||
onReset();
|
||||
|
||||
emuThread->emuUnpause();
|
||||
}
|
||||
|
||||
void MainWindow::onOpenInterfaceSettings()
|
||||
{
|
||||
emuThread->emuPause();
|
||||
|
|
|
@ -206,6 +206,8 @@ private slots:
|
|||
void onMPSettingsFinished(int res);
|
||||
void onOpenWifiSettings();
|
||||
void onWifiSettingsFinished(int res);
|
||||
void onOpenIRSettings();
|
||||
void onIRSettingsFinished(int res);
|
||||
void onOpenFirmwareSettings();
|
||||
void onFirmwareSettingsFinished(int res);
|
||||
void onOpenPathSettings();
|
||||
|
@ -326,6 +328,7 @@ public:
|
|||
QAction* actAudioSettings;
|
||||
QAction* actMPSettings;
|
||||
QAction* actWifiSettings;
|
||||
QAction* actIRSettings;
|
||||
QAction* actFirmwareSettings;
|
||||
QAction* actPathSettings;
|
||||
QAction* actInterfaceSettings;
|
||||
|
|
Loading…
Add table
Reference in a new issue