actually hook up most of that dialog

This commit is contained in:
Arisotura 2022-09-19 20:57:55 +02:00
parent 3786705c68
commit 502f7d08d4
8 changed files with 38 additions and 17 deletions

View File

@ -107,7 +107,9 @@ int FirmwareFavouriteColour;
std::string FirmwareMessage;
std::string FirmwareMAC;
bool SocketBindAnyAddr;
int MPAudioMode;
int MPRecvTimeout;
std::string LANDevice;
bool DirectLAN;
@ -273,7 +275,9 @@ ConfigEntry ConfigFile[] =
{"FirmwareMessage", 2, &FirmwareMessage, (std::string)"", true},
{"FirmwareMAC", 2, &FirmwareMAC, (std::string)"", true},
{"SockBindAnyAddr", 1, &SocketBindAnyAddr, false, false},
{"MPAudioMode", 0, &MPAudioMode, 1, false},
{"MPRecvTimeout", 0, &MPRecvTimeout, 25, false},
{"LANDevice", 2, &LANDevice, (std::string)"", false},
{"DirectLAN", 1, &DirectLAN, false, false},

View File

@ -143,7 +143,9 @@ extern int FirmwareFavouriteColour;
extern std::string FirmwareMessage;
extern std::string FirmwareMAC;
extern bool SocketBindAnyAddr;
extern int MPAudioMode;
extern int MPRecvTimeout;
extern std::string LANDevice;
extern bool DirectLAN;

View File

@ -85,7 +85,7 @@ const u32 kReplyStart = kQueueSize / 2;
const u32 kPacketEnd = kReplyStart;
const u32 kReplyEnd = kQueueSize;
const int RecvTimeout = 25;
int RecvTimeout;
int LastHostID;
@ -287,6 +287,8 @@ bool Init()
printf("MP comm init OK, instance ID %d\n", InstanceID);
RecvTimeout = 25;
return true;
}
@ -305,6 +307,11 @@ void DeInit()
delete MPQueue;
}
void SetRecvTimeout(int timeout)
{
RecvTimeout = timeout;
}
void Begin()
{
MPQueue->lock();

View File

@ -26,8 +26,12 @@ namespace LocalMP
bool Init();
void DeInit();
void SetRecvTimeout(int timeout);
void Begin();
void End();
int SendPacket(u8* data, int len, u64 timestamp);
int RecvPacket(u8* data, u64* timestamp);
int SendCmd(u8* data, int len, u64 timestamp);

View File

@ -33,8 +33,6 @@
MPSettingsDialog* MPSettingsDialog::currentDlg = nullptr;
bool MPSettingsDialog::needsReset = false;
extern bool RunningSomething;
@ -43,7 +41,13 @@ MPSettingsDialog::MPSettingsDialog(QWidget* parent) : QDialog(parent), ui(new Ui
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
// todo
grpAudioMode = new QButtonGroup(this);
grpAudioMode->addButton(ui->rbAudioAll, 0);
grpAudioMode->addButton(ui->rbAudioOneOnly, 1);
grpAudioMode->addButton(ui->rbAudioActiveOnly, 2);
grpAudioMode->button(Config::MPAudioMode)->setChecked(true);
ui->sbReceiveTimeout->setValue(Config::MPRecvTimeout);
}
MPSettingsDialog::~MPSettingsDialog()
@ -53,11 +57,10 @@ MPSettingsDialog::~MPSettingsDialog()
void MPSettingsDialog::done(int r)
{
needsReset = false;
if (r == QDialog::Accepted)
{
// TODO save shit here
Config::MPAudioMode = grpAudioMode->checkedId();
Config::MPRecvTimeout = ui->sbReceiveTimeout->value();
Config::Save();
}

View File

@ -20,6 +20,7 @@
#define MPSETTINGSDIALOG_H
#include <QDialog>
#include <QButtonGroup>
namespace Ui { class MPSettingsDialog; }
class MPSettingsDialog;
@ -50,8 +51,6 @@ public:
currentDlg = nullptr;
}
static bool needsReset;
private slots:
void done(int r);
@ -59,6 +58,8 @@ private slots:
private:
Ui::MPSettingsDialog* ui;
QButtonGroup* grpAudioMode;
};
#endif // MPSETTINGSDIALOG_H

View File

@ -64,6 +64,9 @@
<height>0</height>
</size>
</property>
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="0" column="0">

View File

@ -1772,6 +1772,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
{
actEmuSettings->setEnabled(false);
actVideoSettings->setEnabled(false);
actMPSettings->setEnabled(false);
actWifiSettings->setEnabled(false);
#ifdef __APPLE__
@ -2801,11 +2802,7 @@ void MainWindow::onOpenMPSettings()
void MainWindow::onMPSettingsFinished(int res)
{
/*LocalMP::DeInit();
LocalMP::Init();
if (MPSettingsDialog::needsReset)
onReset();*/
LocalMP::SetRecvTimeout(Config::MPRecvTimeout);
emuThread->emuUnpause();
}