GameList: Move entry to global scope so it can be forward declared

This commit is contained in:
Connor McLaughlin
2020-01-24 14:50:44 +10:00
parent 183928b0f6
commit 82b4229f1b
5 changed files with 66 additions and 48 deletions

View File

@ -1,4 +1,5 @@
#include "gamelistwidget.h"
#include "core/game_list.h"
#include "core/settings.h"
#include "qthostinterface.h"
#include "qtutils.h"
@ -52,7 +53,7 @@ public:
if (row < 0 || row >= static_cast<int>(m_game_list->GetEntryCount()))
return {};
const GameList::GameListEntry& ge = m_game_list->GetEntries()[row];
const GameListEntry& ge = m_game_list->GetEntries()[row];
switch (role)
{
@ -106,9 +107,9 @@ public:
{
switch (ge.type)
{
case GameList::EntryType::Disc:
case GameListEntryType::Disc:
return m_type_disc_pixmap;
case GameList::EntryType::PSExe:
case GameListEntryType::PSExe:
default:
return m_type_exe_pixmap;
}
@ -186,8 +187,8 @@ public:
return false;
}
const GameList::GameListEntry& left = m_game_list->GetEntries().at(left_row);
const GameList::GameListEntry& right = m_game_list->GetEntries().at(right_row);
const GameListEntry& left = m_game_list->GetEntries().at(left_row);
const GameListEntry& right = m_game_list->GetEntries().at(right_row);
return ascending ? (left.title < right.title) : (right.title < left.title);
}
@ -287,7 +288,7 @@ void GameListWidget::onTableViewItemDoubleClicked(const QModelIndex& index)
if (!source_index.isValid() || source_index.row() >= static_cast<int>(m_game_list->GetEntryCount()))
return;
const GameList::GameListEntry& entry = m_game_list->GetEntries().at(source_index.row());
const GameListEntry& entry = m_game_list->GetEntries().at(source_index.row());
emit bootEntryRequested(&entry);
}
@ -300,7 +301,7 @@ void GameListWidget::onSelectionModelCurrentChanged(const QModelIndex& current,
return;
}
const GameList::GameListEntry& entry = m_game_list->GetEntries().at(source_index.row());
const GameListEntry& entry = m_game_list->GetEntries().at(source_index.row());
emit entrySelected(&entry);
}

View File

@ -1,8 +1,10 @@
#pragma once
#include "core/game_list.h"
#include <QtWidgets/QStackedWidget>
#include <QtWidgets/QTableView>
class GameList;
struct GameListEntry;
class GameListModel;
class GameListSortModel;
@ -19,8 +21,8 @@ public:
void initialize(QtHostInterface* host_interface);
Q_SIGNALS:
void entrySelected(const GameList::GameListEntry* entry);
void bootEntryRequested(const GameList::GameListEntry* entry);
void entrySelected(const GameListEntry* entry);
void bootEntryRequested(const GameListEntry* entry);
private Q_SLOTS:
void onGameListRefreshed();

View File

@ -293,7 +293,7 @@ void MainWindow::connectSignals()
connect(m_host_interface, &QtHostInterface::recreateDisplayWidgetRequested, this, &MainWindow::recreateDisplayWidget,
Qt::BlockingQueuedConnection);
connect(m_game_list_widget, &GameListWidget::bootEntryRequested, [this](const GameList::GameListEntry* entry) {
connect(m_game_list_widget, &GameListWidget::bootEntryRequested, [this](const GameListEntry* entry) {
// if we're not running, boot the system, otherwise swap discs
QString path = QString::fromStdString(entry->path);
if (!m_emulation_running)
@ -307,7 +307,7 @@ void MainWindow::connectSignals()
switchToEmulationView();
}
});
connect(m_game_list_widget, &GameListWidget::entrySelected, [this](const GameList::GameListEntry* entry) {
connect(m_game_list_widget, &GameListWidget::entrySelected, [this](const GameListEntry* entry) {
if (!entry)
{
m_ui.statusBar->clearMessage();