more UI work, make things somewhat less shitty

This commit is contained in:
Arisotura 2022-09-19 00:39:59 +02:00
parent 80c3fe4b25
commit 788e4be81d
6 changed files with 97 additions and 126 deletions

View File

@ -74,6 +74,10 @@ AudioSettingsDialog::AudioSettingsDialog(QWidget* parent) : QDialog(parent), ui(
ui->lblInstanceNum->setText(QString("Configuring settings for instance %1").arg(inst+1));
ui->cbInterpolation->setEnabled(false);
ui->cbBitrate->setEnabled(false);
for (QAbstractButton* btn : grpMicMode->buttons())
btn->setEnabled(false);
ui->txtMicWavPath->setEnabled(false);
ui->btnMicWavBrowse->setEnabled(false);
}
else
ui->lblInstanceNum->hide();

View File

@ -282,8 +282,8 @@ ConfigEntry ConfigFile[] =
{"AudioInterp", 0, &AudioInterp, 0, false},
{"AudioBitrate", 0, &AudioBitrate, 0, false},
{"AudioVolume", 0, &AudioVolume, 256, true},
{"MicInputType", 0, &MicInputType, 1, true},
{"MicWavPath", 2, &MicWavPath, (std::string)"", true},
{"MicInputType", 0, &MicInputType, 1, false},
{"MicWavPath", 2, &MicWavPath, (std::string)"", false},
{"LastROMFolder", 2, &LastROMFolder, (std::string)"", true},
@ -302,7 +302,7 @@ ConfigEntry ConfigFile[] =
{"SavestatePath", 2, &SavestatePath, (std::string)"", true},
{"CheatFilePath", 2, &CheatFilePath, (std::string)"", true},
{"EnableCheats", 1, &EnableCheats, false, false},
{"EnableCheats", 1, &EnableCheats, false, true},
{"MouseHide", 1, &MouseHide, false, false},
{"MouseHideSeconds", 0, &MouseHideSeconds, 5, false},

View File

@ -114,6 +114,12 @@ bool TryLoadPCap(void* lib)
bool Init(bool open_adapter)
{
PCapAdapter = NULL;
PacketLen = 0;
RXNum = 0;
NumAdapters = 0;
// TODO: how to deal with cases where an adapter is unplugged or changes config??
if (!PCapLib)
{
@ -142,12 +148,6 @@ bool Init(bool open_adapter)
}
}
PCapAdapter = NULL;
PacketLen = 0;
RXNum = 0;
NumAdapters = 0;
char errbuf[PCAP_ERRBUF_SIZE];
int ret;

View File

@ -50,12 +50,12 @@ WifiSettingsDialog::WifiSettingsDialog(QWidget* parent) : QDialog(parent), ui(ne
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
LAN_Socket::Init();
haspcap = LAN_PCap::Init(false);
ui->rbDirectMode->setText("Direct mode (requires " PCAP_NAME " and ethernet connection)");
ui->cbBindAnyAddr->setChecked(Config::SocketBindAnyAddr);
ui->lblAdapterMAC->setText("(none)");
ui->lblAdapterIP->setText("(none)");
int sel = 0;
for (int i = 0; i < LAN_PCap::NumAdapters; i++)
@ -88,7 +88,6 @@ void WifiSettingsDialog::done(int r)
if (r == QDialog::Accepted)
{
Config::SocketBindAnyAddr = ui->cbBindAnyAddr->isChecked();
Config::DirectLAN = ui->rbDirectMode->isChecked();
int sel = ui->cbxDirectAdapter->currentIndex();

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>572</width>
<height>273</height>
<height>184</height>
</rect>
</property>
<property name="sizePolicy">
@ -24,31 +24,26 @@
<enum>QLayout::SetFixedSize</enum>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Local</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="cbBindAnyAddr">
<widget class="QRadioButton" name="rbIndirectMode">
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enabling this allows (theoretically) playing local multiplayer games over a local network. It may or may not help make for a better connection in general.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Indirect mode uses libslirp. It requires no extra setup and is easy to use.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Bind socket to any address</string>
<string>Indirect mode (uses libslirp, recommended)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Online</string>
<widget class="QRadioButton" name="rbDirectMode">
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Direct mode directly routes network traffic to the host network. It is the most reliable, but requires an ethernet connection.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Non-direct mode uses a layer of emulation to get around this, but is more prone to problems.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0" rowspan="3" colspan="2">
<property name="text">
<string>Direct mode [TEXT PLACEHOLDER]</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Direct mode settings</string>
@ -111,29 +106,6 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="rbIndirectMode">
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Indirect mode uses libslirp. It requires no extra setup and is easy to use.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Indirect mode (uses libslirp, recommended)</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="rbDirectMode">
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Direct mode directly routes network traffic to the host network. It is the most reliable, but requires an ethernet connection.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Non-direct mode uses a layer of emulation to get around this, but is more prone to problems.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Direct mode [TEXT PLACEHOLDER]</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">

View File

@ -1501,8 +1501,6 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
{
QMenu* menu = menubar->addMenu("Config");
//if (inst == 0)
{
actEmuSettings = menu->addAction("Emu settings");
connect(actEmuSettings, &QAction::triggered, this, &MainWindow::onOpenEmuSettings);
@ -1511,25 +1509,18 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
connect(actPreferences, &QAction::triggered, this, &MainWindow::onOpenEmuSettings);
actPreferences->setMenuRole(QAction::PreferencesRole);
#endif
}
actInputConfig = menu->addAction("Input and hotkeys");
connect(actInputConfig, &QAction::triggered, this, &MainWindow::onOpenInputConfig);
//if (inst == 0)
{
actVideoSettings = menu->addAction("Video settings");
connect(actVideoSettings, &QAction::triggered, this, &MainWindow::onOpenVideoSettings);
}
actAudioSettings = menu->addAction("Audio settings");
connect(actAudioSettings, &QAction::triggered, this, &MainWindow::onOpenAudioSettings);
//if (inst == 0)
{
actWifiSettings = menu->addAction("Wifi settings");
connect(actWifiSettings, &QAction::triggered, this, &MainWindow::onOpenWifiSettings);
}
actFirmwareSettings = menu->addAction("Firmware settings");
connect(actFirmwareSettings, &QAction::triggered, this, &MainWindow::onOpenFirmwareSettings);
@ -1771,6 +1762,17 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
actLimitFramerate->setChecked(Config::LimitFPS);
actAudioSync->setChecked(Config::AudioSync);
if (inst > 0)
{
actEmuSettings->setEnabled(false);
actVideoSettings->setEnabled(false);
actWifiSettings->setEnabled(false);
#ifdef __APPLE__
actPreferences->setEnabled(false);
#endif // __APPLE__
}
}
MainWindow::~MainWindow()
@ -2794,12 +2796,6 @@ void MainWindow::onOpenWifiSettings()
void MainWindow::onWifiSettingsFinished(int res)
{
if (Wifi::MPInited)
{
Platform::MP_DeInit();
Platform::MP_Init();
}
Platform::LAN_DeInit();
Platform::LAN_Init();