Skip to content
Permalink
Browse files
Merge pull request #10497 from martinD2014/master
Change the highlighted button on each window
  • Loading branch information
AdmiralCurtiss committed Mar 27, 2022
2 parents 56b5c67 + a4d031c commit b379df3
Show file tree
Hide file tree
Showing 23 changed files with 111 additions and 60 deletions.
@@ -290,6 +290,8 @@ add_executable(dolphin-emu
QtUtils/WrapInScrollArea.h
QtUtils/AspectRatioWidget.cpp
QtUtils/AspectRatioWidget.h
QtUtils/NonDefaultQPushButton.cpp
QtUtils/NonDefaultQPushButton.h
ResourcePackManager.cpp
ResourcePackManager.h
RiivolutionBootWidget.cpp
@@ -24,6 +24,7 @@
#include "Core/HW/Memmap.h"
#include "Core/PowerPC/MMU.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"

CheatSearchFactoryWidget::CheatSearchFactoryWidget()
{
@@ -118,7 +119,7 @@ void CheatSearchFactoryWidget::CreateWidgets()

layout->addWidget(data_type_group);

m_new_search = new QPushButton(tr("New Search"));
m_new_search = new NonDefaultQPushButton(tr("New Search"));
layout->addWidget(m_new_search);

setLayout(layout);
@@ -20,6 +20,7 @@

#include "DolphinQt/Config/CheatCodeEditor.h"
#include "DolphinQt/Config/CheatWarningWidget.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"

#include "UICommon/GameFile.h"

@@ -52,9 +53,9 @@ void ARCodeWidget::CreateWidgets()
{
m_warning = new CheatWarningWidget(m_game_id, m_restart_required, this);
m_code_list = new QListWidget;
m_code_add = new QPushButton(tr("&Add New Code..."));
m_code_edit = new QPushButton(tr("&Edit Code..."));
m_code_remove = new QPushButton(tr("&Remove Code"));
m_code_add = new NonDefaultQPushButton(tr("&Add New Code..."));
m_code_edit = new NonDefaultQPushButton(tr("&Edit Code..."));
m_code_remove = new NonDefaultQPushButton(tr("&Remove Code"));

m_code_list->setEnabled(!m_game_id.empty());
m_code_add->setEnabled(!m_game_id.empty());
@@ -12,6 +12,7 @@
#include "Core/Core.h"

#include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"

CommonControllersWidget::CommonControllersWidget(QWidget* parent) : QWidget(parent)
{
@@ -26,7 +27,8 @@ void CommonControllersWidget::CreateLayout()
m_common_box = new QGroupBox(tr("Common"));
m_common_layout = new QVBoxLayout();
m_common_bg_input = new QCheckBox(tr("Background Input"));
m_common_configure_controller_interface = new QPushButton(tr("Alternate Input Sources"));
m_common_configure_controller_interface =
new NonDefaultQPushButton(tr("Alternate Input Sources"));

m_common_layout->addWidget(m_common_bg_input);
m_common_layout->addWidget(m_common_configure_controller_interface);
@@ -13,6 +13,7 @@

#include "Common/Config/Config.h"
#include "DolphinQt/Config/ControllerInterface/DualShockUDPClientAddServerDialog.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.h"

DualShockUDPClientWidget::DualShockUDPClientWidget()
@@ -32,10 +33,10 @@ void DualShockUDPClientWidget::CreateWidgets()
m_server_list = new QListWidget();
main_layout->addWidget(m_server_list);

m_add_server = new QPushButton(tr("Add..."));
m_add_server = new NonDefaultQPushButton(tr("Add..."));
m_add_server->setEnabled(m_servers_enabled->isChecked());

m_remove_server = new QPushButton(tr("Remove"));
m_remove_server = new NonDefaultQPushButton(tr("Remove"));
m_remove_server->setEnabled(m_servers_enabled->isChecked());

QHBoxLayout* hlayout = new QHBoxLayout;
@@ -16,6 +16,7 @@
#include "DolphinQt/Config/Graphics/GraphicsChoice.h"
#include "DolphinQt/Config/Mapping/MappingWindow.h"
#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/Settings.h"

FreeLookWidget::FreeLookWidget(QWidget* parent) : QWidget(parent)
@@ -34,7 +35,7 @@ void FreeLookWidget::CreateLayout()
m_enable_freelook->SetDescription(
tr("Allows manipulation of the in-game camera.<br><br><dolphin_emphasis>If unsure, "
"leave this unchecked.</dolphin_emphasis>"));
m_freelook_controller_configure_button = new QPushButton(tr("Configure Controller"));
m_freelook_controller_configure_button = new NonDefaultQPushButton(tr("Configure Controller"));

m_freelook_control_type = new GraphicsChoice({tr("Six Axis"), tr("First Person"), tr("Orbital")},
Config::FL1_CONTROL_TYPE);
@@ -21,6 +21,7 @@

#include "DolphinQt/Config/Mapping/GCPadWiiUConfigDialog.h"
#include "DolphinQt/Config/Mapping/MappingWindow.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/Settings.h"

#include "InputCommon/GCAdapter.h"
@@ -76,7 +77,7 @@ void GamecubeControllersWidget::CreateLayout()
{
auto* gc_label = new QLabel(tr("Port %1").arg(i + 1));
auto* gc_box = m_gc_controller_boxes[i] = new QComboBox();
auto* gc_button = m_gc_buttons[i] = new QPushButton(tr("Configure"));
auto* gc_button = m_gc_buttons[i] = new NonDefaultQPushButton(tr("Configure"));

for (const auto& item : s_gc_types)
{
@@ -26,6 +26,7 @@
#include "DolphinQt/Config/CheatCodeEditor.h"
#include "DolphinQt/Config/CheatWarningWidget.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"

#include "UICommon/GameFile.h"

@@ -77,10 +78,10 @@ void GeckoCodeWidget::CreateWidgets()
m_code_view->setReadOnly(true);
m_code_view->setFixedHeight(line_height * 10);

m_add_code = new QPushButton(tr("&Add New Code..."));
m_edit_code = new QPushButton(tr("&Edit Code..."));
m_remove_code = new QPushButton(tr("&Remove Code"));
m_download_codes = new QPushButton(tr("Download Codes"));
m_add_code = new NonDefaultQPushButton(tr("&Add New Code..."));
m_edit_code = new NonDefaultQPushButton(tr("&Edit Code..."));
m_remove_code = new NonDefaultQPushButton(tr("&Remove Code"));
m_download_codes = new NonDefaultQPushButton(tr("Download Codes"));

m_download_codes->setToolTip(tr("Download Codes from the WiiRD Database"));

@@ -19,6 +19,7 @@
#include "DolphinQt/Config/Graphics/GraphicsSlider.h"
#include "DolphinQt/Config/Graphics/GraphicsWindow.h"
#include "DolphinQt/Config/Graphics/PostProcessingConfigWindow.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/Settings.h"

#include "UICommon/VideoUtils.h"
@@ -76,7 +77,7 @@ void EnhancementsWidget::CreateWidgets()
Config::GFX_ENHANCE_MAX_ANISOTROPY);

m_pp_effect = new ToolTipComboBox();
m_configure_pp_effect = new QPushButton(tr("Configure"));
m_configure_pp_effect = new NonDefaultQPushButton(tr("Configure"));
m_scaled_efb_copy = new GraphicsBool(tr("Scaled EFB Copy"), Config::GFX_HACK_COPY_EFB_SCALED);
m_per_pixel_lighting =
new GraphicsBool(tr("Per-Pixel Lighting"), Config::GFX_ENABLE_PIXEL_LIGHTING);
@@ -45,6 +45,7 @@
#include "DolphinQt/Config/Mapping/WiimoteEmuMotionControl.h"
#include "DolphinQt/Config/Mapping/WiimoteEmuMotionControlIMU.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/QtUtils/WindowActivationEventFilter.h"
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
#include "DolphinQt/Settings.h"
@@ -94,7 +95,7 @@ void MappingWindow::CreateDevicesLayout()
m_devices_layout = new QHBoxLayout();
m_devices_box = new QGroupBox(tr("Device"));
m_devices_combo = new QComboBox();
m_devices_refresh = new QPushButton(tr("Refresh"));
m_devices_refresh = new NonDefaultQPushButton(tr("Refresh"));

m_devices_combo->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
m_devices_refresh->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
@@ -110,9 +111,9 @@ void MappingWindow::CreateProfilesLayout()
m_profiles_layout = new QHBoxLayout();
m_profiles_box = new QGroupBox(tr("Profile"));
m_profiles_combo = new QComboBox();
m_profiles_load = new QPushButton(tr("Load"));
m_profiles_save = new QPushButton(tr("Save"));
m_profiles_delete = new QPushButton(tr("Delete"));
m_profiles_load = new NonDefaultQPushButton(tr("Load"));
m_profiles_save = new NonDefaultQPushButton(tr("Save"));
m_profiles_delete = new NonDefaultQPushButton(tr("Delete"));

auto* button_layout = new QHBoxLayout();

@@ -133,8 +134,8 @@ void MappingWindow::CreateResetLayout()
{
m_reset_layout = new QHBoxLayout();
m_reset_box = new QGroupBox(tr("Reset"));
m_reset_clear = new QPushButton(tr("Clear"));
m_reset_default = new QPushButton(tr("Default"));
m_reset_clear = new NonDefaultQPushButton(tr("Clear"));
m_reset_default = new NonDefaultQPushButton(tr("Default"));

m_reset_box->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

@@ -31,6 +31,7 @@

#include "DolphinQt/Config/Mapping/MappingWindow.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/Settings.h"

#include "UICommon/UICommon.h"
@@ -89,9 +90,9 @@ void WiimoteControllersWidget::CreateLayout()
m_wiimote_box->setLayout(m_wiimote_layout);

m_wiimote_passthrough = new QRadioButton(tr("Passthrough a Bluetooth adapter"));
m_wiimote_sync = new QPushButton(tr("Sync"));
m_wiimote_reset = new QPushButton(tr("Reset"));
m_wiimote_refresh = new QPushButton(tr("Refresh"));
m_wiimote_sync = new NonDefaultQPushButton(tr("Sync"));
m_wiimote_reset = new NonDefaultQPushButton(tr("Reset"));
m_wiimote_refresh = new NonDefaultQPushButton(tr("Refresh"));
m_wiimote_pt_labels[0] = new QLabel(tr("Sync real Wii Remotes and pair them"));
m_wiimote_pt_labels[1] = new QLabel(tr("Reset all saved Wii Remote pairings"));
m_wiimote_emu = new QRadioButton(tr("Emulate the Wii's Bluetooth adapter"));
@@ -123,7 +124,7 @@ void WiimoteControllersWidget::CreateLayout()
{
auto* wm_label = m_wiimote_labels[i] = new QLabel(tr("Wii Remote %1").arg(i + 1));
auto* wm_box = m_wiimote_boxes[i] = new QComboBox();
auto* wm_button = m_wiimote_buttons[i] = new QPushButton(tr("Configure"));
auto* wm_button = m_wiimote_buttons[i] = new NonDefaultQPushButton(tr("Configure"));

for (const auto& item : {tr("None"), tr("Emulated Wii Remote"), tr("Real Wii Remote")})
wm_box->addItem(item);
@@ -171,6 +171,7 @@
<ClCompile Include="QtUtils\FlowLayout.cpp" />
<ClCompile Include="QtUtils\ImageConverter.cpp" />
<ClCompile Include="QtUtils\ModalMessageBox.cpp" />
<ClCompile Include="QtUtils\NonDefaultQPushButton.cpp" />
<ClCompile Include="QtUtils\PartiallyClosableTabWidget.cpp" />
<ClCompile Include="QtUtils\UTF8CodePointCountValidator.cpp" />
<ClCompile Include="QtUtils\WindowActivationEventFilter.cpp" />
@@ -223,6 +224,7 @@
<ClInclude Include="QtUtils\FlowLayout.h" />
<ClInclude Include="QtUtils\ImageConverter.h" />
<ClInclude Include="QtUtils\ModalMessageBox.h" />
<ClInclude Include="QtUtils\NonDefaultQPushButton.h" />
<ClInclude Include="QtUtils\QueueOnObject.h" />
<ClInclude Include="QtUtils\RunOnObject.h" />
<ClInclude Include="QtUtils\SignalBlocking.h" />
@@ -21,6 +21,7 @@
#include "Common/Swap.h"
#include "Core/FifoPlayer/FifoPlayer.h"

#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/Settings.h"

#include "VideoCommon/BPMemory.h"
@@ -82,9 +83,9 @@ void FIFOAnalyzer::CreateWidgets()

m_search_box = new QGroupBox(tr("Search Current Object"));
m_search_edit = new QLineEdit;
m_search_new = new QPushButton(tr("Search"));
m_search_next = new QPushButton(tr("Next Match"));
m_search_previous = new QPushButton(tr("Previous Match"));
m_search_new = new NonDefaultQPushButton(tr("Search"));
m_search_next = new NonDefaultQPushButton(tr("Next Match"));
m_search_previous = new NonDefaultQPushButton(tr("Previous Match"));
m_search_label = new QLabel;

m_search_next->setEnabled(false);
@@ -41,6 +41,7 @@
#include "DolphinQt/GCMemcardCreateNewDialog.h"
#include "DolphinQt/QtUtils/DolphinFileDialog.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"

using namespace ExpansionInterface;

@@ -106,9 +107,9 @@ void GCMemcardManager::CreateWidgets()
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);

// Actions
m_select_button = new QPushButton;
m_copy_button = new QPushButton;
m_delete_button = new QPushButton(tr("&Delete"));
m_select_button = new NonDefaultQPushButton;
m_copy_button = new NonDefaultQPushButton;
m_delete_button = new NonDefaultQPushButton(tr("&Delete"));

m_export_button = new QToolButton(this);
m_export_menu = new QMenu(m_export_button);
@@ -122,17 +123,17 @@ void GCMemcardManager::CreateWidgets()
m_export_button->setPopupMode(QToolButton::MenuButtonPopup);
m_export_button->setMenu(m_export_menu);

m_import_button = new QPushButton(tr("&Import..."));
m_fix_checksums_button = new QPushButton(tr("Fix Checksums"));
m_import_button = new NonDefaultQPushButton(tr("&Import..."));
m_fix_checksums_button = new NonDefaultQPushButton(tr("Fix Checksums"));

auto* layout = new QGridLayout;

for (Slot slot : MEMCARD_SLOTS)
{
m_slot_group[slot] = new QGroupBox(slot == Slot::A ? tr("Slot A") : tr("Slot B"));
m_slot_file_edit[slot] = new QLineEdit;
m_slot_open_button[slot] = new QPushButton(tr("&Open..."));
m_slot_create_button[slot] = new QPushButton(tr("&Create..."));
m_slot_open_button[slot] = new NonDefaultQPushButton(tr("&Open..."));
m_slot_create_button[slot] = new NonDefaultQPushButton(tr("&Create..."));
m_slot_table[slot] = new QTableWidget;
m_slot_table[slot]->setTabKeyNavigation(false);
m_slot_stat_label[slot] = new QLabel;
@@ -25,6 +25,7 @@
#include "Core/ConfigManager.h"

#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/Settings.h"

NetPlayBrowser::NetPlayBrowser(QWidget* parent) : QDialog(parent)
@@ -84,7 +85,7 @@ void NetPlayBrowser::CreateWidgets()

m_status_label = new QLabel;
m_button_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
m_button_refresh = new QPushButton(tr("Refresh"));
m_button_refresh = new NonDefaultQPushButton(tr("Refresh"));
m_edit_name = new QLineEdit;
m_edit_game_id = new QLineEdit;
m_check_hide_incompatible = new QCheckBox(tr("Hide Incompatible Sessions"));
@@ -21,6 +21,7 @@
#include "Core/NetPlayProto.h"

#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/QtUtils/UTF8CodePointCountValidator.h"
#include "DolphinQt/Settings.h"

@@ -87,7 +88,7 @@ void NetPlaySetupDialog::CreateMainLayout()
m_button_box = new QDialogButtonBox(QDialogButtonBox::Cancel);
m_nickname_edit = new QLineEdit;
m_connection_type = new QComboBox;
m_reset_traversal_button = new QPushButton(tr("Reset Traversal Settings"));
m_reset_traversal_button = new NonDefaultQPushButton(tr("Reset Traversal Settings"));
m_tab_widget = new QTabWidget;

m_nickname_edit->setValidator(
@@ -101,7 +102,7 @@ void NetPlaySetupDialog::CreateMainLayout()
m_ip_edit = new QLineEdit;
m_connect_port_label = new QLabel(tr("Port:"));
m_connect_port_box = new QSpinBox;
m_connect_button = new QPushButton(tr("Connect"));
m_connect_button = new NonDefaultQPushButton(tr("Connect"));

m_connect_port_box->setMaximum(65535);

@@ -144,7 +145,7 @@ void NetPlaySetupDialog::CreateMainLayout()
m_host_upnp = new QCheckBox(tr("Forward port (UPnP)"));
#endif
m_host_games = new QListWidget;
m_host_button = new QPushButton(tr("Host"));
m_host_button = new NonDefaultQPushButton(tr("Host"));

m_host_port_box->setMaximum(65535);
m_host_force_port_box->setMaximum(65535);
@@ -0,0 +1,11 @@
// Copyright 2022 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"

NonDefaultQPushButton::NonDefaultQPushButton(const QString& text, QWidget* parent)
: QPushButton(text, parent)
{
this->setAutoDefault(false);
}
@@ -0,0 +1,15 @@
// Copyright 2022 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.

#pragma once

#include <QPushButton>

// A custom QPushButton that sets the autoDefault option to false
// This makes sure random buttons are not highlighted anymore by default
class NonDefaultQPushButton : public QPushButton
{
public:
explicit NonDefaultQPushButton(const QString& text = {}, QWidget* parent = nullptr);
};

0 comments on commit b379df3

Please sign in to comment.