summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar fearlessTobi2019-05-05 01:52:17 +0200
committerGravatar FearlessTobi2019-09-04 16:47:32 +0200
commitdfec9c9a437b7478abd8b280f6ce513da595ba73 (patch)
tree37c126892697f63d7c2a74f6df411bc7f0662396 /src
parentAddress trivial review comments (diff)
downloadyuzu-dfec9c9a437b7478abd8b280f6ce513da595ba73.tar.gz
yuzu-dfec9c9a437b7478abd8b280f6ce513da595ba73.tar.xz
yuzu-dfec9c9a437b7478abd8b280f6ce513da595ba73.zip
Address more trivial review comments
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/game_list.cpp17
-rw-r--r--src/yuzu/game_list.h8
-rw-r--r--src/yuzu/game_list_p.h12
-rw-r--r--src/yuzu/main.cpp6
4 files changed, 18 insertions, 25 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index e5627abd4..51ced635b 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -83,7 +83,7 @@ void GameListSearchField::setFilterResult(int visible, int total) {
83 label_filter_result->setText(tr("%1 of %n result(s)", "", total).arg(visible)); 83 label_filter_result->setText(tr("%1 of %n result(s)", "", total).arg(visible));
84} 84}
85 85
86QString GameList::getLastFilterResultItem() { 86QString GameList::getLastFilterResultItem() const {
87 QStandardItem* folder; 87 QStandardItem* folder;
88 QStandardItem* child; 88 QStandardItem* child;
89 QString file_path; 89 QString file_path;
@@ -389,7 +389,7 @@ void GameList::ValidateEntry(const QModelIndex& item) {
389 } 389 }
390} 390}
391 391
392bool GameList::isEmpty() { 392bool GameList::isEmpty() const {
393 for (int i = 0; i < item_model->rowCount(); i++) { 393 for (int i = 0; i < item_model->rowCount(); i++) {
394 const QStandardItem* child = item_model->invisibleRootItem()->child(i); 394 const QStandardItem* child = item_model->invisibleRootItem()->child(i);
395 const auto type = static_cast<GameListItemType>(child->type()); 395 const auto type = static_cast<GameListItemType>(child->type());
@@ -426,10 +426,7 @@ void GameList::DonePopulating(QStringList watch_list) {
426 const int folder_count = tree_view->model()->rowCount(); 426 const int folder_count = tree_view->model()->rowCount();
427 int children_total = 0; 427 int children_total = 0;
428 for (int i = 0; i < folder_count; ++i) { 428 for (int i = 0; i < folder_count; ++i) {
429 int children_count = item_model->item(i, 0)->rowCount(); 429 children_total += item_model->item(i, 0)->rowCount();
430 for (int j = 0; j < children_count; ++j) {
431 ++children_total;
432 }
433 } 430 }
434 search_field->setFilterResult(children_total, children_total); 431 search_field->setFilterResult(children_total, children_total);
435 if (children_total > 0) { 432 if (children_total > 0) {
@@ -546,7 +543,7 @@ void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) {
546 // find the indices of the items in settings and swap them 543 // find the indices of the items in settings and swap them
547 UISettings::values.game_dirs.swap( 544 UISettings::values.game_dirs.swap(
548 UISettings::values.game_dirs.indexOf(game_dir), 545 UISettings::values.game_dirs.indexOf(game_dir),
549 UISettings::values.game_dirs.indexOf(*selected.sibling(selected.row() + 1, 0) 546 UISettings::values.game_dirs.indexOf(*selected.sibling(row + 1, 0)
550 .data(GameListDir::GameDirRole) 547 .data(GameListDir::GameDirRole)
551 .value<UISettings::GameDir*>())); 548 .value<UISettings::GameDir*>()));
552 // move the treeview items 549 // move the treeview items
@@ -673,9 +670,7 @@ void GameList::RefreshGameDirectory() {
673} 670}
674 671
675GameListPlaceholder::GameListPlaceholder(GMainWindow* parent) : QWidget{parent} { 672GameListPlaceholder::GameListPlaceholder(GMainWindow* parent) : QWidget{parent} {
676 this->main_window = parent; 673 connect(parent, &GMainWindow::UpdateThemedIcons, this,
677
678 connect(main_window, &GMainWindow::UpdateThemedIcons, this,
679 &GameListPlaceholder::onUpdateThemedIcons); 674 &GameListPlaceholder::onUpdateThemedIcons);
680 675
681 layout = new QVBoxLayout; 676 layout = new QVBoxLayout;
@@ -684,7 +679,7 @@ GameListPlaceholder::GameListPlaceholder(GMainWindow* parent) : QWidget{parent}
684 layout->setAlignment(Qt::AlignCenter); 679 layout->setAlignment(Qt::AlignCenter);
685 image->setPixmap(QIcon::fromTheme(QStringLiteral("plus_folder")).pixmap(200)); 680 image->setPixmap(QIcon::fromTheme(QStringLiteral("plus_folder")).pixmap(200));
686 681
687 text->setText(tr("Double-click to add a new folder to the game list ")); 682 text->setText(tr("Double-click to add a new folder to the game list"));
688 QFont font = text->font(); 683 QFont font = text->font();
689 font.setPointSize(20); 684 font.setPointSize(20);
690 text->setFont(font); 685 text->setFont(font);
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h
index cf5bd3a39..7ed77fd9c 100644
--- a/src/yuzu/game_list.h
+++ b/src/yuzu/game_list.h
@@ -8,6 +8,7 @@
8#include <QHBoxLayout> 8#include <QHBoxLayout>
9#include <QLabel> 9#include <QLabel>
10#include <QLineEdit> 10#include <QLineEdit>
11#include <QList>
11#include <QModelIndex> 12#include <QModelIndex>
12#include <QSettings> 13#include <QSettings>
13#include <QStandardItem> 14#include <QStandardItem>
@@ -24,8 +25,6 @@
24 25
25class GameListWorker; 26class GameListWorker;
26class GameListSearchField; 27class GameListSearchField;
27template <typename>
28class QList;
29class GameListDir; 28class GameListDir;
30class GMainWindow; 29class GMainWindow;
31 30
@@ -56,11 +55,11 @@ public:
56 FileSys::ManualContentProvider* provider, GMainWindow* parent = nullptr); 55 FileSys::ManualContentProvider* provider, GMainWindow* parent = nullptr);
57 ~GameList() override; 56 ~GameList() override;
58 57
59 QString getLastFilterResultItem(); 58 QString getLastFilterResultItem() const;
60 void clearFilter(); 59 void clearFilter();
61 void setFilterFocus(); 60 void setFilterFocus();
62 void setFilterVisible(bool visibility); 61 void setFilterVisible(bool visibility);
63 bool isEmpty(); 62 bool isEmpty() const;
64 63
65 void LoadCompatibilityList(); 64 void LoadCompatibilityList();
66 void PopulateAsync(QList<UISettings::GameDir>& game_dirs); 65 void PopulateAsync(QList<UISettings::GameDir>& game_dirs);
@@ -135,7 +134,6 @@ protected:
135 void mouseDoubleClickEvent(QMouseEvent* event) override; 134 void mouseDoubleClickEvent(QMouseEvent* event) override;
136 135
137private: 136private:
138 GMainWindow* main_window = nullptr;
139 QVBoxLayout* layout = nullptr; 137 QVBoxLayout* layout = nullptr;
140 QLabel* image = nullptr; 138 QLabel* image = nullptr;
141 QLabel* text = nullptr; 139 QLabel* text = nullptr;
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h
index 13623f526..047061e6c 100644
--- a/src/yuzu/game_list_p.h
+++ b/src/yuzu/game_list_p.h
@@ -228,13 +228,13 @@ public:
228 .pixmap(icon_size) 228 .pixmap(icon_size)
229 .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), 229 .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
230 Qt::DecorationRole); 230 Qt::DecorationRole);
231 setData("Installed Titles", Qt::DisplayRole); 231 setData(QObject::tr("Installed Titles"), Qt::DisplayRole);
232 break; 232 break;
233 case GameListItemType::SystemDir: 233 case GameListItemType::SystemDir:
234 setData(QIcon::fromTheme("chip").pixmap(icon_size).scaled( 234 setData(QIcon::fromTheme("chip").pixmap(icon_size).scaled(
235 icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), 235 icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
236 Qt::DecorationRole); 236 Qt::DecorationRole);
237 setData("System Titles", Qt::DisplayRole); 237 setData(QObject::tr("System Titles"), Qt::DisplayRole);
238 break; 238 break;
239 case GameListItemType::CustomDir: 239 case GameListItemType::CustomDir:
240 const QString icon_name = QFileInfo::exists(game_dir->path) 240 const QString icon_name = QFileInfo::exists(game_dir->path)
@@ -266,7 +266,7 @@ public:
266 .pixmap(icon_size) 266 .pixmap(icon_size)
267 .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), 267 .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
268 Qt::DecorationRole); 268 Qt::DecorationRole);
269 setData("Add New Game Directory", Qt::DisplayRole); 269 setData(QObject::tr("Add New Game Directory"), Qt::DisplayRole);
270 } 270 }
271 271
272 int type() const override { 272 int type() const override {
@@ -292,9 +292,6 @@ public:
292 void clear(); 292 void clear();
293 void setFocus(); 293 void setFocus();
294 294
295 int visible;
296 int total;
297
298private: 295private:
299 class KeyReleaseEater : public QObject { 296 class KeyReleaseEater : public QObject {
300 public: 297 public:
@@ -308,6 +305,9 @@ private:
308 // EventFilter in order to process systemkeys while editing the searchfield 305 // EventFilter in order to process systemkeys while editing the searchfield
309 bool eventFilter(QObject* obj, QEvent* event) override; 306 bool eventFilter(QObject* obj, QEvent* event) override;
310 }; 307 };
308 int visible;
309 int total;
310
311 QHBoxLayout* layout_filter = nullptr; 311 QHBoxLayout* layout_filter = nullptr;
312 QTreeView* tree_view = nullptr; 312 QTreeView* tree_view = nullptr;
313 QLabel* label_filter = nullptr; 313 QLabel* label_filter = nullptr;
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 3146e054c..72c3eb069 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1314,10 +1314,10 @@ void GMainWindow::OnGameListOpenDirectory(const QString& directory) {
1314 if (directory == QStringLiteral("INSTALLED")) { 1314 if (directory == QStringLiteral("INSTALLED")) {
1315 // TODO: Find a better solution when installing files to the SD card gets implemented 1315 // TODO: Find a better solution when installing files to the SD card gets implemented
1316 path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) + 1316 path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
1317 std::string("user/Contents/registered")); 1317 "user/Contents/registered");
1318 } else if (directory == QStringLiteral("SYSTEM")) { 1318 } else if (directory == QStringLiteral("SYSTEM")) {
1319 path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir).c_str() + 1319 path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
1320 std::string("system/Contents/registered")); 1320 "system/Contents/registered");
1321 } else { 1321 } else {
1322 path = directory; 1322 path = directory;
1323 } 1323 }