1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
// Copyright 2015 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <QLabel>
#include <QListView>
#include <QSortFilterProxyModel>
#include <QStackedWidget>
#include <QTableView>
#include "DolphinQt2/GameList/GameFile.h"
#include "DolphinQt2/GameList/GameListModel.h"
class TableDelegate;
class GameList final : public QStackedWidget
{
Q_OBJECT
public:
explicit GameList(QWidget* parent = nullptr);
QString GetSelectedGame() const;
public slots:
void SetTableView() { SetPreferredView(true); }
void SetListView() { SetPreferredView(false); }
void SetViewColumn(int col, bool view) { m_table->setColumnHidden(col, !view); }
private slots:
void ShowContextMenu(const QPoint&);
void OpenWiki();
void SetDefaultISO();
signals:
void GameSelected();
void DirectoryAdded(const QString& dir);
void DirectoryRemoved(const QString& dir);
private:
void MakeTableView();
void MakeListView();
void MakeEmptyView();
// We only have two views, just use a bool to distinguish.
void SetPreferredView(bool table);
void ConsiderViewChange();
GameListModel* m_model;
TableDelegate* m_delegate;
QSortFilterProxyModel* m_table_proxy;
QSortFilterProxyModel* m_list_proxy;
QListView* m_list;
QTableView* m_table;
QLabel* m_empty;
bool m_prefer_table;
protected:
void keyReleaseEvent(QKeyEvent* event) override;
};
|