Qt: Fix folder selection title bar
This commit is contained in:
parent
55d095174f
commit
76f6eafdbc
|
@ -66,9 +66,9 @@ BIOSSettingsWidget::BIOSSettingsWidget(SettingsWindow* dialog, QWidget* parent)
|
|||
|
||||
if (!m_dialog->isPerGameSettings())
|
||||
{
|
||||
SettingWidgetBinder::BindWidgetToFolderSetting(sif, m_ui.searchDirectory, m_ui.browseSearchDirectory,
|
||||
m_ui.openSearchDirectory, nullptr, "BIOS", "SearchDirectory",
|
||||
Path::Combine(EmuFolders::DataRoot, "bios"));
|
||||
SettingWidgetBinder::BindWidgetToFolderSetting(
|
||||
sif, m_ui.searchDirectory, m_ui.browseSearchDirectory, tr("Select BIOS Directory"), m_ui.openSearchDirectory,
|
||||
nullptr, "BIOS", "SearchDirectory", Path::Combine(EmuFolders::DataRoot, "bios"));
|
||||
connect(m_ui.searchDirectory, &QLineEdit::textChanged, this, &BIOSSettingsWidget::refreshList);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -14,16 +14,18 @@ FolderSettingsWidget::FolderSettingsWidget(SettingsWindow* dialog, QWidget* pare
|
|||
|
||||
m_ui.setupUi(this);
|
||||
|
||||
SettingWidgetBinder::BindWidgetToFolderSetting(sif, m_ui.cache, m_ui.cacheBrowse, m_ui.cacheOpen, m_ui.cacheReset,
|
||||
"Folders", "Cache", Path::Combine(EmuFolders::DataRoot, "cache"));
|
||||
SettingWidgetBinder::BindWidgetToFolderSetting(sif, m_ui.covers, m_ui.coversBrowse, m_ui.coversOpen, m_ui.coversReset,
|
||||
"Folders", "Covers", Path::Combine(EmuFolders::DataRoot, "covers"));
|
||||
SettingWidgetBinder::BindWidgetToFolderSetting(sif, m_ui.screenshots, m_ui.screenshotsBrowse, m_ui.screenshotsOpen,
|
||||
m_ui.screenshotsReset, "Folders", "Screenshots",
|
||||
Path::Combine(EmuFolders::DataRoot, "screenshots"));
|
||||
SettingWidgetBinder::BindWidgetToFolderSetting(sif, m_ui.saveStates, m_ui.saveStatesBrowse, m_ui.saveStatesOpen,
|
||||
m_ui.saveStatesReset, "Folders", "SaveStates",
|
||||
Path::Combine(EmuFolders::DataRoot, "savestates"));
|
||||
SettingWidgetBinder::BindWidgetToFolderSetting(sif, m_ui.cache, m_ui.cacheBrowse, tr("Select Cache Directory"),
|
||||
m_ui.cacheOpen, m_ui.cacheReset, "Folders", "Cache",
|
||||
Path::Combine(EmuFolders::DataRoot, "cache"));
|
||||
SettingWidgetBinder::BindWidgetToFolderSetting(sif, m_ui.covers, m_ui.coversBrowse, tr("Select Covers Directory"),
|
||||
m_ui.coversOpen, m_ui.coversReset, "Folders", "Covers",
|
||||
Path::Combine(EmuFolders::DataRoot, "covers"));
|
||||
SettingWidgetBinder::BindWidgetToFolderSetting(
|
||||
sif, m_ui.screenshots, m_ui.screenshotsBrowse, tr("Select Screenshot Directory"), m_ui.screenshotsOpen,
|
||||
m_ui.screenshotsReset, "Folders", "Screenshots", Path::Combine(EmuFolders::DataRoot, "screenshots"));
|
||||
SettingWidgetBinder::BindWidgetToFolderSetting(
|
||||
sif, m_ui.saveStates, m_ui.saveStatesBrowse, tr("Select Save State Directory"), m_ui.saveStatesOpen,
|
||||
m_ui.saveStatesReset, "Folders", "SaveStates", Path::Combine(EmuFolders::DataRoot, "savestates"));
|
||||
}
|
||||
|
||||
FolderSettingsWidget::~FolderSettingsWidget() = default;
|
||||
|
|
|
@ -90,9 +90,9 @@ void MemoryCardSettingsWidget::createUi(SettingsWindow* dialog)
|
|||
|
||||
layout->addWidget(box);
|
||||
|
||||
SettingWidgetBinder::BindWidgetToFolderSetting(m_dialog->getSettingsInterface(), m_memory_card_directory, browse,
|
||||
open_memcards, reset, "MemoryCards", "Directory",
|
||||
Path::Combine(EmuFolders::DataRoot, "memcards"));
|
||||
SettingWidgetBinder::BindWidgetToFolderSetting(
|
||||
m_dialog->getSettingsInterface(), m_memory_card_directory, browse, tr("Select Memory Card Directory"),
|
||||
open_memcards, reset, "MemoryCards", "Directory", Path::Combine(EmuFolders::DataRoot, "memcards"));
|
||||
}
|
||||
|
||||
layout->addStretch(1);
|
||||
|
@ -114,9 +114,8 @@ void MemoryCardSettingsWidget::createPortSettingsUi(SettingsWindow* dialog, int
|
|||
|
||||
const MemoryCardType default_value = (index == 0) ? MemoryCardType::PerGameTitle : MemoryCardType::None;
|
||||
SettingWidgetBinder::BindWidgetToEnumSetting(m_dialog->getSettingsInterface(), ui->memory_card_type, "MemoryCards",
|
||||
fmt::format("Card{}Type", index + 1),
|
||||
&Settings::ParseMemoryCardTypeName, &Settings::GetMemoryCardTypeName,
|
||||
default_value);
|
||||
fmt::format("Card{}Type", index + 1), &Settings::ParseMemoryCardTypeName,
|
||||
&Settings::GetMemoryCardTypeName, default_value);
|
||||
ui->layout->addWidget(new QLabel(tr("Memory Card Type:"), ui->container));
|
||||
ui->layout->addWidget(ui->memory_card_type);
|
||||
|
||||
|
|
|
@ -1179,9 +1179,9 @@ static void BindWidgetToEnumSetting(SettingsInterface* sif, WidgetType* widget,
|
|||
}
|
||||
|
||||
static inline void BindWidgetToFolderSetting(SettingsInterface* sif, QLineEdit* widget, QAbstractButton* browse_button,
|
||||
QAbstractButton* open_button, QAbstractButton* reset_button,
|
||||
std::string section, std::string key, std::string default_value,
|
||||
bool use_relative = true)
|
||||
QString browse_title, QAbstractButton* open_button,
|
||||
QAbstractButton* reset_button, std::string section, std::string key,
|
||||
std::string default_value, bool use_relative = true)
|
||||
{
|
||||
using Accessor = SettingAccessor<QLineEdit>;
|
||||
|
||||
|
@ -1250,19 +1250,16 @@ static inline void BindWidgetToFolderSetting(SettingsInterface* sif, QLineEdit*
|
|||
|
||||
if (browse_button)
|
||||
{
|
||||
QObject::connect(browse_button, &QAbstractButton::clicked, browse_button, [widget, key, value_changed]() {
|
||||
const QString path(QDir::toNativeSeparators(QFileDialog::getExistingDirectory(
|
||||
QtUtils::GetRootWidget(widget),
|
||||
// It seems that the latter half should show the types of folders that can be selected within Settings ->
|
||||
// Folders, but right now it's broken. It would be best for localization purposes to duplicate this into
|
||||
// multiple lines, each per type of folder.
|
||||
qApp->translate("SettingWidgetBinder", "Select folder for %1").arg(QString::fromStdString(key)))));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
QObject::connect(browse_button, &QAbstractButton::clicked, browse_button,
|
||||
[widget, browse_title = std::move(browse_title), value_changed]() {
|
||||
const QString path = QDir::toNativeSeparators(
|
||||
QFileDialog::getExistingDirectory(QtUtils::GetRootWidget(widget), browse_title));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
widget->setText(path);
|
||||
value_changed();
|
||||
});
|
||||
widget->setText(path);
|
||||
value_changed();
|
||||
});
|
||||
}
|
||||
if (open_button)
|
||||
{
|
||||
|
|
|
@ -212,8 +212,9 @@ void SetupWizardDialog::languageChanged()
|
|||
void SetupWizardDialog::setupBIOSPage()
|
||||
{
|
||||
SettingWidgetBinder::BindWidgetToFolderSetting(nullptr, m_ui.biosSearchDirectory, m_ui.browseBiosSearchDirectory,
|
||||
m_ui.openBiosSearchDirectory, m_ui.resetBiosSearchDirectory, "BIOS",
|
||||
"SearchDirectory", Path::Combine(EmuFolders::DataRoot, "bios"));
|
||||
tr("Select BIOS Directory"), m_ui.openBiosSearchDirectory,
|
||||
m_ui.resetBiosSearchDirectory, "BIOS", "SearchDirectory",
|
||||
Path::Combine(EmuFolders::DataRoot, "bios"));
|
||||
|
||||
refreshBiosList();
|
||||
|
||||
|
|
Loading…
Reference in New Issue