Skip to content

Commit

Permalink
Qt: Add folder selection to memory card settings
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek authored and refractionpcsx2 committed Jun 20, 2022
1 parent 02d3c93 commit c23e792
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pcsx2-qt/Settings/MemoryCardSettingsWidget.cpp
Expand Up @@ -16,6 +16,7 @@
#include "PrecompiledHeader.h"

#include <QtGui/QDrag>
#include <QtWidgets/QFileDialog>
#include <QtWidgets/QInputDialog>
#include <QtWidgets/QMenu>
#include <QtWidgets/QMessageBox>
Expand Down Expand Up @@ -48,12 +49,14 @@ MemoryCardSettingsWidget::MemoryCardSettingsWidget(SettingsDialog* dialog, QWidg
// this is a bit lame, but resizeEvent() isn't good enough to autosize our columns,
// since the group box hasn't been resized at that point.
m_ui.cardGroupBox->installEventFilter(this);


SettingWidgetBinder::BindWidgetToFolderSetting(sif, m_ui.directory, m_ui.browse, m_ui.open, m_ui.reset, "Folders", "MemoryCards", "memcards");
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.autoEject, "EmuCore", "McdEnableEjection", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.automaticManagement, "EmuCore", "McdFolderAutoManage", true);

setupAdditionalUi();

connect(m_ui.directory, &QLineEdit::textChanged, this, &MemoryCardSettingsWidget::refresh);
m_ui.cardList->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_ui.cardList, &MemoryCardListWidget::itemSelectionChanged, this, &MemoryCardSettingsWidget::updateCardActions);
connect(m_ui.cardList, &MemoryCardListWidget::customContextMenuRequested, this, &MemoryCardSettingsWidget::listContextMenuRequested);
Expand Down
37 changes: 36 additions & 1 deletion pcsx2-qt/Settings/MemoryCardSettingsWidget.ui
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>796</width>
<width>639</width>
<height>443</height>
</rect>
</property>
Expand Down Expand Up @@ -58,6 +58,41 @@
<string>Memory Cards</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Folder:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="directory"/>
</item>
<item>
<widget class="QPushButton" name="browse">
<property name="text">
<string>Browse...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="open">
<property name="text">
<string>Open...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="reset">
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="MemoryCardListWidget" name="cardList">
<property name="rootIsDecorated">
Expand Down

0 comments on commit c23e792

Please sign in to comment.