Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #9450 from Filoppi/patch-12
Qt: Fix stock input profiles being deletable
  • Loading branch information
leoetlino committed Jan 27, 2021
2 parents 920dd81 + c1ab89c commit 42b55e8
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp
Expand Up @@ -16,6 +16,7 @@

#include "Core/Core.h"

#include "Common/CommonPaths.h"
#include "Common/FileSearch.h"
#include "Common/FileUtil.h"
#include "Common/IniFile.h"
Expand Down Expand Up @@ -195,7 +196,9 @@ void MappingWindow::UpdateProfileButtonState()
if (m_profiles_combo->findText(m_profiles_combo->currentText()) != -1)
{
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);
Expand Down Expand Up @@ -459,7 +462,8 @@ void MappingWindow::PopulateProfileSelection()
{
std::string basename;
SplitPath(filename, nullptr, &basename, nullptr);
m_profiles_combo->addItem(QString::fromStdString(basename), QString::fromStdString(filename));
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->insertSeparator(m_profiles_combo->count());
Expand All @@ -470,9 +474,12 @@ void MappingWindow::PopulateProfileSelection()
{
std::string basename;
SplitPath(filename, nullptr, &basename, nullptr);
// i18n: "Stock" refers to input profiles included with Dolphin
m_profiles_combo->addItem(tr("%1 (Stock)").arg(QString::fromStdString(basename)),
QString::fromStdString(filename));
if (!basename.empty())
{
// i18n: "Stock" refers to input profiles included with Dolphin
m_profiles_combo->addItem(tr("%1 (Stock)").arg(QString::fromStdString(basename)),
QString::fromStdString(filename));
}
}

m_profiles_combo->setCurrentIndex(-1);
Expand Down

0 comments on commit 42b55e8

Please sign in to comment.