Merge pull request #6478 from spycrab/qt_default_btns

Qt: Replace "OK" with "Close" buttons
This commit is contained in:
Léo Lam 2018-03-26 22:48:26 +02:00 committed by GitHub
commit b0e4e35cc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 21 deletions

View File

@ -223,7 +223,7 @@ void ControllersWindow::CreateAdvancedLayout()
void ControllersWindow::CreateMainLayout()
{
auto* layout = new QVBoxLayout();
m_button_box = new QDialogButtonBox(QDialogButtonBox::Ok);
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
layout->addWidget(m_gc_box);
layout->addWidget(m_wiimote_box);
@ -235,6 +235,7 @@ void ControllersWindow::CreateMainLayout()
void ControllersWindow::ConnectWidgets()
{
connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
[=](Core::State state) { OnEmulationStateChanged(state != Core::State::Uninitialized); });
@ -253,7 +254,6 @@ void ControllersWindow::ConnectWidgets()
&ControllersWindow::OnBluetoothPassthroughResetPressed);
connect(m_wiimote_refresh, &QPushButton::clicked, this,
&ControllersWindow::OnWiimoteRefreshPressed);
connect(m_button_box, &QDialogButtonBox::accepted, this, &ControllersWindow::accept);
for (size_t i = 0; i < m_wiimote_groups.size(); i++)
{

View File

@ -24,7 +24,6 @@ GraphicsWindow::GraphicsWindow(X11Utils::XRRConfiguration* xrr_config, MainWindo
: QDialog(parent), m_xrr_config(xrr_config)
{
CreateMainLayout();
ConnectWidgets();
setWindowTitle(tr("Graphics"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
@ -40,7 +39,9 @@ void GraphicsWindow::CreateMainLayout()
m_description =
new QLabel(tr("Move the mouse pointer over an option to display a detailed description."));
m_tab_widget = new QTabWidget();
m_button_box = new QDialogButtonBox(QDialogButtonBox::Ok);
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
description_box->setLayout(description_layout);
description_box->setFixedHeight(230);
@ -82,11 +83,6 @@ void GraphicsWindow::CreateMainLayout()
setLayout(main_layout);
}
void GraphicsWindow::ConnectWidgets()
{
connect(m_button_box, &QDialogButtonBox::accepted, this, &QDialog::accept);
}
void GraphicsWindow::OnBackendChanged(const QString& backend)
{
setWindowTitle(tr("Dolphin %1 Graphics Configuration").arg(backend));

View File

@ -36,7 +36,6 @@ signals:
private:
void CreateMainLayout();
void ConnectWidgets();
void OnBackendChanged(const QString& backend);
void OnDescriptionAdded(QWidget* widget, const char* description);

View File

@ -109,7 +109,7 @@ void MappingWindow::CreateMainLayout()
m_main_layout = new QVBoxLayout();
m_config_layout = new QHBoxLayout();
m_tab_widget = new QTabWidget();
m_button_box = new QDialogButtonBox(QDialogButtonBox::Ok);
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
m_config_layout->addWidget(m_devices_box);
m_config_layout->addWidget(m_reset_box);
@ -124,6 +124,7 @@ void MappingWindow::CreateMainLayout()
void MappingWindow::ConnectWidgets()
{
connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(m_devices_refresh, &QPushButton::clicked, this, &MappingWindow::RefreshDevices);
connect(m_devices_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &MappingWindow::OnDeviceChanged);
@ -132,7 +133,6 @@ void MappingWindow::ConnectWidgets()
connect(m_profiles_save, &QPushButton::clicked, this, &MappingWindow::OnSaveProfilePressed);
connect(m_profiles_load, &QPushButton::clicked, this, &MappingWindow::OnLoadProfilePressed);
connect(m_profiles_delete, &QPushButton::clicked, this, &MappingWindow::OnDeleteProfilePressed);
connect(m_button_box, &QDialogButtonBox::accepted, this, &MappingWindow::accept);
}
void MappingWindow::OnDeleteProfilePressed()

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <QDialogButtonBox>
#include <QPushButton>
#include <QTabWidget>
#include <QVBoxLayout>
@ -52,9 +53,11 @@ PropertiesDialog::PropertiesDialog(QWidget* parent, const UICommon::GameFile& ga
layout->addWidget(tab_widget);
QDialogButtonBox* ok_box = new QDialogButtonBox(QDialogButtonBox::Ok);
connect(ok_box, &QDialogButtonBox::accepted, this, &PropertiesDialog::accept);
layout->addWidget(ok_box);
QDialogButtonBox* close_box = new QDialogButtonBox(QDialogButtonBox::Close);
connect(close_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
layout->addWidget(close_box);
setLayout(layout);
}

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
#include "DolphinQt2/Config/SettingsWindow.h"
@ -59,9 +60,11 @@ SettingsWindow::SettingsWindow(QWidget* parent) : QDialog(parent)
AddTab(m_tabs, tr("Advanced"), new AdvancedPane(), "config");
// Dialog box buttons
QDialogButtonBox* ok_box = new QDialogButtonBox(QDialogButtonBox::Ok);
connect(ok_box, &QDialogButtonBox::accepted, this, &SettingsWindow::accept);
layout->addWidget(ok_box);
QDialogButtonBox* close_box = new QDialogButtonBox(QDialogButtonBox::Close);
connect(close_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
layout->addWidget(close_box);
setLayout(layout);
}

View File

@ -55,7 +55,7 @@ GCMemcardManager::~GCMemcardManager() = default;
void GCMemcardManager::CreateWidgets()
{
m_button_box = new QDialogButtonBox(QDialogButtonBox::Ok);
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
// Actions
m_select_button = new QPushButton;
@ -109,7 +109,7 @@ void GCMemcardManager::CreateWidgets()
void GCMemcardManager::ConnectWidgets()
{
connect(m_button_box, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(m_select_button, &QPushButton::pressed, this, [this] { SetActiveSlot(!m_active_slot); });
connect(m_export_button, &QPushButton::pressed, this, [this] { ExportFiles(true); });
connect(m_export_all_button, &QPushButton::pressed, this, &GCMemcardManager::ExportAllFiles);
@ -252,7 +252,6 @@ void GCMemcardManager::SetSlotFileInteractive(int slot)
tr("Set memory card file for Slot B"),
QString::fromStdString(File::GetUserPath(D_GCUSER_IDX)),
tr("GameCube Memory Cards (*.raw *.gcp)"));
if (!path.isEmpty())
m_slot_file_edit[slot]->setText(path);
}