mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-09-07 16:29:08 +01:00
frontend: Set minimum window size to 640x360 instead of 1280x720 (#3413)
This commit is contained in:
parent
024c84d2db
commit
b73f678ee8
6 changed files with 36 additions and 8 deletions
|
@ -46,7 +46,7 @@ private:
|
||||||
EmuWindow::EmuWindow() {
|
EmuWindow::EmuWindow() {
|
||||||
// TODO: Find a better place to set this.
|
// TODO: Find a better place to set this.
|
||||||
config.min_client_area_size =
|
config.min_client_area_size =
|
||||||
std::make_pair(Layout::ScreenUndocked::Width, Layout::ScreenUndocked::Height);
|
std::make_pair(Layout::MinimumSize::Width, Layout::MinimumSize::Height);
|
||||||
active_config = config;
|
active_config = config;
|
||||||
touch_state = std::make_shared<TouchState>();
|
touch_state = std::make_shared<TouchState>();
|
||||||
Input::RegisterFactory<Input::TouchDevice>("emu_window", touch_state);
|
Input::RegisterFactory<Input::TouchDevice>("emu_window", touch_state);
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
|
|
||||||
namespace Layout {
|
namespace Layout {
|
||||||
|
|
||||||
|
namespace MinimumSize {
|
||||||
|
constexpr u32 Width = 640;
|
||||||
|
constexpr u32 Height = 360;
|
||||||
|
} // namespace MinimumSize
|
||||||
|
|
||||||
namespace ScreenUndocked {
|
namespace ScreenUndocked {
|
||||||
constexpr u32 Width = 1280;
|
constexpr u32 Width = 1280;
|
||||||
constexpr u32 Height = 720;
|
constexpr u32 Height = 720;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QtConcurrent/QtConcurrentRun>
|
#include <QtConcurrent/QtConcurrentRun>
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
|
#include "core/frontend/framebuffer_layout.h"
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
#include "ui_loading_screen.h"
|
#include "ui_loading_screen.h"
|
||||||
#include "video_core/rasterizer_interface.h"
|
#include "video_core/rasterizer_interface.h"
|
||||||
|
@ -61,7 +62,7 @@ LoadingScreen::LoadingScreen(QWidget* parent)
|
||||||
: QWidget(parent), ui(std::make_unique<Ui::LoadingScreen>()),
|
: QWidget(parent), ui(std::make_unique<Ui::LoadingScreen>()),
|
||||||
previous_stage(VideoCore::LoadCallbackStage::Complete) {
|
previous_stage(VideoCore::LoadCallbackStage::Complete) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setMinimumSize(1280, 720);
|
setMinimumSize(Layout::MinimumSize::Width, Layout::MinimumSize::Height);
|
||||||
|
|
||||||
// Create a fade out effect to hide this loading screen widget.
|
// Create a fade out effect to hide this loading screen widget.
|
||||||
// When fading opacity, it will fade to the parent widgets background color, which is why we
|
// When fading opacity, it will fade to the parent widgets background color, which is why we
|
||||||
|
|
|
@ -724,13 +724,13 @@ void GMainWindow::InitializeHotkeys() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::SetDefaultUIGeometry() {
|
void GMainWindow::SetDefaultUIGeometry() {
|
||||||
// geometry: 55% of the window contents are in the upper screen half, 45% in the lower half
|
// geometry: 53% of the window contents are in the upper screen half, 47% in the lower half
|
||||||
const QRect screenRect = QApplication::desktop()->screenGeometry(this);
|
const QRect screenRect = QApplication::desktop()->screenGeometry(this);
|
||||||
|
|
||||||
const int w = screenRect.width() * 2 / 3;
|
const int w = screenRect.width() * 2 / 3;
|
||||||
const int h = screenRect.height() / 2;
|
const int h = screenRect.height() * 2 / 3;
|
||||||
const int x = (screenRect.x() + screenRect.width()) / 2 - w / 2;
|
const int x = (screenRect.x() + screenRect.width()) / 2 - w / 2;
|
||||||
const int y = (screenRect.y() + screenRect.height()) / 2 - h * 55 / 100;
|
const int y = (screenRect.y() + screenRect.height()) / 2 - h * 53 / 100;
|
||||||
|
|
||||||
setGeometry(x, y, w, h);
|
setGeometry(x, y, w, h);
|
||||||
}
|
}
|
||||||
|
@ -831,6 +831,7 @@ void GMainWindow::ConnectMenuEvents() {
|
||||||
&GMainWindow::OnDisplayTitleBars);
|
&GMainWindow::OnDisplayTitleBars);
|
||||||
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);
|
||||||
|
connect(ui.action_Reset_Window_Size, &QAction::triggered, this, &GMainWindow::ResetWindowSize);
|
||||||
|
|
||||||
// Fullscreen
|
// Fullscreen
|
||||||
ui.action_Fullscreen->setShortcut(
|
ui.action_Fullscreen->setShortcut(
|
||||||
|
@ -1829,6 +1830,20 @@ void GMainWindow::ToggleWindowMode() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GMainWindow::ResetWindowSize() {
|
||||||
|
const auto aspect_ratio = Layout::EmulationAspectRatio(
|
||||||
|
static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio),
|
||||||
|
static_cast<float>(Layout::ScreenUndocked::Height) / Layout::ScreenUndocked::Width);
|
||||||
|
if (!ui.action_Single_Window_Mode->isChecked()) {
|
||||||
|
render_window->resize(Layout::ScreenUndocked::Height / aspect_ratio,
|
||||||
|
Layout::ScreenUndocked::Height);
|
||||||
|
} else {
|
||||||
|
resize(Layout::ScreenUndocked::Height / aspect_ratio,
|
||||||
|
Layout::ScreenUndocked::Height + menuBar()->height() +
|
||||||
|
(ui.action_Show_Status_Bar->isChecked() ? statusBar()->height() : 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GMainWindow::OnConfigure() {
|
void GMainWindow::OnConfigure() {
|
||||||
const auto old_theme = UISettings::values.theme;
|
const auto old_theme = UISettings::values.theme;
|
||||||
const bool old_discord_presence = UISettings::values.enable_discord_presence;
|
const bool old_discord_presence = UISettings::values.enable_discord_presence;
|
||||||
|
|
|
@ -208,6 +208,7 @@ private slots:
|
||||||
void ShowFullscreen();
|
void ShowFullscreen();
|
||||||
void HideFullscreen();
|
void HideFullscreen();
|
||||||
void ToggleWindowMode();
|
void ToggleWindowMode();
|
||||||
|
void ResetWindowSize();
|
||||||
void OnCaptureScreenshot();
|
void OnCaptureScreenshot();
|
||||||
void OnCoreError(Core::System::ResultStatus, std::string);
|
void OnCoreError(Core::System::ResultStatus, std::string);
|
||||||
void OnReinitializeKeys(ReinitializeKeyBehavior behavior);
|
void OnReinitializeKeys(ReinitializeKeyBehavior behavior);
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1081</width>
|
<width>1280</width>
|
||||||
<height>730</height>
|
<height>720</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1081</width>
|
<width>1280</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -96,6 +96,7 @@
|
||||||
<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"/>
|
||||||
<addaction name="action_Show_Status_Bar"/>
|
<addaction name="action_Show_Status_Bar"/>
|
||||||
|
<addaction name="action_Reset_Window_Size"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="menu_View_Debugging"/>
|
<addaction name="menu_View_Debugging"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -215,6 +216,11 @@
|
||||||
<string>Show Status Bar</string>
|
<string>Show Status Bar</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="action_Reset_Window_Size">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reset Window Size</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
<action name="action_Fullscreen">
|
<action name="action_Fullscreen">
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|
Loading…
Reference in a new issue