Qt: Add option for memory card type/mode

This commit is contained in:
Connor McLaughlin 2020-04-27 16:16:14 +10:00
parent bae4945c7a
commit 79111e4e03
4 changed files with 29 additions and 7 deletions

View file

@ -30,6 +30,7 @@ Other features include:
- Namco GunCon lightgun support (simulated with mouse)
- Qt and SDL frontends for desktop
- Automatic content scanning - game titles/regions are provided by redump.org
- Optional automatic switching of memory cards for each game
## System Requirements
- A CPU faster than a potato.

View file

@ -78,6 +78,18 @@ void PortSettingsWidget::createPortSettingsUi(int index, PortSettingsUI* ui)
ui->widget = new QWidget(m_tab_widget);
ui->layout = new QVBoxLayout(ui->widget);
ui->memory_card_type = new QComboBox(ui->widget);
for (int i = 0; i < static_cast<int>(MemoryCardType::Count); i++)
{
ui->memory_card_type->addItem(
QString::fromUtf8(Settings::GetMemoryCardTypeDisplayName(static_cast<MemoryCardType>(i))));
}
SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, ui->memory_card_type,
QStringLiteral("MemoryCards/Card%1Type").arg(index + 1),
&Settings::ParseMemoryCardTypeName, &Settings::GetMemoryCardTypeName);
ui->layout->addWidget(new QLabel(tr("Memory Card Type:"), ui->widget));
ui->layout->addWidget(ui->memory_card_type);
QHBoxLayout* memory_card_layout = new QHBoxLayout();
ui->memory_card_path = new QLineEdit(ui->widget);
SettingWidgetBinder::BindWidgetToStringSetting(m_host_interface, ui->memory_card_path,
@ -92,7 +104,7 @@ void PortSettingsWidget::createPortSettingsUi(int index, PortSettingsUI* ui)
connect(memory_card_remove, &QPushButton::clicked, [this, index]() { onEjectMemoryCardClicked(index); });
memory_card_layout->addWidget(memory_card_remove);
ui->layout->addWidget(new QLabel(tr("Memory Card Path:"), ui->widget));
ui->layout->addWidget(new QLabel(tr("Shared Memory Card Path:"), ui->widget));
ui->layout->addLayout(memory_card_layout);
ui->layout->addWidget(new QLabel(tr("Controller Type:"), ui->widget));
@ -101,7 +113,7 @@ void PortSettingsWidget::createPortSettingsUi(int index, PortSettingsUI* ui)
for (int i = 0; i < static_cast<int>(ControllerType::Count); i++)
{
ui->controller_type->addItem(
QString::fromLocal8Bit(Settings::GetControllerTypeDisplayName(static_cast<ControllerType>(i))));
QString::fromUtf8(Settings::GetControllerTypeDisplayName(static_cast<ControllerType>(i))));
}
ControllerType ctype = Settings::ParseControllerTypeName(
m_host_interface->getSettingValue(QStringLiteral("Controller%1/Type").arg(index + 1))
@ -327,8 +339,10 @@ void PortSettingsWidget::onBrowseMemoryCardPathClicked(int index)
void PortSettingsWidget::onEjectMemoryCardClicked(int index)
{
QSignalBlocker blocker(m_port_ui[index].memory_card_path);
m_port_ui[index].memory_card_type->setCurrentIndex(0);
m_port_ui[index].memory_card_path->setText(QString());
m_host_interface->removeSettingValue(QStringLiteral("MemoryCards/Card%1Path").arg(index + 1));
m_host_interface->putSettingValue(QStringLiteral("MemoryCards/Card%1Type").arg(index + 1), QStringLiteral("None"));
m_host_interface->putSettingValue(QStringLiteral("MemoryCards/Card%1Path").arg(index + 1), QString());
m_host_interface->applySettings();
}

View file

@ -36,6 +36,7 @@ private:
QWidget* widget;
QVBoxLayout* layout;
QComboBox* controller_type;
QComboBox* memory_card_type;
QLineEdit* memory_card_path;
QWidget* button_binding_container;
InputBindingWidget* first_button;

View file

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<height>500</height>
<width>780</width>
<height>820</height>
</rect>
</property>
<property name="windowTitle">
@ -30,7 +30,7 @@
<widget class="QListWidget" name="settingsCategory">
<property name="maximumSize">
<size>
<width>200</width>
<width>230</width>
<height>16777215</height>
</size>
</property>
@ -122,7 +122,13 @@
<property name="minimumSize">
<size>
<width>16777215</width>
<height>110</height>
<height>120</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>120</height>
</size>
</property>
</widget>