Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5886 from JosJuice/rename-list-table
DolphinQt2: Rename "Table"/"List" to "List View"/"Grid View"
- Loading branch information
Showing
15 changed files
with
158 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2015 Dolphin Emulator Project | ||
// Licensed under GPLv2+ | ||
// Refer to the license.txt file included. | ||
|
||
#include <QSize> | ||
|
||
#include "DolphinQt2/GameList/GameListModel.h" | ||
#include "DolphinQt2/GameList/GridProxyModel.h" | ||
|
||
const QSize LARGE_BANNER_SIZE(144, 48); | ||
|
||
GridProxyModel::GridProxyModel(QObject* parent) : QSortFilterProxyModel(parent) | ||
{ | ||
setSortCaseSensitivity(Qt::CaseInsensitive); | ||
sort(GameListModel::COL_TITLE); | ||
} | ||
|
||
QVariant GridProxyModel::data(const QModelIndex& i, int role) const | ||
{ | ||
QModelIndex source_index = mapToSource(i); | ||
if (role == Qt::DisplayRole) | ||
{ | ||
return sourceModel()->data(sourceModel()->index(source_index.row(), GameListModel::COL_TITLE), | ||
Qt::DisplayRole); | ||
} | ||
else if (role == Qt::DecorationRole) | ||
{ | ||
auto pixmap = sourceModel() | ||
->data(sourceModel()->index(source_index.row(), GameListModel::COL_BANNER), | ||
Qt::DecorationRole) | ||
.value<QPixmap>(); | ||
return pixmap.scaled(LARGE_BANNER_SIZE * pixmap.devicePixelRatio(), Qt::KeepAspectRatio, | ||
Qt::SmoothTransformation); | ||
} | ||
return QVariant(); | ||
} | ||
|
||
bool GridProxyModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const | ||
{ | ||
GameListModel* glm = qobject_cast<GameListModel*>(sourceModel()); | ||
return glm->ShouldDisplayGameListItem(source_row); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2015 Dolphin Emulator Project | ||
// Licensed under GPLv2+ | ||
// Refer to the license.txt file included. | ||
|
||
#pragma once | ||
|
||
#include <QSortFilterProxyModel> | ||
|
||
// This subclass of QSortFilterProxyModel transforms the raw data into a | ||
// single-column large icon + name to be displayed in a QListView. | ||
class GridProxyModel final : public QSortFilterProxyModel | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit GridProxyModel(QObject* parent = nullptr); | ||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; | ||
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.