Skip to content

Commit

Permalink
Merge pull request dolphin-emu#8580 from AlexApps99/master
Browse files Browse the repository at this point in the history
DolphinQt: Add "File Path" column to Game Grid
  • Loading branch information
spycrab authored Mar 6, 2020
2 parents 8679f7a + 465e7c2 commit dcaabca
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Source/Core/Core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions Source/Core/DolphinQt/GameList/GameList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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},
Expand Down
13 changes: 13 additions & 0 deletions Source/Core/DolphinQt/GameList/GameListModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "DolphinQt/GameList/GameListModel.h"

#include <QDir>
#include <QFileInfo>
#include <QPixmap>

#include "Core/ConfigManager.h"
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinQt/GameList/GameListModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class GameListModel final : public QAbstractTableModel
COL_COUNTRY,
COL_SIZE,
COL_FILE_NAME,
COL_FILE_PATH,
COL_TAGS,
NUM_COLS
};
Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinQt/MenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit dcaabca

Please sign in to comment.