mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-26 15:50:00 -06:00
lay base for the multiplayer settings dialog
This commit is contained in:
@ -17,6 +17,7 @@ set(SOURCES_QT_SDL
|
|||||||
AudioSettingsDialog.cpp
|
AudioSettingsDialog.cpp
|
||||||
FirmwareSettingsDialog.cpp
|
FirmwareSettingsDialog.cpp
|
||||||
PathSettingsDialog.cpp
|
PathSettingsDialog.cpp
|
||||||
|
MPSettingsDialog.cpp
|
||||||
WifiSettingsDialog.cpp
|
WifiSettingsDialog.cpp
|
||||||
InterfaceSettingsDialog.cpp
|
InterfaceSettingsDialog.cpp
|
||||||
ROMInfoDialog.cpp
|
ROMInfoDialog.cpp
|
||||||
|
70
src/frontend/qt_sdl/MPSettingsDialog.cpp
Normal file
70
src/frontend/qt_sdl/MPSettingsDialog.cpp
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
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 <QMessageBox>
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
#include "Platform.h"
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
#include "LAN_Socket.h"
|
||||||
|
#include "LAN_PCap.h"
|
||||||
|
#include "Wifi.h"
|
||||||
|
|
||||||
|
#include "MPSettingsDialog.h"
|
||||||
|
#include "ui_MPSettingsDialog.h"
|
||||||
|
|
||||||
|
|
||||||
|
MPSettingsDialog* MPSettingsDialog::currentDlg = nullptr;
|
||||||
|
|
||||||
|
bool MPSettingsDialog::needsReset = false;
|
||||||
|
|
||||||
|
extern bool RunningSomething;
|
||||||
|
|
||||||
|
|
||||||
|
MPSettingsDialog::MPSettingsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::MPSettingsDialog)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
|
// todo
|
||||||
|
}
|
||||||
|
|
||||||
|
MPSettingsDialog::~MPSettingsDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MPSettingsDialog::done(int r)
|
||||||
|
{
|
||||||
|
needsReset = false;
|
||||||
|
|
||||||
|
if (r == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
// TODO save shit here
|
||||||
|
|
||||||
|
Config::Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
QDialog::done(r);
|
||||||
|
|
||||||
|
closeDlg();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
64
src/frontend/qt_sdl/MPSettingsDialog.h
Normal file
64
src/frontend/qt_sdl/MPSettingsDialog.h
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
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 MPSETTINGSDIALOG_H
|
||||||
|
#define MPSETTINGSDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui { class MPSettingsDialog; }
|
||||||
|
class MPSettingsDialog;
|
||||||
|
|
||||||
|
class MPSettingsDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit MPSettingsDialog(QWidget* parent);
|
||||||
|
~MPSettingsDialog();
|
||||||
|
|
||||||
|
static MPSettingsDialog* currentDlg;
|
||||||
|
static MPSettingsDialog* openDlg(QWidget* parent)
|
||||||
|
{
|
||||||
|
if (currentDlg)
|
||||||
|
{
|
||||||
|
currentDlg->activateWindow();
|
||||||
|
return currentDlg;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentDlg = new MPSettingsDialog(parent);
|
||||||
|
currentDlg->open();
|
||||||
|
return currentDlg;
|
||||||
|
}
|
||||||
|
static void closeDlg()
|
||||||
|
{
|
||||||
|
currentDlg = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool needsReset;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void done(int r);
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::MPSettingsDialog* ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MPSETTINGSDIALOG_H
|
139
src/frontend/qt_sdl/MPSettingsDialog.ui
Normal file
139
src/frontend/qt_sdl/MPSettingsDialog.ui
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MPSettingsDialog</class>
|
||||||
|
<widget class="QDialog" name="MPSettingsDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>466</width>
|
||||||
|
<height>202</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Multiplayer settings - melonDS</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Audio output</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QRadioButton" name="rbAudioOneOnly">
|
||||||
|
<property name="text">
|
||||||
|
<string>Instance 1 only</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QRadioButton" name="rbAudioAll">
|
||||||
|
<property name="text">
|
||||||
|
<string>All instances</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QRadioButton" name="rbAudioActiveOnly">
|
||||||
|
<property name="text">
|
||||||
|
<string>Active instance only</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Network</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSpinBox" name="sbReceiveTimeout">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Data reception timeout: </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>milliseconds</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>MPSettingsDialog</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>MPSettingsDialog</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>
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>572</width>
|
<width>572</width>
|
||||||
<height>184</height>
|
<height>217</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -24,6 +24,12 @@
|
|||||||
<enum>QLayout::SetFixedSize</enum>
|
<enum>QLayout::SetFixedSize</enum>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Network mode</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
<widget class="QRadioButton" name="rbIndirectMode">
|
<widget class="QRadioButton" name="rbIndirectMode">
|
||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string><html><head/><body><p>Indirect mode uses libslirp. It requires no extra setup and is easy to use.</p></body></html></string>
|
<string><html><head/><body><p>Indirect mode uses libslirp. It requires no extra setup and is easy to use.</p></body></html></string>
|
||||||
@ -33,7 +39,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="0">
|
||||||
<widget class="QRadioButton" name="rbDirectMode">
|
<widget class="QRadioButton" name="rbDirectMode">
|
||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string><html><head/><body><p>Direct mode directly routes network traffic to the host network. It is the most reliable, but requires an ethernet connection.</p><p><br/></p><p>Non-direct mode uses a layer of emulation to get around this, but is more prone to problems.</p></body></html></string>
|
<string><html><head/><body><p>Direct mode directly routes network traffic to the host network. It is the most reliable, but requires an ethernet connection.</p><p><br/></p><p>Non-direct mode uses a layer of emulation to get around this, but is more prone to problems.</p></body></html></string>
|
||||||
@ -43,6 +49,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_3">
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -58,6 +58,7 @@
|
|||||||
#include "AudioSettingsDialog.h"
|
#include "AudioSettingsDialog.h"
|
||||||
#include "FirmwareSettingsDialog.h"
|
#include "FirmwareSettingsDialog.h"
|
||||||
#include "PathSettingsDialog.h"
|
#include "PathSettingsDialog.h"
|
||||||
|
#include "MPSettingsDialog.h"
|
||||||
#include "WifiSettingsDialog.h"
|
#include "WifiSettingsDialog.h"
|
||||||
#include "InterfaceSettingsDialog.h"
|
#include "InterfaceSettingsDialog.h"
|
||||||
#include "ROMInfoDialog.h"
|
#include "ROMInfoDialog.h"
|
||||||
@ -78,6 +79,7 @@
|
|||||||
#include "SPU.h"
|
#include "SPU.h"
|
||||||
#include "Wifi.h"
|
#include "Wifi.h"
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
#include "LocalMP.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
#include "Savestate.h"
|
#include "Savestate.h"
|
||||||
@ -1519,6 +1521,9 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
|
|||||||
actAudioSettings = menu->addAction("Audio settings");
|
actAudioSettings = menu->addAction("Audio settings");
|
||||||
connect(actAudioSettings, &QAction::triggered, this, &MainWindow::onOpenAudioSettings);
|
connect(actAudioSettings, &QAction::triggered, this, &MainWindow::onOpenAudioSettings);
|
||||||
|
|
||||||
|
actMPSettings = menu->addAction("Multiplayer settings");
|
||||||
|
connect(actMPSettings, &QAction::triggered, this, &MainWindow::onOpenMPSettings);
|
||||||
|
|
||||||
actWifiSettings = menu->addAction("Wifi settings");
|
actWifiSettings = menu->addAction("Wifi settings");
|
||||||
connect(actWifiSettings, &QAction::triggered, this, &MainWindow::onOpenWifiSettings);
|
connect(actWifiSettings, &QAction::triggered, this, &MainWindow::onOpenWifiSettings);
|
||||||
|
|
||||||
@ -2786,6 +2791,25 @@ void MainWindow::onAudioSettingsFinished(int res)
|
|||||||
micOpen();
|
micOpen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::onOpenMPSettings()
|
||||||
|
{
|
||||||
|
emuThread->emuPause();
|
||||||
|
|
||||||
|
MPSettingsDialog* dlg = MPSettingsDialog::openDlg(this);
|
||||||
|
connect(dlg, &MPSettingsDialog::finished, this, &MainWindow::onMPSettingsFinished);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onMPSettingsFinished(int res)
|
||||||
|
{
|
||||||
|
/*LocalMP::DeInit();
|
||||||
|
LocalMP::Init();
|
||||||
|
|
||||||
|
if (MPSettingsDialog::needsReset)
|
||||||
|
onReset();*/
|
||||||
|
|
||||||
|
emuThread->emuUnpause();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::onOpenWifiSettings()
|
void MainWindow::onOpenWifiSettings()
|
||||||
{
|
{
|
||||||
emuThread->emuPause();
|
emuThread->emuPause();
|
||||||
|
@ -268,6 +268,8 @@ private slots:
|
|||||||
void onOpenPathSettings();
|
void onOpenPathSettings();
|
||||||
void onUpdateAudioSettings();
|
void onUpdateAudioSettings();
|
||||||
void onAudioSettingsFinished(int res);
|
void onAudioSettingsFinished(int res);
|
||||||
|
void onOpenMPSettings();
|
||||||
|
void onMPSettingsFinished(int res);
|
||||||
void onOpenWifiSettings();
|
void onOpenWifiSettings();
|
||||||
void onWifiSettingsFinished(int res);
|
void onWifiSettingsFinished(int res);
|
||||||
void onFirmwareSettingsFinished(int res);
|
void onFirmwareSettingsFinished(int res);
|
||||||
@ -352,6 +354,7 @@ public:
|
|||||||
QAction* actInputConfig;
|
QAction* actInputConfig;
|
||||||
QAction* actVideoSettings;
|
QAction* actVideoSettings;
|
||||||
QAction* actAudioSettings;
|
QAction* actAudioSettings;
|
||||||
|
QAction* actMPSettings;
|
||||||
QAction* actWifiSettings;
|
QAction* actWifiSettings;
|
||||||
QAction* actFirmwareSettings;
|
QAction* actFirmwareSettings;
|
||||||
QAction* actPathSettings;
|
QAction* actPathSettings;
|
||||||
|
Reference in New Issue
Block a user