Address more trivial review comments
This commit is contained in:
parent
7a8f484020
commit
dfec9c9a43
|
@ -83,7 +83,7 @@ void GameListSearchField::setFilterResult(int visible, int total) {
|
|||
label_filter_result->setText(tr("%1 of %n result(s)", "", total).arg(visible));
|
||||
}
|
||||
|
||||
QString GameList::getLastFilterResultItem() {
|
||||
QString GameList::getLastFilterResultItem() const {
|
||||
QStandardItem* folder;
|
||||
QStandardItem* child;
|
||||
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++) {
|
||||
const QStandardItem* child = item_model->invisibleRootItem()->child(i);
|
||||
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();
|
||||
int children_total = 0;
|
||||
for (int i = 0; i < folder_count; ++i) {
|
||||
int children_count = item_model->item(i, 0)->rowCount();
|
||||
for (int j = 0; j < children_count; ++j) {
|
||||
++children_total;
|
||||
}
|
||||
children_total += item_model->item(i, 0)->rowCount();
|
||||
}
|
||||
search_field->setFilterResult(children_total, children_total);
|
||||
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
|
||||
UISettings::values.game_dirs.swap(
|
||||
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)
|
||||
.value<UISettings::GameDir*>()));
|
||||
// move the treeview items
|
||||
|
@ -673,9 +670,7 @@ void GameList::RefreshGameDirectory() {
|
|||
}
|
||||
|
||||
GameListPlaceholder::GameListPlaceholder(GMainWindow* parent) : QWidget{parent} {
|
||||
this->main_window = parent;
|
||||
|
||||
connect(main_window, &GMainWindow::UpdateThemedIcons, this,
|
||||
connect(parent, &GMainWindow::UpdateThemedIcons, this,
|
||||
&GameListPlaceholder::onUpdateThemedIcons);
|
||||
|
||||
layout = new QVBoxLayout;
|
||||
|
@ -684,7 +679,7 @@ GameListPlaceholder::GameListPlaceholder(GMainWindow* parent) : QWidget{parent}
|
|||
layout->setAlignment(Qt::AlignCenter);
|
||||
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();
|
||||
font.setPointSize(20);
|
||||
text->setFont(font);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QList>
|
||||
#include <QModelIndex>
|
||||
#include <QSettings>
|
||||
#include <QStandardItem>
|
||||
|
@ -24,8 +25,6 @@
|
|||
|
||||
class GameListWorker;
|
||||
class GameListSearchField;
|
||||
template <typename>
|
||||
class QList;
|
||||
class GameListDir;
|
||||
class GMainWindow;
|
||||
|
||||
|
@ -56,11 +55,11 @@ public:
|
|||
FileSys::ManualContentProvider* provider, GMainWindow* parent = nullptr);
|
||||
~GameList() override;
|
||||
|
||||
QString getLastFilterResultItem();
|
||||
QString getLastFilterResultItem() const;
|
||||
void clearFilter();
|
||||
void setFilterFocus();
|
||||
void setFilterVisible(bool visibility);
|
||||
bool isEmpty();
|
||||
bool isEmpty() const;
|
||||
|
||||
void LoadCompatibilityList();
|
||||
void PopulateAsync(QList<UISettings::GameDir>& game_dirs);
|
||||
|
@ -135,7 +134,6 @@ protected:
|
|||
void mouseDoubleClickEvent(QMouseEvent* event) override;
|
||||
|
||||
private:
|
||||
GMainWindow* main_window = nullptr;
|
||||
QVBoxLayout* layout = nullptr;
|
||||
QLabel* image = nullptr;
|
||||
QLabel* text = nullptr;
|
||||
|
|
|
@ -228,13 +228,13 @@ public:
|
|||
.pixmap(icon_size)
|
||||
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
||||
Qt::DecorationRole);
|
||||
setData("Installed Titles", Qt::DisplayRole);
|
||||
setData(QObject::tr("Installed Titles"), Qt::DisplayRole);
|
||||
break;
|
||||
case GameListItemType::SystemDir:
|
||||
setData(QIcon::fromTheme("chip").pixmap(icon_size).scaled(
|
||||
icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
||||
Qt::DecorationRole);
|
||||
setData("System Titles", Qt::DisplayRole);
|
||||
setData(QObject::tr("System Titles"), Qt::DisplayRole);
|
||||
break;
|
||||
case GameListItemType::CustomDir:
|
||||
const QString icon_name = QFileInfo::exists(game_dir->path)
|
||||
|
@ -266,7 +266,7 @@ public:
|
|||
.pixmap(icon_size)
|
||||
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
||||
Qt::DecorationRole);
|
||||
setData("Add New Game Directory", Qt::DisplayRole);
|
||||
setData(QObject::tr("Add New Game Directory"), Qt::DisplayRole);
|
||||
}
|
||||
|
||||
int type() const override {
|
||||
|
@ -292,9 +292,6 @@ public:
|
|||
void clear();
|
||||
void setFocus();
|
||||
|
||||
int visible;
|
||||
int total;
|
||||
|
||||
private:
|
||||
class KeyReleaseEater : public QObject {
|
||||
public:
|
||||
|
@ -308,6 +305,9 @@ private:
|
|||
// EventFilter in order to process systemkeys while editing the searchfield
|
||||
bool eventFilter(QObject* obj, QEvent* event) override;
|
||||
};
|
||||
int visible;
|
||||
int total;
|
||||
|
||||
QHBoxLayout* layout_filter = nullptr;
|
||||
QTreeView* tree_view = nullptr;
|
||||
QLabel* label_filter = nullptr;
|
||||
|
|
|
@ -1314,10 +1314,10 @@ void GMainWindow::OnGameListOpenDirectory(const QString& directory) {
|
|||
if (directory == QStringLiteral("INSTALLED")) {
|
||||
// TODO: Find a better solution when installing files to the SD card gets implemented
|
||||
path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
|
||||
std::string("user/Contents/registered"));
|
||||
"user/Contents/registered");
|
||||
} else if (directory == QStringLiteral("SYSTEM")) {
|
||||
path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir).c_str() +
|
||||
std::string("system/Contents/registered"));
|
||||
path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
|
||||
"system/Contents/registered");
|
||||
} else {
|
||||
path = directory;
|
||||
}
|
||||
|
|
Reference in New Issue