mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Merge pull request #9450 from Filoppi/patch-12
Qt: Fix stock input profiles being deletable
This commit is contained in:
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
|
|
||||||
|
#include "Common/CommonPaths.h"
|
||||||
#include "Common/FileSearch.h"
|
#include "Common/FileSearch.h"
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Common/IniFile.h"
|
#include "Common/IniFile.h"
|
||||||
@ -195,7 +196,9 @@ void MappingWindow::UpdateProfileButtonState()
|
|||||||
if (m_profiles_combo->findText(m_profiles_combo->currentText()) != -1)
|
if (m_profiles_combo->findText(m_profiles_combo->currentText()) != -1)
|
||||||
{
|
{
|
||||||
const QString profile_path = m_profiles_combo->currentData().toString();
|
const QString profile_path = m_profiles_combo->currentData().toString();
|
||||||
builtin = profile_path.startsWith(QString::fromStdString(File::GetSysDirectory()));
|
std::string sys_dir = File::GetSysDirectory();
|
||||||
|
sys_dir = ReplaceAll(sys_dir, "\\", DIR_SEP);
|
||||||
|
builtin = profile_path.startsWith(QString::fromStdString(sys_dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_profiles_save->setEnabled(!builtin);
|
m_profiles_save->setEnabled(!builtin);
|
||||||
@ -459,6 +462,7 @@ void MappingWindow::PopulateProfileSelection()
|
|||||||
{
|
{
|
||||||
std::string basename;
|
std::string basename;
|
||||||
SplitPath(filename, nullptr, &basename, nullptr);
|
SplitPath(filename, nullptr, &basename, nullptr);
|
||||||
|
if (!basename.empty()) // Ignore files with an empty name to avoid multiple problems
|
||||||
m_profiles_combo->addItem(QString::fromStdString(basename), QString::fromStdString(filename));
|
m_profiles_combo->addItem(QString::fromStdString(basename), QString::fromStdString(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,10 +474,13 @@ void MappingWindow::PopulateProfileSelection()
|
|||||||
{
|
{
|
||||||
std::string basename;
|
std::string basename;
|
||||||
SplitPath(filename, nullptr, &basename, nullptr);
|
SplitPath(filename, nullptr, &basename, nullptr);
|
||||||
|
if (!basename.empty())
|
||||||
|
{
|
||||||
// i18n: "Stock" refers to input profiles included with Dolphin
|
// i18n: "Stock" refers to input profiles included with Dolphin
|
||||||
m_profiles_combo->addItem(tr("%1 (Stock)").arg(QString::fromStdString(basename)),
|
m_profiles_combo->addItem(tr("%1 (Stock)").arg(QString::fromStdString(basename)),
|
||||||
QString::fromStdString(filename));
|
QString::fromStdString(filename));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_profiles_combo->setCurrentIndex(-1);
|
m_profiles_combo->setCurrentIndex(-1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user