work some on the UI... make it not labelled Fart

This commit is contained in:
Arisotura 2022-09-15 23:39:30 +02:00
parent 5ebc63c713
commit 3192b9621f
5 changed files with 76 additions and 41 deletions

View File

@ -281,9 +281,9 @@ ConfigEntry ConfigFile[] =
{"AudioInterp", 0, &AudioInterp, 0, false}, {"AudioInterp", 0, &AudioInterp, 0, false},
{"AudioBitrate", 0, &AudioBitrate, 0, false}, {"AudioBitrate", 0, &AudioBitrate, 0, false},
{"AudioVolume", 0, &AudioVolume, 256, false}, {"AudioVolume", 0, &AudioVolume, 256, true},
{"MicInputType", 0, &MicInputType, 1, false}, {"MicInputType", 0, &MicInputType, 1, true},
{"MicWavPath", 2, &MicWavPath, (std::string)"", false}, {"MicWavPath", 2, &MicWavPath, (std::string)"", true},
{"LastROMFolder", 2, &LastROMFolder, (std::string)"", true}, {"LastROMFolder", 2, &LastROMFolder, (std::string)"", true},
@ -308,9 +308,9 @@ ConfigEntry ConfigFile[] =
{"MouseHideSeconds", 0, &MouseHideSeconds, 5, false}, {"MouseHideSeconds", 0, &MouseHideSeconds, 5, false},
{"PauseLostFocus", 1, &PauseLostFocus, false, false}, {"PauseLostFocus", 1, &PauseLostFocus, false, false},
{"DSBatteryLevelOkay", 1, &DSBatteryLevelOkay, true, false}, {"DSBatteryLevelOkay", 1, &DSBatteryLevelOkay, true, true},
{"DSiBatteryLevel", 0, &DSiBatteryLevel, 0xF, false}, {"DSiBatteryLevel", 0, &DSiBatteryLevel, 0xF, true},
{"DSiBatteryCharging", 1, &DSiBatteryCharging, true, false}, {"DSiBatteryCharging", 1, &DSiBatteryCharging, true, true},
{"", -1, nullptr, 0, false} {"", -1, nullptr, 0, false}
}; };
@ -322,7 +322,7 @@ void LoadFile(int inst)
if (inst > 0) if (inst > 0)
{ {
char name[100] = {0}; char name[100] = {0};
snprintf(name, 99, kUniqueConfigFile, inst); snprintf(name, 99, kUniqueConfigFile, inst+1);
f = Platform::OpenLocalFile(name, "r"); f = Platform::OpenLocalFile(name, "r");
} }
else else
@ -392,7 +392,7 @@ void Save()
if (inst > 0) if (inst > 0)
{ {
char name[100] = {0}; char name[100] = {0};
snprintf(name, 99, kUniqueConfigFile, inst); snprintf(name, 99, kUniqueConfigFile, inst+1);
f = Platform::OpenLocalFile(name, "w"); f = Platform::OpenLocalFile(name, "w");
} }
else else

View File

@ -19,6 +19,7 @@
#include <QMessageBox> #include <QMessageBox>
#include "Config.h" #include "Config.h"
#include "Platform.h"
#include "FirmwareSettingsDialog.h" #include "FirmwareSettingsDialog.h"
#include "ui_FirmwareSettingsDialog.h" #include "ui_FirmwareSettingsDialog.h"
@ -66,6 +67,12 @@ FirmwareSettingsDialog::FirmwareSettingsDialog(QWidget* parent) : QDialog(parent
ui->txtMAC->setText(QString::fromStdString(Config::FirmwareMAC)); ui->txtMAC->setText(QString::fromStdString(Config::FirmwareMAC));
on_overrideFirmwareBox_toggled(); on_overrideFirmwareBox_toggled();
int inst = Platform::InstanceID();
if (inst > 0)
ui->lblInstanceNum->setText(QString("Configuring settings for instance %1").arg(inst+1));
else
ui->lblInstanceNum->hide();
} }
FirmwareSettingsDialog::~FirmwareSettingsDialog() FirmwareSettingsDialog::~FirmwareSettingsDialog()

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>511</width> <width>511</width>
<height>338</height> <height>357</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -23,6 +23,13 @@
<property name="sizeConstraint"> <property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum> <enum>QLayout::SetFixedSize</enum>
</property> </property>
<item>
<widget class="QLabel" name="lblInstanceNum">
<property name="text">
<string>Configuring settings for instance X</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="grpGeneral"> <widget class="QGroupBox" name="grpGeneral">
<property name="title"> <property name="title">

View File

@ -1340,6 +1340,8 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
setAcceptDrops(true); setAcceptDrops(true);
int inst = Platform::InstanceID();
QMenuBar* menubar = new QMenuBar(); QMenuBar* menubar = new QMenuBar();
{ {
QMenu* menu = menubar->addMenu("File"); QMenu* menu = menubar->addMenu("File");
@ -1471,55 +1473,70 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
actEnableCheats->setCheckable(true); actEnableCheats->setCheckable(true);
connect(actEnableCheats, &QAction::triggered, this, &MainWindow::onEnableCheats); connect(actEnableCheats, &QAction::triggered, this, &MainWindow::onEnableCheats);
actSetupCheats = menu->addAction("Setup cheat codes"); //if (inst == 0)
actSetupCheats->setMenuRole(QAction::NoRole); {
connect(actSetupCheats, &QAction::triggered, this, &MainWindow::onSetupCheats); actSetupCheats = menu->addAction("Setup cheat codes");
actSetupCheats->setMenuRole(QAction::NoRole);
connect(actSetupCheats, &QAction::triggered, this, &MainWindow::onSetupCheats);
menu->addSeparator(); menu->addSeparator();
actROMInfo = menu->addAction("ROM info"); actROMInfo = menu->addAction("ROM info");
connect(actROMInfo, &QAction::triggered, this, &MainWindow::onROMInfo); connect(actROMInfo, &QAction::triggered, this, &MainWindow::onROMInfo);
actRAMInfo = menu->addAction("RAM search"); actRAMInfo = menu->addAction("RAM search");
connect(actRAMInfo, &QAction::triggered, this, &MainWindow::onRAMInfo); connect(actRAMInfo, &QAction::triggered, this, &MainWindow::onRAMInfo);
actTitleManager = menu->addAction("Manage DSi titles"); actTitleManager = menu->addAction("Manage DSi titles");
connect(actTitleManager, &QAction::triggered, this, &MainWindow::onOpenTitleManager); connect(actTitleManager, &QAction::triggered, this, &MainWindow::onOpenTitleManager);
}
// TEST!! {
menu->addSeparator(); menu->addSeparator();
actTest = menu->addAction("Fart"); QMenu* submenu = menu->addMenu("Multiplayer");
connect(actTest, &QAction::triggered, this, &MainWindow::onTest);
actMPNewInstance = submenu->addAction("Launch new instance");
connect(actMPNewInstance, &QAction::triggered, this, &MainWindow::onMPNewInstance);
}
} }
{ {
QMenu* menu = menubar->addMenu("Config"); QMenu* menu = menubar->addMenu("Config");
actEmuSettings = menu->addAction("Emu settings"); //if (inst == 0)
connect(actEmuSettings, &QAction::triggered, this, &MainWindow::onOpenEmuSettings); {
actEmuSettings = menu->addAction("Emu settings");
connect(actEmuSettings, &QAction::triggered, this, &MainWindow::onOpenEmuSettings);
#ifdef __APPLE__ #ifdef __APPLE__
QAction* actPreferences = menu->addAction("Preferences..."); QAction* actPreferences = menu->addAction("Preferences...");
connect(actPreferences, &QAction::triggered, this, &MainWindow::onOpenEmuSettings); connect(actPreferences, &QAction::triggered, this, &MainWindow::onOpenEmuSettings);
actPreferences->setMenuRole(QAction::PreferencesRole); actPreferences->setMenuRole(QAction::PreferencesRole);
#endif #endif
}
actInputConfig = menu->addAction("Input and hotkeys"); actInputConfig = menu->addAction("Input and hotkeys");
connect(actInputConfig, &QAction::triggered, this, &MainWindow::onOpenInputConfig); connect(actInputConfig, &QAction::triggered, this, &MainWindow::onOpenInputConfig);
actVideoSettings = menu->addAction("Video settings"); //if (inst == 0)
connect(actVideoSettings, &QAction::triggered, this, &MainWindow::onOpenVideoSettings); {
actVideoSettings = menu->addAction("Video settings");
connect(actVideoSettings, &QAction::triggered, this, &MainWindow::onOpenVideoSettings);
}
actAudioSettings = menu->addAction("Audio settings"); actAudioSettings = menu->addAction("Audio settings");
connect(actAudioSettings, &QAction::triggered, this, &MainWindow::onOpenAudioSettings); connect(actAudioSettings, &QAction::triggered, this, &MainWindow::onOpenAudioSettings);
actWifiSettings = menu->addAction("Wifi settings"); //if (inst == 0)
connect(actWifiSettings, &QAction::triggered, this, &MainWindow::onOpenWifiSettings); {
actWifiSettings = menu->addAction("Wifi settings");
actInterfaceSettings = menu->addAction("Interface settings"); connect(actWifiSettings, &QAction::triggered, this, &MainWindow::onOpenWifiSettings);
connect(actInterfaceSettings, &QAction::triggered, this, &MainWindow::onOpenInterfaceSettings); }
actFirmwareSettings = menu->addAction("Firmware settings"); actFirmwareSettings = menu->addAction("Firmware settings");
connect(actFirmwareSettings, &QAction::triggered, this, &MainWindow::onOpenFirmwareSettings); connect(actFirmwareSettings, &QAction::triggered, this, &MainWindow::onOpenFirmwareSettings);
actInterfaceSettings = menu->addAction("Interface settings");
connect(actInterfaceSettings, &QAction::triggered, this, &MainWindow::onOpenInterfaceSettings);
actPathSettings = menu->addAction("Path settings"); actPathSettings = menu->addAction("Path settings");
connect(actPathSettings, &QAction::triggered, this, &MainWindow::onOpenPathSettings); connect(actPathSettings, &QAction::triggered, this, &MainWindow::onOpenPathSettings);
@ -2616,17 +2633,21 @@ void MainWindow::onOpenTitleManager()
TitleManagerDialog* dlg = TitleManagerDialog::openDlg(this); TitleManagerDialog* dlg = TitleManagerDialog::openDlg(this);
} }
void MainWindow::onTest() void MainWindow::onMPNewInstance()
{ {
//QProcess::startDetached(QApplication::applicationFilePath()); //QProcess::startDetached(QApplication::applicationFilePath());
QProcess ass; QProcess newinst;
newinst.setProgram(QApplication::applicationFilePath());
newinst.setArguments(QApplication::arguments().mid(1, QApplication::arguments().length()-1));
#ifdef __WIN32__ #ifdef __WIN32__
ass.setCreateProcessArgumentsModifier([] (QProcess::CreateProcessArguments *args) newinst.setCreateProcessArgumentsModifier([] (QProcess::CreateProcessArguments *args)
{ {
args->flags |= CREATE_NEW_CONSOLE; args->flags |= CREATE_NEW_CONSOLE;
}); });
#endif #endif
ass.startDetached(QApplication::applicationFilePath());
newinst.startDetached();
} }
void MainWindow::onOpenEmuSettings() void MainWindow::onOpenEmuSettings()

View File

@ -255,7 +255,7 @@ private slots:
void onROMInfo(); void onROMInfo();
void onRAMInfo(); void onRAMInfo();
void onOpenTitleManager(); void onOpenTitleManager();
void onTest(); void onMPNewInstance();
void onOpenEmuSettings(); void onOpenEmuSettings();
void onEmuSettingsDialogFinished(int res); void onEmuSettingsDialogFinished(int res);
@ -345,7 +345,7 @@ public:
QAction* actROMInfo; QAction* actROMInfo;
QAction* actRAMInfo; QAction* actRAMInfo;
QAction* actTitleManager; QAction* actTitleManager;
QAction* actTest; QAction* actMPNewInstance;
QAction* actEmuSettings; QAction* actEmuSettings;
QAction* actPowerManagement; QAction* actPowerManagement;