more UI work, make things somewhat less shitty
This commit is contained in:
parent
80c3fe4b25
commit
788e4be81d
|
@ -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();
|
||||
|
|
|
@ -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},
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,110 +24,82 @@
|
|||
<enum>QLayout::SetFixedSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Local</string>
|
||||
<widget class="QRadioButton" name="rbIndirectMode">
|
||||
<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>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Indirect mode (uses libslirp, recommended)</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="cbBindAnyAddr">
|
||||
<property name="whatsThis">
|
||||
<string><html><head/><body><p>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.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bind socket to any address</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><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>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="3" column="0" rowspan="3" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Direct mode settings</string>
|
||||
<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>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Network adapter:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cbxDirectAdapter">
|
||||
<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>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Network adapter:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cbxDirectAdapter">
|
||||
<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>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>MAC address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="lblAdapterMAC">
|
||||
<property name="text">
|
||||
<string>[PLACEHOLDER]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>IP address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="lblAdapterIP">
|
||||
<property name="text">
|
||||
<string>[PLACEHOLDER]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="rbIndirectMode">
|
||||
<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>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Indirect mode (uses libslirp, recommended)</string>
|
||||
<string>MAC address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="lblAdapterMAC">
|
||||
<property name="text">
|
||||
<string>[PLACEHOLDER]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="rbDirectMode">
|
||||
<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>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Direct mode [TEXT PLACEHOLDER]</string>
|
||||
<string>IP address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="lblAdapterIP">
|
||||
<property name="text">
|
||||
<string>[PLACEHOLDER]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -1501,35 +1501,26 @@ 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);
|
||||
actEmuSettings = menu->addAction("Emu settings");
|
||||
connect(actEmuSettings, &QAction::triggered, this, &MainWindow::onOpenEmuSettings);
|
||||
|
||||
#ifdef __APPLE__
|
||||
QAction* actPreferences = menu->addAction("Preferences...");
|
||||
connect(actPreferences, &QAction::triggered, this, &MainWindow::onOpenEmuSettings);
|
||||
actPreferences->setMenuRole(QAction::PreferencesRole);
|
||||
QAction* actPreferences = menu->addAction("Preferences...");
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue