Merge pull request #8405 from Docteh/dock_undock

ui: Status bars dock button becomes DOCKED/HANDHELD button
This commit is contained in:
Mai M 2022-06-10 23:11:29 -04:00 committed by GitHub
commit 20576ebb43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 5 deletions

View file

@ -58,6 +58,19 @@ QPushButton#GPUStatusBarButton:!checked {
color: #109010; color: #109010;
} }
QPushButton#DockingStatusBarButton {
min-width: 0px;
color: #000000;
border: 1px solid transparent;
background-color: transparent;
padding: 0px 3px 0px 3px;
text-align: center;
}
QPushButton#DockingStatusBarButton:hover {
border: 1px solid #76797C;
}
QPushButton#buttonRefreshDevices { QPushButton#buttonRefreshDevices {
min-width: 21px; min-width: 21px;
min-height: 21px; min-height: 21px;

View file

@ -1304,6 +1304,19 @@ QPushButton#GPUStatusBarButton:!checked {
color: #40dd40; color: #40dd40;
} }
QPushButton#DockingStatusBarButton {
min-width: 0px;
color: #ffffff;
border: 1px solid transparent;
background-color: transparent;
padding: 0px 3px 0px 3px;
text-align: center;
}
QPushButton#DockingStatusBarButton:hover {
border: 1px solid #76797C;
}
QPushButton#buttonRefreshDevices { QPushButton#buttonRefreshDevices {
min-width: 23px; min-width: 23px;
min-height: 23px; min-height: 23px;

View file

@ -2207,6 +2207,19 @@ QPushButton#GPUStatusBarButton:!checked {
color: #40dd40; color: #40dd40;
} }
QPushButton#DockingStatusBarButton {
min-width: 0px;
color: #ffffff;
border: 1px solid transparent;
background-color: transparent;
padding: 0px 3px 0px 3px;
text-align: center;
}
QPushButton#DockingStatusBarButton:hover {
border: 1px solid #76797C;
}
QPushButton#buttonRefreshDevices { QPushButton#buttonRefreshDevices {
min-width: 19px; min-width: 19px;
min-height: 19px; min-height: 19px;

View file

@ -852,12 +852,11 @@ void GMainWindow::InitializeWidgets() {
// Setup Dock button // Setup Dock button
dock_status_button = new QPushButton(); dock_status_button = new QPushButton();
dock_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); dock_status_button->setObjectName(QStringLiteral("DockingStatusBarButton"));
dock_status_button->setFocusPolicy(Qt::NoFocus); dock_status_button->setFocusPolicy(Qt::NoFocus);
connect(dock_status_button, &QPushButton::clicked, this, &GMainWindow::OnToggleDockedMode); connect(dock_status_button, &QPushButton::clicked, this, &GMainWindow::OnToggleDockedMode);
dock_status_button->setText(tr("DOCK"));
dock_status_button->setCheckable(true); dock_status_button->setCheckable(true);
dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); UpdateDockedButton();
statusBar()->insertPermanentWidget(0, dock_status_button); statusBar()->insertPermanentWidget(0, dock_status_button);
gpu_accuracy_button = new QPushButton(); gpu_accuracy_button = new QPushButton();
@ -2887,7 +2886,7 @@ void GMainWindow::OnToggleDockedMode() {
} }
Settings::values.use_docked_mode.SetValue(!is_docked); Settings::values.use_docked_mode.SetValue(!is_docked);
dock_status_button->setChecked(!is_docked); UpdateDockedButton();
OnDockedModeChanged(is_docked, !is_docked, *system); OnDockedModeChanged(is_docked, !is_docked, *system);
} }
@ -3253,6 +3252,12 @@ void GMainWindow::UpdateGPUAccuracyButton() {
} }
} }
void GMainWindow::UpdateDockedButton() {
const bool is_docked = Settings::values.use_docked_mode.GetValue();
dock_status_button->setChecked(is_docked);
dock_status_button->setText(is_docked ? tr("DOCKED") : tr("HANDHELD"));
}
void GMainWindow::UpdateFilterText() { void GMainWindow::UpdateFilterText() {
const auto filter = Settings::values.scaling_filter.GetValue(); const auto filter = Settings::values.scaling_filter.GetValue();
switch (filter) { switch (filter) {
@ -3296,10 +3301,10 @@ void GMainWindow::UpdateAAText() {
} }
void GMainWindow::UpdateStatusButtons() { void GMainWindow::UpdateStatusButtons() {
dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue());
renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() == renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() ==
Settings::RendererBackend::Vulkan); Settings::RendererBackend::Vulkan);
UpdateGPUAccuracyButton(); UpdateGPUAccuracyButton();
UpdateDockedButton();
UpdateFilterText(); UpdateFilterText();
UpdateAAText(); UpdateAAText();
} }

View file

@ -320,6 +320,7 @@ private:
void MigrateConfigFiles(); void MigrateConfigFiles();
void UpdateWindowTitle(std::string_view title_name = {}, std::string_view title_version = {}, void UpdateWindowTitle(std::string_view title_name = {}, std::string_view title_version = {},
std::string_view gpu_vendor = {}); std::string_view gpu_vendor = {});
void UpdateDockedButton();
void UpdateFilterText(); void UpdateFilterText();
void UpdateAAText(); void UpdateAAText();
void UpdateStatusBar(); void UpdateStatusBar();