Add path to File Name column of game grid

Fixes https://bugs.dolphin-emu.org/issues/10567
This commit is contained in:
AlexApps99 2020-01-24 20:56:38 +13:00
parent 1add30994b
commit 7408c388d6
6 changed files with 32 additions and 0 deletions

View File

@ -188,6 +188,7 @@ void SConfig::SaveGameListSettings(IniFile& ini)
gamelist->Set("ColumnTitle", m_showTitleColumn); gamelist->Set("ColumnTitle", m_showTitleColumn);
gamelist->Set("ColumnNotes", m_showMakerColumn); gamelist->Set("ColumnNotes", m_showMakerColumn);
gamelist->Set("ColumnFileName", m_showFileNameColumn); gamelist->Set("ColumnFileName", m_showFileNameColumn);
gamelist->Set("ColumnFilePath", m_showFilePathColumn);
gamelist->Set("ColumnID", m_showIDColumn); gamelist->Set("ColumnID", m_showIDColumn);
gamelist->Set("ColumnRegion", m_showRegionColumn); gamelist->Set("ColumnRegion", m_showRegionColumn);
gamelist->Set("ColumnSize", m_showSizeColumn); gamelist->Set("ColumnSize", m_showSizeColumn);
@ -464,6 +465,7 @@ void SConfig::LoadGameListSettings(IniFile& ini)
gamelist->Get("ColumnTitle", &m_showTitleColumn, true); gamelist->Get("ColumnTitle", &m_showTitleColumn, true);
gamelist->Get("ColumnNotes", &m_showMakerColumn, true); gamelist->Get("ColumnNotes", &m_showMakerColumn, true);
gamelist->Get("ColumnFileName", &m_showFileNameColumn, false); gamelist->Get("ColumnFileName", &m_showFileNameColumn, false);
gamelist->Get("ColumnFilePath", &m_showFilePathColumn, false);
gamelist->Get("ColumnID", &m_showIDColumn, false); gamelist->Get("ColumnID", &m_showIDColumn, false);
gamelist->Get("ColumnRegion", &m_showRegionColumn, true); gamelist->Get("ColumnRegion", &m_showRegionColumn, true);
gamelist->Get("ColumnSize", &m_showSizeColumn, true); gamelist->Get("ColumnSize", &m_showSizeColumn, true);

View File

@ -268,6 +268,7 @@ struct SConfig
bool m_showTitleColumn; bool m_showTitleColumn;
bool m_showMakerColumn; bool m_showMakerColumn;
bool m_showFileNameColumn; bool m_showFileNameColumn;
bool m_showFilePathColumn;
bool m_showIDColumn; bool m_showIDColumn;
bool m_showRegionColumn; bool m_showRegionColumn;
bool m_showSizeColumn; bool m_showSizeColumn;

View File

@ -145,6 +145,7 @@ void GameList::MakeListView()
hor_header->setSectionResizeMode(GameListModel::COL_COUNTRY, QHeaderView::Fixed); hor_header->setSectionResizeMode(GameListModel::COL_COUNTRY, QHeaderView::Fixed);
hor_header->setSectionResizeMode(GameListModel::COL_SIZE, QHeaderView::Fixed); hor_header->setSectionResizeMode(GameListModel::COL_SIZE, QHeaderView::Fixed);
hor_header->setSectionResizeMode(GameListModel::COL_FILE_NAME, QHeaderView::Interactive); hor_header->setSectionResizeMode(GameListModel::COL_FILE_NAME, QHeaderView::Interactive);
hor_header->setSectionResizeMode(GameListModel::COL_FILE_PATH, QHeaderView::Interactive);
hor_header->setSectionResizeMode(GameListModel::COL_TAGS, QHeaderView::Interactive); hor_header->setSectionResizeMode(GameListModel::COL_TAGS, QHeaderView::Interactive);
// There's some odd platform-specific behavior with default minimum section size // There's some odd platform-specific behavior with default minimum section size
@ -188,6 +189,8 @@ void GameList::UpdateColumnVisibility()
m_list->setColumnHidden(GameListModel::COL_SIZE, !SConfig::GetInstance().m_showSizeColumn); m_list->setColumnHidden(GameListModel::COL_SIZE, !SConfig::GetInstance().m_showSizeColumn);
m_list->setColumnHidden(GameListModel::COL_FILE_NAME, m_list->setColumnHidden(GameListModel::COL_FILE_NAME,
!SConfig::GetInstance().m_showFileNameColumn); !SConfig::GetInstance().m_showFileNameColumn);
m_list->setColumnHidden(GameListModel::COL_FILE_PATH,
!SConfig::GetInstance().m_showFilePathColumn);
m_list->setColumnHidden(GameListModel::COL_TAGS, !SConfig::GetInstance().m_showTagsColumn); m_list->setColumnHidden(GameListModel::COL_TAGS, !SConfig::GetInstance().m_showTagsColumn);
} }
@ -908,6 +911,7 @@ void GameList::OnColumnVisibilityToggled(const QString& row, bool visible)
{tr("Description"), GameListModel::COL_DESCRIPTION}, {tr("Description"), GameListModel::COL_DESCRIPTION},
{tr("Maker"), GameListModel::COL_MAKER}, {tr("Maker"), GameListModel::COL_MAKER},
{tr("File Name"), GameListModel::COL_FILE_NAME}, {tr("File Name"), GameListModel::COL_FILE_NAME},
{tr("File Path"), GameListModel::COL_FILE_PATH},
{tr("Game ID"), GameListModel::COL_ID}, {tr("Game ID"), GameListModel::COL_ID},
{tr("Region"), GameListModel::COL_COUNTRY}, {tr("Region"), GameListModel::COL_COUNTRY},
{tr("File Size"), GameListModel::COL_SIZE}, {tr("File Size"), GameListModel::COL_SIZE},

View File

@ -4,6 +4,7 @@
#include "DolphinQt/GameList/GameListModel.h" #include "DolphinQt/GameList/GameListModel.h"
#include <QDir>
#include <QPixmap> #include <QPixmap>
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
@ -140,6 +141,26 @@ QVariant GameListModel::data(const QModelIndex& index, int role) const
if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole) if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole)
return QString::fromStdString(game.GetFileName()); return QString::fromStdString(game.GetFileName());
break; break;
case COL_FILE_PATH:
if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole)
{
QString file_path = QDir::cleanPath(QString::fromStdString(game.GetFilePath()));
for (QString dir : Settings::Instance().GetPaths())
{
dir = QDir::cleanPath(dir);
if (file_path.startsWith(dir))
{
int path_index = dir.lastIndexOf(QLatin1Char('/'), -2);
if (path_index > -1)
{
file_path = file_path.mid(path_index + 1);
break;
}
}
}
return QDir::toNativeSeparators(file_path);
}
break;
case COL_SIZE: case COL_SIZE:
if (role == Qt::DisplayRole) if (role == Qt::DisplayRole)
{ {
@ -186,6 +207,8 @@ QVariant GameListModel::headerData(int section, Qt::Orientation orientation, int
return tr("Maker"); return tr("Maker");
case COL_FILE_NAME: case COL_FILE_NAME:
return tr("File Name"); return tr("File Name");
case COL_FILE_PATH:
return tr("File Path");
case COL_SIZE: case COL_SIZE:
return tr("Size"); return tr("Size");
case COL_TAGS: case COL_TAGS:

View File

@ -55,6 +55,7 @@ public:
COL_COUNTRY, COL_COUNTRY,
COL_SIZE, COL_SIZE,
COL_FILE_NAME, COL_FILE_NAME,
COL_FILE_PATH,
COL_TAGS, COL_TAGS,
NUM_COLS NUM_COLS
}; };

View File

@ -606,6 +606,7 @@ void MenuBar::AddListColumnsMenu(QMenu* view_menu)
{tr("Description"), &SConfig::GetInstance().m_showDescriptionColumn}, {tr("Description"), &SConfig::GetInstance().m_showDescriptionColumn},
{tr("Maker"), &SConfig::GetInstance().m_showMakerColumn}, {tr("Maker"), &SConfig::GetInstance().m_showMakerColumn},
{tr("File Name"), &SConfig::GetInstance().m_showFileNameColumn}, {tr("File Name"), &SConfig::GetInstance().m_showFileNameColumn},
{tr("File Path"), &SConfig::GetInstance().m_showFilePathColumn},
{tr("Game ID"), &SConfig::GetInstance().m_showIDColumn}, {tr("Game ID"), &SConfig::GetInstance().m_showIDColumn},
{tr("Region"), &SConfig::GetInstance().m_showRegionColumn}, {tr("Region"), &SConfig::GetInstance().m_showRegionColumn},
{tr("File Size"), &SConfig::GetInstance().m_showSizeColumn}, {tr("File Size"), &SConfig::GetInstance().m_showSizeColumn},