add double-click to start game
This commit is contained in:
parent
159be2c7f4
commit
cdfbab4103
|
@ -37,6 +37,7 @@ GameGridFrame::GameGridFrame(std::shared_ptr<GameInfoClass> game_info_get, QWidg
|
||||||
crtColumn = this->currentColumn();
|
crtColumn = this->currentColumn();
|
||||||
columnCnt = this->columnCount();
|
columnCnt = this->columnCount();
|
||||||
});
|
});
|
||||||
|
connect(this, &QTableWidget::cellDoubleClicked, this, &MainWindow::StartGame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameGridFrame::PopulateGameGrid(QVector<GameInfo> m_games_search, bool fromSearch) {
|
void GameGridFrame::PopulateGameGrid(QVector<GameInfo> m_games_search, bool fromSearch) {
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "game_info.h"
|
#include "game_info.h"
|
||||||
#include "game_list_utils.h"
|
#include "game_list_utils.h"
|
||||||
#include "gui_context_menus.h"
|
#include "gui_context_menus.h"
|
||||||
|
#include "main_window.h"
|
||||||
|
|
||||||
class GameGridFrame : public QTableWidget {
|
class GameGridFrame : public QTableWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -54,6 +54,8 @@ GameListFrame::GameListFrame(std::shared_ptr<GameInfoClass> game_info_get, QWidg
|
||||||
connect(this->horizontalScrollBar(), &QScrollBar::valueChanged, this,
|
connect(this->horizontalScrollBar(), &QScrollBar::valueChanged, this,
|
||||||
&GameListFrame::RefreshListBackgroundImage);
|
&GameListFrame::RefreshListBackgroundImage);
|
||||||
|
|
||||||
|
connect(this, &QTableWidget::cellDoubleClicked, this, &MainWindow::StartGame);
|
||||||
|
|
||||||
this->horizontalHeader()->setSortIndicatorShown(true);
|
this->horizontalHeader()->setSortIndicatorShown(true);
|
||||||
this->horizontalHeader()->setSectionsClickable(true);
|
this->horizontalHeader()->setSectionsClickable(true);
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "game_info.h"
|
#include "game_info.h"
|
||||||
#include "game_list_utils.h"
|
#include "game_list_utils.h"
|
||||||
#include "gui_context_menus.h"
|
#include "gui_context_menus.h"
|
||||||
|
#include "main_window.h"
|
||||||
|
|
||||||
class GameListFrame : public QTableWidget {
|
class GameListFrame : public QTableWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -179,32 +179,7 @@ void MainWindow::CreateConnects() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->playButton, &QPushButton::clicked, this, [this]() {
|
connect(ui->playButton, &QPushButton::clicked, this, &MainWindow::StartGame);
|
||||||
QString gamePath = "";
|
|
||||||
int table_mode = Config::getTableMode();
|
|
||||||
if (table_mode == 0) {
|
|
||||||
if (m_game_list_frame->currentItem()) {
|
|
||||||
int itemID = m_game_list_frame->currentItem()->row();
|
|
||||||
gamePath = QString::fromStdString(m_game_info->m_games[itemID].path + "/eboot.bin");
|
|
||||||
}
|
|
||||||
} else if (table_mode == 1) {
|
|
||||||
if (m_game_grid_frame->cellClicked) {
|
|
||||||
int itemID = (m_game_grid_frame->crtRow * m_game_grid_frame->columnCnt) +
|
|
||||||
m_game_grid_frame->crtColumn;
|
|
||||||
gamePath = QString::fromStdString(m_game_info->m_games[itemID].path + "/eboot.bin");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (m_elf_viewer->currentItem()) {
|
|
||||||
int itemID = m_elf_viewer->currentItem()->row();
|
|
||||||
gamePath = QString::fromStdString(m_elf_viewer->m_elf_list[itemID].toStdString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (gamePath != "") {
|
|
||||||
AddRecentFiles(gamePath);
|
|
||||||
Core::Emulator emulator;
|
|
||||||
emulator.Run(gamePath.toUtf8().constData());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(ui->setIconSizeTinyAct, &QAction::triggered, this, [this]() {
|
connect(ui->setIconSizeTinyAct, &QAction::triggered, this, [this]() {
|
||||||
if (isTableList) {
|
if (isTableList) {
|
||||||
|
@ -386,6 +361,33 @@ void MainWindow::CreateConnects() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::StartGame() {
|
||||||
|
QString gamePath = "";
|
||||||
|
int table_mode = Config::getTableMode();
|
||||||
|
if (table_mode == 0) {
|
||||||
|
if (m_game_list_frame->currentItem()) {
|
||||||
|
int itemID = m_game_list_frame->currentItem()->row();
|
||||||
|
gamePath = QString::fromStdString(m_game_info->m_games[itemID].path + "/eboot.bin");
|
||||||
|
}
|
||||||
|
} else if (table_mode == 1) {
|
||||||
|
if (m_game_grid_frame->cellClicked) {
|
||||||
|
int itemID = (m_game_grid_frame->crtRow * m_game_grid_frame->columnCnt) +
|
||||||
|
m_game_grid_frame->crtColumn;
|
||||||
|
gamePath = QString::fromStdString(m_game_info->m_games[itemID].path + "/eboot.bin");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (m_elf_viewer->currentItem()) {
|
||||||
|
int itemID = m_elf_viewer->currentItem()->row();
|
||||||
|
gamePath = QString::fromStdString(m_elf_viewer->m_elf_list[itemID].toStdString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (gamePath != "") {
|
||||||
|
AddRecentFiles(gamePath);
|
||||||
|
Core::Emulator emulator;
|
||||||
|
emulator.Run(gamePath.toUtf8().constData());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::SearchGameTable(const QString& text) {
|
void MainWindow::SearchGameTable(const QString& text) {
|
||||||
if (isTableList) {
|
if (isTableList) {
|
||||||
for (int row = 0; row < m_game_list_frame->rowCount(); row++) {
|
for (int row = 0; row < m_game_list_frame->rowCount(); row++) {
|
||||||
|
|
|
@ -39,6 +39,7 @@ public:
|
||||||
bool Init();
|
bool Init();
|
||||||
void InstallDragDropPkg(std::filesystem::path file, int pkgNum, int nPkg);
|
void InstallDragDropPkg(std::filesystem::path file, int pkgNum, int nPkg);
|
||||||
void InstallDirectory();
|
void InstallDirectory();
|
||||||
|
void StartGame();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void ConfigureGuiFromSettings();
|
void ConfigureGuiFromSettings();
|
||||||
|
|
Loading…
Reference in New Issue