2023-12-22 11:57:49 +00:00
|
|
|
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
|
|
|
// SPDX-License-Identifier: LGPL-3.0+
|
2021-12-13 12:12:54 +00:00
|
|
|
|
|
|
|
#pragma once
|
2023-05-13 04:30:41 +00:00
|
|
|
|
2022-05-07 06:32:44 +00:00
|
|
|
#include "ui_EmptyGameListWidget.h"
|
2022-07-09 08:52:33 +00:00
|
|
|
#include "ui_GameListWidget.h"
|
2023-05-13 04:30:41 +00:00
|
|
|
|
|
|
|
#include "pcsx2/GameList.h"
|
|
|
|
|
2021-12-13 12:12:54 +00:00
|
|
|
#include <QtWidgets/QListView>
|
|
|
|
#include <QtWidgets/QTableView>
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(const GameList::Entry*);
|
|
|
|
|
|
|
|
class GameListModel;
|
|
|
|
class GameListSortModel;
|
|
|
|
class GameListRefreshThread;
|
|
|
|
|
|
|
|
class GameListGridListView : public QListView
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
GameListGridListView(QWidget* parent = nullptr);
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void zoomOut();
|
|
|
|
void zoomIn();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void wheelEvent(QWheelEvent* e);
|
|
|
|
};
|
|
|
|
|
2022-07-09 08:52:33 +00:00
|
|
|
class GameListWidget : public QWidget
|
2021-12-13 12:12:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
GameListWidget(QWidget* parent = nullptr);
|
|
|
|
~GameListWidget();
|
|
|
|
|
|
|
|
__fi GameListModel* getModel() const { return m_model; }
|
|
|
|
|
|
|
|
void initialize();
|
2022-06-04 16:13:05 +00:00
|
|
|
void resizeTableViewColumnsToFit();
|
2021-12-13 12:12:54 +00:00
|
|
|
|
|
|
|
void refresh(bool invalidate_cache);
|
2022-05-15 08:16:24 +00:00
|
|
|
void cancelRefresh();
|
2023-09-09 03:30:53 +00:00
|
|
|
void reloadThemeSpecificImages();
|
2021-12-13 12:12:54 +00:00
|
|
|
|
|
|
|
bool isShowingGameList() const;
|
|
|
|
bool isShowingGameGrid() const;
|
|
|
|
bool getShowGridCoverTitles() const;
|
|
|
|
|
|
|
|
const GameList::Entry* getSelectedEntry() const;
|
|
|
|
|
2022-12-04 08:03:30 +00:00
|
|
|
/// Rescans a single file. NOTE: Happens on UI thread.
|
|
|
|
void rescanFile(const std::string& path);
|
|
|
|
|
2021-12-13 12:12:54 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
void refreshProgress(const QString& status, int current, int total);
|
|
|
|
void refreshComplete();
|
|
|
|
|
|
|
|
void selectionChanged();
|
|
|
|
void entryActivated();
|
|
|
|
void entryContextMenuRequested(const QPoint& point);
|
|
|
|
|
2022-05-07 06:32:44 +00:00
|
|
|
void addGameDirectoryRequested();
|
2022-07-09 08:52:33 +00:00
|
|
|
void layoutChange();
|
2022-05-07 06:32:44 +00:00
|
|
|
|
2021-12-13 12:12:54 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
void onRefreshProgress(const QString& status, int current, int total);
|
|
|
|
void onRefreshComplete();
|
|
|
|
|
|
|
|
void onSelectionModelCurrentChanged(const QModelIndex& current, const QModelIndex& previous);
|
|
|
|
void onTableViewItemActivated(const QModelIndex& index);
|
|
|
|
void onTableViewContextMenuRequested(const QPoint& point);
|
|
|
|
void onTableViewHeaderContextMenuRequested(const QPoint& point);
|
|
|
|
void onTableViewHeaderSortIndicatorChanged(int, Qt::SortOrder);
|
|
|
|
void onListViewItemActivated(const QModelIndex& index);
|
|
|
|
void onListViewContextMenuRequested(const QPoint& point);
|
2023-09-09 04:02:43 +00:00
|
|
|
void onCoverScaleChanged();
|
2021-12-13 12:12:54 +00:00
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
void showGameList();
|
|
|
|
void showGameGrid();
|
|
|
|
void setShowCoverTitles(bool enabled);
|
|
|
|
void gridZoomIn();
|
|
|
|
void gridZoomOut();
|
2022-07-09 08:52:33 +00:00
|
|
|
void gridIntScale(int int_scale);
|
2021-12-13 12:12:54 +00:00
|
|
|
void refreshGridCovers();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent* event);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void loadTableViewColumnVisibilitySettings();
|
|
|
|
void saveTableViewColumnVisibilitySettings();
|
|
|
|
void saveTableViewColumnVisibilitySettings(int column);
|
|
|
|
void loadTableViewColumnSortSettings();
|
|
|
|
void saveTableViewColumnSortSettings();
|
|
|
|
void listZoom(float delta);
|
2022-07-09 08:52:33 +00:00
|
|
|
void updateToolbar();
|
|
|
|
|
|
|
|
Ui::GameListWidget m_ui;
|
2021-12-13 12:12:54 +00:00
|
|
|
|
|
|
|
GameListModel* m_model = nullptr;
|
|
|
|
GameListSortModel* m_sort_model = nullptr;
|
|
|
|
QTableView* m_table_view = nullptr;
|
|
|
|
GameListGridListView* m_list_view = nullptr;
|
|
|
|
|
2022-05-07 06:32:44 +00:00
|
|
|
QWidget* m_empty_widget = nullptr;
|
|
|
|
Ui::EmptyGameListWidget m_empty_ui;
|
|
|
|
|
2021-12-13 12:12:54 +00:00
|
|
|
GameListRefreshThread* m_refresh_thread = nullptr;
|
|
|
|
};
|