summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFearlessTobi <thm.frey@gmail.com>2020-04-06 03:12:17 +0200
committerFearlessTobi <thm.frey@gmail.com>2020-04-06 03:12:17 +0200
commit8d0fb33ac4478098b65927530cfad2a7fd808d78 (patch)
tree1922851fd2df11fd54e4227d3366ece8e107bfe5 /src
parentMerge pull request #3592 from ReinUsesLisp/ipa (diff)
downloadyuzu-8d0fb33ac4478098b65927530cfad2a7fd808d78.tar
yuzu-8d0fb33ac4478098b65927530cfad2a7fd808d78.tar.gz
yuzu-8d0fb33ac4478098b65927530cfad2a7fd808d78.tar.bz2
yuzu-8d0fb33ac4478098b65927530cfad2a7fd808d78.tar.lz
yuzu-8d0fb33ac4478098b65927530cfad2a7fd808d78.tar.xz
yuzu-8d0fb33ac4478098b65927530cfad2a7fd808d78.tar.zst
yuzu-8d0fb33ac4478098b65927530cfad2a7fd808d78.zip
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/game_list.cpp6
-rw-r--r--src/yuzu/game_list_p.h24
2 files changed, 22 insertions, 8 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index a2b88c787..dccbabcbf 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -315,7 +315,7 @@ GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvide
item_model->setHeaderData(COLUMN_FILE_TYPE - 1, Qt::Horizontal, tr("File type"));
item_model->setHeaderData(COLUMN_SIZE - 1, Qt::Horizontal, tr("Size"));
}
- item_model->setSortRole(GameListItemPath::TitleRole);
+ item_model->setSortRole(GameListItemPath::SortRole);
connect(main_window, &GMainWindow::UpdateThemedIcons, this, &GameList::onUpdateThemedIcons);
connect(tree_view, &QTreeView::activated, this, &GameList::ValidateEntry);
@@ -441,6 +441,8 @@ void GameList::DonePopulating(QStringList watch_list) {
if (children_total > 0) {
search_field->setFocus();
}
+ item_model->sort(tree_view->header()->sortIndicatorSection(),
+ tree_view->header()->sortIndicatorOrder());
}
void GameList::PopupContextMenu(const QPoint& menu_location) {
@@ -666,8 +668,6 @@ void GameList::LoadInterfaceLayout() {
// so make it as large as possible as default.
header->resizeSection(COLUMN_NAME, header->width());
}
-
- item_model->sort(header->sortIndicatorSection(), header->sortIndicatorOrder());
}
const QStringList GameList::supported_file_extensions = {
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h
index 7cde72d1b..3e6d5a7cd 100644
--- a/src/yuzu/game_list_p.h
+++ b/src/yuzu/game_list_p.h
@@ -65,10 +65,10 @@ public:
*/
class GameListItemPath : public GameListItem {
public:
- static const int TitleRole = SortRole;
- static const int FullPathRole = SortRole + 1;
- static const int ProgramIdRole = SortRole + 2;
- static const int FileTypeRole = SortRole + 3;
+ static const int TitleRole = SortRole + 1;
+ static const int FullPathRole = SortRole + 2;
+ static const int ProgramIdRole = SortRole + 3;
+ static const int FileTypeRole = SortRole + 4;
GameListItemPath() = default;
GameListItemPath(const QString& game_path, const std::vector<u8>& picture_data,
@@ -95,7 +95,7 @@ public:
}
QVariant data(int role) const override {
- if (role == Qt::DisplayRole) {
+ if (role == Qt::DisplayRole || role == SortRole) {
std::string filename;
Common::SplitPath(data(FullPathRole).toString().toStdString(), nullptr, &filename,
nullptr);
@@ -110,6 +110,9 @@ public:
const auto& row1 = row_data.at(UISettings::values.row_1_text_id);
const int row2_id = UISettings::values.row_2_text_id;
+ if (role == SortRole)
+ return row1.toLower();
+
if (row2_id == 4) // None
return row1;
@@ -123,6 +126,13 @@ public:
return GameListItem::data(role);
}
+
+ /**
+ * Override to prevent automatic sorting.
+ */
+ bool operator<(const QStandardItem& other) const override {
+ return false;
+ }
};
class GameListItemCompat : public GameListItem {
@@ -289,6 +299,10 @@ public:
int type() const override {
return static_cast<int>(GameListItemType::AddDir);
}
+
+ bool operator<(const QStandardItem& other) const override {
+ return false;
+ }
};
class GameList;