yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Merge pull request #38 from goaaats/citra_merges

Merge citra-emu PR#3001 by Styleoshin(citra-qt : Adding fullscreen mode)
This commit is contained in:
bunnei 2018-01-16 10:00:24 -05:00 committed by GitHub
commit 3b28d382d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 73 additions and 1 deletions

View File

@ -137,6 +137,7 @@ void Config::ReadValues() {
qt_config->endGroup(); qt_config->endGroup();
UISettings::values.single_window_mode = qt_config->value("singleWindowMode", true).toBool(); UISettings::values.single_window_mode = qt_config->value("singleWindowMode", true).toBool();
UISettings::values.fullscreen = qt_config->value("fullscreen", false).toBool();
UISettings::values.display_titlebar = qt_config->value("displayTitleBars", true).toBool(); UISettings::values.display_titlebar = qt_config->value("displayTitleBars", true).toBool();
UISettings::values.show_filter_bar = qt_config->value("showFilterBar", true).toBool(); UISettings::values.show_filter_bar = qt_config->value("showFilterBar", true).toBool();
UISettings::values.show_status_bar = qt_config->value("showStatusBar", true).toBool(); UISettings::values.show_status_bar = qt_config->value("showStatusBar", true).toBool();
@ -216,6 +217,7 @@ void Config::SaveValues() {
qt_config->endGroup(); qt_config->endGroup();
qt_config->setValue("singleWindowMode", UISettings::values.single_window_mode); qt_config->setValue("singleWindowMode", UISettings::values.single_window_mode);
qt_config->setValue("fullscreen", UISettings::values.fullscreen);
qt_config->setValue("displayTitleBars", UISettings::values.display_titlebar); qt_config->setValue("displayTitleBars", UISettings::values.display_titlebar);
qt_config->setValue("showFilterBar", UISettings::values.show_filter_bar); qt_config->setValue("showFilterBar", UISettings::values.show_filter_bar);
qt_config->setValue("showStatusBar", UISettings::values.show_status_bar); qt_config->setValue("showStatusBar", UISettings::values.show_status_bar);

View File

@ -185,12 +185,24 @@ void GMainWindow::InitializeRecentFileMenuActions() {
void GMainWindow::InitializeHotkeys() { void GMainWindow::InitializeHotkeys() {
RegisterHotkey("Main Window", "Load File", QKeySequence::Open); RegisterHotkey("Main Window", "Load File", QKeySequence::Open);
RegisterHotkey("Main Window", "Start Emulation"); RegisterHotkey("Main Window", "Start Emulation");
RegisterHotkey( "Main Window", "Fullscreen", QKeySequence::FullScreen );
RegisterHotkey( "Main Window", "Exit Fullscreen", QKeySequence::Cancel, Qt::ApplicationShortcut );
LoadHotkeys(); LoadHotkeys();
connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this, connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this,
SLOT(OnMenuLoadFile())); SLOT(OnMenuLoadFile()));
connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this,
SLOT(OnStartGame())); SLOT(OnStartGame()));
connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activated,
ui.action_Fullscreen, &QAction::trigger);
connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activatedAmbiguously,
ui.action_Fullscreen, &QAction::trigger);
connect(GetHotkey("Main Window", "Exit Fullscreen", this), &QShortcut::activated, this, [&] {
if (emulation_running) {
ui.action_Fullscreen->setChecked(false);
ToggleFullscreen();
}
});
} }
void GMainWindow::SetDefaultUIGeometry() { void GMainWindow::SetDefaultUIGeometry() {
@ -219,6 +231,8 @@ void GMainWindow::RestoreUIState() {
ui.action_Single_Window_Mode->setChecked(UISettings::values.single_window_mode); ui.action_Single_Window_Mode->setChecked(UISettings::values.single_window_mode);
ToggleWindowMode(); ToggleWindowMode();
ui.action_Fullscreen->setChecked(UISettings::values.fullscreen);
ui.action_Display_Dock_Widget_Headers->setChecked(UISettings::values.display_titlebar); ui.action_Display_Dock_Widget_Headers->setChecked(UISettings::values.display_titlebar);
OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked()); OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked());
@ -263,6 +277,10 @@ void GMainWindow::ConnectMenuEvents() {
connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar); connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar);
connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible); connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible);
// Fullscreen
ui.action_Fullscreen->setShortcut(GetHotkey("Main Window", "Fullscreen", this)->key());
connect(ui.action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen);
// Help // Help
connect(ui.action_About, &QAction::triggered, this, &GMainWindow::OnAbout); connect(ui.action_About, &QAction::triggered, this, &GMainWindow::OnAbout);
} }
@ -402,6 +420,9 @@ void GMainWindow::BootGame(const QString& filename) {
render_window->setFocus(); render_window->setFocus();
emulation_running = true; emulation_running = true;
if (ui.action_Fullscreen->isChecked()) {
ShowFullscreen();
}
OnStartGame(); OnStartGame();
} }
@ -548,6 +569,41 @@ void GMainWindow::OnStopGame() {
ShutdownGame(); ShutdownGame();
} }
void GMainWindow::ToggleFullscreen() {
if (!emulation_running) {
return;
}
if (ui.action_Fullscreen->isChecked()) {
ShowFullscreen();
} else {
HideFullscreen();
}
}
void GMainWindow::ShowFullscreen() {
if (ui.action_Single_Window_Mode->isChecked()) {
UISettings::values.geometry = saveGeometry();
ui.menubar->hide();
statusBar()->hide();
showFullScreen();
} else {
UISettings::values.renderwindow_geometry = render_window->saveGeometry();
render_window->showFullScreen();
}
}
void GMainWindow::HideFullscreen() {
if (ui.action_Single_Window_Mode->isChecked()) {
statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked());
ui.menubar->show();
showNormal();
restoreGeometry(UISettings::values.geometry);
} else {
render_window->showNormal();
render_window->restoreGeometry(UISettings::values.renderwindow_geometry);
}
}
void GMainWindow::ToggleWindowMode() { void GMainWindow::ToggleWindowMode() {
if (ui.action_Single_Window_Mode->isChecked()) { if (ui.action_Single_Window_Mode->isChecked()) {
// Render in the main window... // Render in the main window...
@ -700,6 +756,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
UISettings::values.microprofile_visible = microProfileDialog->isVisible(); UISettings::values.microprofile_visible = microProfileDialog->isVisible();
#endif #endif
UISettings::values.single_window_mode = ui.action_Single_Window_Mode->isChecked(); UISettings::values.single_window_mode = ui.action_Single_Window_Mode->isChecked();
UISettings::values.fullscreen = ui.action_Fullscreen->isChecked();
UISettings::values.display_titlebar = ui.action_Display_Dock_Widget_Headers->isChecked(); UISettings::values.display_titlebar = ui.action_Display_Dock_Widget_Headers->isChecked();
UISettings::values.show_filter_bar = ui.action_Show_Filter_Bar->isChecked(); UISettings::values.show_filter_bar = ui.action_Show_Filter_Bar->isChecked();
UISettings::values.show_status_bar = ui.action_Show_Status_Bar->isChecked(); UISettings::values.show_status_bar = ui.action_Show_Status_Bar->isChecked();

View File

@ -127,6 +127,9 @@ private slots:
void OnAbout(); void OnAbout();
void OnToggleFilterBar(); void OnToggleFilterBar();
void OnDisplayTitleBars(bool); void OnDisplayTitleBars(bool);
void ToggleFullscreen();
void ShowFullscreen();
void HideFullscreen();
void ToggleWindowMode(); void ToggleWindowMode();
void OnCoreError(Core::System::ResultStatus, std::string); void OnCoreError(Core::System::ResultStatus, std::string);

View File

@ -83,6 +83,7 @@
<string>Debugging</string> <string>Debugging</string>
</property> </property>
</widget> </widget>
<addaction name="action_Fullscreen"/>
<addaction name="action_Single_Window_Mode"/> <addaction name="action_Single_Window_Mode"/>
<addaction name="action_Display_Dock_Widget_Headers"/> <addaction name="action_Display_Dock_Widget_Headers"/>
<addaction name="action_Show_Filter_Bar"/> <addaction name="action_Show_Filter_Bar"/>
@ -189,6 +190,14 @@
<string>Selects a folder to display in the game list</string> <string>Selects a folder to display in the game list</string>
</property> </property>
</action> </action>
<action name="action_Fullscreen">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Fullscreen</string>
</property>
</action>
</widget> </widget>
<resources/> <resources/>
</ui> </ui>

View File

@ -27,6 +27,7 @@ struct Values {
bool microprofile_visible; bool microprofile_visible;
bool single_window_mode; bool single_window_mode;
bool fullscreen;
bool display_titlebar; bool display_titlebar;
bool show_filter_bar; bool show_filter_bar;
bool show_status_bar; bool show_status_bar;