Duckstation/src/duckstation-qt/gamelistwidget.h

90 lines
2.3 KiB
C
Raw Normal View History

2019-12-31 06:17:17 +00:00
#pragma once
2020-09-23 14:02:13 +00:00
#include <QtWidgets/QListView>
2019-12-31 06:17:17 +00:00
#include <QtWidgets/QStackedWidget>
#include <QtWidgets/QTableView>
class GameList;
struct GameListEntry;
2019-12-31 06:17:17 +00:00
class GameListModel;
2020-01-08 05:01:04 +00:00
class GameListSortModel;
2019-12-31 06:17:17 +00:00
class QtHostInterface;
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);
};
2019-12-31 06:17:17 +00:00
class GameListWidget : public QStackedWidget
{
Q_OBJECT
public:
GameListWidget(QWidget* parent = nullptr);
~GameListWidget();
void initialize(QtHostInterface* host_interface);
2020-09-23 14:02:13 +00:00
bool isShowingGameList() const;
bool isShowingGameGrid() const;
bool getShowGridCoverTitles() const;
const GameListEntry* getSelectedEntry() const;
2019-12-31 06:17:17 +00:00
Q_SIGNALS:
void entrySelected(const GameListEntry* entry);
void entryDoubleClicked(const GameListEntry* entry);
void entryContextMenuRequested(const QPoint& point, const GameListEntry* entry);
2019-12-31 06:17:17 +00:00
private Q_SLOTS:
void onGameListRefreshed();
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);
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();
void refreshGridCovers();
2019-12-31 06:17:17 +00:00
protected:
void resizeEvent(QResizeEvent* event);
private:
void resizeTableViewColumnsToFit();
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();
2019-12-31 06:17:17 +00:00
QtHostInterface* m_host_interface = nullptr;
GameList* m_game_list = nullptr;
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;
2019-12-31 06:17:17 +00:00
};