mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-23 08:50:57 +01:00
Address more trivial review comments
This commit is contained in:
parent
7a8f484020
commit
dfec9c9a43
4 changed files with 18 additions and 25 deletions
|
@ -83,7 +83,7 @@ void GameListSearchField::setFilterResult(int visible, int total) {
|
||||||
label_filter_result->setText(tr("%1 of %n result(s)", "", total).arg(visible));
|
label_filter_result->setText(tr("%1 of %n result(s)", "", total).arg(visible));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GameList::getLastFilterResultItem() {
|
QString GameList::getLastFilterResultItem() const {
|
||||||
QStandardItem* folder;
|
QStandardItem* folder;
|
||||||
QStandardItem* child;
|
QStandardItem* child;
|
||||||
QString file_path;
|
QString file_path;
|
||||||
|
@ -389,7 +389,7 @@ void GameList::ValidateEntry(const QModelIndex& item) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameList::isEmpty() {
|
bool GameList::isEmpty() const {
|
||||||
for (int i = 0; i < item_model->rowCount(); i++) {
|
for (int i = 0; i < item_model->rowCount(); i++) {
|
||||||
const QStandardItem* child = item_model->invisibleRootItem()->child(i);
|
const QStandardItem* child = item_model->invisibleRootItem()->child(i);
|
||||||
const auto type = static_cast<GameListItemType>(child->type());
|
const auto type = static_cast<GameListItemType>(child->type());
|
||||||
|
@ -426,10 +426,7 @@ void GameList::DonePopulating(QStringList watch_list) {
|
||||||
const int folder_count = tree_view->model()->rowCount();
|
const int folder_count = tree_view->model()->rowCount();
|
||||||
int children_total = 0;
|
int children_total = 0;
|
||||||
for (int i = 0; i < folder_count; ++i) {
|
for (int i = 0; i < folder_count; ++i) {
|
||||||
int children_count = item_model->item(i, 0)->rowCount();
|
children_total += item_model->item(i, 0)->rowCount();
|
||||||
for (int j = 0; j < children_count; ++j) {
|
|
||||||
++children_total;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
search_field->setFilterResult(children_total, children_total);
|
search_field->setFilterResult(children_total, children_total);
|
||||||
if (children_total > 0) {
|
if (children_total > 0) {
|
||||||
|
@ -546,7 +543,7 @@ void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) {
|
||||||
// find the indices of the items in settings and swap them
|
// find the indices of the items in settings and swap them
|
||||||
UISettings::values.game_dirs.swap(
|
UISettings::values.game_dirs.swap(
|
||||||
UISettings::values.game_dirs.indexOf(game_dir),
|
UISettings::values.game_dirs.indexOf(game_dir),
|
||||||
UISettings::values.game_dirs.indexOf(*selected.sibling(selected.row() + 1, 0)
|
UISettings::values.game_dirs.indexOf(*selected.sibling(row + 1, 0)
|
||||||
.data(GameListDir::GameDirRole)
|
.data(GameListDir::GameDirRole)
|
||||||
.value<UISettings::GameDir*>()));
|
.value<UISettings::GameDir*>()));
|
||||||
// move the treeview items
|
// move the treeview items
|
||||||
|
@ -673,9 +670,7 @@ void GameList::RefreshGameDirectory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
GameListPlaceholder::GameListPlaceholder(GMainWindow* parent) : QWidget{parent} {
|
GameListPlaceholder::GameListPlaceholder(GMainWindow* parent) : QWidget{parent} {
|
||||||
this->main_window = parent;
|
connect(parent, &GMainWindow::UpdateThemedIcons, this,
|
||||||
|
|
||||||
connect(main_window, &GMainWindow::UpdateThemedIcons, this,
|
|
||||||
&GameListPlaceholder::onUpdateThemedIcons);
|
&GameListPlaceholder::onUpdateThemedIcons);
|
||||||
|
|
||||||
layout = new QVBoxLayout;
|
layout = new QVBoxLayout;
|
||||||
|
@ -684,7 +679,7 @@ GameListPlaceholder::GameListPlaceholder(GMainWindow* parent) : QWidget{parent}
|
||||||
layout->setAlignment(Qt::AlignCenter);
|
layout->setAlignment(Qt::AlignCenter);
|
||||||
image->setPixmap(QIcon::fromTheme(QStringLiteral("plus_folder")).pixmap(200));
|
image->setPixmap(QIcon::fromTheme(QStringLiteral("plus_folder")).pixmap(200));
|
||||||
|
|
||||||
text->setText(tr("Double-click to add a new folder to the game list "));
|
text->setText(tr("Double-click to add a new folder to the game list"));
|
||||||
QFont font = text->font();
|
QFont font = text->font();
|
||||||
font.setPointSize(20);
|
font.setPointSize(20);
|
||||||
text->setFont(font);
|
text->setFont(font);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
#include <QList>
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QStandardItem>
|
#include <QStandardItem>
|
||||||
|
@ -24,8 +25,6 @@
|
||||||
|
|
||||||
class GameListWorker;
|
class GameListWorker;
|
||||||
class GameListSearchField;
|
class GameListSearchField;
|
||||||
template <typename>
|
|
||||||
class QList;
|
|
||||||
class GameListDir;
|
class GameListDir;
|
||||||
class GMainWindow;
|
class GMainWindow;
|
||||||
|
|
||||||
|
@ -56,11 +55,11 @@ public:
|
||||||
FileSys::ManualContentProvider* provider, GMainWindow* parent = nullptr);
|
FileSys::ManualContentProvider* provider, GMainWindow* parent = nullptr);
|
||||||
~GameList() override;
|
~GameList() override;
|
||||||
|
|
||||||
QString getLastFilterResultItem();
|
QString getLastFilterResultItem() const;
|
||||||
void clearFilter();
|
void clearFilter();
|
||||||
void setFilterFocus();
|
void setFilterFocus();
|
||||||
void setFilterVisible(bool visibility);
|
void setFilterVisible(bool visibility);
|
||||||
bool isEmpty();
|
bool isEmpty() const;
|
||||||
|
|
||||||
void LoadCompatibilityList();
|
void LoadCompatibilityList();
|
||||||
void PopulateAsync(QList<UISettings::GameDir>& game_dirs);
|
void PopulateAsync(QList<UISettings::GameDir>& game_dirs);
|
||||||
|
@ -135,7 +134,6 @@ protected:
|
||||||
void mouseDoubleClickEvent(QMouseEvent* event) override;
|
void mouseDoubleClickEvent(QMouseEvent* event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GMainWindow* main_window = nullptr;
|
|
||||||
QVBoxLayout* layout = nullptr;
|
QVBoxLayout* layout = nullptr;
|
||||||
QLabel* image = nullptr;
|
QLabel* image = nullptr;
|
||||||
QLabel* text = nullptr;
|
QLabel* text = nullptr;
|
||||||
|
|
|
@ -228,13 +228,13 @@ public:
|
||||||
.pixmap(icon_size)
|
.pixmap(icon_size)
|
||||||
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
||||||
Qt::DecorationRole);
|
Qt::DecorationRole);
|
||||||
setData("Installed Titles", Qt::DisplayRole);
|
setData(QObject::tr("Installed Titles"), Qt::DisplayRole);
|
||||||
break;
|
break;
|
||||||
case GameListItemType::SystemDir:
|
case GameListItemType::SystemDir:
|
||||||
setData(QIcon::fromTheme("chip").pixmap(icon_size).scaled(
|
setData(QIcon::fromTheme("chip").pixmap(icon_size).scaled(
|
||||||
icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
||||||
Qt::DecorationRole);
|
Qt::DecorationRole);
|
||||||
setData("System Titles", Qt::DisplayRole);
|
setData(QObject::tr("System Titles"), Qt::DisplayRole);
|
||||||
break;
|
break;
|
||||||
case GameListItemType::CustomDir:
|
case GameListItemType::CustomDir:
|
||||||
const QString icon_name = QFileInfo::exists(game_dir->path)
|
const QString icon_name = QFileInfo::exists(game_dir->path)
|
||||||
|
@ -266,7 +266,7 @@ public:
|
||||||
.pixmap(icon_size)
|
.pixmap(icon_size)
|
||||||
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
||||||
Qt::DecorationRole);
|
Qt::DecorationRole);
|
||||||
setData("Add New Game Directory", Qt::DisplayRole);
|
setData(QObject::tr("Add New Game Directory"), Qt::DisplayRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
int type() const override {
|
int type() const override {
|
||||||
|
@ -292,9 +292,6 @@ public:
|
||||||
void clear();
|
void clear();
|
||||||
void setFocus();
|
void setFocus();
|
||||||
|
|
||||||
int visible;
|
|
||||||
int total;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class KeyReleaseEater : public QObject {
|
class KeyReleaseEater : public QObject {
|
||||||
public:
|
public:
|
||||||
|
@ -308,6 +305,9 @@ private:
|
||||||
// EventFilter in order to process systemkeys while editing the searchfield
|
// EventFilter in order to process systemkeys while editing the searchfield
|
||||||
bool eventFilter(QObject* obj, QEvent* event) override;
|
bool eventFilter(QObject* obj, QEvent* event) override;
|
||||||
};
|
};
|
||||||
|
int visible;
|
||||||
|
int total;
|
||||||
|
|
||||||
QHBoxLayout* layout_filter = nullptr;
|
QHBoxLayout* layout_filter = nullptr;
|
||||||
QTreeView* tree_view = nullptr;
|
QTreeView* tree_view = nullptr;
|
||||||
QLabel* label_filter = nullptr;
|
QLabel* label_filter = nullptr;
|
||||||
|
|
|
@ -1314,10 +1314,10 @@ void GMainWindow::OnGameListOpenDirectory(const QString& directory) {
|
||||||
if (directory == QStringLiteral("INSTALLED")) {
|
if (directory == QStringLiteral("INSTALLED")) {
|
||||||
// TODO: Find a better solution when installing files to the SD card gets implemented
|
// TODO: Find a better solution when installing files to the SD card gets implemented
|
||||||
path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
|
path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
|
||||||
std::string("user/Contents/registered"));
|
"user/Contents/registered");
|
||||||
} else if (directory == QStringLiteral("SYSTEM")) {
|
} else if (directory == QStringLiteral("SYSTEM")) {
|
||||||
path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir).c_str() +
|
path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
|
||||||
std::string("system/Contents/registered"));
|
"system/Contents/registered");
|
||||||
} else {
|
} else {
|
||||||
path = directory;
|
path = directory;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue