2019-12-31 06:17:17 +00:00
|
|
|
#pragma once
|
2022-07-11 13:03:29 +00:00
|
|
|
#include "frontend-common/game_list.h"
|
|
|
|
#include "ui_emptygamelistwidget.h"
|
|
|
|
#include "ui_gamelistwidget.h"
|
2020-09-23 14:02:13 +00:00
|
|
|
#include <QtWidgets/QListView>
|
2019-12-31 06:17:17 +00:00
|
|
|
#include <QtWidgets/QTableView>
|
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
Q_DECLARE_METATYPE(const GameList::Entry*);
|
2020-01-24 04:50:44 +00:00
|
|
|
|
2019-12-31 06:17:17 +00:00
|
|
|
class GameListModel;
|
2020-01-08 05:01:04 +00:00
|
|
|
class GameListSortModel;
|
2022-07-11 13:03:29 +00:00
|
|
|
class GameListRefreshThread;
|
2019-12-31 06:17:17 +00:00
|
|
|
|
2020-09-23 14:02:13 +00:00
|
|
|
class GameListGridListView : public QListView
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
GameListGridListView(QWidget* parent = nullptr);
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void zoomOut();
|
|
|
|
void zoomIn();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void wheelEvent(QWheelEvent* e);
|
|
|
|
};
|
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
class GameListWidget : public QWidget
|
2019-12-31 06:17:17 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
GameListWidget(QWidget* parent = nullptr);
|
|
|
|
~GameListWidget();
|
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
ALWAYS_INLINE GameListModel* getModel() const { return m_model; }
|
|
|
|
|
|
|
|
void initialize();
|
|
|
|
void resizeTableViewColumnsToFit();
|
2022-07-24 13:29:20 +00:00
|
|
|
void reloadCommonImages();
|
2022-07-11 13:03:29 +00:00
|
|
|
|
|
|
|
void refresh(bool invalidate_cache);
|
|
|
|
void cancelRefresh();
|
2019-12-31 06:17:17 +00:00
|
|
|
|
2020-09-23 14:02:13 +00:00
|
|
|
bool isShowingGameList() const;
|
|
|
|
bool isShowingGameGrid() const;
|
|
|
|
bool getShowGridCoverTitles() const;
|
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
const GameList::Entry* getSelectedEntry() const;
|
2020-10-13 13:20:50 +00:00
|
|
|
|
2019-12-31 06:17:17 +00:00
|
|
|
Q_SIGNALS:
|
2022-07-11 13:03:29 +00:00
|
|
|
void refreshProgress(const QString& status, int current, int total);
|
|
|
|
void refreshComplete();
|
|
|
|
|
|
|
|
void selectionChanged();
|
|
|
|
void entryActivated();
|
|
|
|
void entryContextMenuRequested(const QPoint& point);
|
|
|
|
|
|
|
|
void addGameDirectoryRequested();
|
|
|
|
void layoutChange();
|
2019-12-31 06:17:17 +00:00
|
|
|
|
|
|
|
private Q_SLOTS:
|
2022-07-11 13:03:29 +00:00
|
|
|
void onRefreshProgress(const QString& status, int current, int total);
|
|
|
|
void onRefreshComplete();
|
|
|
|
|
2020-01-24 04:49:46 +00:00
|
|
|
void onSelectionModelCurrentChanged(const QModelIndex& current, const QModelIndex& previous);
|
2020-10-03 01:58:52 +00:00
|
|
|
void onTableViewItemActivated(const QModelIndex& index);
|
2020-03-02 01:08:16 +00:00
|
|
|
void onTableViewContextMenuRequested(const QPoint& point);
|
2020-03-02 01:08:25 +00:00
|
|
|
void onTableViewHeaderContextMenuRequested(const QPoint& point);
|
2020-03-02 01:08:29 +00:00
|
|
|
void onTableViewHeaderSortIndicatorChanged(int, Qt::SortOrder);
|
2020-10-03 01:58:52 +00:00
|
|
|
void onListViewItemActivated(const QModelIndex& index);
|
2020-09-23 14:02:13 +00:00
|
|
|
void onListViewContextMenuRequested(const QPoint& point);
|
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
void showGameList();
|
|
|
|
void showGameGrid();
|
|
|
|
void setShowCoverTitles(bool enabled);
|
2020-09-23 14:08:29 +00:00
|
|
|
void gridZoomIn();
|
|
|
|
void gridZoomOut();
|
2022-07-11 13:03:29 +00:00
|
|
|
void gridIntScale(int int_scale);
|
2020-09-23 14:08:29 +00:00
|
|
|
void refreshGridCovers();
|
2019-12-31 06:17:17 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent* event);
|
|
|
|
|
|
|
|
private:
|
2020-03-02 01:08:29 +00:00
|
|
|
void loadTableViewColumnVisibilitySettings();
|
|
|
|
void saveTableViewColumnVisibilitySettings();
|
|
|
|
void saveTableViewColumnVisibilitySettings(int column);
|
|
|
|
void loadTableViewColumnSortSettings();
|
|
|
|
void saveTableViewColumnSortSettings();
|
2020-09-23 14:02:13 +00:00
|
|
|
void listZoom(float delta);
|
|
|
|
void updateListFont();
|
2022-07-11 13:03:29 +00:00
|
|
|
void updateToolbar();
|
2020-03-02 01:08:16 +00:00
|
|
|
|
2022-07-11 13:03:29 +00:00
|
|
|
Ui::GameListWidget m_ui;
|
2019-12-31 06:17:17 +00:00
|
|
|
|
2020-09-23 14:02:13 +00:00
|
|
|
GameListModel* m_model = nullptr;
|
|
|
|
GameListSortModel* m_sort_model = nullptr;
|
2019-12-31 06:17:17 +00:00
|
|
|
QTableView* m_table_view = nullptr;
|
2020-09-23 14:02:13 +00:00
|
|
|
GameListGridListView* m_list_view = nullptr;
|
2022-07-11 13:03:29 +00:00
|
|
|
|
|
|
|
QWidget* m_empty_widget = nullptr;
|
|
|
|
Ui::EmptyGameListWidget m_empty_ui;
|
|
|
|
|
|
|
|
GameListRefreshThread* m_refresh_thread = nullptr;
|
2019-12-31 06:17:17 +00:00
|
|
|
};
|