Merge pull request #8580 from AlexApps99/master

DolphinQt: Add "File Path" column to Game Grid
This commit is contained in:
spycrab 2020-03-06 08:22:44 +01:00 committed by GitHub
commit dcaabcac03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 0 deletions

View File

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

View File

@ -268,6 +268,7 @@ struct SConfig
bool m_showTitleColumn;
bool m_showMakerColumn;
bool m_showFileNameColumn;
bool m_showFilePathColumn;
bool m_showIDColumn;
bool m_showRegionColumn;
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_SIZE, QHeaderView::Fixed);
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);
// 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_FILE_NAME,
!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);
}
@ -908,6 +911,7 @@ void GameList::OnColumnVisibilityToggled(const QString& row, bool visible)
{tr("Description"), GameListModel::COL_DESCRIPTION},
{tr("Maker"), GameListModel::COL_MAKER},
{tr("File Name"), GameListModel::COL_FILE_NAME},
{tr("File Path"), GameListModel::COL_FILE_PATH},
{tr("Game ID"), GameListModel::COL_ID},
{tr("Region"), GameListModel::COL_COUNTRY},
{tr("File Size"), GameListModel::COL_SIZE},

View File

@ -4,6 +4,8 @@
#include "DolphinQt/GameList/GameListModel.h"
#include <QDir>
#include <QFileInfo>
#include <QPixmap>
#include "Core/ConfigManager.h"
@ -140,6 +142,15 @@ QVariant GameListModel::data(const QModelIndex& index, int role) const
if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole)
return QString::fromStdString(game.GetFileName());
break;
case COL_FILE_PATH:
if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole)
{
QString file_path = QFileInfo(QString::fromStdString(game.GetFilePath())).canonicalPath();
if (!file_path.endsWith(QDir::separator()))
file_path.append(QDir::separator());
return file_path;
}
break;
case COL_SIZE:
if (role == Qt::DisplayRole)
{
@ -186,6 +197,8 @@ QVariant GameListModel::headerData(int section, Qt::Orientation orientation, int
return tr("Maker");
case COL_FILE_NAME:
return tr("File Name");
case COL_FILE_PATH:
return tr("File Path");
case COL_SIZE:
return tr("Size");
case COL_TAGS:

View File

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

View File

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