Skip to content

Commit

Permalink
Use lootGameName() and displayGameName() in initial places. (#2030)
Browse files Browse the repository at this point in the history
* 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.
* Use game display name in status bar.
  • Loading branch information
Holt59 committed May 26, 2024
1 parent fa82d1c commit b68f476
Show file tree
Hide file tree
Showing 5 changed files with 267 additions and 285 deletions.
32 changes: 18 additions & 14 deletions src/createinstancedialogpages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ 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 +389,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 +418,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 +470,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 +571,8 @@ 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,9 +669,10 @@ 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())
: QObject::tr("Use this folder"),
QObject::tr("I know what I'm doing"), QMessageBox::Ignore})
.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})
.exec();

Expand All @@ -688,8 +691,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 +714,12 @@ 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 b68f476

Please sign in to comment.