mirror of
https://github.com/stenzek/duckstation.git
synced 2025-07-13 21:50:09 +00:00
Qt: Always connect the open folder button (#3472)
And make the line edit read-only instead of disabling it.
This commit is contained in:
parent
fb7772871c
commit
3f7e5ca1cb
@ -1367,10 +1367,20 @@ static inline void BindWidgetToFolderSetting(SettingsInterface* sif, QLineEdit*
|
|||||||
current_path = Path::Canonicalize(Path::Combine(EmuFolders::DataRoot, current_path));
|
current_path = Path::Canonicalize(Path::Combine(EmuFolders::DataRoot, current_path));
|
||||||
const QString value(QString::fromStdString(current_path));
|
const QString value(QString::fromStdString(current_path));
|
||||||
Accessor::setStringValue(widget, value);
|
Accessor::setStringValue(widget, value);
|
||||||
// if we're doing per-game settings, disable the widget, we only allow folder changes in the base config
|
|
||||||
|
if (open_button)
|
||||||
|
{
|
||||||
|
QObject::connect(open_button, &QAbstractButton::clicked, open_button, [widget]() {
|
||||||
|
QString path(Accessor::getStringValue(widget));
|
||||||
|
if (!path.isEmpty())
|
||||||
|
QtUtils::OpenURL(QtUtils::GetRootWidget(widget), QUrl::fromLocalFile(path));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we're doing per-game settings, disable editing, we only allow folder changes in the base config
|
||||||
if (sif)
|
if (sif)
|
||||||
{
|
{
|
||||||
widget->setEnabled(false);
|
widget->setReadOnly(true);
|
||||||
if (browse_button)
|
if (browse_button)
|
||||||
browse_button->setEnabled(false);
|
browse_button->setEnabled(false);
|
||||||
if (reset_button)
|
if (reset_button)
|
||||||
@ -1436,14 +1446,6 @@ static inline void BindWidgetToFolderSetting(SettingsInterface* sif, QLineEdit*
|
|||||||
value_changed();
|
value_changed();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (open_button)
|
|
||||||
{
|
|
||||||
QObject::connect(open_button, &QAbstractButton::clicked, open_button, [widget]() {
|
|
||||||
QString path(Accessor::getStringValue(widget));
|
|
||||||
if (!path.isEmpty())
|
|
||||||
QtUtils::OpenURL(QtUtils::GetRootWidget(widget), QUrl::fromLocalFile(path));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (reset_button)
|
if (reset_button)
|
||||||
{
|
{
|
||||||
QObject::connect(reset_button, &QAbstractButton::clicked, reset_button,
|
QObject::connect(reset_button, &QAbstractButton::clicked, reset_button,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user