Qt: Implement game grid/cover view
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include <QtWidgets/QListView>
|
||||
#include <QtWidgets/QStackedWidget>
|
||||
#include <QtWidgets/QTableView>
|
||||
|
||||
@@ -10,6 +11,21 @@ class GameListSortModel;
|
||||
|
||||
class QtHostInterface;
|
||||
|
||||
class GameListGridListView : public QListView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GameListGridListView(QWidget* parent = nullptr);
|
||||
|
||||
Q_SIGNALS:
|
||||
void zoomOut();
|
||||
void zoomIn();
|
||||
|
||||
protected:
|
||||
void wheelEvent(QWheelEvent* e);
|
||||
};
|
||||
|
||||
class GameListWidget : public QStackedWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -20,6 +36,11 @@ public:
|
||||
|
||||
void initialize(QtHostInterface* host_interface);
|
||||
|
||||
bool isShowingGameList() const;
|
||||
bool isShowingGameGrid() const;
|
||||
|
||||
bool getShowGridCoverTitles() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void entrySelected(const GameListEntry* entry);
|
||||
void entryDoubleClicked(const GameListEntry* entry);
|
||||
@@ -32,6 +53,15 @@ private Q_SLOTS:
|
||||
void onTableViewContextMenuRequested(const QPoint& point);
|
||||
void onTableViewHeaderContextMenuRequested(const QPoint& point);
|
||||
void onTableViewHeaderSortIndicatorChanged(int, Qt::SortOrder);
|
||||
void onListViewItemDoubleClicked(const QModelIndex& index);
|
||||
void onListViewContextMenuRequested(const QPoint& point);
|
||||
|
||||
public Q_SLOTS:
|
||||
void showGameList();
|
||||
void showGameGrid();
|
||||
void setShowCoverTitles(bool enabled);
|
||||
void listZoomIn();
|
||||
void listZoomOut();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event);
|
||||
@@ -44,11 +74,14 @@ private:
|
||||
void saveTableViewColumnVisibilitySettings(int column);
|
||||
void loadTableViewColumnSortSettings();
|
||||
void saveTableViewColumnSortSettings();
|
||||
void listZoom(float delta);
|
||||
void updateListFont();
|
||||
|
||||
QtHostInterface* m_host_interface = nullptr;
|
||||
GameList* m_game_list = nullptr;
|
||||
|
||||
GameListModel* m_table_model = nullptr;
|
||||
GameListSortModel* m_table_sort_model = nullptr;
|
||||
GameListModel* m_model = nullptr;
|
||||
GameListSortModel* m_sort_model = nullptr;
|
||||
QTableView* m_table_view = nullptr;
|
||||
GameListGridListView* m_list_view = nullptr;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user