New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Qt: Implement hotkeys #5510
Qt: Implement hotkeys #5510
Conversation
void Hotkey3D::SaveSettings() | ||
{ | ||
HotkeyManagerEmu::GetConfig()->SaveConfig(); | ||
} |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
class HotkeyScheduler | ||
{ | ||
public: | ||
HotkeyScheduler(MainWindow* parent); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
public: | ||
HotkeyScheduler(MainWindow* parent); | ||
|
||
void stop(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
void start(); | ||
|
||
private: | ||
void run(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/DolphinQt2/MainWindow.h
Outdated
@@ -76,6 +78,8 @@ private slots: | |||
void ShowControllersWindow(); | |||
void ShowAboutDialog(); | |||
|
|||
void OpenConfigureHotkeys(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
void HotkeyScheduler::stop() | ||
{ | ||
m_stop_requested = true; | ||
m_thread.join(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
void HotkeyScheduler::start() | ||
{ | ||
m_stop_requested = false; | ||
m_thread = std::thread([this] { run(); }); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
bool m_stop_requested; | ||
MainWindow* m_parent; | ||
std::thread m_thread; | ||
}; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -47,11 +49,13 @@ MainWindow::MainWindow() : QMainWindow(nullptr) | |||
ConnectMenuBar(); | |||
|
|||
InitControllers(); | |||
|
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
if (IsHotkey(HK_FREELOOK_INCREASE_SPEED, true)) | ||
fl_speed *= 1.1f; | ||
|
||
if (IsHotkey(HK_FREELOOK_INCREASE_SPEED, true)) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
if (IsHotkey(HK_FREELOOK_RIGHT, true)) | ||
VertexShaderManager::TranslateView(-fl_speed, 0.0); | ||
|
||
if (IsHotkey(HK_FREELOOK_RIGHT, true)) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
b83d505
to
57af249
Compare
@@ -0,0 +1,42 @@ | |||
// Copyright 2017 Dolphin Emulator Project |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
#include "DolphinQt2/MainWindow.h" | ||
#include "DolphinQt2/Resources.h" | ||
#include "DolphinQt2/Settings.h" | ||
|
||
#include "InputCommon/ControllerInterface/ControllerInterface.h" | ||
|
||
MainWindow::MainWindow() : QMainWindow(nullptr) | ||
MainWindow::MainWindow() : QMainWindow(nullptr), m_hotkey_window(new MappingWindow(this, 0)) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
void MainWindow::ShowHotkeyDialog() | ||
{ | ||
HotkeyManagerEmu::Enable(false); | ||
m_hotkey_window->ChangeMappingType(MappingWindow::Type::MAPPING_HOTKEYS); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
AboutDialog* about = new AboutDialog(this); | ||
about->show(); | ||
HotkeyManagerEmu::Enable(true); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/DolphinQt2/MenuBar.cpp
Outdated
void MenuBar::AddOptionsMenu() | ||
{ | ||
QMenu* options_menu = addMenu(tr("Options")); | ||
options_menu->addAction(tr("Hotkey Settings"), [this] { emit ConfigureHotkeys(); }); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
if (g_Config.iStereoMode != STEREO_SBS) | ||
{ | ||
// Disable post-processing shader, as stereoscopy itself is currently a shader | ||
if (g_Config.sPostProcessingShader == "dubois") |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
||
// Exit | ||
if (IsHotkey(HK_EXIT)) | ||
QCoreApplication::exit(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
||
// Fullscreen | ||
if (IsHotkey(HK_FULLSCREEN)) | ||
m_parent->FullScreen(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
IsHotkey(HK_TRIGGER_SYNC_BUTTON, true)); | ||
} | ||
// TODO Debugging shortcuts (Separate PR) | ||
Common::SleepCurrentThread(1000 / 60); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
{ | ||
m_stop_requested = false; | ||
m_thread = std::thread(&HotkeyScheduler::Run, this); | ||
m_thread.detach(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
8d514fb
to
946581b
Compare
Would you mind taking a look again, @ligfx? |
Please upload a new screenshot now that #5503 has been merged. It should make the window look a lot nicer! |
78b3f82
to
5296cc3
Compare
@MayImilae Updated screenshot |
|
||
#include "Core/HotkeyManager.h" | ||
|
||
QInputDialog::QInputDialog(QWidget* parent) : QDialog(parent) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
#include "VideoCommon/VertexShaderManager.h" | ||
#include "VideoCommon/VideoConfig.h" | ||
|
||
constexpr const char* DUBOIS_ALGORITHM_SHADER = "dubois"; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
||
void HotkeyScheduler::Stop() | ||
{ | ||
m_stop_requested.Set(true); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
State::UndoSaveState(); | ||
} | ||
|
||
Common::SleepCurrentThread(1000 / 60); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
g_controller_interface.Shutdown(); | ||
Pad::Shutdown(); | ||
Keyboard::Shutdown(); | ||
Wiimote::Shutdown(); | ||
HotkeyManagerEmu::Shutdown(); | ||
|
||
delete m_hotkey_scheduler; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
void MainWindow::ShowHotkeyDialog() | ||
{ | ||
m_hotkey_window->ChangeMappingType(MappingWindow::Type::MAPPING_HOTKEYS); | ||
m_hotkey_window->show(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
38219e0
to
fd35105
Compare
Is it really proper to poll all the hotkey states instead of acting on events? |
@shuffle2 I don't think there's another way as this is handled by InputCommon. Also Wx handles it in the same fashion. |
It's input common which is wrong here. It should be fixed, but fixing it is kind of out of scope of this PR. |
Yeah, InputCommon is all polling-driven, not event-driven. |
well i'm glad we agree it sucks |
Adds hotkeys (+ configuration windows) to Qt.