Duckstation/src/duckstation-qt/gamelistwidget.h

55 lines
1.5 KiB
C
Raw Normal View History

2019-12-31 06:17:17 +00:00
#pragma once
#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;
class GameListWidget : public QStackedWidget
{
Q_OBJECT
public:
GameListWidget(QWidget* parent = nullptr);
~GameListWidget();
void initialize(QtHostInterface* host_interface);
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 onTableViewItemDoubleClicked(const QModelIndex& index);
void onTableViewContextMenuRequested(const QPoint& point);
void onTableViewHeaderContextMenuRequested(const QPoint& point);
void onTableViewHeaderSortIndicatorChanged(int, Qt::SortOrder);
2019-12-31 06:17:17 +00:00
protected:
void resizeEvent(QResizeEvent* event);
private:
const GameListEntry* getSelectedEntry() const;
void resizeTableViewColumnsToFit();
void loadTableViewColumnVisibilitySettings();
void saveTableViewColumnVisibilitySettings();
void saveTableViewColumnVisibilitySettings(int column);
void loadTableViewColumnSortSettings();
void saveTableViewColumnSortSettings();
2019-12-31 06:17:17 +00:00
QtHostInterface* m_host_interface = nullptr;
GameList* m_game_list = nullptr;
GameListModel* m_table_model = nullptr;
2020-01-08 05:01:04 +00:00
GameListSortModel* m_table_sort_model = nullptr;
2019-12-31 06:17:17 +00:00
QTableView* m_table_view = nullptr;
};