mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 19:45:47 -04:00
System: Add option to use a single memory card for playlists
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
#include "inputbindingwidgets.h"
|
||||
#include "qthostinterface.h"
|
||||
#include "qtutils.h"
|
||||
#include "settingsdialog.h"
|
||||
#include "settingwidgetbinder.h"
|
||||
#include <QtCore/QUrl>
|
||||
#include <QtWidgets/QFileDialog>
|
||||
@ -12,39 +13,53 @@
|
||||
|
||||
static constexpr char MEMORY_CARD_IMAGE_FILTER[] = "All Memory Card Types (*.mcd *.mcr *.mc)";
|
||||
|
||||
MemoryCardSettingsWidget::MemoryCardSettingsWidget(QtHostInterface* host_interface, QWidget* parent /* = nullptr */)
|
||||
MemoryCardSettingsWidget::MemoryCardSettingsWidget(QtHostInterface* host_interface, QWidget* parent,
|
||||
SettingsDialog* dialog)
|
||||
: QWidget(parent), m_host_interface(host_interface)
|
||||
{
|
||||
createUi();
|
||||
createUi(dialog);
|
||||
}
|
||||
|
||||
MemoryCardSettingsWidget::~MemoryCardSettingsWidget() = default;
|
||||
|
||||
void MemoryCardSettingsWidget::createUi()
|
||||
void MemoryCardSettingsWidget::createUi(SettingsDialog* dialog)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
for (int i = 0; i < static_cast<int>(m_port_ui.size()); i++)
|
||||
{
|
||||
createPortSettingsUi(i, &m_port_ui[i]);
|
||||
createPortSettingsUi(dialog, i, &m_port_ui[i]);
|
||||
layout->addWidget(m_port_ui[i].container);
|
||||
}
|
||||
|
||||
{
|
||||
QGroupBox* note_box = new QGroupBox(this);
|
||||
QHBoxLayout* note_layout = new QHBoxLayout(note_box);
|
||||
QGroupBox* box = new QGroupBox(tr("Shared Settings"), this);
|
||||
QVBoxLayout* box_layout = new QVBoxLayout(box);
|
||||
|
||||
QCheckBox* playlist_title_as_game_title = new QCheckBox(tr("Use Single Card For Playlist"), box);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, playlist_title_as_game_title, "MemoryCards",
|
||||
"UsePlaylistTitle", true);
|
||||
box_layout->addWidget(playlist_title_as_game_title);
|
||||
dialog->registerWidgetHelp(
|
||||
playlist_title_as_game_title, tr("Use Single Card For Playlist"), tr("Checked"),
|
||||
tr("When using a playlist (m3u) and per-game (title) memory cards, a single memory card "
|
||||
"will be used for all discs. If unchecked, a separate card will be used for each disc."));
|
||||
|
||||
QHBoxLayout* note_layout = new QHBoxLayout();
|
||||
QLabel* note_label =
|
||||
new QLabel(tr("If one of the \"separate card per game\" memory card modes is chosen, these memory "
|
||||
"cards will be saved to the memcards directory."),
|
||||
note_box);
|
||||
box);
|
||||
note_label->setWordWrap(true);
|
||||
note_layout->addWidget(note_label, 1);
|
||||
|
||||
QPushButton* open_memcards = new QPushButton(tr("Open..."), note_box);
|
||||
QPushButton* open_memcards = new QPushButton(tr("Open..."), box);
|
||||
connect(open_memcards, &QPushButton::clicked, this, &MemoryCardSettingsWidget::onOpenMemCardsDirectoryClicked);
|
||||
note_layout->addWidget(open_memcards);
|
||||
layout->addWidget(note_box);
|
||||
box_layout->addLayout(note_layout);
|
||||
|
||||
layout->addWidget(box);
|
||||
}
|
||||
|
||||
layout->addStretch(1);
|
||||
@ -52,7 +67,7 @@ void MemoryCardSettingsWidget::createUi()
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void MemoryCardSettingsWidget::createPortSettingsUi(int index, PortSettingsUI* ui)
|
||||
void MemoryCardSettingsWidget::createPortSettingsUi(SettingsDialog* dialog, int index, PortSettingsUI* ui)
|
||||
{
|
||||
ui->container = new QGroupBox(tr("Memory Card %1").arg(index + 1), this);
|
||||
ui->layout = new QVBoxLayout(ui->container);
|
||||
|
@ -9,13 +9,14 @@
|
||||
#include <vector>
|
||||
|
||||
class QtHostInterface;
|
||||
class SettingsDialog;
|
||||
|
||||
class MemoryCardSettingsWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MemoryCardSettingsWidget(QtHostInterface* host_interface, QWidget* parent = nullptr);
|
||||
MemoryCardSettingsWidget(QtHostInterface* host_interface, QWidget* parent, SettingsDialog* dialog);
|
||||
~MemoryCardSettingsWidget();
|
||||
|
||||
private:
|
||||
@ -29,8 +30,8 @@ private:
|
||||
QLineEdit* memory_card_path;
|
||||
};
|
||||
|
||||
void createUi();
|
||||
void createPortSettingsUi(int index, PortSettingsUI* ui);
|
||||
void createUi(SettingsDialog* dialog);
|
||||
void createPortSettingsUi(SettingsDialog* dialog, int index, PortSettingsUI* ui);
|
||||
void onBrowseMemoryCardPathClicked(int index);
|
||||
void onOpenMemCardsDirectoryClicked();
|
||||
|
||||
|
@ -26,7 +26,7 @@ SettingsDialog::SettingsDialog(QtHostInterface* host_interface, QWidget* parent
|
||||
m_game_list_settings = new GameListSettingsWidget(host_interface, m_ui.settingsContainer);
|
||||
m_hotkey_settings = new HotkeySettingsWidget(host_interface, m_ui.settingsContainer);
|
||||
m_controller_settings = new ControllerSettingsWidget(host_interface, m_ui.settingsContainer);
|
||||
m_memory_card_settings = new MemoryCardSettingsWidget(host_interface, m_ui.settingsContainer);
|
||||
m_memory_card_settings = new MemoryCardSettingsWidget(host_interface, m_ui.settingsContainer, this);
|
||||
m_gpu_settings = new GPUSettingsWidget(host_interface, m_ui.settingsContainer, this);
|
||||
m_audio_settings = new AudioSettingsWidget(host_interface, m_ui.settingsContainer, this);
|
||||
m_advanced_settings = new AdvancedSettingsWidget(host_interface, m_ui.settingsContainer, this);
|
||||
|
Reference in New Issue
Block a user