UI: Massive revamp, new features and improvements

This commit is contained in:
Connor McLaughlin
2022-07-11 23:03:29 +10:00
parent 3fb61865e5
commit b42b5501f6
425 changed files with 39701 additions and 29487 deletions

View File

@@ -1,15 +1,15 @@
#pragma once
#include "frontend-common/game_list.h"
#include "ui_emptygamelistwidget.h"
#include "ui_gamelistwidget.h"
#include <QtWidgets/QListView>
#include <QtWidgets/QStackedWidget>
#include <QtWidgets/QTableView>
class GameList;
struct GameListEntry;
Q_DECLARE_METATYPE(const GameList::Entry*);
class GameListModel;
class GameListSortModel;
class QtHostInterface;
class GameListRefreshThread;
class GameListGridListView : public QListView
{
@@ -26,7 +26,7 @@ protected:
void wheelEvent(QWheelEvent* e);
};
class GameListWidget : public QStackedWidget
class GameListWidget : public QWidget
{
Q_OBJECT
@@ -34,22 +34,35 @@ public:
GameListWidget(QWidget* parent = nullptr);
~GameListWidget();
void initialize(QtHostInterface* host_interface);
ALWAYS_INLINE GameListModel* getModel() const { return m_model; }
void initialize();
void resizeTableViewColumnsToFit();
void refresh(bool invalidate_cache);
void cancelRefresh();
bool isShowingGameList() const;
bool isShowingGameGrid() const;
bool getShowGridCoverTitles() const;
const GameListEntry* getSelectedEntry() const;
const GameList::Entry* getSelectedEntry() const;
Q_SIGNALS:
void entrySelected(const GameListEntry* entry);
void entryDoubleClicked(const GameListEntry* entry);
void entryContextMenuRequested(const QPoint& point, const GameListEntry* entry);
void refreshProgress(const QString& status, int current, int total);
void refreshComplete();
void selectionChanged();
void entryActivated();
void entryContextMenuRequested(const QPoint& point);
void addGameDirectoryRequested();
void layoutChange();
private Q_SLOTS:
void onGameListRefreshed();
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);
@@ -64,13 +77,13 @@ public Q_SLOTS:
void setShowCoverTitles(bool enabled);
void gridZoomIn();
void gridZoomOut();
void gridIntScale(int int_scale);
void refreshGridCovers();
protected:
void resizeEvent(QResizeEvent* event);
private:
void resizeTableViewColumnsToFit();
void loadTableViewColumnVisibilitySettings();
void saveTableViewColumnVisibilitySettings();
void saveTableViewColumnVisibilitySettings(int column);
@@ -78,12 +91,17 @@ private:
void saveTableViewColumnSortSettings();
void listZoom(float delta);
void updateListFont();
void updateToolbar();
QtHostInterface* m_host_interface = nullptr;
GameList* m_game_list = nullptr;
Ui::GameListWidget m_ui;
GameListModel* m_model = nullptr;
GameListSortModel* m_sort_model = nullptr;
QTableView* m_table_view = nullptr;
GameListGridListView* m_list_view = nullptr;
QWidget* m_empty_widget = nullptr;
Ui::EmptyGameListWidget m_empty_ui;
GameListRefreshThread* m_refresh_thread = nullptr;
};