diff options
| author | Leo Lam <leolino.lam@gmail.com> | 2017-05-15 19:51:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-15 19:51:49 +0200 |
| commit | 8e38eca1500ca1186ca9d45e252dbfa35781f73f (patch) | |
| tree | 5a86f1815858e7c6e5e52051892c5ea189959f2f /Source/Core | |
| parent | d2d7247ebe38bb6501061e224bae607c24fed252 (diff) | |
| parent | 4bf9f5e83578d5cf628d0667f537b1fa3ad40c6b (diff) | |
Merge pull request #5426 from spycrab/qt_c_refreshbutton
Qt: Implement Wiimote Refresh button
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/DolphinQt2/Config/ControllersWindow.cpp | 35 | ||||
| -rw-r--r-- | Source/Core/DolphinQt2/Config/ControllersWindow.h | 2 |
2 files changed, 29 insertions, 8 deletions
diff --git a/Source/Core/DolphinQt2/Config/ControllersWindow.cpp b/Source/Core/DolphinQt2/Config/ControllersWindow.cpp index 1b6e1b5265..1bfa4a8330 100644 --- a/Source/Core/DolphinQt2/Config/ControllersWindow.cpp +++ b/Source/Core/DolphinQt2/Config/ControllersWindow.cpp @@ -115,7 +115,7 @@ void ControllersWindow::CreateGamecubeLayout() m_gc_box->setLayout(m_gc_layout); } -static QHBoxLayout* CreateSubItem(QLabel* label, QWidget* widget) +static QHBoxLayout* CreateSubItem(QWidget* label, QWidget* widget) { QHBoxLayout* hbox = new QHBoxLayout(); hbox->addItem(new QSpacerItem(25, 1)); @@ -123,15 +123,24 @@ static QHBoxLayout* CreateSubItem(QLabel* label, QWidget* widget) if (label != nullptr) hbox->addWidget(label); - hbox->addWidget(widget); + if (widget != nullptr) + hbox->addWidget(widget); return hbox; } -static QHBoxLayout* CreateSubItem(const QString& text, QWidget* widget) +static QHBoxLayout* CreateSubItem(QWidget* label, QLayoutItem* item) { - QLabel* label = text.isEmpty() ? nullptr : new QLabel(text); - return CreateSubItem(label, widget); + QHBoxLayout* hbox = new QHBoxLayout(); + hbox->addItem(new QSpacerItem(25, 1)); + + if (label != nullptr) + hbox->addWidget(label); + + if (item != nullptr) + hbox->addItem(item); + + return hbox; } void ControllersWindow::CreateWiimoteLayout() @@ -141,6 +150,7 @@ void ControllersWindow::CreateWiimoteLayout() m_wiimote_passthrough = new QRadioButton(tr("Use Bluetooth Passthrough")); m_wiimote_sync = new QPushButton(tr("Sync")); m_wiimote_reset = new QPushButton(tr("Reset")); + m_wiimote_refresh = new QPushButton(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 Bluetooth Adapter")); @@ -161,6 +171,7 @@ void ControllersWindow::CreateWiimoteLayout() m_wiimote_sync->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_wiimote_reset->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + m_wiimote_refresh->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_wiimote_layout->addRow(CreateSubItem(m_wiimote_pt_labels[0], m_wiimote_sync)); m_wiimote_layout->addRow(CreateSubItem(m_wiimote_pt_labels[1], m_wiimote_reset)); @@ -193,9 +204,9 @@ void ControllersWindow::CreateWiimoteLayout() m_wiimote_layout->addRow(wm_group); } - m_wiimote_layout->addRow(CreateSubItem(QStringLiteral(""), m_wiimote_continuous_scanning)); - m_wiimote_layout->addRow(CreateSubItem(QStringLiteral(""), m_wiimote_real_balance_board)); - m_wiimote_layout->addRow(CreateSubItem(QStringLiteral(""), m_wiimote_speaker_data)); + m_wiimote_layout->addRow(CreateSubItem(m_wiimote_continuous_scanning, m_wiimote_refresh)); + m_wiimote_layout->addRow(CreateSubItem(nullptr, m_wiimote_real_balance_board)); + m_wiimote_layout->addRow(CreateSubItem(m_wiimote_speaker_data, new QSpacerItem(1, 35))); m_wiimote_box->setLayout(m_wiimote_layout); } @@ -239,6 +250,8 @@ void ControllersWindow::ConnectWidgets() &ControllersWindow::OnBluetoothPassthroughSyncPressed); connect(m_wiimote_reset, &QPushButton::clicked, this, &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++) @@ -281,6 +294,7 @@ void ControllersWindow::OnWiimoteModeChanged(bool passthrough) m_wiimote_buttons[i]->setEnabled(!passthrough && index != 0 && index != 2); } + m_wiimote_refresh->setEnabled(!passthrough); m_wiimote_real_balance_board->setEnabled(!passthrough); m_wiimote_speaker_data->setEnabled(!passthrough); m_wiimote_continuous_scanning->setEnabled(!passthrough); @@ -357,6 +371,11 @@ void ControllersWindow::OnBluetoothPassthroughSyncPressed() } } +void ControllersWindow::OnWiimoteRefreshPressed() +{ + WiimoteReal::Refresh(); +} + void ControllersWindow::OnEmulationStateChanged(bool running) { if (!Settings().IsWiiGameRunning() || NetPlay::IsNetPlayRunning()) diff --git a/Source/Core/DolphinQt2/Config/ControllersWindow.h b/Source/Core/DolphinQt2/Config/ControllersWindow.h index 1f49e30e87..4f5963fb79 100644 --- a/Source/Core/DolphinQt2/Config/ControllersWindow.h +++ b/Source/Core/DolphinQt2/Config/ControllersWindow.h @@ -35,6 +35,7 @@ private: void UnimplementedButton(); void OnBluetoothPassthroughSyncPressed(); void OnBluetoothPassthroughResetPressed(); + void OnWiimoteRefreshPressed(); void OnGCPadConfigure(); void OnWiimoteConfigure(); @@ -79,6 +80,7 @@ private: QCheckBox* m_wiimote_continuous_scanning; QCheckBox* m_wiimote_real_balance_board; QCheckBox* m_wiimote_speaker_data; + QPushButton* m_wiimote_refresh; // Advanced QGroupBox* m_advanced_box; |
