more work for settings window

This commit is contained in:
Rosalie Wanders committed 2020-11-01 20:34:26 +01:00
1 parent 6a06e4db1f
commit f8658d8d93
4 files changed
+190 -40

No files matched your search

+4 -3
View File
@@ -239,10 +239,11 @@ bool Core::SetPlugin(Plugin_t plugin)
bool Core::GetRomInfo(QString file, RomInfo_t *info)
{
m64p_error ret;
bool inEmulation = this->emulation_IsRunning() || this->emulation_IsPaused();
if (!this->rom_Open(file))
if (!inEmulation && !this->rom_Open(file))
return false;
ret = M64P::Core.DoCommand(M64CMD_ROM_GET_HEADER, sizeof(m64p_rom_header), &info->Header);
if (ret != M64ERR_SUCCESS)
{
@@ -263,7 +264,7 @@ bool Core::GetRomInfo(QString file, RomInfo_t *info)
info->FileName = file;
if (!this->rom_Close())
if (!inEmulation && !this->rom_Close())
return false;
return true;
@@ -8,6 +8,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "SettingsDialog.hpp"
#include "../../Globals.hpp"
using namespace UserInterface::Dialog;
@@ -16,7 +17,22 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent, Qt::WindowSyst
this->setupUi(this);
// TODO
this->treeWidget->topLevelItem(0)->setSelected(true);
this->treeWidget->topLevelItem(1)->setSelected(true);
if (!g_EmuThread->isRunning())
{
this->treeWidget->topLevelItem(1)->setDisabled(true);
}
else
{
M64P::Wrapper::RomInfo_t info;
g_MupenApi.Core.GetRomInfo("", &info);
this->lineEdit->setText(info.Settings.goodname);
this->comboBox->setCurrentIndex(info.Settings.disableextramem == 1 ? 0 : 1);
this->comboBox_2->setCurrentIndex(info.Settings.savetype);
this->comboBox_3->setCurrentIndex(info.Settings.countperop);
}
}
SettingsDialog::~SettingsDialog(void)
+160 -35
View File
@@ -79,53 +79,178 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QWidget" name="verticalLayoutWidget">
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>-10</x>
<x>0</x>
<y>0</y>
<width>324</width>
<width>321</width>
<height>321</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0">
<property name="spacing">
<number>0</number>
<property name="title">
<string/>
</property>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>170</x>
<y>10</y>
<width>141</width>
<height>32</height>
</rect>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>161</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Good Name</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>161</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Memory Size</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>161</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Save Type</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>10</x>
<y>130</y>
<width>161</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Counter Factor</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox">
<property name="geometry">
<rect>
<x>170</x>
<y>50</y>
<width>141</width>
<height>32</height>
</rect>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="textEdit"/>
</item>
</layout>
<property name="text">
<string>4 MB</string>
</property>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
<property name="text">
<string>8 MB</string>
</property>
</item>
</layout>
</widget>
<widget class="QComboBox" name="comboBox_2">
<property name="geometry">
<rect>
<x>170</x>
<y>90</y>
<width>141</width>
<height>32</height>
</rect>
</property>
<item>
<property name="text">
<string>4 KB EEPROM</string>
</property>
</item>
<item>
<property name="text">
<string>16 KB EEPROM</string>
</property>
</item>
<item>
<property name="text">
<string>SRAM</string>
</property>
</item>
<item>
<property name="text">
<string>Flash RAM</string>
</property>
</item>
<item>
<property name="text">
<string>Controller pack</string>
</property>
</item>
<item>
<property name="text">
<string>None</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="comboBox_3">
<property name="geometry">
<rect>
<x>170</x>
<y>130</y>
<width>141</width>
<height>32</height>
</rect>
</property>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>3</string>
</property>
</item>
<item>
<property name="text">
<string>4</string>
</property>
</item>
<item>
<property name="text">
<string>5</string>
</property>
</item>
</widget>
</widget>
</widget>
<widget class="QWidget" name="pluginSettingsPage"/>
+9 -1
View File
@@ -229,7 +229,7 @@ void MainWindow::menuBar_Setup(bool inEmulation, bool isPaused)
this->menuBar_Menu->addSeparator();
// TODO: Add language support
QMenu* langMenu = new QMenu("Language", this);
QMenu *langMenu = new QMenu("Language", this);
langMenu->addAction("English");
this->menuBar_Menu->addMenu(langMenu);
@@ -755,8 +755,16 @@ void MainWindow::on_Action_Options_ConfigControl(void)
void MainWindow::on_Action_Options_Settings(void)
{
bool isPaused = g_MupenApi.Core.isEmulationPaused();
if (!isPaused)
this->on_Action_System_Pause();
Dialog::SettingsDialog dialog(this);
dialog.exec();
if (!isPaused)
this->on_Action_System_Pause();
}
void MainWindow::on_Action_Help_Support(void)