Skip to content

Commit

Permalink
Use lootGameName() and displayGameName() in initial places
Browse files Browse the repository at this point in the history
# Motivations
- ModOrganizer2/modorganizer-game_ttw#36 (comment) Surfaced desires to change the Fallout TTW plugin's gameName to something more obvious, from TTW to Tale of Two Wastelands, but that would cause existing profiles to break, `displayGameName()` added in ModOrganizer2/modorganizer-uibase#141 gives us the option to change the way the game plugin is displayed, but leaves the existing integral `gameName()` alone
- Similarly ModOrganizer2/modorganizer-game_ttw#36 attempted to fix the sort button LOOT cli argument by changing the `gameShortName()`, as 'TTW' isn't a valid option for LOOT, but that comes with some pretty concerning possible issues

# Modifications
- Use `displayGameName()` in create instance dialogs & the main window, this doesn't cover all places `gameName()` was being used for purely display reasons, but it covers the bulk
- Use `lootGameName()` instead of `gameShortName()` for LOOT cli initiation
  • Loading branch information
Twinki14 committed May 20, 2024
1 parent 5adb1ec commit 5f98c09
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 144 deletions.
24 changes: 12 additions & 12 deletions src/createinstancedialogpages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void GamePage::select(IPluginGame* game, const QString& dir)
// ask the user

const auto path = QFileDialog::getExistingDirectory(
&m_dlg, QObject::tr("Find game installation for %1").arg(game->gameName()));
&m_dlg, QObject::tr("Find game installation for %1").arg(game->displayGameName()));

if (path.isEmpty()) {
// cancelled
Expand Down Expand Up @@ -388,7 +388,7 @@ void GamePage::warnUnrecognized(const QString& path)
// put the list of supported games in the details textbox
QString supportedGames;
for (auto* game : sortedGamePlugins()) {
supportedGames += game->gameName() + "\n";
supportedGames += game->displayGameName() + "\n";
}

QMessageBox dlg(&m_dlg);
Expand Down Expand Up @@ -417,7 +417,7 @@ std::vector<IPluginGame*> GamePage::sortedGamePlugins() const

// natsort
std::sort(v.begin(), v.end(), [](auto* a, auto* b) {
return (naturalCompare(a->gameName(), b->gameName()) < 0);
return (naturalCompare(a->displayGameName(), b->displayGameName()) < 0);
});

return v;
Expand Down Expand Up @@ -469,7 +469,7 @@ void GamePage::updateButton(Game* g)
return;
}

g->button->setText(g->game->gameName().replace("&", "&&"));
g->button->setText(g->game->displayGameName().replace("&", "&&"));
g->button->setIcon(g->game->gameIcon());

if (g->installed) {
Expand Down Expand Up @@ -570,7 +570,7 @@ void GamePage::fillList()
continue;
}

if (!m_filter.matches(g->game->gameName())) {
if (!m_filter.matches(g->game->gameName()) && !m_filter.matches(g->game->displayGameName())) {
// filtered out
continue;
}
Expand Down Expand Up @@ -667,7 +667,7 @@ bool GamePage::confirmMicrosoftStore(const QString& path, IPluginGame* game)
"Organizer"
" and will not work properly.")
.arg(path))
.button({game ? QObject::tr("Use this folder for %1").arg(game->gameName())
.button({game ? QObject::tr("Use this folder for %1").arg(game->displayGameName())
: QObject::tr("Use this folder"),
QObject::tr("I know what I'm doing"), QMessageBox::Ignore})
.button({QObject::tr("Cancel"), QMessageBox::Cancel})
Expand All @@ -688,8 +688,8 @@ bool GamePage::confirmUnknown(const QString& path, IPluginGame* game)
"bold;\">%2</span> or "
"for any other game Mod Organizer can manage.")
.arg(path)
.arg(game->gameName()))
.button({QObject::tr("Use this folder for %1").arg(game->gameName()),
.arg(game->displayGameName()))
.button({QObject::tr("Use this folder for %1").arg(game->displayGameName()),
QObject::tr("I know what I'm doing"), QMessageBox::Ignore})
.button({QObject::tr("Cancel"), QMessageBox::Cancel})
.exec();
Expand All @@ -711,11 +711,11 @@ IPluginGame* GamePage::confirmOtherGame(const QString& path, IPluginGame* select
"not "
"<span style=\"white-space: nowrap; font-weight: bold;\">%3</span>.")
.arg(path)
.arg(guessedGame->gameName())
.arg(selectedGame->gameName()))
.button({QObject::tr("Manage %1 instead").arg(guessedGame->gameName()),
.arg(guessedGame->displayGameName())
.arg(selectedGame->displayGameName()))
.button({QObject::tr("Manage %1 instead").arg(guessedGame->displayGameName()),
QMessageBox::Ok})
.button({QObject::tr("Use this folder for %1").arg(selectedGame->gameName()),
.button({QObject::tr("Use this folder for %1").arg(selectedGame->displayGameName()),
QObject::tr("I know what I'm doing"), QMessageBox::Ignore})
.button({QObject::tr("Cancel"), QMessageBox::Cancel})
.exec();
Expand Down
2 changes: 1 addition & 1 deletion src/loot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ bool Loot::spawnLootcli(QWidget* parent, bool didUpdateMasterList,
const auto logLevel = m_core.settings().diagnostics().lootLogLevel();

QStringList parameters;
parameters << "--game" << m_core.managedGame()->gameShortName()
parameters << "--game" << m_core.managedGame()->lootGameName()

<< "--gamePath"
<< QString("\"%1\"").arg(
Expand Down
2 changes: 1 addition & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ void MainWindow::updateWindowTitle(const APIUserAccount& user)
{
//"\xe2\x80\x93" is an "em dash", a longer "-"
QString title = QString("%1 \xe2\x80\x93 Mod Organizer v%2")
.arg(m_OrganizerCore.managedGame()->gameName(),
.arg(m_OrganizerCore.managedGame()->displayGameName(),
m_OrganizerCore.getVersion().displayString(3));

if (!user.name().isEmpty()) {
Expand Down
Loading

0 comments on commit 5f98c09

Please sign in to comment.