diff options
Diffstat (limited to 'src/yuzu')
-rw-r--r-- | src/yuzu/CMakeLists.txt | 129 | ||||
-rw-r--r-- | src/yuzu/bootmanager.cpp | 21 | ||||
-rw-r--r-- | src/yuzu/bootmanager.h | 10 | ||||
-rw-r--r-- | src/yuzu/configuration/config.cpp | 12 | ||||
-rw-r--r-- | src/yuzu/configuration/configure.ui | 2 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_input.cpp | 19 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_input.ui | 132 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_system.cpp | 16 | ||||
-rw-r--r-- | src/yuzu/debugger/profiler.cpp | 5 | ||||
-rw-r--r-- | src/yuzu/debugger/wait_tree.h | 2 | ||||
-rw-r--r-- | src/yuzu/game_list.cpp | 9 | ||||
-rw-r--r-- | src/yuzu/game_list.h | 2 | ||||
-rw-r--r-- | src/yuzu/hotkeys.cpp | 1 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 46 | ||||
-rw-r--r-- | src/yuzu/ui_settings.h | 2 | ||||
-rw-r--r-- | src/yuzu/util/spinbox.cpp | 2 |
16 files changed, 215 insertions, 195 deletions
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index c52d5627a..0c4056c49 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -3,83 +3,84 @@ set(CMAKE_AUTORCC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) -set(SRCS - about_dialog.cpp - configuration/config.cpp - configuration/configure_debug.cpp - configuration/configure_dialog.cpp - configuration/configure_general.cpp - configuration/configure_graphics.cpp - configuration/configure_input.cpp - configuration/configure_system.cpp - debugger/profiler.cpp - debugger/registers.cpp - debugger/wait_tree.cpp - util/spinbox.cpp - util/util.cpp - bootmanager.cpp - game_list.cpp - hotkeys.cpp - main.cpp - ui_settings.cpp - yuzu.rc - Info.plist - ) - -set(HEADERS - about_dialog.h - configuration/config.h - configuration/configure_debug.h - configuration/configure_dialog.h - configuration/configure_general.h - configuration/configure_graphics.h - configuration/configure_input.h - configuration/configure_system.h - debugger/profiler.h - debugger/registers.h - debugger/wait_tree.h - util/spinbox.h - util/util.h - bootmanager.h - game_list.h - game_list_p.h - hotkeys.h - main.h - ui_settings.h - ) +add_executable(yuzu + Info.plist + about_dialog.cpp + about_dialog.h + bootmanager.cpp + bootmanager.h + configuration/config.cpp + configuration/config.h + configuration/configure_debug.cpp + configuration/configure_debug.h + configuration/configure_dialog.cpp + configuration/configure_dialog.h + configuration/configure_general.cpp + configuration/configure_general.h + configuration/configure_graphics.cpp + configuration/configure_graphics.h + configuration/configure_input.cpp + configuration/configure_input.h + configuration/configure_system.cpp + configuration/configure_system.h + debugger/profiler.cpp + debugger/profiler.h + debugger/registers.cpp + debugger/registers.h + debugger/wait_tree.cpp + debugger/wait_tree.h + game_list.cpp + game_list.h + game_list_p.h + hotkeys.cpp + hotkeys.h + main.cpp + main.h + ui_settings.cpp + ui_settings.h + util/spinbox.cpp + util/spinbox.h + util/util.cpp + util/util.h + yuzu.rc +) set(UIS - aboutdialog.ui - configuration/configure.ui - configuration/configure_debug.ui - configuration/configure_general.ui - configuration/configure_graphics.ui - configuration/configure_input.ui - configuration/configure_system.ui - debugger/registers.ui - hotkeys.ui - main.ui - ) + aboutdialog.ui + configuration/configure.ui + configuration/configure_debug.ui + configuration/configure_general.ui + configuration/configure_graphics.ui + configuration/configure_input.ui + configuration/configure_system.ui + debugger/registers.ui + hotkeys.ui + main.ui +) file(GLOB_RECURSE ICONS ${CMAKE_SOURCE_DIR}/dist/icons/*) file(GLOB_RECURSE THEMES ${CMAKE_SOURCE_DIR}/dist/qt_themes/*) -create_directory_groups(${SRCS} ${HEADERS} ${UIS}) +qt5_wrap_ui(UI_HDRS ${UIS}) -if (Qt5_FOUND) - qt5_wrap_ui(UI_HDRS ${UIS}) -else() - qt4_wrap_ui(UI_HDRS ${UIS}) -endif() +target_sources(yuzu + PRIVATE + ${ICONS} + ${THEMES} + ${UI_HDRS} + ${UIS} +) if (APPLE) set(MACOSX_ICON "../../dist/yuzu.icns") set_source_files_properties(${MACOSX_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - add_executable(yuzu MACOSX_BUNDLE ${SRCS} ${HEADERS} ${UI_HDRS} ${MACOSX_ICON} ${ICONS}) + target_sources(yuzu PRIVATE ${MACOSX_ICON}) + set_target_properties(yuzu PROPERTIES MACOSX_BUNDLE TRUE) set_target_properties(yuzu PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) -else() - add_executable(yuzu ${SRCS} ${HEADERS} ${UI_HDRS} ${ICONS}) endif() + +create_target_directory_groups(yuzu) + target_link_libraries(yuzu PRIVATE common core input_common video_core) target_link_libraries(yuzu PRIVATE Boost::boost glad Qt5::OpenGL Qt5::Widgets) target_link_libraries(yuzu PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 843ac6ad7..469988d63 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -1,12 +1,8 @@ #include <QApplication> #include <QHBoxLayout> #include <QKeyEvent> - -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -// Required for screen DPI information #include <QScreen> #include <QWindow> -#endif #include "common/microprofile.h" #include "common/scm_rev.h" @@ -19,8 +15,7 @@ #include "input_common/motion_emu.h" #include "yuzu/bootmanager.h" -EmuThread::EmuThread(GRenderWindow* render_window) - : exec_step(false), running(false), stop_run(false), render_window(render_window) {} +EmuThread::EmuThread(GRenderWindow* render_window) : render_window(render_window) {} void EmuThread::run() { render_window->MakeCurrent(); @@ -120,15 +115,13 @@ GRenderWindow::~GRenderWindow() { void GRenderWindow::moveContext() { DoneCurrent(); -// We need to move GL context to the swapping thread in Qt5 -#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0) + // If the thread started running, move the GL Context to the new thread. Otherwise, move it // back. auto thread = (QThread::currentThread() == qApp->thread() && emu_thread != nullptr) ? emu_thread : qApp->thread(); child->context()->moveToThread(thread); -#endif } void GRenderWindow::SwapBuffers() { @@ -191,12 +184,8 @@ QByteArray GRenderWindow::saveGeometry() { } qreal GRenderWindow::windowPixelRatio() { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) // windowHandle() might not be accessible until the window is displayed to screen. return windowHandle() ? windowHandle()->screen()->devicePixelRatio() : 1.0f; -#else - return 1.0f; -#endif } void GRenderWindow::closeEvent(QCloseEvent* event) { @@ -299,9 +288,7 @@ void GRenderWindow::OnEmulationStopping() { void GRenderWindow::showEvent(QShowEvent* event) { QWidget::showEvent(event); -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) // windowHandle() is not initialized until the Window is shown, so we connect it here. - connect(this->windowHandle(), SIGNAL(screenChanged(QScreen*)), this, - SLOT(OnFramebufferSizeChanged()), Qt::UniqueConnection); -#endif + connect(windowHandle(), &QWindow::screenChanged, this, &GRenderWindow::OnFramebufferSizeChanged, + Qt::UniqueConnection); } diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h index 6974edcbb..130bc613b 100644 --- a/src/yuzu/bootmanager.h +++ b/src/yuzu/bootmanager.h @@ -58,7 +58,7 @@ public: * @return True if the emulation thread is running, otherwise false * @note This function is thread-safe */ - bool IsRunning() { + bool IsRunning() const { return running; } @@ -68,12 +68,12 @@ public: void RequestStop() { stop_run = true; SetRunning(false); - }; + } private: - bool exec_step; - bool running; - std::atomic<bool> stop_run; + bool exec_step = false; + bool running = false; + std::atomic<bool> stop_run{false}; std::mutex running_mutex; std::condition_variable running_cv; diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 6a40f035c..f9ddb9edc 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -26,10 +26,18 @@ const std::array<int, Settings::NativeButton::NumButtons> Config::default_button const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> Config::default_analogs{{ { - Qt::Key_Up, Qt::Key_Down, Qt::Key_Left, Qt::Key_Right, Qt::Key_E, + Qt::Key_Up, + Qt::Key_Down, + Qt::Key_Left, + Qt::Key_Right, + Qt::Key_E, }, { - Qt::Key_I, Qt::Key_K, Qt::Key_J, Qt::Key_L, Qt::Key_R, + Qt::Key_I, + Qt::Key_K, + Qt::Key_J, + Qt::Key_L, + Qt::Key_R, }, }}; diff --git a/src/yuzu/configuration/configure.ui b/src/yuzu/configuration/configure.ui index babd583a2..c5303851c 100644 --- a/src/yuzu/configuration/configure.ui +++ b/src/yuzu/configuration/configure.ui @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>740</width> + <width>461</width> <height>500</height> </rect> </property> diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp index 10043e6e8..78559e2bb 100644 --- a/src/yuzu/configuration/configure_input.cpp +++ b/src/yuzu/configuration/configure_input.cpp @@ -14,7 +14,11 @@ const std::array<std::string, ConfigureInput::ANALOG_SUB_BUTTONS_NUM> ConfigureInput::analog_sub_buttons{{ - "up", "down", "left", "right", "modifier", + "up", + "down", + "left", + "right", + "modifier", }}; static QString getKeyName(int key_code) { @@ -36,7 +40,8 @@ static void SetAnalogButton(const Common::ParamPackage& input_param, Common::ParamPackage& analog_param, const std::string& button_name) { if (analog_param.Get("engine", "") != "analog_from_button") { analog_param = { - {"engine", "analog_from_button"}, {"modifier_scale", "0.5"}, + {"engine", "analog_from_button"}, + {"modifier_scale", "0.5"}, }; } analog_param.Set(button_name, input_param.Serialize()); @@ -107,11 +112,17 @@ ConfigureInput::ConfigureInput(QWidget* parent) analog_map_buttons = {{ { - ui->buttonLStickUp, ui->buttonLStickDown, ui->buttonLStickLeft, ui->buttonLStickRight, + ui->buttonLStickUp, + ui->buttonLStickDown, + ui->buttonLStickLeft, + ui->buttonLStickRight, ui->buttonLStickMod, }, { - ui->buttonRStickUp, ui->buttonRStickDown, ui->buttonRStickLeft, ui->buttonRStickRight, + ui->buttonRStickUp, + ui->buttonRStickDown, + ui->buttonRStickLeft, + ui->buttonRStickRight, ui->buttonRStickMod, }, }}; diff --git a/src/yuzu/configuration/configure_input.ui b/src/yuzu/configuration/configure_input.ui index c162ca02c..377b79c77 100644 --- a/src/yuzu/configuration/configure_input.ui +++ b/src/yuzu/configuration/configure_input.ui @@ -15,9 +15,9 @@ </property> <layout class="QVBoxLayout" name="verticalLayout_5"> <item> - <layout class="QGridLayout" name="gridLayout_7"> + <layout class="QGridLayout" name="buttons"> <item row="3" column="1"> - <widget class="QGroupBox" name="faceButtons_6"> + <widget class="QGroupBox" name="misc"> <property name="title"> <string>Misc.</string> </property> @@ -29,9 +29,9 @@ </property> <layout class="QGridLayout" name="gridLayout_6"> <item row="0" column="0"> - <layout class="QVBoxLayout" name="verticalLayout_25"> + <layout class="QVBoxLayout" name="buttonMiscPlusVerticalLayout"> <item> - <widget class="QLabel" name="label_29"> + <widget class="QLabel" name="labelPlus"> <property name="text"> <string>Plus:</string> </property> @@ -47,9 +47,9 @@ </layout> </item> <item row="0" column="1"> - <layout class="QVBoxLayout" name="verticalLayout_26"> + <layout class="QVBoxLayout" name="buttonMiscMinusVerticalLayout"> <item> - <widget class="QLabel" name="label_30"> + <widget class="QLabel" name="labelMinus"> <property name="text"> <string>Minus:</string> </property> @@ -65,9 +65,9 @@ </layout> </item> <item row="1" column="0"> - <layout class="QVBoxLayout" name="verticalLayout_27"> + <layout class="QVBoxLayout" name="buttonMiscHomeVerticalLayout"> <item> - <widget class="QLabel" name="label_31"> + <widget class="QLabel" name="labelHome"> <property name="text"> <string>Home:</string> </property> @@ -83,9 +83,9 @@ </layout> </item> <item row="1" column="1"> - <layout class="QVBoxLayout" name="verticalLayout_28"> + <layout class="QVBoxLayout" name="buttonMiscScrCapVerticalLayout"> <item> - <widget class="QLabel" name="label_11"> + <widget class="QLabel" name="labelScrCap"> <property name="text"> <string>Screen Capture:</string> @@ -130,9 +130,9 @@ Capture:</string> </property> <layout class="QGridLayout" name="gridLayout"> <item row="0" column="0"> - <layout class="QVBoxLayout" name="verticalLayout"> + <layout class="QVBoxLayout" name="buttonFaceButtonsAVerticalLayout"> <item> - <widget class="QLabel" name="label"> + <widget class="QLabel" name="labelA"> <property name="text"> <string>A:</string> </property> @@ -148,9 +148,9 @@ Capture:</string> </layout> </item> <item row="0" column="1"> - <layout class="QVBoxLayout" name="verticalLayout_2"> + <layout class="QVBoxLayout" name="buttonFaceButtonsBVerticalLayout"> <item> - <widget class="QLabel" name="label_2"> + <widget class="QLabel" name="labelB"> <property name="text"> <string>B:</string> </property> @@ -166,9 +166,9 @@ Capture:</string> </layout> </item> <item row="1" column="0"> - <layout class="QVBoxLayout" name="verticalLayout_3"> + <layout class="QVBoxLayout" name="buttonFaceButtonsXVerticalLayout"> <item> - <widget class="QLabel" name="label_3"> + <widget class="QLabel" name="labelX"> <property name="text"> <string>X:</string> </property> @@ -184,9 +184,9 @@ Capture:</string> </layout> </item> <item row="1" column="1"> - <layout class="QVBoxLayout" name="verticalLayout_4"> + <layout class="QVBoxLayout" name="buttonFaceButtonsYVerticalLayout"> <item> - <widget class="QLabel" name="label_4"> + <widget class="QLabel" name="labelY"> <property name="text"> <string>Y:</string> </property> @@ -205,7 +205,7 @@ Capture:</string> </widget> </item> <item row="0" column="1"> - <widget class="QGroupBox" name="faceButtons_2"> + <widget class="QGroupBox" name="Dpad"> <property name="title"> <string>Directional Pad</string> </property> @@ -217,9 +217,9 @@ Capture:</string> </property> <layout class="QGridLayout" name="gridLayout_2"> <item row="1" column="0"> - <layout class="QVBoxLayout" name="verticalLayout_12"> + <layout class="QVBoxLayout" name="buttonDpadUpVerticalLayout"> <item> - <widget class="QLabel" name="label_34"> + <widget class="QLabel" name="labelDpadUp"> <property name="text"> <string>Up:</string> </property> @@ -235,9 +235,9 @@ Capture:</string> </layout> </item> <item row="1" column="1"> - <layout class="QVBoxLayout" name="verticalLayout_9"> + <layout class="QVBoxLayout" name="buttonDpadDownVerticalLayout"> <item> - <widget class="QLabel" name="label_35"> + <widget class="QLabel" name="labelDpadDown"> <property name="text"> <string>Down:</string> </property> @@ -253,9 +253,9 @@ Capture:</string> </layout> </item> <item row="0" column="0"> - <layout class="QVBoxLayout" name="verticalLayout_10"> + <layout class="QVBoxLayout" name="buttonDpadLeftVerticalLayout"> <item> - <widget class="QLabel" name="label_32"> + <widget class="QLabel" name="labelDpadLeft"> <property name="text"> <string>Left:</string> </property> @@ -271,9 +271,9 @@ Capture:</string> </layout> </item> <item row="0" column="1"> - <layout class="QVBoxLayout" name="verticalLayout_11"> + <layout class="QVBoxLayout" name="buttonDpadRightVerticalLayout"> <item> - <widget class="QLabel" name="label_33"> + <widget class="QLabel" name="labelDpadRight"> <property name="text"> <string>Right:</string> </property> @@ -292,7 +292,7 @@ Capture:</string> </widget> </item> <item row="3" column="0"> - <widget class="QGroupBox" name="faceButtons_3"> + <widget class="QGroupBox" name="shoulderButtons"> <property name="title"> <string>Shoulder Buttons</string> </property> @@ -304,9 +304,9 @@ Capture:</string> </property> <layout class="QGridLayout" name="gridLayout_3"> <item row="0" column="0"> - <layout class="QVBoxLayout" name="verticalLayout_13"> + <layout class="QVBoxLayout" name="buttonShoulderButtonsLVerticalLayout"> <item> - <widget class="QLabel" name="label_17"> + <widget class="QLabel" name="labelL"> <property name="text"> <string>L:</string> </property> @@ -322,9 +322,9 @@ Capture:</string> </layout> </item> <item row="0" column="1"> - <layout class="QVBoxLayout" name="verticalLayout_14"> + <layout class="QVBoxLayout" name="buttonShoulderButtonsRVerticalLayout"> <item> - <widget class="QLabel" name="label_19"> + <widget class="QLabel" name="labelR"> <property name="text"> <string>R:</string> </property> @@ -340,9 +340,9 @@ Capture:</string> </layout> </item> <item row="1" column="0"> - <layout class="QVBoxLayout" name="verticalLayout_15"> + <layout class="QVBoxLayout" name="buttonShoulderButtonsZLVerticalLayout"> <item> - <widget class="QLabel" name="label_20"> + <widget class="QLabel" name="labelZL"> <property name="text"> <string>ZL:</string> </property> @@ -358,9 +358,9 @@ Capture:</string> </layout> </item> <item row="1" column="1"> - <layout class="QVBoxLayout" name="verticalLayout_16"> + <layout class="QVBoxLayout" name="buttonShoulderButtonsZRVerticalLayout"> <item> - <widget class="QLabel" name="label_18"> + <widget class="QLabel" name="labelZR"> <property name="text"> <string>ZR:</string> </property> @@ -376,9 +376,9 @@ Capture:</string> </layout> </item> <item row="2" column="0"> - <layout class="QVBoxLayout" name="verticalLayout_8"> + <layout class="QVBoxLayout" name="buttonShoulderButtonsSLVerticalLayout"> <item> - <widget class="QLabel" name="label_7"> + <widget class="QLabel" name="labelSL"> <property name="text"> <string>SL:</string> </property> @@ -394,9 +394,9 @@ Capture:</string> </layout> </item> <item row="2" column="1"> - <layout class="QVBoxLayout" name="verticalLayout_29"> + <layout class="QVBoxLayout" name="buttonShoulderButtonsSRVerticalLayout"> <item> - <widget class="QLabel" name="label_8"> + <widget class="QLabel" name="labelSR"> <property name="text"> <string>SR:</string> </property> @@ -415,7 +415,7 @@ Capture:</string> </widget> </item> <item row="1" column="1"> - <widget class="QGroupBox" name="faceButtons_5"> + <widget class="QGroupBox" name="RStick"> <property name="title"> <string>Right Stick</string> </property> @@ -430,9 +430,9 @@ Capture:</string> </property> <layout class="QGridLayout" name="gridLayout_5"> <item row="1" column="1"> - <layout class="QVBoxLayout" name="verticalLayout_24"> + <layout class="QVBoxLayout" name="buttonRStickDownVerticalLayout"> <item> - <widget class="QLabel" name="label_26"> + <widget class="QLabel" name="labelRStickDown"> <property name="text"> <string>Down:</string> </property> @@ -448,9 +448,9 @@ Capture:</string> </layout> </item> <item row="0" column="1"> - <layout class="QVBoxLayout" name="verticalLayout_22"> + <layout class="QVBoxLayout" name="buttonRStickRightVerticalLayout"> <item> - <widget class="QLabel" name="label_27"> + <widget class="QLabel" name="labelRStickRight"> <property name="text"> <string>Right:</string> </property> @@ -473,9 +473,9 @@ Capture:</string> </widget> </item> <item row="1" column="0"> - <layout class="QVBoxLayout" name="verticalLayout_21"> + <layout class="QVBoxLayout" name="buttonRStickLeftVerticalLayout"> <item> - <widget class="QLabel" name="label_25"> + <widget class="QLabel" name="labelRStickLeft"> <property name="text"> <string>Left:</string> </property> @@ -491,9 +491,9 @@ Capture:</string> </layout> </item> <item row="0" column="0"> - <layout class="QVBoxLayout" name="verticalLayout_25"> + <layout class="QVBoxLayout" name="buttonRStickUpVerticalLayout"> <item> - <widget class="QLabel" name="label_28"> + <widget class="QLabel" name="labelRStickUp"> <property name="text"> <string>Up:</string> </property> @@ -509,9 +509,9 @@ Capture:</string> </layout> </item> <item row="2" column="0"> - <layout class="QVBoxLayout" name="verticalLayout_6"> + <layout class="QVBoxLayout" name="buttonRStickPressedVerticalLayout"> <item> - <widget class="QLabel" name="label_5"> + <widget class="QLabel" name="labelRStickPressed"> <property name="text"> <string>Pressed:</string> </property> @@ -527,9 +527,9 @@ Capture:</string> </layout> </item> <item row="2" column="1"> - <layout class="QVBoxLayout" name="verticalLayout_32"> + <layout class="QVBoxLayout" name="buttonRStickModVerticalLayout"> <item> - <widget class="QLabel" name="label_10"> + <widget class="QLabel" name="labelRStickMod"> <property name="text"> <string>Modifier:</string> </property> @@ -548,7 +548,7 @@ Capture:</string> </widget> </item> <item row="1" column="0"> - <widget class="QGroupBox" name="faceButtons_4"> + <widget class="QGroupBox" name="LStick"> <property name="title"> <string>Left Stick</string> </property> @@ -560,9 +560,9 @@ Capture:</string> </property> <layout class="QGridLayout" name="gridLayout_4"> <item row="1" column="1"> - <layout class="QVBoxLayout" name="verticalLayout_20"> + <layout class="QVBoxLayout" name="buttonLStickDownVerticalLayout"> <item> - <widget class="QLabel" name="label_22"> + <widget class="QLabel" name="labelLStickDown"> <property name="text"> <string>Down:</string> </property> @@ -585,9 +585,9 @@ Capture:</string> </widget> </item> <item row="0" column="1"> - <layout class="QVBoxLayout" name="verticalLayout_18"> + <layout class="QVBoxLayout" name="buttonLStickRightVerticalLayout"> <item> - <widget class="QLabel" name="label_23"> + <widget class="QLabel" name="labelLStickRight"> <property name="text"> <string>Right:</string> </property> @@ -603,9 +603,9 @@ Capture:</string> </layout> </item> <item row="0" column="0"> - <layout class="QVBoxLayout" name="verticalLayout_17"> + <layout class="QVBoxLayout" name="buttonLStickLeftVerticalLayout"> <item> - <widget class="QLabel" name="label_21"> + <widget class="QLabel" name="labelLStickLeft"> <property name="text"> <string>Left:</string> </property> @@ -621,9 +621,9 @@ Capture:</string> </layout> </item> <item row="1" column="0"> - <layout class="QVBoxLayout" name="verticalLayout_19"> + <layout class="QVBoxLayout" name="buttonLStickUpVerticalLayout"> <item> - <widget class="QLabel" name="label_24"> + <widget class="QLabel" name="labelLStickUp"> <property name="text"> <string>Up:</string> </property> @@ -639,9 +639,9 @@ Capture:</string> </layout> </item> <item row="3" column="0"> - <layout class="QVBoxLayout" name="verticalLayout_31"> + <layout class="QVBoxLayout" name="buttonLStickModVerticalLayout"> <item> - <widget class="QLabel" name="label_9"> + <widget class="QLabel" name="labelLStickMod"> <property name="text"> <string>Modifier:</string> </property> @@ -657,9 +657,9 @@ Capture:</string> </layout> </item> <item row="3" column="1"> - <layout class="QVBoxLayout" name="verticalLayout_7" stretch="0,0"> + <layout class="QVBoxLayout" name="buttonLStickPressedVerticalLayout" stretch="0,0"> <item> - <widget class="QLabel" name="label_6"> + <widget class="QLabel" name="labelLStickPressed"> <property name="text"> <string>Pressed:</string> </property> diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index d198e38ae..d09505a0f 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -9,7 +9,18 @@ #include "yuzu/ui_settings.h" static const std::array<int, 12> days_in_month = {{ - 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, + 31, + 29, + 31, + 30, + 31, + 30, + 31, + 31, + 30, + 31, + 30, + 31, }}; ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureSystem) { @@ -72,5 +83,6 @@ void ConfigureSystem::refreshConsoleID() { if (reply == QMessageBox::No) return; u64 console_id{}; - ui->label_console_id->setText("Console ID: 0x" + QString::number(console_id, 16).toUpper()); + ui->label_console_id->setText( + tr("Console ID: 0x%1").arg(QString::number(console_id, 16).toUpper())); } diff --git a/src/yuzu/debugger/profiler.cpp b/src/yuzu/debugger/profiler.cpp index cc9babe84..8b30e0a85 100644 --- a/src/yuzu/debugger/profiler.cpp +++ b/src/yuzu/debugger/profiler.cpp @@ -74,7 +74,7 @@ QAction* MicroProfileDialog::toggleViewAction() { toggle_view_action = new QAction(windowTitle(), this); toggle_view_action->setCheckable(true); toggle_view_action->setChecked(isVisible()); - connect(toggle_view_action, SIGNAL(toggled(bool)), SLOT(setVisible(bool))); + connect(toggle_view_action, &QAction::toggled, this, &MicroProfileDialog::setVisible); } return toggle_view_action; @@ -107,7 +107,8 @@ MicroProfileWidget::MicroProfileWidget(QWidget* parent) : QWidget(parent) { MicroProfileSetDisplayMode(1); // Timers screen MicroProfileInitUI(); - connect(&update_timer, SIGNAL(timeout()), SLOT(update())); + connect(&update_timer, &QTimer::timeout, this, + static_cast<void (MicroProfileWidget::*)()>(&MicroProfileWidget::update)); } void MicroProfileWidget::paintEvent(QPaintEvent* ev) { diff --git a/src/yuzu/debugger/wait_tree.h b/src/yuzu/debugger/wait_tree.h index 4034e909b..e538174eb 100644 --- a/src/yuzu/debugger/wait_tree.h +++ b/src/yuzu/debugger/wait_tree.h @@ -20,7 +20,7 @@ class Mutex; class ConditionVariable; class Thread; class Timer; -} +} // namespace Kernel class WaitTreeThread; diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 679c89828..76ced4de4 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -114,8 +114,7 @@ GameList::SearchField::SearchField(GameList* parent) : QWidget{parent} { edit_filter->setPlaceholderText(tr("Enter pattern to filter")); edit_filter->installEventFilter(keyReleaseEater); edit_filter->setClearButtonEnabled(true); - connect(edit_filter, SIGNAL(textChanged(const QString&)), parent, - SLOT(onTextChanged(const QString&))); + connect(edit_filter, &QLineEdit::textChanged, parent, &GameList::onTextChanged); label_filter_result = new QLabel; button_filter_close = new QToolButton(this); button_filter_close->setText("X"); @@ -124,7 +123,7 @@ GameList::SearchField::SearchField(GameList* parent) : QWidget{parent} { "#000000; font-weight: bold; background: #F0F0F0; }" "QToolButton:hover{ border: none; padding: 0px; color: " "#EEEEEE; font-weight: bold; background: #E81123}"); - connect(button_filter_close, SIGNAL(clicked()), parent, SLOT(onFilterCloseClicked())); + connect(button_filter_close, &QToolButton::clicked, parent, &GameList::onFilterCloseClicked); layout_filter->setSpacing(10); layout_filter->addWidget(label_filter); layout_filter->addWidget(edit_filter); @@ -137,8 +136,8 @@ GameList::SearchField::SearchField(GameList* parent) : QWidget{parent} { * Checks if all words separated by spaces are contained in another string * This offers a word order insensitive search function * - * @param String that gets checked if it contains all words of the userinput string - * @param String containing all words getting checked + * @param haystack String that gets checked if it contains all words of the userinput string + * @param userinput String containing all words getting checked * @return true if the haystack contains all words of userinput */ bool GameList::containsAllWords(QString haystack, QString userinput) { diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h index 4823a1296..7aff597b7 100644 --- a/src/yuzu/game_list.h +++ b/src/yuzu/game_list.h @@ -49,7 +49,7 @@ public: QString edit_filter_text_old; protected: - bool eventFilter(QObject* obj, QEvent* event); + bool eventFilter(QObject* obj, QEvent* event) override; }; QHBoxLayout* layout_filter = nullptr; QTreeView* tree_view = nullptr; diff --git a/src/yuzu/hotkeys.cpp b/src/yuzu/hotkeys.cpp index 42f026464..61acb38ee 100644 --- a/src/yuzu/hotkeys.cpp +++ b/src/yuzu/hotkeys.cpp @@ -5,6 +5,7 @@ #include <map> #include <QKeySequence> #include <QShortcut> +#include <QTreeWidgetItem> #include <QtGlobal> #include "yuzu/hotkeys.h" #include "yuzu/ui_settings.h" diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 31f2825ee..e5252abdc 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -175,7 +175,7 @@ void GMainWindow::InitializeRecentFileMenuActions() { for (int i = 0; i < max_recent_files_item; ++i) { actions_recent_files[i] = new QAction(this); actions_recent_files[i]->setVisible(false); - connect(actions_recent_files[i], SIGNAL(triggered()), this, SLOT(OnMenuRecentFile())); + connect(actions_recent_files[i], &QAction::triggered, this, &GMainWindow::OnMenuRecentFile); ui.menu_recent_files->addAction(actions_recent_files[i]); } @@ -190,10 +190,10 @@ void GMainWindow::InitializeHotkeys() { RegisterHotkey("Main Window", "Exit Fullscreen", QKeySequence::Cancel, Qt::ApplicationShortcut); LoadHotkeys(); - connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this, - SLOT(OnMenuLoadFile())); - connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, - SLOT(OnStartGame())); + connect(GetHotkey("Main Window", "Load File", this), &QShortcut::activated, this, + &GMainWindow::OnMenuLoadFile); + connect(GetHotkey("Main Window", "Start Emulation", this), &QShortcut::activated, this, + &GMainWindow::OnStartGame); connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activated, ui.action_Fullscreen, &QAction::trigger); connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activatedAmbiguously, @@ -245,13 +245,14 @@ void GMainWindow::RestoreUIState() { } void GMainWindow::ConnectWidgetEvents() { - connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString))); - connect(game_list, SIGNAL(OpenSaveFolderRequested(u64)), this, - SLOT(OnGameListOpenSaveFolder(u64))); + connect(game_list, &GameList::GameChosen, this, &GMainWindow::OnGameListLoadFile); + connect(game_list, &GameList::OpenSaveFolderRequested, this, + &GMainWindow::OnGameListOpenSaveFolder); - connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, - SLOT(OnEmulationStarting(EmuThread*))); - connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping())); + connect(this, &GMainWindow::EmulationStarting, render_window, + &GRenderWindow::OnEmulationStarting); + connect(this, &GMainWindow::EmulationStopping, render_window, + &GRenderWindow::OnEmulationStopping); connect(&status_bar_update_timer, &QTimer::timeout, this, &GMainWindow::UpdateStatusBar); } @@ -398,17 +399,17 @@ void GMainWindow::BootGame(const QString& filename) { render_window->moveContext(); emu_thread->start(); - connect(render_window, SIGNAL(Closed()), this, SLOT(OnStopGame())); + connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame); // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views // before the CPU continues - connect(emu_thread.get(), SIGNAL(DebugModeEntered()), registersWidget, - SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection); - connect(emu_thread.get(), SIGNAL(DebugModeEntered()), waitTreeWidget, - SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection); - connect(emu_thread.get(), SIGNAL(DebugModeLeft()), registersWidget, SLOT(OnDebugModeLeft()), - Qt::BlockingQueuedConnection); - connect(emu_thread.get(), SIGNAL(DebugModeLeft()), waitTreeWidget, SLOT(OnDebugModeLeft()), - Qt::BlockingQueuedConnection); + connect(emu_thread.get(), &EmuThread::DebugModeEntered, registersWidget, + &RegistersWidget::OnDebugModeEntered, Qt::BlockingQueuedConnection); + connect(emu_thread.get(), &EmuThread::DebugModeEntered, waitTreeWidget, + &WaitTreeWidget::OnDebugModeEntered, Qt::BlockingQueuedConnection); + connect(emu_thread.get(), &EmuThread::DebugModeLeft, registersWidget, + &RegistersWidget::OnDebugModeLeft, Qt::BlockingQueuedConnection); + connect(emu_thread.get(), &EmuThread::DebugModeLeft, waitTreeWidget, + &WaitTreeWidget::OnDebugModeLeft, Qt::BlockingQueuedConnection); // Update the GUI registersWidget->OnDebugModeEntered(); @@ -437,7 +438,7 @@ void GMainWindow::ShutdownGame() { emu_thread = nullptr; // The emulation is stopped, so closing the window or not does not matter anymore - disconnect(render_window, SIGNAL(Closed()), this, SLOT(OnStopGame())); + disconnect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame); // Update the GUI ui.action_Start->setEnabled(false); @@ -548,8 +549,7 @@ void GMainWindow::OnStartGame() { emu_thread->SetRunning(true); qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus"); qRegisterMetaType<std::string>("std::string"); - connect(emu_thread.get(), SIGNAL(ErrorThrown(Core::System::ResultStatus, std::string)), this, - SLOT(OnCoreError(Core::System::ResultStatus, std::string))); + connect(emu_thread.get(), &EmuThread::ErrorThrown, this, &GMainWindow::OnCoreError); ui.action_Start->setEnabled(false); ui.action_Start->setText(tr("Continue")); diff --git a/src/yuzu/ui_settings.h b/src/yuzu/ui_settings.h index d093da641..9036ce2c1 100644 --- a/src/yuzu/ui_settings.h +++ b/src/yuzu/ui_settings.h @@ -50,4 +50,4 @@ struct Values { }; extern Values values; -} +} // namespace UISettings diff --git a/src/yuzu/util/spinbox.cpp b/src/yuzu/util/spinbox.cpp index 92753ec1c..14ef1e884 100644 --- a/src/yuzu/util/spinbox.cpp +++ b/src/yuzu/util/spinbox.cpp @@ -39,7 +39,7 @@ CSpinBox::CSpinBox(QWidget* parent) // TODO: Might be nice to not immediately call the slot. // Think of an address that is being replaced by a different one, in which case a lot // invalid intermediate addresses would be read from during editing. - connect(lineEdit(), SIGNAL(textEdited(QString)), this, SLOT(OnEditingFinished())); + connect(lineEdit(), &QLineEdit::textEdited, this, &CSpinBox::OnEditingFinished); UpdateText(); } |