Qt: Properly implement "Start Fullscreen"
This commit is contained in:
parent
2480624cbe
commit
8f39a0f154
|
@ -113,7 +113,7 @@ bool HostInterface::BootSystem(const SystemBootParameters& parameters)
|
|||
|
||||
void HostInterface::PauseSystem(bool paused)
|
||||
{
|
||||
if (paused == m_paused)
|
||||
if (paused == m_paused || !m_system)
|
||||
return;
|
||||
|
||||
m_paused = paused;
|
||||
|
|
|
@ -13,6 +13,7 @@ void Settings::Load(SettingsInterface& si)
|
|||
speed_limiter_enabled = si.GetBoolValue("Main", "SpeedLimiterEnabled", true);
|
||||
increase_timer_resolution = si.GetBoolValue("Main", "IncreaseTimerResolution", true);
|
||||
start_paused = si.GetBoolValue("Main", "StartPaused", false);
|
||||
start_fullscreen = si.GetBoolValue("Main", "StartFullscreen", false);
|
||||
save_state_on_exit = si.GetBoolValue("Main", "SaveStateOnExit", true);
|
||||
confim_power_off = si.GetBoolValue("Main", "ConfirmPowerOff", true);
|
||||
|
||||
|
@ -32,7 +33,6 @@ void Settings::Load(SettingsInterface& si)
|
|||
.value_or(DisplayCropMode::None);
|
||||
display_force_progressive_scan = si.GetBoolValue("Display", "ForceProgressiveScan", true);
|
||||
display_linear_filtering = si.GetBoolValue("Display", "LinearFiltering", true);
|
||||
display_fullscreen = si.GetBoolValue("Display", "Fullscreen", false);
|
||||
video_sync_enabled = si.GetBoolValue("Display", "VSync", true);
|
||||
|
||||
cdrom_read_thread = si.GetBoolValue("CDROM", "ReadThread", true);
|
||||
|
@ -71,6 +71,7 @@ void Settings::Save(SettingsInterface& si) const
|
|||
si.SetBoolValue("Main", "SpeedLimiterEnabled", speed_limiter_enabled);
|
||||
si.SetBoolValue("Main", "IncreaseTimerResolution", increase_timer_resolution);
|
||||
si.SetBoolValue("Main", "StartPaused", start_paused);
|
||||
si.SetBoolValue("Main", "StartFullscreen", start_fullscreen);
|
||||
si.SetBoolValue("Main", "SaveStateOnExit", save_state_on_exit);
|
||||
si.SetBoolValue("Main", "ConfirmPowerOff", confim_power_off);
|
||||
|
||||
|
@ -85,7 +86,6 @@ void Settings::Save(SettingsInterface& si) const
|
|||
|
||||
si.SetBoolValue("Display", "ForceProgressiveScan", display_force_progressive_scan);
|
||||
si.SetBoolValue("Display", "LinearFiltering", display_linear_filtering);
|
||||
si.SetBoolValue("Display", "Fullscreen", display_fullscreen);
|
||||
si.SetBoolValue("Display", "VSync", video_sync_enabled);
|
||||
|
||||
si.SetBoolValue("CDROM", "ReadThread", cdrom_read_thread);
|
||||
|
|
|
@ -41,6 +41,7 @@ struct Settings
|
|||
bool speed_limiter_enabled = true;
|
||||
bool increase_timer_resolution = true;
|
||||
bool start_paused = false;
|
||||
bool start_fullscreen = false;
|
||||
bool save_state_on_exit = true;
|
||||
bool confim_power_off = true;
|
||||
|
||||
|
@ -53,7 +54,6 @@ struct Settings
|
|||
DisplayCropMode display_crop_mode = DisplayCropMode::None;
|
||||
bool display_force_progressive_scan = false;
|
||||
bool display_linear_filtering = true;
|
||||
bool display_fullscreen = false;
|
||||
bool video_sync_enabled = true;
|
||||
|
||||
bool cdrom_read_thread = true;
|
||||
|
|
|
@ -26,6 +26,7 @@ ConsoleSettingsWidget::ConsoleSettingsWidget(QtHostInterface* host_interface, QW
|
|||
SettingWidgetBinder::BindWidgetToNormalizedSetting(m_host_interface, m_ui.emulationSpeed, "Main/EmulationSpeed",
|
||||
100.0f);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.pauseOnStart, "Main/StartPaused");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.startFullscreen, "Main/StartFullscreen");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.saveStateOnExit, "Main/SaveStateOnExit");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.confirmPowerOff, "Main/ConfirmPowerOff");
|
||||
SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.cpuExecutionMode, "CPU/ExecutionMode",
|
||||
|
|
|
@ -154,13 +154,20 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="startFullscreen">
|
||||
<property name="text">
|
||||
<string>Start Fullscreen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="saveStateOnExit">
|
||||
<property name="text">
|
||||
<string>Save State On Exit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="confirmPowerOff">
|
||||
<property name="text">
|
||||
<string>Confirm Power Off</string>
|
||||
|
|
|
@ -18,7 +18,6 @@ GPUSettingsWidget::GPUSettingsWidget(QtHostInterface* host_interface, QWidget* p
|
|||
"Display/ForceProgressiveScan");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.displayLinearFiltering,
|
||||
"Display/LinearFiltering");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.startFullscreen, "Display/Fullscreen");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.vsync, "Display/VSync");
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(m_host_interface, m_ui.resolutionScale, "GPU/ResolutionScale");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.trueColor, "GPU/TrueColor");
|
||||
|
|
|
@ -83,13 +83,6 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="startFullscreen">
|
||||
<property name="text">
|
||||
<string>Start Fullscreen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="vsync">
|
||||
<property name="text">
|
||||
<string>VSync</string>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "qtsettingsinterface.h"
|
||||
#include "settingsdialog.h"
|
||||
#include "settingwidgetbinder.h"
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QUrl>
|
||||
#include <QtGui/QDesktopServices>
|
||||
|
@ -38,6 +39,7 @@ MainWindow::~MainWindow()
|
|||
void MainWindow::reportError(const QString& message)
|
||||
{
|
||||
QMessageBox::critical(this, tr("DuckStation"), message, QMessageBox::Ok);
|
||||
focusDisplayWidget();
|
||||
}
|
||||
|
||||
void MainWindow::reportMessage(const QString& message)
|
||||
|
@ -88,6 +90,9 @@ void MainWindow::destroyDisplayWindow()
|
|||
|
||||
void MainWindow::setFullscreen(bool fullscreen)
|
||||
{
|
||||
if (fullscreen == m_display_widget->isFullScreen())
|
||||
return;
|
||||
|
||||
if (fullscreen)
|
||||
{
|
||||
m_ui.mainContainer->setCurrentIndex(0);
|
||||
|
|
|
@ -48,7 +48,11 @@ void QtHostInterface::ReportError(const char* message)
|
|||
{
|
||||
HostInterface::ReportError(message);
|
||||
|
||||
emit setFullscreenRequested(false);
|
||||
emit errorReported(QString::fromLocal8Bit(message));
|
||||
|
||||
if (m_settings.start_fullscreen)
|
||||
emit setFullscreenRequested(true);
|
||||
}
|
||||
|
||||
void QtHostInterface::ReportMessage(const char* message)
|
||||
|
@ -60,7 +64,14 @@ void QtHostInterface::ReportMessage(const char* message)
|
|||
|
||||
bool QtHostInterface::ConfirmMessage(const char* message)
|
||||
{
|
||||
return messageConfirmed(QString::fromLocal8Bit(message));
|
||||
emit setFullscreenRequested(false);
|
||||
|
||||
const bool result = messageConfirmed(QString::fromLocal8Bit(message));
|
||||
|
||||
if (m_settings.start_fullscreen)
|
||||
emit setFullscreenRequested(true);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
QVariant QtHostInterface::getSettingValue(const QString& name, const QVariant& default_value)
|
||||
|
@ -251,7 +262,7 @@ std::optional<CommonHostInterface::HostKeyCode> QtHostInterface::GetHostKeyCode(
|
|||
|
||||
void QtHostInterface::OnSystemCreated()
|
||||
{
|
||||
HostInterface::OnSystemCreated();
|
||||
CommonHostInterface::OnSystemCreated();
|
||||
|
||||
wakeThread();
|
||||
destroyBackgroundControllerPollTimer();
|
||||
|
@ -261,7 +272,7 @@ void QtHostInterface::OnSystemCreated()
|
|||
|
||||
void QtHostInterface::OnSystemPaused(bool paused)
|
||||
{
|
||||
HostInterface::OnSystemPaused(paused);
|
||||
CommonHostInterface::OnSystemPaused(paused);
|
||||
|
||||
emit emulationPaused(paused);
|
||||
|
||||
|
@ -392,14 +403,7 @@ void QtHostInterface::pauseSystem(bool paused)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!m_system)
|
||||
return;
|
||||
|
||||
m_paused = paused;
|
||||
m_audio_stream->PauseOutput(paused);
|
||||
if (!paused)
|
||||
wakeThread();
|
||||
emit emulationPaused(paused);
|
||||
CommonHostInterface::PauseSystem(paused);
|
||||
}
|
||||
|
||||
void QtHostInterface::changeDisc(const QString& new_disc_filename)
|
||||
|
|
|
@ -301,7 +301,7 @@ std::unique_ptr<SDLHostInterface> SDLHostInterface::Create()
|
|||
INISettingsInterface si(intf->GetSettingsFileName().c_str());
|
||||
intf->m_settings_copy.Load(si);
|
||||
intf->m_settings = intf->m_settings_copy;
|
||||
intf->m_fullscreen = intf->m_settings_copy.display_fullscreen;
|
||||
intf->m_fullscreen = intf->m_settings_copy.start_fullscreen;
|
||||
|
||||
if (!intf->CreateSDLWindow())
|
||||
{
|
||||
|
@ -1105,6 +1105,7 @@ void SDLHostInterface::DrawSettingsWindow()
|
|||
settings_changed |= ImGui::Checkbox("Enable Speed Limiter", &m_settings_copy.speed_limiter_enabled);
|
||||
settings_changed |= ImGui::Checkbox("Increase Timer Resolution", &m_settings_copy.increase_timer_resolution);
|
||||
settings_changed |= ImGui::Checkbox("Pause On Start", &m_settings_copy.start_paused);
|
||||
settings_changed |= ImGui::Checkbox("Start Fullscreen", &m_settings_copy.start_fullscreen);
|
||||
settings_changed |= ImGui::Checkbox("Save State On Exit", &m_settings_copy.save_state_on_exit);
|
||||
}
|
||||
|
||||
|
@ -1246,9 +1247,6 @@ void SDLHostInterface::DrawSettingsWindow()
|
|||
settings_changed = true;
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Start Fullscreen", &m_settings_copy.display_fullscreen))
|
||||
settings_changed = true;
|
||||
|
||||
settings_changed |= ImGui::Checkbox("Use Debug Device", &m_settings_copy.gpu_use_debug_device);
|
||||
settings_changed |= ImGui::Checkbox("Linear Filtering", &m_settings_copy.display_linear_filtering);
|
||||
settings_changed |= ImGui::Checkbox("VSync", &m_settings_copy.video_sync_enabled);
|
||||
|
|
|
@ -47,6 +47,24 @@ std::unique_ptr<AudioStream> CommonHostInterface::CreateAudioStream(AudioBackend
|
|||
}
|
||||
}
|
||||
|
||||
void CommonHostInterface::OnSystemCreated()
|
||||
{
|
||||
HostInterface::OnSystemCreated();
|
||||
|
||||
if (m_settings.start_fullscreen)
|
||||
SetFullscreen(true);
|
||||
}
|
||||
|
||||
void CommonHostInterface::OnSystemPaused(bool paused)
|
||||
{
|
||||
HostInterface::OnSystemPaused(paused);
|
||||
|
||||
if (paused)
|
||||
SetFullscreen(false);
|
||||
else if (m_settings.start_fullscreen)
|
||||
SetFullscreen(true);
|
||||
}
|
||||
|
||||
void CommonHostInterface::SetDefaultSettings(SettingsInterface& si)
|
||||
{
|
||||
HostInterface::SetDefaultSettings(si);
|
||||
|
@ -319,17 +337,12 @@ void CommonHostInterface::RegisterGeneralHotkeys()
|
|||
{
|
||||
if (m_settings.confim_power_off)
|
||||
{
|
||||
SetFullscreen(false);
|
||||
|
||||
SmallString confirmation_message("Are you sure you want to stop emulation?");
|
||||
if (m_settings.save_state_on_exit)
|
||||
confirmation_message.AppendString("\n\nThe current state will be saved.");
|
||||
|
||||
if (!ConfirmMessage(confirmation_message))
|
||||
{
|
||||
if (m_settings.display_fullscreen)
|
||||
SetFullscreen(true);
|
||||
|
||||
m_system->ResetPerformanceCounters();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,9 @@ protected:
|
|||
|
||||
virtual std::unique_ptr<AudioStream> CreateAudioStream(AudioBackend backend) override;
|
||||
|
||||
virtual void OnSystemCreated() override;
|
||||
virtual void OnSystemPaused(bool paused) override;
|
||||
|
||||
virtual void SetDefaultSettings(SettingsInterface& si) override;
|
||||
|
||||
virtual std::optional<HostKeyCode> GetHostKeyCode(const std::string_view key_code) const;
|
||||
|
|
Loading…
Reference in New Issue