mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-18 06:25:37 +00:00
Qt: Implement fullscreen
This commit is contained in:
parent
87889a13e0
commit
207c75e6eb
|
@ -52,6 +52,28 @@ void MainWindow::onEmulationPaused(bool paused)
|
||||||
m_ui.actionPause->setChecked(paused);
|
m_ui.actionPause->setChecked(paused);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::toggleFullscreen()
|
||||||
|
{
|
||||||
|
const bool fullscreen = !m_display_widget->isFullScreen();
|
||||||
|
if (fullscreen)
|
||||||
|
{
|
||||||
|
m_ui.mainContainer->setCurrentIndex(0);
|
||||||
|
m_ui.mainContainer->removeWidget(m_display_widget);
|
||||||
|
m_display_widget->setParent(nullptr);
|
||||||
|
m_display_widget->showFullScreen();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_ui.mainContainer->insertWidget(1, m_display_widget);
|
||||||
|
m_ui.mainContainer->setCurrentIndex(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_display_widget->setFocus();
|
||||||
|
|
||||||
|
QSignalBlocker blocker(m_ui.actionFullscreen);
|
||||||
|
m_ui.actionFullscreen->setChecked(fullscreen);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::onStartDiscActionTriggered()
|
void MainWindow::onStartDiscActionTriggered()
|
||||||
{
|
{
|
||||||
QString filename =
|
QString filename =
|
||||||
|
@ -94,8 +116,6 @@ void MainWindow::onOpenDirectoryActionTriggered() {}
|
||||||
|
|
||||||
void MainWindow::onExitActionTriggered() {}
|
void MainWindow::onExitActionTriggered() {}
|
||||||
|
|
||||||
void MainWindow::onFullscreenActionToggled(bool fullscreen) {}
|
|
||||||
|
|
||||||
void MainWindow::onGitHubRepositoryActionTriggered() {}
|
void MainWindow::onGitHubRepositoryActionTriggered() {}
|
||||||
|
|
||||||
void MainWindow::onIssueTrackerActionTriggered() {}
|
void MainWindow::onIssueTrackerActionTriggered() {}
|
||||||
|
@ -108,7 +128,7 @@ void MainWindow::setupAdditionalUi()
|
||||||
m_game_list_widget->initialize(m_host_interface);
|
m_game_list_widget->initialize(m_host_interface);
|
||||||
m_ui.mainContainer->insertWidget(0, m_game_list_widget);
|
m_ui.mainContainer->insertWidget(0, m_game_list_widget);
|
||||||
|
|
||||||
m_display_widget = m_host_interface->createDisplayWidget(m_ui.mainContainer);
|
m_display_widget = m_host_interface->createDisplayWidget(nullptr);
|
||||||
m_ui.mainContainer->insertWidget(1, m_display_widget);
|
m_ui.mainContainer->insertWidget(1, m_display_widget);
|
||||||
|
|
||||||
m_ui.mainContainer->setCurrentIndex(0);
|
m_ui.mainContainer->setCurrentIndex(0);
|
||||||
|
@ -156,7 +176,7 @@ void MainWindow::connectSignals()
|
||||||
connect(m_ui.actionReset, &QAction::triggered, m_host_interface, &QtHostInterface::resetSystem);
|
connect(m_ui.actionReset, &QAction::triggered, m_host_interface, &QtHostInterface::resetSystem);
|
||||||
connect(m_ui.actionPause, &QAction::toggled, m_host_interface, &QtHostInterface::pauseSystem);
|
connect(m_ui.actionPause, &QAction::toggled, m_host_interface, &QtHostInterface::pauseSystem);
|
||||||
connect(m_ui.actionExit, &QAction::triggered, this, &MainWindow::onExitActionTriggered);
|
connect(m_ui.actionExit, &QAction::triggered, this, &MainWindow::onExitActionTriggered);
|
||||||
connect(m_ui.actionFullscreen, &QAction::toggled, this, &MainWindow::onFullscreenActionToggled);
|
connect(m_ui.actionFullscreen, &QAction::triggered, this, &MainWindow::toggleFullscreen);
|
||||||
connect(m_ui.actionSettings, &QAction::triggered, [this]() { doSettings(SettingsDialog::Category::Count); });
|
connect(m_ui.actionSettings, &QAction::triggered, [this]() { doSettings(SettingsDialog::Category::Count); });
|
||||||
connect(m_ui.actionGameListSettings, &QAction::triggered,
|
connect(m_ui.actionGameListSettings, &QAction::triggered,
|
||||||
[this]() { doSettings(SettingsDialog::Category::GameListSettings); });
|
[this]() { doSettings(SettingsDialog::Category::GameListSettings); });
|
||||||
|
@ -173,6 +193,7 @@ void MainWindow::connectSignals()
|
||||||
connect(m_host_interface, &QtHostInterface::emulationStarted, this, &MainWindow::onEmulationStarted);
|
connect(m_host_interface, &QtHostInterface::emulationStarted, this, &MainWindow::onEmulationStarted);
|
||||||
connect(m_host_interface, &QtHostInterface::emulationStopped, this, &MainWindow::onEmulationStopped);
|
connect(m_host_interface, &QtHostInterface::emulationStopped, this, &MainWindow::onEmulationStopped);
|
||||||
connect(m_host_interface, &QtHostInterface::emulationPaused, this, &MainWindow::onEmulationPaused);
|
connect(m_host_interface, &QtHostInterface::emulationPaused, this, &MainWindow::onEmulationPaused);
|
||||||
|
connect(m_host_interface, &QtHostInterface::toggleFullscreenRequested, this, &MainWindow::toggleFullscreen);
|
||||||
|
|
||||||
connect(m_game_list_widget, &GameListWidget::bootEntryRequested, [this](const GameList::GameListEntry& entry) {
|
connect(m_game_list_widget, &GameListWidget::bootEntryRequested, [this](const GameList::GameListEntry& entry) {
|
||||||
// if we're not running, boot the system, otherwise swap discs
|
// if we're not running, boot the system, otherwise swap discs
|
||||||
|
|
|
@ -19,18 +19,18 @@ public:
|
||||||
explicit MainWindow(QtHostInterface* host_interface);
|
explicit MainWindow(QtHostInterface* host_interface);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
public Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onEmulationStarting();
|
void onEmulationStarting();
|
||||||
void onEmulationStarted();
|
void onEmulationStarted();
|
||||||
void onEmulationStopped();
|
void onEmulationStopped();
|
||||||
void onEmulationPaused(bool paused);
|
void onEmulationPaused(bool paused);
|
||||||
|
void toggleFullscreen();
|
||||||
|
|
||||||
void onStartDiscActionTriggered();
|
void onStartDiscActionTriggered();
|
||||||
void onChangeDiscActionTriggered();
|
void onChangeDiscActionTriggered();
|
||||||
void onStartBiosActionTriggered();
|
void onStartBiosActionTriggered();
|
||||||
void onOpenDirectoryActionTriggered();
|
void onOpenDirectoryActionTriggered();
|
||||||
void onExitActionTriggered();
|
void onExitActionTriggered();
|
||||||
void onFullscreenActionToggled(bool fullscreen);
|
|
||||||
void onGitHubRepositoryActionTriggered();
|
void onGitHubRepositoryActionTriggered();
|
||||||
void onIssueTrackerActionTriggered();
|
void onIssueTrackerActionTriggered();
|
||||||
void onAboutActionTriggered();
|
void onAboutActionTriggered();
|
||||||
|
|
|
@ -269,7 +269,7 @@ void QtHostInterface::updateHotkeyInputMap()
|
||||||
|
|
||||||
hk(QStringLiteral("Fullscreen"), [this](bool pressed) {
|
hk(QStringLiteral("Fullscreen"), [this](bool pressed) {
|
||||||
if (!pressed)
|
if (!pressed)
|
||||||
toggleFullscreen();
|
emit toggleFullscreenRequested();
|
||||||
});
|
});
|
||||||
|
|
||||||
hk(QStringLiteral("Pause"), [this](bool pressed) {
|
hk(QStringLiteral("Pause"), [this](bool pressed) {
|
||||||
|
@ -313,8 +313,6 @@ void QtHostInterface::addButtonToInputMap(const QString& binding, InputButtonHan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtHostInterface::updateFullscreen() {}
|
|
||||||
|
|
||||||
void QtHostInterface::powerOffSystem()
|
void QtHostInterface::powerOffSystem()
|
||||||
{
|
{
|
||||||
if (!isOnWorkerThread())
|
if (!isOnWorkerThread())
|
||||||
|
@ -366,18 +364,6 @@ void QtHostInterface::pauseSystem(bool paused)
|
||||||
|
|
||||||
void QtHostInterface::changeDisc(QString new_disc_filename) {}
|
void QtHostInterface::changeDisc(QString new_disc_filename) {}
|
||||||
|
|
||||||
void QtHostInterface::toggleFullscreen()
|
|
||||||
{
|
|
||||||
if (!isOnWorkerThread())
|
|
||||||
{
|
|
||||||
QMetaObject::invokeMethod(this, "toggleFullscreen", Qt::QueuedConnection);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_settings.display_fullscreen = !m_settings.display_fullscreen;
|
|
||||||
updateFullscreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QtHostInterface::doBootSystem(QString initial_filename, QString initial_save_state_filename)
|
void QtHostInterface::doBootSystem(QString initial_filename, QString initial_save_state_filename)
|
||||||
{
|
{
|
||||||
if (!m_display_window->initializeDeviceContext())
|
if (!m_display_window->initializeDeviceContext())
|
||||||
|
|
|
@ -65,13 +65,13 @@ Q_SIGNALS:
|
||||||
void emulationStopped();
|
void emulationStopped();
|
||||||
void emulationPaused(bool paused);
|
void emulationPaused(bool paused);
|
||||||
void gameListRefreshed();
|
void gameListRefreshed();
|
||||||
|
void toggleFullscreenRequested();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void powerOffSystem();
|
void powerOffSystem();
|
||||||
void resetSystem();
|
void resetSystem();
|
||||||
void pauseSystem(bool paused);
|
void pauseSystem(bool paused);
|
||||||
void changeDisc(QString new_disc_filename);
|
void changeDisc(QString new_disc_filename);
|
||||||
void toggleFullscreen();
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void doStopThread();
|
void doStopThread();
|
||||||
|
@ -106,7 +106,6 @@ private:
|
||||||
void updateControllerInputMap();
|
void updateControllerInputMap();
|
||||||
void updateHotkeyInputMap();
|
void updateHotkeyInputMap();
|
||||||
void addButtonToInputMap(const QString& binding, InputButtonHandler handler);
|
void addButtonToInputMap(const QString& binding, InputButtonHandler handler);
|
||||||
void updateFullscreen();
|
|
||||||
void createThread();
|
void createThread();
|
||||||
void stopThread();
|
void stopThread();
|
||||||
void threadEntryPoint();
|
void threadEntryPoint();
|
||||||
|
|
Loading…
Reference in a new issue