diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index 51185efc4..ade75a0bf --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.qm *.diff *.mo +.flatpak-builder Makefile antimicro !share/antimicro @@ -19,6 +20,7 @@ vmulti/ windows/*.msi windows/*.wix* build/ +build-dir/ Build/ CMakeLists.txt.user* other/antimicro.1.gz diff --git a/AntiMicro Future Developments.mm b/AntiMicro Future Developments.mm old mode 100644 new mode 100755 diff --git a/BuildOptions.md b/BuildOptions.md old mode 100644 new mode 100755 diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100644 new mode 100755 index 024c3659b..3c432894e --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} "${CMAKE_CURRENT_S if (NOT WIN32) -find_package(ECM 5.43.0 REQUIRED CONFIG) +find_package(ECM REQUIRED CONFIG) endif(NOT WIN32) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -41,11 +41,14 @@ endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) endif(UNIX AND NOT APPLE) include(CheckCXXCompilerFlag) +include(GNUInstallDirs) CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) + if(COMPILER_SUPPORTS_CXX11) if (NOT WIN32) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -Werror -Wall -Wextra -Wno-unused-parameter -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wunused-but-set-parameter -pedantic -Wno-reorder -std=c++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wstrict-null-sentinel -Wstrict-overflow=5 -Wundef -Wno-unused -std=c++11") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") endif() @@ -68,11 +71,16 @@ set(ANTIMICRO_MAJOR_VERSION 2) set(ANTIMICRO_MINOR_VERSION 24) set(ANTIMICRO_PATCH_VERSION 0) +option(WITH_TESTS "Allow tests for classes" OFF) option(USE_SDL_2 "Use SDL 2 libraries." ON) +if(WITH_TESTS) + message("Tests enabled") +endif(WITH_TESTS) + if(UNIX) option(WITH_X11 "Compile with support for X11." ON) - option(WITH_UINPUT "Compile with support for uinput. uinput will be usable to simulate events." ON) + option(WITH_UINPUT "Compile with support for uinput. uinput will be usable to simulate events." OFF) option(WITH_XTEST "Compile with support for XTest. XTest will be usable to simulate events." ON) option(APPDATA "Build project with AppData file support." ON) endif(UNIX) @@ -230,7 +238,6 @@ set(antimicro_SOURCES src/slotitemlistwidget.cpp src/eventhandlers/baseeventhandler.cpp src/eventhandlerfactory.cpp - src/profileimporter.cpp src/uihelpers/advancebuttondialoghelper.cpp src/uihelpers/buttoneditdialoghelper.cpp src/uihelpers/joytabwidgethelper.cpp @@ -245,6 +252,7 @@ set(antimicro_SOURCES src/mousedialog/uihelpers/mousecontrolsticksettingsdialoghelper.cpp src/mousedialog/uihelpers/mousedpadsettingsdialoghelper.cpp src/calibration.cpp + src/globalvariables.cpp ) set(antimicro_HEADERS @@ -328,7 +336,6 @@ set(antimicro_HEADERS src/slotitemlistwidget.h src/eventhandlers/baseeventhandler.h src/eventhandlerfactory.h - src/profileimporter.h src/uihelpers/advancebuttondialoghelper.h src/uihelpers/buttoneditdialoghelper.h src/uihelpers/joytabwidgethelper.h @@ -343,6 +350,7 @@ set(antimicro_HEADERS src/mousedialog/uihelpers/mousecontrolsticksettingsdialoghelper.h src/mousedialog/uihelpers/mousedpadsettingsdialoghelper.h src/calibration.h + src/globalvariables.h ) set(antimicro_FORMS src/mainwindow.ui @@ -366,7 +374,6 @@ set(antimicro_FORMS src/mainwindow.ui src/extraprofilesettingsdialog.ui src/capturedwindowinfodialog.ui src/calibration.ui - src/profileimporter.ui ) set(antimicro_RESOURCES src/resources.qrc) @@ -454,33 +461,6 @@ elseif(WIN32) endif(WITH_VMULTI) endif(UNIX) -set(USE_QT5 OFF) - -if(UNIX) - # Check if Qt 5 was specified using an environment variable - # or by specifying -DQT_QMAKE_EXECUTABLE. - # Otherwise, check for Qt libraries. - if("$ENV{QT_SELECT}" EQUAL 5) - set(USE_QT5 ON) - elseif(QT_QMAKE_EXECUTABLE MATCHES ".*/qmake-qt5") - set(USE_QT5 ON) - else() - find_package(Qt5Core QUIET) - if(Qt5Core_FOUND) - set(USE_QT5 ON) - endif(Qt5Core_FOUND) - endif("$ENV{QT_SELECT}" EQUAL 5) -elseif(WIN32) - # Use Qt5 on Windows. - set(USE_QT5 ON) -endif(UNIX) - -if(USE_QT5) - message("Qt5 has been found") -else() - message(FATAL_ERROR "No Qt version was specified.") -endif(USE_QT5) - if(USE_SDL_2) add_definitions(-DUSE_SDL_2) endif(USE_SDL_2) @@ -506,7 +486,6 @@ if(UNIX) endif(UNIX) if (UNIX) - if (USE_QT5) find_package(Qt5Widgets REQUIRED) find_package(Qt5Core REQUIRED) @@ -517,12 +496,11 @@ if (UNIX) QT5_WRAP_CPP(antimicro_HEADERS_MOC ${antimicro_HEADERS}) QT5_WRAP_UI(antimicro_FORMS_HEADERS ${antimicro_FORMS}) QT5_ADD_RESOURCES(antimicro_RESOURCES_RCC ${antimicro_RESOURCES}) + add_subdirectory("share/antimicro/translations") set(CMAKE_POSITION_INDEPENDENT_CODE ON) - endif(USE_QT5) - elseif(WIN32) find_package(Qt5Widgets REQUIRED) @@ -555,59 +533,11 @@ if(UNIX) endif(USE_SDL_2) elseif (WIN32) if(USE_SDL_2) - set(SDL2_LIBRARY "") - set(SDL2_LIBRARY_DIR "") - set(SDL2_INCLUDE_DIR "") - set(SDL2_DLL_LOCATION_DIR "") - - if (MSYS OR MINGW) - find_package(PkgConfig QUIET) - if(PKG_CONFIG_FOUND) - #include(FindPkgConfig) - - pkg_check_modules(SDL2 QUIET sdl2) - if(SDL2_FOUND) - #find_path(SDL2_INCLUDE_DIR "SDL2/SDL.h" HINTS ${SDL2_INCLUDE_DIRS}) - - set(SDL2_LIBRARY ${SDL2_LIBRARIES}) - set(SDL2_LIBRARY_DIR ${SDL2_LIBRARY_DIRS}) - set(SDL2_INCLUDE_DIR ${SDL2_INCLUDE_DIRS}) - unset(SDL2_DLL_LOCATION_DIR) - find_path(SDL2_DLL_LOCATION_DIR "SDL2.dll" HINTS "${SDL2_LIBRARY_DIRS}/../bin") - #set(SDL2_DLL_LOCATION_DIR "${SDL2_LIBRARY_DIRS}/../bin") - - list(APPEND LIBS ${SDL2_LIBRARIES}) - endif(SDL2_FOUND) - endif(PKG_CONFIG_FOUND) - endif(MSYS OR MINGW) - - if (NOT SDL2_LIBRARY) - # Perform extra voodoo to get proper library paths and include - # proper headers. - file(GLOB SDL2_BASE_DIR "${PROJECT_SOURCE_DIR}/SDL2-*.*.*/") - - if (SDL2_BASE_DIR) - unset(SDL2_LIBRARY) - - if(TARGET_ARCH STREQUAL "x86_64") - set(SDL2_LIBRARY_DIR "${SDL2_BASE_DIR}/x86_64-w64-mingw32/lib") - set(SDL2_INCLUDE_DIR "${SDL2_BASE_DIR}/x86_64-w64-mingw32/include") - set(SDL2_DLL_LOCATION_DIR "${SDL2_BASE_DIR}/x86_64-w64-mingw32/bin") - - find_library(SDL2_LIBRARY SDL2 ${SDL2_LIBRARY_DIR}) - list(APPEND LIBS ${SDL2_LIBRARY}) - include_directories(${SDL2_INCLUDE_DIR}) - else() - set(SDL2_LIBRARY_DIR "${SDL2_BASE_DIR}/i686-w64-mingw32/lib") - set(SDL2_INCLUDE_DIR "${SDL2_BASE_DIR}/i686-w64-mingw32/include") - set(SDL2_DLL_LOCATION_DIR "${SDL2_BASE_DIR}/i686-w64-mingw32/bin") - - find_library(SDL2_LIBRARY SDL2 ${SDL2_LIBRARY_DIR}) - list(APPEND LIBS ${SDL2_LIBRARY}) - include_directories(${SDL2_INCLUDE_DIR}) - endif(TARGET_ARCH STREQUAL "x86_64") - endif(SDL2_BASE_DIR) - endif(NOT SDL2_LIBRARY) + + if(SDL2_LIBRARY_DIR AND SDL2_INCLUDE_DIR) + list(APPEND LIBS ${SDL2_LIBRARY}) + include_directories(${SDL2_INCLUDE_DIR}) + endif(SDL2_LIBRARY_DIR AND SDL2_INCLUDE_DIR) add_definitions(-DUNICODE -D_UNICODE) endif(USE_SDL_2) @@ -634,35 +564,64 @@ if(UNIX) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") endif(UNIX) - -if(USE_QT5) if(UNIX) - add_executable(antimicro ${antimicro_MAIN} ${antimicro_HEADERS_MOC} ${antimicro_SOURCES} ${antimicro_FORMS_HEADERS} ${antimicro_RESOURCES_RCC}) - target_link_libraries (antimicro Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Network) + add_library( antilib + SHARED + ${antimicro_HEADERS_MOC} + ${antimicro_SOURCES} + ${antimicro_FORMS_HEADERS} + ${antimicro_RESOURCES_RCC} + ) + + target_link_libraries (antilib Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Network ${SDL2_LIBRARIES} ${LIBS}) + + add_executable(antimicro ${antimicro_MAIN}) + target_link_libraries (antimicro antilib Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Network) + elseif(WIN32) + + add_library( antilib + SHARED + ${antimicro_HEADERS_MOC} + ${antimicro_SOURCES} + ${antimicro_FORMS_HEADERS} + ${antimicro_RESOURCES_RCC} + src/antimicro.rc + ) + # The WIN32 is required to specify a GUI application. - add_executable(antimicro ${antimicro_MAIN} ${antimicro_HEADERS_MOC} ${antimicro_SOURCES} ${antimicro_FORMS_HEADERS} ${antimicro_RESOURCES_RCC} src/antimicro.rc) - target_link_libraries (antimicro Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Network) + add_executable(antimicro ${antimicro_MAIN}) + target_link_libraries (antimicro antilib Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Network ${LIBS}) endif(UNIX) target_compile_definitions(antimicro PUBLIC QT_DEBUG_NO_OUTPUT) # should be commented during development -endif(USE_QT5) -# Add link libraries. -#message(${LIBS}) -target_link_libraries(antimicro ${LIBS}) # Specify out directory for final executable. if(UNIX) - install(TARGETS antimicro RUNTIME DESTINATION "bin") + install(TARGETS antimicro RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + install(TARGETS antilib DESTINATION "${CMAKE_INSTALL_LIBDIR}") + install(FILES ${antimicro_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/antimicro") elseif(WIN32) install(TARGETS antimicro RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(TARGETS antilib + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT runtime + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT devel + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT devel) + install(FILES ${antimicro_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") endif(UNIX) if(UNIX) - install(FILES src/images/antimicro.png DESTINATION "share/pixmaps") - install(FILES other/antimicro.desktop DESTINATION "share/applications") - install(FILES other/antimicro.xml DESTINATION "share/mime/packages") + install(FILES src/images/32x32/com.github.juliagoda.antimicro.png DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pixmaps") + install(FILES src/images/16x16/com.github.juliagoda.antimicro.png DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps") + install(FILES src/images/24x24/com.github.juliagoda.antimicro.png DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/24x24/apps") + install(FILES src/images/32x32/com.github.juliagoda.antimicro.png DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps") + install(FILES src/images/48x48/com.github.juliagoda.antimicro.png DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps") + install(FILES src/images/64x64/com.github.juliagoda.antimicro.png DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/64x64/apps") + + + install(FILES other/com.github.juliagoda.antimicro.desktop DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications") + install(FILES other/com.github.juliagoda.antimicro.xml DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/mime/packages") endif(UNIX) # Add man page for *nix platforms. @@ -750,7 +709,7 @@ if(WIN32) list(APPEND EXTRA_DLL_FILES ${GCC_DLL} - "${SDL2_BASE_DIR}/i686-w64-mingw32/bin/SDL2.dll" + "${SDL2_BASE_DIR}/i686-w64-mingw32/bin/SDIRDL2.dll" ) endif(TARGET_ARCH STREQUAL "x86_64") @@ -804,7 +763,6 @@ if(WIN32) install(CODE "execute_process(COMMAND \"C:/Program Files (x86)/Windows Kits/8.1/bin/x64/signtool.exe\" sign /v /a /s ROOT /n antimicro ${CMAKE_INSTALL_PREFIX}/antimicro.exe)") endif(PERFORM_SIGNING) - # Set variables needed for MSI building. set(MSIFOLDER "${PROJECT_SOURCE_DIR}/windows") set(WIXENV $ENV{WIX}) @@ -825,7 +783,7 @@ if(WIN32) set(MSIFILENAME "${MSIFILENAME}.${ANTIMICRO_PATCH_VERSION}") endif(ANTIMICRO_PATCH_VERSION AND NOT ANTIMICRO_PATCH_VERSION EQUAL 0) - # Change output file depending on the target architecture. + # Change outputlib file depending on the target architecture. if(TARGET_ARCH STREQUAL "x86_64") set(WIXMSI "${MSIFOLDER}/antimicro-${MSIFILENAME}-win64.msi") else() @@ -859,3 +817,10 @@ if(WIN32) install(FILES gpl.txt Changelog README.md ProfileTips.md DESTINATION ${CMAKE_INSTALL_PREFIX}) endif(WIN32) + + + +if(WITH_TESTS) + enable_testing () + add_subdirectory (tests) +endif(WITH_TESTS) diff --git a/Changelog b/Changelog old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/ProfileTips.md b/ProfileTips.md old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 index b20ca782e..2351b3a6a --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# antimicro 2.23 +# antimicro 2.24 1. [Description](#description) 2. [License](#license) diff --git a/Resources.txt b/Resources.txt old mode 100644 new mode 100755 diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in old mode 100644 new mode 100755 diff --git a/com.github.juliagoda.antimicro.json b/com.github.juliagoda.antimicro.json new file mode 100644 index 000000000..3da903de0 --- /dev/null +++ b/com.github.juliagoda.antimicro.json @@ -0,0 +1,36 @@ +{ + "app-id": "com.github.juliagoda.antimicro", + "runtime": "org.kde.Platform", + "runtime-version": "5.11", + "sdk": "org.kde.Sdk", + "command": "antimicro", + "finish-args": [ + "--device=all", + "--socket=x11", + "--socket=fallback-x11", + "--share=ipc", + "--share=network", + "--talk-name=org.freedesktop.Notifications", + "--talk-name=org.kde.StatusNotifierWatcher", + "--socket=system-bus" + ], + "modules": [ + { + "name": "antimicro", + "buildsystem": "cmake", + "builddir": true, + "config-opts": [ + "-DAPPDATA=ON", + "-DUSE_SDL_2=ON", + "-DWITH_UINPUT=OFF", + "-DWITH_XTEST=ON", + "-DCMAKE_BUILD_TYPE=Release" + ], + "sources": [ + { + "type": "git", + "url": "https://github.com/juliagoda/antimicro.git" + }] + } + ] +} diff --git a/other/40-uinput.rules b/other/40-uinput.rules old mode 100644 new mode 100755 diff --git a/other/CMakeLists.txt b/other/CMakeLists.txt old mode 100644 new mode 100755 index bb8977bde..10b3cabfd --- a/other/CMakeLists.txt +++ b/other/CMakeLists.txt @@ -4,4 +4,4 @@ add_custom_target(manpage) add_custom_command(TARGET manpage PRE_BUILD COMMAND gzip -c "${PROJECT_SOURCE_DIR}/other/antimicro.1" > "antimicro.1.gz" VERBATIM ) -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/antimicro.1.gz" DESTINATION "share/man/man1") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/antimicro.1.gz" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/man/man1") diff --git a/other/antimicro.1 b/other/antimicro.1 old mode 100644 new mode 100755 diff --git a/other/appdata/CMakeLists.txt b/other/appdata/CMakeLists.txt old mode 100644 new mode 100755 index 8fe97cc1c..f54e7424d --- a/other/appdata/CMakeLists.txt +++ b/other/appdata/CMakeLists.txt @@ -8,9 +8,9 @@ if(APPDATA) # Add an entry per language COMMAND msgfmt "${PROJECT_SOURCE_DIR}/other/appdata/PO_files/en.po" -o "${CMAKE_CURRENT_BINARY_DIR}/PO_files/en.mo" - COMMAND itstool -i "${PROJECT_SOURCE_DIR}/other/appdata/appdata.its" -j "${PROJECT_SOURCE_DIR}/other/appdata/antimicro.appdata.xml.in" -o "antimicro.appdata.xml" "${CMAKE_CURRENT_BINARY_DIR}/PO_files/*.mo" + COMMAND itstool -i "${PROJECT_SOURCE_DIR}/other/appdata/appdata.its" -j "${PROJECT_SOURCE_DIR}/other/appdata/com.github.juliagoda.antimicro.appdata.xml.in" -o "com.github.juliagoda.antimicro.appdata.xml" "${CMAKE_CURRENT_BINARY_DIR}/PO_files/*.mo" ) # Only install an appdata file if the user requested to have one built. - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/antimicro.appdata.xml" DESTINATION "share/appdata") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/com.github.juliagoda.antimicro.appdata.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo") endif(APPDATA) diff --git a/other/appdata/PO_files/en.po b/other/appdata/PO_files/en.po old mode 100644 new mode 100755 diff --git a/other/appdata/appdata.its b/other/appdata/appdata.its old mode 100644 new mode 100755 diff --git a/other/appdata/com.github.juliagoda.antimicro.appdata.xml.in b/other/appdata/com.github.juliagoda.antimicro.appdata.xml.in new file mode 100644 index 000000000..305b93ff2 --- /dev/null +++ b/other/appdata/com.github.juliagoda.antimicro.appdata.xml.in @@ -0,0 +1,80 @@ + + + com.github.juliagoda.antimicro.desktop + CC0-1.0 + GPL-3.0+ + antimicro + Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support. + +

+ antimicro is a graphical program used to map keyboard keys and mouse + controls to a gamepad. This program is useful for playing PC games using a + gamepad that do not have any form of built-in gamepad support. +

+

+ antimicro was inspired by QJoyPad but has additional features. +

+
+ https://github.com/juliagoda/antimicro + + +​ + + + + + + antimicro + + juliagoda.pl_AT_protonmail.com + + ModernToolkit + + + + https://raw.githubusercontent.com/juliagoda/antimicro/master/other/appdata/screenshots/application_trayicon.png + Application Tray Icon + + + https://raw.githubusercontent.com/juliagoda/antimicro/master/other/appdata/screenshots/controller_callibration_dark_theme.png + Controller Calibration (Dark Theme) + + + https://raw.githubusercontent.com/juliagoda/antimicro/master/other/appdata/screenshots/controller_main_window_dark_theme_1.png + Profile Configuration Dialog 1 (Dark Theme) + + + https://raw.githubusercontent.com/juliagoda/antimicro/master/other/appdata/screenshots/controller_main_window_dark_theme_2.png + Profile Configuration Dialog 2 (Dark Theme) + + + https://raw.githubusercontent.com/juliagoda/antimicro/master/other/appdata/screenshots/controller_configure_dark_theme.png + Analog Sticks Configuration Dialog (Dark Theme) + + + https://raw.githubusercontent.com/juliagoda/antimicro/master/other/appdata/screenshots/controller_mapping_dark_theme.png + Controller Mapping Dialog (Dark Theme) + + + https://github.com/juliagoda/antimicro + juliagoda.pl_AT_protonmail.com + + game + controller + joystick + keyboard + mouse + + + none + none + none + none + none + none + none + none + none + none + +
diff --git a/other/appdata/screenshots/about_window.png b/other/appdata/screenshots/about_window.png new file mode 100644 index 000000000..ffcfbb9a1 Binary files /dev/null and b/other/appdata/screenshots/about_window.png differ diff --git a/other/appdata/screenshots/application_trayicon.png b/other/appdata/screenshots/application_trayicon.png new file mode 100644 index 000000000..83e8d2969 Binary files /dev/null and b/other/appdata/screenshots/application_trayicon.png differ diff --git a/other/appdata/screenshots/controller_callibration_dark_theme.png b/other/appdata/screenshots/controller_callibration_dark_theme.png new file mode 100644 index 000000000..287a61f38 Binary files /dev/null and b/other/appdata/screenshots/controller_callibration_dark_theme.png differ diff --git a/other/appdata/screenshots/controller_configure_dark_theme.png b/other/appdata/screenshots/controller_configure_dark_theme.png old mode 100644 new mode 100755 diff --git a/other/appdata/screenshots/controller_main_window_dark_theme_1.png b/other/appdata/screenshots/controller_main_window_dark_theme_1.png new file mode 100644 index 000000000..57e46cc99 Binary files /dev/null and b/other/appdata/screenshots/controller_main_window_dark_theme_1.png differ diff --git a/other/appdata/screenshots/controller_main_window_dark_theme_2.png b/other/appdata/screenshots/controller_main_window_dark_theme_2.png new file mode 100644 index 000000000..7089fe832 Binary files /dev/null and b/other/appdata/screenshots/controller_main_window_dark_theme_2.png differ diff --git a/other/appdata/screenshots/controller_mapping_dark_theme.png b/other/appdata/screenshots/controller_mapping_dark_theme.png old mode 100644 new mode 100755 index c370bbcaf..79b966239 Binary files a/other/appdata/screenshots/controller_mapping_dark_theme.png and b/other/appdata/screenshots/controller_mapping_dark_theme.png differ diff --git a/other/com.github.juliagoda.antimicro.desktop b/other/com.github.juliagoda.antimicro.desktop new file mode 100755 index 000000000..e2e1853f9 --- /dev/null +++ b/other/com.github.juliagoda.antimicro.desktop @@ -0,0 +1,18 @@ +[Desktop Entry] +Name=antimicro +Comment=Use a gamepad to control a variety of programs +Name[sr]=Анти-микро +Comment[sr]=Користите џојстик или играћу тастатуру за управљање различитим програмима +Name[fr]=AntiMicro +Comment[fr]=Utilisez une manette de jeu pour commander un logiciel +Name[de]=AntiMicro +Comment[de]=Nutze das Gamepad um Programme/Spiele zu steuern +Comment[uk]=Використовуйте ігровий маніпулятор для керування програмами +Exec=antimicro +Icon=com.github.juliagoda.antimicro +StartupNotify=true +Terminal=false +Type=Application +Categories=Qt;Utility; +MimeType=application/x-amgp; +Keywords=game;controller;keyboard;joystick;mouse; diff --git a/other/com.github.juliagoda.antimicro.xml b/other/com.github.juliagoda.antimicro.xml new file mode 100755 index 000000000..e4719ac3d --- /dev/null +++ b/other/com.github.juliagoda.antimicro.xml @@ -0,0 +1,7 @@ + + + + AntiMicro Profile + + + diff --git a/other/scripts/build-sdl-lib.bat b/other/scripts/build-sdl-lib.bat old mode 100644 new mode 100755 diff --git a/other/spec/antimicro-git.spec b/other/spec/antimicro-git.spec old mode 100644 new mode 100755 diff --git a/repo/.lock b/repo/.lock new file mode 100644 index 000000000..e69de29bb diff --git a/repo/config b/repo/config new file mode 100644 index 000000000..18e52e7ac --- /dev/null +++ b/repo/config @@ -0,0 +1,3 @@ +[core] +repo_version=1 +mode=archive-z2 diff --git a/repo/objects/01/f86097b296783f9277d100e5fa23e10749ce6dd2a8f23361112e51b4f2b9ea.filez b/repo/objects/01/f86097b296783f9277d100e5fa23e10749ce6dd2a8f23361112e51b4f2b9ea.filez new file mode 100644 index 000000000..29cfcaf82 Binary files /dev/null and b/repo/objects/01/f86097b296783f9277d100e5fa23e10749ce6dd2a8f23361112e51b4f2b9ea.filez differ diff --git a/repo/objects/04/174d971f621e0d07f7a1e81f3d21a50081ba5dfbb99ae0657ee6644054e38f.dirtree b/repo/objects/04/174d971f621e0d07f7a1e81f3d21a50081ba5dfbb99ae0657ee6644054e38f.dirtree new file mode 100644 index 000000000..f3e4dc109 Binary files /dev/null and b/repo/objects/04/174d971f621e0d07f7a1e81f3d21a50081ba5dfbb99ae0657ee6644054e38f.dirtree differ diff --git a/repo/objects/06/26a70a6414e90a1666c3218b4209fa6e614e1f9830106cd1103de1d14d4c49.filez b/repo/objects/06/26a70a6414e90a1666c3218b4209fa6e614e1f9830106cd1103de1d14d4c49.filez new file mode 100644 index 000000000..322e4c489 Binary files /dev/null and b/repo/objects/06/26a70a6414e90a1666c3218b4209fa6e614e1f9830106cd1103de1d14d4c49.filez differ diff --git a/repo/objects/06/6a1cf58035d1f550062afd1ca457323d18924dcc6a687e9638a39d777af0cc.dirtree b/repo/objects/06/6a1cf58035d1f550062afd1ca457323d18924dcc6a687e9638a39d777af0cc.dirtree new file mode 100644 index 000000000..a60be3784 Binary files /dev/null and b/repo/objects/06/6a1cf58035d1f550062afd1ca457323d18924dcc6a687e9638a39d777af0cc.dirtree differ diff --git a/repo/objects/06/7cbe3ca0c395e674243adc5b3c9c9fa47ad08d220609138b52576675969a3e.filez b/repo/objects/06/7cbe3ca0c395e674243adc5b3c9c9fa47ad08d220609138b52576675969a3e.filez new file mode 100644 index 000000000..0a479e496 Binary files /dev/null and b/repo/objects/06/7cbe3ca0c395e674243adc5b3c9c9fa47ad08d220609138b52576675969a3e.filez differ diff --git a/repo/objects/0a/2714d219243f836e43f0c13a9dcb34a2b22c273c7b5196aa72a0339c639ff8.filez b/repo/objects/0a/2714d219243f836e43f0c13a9dcb34a2b22c273c7b5196aa72a0339c639ff8.filez new file mode 100644 index 000000000..33c756d14 Binary files /dev/null and b/repo/objects/0a/2714d219243f836e43f0c13a9dcb34a2b22c273c7b5196aa72a0339c639ff8.filez differ diff --git a/repo/objects/0c/61807d0daf54c7ab0c40e4cb49b2e52fdbf23945dc5d7edf9f3997661ce6c7.filez b/repo/objects/0c/61807d0daf54c7ab0c40e4cb49b2e52fdbf23945dc5d7edf9f3997661ce6c7.filez new file mode 100644 index 000000000..e68552054 Binary files /dev/null and b/repo/objects/0c/61807d0daf54c7ab0c40e4cb49b2e52fdbf23945dc5d7edf9f3997661ce6c7.filez differ diff --git a/repo/objects/0c/8f5a94910909dc60d5433ae6d28828c43129c6ce03152cfa589fc71b0432b1.filez b/repo/objects/0c/8f5a94910909dc60d5433ae6d28828c43129c6ce03152cfa589fc71b0432b1.filez new file mode 100644 index 000000000..24e0995a1 Binary files /dev/null and b/repo/objects/0c/8f5a94910909dc60d5433ae6d28828c43129c6ce03152cfa589fc71b0432b1.filez differ diff --git a/repo/objects/10/7d43d909a07d9081d2e4de8312dbc40f32b54ca195a0fcee11e43b33f2bc52.filez b/repo/objects/10/7d43d909a07d9081d2e4de8312dbc40f32b54ca195a0fcee11e43b33f2bc52.filez new file mode 100644 index 000000000..d73ec72d2 Binary files /dev/null and b/repo/objects/10/7d43d909a07d9081d2e4de8312dbc40f32b54ca195a0fcee11e43b33f2bc52.filez differ diff --git a/repo/objects/14/35d296df40e5f1bae84e29cddb8c4deb625c1d9e94d0db9bdfb77e7623f192.filez b/repo/objects/14/35d296df40e5f1bae84e29cddb8c4deb625c1d9e94d0db9bdfb77e7623f192.filez new file mode 100644 index 000000000..7b34fbbf5 Binary files /dev/null and b/repo/objects/14/35d296df40e5f1bae84e29cddb8c4deb625c1d9e94d0db9bdfb77e7623f192.filez differ diff --git a/repo/objects/16/27961b211a23ead2337a08b078e60ab72f423d12780f58808ea200267eb210.filez b/repo/objects/16/27961b211a23ead2337a08b078e60ab72f423d12780f58808ea200267eb210.filez new file mode 100644 index 000000000..32edd9fec Binary files /dev/null and b/repo/objects/16/27961b211a23ead2337a08b078e60ab72f423d12780f58808ea200267eb210.filez differ diff --git a/repo/objects/16/5af28b502b755c568d0efaad73781f4af35d80684db3dec44c0760d563e8a3.filez b/repo/objects/16/5af28b502b755c568d0efaad73781f4af35d80684db3dec44c0760d563e8a3.filez new file mode 100644 index 000000000..f70842a10 Binary files /dev/null and b/repo/objects/16/5af28b502b755c568d0efaad73781f4af35d80684db3dec44c0760d563e8a3.filez differ diff --git a/repo/objects/19/6bcbd53dc65a27248fcc6ae0073a18a13cb9b6f132f626543b2a4657a732ac.filez b/repo/objects/19/6bcbd53dc65a27248fcc6ae0073a18a13cb9b6f132f626543b2a4657a732ac.filez new file mode 100644 index 000000000..0859a2577 Binary files /dev/null and b/repo/objects/19/6bcbd53dc65a27248fcc6ae0073a18a13cb9b6f132f626543b2a4657a732ac.filez differ diff --git a/repo/objects/19/b853289a096fe24bb31d76e566d493d8f544da214e61e95b9c94c975970fda.dirtree b/repo/objects/19/b853289a096fe24bb31d76e566d493d8f544da214e61e95b9c94c975970fda.dirtree new file mode 100644 index 000000000..915f51779 Binary files /dev/null and b/repo/objects/19/b853289a096fe24bb31d76e566d493d8f544da214e61e95b9c94c975970fda.dirtree differ diff --git a/repo/objects/1a/4c2773c459991cd148a6379e9469d4631d829844fcfd63b1ed663fa956625f.filez b/repo/objects/1a/4c2773c459991cd148a6379e9469d4631d829844fcfd63b1ed663fa956625f.filez new file mode 100644 index 000000000..d37669084 Binary files /dev/null and b/repo/objects/1a/4c2773c459991cd148a6379e9469d4631d829844fcfd63b1ed663fa956625f.filez differ diff --git a/repo/objects/1b/dffc84010cea9c1eff8e863fa521e89445008e9c9cb2fa3f30b696d3ab1aca.filez b/repo/objects/1b/dffc84010cea9c1eff8e863fa521e89445008e9c9cb2fa3f30b696d3ab1aca.filez new file mode 100644 index 000000000..68abf660d Binary files /dev/null and b/repo/objects/1b/dffc84010cea9c1eff8e863fa521e89445008e9c9cb2fa3f30b696d3ab1aca.filez differ diff --git a/repo/objects/1d/c9ecd1fcf73c5b1c9dd00dbf31ab7ba4ed82ff722ed3d2bff0e323c2cd2837.filez b/repo/objects/1d/c9ecd1fcf73c5b1c9dd00dbf31ab7ba4ed82ff722ed3d2bff0e323c2cd2837.filez new file mode 100644 index 000000000..d8ce5d37b Binary files /dev/null and b/repo/objects/1d/c9ecd1fcf73c5b1c9dd00dbf31ab7ba4ed82ff722ed3d2bff0e323c2cd2837.filez differ diff --git a/repo/objects/1e/6c52727940e87716025c7df2991d8f84b5b783f182bce7ee603fde61145b92.filez b/repo/objects/1e/6c52727940e87716025c7df2991d8f84b5b783f182bce7ee603fde61145b92.filez new file mode 100644 index 000000000..98a639643 Binary files /dev/null and b/repo/objects/1e/6c52727940e87716025c7df2991d8f84b5b783f182bce7ee603fde61145b92.filez differ diff --git a/repo/objects/1f/1319ea6d10122e5e445ebf8fdcc23bd82a5a6b98729d1cab121d0e2ff03981.dirtree b/repo/objects/1f/1319ea6d10122e5e445ebf8fdcc23bd82a5a6b98729d1cab121d0e2ff03981.dirtree new file mode 100644 index 000000000..611bc1952 Binary files /dev/null and b/repo/objects/1f/1319ea6d10122e5e445ebf8fdcc23bd82a5a6b98729d1cab121d0e2ff03981.dirtree differ diff --git a/repo/objects/1f/25c2f519108da140329339fe6f519dbd6d9dae28643594aa7886d11f055b8b.filez b/repo/objects/1f/25c2f519108da140329339fe6f519dbd6d9dae28643594aa7886d11f055b8b.filez new file mode 100644 index 000000000..a2a47fdbc Binary files /dev/null and b/repo/objects/1f/25c2f519108da140329339fe6f519dbd6d9dae28643594aa7886d11f055b8b.filez differ diff --git a/repo/objects/21/f8494fd4046c509832a5ce4f129d909f72e31ee595a57e7103405e71f53d80.filez b/repo/objects/21/f8494fd4046c509832a5ce4f129d909f72e31ee595a57e7103405e71f53d80.filez new file mode 100644 index 000000000..d7e7f3fd0 Binary files /dev/null and b/repo/objects/21/f8494fd4046c509832a5ce4f129d909f72e31ee595a57e7103405e71f53d80.filez differ diff --git a/repo/objects/24/0705beffe0dc88da7220ef4b44b8b29a86d22652f476ba27bcec789559f664.filez b/repo/objects/24/0705beffe0dc88da7220ef4b44b8b29a86d22652f476ba27bcec789559f664.filez new file mode 100644 index 000000000..ae570f002 Binary files /dev/null and b/repo/objects/24/0705beffe0dc88da7220ef4b44b8b29a86d22652f476ba27bcec789559f664.filez differ diff --git a/repo/objects/25/c30f0cf3f3ea59bbfc7be908539686c008deadab04555cf1cdb17578d029f6.commit b/repo/objects/25/c30f0cf3f3ea59bbfc7be908539686c008deadab04555cf1cdb17578d029f6.commit new file mode 100644 index 000000000..b6d8667ec Binary files /dev/null and b/repo/objects/25/c30f0cf3f3ea59bbfc7be908539686c008deadab04555cf1cdb17578d029f6.commit differ diff --git a/repo/objects/28/0077492cf6d9cf7c919c933495830496d13f31e035f14007d246573baa3b24.filez b/repo/objects/28/0077492cf6d9cf7c919c933495830496d13f31e035f14007d246573baa3b24.filez new file mode 100644 index 000000000..ee7e99b65 Binary files /dev/null and b/repo/objects/28/0077492cf6d9cf7c919c933495830496d13f31e035f14007d246573baa3b24.filez differ diff --git a/repo/objects/2c/094fd75febb27c8635c95826c9602347f637ab314e969a4a776264e6820545.filez b/repo/objects/2c/094fd75febb27c8635c95826c9602347f637ab314e969a4a776264e6820545.filez new file mode 100644 index 000000000..c010ff6aa Binary files /dev/null and b/repo/objects/2c/094fd75febb27c8635c95826c9602347f637ab314e969a4a776264e6820545.filez differ diff --git a/repo/objects/2d/934447792ccfdfce6ba66cb9342bfc9499bdd9eae4f8798809e41ce0a76ce9.filez b/repo/objects/2d/934447792ccfdfce6ba66cb9342bfc9499bdd9eae4f8798809e41ce0a76ce9.filez new file mode 100644 index 000000000..4232e3c05 Binary files /dev/null and b/repo/objects/2d/934447792ccfdfce6ba66cb9342bfc9499bdd9eae4f8798809e41ce0a76ce9.filez differ diff --git a/repo/objects/2d/f35a4e0dc57978dae1a88fe6cb7ed138a2013d9f4327a187a0e1830a311f71.filez b/repo/objects/2d/f35a4e0dc57978dae1a88fe6cb7ed138a2013d9f4327a187a0e1830a311f71.filez new file mode 100644 index 000000000..301b025cc Binary files /dev/null and b/repo/objects/2d/f35a4e0dc57978dae1a88fe6cb7ed138a2013d9f4327a187a0e1830a311f71.filez differ diff --git a/repo/objects/2d/ffe0936c2bdae6e11681693bafcc4459311063358cecc3f567474635474dc3.filez b/repo/objects/2d/ffe0936c2bdae6e11681693bafcc4459311063358cecc3f567474635474dc3.filez new file mode 100644 index 000000000..9c03efad9 Binary files /dev/null and b/repo/objects/2d/ffe0936c2bdae6e11681693bafcc4459311063358cecc3f567474635474dc3.filez differ diff --git a/repo/objects/2e/2dfabec7461662a719e51b3c0c457530b2358792f5a40dfe4ffd8d43187c9e.filez b/repo/objects/2e/2dfabec7461662a719e51b3c0c457530b2358792f5a40dfe4ffd8d43187c9e.filez new file mode 100644 index 000000000..115ce8d60 Binary files /dev/null and b/repo/objects/2e/2dfabec7461662a719e51b3c0c457530b2358792f5a40dfe4ffd8d43187c9e.filez differ diff --git a/repo/objects/31/3500e53c59037fe506e449da10de4051cee6d03005f49225059c6d35df8f00.filez b/repo/objects/31/3500e53c59037fe506e449da10de4051cee6d03005f49225059c6d35df8f00.filez new file mode 100644 index 000000000..01c52be65 Binary files /dev/null and b/repo/objects/31/3500e53c59037fe506e449da10de4051cee6d03005f49225059c6d35df8f00.filez differ diff --git a/repo/objects/33/e0778cfdf9e08407a4749af7ccde4e4b79885f036efa6bb18d2296bb757512.filez b/repo/objects/33/e0778cfdf9e08407a4749af7ccde4e4b79885f036efa6bb18d2296bb757512.filez new file mode 100644 index 000000000..574a791eb Binary files /dev/null and b/repo/objects/33/e0778cfdf9e08407a4749af7ccde4e4b79885f036efa6bb18d2296bb757512.filez differ diff --git a/repo/objects/34/1124b04395360ee9feda8a38f0320e3860c12a8c6f58d9ab57c8f194027444.dirtree b/repo/objects/34/1124b04395360ee9feda8a38f0320e3860c12a8c6f58d9ab57c8f194027444.dirtree new file mode 100644 index 000000000..0b79a0610 Binary files /dev/null and b/repo/objects/34/1124b04395360ee9feda8a38f0320e3860c12a8c6f58d9ab57c8f194027444.dirtree differ diff --git a/repo/objects/38/c6b874f3e94638203066d1f5ede725f16977a30cf0728832f11717c4f76b36.filez b/repo/objects/38/c6b874f3e94638203066d1f5ede725f16977a30cf0728832f11717c4f76b36.filez new file mode 100644 index 000000000..842287fe0 Binary files /dev/null and b/repo/objects/38/c6b874f3e94638203066d1f5ede725f16977a30cf0728832f11717c4f76b36.filez differ diff --git a/repo/objects/3c/09b0f5576d136233753f2f78b5512ba27646631d2638dcdf0b3d4d3132bb31.filez b/repo/objects/3c/09b0f5576d136233753f2f78b5512ba27646631d2638dcdf0b3d4d3132bb31.filez new file mode 100644 index 000000000..07d69c504 Binary files /dev/null and b/repo/objects/3c/09b0f5576d136233753f2f78b5512ba27646631d2638dcdf0b3d4d3132bb31.filez differ diff --git a/repo/objects/3d/4c5e4fdf65570520dcb6f019f815ed5037705bbe2a4af52d76d8d88959ef41.filez b/repo/objects/3d/4c5e4fdf65570520dcb6f019f815ed5037705bbe2a4af52d76d8d88959ef41.filez new file mode 100644 index 000000000..7dc009a56 Binary files /dev/null and b/repo/objects/3d/4c5e4fdf65570520dcb6f019f815ed5037705bbe2a4af52d76d8d88959ef41.filez differ diff --git a/repo/objects/3d/713bdac06f360226909e1c13f1b078b8631c5a0d9a5d0ca2bdbcc13e3f1291.filez b/repo/objects/3d/713bdac06f360226909e1c13f1b078b8631c5a0d9a5d0ca2bdbcc13e3f1291.filez new file mode 100644 index 000000000..da192a25e Binary files /dev/null and b/repo/objects/3d/713bdac06f360226909e1c13f1b078b8631c5a0d9a5d0ca2bdbcc13e3f1291.filez differ diff --git a/repo/objects/3f/0dda5683b1af92fbca8118bc7602542342c382c9830046f3815b64828a126d.filez b/repo/objects/3f/0dda5683b1af92fbca8118bc7602542342c382c9830046f3815b64828a126d.filez new file mode 100644 index 000000000..1f49a10db Binary files /dev/null and b/repo/objects/3f/0dda5683b1af92fbca8118bc7602542342c382c9830046f3815b64828a126d.filez differ diff --git a/repo/objects/3f/2a39a366372789f9bc2558d5bfbe14a8e547b336c00b5b0f49a5d342369205.filez b/repo/objects/3f/2a39a366372789f9bc2558d5bfbe14a8e547b336c00b5b0f49a5d342369205.filez new file mode 100644 index 000000000..b80446559 Binary files /dev/null and b/repo/objects/3f/2a39a366372789f9bc2558d5bfbe14a8e547b336c00b5b0f49a5d342369205.filez differ diff --git a/repo/objects/3f/d03bc53488007b5bb46f96e5e2912c5e04b5c88550b767efba71263b233dbe.dirtree b/repo/objects/3f/d03bc53488007b5bb46f96e5e2912c5e04b5c88550b767efba71263b233dbe.dirtree new file mode 100644 index 000000000..535571b99 Binary files /dev/null and b/repo/objects/3f/d03bc53488007b5bb46f96e5e2912c5e04b5c88550b767efba71263b233dbe.dirtree differ diff --git a/repo/objects/40/b3704d77473b98fddd7e18fb92d6538e9e1415ee01c973eaa88718d0cf8c35.filez b/repo/objects/40/b3704d77473b98fddd7e18fb92d6538e9e1415ee01c973eaa88718d0cf8c35.filez new file mode 100644 index 000000000..30b7a231c Binary files /dev/null and b/repo/objects/40/b3704d77473b98fddd7e18fb92d6538e9e1415ee01c973eaa88718d0cf8c35.filez differ diff --git a/repo/objects/40/e68f4242444195913cd8b9b91abb7d80929fb2c4fb0ce27a96ecede9199881.filez b/repo/objects/40/e68f4242444195913cd8b9b91abb7d80929fb2c4fb0ce27a96ecede9199881.filez new file mode 100644 index 000000000..029a46daf Binary files /dev/null and b/repo/objects/40/e68f4242444195913cd8b9b91abb7d80929fb2c4fb0ce27a96ecede9199881.filez differ diff --git a/repo/objects/41/514fba0348385677546a001b09741b647388021cc098d583c52035d368d826.filez b/repo/objects/41/514fba0348385677546a001b09741b647388021cc098d583c52035d368d826.filez new file mode 100644 index 000000000..82908c4db Binary files /dev/null and b/repo/objects/41/514fba0348385677546a001b09741b647388021cc098d583c52035d368d826.filez differ diff --git a/repo/objects/41/c2fcd3103ed83c4293f2c305366725be100736696ff8ef6b54d7ffa25e3c04.filez b/repo/objects/41/c2fcd3103ed83c4293f2c305366725be100736696ff8ef6b54d7ffa25e3c04.filez new file mode 100644 index 000000000..4cc750b00 Binary files /dev/null and b/repo/objects/41/c2fcd3103ed83c4293f2c305366725be100736696ff8ef6b54d7ffa25e3c04.filez differ diff --git a/repo/objects/42/8ea7bc7a7c5b36fdf007031169d0f9905fc26ec555b9052b0525a23391f066.filez b/repo/objects/42/8ea7bc7a7c5b36fdf007031169d0f9905fc26ec555b9052b0525a23391f066.filez new file mode 100644 index 000000000..be0b9a718 Binary files /dev/null and b/repo/objects/42/8ea7bc7a7c5b36fdf007031169d0f9905fc26ec555b9052b0525a23391f066.filez differ diff --git a/repo/objects/43/5536a5a0ffc863d155f5346d50706c11c8ec6cf19556b31d27b994903f3682.filez b/repo/objects/43/5536a5a0ffc863d155f5346d50706c11c8ec6cf19556b31d27b994903f3682.filez new file mode 100644 index 000000000..825a5ca66 Binary files /dev/null and b/repo/objects/43/5536a5a0ffc863d155f5346d50706c11c8ec6cf19556b31d27b994903f3682.filez differ diff --git a/repo/objects/43/6c337e571c6de42f78f19b4ee118ce40781768d300f61168e451405f83f67d.dirtree b/repo/objects/43/6c337e571c6de42f78f19b4ee118ce40781768d300f61168e451405f83f67d.dirtree new file mode 100644 index 000000000..9981ca6d8 Binary files /dev/null and b/repo/objects/43/6c337e571c6de42f78f19b4ee118ce40781768d300f61168e451405f83f67d.dirtree differ diff --git a/repo/objects/44/6a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488.dirmeta b/repo/objects/44/6a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488.dirmeta new file mode 100644 index 000000000..6757a41ee Binary files /dev/null and b/repo/objects/44/6a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488.dirmeta differ diff --git a/repo/objects/44/c4a1495775b38fbccf8c768dc4b6c84d3ddbeead2a8b98b1a4aa272a4abec3.dirtree b/repo/objects/44/c4a1495775b38fbccf8c768dc4b6c84d3ddbeead2a8b98b1a4aa272a4abec3.dirtree new file mode 100644 index 000000000..03e38690e Binary files /dev/null and b/repo/objects/44/c4a1495775b38fbccf8c768dc4b6c84d3ddbeead2a8b98b1a4aa272a4abec3.dirtree differ diff --git a/repo/objects/46/59d21e1e5fa08b3fb751216192ed8abac2341e8f3705719a01a9d13af78ae5.filez b/repo/objects/46/59d21e1e5fa08b3fb751216192ed8abac2341e8f3705719a01a9d13af78ae5.filez new file mode 100644 index 000000000..4729c675e Binary files /dev/null and b/repo/objects/46/59d21e1e5fa08b3fb751216192ed8abac2341e8f3705719a01a9d13af78ae5.filez differ diff --git a/repo/objects/46/886d97475f01f57f84e867e6783032a3f1037cdc7617a5c9ef89142a2768f6.filez b/repo/objects/46/886d97475f01f57f84e867e6783032a3f1037cdc7617a5c9ef89142a2768f6.filez new file mode 100644 index 000000000..56613816e Binary files /dev/null and b/repo/objects/46/886d97475f01f57f84e867e6783032a3f1037cdc7617a5c9ef89142a2768f6.filez differ diff --git a/repo/objects/47/2b94f7979aa26593271ce51f2cdaea2e39055a3ea1336934ce456df510e779.filez b/repo/objects/47/2b94f7979aa26593271ce51f2cdaea2e39055a3ea1336934ce456df510e779.filez new file mode 100644 index 000000000..91ab379b7 Binary files /dev/null and b/repo/objects/47/2b94f7979aa26593271ce51f2cdaea2e39055a3ea1336934ce456df510e779.filez differ diff --git a/repo/objects/49/7526ce53f4ceea558e64e5b8d74897ad8c8f9587874b32ca1a36632b9a490a.filez b/repo/objects/49/7526ce53f4ceea558e64e5b8d74897ad8c8f9587874b32ca1a36632b9a490a.filez new file mode 100644 index 000000000..6dda1ee8d Binary files /dev/null and b/repo/objects/49/7526ce53f4ceea558e64e5b8d74897ad8c8f9587874b32ca1a36632b9a490a.filez differ diff --git a/repo/objects/49/f17001b7fc07abba1f6550d752a12a7082f3eb7c71ff11168834ec9b5b6371.filez b/repo/objects/49/f17001b7fc07abba1f6550d752a12a7082f3eb7c71ff11168834ec9b5b6371.filez new file mode 100644 index 000000000..ba3631af5 Binary files /dev/null and b/repo/objects/49/f17001b7fc07abba1f6550d752a12a7082f3eb7c71ff11168834ec9b5b6371.filez differ diff --git a/repo/objects/4d/027439408bcda052a1df90740548ffe4b45015556be882cb0608adc0cecca0.filez b/repo/objects/4d/027439408bcda052a1df90740548ffe4b45015556be882cb0608adc0cecca0.filez new file mode 100644 index 000000000..8cd4438bc Binary files /dev/null and b/repo/objects/4d/027439408bcda052a1df90740548ffe4b45015556be882cb0608adc0cecca0.filez differ diff --git a/repo/objects/4d/2d98a6e076825b2486c2f6673e4a6e3e9b5280b25625e695b05f0b3123f330.filez b/repo/objects/4d/2d98a6e076825b2486c2f6673e4a6e3e9b5280b25625e695b05f0b3123f330.filez new file mode 100644 index 000000000..514701e44 Binary files /dev/null and b/repo/objects/4d/2d98a6e076825b2486c2f6673e4a6e3e9b5280b25625e695b05f0b3123f330.filez differ diff --git a/repo/objects/4e/3dd8cc6c3fe75b5c7d43992924ec365800a0e9d0a2e587599c8818567bcffe.dirtree b/repo/objects/4e/3dd8cc6c3fe75b5c7d43992924ec365800a0e9d0a2e587599c8818567bcffe.dirtree new file mode 100644 index 000000000..4e1fc88e2 Binary files /dev/null and b/repo/objects/4e/3dd8cc6c3fe75b5c7d43992924ec365800a0e9d0a2e587599c8818567bcffe.dirtree differ diff --git a/repo/objects/50/daae25fecfb025886ed6a8f732705dcd542eae1d9c1f3f203287cd953f116b.filez b/repo/objects/50/daae25fecfb025886ed6a8f732705dcd542eae1d9c1f3f203287cd953f116b.filez new file mode 100644 index 000000000..eea5667b5 Binary files /dev/null and b/repo/objects/50/daae25fecfb025886ed6a8f732705dcd542eae1d9c1f3f203287cd953f116b.filez differ diff --git a/repo/objects/51/d474170bc48a16278ca8e32357cd1cbf920150be08839f8073910c126a0ae9.filez b/repo/objects/51/d474170bc48a16278ca8e32357cd1cbf920150be08839f8073910c126a0ae9.filez new file mode 100644 index 000000000..6d03d8955 Binary files /dev/null and b/repo/objects/51/d474170bc48a16278ca8e32357cd1cbf920150be08839f8073910c126a0ae9.filez differ diff --git a/repo/objects/53/9f390ee93c783631edf780dcd0e721ecc42ed3421889fb0d8d2fbb746bc757.filez b/repo/objects/53/9f390ee93c783631edf780dcd0e721ecc42ed3421889fb0d8d2fbb746bc757.filez new file mode 100644 index 000000000..5161101e3 Binary files /dev/null and b/repo/objects/53/9f390ee93c783631edf780dcd0e721ecc42ed3421889fb0d8d2fbb746bc757.filez differ diff --git a/repo/objects/59/3dfade77b23c0cf8f58f84d508505a72e2e73ce170fb84557f1b9ddb1599ff.filez b/repo/objects/59/3dfade77b23c0cf8f58f84d508505a72e2e73ce170fb84557f1b9ddb1599ff.filez new file mode 100644 index 000000000..01c08529d Binary files /dev/null and b/repo/objects/59/3dfade77b23c0cf8f58f84d508505a72e2e73ce170fb84557f1b9ddb1599ff.filez differ diff --git a/repo/objects/5a/bf8cff737f16da1f4b08f30194e1ea4d523cee89ca4050124d52b3da2621b7.dirtree b/repo/objects/5a/bf8cff737f16da1f4b08f30194e1ea4d523cee89ca4050124d52b3da2621b7.dirtree new file mode 100644 index 000000000..c05599668 Binary files /dev/null and b/repo/objects/5a/bf8cff737f16da1f4b08f30194e1ea4d523cee89ca4050124d52b3da2621b7.dirtree differ diff --git a/repo/objects/5e/c6d4b8f5d1c8d07577139cfa0b249c88a70f141a476a2cc3a8d3f261d80cb7.filez b/repo/objects/5e/c6d4b8f5d1c8d07577139cfa0b249c88a70f141a476a2cc3a8d3f261d80cb7.filez new file mode 100644 index 000000000..1e2210017 Binary files /dev/null and b/repo/objects/5e/c6d4b8f5d1c8d07577139cfa0b249c88a70f141a476a2cc3a8d3f261d80cb7.filez differ diff --git a/repo/objects/5f/cc34d501a0e86bcf1518ade3d5cdcf36631b896ebafc148bb2bbf0d063145e.filez b/repo/objects/5f/cc34d501a0e86bcf1518ade3d5cdcf36631b896ebafc148bb2bbf0d063145e.filez new file mode 100644 index 000000000..1cb392777 Binary files /dev/null and b/repo/objects/5f/cc34d501a0e86bcf1518ade3d5cdcf36631b896ebafc148bb2bbf0d063145e.filez differ diff --git a/repo/objects/62/fbed2c3ff350c992c017f8bc629a98747e8b7d41a96bf062d8cdefff0bd6f2.filez b/repo/objects/62/fbed2c3ff350c992c017f8bc629a98747e8b7d41a96bf062d8cdefff0bd6f2.filez new file mode 100644 index 000000000..1a6978c9c Binary files /dev/null and b/repo/objects/62/fbed2c3ff350c992c017f8bc629a98747e8b7d41a96bf062d8cdefff0bd6f2.filez differ diff --git a/repo/objects/63/10e92df74872d40c1d4f52b20a39d5e696c0f49ee9e0613168c985a443c7d7.dirtree b/repo/objects/63/10e92df74872d40c1d4f52b20a39d5e696c0f49ee9e0613168c985a443c7d7.dirtree new file mode 100644 index 000000000..2e5d60768 Binary files /dev/null and b/repo/objects/63/10e92df74872d40c1d4f52b20a39d5e696c0f49ee9e0613168c985a443c7d7.dirtree differ diff --git a/repo/objects/65/990f4e145ac981ea84eff29876645038a2deeeab593857c8a31f943a5a1e21.filez b/repo/objects/65/990f4e145ac981ea84eff29876645038a2deeeab593857c8a31f943a5a1e21.filez new file mode 100644 index 000000000..791f2a897 Binary files /dev/null and b/repo/objects/65/990f4e145ac981ea84eff29876645038a2deeeab593857c8a31f943a5a1e21.filez differ diff --git a/repo/objects/65/9bc03c8ab1e30074d1c931c28bab9dfe3c8d4dc50edab44fab0dd5939dbd62.filez b/repo/objects/65/9bc03c8ab1e30074d1c931c28bab9dfe3c8d4dc50edab44fab0dd5939dbd62.filez new file mode 100644 index 000000000..beb1aa217 Binary files /dev/null and b/repo/objects/65/9bc03c8ab1e30074d1c931c28bab9dfe3c8d4dc50edab44fab0dd5939dbd62.filez differ diff --git a/repo/objects/69/043a82b3464dabe668c744f839ffce09a8c427369817fac9c76d1aee6dd0db.filez b/repo/objects/69/043a82b3464dabe668c744f839ffce09a8c427369817fac9c76d1aee6dd0db.filez new file mode 100644 index 000000000..25d67ec57 Binary files /dev/null and b/repo/objects/69/043a82b3464dabe668c744f839ffce09a8c427369817fac9c76d1aee6dd0db.filez differ diff --git a/repo/objects/69/acc5506b73c2630add794c33a9c3675c3ebaf7fa3c3305e5643954d8999237.filez b/repo/objects/69/acc5506b73c2630add794c33a9c3675c3ebaf7fa3c3305e5643954d8999237.filez new file mode 100644 index 000000000..567f47b84 Binary files /dev/null and b/repo/objects/69/acc5506b73c2630add794c33a9c3675c3ebaf7fa3c3305e5643954d8999237.filez differ diff --git a/repo/objects/6b/2cdabb7937183000d8bbadf61bfce4aa8782d1e89c6a8441dd98141d1ae142.commit b/repo/objects/6b/2cdabb7937183000d8bbadf61bfce4aa8782d1e89c6a8441dd98141d1ae142.commit new file mode 100644 index 000000000..a86fc9c7d Binary files /dev/null and b/repo/objects/6b/2cdabb7937183000d8bbadf61bfce4aa8782d1e89c6a8441dd98141d1ae142.commit differ diff --git a/repo/objects/6d/5ba4cb0379346467f3893b81db1998909e2f828cc990a2b0e67e0d70c8929a.filez b/repo/objects/6d/5ba4cb0379346467f3893b81db1998909e2f828cc990a2b0e67e0d70c8929a.filez new file mode 100644 index 000000000..be13adccf Binary files /dev/null and b/repo/objects/6d/5ba4cb0379346467f3893b81db1998909e2f828cc990a2b0e67e0d70c8929a.filez differ diff --git a/repo/objects/6e/340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d.dirtree b/repo/objects/6e/340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d.dirtree new file mode 100644 index 000000000..f76dd238a Binary files /dev/null and b/repo/objects/6e/340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d.dirtree differ diff --git a/repo/objects/71/a49cc20219ea047ccd7e7170d904e85074c29889641a535ac589154462882c.commit b/repo/objects/71/a49cc20219ea047ccd7e7170d904e85074c29889641a535ac589154462882c.commit new file mode 100644 index 000000000..d1f58764d Binary files /dev/null and b/repo/objects/71/a49cc20219ea047ccd7e7170d904e85074c29889641a535ac589154462882c.commit differ diff --git a/repo/objects/71/bd3f2f6c6a08b3be988d6ad7daa743fbab793133d3aff6c45096a3de5fea0e.filez b/repo/objects/71/bd3f2f6c6a08b3be988d6ad7daa743fbab793133d3aff6c45096a3de5fea0e.filez new file mode 100644 index 000000000..3275147b7 Binary files /dev/null and b/repo/objects/71/bd3f2f6c6a08b3be988d6ad7daa743fbab793133d3aff6c45096a3de5fea0e.filez differ diff --git a/repo/objects/72/35f9594f076ff6547e14e1b98b1f620dafab82056b3e528b00aeef7ada4888.dirtree b/repo/objects/72/35f9594f076ff6547e14e1b98b1f620dafab82056b3e528b00aeef7ada4888.dirtree new file mode 100644 index 000000000..ac2bbcaf4 Binary files /dev/null and b/repo/objects/72/35f9594f076ff6547e14e1b98b1f620dafab82056b3e528b00aeef7ada4888.dirtree differ diff --git a/repo/objects/72/903bf9ba5b772d12e787f9f9ab107ea44af465c50bc7c53d27cd6c776f8860.filez b/repo/objects/72/903bf9ba5b772d12e787f9f9ab107ea44af465c50bc7c53d27cd6c776f8860.filez new file mode 100644 index 000000000..5ccba56f5 Binary files /dev/null and b/repo/objects/72/903bf9ba5b772d12e787f9f9ab107ea44af465c50bc7c53d27cd6c776f8860.filez differ diff --git a/repo/objects/73/724508a98691fcd280a2501c859510571bb82c2bfbf236a18876fe06242ebe.filez b/repo/objects/73/724508a98691fcd280a2501c859510571bb82c2bfbf236a18876fe06242ebe.filez new file mode 100644 index 000000000..f13b19e76 Binary files /dev/null and b/repo/objects/73/724508a98691fcd280a2501c859510571bb82c2bfbf236a18876fe06242ebe.filez differ diff --git a/repo/objects/74/440b3ef5af43c2518429f8b5b34c84c37f73202929e6d6489c77247b346e4e.filez b/repo/objects/74/440b3ef5af43c2518429f8b5b34c84c37f73202929e6d6489c77247b346e4e.filez new file mode 100644 index 000000000..4bf06ef45 Binary files /dev/null and b/repo/objects/74/440b3ef5af43c2518429f8b5b34c84c37f73202929e6d6489c77247b346e4e.filez differ diff --git a/repo/objects/76/33ed5db7285e92f154cea1569807c1b83260627aaeef33459886ce1f7b0446.commit b/repo/objects/76/33ed5db7285e92f154cea1569807c1b83260627aaeef33459886ce1f7b0446.commit new file mode 100644 index 000000000..39e77a908 Binary files /dev/null and b/repo/objects/76/33ed5db7285e92f154cea1569807c1b83260627aaeef33459886ce1f7b0446.commit differ diff --git a/repo/objects/76/53f9e0819da90cb51a71c67b8ca62892676c52e4d377a45b5c147d5e6dae88.dirtree b/repo/objects/76/53f9e0819da90cb51a71c67b8ca62892676c52e4d377a45b5c147d5e6dae88.dirtree new file mode 100644 index 000000000..e1f91ad4a Binary files /dev/null and b/repo/objects/76/53f9e0819da90cb51a71c67b8ca62892676c52e4d377a45b5c147d5e6dae88.dirtree differ diff --git a/repo/objects/79/6db1fd624ebb40c8774f017d1dbaf926d50cdfe44a20312e02f2cb4c0f39c6.filez b/repo/objects/79/6db1fd624ebb40c8774f017d1dbaf926d50cdfe44a20312e02f2cb4c0f39c6.filez new file mode 100644 index 000000000..2ec5ccebe Binary files /dev/null and b/repo/objects/79/6db1fd624ebb40c8774f017d1dbaf926d50cdfe44a20312e02f2cb4c0f39c6.filez differ diff --git a/repo/objects/7b/6c611e0a7b4eb62b0b10adddc3ebc5561e072f4f9238ab011c8915d14f6aec.filez b/repo/objects/7b/6c611e0a7b4eb62b0b10adddc3ebc5561e072f4f9238ab011c8915d14f6aec.filez new file mode 100644 index 000000000..870713c11 Binary files /dev/null and b/repo/objects/7b/6c611e0a7b4eb62b0b10adddc3ebc5561e072f4f9238ab011c8915d14f6aec.filez differ diff --git a/repo/objects/7c/0b1aa30c0b230869b0c6414af405e6f5eb7934a017e21595b4dacf151db96f.filez b/repo/objects/7c/0b1aa30c0b230869b0c6414af405e6f5eb7934a017e21595b4dacf151db96f.filez new file mode 100644 index 000000000..9c9aca067 Binary files /dev/null and b/repo/objects/7c/0b1aa30c0b230869b0c6414af405e6f5eb7934a017e21595b4dacf151db96f.filez differ diff --git a/repo/objects/7c/d397e7cc9be27fce1b3f613676a36fa607401682692f23ce8c8887c38ecfbd.filez b/repo/objects/7c/d397e7cc9be27fce1b3f613676a36fa607401682692f23ce8c8887c38ecfbd.filez new file mode 100644 index 000000000..0041e2f7d Binary files /dev/null and b/repo/objects/7c/d397e7cc9be27fce1b3f613676a36fa607401682692f23ce8c8887c38ecfbd.filez differ diff --git a/repo/objects/7c/f2ef241fd3e2d0c8c4f9b85c16423fd9276fcc012db637cb9874a940b9edf1.filez b/repo/objects/7c/f2ef241fd3e2d0c8c4f9b85c16423fd9276fcc012db637cb9874a940b9edf1.filez new file mode 100644 index 000000000..042a01d7e Binary files /dev/null and b/repo/objects/7c/f2ef241fd3e2d0c8c4f9b85c16423fd9276fcc012db637cb9874a940b9edf1.filez differ diff --git a/repo/objects/7d/4f16ca8e8861294cde20453e61ecd01475cdab0d61630f4fc5c246f9215d8e.filez b/repo/objects/7d/4f16ca8e8861294cde20453e61ecd01475cdab0d61630f4fc5c246f9215d8e.filez new file mode 100644 index 000000000..fdbb9d99c Binary files /dev/null and b/repo/objects/7d/4f16ca8e8861294cde20453e61ecd01475cdab0d61630f4fc5c246f9215d8e.filez differ diff --git a/repo/objects/7e/340933b0dd8d753a7f4e07fbc3a088cb1925b85ca4c6cc8287652f985dfd11.filez b/repo/objects/7e/340933b0dd8d753a7f4e07fbc3a088cb1925b85ca4c6cc8287652f985dfd11.filez new file mode 100644 index 000000000..154db3c1a Binary files /dev/null and b/repo/objects/7e/340933b0dd8d753a7f4e07fbc3a088cb1925b85ca4c6cc8287652f985dfd11.filez differ diff --git a/repo/objects/7e/c153528ec6d6e724fb92ea266bad223772e62444a81fa3c40a29e81f60ad57.filez b/repo/objects/7e/c153528ec6d6e724fb92ea266bad223772e62444a81fa3c40a29e81f60ad57.filez new file mode 100644 index 000000000..cfd2d28c7 Binary files /dev/null and b/repo/objects/7e/c153528ec6d6e724fb92ea266bad223772e62444a81fa3c40a29e81f60ad57.filez differ diff --git a/repo/objects/7f/8c621e74a86ccb11460df286dce5bedfd17fcc83405de5e64ca0a3142f5c31.dirtree b/repo/objects/7f/8c621e74a86ccb11460df286dce5bedfd17fcc83405de5e64ca0a3142f5c31.dirtree new file mode 100644 index 000000000..fe907f342 Binary files /dev/null and b/repo/objects/7f/8c621e74a86ccb11460df286dce5bedfd17fcc83405de5e64ca0a3142f5c31.dirtree differ diff --git a/repo/objects/7f/90e507c78b96dd64299f9c488e43faa116fe2cde93f2c6cebb799252651e5a.filez b/repo/objects/7f/90e507c78b96dd64299f9c488e43faa116fe2cde93f2c6cebb799252651e5a.filez new file mode 100644 index 000000000..0295223f8 Binary files /dev/null and b/repo/objects/7f/90e507c78b96dd64299f9c488e43faa116fe2cde93f2c6cebb799252651e5a.filez differ diff --git a/repo/objects/80/8cc668f4eb4e20fde7cee20df2cc4010d0a8d6ce46c0835ca53d9ebb1524ad.dirtree b/repo/objects/80/8cc668f4eb4e20fde7cee20df2cc4010d0a8d6ce46c0835ca53d9ebb1524ad.dirtree new file mode 100644 index 000000000..5292def55 Binary files /dev/null and b/repo/objects/80/8cc668f4eb4e20fde7cee20df2cc4010d0a8d6ce46c0835ca53d9ebb1524ad.dirtree differ diff --git a/repo/objects/84/6f20624bbdd7f1985e06f7df006b865b1dc03542f22575248575f3d64e5b37.filez b/repo/objects/84/6f20624bbdd7f1985e06f7df006b865b1dc03542f22575248575f3d64e5b37.filez new file mode 100644 index 000000000..a663c2362 Binary files /dev/null and b/repo/objects/84/6f20624bbdd7f1985e06f7df006b865b1dc03542f22575248575f3d64e5b37.filez differ diff --git a/repo/objects/84/717f11d41ea0fbbc60e94f238909c659bd71f3f0781ea1f29e70568ffa255b.filez b/repo/objects/84/717f11d41ea0fbbc60e94f238909c659bd71f3f0781ea1f29e70568ffa255b.filez new file mode 100644 index 000000000..7df0a873b Binary files /dev/null and b/repo/objects/84/717f11d41ea0fbbc60e94f238909c659bd71f3f0781ea1f29e70568ffa255b.filez differ diff --git a/repo/objects/84/fbc8281004bf3503da1977cc9a4c3b28c8ddde5c1bbeebced93e4e12d83a45.dirtree b/repo/objects/84/fbc8281004bf3503da1977cc9a4c3b28c8ddde5c1bbeebced93e4e12d83a45.dirtree new file mode 100644 index 000000000..62ad23597 Binary files /dev/null and b/repo/objects/84/fbc8281004bf3503da1977cc9a4c3b28c8ddde5c1bbeebced93e4e12d83a45.dirtree differ diff --git a/repo/objects/86/0132d78faa9a44c7aa984ab445cc99143a5096bf21dfd982c582afbdc2ef36.dirtree b/repo/objects/86/0132d78faa9a44c7aa984ab445cc99143a5096bf21dfd982c582afbdc2ef36.dirtree new file mode 100644 index 000000000..ae9a7274b Binary files /dev/null and b/repo/objects/86/0132d78faa9a44c7aa984ab445cc99143a5096bf21dfd982c582afbdc2ef36.dirtree differ diff --git a/repo/objects/86/8decf1a80b18d8819d9c392f2112220d6cffdc2191d8ee8970fbb8c3912ba1.filez b/repo/objects/86/8decf1a80b18d8819d9c392f2112220d6cffdc2191d8ee8970fbb8c3912ba1.filez new file mode 100644 index 000000000..27ba07c42 Binary files /dev/null and b/repo/objects/86/8decf1a80b18d8819d9c392f2112220d6cffdc2191d8ee8970fbb8c3912ba1.filez differ diff --git a/repo/objects/86/dfdf757cb7865bd907c4eedbf76c53094d0c827b5bb90b196195ff261e498c.dirtree b/repo/objects/86/dfdf757cb7865bd907c4eedbf76c53094d0c827b5bb90b196195ff261e498c.dirtree new file mode 100644 index 000000000..6ba977199 Binary files /dev/null and b/repo/objects/86/dfdf757cb7865bd907c4eedbf76c53094d0c827b5bb90b196195ff261e498c.dirtree differ diff --git a/repo/objects/8a/130777023554e07be7a161d3e21e669e4d8634d071135305a7bd00a1f811f5.filez b/repo/objects/8a/130777023554e07be7a161d3e21e669e4d8634d071135305a7bd00a1f811f5.filez new file mode 100644 index 000000000..fe2670498 Binary files /dev/null and b/repo/objects/8a/130777023554e07be7a161d3e21e669e4d8634d071135305a7bd00a1f811f5.filez differ diff --git a/repo/objects/8a/6c781b1df30c7c3e84331e2da66c8932473b6160704624e0193370fd3d51ad.filez b/repo/objects/8a/6c781b1df30c7c3e84331e2da66c8932473b6160704624e0193370fd3d51ad.filez new file mode 100644 index 000000000..962505616 Binary files /dev/null and b/repo/objects/8a/6c781b1df30c7c3e84331e2da66c8932473b6160704624e0193370fd3d51ad.filez differ diff --git a/repo/objects/8c/242b81b2a7d8677bc0f39d028942689ed93b7315766a290641f45d363a25cd.filez b/repo/objects/8c/242b81b2a7d8677bc0f39d028942689ed93b7315766a290641f45d363a25cd.filez new file mode 100644 index 000000000..b676a4673 Binary files /dev/null and b/repo/objects/8c/242b81b2a7d8677bc0f39d028942689ed93b7315766a290641f45d363a25cd.filez differ diff --git a/repo/objects/8d/bd359d65afa1e5d1f3f795cf4a4350dc2e2752bb118d0757a7931b6748706a.filez b/repo/objects/8d/bd359d65afa1e5d1f3f795cf4a4350dc2e2752bb118d0757a7931b6748706a.filez new file mode 100644 index 000000000..e3f70c2ba Binary files /dev/null and b/repo/objects/8d/bd359d65afa1e5d1f3f795cf4a4350dc2e2752bb118d0757a7931b6748706a.filez differ diff --git a/repo/objects/8e/9dbb12af690ba35846ba2706123b36b7913208a47759a1c3a12c23b7601b41.dirtree b/repo/objects/8e/9dbb12af690ba35846ba2706123b36b7913208a47759a1c3a12c23b7601b41.dirtree new file mode 100644 index 000000000..50cf5de00 Binary files /dev/null and b/repo/objects/8e/9dbb12af690ba35846ba2706123b36b7913208a47759a1c3a12c23b7601b41.dirtree differ diff --git a/repo/objects/8e/bb1066ccf521bdded4cc27656a87b81c3c60d1464e70c158285faaedec4bbe.filez b/repo/objects/8e/bb1066ccf521bdded4cc27656a87b81c3c60d1464e70c158285faaedec4bbe.filez new file mode 100644 index 000000000..6b74792d3 Binary files /dev/null and b/repo/objects/8e/bb1066ccf521bdded4cc27656a87b81c3c60d1464e70c158285faaedec4bbe.filez differ diff --git a/repo/objects/8f/f78d2a3212edbf9d5ccc52c9047cf5013e6dfe9c0e14488d8033e6fe2d075d.filez b/repo/objects/8f/f78d2a3212edbf9d5ccc52c9047cf5013e6dfe9c0e14488d8033e6fe2d075d.filez new file mode 100644 index 000000000..0b6e6baa1 Binary files /dev/null and b/repo/objects/8f/f78d2a3212edbf9d5ccc52c9047cf5013e6dfe9c0e14488d8033e6fe2d075d.filez differ diff --git a/repo/objects/91/1ee7956ecde73d4e93c7dd9894065dc851e47e7bcf93487883eb58837b6b83.filez b/repo/objects/91/1ee7956ecde73d4e93c7dd9894065dc851e47e7bcf93487883eb58837b6b83.filez new file mode 100644 index 000000000..b7ceec677 Binary files /dev/null and b/repo/objects/91/1ee7956ecde73d4e93c7dd9894065dc851e47e7bcf93487883eb58837b6b83.filez differ diff --git a/repo/objects/92/6008f63a3ab0bcccf40bd6b54fd16d45eaebf1b211d10c8b1ff190e31a41a9.filez b/repo/objects/92/6008f63a3ab0bcccf40bd6b54fd16d45eaebf1b211d10c8b1ff190e31a41a9.filez new file mode 100644 index 000000000..985163b4e Binary files /dev/null and b/repo/objects/92/6008f63a3ab0bcccf40bd6b54fd16d45eaebf1b211d10c8b1ff190e31a41a9.filez differ diff --git a/repo/objects/94/06d7e034a778a2b75b3e8a11b6a4280b3cf581691f1bb3638c4be5d03bc4fb.dirtree b/repo/objects/94/06d7e034a778a2b75b3e8a11b6a4280b3cf581691f1bb3638c4be5d03bc4fb.dirtree new file mode 100644 index 000000000..b94764329 Binary files /dev/null and b/repo/objects/94/06d7e034a778a2b75b3e8a11b6a4280b3cf581691f1bb3638c4be5d03bc4fb.dirtree differ diff --git a/repo/objects/94/092b71bc083f27b80de9724ab7bb4a38d707f66f065fe9e45c64472f949958.filez b/repo/objects/94/092b71bc083f27b80de9724ab7bb4a38d707f66f065fe9e45c64472f949958.filez new file mode 100644 index 000000000..6b47928d6 Binary files /dev/null and b/repo/objects/94/092b71bc083f27b80de9724ab7bb4a38d707f66f065fe9e45c64472f949958.filez differ diff --git a/repo/objects/97/2938d146791fa8c28d6b86b469eaeb6184edc374788796bef17f973cd2d453.filez b/repo/objects/97/2938d146791fa8c28d6b86b469eaeb6184edc374788796bef17f973cd2d453.filez new file mode 100644 index 000000000..26cea8903 Binary files /dev/null and b/repo/objects/97/2938d146791fa8c28d6b86b469eaeb6184edc374788796bef17f973cd2d453.filez differ diff --git a/repo/objects/98/5014b517f77725fd562ba5364386faccb5595668add3bd3dafa4a9f25490bd.filez b/repo/objects/98/5014b517f77725fd562ba5364386faccb5595668add3bd3dafa4a9f25490bd.filez new file mode 100644 index 000000000..3f16dfefa Binary files /dev/null and b/repo/objects/98/5014b517f77725fd562ba5364386faccb5595668add3bd3dafa4a9f25490bd.filez differ diff --git a/repo/objects/98/9407a3997bb78d5b111a37845b0008ad26d6f694c8e5dcb5cca8dd99ee7c5d.filez b/repo/objects/98/9407a3997bb78d5b111a37845b0008ad26d6f694c8e5dcb5cca8dd99ee7c5d.filez new file mode 100644 index 000000000..b613b03f0 Binary files /dev/null and b/repo/objects/98/9407a3997bb78d5b111a37845b0008ad26d6f694c8e5dcb5cca8dd99ee7c5d.filez differ diff --git a/repo/objects/9b/d03eaaa595eecda1759ee0816333008bfc0b8a2eb18a3a1f2cf471e5a7c15e.dirtree b/repo/objects/9b/d03eaaa595eecda1759ee0816333008bfc0b8a2eb18a3a1f2cf471e5a7c15e.dirtree new file mode 100644 index 000000000..7c6bd387f Binary files /dev/null and b/repo/objects/9b/d03eaaa595eecda1759ee0816333008bfc0b8a2eb18a3a1f2cf471e5a7c15e.dirtree differ diff --git a/repo/objects/9e/728e6d1669c876ca6decb241575f83764d553b6774d8d319dc84e40ea7af24.filez b/repo/objects/9e/728e6d1669c876ca6decb241575f83764d553b6774d8d319dc84e40ea7af24.filez new file mode 100644 index 000000000..7e0a4771b Binary files /dev/null and b/repo/objects/9e/728e6d1669c876ca6decb241575f83764d553b6774d8d319dc84e40ea7af24.filez differ diff --git a/repo/objects/9e/c47b4c6d06e316b43127b5f8d6a14d895b2103b081a1a8ecf3ba1480f3e95a.filez b/repo/objects/9e/c47b4c6d06e316b43127b5f8d6a14d895b2103b081a1a8ecf3ba1480f3e95a.filez new file mode 100644 index 000000000..27f29c749 Binary files /dev/null and b/repo/objects/9e/c47b4c6d06e316b43127b5f8d6a14d895b2103b081a1a8ecf3ba1480f3e95a.filez differ diff --git a/repo/objects/9f/0cf461e9006c49f3be70376cf1de53f5605f6466e540a5396d92a43f654c6b.dirtree b/repo/objects/9f/0cf461e9006c49f3be70376cf1de53f5605f6466e540a5396d92a43f654c6b.dirtree new file mode 100644 index 000000000..e873d408d Binary files /dev/null and b/repo/objects/9f/0cf461e9006c49f3be70376cf1de53f5605f6466e540a5396d92a43f654c6b.dirtree differ diff --git a/repo/objects/9f/eff0d305faecc39637de60b3cbf01881b906cface4cb2c687c49d64bd21e25.filez b/repo/objects/9f/eff0d305faecc39637de60b3cbf01881b906cface4cb2c687c49d64bd21e25.filez new file mode 100644 index 000000000..05d82fc60 Binary files /dev/null and b/repo/objects/9f/eff0d305faecc39637de60b3cbf01881b906cface4cb2c687c49d64bd21e25.filez differ diff --git a/repo/objects/a0/33a5f252383b2bef35061ccd60085ce59c44795cbbfd8206f6b5d0c445d243.filez b/repo/objects/a0/33a5f252383b2bef35061ccd60085ce59c44795cbbfd8206f6b5d0c445d243.filez new file mode 100644 index 000000000..90e81f75c Binary files /dev/null and b/repo/objects/a0/33a5f252383b2bef35061ccd60085ce59c44795cbbfd8206f6b5d0c445d243.filez differ diff --git a/repo/objects/a2/601a174a9e784ee70ec77f2b07b0b383d7be046306d188b1d8f14139479f54.filez b/repo/objects/a2/601a174a9e784ee70ec77f2b07b0b383d7be046306d188b1d8f14139479f54.filez new file mode 100644 index 000000000..0becde18b Binary files /dev/null and b/repo/objects/a2/601a174a9e784ee70ec77f2b07b0b383d7be046306d188b1d8f14139479f54.filez differ diff --git a/repo/objects/a5/26c3399a72159cc3405c448507f8c1fa9d634f49c041edf23e46160b26c0dc.dirtree b/repo/objects/a5/26c3399a72159cc3405c448507f8c1fa9d634f49c041edf23e46160b26c0dc.dirtree new file mode 100644 index 000000000..898df5bba Binary files /dev/null and b/repo/objects/a5/26c3399a72159cc3405c448507f8c1fa9d634f49c041edf23e46160b26c0dc.dirtree differ diff --git a/repo/objects/a8/858b36da5e600c9387a00c1aaef1b8dfae18588bcdcde1e6a72bfbdf897dea.filez b/repo/objects/a8/858b36da5e600c9387a00c1aaef1b8dfae18588bcdcde1e6a72bfbdf897dea.filez new file mode 100644 index 000000000..757943456 Binary files /dev/null and b/repo/objects/a8/858b36da5e600c9387a00c1aaef1b8dfae18588bcdcde1e6a72bfbdf897dea.filez differ diff --git a/repo/objects/a9/137491f830ae049eee74957d64a044fae2cb83c573ffb15dca4a687b57f5fc.filez b/repo/objects/a9/137491f830ae049eee74957d64a044fae2cb83c573ffb15dca4a687b57f5fc.filez new file mode 100644 index 000000000..57ed56c52 Binary files /dev/null and b/repo/objects/a9/137491f830ae049eee74957d64a044fae2cb83c573ffb15dca4a687b57f5fc.filez differ diff --git a/repo/objects/a9/8b1fccb9995fb80f79d1083a8bd343349d03c9e5d2aa86ab0b9b1b476161ed.filez b/repo/objects/a9/8b1fccb9995fb80f79d1083a8bd343349d03c9e5d2aa86ab0b9b1b476161ed.filez new file mode 100644 index 000000000..270149666 Binary files /dev/null and b/repo/objects/a9/8b1fccb9995fb80f79d1083a8bd343349d03c9e5d2aa86ab0b9b1b476161ed.filez differ diff --git a/repo/objects/aa/896b67399fb7762ba23b9a132e14c6508fbdddf481bf76ccfb9c68c3d0d574.filez b/repo/objects/aa/896b67399fb7762ba23b9a132e14c6508fbdddf481bf76ccfb9c68c3d0d574.filez new file mode 100644 index 000000000..a5c5f4532 Binary files /dev/null and b/repo/objects/aa/896b67399fb7762ba23b9a132e14c6508fbdddf481bf76ccfb9c68c3d0d574.filez differ diff --git a/repo/objects/aa/8f39cfd413a5417f538a1f43afd562bda6a54e55b66a136b93d2421ff53e35.filez b/repo/objects/aa/8f39cfd413a5417f538a1f43afd562bda6a54e55b66a136b93d2421ff53e35.filez new file mode 100644 index 000000000..c21f063fe Binary files /dev/null and b/repo/objects/aa/8f39cfd413a5417f538a1f43afd562bda6a54e55b66a136b93d2421ff53e35.filez differ diff --git a/repo/objects/ab/31d27e745699e851add5f6e636105bcd327a7549ca7d8ccdbdff3eaf16f797.filez b/repo/objects/ab/31d27e745699e851add5f6e636105bcd327a7549ca7d8ccdbdff3eaf16f797.filez new file mode 100644 index 000000000..9e2c85525 Binary files /dev/null and b/repo/objects/ab/31d27e745699e851add5f6e636105bcd327a7549ca7d8ccdbdff3eaf16f797.filez differ diff --git a/repo/objects/ab/9189a6e5918707f43ce54dee5955411ec20eef829e35078fbf409fa90a07cd.dirtree b/repo/objects/ab/9189a6e5918707f43ce54dee5955411ec20eef829e35078fbf409fa90a07cd.dirtree new file mode 100644 index 000000000..dc99594fb Binary files /dev/null and b/repo/objects/ab/9189a6e5918707f43ce54dee5955411ec20eef829e35078fbf409fa90a07cd.dirtree differ diff --git a/repo/objects/ab/ce2e45fc0658480c83f3bdab1c59c9a99df5b3f48beba863c28ba4589842d6.dirtree b/repo/objects/ab/ce2e45fc0658480c83f3bdab1c59c9a99df5b3f48beba863c28ba4589842d6.dirtree new file mode 100644 index 000000000..711b5d0a6 Binary files /dev/null and b/repo/objects/ab/ce2e45fc0658480c83f3bdab1c59c9a99df5b3f48beba863c28ba4589842d6.dirtree differ diff --git a/repo/objects/ad/4048a76a8f52e4bd1a0f1d56b5b6563b129269fe7c17349b20c0b55226df4d.filez b/repo/objects/ad/4048a76a8f52e4bd1a0f1d56b5b6563b129269fe7c17349b20c0b55226df4d.filez new file mode 100644 index 000000000..1e35208e3 Binary files /dev/null and b/repo/objects/ad/4048a76a8f52e4bd1a0f1d56b5b6563b129269fe7c17349b20c0b55226df4d.filez differ diff --git a/repo/objects/b0/2d708664d0c0eb4b9d1ee123d0b1bf34222b4736c10f9e2a139252267192f5.dirtree b/repo/objects/b0/2d708664d0c0eb4b9d1ee123d0b1bf34222b4736c10f9e2a139252267192f5.dirtree new file mode 100644 index 000000000..630f06359 Binary files /dev/null and b/repo/objects/b0/2d708664d0c0eb4b9d1ee123d0b1bf34222b4736c10f9e2a139252267192f5.dirtree differ diff --git a/repo/objects/b3/a2805fc101720f969b0a56e33b3a8c5923894ec0d62125900776702ca9dd72.filez b/repo/objects/b3/a2805fc101720f969b0a56e33b3a8c5923894ec0d62125900776702ca9dd72.filez new file mode 100644 index 000000000..a2ee19969 Binary files /dev/null and b/repo/objects/b3/a2805fc101720f969b0a56e33b3a8c5923894ec0d62125900776702ca9dd72.filez differ diff --git a/repo/objects/b5/89d572469cc9ea8c8862871d4111b41b0d5f23078023cff4e17d4e9b23d721.filez b/repo/objects/b5/89d572469cc9ea8c8862871d4111b41b0d5f23078023cff4e17d4e9b23d721.filez new file mode 100644 index 000000000..7c820672c Binary files /dev/null and b/repo/objects/b5/89d572469cc9ea8c8862871d4111b41b0d5f23078023cff4e17d4e9b23d721.filez differ diff --git a/repo/objects/b9/11d71421920a02d61269e97ed11de47ee0ddb89161061fbfe4614f57d15733.dirtree b/repo/objects/b9/11d71421920a02d61269e97ed11de47ee0ddb89161061fbfe4614f57d15733.dirtree new file mode 100644 index 000000000..b3899f564 Binary files /dev/null and b/repo/objects/b9/11d71421920a02d61269e97ed11de47ee0ddb89161061fbfe4614f57d15733.dirtree differ diff --git a/repo/objects/b9/4fce966376a4472ac68b5118dcb0ad8e622cb746dfc8e97d22c53057a7fb3e.filez b/repo/objects/b9/4fce966376a4472ac68b5118dcb0ad8e622cb746dfc8e97d22c53057a7fb3e.filez new file mode 100644 index 000000000..e216a729a Binary files /dev/null and b/repo/objects/b9/4fce966376a4472ac68b5118dcb0ad8e622cb746dfc8e97d22c53057a7fb3e.filez differ diff --git a/repo/objects/bb/1ce5e173f98dbe91b8c2a02dc8428f7203581c02a12267138b80bd5e95a417.filez b/repo/objects/bb/1ce5e173f98dbe91b8c2a02dc8428f7203581c02a12267138b80bd5e95a417.filez new file mode 100644 index 000000000..6b364b80f Binary files /dev/null and b/repo/objects/bb/1ce5e173f98dbe91b8c2a02dc8428f7203581c02a12267138b80bd5e95a417.filez differ diff --git a/repo/objects/bc/7315a2310bc69742be378f6125c84bb757d2c4750b7ae239c6d96ec5a07705.dirtree b/repo/objects/bc/7315a2310bc69742be378f6125c84bb757d2c4750b7ae239c6d96ec5a07705.dirtree new file mode 100644 index 000000000..2c5c73b67 Binary files /dev/null and b/repo/objects/bc/7315a2310bc69742be378f6125c84bb757d2c4750b7ae239c6d96ec5a07705.dirtree differ diff --git a/repo/objects/be/644212270a1111e79143ec1867271075d996ad7986ed9a23fcc2c952514004.filez b/repo/objects/be/644212270a1111e79143ec1867271075d996ad7986ed9a23fcc2c952514004.filez new file mode 100644 index 000000000..3c5e32ddd Binary files /dev/null and b/repo/objects/be/644212270a1111e79143ec1867271075d996ad7986ed9a23fcc2c952514004.filez differ diff --git a/repo/objects/c0/3c7223c618129fd494610f411441d606702b3df9e0bdf06553959e74a3181f.filez b/repo/objects/c0/3c7223c618129fd494610f411441d606702b3df9e0bdf06553959e74a3181f.filez new file mode 100644 index 000000000..0eb7aa361 Binary files /dev/null and b/repo/objects/c0/3c7223c618129fd494610f411441d606702b3df9e0bdf06553959e74a3181f.filez differ diff --git a/repo/objects/c2/f5bdc250b1a335add98920f0434b55857447884ad90d5086961ee80a76fbbc.filez b/repo/objects/c2/f5bdc250b1a335add98920f0434b55857447884ad90d5086961ee80a76fbbc.filez new file mode 100644 index 000000000..ea85d153c Binary files /dev/null and b/repo/objects/c2/f5bdc250b1a335add98920f0434b55857447884ad90d5086961ee80a76fbbc.filez differ diff --git a/repo/objects/c3/2fe471888f97af61f96693a6e0d7a62a7aab4fce5810042d6ff0338a6c86cc.filez b/repo/objects/c3/2fe471888f97af61f96693a6e0d7a62a7aab4fce5810042d6ff0338a6c86cc.filez new file mode 100644 index 000000000..0354b1637 Binary files /dev/null and b/repo/objects/c3/2fe471888f97af61f96693a6e0d7a62a7aab4fce5810042d6ff0338a6c86cc.filez differ diff --git a/repo/objects/c3/bb3e149b2d6c861720da53d8b1a55360e0ea9767f9567dd2a051b16b8058fe.filez b/repo/objects/c3/bb3e149b2d6c861720da53d8b1a55360e0ea9767f9567dd2a051b16b8058fe.filez new file mode 100644 index 000000000..8a4071e3e Binary files /dev/null and b/repo/objects/c3/bb3e149b2d6c861720da53d8b1a55360e0ea9767f9567dd2a051b16b8058fe.filez differ diff --git a/repo/objects/c4/13225da73291febb2c28a263ee7d88fc108fddaf85fd662f78c42936af6c44.filez b/repo/objects/c4/13225da73291febb2c28a263ee7d88fc108fddaf85fd662f78c42936af6c44.filez new file mode 100644 index 000000000..42dd12ea9 Binary files /dev/null and b/repo/objects/c4/13225da73291febb2c28a263ee7d88fc108fddaf85fd662f78c42936af6c44.filez differ diff --git a/repo/objects/c4/f6e09b079b582753c0a556e50ce7826247c8fcc165a191a38965c3a497a271.dirtree b/repo/objects/c4/f6e09b079b582753c0a556e50ce7826247c8fcc165a191a38965c3a497a271.dirtree new file mode 100644 index 000000000..6dcaa33f9 Binary files /dev/null and b/repo/objects/c4/f6e09b079b582753c0a556e50ce7826247c8fcc165a191a38965c3a497a271.dirtree differ diff --git a/repo/objects/c6/0df779e2fc0a40985e9ec4b807489d9cb79a537198ffcc0bb22baa261f0d6c.filez b/repo/objects/c6/0df779e2fc0a40985e9ec4b807489d9cb79a537198ffcc0bb22baa261f0d6c.filez new file mode 100644 index 000000000..17ce8e61c Binary files /dev/null and b/repo/objects/c6/0df779e2fc0a40985e9ec4b807489d9cb79a537198ffcc0bb22baa261f0d6c.filez differ diff --git a/repo/objects/c9/f8d6d1ba05aa45a6a60ce1e3a035d672aae0070e32762dd6fce6f244bd4adf.filez b/repo/objects/c9/f8d6d1ba05aa45a6a60ce1e3a035d672aae0070e32762dd6fce6f244bd4adf.filez new file mode 100644 index 000000000..041398dda Binary files /dev/null and b/repo/objects/c9/f8d6d1ba05aa45a6a60ce1e3a035d672aae0070e32762dd6fce6f244bd4adf.filez differ diff --git a/repo/objects/ca/952375ca08ebd8398558432f6ddbbafbba396bf6651481d7146af6e8ec4914.dirtree b/repo/objects/ca/952375ca08ebd8398558432f6ddbbafbba396bf6651481d7146af6e8ec4914.dirtree new file mode 100644 index 000000000..27dcfd572 Binary files /dev/null and b/repo/objects/ca/952375ca08ebd8398558432f6ddbbafbba396bf6651481d7146af6e8ec4914.dirtree differ diff --git a/repo/objects/cb/19a4139b37f40607cb31d49c80ed914a4bc2e138561755223667b05c987189.filez b/repo/objects/cb/19a4139b37f40607cb31d49c80ed914a4bc2e138561755223667b05c987189.filez new file mode 100644 index 000000000..7609285c0 Binary files /dev/null and b/repo/objects/cb/19a4139b37f40607cb31d49c80ed914a4bc2e138561755223667b05c987189.filez differ diff --git a/repo/objects/cd/2fb60a836a21aa76fb44da7c2b72b88b4640e3bc2ae4e7905ea14e4e3472cf.filez b/repo/objects/cd/2fb60a836a21aa76fb44da7c2b72b88b4640e3bc2ae4e7905ea14e4e3472cf.filez new file mode 100644 index 000000000..ec023927c Binary files /dev/null and b/repo/objects/cd/2fb60a836a21aa76fb44da7c2b72b88b4640e3bc2ae4e7905ea14e4e3472cf.filez differ diff --git a/repo/objects/cf/a5fae94d78a61423b4ba04482364c8ef86bc5732608dc3d96e64261f1cda45.dirtree b/repo/objects/cf/a5fae94d78a61423b4ba04482364c8ef86bc5732608dc3d96e64261f1cda45.dirtree new file mode 100644 index 000000000..bac630358 Binary files /dev/null and b/repo/objects/cf/a5fae94d78a61423b4ba04482364c8ef86bc5732608dc3d96e64261f1cda45.dirtree differ diff --git a/repo/objects/cf/c83548e29e67cf627cca6b527835684b944f91ee55c965f296d9f635c744f2.filez b/repo/objects/cf/c83548e29e67cf627cca6b527835684b944f91ee55c965f296d9f635c744f2.filez new file mode 100644 index 000000000..12caf5b80 Binary files /dev/null and b/repo/objects/cf/c83548e29e67cf627cca6b527835684b944f91ee55c965f296d9f635c744f2.filez differ diff --git a/repo/objects/d0/1861fee9974ea0f0d39242f7654c99087159e19611d2cb229e79a4549c5691.dirtree b/repo/objects/d0/1861fee9974ea0f0d39242f7654c99087159e19611d2cb229e79a4549c5691.dirtree new file mode 100644 index 000000000..20bfa6959 Binary files /dev/null and b/repo/objects/d0/1861fee9974ea0f0d39242f7654c99087159e19611d2cb229e79a4549c5691.dirtree differ diff --git a/repo/objects/d1/305c5699184f4d317740f0aff4d25c47531d849bb6a0ebda3f6e921c27c44a.filez b/repo/objects/d1/305c5699184f4d317740f0aff4d25c47531d849bb6a0ebda3f6e921c27c44a.filez new file mode 100644 index 000000000..138913f9d Binary files /dev/null and b/repo/objects/d1/305c5699184f4d317740f0aff4d25c47531d849bb6a0ebda3f6e921c27c44a.filez differ diff --git a/repo/objects/d1/d52df8f6e7c0570c1db26bb9c3ff34edb263f5b0054724c97940e785f6e8e8.filez b/repo/objects/d1/d52df8f6e7c0570c1db26bb9c3ff34edb263f5b0054724c97940e785f6e8e8.filez new file mode 100644 index 000000000..06eb88738 Binary files /dev/null and b/repo/objects/d1/d52df8f6e7c0570c1db26bb9c3ff34edb263f5b0054724c97940e785f6e8e8.filez differ diff --git a/repo/objects/d6/5941cff1833b51c001a6645231c037aa8915030d6437bb29f94e2161c49723.commit b/repo/objects/d6/5941cff1833b51c001a6645231c037aa8915030d6437bb29f94e2161c49723.commit new file mode 100644 index 000000000..81d8f3fce Binary files /dev/null and b/repo/objects/d6/5941cff1833b51c001a6645231c037aa8915030d6437bb29f94e2161c49723.commit differ diff --git a/repo/objects/d6/ad335d9d7f9bbfbb6e33774efe0d0eb5db8fdc8d94fb512facbf632c6c90a5.filez b/repo/objects/d6/ad335d9d7f9bbfbb6e33774efe0d0eb5db8fdc8d94fb512facbf632c6c90a5.filez new file mode 100644 index 000000000..e8d5d8b4a Binary files /dev/null and b/repo/objects/d6/ad335d9d7f9bbfbb6e33774efe0d0eb5db8fdc8d94fb512facbf632c6c90a5.filez differ diff --git a/repo/objects/d6/f2d62271196356861d8bd8520608b99db3768f69598cdcbae752ccefd2f3b0.filez b/repo/objects/d6/f2d62271196356861d8bd8520608b99db3768f69598cdcbae752ccefd2f3b0.filez new file mode 100644 index 000000000..80847fe5b Binary files /dev/null and b/repo/objects/d6/f2d62271196356861d8bd8520608b99db3768f69598cdcbae752ccefd2f3b0.filez differ diff --git a/repo/objects/d7/618bdf95c950b23590bb8f79384eb0557e5515f7f12c838b876246a537bdf0.filez b/repo/objects/d7/618bdf95c950b23590bb8f79384eb0557e5515f7f12c838b876246a537bdf0.filez new file mode 100644 index 000000000..52e921e98 Binary files /dev/null and b/repo/objects/d7/618bdf95c950b23590bb8f79384eb0557e5515f7f12c838b876246a537bdf0.filez differ diff --git a/repo/objects/d7/b303e56c08ad77a515e4b5c88c5437024f0e3a7f235ee40262709d6a5c206a.filez b/repo/objects/d7/b303e56c08ad77a515e4b5c88c5437024f0e3a7f235ee40262709d6a5c206a.filez new file mode 100644 index 000000000..2a94e1958 Binary files /dev/null and b/repo/objects/d7/b303e56c08ad77a515e4b5c88c5437024f0e3a7f235ee40262709d6a5c206a.filez differ diff --git a/repo/objects/d7/cf2b14ead55f4fe35168406781e591330854a3fa11b10259897e829b8667db.filez b/repo/objects/d7/cf2b14ead55f4fe35168406781e591330854a3fa11b10259897e829b8667db.filez new file mode 100644 index 000000000..29f57d3d9 Binary files /dev/null and b/repo/objects/d7/cf2b14ead55f4fe35168406781e591330854a3fa11b10259897e829b8667db.filez differ diff --git a/repo/objects/d8/ffed80dd2201776fc467f23e0ed21bf94adae1ee0bd419dcd58e60b5bc826e.filez b/repo/objects/d8/ffed80dd2201776fc467f23e0ed21bf94adae1ee0bd419dcd58e60b5bc826e.filez new file mode 100644 index 000000000..cf3c08b09 Binary files /dev/null and b/repo/objects/d8/ffed80dd2201776fc467f23e0ed21bf94adae1ee0bd419dcd58e60b5bc826e.filez differ diff --git a/repo/objects/d9/163a95cdd8e75d585620038e2b9443a3f5be57b74b03ad5b18b0083ae92823.filez b/repo/objects/d9/163a95cdd8e75d585620038e2b9443a3f5be57b74b03ad5b18b0083ae92823.filez new file mode 100644 index 000000000..be0c45881 Binary files /dev/null and b/repo/objects/d9/163a95cdd8e75d585620038e2b9443a3f5be57b74b03ad5b18b0083ae92823.filez differ diff --git a/repo/objects/df/a0d2bf9bb5c558787c0f1399aa5130b25e365e56b18bcf7dc5ca0287408bfc.filez b/repo/objects/df/a0d2bf9bb5c558787c0f1399aa5130b25e365e56b18bcf7dc5ca0287408bfc.filez new file mode 100644 index 000000000..000b333e2 Binary files /dev/null and b/repo/objects/df/a0d2bf9bb5c558787c0f1399aa5130b25e365e56b18bcf7dc5ca0287408bfc.filez differ diff --git a/repo/objects/e0/19fc3e9311b22b0ae0186a33f465ba4291bbc9b49a961320aa5b765b53e3c5.filez b/repo/objects/e0/19fc3e9311b22b0ae0186a33f465ba4291bbc9b49a961320aa5b765b53e3c5.filez new file mode 100644 index 000000000..fa16afee4 Binary files /dev/null and b/repo/objects/e0/19fc3e9311b22b0ae0186a33f465ba4291bbc9b49a961320aa5b765b53e3c5.filez differ diff --git a/repo/objects/e1/04dfd3c6ec9a5b282aefb68ca6aed11f3f6b6fe89e3c87d9820a752054edab.dirtree b/repo/objects/e1/04dfd3c6ec9a5b282aefb68ca6aed11f3f6b6fe89e3c87d9820a752054edab.dirtree new file mode 100644 index 000000000..537aa9fe2 Binary files /dev/null and b/repo/objects/e1/04dfd3c6ec9a5b282aefb68ca6aed11f3f6b6fe89e3c87d9820a752054edab.dirtree differ diff --git a/repo/objects/e5/86401fae35290da4dbd7a84c1b0d7f6d7aab8d51af82478b0196bff1dec963.dirtree b/repo/objects/e5/86401fae35290da4dbd7a84c1b0d7f6d7aab8d51af82478b0196bff1dec963.dirtree new file mode 100644 index 000000000..1f0e50afe Binary files /dev/null and b/repo/objects/e5/86401fae35290da4dbd7a84c1b0d7f6d7aab8d51af82478b0196bff1dec963.dirtree differ diff --git a/repo/objects/e9/844e6232136e21946a3dc5f4692bf4eed2e27121f431d66c70f346bf4d99f4.filez b/repo/objects/e9/844e6232136e21946a3dc5f4692bf4eed2e27121f431d66c70f346bf4d99f4.filez new file mode 100644 index 000000000..c62fc9a7d Binary files /dev/null and b/repo/objects/e9/844e6232136e21946a3dc5f4692bf4eed2e27121f431d66c70f346bf4d99f4.filez differ diff --git a/repo/objects/e9/b6f6e70a461b258e9296aaa5be6bff70e50ccd2c2d6835aca7bf0760716540.filez b/repo/objects/e9/b6f6e70a461b258e9296aaa5be6bff70e50ccd2c2d6835aca7bf0760716540.filez new file mode 100644 index 000000000..f5cd46100 Binary files /dev/null and b/repo/objects/e9/b6f6e70a461b258e9296aaa5be6bff70e50ccd2c2d6835aca7bf0760716540.filez differ diff --git a/repo/objects/eb/59ed21d05e414d39109c3f978d43651cf58e962117102b7a633d0ce4906a18.dirtree b/repo/objects/eb/59ed21d05e414d39109c3f978d43651cf58e962117102b7a633d0ce4906a18.dirtree new file mode 100644 index 000000000..26c572ba8 Binary files /dev/null and b/repo/objects/eb/59ed21d05e414d39109c3f978d43651cf58e962117102b7a633d0ce4906a18.dirtree differ diff --git a/repo/objects/ec/a58644926a1b6056fbecda17788bd3ec2a3ab578be7f87a8ce25c26d1f012e.filez b/repo/objects/ec/a58644926a1b6056fbecda17788bd3ec2a3ab578be7f87a8ce25c26d1f012e.filez new file mode 100644 index 000000000..147c02d52 Binary files /dev/null and b/repo/objects/ec/a58644926a1b6056fbecda17788bd3ec2a3ab578be7f87a8ce25c26d1f012e.filez differ diff --git a/repo/objects/ed/3ff79db119668a1e33e9b3bba9aee78d75c72c2c269ac9cb17fb7234a0d661.dirtree b/repo/objects/ed/3ff79db119668a1e33e9b3bba9aee78d75c72c2c269ac9cb17fb7234a0d661.dirtree new file mode 100644 index 000000000..484c4a079 Binary files /dev/null and b/repo/objects/ed/3ff79db119668a1e33e9b3bba9aee78d75c72c2c269ac9cb17fb7234a0d661.dirtree differ diff --git a/repo/objects/ee/b005c21b4f0f9818aaef70e40e0cbc8bc8fe98c91d4d3a858d41e45b5c359d.filez b/repo/objects/ee/b005c21b4f0f9818aaef70e40e0cbc8bc8fe98c91d4d3a858d41e45b5c359d.filez new file mode 100644 index 000000000..9e4fe14fc Binary files /dev/null and b/repo/objects/ee/b005c21b4f0f9818aaef70e40e0cbc8bc8fe98c91d4d3a858d41e45b5c359d.filez differ diff --git a/repo/objects/ee/cc1bd323a5f741592666eb5a4bf5157256f8d0e4ffa341d75422d6f09d5724.dirtree b/repo/objects/ee/cc1bd323a5f741592666eb5a4bf5157256f8d0e4ffa341d75422d6f09d5724.dirtree new file mode 100644 index 000000000..99c3ab491 Binary files /dev/null and b/repo/objects/ee/cc1bd323a5f741592666eb5a4bf5157256f8d0e4ffa341d75422d6f09d5724.dirtree differ diff --git a/repo/objects/ef/a4edd75da18527fc66700bc654113d33d810a84616dcd5d35e06df3c958d62.dirtree b/repo/objects/ef/a4edd75da18527fc66700bc654113d33d810a84616dcd5d35e06df3c958d62.dirtree new file mode 100644 index 000000000..04dbc5886 Binary files /dev/null and b/repo/objects/ef/a4edd75da18527fc66700bc654113d33d810a84616dcd5d35e06df3c958d62.dirtree differ diff --git a/repo/objects/ef/d315bd8d0c24b374400fe916cf8312747e112939502a785118603c5ecb3a88.dirtree b/repo/objects/ef/d315bd8d0c24b374400fe916cf8312747e112939502a785118603c5ecb3a88.dirtree new file mode 100644 index 000000000..b56d0e707 Binary files /dev/null and b/repo/objects/ef/d315bd8d0c24b374400fe916cf8312747e112939502a785118603c5ecb3a88.dirtree differ diff --git a/repo/objects/f1/7a3ce385ef2b30fc9d08fd8e8465f02d4eda733f268b2add48ae283d6fa3ae.filez b/repo/objects/f1/7a3ce385ef2b30fc9d08fd8e8465f02d4eda733f268b2add48ae283d6fa3ae.filez new file mode 100644 index 000000000..3d2fbf405 Binary files /dev/null and b/repo/objects/f1/7a3ce385ef2b30fc9d08fd8e8465f02d4eda733f268b2add48ae283d6fa3ae.filez differ diff --git a/repo/objects/f4/4fb4d2baf911a1d6dee044d489417d7d4da70681edb4e0bfaac299b6240ab2.dirtree b/repo/objects/f4/4fb4d2baf911a1d6dee044d489417d7d4da70681edb4e0bfaac299b6240ab2.dirtree new file mode 100644 index 000000000..99e886cde Binary files /dev/null and b/repo/objects/f4/4fb4d2baf911a1d6dee044d489417d7d4da70681edb4e0bfaac299b6240ab2.dirtree differ diff --git a/repo/objects/f5/606a89af5ffa7d95ad69e7adb2afa9293556b99df98b924f727ff4466124f0.filez b/repo/objects/f5/606a89af5ffa7d95ad69e7adb2afa9293556b99df98b924f727ff4466124f0.filez new file mode 100644 index 000000000..721220b44 Binary files /dev/null and b/repo/objects/f5/606a89af5ffa7d95ad69e7adb2afa9293556b99df98b924f727ff4466124f0.filez differ diff --git a/repo/objects/f8/2aff09af0d3acac546bd076f40612d97ab4427bb06b99095a33c727ec5ca9f.filez b/repo/objects/f8/2aff09af0d3acac546bd076f40612d97ab4427bb06b99095a33c727ec5ca9f.filez new file mode 100644 index 000000000..d438c73d6 Binary files /dev/null and b/repo/objects/f8/2aff09af0d3acac546bd076f40612d97ab4427bb06b99095a33c727ec5ca9f.filez differ diff --git a/repo/objects/f8/5fb17ba73178e086f2cb3a52772f2b921c0ee6589813021b1150991ef85158.filez b/repo/objects/f8/5fb17ba73178e086f2cb3a52772f2b921c0ee6589813021b1150991ef85158.filez new file mode 100644 index 000000000..2536a8de6 Binary files /dev/null and b/repo/objects/f8/5fb17ba73178e086f2cb3a52772f2b921c0ee6589813021b1150991ef85158.filez differ diff --git a/repo/objects/f9/0bb6927ecb7f343f9c1d90cc81d5ebcf2dcfd7b09b05881070989dee715dab.filez b/repo/objects/f9/0bb6927ecb7f343f9c1d90cc81d5ebcf2dcfd7b09b05881070989dee715dab.filez new file mode 100644 index 000000000..4992e0e26 Binary files /dev/null and b/repo/objects/f9/0bb6927ecb7f343f9c1d90cc81d5ebcf2dcfd7b09b05881070989dee715dab.filez differ diff --git a/repo/objects/fa/69ac13724c50a7704361510bf4fc3c6dff7346489bfc15ad536694468c7077.filez b/repo/objects/fa/69ac13724c50a7704361510bf4fc3c6dff7346489bfc15ad536694468c7077.filez new file mode 100644 index 000000000..6183f5a93 Binary files /dev/null and b/repo/objects/fa/69ac13724c50a7704361510bf4fc3c6dff7346489bfc15ad536694468c7077.filez differ diff --git a/repo/objects/fc/47357f30944de7bf35927dc43a59211f34dcf66b8605d1f41fc105976e13c5.filez b/repo/objects/fc/47357f30944de7bf35927dc43a59211f34dcf66b8605d1f41fc105976e13c5.filez new file mode 100644 index 000000000..73d6d86da Binary files /dev/null and b/repo/objects/fc/47357f30944de7bf35927dc43a59211f34dcf66b8605d1f41fc105976e13c5.filez differ diff --git a/repo/objects/fc/5b66242a60ca51f8561c63c26e5cb506ac557aff80158da7e25ad5ac62946b.dirtree b/repo/objects/fc/5b66242a60ca51f8561c63c26e5cb506ac557aff80158da7e25ad5ac62946b.dirtree new file mode 100644 index 000000000..76b9e7be0 Binary files /dev/null and b/repo/objects/fc/5b66242a60ca51f8561c63c26e5cb506ac557aff80158da7e25ad5ac62946b.dirtree differ diff --git a/repo/objects/fd/80c15f05281985c4019b9dc456da968a4bc21a21005195a1743845d27e527e.filez b/repo/objects/fd/80c15f05281985c4019b9dc456da968a4bc21a21005195a1743845d27e527e.filez new file mode 100644 index 000000000..d6c1ede6f Binary files /dev/null and b/repo/objects/fd/80c15f05281985c4019b9dc456da968a4bc21a21005195a1743845d27e527e.filez differ diff --git a/repo/objects/fe/20097755c180db69b8e2b5c5af88ec743f1aa22091e8217dc2c46448a0c4cf.filez b/repo/objects/fe/20097755c180db69b8e2b5c5af88ec743f1aa22091e8217dc2c46448a0c4cf.filez new file mode 100644 index 000000000..81fb56ebb Binary files /dev/null and b/repo/objects/fe/20097755c180db69b8e2b5c5af88ec743f1aa22091e8217dc2c46448a0c4cf.filez differ diff --git a/repo/objects/fe/61be5488a510743dc507663cfe6c2f5e1ee2acdcaaa382823a64c3d6bccade.filez b/repo/objects/fe/61be5488a510743dc507663cfe6c2f5e1ee2acdcaaa382823a64c3d6bccade.filez new file mode 100644 index 000000000..dfdcbb872 Binary files /dev/null and b/repo/objects/fe/61be5488a510743dc507663cfe6c2f5e1ee2acdcaaa382823a64c3d6bccade.filez differ diff --git a/repo/objects/ff/5ee721b5ef42d6aab20114bcdfe526f94ffa680e9ce9613f52df5936c7b1e0.filez b/repo/objects/ff/5ee721b5ef42d6aab20114bcdfe526f94ffa680e9ce9613f52df5936c7b1e0.filez new file mode 100644 index 000000000..122a993ef Binary files /dev/null and b/repo/objects/ff/5ee721b5ef42d6aab20114bcdfe526f94ffa680e9ce9613f52df5936c7b1e0.filez differ diff --git a/repo/refs/heads/app/com.github.juliagoda.antimicro/x86_64/master b/repo/refs/heads/app/com.github.juliagoda.antimicro/x86_64/master new file mode 100644 index 000000000..746cb110c --- /dev/null +++ b/repo/refs/heads/app/com.github.juliagoda.antimicro/x86_64/master @@ -0,0 +1 @@ +7633ed5db7285e92f154cea1569807c1b83260627aaeef33459886ce1f7b0446 diff --git a/repo/refs/heads/app/com.github.juliagoda.antimicro/x86_64/stable b/repo/refs/heads/app/com.github.juliagoda.antimicro/x86_64/stable new file mode 100644 index 000000000..7336870f5 --- /dev/null +++ b/repo/refs/heads/app/com.github.juliagoda.antimicro/x86_64/stable @@ -0,0 +1 @@ +d65941cff1833b51c001a6645231c037aa8915030d6437bb29f94e2161c49723 diff --git a/repo/refs/heads/runtime/com.github.juliagoda.antimicro.Debug/x86_64/master b/repo/refs/heads/runtime/com.github.juliagoda.antimicro.Debug/x86_64/master new file mode 100644 index 000000000..32c9d42b9 --- /dev/null +++ b/repo/refs/heads/runtime/com.github.juliagoda.antimicro.Debug/x86_64/master @@ -0,0 +1 @@ +71a49cc20219ea047ccd7e7170d904e85074c29889641a535ac589154462882c diff --git a/repo/summary b/repo/summary new file mode 100644 index 000000000..97c9351da Binary files /dev/null and b/repo/summary differ diff --git a/share/antimicro/blank.txt b/share/antimicro/blank.txt old mode 100644 new mode 100755 diff --git a/share/antimicro/translations/CMakeLists.txt b/share/antimicro/translations/CMakeLists.txt old mode 100644 new mode 100755 index 68e18e6d1..48f024bbb --- a/share/antimicro/translations/CMakeLists.txt +++ b/share/antimicro/translations/CMakeLists.txt @@ -5,7 +5,7 @@ list(APPEND antimicro_TRANSLATIONS antimicro.ts) file(GLOB_RECURSE antimicro_BASE_SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp) file(GLOB_RECURSE antimicro_BASE_FORMS ${PROJECT_SOURCE_DIR}/src/*.ui) -if(USE_QT5) + if(UPDATE_TRANSLATIONS) message("Update translations - lupdate ON") QT5_CREATE_TRANSLATION(antimicro_QMFILES ${antimicro_BASE_SOURCES} @@ -13,9 +13,9 @@ if(USE_QT5) else() QT5_ADD_TRANSLATION(antimicro_QMFILES ${antimicro_TRANSLATIONS}) endif(UPDATE_TRANSLATIONS) -endif(USE_QT5) + add_custom_target(updateqm DEPENDS ${antimicro_QMFILES}) -install(FILES ${antimicro_QMFILES} DESTINATION "share/antimicro/translations") +install(FILES ${antimicro_QMFILES} DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/antimicro/translations") set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM true) diff --git a/share/antimicro/translations/antimicro.ts b/share/antimicro/translations/antimicro.ts old mode 100644 new mode 100755 index c162a7265..38318ad43 --- a/share/antimicro/translations/antimicro.ts +++ b/share/antimicro/translations/antimicro.ts @@ -4,17 +4,17 @@ AboutDialog - + About - + Version - + "juliagoda" (since March, 2018) Wanting only to play my favourite old games that din't support gamepads, I found this project (which map keyboard keys and mouse buttons to connected gamepads on Linux) as most proper and recent. But because of poor choices of such application on the internet and since it didn't compile properly, I decided to rescue the project. However, once I finished my work (enough to enjoy playing games) I thought about sharing this code with others. Of course all informations about past programmers will be held. "Ryochan7" (since December 30, 2012 until 2017), I have been working on antimicro in my spare time. What originally started as a fork of QJoyPad and a way to learn proper event-driven programming has turned into something much bigger than I originally intended. Although I have spent a lot of time learning new techniques, finding out more about the domain of KB+M emulation, and spending Friday nights bashing my head against my keyboard, it has been a fun and enriching experience overall. @@ -32,17 +32,17 @@ As of May 24, 2016, this project has moved to https://github.com/AntiMicro/antim - + Copyright: 2013 - 2018 - + Info - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -86,7 +86,7 @@ p, li { white-space: pre-wrap; } - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -204,57 +204,57 @@ p, li { white-space: pre-wrap; } - + Changelog - + Credits - + antimicro - + About Development - + License - + Program Version %1 - + Program Compiled on %1 at %2 - + Built Against SDL %1 - + Running With SDL %1 - + Using Qt %1 - + Using Event Handler: %1 @@ -262,151 +262,156 @@ p, li { white-space: pre-wrap; } AddEditAutoProfileDialog - + Auto Profile Dialog - + Profile: - - + + Browse - + Window: - - + + Select Window. Click on the appropriate application window and the application file path will be populated in the form. - + Detect Window Properties - + Class: - + Title: - + + set partial title + + + + Application: - + Select - - Devices: + + De&vices: - - + + Select this profile to be the default loaded for the specified device. The selection will be used instead of the all default profile option. - + Set as Default for Controller - - + + A different profile is already selected as the default for this device. - + Current (%1) - + Open Config - - + + Select Program - + Programs (*.exe) - + Please use the main default profile selection. - + Please select a window by using the mouse. Press Escape if you want to cancel. - + Capture Application Window - + Could not obtain information for the selected window. - + Application Capture Failed - + Profile file path is invalid. - + No window matching property was specified. - + Program path is invalid or not executable. - + File is not an .exe file. - + No window matching property was selected. @@ -414,502 +419,502 @@ of the all default profile option. AdvanceButtonDialog - - + + Advanced - + Assignments - + Toggle - + Turbo - + Set Selector - + Blank or KB/M - + Hold - + Pause - + Cycle - + Distance - + Insert - + Delete - + Clear All - + Time: - + 0.01s - + 0s - + Insert a pause that occurs in between key presses. - + Release - - + + Insert a new blank slot. - + Delete a slot. - + Clear all currently assigned slots. - + Specify the duration of an inserted Pause or Hold slot. - + 0m - + &Mouse Speed Mod: - - + + Specify the range past an axis dead zone in which a sequence of actions will execute. - + Distance: - - + + % - + Mouse Mod - + Press Time - + Delay - + Execute - + Load - + Set Change - + Text Entry - + Placeholder - - + + 0 - + Set the percentage that mouse speeds will be modified by. - + Auto Reset Cycle After - + seconds - + Executable: - + ... - + Arguments: - - - + + + Enabled - + Mode: - + <html><head/><body><p>Normal: Repeatedly press and release a button by the chosen rate.</p><p>Gradient: Modify the button press and button release delay based on how far an axis has been moved. The rate will remain the same.</p><p>Pulse: Modify how many times a button is pressed and released per second. The button delay will remain the same.</p></body></html> - + Normal - + Gradient - + Pulse - + Delay: - + 0.10s - + Rate: - + 10.0/s - - + + Disabled - + Select Set 1 One Way - + Select Set 1 Two Way - + Select Set 1 While Held - + Select Set 2 One Way - + Select Set 2 Two Way - + Select Set 2 While Held - + Select Set 3 One Way - + Select Set 3 Two Way - + Select Set 3 While Held - + Select Set 4 One Way - + Select Set 4 Two Way - + Select Set 4 While Held - + Select Set 5 One Way - + Select Set 5 Two Way - + Select Set 5 While Held - + Select Set 6 One Way - + Select Set 6 Two Way - + Select Set 6 While Held - + Select Set 7 One Way - + Select Set 7 Two Way - + Select Set 7 While Held - + Select Set 8 One Way - + Select Set 8 Two Way - + Select Set 8 While Held - + sec. - + /sec. - + Set %1 - - + + Select Set %1 - + One Way - + Two Way - + While Held - + Choose Executable - + Slots past a Cycle action will be executed on the next button press. Multiple cycles can be added in order to create partitions in a sequence. - + Delays the time that the next slot is activated by the time specified. Slots activated before the delay will remain active after the delay time has passed. - + Distance action specifies that the slots afterwards will only be executed when an axis is moved a certain range past the designated dead zone. - + Insert a hold action. Slots after the action will only be executed if the button is held past the interval specified. - + Chose a profile to load when this slot is activated. - + Mouse mod action will modify all mouse speed settings by a specified percentage while the action is being processed. This can be useful for slowing down the mouse while sniping. - + Specify the time that keys past this slot should be held down. - + Insert a release action. Slots after the action will only be executed after a button release if the button was held past the interval specified. - + Change to selected set once slot is activated. - + Full string will be typed when a slot is activated. - + Execute program when slot is activated. - - + + Choose Profile - + Config Files (*.amgp *.xml) @@ -917,157 +922,157 @@ of the all default profile option. AdvanceStickAssignmentDialog - + Stick/Pad Assignment - + Sticks - + DPads - - + + %1 (Joystick %2) - + Stick 1 - - - + + + Enabled - - - - - - + + + + + + Assign - - + + X Axis: - - + + Y Axis: - + Stick 2 - + Number of Physical DPads: %1 - + Virtual DPad 1 - + Up: - + Down: - + Note: This window is meant for backwards compatibility with profiles made before antimicro 2.0. Since version 2.0, use of the Game Controller Mapping window is preferred. - + Left: - + Right: - - - - + + + + Axis %1 - - - - + + + + Axis %1 - - - - - + + + + Axis %1 + - - - - + + + + Button %1 - + Move stick 1 along the X axis - + Move stick 1 along the Y axis - + Move stick 2 along the X axis - + Move stick 2 along the Y axis - - - - + + + + Press a button or move an axis @@ -1075,179 +1080,179 @@ of the all default profile option. AxisEditDialog - + Axis - - + + Mouse (Horizontal) - - + + Mouse (Inverted Horizontal) - - + + Mouse (Vertical) - - + + Mouse (Inverted Vertical) - - + + Arrows: Up | Down - - + + Arrows: Left | Right - - + + Keys: W | S - - + + Keys: A | D - - + + NumPad: KP_8 | KP_2 - - + + NumPad: KP_4 | KP_6 - - - + + + None - - + + Set the value to use as the limit for an axis. Useful for a worn out analog stick. - + Negative Half Throttle - + Positive Half Throttle - + Name: - + Specify the name of an axis. - + Mouse Settings - - + + Set the value of the dead zone for an axis. - + Presets: - + Dead Zone: - + Max Zone: - - + + [NO KEY] - + Throttle setting that determines the behavior of how to interpret an axis hold or release. - + Negative Throttle - + Normal - + Positive Throttle - + Current Value: - + Set - + Set %1 - + Left Mouse Button - + Right Mouse Button @@ -1255,123 +1260,123 @@ interpret an axis hold or release. ButtonEditDialog - + Dialog - + To make a new assignment, press any keyboard key or click a button in the Keyboard or Mouse tab - + Placeholder - + Toggle - + Enables a key press or release to only occur when a controller button is pressed. - + Enables rapid key presses and releases. Turbo controller. - + Turbo - + Last keyboard/mouse button: - + Slots - + Na&me: - + Specify the name of a button. - + Action: - + Specify the action that will be performed in game while this button is being used. - + Advanced - - - + + + Choose your keyboard key - + No button - - - - + + + + Last button - + To change settings for last button, it must be at least one assignment from keyboard to gamepad - + To change settings of turbo for last button, it must be at least one assignment from keyboard to gamepad - + To open advanced dialog, it's needed to map at least one button from keyboard to gamepad - + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + As last gamepad button has been set - + Index %1 @@ -1379,190 +1384,190 @@ this button is being used. Calibration - + Form - - + + Start calibration - + Controller: - + Sticks: - - Use settings from jstest-gtk - - - - + Reset settings - + Cancel - - + + Save - - + + Calibration - - Do you really want to reset settings of current axes? + + Do you really want to reset settings of current axis? - + Calibration was saved for the preset. Do you really want to reset settings? - + Place the joystick in the center position. It's the part, where often you don't have to move. Just skip it in such situation. - + Calibrating center - + Start second step - + Center X: %1 - + Center Y: %1 - + Place the joystick in the top-left corner many times - - + + Calibrating position - - + + X: %1 - - + + Y: %1 - + Place the joystick in the bottom-right corner - + Start final step - + range X: %1 - %2 - + range Y: %1 - %2 - + deadzone X: %1 - + deadzone Y: %1 - + ---Calibration done!--- - + Calibration values have been saved - - + + Dead zone calibration - - You must move X axis to the right at least five times! Keep moving! + + You have to move axes to the top-left corner at least five times. + + + + + You have to move axes to the bottom-right corner at least five times. - - You must move X axis to the left at least five times! Keep moving! + + Do you want to save calibration of current axis? - - - - + + + + Axis %1 @@ -1570,64 +1575,64 @@ deadzone Y: %1 CapturedWindowInfoDialog - + Captured Window Properties - + Information About Window - + Class: - - - + + + TextLabel - + Title: - + Path: - + Match By Properties - + Class - + Title - + Path - + Full Path - + File Name @@ -1635,67 +1640,67 @@ deadzone Y: %1 DPadContextMenu - + Mouse (Normal) - + Mouse (Inverted Horizontal) - + Mouse (Inverted Vertical) - + Mouse (Inverted Horizontal + Vertical) - + Arrows - + Keys: W | A | S | D - + NumPad - + None - + Standard - + Eight Way - + 4 Way Cardinal - + 4 Way Diagonal - + Mouse Settings @@ -1703,108 +1708,108 @@ deadzone Y: %1 DPadEditDialog - + Dialog - + Presets: - + Mouse (Normal) - + Mouse (Inverted Horizontal) - + Mouse (Inverted Vertical) - + Mouse (Inverted Horizontal + Vertical) - + Arrows - + Keys: W | A | S | D - + NumPad - + None - + Dpad Mode: - + &Name: - + 4 Way Cardinal - + 4 Way Diagonal - + DPad Delay: - - + + Time lapsed before a direction change is taken into effect. - + s - + Specify the name of a dpad. - + Mouse Settings - + Standard - + Standard: 8 region dpad with two direction buttons active when the dpad is in a diagonal region. @@ -1820,17 +1825,17 @@ to a diagonal zone. - + Eight Way - + Set - + Set %1 @@ -1838,27 +1843,27 @@ to a diagonal zone. EditAllDefaultAutoProfileDialog - + Default Profile - + Profile: - + Browse - + Open Config - + Profile file path is invalid. @@ -1866,29 +1871,29 @@ to a diagonal zone. ExtraProfileSettingsDialog - + Extra Profile Settings - + Key Press Time: - + 0.00 ms - + Profile Name: - - - + + + s @@ -1896,7 +1901,7 @@ to a diagonal zone. GameController - + Game Controller @@ -1904,9 +1909,9 @@ to a diagonal zone. GameControllerDPad - - - + + + DPad @@ -1914,187 +1919,187 @@ to a diagonal zone. GameControllerMappingDialog - + Game Controller Mapping - + <html><head/><body><p>antimicro makes use of the <a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;">Game Controller API</span></a> provided by SDL 2 in order to abstract various gamepads to fit a unified standard. In order to make a button assignment, please highlight the mapping cell for the appropriate button row below. You can then press a button or move an axis on your gamepad and the cell will update with the physical button or axis that will be used.</p><p>antimicro will use the mapping that you specify to save a mapping string that will be loaded into SDL.</p></body></html> - + A - + B - + X - + Y - + Back - + Start - + Guide - + Left Shoulder - + Right Shoulder - + Left Stick Click - + Right Stick Click - + Left Stick X - + Left Stick Y - + Right Stick X - + Right Stick Y - + Left Trigger - + Right Trigger - + DPad Up - + DPad Left - + DPad Down - + DPad Right - + Mapping - + SDL 2 Game Controller Mapping String - + Last Axis Event: - + Current Axis Detection Dead Zone: - + 5000 - + 10000 - + 15000 - + 20000 - + 25000 - + 30000 - + 32000 - + Game Controller Mapping (%1) (#%2) - + Discard Controller Mapping? - + Discard mapping for this controller? If discarded, the controller will be reverted to a joystick once you refresh all joysticks. @@ -2104,47 +2109,47 @@ If discarded, the controller will be reverted to a joystick once you refresh all GameControllerSet - + Back - + Guide - + Start - + LS Click - + RS Click - + L Shoulder - + R Shoulder - + L Trigger - + R Trigger @@ -2152,9 +2157,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all GameControllerTrigger - - - + + + Trigger @@ -2162,9 +2167,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxis - - - + + + Axis @@ -2172,24 +2177,24 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxisButton - + Negative - + Positive - + Unknown - - - + + + Button @@ -2197,74 +2202,74 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxisContextMenu - + Mouse (Horizontal) - + Mouse (Inverted Horizontal) - + Mouse (Vertical) - + Mouse (Inverted Vertical) - + Arrows: Up | Down - + Arrows: Left | Right - + Keys: W | S - + Keys: A | D - + NumPad: KP_8 | KP_2 - + NumPad: KP_4 | KP_6 - - + + None - - + + Mouse Settings - + Left Mouse Button - + Right Mouse Button @@ -2272,57 +2277,57 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButton - + Processing turbo for #%1 - %2 - + Finishing turbo for button #%1 - %2 - + Processing press for button #%1 - %2 - + Processing release for button #%1 - %2 - + Distance change for button #%1 - %2 - - - + + + Button - - - - + + + + [NO KEY] - + [Set %1 1W] - + [Set %1 2W] - + [Set %1 WH] @@ -2330,47 +2335,47 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButtonContextMenu - + Toggle - + Turbo - + Clear - + Set Select - + Disabled - + Set %1 - + Set %1 1W - + Set %1 2W - + Set %1 WH @@ -2378,118 +2383,118 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButtonSlot - - + + Mouse - + Up - + Down - + Left - + Right - + LB - + MB - + RB - + B4 - + B5 - + Pause - + Hold - + Cycle - + Distance - + Release - + Mouse Mod - + Press Time - + Delay - + Load %1 - + Set Change %1 - + [Text] %1 - + [Exec] %1 - + [NO KEY] @@ -2497,9 +2502,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStick - - - + + + Stick @@ -2507,37 +2512,37 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickButton - - - + + + Up - - - + + + Down - - - + + + Left - - - + + + Right - - - + + + Button @@ -2545,67 +2550,67 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickContextMenu - + Mouse (Normal) - + Mouse (Inverted Horizontal) - + Mouse (Inverted Vertical) - + Mouse (Inverted Horizontal + Vertical) - + Arrows - + Keys: W | A | S | D - + NumPad - + None - + Standard - + Eight Way - + 4 Way Cardinal - + 4 Way Diagonal - + Mouse Settings @@ -2613,86 +2618,86 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickEditDialog - + Dialog - + X: - - - - - + + + + + 0 - + Y: - + Distance: - + Presets: - + Mouse (Normal) - + Mouse (Inverted Horizontal) - + Mouse (Inverted Vertical) - + Mouse (Inverted Horizontal + Vertical) - + Arrows - + Keys: W | A | S | D - + NumPad - + None - + Stick Mode: - + Standard: 8 region stick with two direction buttons active when the stick is in a diagonal region. @@ -2708,72 +2713,72 @@ to a diagonal zone of the stick. - + 4 Way Cardinal - + 4 Way Diagonal - - + + Dead zone value to use for an analog stick. - - + + Value when an analog stick is considered moved 100%. - - + + The area (in degrees) that each diagonal region occupies. - + Square Stick: - - + + Percentage to modify a square stick coordinates to confine values to a circle - + % - + Stick Delay: - - + + Time lapsed before a direction change is taken into effect. - + s - + Modifier: - + Edit button that is active while the stick is active. This button is useful for assigning zones with @@ -2782,68 +2787,68 @@ functionality to an analog stick. - + PushButton - + Na&me: Name: - + Specify the name of an analog stick. - + Mouse Settings - + Standard - + Bearing: - + % Safe Zone: - + Eight Way - + Dead Zone: - + Max Zone: - + Diagonal Range: - + Set - + Set %1 @@ -2851,9 +2856,9 @@ functionality to an analog stick. JoyControlStickModifierButton - - - + + + Modifier @@ -2861,9 +2866,9 @@ functionality to an analog stick. JoyDPad - - - + + + DPad @@ -2871,37 +2876,37 @@ functionality to an analog stick. JoyDPadButton - - - + + + Up - - - + + + Down - - - + + + Left - - - + + + Right - - - + + + Button @@ -2909,266 +2914,271 @@ functionality to an analog stick. JoyTabWidget - - - - - - + + + + + + <New> - - + + Remove - - + + Remove configuration from recent list. - - + + Load - - + + Load configuration file. - - + + Save - - + + Save changes to configuration file. - - + + Save As - - + + Save changes to a new configuration file. - - + + Sets - + Copy from Set - + Settings - - + + Set 1 - - + + Set 2 - - + + Set 3 - - + + Set 4 - - + + Set 5 - - + + Set 6 - - + + Set 7 - - + + Set 8 - - + + Stick/Pad Assign - - + + Controller Mapping - - + + Quick Set - - + + Names - - + + Toggle button name displaying. - - + + Pref - - + + Change global profile settings. - - - + + + Reset - - + + Revert changes to the configuration. Reload configuration file. - + Open Config - + Config Files (*.amgp *.xml) - - - + + + Config File (*.%1.amgp) - - + + Do you really want to reset buttons settings for joystick? + + + + + Save Profile Changes? - - + + Changes to the new profile have not been saved. Would you like to save or discard the current profile? - - + + Changes to the profile "%1" have not been saved. Would you like to save or discard changes to the current profile? - + Sticks - - + + DPads - + No buttons have been assigned. Please use Quick Set to assign keys to buttons or disable hiding empty buttons. - - + + Set %1: %2 - - + + Set %1 - + Copy Set Assignments - + Are you sure you want to copy the assignments and device properties from %1? - - - + + + Save Config - - + + Set @@ -3176,7 +3186,7 @@ to buttons or disable hiding empty buttons. Joystick - + Joystick @@ -3184,98 +3194,98 @@ to buttons or disable hiding empty buttons. JoystickStatusWindow - + Properties - + Details - + Name: - - - - - - - + + + + + + + %1 - + Number: - + Axes: - + Buttons: - + Hats: - + GUID: - + Game Controller: - + Axes - + Buttons - + Hats - + %1 (#%2) Properties - + Axis %1 - + Hat %1 - + No - + Yes @@ -3283,62 +3293,67 @@ to buttons or disable hiding empty buttons. MainSettingsDialog - + Edit Settings - + General - + Controller Mappings - + Language - + Auto Profile - + Mouse - + Advanced - + + Profile Direc&tory: + + + + <html><head/><body><p>Specify the default directory that the program should use in file dialogs when loading a profile or saving a new profile.</p></body></html> - + Recent Profile Count: - + <html><head/><body><p>Number of profiles that can be placed in recent profile list. 0 will result in the program not enforcing a limit on the number of profiles displayed.</p></body></html> - + Gamepad Poll Rate: - + Change the poll rate that the program uses to discover new events from gamepads. Defaults to 10 ms. @@ -3348,52 +3363,52 @@ before using antimicro unattended. - + Hide main window when the main window close button is clicked instead of quitting the program. - + Close To Tray - + Have Windows start antimicro at system startup. - + Launch At Windows Startup - + Display recent profiles for all controllers as a single list in the tray menu. Defaults to using sub-menus. - + Single Profile List in Tray - + Have the program minimize to the taskbar. By default, the program minimizes to the system tray if available. - + Minimize to Taskbar - + This option will cause the program to hide all buttons that have no slots assigned to them. The Quick Set dialog window will have to be used @@ -3401,184 +3416,194 @@ to bring up the edit dialog for gamepad buttons. - + Hide Empty Buttons - + When the program is launched, open the last known profile that was opened during the previous session. - + Auto Load Last Opened Profile - + Only show the system tray icon when the program first launches. - + Launch in Tray - + Associate .amgp files with antimicro in Windows Explorer. - + Associate Profiles - + Key Repeat - + Active keys will be repeatedly pressed when this option is enabled. - - + + Enable - + Specifies how much time should elapse before key repeating begins. - + Specifies how many times key presses will be performed per seconds. - + <html><head/><body><p>antimicro has been translated into many different languages by contributors. By default, the program will choose an appropriate translation based on your system's locale setting. However, you can make antimicro load a different translation depending on the language that you choose from the list below.</p></body></html> - + Português do Brasil - + Français - + Deutsch - + Italiano - + 日本語 - + Русский - + српски / srpski - + 简体中文 - + Español - + українська - + Polski - + + History Si&ze: + + + + Log File: - + Log Level: - + None - + Error - + Warning - + Info - + Debug - + + Reset + + + + Class - + Title - + Program - + Disable the "Enhanced Pointer Precision" Windows setting while antimicro is running. Disabling "Enhanced Pointer Precision" will allow mouse movement within antimicro to be more @@ -3586,32 +3611,27 @@ precise. - + Disable Enhance Pointer Precision - + Smoothing - - Histor&y Size: - - - - + Weight &Modifier: - + Refresh Rate: - + The refresh rate is the amount of time that will elapse in between mouse events. Please be cautious when editing this setting as it will cause the program to use @@ -3621,46 +3641,46 @@ it unattended. - + Spring - + Screen: - + Utilize the specified screen for spring mode. On Linux, the default is to use the primary screen. On Windows, the default is to use all available screens. - + Accel Numerator: - - - + + + 0 - + Accel Denominator: - + Accel Threshold: - + If the acceleration values for the virtual mouse have been changed by a different process, particularly when quitting an older game, then you might want to reset the acceleration @@ -3668,341 +3688,346 @@ values used by the virtual mouse. - + Reset Acceleration - + Delay: - - Profi&le Directory: - - - - + ms - + Rate: - + times/s - + Below is a list of the custom mappings that have been saved. You can use the following table to delete mappings or have mappings temporarily disabled. You can also disable mappings that are included with SDL; just insert a new row with the appropriate joystick GUID and check disable. Settings will not take affect until you either refresh all joysticks or unplug that particular joystick. - + GUID - + Mapping String - + Disable? - - + + Delete - + Insert - - + + Default - + English - - + + Active - + Devices: - - + + All - + Device - + Profile - + Default? - + Add - + Edit - + Also, Windows users who want to use a low value should also check the "Disable Enhance Pointer Precision" checkbox if you haven't disabled the option in Windows. - + Select Default Profile Directory - + Are you sure you want to delete the profile? - + Save Log File As - + Log Files (*.log) + + + Do you really want to reset setting? + + + + + Would you like to reset mappings too? + + MainWindow - + antimicro - + No Joysticks have been found. Please plug in a joystick and then choose the "Update Joysticks" option in the main menu - + If events are not seen by a game, please click here to run this application as Administrator. - + &App - + &Options - + &Help - - + + &Quit - + Ctrl+Q - - + + &Update Joysticks - + Ctrl+U - - + + &Hide - + Ctrl+H - + &About - + Ctrl+A - + About &Qt - + &Properties - + &Key Checker - + &GitHub Page - + &Game Controller Mapping - + S&ettings - + &Stick/Pad Assign - + &Wiki - + &Issues - + &Calibration - + Home Page - + Could not find a proper controller identifier. Exiting. - - - - - - - + + + + + + + (%1) - - + + Open File - + &Restore - + Calibration couldn't be opened - + You must connect at least one controller to open the window - + Run as Administrator? - + Are you sure that you want to run this program as Adminstrator? Some games run as Administrator which will cause events generated by antimicro to not be used by those games unless antimicro is also run as the Adminstrator. This is due to permission problems caused by User Account Control (UAC) options in Windows Vista and later. - + Failed to elevate program - + Failed to restart this program as the Administrator - + Could not find controller. Exiting. @@ -4010,12 +4035,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseAxisSettingsDialog - + Mouse Settings - - + Set %1 @@ -4023,12 +4048,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseButtonSettingsDialog - + Mouse Settings - - + Set %1 @@ -4036,12 +4061,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseControlStickSettingsDialog - + Mouse Settings - + Set %1 @@ -4049,12 +4074,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseDPadSettingsDialog - + Mouse Settings - + Set %1 @@ -4062,17 +4087,17 @@ Some games run as Administrator which will cause events generated by antimicro t MouseSettingsDialog - + Mouse Settings - + Mouse Mode: - + Cursor mode is used to move the mouse cursor around the screen relative to its current position depending on how much you move an axis @@ -4086,79 +4111,79 @@ axis is moved back to the dead zone. - + Cursor - + Spring - + Acceleration: - + Enhanced Precision - - + + Linear - + Quadratic - + Cubic - + Quadratic Extreme - + Power Function - + Easing Quadratic - + Easing Cubic - + Mouse Speed Settings - + Enable to change the horizontal and vertical speed boxes at the same time. - + Change Together - + Options for adding more acceleration to the mouse movement beyond what the acceleration curve would produce. Acceleration is added based on how quickly an axis is @@ -4168,52 +4193,52 @@ using typical gamepad analog sticks. - + Delta Acceleration - + &Multiplier: - + Mi&n Threshold: - - + + 1 = 20 pps - + Wheel Hori. Speed: - + Set the speed used for horizontal mouse wheel movement according to number of simulated notches per second. - + Set the speed used for vertical mouse wheel movement according to number of simulated notches per second. - + Sensitivit&y: - + For Power Function acceleration curve. Specifies the factor to use for curve sensitivity. When the value is above 1.0, the mouse movement will be accelerated @@ -4221,122 +4246,122 @@ faster at the low end of an axis. - + Easing Duration: - - + + s - + Highest value to accelerate mouse movement by - + x - + Start %: - + Acceleration begins at this percentage of the base multiplier - + Minimum amount of axis travel required for acceleration to begin - + Max Threshold: - + Maximum axis travel before acceleration has reached the multiplier value - + E&xtra Duration: - + Curve: - + Ease Out Sine - + Ease Out Quad - + Ease Out Cubic - + Release Radius: - + Specifies that the spring area will be relative to the mouse position set by a non-relative spring. - + Relative - + Mouse Status - + X: - - + + 0 (0 pps) - + Y: - - + + 1 = 1 notch(es)/s - + Enhanced: Three tier curve that makes the mouse move slow on the low end of an axis and fast on the high end. @@ -4358,77 +4383,77 @@ a period of time using a Cubic curve. - + Hori&zontal Speed: - + &Vertical Speed: - + Wheel Vert. Speed: - + Specifies the amount of time (in seconds) that will be required before the mouse is fully accelerated after reaching the high end of an axis. - - - - + + + + % - + Extend the time that extra acceleration is applied. Axis travel will be taken into account. A slower flick will decrease the actual time that extra acceleration will be applied. - + Spring Settings - + Spring Width: - + Changes the width of the region that the cursor can move in spring mode. 0 will use the entire width of your screen. - + Spring Height: - + Changes the height of the region that the cursor can move in spring mode. 0 will use the entire height of your screen. - - + + %n notch(es)/s %n notch/s @@ -4439,39 +4464,39 @@ of your screen. QKeyDisplayDialog - + Key Checker - - <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> + + <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="http://doc.qt.io/qt-5/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">http://doc.qt.io/qt-5/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> - + Event Handler: - + Native Key Value: - - - + + + 0x00000000 - + Qt Key Value: - + antimicro Key Value: @@ -4479,285 +4504,285 @@ of your screen. QObject - + Super - + Menu - + Mute - + Vol+ - + Vol- - + Play/Pause - + Play - + Pause - + Prev - + Next - + Mail - + Home - + Media - + Search - + Daemon launched - + Failed to launch daemon - + Launching daemon - - + + Display string "%1" is not valid. - + Failed to set a signature id for the daemon - + Failed to change working directory to / - + Quitting Program - + # of joysticks found: %1 - + List Joysticks: - + --------------- - + Joystick %1: - + Index: %1 - + GUID: %1 - + Name: %1 - + Yes - + No - + Game Controller: %1 - + # of Axes: %1 - + # of Buttons: %1 - + # of Hats: %1 - + Attempting to use fallback option %1 for event generation. - + Failed to open event generator. Exiting. - + Using %1 as the event generator. - + Could not raise process priority. - + Last button - + There isn't a last button pressed from gamepad in data. Did you set at least one button from gamepad for keyboard? - + Active window changed to: Title = "%1", Class = "%2", Program = "%3" or "%4". - + Profile location %1 is not an XML file. - + Profile location %1 does not exist. - - - + + + Controller identifier is not a valid value. - + An invalid set number '%1' was specified. - + Controller identifier '%s'' is not a valid value. - + No set number was specified. - + No controller was specified. - + No display string was specified. - + An invalid event generator was specified. - + No event generator string was specified. - + No log file specified. - + Logging started - + Auto-switching to profile "%1". - + Auto-switching to nullptr profile! - + xinput version must be at least 2.0. No mouse acceleration changes will occur. @@ -4765,18 +4790,18 @@ of your screen. QuickSetDialog - + Quick Set - + <html><head/><body><p>Please press a button or move an axis on %1 (<span style=" font-weight:600;">%2</span>).<br/>A dialog window will then appear which will<br/>allow you to make an assignment.</p></body></html> - - + + Quick Set %1 @@ -4784,12 +4809,12 @@ of your screen. SetAxisThrottleDialog - + Throttle Change - + The throttle setting for Axis %1 has been changed. Would you like to distribute this throttle change to all sets? @@ -4799,12 +4824,12 @@ Would you like to distribute this throttle change to all sets? SetJoystick - + Set %1: %2 - + Set %1 @@ -4812,52 +4837,52 @@ Would you like to distribute this throttle change to all sets? SetNamesDialog - + Set Name Settings - + Set 1 - + Set 2 - + Set 3 - + Set 4 - + Set 5 - + Set 6 - + Set 7 - + Set 8 - + Name @@ -4865,7 +4890,7 @@ Would you like to distribute this throttle change to all sets? SimpleKeyGrabberButton - + Mouse @@ -4873,7 +4898,7 @@ Would you like to distribute this throttle change to all sets? SpringModeRegionPreview - + Spring Mode Preview @@ -4881,20 +4906,20 @@ Would you like to distribute this throttle change to all sets? UInputEventHandler - + Could not find a valid uinput device file. Please check that you have the uinput module loaded. lsmod | grep uinput - + Could not open uinput device file Please check that you have permission to write to the device - + Using uinput device file %1 @@ -4902,551 +4927,551 @@ Please check that you have permission to write to the device UInputHelper - + a - + b - + c - + d - + e - + f - + g - + h - + i - + j - + k - + l - + m - + n - + o - + p - + q - + r - + s - + t - + u - + v - + w - + x - + y - + z - + Esc - + F1 - + F2 - + F3 - + F4 - + F5 - + F6 - + F7 - + F8 - + F9 - + F10 - + F11 - + F12 - + ` - + 1 - + 2 - + 3 - + 4 - + 5 - + 6 - + 7 - + 8 - + 9 - + 0 - - + + - - + = - + BackSpace - + Tab - + [ - + ] - + \ - + CapsLock - + ; - + ' - + Enter - + Shift_L - + , - - + + . - - + + / - + Ctrl_L - - + + Super_L - + Alt_L - + Space - + Alt_R - + Menu - + Ctrl_R - + Shift_R - + Up - + Left - + Down - + Right - + PrtSc - + Ins - + Del - + Home - + End - + PgUp - + PgDn - + NumLock - + * - + + - + KP_Enter - + KP_1 - + KP_2 - + KP_3 - + KP_4 - + KP_5 - + KP_6 - + KP_7 - + KP_8 - + KP_9 - + KP_0 - + SCLK - + Pause - + Super_R - + Mute - + VolDn - + VolUp - + Play - + Stop - + Prev - + Next - + [NO KEY] @@ -5454,54 +5479,54 @@ Please check that you have permission to write to the device UnixWindowInfoDialog - + Captured Window Properties - + Information About Window - + Class: - - - + + + TextLabel - + Title: - + Path: - + Match By Properties - + Class - + Title - + Path @@ -5509,9 +5534,9 @@ Please check that you have permission to write to the device VDPad - - - + + + VDPad @@ -5519,263 +5544,263 @@ Please check that you have permission to write to the device VirtualKeyPushButton - + Space - + Tab - + Shift (L) - + Shift (R) - + Ctrl (L) - + Ctrl (R) - + Alt (L) - - + + Alt (R) - + Alt Gr - + ` - + ~ - - + + - - + = - + [ - + ] - + \ - + Caps - + ; - + ' - + , - - + + . - - + + / - + ESC - + PRTSC - + SCLK - + INS - + PGUP - + DEL - + PGDN - + 1 - + 2 - + 3 - + 4 - + 5 - + 6 - + 7 - + 8 - + 9 - + 0 - + NUM LK - - + + * - + + - + Enter - + < - + : - + Super (L) - + Menu - + Up - + Down - + Left - + Right @@ -5783,226 +5808,226 @@ LK VirtualKeyboardMouseWidget - - + + Keyboard - - + + Mouse - + Mouse Settings - + Left Mouse - + Up Mouse - + Left Button Mouse - + Middle Button Mouse - + Right Button Mouse - + Wheel Up Mouse - + Wheel Left Mouse - + Wheel Right Mouse - + Wheel Down Mouse - + Down Mouse - + Right Mouse - + Button 4 Mouse - + Mouse 8 Mouse - + Button 5 Mouse - + Mouse 9 Mouse - + NONE - - + + Last button - - + + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + Others - + Applications - + Browser Back - + Browser Favorites - + Browser Forward - + Browser Home - + Browser Refresh - + Browser Search - + Browser Stop - + Calc - + Email - + Media - + Media Next - + Media Play - + Media Previous - + Media Stop - + Search - + Volume Down - + Volume Mute - + Volume Up @@ -6010,7 +6035,7 @@ LK VirtualMousePushButton - + INVALID @@ -6018,28 +6043,28 @@ LK WinAppProfileTimerDialog - - + + Capture Application - + After pressing the "Capture Application" button, please select the application window that you want to have a profile associated with. The active application will be captured after the selected number of seconds. - + Timer: - + Seconds - + Cancel @@ -6047,12 +6072,12 @@ LK WinExtras - + [NO KEY] - + AntiMicro Profile @@ -6060,67 +6085,62 @@ LK X11Extras - + ESC - + Tab - + Space - + DEL - + Return - + KP_Enter - + Backspace - + Alt Gr - + xinput extension was not found. No mouse acceleration changes will occur. - + xinput version must be at least 2.0. No mouse acceleration changes will occur. - - Virtual pointer found with id=%1. - - - - + PtrFeedbackClass was not found for virtual pointer.No change to mouse acceleration will occur for device with id=%1 - + Changing mouse acceleration for device with id=%1 @@ -6128,7 +6148,7 @@ LK XMLConfigReader - + Could not write updated profile XML to file %1. @@ -6136,7 +6156,7 @@ LK XMLConfigWriter - + Could not write to profile at %1. @@ -6144,7 +6164,7 @@ LK antimicro - + Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support. @@ -6152,97 +6172,97 @@ LK main - + Launch program in system tray only. - + Launch program with the tray menu disabled - + Launch program without the main window displayed - + Launch program with the configuration file selected as the default for selected controllers. Defaults to all controllers - + location - + Apply configuration file to a specific controller. Value can be a controller index, name, or GUID - + value - + Unload currently enabled profile(s) - + value(s) - + Start joysticks on a specific set. Value can be a controller index, name, or GUID - + number value - + Launch program as a daemon. Use only on Linux. - + Enable logging - + log-type - + Choose a file for logs writing - + filename - + Choose between using XTest support and uinput support for event generation. Use only if you have enabled xtest and uinput options on Linux or vmulti on Windows. Default: xtest. - + event-generation-type - + Print information about joysticks detected by SDL. Use only if you have sdl library. You can check your controller index, name or even GUID. diff --git a/share/antimicro/translations/antimicro_br.ts b/share/antimicro/translations/antimicro_br.ts old mode 100644 new mode 100755 index ccda5464e..d3298cf29 --- a/share/antimicro/translations/antimicro_br.ts +++ b/share/antimicro/translations/antimicro_br.ts @@ -4,17 +4,17 @@ AboutDialog - + About Sobre - + Version Versão - + "juliagoda" (since March, 2018) Wanting only to play my favourite old games that din't support gamepads, I found this project (which map keyboard keys and mouse buttons to connected gamepads on Linux) as most proper and recent. But because of poor choices of such application on the internet and since it didn't compile properly, I decided to rescue the project. However, once I finished my work (enough to enjoy playing games) I thought about sharing this code with others. Of course all informations about past programmers will be held. "Ryochan7" (since December 30, 2012 until 2017), I have been working on antimicro in my spare time. What originally started as a fork of QJoyPad and a way to learn proper event-driven programming has turned into something much bigger than I originally intended. Although I have spent a lot of time learning new techniques, finding out more about the domain of KB+M emulation, and spending Friday nights bashing my head against my keyboard, it has been a fun and enriching experience overall. @@ -32,17 +32,17 @@ As of May 24, 2016, this project has moved to https://github.com/AntiMicro/antim - + Copyright: 2013 - 2018 - + Info - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -86,7 +86,7 @@ p, li { white-space: pre-wrap; } - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -204,57 +204,57 @@ p, li { white-space: pre-wrap; } - + Changelog - + Credits Créditos - + antimicro - + About Development - + License Licença - + Program Version %1 - + Program Compiled on %1 at %2 - + Built Against SDL %1 - + Running With SDL %1 - + Using Qt %1 - + Using Event Handler: %1 @@ -262,151 +262,156 @@ p, li { white-space: pre-wrap; } AddEditAutoProfileDialog - + Auto Profile Dialog - + Profile: - - + + Browse - + Window: - - + + Select Window. Click on the appropriate application window and the application file path will be populated in the form. - + Detect Window Properties - + Class: - + Title: - + + set partial title + + + + Application: - + Select - - Devices: + + De&vices: - - + + Select this profile to be the default loaded for the specified device. The selection will be used instead of the all default profile option. - + Set as Default for Controller - - + + A different profile is already selected as the default for this device. - + Current (%1) - + Open Config Abrir Configuração - - + + Select Program - + Programs (*.exe) - + Please use the main default profile selection. - + Please select a window by using the mouse. Press Escape if you want to cancel. - + Capture Application Window - + Could not obtain information for the selected window. - + Application Capture Failed - + Profile file path is invalid. - + No window matching property was specified. - + Program path is invalid or not executable. - + File is not an .exe file. - + No window matching property was selected. @@ -414,502 +419,502 @@ of the all default profile option. AdvanceButtonDialog - - + + Advanced Avançado - + Assignments Atribuições - + Toggle Alternar - + Turbo Turbo - + Set Selector Definir Seletor - + Blank or KB/M - + Hold Segurar - + Pause Pausar - + Cycle Ciclo - + Distance Distância - + Insert Inserir - + Delete Deletar - + Clear All Limpar tudo - + Time: Tempo: - + 0.01s - + 0s - + Insert a pause that occurs in between key presses. Inserir uma pausa que ocorre entre teclas pressionadas. - + Release Liberar - - + + Insert a new blank slot. Inserir um novo slot vazio. - + Delete a slot. Deletar um slot. - + Clear all currently assigned slots. Limpar todos os slots atribuido atualmente. - + Specify the duration of an inserted Pause or Hold slot. Especificar a duração de uma pausa inserida ou manter o slot. - + 0m 0m - + &Mouse Speed Mod: - - + + Specify the range past an axis dead zone in which a sequence of actions will execute. Especifique o intervalo passado em uma zona morta, no eixo em que uma seqüência de ações será executado. - + Distance: Distância: - - + + % - + Mouse Mod - + Press Time - + Delay - + Execute - + Load Carregar - + Set Change - + Text Entry - + Placeholder Espaço Reservado - - + + 0 0 - + Set the percentage that mouse speeds will be modified by. - + Auto Reset Cycle After - + seconds - + Executable: - + ... - + Arguments: - - - + + + Enabled Habilitar - + Mode: - + <html><head/><body><p>Normal: Repeatedly press and release a button by the chosen rate.</p><p>Gradient: Modify the button press and button release delay based on how far an axis has been moved. The rate will remain the same.</p><p>Pulse: Modify how many times a button is pressed and released per second. The button delay will remain the same.</p></body></html> - + Normal Normal - + Gradient - + Pulse - + Delay: Atrasar: - + 0.10s - + Rate: Taxa: - + 10.0/s - - + + Disabled Inválido - + Select Set 1 One Way Selecionar e definir uma maneira - + Select Set 1 Two Way Selecionar e definir duas maneiras - + Select Set 1 While Held Selecionar e Definir um Enquanto Realiza - + Select Set 2 One Way Selecionar e definir 2 uma maneira - + Select Set 2 Two Way Selecionar e definir 2 duas maneiras - + Select Set 2 While Held Selecionar e Definir 2 Enquanto Realiza - + Select Set 3 One Way Selecionar e definir 3 uma maneira - + Select Set 3 Two Way Selecionar e definir 3 duas maneiras - + Select Set 3 While Held Selecionar e definir 3 Enquanto Realiza - + Select Set 4 One Way Selecionar e definir 4 uma maneira - + Select Set 4 Two Way Selecionar e definir 4 duas maneiras - + Select Set 4 While Held Selecionar e definir 4 enquanto realiza - + Select Set 5 One Way Selecionar e definir 5 uma maneiras - + Select Set 5 Two Way Selecionar e definir 5 duas maneiras - + Select Set 5 While Held Selecionar e definir 5 enquanto realiza - + Select Set 6 One Way Selecionar e definir 6 uma maneiras - + Select Set 6 Two Way Selecionar e definir 6 duas maneiras - + Select Set 6 While Held Selecionar e definir 6 enquanto realiza - + Select Set 7 One Way Selecionar e definir 7 uma maneiras - + Select Set 7 Two Way Selecionar e definir 7 duas maneiras - + Select Set 7 While Held Selecionar e definir 7 enquanto realiza - + Select Set 8 One Way Selecionar e definir 8 uma maneiras - + Select Set 8 Two Way Selecionar e definir 8 duas maneiras - + Select Set 8 While Held Selecionar e definir 8 enquanto realiza - + sec. - + /sec. - + Set %1 - - + + Select Set %1 - + One Way - + Two Way - + While Held - + Choose Executable - + Slots past a Cycle action will be executed on the next button press. Multiple cycles can be added in order to create partitions in a sequence. - + Delays the time that the next slot is activated by the time specified. Slots activated before the delay will remain active after the delay time has passed. - + Distance action specifies that the slots afterwards will only be executed when an axis is moved a certain range past the designated dead zone. - + Insert a hold action. Slots after the action will only be executed if the button is held past the interval specified. - + Chose a profile to load when this slot is activated. - + Mouse mod action will modify all mouse speed settings by a specified percentage while the action is being processed. This can be useful for slowing down the mouse while sniping. - + Specify the time that keys past this slot should be held down. - + Insert a release action. Slots after the action will only be executed after a button release if the button was held past the interval specified. - + Change to selected set once slot is activated. - + Full string will be typed when a slot is activated. - + Execute program when slot is activated. - - + + Choose Profile - + Config Files (*.amgp *.xml) @@ -917,157 +922,157 @@ of the all default profile option. AdvanceStickAssignmentDialog - + Stick/Pad Assignment Atribuir Stick/Pad - + Sticks Analógicos - + DPads Direcionais - - + + %1 (Joystick %2) - + Stick 1 Analógico 1 - - - + + + Enabled Habilitado - - - - - - + + + + + + Assign - - + + X Axis: Eixo X: - - + + Y Axis: Aixo Y: - + Stick 2 Analógico 2 - + Number of Physical DPads: %1 Número de Dpads físico:%1 - + Virtual DPad 1 DPad 1 Virtual - + Up: Cima: - + Down: Baixo: - + Note: This window is meant for backwards compatibility with profiles made before antimicro 2.0. Since version 2.0, use of the Game Controller Mapping window is preferred. - + Left: Esquerda: - + Right: Direita: - - - - + + + + Axis %1 Eixo %1 - - - - + + + + Axis %1 - Eixo %1- - - - - + + + + Axis %1 + Eixo %1+ - - - - + + + + Button %1 Botão %1 - + Move stick 1 along the X axis - + Move stick 1 along the Y axis - + Move stick 2 along the X axis - + Move stick 2 along the Y axis - - - - + + + + Press a button or move an axis @@ -1075,180 +1080,180 @@ of the all default profile option. AxisEditDialog - + Axis Eixo - - + + Mouse (Horizontal) Mouse (Horizontal) - - + + Mouse (Inverted Horizontal) Mouse (Horizontal Invertido) - - + + Mouse (Vertical) Mouse (Vertical) - - + + Mouse (Inverted Vertical) Mouse (Vertical Invertido) - - + + Arrows: Up | Down Setas: Cima | Baixo - - + + Arrows: Left | Right Setas: Esquerda | Direita - - + + Keys: W | S Teclas: W | S - - + + Keys: A | D Teclas: A | D - - + + NumPad: KP_8 | KP_2 Pad Numérico: KP_8 | KP_2 - - + + NumPad: KP_4 | KP_6 Pad Numérico: KP_4 | KP_6 - - - + + + None Nada - - + + Set the value to use as the limit for an axis. Useful for a worn out analog stick. - + Negative Half Throttle - + Positive Half Throttle - + Name: - + Specify the name of an axis. - + Mouse Settings Configurações do Mouse - - + + Set the value of the dead zone for an axis. Defina o valor da zona morta para um eixo. - + Presets: Predefinido: - + Dead Zone: Zona Morta: - + Max Zone: Zona Máxima: - - + + [NO KEY] [SEM TECLA] - + Throttle setting that determines the behavior of how to interpret an axis hold or release. Posição do acelerador, que determina o comportamento de como interpretar um eixo ou liberação. - + Negative Throttle Acelerador Negativo - + Normal Normal - + Positive Throttle Aceleração Positiva - + Current Value: Valor Atual: - + Set Definir - + Set %1 - + Left Mouse Button - + Right Mouse Button @@ -1256,37 +1261,37 @@ interpretar um eixo ou liberação. ButtonEditDialog - + Dialog Diálogo - + To make a new assignment, press any keyboard key or click a button in the Keyboard or Mouse tab Para fazer uma nova atribuição, pressionar qualquer tecla do teclado ou clicar em um botão na guia do teclado ou mouse - + Placeholder Espaço Reservado - + Toggle Alternar - + Enables a key press or release to only occur when a controller button is pressed. Permite um pressionamento ou a liberação para ocorrer apenas quando um botão é pressionado no controlador. - + Enables rapid key presses and releases. Turbo controller. Permite o rápido pressionamento de teclas e lançamentos. Turbo controlador. - + Turbo Turbo @@ -1295,38 +1300,38 @@ interpretar um eixo ou liberação. Atual: - + Last keyboard/mouse button: - + Slots Slot - + Na&me: - + Specify the name of a button. - + Action: - + Specify the action that will be performed in game while this button is being used. - + Advanced Avançado @@ -1335,52 +1340,52 @@ this button is being used. Definir - - - + + + Choose your keyboard key - + No button - - - - + + + + Last button - + To change settings for last button, it must be at least one assignment from keyboard to gamepad - + To change settings of turbo for last button, it must be at least one assignment from keyboard to gamepad - + To open advanced dialog, it's needed to map at least one button from keyboard to gamepad - + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + As last gamepad button has been set - + Index %1 @@ -1388,190 +1393,190 @@ this button is being used. Calibration - + Form - - + + Start calibration - + Controller: - + Sticks: - - Use settings from jstest-gtk - - - - + Reset settings - + Cancel - - + + Save Salvar - - + + Calibration - - Do you really want to reset settings of current axes? + + Do you really want to reset settings of current axis? - + Calibration was saved for the preset. Do you really want to reset settings? - + Place the joystick in the center position. It's the part, where often you don't have to move. Just skip it in such situation. - + Calibrating center - + Start second step - + Center X: %1 - + Center Y: %1 - + Place the joystick in the top-left corner many times - - + + Calibrating position - - + + X: %1 - - + + Y: %1 - + Place the joystick in the bottom-right corner - + Start final step - + range X: %1 - %2 - + range Y: %1 - %2 - + deadzone X: %1 - + deadzone Y: %1 - + ---Calibration done!--- - + Calibration values have been saved - - + + Dead zone calibration - - You must move X axis to the right at least five times! Keep moving! + + You have to move axes to the top-left corner at least five times. + + + + + You have to move axes to the bottom-right corner at least five times. - - You must move X axis to the left at least five times! Keep moving! + + Do you want to save calibration of current axis? - - - - + + + + Axis %1 Eixo %1 @@ -1579,64 +1584,64 @@ deadzone Y: %1 CapturedWindowInfoDialog - + Captured Window Properties - + Information About Window - + Class: - - - + + + TextLabel - + Title: - + Path: - + Match By Properties - + Class - + Title - + Path - + Full Path - + File Name @@ -1675,67 +1680,67 @@ deadzone Y: %1 DPadContextMenu - + Mouse (Normal) Mouse (Normal) - + Mouse (Inverted Horizontal) Mouse (Horizontal Invertido) - + Mouse (Inverted Vertical) - + Mouse (Inverted Horizontal + Vertical) Mouse (Horizontal + Vertical Invertido) - + Arrows Setas - + Keys: W | A | S | D Teclas: W | A | S | D - + NumPad Pad Numérico - + None Nada - + Standard Padrão - + Eight Way Oito Maneiras - + 4 Way Cardinal - + 4 Way Diagonal - + Mouse Settings @@ -1743,108 +1748,108 @@ deadzone Y: %1 DPadEditDialog - + Dialog Diálogo - + Presets: Predefinido: - + Mouse (Normal) Mouse (Normal) - + Mouse (Inverted Horizontal) Mouse (Horizontal Invertido) - + Mouse (Inverted Vertical) Mouse (Vertical Invertido) - + Mouse (Inverted Horizontal + Vertical) Mouse (Horizontal + Vertical Invertido) - + Arrows Setas - + Keys: W | A | S | D Teclas: W | A | S | D - + NumPad Pad Numérico - + None Nada - + Dpad Mode: Modo Pad: - + &Name: - + 4 Way Cardinal - + 4 Way Diagonal - + DPad Delay: - - + + Time lapsed before a direction change is taken into effect. - + s - + Specify the name of a dpad. - + Mouse Settings Configuração do Mouse - + Standard Padrão - + Standard: 8 region dpad with two direction buttons active when the dpad is in a diagonal region. @@ -1860,17 +1865,17 @@ to a diagonal zone. - + Eight Way Oito Maneiras - + Set Definir - + Set %1 @@ -1878,27 +1883,27 @@ to a diagonal zone. EditAllDefaultAutoProfileDialog - + Default Profile - + Profile: - + Browse - + Open Config Abrir Configuração - + Profile file path is invalid. @@ -1906,29 +1911,29 @@ to a diagonal zone. ExtraProfileSettingsDialog - + Extra Profile Settings - + Key Press Time: - + 0.00 ms - + Profile Name: - - - + + + s s @@ -1936,7 +1941,7 @@ to a diagonal zone. GameController - + Game Controller @@ -1944,9 +1949,9 @@ to a diagonal zone. GameControllerDPad - - - + + + DPad Direcional @@ -1954,187 +1959,187 @@ to a diagonal zone. GameControllerMappingDialog - + Game Controller Mapping - + <html><head/><body><p>antimicro makes use of the <a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;">Game Controller API</span></a> provided by SDL 2 in order to abstract various gamepads to fit a unified standard. In order to make a button assignment, please highlight the mapping cell for the appropriate button row below. You can then press a button or move an axis on your gamepad and the cell will update with the physical button or axis that will be used.</p><p>antimicro will use the mapping that you specify to save a mapping string that will be loaded into SDL.</p></body></html> - + A - + B - + X - + Y - + Back - + Start - + Guide - + Left Shoulder - + Right Shoulder - + Left Stick Click - + Right Stick Click - + Left Stick X - + Left Stick Y - + Right Stick X - + Right Stick Y - + Left Trigger - + Right Trigger - + DPad Up - + DPad Left - + DPad Down - + DPad Right - + Mapping - + SDL 2 Game Controller Mapping String - + Last Axis Event: - + Current Axis Detection Dead Zone: - + 5000 5000 - + 10000 10000 - + 15000 15000 - + 20000 20000 - + 25000 25000 - + 30000 30000 - + 32000 32000 - + Game Controller Mapping (%1) (#%2) - + Discard Controller Mapping? - + Discard mapping for this controller? If discarded, the controller will be reverted to a joystick once you refresh all joysticks. @@ -2144,47 +2149,47 @@ If discarded, the controller will be reverted to a joystick once you refresh all GameControllerSet - + Back - + Guide - + Start - + LS Click - + RS Click - + L Shoulder - + R Shoulder - + L Trigger - + R Trigger @@ -2192,9 +2197,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all GameControllerTrigger - - - + + + Trigger @@ -2202,9 +2207,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxis - - - + + + Axis Eixo @@ -2212,24 +2217,24 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxisButton - + Negative Negativo - + Positive Positivo - + Unknown Desconhecido - - - + + + Button Botão @@ -2237,74 +2242,74 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxisContextMenu - + Mouse (Horizontal) Mouse (Horizontal) - + Mouse (Inverted Horizontal) Mouse (Horizontal Invertido) - + Mouse (Vertical) Mouse (Vertical) - + Mouse (Inverted Vertical) - + Arrows: Up | Down Setas: Cima | Baixo - + Arrows: Left | Right Setas: Esquerda | Direita - + Keys: W | S Teclas: W | S - + Keys: A | D Teclas: A | D - + NumPad: KP_8 | KP_2 Pad Numérico: KP_8 | KP_2 - + NumPad: KP_4 | KP_6 Pad Numérico: KP_4 | KP_6 - - + + None Nada - - + + Mouse Settings - + Left Mouse Button - + Right Mouse Button @@ -2312,57 +2317,57 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButton - + Processing turbo for #%1 - %2 - + Finishing turbo for button #%1 - %2 - + Processing press for button #%1 - %2 - + Processing release for button #%1 - %2 - + Distance change for button #%1 - %2 - - - + + + Button Botão - - - - + + + + [NO KEY] [SEM TECLA] - + [Set %1 1W] - + [Set %1 2W] - + [Set %1 WH] @@ -2370,47 +2375,47 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButtonContextMenu - + Toggle Alternar - + Turbo Turbo - + Clear - + Set Select - + Disabled Inválido - + Set %1 - + Set %1 1W - + Set %1 2W - + Set %1 WH @@ -2418,118 +2423,118 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButtonSlot - - + + Mouse Mover - + Up Cima - + Down Baixo - + Left Esquerda - + Right Direita - + LB LB - + MB MB - + RB RB - + B4 - + B5 - + Pause Pausar - + Hold Segurar - + Cycle Ciclo - + Distance Distância - + Release Soltar - + Mouse Mod - + Press Time - + Delay - + Load %1 - + Set Change %1 - + [Text] %1 - + [Exec] %1 - + [NO KEY] [SEM TECLA] @@ -2537,9 +2542,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStick - - - + + + Stick Analógico @@ -2547,37 +2552,37 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickButton - - - + + + Up Cima - - - + + + Down Baixo - - - + + + Left Esquerda - - - + + + Right Direita - - - + + + Button Botão @@ -2585,67 +2590,67 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickContextMenu - + Mouse (Normal) Mouse (Normal) - + Mouse (Inverted Horizontal) Mouse (Horizontal Invertido) - + Mouse (Inverted Vertical) - + Mouse (Inverted Horizontal + Vertical) Mouse (Horizontal + Vertical Invertido) - + Arrows Setas - + Keys: W | A | S | D Teclas: W | A | S | D - + NumPad Pad Numérico - + None Nada - + Standard Padrão - + Eight Way Oito Maneiras - + 4 Way Cardinal - + 4 Way Diagonal - + Mouse Settings @@ -2653,86 +2658,86 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickEditDialog - + Dialog Diálogo - + X: X: - - - - - + + + + + 0 0 - + Y: Y: - + Distance: Distância: - + Presets: Predefinido: - + Mouse (Normal) Mouse (Normal) - + Mouse (Inverted Horizontal) Mouse (Horizontal Invertido) - + Mouse (Inverted Vertical) Mouse (Vertical invertido) - + Mouse (Inverted Horizontal + Vertical) Mouse (Horizontal + Vertical Invertido) - + Arrows Setas - + Keys: W | A | S | D Teclas: W | A | S | D - + NumPad Pad Numérico - + None Nada - + Stick Mode: Modo Analógico: - + Standard: 8 region stick with two direction buttons active when the stick is in a diagonal region. @@ -2748,72 +2753,72 @@ to a diagonal zone of the stick. - + 4 Way Cardinal - + 4 Way Diagonal - - + + Dead zone value to use for an analog stick. - - + + Value when an analog stick is considered moved 100%. - - + + The area (in degrees) that each diagonal region occupies. - + Square Stick: - - + + Percentage to modify a square stick coordinates to confine values to a circle - + % - + Stick Delay: - - + + Time lapsed before a direction change is taken into effect. - + s - + Modifier: - + Edit button that is active while the stick is active. This button is useful for assigning zones with @@ -2822,68 +2827,68 @@ functionality to an analog stick. - + PushButton - + Na&me: Name: - + Specify the name of an analog stick. - + Mouse Settings Configurações do Mouse - + Standard Padrão - + Bearing: - + % Safe Zone: - + Eight Way Oito Maneiras - + Dead Zone: Zona da Morte: - + Max Zone: Zona Máxima: - + Diagonal Range: Alcance Diagonal: - + Set Definir - + Set %1 @@ -2891,9 +2896,9 @@ functionality to an analog stick. JoyControlStickModifierButton - - - + + + Modifier @@ -2901,9 +2906,9 @@ functionality to an analog stick. JoyDPad - - - + + + DPad Direcional @@ -2911,37 +2916,37 @@ functionality to an analog stick. JoyDPadButton - - - + + + Up Cima - - - + + + Down Baixo - - - + + + Left Esquerda - - - + + + Right Direita - - - + + + Button Botão @@ -2949,266 +2954,271 @@ functionality to an analog stick. JoyTabWidget - - - - - - + + + + + + <New> Novo - - + + Remove - - + + Remove configuration from recent list. - - + + Load Carregar - - + + Load configuration file. - - + + Save Salvar - - + + Save changes to configuration file. - - + + Save As Salvar Como - - + + Save changes to a new configuration file. - - + + Sets - + Copy from Set - + Settings - - + + Set 1 - - + + Set 2 - - + + Set 3 - - + + Set 4 - - + + Set 5 - - + + Set 6 - - + + Set 7 - - + + Set 8 - - + + Stick/Pad Assign Atribuir Analógico/Direcional - - + + Controller Mapping - - + + Quick Set Definir Rápido - - + + Names - - + + Toggle button name displaying. - - + + Pref - - + + Change global profile settings. - - - + + + Reset Resetar - - + + Revert changes to the configuration. Reload configuration file. - + Open Config Abrir Configuração - + Config Files (*.amgp *.xml) - - - + + + Config File (*.%1.amgp) - - + + Do you really want to reset buttons settings for joystick? + + + + + Save Profile Changes? - - + + Changes to the new profile have not been saved. Would you like to save or discard the current profile? - - + + Changes to the profile "%1" have not been saved. Would you like to save or discard changes to the current profile? - + Sticks Analógicos - - + + DPads Direcionais - + No buttons have been assigned. Please use Quick Set to assign keys to buttons or disable hiding empty buttons. - - + + Set %1: %2 - - + + Set %1 - + Copy Set Assignments - + Are you sure you want to copy the assignments and device properties from %1? - - - + + + Save Config Salvar Configuração - - + + Set Definir @@ -3216,7 +3226,7 @@ to buttons or disable hiding empty buttons. Joystick - + Joystick Analógico @@ -3224,98 +3234,98 @@ to buttons or disable hiding empty buttons. JoystickStatusWindow - + Properties - + Details - + Name: - - - - - - - + + + + + + + %1 - + Number: - + Axes: - + Buttons: - + Hats: - + GUID: - + Game Controller: - + Axes - + Buttons - + Hats - + %1 (#%2) Properties - + Axis %1 Eixo %1 - + Hat %1 - + No - + Yes @@ -3323,62 +3333,67 @@ to buttons or disable hiding empty buttons. MainSettingsDialog - + Edit Settings - + General - + Controller Mappings - + Language - + Auto Profile - + Mouse - + Advanced Avançado - + + Profile Direc&tory: + + + + <html><head/><body><p>Specify the default directory that the program should use in file dialogs when loading a profile or saving a new profile.</p></body></html> - + Recent Profile Count: - + <html><head/><body><p>Number of profiles that can be placed in recent profile list. 0 will result in the program not enforcing a limit on the number of profiles displayed.</p></body></html> - + Gamepad Poll Rate: - + Change the poll rate that the program uses to discover new events from gamepads. Defaults to 10 ms. @@ -3388,52 +3403,52 @@ before using antimicro unattended. - + Hide main window when the main window close button is clicked instead of quitting the program. - + Close To Tray - + Have Windows start antimicro at system startup. - + Launch At Windows Startup - + Display recent profiles for all controllers as a single list in the tray menu. Defaults to using sub-menus. - + Single Profile List in Tray - + Have the program minimize to the taskbar. By default, the program minimizes to the system tray if available. - + Minimize to Taskbar - + This option will cause the program to hide all buttons that have no slots assigned to them. The Quick Set dialog window will have to be used @@ -3441,184 +3456,194 @@ to bring up the edit dialog for gamepad buttons. - + Hide Empty Buttons - + When the program is launched, open the last known profile that was opened during the previous session. - + Auto Load Last Opened Profile - + Only show the system tray icon when the program first launches. - + Launch in Tray - + Associate .amgp files with antimicro in Windows Explorer. - + Associate Profiles - + Key Repeat - + Active keys will be repeatedly pressed when this option is enabled. - - + + Enable - + Specifies how much time should elapse before key repeating begins. - + Specifies how many times key presses will be performed per seconds. - + <html><head/><body><p>antimicro has been translated into many different languages by contributors. By default, the program will choose an appropriate translation based on your system's locale setting. However, you can make antimicro load a different translation depending on the language that you choose from the list below.</p></body></html> - + Português do Brasil - + Français - + Deutsch - + Italiano - + 日本語 - + Русский - + српски / srpski - + 简体中文 - + Español - + українська - + Polski - + + History Si&ze: + + + + Log File: - + Log Level: - + None Nada - + Error - + Warning - + Info - + Debug - + + Reset + Resetar + + + Class - + Title - + Program - + Disable the "Enhanced Pointer Precision" Windows setting while antimicro is running. Disabling "Enhanced Pointer Precision" will allow mouse movement within antimicro to be more @@ -3626,32 +3651,27 @@ precise. - + Disable Enhance Pointer Precision - + Smoothing - - Histor&y Size: - - - - + Weight &Modifier: - + Refresh Rate: - + The refresh rate is the amount of time that will elapse in between mouse events. Please be cautious when editing this setting as it will cause the program to use @@ -3661,46 +3681,46 @@ it unattended. - + Spring Pular - + Screen: - + Utilize the specified screen for spring mode. On Linux, the default is to use the primary screen. On Windows, the default is to use all available screens. - + Accel Numerator: - - - + + + 0 0 - + Accel Denominator: - + Accel Threshold: - + If the acceleration values for the virtual mouse have been changed by a different process, particularly when quitting an older game, then you might want to reset the acceleration @@ -3708,164 +3728,169 @@ values used by the virtual mouse. - + Reset Acceleration - + Delay: Atrasar: - - Profi&le Directory: - - - - + ms - + Rate: Taxa: - + times/s - + Below is a list of the custom mappings that have been saved. You can use the following table to delete mappings or have mappings temporarily disabled. You can also disable mappings that are included with SDL; just insert a new row with the appropriate joystick GUID and check disable. Settings will not take affect until you either refresh all joysticks or unplug that particular joystick. - + GUID - + Mapping String - + Disable? - - + + Delete Deletar - + Insert Inserir - - + + Default - + English - - + + Active - + Devices: - - + + All - + Device - + Profile - + Default? - + Add - + Edit - + Also, Windows users who want to use a low value should also check the "Disable Enhance Pointer Precision" checkbox if you haven't disabled the option in Windows. - + Select Default Profile Directory - + Are you sure you want to delete the profile? - + Save Log File As - + Log Files (*.log) + + + Do you really want to reset setting? + + + + + Would you like to reset mappings too? + + MainWindow - + No Joysticks have been found. Please plug in a joystick and then choose the "Update Joysticks" option in the main menu Nenhum joystick foi encontrados. Por favor, conecte um joystick e, em seguida, escolha a opção "Atualizar Joysticks" no menu principal - + If events are not seen by a game, please click here to run this application as Administrator. - + &App @@ -3874,110 +3899,110 @@ the option in Windows. Atribuir Analógico/Dpad - + &Options &Opções - + antimicro - + &Help &Ajuda - - + + &Quit &Sair - + Ctrl+Q Ctrl+Q - - + + &Update Joysticks &Atualizar joysticks - + Ctrl+U Ctrl+U - - + + &Hide &Esconder - + Ctrl+H Ctrl+H - + &About &Sobre - + Ctrl+A Ctrl+A - + About &Qt - + &Properties - + &Key Checker - + &GitHub Page - + &Game Controller Mapping - + S&ettings - + &Stick/Pad Assign - + &Wiki - + &Issues - + &Calibration @@ -3986,71 +4011,71 @@ the option in Windows. Sobre Qt - + Home Page - + Could not find a proper controller identifier. Exiting. - - - - - - - + + + + + + + (%1) - - + + Open File Abrir Arquivo - + &Restore &Restaurar - + Calibration couldn't be opened - + You must connect at least one controller to open the window - + Run as Administrator? - + Are you sure that you want to run this program as Adminstrator? Some games run as Administrator which will cause events generated by antimicro to not be used by those games unless antimicro is also run as the Adminstrator. This is due to permission problems caused by User Account Control (UAC) options in Windows Vista and later. - + Failed to elevate program - + Failed to restart this program as the Administrator - + Could not find controller. Exiting. @@ -4058,12 +4083,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseAxisSettingsDialog - + Mouse Settings - Configuração do Mouse - + Set %1 @@ -4071,12 +4096,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseButtonSettingsDialog - + Mouse Settings - Configuração do Mouse - + Set %1 @@ -4084,12 +4109,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseControlStickSettingsDialog - + Mouse Settings - + Set %1 @@ -4097,12 +4122,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseDPadSettingsDialog - + Mouse Settings - + Set %1 @@ -4110,17 +4135,17 @@ Some games run as Administrator which will cause events generated by antimicro t MouseSettingsDialog - + Mouse Settings Configuração do Mouse - + Mouse Mode: Modo do Mouse: - + Cursor mode is used to move the mouse cursor around the screen relative to its current position depending on how much you move an axis @@ -4134,79 +4159,79 @@ axis is moved back to the dead zone. - + Cursor Cursor - + Spring Pular - + Acceleration: Aceleração: - + Enhanced Precision - - + + Linear Linear - + Quadratic Quadrático - + Cubic Cúbico - + Quadratic Extreme Extremo Quadrático - + Power Function Função Pwer - + Easing Quadratic - + Easing Cubic - + Mouse Speed Settings Configuração da velocidade do Mouse - + Enable to change the horizontal and vertical speed boxes at the same time. - + Change Together Alterar Junto - + Options for adding more acceleration to the mouse movement beyond what the acceleration curve would produce. Acceleration is added based on how quickly an axis is @@ -4216,17 +4241,17 @@ using typical gamepad analog sticks. - + Delta Acceleration - + &Multiplier: - + Mi&n Threshold: @@ -4237,8 +4262,8 @@ Speed: Velocidade Horizontal: - - + + 1 = 20 pps 1 = 20 pps @@ -4248,30 +4273,30 @@ Speed: Velocidade Vertical: - + Wheel Hori. Speed: - + Set the speed used for horizontal mouse wheel movement according to number of simulated notches per second. - + Set the speed used for vertical mouse wheel movement according to number of simulated notches per second. - + Sensitivit&y: - + For Power Function acceleration curve. Specifies the factor to use for curve sensitivity. When the value is above 1.0, the mouse movement will be accelerated @@ -4279,122 +4304,122 @@ faster at the low end of an axis. - + Easing Duration: - - + + s - + Highest value to accelerate mouse movement by - + x x - + Start %: - + Acceleration begins at this percentage of the base multiplier - + Minimum amount of axis travel required for acceleration to begin - + Max Threshold: - + Maximum axis travel before acceleration has reached the multiplier value - + E&xtra Duration: - + Curve: - + Ease Out Sine - + Ease Out Quad - + Ease Out Cubic - + Release Radius: - + Specifies that the spring area will be relative to the mouse position set by a non-relative spring. - + Relative - + Mouse Status - + X: X: - - + + 0 (0 pps) - + Y: Y: - - + + 1 = 1 notch(es)/s - + Enhanced: Three tier curve that makes the mouse move slow on the low end of an axis and fast on the high end. @@ -4416,19 +4441,19 @@ a period of time using a Cubic curve. - + Hori&zontal Speed: - + &Vertical Speed: - + Wheel Vert. Speed: @@ -4438,59 +4463,59 @@ Speed: Sensibilidade: - + Specifies the amount of time (in seconds) that will be required before the mouse is fully accelerated after reaching the high end of an axis. - - - - + + + + % - + Extend the time that extra acceleration is applied. Axis travel will be taken into account. A slower flick will decrease the actual time that extra acceleration will be applied. - + Spring Settings Configuração do Pulo - + Spring Width: Pulo de Largura: - + Changes the width of the region that the cursor can move in spring mode. 0 will use the entire width of your screen. - + Spring Height: Pulo de Altura: - + Changes the height of the region that the cursor can move in spring mode. 0 will use the entire height of your screen. - - + + %n notch(es)/s @@ -4501,39 +4526,39 @@ of your screen. QKeyDisplayDialog - + Key Checker - - <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> + + <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="http://doc.qt.io/qt-5/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">http://doc.qt.io/qt-5/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> - + Event Handler: - + Native Key Value: - - - + + + 0x00000000 - + Qt Key Value: - + antimicro Key Value: @@ -4541,265 +4566,265 @@ of your screen. QObject - + Super - + Menu Menu - + Mute - + Vol+ - + Vol- - + Play/Pause - + Play - + Pause Pausar - + Prev - + Next Next - + Mail - + Home Home - + Media - + Search - + Daemon launched - + Failed to launch daemon - + Launching daemon - - + + Display string "%1" is not valid. - + Failed to set a signature id for the daemon - + Failed to change working directory to / - + Quitting Program - + # of joysticks found: %1 - + List Joysticks: - + --------------- - + Joystick %1: - + Index: %1 - + GUID: %1 - + Name: %1 - + Yes - + No - + Game Controller: %1 - + # of Axes: %1 - + # of Buttons: %1 - + # of Hats: %1 - + Attempting to use fallback option %1 for event generation. - + Failed to open event generator. Exiting. - + Using %1 as the event generator. - + Could not raise process priority. - + Last button - + There isn't a last button pressed from gamepad in data. Did you set at least one button from gamepad for keyboard? - + Active window changed to: Title = "%1", Class = "%2", Program = "%3" or "%4". - + Profile location %1 is not an XML file. A localização do perfil %1 não é um arquivo XML. - + Profile location %1 does not exist. A localização do perfil %1 não existe. - - - + + + Controller identifier is not a valid value. - + An invalid set number '%1' was specified. - + Controller identifier '%s'' is not a valid value. - + No set number was specified. - + No controller was specified. - + No display string was specified. - + An invalid event generator was specified. - + No event generator string was specified. - + No log file specified. @@ -4824,22 +4849,22 @@ of your screen. Lançar programa com o menu da bandeja desativado. - + Logging started - + Auto-switching to profile "%1". - + Auto-switching to nullptr profile! - + xinput version must be at least 2.0. No mouse acceleration changes will occur. @@ -4847,18 +4872,18 @@ of your screen. QuickSetDialog - + Quick Set Definir rápido - + <html><head/><body><p>Please press a button or move an axis on %1 (<span style=" font-weight:600;">%2</span>).<br/>A dialog window will then appear which will<br/>allow you to make an assignment.</p></body></html> - - + + Quick Set %1 @@ -4866,12 +4891,12 @@ of your screen. SetAxisThrottleDialog - + Throttle Change Suprimir Rápido - + The throttle setting for Axis %1 has been changed. Would you like to distribute this throttle change to all sets? @@ -4881,12 +4906,12 @@ Would you like to distribute this throttle change to all sets? SetJoystick - + Set %1: %2 - + Set %1 @@ -4894,52 +4919,52 @@ Would you like to distribute this throttle change to all sets? SetNamesDialog - + Set Name Settings - + Set 1 - + Set 2 - + Set 3 - + Set 4 - + Set 5 - + Set 6 - + Set 7 - + Set 8 - + Name @@ -4947,7 +4972,7 @@ Would you like to distribute this throttle change to all sets? SimpleKeyGrabberButton - + Mouse Mouse @@ -4955,7 +4980,7 @@ Would you like to distribute this throttle change to all sets? SpringModeRegionPreview - + Spring Mode Preview @@ -4963,20 +4988,20 @@ Would you like to distribute this throttle change to all sets? UInputEventHandler - + Could not find a valid uinput device file. Please check that you have the uinput module loaded. lsmod | grep uinput - + Could not open uinput device file Please check that you have permission to write to the device - + Using uinput device file %1 @@ -4984,551 +5009,551 @@ Please check that you have permission to write to the device UInputHelper - + a a - + b b - + c c - + d d - + e e - + f f - + g g - + h h - + i i - + j j - + k k - + l l - + m m - + n n - + o o - + p p - + q q - + r r - + s s - + t t - + u u - + v v - + w w - + x x - + y y - + z z - + Esc - + F1 F1 - + F2 F2 - + F3 F3 - + F4 F4 - + F5 F5 - + F6 F6 - + F7 F7 - + F8 F8 - + F9 F9 - + F10 F10 - + F11 F11 - + F12 F12 - + ` ` - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - - + + - - - + = = - + BackSpace BackSpace - + Tab Tab - + [ [ - + ] ] - + \ \ - + CapsLock - + ; ; - + ' ' - + Enter - + Shift_L Shift_L - + , , - - + + . . - - + + / / - + Ctrl_L - - + + Super_L Super_L - + Alt_L Alt_L - + Space Espaço - + Alt_R Alt_R - + Menu Menu - + Ctrl_R - + Shift_R Shift_R - + Up Cima - + Left Esquerda - + Down Baixo - + Right Direita - + PrtSc - + Ins - + Del - + Home Home - + End End - + PgUp - + PgDn - + NumLock - + * * - + + + - + KP_Enter KP_Enter - + KP_1 KP_1 - + KP_2 KP_2 - + KP_3 KP_3 - + KP_4 KP_4 - + KP_5 KP_5 - + KP_6 KP_6 - + KP_7 KP_7 - + KP_8 KP_8 - + KP_9 KP_9 - + KP_0 KP_0 - + SCLK SCLK - + Pause Pausar - + Super_R - + Mute - + VolDn - + VolUp - + Play - + Stop - + Prev - + Next Next - + [NO KEY] [SEM TECLA] @@ -5536,54 +5561,54 @@ Please check that you have permission to write to the device UnixWindowInfoDialog - + Captured Window Properties - + Information About Window - + Class: - - - + + + TextLabel - + Title: - + Path: - + Match By Properties - + Class - + Title - + Path @@ -5591,9 +5616,9 @@ Please check that you have permission to write to the device VDPad - - - + + + VDPad VDPad @@ -5601,223 +5626,223 @@ Please check that you have permission to write to the device VirtualKeyPushButton - + Space Espaço - + Tab Tab - + Shift (L) Shift (L) - + Shift (R) Shift (R) - + Ctrl (L) Ctrl (L) - + Ctrl (R) Ctrl (R) - + Alt (L) Alt (L) - - + + Alt (R) Alt (R) - + Alt Gr - + ` ` - + ~ ~ - - + + - - - + = = - + [ [ - + ] ] - + \ \ - + Caps Caps - + ; ; - + ' ' - + , , - - + + . . - - + + / / - + ESC ESC - + PRTSC PRTSC - + SCLK SCLK - + INS INS - + PGUP PGUP - + DEL DEL - + PGDN PGDN - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - + NUM LK NUM LK - - + + * * - + + + - + Enter @@ -5830,42 +5855,42 @@ R E N T E R - + < < - + : : - + Super (L) - + Menu Menu - + Up Cima - + Down Baixo - + Left Esquerda - + Right Direita @@ -5873,226 +5898,226 @@ R VirtualKeyboardMouseWidget - - + + Keyboard Teclado - - + + Mouse Mouse - + Mouse Settings Configurações do Mouse - + Left Mouse Esquerda - + Up Mouse Cima - + Left Button Mouse - + Middle Button Mouse - + Right Button Mouse - + Wheel Up Mouse Roda pra Cima - + Wheel Left Mouse Roda pra Esquerda - + Wheel Right Mouse Roda pra Direita - + Wheel Down Mouse Roda pra Baixo - + Down Mouse Baixo - + Right Mouse Direita - + Button 4 Mouse - + Mouse 8 Mouse - + Button 5 Mouse - + Mouse 9 Mouse - + NONE NADA - - + + Last button - - + + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + Others - + Applications - + Browser Back - + Browser Favorites - + Browser Forward - + Browser Home - + Browser Refresh - + Browser Search - + Browser Stop - + Calc - + Email - + Media - + Media Next - + Media Play - + Media Previous - + Media Stop - + Search - + Volume Down - + Volume Mute - + Volume Up @@ -6100,7 +6125,7 @@ R VirtualMousePushButton - + INVALID INVÁLIDO @@ -6108,28 +6133,28 @@ R WinAppProfileTimerDialog - - + + Capture Application - + After pressing the "Capture Application" button, please select the application window that you want to have a profile associated with. The active application will be captured after the selected number of seconds. - + Timer: - + Seconds - + Cancel @@ -6137,12 +6162,12 @@ R WinExtras - + [NO KEY] [SEM TECLA] - + AntiMicro Profile @@ -6150,67 +6175,62 @@ R X11Extras - + ESC ESC - + Tab Tab - + Space Espaço - + DEL DEL - + Return - + KP_Enter KP_Enter - + Backspace Retrocesso - + Alt Gr - + xinput extension was not found. No mouse acceleration changes will occur. - + xinput version must be at least 2.0. No mouse acceleration changes will occur. - - Virtual pointer found with id=%1. - - - - + PtrFeedbackClass was not found for virtual pointer.No change to mouse acceleration will occur for device with id=%1 - + Changing mouse acceleration for device with id=%1 @@ -6218,7 +6238,7 @@ R XMLConfigReader - + Could not write updated profile XML to file %1. @@ -6226,7 +6246,7 @@ R XMLConfigWriter - + Could not write to profile at %1. @@ -6234,7 +6254,7 @@ R antimicro - + Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support. @@ -6242,97 +6262,97 @@ R main - + Launch program in system tray only. Lançar programa na bandeja do sistema. - + Launch program with the tray menu disabled - + Launch program without the main window displayed - + Launch program with the configuration file selected as the default for selected controllers. Defaults to all controllers - + location - + Apply configuration file to a specific controller. Value can be a controller index, name, or GUID - + value - + Unload currently enabled profile(s) - + value(s) - + Start joysticks on a specific set. Value can be a controller index, name, or GUID - + number value - + Launch program as a daemon. Use only on Linux. - + Enable logging - + log-type - + Choose a file for logs writing - + filename - + Choose between using XTest support and uinput support for event generation. Use only if you have enabled xtest and uinput options on Linux or vmulti on Windows. Default: xtest. - + event-generation-type - + Print information about joysticks detected by SDL. Use only if you have sdl library. You can check your controller index, name or even GUID. diff --git a/share/antimicro/translations/antimicro_de.ts b/share/antimicro/translations/antimicro_de.ts old mode 100644 new mode 100755 index 68f617f60..4515ea6cd --- a/share/antimicro/translations/antimicro_de.ts +++ b/share/antimicro/translations/antimicro_de.ts @@ -4,17 +4,17 @@ AboutDialog - + About Über - + Version Version - + "juliagoda" (since March, 2018) Wanting only to play my favourite old games that din't support gamepads, I found this project (which map keyboard keys and mouse buttons to connected gamepads on Linux) as most proper and recent. But because of poor choices of such application on the internet and since it didn't compile properly, I decided to rescue the project. However, once I finished my work (enough to enjoy playing games) I thought about sharing this code with others. Of course all informations about past programmers will be held. "Ryochan7" (since December 30, 2012 until 2017), I have been working on antimicro in my spare time. What originally started as a fork of QJoyPad and a way to learn proper event-driven programming has turned into something much bigger than I originally intended. Although I have spent a lot of time learning new techniques, finding out more about the domain of KB+M emulation, and spending Friday nights bashing my head against my keyboard, it has been a fun and enriching experience overall. @@ -32,17 +32,17 @@ As of May 24, 2016, this project has moved to https://github.com/AntiMicro/antim - + Copyright: 2013 - 2018 - + Info - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -86,7 +86,7 @@ p, li { white-space: pre-wrap; } - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -204,57 +204,57 @@ p, li { white-space: pre-wrap; } - + Changelog - + Credits Mitwirkende - + antimicro - + About Development Über die Entwicklung - + License Lizenz - + Program Version %1 Programmversion %1 - + Program Compiled on %1 at %2 Programm kompiliert am %1 um %2 - + Built Against SDL %1 Nutzt SDL %1 - + Running With SDL %1 Läuft mit SDL %1 - + Using Qt %1 Benutzt Qt %1 - + Using Event Handler: %1 @@ -262,29 +262,29 @@ p, li { white-space: pre-wrap; } AddEditAutoProfileDialog - + Auto Profile Dialog Auto-Profil-Dialog - + Profile: Profil: - - + + Browse Durchsuchen - + Window: Fenster: - - + + Select Window. Click on the appropriate application window and the application file path will be populated in the form. @@ -293,122 +293,131 @@ Anwendungs-Fenster und der Anwendungs-Dateipfad wird in das Formular eingetragen. - + Detect Window Properties Erkenne Fenstereigenschaften - + Class: Klasse: - + Title: Titel: - + + set partial title + + + + Application: Anwendung: - + Select Wähle - + + De&vices: + + + Devices: - Geräte: + Geräte: - - + + Select this profile to be the default loaded for the specified device. The selection will be used instead of the all default profile option. Wählen Sie dieses Profil als Standard für das jeweilige Gerät. Diese Auswahl wird anstatt jeder anderen Standardeinstellung genutzt. - + Set as Default for Controller Setze als Standardcontroller - - + + A different profile is already selected as the default for this device. Ein anderes Profil ist bereits als Standard für dieses Gerät ausgewählt. - + Current (%1) Aktuell (%1) - + Open Config Konfiguration öffnen - - + + Select Program Wähle Anwendung - + Programs (*.exe) Programme (*.exe) - + Please use the main default profile selection. Bitte benutzen Sie die Standard-Profilauswahl. - + Please select a window by using the mouse. Press Escape if you want to cancel. Bitte wählen Sie mit der Maus ein Fenster aus. Escape drücken um abzubrechen. - + Capture Application Window Anwendungsfenster auswählen - + Could not obtain information for the selected window. Konnte nicht Information für das ausgewählte Fenster gewinnen. - + Application Capture Failed Anwendungsauswahl fehlgeschlagen - + Profile file path is invalid. Profil-Dateipfad ist ungültig. - + No window matching property was specified. Kein zugehöriges Fenster wurde spezifiziert. - + Program path is invalid or not executable. Programmpfad ist ungültig oder nicht ausführbar. - + File is not an .exe file. Datei ist keine .exe-Datei. - + No window matching property was selected. Kein zugehöriges Fenster wurde ausgewählt. @@ -416,187 +425,187 @@ of the all default profile option. AdvanceButtonDialog - - + + Advanced Erweitert - + Assignments Zuweisungen - + Toggle Umschalten - + Turbo Turbo - + Set Selector Wähle Set - + Blank or KB/M Leer oder KB/M - + Hold Halten - + Pause Pause - + Cycle Kreislauf - + Distance Distanz - + Insert Einfügen - + Delete Entfernen - + Clear All Leeren - + Time: Zeit: - + 0.01s 0.01s - + 0s 0s - + Insert a pause that occurs in between key presses. Fügt eine Pause zwischen den Tasten ein. - + Release Freigeben - - + + Insert a new blank slot. Fügt eine neue leere Aktion hinzu. - + Delete a slot. Löscht eine Aktion. - + Clear all currently assigned slots. Löscht alle zugewiesenen Aktionen. - + Specify the duration of an inserted Pause or Hold slot. Gibt die Dauer der hinzugefügten Pause- oder Haltenaktion an. - + 0m 0m - + &Mouse Speed Mod: - - + + Specify the range past an axis dead zone in which a sequence of actions will execute. Gibt die Distanz der Achse zur "Dead Zone" an, in der die Sequenz an Aktionen ausgeführt wird. - + Distance: Distanz: - - + + % % - + Mouse Mod Maus Mod - + Press Time Druckzeit - + Delay Verzögerung - + Execute - + Load Laden - + Set Change Wähle Änderung - + Text Entry - + Placeholder Platzhalter - - + + 0 0 @@ -605,317 +614,317 @@ of the all default profile option. Maus Mod Geschwindigkeit: - + Set the percentage that mouse speeds will be modified by. Stellen Sie den Prozentsatz ein um der die Mausgeschwindigkeit modifiziert werden soll. - + Auto Reset Cycle After Zyklus automatisch neustarten nach - + seconds Sekunden - + Executable: - + ... - + Arguments: - - - + + + Enabled Aktiviert - + Mode: Modus: - + <html><head/><body><p>Normal: Repeatedly press and release a button by the chosen rate.</p><p>Gradient: Modify the button press and button release delay based on how far an axis has been moved. The rate will remain the same.</p><p>Pulse: Modify how many times a button is pressed and released per second. The button delay will remain the same.</p></body></html> <html><head/><body><p>Normal: Wiederholt mit der eingestellten Rate Taste drücken und loslassen.</p><p>Verlaufend: Ändere die Auslösen-/Loslassen-Verzögerung aufgrund wie weit die eine Achse bewegt wurde.</p><p>Pulsierend: Ändere wie häufig eine Taste pro Sekunde ausgelöst wurde. Die Verögerung bleibt gleich.</p></body></html> - + Normal Normal - + Gradient Verlaufend - + Pulse Pulsierend - + Delay: Verzögerung: - + 0.10s 0.10s - + Rate: Rate: - + 10.0/s 10.0/s - - + + Disabled Deaktiviert - + Select Set 1 One Way Wähle Set 1: einseitig - + Select Set 1 Two Way Wähle Set 1: wechselseitig - + Select Set 1 While Held Wähle Set 1: festgehalten - + Select Set 2 One Way Wähle Set 2: einseitig - + Select Set 2 Two Way Wähle Set 2: wechselseitig - + Select Set 2 While Held Wähle Set 2: festgehalten - + Select Set 3 One Way Wähle Set 3: einseitig - + Select Set 3 Two Way Wähle Set 3: wechselseitig - + Select Set 3 While Held Wähle Set 3: festgehalten - + Select Set 4 One Way Wähle Set 4: einseitig - + Select Set 4 Two Way Wähle Set 4: wechselseitig - + Select Set 4 While Held Wähle Set 4: festgehalten - + Select Set 5 One Way Wähle Set 5: einseitig - + Select Set 5 Two Way Wähle Set 5: wechselseitig - + Select Set 5 While Held Wähle Set 5: festgehalten - + Select Set 6 One Way Wähle Set 6: einseitig - + Select Set 6 Two Way Wähle Set 6: wechselseitig - + Select Set 6 While Held Wähle Set 6: festgehalten - + Select Set 7 One Way Wähle Set 7: einseitig - + Select Set 7 Two Way Wähle Set 7: wechselseitig - + Select Set 7 While Held Wähle Set 7: festgehalten - + Select Set 8 One Way Wähle Set 8: einseitig - + Select Set 8 Two Way Wähle Set 8: wechselseitig - + Select Set 8 While Held Wähle Set 8: festgehalten - + sec. Sek. - + /sec. /Sek. - + Set %1 Set %1 - - + + Select Set %1 Wähle Set %1 - + One Way Einweg - + Two Way Zweiwege - + While Held Solang wie gehalten - + Choose Executable - + Slots past a Cycle action will be executed on the next button press. Multiple cycles can be added in order to create partitions in a sequence. - + Delays the time that the next slot is activated by the time specified. Slots activated before the delay will remain active after the delay time has passed. - + Distance action specifies that the slots afterwards will only be executed when an axis is moved a certain range past the designated dead zone. - + Insert a hold action. Slots after the action will only be executed if the button is held past the interval specified. - + Chose a profile to load when this slot is activated. Wähle ein Profil zum Laden wenn dieser Slot aktiviert ist. - + Mouse mod action will modify all mouse speed settings by a specified percentage while the action is being processed. This can be useful for slowing down the mouse while sniping. - + Specify the time that keys past this slot should be held down. - + Insert a release action. Slots after the action will only be executed after a button release if the button was held past the interval specified. - + Change to selected set once slot is activated. Wechsle zu ausgewähltem Set wenn Slot aktiviert ist. - + Full string will be typed when a slot is activated. - + Execute program when slot is activated. - - + + Choose Profile Wähle Profil - + Config Files (*.amgp *.xml) Konfigurationsdateien (*.amgp *.xml) @@ -923,157 +932,157 @@ of the all default profile option. AdvanceStickAssignmentDialog - + Stick/Pad Assignment Stick/Pad Zuweisung - + Sticks Sticks - + DPads DPads - - + + %1 (Joystick %2) %1 (Joystick %2) - + Stick 1 Stick 1 - - - + + + Enabled Aktiviert - - - - - - + + + + + + Assign Zuweisen - - + + X Axis: X Achse: - - + + Y Axis: Y Achse: - + Stick 2 Stick 2 - + Number of Physical DPads: %1 Nummer der physischen DPads: %1 - + Virtual DPad 1 Virtueller DPad 1 - + Up: Hoch: - + Down: Runter: - + Note: This window is meant for backwards compatibility with profiles made before antimicro 2.0. Since version 2.0, use of the Game Controller Mapping window is preferred. Hinweis: Dieses Fenster ist nur zur Rückwärtskompatibilität zu Profilen für antimicro vor 2.0 gedacht. Seit Version 2.0 wird das Spielecontroller-Zuweisungsfenster bevorzugt. - + Left: Links: - + Right: Rechts: - - - - + + + + Axis %1 Achse %1 - - - - + + + + Axis %1 - Achse %1 - - - - - + + + + Axis %1 + Achse %1 + - - - - + + + + Button %1 Button %1 - + Move stick 1 along the X axis Bewege Stick 1 entlang der X Achse - + Move stick 1 along the Y axis Bewege Stick 1 entlang der Y Achse - + Move stick 2 along the X axis Bewege Stick 2 entlang der X Achse - + Move stick 2 along the Y axis Bewege Stick 2 entlang der Y Achse - - - - + + + + Press a button or move an axis Drücke einen Button oder bewege eine Achse @@ -1081,181 +1090,181 @@ of the all default profile option. AxisEditDialog - + Axis Achse - - + + Mouse (Horizontal) Maus (Horizontal) - - + + Mouse (Inverted Horizontal) Maus (Invertiert Horizontal) - - + + Mouse (Vertical) Maus (Vertikal) - - + + Mouse (Inverted Vertical) Maus (Invertiert Vertikal) - - + + Arrows: Up | Down Pfeiltasten: Hoch | Runter - - + + Arrows: Left | Right Pfeiltasten: Links | Rechts - - + + Keys: W | S Tasten: W | S - - + + Keys: A | D Tasten: A | D - - + + NumPad: KP_8 | KP_2 Nummernblock: KP_8 | KP_2 - - + + NumPad: KP_4 | KP_6 Nummernblock: KP_4 | KP_6 - - - + + + None Nichts - - + + Set the value to use as the limit for an axis. Useful for a worn out analog stick. Setze einen Wert als Limitierung einer Achse. Nützlich bei abgenutzten Analogsticks. - + Negative Half Throttle Negative Halbbeschleunigung - + Positive Half Throttle Positive Halbbeschleunigung - + Name: Name: - + Specify the name of an axis. Vergebe den Namen der Achse. - + Mouse Settings Mauseinstellungen - - + + Set the value of the dead zone for an axis. Bestimmt den Wert der Dead Zone einer Achse. - + Presets: Vorgaben: - + Dead Zone: Dead Zone: - + Max Zone: Max Zone: - - + + [NO KEY] [KEINE TASTE] - + Throttle setting that determines the behavior of how to interpret an axis hold or release. Beschleunigung gibt das Verhalten an wie das Halten oder Loslassen einer Achse interpretiert wird. - + Negative Throttle Negative Beschleunigung - + Normal Normal - + Positive Throttle Positive Beschleunigung - + Current Value: Aktueller Wert: - + Set Set - + Set %1 Set %1 - + Left Mouse Button Linke Maustaste - + Right Mouse Button Rechte Maustaste @@ -1263,37 +1272,37 @@ oder Loslassen einer Achse interpretiert wird. ButtonEditDialog - + Dialog Dialog - + To make a new assignment, press any keyboard key or click a button in the Keyboard or Mouse tab Um eine neue Zuweisung zu machen, drück eine Taste oder klick einen Button im Tastatur oder Mausreiter - + Placeholder Platzhalter - + Toggle Umschalten - + Enables a key press or release to only occur when a controller button is pressed. Tasten werden erst, wenn der Button gedrückt wurde entweder festgehalten oder frei gelassen. - + Enables rapid key presses and releases. Turbo controller. Aktiviert schnelles Tastendrücken oder Freigeben. Autofeuer. - + Turbo Turbo @@ -1302,38 +1311,38 @@ oder Loslassen einer Achse interpretiert wird. Aktuell: - + Last keyboard/mouse button: - + Slots Slots - + Na&me: - Name: + Na&me: - + Specify the name of a button. Vergebe den Namen des Buttons. - + Action: Aktion: - + Specify the action that will be performed in game while this button is being used. Gibt die Aktion des Buttons an, die Ingame genutzt wird. - + Advanced Advanced @@ -1346,52 +1355,52 @@ this button is being used. Set %1 - - - + + + Choose your keyboard key - + No button - - - - + + + + Last button - + To change settings for last button, it must be at least one assignment from keyboard to gamepad - + To change settings of turbo for last button, it must be at least one assignment from keyboard to gamepad - + To open advanced dialog, it's needed to map at least one button from keyboard to gamepad - + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + As last gamepad button has been set - + Index %1 @@ -1399,190 +1408,190 @@ this button is being used. Calibration - + Form - - + + Start calibration - + Controller: - + Sticks: - - Use settings from jstest-gtk - - - - + Reset settings - + Cancel Abbrechen - - + + Save Speichern - - + + Calibration - - Do you really want to reset settings of current axes? + + Do you really want to reset settings of current axis? - + Calibration was saved for the preset. Do you really want to reset settings? - + Place the joystick in the center position. It's the part, where often you don't have to move. Just skip it in such situation. - + Calibrating center - + Start second step - + Center X: %1 - + Center Y: %1 - + Place the joystick in the top-left corner many times - - + + Calibrating position - - + + X: %1 - - + + Y: %1 - + Place the joystick in the bottom-right corner - + Start final step - + range X: %1 - %2 - + range Y: %1 - %2 - + deadzone X: %1 - + deadzone Y: %1 - + ---Calibration done!--- - + Calibration values have been saved - - + + Dead zone calibration - - You must move X axis to the right at least five times! Keep moving! + + You have to move axes to the top-left corner at least five times. - - You must move X axis to the left at least five times! Keep moving! + + You have to move axes to the bottom-right corner at least five times. - - - - + + Do you want to save calibration of current axis? + + + + + + + Axis %1 Achse %1 @@ -1590,64 +1599,64 @@ deadzone Y: %1 CapturedWindowInfoDialog - + Captured Window Properties Erkannte Fenstereigenschaften - + Information About Window Fensterinformationen - + Class: Klasse: - - - + + + TextLabel - + Title: Titel: - + Path: Pfad: - + Match By Properties - + Class Klasse - + Title Titel - + Path Pfad - + Full Path vollständiger Pfad - + File Name Dateinmae @@ -1794,67 +1803,67 @@ deadzone Y: %1 DPadContextMenu - + Mouse (Normal) Maus (Normal) - + Mouse (Inverted Horizontal) Maus (Invertiert Horizontal) - + Mouse (Inverted Vertical) Maus (Invertiert Vertikal) - + Mouse (Inverted Horizontal + Vertical) Maus (Invertiert Horizontal + Vertikal) - + Arrows Pfeiltasten - + Keys: W | A | S | D Tasten: W | A | S | D - + NumPad Nummerntastatur - + None Nichts - + Standard Standard - + Eight Way 8-Weg - + 4 Way Cardinal 4-Wege kardinal - + 4 Way Diagonal 4-Wege diagonal - + Mouse Settings Mauseinstellungen @@ -1862,108 +1871,108 @@ deadzone Y: %1 DPadEditDialog - + Dialog Dialog - + Presets: Vorgaben: - + Mouse (Normal) Maus (Normal) - + Mouse (Inverted Horizontal) Maus (Invertiert Horizontal) - + Mouse (Inverted Vertical) Maus (Invertiert Vertikal) - + Mouse (Inverted Horizontal + Vertical) Maus (Invertiert Horizontal + Vertikal) - + Arrows Pfeiltasten - + Keys: W | A | S | D Tasten: W | A | S | D - + NumPad Nummerntastatur - + None Nichts - + Dpad Mode: DPad Modus: - + &Name: - + 4 Way Cardinal 4-Wege kardinal - + 4 Way Diagonal 4-Wege diagonal - + DPad Delay: DPad-Verzögerung: - - + + Time lapsed before a direction change is taken into effect. Zeit abgelaufen bevor eine Richtungsänderung vollzogen wird. - + s - + Specify the name of a dpad. Vergebe den Namen des DPads. - + Mouse Settings Mauseinstellungen - + Standard Standard - + Standard: 8 region dpad with two direction buttons active when the dpad is in a diagonal region. @@ -1979,17 +1988,17 @@ to a diagonal zone. - + Eight Way 8-Wege - + Set Set - + Set %1 Set %1 @@ -1997,27 +2006,27 @@ to a diagonal zone. EditAllDefaultAutoProfileDialog - + Default Profile Standardprofil - + Profile: Profil: - + Browse Durchsuchen - + Open Config Konfiguration öffnen - + Profile file path is invalid. Profil-Dateipfad ist ungültig. @@ -2025,29 +2034,29 @@ to a diagonal zone. ExtraProfileSettingsDialog - + Extra Profile Settings Weitere Profileinstellungen - + Key Press Time: Tastendruckzeit: - + 0.00 ms 0.00 ms - + Profile Name: Profilname: - - - + + + s s @@ -2055,7 +2064,7 @@ to a diagonal zone. GameController - + Game Controller Gamecontroller @@ -2063,9 +2072,9 @@ to a diagonal zone. GameControllerDPad - - - + + + DPad DPad @@ -2073,187 +2082,187 @@ to a diagonal zone. GameControllerMappingDialog - + Game Controller Mapping Game Controller Zuweisung - + <html><head/><body><p>antimicro makes use of the <a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;">Game Controller API</span></a> provided by SDL 2 in order to abstract various gamepads to fit a unified standard. In order to make a button assignment, please highlight the mapping cell for the appropriate button row below. You can then press a button or move an axis on your gamepad and the cell will update with the physical button or axis that will be used.</p><p>antimicro will use the mapping that you specify to save a mapping string that will be loaded into SDL.</p></body></html> - + A A - + B B - + X X - + Y Y - + Back Zurück - + Start Start - + Guide Guide - + Left Shoulder linker Schulterbutton - + Right Shoulder rechter Schulterbutton - + Left Stick Click linker Stick Klick - + Right Stick Click rechter Stick Klick - + Left Stick X linker Stick X - + Left Stick Y linker Stick Y - + Right Stick X rechter Stick X - + Right Stick Y rechter Stick Y - + Left Trigger linker Trigger - + Right Trigger rechter Trigger - + DPad Up DPad Hoch - + DPad Left DPad Links - + DPad Down DPad Runter - + DPad Right DPad Rechts - + Mapping Zuweisung - + SDL 2 Game Controller Mapping String SDL 2 Game Controller Zuweisungsstring - + Last Axis Event: Letztes Achsenereignis: - + Current Axis Detection Dead Zone: Aktuelle Achsenerkennungs Totzone: - + 5000 5000 - + 10000 10000 - + 15000 15000 - + 20000 20000 - + 25000 25000 - + 30000 30000 - + 32000 32000 - + Game Controller Mapping (%1) (#%2) Spielecontroller Zuweisung (%1) (#%2) - + Discard Controller Mapping? Controller Zuweisung verwerfen? - + Discard mapping for this controller? If discarded, the controller will be reverted to a joystick once you refresh all joysticks. @@ -2266,47 +2275,47 @@ Joysticks aktualisiert werden. GameControllerSet - + Back Zurück - + Guide Handbuch - + Start Start - + LS Click LS Klick - + RS Click RS Klick - + L Shoulder L Schulter - + R Shoulder R Schulter - + L Trigger L Trigger - + R Trigger R Trigger @@ -2314,9 +2323,9 @@ Joysticks aktualisiert werden. GameControllerTrigger - - - + + + Trigger Trigger @@ -2324,9 +2333,9 @@ Joysticks aktualisiert werden. JoyAxis - - - + + + Axis Achse @@ -2334,24 +2343,24 @@ Joysticks aktualisiert werden. JoyAxisButton - + Negative Negativ - + Positive Positiv - + Unknown Unbekannt - - - + + + Button Button @@ -2359,74 +2368,74 @@ Joysticks aktualisiert werden. JoyAxisContextMenu - + Mouse (Horizontal) Maus (Horizontal) - + Mouse (Inverted Horizontal) Maus (Invertiert Horizontal) - + Mouse (Vertical) Maus (Vertikal) - + Mouse (Inverted Vertical) Maus (Invertiert Vertikal) - + Arrows: Up | Down Pfeiltasten: Hoch | Runter - + Arrows: Left | Right Pfeiltasten: Links | Rechts - + Keys: W | S Tasten: W | S - + Keys: A | D Tasten: A | D - + NumPad: KP_8 | KP_2 Nummernblock: KP_8 | KP_2 - + NumPad: KP_4 | KP_6 Nummernblock: KP_4 | KP_6 - - + + None Nichts - - + + Mouse Settings Mauseinstellungen - + Left Mouse Button Linke Maustaste - + Right Mouse Button Rechte Maustaste @@ -2434,57 +2443,57 @@ Joysticks aktualisiert werden. JoyButton - + Processing turbo for #%1 - %2 - + Finishing turbo for button #%1 - %2 - + Processing press for button #%1 - %2 - + Processing release for button #%1 - %2 - + Distance change for button #%1 - %2 - - - + + + Button Button - - - - + + + + [NO KEY] [KEINE TASTE] - + [Set %1 1W] - + [Set %1 2W] - + [Set %1 WH] @@ -2492,47 +2501,47 @@ Joysticks aktualisiert werden. JoyButtonContextMenu - + Toggle Umschalten - + Turbo Turbo - + Clear Leeren - + Set Select Set-Auswahl - + Disabled Deaktiviert - + Set %1 Set %1 - + Set %1 1W Set %1 1W - + Set %1 2W Set %1 2W - + Set %1 WH @@ -2540,118 +2549,118 @@ Joysticks aktualisiert werden. JoyButtonSlot - - + + Mouse Maus - + Up Hoch - + Down Runter - + Left Links - + Right Rechts - + LB LB - + MB MB - + RB RB - + B4 B4 - + B5 B5 - + Pause Pause - + Hold Halten - + Cycle Kreislauf - + Distance Distanz - + Release Freigeben - + Mouse Mod Maus Mod - + Press Time Druckzeit - + Delay Verzögerung - + Load %1 Lade %1 - + Set Change %1 - + [Text] %1 - + [Exec] %1 - + [NO KEY] [KEINE TASTE] @@ -2659,9 +2668,9 @@ Joysticks aktualisiert werden. JoyControlStick - - - + + + Stick Stick @@ -2669,37 +2678,37 @@ Joysticks aktualisiert werden. JoyControlStickButton - - - + + + Up Hoch - - - + + + Down Runter - - - + + + Left Links - - - + + + Right Rechts - - - + + + Button Button @@ -2707,67 +2716,67 @@ Joysticks aktualisiert werden. JoyControlStickContextMenu - + Mouse (Normal) Maus (Normal) - + Mouse (Inverted Horizontal) Maus (Invertiert Horizontal) - + Mouse (Inverted Vertical) Maus (Invertiert Vertikal) - + Mouse (Inverted Horizontal + Vertical) Maus (Invertiert Horizontal + Vertikal) - + Arrows Pfeiltasten - + Keys: W | A | S | D Tasten: W | A | S | D - + NumPad Nummerntastatur - + None Nichts - + Standard Standard - + Eight Way 8-Wege - + 4 Way Cardinal 4-Wege kardinal - + 4 Way Diagonal 4-Wege diagonal - + Mouse Settings Mauseinstellungen @@ -2775,86 +2784,86 @@ Joysticks aktualisiert werden. JoyControlStickEditDialog - + Dialog Dialog - + X: X: - - - - - + + + + + 0 0 - + Y: Y: - + Distance: Distanz: - + Presets: Vorgaben: - + Mouse (Normal) Maus (Normal) - + Mouse (Inverted Horizontal) Maus (Invertiert Horizontal) - + Mouse (Inverted Vertical) Maus (Invertiert Vertikal) - + Mouse (Inverted Horizontal + Vertical) Maus (Invertiert Horizontal + Vertikal) - + Arrows Pfeiltasten - + Keys: W | A | S | D Tasten: W | A | S | D - + NumPad Nummerntastatur - + None Nichts - + Stick Mode: Stickmodus: - + Standard: 8 region stick with two direction buttons active when the stick is in a diagonal region. @@ -2881,72 +2890,72 @@ Kardinal-/Himmelsrichtung des Sticks entspricht. Nützlich für Menüs. Diagonal-Zone des Sticks entspricht. - + 4 Way Cardinal 4-Wege kardinal - + 4 Way Diagonal 4-Wege diagonal - - + + Dead zone value to use for an analog stick. Totzonenwert für Analogsticks. - - + + Value when an analog stick is considered moved 100%. Wert für den ein Analogstick als 100% ausgelenkt betrachtet wird. - - + + The area (in degrees) that each diagonal region occupies. Den Bereich (in Grad) die jede diagonale Region einnimmt. - + Square Stick: - - + + Percentage to modify a square stick coordinates to confine values to a circle - + % % - + Stick Delay: Stick Verzögerung: - - + + Time lapsed before a direction change is taken into effect. Abgelaufene Zeit bis eine Richtungsänderung wirksam wird. - + s - + Modifier: Modifikator: - + Edit button that is active while the stick is active. This button is useful for assigning zones with @@ -2955,68 +2964,68 @@ functionality to an analog stick. - + PushButton - + Na&me: Name: - Name: + Na&me: - + Specify the name of an analog stick. Vergebe den Namen eines Analogsticks. - + Mouse Settings Mauseinstellungen - + Standard Standard - + Bearing: - + % Safe Zone: - + Eight Way 8-Wege - + Dead Zone: Dead Zone: - + Max Zone: Max Zone: - + Diagonal Range: diagonale Reichweite: - + Set Set - + Set %1 Set %1 @@ -3024,9 +3033,9 @@ functionality to an analog stick. JoyControlStickModifierButton - - - + + + Modifier Modifikator @@ -3034,9 +3043,9 @@ functionality to an analog stick. JoyDPad - - - + + + DPad DPad @@ -3044,37 +3053,37 @@ functionality to an analog stick. JoyDPadButton - - - + + + Up Hoch - - - + + + Down Runter - - - + + + Left Links - - - + + + Right Rechts - - - + + + Button Button @@ -3082,267 +3091,272 @@ functionality to an analog stick. JoyTabWidget - - - - - - + + + + + + <New> <Neu> - - + + Remove Entfernen - - + + Remove configuration from recent list. Entferne Konfiguration aus den letzten Einträgen. - - + + Load Laden - - + + Load configuration file. Lade Konfigurationsdatei. - - + + Save Speichern - - + + Save changes to configuration file. Änderungen in Konfigurationsdatei speichern. - - + + Save As Speichern unter - - + + Save changes to a new configuration file. Änderungen in neue Konfigurationsdatei speichern. - - + + Sets Sets - + Copy from Set - + Settings Einstellungen - - + + Set 1 Set 1 - - + + Set 2 Set 2 - - + + Set 3 Set 3 - - + + Set 4 Set 4 - - + + Set 5 Set 5 - - + + Set 6 Set 6 - - + + Set 7 Set 7 - - + + Set 8 Set 8 - - + + Stick/Pad Assign Stick/Pad Zuweisung - - + + Controller Mapping Controllerzuweisung - - + + Quick Set Schnellkonfiguration - - + + Names Namen - - + + Toggle button name displaying. Buttonnamendarstellung wechseln. - - + + Pref Einst - - + + Change global profile settings. Globale Profileinstellungen ändern. - - - + + + Reset Reset - - + + Revert changes to the configuration. Reload configuration file. Änderungen der Konfiguration zurücksetzen. Neuladen der Konfiguration. - + Open Config Konfiguration öffnen - + Config Files (*.amgp *.xml) Konfigurationsdateien (*.amgp *.xml) - - - + + + Config File (*.%1.amgp) Konfigurationsdatei (*.%1.amgp) - - + + Do you really want to reset buttons settings for joystick? + + + + + Save Profile Changes? Profiländerungen speichern? - - + + Changes to the new profile have not been saved. Would you like to save or discard the current profile? Änderungen am neuen Profil wurden nicht gespeichert. Möchten Sie das aktuelle Profil speichern oder verwerfen? - - + + Changes to the profile "%1" have not been saved. Would you like to save or discard changes to the current profile? Änderungen am neuen Profil %1 wurden nicht gespeichert. Möchten Sie das aktuelle Profil speichern oder verwerfen? - + Sticks Sticks - - + + DPads DPads - + No buttons have been assigned. Please use Quick Set to assign keys to buttons or disable hiding empty buttons. Es wurden keine Tasten zugewiesen. Bitte verwenden Sie den Schnellkonfiguration um Tasten zuzuweisen oder deaktivieren Sie das Ausblenden leerer Tasten. - - + + Set %1: %2 Set %1: %2 - - + + Set %1 Set %1 - + Copy Set Assignments Kopiere Set-Zuweisungen - + Are you sure you want to copy the assignments and device properties from %1? Sind Sie sicher, dass Sie die Aufgaben-und Geräteeigenschaften von%1 kopieren möchten? - - - + + + Save Config Konfiguration speichern - - + + Set Set @@ -3350,7 +3364,7 @@ oder deaktivieren Sie das Ausblenden leerer Tasten. Joystick - + Joystick Joystick @@ -3358,98 +3372,98 @@ oder deaktivieren Sie das Ausblenden leerer Tasten. JoystickStatusWindow - + Properties Eigenschaften - + Details Details - + Name: Name: - - - - - - - + + + + + + + %1 %1 - + Number: Nummer: - + Axes: Achsen: - + Buttons: Buttons: - + Hats: Hats: - + GUID: GUID: - + Game Controller: Gamecontroller: - + Axes Achsen - + Buttons Buttons - + Hats Hats - + %1 (#%2) Properties %1 (#%2) Eigenschaften - + Axis %1 Achse %1 - + Hat %1 Hat %1 - + No Nein - + Yes Ja @@ -3457,62 +3471,67 @@ oder deaktivieren Sie das Ausblenden leerer Tasten. MainSettingsDialog - + Edit Settings Einstellungen ändern - + General Allgemein - + Controller Mappings Controllerzuweisungen - + Language Sprache - + Auto Profile Autoprofil - + Mouse Maus - + Advanced - + + Profile Direc&tory: + + + + <html><head/><body><p>Specify the default directory that the program should use in file dialogs when loading a profile or saving a new profile.</p></body></html> <html><head/><body><p>Geben Sie das Standardverzeichnis an, dass das Programm im Dateidialog verwenden soll beim Laden oder Speichern eines Profils.</p></body></html> - + Recent Profile Count: Einträge an Profilen merken: - + <html><head/><body><p>Number of profiles that can be placed in recent profile list. 0 will result in the program not enforcing a limit on the number of profiles displayed.</p></body></html> <html><head/><body><p>Anzahl der Profile, die in den letzten Profilen-Liste platziert werden können. 0 = keine Begrenzung.</p></body></html> - + Gamepad Poll Rate: - + Change the poll rate that the program uses to discover new events from gamepads. Defaults to 10 ms. @@ -3522,28 +3541,28 @@ before using antimicro unattended. - + Hide main window when the main window close button is clicked instead of quitting the program. Verstecke Hauptfenster anstatt es zu schließen, wenn die "Schließen"-Schaltfläche gedrückt wurde. - + Close To Tray Schließen im Tray - + Have Windows start antimicro at system startup. Lade antimicro beim Systemstart. - + Launch At Windows Startup Beim Windows-Start starten - + Display recent profiles for all controllers as a single list in the tray menu. Defaults to using sub-menus. @@ -3551,24 +3570,24 @@ to using sub-menus. Controller als eine Liste anstatt als Untermenüs. - + Single Profile List in Tray Einzelprofil-Menü im Tray - + Have the program minimize to the taskbar. By default, the program minimizes to the system tray if available. Minimiere das Programm in die Taskleiste. Standardmäßig wird AntiMicro, falls möglich, in das System-Tray minimiert. - + Minimize to Taskbar In die Taskleiste minimieren - + This option will cause the program to hide all buttons that have no slots assigned to them. The Quick Set dialog window will have to be used @@ -3578,12 +3597,12 @@ Aktion zugeordnet wird. Der Schnelleinstellungs-Dialog muss benutzt werden um die Editier-Einstellungen aufzurufen. - + Hide Empty Buttons Verstecke leere Schaltflächen - + When the program is launched, open the last known profile that was opened during the previous session. @@ -3591,159 +3610,169 @@ previous session. öffne das zuletzt benutzte Profil. - + Auto Load Last Opened Profile Zuletzt geöffnetes Profil automatisch öffnen - + Only show the system tray icon when the program first launches. Zeige das System-Tray-Icon nur, wenn das Programm zum ersten Mal startet. - + Launch in Tray Starten im Tray - + Associate .amgp files with antimicro in Windows Explorer. Assoziiere .amgp-Dateien mit antimicro im Windows Explorer. - + Associate Profiles Assoziiere Profile - + Key Repeat Tastenanschlag - + Active keys will be repeatedly pressed when this option is enabled. Dauerhaft gedrückte Tasten werden wiederholt gedrückt, wenn diese Option aktiviert ist. - - + + Enable Aktivieren - + Specifies how much time should elapse before key repeating begins. Bestimmt die Zeit die abläuft bis das Wiederholen des Tastenanschlags beginnt. - + Specifies how many times key presses will be performed per seconds. Bestimmt wie oft Tastenanschläge pro Sekunde durchgeführt werden. - + <html><head/><body><p>antimicro has been translated into many different languages by contributors. By default, the program will choose an appropriate translation based on your system's locale setting. However, you can make antimicro load a different translation depending on the language that you choose from the list below.</p></body></html> <html><head/><body><p>antimicro wurde durch Mitwirkende in viele verschiedene Sprachen übersetzt. Standardmäßig wählt das Programm ein die entsprechende Übersetzung anhand der Einstellung Ihres Systems. Jedoch können Sie antimicro eine andere Übersetzung anhand der Sprache von der Liste hierunter wählen.</p></body></html> - + Português do Brasil - + Français - + Deutsch - + Italiano - + 日本語 - + Русский - + српски / srpski - + 简体中文 - + Español - + українська - + Polski - + + History Si&ze: + + + + Log File: - + Log Level: - + None Nichts - + Error - + Warning - + Info - + Debug + + + Reset + Reset + French Französisch @@ -3761,22 +3790,22 @@ durchgeführt werden. Ukrainisch - + Class Klasse - + Title Titel - + Program Programm - + Disable the "Enhanced Pointer Precision" Windows setting while antimicro is running. Disabling "Enhanced Pointer Precision" will allow mouse movement within antimicro to be more @@ -3786,32 +3815,27 @@ während antimicro läuft. Dies erlaubt präzisere Mausbewegungen in antimicro. - + Disable Enhance Pointer Precision Deaktiviere "Zeigerbeschleunigung verbessern" - + Smoothing Glättung - - Histor&y Size: - - - - + Weight &Modifier: - + Refresh Rate: Wiederholrate: - + The refresh rate is the amount of time that will elapse in between mouse events. Please be cautious when editing this setting as it will cause the program to use @@ -3821,46 +3845,46 @@ it unattended. - + Spring Quelle - + Screen: Bildschirm: - + Utilize the specified screen for spring mode. On Linux, the default is to use the primary screen. On Windows, the default is to use all available screens. - + Accel Numerator: - - - + + + 0 0 - + Accel Denominator: - + Accel Threshold: - + If the acceleration values for the virtual mouse have been changed by a different process, particularly when quitting an older game, then you might want to reset the acceleration @@ -3868,37 +3892,32 @@ values used by the virtual mouse. - + Reset Acceleration - + Delay: Verzögerung: - - Profi&le Directory: - - - - + ms ms - + Rate: Rate: - + times/s mal/s - + Below is a list of the custom mappings that have been saved. You can use the following table to delete mappings or have mappings temporarily disabled. You can also disable mappings that are included with SDL; just insert a new row with the appropriate joystick GUID and check disable. Settings will not take affect until you either refresh all joysticks or unplug that particular joystick. @@ -3907,34 +3926,34 @@ Settings will not take affect until you either refresh all joysticks or unplug t Die Einstellungen werden nicht wirksam werden, bis Sie entweder alle Joysticks aktualisieren oder diesen bestimmten Joystick trennen. - + GUID GUID - + Mapping String Zuweisungsstring - + Disable? Deaktivieren? - - + + Delete Löschen - + Insert Einfügen - - + + Default Standard @@ -3943,7 +3962,7 @@ Die Einstellungen werden nicht wirksam werden, bis Sie entweder alle Joysticks a Brasilianisches Portugiesisch - + English Englisch @@ -3952,49 +3971,49 @@ Die Einstellungen werden nicht wirksam werden, bis Sie entweder alle Joysticks a Deutsch - - + + Active Aktiv - + Devices: Geräte: - - + + All Alles - + Device Gerät - + Profile Profil - + Default? Standard? - + Add Hinzufügen - + Edit Editieren - + Also, Windows users who want to use a low value should also check the "Disable Enhance Pointer Precision" checkbox if you haven't disabled the option in Windows. @@ -4003,42 +4022,52 @@ auch das "Deaktiviere 'Zeigerbeschleunigung verbessern'" Kon aktivieren, wenn die Option nicht in Windows deaktiviert ist. - + Select Default Profile Directory Wähle das Standard-Profil-Verzeichnis - + Are you sure you want to delete the profile? Sind Sie sicher, dass Sie das Profil löschen möchten? - + Save Log File As - + Log Files (*.log) + + + Do you really want to reset setting? + + + + + Would you like to reset mappings too? + + MainWindow - + No Joysticks have been found. Please plug in a joystick and then choose the "Update Joysticks" option in the main menu Keine Joysticks gefunden. Stecken Sie eine Joystick ein und wählen Sie dann die Option "Joysticks aktualisieren" im Hauptmenü aus - + If events are not seen by a game, please click here to run this application as Administrator. - + &App &Anwendung @@ -4047,12 +4076,12 @@ aktivieren, wenn die Option nicht in Windows deaktiviert ist. Stick/Pad Zuweisung - + &Options &Optionen - + antimicro @@ -4061,100 +4090,100 @@ aktivieren, wenn die Option nicht in Windows deaktiviert ist. Wenn die Ereignisse nicht erkannt werden, klicken Sie hier um als Administrator neuzustarten. - + &Help &Hilfe - - + + &Quit B&eenden - + Ctrl+Q Strg+Q - - + + &Update Joysticks &Joysticks aktualisieren - + Ctrl+U Strg+U - - + + &Hide &Verstecken - + Ctrl+H Strg+H - + &About Ü&ber - + Ctrl+A Strg+A - + About &Qt - + &Properties - + &Key Checker - + &GitHub Page - + &Game Controller Mapping - + S&ettings - + &Stick/Pad Assign - + &Wiki - + &Issues - + &Calibration @@ -4171,7 +4200,7 @@ aktivieren, wenn die Option nicht in Windows deaktiviert ist. Tastenkontrolle - + Home Page Webseite @@ -4188,49 +4217,49 @@ aktivieren, wenn die Option nicht in Windows deaktiviert ist. Einstellungen - + Could not find a proper controller identifier. Exiting. - - - - - - - + + + + + + + (%1) (%1) - - + + Open File Datei öffnen - + &Restore &Wiederherstellen - + Calibration couldn't be opened - + You must connect at least one controller to open the window - + Run as Administrator? Als Administrator ausführen? - + Are you sure that you want to run this program as Adminstrator? Some games run as Administrator which will cause events generated by antimicro to not be used by those games unless antimicro is also run as the Adminstrator. This is due to permission problems caused by User Account Control (UAC) options in Windows Vista and later. @@ -4239,17 +4268,17 @@ Some games run as Administrator which will cause events generated by antimicro t Manche Spiele laufen als Administrator, weshalb manche Ereignisse durch antimicro nicht von diesen Spielen erkannt werden, wenn antimicro nicht auch als Administrator ausgeführt wird. Dies geschieht auf Grund von Erlaubnisproblemen durch Benutzerkontensteuerung (UAC) Einstellungen in Windows Vista und neuer. - + Failed to elevate program Berechtigungserhöhung fehlgeschlagen - + Failed to restart this program as the Administrator Neustart als Administrator ist fehlgeschlagen - + Could not find controller. Exiting. @@ -4257,12 +4286,12 @@ Manche Spiele laufen als Administrator, weshalb manche Ereignisse durch antimicr MouseAxisSettingsDialog - + Mouse Settings - Mauseinstellungen - - + Set %1 Set %1 @@ -4270,12 +4299,12 @@ Manche Spiele laufen als Administrator, weshalb manche Ereignisse durch antimicr MouseButtonSettingsDialog - + Mouse Settings - Mauseinstellungen - - + Set %1 Set %1 @@ -4283,12 +4312,12 @@ Manche Spiele laufen als Administrator, weshalb manche Ereignisse durch antimicr MouseControlStickSettingsDialog - + Mouse Settings Mauseinstellungen - + Set %1 Set %1 @@ -4296,12 +4325,12 @@ Manche Spiele laufen als Administrator, weshalb manche Ereignisse durch antimicr MouseDPadSettingsDialog - + Mouse Settings Mauseinstellungen - + Set %1 Set %1 @@ -4309,17 +4338,17 @@ Manche Spiele laufen als Administrator, weshalb manche Ereignisse durch antimicr MouseSettingsDialog - + Mouse Settings Mauseinstellungen - + Mouse Mode: Mausmodus: - + Cursor mode is used to move the mouse cursor around the screen relative to its current position depending on how much you move an axis @@ -4342,68 +4371,68 @@ Mittelpunkt, wenn eine Achse zur Dead Zone zurück kehrt. - + Cursor Zeiger - + Spring Sprung - + Acceleration: Beschleunigung: - + Enhanced Precision Verbesserte Präzision - - + + Linear linear - + Quadratic quadratisch - + Cubic kubisch - + Quadratic Extreme extrem quadratisch - + Power Function Power Funktion - + Easing Quadratic - + Easing Cubic - + Mouse Speed Settings Einstellungen der Mausgeschwindigkeit - + Enable to change the horizontal and vertical speed boxes at the same time. Aktivieren, um die horizontale und vertikale @@ -4411,12 +4440,12 @@ Geschwindigkeitseinstellungen zur gleichen Zeit zu ändern. - + Change Together Zusammen ändern - + Options for adding more acceleration to the mouse movement beyond what the acceleration curve would produce. Acceleration is added based on how quickly an axis is @@ -4426,17 +4455,17 @@ using typical gamepad analog sticks. - + Delta Acceleration - + &Multiplier: - + Mi&n Threshold: @@ -4448,8 +4477,8 @@ Speed: horizontal: - - + + 1 = 20 pps 1 = 20 pps @@ -4460,33 +4489,33 @@ Speed: vertikal: - + Wheel Hori. Speed: Rad-Gesch. horizontal: - + Set the speed used for horizontal mouse wheel movement according to number of simulated notches per second. Stellen Sie die Geschwindigkeit für die horizontale Mausrad-Bewegung entsprechend der Anzahl der simulierten Raster pro Sekunde ein. - + Set the speed used for vertical mouse wheel movement according to number of simulated notches per second. Stellen Sie die Geschwindigkeit für die vertikale Mausrad-Bewegung entsprechend der Anzahl der simulierten Raster pro Sekunde ein. - + Sensitivit&y: - + For Power Function acceleration curve. Specifies the factor to use for curve sensitivity. When the value is above 1.0, the mouse movement will be accelerated @@ -4494,13 +4523,13 @@ faster at the low end of an axis. - + Easing Duration: - - + + s @@ -4513,73 +4542,73 @@ faster at the low end of an axis. Multiplikator: - + Highest value to accelerate mouse movement by - + x - + Start %: - + Acceleration begins at this percentage of the base multiplier - + Minimum amount of axis travel required for acceleration to begin - + Max Threshold: - + Maximum axis travel before acceleration has reached the multiplier value - + E&xtra Duration: - + Curve: - + Ease Out Sine - + Ease Out Quad - + Ease Out Cubic - + Release Radius: - + Specifies that the spring area will be relative to the mouse position set by a non-relative spring. Wenn aktiviert, @@ -4587,39 +4616,39 @@ mouse position set by a non-relative spring. durch ein nicht-relativen Ursprung relativ zur Mausposition sein wird. - + Relative Relativ - + Mouse Status - + X: X: - - + + 0 (0 pps) - + Y: Y: - - + + 1 = 1 notch(es)/s 1 = 1 Raste - + Enhanced: Three tier curve that makes the mouse move slow on the low end of an axis and fast on the high end. @@ -4641,19 +4670,19 @@ a period of time using a Cubic curve. - + Hori&zontal Speed: - + &Vertical Speed: - + Wheel Vert. Speed: Rad-Gesch @@ -4664,39 +4693,39 @@ vertikal: Empfindlichkeit: - + Specifies the amount of time (in seconds) that will be required before the mouse is fully accelerated after reaching the high end of an axis. - - - - + + + + % - + Extend the time that extra acceleration is applied. Axis travel will be taken into account. A slower flick will decrease the actual time that extra acceleration will be applied. - + Spring Settings Sprungeinstellungen - + Spring Width: Sprungweite: - + Changes the width of the region that the cursor can move in spring mode. 0 will use the entire width of your screen. @@ -4705,12 +4734,12 @@ im Sprungmodus zurück legt. 0 wird die gesamte Breite auf Ihrem Bildschirm nutzen. - + Spring Height: Sprunghöhe: - + Changes the height of the region that the cursor can move in spring mode. 0 will use the entire height of your screen. @@ -4719,8 +4748,8 @@ im Sprungmodus zurück legt. 0 wird die gesamte Höhe auf Ihrem Bildschirm nutzen. - - + + %n notch(es)/s %n notch/s @@ -4731,39 +4760,39 @@ auf Ihrem Bildschirm nutzen. QKeyDisplayDialog - + Key Checker Tastenkontrolle - - <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> + + <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="http://doc.qt.io/qt-5/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">http://doc.qt.io/qt-5/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> - + Event Handler: - + Native Key Value: Nativer Tastenwert: - - - + + + 0x00000000 0x00000000 - + Qt Key Value: Qt-Tastenwert: - + antimicro Key Value: @@ -4771,260 +4800,260 @@ auf Ihrem Bildschirm nutzen. QObject - + Super Super - + Menu Menü - + Mute Stummschalten - + Vol+ - + Vol- - + Play/Pause Wiedergabe/Pause - + Play Wiedergabe - + Pause - + Prev Zurück - + Next Vor - + Mail EMail - + Home Pos1 - + Media - + Search Suche - + Daemon launched Dienst gestartet - + Failed to launch daemon Dienst konnte nicht gestartet werden - + Launching daemon Starte Dienst - - + + Display string "%1" is not valid. - + Failed to set a signature id for the daemon Signatur-ID konnte für den Dienst nicht gesetzt werden - + Failed to change working directory to / Arbeitsverzeichnis konnte nicht gesetzt werden zu / - + Quitting Program Beende Programm - + # of joysticks found: %1 # an Joysticks gefunden: %1 - + List Joysticks: - + --------------- - + Joystick %1: - + Index: %1 - + GUID: %1 - + Name: %1 - + Yes Ja - + No Nein - + Game Controller: %1 - + # of Axes: %1 # der Achsen: %1 - + # of Buttons: %1 # der Knöpfe: %1 - + # of Hats: %1 # der Hats: %1 - + Attempting to use fallback option %1 for event generation. Versuche Fallback-Option %1 zur Ereignisgenerierung. - + Failed to open event generator. Exiting. Öffnen des Ereignisgenerators fehlgeschlagen. Breche ab. - + Using %1 as the event generator. Nutze %1 als Ereignisgenerator. - + Could not raise process priority. Konnte Prozesspriorität nicht erhöhen. - + Last button - + There isn't a last button pressed from gamepad in data. Did you set at least one button from gamepad for keyboard? - + Active window changed to: Title = "%1", Class = "%2", Program = "%3" or "%4". - + Profile location %1 is not an XML file. Profilort %1 ist keine XML Datei. - + Profile location %1 does not exist. Profilort %1 existiert nicht. - - - + + + Controller identifier is not a valid value. Controllernummer ist keine gültige Ziffer. - + An invalid set number '%1' was specified. - + Controller identifier '%s'' is not a valid value. - + No set number was specified. Kein Set gewählt. - + No controller was specified. Kein Controller wurde spezifiert. - + No display string was specified. - + An invalid event generator was specified. Ein ungültiger Ereignisgenerator wurde angegeben. - + No event generator string was specified. Kein Ereignesgenerator String wurde angegeben. @@ -5033,7 +5062,7 @@ auf Ihrem Bildschirm nutzen. Qt style Parameter erkannt, aber kein Style spezifiziert. - + No log file specified. @@ -5138,22 +5167,22 @@ auf Ihrem Bildschirm nutzen. Controller Index oder GUID sein. - + Logging started - + Auto-switching to profile "%1". - + Auto-switching to nullptr profile! - + xinput version must be at least 2.0. No mouse acceleration changes will occur. xinput Version muss mindestens 2.0 sein. Es wird keine Mausbeschleunigungsänderungen geben. @@ -5161,18 +5190,18 @@ auf Ihrem Bildschirm nutzen. QuickSetDialog - + Quick Set Schnellkonfiguration - + <html><head/><body><p>Please press a button or move an axis on %1 (<span style=" font-weight:600;">%2</span>).<br/>A dialog window will then appear which will<br/>allow you to make an assignment.</p></body></html> <html><head/><body><p>Bitte drücken Sie eine Taste oder bewegen Sie eine Achse auf %1 (<span style=" font-weight:600;">%2</span>).<br/>Dann erscheint ein Dialogfenter, dass Ihnen <br>erlaubt eine Zuordnung zu machen.</p></body></html> - - + + Quick Set %1 Schnellkonfiguration %1 @@ -5180,12 +5209,12 @@ auf Ihrem Bildschirm nutzen. SetAxisThrottleDialog - + Throttle Change Schubänderung - + The throttle setting for Axis %1 has been changed. Would you like to distribute this throttle change to all sets? @@ -5197,12 +5226,12 @@ Möchten Sie die Änderungen an alle Sets übertragen? SetJoystick - + Set %1: %2 Set %1: %2 - + Set %1 Set %1 @@ -5210,52 +5239,52 @@ Möchten Sie die Änderungen an alle Sets übertragen? SetNamesDialog - + Set Name Settings Setnameneinstellungen - + Set 1 Set 1 - + Set 2 Set 2 - + Set 3 Set 3 - + Set 4 Set 4 - + Set 5 Set 5 - + Set 6 Set 6 - + Set 7 Set 7 - + Set 8 Set 8 - + Name Name @@ -5263,7 +5292,7 @@ Möchten Sie die Änderungen an alle Sets übertragen? SimpleKeyGrabberButton - + Mouse Maus @@ -5271,7 +5300,7 @@ Möchten Sie die Änderungen an alle Sets übertragen? SpringModeRegionPreview - + Spring Mode Preview Sprungmodus-Vorschau @@ -5279,7 +5308,7 @@ Möchten Sie die Änderungen an alle Sets übertragen? UInputEventHandler - + Could not find a valid uinput device file. Please check that you have the uinput module loaded. lsmod | grep uinput @@ -5288,14 +5317,14 @@ Bitte überprüfen Sie, ob das uinput Modul geladen ist. lsmod | grep uinput - + Could not open uinput device file Please check that you have permission to write to the device Konnte nicht uinput Gerätedatei öffnen Bitte überprüfen Sie ob Sie die Berechtigung haben auf dieses Gerät zu schreiben - + Using uinput device file %1 Nutze uinput Gerätedatei %1 @@ -5303,551 +5332,551 @@ Bitte überprüfen Sie ob Sie die Berechtigung haben auf dieses Gerät zu schrei UInputHelper - + a - + b - + c - + d - + e - + f - + g - + h - + i - + j - + k - + l - + m - + n - + o - + p - + q - + r - + s - + t - + u - + v - + w - + x - + y - + z - + Esc - + F1 - + F2 - + F3 - + F4 - + F5 - + F6 - + F7 - + F8 - + F9 - + F10 - + F11 - + F12 - + ` - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - - + + - - + = - + BackSpace Rücktaste - + Tab Tabulator - + [ - + ] - + \ - + CapsLock Feststell - + ; - + ' - + Enter Eingabe - + Shift_L Umschalt_L - + , - - + + . - - + + / - + Ctrl_L Strg_L - - + + Super_L Super_L - + Alt_L Alt_L - + Space Leertaste - + Alt_R Alt_R - + Menu Menü - + Ctrl_R Strg_R - + Shift_R Umschalt_R - + Up Hoch - + Left Links - + Down Runter - + Right Rechts - + PrtSc Druck - + Ins Einfg - + Del Entf - + Home Pos1 - + End Ende - + PgUp Bild ↑ - + PgDn Bild ↓ - + NumLock - + * - + + - + KP_Enter - + KP_1 - + KP_2 - + KP_3 - + KP_4 - + KP_5 - + KP_6 - + KP_7 - + KP_8 - + KP_9 - + KP_0 - + SCLK Rol ↓ - + Pause Pause - + Super_R - + Mute Stumm - + VolDn Vol- - + VolUp Vol+ - + Play Wiedergabe - + Stop - + Prev Zurück - + Next Vor - + [NO KEY] [KEINE TASTE] @@ -5855,54 +5884,54 @@ Bitte überprüfen Sie ob Sie die Berechtigung haben auf dieses Gerät zu schrei UnixWindowInfoDialog - + Captured Window Properties Erkannte Fenstereigenschaften - + Information About Window Informationen über das Fenster - + Class: Klasse: - - - + + + TextLabel - + Title: Titel: - + Path: Pfad: - + Match By Properties - + Class Klasse - + Title Titel - + Path Pfad @@ -5910,9 +5939,9 @@ Bitte überprüfen Sie ob Sie die Berechtigung haben auf dieses Gerät zu schrei VDPad - - - + + + VDPad VDPad @@ -5920,224 +5949,224 @@ Bitte überprüfen Sie ob Sie die Berechtigung haben auf dieses Gerät zu schrei VirtualKeyPushButton - + Space Leertaste - + Tab - + Shift (L) Umschalt (L) - + Shift (R) Umschalt (R) - + Ctrl (L) Strg (L) - + Ctrl (R) Strg (R) - + Alt (L) Alt (L) - - + + Alt (R) Alt (R) - + Alt Gr - + ` - + ~ - - + + - - + = - + [ - + ] - + \ - + Caps Feststell - + ; - + ' - + , - - + + . - - + + / - + ESC - + PRTSC Drucken - + SCLK Rollen - + INS Einfg - + PGUP Bild ↑ - + DEL Entf - + PGDN Bild ↓ - + 1 - + 2 - + 3 - + 4 - + 5 - + 6 - + 7 - + 8 - + 9 - + 0 - + NUM LK NUM LOCK - - + + * - + + - + Enter Eingabe @@ -6156,42 +6185,42 @@ B E - + < - + : - + Super (L) - + Menu Menü - + Up Hoch - + Down Runter - + Left Links - + Right Rechts @@ -6199,226 +6228,226 @@ E VirtualKeyboardMouseWidget - - + + Keyboard Tastatur - - + + Mouse Maus - + Mouse Settings Mauseinstellungen - + Left Mouse Links - + Up Mouse Hoch - + Left Button Mouse Linke Taste - + Middle Button Mouse Mittlere Taste - + Right Button Mouse Rechte Taste - + Wheel Up Mouse Mausrad hoch - + Wheel Left Mouse Mausrad links - + Wheel Right Mouse Mausrad rechts - + Wheel Down Mouse Mausrad runter - + Down Mouse Runter - + Right Mouse Rechts - + Button 4 Mouse Taste 4 - + Mouse 8 Mouse Taste 8 - + Button 5 Mouse Taste 5 - + Mouse 9 Mouse Taste 9 - + NONE KEINE - - + + Last button - - + + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + Others - + Applications - + Browser Back - + Browser Favorites - + Browser Forward - + Browser Home - + Browser Refresh - + Browser Search - + Browser Stop - + Calc - + Email - + Media - + Media Next - + Media Play - + Media Previous - + Media Stop - + Search Suche - + Volume Down - + Volume Mute - + Volume Up @@ -6426,7 +6455,7 @@ E VirtualMousePushButton - + INVALID UNGÜLTIG @@ -6434,28 +6463,28 @@ E WinAppProfileTimerDialog - - + + Capture Application Wähle Applikation - + After pressing the "Capture Application" button, please select the application window that you want to have a profile associated with. The active application will be captured after the selected number of seconds. Wählen Sie das Fenster aus mit dem Sie das Profil assozieren möchten, nachdem Sie auf den "Wähle Applikation" Button geklickt haben. Die aktive Applikation wird nach der angegebenen Zahl an Sekunden ausgewählt. - + Timer: - + Seconds Sekunden - + Cancel Abbrechen @@ -6463,12 +6492,12 @@ E WinExtras - + [NO KEY] [KEINE TASTE] - + AntiMicro Profile @@ -6476,67 +6505,66 @@ E X11Extras - + ESC - + Tab Tabulator - + Space Leertaste - + DEL Entf - + Return Eingabe - + KP_Enter - + Backspace Rücktaste - + Alt Gr - + xinput extension was not found. No mouse acceleration changes will occur. xinput Erweiterung wurde nicht gefunden. Es wird keine Mausbeschleunigungsänderungen geben. - + xinput version must be at least 2.0. No mouse acceleration changes will occur. xinput Version muss mindestens 2.0 sein. Es wird keine Mausbeschleunigungsänderungen geben. - Virtual pointer found with id=%1. - Virtueller Mauszeiger mit id=%1 gefunden. + Virtueller Mauszeiger mit id=%1 gefunden. - + PtrFeedbackClass was not found for virtual pointer.No change to mouse acceleration will occur for device with id=%1 PtrFeedbackCalls wurde nicht für den virtuellen Mauszeiger gefunden. Es wird keine Mausbeschleunigungsänderungen für das Gerät mit id=%1 geben - + Changing mouse acceleration for device with id=%1 Ändere Mausbeschleunigung für Gerät der id=%1 @@ -6544,7 +6572,7 @@ E XMLConfigReader - + Could not write updated profile XML to file %1. Konnte aktuelles Profil nicht als XML in Datei %1 schreiben. @@ -6552,7 +6580,7 @@ E XMLConfigWriter - + Could not write to profile at %1. Konnte Profil nicht schreiben in %1. @@ -6560,7 +6588,7 @@ E antimicro - + Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support. @@ -6568,97 +6596,97 @@ E main - + Launch program in system tray only. Nur im Systemtray starten. - + Launch program with the tray menu disabled - + Launch program without the main window displayed - + Launch program with the configuration file selected as the default for selected controllers. Defaults to all controllers - + location - + Apply configuration file to a specific controller. Value can be a controller index, name, or GUID - + value - + Unload currently enabled profile(s) - + value(s) - + Start joysticks on a specific set. Value can be a controller index, name, or GUID - + number value - + Launch program as a daemon. Use only on Linux. - + Enable logging - + log-type - + Choose a file for logs writing - + filename - + Choose between using XTest support and uinput support for event generation. Use only if you have enabled xtest and uinput options on Linux or vmulti on Windows. Default: xtest. - + event-generation-type - + Print information about joysticks detected by SDL. Use only if you have sdl library. You can check your controller index, name or even GUID. diff --git a/share/antimicro/translations/antimicro_en.ts b/share/antimicro/translations/antimicro_en.ts old mode 100644 new mode 100755 index 450c8a188..a5aea5c32 --- a/share/antimicro/translations/antimicro_en.ts +++ b/share/antimicro/translations/antimicro_en.ts @@ -4,17 +4,17 @@ AboutDialog - + About About - + Version Version - + "juliagoda" (since March, 2018) Wanting only to play my favourite old games that din't support gamepads, I found this project (which map keyboard keys and mouse buttons to connected gamepads on Linux) as most proper and recent. But because of poor choices of such application on the internet and since it didn't compile properly, I decided to rescue the project. However, once I finished my work (enough to enjoy playing games) I thought about sharing this code with others. Of course all informations about past programmers will be held. "Ryochan7" (since December 30, 2012 until 2017), I have been working on antimicro in my spare time. What originally started as a fork of QJoyPad and a way to learn proper event-driven programming has turned into something much bigger than I originally intended. Although I have spent a lot of time learning new techniques, finding out more about the domain of KB+M emulation, and spending Friday nights bashing my head against my keyboard, it has been a fun and enriching experience overall. @@ -45,17 +45,17 @@ As of May 24, 2016, this project has moved to https://github.com/AntiMicro/antim - + Copyright: 2013 - 2018 Copyright: 2013 - 2018 - + Info Info - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -138,7 +138,7 @@ p, li { white-space: pre-wrap; } <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"><br /></p></body></html> - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -368,57 +368,57 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif';">If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.</span></p></body></html> - + Changelog Changelog - + Credits Credits - + antimicro antimicro - + About Development About Development - + License License - + Program Version %1 Program Version %1 - + Program Compiled on %1 at %2 Program Compiled on %1 at %2 - + Built Against SDL %1 Built Against SDL %1 - + Running With SDL %1 Running With SDL %1 - + Using Qt %1 Using Qt %1 - + Using Event Handler: %1 Using Event Handler: %1 @@ -426,29 +426,29 @@ p, li { white-space: pre-wrap; } AddEditAutoProfileDialog - + Auto Profile Dialog Auto Profile Dialog - + Profile: Profile: - - + + Browse Browse - + Window: Window: - - + + Select Window. Click on the appropriate application window and the application file path will be populated in the form. @@ -457,38 +457,47 @@ window and the application file path will be populated in the form. - + Detect Window Properties Detect Window Properties - + Class: Class: - + Title: Title: - + + set partial title + set partial title + + + Application: Application: - + Select Select - + + De&vices: + De&vices: + + Devices: - Devices: + Devices: - - + + Select this profile to be the default loaded for the specified device. The selection will be used instead of the all default profile option. @@ -497,84 +506,84 @@ the specified device. The selection will be used instead of the all default profile option. - + Set as Default for Controller Set as Default for Controller - - + + A different profile is already selected as the default for this device. A different profile is already selected as the default for this device. - + Current (%1) Current (%1) - + Open Config Open Config - - + + Select Program Select Program - + Programs (*.exe) Programs (*.exe) - + Please use the main default profile selection. Please use the main default profile selection. - + Please select a window by using the mouse. Press Escape if you want to cancel. Please select a window by using the mouse. Press Escape if you want to cancel. - + Capture Application Window Capture Application Window - + Could not obtain information for the selected window. Could not obtain information for the selected window. - + Application Capture Failed Application Capture Failed - + Profile file path is invalid. Profile file path is invalid. - + No window matching property was specified. No window matching property was specified. - + Program path is invalid or not executable. Program path is invalid or not executable. - + File is not an .exe file. File is not an .exe file. - + No window matching property was selected. No window matching property was selected. @@ -582,502 +591,502 @@ of the all default profile option. AdvanceButtonDialog - - + + Advanced Advanced - + Assignments Assignments - + Toggle Toggle - + Turbo Turbo - + Set Selector Set Selector - + Blank or KB/M Blank or KB/M - + Hold Hold - + Pause Pause - + Cycle Cycle - + Distance Distance - + Insert Insert - + Delete Delete - + Clear All Clear All - + Time: Time: - + 0.01s 0.01s - + 0s 0s - + Insert a pause that occurs in between key presses. Insert a pause that occurs in between key presses. - + Release Release - - + + Insert a new blank slot. Insert a new blank slot. - + Delete a slot. Delete a slot. - + Clear all currently assigned slots. Clear all currently assigned slots. - + Specify the duration of an inserted Pause or Hold slot. Specify the duration of an inserted Pause or Hold slot. - + 0m 0m - + &Mouse Speed Mod: &Mouse Speed Mod: - - + + Specify the range past an axis dead zone in which a sequence of actions will execute. Specify the range past an axis dead zone in which a sequence of actions will execute. - + Distance: Distance: - - + + % % - + Mouse Mod Mouse Mod - + Press Time Press Time - + Delay Delay - + Execute Execute - + Load Load - + Set Change Set Change - + Text Entry Text Entry - + Placeholder Placeholder - - + + 0 0 - + Set the percentage that mouse speeds will be modified by. Set the percentage that mouse speeds will be modified by. - + Auto Reset Cycle After Auto Reset Cycle After - + seconds seconds - + Executable: Executable: - + ... ... - + Arguments: Arguments: - - - + + + Enabled Enabled - + Mode: Mode: - + <html><head/><body><p>Normal: Repeatedly press and release a button by the chosen rate.</p><p>Gradient: Modify the button press and button release delay based on how far an axis has been moved. The rate will remain the same.</p><p>Pulse: Modify how many times a button is pressed and released per second. The button delay will remain the same.</p></body></html> <html><head/><body><p>Normal: Repeatedly press and release a button by the chosen rate.</p><p>Gradient: Modify the button press and button release delay based on how far an axis has been moved. The rate will remain the same.</p><p>Pulse: Modify how many times a button is pressed and released per second. The button delay will remain the same.</p></body></html> - + Normal Normal - + Gradient Gradient - + Pulse Pulse - + Delay: Delay: - + 0.10s 0.10s - + Rate: Rate: - + 10.0/s 10.0/s - - + + Disabled Disabled - + Select Set 1 One Way Select Set 1 One Way - + Select Set 1 Two Way Select Set 1 Two Way - + Select Set 1 While Held Select Set 1 While Held - + Select Set 2 One Way Select Set 2 One Way - + Select Set 2 Two Way Select Set 2 Two Way - + Select Set 2 While Held Select Set 2 While Held - + Select Set 3 One Way Select Set 3 One Way - + Select Set 3 Two Way Select Set 3 Two Way - + Select Set 3 While Held Select Set 3 While Held - + Select Set 4 One Way Select Set 4 One Way - + Select Set 4 Two Way Select Set 4 Two Way - + Select Set 4 While Held Select Set 4 While Held - + Select Set 5 One Way Select Set 5 One Way - + Select Set 5 Two Way Select Set 5 Two Way - + Select Set 5 While Held Select Set 5 While Held - + Select Set 6 One Way Select Set 6 One Way - + Select Set 6 Two Way Select Set 6 Two Way - + Select Set 6 While Held Select Set 6 While Held - + Select Set 7 One Way Select Set 7 One Way - + Select Set 7 Two Way Select Set 7 Two Way - + Select Set 7 While Held Select Set 7 While Held - + Select Set 8 One Way Select Set 8 One Way - + Select Set 8 Two Way Select Set 8 Two Way - + Select Set 8 While Held Select Set 8 While Held - + sec. sec. - + /sec. /sec. - + Set %1 Set %1 - - + + Select Set %1 Select Set %1 - + One Way One Way - + Two Way Two Way - + While Held While Held - + Choose Executable Choose Executable - + Slots past a Cycle action will be executed on the next button press. Multiple cycles can be added in order to create partitions in a sequence. Slots past a Cycle action will be executed on the next button press. Multiple cycles can be added in order to create partitions in a sequence. - + Delays the time that the next slot is activated by the time specified. Slots activated before the delay will remain active after the delay time has passed. Delays the time that the next slot is activated by the time specified. Slots activated before the delay will remain active after the delay time has passed. - + Distance action specifies that the slots afterwards will only be executed when an axis is moved a certain range past the designated dead zone. Distance action specifies that the slots afterwards will only be executed when an axis is moved a certain range past the designated dead zone. - + Insert a hold action. Slots after the action will only be executed if the button is held past the interval specified. Insert a hold action. Slots after the action will only be executed if the button is held past the interval specified. - + Chose a profile to load when this slot is activated. Choose a profile to load when this slot is activated. - + Mouse mod action will modify all mouse speed settings by a specified percentage while the action is being processed. This can be useful for slowing down the mouse while sniping. Mouse mod action will modify all mouse speed settings by a specified percentage while the action is being processed. This can be useful for slowing down the mouse while sniping. - + Specify the time that keys past this slot should be held down. Specify the time that keys past this slot should be held down. - + Insert a release action. Slots after the action will only be executed after a button release if the button was held past the interval specified. Insert a release action. Slots after the action will only be executed after a button release if the button was held past the interval specified. - + Change to selected set once slot is activated. Change to selected set once slot is activated. - + Full string will be typed when a slot is activated. Full string will be typed when a slot is activated. - + Execute program when slot is activated. Execute program when slot is activated. - - + + Choose Profile Choose Profile - + Config Files (*.amgp *.xml) Config Files (*.amgp *.xml) @@ -1085,157 +1094,157 @@ of the all default profile option. AdvanceStickAssignmentDialog - + Stick/Pad Assignment Stick/Pad Assignment - + Sticks Sticks - + DPads DPads - - + + %1 (Joystick %2) %1 (Joystick %2) - + Stick 1 Stick 1 - - - + + + Enabled Enabled - - - - - - + + + + + + Assign Assign - - + + X Axis: X Axis: - - + + Y Axis: Y Axis: - + Stick 2 Stick 2 - + Number of Physical DPads: %1 Number of Physical DPads: %1 - + Virtual DPad 1 Virtual DPad 1 - + Up: Up: - + Down: Down: - + Note: This window is meant for backwards compatibility with profiles made before antimicro 2.0. Since version 2.0, use of the Game Controller Mapping window is preferred. Note: This window is meant for backwards compatibility with profiles made before antimicro 2.0. Since version 2.0, use of the Game Controller Mapping window is preferred. - + Left: Left: - + Right: Right: - - - - + + + + Axis %1 Axis %1 - - - - + + + + Axis %1 - Axis %1 - - - - - + + + + Axis %1 + Axis %1 + - - - - + + + + Button %1 Button %1 - + Move stick 1 along the X axis Move stick 1 along the X axis - + Move stick 1 along the Y axis Move stick 1 along the Y axis - + Move stick 2 along the X axis Move stick 2 along the X axis - + Move stick 2 along the Y axis Move stick 2 along the Y axis - - - - + + + + Press a button or move an axis Press a button or move an axis @@ -1243,181 +1252,181 @@ of the all default profile option. AxisEditDialog - + Axis Axis - - + + Mouse (Horizontal) Mouse (Horizontal) - - + + Mouse (Inverted Horizontal) Mouse (Inverted Horizontal) - - + + Mouse (Vertical) Mouse (Vertical) - - + + Mouse (Inverted Vertical) Mouse (Inverted Vertical) - - + + Arrows: Up | Down Arrows: Up | Down - - + + Arrows: Left | Right Arrows: Left | Right - - + + Keys: W | S Keys: W | S - - + + Keys: A | D Keys: A | D - - + + NumPad: KP_8 | KP_2 NumPad: KP_8 | KP_2 - - + + NumPad: KP_4 | KP_6 NumPad: KP_4 | KP_6 - - - + + + None None - - + + Set the value to use as the limit for an axis. Useful for a worn out analog stick. Set the value to use as the limit for an axis. Useful for a worn out analog stick. - + Negative Half Throttle Negative Half Throttle - + Positive Half Throttle Positive Half Throttle - + Name: Name: - + Specify the name of an axis. Specify the name of an axis. - + Mouse Settings Mouse Settings - - + + Set the value of the dead zone for an axis. Set the value of the dead zone for an axis. - + Presets: Presets: - + Dead Zone: Dead Zone: - + Max Zone: Max Zone: - - + + [NO KEY] [NO KEY] - + Throttle setting that determines the behavior of how to interpret an axis hold or release. Throttle setting that determines the behavior of how to interpret an axis hold or release. - + Negative Throttle Negative Throttle - + Normal Normal - + Positive Throttle Positive Throttle - + Current Value: Current Value: - + Set Set - + Set %1 Set %1 - + Left Mouse Button Left Mouse Button - + Right Mouse Button Right Mouse Button @@ -1425,124 +1434,124 @@ interpret an axis hold or release. ButtonEditDialog - + Dialog Dialog - + To make a new assignment, press any keyboard key or click a button in the Keyboard or Mouse tab To make a new assignment, press any keyboard key or click a button in the Keyboard or Mouse tab - + Placeholder Placeholder - + Toggle Toggle - + Enables a key press or release to only occur when a controller button is pressed. Enables a key press or release to only occur when a controller button is pressed. - + Enables rapid key presses and releases. Turbo controller. Enables rapid key presses and releases. Turbo controller. - + Turbo Turbo - + Last keyboard/mouse button: Last keyboard/mouse button: - + Slots Slots - + Na&me: Na&me: - + Specify the name of a button. Specify the name of a button. - + Action: Action: - + Specify the action that will be performed in game while this button is being used. Specify the action that will be performed in game while this button is being used. - + Advanced Advanced - - - + + + Choose your keyboard key Choose your keyboard key - + No button No button - - - - + + + + Last button Last button - + To change settings for last button, it must be at least one assignment from keyboard to gamepad To change settings for last button, it must be at least one assignment from keyboard to gamepad - + To change settings of turbo for last button, it must be at least one assignment from keyboard to gamepad To change settings of turbo for last button, it must be at least one assignment from keyboard to gamepad - + To open advanced dialog, it's needed to map at least one button from keyboard to gamepad To open advanced dialog, it's needed to map at least one button from keyboard to gamepad - + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + As last gamepad button has been set As last gamepad button has been set - + Index %1 Index %1 @@ -1550,65 +1559,68 @@ this button is being used. Calibration - + Form Form - - + + Start calibration Start calibration - + Controller: Controller: - + Sticks: Sticks: - Use settings from jstest-gtk - Use settings from jstest-gtk + Use settings from jstest-gtk - + Reset settings Reset settings - + Cancel Cancel - - + + Save Save - - + + Calibration Calibration - Do you really want to reset settings of current axes? - Do you really want to reset settings of current axes? + Do you really want to reset settings of current axes? + + + + Do you really want to reset settings of current axis? + Do you really want to reset settings of current axis? - + Calibration was saved for the preset. Do you really want to reset settings? Calibration was saved for the preset. Do you really want to reset settings? - + Place the joystick in the center position. It's the part, where often you don't have to move. Just skip it in such situation. @@ -1617,17 +1629,17 @@ It's the part, where often you don't have to move. Just skip it in suc It's the part, where often you don't have to move. Just skip it in such situation. - + Calibrating center Calibrating center - + Start second step Start second step - + Center X: %1 @@ -1636,28 +1648,28 @@ Center X: %1 Center X: %1 - + Center Y: %1 Center Y: %1 - + Place the joystick in the top-left corner many times Place the joystick in the top-left corner many times - - + + Calibrating position Calibrating position - - + + X: %1 @@ -1666,27 +1678,27 @@ X: %1 X: %1 - - + + Y: %1 Y: %1 - + Place the joystick in the bottom-right corner Place the joystick in the bottom-right corner - + Start final step Start final step - + range X: %1 - %2 @@ -1695,14 +1707,14 @@ range X: %1 - %2 range X: %1 - %2 - + range Y: %1 - %2 range Y: %1 - %2 - + deadzone X: %1 @@ -1711,14 +1723,14 @@ deadzone X: %1 deadzone X: %1 - + deadzone Y: %1 deadzone Y: %1 - + ---Calibration done!--- @@ -1727,31 +1739,44 @@ deadzone Y: %1 - + Calibration values have been saved Calibration values have been saved - - + + Dead zone calibration Dead zone calibration - + + You have to move axes to the top-left corner at least five times. + You have to move axes to the top-left corner at least five times. + + + + You have to move axes to the bottom-right corner at least five times. + You have to move axes to the bottom-right corner at least five times. + + + + Do you want to save calibration of current axis? + Do you want to save calibration of current axis? + + You must move X axis to the right at least five times! Keep moving! - You must move X axis to the right at least five times! Keep moving! + You must move X axis to the right at least five times! Keep moving! - You must move X axis to the left at least five times! Keep moving! - You must move X axis to the left at least five times! Keep moving! + You must move X axis to the left at least five times! Keep moving! - - - - + + + + Axis %1 Axis %1 @@ -1759,64 +1784,64 @@ deadzone Y: %1 CapturedWindowInfoDialog - + Captured Window Properties Captured Window Properties - + Information About Window Information About Window - + Class: Class: - - - + + + TextLabel TextLabel - + Title: Title: - + Path: Path: - + Match By Properties Match By Properties - + Class Class - + Title Title - + Path Path - + Full Path Full Path - + File Name File Name @@ -1824,67 +1849,67 @@ deadzone Y: %1 DPadContextMenu - + Mouse (Normal) Mouse (Normal) - + Mouse (Inverted Horizontal) Mouse (Inverted Horizontal) - + Mouse (Inverted Vertical) Mouse (Inverted Vertical) - + Mouse (Inverted Horizontal + Vertical) Mouse (Inverted Horizontal + Vertical) - + Arrows Arrows - + Keys: W | A | S | D Keys: W | A | S | D - + NumPad NumPad - + None None - + Standard Standard - + Eight Way Eight Way - + 4 Way Cardinal 4 Way Cardinal - + 4 Way Diagonal 4 Way Diagonal - + Mouse Settings Mouse Settings @@ -1892,108 +1917,108 @@ deadzone Y: %1 DPadEditDialog - + Dialog Dialog - + Presets: Presets: - + Mouse (Normal) Mouse (Normal) - + Mouse (Inverted Horizontal) Mouse (Inverted Horizontal) - + Mouse (Inverted Vertical) Mouse (Inverted Vertical) - + Mouse (Inverted Horizontal + Vertical) Mouse (Inverted Horizontal + Vertical) - + Arrows Arrows - + Keys: W | A | S | D Keys: W | A | S | D - + NumPad NumPad - + None None - + Dpad Mode: Dpad Mode: - + &Name: &Name: - + 4 Way Cardinal 4 Way Cardinal - + 4 Way Diagonal 4 Way Diagonal - + DPad Delay: DPad Delay: - - + + Time lapsed before a direction change is taken into effect. Time lapsed before a direction change is taken into effect. - + s s - + Specify the name of a dpad. Specify the name of a dpad. - + Mouse Settings Mouse Settings - + Standard Standard - + Standard: 8 region dpad with two direction buttons active when the dpad is in a diagonal region. @@ -2020,17 +2045,17 @@ the cardinal directions of the dpad. Useful for menus. to a diagonal zone. - + Eight Way Eight Way - + Set Set - + Set %1 Set %1 @@ -2038,27 +2063,27 @@ to a diagonal zone. EditAllDefaultAutoProfileDialog - + Default Profile Default Profile - + Profile: Profile: - + Browse Browse - + Open Config Open Config - + Profile file path is invalid. Profile file path is invalid. @@ -2066,29 +2091,29 @@ to a diagonal zone. ExtraProfileSettingsDialog - + Extra Profile Settings Extra Profile Settings - + Key Press Time: Key Press Time: - + 0.00 ms 0.00 ms - + Profile Name: Profile Name: - - - + + + s s @@ -2096,7 +2121,7 @@ to a diagonal zone. GameController - + Game Controller Game Controller @@ -2104,9 +2129,9 @@ to a diagonal zone. GameControllerDPad - - - + + + DPad DPad @@ -2114,187 +2139,187 @@ to a diagonal zone. GameControllerMappingDialog - + Game Controller Mapping Game Controller Mapping - + <html><head/><body><p>antimicro makes use of the <a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;">Game Controller API</span></a> provided by SDL 2 in order to abstract various gamepads to fit a unified standard. In order to make a button assignment, please highlight the mapping cell for the appropriate button row below. You can then press a button or move an axis on your gamepad and the cell will update with the physical button or axis that will be used.</p><p>antimicro will use the mapping that you specify to save a mapping string that will be loaded into SDL.</p></body></html> <html><head/><body><p>antimicro makes use of the <a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;">Game Controller API</span></a> provided by SDL 2 in order to abstract various gamepads to fit a unified standard. In order to make a button assignment, please highlight the mapping cell for the appropriate button row below. You can then press a button or move an axis on your gamepad and the cell will update with the physical button or axis that will be used.</p><p>antimicro will use the mapping that you specify to save a mapping string that will be loaded into SDL.</p></body></html> - + A A - + B B - + X X - + Y Y - + Back Back - + Start Start - + Guide Guide - + Left Shoulder Left Shoulder - + Right Shoulder Right Shoulder - + Left Stick Click Left Stick Click - + Right Stick Click Right Stick Click - + Left Stick X Left Stick X - + Left Stick Y Left Stick Y - + Right Stick X Right Stick X - + Right Stick Y Right Stick Y - + Left Trigger Left Trigger - + Right Trigger Right Trigger - + DPad Up DPad Up - + DPad Left DPad Left - + DPad Down DPad Down - + DPad Right DPad Right - + Mapping Mapping - + SDL 2 Game Controller Mapping String SDL 2 Game Controller Mapping String - + Last Axis Event: Last Axis Event: - + Current Axis Detection Dead Zone: Current Axis Detection Dead Zone: - + 5000 5000 - + 10000 10000 - + 15000 15000 - + 20000 20000 - + 25000 25000 - + 30000 30000 - + 32000 32000 - + Game Controller Mapping (%1) (#%2) Game Controller Mapping (%1) (#%2) - + Discard Controller Mapping? Discard Controller Mapping? - + Discard mapping for this controller? If discarded, the controller will be reverted to a joystick once you refresh all joysticks. @@ -2306,47 +2331,47 @@ If discarded, the controller will be reverted to a joystick once you refresh all GameControllerSet - + Back Back - + Guide Guide - + Start Start - + LS Click LS Click - + RS Click RS Click - + L Shoulder L Shoulder - + R Shoulder R Shoulder - + L Trigger L Trigger - + R Trigger R Trigger @@ -2354,9 +2379,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all GameControllerTrigger - - - + + + Trigger Trigger @@ -2364,9 +2389,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxis - - - + + + Axis Axis @@ -2374,24 +2399,24 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxisButton - + Negative Negative - + Positive Positive - + Unknown Unknown - - - + + + Button Button @@ -2399,74 +2424,74 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxisContextMenu - + Mouse (Horizontal) Mouse (Horizontal) - + Mouse (Inverted Horizontal) Mouse (Inverted Horizontal) - + Mouse (Vertical) Mouse (Vertical) - + Mouse (Inverted Vertical) Mouse (Inverted Vertical) - + Arrows: Up | Down Arrows: Up | Down - + Arrows: Left | Right Arrows: Left | Right - + Keys: W | S Keys: W | S - + Keys: A | D Keys: A | D - + NumPad: KP_8 | KP_2 NumPad: KP_8 | KP_2 - + NumPad: KP_4 | KP_6 NumPad: KP_4 | KP_6 - - + + None None - - + + Mouse Settings Mouse Settings - + Left Mouse Button Left Mouse Button - + Right Mouse Button Right Mouse Button @@ -2474,57 +2499,57 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButton - + Processing turbo for #%1 - %2 Processing turbo for #%1 - %2 - + Finishing turbo for button #%1 - %2 Finishing turbo for button #%1 - %2 - + Processing press for button #%1 - %2 Processing press for button #%1 - %2 - + Processing release for button #%1 - %2 Processing release for button #%1 - %2 - + Distance change for button #%1 - %2 Distance change for button #%1 - %2 - - - + + + Button Button - - - - + + + + [NO KEY] [NO KEY] - + [Set %1 1W] [Set %1 1W] - + [Set %1 2W] [Set %1 2W] - + [Set %1 WH] [Set %1 WH] @@ -2532,47 +2557,47 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButtonContextMenu - + Toggle Toggle - + Turbo Turbo - + Clear Clear - + Set Select Set Select - + Disabled Disabled - + Set %1 Set %1 - + Set %1 1W Set %1 1W - + Set %1 2W Set %1 2W - + Set %1 WH Set %1 WH @@ -2580,118 +2605,118 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButtonSlot - - + + Mouse Mouse - + Up Up - + Down Down - + Left Left - + Right Right - + LB LB - + MB MB - + RB RB - + B4 B4 - + B5 B5 - + Pause Pause - + Hold Hold - + Cycle Cycle - + Distance Distance - + Release Release - + Mouse Mod Mouse Mod - + Press Time Press Time - + Delay Delay - + Load %1 Load %1 - + Set Change %1 Set Change %1 - + [Text] %1 [Text] %1 - + [Exec] %1 [Exec] %1 - + [NO KEY] [NO KEY] @@ -2699,9 +2724,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStick - - - + + + Stick Stick @@ -2709,37 +2734,37 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickButton - - - + + + Up Up - - - + + + Down Down - - - + + + Left Left - - - + + + Right Right - - - + + + Button Button @@ -2747,67 +2772,67 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickContextMenu - + Mouse (Normal) Mouse (Normal) - + Mouse (Inverted Horizontal) Mouse (Inverted Horizontal) - + Mouse (Inverted Vertical) Mouse (Inverted Vertical) - + Mouse (Inverted Horizontal + Vertical) Mouse (Inverted Horizontal + Vertical) - + Arrows Arrows - + Keys: W | A | S | D Keys: W | A | S | D - + NumPad NumPad - + None None - + Standard Standard - + Eight Way Eight Way - + 4 Way Cardinal 4 Way Cardinal - + 4 Way Diagonal 4 Way Diagonal - + Mouse Settings Mouse Settings @@ -2815,86 +2840,86 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickEditDialog - + Dialog Dialog - + X: X: - - - - - + + + + + 0 0 - + Y: Y: - + Distance: Distance: - + Presets: Presets: - + Mouse (Normal) Mouse (Normal) - + Mouse (Inverted Horizontal) Mouse (Inverted Horizontal) - + Mouse (Inverted Vertical) Mouse (Inverted Vertical) - + Mouse (Inverted Horizontal + Vertical) Mouse (Inverted Horizontal + Vertical) - + Arrows Arrows - + Keys: W | A | S | D Keys: W | A | S | D - + NumPad NumPad - + None None - + Stick Mode: Stick Mode: - + Standard: 8 region stick with two direction buttons active when the stick is in a diagonal region. @@ -2921,72 +2946,72 @@ the cardinal directions of the stick. Useful for menus. to a diagonal zone of the stick. - + 4 Way Cardinal 4 Way Cardinal - + 4 Way Diagonal 4 Way Diagonal - - + + Dead zone value to use for an analog stick. Dead zone value to use for an analog stick. - - + + Value when an analog stick is considered moved 100%. Value when an analog stick is considered moved 100%. - - + + The area (in degrees) that each diagonal region occupies. The area (in degrees) that each diagonal region occupies. - + Square Stick: Square Stick: - - + + Percentage to modify a square stick coordinates to confine values to a circle Percentage to modify a square stick coordinates to confine values to a circle - + % % - + Stick Delay: Stick Delay: - - + + Time lapsed before a direction change is taken into effect. Time lapsed before a direction change is taken into effect. - + s s - + Modifier: Modifier: - + Edit button that is active while the stick is active. This button is useful for assigning zones with @@ -2999,68 +3024,68 @@ modifier keys that can be used to assign walk/run functionality to an analog stick. - + PushButton PushButton - + Na&me: Name: Na&me: - + Specify the name of an analog stick. Specify the name of an analog stick. - + Mouse Settings Mouse Settings - + Standard Standard - + Bearing: Bearing: - + % Safe Zone: % Safe Zone: - + Eight Way Eight Way - + Dead Zone: Dead Zone: - + Max Zone: Max Zone: - + Diagonal Range: Diagonal Range: - + Set Set - + Set %1 Set %1 @@ -3068,9 +3093,9 @@ functionality to an analog stick. JoyControlStickModifierButton - - - + + + Modifier Modifier @@ -3078,9 +3103,9 @@ functionality to an analog stick. JoyDPad - - - + + + DPad DPad @@ -3088,37 +3113,37 @@ functionality to an analog stick. JoyDPadButton - - - + + + Up Up - - - + + + Down Down - - - + + + Left Left - - - + + + Right Right - - - + + + Button Button @@ -3126,267 +3151,272 @@ functionality to an analog stick. JoyTabWidget - - - - - - + + + + + + <New> <New> - - + + Remove Remove - - + + Remove configuration from recent list. Remove configuration from recent list. - - + + Load Load - - + + Load configuration file. Load configuration file. - - + + Save Save - - + + Save changes to configuration file. Save changes to configuration file. - - + + Save As Save As - - + + Save changes to a new configuration file. Save changes to a new configuration file. - - + + Sets Sets - + Copy from Set Copy from Set - + Settings Settings - - + + Set 1 Set 1 - - + + Set 2 Set 2 - - + + Set 3 Set 3 - - + + Set 4 Set 4 - - + + Set 5 Set 5 - - + + Set 6 Set 6 - - + + Set 7 Set 7 - - + + Set 8 Set 8 - - + + Stick/Pad Assign Stick/Pad Assign - - + + Controller Mapping Controller Mapping - - + + Quick Set Quick Set - - + + Names Names - - + + Toggle button name displaying. Toggle button name displaying. - - + + Pref Pref - - + + Change global profile settings. Change global profile settings. - - - + + + Reset Reset - - + + Revert changes to the configuration. Reload configuration file. Revert changes to the configuration. Reload configuration file. - + Open Config Open Config - + Config Files (*.amgp *.xml) Config Files (*.amgp *.xml) - - - + + + Config File (*.%1.amgp) Config File (*.%1.amgp) - - + + Do you really want to reset buttons settings for joystick? + Do you really want to reset buttons settings for joystick? + + + + Save Profile Changes? Save Profile Changes? - - + + Changes to the new profile have not been saved. Would you like to save or discard the current profile? Changes to the new profile have not been saved. Would you like to save or discard the current profile? - - + + Changes to the profile "%1" have not been saved. Would you like to save or discard changes to the current profile? Changes to the profile "%1" have not been saved. Would you like to save or discard changes to the current profile? - + Sticks Sticks - - + + DPads DPads - + No buttons have been assigned. Please use Quick Set to assign keys to buttons or disable hiding empty buttons. No buttons have been assigned. Please use Quick Set to assign keys to buttons or disable hiding empty buttons. - - + + Set %1: %2 Set %1: %2 - - + + Set %1 Set %1 - + Copy Set Assignments Copy Set Assignments - + Are you sure you want to copy the assignments and device properties from %1? Are you sure you want to copy the assignments and device properties from %1? - - - + + + Save Config Save Config - - + + Set Set @@ -3394,7 +3424,7 @@ to buttons or disable hiding empty buttons. Joystick - + Joystick Joystick @@ -3402,98 +3432,98 @@ to buttons or disable hiding empty buttons. JoystickStatusWindow - + Properties Properties - + Details Details - + Name: Name: - - - - - - - + + + + + + + %1 %1 - + Number: Number: - + Axes: Axes: - + Buttons: Buttons: - + Hats: Hats: - + GUID: GUID: - + Game Controller: Game Controller: - + Axes Axes - + Buttons Buttons - + Hats Hats - + %1 (#%2) Properties %1 (#%2) Properties - + Axis %1 Axis %1 - + Hat %1 Hat %1 - + No No - + Yes Yes @@ -3501,62 +3531,67 @@ to buttons or disable hiding empty buttons. MainSettingsDialog - + Edit Settings Edit Settings - + General General - + Controller Mappings Controller Mappings - + Language Language - + Auto Profile Auto Profile - + Mouse Mouse - + Advanced Advanced - + + Profile Direc&tory: + Profile Direc&tory: + + + <html><head/><body><p>Specify the default directory that the program should use in file dialogs when loading a profile or saving a new profile.</p></body></html> <html><head/><body><p>Specify the default directory that the program should use in file dialogs when loading a profile or saving a new profile.</p></body></html> - + Recent Profile Count: Recent Profile Count: - + <html><head/><body><p>Number of profiles that can be placed in recent profile list. 0 will result in the program not enforcing a limit on the number of profiles displayed.</p></body></html> <html><head/><body><p>Number of profiles that can be placed in recent profile list. 0 will result in the program not enforcing a limit on the number of profiles displayed.</p></body></html> - + Gamepad Poll Rate: Gamepad Poll Rate: - + Change the poll rate that the program uses to discover new events from gamepads. Defaults to 10 ms. @@ -3571,29 +3606,29 @@ use more CPU power so please test the setting that you use before using antimicro unattended. - + Hide main window when the main window close button is clicked instead of quitting the program. Hide main window when the main window close button is clicked instead of quitting the program. - + Close To Tray Close To Tray - + Have Windows start antimicro at system startup. Have Windows start antimicro at system startup. - + Launch At Windows Startup Launch At Windows Startup - + Display recent profiles for all controllers as a single list in the tray menu. Defaults to using sub-menus. @@ -3602,12 +3637,12 @@ as a single list in the tray menu. Defaults to using sub-menus. - + Single Profile List in Tray Single Profile List in Tray - + Have the program minimize to the taskbar. By default, the program minimizes to the system tray if available. @@ -3616,12 +3651,12 @@ By default, the program minimizes to the system tray if available. - + Minimize to Taskbar Minimize to Taskbar - + This option will cause the program to hide all buttons that have no slots assigned to them. The Quick Set dialog window will have to be used @@ -3632,12 +3667,12 @@ The Quick Set dialog window will have to be used to bring up the edit dialog for gamepad buttons. - + Hide Empty Buttons Hide Empty Buttons - + When the program is launched, open the last known profile that was opened during the previous session. @@ -3646,176 +3681,186 @@ known profile that was opened during the previous session. - + Auto Load Last Opened Profile Auto Load Last Opened Profile - + Only show the system tray icon when the program first launches. Only show the system tray icon when the program first launches. - + Launch in Tray Launch in Tray - + Associate .amgp files with antimicro in Windows Explorer. Associate .amgp files with antimicro in Windows Explorer. - + Associate Profiles Associate Profiles - + Key Repeat Key Repeat - + Active keys will be repeatedly pressed when this option is enabled. Active keys will be repeatedly pressed when this option is enabled. - - + + Enable Enable - + Specifies how much time should elapse before key repeating begins. Specifies how much time should elapse before key repeating begins. - + Specifies how many times key presses will be performed per seconds. Specifies how many times key presses will be performed per seconds. - + <html><head/><body><p>antimicro has been translated into many different languages by contributors. By default, the program will choose an appropriate translation based on your system's locale setting. However, you can make antimicro load a different translation depending on the language that you choose from the list below.</p></body></html> <html><head/><body><p>antimicro has been translated into many different languages by contributors. By default, the program will choose an appropriate translation based on your system's locale setting. However, you can make antimicro load a different translation depending on the language that you choose from the list below.</p></body></html> - + Português do Brasil Português do Brasil - + Français Français - + Deutsch Deutsch - + Italiano Italiano - + 日本語 日本語 - + Русский Русский - + српски / srpski српски / srpski - + 简体中文 简体中文 - + Español Español - + українська українська - + Polski Polski - + + History Si&ze: + History Si&ze: + + + Log File: Log File: - + Log Level: Log Level: - + None None - + Error Error - + Warning Warning - + Info Info - + Debug Debug - + + Reset + Reset + + + Class Class - + Title Title - + Program Program - + Disable the "Enhanced Pointer Precision" Windows setting while antimicro is running. Disabling "Enhanced Pointer Precision" will allow mouse movement within antimicro to be more @@ -3826,32 +3871,31 @@ will allow mouse movement within antimicro to be more precise. - + Disable Enhance Pointer Precision Disable Enhance Pointer Precision - + Smoothing Smoothing - Histor&y Size: - Histor&y Size: + Histor&y Size: - + Weight &Modifier: Weight &Modifier: - + Refresh Rate: Refresh Rate: - + The refresh rate is the amount of time that will elapse in between mouse events. Please be cautious when editing this setting as it will cause the program to use @@ -3866,17 +3910,17 @@ system instability. Please test the setting before using it unattended. - + Spring Spring - + Screen: Screen: - + Utilize the specified screen for spring mode. On Linux, the default is to use the primary screen. On Windows, the default is to use all available screens. @@ -3885,29 +3929,29 @@ default is to use the primary screen. On Windows, the default is to use all available screens. - + Accel Numerator: Accel Numerator: - - - + + + 0 0 - + Accel Denominator: Accel Denominator: - + Accel Threshold: Accel Threshold: - + If the acceleration values for the virtual mouse have been changed by a different process, particularly when quitting an older game, then you might want to reset the acceleration @@ -3918,37 +3962,36 @@ an older game, then you might want to reset the acceleration values used by the virtual mouse. - + Reset Acceleration Reset Acceleration - + Delay: Delay: - Profi&le Directory: - Profi&le Directory: + Profi&le Directory: - + ms ms - + Rate: Rate: - + times/s times/s - + Below is a list of the custom mappings that have been saved. You can use the following table to delete mappings or have mappings temporarily disabled. You can also disable mappings that are included with SDL; just insert a new row with the appropriate joystick GUID and check disable. Settings will not take affect until you either refresh all joysticks or unplug that particular joystick. @@ -3957,86 +4000,86 @@ Settings will not take affect until you either refresh all joysticks or unplug t Settings will not take affect until you either refresh all joysticks or unplug that particular joystick. - + GUID GUID - + Mapping String Mapping String - + Disable? Disable? - - + + Delete Delete - + Insert Insert - - + + Default Default - + English English - - + + Active Active - + Devices: Devices: - - + + All All - + Device Device - + Profile Profile - + Default? Default? - + Add Add - + Edit Edit - + Also, Windows users who want to use a low value should also check the "Disable Enhance Pointer Precision" checkbox if you haven't disabled the option in Windows. @@ -4045,206 +4088,216 @@ the option in Windows. the option in Windows. - + Select Default Profile Directory Select Default Profile Directory - + Are you sure you want to delete the profile? Are you sure you want to delete the profile? - + Save Log File As Save Log File As - + Log Files (*.log) Log Files (*.log) + + + Do you really want to reset setting? + Do you really want to reset setting? + + + + Would you like to reset mappings too? + Would you like to reset mappings too? + MainWindow - + antimicro antimicro - + No Joysticks have been found. Please plug in a joystick and then choose the "Update Joysticks" option in the main menu No Joysticks have been found. Please plug in a joystick and then choose the "Update Joysticks" option in the main menu - + If events are not seen by a game, please click here to run this application as Administrator. If events are not seen by a game, please click here to run this application as Administrator. - + &App &App - + &Options &Options - + &Help &Help - - + + &Quit &Quit - + Ctrl+Q Ctrl+Q - - + + &Update Joysticks &Update Joysticks - + Ctrl+U Ctrl+U - - + + &Hide &Hide - + Ctrl+H Ctrl+H - + &About &About - + Ctrl+A Ctrl+A - + About &Qt About &Qt - + &Properties &Properties - + &Key Checker &Key Checker - + &GitHub Page &GitHub Page - + &Game Controller Mapping &Game Controller Mapping - + S&ettings S&ettings - + &Stick/Pad Assign &Stick/Pad Assign - + &Wiki &Wiki - + &Issues - + &Issues - + &Calibration - + &Calibration Issues Issues - + Home Page Home Page - + Could not find a proper controller identifier. Exiting. Could not find a proper controller identifier. Exiting. - - - - - - - + + + + + + + (%1) (%1) - - + + Open File Open File - + &Restore &Restore - + Calibration couldn't be opened - + Calibration couldn't be opened - + You must connect at least one controller to open the window - + You must connect at least one controller to open the window - + Run as Administrator? Run as Administrator? - + Are you sure that you want to run this program as Adminstrator? Some games run as Administrator which will cause events generated by antimicro to not be used by those games unless antimicro is also run as the Adminstrator. This is due to permission problems caused by User Account Control (UAC) options in Windows Vista and later. @@ -4253,17 +4306,17 @@ Some games run as Administrator which will cause events generated by antimicro t Some games run as Administrator which will cause events generated by antimicro to not be used by those games unless antimicro is also run as the Adminstrator. This is due to permission problems caused by User Account Control (UAC) options in Windows Vista and later. - + Failed to elevate program Failed to elevate program - + Failed to restart this program as the Administrator Failed to restart this program as the Administrator - + Could not find controller. Exiting. Could not find controller. Exiting. @@ -4271,12 +4324,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseAxisSettingsDialog - + Mouse Settings - Mouse Settings - - + Set %1 Set %1 @@ -4284,12 +4337,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseButtonSettingsDialog - + Mouse Settings - Mouse Settings - - + Set %1 Set %1 @@ -4297,12 +4350,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseControlStickSettingsDialog - + Mouse Settings Mouse Settings - + Set %1 Set %1 @@ -4310,12 +4363,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseDPadSettingsDialog - + Mouse Settings Mouse Settings - + Set %1 Set %1 @@ -4323,17 +4376,17 @@ Some games run as Administrator which will cause events generated by antimicro t MouseSettingsDialog - + Mouse Settings Mouse Settings - + Mouse Mode: Mouse Mode: - + Cursor mode is used to move the mouse cursor around the screen relative to its current position depending on how much you move an axis @@ -4356,80 +4409,80 @@ be returned to the center of the screen when the axis is moved back to the dead zone. - + Cursor Cursor - + Spring Spring - + Acceleration: Acceleration: - + Enhanced Precision Enhanced Precision - - + + Linear Linear - + Quadratic Quadratic - + Cubic Cubic - + Quadratic Extreme Quadratic Extreme - + Power Function Power Function - + Easing Quadratic Easing Quadratic - + Easing Cubic Easing Cubic - + Mouse Speed Settings Mouse Speed Settings - + Enable to change the horizontal and vertical speed boxes at the same time. Enable to change the horizontal and vertical speed boxes at the same time. - + Change Together Change Together - + Options for adding more acceleration to the mouse movement beyond what the acceleration curve would produce. Acceleration is added based on how quickly an axis is @@ -4444,56 +4497,56 @@ some of the issues of the very limited input range available using typical gamepad analog sticks. - + Delta Acceleration Delta Acceleration - + &Multiplier: &Multiplier: - + Mi&n Threshold: Mi&n Threshold: - - + + 1 = 20 pps 1 = 20 pps - + Wheel Hori. Speed: Wheel Hori. Speed: - + Set the speed used for horizontal mouse wheel movement according to number of simulated notches per second. Set the speed used for horizontal mouse wheel movement according to number of simulated notches per second. - + Set the speed used for vertical mouse wheel movement according to number of simulated notches per second. Set the speed used for vertical mouse wheel movement according to number of simulated notches per second. - + Sensitivit&y: Sensitivit&y: - + For Power Function acceleration curve. Specifies the factor to use for curve sensitivity. When the value is above 1.0, the mouse movement will be accelerated @@ -4504,124 +4557,124 @@ is above 1.0, the mouse movement will be accelerated faster at the low end of an axis. - + Easing Duration: Easing Duration: - - + + s s - + Highest value to accelerate mouse movement by Highest value to accelerate mouse movement by - + x x - + Start %: Start %: - + Acceleration begins at this percentage of the base multiplier Acceleration begins at this percentage of the base multiplier - + Minimum amount of axis travel required for acceleration to begin Minimum amount of axis travel required for acceleration to begin - + Max Threshold: Max Threshold: - + Maximum axis travel before acceleration has reached the multiplier value Maximum axis travel before acceleration has reached the multiplier value - + E&xtra Duration: E&xtra Duration: - + Curve: Curve: - + Ease Out Sine Ease Out Sine - + Ease Out Quad Ease Out Quad - + Ease Out Cubic Ease Out Cubic - + Release Radius: Release Radius: - + Specifies that the spring area will be relative to the mouse position set by a non-relative spring. Specifies that the spring area will be relative to the mouse position set by a non-relative spring. - + Relative Relative - + Mouse Status Mouse Status - + X: X: - - + + 0 (0 pps) 0 (0 pps) - + Y: Y: - - + + 1 = 1 notch(es)/s 1 = 1 notch(es)/s - + Enhanced: Three tier curve that makes the mouse move slow on the low end of an axis and fast on the high end. @@ -4660,28 +4713,28 @@ Easing Cubic: Axis high end is gradually accelerated over a period of time using a Cubic curve. - + Hori&zontal Speed: Hori&zontal Speed: - + &Vertical Speed: &Vertical Speed: - + Wheel Vert. Speed: Wheel Vert. Speed: - + Specifies the amount of time (in seconds) that will be required before the mouse is fully accelerated after reaching the high end of an axis. @@ -4690,15 +4743,15 @@ be required before the mouse is fully accelerated after reaching the high end of an axis. - - - - + + + + % % - + Extend the time that extra acceleration is applied. Axis travel will be taken into account. A slower flick will decrease the actual time that extra acceleration will be applied. @@ -4707,17 +4760,17 @@ will be taken into account. A slower flick will decrease the actual time that extra acceleration will be applied. - + Spring Settings Spring Settings - + Spring Width: Spring Width: - + Changes the width of the region that the cursor can move in spring mode. 0 will use the entire width of your screen. @@ -4726,12 +4779,12 @@ can move in spring mode. 0 will use the entire width of your screen. - + Spring Height: Spring Height: - + Changes the height of the region that the cursor can move in spring mode. 0 will use the entire height of your screen. @@ -4740,8 +4793,8 @@ can move in spring mode. 0 will use the entire height of your screen. - - + + %n notch(es)/s %n notch/s @@ -4752,39 +4805,43 @@ of your screen. QKeyDisplayDialog - + Key Checker Key Checker - <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> - <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="https://doc.qt.io/qt-5.10/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-5.10/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> + <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="https://doc.qt.io/qt-5.10/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-5.10/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> + + + + <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="http://doc.qt.io/qt-5/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">http://doc.qt.io/qt-5/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> + <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="http://doc.qt.io/qt-5/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">http://doc.qt.io/qt-5/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> - + Event Handler: Event Handler: - + Native Key Value: Native Key Value: - - - + + + 0x00000000 0x00000000 - + Qt Key Value: Qt Key Value: - + antimicro Key Value: antimicro Key Value: @@ -4792,285 +4849,285 @@ of your screen. QObject - + Super Super - + Menu Menu - + Mute Mute - + Vol+ Vol+ - + Vol- Vol- - + Play/Pause Play/Pause - + Play Play - + Pause Pause - + Prev Prev - + Next Next - + Mail Mail - + Home Home - + Media Media - + Search Search - + Daemon launched Daemon launched - + Failed to launch daemon Failed to launch daemon - + Launching daemon Launching daemon - - + + Display string "%1" is not valid. Display string "%1" is not valid. - + Failed to set a signature id for the daemon Failed to set a signature id for the daemon - + Failed to change working directory to / Failed to change working directory to / - + Quitting Program Quitting Program - + # of joysticks found: %1 # of joysticks found: %1 - + List Joysticks: List Joysticks: - + --------------- --------------- - + Joystick %1: Joystick %1: - + Index: %1 Index: %1 - + GUID: %1 GUID: %1 - + Name: %1 Name: %1 - + Yes Yes - + No No - + Game Controller: %1 Game Controller: %1 - + # of Axes: %1 # of Axes: %1 - + # of Buttons: %1 # of Buttons: %1 - + # of Hats: %1 # of Hats: %1 - + Attempting to use fallback option %1 for event generation. Attempting to use fallback option %1 for event generation. - + Failed to open event generator. Exiting. Failed to open event generator. Exiting. - + Using %1 as the event generator. Using %1 as the event generator. - + Could not raise process priority. Could not raise process priority. - + Last button Last button - + There isn't a last button pressed from gamepad in data. Did you set at least one button from gamepad for keyboard? There isn't a last button pressed from gamepad in data. Did you set at least one button from gamepad for keyboard? - + Active window changed to: Title = "%1", Class = "%2", Program = "%3" or "%4". Active window changed to: Title = "%1", Class = "%2", Program = "%3" or "%4". - + Profile location %1 is not an XML file. Profile location %1 is not an XML file. - + Profile location %1 does not exist. Profile location %1 does not exist. - - - + + + Controller identifier is not a valid value. Controller identifier is not a valid value. - + An invalid set number '%1' was specified. An invalid set number '%1' was specified. - + Controller identifier '%s'' is not a valid value. Controller identifier '%s'' is not a valid value. - + No set number was specified. No set number was specified. - + No controller was specified. No controller was specified. - + No display string was specified. No display string was specified. - + An invalid event generator was specified. An invalid event generator was specified. - + No event generator string was specified. No event generator string was specified. - + No log file specified. No log file specified. - + Logging started Logging started - + Auto-switching to profile "%1". Auto-switching to profile "%1". - + Auto-switching to nullptr profile! Auto-switching to nullptr profile! - + xinput version must be at least 2.0. No mouse acceleration changes will occur. xinput version must be at least 2.0. No mouse acceleration changes will occur. @@ -5078,18 +5135,18 @@ of your screen. QuickSetDialog - + Quick Set Quick Set - + <html><head/><body><p>Please press a button or move an axis on %1 (<span style=" font-weight:600;">%2</span>).<br/>A dialog window will then appear which will<br/>allow you to make an assignment.</p></body></html> <html><head/><body><p>Please press a button or move an axis on %1 (<span style=" font-weight:600;">%2</span>).<br/>A dialog window will then appear which will<br/>allow you to make an assignment.</p></body></html> - - + + Quick Set %1 Quick Set %1 @@ -5097,12 +5154,12 @@ of your screen. SetAxisThrottleDialog - + Throttle Change Throttle Change - + The throttle setting for Axis %1 has been changed. Would you like to distribute this throttle change to all sets? @@ -5114,12 +5171,12 @@ Would you like to distribute this throttle change to all sets? SetJoystick - + Set %1: %2 Set %1: %2 - + Set %1 Set %1 @@ -5127,52 +5184,52 @@ Would you like to distribute this throttle change to all sets? SetNamesDialog - + Set Name Settings Set Name Settings - + Set 1 Set 1 - + Set 2 Set 2 - + Set 3 Set 3 - + Set 4 Set 4 - + Set 5 Set 5 - + Set 6 Set 6 - + Set 7 Set 7 - + Set 8 Set 8 - + Name Name @@ -5180,7 +5237,7 @@ Would you like to distribute this throttle change to all sets? SimpleKeyGrabberButton - + Mouse Mouse @@ -5188,7 +5245,7 @@ Would you like to distribute this throttle change to all sets? SpringModeRegionPreview - + Spring Mode Preview Spring Mode Preview @@ -5196,7 +5253,7 @@ Would you like to distribute this throttle change to all sets? UInputEventHandler - + Could not find a valid uinput device file. Please check that you have the uinput module loaded. lsmod | grep uinput @@ -5205,14 +5262,14 @@ Please check that you have the uinput module loaded. lsmod | grep uinput - + Could not open uinput device file Please check that you have permission to write to the device Could not open uinput device file Please check that you have permission to write to the device - + Using uinput device file %1 Using uinput device file %1 @@ -5220,551 +5277,551 @@ Please check that you have permission to write to the device UInputHelper - + a a - + b b - + c c - + d d - + e e - + f f - + g g - + h h - + i i - + j j - + k k - + l l - + m m - + n n - + o o - + p p - + q q - + r r - + s s - + t t - + u u - + v v - + w w - + x x - + y y - + z z - + Esc Esc - + F1 F1 - + F2 F2 - + F3 F3 - + F4 F4 - + F5 F5 - + F6 F6 - + F7 F7 - + F8 F8 - + F9 F9 - + F10 F10 - + F11 F11 - + F12 F12 - + ` ` - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - - + + - - - + = = - + BackSpace BackSpace - + Tab Tab - + [ [ - + ] ] - + \ \ - + CapsLock CapsLock - + ; ; - + ' ' - + Enter Enter - + Shift_L Shift_L - + , , - - + + . . - - + + / / - + Ctrl_L Ctrl_L - - + + Super_L Super_L - + Alt_L Alt_L - + Space Space - + Alt_R Alt_R - + Menu Menu - + Ctrl_R Ctrl_R - + Shift_R Shift_R - + Up Up - + Left Left - + Down Down - + Right Right - + PrtSc PrtSc - + Ins Ins - + Del Del - + Home Home - + End End - + PgUp PgUp - + PgDn PgDn - + NumLock NumLock - + * * - + + + - + KP_Enter KP_Enter - + KP_1 KP_1 - + KP_2 KP_2 - + KP_3 KP_3 - + KP_4 KP_4 - + KP_5 KP_5 - + KP_6 KP_6 - + KP_7 KP_7 - + KP_8 KP_8 - + KP_9 KP_9 - + KP_0 KP_0 - + SCLK SCLK - + Pause Pause - + Super_R Super_R - + Mute Mute - + VolDn VolDn - + VolUp VolUp - + Play Play - + Stop Stop - + Prev Prev - + Next Next - + [NO KEY] [NO KEY] @@ -5772,54 +5829,54 @@ Please check that you have permission to write to the device UnixWindowInfoDialog - + Captured Window Properties Captured Window Properties - + Information About Window Information About Window - + Class: Class: - - - + + + TextLabel TextLabel - + Title: Title: - + Path: Path: - + Match By Properties Match By Properties - + Class Class - + Title Title - + Path Path @@ -5827,9 +5884,9 @@ Please check that you have permission to write to the device VDPad - - - + + + VDPad VDPad @@ -5837,264 +5894,264 @@ Please check that you have permission to write to the device VirtualKeyPushButton - + Space Space - + Tab Tab - + Shift (L) Shift (L) - + Shift (R) Shift (R) - + Ctrl (L) Ctrl (L) - + Ctrl (R) Ctrl (R) - + Alt (L) Alt (L) - - + + Alt (R) Alt (R) - + Alt Gr Alt Gr - + ` ` - + ~ ~ - - + + - - - + = = - + [ [ - + ] ] - + \ \ - + Caps Caps - + ; ; - + ' ' - + , , - - + + . . - - + + / / - + ESC ESC - + PRTSC PRTSC - + SCLK SCLK - + INS INS - + PGUP PGUP - + DEL DEL - + PGDN PGDN - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - + NUM LK NUM LK - - + + * * - + + + - + Enter Enter - + < < - + : : - + Super (L) Super (L) - + Menu Menu - + Up Up - + Down Down - + Left Left - + Right Right @@ -6102,226 +6159,226 @@ LK VirtualKeyboardMouseWidget - - + + Keyboard Keyboard - - + + Mouse Mouse - + Mouse Settings Mouse Settings - + Left Mouse Left - + Up Mouse Up - + Left Button Mouse Left Button - + Middle Button Mouse Middle Button - + Right Button Mouse Right Button - + Wheel Up Mouse Wheel Up - + Wheel Left Mouse Wheel Left - + Wheel Right Mouse Wheel Right - + Wheel Down Mouse Wheel Down - + Down Mouse Down - + Right Mouse Right - + Button 4 Mouse Button 4 - + Mouse 8 Mouse Mouse 8 - + Button 5 Mouse Button 5 - + Mouse 9 Mouse Mouse 9 - + NONE NONE - - + + Last button Last button - - + + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + Others Others - + Applications Applications - + Browser Back Browser Back - + Browser Favorites Browser Favorites - + Browser Forward Browser Forward - + Browser Home Browser Home - + Browser Refresh Browser Refresh - + Browser Search Browser Search - + Browser Stop Browser Stop - + Calc Calc - + Email Email - + Media Media - + Media Next Media Next - + Media Play Media Play - + Media Previous Media Previous - + Media Stop Media Stop - + Search Search - + Volume Down Volume Down - + Volume Mute Volume Mute - + Volume Up Volume Up @@ -6329,7 +6386,7 @@ LK VirtualMousePushButton - + INVALID INVALID @@ -6337,28 +6394,28 @@ LK WinAppProfileTimerDialog - - + + Capture Application Capture Application - + After pressing the "Capture Application" button, please select the application window that you want to have a profile associated with. The active application will be captured after the selected number of seconds. After pressing the "Capture Application" button, please select the application window that you want to have a profile associated with. The active application will be captured after the selected number of seconds. - + Timer: Timer: - + Seconds Seconds - + Cancel Cancel @@ -6366,12 +6423,12 @@ LK WinExtras - + [NO KEY] [NO KEY] - + AntiMicro Profile AntiMicro Profile @@ -6379,67 +6436,66 @@ LK X11Extras - + ESC ESC - + Tab Tab - + Space Space - + DEL DEL - + Return Return - + KP_Enter KP_Enter - + Backspace Backspace - + Alt Gr Alt Gr - + xinput extension was not found. No mouse acceleration changes will occur. xinput extension was not found. No mouse acceleration changes will occur. - + xinput version must be at least 2.0. No mouse acceleration changes will occur. xinput version must be at least 2.0. No mouse acceleration changes will occur. - Virtual pointer found with id=%1. - Virtual pointer found with id=%1. + Virtual pointer found with id=%1. - + PtrFeedbackClass was not found for virtual pointer.No change to mouse acceleration will occur for device with id=%1 PtrFeedbackClass was not found for virtual pointer.No change to mouse acceleration will occur for device with id=%1 - + Changing mouse acceleration for device with id=%1 Changing mouse acceleration for device with id=%1 @@ -6447,7 +6503,7 @@ LK XMLConfigReader - + Could not write updated profile XML to file %1. Could not write updated profile XML to file %1. @@ -6455,7 +6511,7 @@ LK XMLConfigWriter - + Could not write to profile at %1. Could not write to profile at %1. @@ -6463,7 +6519,7 @@ LK antimicro - + Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support. Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support. @@ -6471,97 +6527,97 @@ LK main - + Launch program in system tray only. Launch program in system tray only. - + Launch program with the tray menu disabled Launch program with the tray menu disabled - + Launch program without the main window displayed Launch program without the main window displayed - + Launch program with the configuration file selected as the default for selected controllers. Defaults to all controllers Launch program with the configuration file selected as the default for selected controllers. Defaults to all controllers - + location location - + Apply configuration file to a specific controller. Value can be a controller index, name, or GUID Apply configuration file to a specific controller. Value can be a controller index, name, or GUID - + value value - + Unload currently enabled profile(s) Unload currently enabled profile(s) - + value(s) value(s) - + Start joysticks on a specific set. Value can be a controller index, name, or GUID Start joysticks on a specific set. Value can be a controller index, name, or GUID - + number value number value - + Launch program as a daemon. Use only on Linux. Launch program as a daemon. Use only on Linux. - + Enable logging Enable logging - + log-type log-type - + Choose a file for logs writing Choose a file for logs writing - + filename filename - + Choose between using XTest support and uinput support for event generation. Use only if you have enabled xtest and uinput options on Linux or vmulti on Windows. Default: xtest. Choose between using XTest support and uinput support for event generation. Use only if you have enabled xtest and uinput options on Linux or vmulti on Windows. Default: xtest. - + event-generation-type event-generation-type - + Print information about joysticks detected by SDL. Use only if you have sdl library. You can check your controller index, name or even GUID. Print information about joysticks detected by SDL. Use only if you have sdl library. You can check your controller index, name or even GUID. diff --git a/share/antimicro/translations/antimicro_es.ts b/share/antimicro/translations/antimicro_es.ts old mode 100644 new mode 100755 index 5f0a4ebb6..0c2f2d9f4 --- a/share/antimicro/translations/antimicro_es.ts +++ b/share/antimicro/translations/antimicro_es.ts @@ -4,17 +4,17 @@ AboutDialog - + About sobre - + Version versión - + "juliagoda" (since March, 2018) Wanting only to play my favourite old games that din't support gamepads, I found this project (which map keyboard keys and mouse buttons to connected gamepads on Linux) as most proper and recent. But because of poor choices of such application on the internet and since it didn't compile properly, I decided to rescue the project. However, once I finished my work (enough to enjoy playing games) I thought about sharing this code with others. Of course all informations about past programmers will be held. "Ryochan7" (since December 30, 2012 until 2017), I have been working on antimicro in my spare time. What originally started as a fork of QJoyPad and a way to learn proper event-driven programming has turned into something much bigger than I originally intended. Although I have spent a lot of time learning new techniques, finding out more about the domain of KB+M emulation, and spending Friday nights bashing my head against my keyboard, it has been a fun and enriching experience overall. @@ -32,17 +32,17 @@ As of May 24, 2016, this project has moved to https://github.com/AntiMicro/antim - + Copyright: 2013 - 2018 Copyright: 2013 - 2016 {2013 ?} {2013 ?} {2018?} - + Info info - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -86,7 +86,7 @@ p, li { white-space: pre-wrap; } - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -204,7 +204,7 @@ p, li { white-space: pre-wrap; } - + Changelog Changelog @@ -229,12 +229,12 @@ Desde entonces, he tratado de averiguar lo que los otros programas hacen la dere Una vez que el control de Steam finalmente se lanzó al público, la necesidad de este programa no podría existir más. Sólo se basa en el concepto del controlador solamete, el controlador de Steam tendría tantas ventajas sobre el uso de un programa como este para proporcionar la emulación KB + M. - + Credits Créditos - + antimicro antimicro @@ -290,42 +290,42 @@ p, li { white-space: pre-wrap; } <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> - + About Development Sobre el desenvolvimiento - + License Licencia - + Program Version %1 Versión del programa %1 - + Program Compiled on %1 at %2 Programa compilado en %1 a %2 - + Built Against SDL %1 - + Running With SDL %1 - + Using Qt %1 Usando Qt %1 - + Using Event Handler: %1 Usando Gestor de Eventos: %1 @@ -333,151 +333,160 @@ p, li { white-space: pre-wrap; } AddEditAutoProfileDialog - + Auto Profile Dialog - + Profile: Perfil: - - + + Browse Navegar - + Window: ventana: - - + + Select Window. Click on the appropriate application window and the application file path will be populated in the form. - + Detect Window Properties - + Class: Clase: - + Title: Título: - + + set partial title + + + + Application: Aplicación: - + Select seleccione - + + De&vices: + + + Devices: - Dispositivos: + Dispositivos: - - + + Select this profile to be the default loaded for the specified device. The selection will be used instead of the all default profile option. - + Set as Default for Controller - - + + A different profile is already selected as the default for this device. - + Current (%1) - + Open Config Abrir Config - - + + Select Program Seleccionar Programa - + Programs (*.exe) Programas (*.exe) - + Please use the main default profile selection. Por favor, utilice la selección principal perfil predeterminado. - + Please select a window by using the mouse. Press Escape if you want to cancel. Por favor, seleccione una ventana utilizando el ratón. Presione Escape si desea cancelar. - + Capture Application Window - + Could not obtain information for the selected window. - + Application Capture Failed - + Profile file path is invalid. La ruta de archivo de perfil es invalido. - + No window matching property was specified. - + Program path is invalid or not executable. - + File is not an .exe file. El Archivo no es un .exe. - + No window matching property was selected. @@ -485,187 +494,187 @@ of the all default profile option. AdvanceButtonDialog - - + + Advanced Avanzado - + Assignments Asignamientos - + Toggle Alternar - + Turbo Turbo - + Set Selector Selector de Set - + Blank or KB/M Vacio o KB/M - + Hold Mantener - + Pause Pausa - + Cycle Ciclo - + Distance Distancia - + Insert Inserir - + Delete Borrar - + Clear All Limpiar todo - + Time: Tiempo: - + 0.01s 0.01s - + 0s 0s - + Insert a pause that occurs in between key presses. Insertar una pausa que se produce en la introducción de la tecla. - + Release Soltar - - + + Insert a new blank slot. Inserte una nueva ranura en blanco. - + Delete a slot. Borrar ranura. - + Clear all currently assigned slots. Limpiar todos los slots asignados actualmente. - + Specify the duration of an inserted Pause or Hold slot. Especificar la duración de una ranura de pausa o de retención insertado. - + 0m 0m - + &Mouse Speed Mod: - - + + Specify the range past an axis dead zone in which a sequence of actions will execute. Especificar el rango más allá de una zona muerta eje en el que una secuencia de acciones se ejecutará. - + Distance: Distancia: - - + + % % - + Mouse Mod Raton Mod - + Press Time Tiempo de presionado - + Delay Retraso - + Execute Ejecutar - + Load Cargar - + Set Change Definir Cambio - + Text Entry Entrada de texto - + Placeholder marcador de posición - - + + 0 0 @@ -674,318 +683,318 @@ of the all default profile option. Velovidad de Ratón Mod: - + Set the percentage that mouse speeds will be modified by. Establecer el porcentaje que las velocidades de ratón serán modificadas por. - + Auto Reset Cycle After Auto Resetear Ciclos Después - + seconds segundos - + Executable: - + ... ... - + Arguments: - - - + + + Enabled Habilitado - + Mode: Modo: - + <html><head/><body><p>Normal: Repeatedly press and release a button by the chosen rate.</p><p>Gradient: Modify the button press and button release delay based on how far an axis has been moved. The rate will remain the same.</p><p>Pulse: Modify how many times a button is pressed and released per second. The button delay will remain the same.</p></body></html> <html><head/><body><p>Normal:. Pulse y suelte repetidamente un botón por la tasa elegido </p><p> Gradiente: Modificar el retraso y liberación de un botón de acuerdo con la distancia de un eje se ha movido. La tasa seguirá siendo el mismo </p><p>Pulso:. Modifica como muchas veces un botón es presionado y liberado por segundo. El retraso botón seguirá siendo el mismo.</p></body></html> - + Normal Normal - + Gradient Gradiente - + Pulse Pulso - + Delay: Retraso: - + 0.10s 0.10s - + Rate: Taza: - + 10.0/s 10.0/s - - + + Disabled Inhabilitado - + Select Set 1 One Way Seleccione Set 1 Unidireccional - + Select Set 1 Two Way Seleccione Set 1 Bidireccional - + Select Set 1 While Held Seleccione Set 1 Mientras se Mantiene - + Select Set 2 One Way Seleccionar Set 2 Unidireccional - + Select Set 2 Two Way Seleccionar Set 2 Bidireccional - + Select Set 2 While Held Seleccionar Set 2 Mientras se Mantiene - + Select Set 3 One Way Seleccionar Set 3 Unidireccional - + Select Set 3 Two Way Seleccionar Set 3 Bidireccional - + Select Set 3 While Held Seleccionar Set 3 Mientras se Mantiene - + Select Set 4 One Way Seleccionar Set 4 Unidireccional - + Select Set 4 Two Way Seleccionar Set 4 Bidireccional - + Select Set 4 While Held Seleccionar Set 4 Mientras se Mantiene - + Select Set 5 One Way Seleccionar Set 5 Unidireccional - + Select Set 5 Two Way Seleccionar Set 5 Bidireccional - + Select Set 5 While Held Seleccionar Set 5 Mientras se Mantiene - + Select Set 6 One Way Seleccionar Set 6 Unidireccional - + Select Set 6 Two Way Seleccionar Set 6 Bidireccional - + Select Set 6 While Held Seleccionar Set 6 Mientras se Mantiene - + Select Set 7 One Way Seleccionar Set 7 Unidireccional - + Select Set 7 Two Way Seleccionar Set 7 Bidireccional - + Select Set 7 While Held Seleccionar Set 7 Mientras se Mantiene - + Select Set 8 One Way Seleccionar Set 8 Unidireccional - + Select Set 8 Two Way Seleccionar Set 8 Bidireccional - + Select Set 8 While Held Seleccionar Set 8 Mientras se Mantiene - + sec. Seg. - + /sec. /seg. - + Set %1 Set %1 - - + + Select Set %1 Seleccionar Set %1 - + One Way Unidireccional - + Two Way Bidireccional - + While Held Mientras se Mantiene - + Choose Executable Escojer Ejecutable - + Slots past a Cycle action will be executed on the next button press. Multiple cycles can be added in order to create partitions in a sequence. Las ranuras mas allá de un Ciclo de acción podrán ser ejecutados en la proxima vez que se presione el botón. ciclos múltiples se pueden agregar con el fin de crear particiones en una secuencia. - + Delays the time that the next slot is activated by the time specified. Slots activated before the delay will remain active after the delay time has passed. Retrasa el momento en que la siguiente ranura es activado por el tiempo especificado. Las ranuras activadas antes de que el retraso se mantendrá activa una vez transcurrido el tiempo de retardo. - + Distance action specifies that the slots afterwards will only be executed when an axis is moved a certain range past the designated dead zone. Distancia acción especifica que las ranuras después sólo se ejecutan cuando un eje se mueve de un cierto rango más allá de la zona muerta designada. - + Insert a hold action. Slots after the action will only be executed if the button is held past the interval specified. Inserte una acción de retención. Las ranuras después de la acción sólo se ejecutarán si el botón se mantiene más allá del intervalo especificado. - + Chose a profile to load when this slot is activated. Elija un perfil para cargar cuando se activa esta ranura. - + Mouse mod action will modify all mouse speed settings by a specified percentage while the action is being processed. This can be useful for slowing down the mouse while sniping. El Mod de acción del ratón va a modificar todos los ajustes de velocidad del ratón en un porcentaje especificado, mientras que la acción se está procesando. Esto puede ser útil para ralentizar el ratón para francotiradores. - + Specify the time that keys past this slot should be held down. Especificar el tiempo que las teclas pasan en esta ranura deben mantenerse presionadas. - + Insert a release action. Slots after the action will only be executed after a button release if the button was held past the interval specified. Insertar una acción de liberación. Las ranuras después de la acción sólo se ejecutarán después de la liberación del botón si este fue presionado más allá del intervalo especificado. - + Change to selected set once slot is activated. Cambiar al set seleccionado una vez que se activa la ranura. - + Full string will be typed when a slot is activated. La cadena completa se tecleará cuando se activa una ranura. - + Execute program when slot is activated. Ejecutar el programa cuando se activa la ranura. - - + + Choose Profile Elegir Perfil - + Config Files (*.amgp *.xml) Archivos de Config (*.amgp *.xml) @@ -993,157 +1002,157 @@ Distancia acción especifica que las ranuras después sólo se ejecutan cuando u AdvanceStickAssignmentDialog - + Stick/Pad Assignment Asignamiento de Palanca/Pad - + Sticks Palancas - + DPads DPads - - + + %1 (Joystick %2) %1 (Mando %2) - + Stick 1 Palanca 1 - - - + + + Enabled Habilitar - - - - - - + + + + + + Assign Asignar - - + + X Axis: Eje X: - - + + Y Axis: Eje Y: - + Stick 2 Palanca 2 - + Number of Physical DPads: %1 Numero de DPads físicos: %1 - + Virtual DPad 1 DPad 1 Virtual - + Up: Arriba: - + Down: Abajo: - + Note: This window is meant for backwards compatibility with profiles made before antimicro 2.0. Since version 2.0, use of the Game Controller Mapping window is preferred. Nota: Esta ventana es para la retrocompatibilidad con los perfiles realizados antes Antimicro 2.0. Desde la versión 2.0, se prefiere el uso de la ventana de juego Mapeo controlador. - + Left: Izquierda: - + Right: Derecha: - - - - + + + + Axis %1 Ejes %1 - - - - + + + + Axis %1 - Ejes %1 - - - - - + + + + Axis %1 + Ejes %1 + - - - - + + + + Button %1 Botón %1 - + Move stick 1 along the X axis Mueva la palanca 1 a lo largo del eje X - + Move stick 1 along the Y axis Mueva la palanca 1 a lo largo del eje Y - + Move stick 2 along the X axis Mueva la palanca 2 a lo largo del eje X - + Move stick 2 along the Y axis Mueva la palanca 2 a lo largo del eje Y - - - - + + + + Press a button or move an axis Presione un botón o mueva un eje @@ -1151,181 +1160,181 @@ Distancia acción especifica que las ranuras después sólo se ejecutan cuando u AxisEditDialog - + Axis Ejes - - + + Mouse (Horizontal) Ratón (Horizontal) - - + + Mouse (Inverted Horizontal) Ratón (Horizontal Invertido) - - + + Mouse (Vertical) Ratón (Vertical) - - + + Mouse (Inverted Vertical) Ratón (Vertical Invertido) - - + + Arrows: Up | Down Direccionales: Arriba | Abajo - - + + Arrows: Left | Right Direccionales: Izquierda | Derecha - - + + Keys: W | S Teclas: W | S - - + + Keys: A | D Teclas: A | D - - + + NumPad: KP_8 | KP_2 Teclado Num: 8 | 2 - - + + NumPad: KP_4 | KP_6 Teclado Num: 4 | 6 - - - + + + None Nada - - + + Set the value to use as the limit for an axis. Useful for a worn out analog stick. Establecer el valor a utilizar como límite para un eje. Útil para una palancas analógicas desgastadas. - + Negative Half Throttle Mitad de Acelerador Negativo - + Positive Half Throttle Mitad de Acelerador Positivo - + Name: Nombre: - + Specify the name of an axis. Especificar un nombre para un eje. - + Mouse Settings Configuraciones de Ratón - - + + Set the value of the dead zone for an axis. Establecer el valor de la zona muerta para un eje. - + Presets: Presets: - + Dead Zone: Zona Muerta: - + Max Zone: Zona Maxima: - - + + [NO KEY] [SIN TECLA] - + Throttle setting that determines the behavior of how to interpret an axis hold or release. Ajuste del acelerador la que determina el comportamiento de la forma de interpretar un eje de retención o liberación. - + Negative Throttle Acelerador Negativo - + Normal Normal - + Positive Throttle Acelerador Positivo - + Current Value: Valor Actual: - + Set - + Set %1 - + Left Mouse Button Botón Izquierdo del Ratón - + Right Mouse Button Botón Derecho del Ratón @@ -1333,37 +1342,37 @@ interpretar un eje de retención o liberación. ButtonEditDialog - + Dialog Dialogo - + To make a new assignment, press any keyboard key or click a button in the Keyboard or Mouse tab Para realizar una nueva asignación, pulse cualquier tecla del teclado o haga clic en un botón en el teclado o en la pestaña ratón - + Placeholder marcador de posición - + Toggle Alternar - + Enables a key press or release to only occur when a controller button is pressed. Habilita la pulsación de una tecla o la liberación que sólo ocurren cuando se pulsa un botón del mando. - + Enables rapid key presses and releases. Turbo controller. Permite a las pulsaciones de teclas rápidas y liberaciones. Controlador Turbo. - + Turbo Turbo @@ -1372,39 +1381,39 @@ interpretar un eje de retención o liberación. Presente: - + Last keyboard/mouse button: - + Slots Ranuras - + Na&me: No&mbre: - + Specify the name of a button. Especifique el nombre de un botón. - + Action: Acción: - + Specify the action that will be performed in game while this button is being used. Especificar la acción que se llevará a cabo en juego, mientras se está utilizando este botón. - + Advanced Avanzado @@ -1417,52 +1426,52 @@ se está utilizando este botón. Set %1 - - - + + + Choose your keyboard key - + No button - - - - + + + + Last button - + To change settings for last button, it must be at least one assignment from keyboard to gamepad - + To change settings of turbo for last button, it must be at least one assignment from keyboard to gamepad - + To open advanced dialog, it's needed to map at least one button from keyboard to gamepad - + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + As last gamepad button has been set - + Index %1 @@ -1470,190 +1479,190 @@ se está utilizando este botón. Calibration - + Form - - + + Start calibration - + Controller: - + Sticks: - - Use settings from jstest-gtk - - - - + Reset settings - + Cancel Cancelar - - + + Save - - + + Calibration - - Do you really want to reset settings of current axes? + + Do you really want to reset settings of current axis? - + Calibration was saved for the preset. Do you really want to reset settings? - + Place the joystick in the center position. It's the part, where often you don't have to move. Just skip it in such situation. - + Calibrating center - + Start second step - + Center X: %1 - + Center Y: %1 - + Place the joystick in the top-left corner many times - - + + Calibrating position - - + + X: %1 - - + + Y: %1 - + Place the joystick in the bottom-right corner - + Start final step - + range X: %1 - %2 - + range Y: %1 - %2 - + deadzone X: %1 - + deadzone Y: %1 - + ---Calibration done!--- - + Calibration values have been saved - - + + Dead zone calibration - - You must move X axis to the right at least five times! Keep moving! + + You have to move axes to the top-left corner at least five times. + + + + + You have to move axes to the bottom-right corner at least five times. - - You must move X axis to the left at least five times! Keep moving! + + Do you want to save calibration of current axis? - - - - + + + + Axis %1 Ejes %1 @@ -1661,64 +1670,64 @@ deadzone Y: %1 CapturedWindowInfoDialog - + Captured Window Properties - + Information About Window - + Class: Clase: - - - + + + TextLabel - + Title: Titulo: - + Path: Camino: - + Match By Properties - + Class Clase - + Title Titulo - + Path Camino - + Full Path - + File Name @@ -1749,67 +1758,67 @@ deadzone Y: %1 DPadContextMenu - + Mouse (Normal) Ratón (Normal) - + Mouse (Inverted Horizontal) Ratón (Horizontal Invertido) - + Mouse (Inverted Vertical) Ratón (Vertical Invertido) - + Mouse (Inverted Horizontal + Vertical) Ratón (Horizontal+Vertical Invertido) - + Arrows Direccionales - + Keys: W | A | S | D Teclas: W | A | S | D - + NumPad Teclado Num - + None Nada - + Standard Estándar - + Eight Way Ocho Vías - + 4 Way Cardinal 4 Vias Cardinal - + 4 Way Diagonal 4 Vias Diagonal - + Mouse Settings Configuracion de Ratón @@ -1817,108 +1826,108 @@ deadzone Y: %1 DPadEditDialog - + Dialog Dialogo - + Presets: Presets: - + Mouse (Normal) Ratón (Normal) - + Mouse (Inverted Horizontal) Ratón (Horizontal Invertido) - + Mouse (Inverted Vertical) Ratón (Vertical Invertido) - + Mouse (Inverted Horizontal + Vertical) Ratón (Horizontal+Vertical Invertido) - + Arrows Direccionales - + Keys: W | A | S | D Teclas: W | A | S | D - + NumPad Teclado Num - + None Nada - + Dpad Mode: Modo Dpad: - + &Name: &Nombre: - + 4 Way Cardinal 4 Vias Cardinal - + 4 Way Diagonal 4 Vias Diagonal - + DPad Delay: Retraso de Dpad: - - + + Time lapsed before a direction change is taken into effect. Tiempo transcurrido antes de un cambio de dirección se tenga en efecto. - + s s - + Specify the name of a dpad. Especificar un nombre para Dpad. - + Mouse Settings Configuracion de Ratón - + Standard Estándar - + Standard: 8 region dpad with two direction buttons active when the dpad is in a diagonal region. @@ -1945,17 +1954,17 @@ los puntos cardinales de la DPAD. Útil para los menús. a una zona de diagonal. - + Eight Way Ocho Vías - + Set Set - + Set %1 Set %1 @@ -1963,27 +1972,27 @@ a una zona de diagonal. EditAllDefaultAutoProfileDialog - + Default Profile Perfil por Defecto - + Profile: Perfil: - + Browse Navegar - + Open Config Abrir Config - + Profile file path is invalid. La ruta de archivo de perfil es invalido. @@ -1991,29 +2000,29 @@ a una zona de diagonal. ExtraProfileSettingsDialog - + Extra Profile Settings Configuraciones Extra de Perfil - + Key Press Time: Tiempo de presionado de Tecla: - + 0.00 ms 0.00 ms - + Profile Name: Nombre del Perfil: - - - + + + s s @@ -2021,7 +2030,7 @@ a una zona de diagonal. GameController - + Game Controller Controlador de juego @@ -2029,9 +2038,9 @@ a una zona de diagonal. GameControllerDPad - - - + + + DPad DPad @@ -2039,187 +2048,187 @@ a una zona de diagonal. GameControllerMappingDialog - + Game Controller Mapping Mapeo de Controles de Juego - + <html><head/><body><p>antimicro makes use of the <a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;">Game Controller API</span></a> provided by SDL 2 in order to abstract various gamepads to fit a unified standard. In order to make a button assignment, please highlight the mapping cell for the appropriate button row below. You can then press a button or move an axis on your gamepad and the cell will update with the physical button or axis that will be used.</p><p>antimicro will use the mapping that you specify to save a mapping string that will be loaded into SDL.</p></body></html> - + A - + B - + X - + Y - + Back - + Start - + Guide - + Left Shoulder - + Right Shoulder - + Left Stick Click - + Right Stick Click - + Left Stick X - + Left Stick Y - + Right Stick X - + Right Stick Y - + Left Trigger - + Right Trigger - + DPad Up - + DPad Left - + DPad Down - + DPad Right - + Mapping - + SDL 2 Game Controller Mapping String - + Last Axis Event: - + Current Axis Detection Dead Zone: - + 5000 5000 - + 10000 10000 - + 15000 15000 - + 20000 20000 - + 25000 25000 - + 30000 30000 - + 32000 32000 - + Game Controller Mapping (%1) (#%2) Mapeo de Controles de Juego (%1) (#%2) - + Discard Controller Mapping? ¿Descartar Mapeo de Controlador? - + Discard mapping for this controller? If discarded, the controller will be reverted to a joystick once you refresh all joysticks. @@ -2231,47 +2240,47 @@ Si lo descarta, el controlador podrá revertirse a un mando una vez que se actua GameControllerSet - + Back - + Guide - + Start - + LS Click - + RS Click - + L Shoulder - + R Shoulder - + L Trigger - + R Trigger @@ -2279,9 +2288,9 @@ Si lo descarta, el controlador podrá revertirse a un mando una vez que se actua GameControllerTrigger - - - + + + Trigger Gatillo @@ -2289,9 +2298,9 @@ Si lo descarta, el controlador podrá revertirse a un mando una vez que se actua JoyAxis - - - + + + Axis Ejes @@ -2299,24 +2308,24 @@ Si lo descarta, el controlador podrá revertirse a un mando una vez que se actua JoyAxisButton - + Negative Negativo - + Positive Positivo - + Unknown Desconocido - - - + + + Button Botón @@ -2324,74 +2333,74 @@ Si lo descarta, el controlador podrá revertirse a un mando una vez que se actua JoyAxisContextMenu - + Mouse (Horizontal) Ratón (Horizontal) - + Mouse (Inverted Horizontal) Ratón (Horizontal Invertido) - + Mouse (Vertical) Ratón (Vertical) - + Mouse (Inverted Vertical) Ratón (Vertical Invertido) - + Arrows: Up | Down Direccionales: Arriba | Abajo - + Arrows: Left | Right Direccionales: Izquierda | Derecha - + Keys: W | S Teclas: W | S - + Keys: A | D Teclas: A | D - + NumPad: KP_8 | KP_2 Teclado Num: 8 | 2 - + NumPad: KP_4 | KP_6 Teclado Num: 4 | 6 - - + + None Nada - - + + Mouse Settings Configuracion de Ratón - + Left Mouse Button Botón Izquierdo del Ratón - + Right Mouse Button Botón Derecho del Ratón @@ -2399,57 +2408,57 @@ Si lo descarta, el controlador podrá revertirse a un mando una vez que se actua JoyButton - + Processing turbo for #%1 - %2 Procesando turbo para #%1 - %2 - + Finishing turbo for button #%1 - %2 Finalizando turbo para botón #%1 - %2 - + Processing press for button #%1 - %2 Procesando de presionado para botón #%1 - %2 - + Processing release for button #%1 - %2 Procesando de liberacion de botón #%1 - %2 - + Distance change for button #%1 - %2 Distancia de cambio para botón #%1 - %2 - - - + + + Button Botón - - - - + + + + [NO KEY] [SIN TECLA] - + [Set %1 1W] [Set %1 1W] - + [Set %1 2W] [Set %1 2W] - + [Set %1 WH] [Set %1 WH] @@ -2457,47 +2466,47 @@ Si lo descarta, el controlador podrá revertirse a un mando una vez que se actua JoyButtonContextMenu - + Toggle Alternar - + Turbo Turbo - + Clear Limpiar - + Set Select Seleccionar Set - + Disabled Inhabilitado - + Set %1 Set %1 - + Set %1 1W Set %1 1W - + Set %1 2W Set %1 2W - + Set %1 WH Set %1 WH @@ -2505,118 +2514,118 @@ Si lo descarta, el controlador podrá revertirse a un mando una vez que se actua JoyButtonSlot - - + + Mouse Ratón - + Up Arriba - + Down Abajo - + Left Izquierda - + Right Derecha - + LB BI - + MB BM - + RB BD - + B4 B4 - + B5 B5 - + Pause Pausa - + Hold Mantener - + Cycle Ciclo - + Distance Distancia - + Release Soltar - + Mouse Mod Raton Mod - + Press Time Tiempo de presionado - + Delay Retraso - + Load %1 Cargar %1 - + Set Change %1 Cambiar Set %1 - + [Text] %1 [Texto] %1 - + [Exec] %1 [Ejec] %1 - + [NO KEY] [SIN TECLA] @@ -2624,9 +2633,9 @@ Si lo descarta, el controlador podrá revertirse a un mando una vez que se actua JoyControlStick - - - + + + Stick Palanca @@ -2634,37 +2643,37 @@ Si lo descarta, el controlador podrá revertirse a un mando una vez que se actua JoyControlStickButton - - - + + + Up Arriba - - - + + + Down Abajo - - - + + + Left Izquierda - - - + + + Right Derecha - - - + + + Button Botón @@ -2672,67 +2681,67 @@ Si lo descarta, el controlador podrá revertirse a un mando una vez que se actua JoyControlStickContextMenu - + Mouse (Normal) Ratón (Normal) - + Mouse (Inverted Horizontal) Ratón (Horizontal Invertido) - + Mouse (Inverted Vertical) Ratón (Vertical Invertido) - + Mouse (Inverted Horizontal + Vertical) Ratón (Horizontal+Vertical Invertido) - + Arrows Direccionales - + Keys: W | A | S | D Teclas: W | A | S | D - + NumPad Teclado Num - + None Nada - + Standard Estándar - + Eight Way Ocho Vías - + 4 Way Cardinal 4 Vias Cardinal - + 4 Way Diagonal 4 Vias Diagonal - + Mouse Settings Configuracion de Ratón @@ -2740,86 +2749,86 @@ Si lo descarta, el controlador podrá revertirse a un mando una vez que se actua JoyControlStickEditDialog - + Dialog Dialogo - + X: - - - - - + + + + + 0 0 - + Y: - + Distance: Distancia: - + Presets: Presets: - + Mouse (Normal) Ratón (Normal) - + Mouse (Inverted Horizontal) Ratón (Horizontal Invertido) - + Mouse (Inverted Vertical) Ratón (Vertical Invertido) - + Mouse (Inverted Horizontal + Vertical) Ratón (Horizontal+Vertical Invertido) - + Arrows Direccionales - + Keys: W | A | S | D Teclas: W | A | S | D - + NumPad Teclado Num - + None Nada - + Stick Mode: Modo Palanca: - + Standard: 8 region stick with two direction buttons active when the stick is in a diagonal region. @@ -2846,72 +2855,72 @@ los puntos cardinales de la DPAD. Útil para los menús. a una zona de diagonal. - + 4 Way Cardinal 4 Vias Cardinal - + 4 Way Diagonal 4 Vias Diagonal - - + + Dead zone value to use for an analog stick. Valores de Zona Muerta usadas para una palanca analogica. - - + + Value when an analog stick is considered moved 100%. Valor cuando una palanca analogica se considera que se movió al 100%. - - + + The area (in degrees) that each diagonal region occupies. El área (en grados) que cada región ocupa. - + Square Stick: Palanca cuadrada: - - + + Percentage to modify a square stick coordinates to confine values to a circle Porcentaje para modificar las coordenadas de la palanca cuadrada para confinar valores para el ciclo - + % % - + Stick Delay: Retraso de Palanca: - - + + Time lapsed before a direction change is taken into effect. Tiempo transcurrido antes de un cambio de dirección tomado en efecto. - + s s - + Modifier: Modificador: - + Edit button that is active while the stick is active. This button is useful for assigning zones with @@ -2920,68 +2929,68 @@ functionality to an analog stick. - + PushButton Presione un Botón - + Na&me: Name: Nombre: - + Specify the name of an analog stick. Especificar un nombre para una palanca analogica. - + Mouse Settings Configuraciones de Ratón - + Standard Estándar - + Bearing: - + % Safe Zone: % Zona Segura: - + Eight Way Ocho Vías - + Dead Zone: Zona Muerta: - + Max Zone: Zona Maxima: - + Diagonal Range: Rango Diagonal: - + Set Set - + Set %1 Set %1 @@ -2989,9 +2998,9 @@ functionality to an analog stick. JoyControlStickModifierButton - - - + + + Modifier Modificador @@ -2999,9 +3008,9 @@ functionality to an analog stick. JoyDPad - - - + + + DPad DPad @@ -3009,37 +3018,37 @@ functionality to an analog stick. JoyDPadButton - - - + + + Up Arriba - - - + + + Down Abajo - - - + + + Left Izquierda - - - + + + Right Derecha - - - + + + Button Botón @@ -3047,266 +3056,271 @@ functionality to an analog stick. JoyTabWidget - - - - - - + + + + + + <New> - - + + Remove - - + + Remove configuration from recent list. - - + + Load Cargar - - + + Load configuration file. - - + + Save - - + + Save changes to configuration file. - - + + Save As - - + + Save changes to a new configuration file. - - + + Sets - + Copy from Set - + Settings Configuraciones - - + + Set 1 Set 1 - - + + Set 2 Set 2 - - + + Set 3 Set 3 - - + + Set 4 Set 4 - - + + Set 5 Set 5 - - + + Set 6 Set 6 - - + + Set 7 Set 7 - - + + Set 8 Set 8 - - + + Stick/Pad Assign Asignación de Palanca/Pad - - + + Controller Mapping - - + + Quick Set Configuración rápida - - + + Names - - + + Toggle button name displaying. - - + + Pref - - + + Change global profile settings. - - - + + + Reset - - + + Revert changes to the configuration. Reload configuration file. - + Open Config Abrir Config - + Config Files (*.amgp *.xml) Archivos de Config (*.amgp *.xml) - - - + + + Config File (*.%1.amgp) - - + + Do you really want to reset buttons settings for joystick? + + + + + Save Profile Changes? - - + + Changes to the new profile have not been saved. Would you like to save or discard the current profile? - - + + Changes to the profile "%1" have not been saved. Would you like to save or discard changes to the current profile? - + Sticks Palancas - - + + DPads DPads - + No buttons have been assigned. Please use Quick Set to assign keys to buttons or disable hiding empty buttons. - - + + Set %1: %2 Set %1: %2 - - + + Set %1 Set %1 - + Copy Set Assignments - + Are you sure you want to copy the assignments and device properties from %1? - - - + + + Save Config - - + + Set Set @@ -3314,7 +3328,7 @@ to buttons or disable hiding empty buttons. Joystick - + Joystick Mando @@ -3322,98 +3336,98 @@ to buttons or disable hiding empty buttons. JoystickStatusWindow - + Properties Propiedades - + Details Detalles - + Name: Nombre: - - - - - - - + + + + + + + %1 %1 - + Number: Numero: - + Axes: Ejes: - + Buttons: Botones: - + Hats: Hats: - + GUID: GUID: - + Game Controller: Controlador de Juego: - + Axes Ejes - + Buttons Botones - + Hats Hats - + %1 (#%2) Properties %1 (#%2) Propiedades - + Axis %1 Ejes %1 - + Hat %1 Hat %1 - + No No - + Yes Si @@ -3421,62 +3435,67 @@ to buttons or disable hiding empty buttons. MainSettingsDialog - + Edit Settings Editar Configuraciones - + General General - + Controller Mappings Mapeo de controles - + Language Lenguaje - + Auto Profile Auto Perfil - + Mouse Ratón - + Advanced Avanzado - + + Profile Direc&tory: + + + + <html><head/><body><p>Specify the default directory that the program should use in file dialogs when loading a profile or saving a new profile.</p></body></html> <html><head/><body><p>Especificar el directorio por defecto que el programa debe utilizar en los diálogos de archivo cuando se carga un perfil o guardar un nuevo perfil.</p></body></html> - + Recent Profile Count: Contaje de Perfiles Recientes: - + <html><head/><body><p>Number of profiles that can be placed in recent profile list. 0 will result in the program not enforcing a limit on the number of profiles displayed.</p></body></html> <html><head/><body><p>Número de perfiles que se puede colocar en la lista de perfil reciente. 0 dará lugar a que el programa no cumplir un límite en el número de perfiles que se muestran.</p></body></html> - + Gamepad Poll Rate: Taza de Sondeo de Mando: - + Change the poll rate that the program uses to discover new events from gamepads. Defaults to 10 ms. @@ -3491,29 +3510,29 @@ usar más energía de la CPU así que por favor probar la configuración que uti antes de usar Antimicro desatendida. - + Hide main window when the main window close button is clicked instead of quitting the program. Ocultar ventana principal cuando el botón de la ventana principal es estrecha se hace clic en lugar de salir del programa. - + Close To Tray Cerrar para la bandeja del sistema - + Have Windows start antimicro at system startup. Hacer que Windows inicie Antimicro junto con el sistema. - + Launch At Windows Startup Iniciar junto con Windows - + Display recent profiles for all controllers as a single list in the tray menu. Defaults to using sub-menus. @@ -3522,12 +3541,12 @@ como una única lista en el menú de la bandeja. predeterminados a la utilización de los submenús. - + Single Profile List in Tray Lista única de perfiles en la bandeja de sistema - + Have the program minimize to the taskbar. By default, the program minimizes to the system tray if available. @@ -3536,12 +3555,12 @@ Por defecto, el programa se minimiza en el sistema la bandeja si está disponible. - + Minimize to Taskbar Minimizar para la barra de tareas - + This option will cause the program to hide all buttons that have no slots assigned to them. The Quick Set dialog window will have to be used @@ -3552,12 +3571,12 @@ La ventana de diálogo de configuración rápida tendrá que ser utilizado para que aparezca el diálogo de edición para los botones del mando. - + Hide Empty Buttons Ocultar Botones Vacíos - + When the program is launched, open the last known profile that was opened during the previous session. @@ -3566,158 +3585,168 @@ perfil conocido que se abrió durante la sesión anterior. - + Auto Load Last Opened Profile Auto Cargar el ultimo perfil abierto - + Only show the system tray icon when the program first launches. Solamente mostrar el icono en la bandeja de sistema cuando el programa inicie por primera vez. - + Launch in Tray Lanzar en la bandeja del sistema - + Associate .amgp files with antimicro in Windows Explorer. Asociar archivos .amgp con antimicro en Windows Explorer. - + Associate Profiles Asociar Perfiles - + Key Repeat Repetición de Tecla - + Active keys will be repeatedly pressed when this option is enabled. Las teclas activadas serán presionadas repetidamente cuando esta opción esté activada. - - + + Enable Habilitar - + Specifies how much time should elapse before key repeating begins. Especifica cuánto tiempo debe transcurrir antes de repetión de tecla comienza. - + Specifies how many times key presses will be performed per seconds. Especifica cuántas veces se llevarán a cabo las pulsaciones de teclas por segundo. - + <html><head/><body><p>antimicro has been translated into many different languages by contributors. By default, the program will choose an appropriate translation based on your system's locale setting. However, you can make antimicro load a different translation depending on the language that you choose from the list below.</p></body></html> <html><head/><body><p>Antimicro ha sido traducido a muchos idiomas diferentes por los contribuyentes. Por defecto, el programa elegirá una traducción apropiada basada en la configuración regional de su sistema. Sin embargo, puede hacer que la carga Antimicro una traducción diferente en función del idioma que elija en la lista siguiente.</p></body></html> - + Português do Brasil - + Français - + Deutsch - + Italiano - + 日本語 - + Русский - + српски / srpski - + 简体中文 - + Español - + українська - + Polski - + + History Si&ze: + + + + Log File: - + Log Level: - + None Nada - + Error - + Warning - + Info info - + Debug + + + Reset + + French Francés @@ -3743,22 +3772,22 @@ por segundo. Ucraniano - + Class Clase - + Title Titulo - + Program Programa - + Disable the "Enhanced Pointer Precision" Windows setting while antimicro is running. Disabling "Enhanced Pointer Precision" will allow mouse movement within antimicro to be more @@ -3769,32 +3798,31 @@ permitirá el movimiento del ratón dentro de Antimicro a ser más preciso. - + Disable Enhance Pointer Precision Desactivar la precisión del puntero mejorado - + Smoothing suavizado - Histor&y Size: - Tamaño del &Historial: + Tamaño del &Historial: - + Weight &Modifier: &Modificador de peso: - + Refresh Rate: Taza de Actualizacion: - + The refresh rate is the amount of time that will elapse in between mouse events. Please be cautious when editing this setting as it will cause the program to use @@ -3809,17 +3837,17 @@ inestabilidad del sistema. Por favor, probar la configuración antes de usar sin vigilancia. - + Spring Spring - + Screen: Pantalla: - + Utilize the specified screen for spring mode. On Linux, the default is to use the primary screen. On Windows, the default is to use all available screens. @@ -3828,29 +3856,29 @@ por defecto es el uso de la pantalla principal. En Windows, el valor por defecto es utilizar todas las pantallas disponibles. - + Accel Numerator: Numerador de Aceleración: - - - + + + 0 0 - + Accel Denominator: Denominador de Aceleración: - + Accel Threshold: Límite de Aceleración: - + If the acceleration values for the virtual mouse have been changed by a different process, particularly when quitting an older game, then you might want to reset the acceleration @@ -3861,37 +3889,36 @@ un juego antiguo, entonces es posible que desee restablecer la aceleración Los valores utilizados por el ratón virtual. - + Reset Acceleration Resetear Aceleración - + Delay: Retraso: - Profi&le Directory: - Directorio de Perfi&l: + Directorio de Perfi&l: - + ms ms - + Rate: Taza: - + times/s tiempo/s - + Below is a list of the custom mappings that have been saved. You can use the following table to delete mappings or have mappings temporarily disabled. You can also disable mappings that are included with SDL; just insert a new row with the appropriate joystick GUID and check disable. Settings will not take affect until you either refresh all joysticks or unplug that particular joystick. @@ -3900,34 +3927,34 @@ Settings will not take affect until you either refresh all joysticks or unplug t Los ajustes no tendrán efecto hasta que actualizar todos los mandos o desenchufar el mando en particular. - + GUID GUID - + Mapping String Cadena de Mapeo - + Disable? Inhabilitar? - - + + Delete Borrar - + Insert Insertar - - + + Default Por Defecto @@ -3936,7 +3963,7 @@ Los ajustes no tendrán efecto hasta que actualizar todos los mandos o desenchuf Portugués de Brasil - + English Inglés @@ -3945,49 +3972,49 @@ Los ajustes no tendrán efecto hasta que actualizar todos los mandos o desenchuf Alemán - - + + Active Activo - + Devices: Dispositivos: - - + + All Todo - + Device Dispositivo - + Profile Perfil - + Default? Por Defecto? - + Add Agregar - + Edit Editar - + Also, Windows users who want to use a low value should also check the "Disable Enhance Pointer Precision" checkbox if you haven't disabled the option in Windows. @@ -3996,35 +4023,45 @@ the option in Windows. la opción en Windows. - + Select Default Profile Directory Seleccionar el Directorio de Perfil por defecto - + Are you sure you want to delete the profile? Está seguro que quiere borrar el perfil? - + Save Log File As - + Log Files (*.log) + + + Do you really want to reset setting? + + + + + Would you like to reset mappings too? + + MainWindow - + antimicro antimicro - + No Joysticks have been found. Please plug in a joystick and then choose the "Update Joysticks" option in the main menu Ningún Mando fue encontrado @@ -4035,115 +4072,115 @@ Por favor conecte un Mando y elija la opción "Actualizar Mandos" en e Si los eventos no son vistos por un juego, por favor haga clic aquí para ejecutar esta aplicación como administrador. - + If events are not seen by a game, please click here to run this application as Administrator. - + &App &App - + &Options &Opciones - + &Help A&yuda - - + + &Quit S&alir - + Ctrl+Q Ctrl+Q - - + + &Update Joysticks Act&ualizar Mandos - + Ctrl+U Ctrl+U - - + + &Hide O&cultar - + Ctrl+H Ctrl+H - + &About So&bre - + Ctrl+A Ctrl+A - + About &Qt - + &Properties - + &Key Checker - + &GitHub Page - + &Game Controller Mapping - + S&ettings - + &Stick/Pad Assign - + &Wiki - + &Issues - + &Calibration @@ -4160,7 +4197,7 @@ Por favor conecte un Mando y elija la opción "Actualizar Mandos" en e Verificador de Teclas - + Home Page Home Page @@ -4185,49 +4222,49 @@ Por favor conecte un Mando y elija la opción "Actualizar Mandos" en e Wiki - + Could not find a proper controller identifier. Exiting. No se pudo encontrar un identificador de controlador apropiado.Saliendo. - - - - - - - + + + + + + + (%1) (%1) - - + + Open File Abrir Archivo - + &Restore &Restaurar - + Calibration couldn't be opened - + You must connect at least one controller to open the window - + Run as Administrator? ¿Ejecutar como Administrador? - + Are you sure that you want to run this program as Adminstrator? Some games run as Administrator which will cause events generated by antimicro to not be used by those games unless antimicro is also run as the Adminstrator. This is due to permission problems caused by User Account Control (UAC) options in Windows Vista and later. @@ -4236,17 +4273,17 @@ Some games run as Administrator which will cause events generated by antimicro t Algunos juegos se ejecutan como administrador lo que hará que los eventos generados por Antimicro para no ser utilizado por aquellos juegos a menos Antimicro también se ejecuta como el Adminstrator. Esto se debe a problemas de permisos causadas por las opciones de Control de cuentas de usuario (UAC) en Windows Vista y versiones posteriores. - + Failed to elevate program Fallo al elevar el programa - + Failed to restart this program as the Administrator Fallo al reiniciar este programa como administrador - + Could not find controller. Exiting. No se pudo encontrar un controlador. Saliendo. @@ -4254,12 +4291,12 @@ Algunos juegos se ejecutan como administrador lo que hará que los eventos gener MouseAxisSettingsDialog - + Mouse Settings - Configuraciones de Ratón - - + Set %1 Set %1 @@ -4267,12 +4304,12 @@ Algunos juegos se ejecutan como administrador lo que hará que los eventos gener MouseButtonSettingsDialog - + Mouse Settings - Configuraciones de Ratón - - + Set %1 Set %1 @@ -4280,12 +4317,12 @@ Algunos juegos se ejecutan como administrador lo que hará que los eventos gener MouseControlStickSettingsDialog - + Mouse Settings Configuraciones de Ratón - + Set %1 Set %1 @@ -4293,12 +4330,12 @@ Algunos juegos se ejecutan como administrador lo que hará que los eventos gener MouseDPadSettingsDialog - + Mouse Settings Configuraciones de Ratón - + Set %1 Set %1 @@ -4306,17 +4343,17 @@ Algunos juegos se ejecutan como administrador lo que hará que los eventos gener MouseSettingsDialog - + Mouse Settings Configuracion de Ratón - + Mouse Mode: Modo Ratón: - + Cursor mode is used to move the mouse cursor around the screen relative to its current position depending on how much you move an axis @@ -4330,79 +4367,79 @@ axis is moved back to the dead zone. - + Cursor Cursor - + Spring Spring - + Acceleration: Aceleración: - + Enhanced Precision Puntero Mejorado - - + + Linear - + Quadratic - + Cubic - + Quadratic Extreme - + Power Function - + Easing Quadratic - + Easing Cubic - + Mouse Speed Settings - + Enable to change the horizontal and vertical speed boxes at the same time. - + Change Together - + Options for adding more acceleration to the mouse movement beyond what the acceleration curve would produce. Acceleration is added based on how quickly an axis is @@ -4412,17 +4449,17 @@ using typical gamepad analog sticks. - + Delta Acceleration - + &Multiplier: - + Mi&n Threshold: @@ -4434,8 +4471,8 @@ Speed: Horizontal: - - + + 1 = 20 pps @@ -4446,30 +4483,30 @@ Speed: Vertical: - + Wheel Hori. Speed: - + Set the speed used for horizontal mouse wheel movement according to number of simulated notches per second. - + Set the speed used for vertical mouse wheel movement according to number of simulated notches per second. - + Sensitivit&y: - + For Power Function acceleration curve. Specifies the factor to use for curve sensitivity. When the value is above 1.0, the mouse movement will be accelerated @@ -4477,13 +4514,13 @@ faster at the low end of an axis. - + Easing Duration: - - + + s s @@ -4496,22 +4533,22 @@ faster at the low end of an axis. Multiplicador: - + Highest value to accelerate mouse movement by - + x - + Start %: - + Acceleration begins at this percentage of the base multiplier La aceleración comienza en este porcentaje de la base de multiplicador @@ -4522,93 +4559,93 @@ Threshold: Mínimo: - + Minimum amount of axis travel required for acceleration to begin cantidad mínima de recorrido del eje requerido para la aceleración a comenzar - + Max Threshold: Límite Máximo: - + Maximum axis travel before acceleration has reached the multiplier value El recorrido máximo del eje antes de la aceleración ha alcanzado el valor del multiplicador - + E&xtra Duration: - + Curve: Curva: - + Ease Out Sine - + Ease Out Quad - + Ease Out Cubic - + Release Radius: - + Specifies that the spring area will be relative to the mouse position set by a non-relative spring. - + Relative - + Mouse Status - + X: - - + + 0 (0 pps) - + Y: - - + + 1 = 1 notch(es)/s - + Enhanced: Three tier curve that makes the mouse move slow on the low end of an axis and fast on the high end. @@ -4630,77 +4667,77 @@ a period of time using a Cubic curve. - + Hori&zontal Speed: - + &Vertical Speed: - + Wheel Vert. Speed: - + Specifies the amount of time (in seconds) that will be required before the mouse is fully accelerated after reaching the high end of an axis. - - - - + + + + % % - + Extend the time that extra acceleration is applied. Axis travel will be taken into account. A slower flick will decrease the actual time that extra acceleration will be applied. - + Spring Settings - + Spring Width: - + Changes the width of the region that the cursor can move in spring mode. 0 will use the entire width of your screen. - + Spring Height: - + Changes the height of the region that the cursor can move in spring mode. 0 will use the entire height of your screen. - - + + %n notch(es)/s %n notch/s @@ -4711,7 +4748,7 @@ of your screen. QKeyDisplayDialog - + Key Checker Verificador de Teclas @@ -4720,34 +4757,34 @@ of your screen. <html><head/><body><p>Presione una tecla del teclado para ver cómo se detecta la tecla por esta aplicación. La ventana mostrará el valor de la tecla del sistema nativo, el valor original dada por Qt (si es el caso), y el valor personalizado utilizado por Antimicro. </p><p> El valor de la tecla Antimicro y el valor de tecla Qt generalmente es la misma . Antimicro intenta utilizar los valores de las claves definidas en Qt cuando sea posible. Vea la página <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum</span></a> para una lista de valores definidos por Qt. Si descubre que la tecla no es compatible de forma nativa por este programa, por favor informa del problema al estilo de Antimicro <a href="https://github.com/AntiMicro/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> para que el programa pueda editarlo para soportarlo directamente. Tal como es, se añade un prefijo personalizado para valores desconocidos por lo que todavía se pueden utilizar; el principal problema es que el perfil ya no será portátil.</p></body></html> - - <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> + + <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="http://doc.qt.io/qt-5/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">http://doc.qt.io/qt-5/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> - + Event Handler: Controlador de eventos: - + Native Key Value: Valor de tecla nativo: - - - + + + 0x00000000 0x00000000 - + Qt Key Value: Valor QT de Tecla: - + antimicro Key Value: Valor Antimicro de Tecla: @@ -4755,285 +4792,285 @@ of your screen. QObject - + Super - + Menu Menu - + Mute - + Vol+ - + Vol- - + Play/Pause - + Play - + Pause Pausa - + Prev - + Next - + Mail - + Home - + Media Media - + Search Buscar - + Daemon launched - + Failed to launch daemon - + Launching daemon - - + + Display string "%1" is not valid. - + Failed to set a signature id for the daemon - + Failed to change working directory to / - + Quitting Program Saliendo del Programa - + # of joysticks found: %1 # de mandos econtrados: %1 - + List Joysticks: Lista de Mandos: - + --------------- - + Joystick %1: - + Index: %1 - + GUID: %1 GUID: %1 - + Name: %1 Nombre: %1 - + Yes Si - + No No - + Game Controller: %1 Controlador de Juego: %1 - + # of Axes: %1 - + # of Buttons: %1 - + # of Hats: %1 - + Attempting to use fallback option %1 for event generation. - + Failed to open event generator. Exiting. - + Using %1 as the event generator. - + Could not raise process priority. - + Last button - + There isn't a last button pressed from gamepad in data. Did you set at least one button from gamepad for keyboard? - + Active window changed to: Title = "%1", Class = "%2", Program = "%3" or "%4". - + Profile location %1 is not an XML file. Localización de Perfil %1 no es un archivo XML válido. - + Profile location %1 does not exist. Localización de Perfil %1 No existe. - - - + + + Controller identifier is not a valid value. - + An invalid set number '%1' was specified. Un numero de Set inválido '%1' fué especificado. - + Controller identifier '%s'' is not a valid value. Controlador idendificado '%s'' no es un valor válido (valga la redundancia). - + No set number was specified. - + No controller was specified. - + No display string was specified. Ninguna cadena de exibición fué especificado. - + An invalid event generator was specified. - + No event generator string was specified. - + No log file specified. - + Logging started - + Auto-switching to profile "%1". - + Auto-switching to nullptr profile! - + xinput version must be at least 2.0. No mouse acceleration changes will occur. La versión xinput debe ser al menos 2,0. no se producirán cambios en la aceleración del ratón. @@ -5041,18 +5078,18 @@ of your screen. QuickSetDialog - + Quick Set Configuración rápida - + <html><head/><body><p>Please press a button or move an axis on %1 (<span style=" font-weight:600;">%2</span>).<br/>A dialog window will then appear which will<br/>allow you to make an assignment.</p></body></html> <html><head/><body><p>Por favor, pulse un botón o mueva un eje en %1 (<span style=" font-weight:600;">%2</span>).<br/>una ventana de diálogo aparecerá entonces<br/>permitirá crear una asignación.</p></body></html> - - + + Quick Set %1 Configuración rápida %1 @@ -5060,12 +5097,12 @@ of your screen. SetAxisThrottleDialog - + Throttle Change Cambio del acelerador - + The throttle setting for Axis %1 has been changed. Would you like to distribute this throttle change to all sets? @@ -5077,12 +5114,12 @@ Would you like to distribute this throttle change to all sets? SetJoystick - + Set %1: %2 Set %1: %2 - + Set %1 Set %1 @@ -5090,52 +5127,52 @@ Would you like to distribute this throttle change to all sets? SetNamesDialog - + Set Name Settings Config Nombre de Set - + Set 1 Set 1 - + Set 2 Set 2 - + Set 3 Set 3 - + Set 4 Set 4 - + Set 5 Set 5 - + Set 6 Set 6 - + Set 7 Set 7 - + Set 8 Set 8 - + Name Nombre @@ -5143,7 +5180,7 @@ Would you like to distribute this throttle change to all sets? SimpleKeyGrabberButton - + Mouse Ratón @@ -5151,7 +5188,7 @@ Would you like to distribute this throttle change to all sets? SpringModeRegionPreview - + Spring Mode Preview Vista previa de modo Spring @@ -5159,7 +5196,7 @@ Would you like to distribute this throttle change to all sets? UInputEventHandler - + Could not find a valid uinput device file. Please check that you have the uinput module loaded. lsmod | grep uinput @@ -5168,14 +5205,14 @@ Por favor, compruebe que tiene el módulo uinput cargado. lsmod | grep uinput - + Could not open uinput device file Please check that you have permission to write to the device No se pudo abrir archivo de dispositivo uinput Por favor, compruebe que tiene permiso para escribir en el dispositivo - + Using uinput device file %1 El uso de archivos del dispositivo uinput %1 @@ -5183,551 +5220,551 @@ Por favor, compruebe que tiene permiso para escribir en el dispositivo UInputHelper - + a - + b - + c - + d - + e - + f - + g - + h - + i - + j - + k - + l - + m - + n - + o - + p - + q - + r - + s s - + t - + u - + v - + w - + x - + y - + z - + Esc - + F1 - + F2 - + F3 - + F4 - + F5 - + F6 - + F7 - + F8 - + F9 - + F10 - + F11 - + F12 - + ` ` - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - - + + - - - + = = - + BackSpace - + Tab - + [ [ - + ] ] - + \ \ - + CapsLock - + ; ; - + ' ' - + Enter - + Shift_L - + , , - - + + . . - - + + / / - + Ctrl_L - - + + Super_L - + Alt_L - + Space - + Alt_R - + Menu Menu - + Ctrl_R - + Shift_R - + Up Arriba - + Left Izquierda - + Down Abajo - + Right Derecha - + PrtSc - + Ins - + Del - + Home - + End - + PgUp - + PgDn - + NumLock - + * * - + + + - + KP_Enter Enter_Num - + KP_1 - + KP_2 - + KP_3 - + KP_4 - + KP_5 - + KP_6 - + KP_7 - + KP_8 - + KP_9 - + KP_0 - + SCLK SCLK - + Pause Pausa - + Super_R - + Mute - + VolDn - + VolUp - + Play - + Stop - + Prev - + Next - + [NO KEY] [SIN TECLA] @@ -5735,54 +5772,54 @@ Por favor, compruebe que tiene permiso para escribir en el dispositivo UnixWindowInfoDialog - + Captured Window Properties - + Information About Window - + Class: Clase: - - - + + + TextLabel - + Title: Titulo: - + Path: Camino: - + Match By Properties - + Class Clase - + Title Titulo - + Path Camino @@ -5790,9 +5827,9 @@ Por favor, compruebe que tiene permiso para escribir en el dispositivo VDPad - - - + + + VDPad VDPad @@ -5800,224 +5837,224 @@ Por favor, compruebe que tiene permiso para escribir en el dispositivo VirtualKeyPushButton - + Space Espaciador - + Tab Tabulador - + Shift (L) Mayus (Izq) - + Shift (R) Mayus (Der) - + Ctrl (L) Ctrl (Izq) - + Ctrl (R) Ctrl (Der) - + Alt (L) Alt (Izq) - - + + Alt (R) Alt (Der) - + Alt Gr - + ` ` - + ~ ~ - - + + - - - + = = - + [ [ - + ] ] - + \ \ - + Caps Caps - + ; ; - + ' ' - + , , - - + + . . - - + + / / - + ESC ESC - + PRTSC PRTSC - + SCLK SCLK - + INS INS - + PGUP RePag - + DEL SUPR - + PGDN AvPag - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - + NUM LK BLOCK NUM - - + + * * - + + + - + Enter @@ -6034,42 +6071,42 @@ E R - + < < - + : : - + Super (L) Super (Izq) - + Menu Menu - + Up Arriba - + Down Abajo - + Left Izquierda - + Right Derecha @@ -6077,241 +6114,241 @@ R VirtualKeyboardMouseWidget - - + + Keyboard Teclado - - + + Mouse Ratón - + Mouse Settings Configuraciones de Ratón - + Left Mouse Ratón Izquierda - + Up Mouse Ratón Arriba - + Left Button Mouse Ratón Boton Izquierdo - + Middle Button Mouse Ratón Boton del Medio - + Right Button Mouse Ratón Botón Derecho - + Wheel Up Mouse Ratón Rueda Arriba - + Wheel Left Mouse Ratón Rueda Izquierda - + Wheel Right Mouse Ratón Rueda Derecha - + Wheel Down Mouse Ratón Rueda Abajo - + Down Mouse Ratón Abajo - + Right Mouse Ratón Derecha - + Button 4 Mouse Ratón Botón 4 - + Mouse 8 Mouse Ratón Ratón 8 - + Button 5 Mouse Ratón Botón 5 - + Mouse 9 Mouse Ratón Ratón 9 - + NONE NADA - - + + Last button - - + + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + Others - + Applications Aplicaciones - + Browser Back Navegador Atrás - + Browser Favorites Navegador Favoritos - + Browser Forward Navegador Adelante - + Browser Home Navegador Inicio - + Browser Refresh Navegador Actualizar - + Browser Search Navegador Busca - + Browser Stop Navegador Parar - + Calc Calc - + Email Email - + Media Media - + Media Next Media Próximo - + Media Play Media Reproduzir - + Media Previous Media Anterior - + Media Stop Media Parar - + Search Buscar - + Volume Down Volume Bajar - + Volume Mute Volume Mudo - + Volume Up Volume Subir @@ -6319,7 +6356,7 @@ R VirtualMousePushButton - + INVALID INVALIDO @@ -6327,28 +6364,28 @@ R WinAppProfileTimerDialog - - + + Capture Application Solicitación de Captura - + After pressing the "Capture Application" button, please select the application window that you want to have a profile associated with. The active application will be captured after the selected number of seconds. Después de pulsar el botón "Solicitud de captura", por favor, seleccione la ventana de la aplicación que desea tener un perfil asociado. La aplicación activa será capturado después del número de segundos seleccionado. - + Timer: Temporizador: - + Seconds Segundos - + Cancel Cancelar @@ -6356,12 +6393,12 @@ R WinExtras - + [NO KEY] [SIN TECLA] - + AntiMicro Profile Perfil AntiMicro @@ -6369,67 +6406,66 @@ R X11Extras - + ESC ESC - + Tab Tab - + Space espaciador - + DEL SUPR - + Return ENTER - + KP_Enter Enter_Num - + Backspace Backspace - + Alt Gr - + xinput extension was not found. No mouse acceleration changes will occur. No se ha encontrado la extensión xinput. no se producirán cambios en la aceleración del ratón. - + xinput version must be at least 2.0. No mouse acceleration changes will occur. La versión xinput debe ser al menos 2,0. no se producirán cambios en la aceleración del ratón. - Virtual pointer found with id=%1. - Puntero virtual encontrado con el id=%1. + Puntero virtual encontrado con el id=%1. - + PtrFeedbackClass was not found for virtual pointer.No change to mouse acceleration will occur for device with id=%1 PeerFeedback clase no se encontró para el puntero virtual. Ningún cambio en la aceleración del ratón se producirá para el dispositivo con el id=%1 - + Changing mouse acceleration for device with id=%1 Cambiando la aceleración del ratón para el dispositivo con id=%1 @@ -6437,7 +6473,7 @@ R XMLConfigReader - + Could not write updated profile XML to file %1. No se puede escribir XML del perfil actualizado en el archivo %1. @@ -6445,7 +6481,7 @@ R XMLConfigWriter - + Could not write to profile at %1. No se pudo escribir al perfil en %1. @@ -6453,7 +6489,7 @@ R antimicro - + Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support. @@ -6461,97 +6497,97 @@ R main - + Launch program in system tray only. - + Launch program with the tray menu disabled - + Launch program without the main window displayed - + Launch program with the configuration file selected as the default for selected controllers. Defaults to all controllers - + location - + Apply configuration file to a specific controller. Value can be a controller index, name, or GUID - + value - + Unload currently enabled profile(s) - + value(s) - + Start joysticks on a specific set. Value can be a controller index, name, or GUID - + number value - + Launch program as a daemon. Use only on Linux. - + Enable logging - + log-type - + Choose a file for logs writing - + filename - + Choose between using XTest support and uinput support for event generation. Use only if you have enabled xtest and uinput options on Linux or vmulti on Windows. Default: xtest. - + event-generation-type - + Print information about joysticks detected by SDL. Use only if you have sdl library. You can check your controller index, name or even GUID. diff --git a/share/antimicro/translations/antimicro_fr.ts b/share/antimicro/translations/antimicro_fr.ts old mode 100644 new mode 100755 index b7e04faf3..e7565fb50 --- a/share/antimicro/translations/antimicro_fr.ts +++ b/share/antimicro/translations/antimicro_fr.ts @@ -4,17 +4,17 @@ AboutDialog - + About À propos - + Version - + "juliagoda" (since March, 2018) Wanting only to play my favourite old games that din't support gamepads, I found this project (which map keyboard keys and mouse buttons to connected gamepads on Linux) as most proper and recent. But because of poor choices of such application on the internet and since it didn't compile properly, I decided to rescue the project. However, once I finished my work (enough to enjoy playing games) I thought about sharing this code with others. Of course all informations about past programmers will be held. "Ryochan7" (since December 30, 2012 until 2017), I have been working on antimicro in my spare time. What originally started as a fork of QJoyPad and a way to learn proper event-driven programming has turned into something much bigger than I originally intended. Although I have spent a lot of time learning new techniques, finding out more about the domain of KB+M emulation, and spending Friday nights bashing my head against my keyboard, it has been a fun and enriching experience overall. @@ -32,17 +32,17 @@ As of May 24, 2016, this project has moved to https://github.com/AntiMicro/antim - + Copyright: 2013 - 2018 - + Info - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -86,7 +86,7 @@ p, li { white-space: pre-wrap; } - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -204,57 +204,57 @@ p, li { white-space: pre-wrap; } - + Changelog - + Credits Crédits - + antimicro - + About Development - + License License - + Program Version %1 - + Program Compiled on %1 at %2 - + Built Against SDL %1 - + Running With SDL %1 - + Using Qt %1 - + Using Event Handler: %1 @@ -262,151 +262,156 @@ p, li { white-space: pre-wrap; } AddEditAutoProfileDialog - + Auto Profile Dialog - + Profile: - - + + Browse - + Window: - - + + Select Window. Click on the appropriate application window and the application file path will be populated in the form. - + Detect Window Properties - + Class: - + Title: - + + set partial title + + + + Application: - + Select - - Devices: + + De&vices: - - + + Select this profile to be the default loaded for the specified device. The selection will be used instead of the all default profile option. - + Set as Default for Controller - - + + A different profile is already selected as the default for this device. - + Current (%1) - + Open Config Charger un fichier de configuration - - + + Select Program - + Programs (*.exe) - + Please use the main default profile selection. - + Please select a window by using the mouse. Press Escape if you want to cancel. - + Capture Application Window - + Could not obtain information for the selected window. - + Application Capture Failed - + Profile file path is invalid. - + No window matching property was specified. - + Program path is invalid or not executable. - + File is not an .exe file. - + No window matching property was selected. @@ -414,187 +419,187 @@ of the all default profile option. AdvanceButtonDialog - - + + Advanced Avancé - + Assignments Assignements - + Toggle Maintient de la pression - + Turbo Turbo - + Set Selector Séléction de réglage - + Blank or KB/M - + Hold Maintenir - + Pause Pause - + Cycle Cycle - + Distance Distance - + Insert Insérer - + Delete Supprimer - + Clear All Nettoyer - + Time: Temps : - + 0.01s 0,01s - + 0s 0s - + Insert a pause that occurs in between key presses. Insére une pause de la durée indiquée entre la pression des touches. - + Release Relâchement - - + + Insert a new blank slot. Insere un nouvel emplacement vide. - + Delete a slot. Supprime un emplacement. - + Clear all currently assigned slots. Supprime tous les emplacements assignés. - + Specify the duration of an inserted Pause or Hold slot. Spécifie la durée de Pause ou de Maintien. - + 0m 0m - + &Mouse Speed Mod: - - + + Specify the range past an axis dead zone in which a sequence of actions will execute. Spécifie la distance par rapport à la zone morte pour exécuter la suite des actions. - + Distance: Distance : - - + + % % - + Mouse Mod Mode de la Souris - + Press Time - + Delay - + Execute - + Load Charger - + Set Change - + Text Entry - + Placeholder Espace réservé - - + + 0 0 @@ -603,317 +608,317 @@ of the all default profile option. Vitesse du Mode de la Souris : - + Set the percentage that mouse speeds will be modified by. Régler toutes les vitesses de la souris avec le pourcentage spécifié. - + Auto Reset Cycle After - + seconds - + Executable: - + ... - + Arguments: - - - + + + Enabled Activé - + Mode: - + <html><head/><body><p>Normal: Repeatedly press and release a button by the chosen rate.</p><p>Gradient: Modify the button press and button release delay based on how far an axis has been moved. The rate will remain the same.</p><p>Pulse: Modify how many times a button is pressed and released per second. The button delay will remain the same.</p></body></html> - + Normal Normal - + Gradient - + Pulse - + Delay: Intervalle : - + 0.10s 0,10s - + Rate: Taux : - + 10.0/s 10,0/s - - + + Disabled Désactivé - + Select Set 1 One Way Séléction du réglage N°1 : Aller - + Select Set 1 Two Way Séléction du réglage N°1 : Aller-Retour - + Select Set 1 While Held Séléction du réglage N°1 : Pendant la pression - + Select Set 2 One Way Séléction du réglage N°2 : Aller - + Select Set 2 Two Way Séléction du réglage N°2 : Aller-Retour - + Select Set 2 While Held Séléction du réglage N°2 : Pendant la pression - + Select Set 3 One Way Séléction du réglage N°3 : Aller - + Select Set 3 Two Way Séléction du réglage N°3 : Aller-Retour - + Select Set 3 While Held Séléction du réglage N°3 : Pendant la pression - + Select Set 4 One Way Séléction du réglage N°4 : Aller - + Select Set 4 Two Way Séléction du réglage N°4 : Aller-Retour - + Select Set 4 While Held Séléction du réglage N°4 : Pendant la pression - + Select Set 5 One Way Séléction du réglage N°5 : Aller - + Select Set 5 Two Way Séléction du réglage N°5 : Aller-Retour - + Select Set 5 While Held Séléction du réglage N°5 : Pendant la pression - + Select Set 6 One Way Séléction du réglage N°6 : Aller - + Select Set 6 Two Way Séléction du réglage N°6 : Aller-Retour - + Select Set 6 While Held Séléction du réglage N°6 : Pendant la pression - + Select Set 7 One Way Séléction du réglage N°7 : Aller - + Select Set 7 Two Way Séléction du réglage N°7 : Aller-Retour - + Select Set 7 While Held Séléction du réglage N°7 : Pendant la pression - + Select Set 8 One Way Séléction du réglage N°8 : Aller - + Select Set 8 Two Way Séléction du réglage N°8 : Aller-Retour - + Select Set 8 While Held Séléction du réglage N°8 : Pendant la pression - + sec. - + /sec. - + Set %1 - - + + Select Set %1 - + One Way - + Two Way - + While Held - + Choose Executable - + Slots past a Cycle action will be executed on the next button press. Multiple cycles can be added in order to create partitions in a sequence. - + Delays the time that the next slot is activated by the time specified. Slots activated before the delay will remain active after the delay time has passed. - + Distance action specifies that the slots afterwards will only be executed when an axis is moved a certain range past the designated dead zone. - + Insert a hold action. Slots after the action will only be executed if the button is held past the interval specified. - + Chose a profile to load when this slot is activated. - + Mouse mod action will modify all mouse speed settings by a specified percentage while the action is being processed. This can be useful for slowing down the mouse while sniping. - + Specify the time that keys past this slot should be held down. - + Insert a release action. Slots after the action will only be executed after a button release if the button was held past the interval specified. - + Change to selected set once slot is activated. - + Full string will be typed when a slot is activated. - + Execute program when slot is activated. - - + + Choose Profile - + Config Files (*.amgp *.xml) @@ -921,157 +926,157 @@ of the all default profile option. AdvanceStickAssignmentDialog - + Stick/Pad Assignment Assignement du Stick/Pad - + Sticks Sticks - + DPads DPads - - + + %1 (Joystick %2) %1 (Manette %2) - + Stick 1 Stick 1 - - - + + + Enabled Activé - - - - - - + + + + + + Assign Assigner - - + + X Axis: Axe X : - - + + Y Axis: Axe Y : - + Stick 2 Stick 2 - + Number of Physical DPads: %1 Numéro du DPads Physique : %1 - + Virtual DPad 1 DPad Virtuel 1 - + Up: Haut : - + Down: Bas : - + Note: This window is meant for backwards compatibility with profiles made before antimicro 2.0. Since version 2.0, use of the Game Controller Mapping window is preferred. - + Left: Gauche : - + Right: Droite : - - - - + + + + Axis %1 Axe %1 - - - - + + + + Axis %1 - Axe %1 - - - - - + + + + Axis %1 + Axe %1 + - - - - + + + + Button %1 Bouton %1 - + Move stick 1 along the X axis Déplacer le stick 1 selon l'axe X - + Move stick 1 along the Y axis Déplacer le stick 1 selon l'axe Y - + Move stick 2 along the X axis Déplacer le stick 2 selon l'axe X - + Move stick 2 along the Y axis Déplacer le stick 1 selon l'axe Y - - - - + + + + Press a button or move an axis Presser un bouton ou bouger un axe @@ -1079,180 +1084,180 @@ of the all default profile option. AxisEditDialog - + Axis Axe - - + + Mouse (Horizontal) Souris (Horizontal) - - + + Mouse (Inverted Horizontal) Souris (Horizontal Inversé) - - + + Mouse (Vertical) Souris (Vertical) - - + + Mouse (Inverted Vertical) Souris (Vertical Inversé) - - + + Arrows: Up | Down Flèches : Haut | Bas - - + + Arrows: Left | Right Flèches : Gauche | Droite - - + + Keys: W | S Touches : W | S - - + + Keys: A | D Touches : A | D - - + + NumPad: KP_8 | KP_2 Pavé Numérique : KP_8 | KP_2 - - + + NumPad: KP_4 | KP_6 Pavé Numérique : KP_4 | KP_6 - - - + + + None Aucun - - + + Set the value to use as the limit for an axis. Useful for a worn out analog stick. - + Negative Half Throttle Demie accélération négative - + Positive Half Throttle Demie accélération positive - + Name: Nom : - + Specify the name of an axis. Indiquer le nom d'un axe. - + Mouse Settings Configurations de la Souris - - + + Set the value of the dead zone for an axis. Régler la valeur de la zone morte pour un axe. - + Presets: Pré-réglages : - + Dead Zone: Zone morte : - + Max Zone: Zone maximale : - - + + [NO KEY] [AUCUNE TOUCHE] - + Throttle setting that determines the behavior of how to interpret an axis hold or release. Configure l’accélération qui détermine le comportement de maintien ou de relâchement d'un axe. - + Negative Throttle Accélération négative - + Normal Normal - + Positive Throttle Accélération positive - + Current Value: Valeur actuelle : - + Set Configuration - + Set %1 - + Left Mouse Button - + Right Mouse Button @@ -1260,37 +1265,37 @@ de maintien ou de relâchement d'un axe. ButtonEditDialog - + Dialog Dialogue - + To make a new assignment, press any keyboard key or click a button in the Keyboard or Mouse tab Pour assigner une touche à ce bouton, presser celle-ci ou cliquer sur son équivalent graphique dans les onglets clavier et souris - + Placeholder Espace réservé - + Toggle Pression continue - + Enables a key press or release to only occur when a controller button is pressed. Permet d'appuyer ou de relâcher une touche uniquement lorsqu'un bouton est pressé. - + Enables rapid key presses and releases. Turbo controller. Permet d'appuyer et de relâcher très rapidement une touche en maintenant pressé un bouton. Contrôle du Turbo. - + Turbo Turbo @@ -1299,39 +1304,39 @@ de maintien ou de relâchement d'un axe. Actuellement : - + Last keyboard/mouse button: - + Slots Emplacements - + Na&me: Nom : - + Specify the name of a button. Indiquer le nom d'un bouton. - + Action: Action : - + Specify the action that will be performed in game while this button is being used. Indiquer l'action qui sera exécutée pendnt le jeu lorsque que ce bouton est utilisé. - + Advanced Avancé @@ -1340,52 +1345,52 @@ lorsque que ce bouton est utilisé. Configuration - - - + + + Choose your keyboard key - + No button - - - - + + + + Last button - + To change settings for last button, it must be at least one assignment from keyboard to gamepad - + To change settings of turbo for last button, it must be at least one assignment from keyboard to gamepad - + To open advanced dialog, it's needed to map at least one button from keyboard to gamepad - + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + As last gamepad button has been set - + Index %1 @@ -1393,190 +1398,190 @@ lorsque que ce bouton est utilisé. Calibration - + Form - - + + Start calibration - + Controller: - + Sticks: - - Use settings from jstest-gtk - - - - + Reset settings - + Cancel - - + + Save Enregistrer - - + + Calibration - - Do you really want to reset settings of current axes? + + Do you really want to reset settings of current axis? - + Calibration was saved for the preset. Do you really want to reset settings? - + Place the joystick in the center position. It's the part, where often you don't have to move. Just skip it in such situation. - + Calibrating center - + Start second step - + Center X: %1 - + Center Y: %1 - + Place the joystick in the top-left corner many times - - + + Calibrating position - - + + X: %1 - - + + Y: %1 - + Place the joystick in the bottom-right corner - + Start final step - + range X: %1 - %2 - + range Y: %1 - %2 - + deadzone X: %1 - + deadzone Y: %1 - + ---Calibration done!--- - + Calibration values have been saved - - + + Dead zone calibration - - You must move X axis to the right at least five times! Keep moving! + + You have to move axes to the top-left corner at least five times. + + + + + You have to move axes to the bottom-right corner at least five times. - - You must move X axis to the left at least five times! Keep moving! + + Do you want to save calibration of current axis? - - - - + + + + Axis %1 Axe %1 @@ -1584,64 +1589,64 @@ deadzone Y: %1 CapturedWindowInfoDialog - + Captured Window Properties - + Information About Window - + Class: - - - + + + TextLabel - + Title: - + Path: - + Match By Properties - + Class - + Title - + Path - + Full Path - + File Name @@ -1712,67 +1717,67 @@ deadzone Y: %1 DPadContextMenu - + Mouse (Normal) Souris (Normal) - + Mouse (Inverted Horizontal) Souris (Horizontal Inversé) - + Mouse (Inverted Vertical) Souris (Vertical Inversé) - + Mouse (Inverted Horizontal + Vertical) Souris (Vertical et Horizontal Inversés) - + Arrows Flèches - + Keys: W | A | S | D Touches :W | A | S | D - + NumPad - + None - + Standard Standard - + Eight Way Eight Way - + 4 Way Cardinal - + 4 Way Diagonal - + Mouse Settings Configurations de la Souris @@ -1780,108 +1785,108 @@ deadzone Y: %1 DPadEditDialog - + Dialog Dialogue - + Presets: Pré-réglages : - + Mouse (Normal) Souris (Normal) - + Mouse (Inverted Horizontal) Souris (Horizontal Inversé) - + Mouse (Inverted Vertical) Souris (Vertical Inversé) - + Mouse (Inverted Horizontal + Vertical) Souris (Vertical et Horizontal Inversés) - + Arrows Flèches - + Keys: W | A | S | D Touches :W | A | S | D - + NumPad Pavé Numérique - + None Aucun - + Dpad Mode: Mode Dpad : - + &Name: - + 4 Way Cardinal - + 4 Way Diagonal - + DPad Delay: - - + + Time lapsed before a direction change is taken into effect. - + s - + Specify the name of a dpad. Indiquer le nom d'un dpad. - + Mouse Settings Configurations de la Souris - + Standard Standard - + Standard: 8 region dpad with two direction buttons active when the dpad is in a diagonal region. @@ -1897,17 +1902,17 @@ to a diagonal zone. - + Eight Way Eight Way - + Set Configuration - + Set %1 @@ -1915,27 +1920,27 @@ to a diagonal zone. EditAllDefaultAutoProfileDialog - + Default Profile - + Profile: - + Browse - + Open Config Charger un fichier de configuration - + Profile file path is invalid. @@ -1943,29 +1948,29 @@ to a diagonal zone. ExtraProfileSettingsDialog - + Extra Profile Settings - + Key Press Time: - + 0.00 ms - + Profile Name: - - - + + + s @@ -1973,7 +1978,7 @@ to a diagonal zone. GameController - + Game Controller @@ -1981,9 +1986,9 @@ to a diagonal zone. GameControllerDPad - - - + + + DPad @@ -1991,187 +1996,187 @@ to a diagonal zone. GameControllerMappingDialog - + Game Controller Mapping Cartographie de contrôleur de jeu - + <html><head/><body><p>antimicro makes use of the <a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;">Game Controller API</span></a> provided by SDL 2 in order to abstract various gamepads to fit a unified standard. In order to make a button assignment, please highlight the mapping cell for the appropriate button row below. You can then press a button or move an axis on your gamepad and the cell will update with the physical button or axis that will be used.</p><p>antimicro will use the mapping that you specify to save a mapping string that will be loaded into SDL.</p></body></html> - + A - + B - + X - + Y - + Back Retour - + Start - + Guide - + Left Shoulder Latéral gauche - + Right Shoulder Latéral droit - + Left Stick Click Clic Stick Gauche - + Right Stick Click Clic Stick Droite - + Left Stick X Stick Gauche X - + Left Stick Y Stick Gauche Y - + Right Stick X Stick Droit X - + Right Stick Y Stick Droit Y - + Left Trigger Gachette gauche - + Right Trigger Gachette droite - + DPad Up DPad Haut - + DPad Left DPad Gauche - + DPad Down DPad Bas - + DPad Right DPad Droit - + Mapping Cartographie - + SDL 2 Game Controller Mapping String - + Last Axis Event: - + Current Axis Detection Dead Zone: - + 5000 5000 - + 10000 10000 - + 15000 15000 - + 20000 20000 - + 25000 25000 - + 30000 30000 - + 32000 32000 - + Game Controller Mapping (%1) (#%2) - + Discard Controller Mapping? Désactivé la cartographie de contrôleur de jeu ? - + Discard mapping for this controller? If discarded, the controller will be reverted to a joystick once you refresh all joysticks. @@ -2183,47 +2188,47 @@ S'il est éliminé, le contrôleur redeviendra un joystick une fois tous le GameControllerSet - + Back Retour - + Guide - + Start - + LS Click - + RS Click - + L Shoulder - + R Shoulder - + L Trigger - + R Trigger @@ -2231,9 +2236,9 @@ S'il est éliminé, le contrôleur redeviendra un joystick une fois tous le GameControllerTrigger - - - + + + Trigger Gachette @@ -2241,9 +2246,9 @@ S'il est éliminé, le contrôleur redeviendra un joystick une fois tous le JoyAxis - - - + + + Axis Axe @@ -2251,24 +2256,24 @@ S'il est éliminé, le contrôleur redeviendra un joystick une fois tous le JoyAxisButton - + Negative Négatif - + Positive Positif - + Unknown Inconnu - - - + + + Button Bouton @@ -2276,74 +2281,74 @@ S'il est éliminé, le contrôleur redeviendra un joystick une fois tous le JoyAxisContextMenu - + Mouse (Horizontal) Souris (Horizontal) - + Mouse (Inverted Horizontal) Souris (Horizontal Inversé) - + Mouse (Vertical) Souris (Vertical) - + Mouse (Inverted Vertical) Souris (Vertical Inversé) - + Arrows: Up | Down Flèches : Haut | Bas - + Arrows: Left | Right Flèches : Gauche | Droite - + Keys: W | S Touches : W | S - + Keys: A | D Touches : A | D - + NumPad: KP_8 | KP_2 Pavé Numérique : KP_8 | KP_2 - + NumPad: KP_4 | KP_6 Pavé Numérique : KP_4 | KP_6 - - + + None - - + + Mouse Settings Configurations de la Souris - + Left Mouse Button - + Right Mouse Button @@ -2351,57 +2356,57 @@ S'il est éliminé, le contrôleur redeviendra un joystick une fois tous le JoyButton - + Processing turbo for #%1 - %2 - + Finishing turbo for button #%1 - %2 - + Processing press for button #%1 - %2 - + Processing release for button #%1 - %2 - + Distance change for button #%1 - %2 - - - + + + Button Bouton - - - - + + + + [NO KEY] [AUCUNE TOUCHE] - + [Set %1 1W] - + [Set %1 2W] - + [Set %1 WH] @@ -2409,47 +2414,47 @@ S'il est éliminé, le contrôleur redeviendra un joystick une fois tous le JoyButtonContextMenu - + Toggle - + Turbo Turbo - + Clear - + Set Select - + Disabled Désactivé - + Set %1 - + Set %1 1W - + Set %1 2W - + Set %1 WH @@ -2457,118 +2462,118 @@ S'il est éliminé, le contrôleur redeviendra un joystick une fois tous le JoyButtonSlot - - + + Mouse Souris - + Up Haut - + Down Bas - + Left Gauche - + Right Droite - + LB BG - + MB BC - + RB BD - + B4 B4 - + B5 B5 - + Pause Pause - + Hold Maintenir - + Cycle Cycle - + Distance Distance - + Release Relâchement - + Mouse Mod Mode de la Souris - + Press Time - + Delay - + Load %1 - + Set Change %1 - + [Text] %1 - + [Exec] %1 - + [NO KEY] [AUCUNE TOUCHE] @@ -2576,9 +2581,9 @@ S'il est éliminé, le contrôleur redeviendra un joystick une fois tous le JoyControlStick - - - + + + Stick @@ -2586,37 +2591,37 @@ S'il est éliminé, le contrôleur redeviendra un joystick une fois tous le JoyControlStickButton - - - + + + Up Haut - - - + + + Down Bas - - - + + + Left Gauche - - - + + + Right Droite - - - + + + Button Bouton @@ -2624,67 +2629,67 @@ S'il est éliminé, le contrôleur redeviendra un joystick une fois tous le JoyControlStickContextMenu - + Mouse (Normal) Souris (Normal) - + Mouse (Inverted Horizontal) Souris (Horizontal Inversé) - + Mouse (Inverted Vertical) Souris (Vertical Inversé) - + Mouse (Inverted Horizontal + Vertical) Souris (Vertical et Horizontal Inversés) - + Arrows Flèches - + Keys: W | A | S | D Touches :W | A | S | D - + NumPad - + None - + Standard Standard - + Eight Way Eight Way - + 4 Way Cardinal - + 4 Way Diagonal - + Mouse Settings Configurations de la Souris @@ -2692,86 +2697,86 @@ S'il est éliminé, le contrôleur redeviendra un joystick une fois tous le JoyControlStickEditDialog - + Dialog Dialogue - + X: X : - - - - - + + + + + 0 0 - + Y: Y : - + Distance: Distance : - + Presets: Pré-réglages : - + Mouse (Normal) Souris (Normal) - + Mouse (Inverted Horizontal) Souris (Horizontal Inversé) - + Mouse (Inverted Vertical) Souris (Vertical Inversé) - + Mouse (Inverted Horizontal + Vertical) Souris (Vertical et Horizontal Inversés) - + Arrows Flèches - + Keys: W | A | S | D Touches :W | A | S | D - + NumPad NumPad - + None Aucub - + Stick Mode: Mode du Stick : - + Standard: 8 region stick with two direction buttons active when the stick is in a diagonal region. @@ -2787,72 +2792,72 @@ to a diagonal zone of the stick. - + 4 Way Cardinal - + 4 Way Diagonal - - + + Dead zone value to use for an analog stick. - - + + Value when an analog stick is considered moved 100%. - - + + The area (in degrees) that each diagonal region occupies. - + Square Stick: - - + + Percentage to modify a square stick coordinates to confine values to a circle - + % % - + Stick Delay: - - + + Time lapsed before a direction change is taken into effect. - + s - + Modifier: - + Edit button that is active while the stick is active. This button is useful for assigning zones with @@ -2861,68 +2866,68 @@ functionality to an analog stick. - + PushButton - + Na&me: Name: Nom : - + Specify the name of an analog stick. Indiquer le nom d'un stick analogue. - + Mouse Settings Configurations de la Souris - + Standard Standard - + Bearing: - + % Safe Zone: - + Eight Way Eight Way - + Dead Zone: Zone morte : - + Max Zone: Zone maximale : - + Diagonal Range: Valleur de diagonale : - + Set Configuration - + Set %1 @@ -2930,9 +2935,9 @@ functionality to an analog stick. JoyControlStickModifierButton - - - + + + Modifier @@ -2940,9 +2945,9 @@ functionality to an analog stick. JoyDPad - - - + + + DPad @@ -2950,37 +2955,37 @@ functionality to an analog stick. JoyDPadButton - - - + + + Up Haut - - - + + + Down Bas - - - + + + Left Gauche - - - + + + Right Droite - - - + + + Button Bouton @@ -2988,266 +2993,271 @@ functionality to an analog stick. JoyTabWidget - - - - - - + + + + + + <New> <Nouveau> - - + + Remove Supprimer - - + + Remove configuration from recent list. Supprimer la configuration depuis la liste des recents. - - + + Load Charger - - + + Load configuration file. Charger un fichier de configuration. - - + + Save Enregistrer - - + + Save changes to configuration file. Enregistrer les modifications dans le fichier de configuration. - - + + Save As Enregistrer Sous - - + + Save changes to a new configuration file. Enregistrer les modifications dans un nouveau fichier de configuration. - - + + Sets - + Copy from Set - + Settings - - + + Set 1 - - + + Set 2 - - + + Set 3 - - + + Set 4 - - + + Set 5 - - + + Set 6 - - + + Set 7 - - + + Set 8 - - + + Stick/Pad Assign Assignement du Stick/Pad - - + + Controller Mapping - - + + Quick Set Configuration Rapide - - + + Names Noms - - + + Toggle button name displaying. Alterner nom du bouton d'affichage. - - + + Pref - - + + Change global profile settings. - - - + + + Reset Réinitialiser - - + + Revert changes to the configuration. Reload configuration file. Annuler les changements de configuration. Recharger le fichier de configuration. - + Open Config Charger un fichier de configuration - + Config Files (*.amgp *.xml) - - - + + + Config File (*.%1.amgp) - - + + Do you really want to reset buttons settings for joystick? + + + + + Save Profile Changes? - - + + Changes to the new profile have not been saved. Would you like to save or discard the current profile? - - + + Changes to the profile "%1" have not been saved. Would you like to save or discard changes to the current profile? - + Sticks Sticks - - + + DPads DPads - + No buttons have been assigned. Please use Quick Set to assign keys to buttons or disable hiding empty buttons. - - + + Set %1: %2 - - + + Set %1 - + Copy Set Assignments - + Are you sure you want to copy the assignments and device properties from %1? - - - + + + Save Config Enregistrer le fichier de configuration - - + + Set Configuration @@ -3255,7 +3265,7 @@ to buttons or disable hiding empty buttons. Joystick - + Joystick Manette @@ -3263,98 +3273,98 @@ to buttons or disable hiding empty buttons. JoystickStatusWindow - + Properties Propriétés - + Details Détails - + Name: Nom : - - - - - - - + + + + + + + %1 %1 - + Number: Nombre : - + Axes: Axes : - + Buttons: Boutons : - + Hats: Hats : - + GUID: GUID : - + Game Controller: - + Axes Axes - + Buttons Boutons - + Hats Hats - + %1 (#%2) Properties %1 (#%2) Propriétés - + Axis %1 Axe %1 - + Hat %1 Hat %1 - + No - + Yes @@ -3362,62 +3372,67 @@ to buttons or disable hiding empty buttons. MainSettingsDialog - + Edit Settings Modifier les paramètres - + General - + Controller Mappings Cartographie de contrôleur - + Language - + Auto Profile - + Mouse Souris - + Advanced Avancé - + + Profile Direc&tory: + + + + <html><head/><body><p>Specify the default directory that the program should use in file dialogs when loading a profile or saving a new profile.</p></body></html> - + Recent Profile Count: - + <html><head/><body><p>Number of profiles that can be placed in recent profile list. 0 will result in the program not enforcing a limit on the number of profiles displayed.</p></body></html> - + Gamepad Poll Rate: - + Change the poll rate that the program uses to discover new events from gamepads. Defaults to 10 ms. @@ -3427,52 +3442,52 @@ before using antimicro unattended. - + Hide main window when the main window close button is clicked instead of quitting the program. - + Close To Tray - + Have Windows start antimicro at system startup. - + Launch At Windows Startup - + Display recent profiles for all controllers as a single list in the tray menu. Defaults to using sub-menus. - + Single Profile List in Tray - + Have the program minimize to the taskbar. By default, the program minimizes to the system tray if available. - + Minimize to Taskbar - + This option will cause the program to hide all buttons that have no slots assigned to them. The Quick Set dialog window will have to be used @@ -3480,184 +3495,194 @@ to bring up the edit dialog for gamepad buttons. - + Hide Empty Buttons - + When the program is launched, open the last known profile that was opened during the previous session. - + Auto Load Last Opened Profile - + Only show the system tray icon when the program first launches. - + Launch in Tray - + Associate .amgp files with antimicro in Windows Explorer. - + Associate Profiles - + Key Repeat - + Active keys will be repeatedly pressed when this option is enabled. - - + + Enable - + Specifies how much time should elapse before key repeating begins. - + Specifies how many times key presses will be performed per seconds. - + <html><head/><body><p>antimicro has been translated into many different languages by contributors. By default, the program will choose an appropriate translation based on your system's locale setting. However, you can make antimicro load a different translation depending on the language that you choose from the list below.</p></body></html> - + Português do Brasil - + Français - + Deutsch - + Italiano - + 日本語 - + Русский - + српски / srpski - + 简体中文 - + Español - + українська - + Polski - + + History Si&ze: + + + + Log File: - + Log Level: - + None - + Error - + Warning - + Info - + Debug - + + Reset + Réinitialiser + + + Class - + Title - + Program - + Disable the "Enhanced Pointer Precision" Windows setting while antimicro is running. Disabling "Enhanced Pointer Precision" will allow mouse movement within antimicro to be more @@ -3665,32 +3690,27 @@ precise. - + Disable Enhance Pointer Precision - + Smoothing - - Histor&y Size: - - - - + Weight &Modifier: - + Refresh Rate: - + The refresh rate is the amount of time that will elapse in between mouse events. Please be cautious when editing this setting as it will cause the program to use @@ -3700,46 +3720,46 @@ it unattended. - + Spring Ressort - + Screen: - + Utilize the specified screen for spring mode. On Linux, the default is to use the primary screen. On Windows, the default is to use all available screens. - + Accel Numerator: - - - + + + 0 0 - + Accel Denominator: - + Accel Threshold: - + If the acceleration values for the virtual mouse have been changed by a different process, particularly when quitting an older game, then you might want to reset the acceleration @@ -3747,37 +3767,32 @@ values used by the virtual mouse. - + Reset Acceleration - + Delay: Intervalle : - - Profi&le Directory: - - - - + ms - + Rate: Taux : - + times/s - + Below is a list of the custom mappings that have been saved. You can use the following table to delete mappings or have mappings temporarily disabled. You can also disable mappings that are included with SDL; just insert a new row with the appropriate joystick GUID and check disable. Settings will not take affect until you either refresh all joysticks or unplug that particular joystick. @@ -3786,128 +3801,138 @@ Settings will not take affect until you either refresh all joysticks or unplug t Les paramètres ne prennent effet que lors de la prochaine réactualisation des joysticks ou en débranchant la manette spécifique. - + GUID - + Mapping String Chaîne de cartographie - + Disable? Désactiver ? - - + + Delete Supprimer - + Insert Insérer - - + + Default - + English - - + + Active - + Devices: - - + + All - + Device - + Profile - + Default? - + Add - + Edit - + Also, Windows users who want to use a low value should also check the "Disable Enhance Pointer Precision" checkbox if you haven't disabled the option in Windows. - + Select Default Profile Directory - + Are you sure you want to delete the profile? - + Save Log File As - + Log Files (*.log) + + + Do you really want to reset setting? + + + + + Would you like to reset mappings too? + + MainWindow - + No Joysticks have been found. Please plug in a joystick and then choose the "Update Joysticks" option in the main menu Aucune manette n'a été détéctée. Merci de brancher une manette et de choisir l'option "Mettre à jour les manettes" du menu principal - + If events are not seen by a game, please click here to run this application as Administrator. - + &App @@ -3916,110 +3941,110 @@ the option in Windows. Assignement du Stick/Pad - + &Options &Options - + antimicro - + &Help &Aide - - + + &Quit &Quitter - + Ctrl+Q Ctrl+Q - - + + &Update Joysticks &Mettre à jour les manettes - + Ctrl+U Ctrl+U - - + + &Hide &Masquer - + Ctrl+H Ctrl+H - + &About &À propos - + Ctrl+A Ctrl+A - + About &Qt - + &Properties - + &Key Checker - + &GitHub Page - + &Game Controller Mapping - + S&ettings - + &Stick/Pad Assign - + &Wiki - + &Issues - + &Calibration @@ -4036,7 +4061,7 @@ the option in Windows. Vérificateur de clé - + Home Page Page d'accueil @@ -4049,66 +4074,66 @@ the option in Windows. Cartographie de contrôleur de jeu - + Could not find a proper controller identifier. Exiting. - - - - - - - + + + + + + + (%1) - - + + Open File Ouvrir fichier - + &Restore &Restaurer - + Calibration couldn't be opened - + You must connect at least one controller to open the window - + Run as Administrator? - + Are you sure that you want to run this program as Adminstrator? Some games run as Administrator which will cause events generated by antimicro to not be used by those games unless antimicro is also run as the Adminstrator. This is due to permission problems caused by User Account Control (UAC) options in Windows Vista and later. - + Failed to elevate program - + Failed to restart this program as the Administrator - + Could not find controller. Exiting. @@ -4116,12 +4141,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseAxisSettingsDialog - + Mouse Settings - Configurations de la Souris - - + Set %1 @@ -4129,12 +4154,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseButtonSettingsDialog - + Mouse Settings - Configurations de la Souris - - + Set %1 @@ -4142,12 +4167,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseControlStickSettingsDialog - + Mouse Settings Configurations de la Souris - + Set %1 @@ -4155,12 +4180,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseDPadSettingsDialog - + Mouse Settings Configurations de la Souris - + Set %1 @@ -4168,17 +4193,17 @@ Some games run as Administrator which will cause events generated by antimicro t MouseSettingsDialog - + Mouse Settings Configurations de la Souris - + Mouse Mode: Mode de la Souris : - + Cursor mode is used to move the mouse cursor around the screen relative to its current position depending on how much you move an axis @@ -4201,80 +4226,80 @@ retourne au centre de l'écran quand l'axe est déplacé vers la zone morte. - + Cursor Curseur - + Spring Ressort - + Acceleration: Accélération : - + Enhanced Precision - - + + Linear Linéair - + Quadratic Quadratique - + Cubic Cubique - + Quadratic Extreme Quadratique Extreme - + Power Function Fonction Énergie - + Easing Quadratic - + Easing Cubic - + Mouse Speed Settings Configurations de la Vitesse de la Souris - + Enable to change the horizontal and vertical speed boxes at the same time. Activer la modification simultanée des boîtes de vitesse horizontale et verticale. - + Change Together Modifier en même temps - + Options for adding more acceleration to the mouse movement beyond what the acceleration curve would produce. Acceleration is added based on how quickly an axis is @@ -4284,17 +4309,17 @@ using typical gamepad analog sticks. - + Delta Acceleration - + &Multiplier: - + Mi&n Threshold: @@ -4306,8 +4331,8 @@ Speed: horizontale : - - + + 1 = 20 pps 1 = 20 pps @@ -4318,31 +4343,31 @@ Speed: verticale : - + Wheel Hori. Speed: Molette Hori. Vitesse : - + Set the speed used for horizontal mouse wheel movement according to number of simulated notches per second. - + Set the speed used for vertical mouse wheel movement according to number of simulated notches per second. - + Sensitivit&y: - + For Power Function acceleration curve. Specifies the factor to use for curve sensitivity. When the value is above 1.0, the mouse movement will be accelerated @@ -4350,122 +4375,122 @@ faster at the low end of an axis. - + Easing Duration: - - + + s - + Highest value to accelerate mouse movement by - + x - + Start %: - + Acceleration begins at this percentage of the base multiplier - + Minimum amount of axis travel required for acceleration to begin - + Max Threshold: - + Maximum axis travel before acceleration has reached the multiplier value - + E&xtra Duration: - + Curve: - + Ease Out Sine - + Ease Out Quad - + Ease Out Cubic - + Release Radius: - + Specifies that the spring area will be relative to the mouse position set by a non-relative spring. - + Relative - + Mouse Status - + X: X : - - + + 0 (0 pps) - + Y: Y : - - + + 1 = 1 notch(es)/s 1 = 1 cran(s)/s - + Enhanced: Three tier curve that makes the mouse move slow on the low end of an axis and fast on the high end. @@ -4487,19 +4512,19 @@ a period of time using a Cubic curve. - + Hori&zontal Speed: - + &Vertical Speed: - + Wheel Vert. Speed: Molette Vert. @@ -4510,39 +4535,39 @@ Vitesse : Sensibilité : - + Specifies the amount of time (in seconds) that will be required before the mouse is fully accelerated after reaching the high end of an axis. - - - - + + + + % % - + Extend the time that extra acceleration is applied. Axis travel will be taken into account. A slower flick will decrease the actual time that extra acceleration will be applied. - + Spring Settings Configuration du Ressort - + Spring Width: Largeur du Ressort : - + Changes the width of the region that the cursor can move in spring mode. 0 will use the entire width of your screen. @@ -4551,12 +4576,12 @@ le curseur peut se déplacer en mode "ressort". 0 utilise toute la largeur de l'écran. - + Spring Height: Hauteur du Ressort : - + Changes the height of the region that the cursor can move in spring mode. 0 will use the entire height of your screen. @@ -4565,8 +4590,8 @@ le curseur peut se déplacer en mode "ressort". 0 utilise toute la hauteur de l'écran. - - + + %n notch(es)/s %n cran/s @@ -4577,39 +4602,39 @@ le curseur peut se déplacer en mode "ressort". QKeyDisplayDialog - + Key Checker Vérificateur de touche - - <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> + + <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="http://doc.qt.io/qt-5/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">http://doc.qt.io/qt-5/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> - + Event Handler: - + Native Key Value: Valeur native de la touche : - - - + + + 0x00000000 - + Qt Key Value: Valeur de la touche Qt : - + antimicro Key Value: @@ -4617,265 +4642,265 @@ le curseur peut se déplacer en mode "ressort". QObject - + Super Super - + Menu - + Mute - + Vol+ - + Vol- - + Play/Pause - + Play - + Pause Pause - + Prev - + Next Suivant - + Mail - + Home Début - + Media - + Search - + Daemon launched - + Failed to launch daemon - + Launching daemon - - + + Display string "%1" is not valid. - + Failed to set a signature id for the daemon - + Failed to change working directory to / - + Quitting Program - + # of joysticks found: %1 - + List Joysticks: - + --------------- - + Joystick %1: - + Index: %1 - + GUID: %1 - + Name: %1 - + Yes - + No - + Game Controller: %1 - + # of Axes: %1 - + # of Buttons: %1 - + # of Hats: %1 - + Attempting to use fallback option %1 for event generation. - + Failed to open event generator. Exiting. - + Using %1 as the event generator. - + Could not raise process priority. - + Last button - + There isn't a last button pressed from gamepad in data. Did you set at least one button from gamepad for keyboard? - + Active window changed to: Title = "%1", Class = "%2", Program = "%3" or "%4". - + Profile location %1 is not an XML file. Le fichier profile %1 n'est pas un fichier XML. - + Profile location %1 does not exist. Le fichier profile %1 n'existe pas. - - - + + + Controller identifier is not a valid value. L'identifiant du contrôleur n'est pas une valeur valide. - + An invalid set number '%1' was specified. - + Controller identifier '%s'' is not a valid value. - + No set number was specified. - + No controller was specified. - + No display string was specified. - + An invalid event generator was specified. - + No event generator string was specified. - + No log file specified. @@ -4928,22 +4953,22 @@ le curseur peut se déplacer en mode "ressort". La valeur peut être un index, un nom ou le GUID d'un controleur. - + Logging started - + Auto-switching to profile "%1". - + Auto-switching to nullptr profile! - + xinput version must be at least 2.0. No mouse acceleration changes will occur. @@ -4951,18 +4976,18 @@ le curseur peut se déplacer en mode "ressort". QuickSetDialog - + Quick Set Configuration Rapide - + <html><head/><body><p>Please press a button or move an axis on %1 (<span style=" font-weight:600;">%2</span>).<br/>A dialog window will then appear which will<br/>allow you to make an assignment.</p></body></html> <html><head/><body><p>Merci de presser un bouton ou de bouger un axe de %1 (<span style=" font-weight:600;">%2</span>).<br/>Une fenêtre de dialogue va apparaître<br/>pour permettre de faire une assignation.</p></body></html> - - + + Quick Set %1 Configuration Rapide %1 @@ -4970,12 +4995,12 @@ le curseur peut se déplacer en mode "ressort". SetAxisThrottleDialog - + Throttle Change Modifier l'accélération - + The throttle setting for Axis %1 has been changed. Would you like to distribute this throttle change to all sets? @@ -4988,12 +5013,12 @@ Faut-il appliquer cette valeur d'accélération à tous les réglages ? SetJoystick - + Set %1: %2 - + Set %1 @@ -5001,52 +5026,52 @@ Faut-il appliquer cette valeur d'accélération à tous les réglages ? SetNamesDialog - + Set Name Settings - + Set 1 - + Set 2 - + Set 3 - + Set 4 - + Set 5 - + Set 6 - + Set 7 - + Set 8 - + Name @@ -5054,7 +5079,7 @@ Faut-il appliquer cette valeur d'accélération à tous les réglages ? SimpleKeyGrabberButton - + Mouse Souris @@ -5062,7 +5087,7 @@ Faut-il appliquer cette valeur d'accélération à tous les réglages ? SpringModeRegionPreview - + Spring Mode Preview Aperçu du mode ressort @@ -5070,20 +5095,20 @@ Faut-il appliquer cette valeur d'accélération à tous les réglages ? UInputEventHandler - + Could not find a valid uinput device file. Please check that you have the uinput module loaded. lsmod | grep uinput - + Could not open uinput device file Please check that you have permission to write to the device - + Using uinput device file %1 @@ -5091,551 +5116,551 @@ Please check that you have permission to write to the device UInputHelper - + a q - + b - + c - + d - + e - + f - + g - + h - + i - + j - + k - + l - + m , - + n - + o - + p - + q a - + r - + s - + t - + u - + v - + w z - + x - + y - + z w - + Esc - + F1 - + F2 - + F3 - + F4 - + F5 - + F6 - + F7 - + F8 - + F9 - + F10 - + F11 - + F12 - + ` - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - - + + - - + = - + BackSpace Retour Arrière - + Tab Tab - + [ - + ] - + \ - + CapsLock - + ; - + ' - + Enter - + Shift_L Maj_G - + , - - + + . - - + + / - + Ctrl_L - - + + Super_L Super_L - + Alt_L Alt_L - + Space Espace - + Alt_R Alt_R - + Menu Menu - + Ctrl_R - + Shift_R Maj_D - + Up Haut - + Left Gauche - + Down Bas - + Right Droite - + PrtSc - + Ins - + Del - + Home Début - + End End - + PgUp - + PgDn - + NumLock - + * - + + - + KP_Enter KP_Entrée - + KP_1 - + KP_2 - + KP_3 - + KP_4 - + KP_5 - + KP_6 - + KP_7 - + KP_8 - + KP_9 - + KP_0 - + SCLK Arrêt Defil - + Pause Pause - + Super_R - + Mute - + VolDn - + VolUp - + Play - + Stop - + Prev - + Next Suivant - + [NO KEY] [AUCUNE TOUCHE] @@ -5643,54 +5668,54 @@ Please check that you have permission to write to the device UnixWindowInfoDialog - + Captured Window Properties - + Information About Window - + Class: - - - + + + TextLabel - + Title: - + Path: - + Match By Properties - + Class - + Title - + Path @@ -5698,9 +5723,9 @@ Please check that you have permission to write to the device VDPad - - - + + + VDPad @@ -5708,224 +5733,224 @@ Please check that you have permission to write to the device VirtualKeyPushButton - + Space Espace - + Tab Tab - + Shift (L) Maj (G) - + Shift (R) Maj (D) - + Ctrl (L) Ctrl (G) - + Ctrl (R) Ctrl (D) - + Alt (L) Alt (G) - - + + Alt (R) Alt (D) - + Alt Gr - + ` - + ~ - - + + - - + = - + [ - + ] - + \ - + Caps Verr Maj - + ; - + ' - + , - - + + . - - + + / - + ESC ECHAP - + PRTSC Impr Ecran - + SCLK Arrêt Defil - + INS INSER - + PGUP PGUP - + DEL SUPPR - + PGDN PGDN - + 1 - + 2 - + 3 - + 4 - + 5 - + 6 - + 7 - + 8 - + 9 - + 0 - + NUM LK VERR NUM - - + + * - + + - + Enter @@ -5943,42 +5968,42 @@ R E - + < - + : - + Super (L) Super (G) - + Menu - + Up Haut - + Down Bas - + Left Gauche - + Right Droite @@ -5986,226 +6011,226 @@ E VirtualKeyboardMouseWidget - - + + Keyboard Clavier - - + + Mouse Souris - + Mouse Settings Configurations de la Souris - + Left Mouse Gauche - + Up Mouse Haut - + Left Button Mouse - + Middle Button Mouse - + Right Button Mouse - + Wheel Up Mouse Molette bas - + Wheel Left Mouse Molette gauche - + Wheel Right Mouse Molette droite - + Wheel Down Mouse Molette bas - + Down Mouse Bas - + Right Mouse Droite - + Button 4 Mouse Bouton 4 - + Mouse 8 Mouse Souris 8 - + Button 5 Mouse Bouton 5 - + Mouse 9 Mouse Souris 9 - + NONE AUCUNE - - + + Last button - - + + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + Others - + Applications - + Browser Back - + Browser Favorites - + Browser Forward - + Browser Home - + Browser Refresh - + Browser Search - + Browser Stop - + Calc - + Email - + Media - + Media Next - + Media Play - + Media Previous - + Media Stop - + Search - + Volume Down - + Volume Mute - + Volume Up @@ -6213,7 +6238,7 @@ E VirtualMousePushButton - + INVALID INVALIDE @@ -6221,28 +6246,28 @@ E WinAppProfileTimerDialog - - + + Capture Application - + After pressing the "Capture Application" button, please select the application window that you want to have a profile associated with. The active application will be captured after the selected number of seconds. - + Timer: - + Seconds - + Cancel @@ -6250,12 +6275,12 @@ E WinExtras - + [NO KEY] [AUCUNE TOUCHE] - + AntiMicro Profile @@ -6263,67 +6288,62 @@ E X11Extras - + ESC ECHAP - + Tab Tab - + Space Espace - + DEL SUPPR - + Return - + KP_Enter KP_Entrée - + Backspace Retour arrière - + Alt Gr - + xinput extension was not found. No mouse acceleration changes will occur. - + xinput version must be at least 2.0. No mouse acceleration changes will occur. - - Virtual pointer found with id=%1. - - - - + PtrFeedbackClass was not found for virtual pointer.No change to mouse acceleration will occur for device with id=%1 - + Changing mouse acceleration for device with id=%1 @@ -6331,7 +6351,7 @@ E XMLConfigReader - + Could not write updated profile XML to file %1. Impossible de mettre à jour le profil XML du fichier %1. @@ -6339,7 +6359,7 @@ E XMLConfigWriter - + Could not write to profile at %1. Impossible d'écrire le profil %1. @@ -6347,7 +6367,7 @@ E antimicro - + Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support. @@ -6355,97 +6375,97 @@ E main - + Launch program in system tray only. Lance le logiciel directement dans la zone de notification. - + Launch program with the tray menu disabled - + Launch program without the main window displayed - + Launch program with the configuration file selected as the default for selected controllers. Defaults to all controllers - + location - + Apply configuration file to a specific controller. Value can be a controller index, name, or GUID - + value - + Unload currently enabled profile(s) - + value(s) - + Start joysticks on a specific set. Value can be a controller index, name, or GUID - + number value - + Launch program as a daemon. Use only on Linux. - + Enable logging - + log-type - + Choose a file for logs writing - + filename - + Choose between using XTest support and uinput support for event generation. Use only if you have enabled xtest and uinput options on Linux or vmulti on Windows. Default: xtest. - + event-generation-type - + Print information about joysticks detected by SDL. Use only if you have sdl library. You can check your controller index, name or even GUID. diff --git a/share/antimicro/translations/antimicro_it.ts b/share/antimicro/translations/antimicro_it.ts old mode 100644 new mode 100755 index f58b38548..14a8935e9 --- a/share/antimicro/translations/antimicro_it.ts +++ b/share/antimicro/translations/antimicro_it.ts @@ -4,17 +4,17 @@ AboutDialog - + About A proposito - + Version Versione - + "juliagoda" (since March, 2018) Wanting only to play my favourite old games that din't support gamepads, I found this project (which map keyboard keys and mouse buttons to connected gamepads on Linux) as most proper and recent. But because of poor choices of such application on the internet and since it didn't compile properly, I decided to rescue the project. However, once I finished my work (enough to enjoy playing games) I thought about sharing this code with others. Of course all informations about past programmers will be held. "Ryochan7" (since December 30, 2012 until 2017), I have been working on antimicro in my spare time. What originally started as a fork of QJoyPad and a way to learn proper event-driven programming has turned into something much bigger than I originally intended. Although I have spent a lot of time learning new techniques, finding out more about the domain of KB+M emulation, and spending Friday nights bashing my head against my keyboard, it has been a fun and enriching experience overall. @@ -32,17 +32,17 @@ As of May 24, 2016, this project has moved to https://github.com/AntiMicro/antim - + Copyright: 2013 - 2018 Copyright: 2013 - 2016 {2013 ?} {2018?} {2013 ?} - + Info Info - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -86,7 +86,7 @@ p, li { white-space: pre-wrap; } - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -204,7 +204,7 @@ p, li { white-space: pre-wrap; } - + Changelog Changelog @@ -213,52 +213,52 @@ p, li { white-space: pre-wrap; } Copyright: 2013 - 2016 {2013 ?} {2016?} - + Credits Ringraziamenti - + antimicro antimicro - + About Development Informazioni sviluppo - + License Licenza - + Program Version %1 Versione programma %1 - + Program Compiled on %1 at %2 Programma compilato il %1 alle %2 - + Built Against SDL %1 Costruito con SDL %1 - + Running With SDL %1 Eseguito con SDL %1 - + Using Qt %1 Utilizzando Qt %1 - + Using Event Handler: %1 Gestore di eventi in uso: %1 @@ -266,29 +266,29 @@ p, li { white-space: pre-wrap; } AddEditAutoProfileDialog - + Auto Profile Dialog Finestra di auto-profilo - + Profile: Profilo: - - + + Browse Sfoglia - + Window: Finestra: - - + + Select Window. Click on the appropriate application window and the application file path will be populated in the form. @@ -296,38 +296,47 @@ in the form. e il percorso al file dell'applicazione riempirà il campo. - + Detect Window Properties Rileva proprietà finestra - + Class: Classe: - + Title: Titolo: - + + set partial title + + + + Application: Applicazione: - + Select Seleziona - + + De&vices: + + + Devices: - Dispositivi: + Dispositivi: - - + + Select this profile to be the default loaded for the specified device. The selection will be used instead of the all default profile option. @@ -336,84 +345,84 @@ per il dispositivo specificato. La selezione verrà usata al posto di qualsiasi altro profilo predefinito. - + Set as Default for Controller Imposta come controller predefinito - - + + A different profile is already selected as the default for this device. È già stato selezionato un altro profilo come predefinito per questo dispositivo. - + Current (%1) Corrente (%1) - + Open Config Apri configurazione - - + + Select Program Seleziona programma - + Programs (*.exe) Programmi (*.exe) - + Please use the main default profile selection. Per favore usa la selezione profilo predefinita principale. - + Please select a window by using the mouse. Press Escape if you want to cancel. Per favore seleziona una finestra utilizzando il mouse. Premi Esc se vuoi annullare. - + Capture Application Window Cattura finestra applicazione - + Could not obtain information for the selected window. Impossibile ottenere le informazioni della finestra selezionata. - + Application Capture Failed Cattura applicazione fallita - + Profile file path is invalid. Percorso del file di profilo invalida. - + No window matching property was specified. Non è stata specificata alcuna proprietà per identificare la finestra. - + Program path is invalid or not executable. Il programma è invalido o non è un eseguibile. - + File is not an .exe file. Il file non è un .exe. - + No window matching property was selected. Non è stata selezionata alcuna proprietà per identificare la finestra. @@ -421,187 +430,187 @@ al posto di qualsiasi altro profilo predefinito. AdvanceButtonDialog - - + + Advanced Avanzate - + Assignments Assegnazioni - + Toggle Cambio stato - + Turbo Turbo - + Set Selector Selezionatore set - + Blank or KB/M Vuoto o Tastiera/Mouse - + Hold Tieni - + Pause Pausa - + Cycle Ciclo - + Distance Distanza - + Insert Inserisci - + Delete Cancella - + Clear All Cancella tutto - + Time: Tempo: - + 0.01s 0.01s - + 0s 0s - + Insert a pause that occurs in between key presses. Inserisci una pausa tra un tasto e l'altro. - + Release Rilascia - - + + Insert a new blank slot. Inserisci un nuovo slot vuoto. - + Delete a slot. Cancella uno slot. - + Clear all currently assigned slots. Cancella tutti gli slot assegnati. - + Specify the duration of an inserted Pause or Hold slot. Specifica la durata di una Pausa inserita o di un Tieni. - + 0m 0m - + &Mouse Speed Mod: - - + + Specify the range past an axis dead zone in which a sequence of actions will execute. Specifica l'intervallo dopo la zona morta di un'asse in cui una sequenza di azioni verrà eseguita. - + Distance: Distanza: - - + + % % - + Mouse Mod Modifica mouse - + Press Time Tempo di pressione - + Delay Ritardo - + Execute Esegui - + Load Carica - + Set Change Cambio di set - + Text Entry Inserimento testo - + Placeholder Segnaposto - - + + 0 0 @@ -610,317 +619,317 @@ al posto di qualsiasi altro profilo predefinito. Modifica velocità mouse: - + Set the percentage that mouse speeds will be modified by. Imposta la percentuale con cui le velocità del mouse verranno modificate. - + Auto Reset Cycle After Auto-resetta ciclo dopo - + seconds secondi - + Executable: - + ... ... - + Arguments: - - - + + + Enabled Attivato - + Mode: Modalità: - + <html><head/><body><p>Normal: Repeatedly press and release a button by the chosen rate.</p><p>Gradient: Modify the button press and button release delay based on how far an axis has been moved. The rate will remain the same.</p><p>Pulse: Modify how many times a button is pressed and released per second. The button delay will remain the same.</p></body></html> <html><head/><body><p>Normale: preme e rilascia ripetutamente un tasto a seconda del rapporto scelto.</p><p>Gradiente: modifica il tasto premuto e il ritardo di un tasto rilasciato a seconda di quanto è stata mossa un'asse. Il rapporto rimarrà lo stesso.</p><p>Pulsa: modifica quante volte un tasto viene premuto e rilasciato al secondo. Il ritardo del tasto rimarrà lo stesso.</p></body></html> - + Normal Normale - + Gradient Gradiente - + Pulse Pulsa - + Delay: Ritardo: - + 0.10s 0.10s - + Rate: Rapporto: - + 10.0/s 10.0/s - - + + Disabled Disattivato - + Select Set 1 One Way Selezione set 1 a una direzione - + Select Set 1 Two Way Selezione set 1 a due direzioni - + Select Set 1 While Held Selezione set 1 finché premuto - + Select Set 2 One Way Selezione set 2 a una direzione - + Select Set 2 Two Way Selezione set 2 a due direzioni - + Select Set 2 While Held Selezione set 2 finché premuto - + Select Set 3 One Way Selezione set 3 a una direzione - + Select Set 3 Two Way Selezione set 3 a due direzioni - + Select Set 3 While Held Selezione set 3 finché premuto - + Select Set 4 One Way Selezione set 4 a una direzione - + Select Set 4 Two Way Selezione set 4 a due direzioni - + Select Set 4 While Held Selezione set 4 finché premuto - + Select Set 5 One Way Selezione set 5 a una direzione - + Select Set 5 Two Way Selezione set 5 a due direzioni - + Select Set 5 While Held Selezione set 5 finché premuto - + Select Set 6 One Way Selezione set 6 a una direzione - + Select Set 6 Two Way Selezione set 6 a due direzioni - + Select Set 6 While Held Selezione set 6 finché premuto - + Select Set 7 One Way Selezione set 7 a una direzione - + Select Set 7 Two Way Selezione set 7 a due direzioni - + Select Set 7 While Held Selezione set 7 finché premuto - + Select Set 8 One Way Selezione set 8 a una direzione - + Select Set 8 Two Way Selezione set 8 a due direzioni - + Select Set 8 While Held Selezione set 8 finché premuto - + sec. sec. - + /sec. /sec. - + Set %1 Set %1 - - + + Select Set %1 Seleziona set %1 - + One Way a una direzione - + Two Way a due direzioni - + While Held finché premuto - + Choose Executable Scegli eseguibile - + Slots past a Cycle action will be executed on the next button press. Multiple cycles can be added in order to create partitions in a sequence. Gli slot dopo un'azione Ciclo verranno eseguiti al prossimo tasto premuto. Cicli multipli possono essere aggiunti per creare partizioni in sequenza. - + Delays the time that the next slot is activated by the time specified. Slots activated before the delay will remain active after the delay time has passed. Ritarda il tempo dopo il quale il prossimo slot viene attivato per il tempo specificato. Gli slot attivati prima del ritardo rimarranno attivi finché il ritardo non trascorre. - + Distance action specifies that the slots afterwards will only be executed when an axis is moved a certain range past the designated dead zone. L'azione Distanza specifica che gli slot successivi verranno eseguiti solo quando un'asse si muove oltre un certo intervallo dopo la zona morta. - + Insert a hold action. Slots after the action will only be executed if the button is held past the interval specified. Inserisce un'azione Tieni. Gli slot dopo l'azione verranno eseguiti solo se il tasto viene tenuto premuto oltre all'intervallo specificato. - + Chose a profile to load when this slot is activated. Scegli un profilo da caricare quando questo slot viene attivato. - + Mouse mod action will modify all mouse speed settings by a specified percentage while the action is being processed. This can be useful for slowing down the mouse while sniping. L'azione Modifica mouse modificherà tutte le impostazioni della velocità mouse di una percentuale specifica mentre l'azione viene processata. Questo può tornare utile per rallentare il mouse usando un fucile da cecchino. - + Specify the time that keys past this slot should be held down. Specifica il tempo in cui i tasti dopo questo slot debbano restare premuti. - + Insert a release action. Slots after the action will only be executed after a button release if the button was held past the interval specified. Inserisce un'azione di rilascio. Gli slot dopo l'azione verranno eseguiti solo dopo il rilascio di un tasto se il tasto è stato premuto dopo l'intervallo specificato. - + Change to selected set once slot is activated. Cambia il set selezionato quando lo slot viene attivato. - + Full string will be typed when a slot is activated. Una stringa verrà digitata quando uno slot viene attivato. - + Execute program when slot is activated. Esegue un programma quando lo slot viene attivato. - - + + Choose Profile Scegli profilo - + Config Files (*.amgp *.xml) File di configurazione (*.amgp *.xml) @@ -928,157 +937,157 @@ al posto di qualsiasi altro profilo predefinito. AdvanceStickAssignmentDialog - + Stick/Pad Assignment Assegnazioni analogico/pad - + Sticks Analogici - + DPads DPads - - + + %1 (Joystick %2) %1 (Joystick %2) - + Stick 1 Analogico 1 - - - + + + Enabled Attivato - - - - - - + + + + + + Assign Assegna - - + + X Axis: Asse X: - - + + Y Axis: Asse Y: - + Stick 2 Analogico 2 - + Number of Physical DPads: %1 Numero di DPad fisici: %1 - + Virtual DPad 1 DPad virtuale 1 - + Up: Su: - + Down: Giù: - + Note: This window is meant for backwards compatibility with profiles made before antimicro 2.0. Since version 2.0, use of the Game Controller Mapping window is preferred. Nota: questa finestra è destinata alla retrocompatibilità coi profili creati prima di antimicro 2.0. Dalla versione 2.0, è preferibile l'uso della finestra Mappatura controller di gioco. - + Left: Sinistra: - + Right: Destra: - - - - + + + + Axis %1 Asse %1 - - - - + + + + Axis %1 - Asse %1 - - - - - + + + + Axis %1 + Asse %1 + - - - - + + + + Button %1 Tasto %1 - + Move stick 1 along the X axis Muovere analogico 1 lungo l'asse X - + Move stick 1 along the Y axis Muovere analogico 1 lungo l'asse Y - + Move stick 2 along the X axis Muovere analogico 2 lungo l'asse X - + Move stick 2 along the Y axis Muovere analogico 2 lungo l'asse Y - - - - + + + + Press a button or move an axis Premere un tasto o muovere un'asse @@ -1086,181 +1095,181 @@ al posto di qualsiasi altro profilo predefinito. AxisEditDialog - + Axis Asse - - + + Mouse (Horizontal) Mouse (orizzontale) - - + + Mouse (Inverted Horizontal) Mouse (orizzontale invertito) - - + + Mouse (Vertical) Mouse (verticale) - - + + Mouse (Inverted Vertical) Mouse (verticale invertito) - - + + Arrows: Up | Down Frecce: Su | Giù - - + + Arrows: Left | Right Frecce: Sinistra | Destra - - + + Keys: W | S Tasti: W | S - - + + Keys: A | D Tasti: A | D - - + + NumPad: KP_8 | KP_2 TastNum: TN_8 | TN_2 - - + + NumPad: KP_4 | KP_6 TastNum: TN_4 | TN_6 - - - + + + None Niente - - + + Set the value to use as the limit for an axis. Useful for a worn out analog stick. Imposta il valore da usare come limite per un'asse. Utile per un analogico consumato. - + Negative Half Throttle Acceleratore negativo a metà - + Positive Half Throttle Acceleratore positivo a metà - + Name: Nome: - + Specify the name of an axis. Specifica il nome di un'asse. - + Mouse Settings Impostazioni mouse - - + + Set the value of the dead zone for an axis. Imposta il valore della zona morta per un'asse. - + Presets: Preimpostazioni: - + Dead Zone: Zona morta: - + Max Zone: Zona massima: - - + + [NO KEY] [NO TASTO] - + Throttle setting that determines the behavior of how to interpret an axis hold or release. Impostazione dell'acceleratore che determina come interpretare il rilascio o la pressione di un'asse. - + Negative Throttle Acceleratore negativo - + Normal Normale - + Positive Throttle Acceleratore positivo - + Current Value: Valore corrente: - + Set Set - + Set %1 Set %1 - + Left Mouse Button Tasto sinistro del mouse - + Right Mouse Button Tasto destro del mouse @@ -1268,37 +1277,37 @@ interpretare il rilascio o la pressione di un'asse. ButtonEditDialog - + Dialog Finestra di dialogo - + To make a new assignment, press any keyboard key or click a button in the Keyboard or Mouse tab Per assegnare un nuovo tasto, premere qualunque tasto della tastiera o cliccare un pulsante nella sezione Tastiera o Mouse - + Placeholder Segnaposto - + Toggle Cambio stato - + Enables a key press or release to only occur when a controller button is pressed. Abilita la pressione o il rilascio di un tasto solo quando il tasto di un controller viene premuto. - + Enables rapid key presses and releases. Turbo controller. Abilita la pressione e il rilascio rapidi di un tasto. Controller turbo. - + Turbo Turbo @@ -1307,39 +1316,39 @@ interpretare il rilascio o la pressione di un'asse. Corrente: - + Last keyboard/mouse button: - + Slots Slot - + Na&me: Nome: - + Specify the name of a button. Specifica il nome di un tasto. - + Action: Azione: - + Specify the action that will be performed in game while this button is being used. Specifica l'azione che verrà eseguita in gioco mentre questo tasto viene usato. - + Advanced Avanzate @@ -1352,52 +1361,52 @@ mentre questo tasto viene usato. Set %1 - - - + + + Choose your keyboard key - + No button - - - - + + + + Last button - + To change settings for last button, it must be at least one assignment from keyboard to gamepad - + To change settings of turbo for last button, it must be at least one assignment from keyboard to gamepad - + To open advanced dialog, it's needed to map at least one button from keyboard to gamepad - + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + As last gamepad button has been set - + Index %1 @@ -1405,190 +1414,190 @@ mentre questo tasto viene usato. Calibration - + Form - - + + Start calibration - + Controller: - + Sticks: - - Use settings from jstest-gtk - - - - + Reset settings - + Cancel Annulla - - + + Save Salva - - + + Calibration - - Do you really want to reset settings of current axes? + + Do you really want to reset settings of current axis? - + Calibration was saved for the preset. Do you really want to reset settings? - + Place the joystick in the center position. It's the part, where often you don't have to move. Just skip it in such situation. - + Calibrating center - + Start second step - + Center X: %1 - + Center Y: %1 - + Place the joystick in the top-left corner many times - - + + Calibrating position - - + + X: %1 - - + + Y: %1 - + Place the joystick in the bottom-right corner - + Start final step - + range X: %1 - %2 - + range Y: %1 - %2 - + deadzone X: %1 - + deadzone Y: %1 - + ---Calibration done!--- - + Calibration values have been saved - - + + Dead zone calibration - - You must move X axis to the right at least five times! Keep moving! + + You have to move axes to the top-left corner at least five times. + + + + + You have to move axes to the bottom-right corner at least five times. - - You must move X axis to the left at least five times! Keep moving! + + Do you want to save calibration of current axis? - - - - + + + + Axis %1 Asse %1 @@ -1596,64 +1605,64 @@ deadzone Y: %1 CapturedWindowInfoDialog - + Captured Window Properties Proprietà finestra catturata - + Information About Window Informazioni sulla finestra - + Class: Classe: - - - + + + TextLabel etichetta di testo - + Title: Titolo: - + Path: Percorso: - + Match By Properties Trova per proprietà - + Class Classe - + Title Titolo - + Path Percorso - + Full Path Percorso completo - + File Name Nome file @@ -1824,67 +1833,67 @@ deadzone Y: %1 DPadContextMenu - + Mouse (Normal) Mouse (normale) - + Mouse (Inverted Horizontal) Mouse (orizzontale invertito) - + Mouse (Inverted Vertical) Mouse (verticale invertito) - + Mouse (Inverted Horizontal + Vertical) Mouse (orizzontale + verticale invertito) - + Arrows Frecce - + Keys: W | A | S | D Tasti: W | A | S | D - + NumPad TastNum - + None Niente - + Standard Standard - + Eight Way 8 direzioni - + 4 Way Cardinal 4 direzioni cardinali - + 4 Way Diagonal 4 direzioni diagonali - + Mouse Settings Impostazioni mouse @@ -1892,108 +1901,108 @@ deadzone Y: %1 DPadEditDialog - + Dialog Finestra di dialogo - + Presets: Preimpostazioni: - + Mouse (Normal) Mouse (normale) - + Mouse (Inverted Horizontal) Mouse (orizzontale invertito) - + Mouse (Inverted Vertical) Mouse (verticale invertito) - + Mouse (Inverted Horizontal + Vertical) Mouse (orizzontale + verticale invertito) - + Arrows Frecce - + Keys: W | A | S | D Tasti: W | A | S | D - + NumPad TastNum - + None Niente - + Dpad Mode: Modalità DPad: - + &Name: Nome: - + 4 Way Cardinal 4 direzioni cardinali - + 4 Way Diagonal 4 direzioni diagonali - + DPad Delay: Ritardo DPad: - - + + Time lapsed before a direction change is taken into effect. Tempo trascorso prima che il cambiamento di una direzione abbia effetto. - + s s - + Specify the name of a dpad. Specifica il nome di un DPad. - + Mouse Settings Impostazioni mouse - + Standard Standard - + Standard: 8 region dpad with two direction buttons active when the dpad is in a diagonal region. @@ -2020,17 +2029,17 @@ alla direzione cardinale del DPad. Utile per i menu. corrispondente alla zona diagonale del DPad. - + Eight Way 8 direzioni - + Set Set - + Set %1 Set %1 @@ -2038,27 +2047,27 @@ corrispondente alla zona diagonale del DPad. EditAllDefaultAutoProfileDialog - + Default Profile Profilo predefinito - + Profile: Profilo: - + Browse Sfoglia - + Open Config Apri configurazione - + Profile file path is invalid. Il percorso del profilo è invalido. @@ -2066,29 +2075,29 @@ corrispondente alla zona diagonale del DPad. ExtraProfileSettingsDialog - + Extra Profile Settings Altre impostazioni profilo - + Key Press Time: Tempo pressione tasto: - + 0.00 ms 0.00 ms - + Profile Name: Nome profilo: - - - + + + s s @@ -2096,7 +2105,7 @@ corrispondente alla zona diagonale del DPad. GameController - + Game Controller Controller di gioco @@ -2104,9 +2113,9 @@ corrispondente alla zona diagonale del DPad. GameControllerDPad - - - + + + DPad DPad @@ -2114,187 +2123,187 @@ corrispondente alla zona diagonale del DPad. GameControllerMappingDialog - + Game Controller Mapping Mappatura controller di gioco - + <html><head/><body><p>antimicro makes use of the <a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;">Game Controller API</span></a> provided by SDL 2 in order to abstract various gamepads to fit a unified standard. In order to make a button assignment, please highlight the mapping cell for the appropriate button row below. You can then press a button or move an axis on your gamepad and the cell will update with the physical button or axis that will be used.</p><p>antimicro will use the mapping that you specify to save a mapping string that will be loaded into SDL.</p></body></html> <html><head/><body><p>antimicro utilizza la <a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;">Game Controller API</span></a> fornita da SDL 2 per astrarre vari gamepad e adattarli a un unico standard. Per assegnare un tasto, per favore evidenzia la cella di mappatura per il tasto della riga giusta qui sotto. Dopodiché puoi premere un tasto o muovere un'asse sul tuo gamepad e la cella si aggiornerà con il tasto fisico o l'asse che verrà usata.</p><p>antimicro userà la mappatura che hai specificato per salvare una stringa di mappatura che verrà caricata in SDL.</p></body></html> - + A A - + B B - + X X - + Y Y - + Back Back - + Start Start - + Guide Guide - + Left Shoulder Dorsale sinistro - + Right Shoulder Dorsale destro - + Left Stick Click Click analogico sinistro - + Right Stick Click Click analogico destro - + Left Stick X Analogico sinistro X - + Left Stick Y Analogico sinistro Y - + Right Stick X Analogico destro X - + Right Stick Y Analogico destro Y - + Left Trigger Grilletto sinistro - + Right Trigger Grilletto destro - + DPad Up DPad su - + DPad Left DPad sinistra - + DPad Down DPad giù - + DPad Right DPad destra - + Mapping Mappatura - + SDL 2 Game Controller Mapping String Stringa di mappatura Game controller SDL 2 - + Last Axis Event: Ultimo evento asse: - + Current Axis Detection Dead Zone: Rilevamento corrente della zona morta dell'asse: - + 5000 5000 - + 10000 10000 - + 15000 15000 - + 20000 20000 - + 25000 25000 - + 30000 30000 - + 32000 32000 - + Game Controller Mapping (%1) (#%2) Mappatura controller di gioco (%1) (#%2) - + Discard Controller Mapping? Scartare mappatura controller? - + Discard mapping for this controller? If discarded, the controller will be reverted to a joystick once you refresh all joysticks. @@ -2306,47 +2315,47 @@ Scartandola, il controller tornerà ad essere un joystick una volta aggiornati t GameControllerSet - + Back Indietro - + Guide Guida - + Start Start - + LS Click Click analog SX - + RS Click Click analog DX - + L Shoulder Dorsale SX - + R Shoulder Dorsale DX - + L Trigger Grilletto SX - + R Trigger Grilletto DX @@ -2354,9 +2363,9 @@ Scartandola, il controller tornerà ad essere un joystick una volta aggiornati t GameControllerTrigger - - - + + + Trigger Grilletto @@ -2364,9 +2373,9 @@ Scartandola, il controller tornerà ad essere un joystick una volta aggiornati t JoyAxis - - - + + + Axis Asse @@ -2374,24 +2383,24 @@ Scartandola, il controller tornerà ad essere un joystick una volta aggiornati t JoyAxisButton - + Negative Negativo - + Positive Positivo - + Unknown Sconosciuto - - - + + + Button Tasto @@ -2399,74 +2408,74 @@ Scartandola, il controller tornerà ad essere un joystick una volta aggiornati t JoyAxisContextMenu - + Mouse (Horizontal) Mouse (orizzontale) - + Mouse (Inverted Horizontal) Mouse (orizzontale invertito) - + Mouse (Vertical) Mouse (verticale) - + Mouse (Inverted Vertical) Mouse (verticale invertito) - + Arrows: Up | Down Frecce: Su | Giù - + Arrows: Left | Right Frecce: Sinistra | Destra - + Keys: W | S Tasti: W | S - + Keys: A | D Tasti: A | D - + NumPad: KP_8 | KP_2 TastNum: TN_8 | TN_2 - + NumPad: KP_4 | KP_6 TastNum: TN_4 | TN_6 - - + + None Niente - - + + Mouse Settings Impostazioni mouse - + Left Mouse Button Tasto sinistro del mouse - + Right Mouse Button Tasto destro del mouse @@ -2474,57 +2483,57 @@ Scartandola, il controller tornerà ad essere un joystick una volta aggiornati t JoyButton - + Processing turbo for #%1 - %2 Processando turbo per #%1 - %2 - + Finishing turbo for button #%1 - %2 Finendo turbo per tasto #%1 - %2 - + Processing press for button #%1 - %2 Processando pressione per tasto #%1 - %2 - + Processing release for button #%1 - %2 Processando rilascio per tasto #%1 - %2 - + Distance change for button #%1 - %2 Cambio di distanza per tasto #%1 - %2 - - - + + + Button Tasto - - - - + + + + [NO KEY] [NO TASTO] - + [Set %1 1W] [Set %1 1DIREZ] - + [Set %1 2W] [Set %1 2DIREZ] - + [Set %1 WH] [Set %1 PREMENDO] @@ -2532,47 +2541,47 @@ Scartandola, il controller tornerà ad essere un joystick una volta aggiornati t JoyButtonContextMenu - + Toggle Cambio stato - + Turbo Turbo - + Clear Cancella - + Set Select Seleziona set - + Disabled Disattivato - + Set %1 Set %1 - + Set %1 1W Set %1 1DIREZ - + Set %1 2W Set %1 2DIREZ - + Set %1 WH Set %1 PREMENDO @@ -2580,118 +2589,118 @@ Scartandola, il controller tornerà ad essere un joystick una volta aggiornati t JoyButtonSlot - - + + Mouse Mouse - + Up Su - + Down Giù - + Left Sinistra - + Right Destra - + LB TastoMouseSX - + MB TastoMouseCENTRO - + RB TastoMouseDX - + B4 Tasto4 - + B5 Tasto5 - + Pause Pausa - + Hold Tieni - + Cycle Ciclo - + Distance Distanza - + Release Rilascia - + Mouse Mod Modifica mouse - + Press Time Tempo di pressione - + Delay Ritardo - + Load %1 Carica %1 - + Set Change %1 Cambio di set %1 - + [Text] %1 [Testo] %1 - + [Exec] %1 [Esec] %1 - + [NO KEY] [NO TASTO] @@ -2699,9 +2708,9 @@ Scartandola, il controller tornerà ad essere un joystick una volta aggiornati t JoyControlStick - - - + + + Stick Analogico @@ -2709,37 +2718,37 @@ Scartandola, il controller tornerà ad essere un joystick una volta aggiornati t JoyControlStickButton - - - + + + Up Su - - - + + + Down Giù - - - + + + Left Sinistra - - - + + + Right Destra - - - + + + Button Tasto @@ -2747,67 +2756,67 @@ Scartandola, il controller tornerà ad essere un joystick una volta aggiornati t JoyControlStickContextMenu - + Mouse (Normal) Mouse (normale) - + Mouse (Inverted Horizontal) Mouse (orizzontale invertito) - + Mouse (Inverted Vertical) Mouse (verticale invertito) - + Mouse (Inverted Horizontal + Vertical) Mouse (orizzontale + verticale invertito) - + Arrows Frecce - + Keys: W | A | S | D Tasti: W | A | S | D - + NumPad TastNum - + None Niente - + Standard Standard - + Eight Way 8 direzioni - + 4 Way Cardinal 4 direzioni cardinali - + 4 Way Diagonal 4 direzioni diagonali - + Mouse Settings Impostazioni mouse @@ -2815,86 +2824,86 @@ Scartandola, il controller tornerà ad essere un joystick una volta aggiornati t JoyControlStickEditDialog - + Dialog Finestra di dialogo - + X: X: - - - - - + + + + + 0 0 - + Y: Y: - + Distance: Distanza: - + Presets: Preimpostazioni: - + Mouse (Normal) Mouse (normale) - + Mouse (Inverted Horizontal) Mouse (orizzontale invertito) - + Mouse (Inverted Vertical) Mouse (verticale invertito) - + Mouse (Inverted Horizontal + Vertical) Mouse (orizzontale + verticale invertito) - + Arrows Frecce - + Keys: W | A | S | D Tasti: W | A | S | D - + NumPad TastNum - + None Niente - + Stick Mode: Modalità analogico: - + Standard: 8 region stick with two direction buttons active when the stick is in a diagonal region. @@ -2921,72 +2930,72 @@ alla direzione cardinale dell'analogico. Utile per i menu. corrispondente alla zona diagonale dell'analogico. - + 4 Way Cardinal 4 direzioni cardinali - + 4 Way Diagonal 4 direzioni diagonali - - + + Dead zone value to use for an analog stick. Valore zona morta da usare per un analogico. - - + + Value when an analog stick is considered moved 100%. Valore in cui un analogico viene considerato spostato al 100%. - - + + The area (in degrees) that each diagonal region occupies. L'area (in gradi) che ogni regione diagonale occupa. - + Square Stick: Analogico quadrato: - - + + Percentage to modify a square stick coordinates to confine values to a circle Percentuale per modificare le coordinate di un analogico quadrato per confinare i valori ad un cerchio. - + % % - + Stick Delay: Ritardo analogico: - - + + Time lapsed before a direction change is taken into effect. Tempo trascorso prima che il cambio di una direzione entri in funzione. - + s s - + Modifier: Modificatore: - + Edit button that is active while the stick is active. This button is useful for assigning zones with @@ -3000,68 +3009,68 @@ assegnare funzionalità cammina/corri ad un analogico. - + PushButton PremiTasto - + Na&me: Name: Nome: - + Specify the name of an analog stick. Specifica il nome di un analogico. - + Mouse Settings Impostazioni mouse - + Standard Standard - + Bearing: Tolleranza: - + % Safe Zone: % Zona sicura: - + Eight Way 8 direzioni - + Dead Zone: Zona morta: - + Max Zone: Zona massima: - + Diagonal Range: Raggio diagonale: - + Set Set - + Set %1 Set %1 @@ -3069,9 +3078,9 @@ analogico. JoyControlStickModifierButton - - - + + + Modifier Modificatore @@ -3079,9 +3088,9 @@ analogico. JoyDPad - - - + + + DPad DPad @@ -3089,37 +3098,37 @@ analogico. JoyDPadButton - - - + + + Up Su - - - + + + Down Giù - - - + + + Left Sinistra - - - + + + Right Destra - - - + + + Button Tasto @@ -3127,267 +3136,272 @@ analogico. JoyTabWidget - - - - - - + + + + + + <New> <Nuovo> - - + + Remove Rimuovi - - + + Remove configuration from recent list. Rimuovi configurazione dalla lista dei recenti. - - + + Load Carica - - + + Load configuration file. Carica file di configurazione. - - + + Save Salva - - + + Save changes to configuration file. Salva cambiamenti sul file di configurazione. - - + + Save As Salva come - - + + Save changes to a new configuration file. Salva cambiamenti su un nuovo file di configurazione. - - + + Sets Set - + Copy from Set Copia da Set - + Settings Impostazioni - - + + Set 1 Set 1 - - + + Set 2 Set 2 - - + + Set 3 Set 3 - - + + Set 4 Set 4 - - + + Set 5 Set 5 - - + + Set 6 Set 6 - - + + Set 7 Set 7 - - + + Set 8 Set 8 - - + + Stick/Pad Assign Assegna analogico/pad - - + + Controller Mapping Mappatura controller - - + + Quick Set Set rapido - - + + Names Nomi - - + + Toggle button name displaying. Aziona visualizzazione del nome del tasto. - - + + Pref Pref - - + + Change global profile settings. Cambia opzioni globali profilo. - - - + + + Reset Reset - - + + Revert changes to the configuration. Reload configuration file. Ripristina modifiche alla configurazione. Ricarica file di configurazione. - + Open Config Apri configurazione - + Config Files (*.amgp *.xml) File di configurazione (*.amgp *.xml) - - - + + + Config File (*.%1.amgp) File di configurazione (*.%1.amgp) - - + + Do you really want to reset buttons settings for joystick? + + + + + Save Profile Changes? Salvare cambiamenti profilo? - - + + Changes to the new profile have not been saved. Would you like to save or discard the current profile? I cambiamenti del nuovo profilo non sono stati salvati. Vuoi salvare o scartare il profilo corrente? - - + + Changes to the profile "%1" have not been saved. Would you like to save or discard changes to the current profile? I cambiamenti del profilo "%1" non sono stati salvati. Vuoi salvare o scartare il profilo corrente? - + Sticks Analogici - - + + DPads DPads - + No buttons have been assigned. Please use Quick Set to assign keys to buttons or disable hiding empty buttons. Nessun tasto è stato assegnato. Per favore usa il Set rapido per assegnare funzioni ai tasti o disattiva il nascondimento dei tasti vuoti. - - + + Set %1: %2 Set %1: %2 - - + + Set %1 Set %1 - + Copy Set Assignments Copia assegnazioni set - + Are you sure you want to copy the assignments and device properties from %1? Sei sicuro di voler copiare le assegnazioni e le proprietà dispositivo da %1? - - - + + + Save Config Salva configurazione - - + + Set Set @@ -3395,7 +3409,7 @@ assegnare funzioni ai tasti o disattiva il nascondimento dei tasti vuoti. Joystick - + Joystick Joystick @@ -3403,98 +3417,98 @@ assegnare funzioni ai tasti o disattiva il nascondimento dei tasti vuoti. JoystickStatusWindow - + Properties Proprietà - + Details Dettagli - + Name: Nome: - - - - - - - + + + + + + + %1 %1 - + Number: Numero: - + Axes: Assi: - + Buttons: Tasti: - + Hats: Hat switch: - + GUID: GUID: - + Game Controller: Controller di gioco: - + Axes Assi - + Buttons Tasti - + Hats Hat switch - + %1 (#%2) Properties %1 (#%2) Proprietà - + Axis %1 Asse %1 - + Hat %1 Hat switch %1 - + No No - + Yes @@ -3502,62 +3516,67 @@ assegnare funzioni ai tasti o disattiva il nascondimento dei tasti vuoti. MainSettingsDialog - + Edit Settings Modifica impostazioni - + General Generale - + Controller Mappings Mappatura controller - + Language Lingua - + Auto Profile Auto-profilo - + Mouse Mouse - + Advanced Avanzate - + + Profile Direc&tory: + + + + <html><head/><body><p>Specify the default directory that the program should use in file dialogs when loading a profile or saving a new profile.</p></body></html> <html><head/><body><p>Specifica la cartella predefinita che il programma deve usare nelle finestre di dialogo file mentre si carica un profilo o se ne salva uno nuovo.</p></body></html> - + Recent Profile Count: Conteggio profili recenti: - + <html><head/><body><p>Number of profiles that can be placed in recent profile list. 0 will result in the program not enforcing a limit on the number of profiles displayed.</p></body></html> <html><head/><body><p>Numero di profili che possono essere messi nella lista dei profili recenti. 0 significa che il programma non impone alcun limite sui profili visualizzati.</p></body></html> - + Gamepad Poll Rate: Velocità di polling del gamepad: - + Change the poll rate that the program uses to discover new events from gamepads. Defaults to 10 ms. @@ -3572,29 +3591,29 @@ di CPU maggiore quindi per favore esamina l'impostazione che userai. - + Hide main window when the main window close button is clicked instead of quitting the program. Nascondi finestra principale quando il tasto chiusura della finestra principale viene cliccato invece di uscire dal programma. - + Close To Tray Riduci nell'area di notifica - + Have Windows start antimicro at system startup. Avvia antimicro automaticamente all'avvio di Windows. - + Launch At Windows Startup Esegui all'avvio di Windows - + Display recent profiles for all controllers as a single list in the tray menu. Defaults to using sub-menus. @@ -3603,12 +3622,12 @@ come una lista singola nell'area di notifica. Di predefinito, usa i sottomenu. - + Single Profile List in Tray Lista profili singola nell'area di notifica - + Have the program minimize to the taskbar. By default, the program minimizes to the system tray if available. @@ -3616,12 +3635,12 @@ tray if available. il programma si riduce a icona se possibile. - + Minimize to Taskbar Riduci a icona - + This option will cause the program to hide all buttons that have no slots assigned to them. The Quick Set dialog window will have to be used @@ -3632,12 +3651,12 @@ usare la finestra di dialogo Set rapido per mostrare la finestra di dialogo di modifica per i tasti gamepad. - + Hide Empty Buttons Nascondi tasti vuoti - + When the program is launched, open the last known profile that was opened during the previous session. @@ -3646,157 +3665,167 @@ l'ultimo profilo conosciuto usato nella precedente sessione. - + Auto Load Last Opened Profile Auto-carica l'ultimo profilo aperto - + Only show the system tray icon when the program first launches. Mostra solo l'icona dell'area di notifica quando il programma si apre la prima volta. - + Launch in Tray Esegui nell'area di notifica - + Associate .amgp files with antimicro in Windows Explorer. Associa file .amgp con antimicro in Windows Explorer. - + Associate Profiles Associa profili - + Key Repeat Ripetizione tasto - + Active keys will be repeatedly pressed when this option is enabled. I tasti attivi verranno premuti a ripetizione quando questa opzione è attivata. - - + + Enable Attiva - + Specifies how much time should elapse before key repeating begins. Specifica quanto tempo debba passare prima che cominci la ripetizione tasto. - + Specifies how many times key presses will be performed per seconds. Specifica quante volte al secondo verranno premuti i tasti. - + <html><head/><body><p>antimicro has been translated into many different languages by contributors. By default, the program will choose an appropriate translation based on your system's locale setting. However, you can make antimicro load a different translation depending on the language that you choose from the list below.</p></body></html> <html><head/><body><p>antimicro è stato tradotto in molte lingue da collaboratori. Di base, il programma sceglierà una traduzione adatta basandosi sulle impostazioni della lingua del tuo sistema. Tuttavia, puoi far caricare ad antimicro una lingua differente a seconda di quella che scegli nella lista qui sotto.</p></body></html> - + Português do Brasil - + Français - + Deutsch - + Italiano - + 日本語 - + Русский - + српски / srpski - + 简体中文 - + Español - + українська - + Polski - + + History Si&ze: + + + + Log File: - + Log Level: - + None Niente - + Error - + Warning - + Info Info - + Debug + + + Reset + Reset + French Francese @@ -3822,22 +3851,22 @@ per seconds. Ucraino - + Class Classe - + Title Titolo - + Program Programma - + Disable the "Enhanced Pointer Precision" Windows setting while antimicro is running. Disabling "Enhanced Pointer Precision" will allow mouse movement within antimicro to be more @@ -3847,32 +3876,31 @@ mentre antimicro è in esecuzione. Disattivare "Aumenta precisione puntator permetterà movimenti del mouse più precisi. - + Disable Enhance Pointer Precision Disattiva Aumenta precisione puntatore - + Smoothing - Histor&y Size: - Dimensioni storia: + Dimensioni storia: - + Weight &Modifier: Modificatore peso: - + Refresh Rate: Frequenza di aggiornamento: - + The refresh rate is the amount of time that will elapse in between mouse events. Please be cautious when editing this setting as it will cause the program to use @@ -3887,17 +3915,17 @@ basso può causare instabilità al sistema. Per favore esamina l'impostazione che userai. - + Spring Fonte - + Screen: Schermo: - + Utilize the specified screen for spring mode. On Linux, the default is to use the primary screen. On Windows, the default is to use all available screens. @@ -3906,29 +3934,29 @@ di predefinito viene usato lo schermo primario. Su Windows, di predefinito vengono usati tutti gli schermi disponibili. - + Accel Numerator: Numeratore accelerazione: - - - + + + 0 0 - + Accel Denominator: Denominatore accelerazione: - + Accel Threshold: Soglia accelerazione: - + If the acceleration values for the virtual mouse have been changed by a different process, particularly when quitting an older game, then you might want to reset the acceleration @@ -3939,37 +3967,36 @@ un vecchio gioco, allora potresti voler resettare i valori di accelerazione usati dal mouse virtuale. - + Reset Acceleration Resetta accelerazione - + Delay: Ritardo: - Profi&le Directory: - Cartella profilo: + Cartella profilo: - + ms ms - + Rate: Rapporto: - + times/s volte/s - + Below is a list of the custom mappings that have been saved. You can use the following table to delete mappings or have mappings temporarily disabled. You can also disable mappings that are included with SDL; just insert a new row with the appropriate joystick GUID and check disable. Settings will not take affect until you either refresh all joysticks or unplug that particular joystick. @@ -3978,34 +4005,34 @@ Settings will not take affect until you either refresh all joysticks or unplug t Le impostazioni non avranno effetto finché non aggiorni tutti i joystick o disconnetti quel joystick in particolare. - + GUID GUID - + Mapping String Stringa di mappatura - + Disable? Disattivare? - - + + Delete Cancella - + Insert Inserisci - - + + Default Predefinito @@ -4014,7 +4041,7 @@ Le impostazioni non avranno effetto finché non aggiorni tutti i joystick o disc Portoghese brasiliano - + English Inglese @@ -4023,49 +4050,49 @@ Le impostazioni non avranno effetto finché non aggiorni tutti i joystick o disc Tedesco - - + + Active Attivo - + Devices: Dispositivi: - - + + All Tutto - + Device Dispositivi - + Profile Profili - + Default? Predefinito? - + Add Aggiungi - + Edit Modifica - + Also, Windows users who want to use a low value should also check the "Disable Enhance Pointer Precision" checkbox if you haven't disabled the option in Windows. @@ -4074,35 +4101,45 @@ anche mettere la spunta su "Disattiva Aumenta precisione puntatore" se non hanno già disattivato tale opzione in Windows. - + Select Default Profile Directory Seleziona la cartella del profilo predefinito - + Are you sure you want to delete the profile? Sei sicuro di voler cancellare il profilo? - + Save Log File As - + Log Files (*.log) + + + Do you really want to reset setting? + + + + + Would you like to reset mappings too? + + MainWindow - + antimicro antimicro - + No Joysticks have been found. Please plug in a joystick and then choose the "Update Joysticks" option in the main menu Non è stato trovato alcun joystick. @@ -4113,115 +4150,115 @@ Per favore collega un joystick e scegli l'opzione "Aggiorna i joystick Se gli eventi non vengono registrati dal gioco, clicca qui per eseguire l'applicazione da Amministratore. - + If events are not seen by a game, please click here to run this application as Administrator. - + &App App - + &Options Opzioni - + &Help Aiuto - - + + &Quit Esci - + Ctrl+Q Ctrl+Q - - + + &Update Joysticks Aggiorna i joystick - + Ctrl+U Ctrl+U - - + + &Hide Nascondi - + Ctrl+H Ctrl+H - + &About A proposito - + Ctrl+A Ctrl+A - + About &Qt - + &Properties - + &Key Checker - + &GitHub Page - + &Game Controller Mapping - + S&ettings - + &Stick/Pad Assign - + &Wiki - + &Issues - + &Calibration @@ -4238,7 +4275,7 @@ Per favore collega un joystick e scegli l'opzione "Aggiorna i joystick Controllo tasti - + Home Page Homepage @@ -4263,49 +4300,49 @@ Per favore collega un joystick e scegli l'opzione "Aggiorna i joystick Wiki - + Could not find a proper controller identifier. Exiting. Impossibile trovare un identificatore controller adatto. Esco. - - - - - - - + + + + + + + (%1) (%1) - - + + Open File Apri file - + &Restore Ripristina - + Calibration couldn't be opened - + You must connect at least one controller to open the window - + Run as Administrator? Eseguire come amministratore? - + Are you sure that you want to run this program as Adminstrator? Some games run as Administrator which will cause events generated by antimicro to not be used by those games unless antimicro is also run as the Adminstrator. This is due to permission problems caused by User Account Control (UAC) options in Windows Vista and later. @@ -4314,17 +4351,17 @@ Some games run as Administrator which will cause events generated by antimicro t Certi giochi vengono eseguiti come Amministratore, il che rende inutilizzabili certi eventi generati da antimicro a meno che anche antimicro venga eseguito come Amministratore. Questo succede per via dei problemi causati dalle opzioni del Controllo account utente (UAC) da Windows Vista in poi. - + Failed to elevate program Impossibile elevare il programma - + Failed to restart this program as the Administrator Impossibile riavviare questo programma come Amministratore - + Could not find controller. Exiting. Impossibile trovare controller. Esco. @@ -4332,12 +4369,12 @@ Certi giochi vengono eseguiti come Amministratore, il che rende inutilizzabili c MouseAxisSettingsDialog - + Mouse Settings - Impostazioni mouse - - + Set %1 Set %1 @@ -4345,12 +4382,12 @@ Certi giochi vengono eseguiti come Amministratore, il che rende inutilizzabili c MouseButtonSettingsDialog - + Mouse Settings - Impostazioni mouse - - + Set %1 Set %1 @@ -4358,12 +4395,12 @@ Certi giochi vengono eseguiti come Amministratore, il che rende inutilizzabili c MouseControlStickSettingsDialog - + Mouse Settings Impostazioni mouse - + Set %1 Set %1 @@ -4371,12 +4408,12 @@ Certi giochi vengono eseguiti come Amministratore, il che rende inutilizzabili c MouseDPadSettingsDialog - + Mouse Settings Impostazioni mouse - + Set %1 Set %1 @@ -4384,17 +4421,17 @@ Certi giochi vengono eseguiti come Amministratore, il che rende inutilizzabili c MouseSettingsDialog - + Mouse Settings Impostazioni mouse - + Mouse Mode: Modalità mouse: - + Cursor mode is used to move the mouse cursor around the screen relative to its current position depending on how much you move an axis @@ -4417,80 +4454,80 @@ del mouse tornerà al centro dello schermo quando l'asse torna nella la zona morta. - + Cursor Cursore - + Spring Fonte - + Acceleration: Accelerazione: - + Enhanced Precision Aumenta precisione - - + + Linear Lineare - + Quadratic Quadratico - + Cubic Cubico - + Quadratic Extreme Quadratico estremo - + Power Function Funzione di potenza - + Easing Quadratic Interpolazione quadratica - + Easing Cubic Interpolazione cubica - + Mouse Speed Settings Impostazioni velocità mouse - + Enable to change the horizontal and vertical speed boxes at the same time. Permette di modificare i campi di velocità orizzontale e verticale allo stesso tempo. - + Change Together Modifica insieme - + Options for adding more acceleration to the mouse movement beyond what the acceleration curve would produce. Acceleration is added based on how quickly an axis is @@ -4500,17 +4537,17 @@ using typical gamepad analog sticks. - + Delta Acceleration - + &Multiplier: - + Mi&n Threshold: @@ -4522,8 +4559,8 @@ Speed: orizzontale: - - + + 1 = 20 pps 1 = 20 pixel/sec @@ -4534,33 +4571,33 @@ Speed: verticale: - + Wheel Hori. Speed: Velocità orizz. rotella: - + Set the speed used for horizontal mouse wheel movement according to number of simulated notches per second. Imposta la velocità usata per il movimento orizzontale della rotella del mouse a seconda del numero di tacche al secondo simulate. - + Set the speed used for vertical mouse wheel movement according to number of simulated notches per second. Imposta la velocità usata per il movimento verticale della rotella del mouse a seconda del numero di tacche al secondo simulate. - + Sensitivit&y: - + For Power Function acceleration curve. Specifies the factor to use for curve sensitivity. When the value is above 1.0, the mouse movement will be accelerated @@ -4571,13 +4608,13 @@ valore supera 1, il movimento del mouse verrà accelerato più velocemente nella parte bassa di un'asse. - + Easing Duration: Durata interpolazione: - - + + s s @@ -4590,23 +4627,23 @@ più velocemente nella parte bassa di un'asse. Moltiplicatore: - + Highest value to accelerate mouse movement by Il valore più grande per cui accelerare il mouse - + x x - + Start %: Inizio %: Start %: - + Acceleration begins at this percentage of the base multiplier L'accelerazione comincia da questa percentuale del moltiplicatore di base @@ -4617,93 +4654,93 @@ Threshold: minima: - + Minimum amount of axis travel required for acceleration to begin Valore minimo di spostamento asse richiesto per far sì che cominci l'accelerazione - + Max Threshold: Soglia massima: - + Maximum axis travel before acceleration has reached the multiplier value Valore massimo di spostamento asse prima che l'accelerazione raggiunga il valore del moltiplicatore - + E&xtra Duration: - + Curve: Curva: - + Ease Out Sine Sinusoidale graduale - + Ease Out Quad Quadratico graduale - + Ease Out Cubic Cubico graduale - + Release Radius: Raggio di rilascio: - + Specifies that the spring area will be relative to the mouse position set by a non-relative spring. Specifica che l'area della fonte sarà relativa alla posizione del mouse impostata da una fonte non relativa. - + Relative Relativa - + Mouse Status Stato mouse - + X: X: - - + + 0 (0 pps) 0 (0 pixel/sec) - + Y: Y: - - + + 1 = 1 notch(es)/s 1 = 1 tacca(tacche)/sec - + Enhanced: Three tier curve that makes the mouse move slow on the low end of an axis and fast on the high end. @@ -4747,19 +4784,19 @@ gradualmente accelerata per un periodo di tempo usando una curva cubica. - + Hori&zontal Speed: - + &Vertical Speed: - + Wheel Vert. Speed: Velocità orizz. @@ -4770,7 +4807,7 @@ rotella: Sensibilità: - + Specifies the amount of time (in seconds) that will be required before the mouse is fully accelerated after reaching the high end of an axis. @@ -4791,10 +4828,10 @@ legati all'estremamente limitata gamma di input disponibili usando i tipici analogici dei gamepad. - - - - + + + + % % @@ -4803,7 +4840,7 @@ disponibili usando i tipici analogici dei gamepad. Durata aggiuntiva: - + Extend the time that extra acceleration is applied. Axis travel will be taken into account. A slower flick will decrease the actual time that extra acceleration will be applied. @@ -4812,17 +4849,17 @@ Il percorso dell'asse verrà considerato. Un movimento più lento diminuirà il tempo effettivo in cui verrà applicata l'accelerazione supplementare. - + Spring Settings Impostazioni fonte - + Spring Width: Larghezza fonte: - + Changes the width of the region that the cursor can move in spring mode. 0 will use the entire width of your screen. @@ -4831,12 +4868,12 @@ muoversi in modalità fonte. 0 utilizzerà l'intera grandezza dello schermo. - + Spring Height: Altezza fonte: - + Changes the height of the region that the cursor can move in spring mode. 0 will use the entire height of your screen. @@ -4845,8 +4882,8 @@ muoversi in modalità fonte. 0 utilizzerà l'intera grandezza dello schermo. - - + + %n notch(es)/s %n notch/s @@ -4857,7 +4894,7 @@ grandezza dello schermo. QKeyDisplayDialog - + Key Checker Controllo tasti @@ -4866,34 +4903,34 @@ grandezza dello schermo. <html><head/><body><p>Premi un tasto sulla tua tastiera per vedere come viene rilevato da questa applicazione. La finestra mostrerà il valore tasto nativo, il valore originale dato da Qt (se applicabile), e il valore personalizzato usato da antimicro.</p><p>Il valore tasto antimicro e il valore tasto Qt solitamente saranno gli stessi. antimicro cerca di i valori tasto definiti in Qt se possibile. Guarda la pagina <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum</span></a> per una lista di valori definiti da Qt. Se scopri un tasto che non è supportato nativamente da questo programma, per favore segnala il problema alla <a href="https://github.com/AntiMicro/antimicro"><span style=" text-decoration: underline; color:#0057ae;">pagina GitHub</span></a> cosicché il programma possa essere modificato per supportarlo direttamente. In questo momento, un prefisso personalizzato viene aggiunto ai valori sconosciuti in modo che possano essere ancora utilizzati; il problema principale è che il profilo non sarà più portatile.</p></body></html> - - <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> + + <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="http://doc.qt.io/qt-5/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">http://doc.qt.io/qt-5/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> - + Event Handler: Gestore di eventi: - + Native Key Value: Valore tasto nativo: - - - + + + 0x00000000 0x00000000 - + Qt Key Value: Valore tasto Qt: - + antimicro Key Value: Valore tasto antimicro: @@ -4901,260 +4938,260 @@ grandezza dello schermo. QObject - + Super Super - + Menu Menu - + Mute Muto - + Vol+ Vol+ - + Vol- Vol- - + Play/Pause Play/Pausa - + Play Play - + Pause Pausa - + Prev Prec - + Next Succ - + Mail Mail - + Home Home - + Media Media - + Search Cerca - + Daemon launched Demone avviato - + Failed to launch daemon Impossibile avviare demone - + Launching daemon Avviando demone - - + + Display string "%1" is not valid. La stringa di display "%1" non è valida. - + Failed to set a signature id for the daemon Impossibile impostare un ID firma per il demone - + Failed to change working directory to / Impossibile cambiare la cartella di lavoro per / - + Quitting Program Chiudendo il programma - + # of joysticks found: %1 № di joystick trovati: %1 - + List Joysticks: Lista joystick: - + --------------- --------------- - + Joystick %1: Joystick %1: - + Index: %1 Indice: %1 - + GUID: %1 GUID: %1 - + Name: %1 Nome: %1 - + Yes - + No No - + Game Controller: %1 Controller di gioco: %1 - + # of Axes: %1 № di assi: %1 - + # of Buttons: %1 № di tasti: %1 - + # of Hats: %1 № di hat switch: %1 - + Attempting to use fallback option %1 for event generation. Tentativo di utilizzo dell'opzione alternativa %1 per la generazione eventi. - + Failed to open event generator. Exiting. Impossibile aprire il generatore di eventi. Esco. - + Using %1 as the event generator. Sto usando %1 come generatore eventi. - + Could not raise process priority. Impossibile aumentare la priorità del processo. - + Last button - + There isn't a last button pressed from gamepad in data. Did you set at least one button from gamepad for keyboard? - + Active window changed to: Title = "%1", Class = "%2", Program = "%3" or "%4". - + Profile location %1 is not an XML file. Il profilo in %1 non è un file XML. - + Profile location %1 does not exist. Il profilo in %1 non esiste. - - - + + + Controller identifier is not a valid value. L'identificatore controller non è un valore valido. - + An invalid set number '%1' was specified. È stato specificato un numero di set '%1' invalido. - + Controller identifier '%s'' is not a valid value. L'identificatore controller '%s'' non è un valore valido. - + No set number was specified. Non è stato specificato un numero di set. - + No controller was specified. Non è stato specificato un controller. - + No display string was specified. Non è stata specificata una stringa di visualizzazione. - + An invalid event generator was specified. È stato specificato un generatore di eventi invalido. - + No event generator string was specified. Nessuna stringa di generatore eventi è stata specificata. @@ -5163,7 +5200,7 @@ grandezza dello schermo. È stato rilevato il flag stile Qt ma non è stato specificato alcuno stile. - + No log file specified. @@ -5280,22 +5317,22 @@ grandezza dello schermo. indice controller o GUID. - + Logging started - + Auto-switching to profile "%1". - + Auto-switching to nullptr profile! - + xinput version must be at least 2.0. No mouse acceleration changes will occur. La versione xinput dev'essere almeno 2.0. Non avverrà alcuna modifica all'accelerazione mouse. @@ -5303,18 +5340,18 @@ grandezza dello schermo. QuickSetDialog - + Quick Set Set rapido - + <html><head/><body><p>Please press a button or move an axis on %1 (<span style=" font-weight:600;">%2</span>).<br/>A dialog window will then appear which will<br/>allow you to make an assignment.</p></body></html> <html><head/><body><p>Per favore premi un tasto o muovi un'asse su %1 (<span style=" font-weight:600;">%2</span>).<br/>Verrà mostrata una finestra di dialogo che<br/>ti permetterà di creare un'assegnazione.</p></body></html> - - + + Quick Set %1 Set rapido %1 @@ -5322,12 +5359,12 @@ grandezza dello schermo. SetAxisThrottleDialog - + Throttle Change Modifica acceleratore - + The throttle setting for Axis %1 has been changed. Would you like to distribute this throttle change to all sets? @@ -5339,12 +5376,12 @@ Vuoi distribuire questa modifica su tutti i set? SetJoystick - + Set %1: %2 Set %1: %2 - + Set %1 Set %1 @@ -5352,52 +5389,52 @@ Vuoi distribuire questa modifica su tutti i set? SetNamesDialog - + Set Name Settings Impostazioni nome set - + Set 1 Set 1 - + Set 2 Set 2 - + Set 3 Set 3 - + Set 4 Set 4 - + Set 5 Set 5 - + Set 6 Set 6 - + Set 7 Set 7 - + Set 8 Set 8 - + Name Nome @@ -5405,7 +5442,7 @@ Vuoi distribuire questa modifica su tutti i set? SimpleKeyGrabberButton - + Mouse Mouse @@ -5413,7 +5450,7 @@ Vuoi distribuire questa modifica su tutti i set? SpringModeRegionPreview - + Spring Mode Preview Anteprima modalità fonte @@ -5421,7 +5458,7 @@ Vuoi distribuire questa modifica su tutti i set? UInputEventHandler - + Could not find a valid uinput device file. Please check that you have the uinput module loaded. lsmod | grep uinput @@ -5430,14 +5467,14 @@ Per favore controlla di aver caricato il modulo uinput. lsmod | grep uinput - + Could not open uinput device file Please check that you have permission to write to the device Impossibile aprire il file di dispositivo uinput. Per favore controlla di avere i permessi di scrittura sul dispositivo. - + Using uinput device file %1 File di dispositivo uinput %1 in uso @@ -5445,551 +5482,551 @@ Per favore controlla di avere i permessi di scrittura sul dispositivo. UInputHelper - + a a - + b b - + c c - + d d - + e e - + f f - + g g - + h h - + i i - + j j - + k k - + l l - + m m - + n n - + o o - + p p - + q q - + r r - + s s - + t t - + u u - + v v - + w w - + x x - + y y - + z z - + Esc Esc - + F1 F1 - + F2 F2 - + F3 F3 - + F4 F4 - + F5 F5 - + F6 F6 - + F7 F7 - + F8 F8 - + F9 F9 - + F10 F10 - + F11 F11 - + F12 F12 - + ` ` - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - - + + - - - + = = - + BackSpace BackSpace - + Tab Tab - + [ [ - + ] ] - + \ \ - + CapsLock BlocMaiusc - + ; ; - + ' ' - + Enter Invio - + Shift_L Maiusc_SX - + , , - - + + . . - - + + / / - + Ctrl_L Ctrl_SX - - + + Super_L Super_SX - + Alt_L Alt_SX - + Space Spazio - + Alt_R Alt_DX - + Menu Menu - + Ctrl_R Ctrl_DX - + Shift_R Maiusc_DX - + Up Su - + Left Sinistra - + Down Giù - + Right Destra - + PrtSc Stamp - + Ins Ins - + Del Canc - + Home Home - + End Fine - + PgUp PgSu - + PgDn PgGiù - + NumLock BlocNum - + * * - + + + - + KP_Enter TN_Invio - + KP_1 TN_1 - + KP_2 TN_2 - + KP_3 TN_3 - + KP_4 TN_4 - + KP_5 TN_5 - + KP_6 TN_6 - + KP_7 TN_7 - + KP_8 TN_8 - + KP_9 TN_9 - + KP_0 TN_0 - + SCLK BlocScorr - + Pause Pausa - + Super_R Super_DX - + Mute Muto - + VolDn VolGiù - + VolUp VolSu - + Play Play - + Stop Stop - + Prev Prec - + Next Succ - + [NO KEY] [NO TASTO] @@ -5997,54 +6034,54 @@ Per favore controlla di avere i permessi di scrittura sul dispositivo. UnixWindowInfoDialog - + Captured Window Properties Finestra proprietà catturate - + Information About Window Informazioni sulla finestra - + Class: Classe: - - - + + + TextLabel etichetta di testo - + Title: Titolo: - + Path: Percorso: - + Match By Properties Trova per proprietà - + Class Classe - + Title Titolo - + Path Percorso @@ -6052,9 +6089,9 @@ Per favore controlla di avere i permessi di scrittura sul dispositivo. VDPad - - - + + + VDPad VDPad @@ -6062,224 +6099,224 @@ Per favore controlla di avere i permessi di scrittura sul dispositivo. VirtualKeyPushButton - + Space Spazio - + Tab Tab - + Shift (L) Maiusc (SX) - + Shift (R) Maiusc (DX) - + Ctrl (L) Ctrl (SX) - + Ctrl (R) Ctrl (DX) - + Alt (L) Alt (SX) - - + + Alt (R) Alt (DX) - + Alt Gr - + ` ` - + ~ ~ - - + + - - - + = = - + [ [ - + ] ] - + \ \ - + Caps Caps - + ; ; - + ' ' - + , , - - + + . . - - + + / / - + ESC ESC - + PRTSC STAMP - + SCLK BLOCSCORR - + INS INS - + PGUP PGSU - + DEL CANC - + PGDN PGGIU - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - + NUM LK BLOC NUM - - + + * * - + + + - + Enter Invio @@ -6296,42 +6333,42 @@ I O - + < < - + : : - + Super (L) Super (SX) - + Menu Menu - + Up Su - + Down Giù - + Left Sinistra - + Right Destra @@ -6339,226 +6376,226 @@ O VirtualKeyboardMouseWidget - - + + Keyboard Tastiera - - + + Mouse Mouse - + Mouse Settings Impostazioni mouse - + Left Mouse Sinistra - + Up Mouse Su - + Left Button Mouse Tasto sinistro - + Middle Button Mouse Tasto centrale - + Right Button Mouse Tasto destro - + Wheel Up Mouse Rotella su - + Wheel Left Mouse Rotella sinistra - + Wheel Right Mouse Rotella destra - + Wheel Down Mouse Rotella giù - + Down Mouse Giù - + Right Mouse Destra - + Button 4 Mouse Tasto 4 - + Mouse 8 Mouse Mouse 8 - + Button 5 Mouse Tasto 5 - + Mouse 9 Mouse Mouse 9 - + NONE NIENTE - - + + Last button - - + + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + Others - + Applications Applicazioni - + Browser Back Browser indietro - + Browser Favorites Browser preferiti - + Browser Forward Browser avanti - + Browser Home Browser home - + Browser Refresh Browser aggiorna - + Browser Search Browser cerca - + Browser Stop Browser stop - + Calc Calc - + Email Email - + Media Media - + Media Next Media successivo - + Media Play Media play - + Media Previous Media precedente - + Media Stop Media stop - + Search Cerca - + Volume Down Volume giù - + Volume Mute Volume muto - + Volume Up Volume su @@ -6566,7 +6603,7 @@ O VirtualMousePushButton - + INVALID INVALIDO @@ -6574,28 +6611,28 @@ O WinAppProfileTimerDialog - - + + Capture Application Cattura applicazione - + After pressing the "Capture Application" button, please select the application window that you want to have a profile associated with. The active application will be captured after the selected number of seconds. Dopo aver premuto il tasto "Cattura applicazione", per favore seleziona la finestra dell'applicazione con cui vuoi associare un profilo. L'applicazione attiva verrà catturata dopo il numero di secondi scelto. - + Timer: Timer: - + Seconds Secondi - + Cancel Annulla @@ -6603,12 +6640,12 @@ O WinExtras - + [NO KEY] [NO TASTO] - + AntiMicro Profile Profilo AntiMicro @@ -6616,67 +6653,66 @@ O X11Extras - + ESC ESC - + Tab Tab - + Space Spazio - + DEL CANC - + Return Invio - + KP_Enter TN_Invio - + Backspace Backspace - + Alt Gr - + xinput extension was not found. No mouse acceleration changes will occur. Estensione xinput non trovata. Non avverrà alcuna modifica all'accelerazione mouse. - + xinput version must be at least 2.0. No mouse acceleration changes will occur. La versione xinput dev'essere almeno 2.0. Non avverrà alcuna modifica all'accelerazione mouse. - Virtual pointer found with id=%1. - Trovato puntatore virtuale con id=%1. + Trovato puntatore virtuale con id=%1. - + PtrFeedbackClass was not found for virtual pointer.No change to mouse acceleration will occur for device with id=%1 PtrFeedbackClass non è stato trovato per il puntatore virtuale. Non avverrà alcuna modifica all'accelerazione del mouse con id=%1 - + Changing mouse acceleration for device with id=%1 Modificando l'accelerazione mouse per il dispositivo con id=%1 @@ -6684,7 +6720,7 @@ O XMLConfigReader - + Could not write updated profile XML to file %1. Impossibile scrivere profilo XML aggiornato sul file %1. @@ -6692,7 +6728,7 @@ O XMLConfigWriter - + Could not write to profile at %1. Impossibile scrivere su profilo a %1. @@ -6700,7 +6736,7 @@ O antimicro - + Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support. @@ -6708,97 +6744,97 @@ O main - + Launch program in system tray only. Esegui programma solo nella barra di sistema. - + Launch program with the tray menu disabled - + Launch program without the main window displayed - + Launch program with the configuration file selected as the default for selected controllers. Defaults to all controllers - + location - + Apply configuration file to a specific controller. Value can be a controller index, name, or GUID - + value - + Unload currently enabled profile(s) - + value(s) - + Start joysticks on a specific set. Value can be a controller index, name, or GUID - + number value - + Launch program as a daemon. Use only on Linux. - + Enable logging - + log-type - + Choose a file for logs writing - + filename - + Choose between using XTest support and uinput support for event generation. Use only if you have enabled xtest and uinput options on Linux or vmulti on Windows. Default: xtest. - + event-generation-type - + Print information about joysticks detected by SDL. Use only if you have sdl library. You can check your controller index, name or even GUID. diff --git a/share/antimicro/translations/antimicro_ja.ts b/share/antimicro/translations/antimicro_ja.ts old mode 100644 new mode 100755 index 45b5e6453..630ff6614 --- a/share/antimicro/translations/antimicro_ja.ts +++ b/share/antimicro/translations/antimicro_ja.ts @@ -4,17 +4,17 @@ AboutDialog - + About - + Version バージョン - + "juliagoda" (since March, 2018) Wanting only to play my favourite old games that din't support gamepads, I found this project (which map keyboard keys and mouse buttons to connected gamepads on Linux) as most proper and recent. But because of poor choices of such application on the internet and since it didn't compile properly, I decided to rescue the project. However, once I finished my work (enough to enjoy playing games) I thought about sharing this code with others. Of course all informations about past programmers will be held. "Ryochan7" (since December 30, 2012 until 2017), I have been working on antimicro in my spare time. What originally started as a fork of QJoyPad and a way to learn proper event-driven programming has turned into something much bigger than I originally intended. Although I have spent a lot of time learning new techniques, finding out more about the domain of KB+M emulation, and spending Friday nights bashing my head against my keyboard, it has been a fun and enriching experience overall. @@ -32,17 +32,17 @@ As of May 24, 2016, this project has moved to https://github.com/AntiMicro/antim - + Copyright: 2013 - 2018 - + Info 情報 - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -86,7 +86,7 @@ p, li { white-space: pre-wrap; } - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -204,57 +204,57 @@ p, li { white-space: pre-wrap; } - + Changelog - + Credits - + antimicro antimicro - + About Development - + License ライセンス - + Program Version %1 - + Program Compiled on %1 at %2 - + Built Against SDL %1 - + Running With SDL %1 - + Using Qt %1 - + Using Event Handler: %1 @@ -262,151 +262,160 @@ p, li { white-space: pre-wrap; } AddEditAutoProfileDialog - + Auto Profile Dialog - + Profile: プロファイル: - - + + Browse - + Window: ウィンドウ: - - + + Select Window. Click on the appropriate application window and the application file path will be populated in the form. - + Detect Window Properties - + Class: - + Title: タイトル: - + + set partial title + + + + Application: アプリケーション: - + Select - + + De&vices: + + + Devices: - デバイス: + デバイス: - - + + Select this profile to be the default loaded for the specified device. The selection will be used instead of the all default profile option. - + Set as Default for Controller - - + + A different profile is already selected as the default for this device. - + Current (%1) - + Open Config - - + + Select Program - + Programs (*.exe) - + Please use the main default profile selection. - + Please select a window by using the mouse. Press Escape if you want to cancel. - + Capture Application Window - + Could not obtain information for the selected window. - + Application Capture Failed - + Profile file path is invalid. - + No window matching property was specified. - + Program path is invalid or not executable. - + File is not an .exe file. - + No window matching property was selected. @@ -414,502 +423,502 @@ of the all default profile option. AdvanceButtonDialog - - + + Advanced 詳細設定 - + Assignments 割り当て - + Toggle トグル - + Turbo 連射 - + Set Selector - + Blank or KB/M - + Hold - + Pause Pause - + Cycle - + Distance - + Insert - + Delete 削除 - + Clear All - + Time: - + 0.01s 0.01 秒 - + 0s 0 秒 - + Insert a pause that occurs in between key presses. - + Release - - + + Insert a new blank slot. - + Delete a slot. - + Clear all currently assigned slots. - + Specify the duration of an inserted Pause or Hold slot. - + 0m 0 分 - + &Mouse Speed Mod: - - + + Specify the range past an axis dead zone in which a sequence of actions will execute. - + Distance: - - + + % % - + Mouse Mod - + Press Time - + Delay - + Execute - + Load 読み込み - + Set Change - + Text Entry - + Placeholder - - + + 0 0 - + Set the percentage that mouse speeds will be modified by. - + Auto Reset Cycle After - + seconds - + Executable: - + ... - + Arguments: - - - + + + Enabled 有効 - + Mode: - + <html><head/><body><p>Normal: Repeatedly press and release a button by the chosen rate.</p><p>Gradient: Modify the button press and button release delay based on how far an axis has been moved. The rate will remain the same.</p><p>Pulse: Modify how many times a button is pressed and released per second. The button delay will remain the same.</p></body></html> - + Normal - + Gradient - + Pulse - + Delay: - + 0.10s 0.10 秒 - + Rate: - + 10.0/s - - + + Disabled - + Select Set 1 One Way - + Select Set 1 Two Way - + Select Set 1 While Held - + Select Set 2 One Way - + Select Set 2 Two Way - + Select Set 2 While Held - + Select Set 3 One Way - + Select Set 3 Two Way - + Select Set 3 While Held - + Select Set 4 One Way - + Select Set 4 Two Way - + Select Set 4 While Held - + Select Set 5 One Way - + Select Set 5 Two Way - + Select Set 5 While Held - + Select Set 6 One Way - + Select Set 6 Two Way - + Select Set 6 While Held - + Select Set 7 One Way - + Select Set 7 Two Way - + Select Set 7 While Held - + Select Set 8 One Way - + Select Set 8 Two Way - + Select Set 8 While Held - + sec. - + /sec. - + Set %1 セット %1 - - + + Select Set %1 - + One Way - + Two Way - + While Held - + Choose Executable - + Slots past a Cycle action will be executed on the next button press. Multiple cycles can be added in order to create partitions in a sequence. - + Delays the time that the next slot is activated by the time specified. Slots activated before the delay will remain active after the delay time has passed. - + Distance action specifies that the slots afterwards will only be executed when an axis is moved a certain range past the designated dead zone. - + Insert a hold action. Slots after the action will only be executed if the button is held past the interval specified. - + Chose a profile to load when this slot is activated. - + Mouse mod action will modify all mouse speed settings by a specified percentage while the action is being processed. This can be useful for slowing down the mouse while sniping. - + Specify the time that keys past this slot should be held down. - + Insert a release action. Slots after the action will only be executed after a button release if the button was held past the interval specified. - + Change to selected set once slot is activated. - + Full string will be typed when a slot is activated. - + Execute program when slot is activated. - - + + Choose Profile - + Config Files (*.amgp *.xml) 構成ファイル (*.amgp *.xml) @@ -917,157 +926,157 @@ of the all default profile option. AdvanceStickAssignmentDialog - + Stick/Pad Assignment - + Sticks スティック - + DPads 十字キー - - + + %1 (Joystick %2) %1 (ジョイスティック %2) - + Stick 1 スティック 1 - - - + + + Enabled 有効 - - - - - - + + + + + + Assign 割り当て - - + + X Axis: X 軸: - - + + Y Axis: Y 軸: - + Stick 2 スティック 2 - + Number of Physical DPads: %1 物理方向キーの数: %1 - + Virtual DPad 1 仮想方向キー 1 - + Up: 上: - + Down: 下: - + Note: This window is meant for backwards compatibility with profiles made before antimicro 2.0. Since version 2.0, use of the Game Controller Mapping window is preferred. 注: このウィンドウは、バージョン 2.0 より前の antimicro で作成したプロファイルとの後方互換性を確保するために使用します。バージョン 2.0 以降では「ゲームコントローラーマッピング」ウィンドウの使用を推奨します。 - + Left: 左: - + Right: 右: - - - - + + + + Axis %1 軸 %1 - - - - + + + + Axis %1 - 軸 %1 - - - - - + + + + Axis %1 + 軸 %1 + - - - - + + + + Button %1 ボタン %1 - + Move stick 1 along the X axis - + Move stick 1 along the Y axis - + Move stick 2 along the X axis - + Move stick 2 along the Y axis - - - - + + + + Press a button or move an axis @@ -1075,179 +1084,179 @@ of the all default profile option. AxisEditDialog - + Axis - - + + Mouse (Horizontal) - - + + Mouse (Inverted Horizontal) - - + + Mouse (Vertical) - - + + Mouse (Inverted Vertical) - - + + Arrows: Up | Down - - + + Arrows: Left | Right - - + + Keys: W | S - - + + Keys: A | D - - + + NumPad: KP_8 | KP_2 - - + + NumPad: KP_4 | KP_6 - - - + + + None - - + + Set the value to use as the limit for an axis. Useful for a worn out analog stick. - + Negative Half Throttle - + Positive Half Throttle - + Name: 名前: - + Specify the name of an axis. - + Mouse Settings マウスの設定 - - + + Set the value of the dead zone for an axis. - + Presets: プリセット: - + Dead Zone: - + Max Zone: - - + + [NO KEY] [割り当てなし] - + Throttle setting that determines the behavior of how to interpret an axis hold or release. - + Negative Throttle - + Normal - + Positive Throttle - + Current Value: - + Set セット - + Set %1 セット %1 - + Left Mouse Button 左マウスボタン - + Right Mouse Button 右マウスボタン @@ -1255,37 +1264,37 @@ interpret an axis hold or release. ButtonEditDialog - + Dialog - + To make a new assignment, press any keyboard key or click a button in the Keyboard or Mouse tab 割り当てを新規作成するには、キーボードのキーを押すか、「キーボード」あるいは「マウス」タブのいずれかのボタンをクリックしてください - + Placeholder - + Toggle トグル - + Enables a key press or release to only occur when a controller button is pressed. - + Enables rapid key presses and releases. Turbo controller. - + Turbo 連射 @@ -1294,38 +1303,38 @@ interpret an axis hold or release. 現在の割り当て: - + Last keyboard/mouse button: - + Slots - + Na&me: 名前(&M): - + Specify the name of a button. - + Action: アクション: - + Specify the action that will be performed in game while this button is being used. - + Advanced 詳細設定 @@ -1338,52 +1347,52 @@ this button is being used. セット %1 - - - + + + Choose your keyboard key - + No button - - - - + + + + Last button - + To change settings for last button, it must be at least one assignment from keyboard to gamepad - + To change settings of turbo for last button, it must be at least one assignment from keyboard to gamepad - + To open advanced dialog, it's needed to map at least one button from keyboard to gamepad - + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + As last gamepad button has been set - + Index %1 @@ -1391,190 +1400,190 @@ this button is being used. Calibration - + Form - - + + Start calibration - + Controller: - + Sticks: - - Use settings from jstest-gtk - - - - + Reset settings - + Cancel キャンセル - - + + Save 保存 - - + + Calibration - - Do you really want to reset settings of current axes? + + Do you really want to reset settings of current axis? - + Calibration was saved for the preset. Do you really want to reset settings? - + Place the joystick in the center position. It's the part, where often you don't have to move. Just skip it in such situation. - + Calibrating center - + Start second step - + Center X: %1 - + Center Y: %1 - + Place the joystick in the top-left corner many times - - + + Calibrating position - - + + X: %1 - - + + Y: %1 - + Place the joystick in the bottom-right corner - + Start final step - + range X: %1 - %2 - + range Y: %1 - %2 - + deadzone X: %1 - + deadzone Y: %1 - + ---Calibration done!--- - + Calibration values have been saved - - + + Dead zone calibration - - You must move X axis to the right at least five times! Keep moving! + + You have to move axes to the top-left corner at least five times. - - You must move X axis to the left at least five times! Keep moving! + + You have to move axes to the bottom-right corner at least five times. - - - - + + Do you want to save calibration of current axis? + + + + + + + Axis %1 軸 %1 @@ -1582,64 +1591,64 @@ deadzone Y: %1 CapturedWindowInfoDialog - + Captured Window Properties - + Information About Window - + Class: - - - + + + TextLabel - + Title: タイトル: - + Path: - + Match By Properties - + Class - + Title タイトル - + Path - + Full Path - + File Name @@ -1654,67 +1663,67 @@ deadzone Y: %1 DPadContextMenu - + Mouse (Normal) - + Mouse (Inverted Horizontal) - + Mouse (Inverted Vertical) - + Mouse (Inverted Horizontal + Vertical) - + Arrows - + Keys: W | A | S | D - + NumPad - + None - + Standard - + Eight Way - + 4 Way Cardinal - + 4 Way Diagonal - + Mouse Settings マウスの設定 @@ -1722,108 +1731,108 @@ deadzone Y: %1 DPadEditDialog - + Dialog - + Presets: プリセット: - + Mouse (Normal) - + Mouse (Inverted Horizontal) - + Mouse (Inverted Vertical) - + Mouse (Inverted Horizontal + Vertical) - + Arrows - + Keys: W | A | S | D - + NumPad - + None - + Dpad Mode: - + &Name: - + 4 Way Cardinal - + 4 Way Diagonal - + DPad Delay: - - + + Time lapsed before a direction change is taken into effect. - + s - + Specify the name of a dpad. - + Mouse Settings マウスの設定 - + Standard - + Standard: 8 region dpad with two direction buttons active when the dpad is in a diagonal region. @@ -1839,17 +1848,17 @@ to a diagonal zone. - + Eight Way - + Set セット - + Set %1 セット %1 @@ -1857,27 +1866,27 @@ to a diagonal zone. EditAllDefaultAutoProfileDialog - + Default Profile - + Profile: プロファイル: - + Browse - + Open Config - + Profile file path is invalid. @@ -1885,29 +1894,29 @@ to a diagonal zone. ExtraProfileSettingsDialog - + Extra Profile Settings - + Key Press Time: - + 0.00 ms - + Profile Name: プロファイル名: - - - + + + s s @@ -1915,7 +1924,7 @@ to a diagonal zone. GameController - + Game Controller ゲームコントローラー @@ -1923,9 +1932,9 @@ to a diagonal zone. GameControllerDPad - - - + + + DPad 十字キー @@ -1933,187 +1942,187 @@ to a diagonal zone. GameControllerMappingDialog - + Game Controller Mapping - + <html><head/><body><p>antimicro makes use of the <a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;">Game Controller API</span></a> provided by SDL 2 in order to abstract various gamepads to fit a unified standard. In order to make a button assignment, please highlight the mapping cell for the appropriate button row below. You can then press a button or move an axis on your gamepad and the cell will update with the physical button or axis that will be used.</p><p>antimicro will use the mapping that you specify to save a mapping string that will be loaded into SDL.</p></body></html> - + A A - + B B - + X X - + Y Y - + Back - + Start - + Guide - + Left Shoulder - + Right Shoulder - + Left Stick Click - + Right Stick Click - + Left Stick X 左スティック X - + Left Stick Y 左スティック Y - + Right Stick X 右スティック X - + Right Stick Y 右スティック Y - + Left Trigger 左トリガー - + Right Trigger 右トリガー - + DPad Up 十字キー↑ - + DPad Left 十字キー← - + DPad Down 十字キー↓ - + DPad Right 十字キー→ - + Mapping - + SDL 2 Game Controller Mapping String - + Last Axis Event: - + Current Axis Detection Dead Zone: - + 5000 5000 - + 10000 10000 - + 15000 15000 - + 20000 20000 - + 25000 25000 - + 30000 30000 - + 32000 32000 - + Game Controller Mapping (%1) (#%2) - + Discard Controller Mapping? - + Discard mapping for this controller? If discarded, the controller will be reverted to a joystick once you refresh all joysticks. @@ -2123,47 +2132,47 @@ If discarded, the controller will be reverted to a joystick once you refresh all GameControllerSet - + Back - + Guide - + Start - + LS Click - + RS Click - + L Shoulder - + R Shoulder - + L Trigger 左トリガー - + R Trigger 右トリガー @@ -2171,9 +2180,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all GameControllerTrigger - - - + + + Trigger トリガー @@ -2181,9 +2190,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxis - - - + + + Axis @@ -2191,24 +2200,24 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxisButton - + Negative - + Positive - + Unknown 不明 - - - + + + Button ボタン @@ -2216,74 +2225,74 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxisContextMenu - + Mouse (Horizontal) - + Mouse (Inverted Horizontal) - + Mouse (Vertical) - + Mouse (Inverted Vertical) - + Arrows: Up | Down - + Arrows: Left | Right - + Keys: W | S - + Keys: A | D - + NumPad: KP_8 | KP_2 - + NumPad: KP_4 | KP_6 - - + + None - - + + Mouse Settings マウスの設定 - + Left Mouse Button 左マウスボタン - + Right Mouse Button 右マウスボタン @@ -2291,57 +2300,57 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButton - + Processing turbo for #%1 - %2 - + Finishing turbo for button #%1 - %2 - + Processing press for button #%1 - %2 - + Processing release for button #%1 - %2 - + Distance change for button #%1 - %2 - - - + + + Button ボタン - - - - + + + + [NO KEY] [割り当てなし] - + [Set %1 1W] - + [Set %1 2W] - + [Set %1 WH] @@ -2349,47 +2358,47 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButtonContextMenu - + Toggle トグル - + Turbo 連射 - + Clear - + Set Select - + Disabled - + Set %1 セット %1 - + Set %1 1W セット %1 1W - + Set %1 2W セット %1 2W - + Set %1 WH @@ -2397,118 +2406,118 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButtonSlot - - + + Mouse マウス - + Up - + Down - + Left - + Right - + LB - + MB - + RB - + B4 - + B5 - + Pause Pause - + Hold - + Cycle - + Distance - + Release - + Mouse Mod - + Press Time - + Delay - + Load %1 - + Set Change %1 - + [Text] %1 - + [Exec] %1 - + [NO KEY] [割り当てなし] @@ -2516,9 +2525,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStick - - - + + + Stick スティック @@ -2526,37 +2535,37 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickButton - - - + + + Up - - - + + + Down - - - + + + Left - - - + + + Right - - - + + + Button ボタン @@ -2564,67 +2573,67 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickContextMenu - + Mouse (Normal) - + Mouse (Inverted Horizontal) - + Mouse (Inverted Vertical) - + Mouse (Inverted Horizontal + Vertical) - + Arrows - + Keys: W | A | S | D - + NumPad - + None - + Standard - + Eight Way - + 4 Way Cardinal - + 4 Way Diagonal - + Mouse Settings マウスの設定 @@ -2632,86 +2641,86 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickEditDialog - + Dialog - + X: X: - - - - - + + + + + 0 0 - + Y: Y: - + Distance: - + Presets: プリセット: - + Mouse (Normal) - + Mouse (Inverted Horizontal) - + Mouse (Inverted Vertical) - + Mouse (Inverted Horizontal + Vertical) - + Arrows - + Keys: W | A | S | D - + NumPad - + None - + Stick Mode: - + Standard: 8 region stick with two direction buttons active when the stick is in a diagonal region. @@ -2727,72 +2736,72 @@ to a diagonal zone of the stick. - + 4 Way Cardinal - + 4 Way Diagonal - - + + Dead zone value to use for an analog stick. - - + + Value when an analog stick is considered moved 100%. - - + + The area (in degrees) that each diagonal region occupies. - + Square Stick: - - + + Percentage to modify a square stick coordinates to confine values to a circle - + % % - + Stick Delay: - - + + Time lapsed before a direction change is taken into effect. - + s - + Modifier: - + Edit button that is active while the stick is active. This button is useful for assigning zones with @@ -2801,68 +2810,68 @@ functionality to an analog stick. - + PushButton - + Na&me: Name: 名前: - + Specify the name of an analog stick. - + Mouse Settings マウスの設定 - + Standard - + Bearing: - + % Safe Zone: - + Eight Way - + Dead Zone: - + Max Zone: - + Diagonal Range: - + Set セット - + Set %1 セット %1 @@ -2870,9 +2879,9 @@ functionality to an analog stick. JoyControlStickModifierButton - - - + + + Modifier @@ -2880,9 +2889,9 @@ functionality to an analog stick. JoyDPad - - - + + + DPad 十字キー @@ -2890,37 +2899,37 @@ functionality to an analog stick. JoyDPadButton - - - + + + Up - - - + + + Down - - - + + + Left - - - + + + Right - - - + + + Button ボタン @@ -2928,266 +2937,271 @@ functionality to an analog stick. JoyTabWidget - - - - - - + + + + + + <New> <新規> - - + + Remove 削除 - - + + Remove configuration from recent list. - - + + Load 読み込み - - + + Load configuration file. - - + + Save 保存 - - + + Save changes to configuration file. - - + + Save As 別名保存 - - + + Save changes to a new configuration file. - - + + Sets セット - + Copy from Set セットからコピー - + Settings 設定 - - + + Set 1 セット 1 - - + + Set 2 セット 2 - - + + Set 3 セット 3 - - + + Set 4 セット 4 - - + + Set 5 セット 5 - - + + Set 6 セット 6 - - + + Set 7 セット 7 - - + + Set 8 セット 8 - - + + Stick/Pad Assign - - + + Controller Mapping - - + + Quick Set クイックセット - - + + Names - - + + Toggle button name displaying. - - + + Pref - - + + Change global profile settings. - - - + + + Reset リセット - - + + Revert changes to the configuration. Reload configuration file. - + Open Config - + Config Files (*.amgp *.xml) 構成ファイル (*.amgp *.xml) - - - + + + Config File (*.%1.amgp) 構成ファイル (*.%1.amgp) - - + + Do you really want to reset buttons settings for joystick? + + + + + Save Profile Changes? - - + + Changes to the new profile have not been saved. Would you like to save or discard the current profile? - - + + Changes to the profile "%1" have not been saved. Would you like to save or discard changes to the current profile? - + Sticks スティック - - + + DPads 十字キー - + No buttons have been assigned. Please use Quick Set to assign keys to buttons or disable hiding empty buttons. - - + + Set %1: %2 セット %1: %2 - - + + Set %1 セット %1 - + Copy Set Assignments - + Are you sure you want to copy the assignments and device properties from %1? - - - + + + Save Config - - + + Set セット @@ -3195,7 +3209,7 @@ to buttons or disable hiding empty buttons. Joystick - + Joystick ジョイスティック @@ -3203,98 +3217,98 @@ to buttons or disable hiding empty buttons. JoystickStatusWindow - + Properties プロパティ - + Details - + Name: 名前: - - - - - - - + + + + + + + %1 %1 - + Number: - + Axes: 軸: - + Buttons: ボタン: - + Hats: - + GUID: GUID: - + Game Controller: ゲームコントローラー: - + Axes - + Buttons ボタン - + Hats - + %1 (#%2) Properties - + Axis %1 軸 %1 - + Hat %1 - + No いいえ - + Yes はい @@ -3302,62 +3316,67 @@ to buttons or disable hiding empty buttons. MainSettingsDialog - + Edit Settings - + General 全般 - + Controller Mappings - + Language 言語 - + Auto Profile - + Mouse マウス - + Advanced 詳細設定 - + + Profile Direc&tory: + + + + <html><head/><body><p>Specify the default directory that the program should use in file dialogs when loading a profile or saving a new profile.</p></body></html> - + Recent Profile Count: - + <html><head/><body><p>Number of profiles that can be placed in recent profile list. 0 will result in the program not enforcing a limit on the number of profiles displayed.</p></body></html> - + Gamepad Poll Rate: - + Change the poll rate that the program uses to discover new events from gamepads. Defaults to 10 ms. @@ -3367,52 +3386,52 @@ before using antimicro unattended. - + Hide main window when the main window close button is clicked instead of quitting the program. - + Close To Tray - + Have Windows start antimicro at system startup. - + Launch At Windows Startup Windows の起動と同時に開始 - + Display recent profiles for all controllers as a single list in the tray menu. Defaults to using sub-menus. - + Single Profile List in Tray - + Have the program minimize to the taskbar. By default, the program minimizes to the system tray if available. - + Minimize to Taskbar タスクバーに入れる - + This option will cause the program to hide all buttons that have no slots assigned to them. The Quick Set dialog window will have to be used @@ -3420,167 +3439,177 @@ to bring up the edit dialog for gamepad buttons. - + Hide Empty Buttons - + When the program is launched, open the last known profile that was opened during the previous session. - + Auto Load Last Opened Profile - + Only show the system tray icon when the program first launches. - + Launch in Tray - + Associate .amgp files with antimicro in Windows Explorer. - + Associate Profiles プロファイルを関連付け - + Key Repeat - + Active keys will be repeatedly pressed when this option is enabled. - - + + Enable 有効 - + Specifies how much time should elapse before key repeating begins. - + Specifies how many times key presses will be performed per seconds. - + <html><head/><body><p>antimicro has been translated into many different languages by contributors. By default, the program will choose an appropriate translation based on your system's locale setting. However, you can make antimicro load a different translation depending on the language that you choose from the list below.</p></body></html> - + Português do Brasil - + Français - + Deutsch - + Italiano - + 日本語 - + Русский - + српски / srpski - + 简体中文 - + Español - + українська - + Polski - + + History Si&ze: + + + + Log File: - + Log Level: - + None - + Error - + Warning - + Info 情報 - + Debug + + + Reset + リセット + French フランス語 @@ -3602,22 +3631,22 @@ per seconds. ウクライナ語 - + Class - + Title タイトル - + Program - + Disable the "Enhanced Pointer Precision" Windows setting while antimicro is running. Disabling "Enhanced Pointer Precision" will allow mouse movement within antimicro to be more @@ -3625,32 +3654,27 @@ precise. - + Disable Enhance Pointer Precision - + Smoothing - - Histor&y Size: - - - - + Weight &Modifier: - + Refresh Rate: - + The refresh rate is the amount of time that will elapse in between mouse events. Please be cautious when editing this setting as it will cause the program to use @@ -3660,46 +3684,46 @@ it unattended. - + Spring - + Screen: スクリーン: - + Utilize the specified screen for spring mode. On Linux, the default is to use the primary screen. On Windows, the default is to use all available screens. - + Accel Numerator: - - - + + + 0 0 - + Accel Denominator: - + Accel Threshold: - + If the acceleration values for the virtual mouse have been changed by a different process, particularly when quitting an older game, then you might want to reset the acceleration @@ -3707,71 +3731,66 @@ values used by the virtual mouse. - + Reset Acceleration - + Delay: - - Profi&le Directory: - - - - + ms - + Rate: - + times/s - + Below is a list of the custom mappings that have been saved. You can use the following table to delete mappings or have mappings temporarily disabled. You can also disable mappings that are included with SDL; just insert a new row with the appropriate joystick GUID and check disable. Settings will not take affect until you either refresh all joysticks or unplug that particular joystick. - + GUID GUID - + Mapping String - + Disable? - - + + Delete 削除 - + Insert - - + + Default デフォルト @@ -3780,7 +3799,7 @@ Settings will not take affect until you either refresh all joysticks or unplug t ポルトガル語 (ブラジル) - + English 英語 @@ -3789,199 +3808,209 @@ Settings will not take affect until you either refresh all joysticks or unplug t ドイツ語 - - + + Active - + Devices: デバイス: - - + + All - + Device デバイス - + Profile プロファイル - + Default? - + Add 追加 - + Edit 編集 - + Also, Windows users who want to use a low value should also check the "Disable Enhance Pointer Precision" checkbox if you haven't disabled the option in Windows. - + Select Default Profile Directory - + Are you sure you want to delete the profile? - + Save Log File As - + Log Files (*.log) + + + Do you really want to reset setting? + + + + + Would you like to reset mappings too? + + MainWindow - + antimicro antimicro - + No Joysticks have been found. Please plug in a joystick and then choose the "Update Joysticks" option in the main menu ジョイスティックが見つかりません。 ジョイスティックを接続し、メインメニューの「ジョイスティックを更新」を選択してください - + If events are not seen by a game, please click here to run this application as Administrator. - + &App - + &Options オプション(&O) - + &Help ヘルプ(&H) - - + + &Quit 終了(&Q) - + Ctrl+Q Ctrl+Q - - + + &Update Joysticks ジョイスティックを更新(&U) - + Ctrl+U Ctrl+U - - + + &Hide 隠す(&H) - + Ctrl+H Ctrl+H - + &About AntiMicro について(&A) - + Ctrl+A Ctrl+A - + About &Qt - + &Properties - + &Key Checker - + &GitHub Page - + &Game Controller Mapping - + S&ettings - + &Stick/Pad Assign - + &Wiki - + &Issues - + &Calibration @@ -3998,7 +4027,7 @@ the option in Windows. キーチェッカー - + Home Page ホームページ @@ -4011,66 +4040,66 @@ the option in Windows. 設定 - + Could not find a proper controller identifier. Exiting. - - - - - - - + + + + + + + (%1) (%1) - - + + Open File - + &Restore - + Calibration couldn't be opened - + You must connect at least one controller to open the window - + Run as Administrator? - + Are you sure that you want to run this program as Adminstrator? Some games run as Administrator which will cause events generated by antimicro to not be used by those games unless antimicro is also run as the Adminstrator. This is due to permission problems caused by User Account Control (UAC) options in Windows Vista and later. - + Failed to elevate program - + Failed to restart this program as the Administrator - + Could not find controller. Exiting. @@ -4078,12 +4107,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseAxisSettingsDialog - + Mouse Settings - - + Set %1 セット %1 @@ -4091,12 +4120,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseButtonSettingsDialog - + Mouse Settings - - + Set %1 セット %1 @@ -4104,12 +4133,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseControlStickSettingsDialog - + Mouse Settings マウスの設定 - + Set %1 セット %1 @@ -4117,12 +4146,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseDPadSettingsDialog - + Mouse Settings マウスの設定 - + Set %1 セット %1 @@ -4130,17 +4159,17 @@ Some games run as Administrator which will cause events generated by antimicro t MouseSettingsDialog - + Mouse Settings マウスの設定 - + Mouse Mode: マウスモード: - + Cursor mode is used to move the mouse cursor around the screen relative to its current position depending on how much you move an axis @@ -4154,79 +4183,79 @@ axis is moved back to the dead zone. - + Cursor カーソル - + Spring - + Acceleration: 加速: - + Enhanced Precision - - + + Linear - + Quadratic - + Cubic - + Quadratic Extreme - + Power Function - + Easing Quadratic - + Easing Cubic - + Mouse Speed Settings - + Enable to change the horizontal and vertical speed boxes at the same time. - + Change Together - + Options for adding more acceleration to the mouse movement beyond what the acceleration curve would produce. Acceleration is added based on how quickly an axis is @@ -4236,17 +4265,17 @@ using typical gamepad analog sticks. - + Delta Acceleration - + &Multiplier: - + Mi&n Threshold: @@ -4257,8 +4286,8 @@ Speed: 水平速度: - - + + 1 = 20 pps @@ -4268,30 +4297,30 @@ Speed: 垂直速度: - + Wheel Hori. Speed: - + Set the speed used for horizontal mouse wheel movement according to number of simulated notches per second. - + Set the speed used for vertical mouse wheel movement according to number of simulated notches per second. - + Sensitivit&y: - + For Power Function acceleration curve. Specifies the factor to use for curve sensitivity. When the value is above 1.0, the mouse movement will be accelerated @@ -4299,122 +4328,122 @@ faster at the low end of an axis. - + Easing Duration: - - + + s - + Highest value to accelerate mouse movement by - + x x - + Start %: - + Acceleration begins at this percentage of the base multiplier - + Minimum amount of axis travel required for acceleration to begin - + Max Threshold: - + Maximum axis travel before acceleration has reached the multiplier value - + E&xtra Duration: - + Curve: - + Ease Out Sine - + Ease Out Quad - + Ease Out Cubic - + Release Radius: - + Specifies that the spring area will be relative to the mouse position set by a non-relative spring. - + Relative - + Mouse Status - + X: X: - - + + 0 (0 pps) - + Y: Y: - - + + 1 = 1 notch(es)/s 1 = 1 ノッチ/秒 - + Enhanced: Three tier curve that makes the mouse move slow on the low end of an axis and fast on the high end. @@ -4436,19 +4465,19 @@ a period of time using a Cubic curve. - + Hori&zontal Speed: - + &Vertical Speed: - + Wheel Vert. Speed: @@ -4458,59 +4487,59 @@ Speed: 感度: - + Specifies the amount of time (in seconds) that will be required before the mouse is fully accelerated after reaching the high end of an axis. - - - - + + + + % % - + Extend the time that extra acceleration is applied. Axis travel will be taken into account. A slower flick will decrease the actual time that extra acceleration will be applied. - + Spring Settings - + Spring Width: - + Changes the width of the region that the cursor can move in spring mode. 0 will use the entire width of your screen. - + Spring Height: - + Changes the height of the region that the cursor can move in spring mode. 0 will use the entire height of your screen. - - + + %n notch(es)/s %n ノッチ/秒 @@ -4520,39 +4549,39 @@ of your screen. QKeyDisplayDialog - + Key Checker キーチェッカー - - <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> + + <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="http://doc.qt.io/qt-5/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">http://doc.qt.io/qt-5/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> - + Event Handler: イベントハンドラ: - + Native Key Value: ネイティブキー値: - - - + + + 0x00000000 0x00000000 - + Qt Key Value: Qt キー値: - + antimicro Key Value: antimicro キー値: @@ -4560,265 +4589,265 @@ of your screen. QObject - + Super - + Menu - + Mute - + Vol+ - + Vol- - + Play/Pause - + Play - + Pause Pause - + Prev - + Next - + Mail - + Home Home - + Media メディア - + Search 検索 - + Daemon launched - + Failed to launch daemon - + Launching daemon - - + + Display string "%1" is not valid. - + Failed to set a signature id for the daemon - + Failed to change working directory to / - + Quitting Program - + # of joysticks found: %1 - + List Joysticks: - + --------------- - + Joystick %1: ジョイスティック %1: - + Index: %1 - + GUID: %1 GUID: %1 - + Name: %1 名前: %1 - + Yes はい - + No いいえ - + Game Controller: %1 ゲームコントローラー: %1 - + # of Axes: %1 - + # of Buttons: %1 - + # of Hats: %1 - + Attempting to use fallback option %1 for event generation. - + Failed to open event generator. Exiting. - + Using %1 as the event generator. - + Could not raise process priority. - + Last button - + There isn't a last button pressed from gamepad in data. Did you set at least one button from gamepad for keyboard? - + Active window changed to: Title = "%1", Class = "%2", Program = "%3" or "%4". - + Profile location %1 is not an XML file. - + Profile location %1 does not exist. - - - + + + Controller identifier is not a valid value. - + An invalid set number '%1' was specified. - + Controller identifier '%s'' is not a valid value. - + No set number was specified. - + No controller was specified. - + No display string was specified. - + An invalid event generator was specified. - + No event generator string was specified. - + No log file specified. @@ -4827,22 +4856,22 @@ of your screen. オプション - + Logging started - + Auto-switching to profile "%1". - + Auto-switching to nullptr profile! - + xinput version must be at least 2.0. No mouse acceleration changes will occur. @@ -4850,18 +4879,18 @@ of your screen. QuickSetDialog - + Quick Set クイックセット - + <html><head/><body><p>Please press a button or move an axis on %1 (<span style=" font-weight:600;">%2</span>).<br/>A dialog window will then appear which will<br/>allow you to make an assignment.</p></body></html> - - + + Quick Set %1 クイックセット %1 @@ -4869,12 +4898,12 @@ of your screen. SetAxisThrottleDialog - + Throttle Change - + The throttle setting for Axis %1 has been changed. Would you like to distribute this throttle change to all sets? @@ -4884,12 +4913,12 @@ Would you like to distribute this throttle change to all sets? SetJoystick - + Set %1: %2 セット %1: %2 - + Set %1 セット %1 @@ -4897,52 +4926,52 @@ Would you like to distribute this throttle change to all sets? SetNamesDialog - + Set Name Settings - + Set 1 セット 1 - + Set 2 セット 2 - + Set 3 セット 3 - + Set 4 セット 4 - + Set 5 セット 5 - + Set 6 セット 6 - + Set 7 セット 7 - + Set 8 セット 8 - + Name @@ -4950,7 +4979,7 @@ Would you like to distribute this throttle change to all sets? SimpleKeyGrabberButton - + Mouse マウス @@ -4958,7 +4987,7 @@ Would you like to distribute this throttle change to all sets? SpringModeRegionPreview - + Spring Mode Preview @@ -4966,20 +4995,20 @@ Would you like to distribute this throttle change to all sets? UInputEventHandler - + Could not find a valid uinput device file. Please check that you have the uinput module loaded. lsmod | grep uinput - + Could not open uinput device file Please check that you have permission to write to the device - + Using uinput device file %1 @@ -4987,551 +5016,551 @@ Please check that you have permission to write to the device UInputHelper - + a a - + b b - + c c - + d d - + e e - + f f - + g g - + h h - + i i - + j j - + k k - + l l - + m m - + n n - + o o - + p p - + q q - + r r - + s s - + t t - + u u - + v v - + w w - + x x - + y y - + z z - + Esc Esc - + F1 F1 - + F2 F2 - + F3 F3 - + F4 F4 - + F5 F5 - + F6 F6 - + F7 F7 - + F8 F8 - + F9 F9 - + F10 F10 - + F11 F11 - + F12 F12 - + ` ` - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - - + + - - - + = = - + BackSpace BackSpace - + Tab Tab - + [ [ - + ] ] - + \ \ - + CapsLock CapsLock - + ; ; - + ' ' - + Enter Enter - + Shift_L - + , , - - + + . . - - + + / / - + Ctrl_L - - + + Super_L - + Alt_L - + Space スペース - + Alt_R - + Menu - + Ctrl_R - + Shift_R - + Up - + Left - + Down - + Right - + PrtSc PrtSc - + Ins - + Del Del - + Home Home - + End End - + PgUp PgUp - + PgDn PgDn - + NumLock NumLock - + * * - + + + - + KP_Enter - + KP_1 - + KP_2 - + KP_3 - + KP_4 - + KP_5 - + KP_6 - + KP_7 - + KP_8 - + KP_9 - + KP_0 - + SCLK - + Pause Pause - + Super_R - + Mute - + VolDn - + VolUp - + Play - + Stop - + Prev - + Next - + [NO KEY] [割り当てなし] @@ -5539,54 +5568,54 @@ Please check that you have permission to write to the device UnixWindowInfoDialog - + Captured Window Properties - + Information About Window - + Class: - - - + + + TextLabel - + Title: タイトル: - + Path: - + Match By Properties - + Class - + Title タイトル - + Path @@ -5594,9 +5623,9 @@ Please check that you have permission to write to the device VDPad - - - + + + VDPad @@ -5604,263 +5633,263 @@ Please check that you have permission to write to the device VirtualKeyPushButton - + Space スペース - + Tab Tab - + Shift (L) Shift (左) - + Shift (R) Shift (右) - + Ctrl (L) Ctrl (左) - + Ctrl (R) Ctrl (右) - + Alt (L) Alt (左) - - + + Alt (R) Alt (右) - + Alt Gr - + ` ` - + ~ ~ - - + + - - - + = = - + [ [ - + ] ] - + \ \ - + Caps Caps - + ; ; - + ' ' - + , , - - + + . . - - + + / / - + ESC - + PRTSC - + SCLK - + INS - + PGUP - + DEL - + PGDN - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - + NUM LK - - + + * * - + + + - + Enter Enter - + < < - + : : - + Super (L) - + Menu - + Up - + Down - + Left - + Right @@ -5868,226 +5897,226 @@ LK VirtualKeyboardMouseWidget - - + + Keyboard キーボード - - + + Mouse マウス - + Mouse Settings マウスの設定 - + Left Mouse - + Up Mouse - + Left Button Mouse 左ボタン - + Middle Button Mouse 中ボタン - + Right Button Mouse 右ボタン - + Wheel Up Mouse - + Wheel Left Mouse - + Wheel Right Mouse - + Wheel Down Mouse - + Down Mouse - + Right Mouse - + Button 4 Mouse ボタン 4 - + Mouse 8 Mouse マウス 8 - + Button 5 Mouse ボタン 5 - + Mouse 9 Mouse マウス 9 - + NONE 割り当てなし - - + + Last button - - + + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + Others - + Applications アプリケーション - + Browser Back ブラウザ: 戻る - + Browser Favorites ブラウザ: お気に入り - + Browser Forward ブラウザ: 進む - + Browser Home ブラウザ: ホーム - + Browser Refresh ブラウザ: 更新 - + Browser Search ブラウザ: 検索 - + Browser Stop - + Calc - + Email Eメール - + Media メディア - + Media Next メディア: 次へ - + Media Play メディア: 再生 - + Media Previous メディア: 前へ - + Media Stop メディア: 停止 - + Search 検索 - + Volume Down 音量: 下げる - + Volume Mute 音量: ミュート - + Volume Up 音量: 上げる @@ -6095,7 +6124,7 @@ LK VirtualMousePushButton - + INVALID @@ -6103,28 +6132,28 @@ LK WinAppProfileTimerDialog - - + + Capture Application - + After pressing the "Capture Application" button, please select the application window that you want to have a profile associated with. The active application will be captured after the selected number of seconds. - + Timer: タイマー: - + Seconds - + Cancel キャンセル @@ -6132,12 +6161,12 @@ LK WinExtras - + [NO KEY] [割り当てなし] - + AntiMicro Profile AntiMicro プロファイル @@ -6145,67 +6174,62 @@ LK X11Extras - + ESC - + Tab Tab - + Space スペース - + DEL - + Return - + KP_Enter - + Backspace Backspace - + Alt Gr - + xinput extension was not found. No mouse acceleration changes will occur. - + xinput version must be at least 2.0. No mouse acceleration changes will occur. - - Virtual pointer found with id=%1. - - - - + PtrFeedbackClass was not found for virtual pointer.No change to mouse acceleration will occur for device with id=%1 - + Changing mouse acceleration for device with id=%1 @@ -6213,7 +6237,7 @@ LK XMLConfigReader - + Could not write updated profile XML to file %1. @@ -6221,7 +6245,7 @@ LK XMLConfigWriter - + Could not write to profile at %1. @@ -6229,7 +6253,7 @@ LK antimicro - + Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support. @@ -6237,97 +6261,97 @@ LK main - + Launch program in system tray only. - + Launch program with the tray menu disabled - + Launch program without the main window displayed - + Launch program with the configuration file selected as the default for selected controllers. Defaults to all controllers - + location - + Apply configuration file to a specific controller. Value can be a controller index, name, or GUID - + value - + Unload currently enabled profile(s) - + value(s) - + Start joysticks on a specific set. Value can be a controller index, name, or GUID - + number value - + Launch program as a daemon. Use only on Linux. - + Enable logging - + log-type - + Choose a file for logs writing - + filename - + Choose between using XTest support and uinput support for event generation. Use only if you have enabled xtest and uinput options on Linux or vmulti on Windows. Default: xtest. - + event-generation-type - + Print information about joysticks detected by SDL. Use only if you have sdl library. You can check your controller index, name or even GUID. diff --git a/share/antimicro/translations/antimicro_pl.ts b/share/antimicro/translations/antimicro_pl.ts old mode 100644 new mode 100755 index 4341b2860..869169697 --- a/share/antimicro/translations/antimicro_pl.ts +++ b/share/antimicro/translations/antimicro_pl.ts @@ -4,27 +4,27 @@ AboutDialog - + About O programie - + antimicro antimicro - + Version Wersja - + Credits Przypisy - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -147,17 +147,17 @@ p, li { white-space: pre-wrap; } <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"><br /></p></body></html> - + Info Info - + License Licencja - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -388,17 +388,17 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif';">If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.</span></p></body></html> - + Changelog Dziennik zmian - + About Development O rozwoju - + "juliagoda" (since March, 2018) Wanting only to play my favourite old games that din't support gamepads, I found this project (which map keyboard keys and mouse buttons to connected gamepads on Linux) as most proper and recent. But because of poor choices of such application on the internet and since it didn't compile properly, I decided to rescue the project. However, once I finished my work (enough to enjoy playing games) I thought about sharing this code with others. Of course all informations about past programmers will be held. "Ryochan7" (since December 30, 2012 until 2017), I have been working on antimicro in my spare time. What originally started as a fork of QJoyPad and a way to learn proper event-driven programming has turned into something much bigger than I originally intended. Although I have spent a lot of time learning new techniques, finding out more about the domain of KB+M emulation, and spending Friday nights bashing my head against my keyboard, it has been a fun and enriching experience overall. @@ -429,37 +429,37 @@ Z dniem 24 maja, 2016, projekt został przeniesiony na stronę https://github.co - + Copyright: 2013 - 2018 Prawa autorskie: 2013 - 2018 - + Program Version %1 Wersja programu %1 - + Program Compiled on %1 at %2 Program skompilowany na %1 z pomocą %2 - + Built Against SDL %1 Zbudowane z biblioteką SDL %1 - + Running With SDL %1 Uruchomione z biblioteką SDL %1 - + Using Qt %1 Z użyciem Qt %1 - + Using Event Handler: %1 Z użyciem procedury obsługi zdarzenia: %1 @@ -467,29 +467,29 @@ Z dniem 24 maja, 2016, projekt został przeniesiony na stronę https://github.co AddEditAutoProfileDialog - + Auto Profile Dialog Okno Autoprofilu - + Profile: Profil: - - + + Browse Przeglądaj - + Window: Okno: - - + + Select Window. Click on the appropriate application window and the application file path will be populated in the form. @@ -498,38 +498,47 @@ in the form. rubryki. - + Detect Window Properties Wykryj właściwości okna - + Class: Klasa: - + Title: Tytuł: - + + set partial title + ustaw częściowy tytuł + + + Application: Aplikacja: - + Select Zaznacz - + + De&vices: + Urz&ądzenia: + + Devices: - Urządzenia: + Urządzenia: - - + + Select this profile to be the default loaded for the specified device. The selection will be used instead of the all default profile option. @@ -538,84 +547,84 @@ dla określonego urządzenia. Wybór zostanie użyty zamiast domyślnej opcji. - + Set as Default for Controller Ustaw jako domyślny dla kontrolera - - + + A different profile is already selected as the default for this device. Inny profil jest aktualnie zaznaczony jako domyślny dla tego urządzenia. - + Current (%1) Aktualny (%1) - + Open Config Otwórz konfigurację - - + + Select Program Zaznacz program - + Programs (*.exe) Programy (*.exe) - + Please use the main default profile selection. Zaleca się użycie wyboru głównego domyślnego profilu. - + Please select a window by using the mouse. Press Escape if you want to cancel. Zaznacz okno za pomocą myszki. Wciśnij Escape, jeśli chcesz anulować. - + Capture Application Window Przechwyć okno aplikacji - + Could not obtain information for the selected window. Nie można uzyskać informacji dla zaznaczonego okna. - + Application Capture Failed Przechwytywanie okna zostało zakończone niepowodzeniem - + Profile file path is invalid. Ścieżka profilu jest nieprawidłowa. - + No window matching property was specified. Nie została określona żadna pasująca właściwość dla okna. - + Program path is invalid or not executable. Ścieżka programu jest nieprawidłowa lub nie jest wykonywalna. - + File is not an .exe file. Plik nie jest plikiem .exe. - + No window matching property was selected. Nie została zaznaczona żadna pasująca właściwość dla okna. @@ -623,502 +632,502 @@ zamiast domyślnej opcji. AdvanceButtonDialog - - + + Advanced Zaawansowane - + Assignments Przypisania - + Toggle Przycisk przełączania - + Turbo Przycisk turbo - + Set Selector Wybiesz selektor - + Blank or KB/M Pusty lub KB/M - + Cycle Cykl - + Delay Opóźnienie - + Distance Odległość - + Execute Wywołanie - + Hold Przytrzymanie - + Load Załadowanie - + Mouse Mod Moduł myszki - + Pause Przerwa - + Press Time Przytrzymanie okresowo - + Release Zwolnienie - + Set Change Zmiana ustawienia - + Text Entry Wprowadzenie tekstu - - + + Insert a new blank slot. Dodaj nowy pusty slot. - + Insert Dodaj - + Delete a slot. Usuń slot. - + Delete Usuń - + Clear all currently assigned slots. Wyczyść wszystkie aktualnie przypisane sloty. - + Clear All Wyczyść wszystko - + Placeholder Zastępstwo - + Specify the duration of an inserted Pause or Hold slot. Określ czas trwania wprowadzonego slotu "Przerwa" lub "Przytrzymanie". - + Time: Czas: - + 0.01s 0.01s - + 0m 0m - - + + 0 0 - + 0s 0s - + &Mouse Speed Mod: &Moduł prędkości myszki: - + Set the percentage that mouse speeds will be modified by. Ustaw wartość w procentach, o którą prędkość myszki zostanie zmieniona. - - + + % % - - + + Specify the range past an axis dead zone in which a sequence of actions will execute. Określ przedział martwej strefy dla osi, w którym zostanie wywołana kolejność akcji. - + Distance: Odległość: - + Auto Reset Cycle After Automatycznie resetuj cykl po - + seconds sekundach - - + + Choose Profile Wybierz profil - + Executable: Wykonywalny: - + ... ... - + Arguments: Argumenty: - - - + + + Enabled Odblokowane - + Mode: Tryb: - + <html><head/><body><p>Normal: Repeatedly press and release a button by the chosen rate.</p><p>Gradient: Modify the button press and button release delay based on how far an axis has been moved. The rate will remain the same.</p><p>Pulse: Modify how many times a button is pressed and released per second. The button delay will remain the same.</p></body></html> <html><head/><body><p>Standardowo: Cyklicznie jest wciskany i zwalniany przycisk według wybranej prędkości.</p><p>Gradientowo: Zmienia opóźnienie wciśnięcia przycisku i jego zwolnienie według odległości pokonanej przez oś. Częstotliwość pozostaje niezmieniona.</p><p>Pulsowo: Zmienia częstotliwość naciskania i zwalniania przycisku na sekundę. Opoźnienie przycisku pozostaje niezmienione.</p></body></html> - + Normal Standardowo - + Gradient Gradientowo - + Pulse Pulsowo - + Delay: Opoźnienie: - + 0.10s 0.10s - + Rate: Tempo: - + 10.0/s 10.0/s - - + + Disabled Zablokowany - + Select Set 1 One Way Zaznacz zestawienie 1 jednokierunkowe - + Select Set 1 Two Way Zaznacz zestawienie 1 dwukierunkowe - + Select Set 1 While Held Zaznacz zestawienie 1 podczas trzymania - + Select Set 2 One Way Zaznacz zestawienie 2 jednokierunkowe - + Select Set 2 Two Way Zaznacz zestawienie 2 dwukierunkowe - + Select Set 2 While Held Zaznacz zestawienie 2 podczas trzymania - + Select Set 3 One Way Zaznacz zestawienie 3 jednokierunkowe - + Select Set 3 Two Way Zaznacz zestawienie 3 dwukierunkowe - + Select Set 3 While Held Zaznacz zestawienie 3 podczas trzymania - + Select Set 4 One Way Zaznacz zestawienie 4 jednokierunkowe - + Select Set 4 Two Way Zaznacz zestawienie 4 dwukierunkowe - + Select Set 4 While Held Zaznacz zestawienie 4 podczas trzymania - + Select Set 5 One Way Zaznacz zestawienie 5 jednokierunkowe - + Select Set 5 Two Way Zaznacz zestawienie 5 dwukierunkowe - + Select Set 5 While Held Zaznacz zestawienie 5 podczas trzymania - + Select Set 6 One Way Zaznacz zestawienie 6 jednokierunkowe - + Select Set 6 Two Way Zaznacz zestawienie 6 dwukierunkowe - + Select Set 6 While Held Zaznacz zestawienie 6 podczas trzymania - + Select Set 7 One Way Zaznacz zestawienie 6 jednokierunkowe - + Select Set 7 Two Way Zaznacz zestawienie 7 dwukierunkowe - + Select Set 7 While Held Zaznacz zestawienie 7 podczas trzymania - + Select Set 8 One Way Zaznacz zestawienie 8 jednokierunkowe - + Select Set 8 Two Way Zaznacz zestawienie 8 dwukierunkowe - + Select Set 8 While Held Zaznacz zestawienie 8 podczas trzymania - + sec. sek. - + /sec. /sek. - + Set %1 Zestawienie %1 - - + + Select Set %1 Wybierz zestawienie %1 - + One Way Jednokierunkowo - + Two Way Dwukierunkowo - + While Held Podczas trzymania - + Config Files (*.amgp *.xml) Pliki konfiguracyjne (*.amgp *.xml) - + Choose Executable Wybierz plik wykonywalny - + Slots past a Cycle action will be executed on the next button press. Multiple cycles can be added in order to create partitions in a sequence. Sloty za cyklem zostaną wywołane przy kolejnym naciśnięciu przycisku. Wielokrotne cykle mogą być dodane w kolejności, by tworzyć podziały w sekwencji. - + Delays the time that the next slot is activated by the time specified. Slots activated before the delay will remain active after the delay time has passed. Opóźnia czas trwania wywołania następnego slotu według określonego czasu. Sloty aktywowane przed wystąpieniem opóźnienia pozostaną aktywne po przeminięciu określonego czasu dla opóźnienia. - + Distance action specifies that the slots afterwards will only be executed when an axis is moved a certain range past the designated dead zone. Akcja odległości określa wywoływanie slotów, gdy oś jest przesuwana w określonym przedziale za wyznaczoną martwą strefą. - + Insert a hold action. Slots after the action will only be executed if the button is held past the interval specified. Wprowadź akcję przytrzymania. Sloty po tej akcji zostaną wywołane, jeśli przycisk ten został trzymany przez określoną umowną ilość czasu. - + Chose a profile to load when this slot is activated. Wybierz profil do załadowywania gdy slot jest aktywny. - + Mouse mod action will modify all mouse speed settings by a specified percentage while the action is being processed. This can be useful for slowing down the mouse while sniping. Akcja modułu myszki zmieni wszystkie ustawienia prędkości myszki według określonej liczby procentowej, podczas gdy wykonywana jest akcja. Opcja ta moze być użyteczna dla zwolnienia prędkosci myszki podczas strzelania. - + Insert a pause that occurs in between key presses. Dodaj przerwę, która występuje pomiędzy naciskanymi klawiszami. - + Specify the time that keys past this slot should be held down. Określ czas, przez który klawisze z tego slotu powinny być przytrzymywane. - + Insert a release action. Slots after the action will only be executed after a button release if the button was held past the interval specified. Wprowadź akcję zwalniania. Sloty po tej akcji zostaną wywołane po zwolnieniu przycisku, jeśli przycisk ten został trzymany przez określoną umowną ilość czasu. - + Change to selected set once slot is activated. Zmień zaznaczone zestawienie gdy slot jest aktywowany. - + Full string will be typed when a slot is activated. Pełna treść zostania wpisana gdy slot zostanie aktywowany. - + Execute program when slot is activated. Wykonaj program gdy slot jest aktywny. @@ -1126,157 +1135,157 @@ zamiast domyślnej opcji. AdvanceStickAssignmentDialog - + Stick/Pad Assignment Przypisanie do Joysticka/Gamepada - + Sticks Joysticki - + DPads Pady kierunkowe - + Note: This window is meant for backwards compatibility with profiles made before antimicro 2.0. Since version 2.0, use of the Game Controller Mapping window is preferred. Adnotacja: To okno zostało zachowane z myślą o kompatybilności wstecznej z profilami stworzonymi w wersji antimicro starszej niż 2.0. Rekomendowane jednak jest używanie nowszej wersji okna do mapowania kontrolera. - - + + %1 (Joystick %2) %1 (Joystick %2) - + Stick 1 Joystick 1 - - - + + + Enabled Odblokowany - - - - - - + + + + + + Assign Przypisz - - + + X Axis: Oś X: - - + + Y Axis: Oś Y: - + Stick 2 Joystick 2 - + Number of Physical DPads: %1 Liczba fizycznych padów kierunkowych: %1 - + Virtual DPad 1 Wirtualny pad kierunkowy 1 - + Down: Dół: - + Left: Lewo: - + Right: Prawo: - + Up: Góra: - - - - + + + + Axis %1 Oś %1 - - - - + + + + Axis %1 - Oś %1 - - - - - + + + + Axis %1 + Oś %1 + - - - - + + + + Button %1 Przycisk %1 - + Move stick 1 along the X axis Porusz gałką 1 wzdłuż osi X - + Move stick 1 along the Y axis Porusz gałką 1 wzdłuż osi Y - + Move stick 2 along the X axis Porusz gałką 2 wzdłuż osi X - + Move stick 2 along the Y axis Porusz gałką 2 wzdłuż osi Y - - - - + + + + Press a button or move an axis Wciśnij przycisk lub porusz gałką wzdłuż osi @@ -1284,181 +1293,181 @@ zamiast domyślnej opcji. AxisEditDialog - + Axis - + Presets: Predefinicje: - - + + Mouse (Horizontal) Mysz (poziomo) - - + + Mouse (Inverted Horizontal) Mysz (w odwróconym poziomie) - - + + Mouse (Vertical) Mysz (pionowo) - - + + Mouse (Inverted Vertical) Mysz (w odwróconym pionie) - - + + Arrows: Up | Down Strzałki: Góra | Dół - - + + Arrows: Left | Right Strzałki: Lewo | Prawo - - + + Keys: W | S Klawisze: W | S - - + + Keys: A | D Klawisze: A | D - - + + NumPad: KP_8 | KP_2 Klawisze num: KP_8 | KP_2 - - + + NumPad: KP_4 | KP_6 Klawisze num: KP_4 | KP_6 - - - + + + None Brak - - + + Set the value to use as the limit for an axis. Useful for a worn out analog stick. Ustaw wartość limitu dla osi. Opcja jest przydatna dla zużytej gałki analogowej. - + Dead Zone: Martwa strefa: - - + + Set the value of the dead zone for an axis. Ustaw wartość martwej strefy dla osi. - + Max Zone: Maksymalna strefa: - - + + [NO KEY] [BRAK] - + Throttle setting that determines the behavior of how to interpret an axis hold or release. Ustawienia przepustnicy, które determinują zachowanie sposobu interpretacji trzymania osi i jej zwalniania. - + Negative Half Throttle Ujemny zakres ruchu osi do połowy - + Negative Throttle Ujemny zakres ruchu osi - + Normal Standardowy - + Positive Throttle Dodatni zakres ruchu osi - + Positive Half Throttle Dodatni zakres ruchu osi do połowy - + Current Value: Aktualna wartość: - + Name: Nazwa: - + Specify the name of an axis. Określ nazwę osi. - + Mouse Settings Ustawienia myszki - + Set Ustaw - + Set %1 Zestawienie %1 - + Left Mouse Button Lewy przycisk myszy - + Right Mouse Button Prawy przycisk myszy @@ -1466,124 +1475,124 @@ sposobu interpretacji trzymania osi i jej zwalniania. ButtonEditDialog - + Dialog Okno dialogowe - + To make a new assignment, press any keyboard key or click a button in the Keyboard or Mouse tab Wciśnij dowolny klawisz lub kliknij na przycisk myszy, by stworzyć nowe przypisanie - + Placeholder Zastępstwo - + Enables a key press or release to only occur when a controller button is pressed. Odblokowuje naciśnięcie klawisza lub zwolnienie go, gdy przycisk kontrolera jest wciśnięty. - + Toggle Przycisk przełączania - + Enables rapid key presses and releases. Turbo controller. Odblokowuje szybsze naciskanie klawiszy i ch zwalnianie. Kontroler turbo. - + Turbo Przycisk turbo - + Last keyboard/mouse button: Ostatni przycisk klawiatury/myszy: - + Slots Sloty - + Na&me: Naz&wa: - + Specify the name of a button. Określ nazwę przycisku. - + Action: Akcja: - + Specify the action that will be performed in game while this button is being used. Określ akcję, która będzie się wykonywała w grze, podczas gdy przycisk jest wciśnięty. - + Advanced Zaawansowany - - - + + + Choose your keyboard key Naciśnij dowolny klawisz - + No button Brak przycisku - - - - + + + + Last button Ostatni przycisk - + To change settings for last button, it must be at least one assignment from keyboard to gamepad Musi istnieć co najmniej jedno przypisanie z klawiatury do gamepad'a, by zmienić ustawienia dla ostatniego przycisku - + To change settings of turbo for last button, it must be at least one assignment from keyboard to gamepad Musi istnieć co najmniej jedno przypisanie z klawiatury do gamepad'a, by zmienić ustawienia turbo dla ostatniego przycisku - + To open advanced dialog, it's needed to map at least one button from keyboard to gamepad Potrzebne jest co najmniej jedno mapowanie z klawiatury do gamepad'a, by móc otworzyć okno z zaawansowanymi ustawieniami - + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad Sloty dla wprowadzonych przycisków nie mogły zostać usunięte, ponieważ żadne dane nie zostały dotychczas wprowadzone z układu klawiatury do układu gamepad'a. Stwórz mapowanie co najmniej jednego przycisku dla gamepad'a - + As last gamepad button has been set Został ustawiony ostatni przycisk gamepad'a - + Index %1 Indeks %1 @@ -1591,65 +1600,68 @@ gdy przycisk jest wciśnięty. Calibration - + Form Okno - - + + Start calibration Rozpocznij kalibrację - + Controller: Kontroler: - + Sticks: Joysticki: - Use settings from jstest-gtk - Zastosuj ustawienia z jstest-gtk + Zastosuj ustawienia z jstest-gtk - + Reset settings Resetuj ustawienia - + Cancel Anuluj - - + + Save Zapisz - - + + Calibration Kalibracja - Do you really want to reset settings of current axes? - Czy chcesz zresetować ustawienia aktualnych osi? + Czy chcesz zresetować ustawienia aktualnych osi? + + + + Do you really want to reset settings of current axis? + Czy na pewno chcesz zresetować ustawienia dla aktualnych osi? - + Calibration was saved for the preset. Do you really want to reset settings? Wartości kalibracji były zapisywane dla przycisku. Czy aby napewno zresetować ustawienia? - + Place the joystick in the center position. It's the part, where often you don't have to move. Just skip it in such situation. @@ -1658,17 +1670,17 @@ It's the part, where often you don't have to move. Just skip it in suc To jest ta część, gdzie często nie ma potrzeby ruszania osią. W takiej sytuacji wystarczy jedynie przejść do następnego kroku. - + Calibrating center Kalibrowanie środka - + Start second step Rozpocznij drugi krok - + Center X: %1 @@ -1677,28 +1689,28 @@ Center X: %1 Środek X: %1 - + Center Y: %1 Środek Y: %1 - + Place the joystick in the top-left corner many times Nakieruj oś w stronę górnego lewego rogu wiele razy - - + + Calibrating position Kalibrowanie pozycji - - + + X: %1 @@ -1707,27 +1719,27 @@ X: %1 X: %1 - - + + Y: %1 Y: %1 - + Place the joystick in the bottom-right corner Nakieruj oś w stronę dolnego prawego rogu - + Start final step Rozpocznij ostatni krok - + range X: %1 - %2 @@ -1736,14 +1748,14 @@ range X: %1 - %2 przedział dla X: %1 - %2 - + range Y: %1 - %2 przedział dla Y: %1 - %2 - + deadzone X: %1 @@ -1752,14 +1764,14 @@ deadzone X: %1 martwa strefa X: %1 - + deadzone Y: %1 martwa strefa Y: %1 - + ---Calibration done!--- @@ -1768,31 +1780,44 @@ martwa strefa Y: %1 - + Calibration values have been saved Wartości kalibracji zostały zapisane - - + + Dead zone calibration kalibracja martwej strefy - + + You have to move axes to the top-left corner at least five times. + Nakieruj oś w lewy górny róg co najmniej pięć razy. + + + + You have to move axes to the bottom-right corner at least five times. + Nakieruj oś w prawy dolny róg co najmniej pięć razy. + + + + Do you want to save calibration of current axis? + Czy chcesz zapisać zmiany dla aktualnych osi? + + You must move X axis to the right at least five times! Keep moving! - Nakieruj oś X w prawą stronę co najmniej pięć razy! + Nakieruj oś X w prawą stronę co najmniej pięć razy! - You must move X axis to the left at least five times! Keep moving! - Nakieruj oś X w lewą stronę co najmniej pięć razy! + Nakieruj oś X w lewą stronę co najmniej pięć razy! - - - - + + + + Axis %1 Oś %1 @@ -1800,64 +1825,64 @@ martwa strefa Y: %1 CapturedWindowInfoDialog - + Captured Window Properties Uchwycone właściwości okna - + Information About Window Informacje o oknie - + Class: Klasa: - - - + + + TextLabel Etykieta - + Title: Tytuł: - + Path: Ścieżka: - + Match By Properties Dopasowanie według właściwości - + Class Klasa - + Title Tytuł - + Path Ścieżka - + Full Path Pełna ścieżka - + File Name Nazwa pliku @@ -1865,67 +1890,67 @@ martwa strefa Y: %1 DPadContextMenu - + Mouse (Normal) Mysz (standardowo) - + Mouse (Inverted Horizontal) Mysz (w odwróconym poziomie) - + Mouse (Inverted Vertical) Mysz (w odwróconym pionie) - + Mouse (Inverted Horizontal + Vertical) Mysz (w odwróconym poziomie + pionie) - + Arrows Strzałki - + Keys: W | A | S | D Klawisze: W | A | S | D - + NumPad Klawisze numeryczne - + None Brak - + Standard Standard - + Eight Way Ośmioosiowo - + 4 Way Cardinal w 4 głównych kierunkach - + 4 Way Diagonal w 4 głównych przekątnych - + Mouse Settings Ustawienia myszki @@ -1933,62 +1958,62 @@ martwa strefa Y: %1 DPadEditDialog - + Dialog Okno dialogowe - + Presets: Predefinicje: - + Mouse (Normal) Mysz (standardowo) - + Mouse (Inverted Horizontal) Mysz (w odwróconym poziomie) - + Mouse (Inverted Vertical) Mysz (w odwróconym pionie) - + Mouse (Inverted Horizontal + Vertical) Mysz (w odwróconym poziomie + pionie) - + Arrows Strzałki - + Keys: W | A | S | D Klawisze: W | A | S | D - + NumPad Klawiatura numeryczna - + None Brak - + Dpad Mode: Tryb pada kierunkowego: - + Standard: 8 region dpad with two direction buttons active when the dpad is in a diagonal region. @@ -2017,63 +2042,63 @@ W 4 głównych przekątnych: Czterokierunkowy analog z kierunkami odwołującymi się do stref przekątnych analogu. - + Standard Standardowo - + Eight Way Ośmioosiowo - + 4 Way Cardinal W 4 głównych kierunkach - + 4 Way Diagonal W 4 głównych przekątnych - + DPad Delay: Opóźnienie pada kierunkowego: - - + + Time lapsed before a direction change is taken into effect. Czas, który upłynął przed wykryciem zmiany kierunku. - + s s - + &Name: &Nazwa: - + Specify the name of a dpad. Określ nazwę pada kierunkowego. - + Mouse Settings Ustawienia myszki - + Set Ustaw - + Set %1 Zestawienie %1 @@ -2081,27 +2106,27 @@ odwołującymi się do stref przekątnych analogu. EditAllDefaultAutoProfileDialog - + Default Profile Domyślny profil - + Profile: Profil: - + Browse Przeglądaj - + Open Config Otwórz konfigurację - + Profile file path is invalid. Ścieżka dla plik jest nieprawidłowa. @@ -2109,29 +2134,29 @@ odwołującymi się do stref przekątnych analogu. ExtraProfileSettingsDialog - + Extra Profile Settings Dodatkowe ustawienia profilu - + Key Press Time: Czas wciśniętego klawisza: - + 0.00 ms 0.00 ms - + Profile Name: Nazwa profilu: - - - + + + s s @@ -2139,7 +2164,7 @@ odwołującymi się do stref przekątnych analogu. GameController - + Game Controller Kontroler @@ -2147,9 +2172,9 @@ odwołującymi się do stref przekątnych analogu. GameControllerDPad - - - + + + DPad Pad kierunkowy @@ -2157,187 +2182,187 @@ odwołującymi się do stref przekątnych analogu. GameControllerMappingDialog - + Game Controller Mapping Mapowanie kontrolera - + <html><head/><body><p>antimicro makes use of the <a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;">Game Controller API</span></a> provided by SDL 2 in order to abstract various gamepads to fit a unified standard. In order to make a button assignment, please highlight the mapping cell for the appropriate button row below. You can then press a button or move an axis on your gamepad and the cell will update with the physical button or axis that will be used.</p><p>antimicro will use the mapping that you specify to save a mapping string that will be loaded into SDL.</p></body></html> <html><head/><body><p>antimicro używa dla działania tego <a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;"> interfejsu kontrolerów gier</span></a> świadczonego przez bibliotekę SDL 2 w celu dopasowania przeróżnych gamepad'ów do jednolitego stworzonego standardu. Podświetl komórkę tabelki dla odpowiedniego przycisku, aby go przypisać. Możesz nacisnąć przycisk lub poruszyć osią na gamepad'zie, a wtedy w wybranej komórce zaktualizują się informacje według wciśniętego przycisku lub poruszonej osi. Pamiętaj, że narzucając wykrycie osi, musisz poruszyć nią w dół lub w prawo, gdyż pod nimi kryją się wartości dodatnie. </p><p>antimicro użyje mapowania, które określisz podczas zapisywania mapowania tekstowego w postaci odczytywanej przez bibliotekę SDL.</p></body></html> - + A A - + B B - + X X - + Y Y - + Back Back - + Start Start - + Guide Guide - + Left Shoulder Left Shoulder - + Right Shoulder Right Shoulder - + Left Stick Click Left Stick Click - + Right Stick Click Right Stick Click - + Left Stick X Left Stick X - + Left Stick Y Left Stick Y - + Right Stick X Right Stick X - + Right Stick Y Right Stick Y - + Left Trigger Left Trigger - + Right Trigger Right Trigger - + DPad Up DPad Up - + DPad Left DPad Left - + DPad Down DPad Down - + DPad Right DPad Right - + Mapping Mapowanie - + SDL 2 Game Controller Mapping String Treść mapowania kontrolera według SDL 2 - + Last Axis Event: Ostatnie zdarzenie dla osi: - + Current Axis Detection Dead Zone: Aktualna martwa strefa podczas wykrywania ruchu osią: - + 5000 5000 - + 10000 10000 - + 15000 15000 - + 20000 20000 - + 25000 25000 - + 30000 30000 - + 32000 32000 - + Game Controller Mapping (%1) (#%2) Mapowanie kontrolera (%1) (#%2) - + Discard Controller Mapping? Usunąć mapowanie kontrolera? - + Discard mapping for this controller? If discarded, the controller will be reverted to a joystick once you refresh all joysticks. @@ -2349,47 +2374,47 @@ Jeśli zostanie usunięte, kontroler zostanie przywrócony do joysticka, gdy tyl GameControllerSet - + Back Back - + Guide Guide - + Start Start - + LS Click LS Click - + RS Click RS Click - + L Shoulder L Shoulder - + R Shoulder R Shoulder - + L Trigger L Trigger - + R Trigger R Trigger @@ -2397,9 +2422,9 @@ Jeśli zostanie usunięte, kontroler zostanie przywrócony do joysticka, gdy tyl GameControllerTrigger - - - + + + Trigger Przyciski Trigger @@ -2407,9 +2432,9 @@ Jeśli zostanie usunięte, kontroler zostanie przywrócony do joysticka, gdy tyl JoyAxis - - - + + + Axis @@ -2417,24 +2442,24 @@ Jeśli zostanie usunięte, kontroler zostanie przywrócony do joysticka, gdy tyl JoyAxisButton - - - + + + Button Przycisk - + Negative Ujemny - + Positive Dodatni - + Unknown Nieznany @@ -2442,74 +2467,74 @@ Jeśli zostanie usunięte, kontroler zostanie przywrócony do joysticka, gdy tyl JoyAxisContextMenu - + Mouse (Horizontal) Mysz (poziomo) - + Mouse (Inverted Horizontal) Mysz (w odwróconym poziomie) - + Mouse (Vertical) Mysz (pionowo) - + Mouse (Inverted Vertical) Mysz (w odwróconym pionie) - + Arrows: Up | Down Strzałki: Góra | Dół - + Arrows: Left | Right Strzałki: Lewo | Prawo - + Keys: W | S Klawisze: W | S - + Keys: A | D Klawisze: A | D - + NumPad: KP_8 | KP_2 Klawiatura num: KP_8 | KP_2 - + NumPad: KP_4 | KP_6 Klawiatura num: KP_4 | KP_6 - - + + None Brak - - + + Mouse Settings Ustawienia myszki - + Left Mouse Button Lewy przycisk myszy - + Right Mouse Button Prawy przycisk myszy @@ -2517,57 +2542,57 @@ Jeśli zostanie usunięte, kontroler zostanie przywrócony do joysticka, gdy tyl JoyButton - + Processing turbo for #%1 - %2 Przetwarzanie trybu turbo dla #%1 - %2 - + Finishing turbo for button #%1 - %2 Finalizacja trybu turbo dla przycisku #%1 - %2 - + Processing press for button #%1 - %2 Przetwarzanie naciśnięcia dla przycisku #%1 - %2 - + Processing release for button #%1 - %2 Przetwarzanie zwalniania dla przycisku #%1 - %2 - + Distance change for button #%1 - %2 Zmiana odległości dla przycisku #%1 - %2 - - - + + + Button Przycisk - - - - + + + + [NO KEY] [BRAK] - + [Set %1 1W] [Zestawienie %1 1W] - + [Set %1 2W] [Zestawienie %1 2W] - + [Set %1 WH] [Zestawienie %1 WH] @@ -2575,47 +2600,47 @@ Jeśli zostanie usunięte, kontroler zostanie przywrócony do joysticka, gdy tyl JoyButtonContextMenu - + Toggle Przycisk przełączania - + Turbo Przycisk turbo - + Clear Wyczyść - + Set Select Wybór ustawienia - + Disabled Zablokowane - + Set %1 Zestawienie %1 - + Set %1 1W Zestawienie %1 1W - + Set %1 2W Zestawienie %1 2W - + Set %1 WH Zestawienie %1 WH @@ -2623,118 +2648,118 @@ Jeśli zostanie usunięte, kontroler zostanie przywrócony do joysticka, gdy tyl JoyButtonSlot - - + + Mouse Mysz - + Up Góra - + Down Dół - + Left Lewo - + Right Prawo - + LB LB - + MB MB - + RB RB - + B4 B4 - + B5 B5 - + Pause Przerwa - + Hold Przytrzymanie - + Cycle Cykl - + Distance Odległość - + Release Zwolnienie - + Mouse Mod Tryb myszki - + Press Time Przytrzymanie okresowo - + Delay Opóźnienie - + Load %1 Załadowanie %1 - + Set Change %1 Zmiana ustawienia %1 - + [Text] %1 [Text] %1 - + [Exec] %1 [Exec] %1 - + [NO KEY] [BRAK] @@ -2742,9 +2767,9 @@ Jeśli zostanie usunięte, kontroler zostanie przywrócony do joysticka, gdy tyl JoyControlStick - - - + + + Stick Joystick analogowy @@ -2752,37 +2777,37 @@ Jeśli zostanie usunięte, kontroler zostanie przywrócony do joysticka, gdy tyl JoyControlStickButton - - - + + + Up Góra - - - + + + Down Dół - - - + + + Left Lewo - - - + + + Right Prawo - - - + + + Button Przycisk @@ -2790,67 +2815,67 @@ Jeśli zostanie usunięte, kontroler zostanie przywrócony do joysticka, gdy tyl JoyControlStickContextMenu - + Mouse (Normal) Mysz (standardowo) - + Mouse (Inverted Horizontal) Mysz (w odwróconym poziomie) - + Mouse (Inverted Vertical) Mysz (w odwróconym pionie) - + Mouse (Inverted Horizontal + Vertical) Mysz (w odwróconym poziomie + pionie) - + Arrows Strzałki - + Keys: W | A | S | D Klawisze: W | A | S | D - + NumPad Klawisze numeryczne - + None Brak - + Standard Standard - + Eight Way Ośmioosiowo - + 4 Way Cardinal w 4 głównych kierunkach - + 4 Way Diagonal w 4 głównych przekątnych - + Mouse Settings Ustawienia myszki @@ -2858,96 +2883,96 @@ Jeśli zostanie usunięte, kontroler zostanie przywrócony do joysticka, gdy tyl JoyControlStickEditDialog - + Dialog Okno dialogowe - + X: X: - - - - - + + + + + 0 0 - + Y: Y: - + Distance: Odległość: - + Bearing: Łożysko: - + % Safe Zone: % strefa bezpieczna: - + Presets: Predefinicje: - + Mouse (Normal) Mysz (standardowo) - + Mouse (Inverted Horizontal) Mysz (w odwróconym poziomie) - + Mouse (Inverted Vertical) Mysz (w odwróconym pionie) - + Mouse (Inverted Horizontal + Vertical) Mysz (w odwróconym poziomie + pionie) - + Arrows Strzałki - + Keys: W | A | S | D Klawisze: W | A | S | D - + NumPad Klawisze numeryczne - + None Brak - + Stick Mode: Tryb joysticka analogowego: - + Standard: 8 region stick with two direction buttons active when the stick is in a diagonal region. @@ -2976,98 +3001,98 @@ W 4 głównych przekątnych: Czterokierunkowy analog z kierunkami odwołującymi się do stref przekątnych analogu. - + Standard Standardowo - + Eight Way Ośmioosiowo - + 4 Way Cardinal W 4 głównych kierunkach - + 4 Way Diagonal W 4 głównych przekątnych - + Dead Zone: Martwa strefa: - - + + Dead zone value to use for an analog stick. Wartość martwej strefy dla zastosowania w joysticku analogowym. - + Max Zone: Maksymalna strefa: - - + + Value when an analog stick is considered moved 100%. Wartość określająca analog, którego kursor przekroczył 100%. - + Diagonal Range: Zakres przekątnej: - - + + The area (in degrees) that each diagonal region occupies. Powierzchnia (w stopniach), która zajmuje każdy przekątny kierunek. - + Square Stick: Czterokierunkowy analog: - - + + Percentage to modify a square stick coordinates to confine values to a circle Zmiana współrzędnych czterokierunkowego analogu dla ograniczenia wartości do koła, określona w procentach - + % % - + Stick Delay: Opóźnienie drążka: - - + + Time lapsed before a direction change is taken into effect. Czas, który upłynął przed wykryciem zmiany kierunku. - + s s - + Modifier: Modyfikator: - + Edit button that is active while the stick is active. This button is useful for assigning zones with @@ -3080,33 +3105,33 @@ klawiszami modyfikatora, które mogą być użyte do przypisania funkcji chodzenia/biegania do drążka analogowego. - + PushButton Przycisk - + Na&me: Name: Na&zwa: - + Specify the name of an analog stick. Określ nazwę joysticka analogowego. - + Mouse Settings Ustawienia myszki - + Set Ustaw - + Set %1 Zestawienie %1 @@ -3114,9 +3139,9 @@ przypisania funkcji chodzenia/biegania do drążka analogowego. JoyControlStickModifierButton - - - + + + Modifier Modyfikator @@ -3124,9 +3149,9 @@ przypisania funkcji chodzenia/biegania do drążka analogowego. JoyDPad - - - + + + DPad Pad kierunkowy @@ -3134,37 +3159,37 @@ przypisania funkcji chodzenia/biegania do drążka analogowego. JoyDPadButton - - - + + + Up Góra - - - + + + Down Dół - - - + + + Left Lewo - - - + + + Right Prawo - - - + + + Button Przycisk @@ -3172,243 +3197,248 @@ przypisania funkcji chodzenia/biegania do drążka analogowego. JoyTabWidget - - - - - - + + + + + + <New> <Nowy> - - + + Remove Usuń - - + + Remove configuration from recent list. Usuń konfigurację z ostatniej listy. - - + + Load Załaduj - - + + Load configuration file. Załaduj plik konfiguracyjny. - - + + Save Zapisz - - + + Save changes to configuration file. Zapisz zmiany do pliku konfiguracyjnego. - - + + Save As Zapisz jako - - + + Save changes to a new configuration file. Zapisz zmiany do nowego pliku konfiguracyjnego. - - + + Sets Zestawienia - + Copy from Set Kopiuj z zestawienia - + Settings Ustawienia - - + + Set 1 Zestawienie 1 - - + + Set 2 Zestawienie 2 - - + + Set 3 Zestawienie 3 - - + + Set 4 Zestawienie 4 - - + + Set 5 Zestawienie 5 - - + + Set 6 Zestawienie 6 - - + + Set 7 Zestawienie 7 - - + + Set 8 Zestawienie 8 - - + + Stick/Pad Assign Przypisywanie do Joysticka/Gamepada - - + + Controller Mapping Mapowanie kontrolera - - + + Quick Set Szybkie ustawienie - - + + Names Nazwy - - + + Toggle button name displaying. Przełącz wyświetlanie nazwy przycisku. - - + + Pref Pref - - + + Change global profile settings. Zmień globalne ustawienia dla profilu. - - - + + + Reset Reset - - + + Revert changes to the configuration. Reload configuration file. Przwróć zmiany w konfiguracji. Przeładuj plik konfiguracyjny. - + Open Config Otwórz konfigurację - + Config Files (*.amgp *.xml) Pliki konfiguracyjne (*.amgp *.xml) - - - + + + Save Config Zapisz konfigurację - - - + + + Config File (*.%1.amgp) Plik konfiguracyjny (*.%1.amgp) - - + + Do you really want to reset buttons settings for joystick? + Czy na pewno chcesz zresetować ustawienia dla przycisków joystick'a? + + + + Set Ustaw - - + + Save Profile Changes? Zapisać zmiany dla profilu? - - + + Changes to the new profile have not been saved. Would you like to save or discard the current profile? Zmiany dla nowego profilu nie zostały zapisane. Czy chcesz, aby aktualny profil został zapisany lub usunięty? - - + + Changes to the profile "%1" have not been saved. Would you like to save or discard changes to the current profile? Zmiany dla profilu "%1" nie zostały zapisane. Czy chcesz, aby zmiany dla aktualnego profilu zostały zapisane lub usunięte? - + Sticks Joysticki analogowe - - + + DPads Pady kierunkowe - + No buttons have been assigned. Please use Quick Set to assign keys to buttons or disable hiding empty buttons. Nie wykryto żadnych przypisywanych przycisków. @@ -3416,24 +3446,24 @@ Użyj okna szybkiego ustawiania, by przypisać znaki klawiszy do przycisków lub zablokuj ukrywanie pustych przycisków. - - + + Set %1: %2 Zestawienie %1: %2 - - + + Set %1 Zestawienie %1 - + Copy Set Assignments Skopiuj zestawienie przypisań - + Are you sure you want to copy the assignments and device properties from %1? Czy na pewno chcesz skopiować przypisania i właściwości urządzenia z %1? @@ -3441,7 +3471,7 @@ do przycisków lub zablokuj ukrywanie pustych przycisków. Joystick - + Joystick Joystick @@ -3449,98 +3479,98 @@ do przycisków lub zablokuj ukrywanie pustych przycisków. JoystickStatusWindow - + Properties Właściwości - + Details Szczegóły - + Name: Nazwa: - - - - - - - + + + + + + + %1 %1 - + Number: Numer: - + Axes: Osie: - + Buttons: Przyciski: - + Hats: Przyciski POV: - + GUID: GUID: - + Game Controller: Kontroler: - + Axes Osie - + Buttons Przyciski - + Hats Przyciski POV - + %1 (#%2) Properties %1 (#%2) Właściwości - + Axis %1 Oś %1 - + Hat %1 Przycisk POV %1 - + No Nie - + Yes Tak @@ -3548,67 +3578,71 @@ do przycisków lub zablokuj ukrywanie pustych przycisków. MainSettingsDialog - + Edit Settings Zmień ustawienia - + General Ogólnie - + Controller Mappings Mapowania kontrolera - + Language Język - + Auto Profile Profil automatyczny - + Mouse Mysz - + Advanced Zaawansowany - Profi&le Directory: + Ścieżka profi&lu: + + + + Profile Direc&tory: Ścieżka profi&lu: - + <html><head/><body><p>Specify the default directory that the program should use in file dialogs when loading a profile or saving a new profile.</p></body></html> <html><head/><body><p>Określ domyślną ścieżkę, aby program mógł go użyć w innych oknach podczas ładowania profilu lub zapisywania nowego.</p></body></html> - + Recent Profile Count: Liczba ostatnich profili: - + <html><head/><body><p>Number of profiles that can be placed in recent profile list. 0 will result in the program not enforcing a limit on the number of profiles displayed.</p></body></html> <html><head/><body><p>Liczba profili, które mogą być umieszczone na liście ostatnich profili. 0 będzie skutkowało tym, że limit dla liczby wyświetlanych profili nie będzie w ogóle narzucany.</p></body></html> - + Gamepad Poll Rate: Szybkość wysyłania sygnałów gamepada: - + Change the poll rate that the program uses to discover new events from gamepads. Defaults to 10 ms. @@ -3623,29 +3657,29 @@ zużycie mocy procesora. Wysoce rekomendowane jest przeprowadzenie testów ustawień przed użyciem antimicro. - + Hide main window when the main window close button is clicked instead of quitting the program. Ukryj główne okno, a nie zamykaj, gdy wybierany jest przycisk zamykania okna. - + Close To Tray Zamknij w tacce systemowej - + Have Windows start antimicro at system startup. Uruchom antimicro przy uruchomieniu systemu. - + Launch At Windows Startup Uruchom przy starcie Windows - + Display recent profiles for all controllers as a single list in the tray menu. Defaults to using sub-menus. @@ -3655,12 +3689,12 @@ menu zasobnika systemowego. Domyślnie dla użycia podmenu. - + Single Profile List in Tray Pojedyncza lista profilu w tacce systemowej - + Have the program minimize to the taskbar. By default, the program minimizes to the system tray if available. @@ -3669,12 +3703,12 @@ Domyślnie program jest minimalizowany do tacki systemowej jeśli jest to możliwe. - + Minimize to Taskbar Zminimalizuj do paska zadań - + This option will cause the program to hide all buttons that have no slots assigned to them. The Quick Set dialog window will have to be used @@ -3686,12 +3720,12 @@ ustawiania, by pojawiło się okno edytowania dla przycisków gamepada. - + Hide Empty Buttons Ukryj puste przyciski - + When the program is launched, open the last known profile that was opened during the previous session. @@ -3700,86 +3734,86 @@ znany profil, który był otwierany podczas poprzedniej sesji. - + Auto Load Last Opened Profile Automatycznie ładuj ostatni otwarty profil - + Only show the system tray icon when the program first launches. Pokazuj jedynie ikonę w tacce systemowej, gdy program się uruchamia. - + Launch in Tray Uruchom w tacce systemowej - + Associate .amgp files with antimicro in Windows Explorer. Skojarz pliki .amgp z antimicro w eksploratorze Windows. - + Associate Profiles Skojarz profile - + Key Repeat Powtarzanie klawisza - + Active keys will be repeatedly pressed when this option is enabled. Aktywne klawisze będą wielokrotnie naciskane gdy ta opcja zostanie zaznaczona. - - + + Enable Odblokuj - + Delay: Opóźnienie: - + Specifies how much time should elapse before key repeating begins. Określa, ile czasu musi upłynąć, zanim nastąpi powtarzanie przycisku klawisza. - + ms ms - + Rate: Tempo: - + Specifies how many times key presses will be performed per seconds. Określa, ile razy na sekundę klawisz będzie naciskany automatycznie. - + times/s raz/y - + Below is a list of the custom mappings that have been saved. You can use the following table to delete mappings or have mappings temporarily disabled. You can also disable mappings that are included with SDL; just insert a new row with the appropriate joystick GUID and check disable. Settings will not take affect until you either refresh all joysticks or unplug that particular joystick. @@ -3788,161 +3822,161 @@ Settings will not take affect until you either refresh all joysticks or unplug t Ustawienia nie będą miały wpływu o ile nie zostaną odświeżone wszystkie joysticki lub nie zostanie odpięty konkretny joystick. - + GUID GUID - + Mapping String Mapowanie tekstowe - + Disable? Zablokować? - - + + Delete Usuń - + Insert Dodaj - + <html><head/><body><p>antimicro has been translated into many different languages by contributors. By default, the program will choose an appropriate translation based on your system's locale setting. However, you can make antimicro load a different translation depending on the language that you choose from the list below.</p></body></html> <html><head/><body><p>antimicro został przetłumaczony na wiele innych języków przez kilku woluntariuszy. Domyślnie program wybierze odpowiednie tłumaczenie oparte na ustawieniach lokalnych systemu. Jednakże możliwy jest wybór innego języka, który znajduje się na liście poniżej.</p></body></html> - - + + Default Domyślny - + Português do Brasil Português do Brasil - + English English - + Français Français - + Deutsch Deutsch - + Italiano Italiano - + 日本語 日本語 - + Русский Русский - + српски / srpski српски / srpski - + 简体中文 简体中文 - + Español Español - + українська українська - + Polski Polski - - + + Active Aktywny - + Devices: Urządzenia: - - + + All Wszystko - + Device Urządzenie - + Profile Profil - + Class Klasa - + Title Tytuł - + Program Program - + Default? Domyślnie? - + Add Dodaj - + Edit Edytuj - + Disable the "Enhanced Pointer Precision" Windows setting while antimicro is running. Disabling "Enhanced Pointer Precision" will allow mouse movement within antimicro to be more @@ -3953,32 +3987,41 @@ gdy antimicro jest uruchomiony. Zablokowanie opcji ruch myszki wewnątrz antimicro. - + Disable Enhance Pointer Precision Zablokuj rozszerzoną precyzję myszki - + Smoothing Wygładzanie - - Histor&y Size: + + History Si&ze: Rozmia&r historii: - + + Reset + Reset + + + Histor&y Size: + Rozmia&r historii: + + + Weight &Modifier: Modyfikator &wagi: - + Refresh Rate: Częstotliwość odświeżania: - + The refresh rate is the amount of time that will elapse in between mouse events. Please be cautious when editing this setting as it will cause the program to use @@ -3993,17 +4036,17 @@ niskiej wywoła destabilizację systemu. Silnie zaleca się przetestowanie ustawienia przed jego użyciem. - + Spring Tekst - + Screen: Ekran: - + Utilize the specified screen for spring mode. On Linux, the default is to use the primary screen. On Windows, the default is to use all available screens. @@ -4012,29 +4055,29 @@ domyślnie używany jest główny ekran. Na Windows, domyślnie używane są wszystkie dostępne ekrany. - + Accel Numerator: Licznik przyspieszenia: - - - + + + 0 0 - + Accel Denominator: Mianownik przyspieszenia: - + Accel Threshold: Granica przyspieszenia: - + If the acceleration values for the virtual mouse have been changed by a different process, particularly when quitting an older game, then you might want to reset the acceleration @@ -4045,47 +4088,47 @@ wyłącznia starszej gry, to możesz chcieć zresetować wartości przyspieszenia stosowane przez wirtualną myszkę. - + Reset Acceleration Resetuj przyspieszenie - + Log File: Plik z logami: - + Log Level: Poziom logów: - + None Brak - + Error Błąd - + Warning Ostrzeżenie - + Info Informacja - + Debug Debugowanie - + Also, Windows users who want to use a low value should also check the "Disable Enhance Pointer Precision" checkbox if you haven't disabled the option in Windows. @@ -4094,155 +4137,165 @@ wartość, powinni także sprawdzić opcję "Zablokuj rozszerzoną precyzj myszki", jeżeli nie chcą mieć zablokowanej tej opcji w Windows. - + Select Default Profile Directory Zaznacz domyślny katalog profilu - + Are you sure you want to delete the profile? Czy na pewno usunąć ten profil? - + Save Log File As Zapisz plik z logami jako - + Log Files (*.log) Pliki z logami (*.log) + + + Do you really want to reset setting? + Czy na pewno chcesz zresetować ustawienia? + + + + Would you like to reset mappings too? + Czy chcesz także zresetować ustawienia mapowania? + MainWindow - + antimicro antimicro - + No Joysticks have been found. Please plug in a joystick and then choose the "Update Joysticks" option in the main menu Nie znaleziono żadnego joysticka. Podłącz joystick a następnie wybierz opcję "Zaktualizuj joysticki" w głównym menu - + If events are not seen by a game, please click here to run this application as Administrator. Jeśli zdarzenia nie są wykrywane przez grę, kliknij tutaj, by uruchomić aplikację w trybie administratora. - + &App &Aplikacja - + &Options &Opcje - + &Help &Pomoc - - + + &Quit &Zakończ - + Ctrl+Q Ctrl+Q - - + + &Update Joysticks &Zaktualizuj joysticki - + Ctrl+U Ctrl+U - - + + &Hide &Ukryj - + Ctrl+H Ctrl+H - + &About &O programie - + Ctrl+A Ctrl+A - + About &Qt O &Qt - + &Properties &Właściwości - + &Key Checker &Sprawdzanie klawiszy - + Home Page Strona domowa - + &GitHub Page &Strona na Github - + &Game Controller Mapping &Mapowanie kontrolera - + S&ettings U&stawienia - + &Stick/Pad Assign &Przypisywanie do Joysticka/Gamepada - + &Wiki &Wiki - + &Issues &Błędy - + &Calibration &Kalibracja @@ -4251,49 +4304,49 @@ Podłącz joystick a następnie wybierz opcję "Zaktualizuj joysticki" Błędy - + Could not find a proper controller identifier. Exiting. Nie można znaleźć odpowiedniego identyfikatora dla kontrolera. Wychodzę. - - - - - - - + + + + + + + (%1) (%1) - - + + Open File Otwórz plik - + &Restore &Przywracanie - + Calibration couldn't be opened Okno kalibracji nie mogło zostać otwarte - + You must connect at least one controller to open the window Wymagane jest podłączenie co najmniej jednego kontrolera przed próbą otworzenia okna - + Run as Administrator? Uruchomić jako administrator? - + Are you sure that you want to run this program as Adminstrator? Some games run as Administrator which will cause events generated by antimicro to not be used by those games unless antimicro is also run as the Adminstrator. This is due to permission problems caused by User Account Control (UAC) options in Windows Vista and later. @@ -4302,17 +4355,17 @@ Some games run as Administrator which will cause events generated by antimicro t Niektóre gry wymagają uruchamiania w trybie administratora, który pozwala na wychwytywanie zdarzeń, generowanych przez antimicro tak, aby nie były używane przez te gry, o ile antimicro jest również uruchomiony w trybie administratora. Sposób ten powstał z powodu problemów uprawnień, wywoływanych przez opcje Kontroli Konta Użytkownika w wersjach Windows'a, poczynając od wersji Windows Vista. - + Failed to elevate program Podniesienie programu zakończyło się niepowodzeniem - + Failed to restart this program as the Administrator Ponowne uruchomienie programu w trybie administratora zakończyło się niepowodzeniem - + Could not find controller. Exiting. Nie można znaleźć kontrolera. Wychodzę. @@ -4320,12 +4373,12 @@ Niektóre gry wymagają uruchamiania w trybie administratora, który pozwala na MouseAxisSettingsDialog - + Mouse Settings - Ustawienia Myszki - - + Set %1 Zestawienie %1 @@ -4333,12 +4386,12 @@ Niektóre gry wymagają uruchamiania w trybie administratora, który pozwala na MouseButtonSettingsDialog - + Mouse Settings - Ustawienia msyzki - - + Set %1 Zestawienie %1 @@ -4346,12 +4399,12 @@ Niektóre gry wymagają uruchamiania w trybie administratora, który pozwala na MouseControlStickSettingsDialog - + Mouse Settings Ustawienia myszki - + Set %1 Zestawienie %1 @@ -4359,12 +4412,12 @@ Niektóre gry wymagają uruchamiania w trybie administratora, który pozwala na MouseDPadSettingsDialog - + Mouse Settings Ustawienia myszki - + Set %1 Zestawienie %1 @@ -4372,17 +4425,17 @@ Niektóre gry wymagają uruchamiania w trybie administratora, który pozwala na MouseSettingsDialog - + Mouse Settings Ustawienia myszki - + Mouse Mode: Tryb myszki: - + Cursor mode is used to move the mouse cursor around the screen relative to its current position depending on how much you move an axis @@ -4406,22 +4459,22 @@ gdy odległość wzdłuż osi, którą pokonałeś ruchem myszki przekroczy ustaloną granicę. - + Cursor Kursor - + Spring Tekst - + Acceleration: Akceleracja: - + Enhanced: Three tier curve that makes the mouse move slow on the low end of an axis and fast on the high end. @@ -4459,123 +4512,123 @@ Funkcja mocy: Pozwala na użycie bardziej tradycyjnej opcji krzywej. Łagodnie sześcienny: Poziom końcowy osi przyspiesza stopniowo przez określony czas z zastosowaniem krzywej trzeciego stopnia. - + Enhanced Precision Rozszerzona precyzja - - + + Linear Liniowa (krzywa I stopnia) - + Quadratic Kwadratowa (krzywa II stopnia) - + Cubic Sześcienna (krzywa III stopnia) - + Quadratic Extreme Skrajnie kwadratowa - + Power Function Funkcja mocy - + Easing Quadratic Łagodnie kwadratowa - + Easing Cubic Łagodnie sześcienna - + Mouse Speed Settings Ustawienia prędkości myszki - + Enable to change the horizontal and vertical speed boxes at the same time. Możliwa zmiana prędkości poziomej i pionowej skrzyń w tym samym czasie. - + Change Together Zmiany całościowe - + Hori&zontal Speed: Prę&dkość pozioma: - - + + 1 = 20 pps 1 = 20 pps - + &Vertical Speed: &Prędkość pionowa: - + Wheel Hori. Speed: Kierownica Hori. Prędkość: - + Set the speed used for horizontal mouse wheel movement according to number of simulated notches per second. Ustawia prędkość poziomego ruchu rolki myszki według liczby symulowanych kroków na sekundę. - - + + 1 = 1 notch(es)/s 1 = 1 obrót(y)/ów - + Wheel Vert. Speed: Kierownica pionowa. Prędkość: - + Set the speed used for vertical mouse wheel movement according to number of simulated notches per second. Ustawia prędkość pionowego ruchu rolki myszki według liczby symulowanych kroków na sekundę. - + Sensitivit&y: Czułoś&ć: - + For Power Function acceleration curve. Specifies the factor to use for curve sensitivity. When the value is above 1.0, the mouse movement will be accelerated @@ -4586,12 +4639,12 @@ przekracza 1.0, ruch myszki ulegnie większemu przyspieszeniu na niskim poziomie osi. - + Easing Duration: Zmniejszenie trwania: - + Specifies the amount of time (in seconds) that will be required before the mouse is fully accelerated after reaching the high end of an axis. @@ -4600,13 +4653,13 @@ przed pełnym przyspieszeniem myszy i po osiągnięciu końcowego odcinka osi. - - + + s s - + Options for adding more acceleration to the mouse movement beyond what the acceleration curve would produce. Acceleration is added based on how quickly an axis is @@ -4621,74 +4674,74 @@ pewnych błędów związanych z bardzo ograniczoną dostępnością do przedziału wartości, używając standardowych przycisków analogowych. - + Delta Acceleration Przyspieszenie delta - + &Multiplier: &Mnożnik: - + Highest value to accelerate mouse movement by Największa wartość przyspieszenia ruchu myszki - + x x - + Start %: Start %: - + Acceleration begins at this percentage of the base multiplier Przyspiesznie rozpoczyna się na tym poziomie procentowym głównego mnożnika - - - - + + + + % % - + Mi&n Threshold: Mi&nimalna granica: - + Minimum amount of axis travel required for acceleration to begin Minimum dla ilości przesuwu osi, wymaganej do rozpoczęcia przyspieszenia - + Max Threshold: Maksymalna granica: - + Maximum axis travel before acceleration has reached the multiplier value Maksimum dla przesuwu osi, potrzebnego dla momentu, zanim przyspiesznie osiągnie wartość mnożnika - + E&xtra Duration: Do&datkowy czas trwania: - + Extend the time that extra acceleration is applied. Axis travel will be taken into account. A slower flick will decrease the actual time that extra acceleration will be applied. @@ -4697,37 +4750,37 @@ Przesuw osi zostanie przeniesiony do konta. Wolniejszy ruch zmniejszy aktualny czas, by mogło zostać dodane dodatkowe przyspieszenie. - + Curve: Krzywa: - + Ease Out Sine Zwalnianie pod koniec - + Ease Out Quad Większe zwalnianie pod koniec - + Ease Out Cubic Zwalnianie pod koniec plus większe przyspieszenie - + Spring Settings Ustawienia tekstu - + Spring Width: Szerokość tekstu: - + Changes the width of the region that the cursor can move in spring mode. 0 will use the entire width of your screen. @@ -4736,12 +4789,12 @@ mógł poruszać się w trybie tekstowym. 0 będzie używało całej szerokości twojego ekranu. - + Spring Height: Wysokość tekstu: - + Changes the height of the region that the cursor can move in spring mode. 0 will use the entire height of your screen. @@ -4750,46 +4803,46 @@ mógł poruszać się w trybie sprężyny. 0 będzie używało całej szerokości twojego ekranu. - + Release Radius: Zwalnianie zasięgu: - + Specifies that the spring area will be relative to the mouse position set by a non-relative spring. Określa, czy pole tekstowe będzie zależne od pozycji kursora myszki, ustawionej przez niezależny tekst. - + Relative Względny - + Mouse Status Status myszki - + X: X: - - + + 0 (0 pps) 0 (0 pps) - + Y: Y: - - + + %n notch(es)/s %n obrót @@ -4801,39 +4854,43 @@ pozycji kursora myszki, ustawionej przez niezależny tekst. QKeyDisplayDialog - + Key Checker Detekcja klawiszy - <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> + <html><head/><body><p>Naciśnij dowolny klawisz na klawiaturze, aby sprawdzić, w jakiej postaci jest wykrywany przez aplikację. W oknie pojawią się wartości pod trzema postaciami: systemową natywną, oryginalną stosowaną przez bibliotekę Qt oraz w postaci standardowej używanej przez antimicro.</p><p>Wartość znaku w antimicro oraz wartość znaku stosowanego w Qt będą zazwyczaj takie same, ponieważ aplikacja stara się używać wartości zdefiniowanej przez Qt, o ile jest to możliwe. Odwiedź stronę <a href="http://doc.qt.io/qt-5/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">http://doc.qt.io/qt-5/qt.html#Key-enum</span></a> aby zapoznać się z aktualną listą znaków. Jeśli zauważysz, że wybrany znak nie jest natywnie wspierany przez program, możesz to zgłosić na stronie <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">strona GitHub</span></a> by można było odpowiednio uaktualnić program. Tak jak jest aktualnie, prefiks jest dodawany do nieznanych wartości, aby mogły być nadal używane. Jednak problemem staje się brak przenośności danego profilu.</p></body></html> + + + + <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="http://doc.qt.io/qt-5/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">http://doc.qt.io/qt-5/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> <html><head/><body><p>Naciśnij dowolny klawisz na klawiaturze, aby sprawdzić, w jakiej postaci jest wykrywany przez aplikację. W oknie pojawią się wartości pod trzema postaciami: systemową natywną, oryginalną stosowaną przez bibliotekę Qt oraz w postaci standardowej używanej przez antimicro.</p><p>Wartość znaku w antimicro oraz wartość znaku stosowanego w Qt będą zazwyczaj takie same, ponieważ aplikacja stara się używać wartości zdefiniowanej przez Qt, o ile jest to możliwe. Odwiedź stronę <a href="http://doc.qt.io/qt-5/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">http://doc.qt.io/qt-5/qt.html#Key-enum</span></a> aby zapoznać się z aktualną listą znaków. Jeśli zauważysz, że wybrany znak nie jest natywnie wspierany przez program, możesz to zgłosić na stronie <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">strona GitHub</span></a> by można było odpowiednio uaktualnić program. Tak jak jest aktualnie, prefiks jest dodawany do nieznanych wartości, aby mogły być nadal używane. Jednak problemem staje się brak przenośności danego profilu.</p></body></html> - + Event Handler: Procedura obsługi zdarzenia: - + Native Key Value: Wartość klawisza natywnego: - - - + + + 0x00000000 0x00000000 - + Qt Key Value: Wartość klawisza Qt: - + antimicro Key Value: Wartość klawisza antimicro: @@ -4841,134 +4898,134 @@ pozycji kursora myszki, ustawionej przez niezależny tekst. QObject - + Last button Ostatni przycisk - + There isn't a last button pressed from gamepad in data. Did you set at least one button from gamepad for keyboard? Program nie wykrywa ostatniego przypisanego przycisku. Czy co najmniej jeden przycisk został zmapowany z klawiatury do gamepad'a? - + # of joysticks found: %1 # joystick'ów zostało znalezionych: %1 - + List Joysticks: Lista joystick'ów: - + --------------- --------------- - + Joystick %1: Joystick %1: - + Index: %1 Indeks: %1 - + GUID: %1 GUID: %1 - + Name: %1 Nazwa: %1 - + Yes Tak - + No Nie - + Game Controller: %1 Kontroler do gier: %1 - + # of Axes: %1 # osi: %1 - + # of Buttons: %1 # przycisków: %1 - + # of Hats: %1 # przycisków POV: %1 - + Active window changed to: Title = "%1", Class = "%2", Program = "%3" or "%4". Aktywne okno zostało zmienione: Tytuł = "%1", Klasa = "%2", Program = "%3" lub "%4". - + Profile location %1 is not an XML file. Lokalizacja profilu %1 nie wskazuje na plik typu XML. - + Profile location %1 does not exist. Profil %1 nie istnieje. - - - + + + Controller identifier is not a valid value. Identyfikator kontrolera nie należy do wartości prawidłowych. - + An invalid set number '%1' was specified. Została określona nieprawidłowa liczba '%1". - + Controller identifier '%s'' is not a valid value. Identyfikator kontrolera '%s'' nie jest wartością prawidłową. - + No set number was specified. Nie została określona ustalona liczba. - + No controller was specified. Kontroler nie został określony. - + No display string was specified. Tekst dla wyświetlenia nie został określony. - + An invalid event generator was specified. Został określony nieprawidłowy generator zdarzeń. - + No event generator string was specified. Nie został określony generator zdarzeń. @@ -4977,7 +5034,7 @@ pozycji kursora myszki, ustawionej przez niezależny tekst. Flaga dla stylu Qt została wykryta lecz sam styl nie został uwzględniony. - + No log file specified. Nie został określony plik z logami programu. @@ -5006,148 +5063,148 @@ pozycji kursora myszki, ustawionej przez niezależny tekst. Uruchom program w tacce systemowej. - + Logging started Rozpoczęto generowanie logów - + Daemon launched Usługa została uruchomiona - + Failed to launch daemon Uruchomienie usługi zostało zakończone niepowodzeniem - + Launching daemon Uruchamianie usługi - - + + Display string "%1" is not valid. Treść dla wyświetlenia "%1" jest nieprawidłowa. - + Failed to set a signature id for the daemon Ustawienie sygnatury id dla usługi została zakończona niepowodzeniem - + Failed to change working directory to / Zmiana katalogu roboczego została zakończona niepowodzeniem / - + Attempting to use fallback option %1 for event generation. Próba użycia awaryjnej opcji %1 dla generatora zdarzeń. - + Failed to open event generator. Exiting. Uruchomienie generatora zdarzeń zostało zakończone niepowodzeniem. Koniec. - + Using %1 as the event generator. Zastosowanie %1 jako generatora zdarzeń. - + Could not raise process priority. Nie można nadać procesowi większego priorytetu. - + Quitting Program Zamykanie aplikacji - + Auto-switching to profile "%1". Autoprzełączanie do profilu "%1". - + Auto-switching to nullptr profile! Autoprzełączanie do profilu nullptr! - + Super Super - + Menu Menu - + Mute Mute - + Vol+ Vol+ - + Vol- Vol- - + Play/Pause Play/Pause - + Play Play - + Pause Pause - + Prev Prev - + Next Next - + Mail Mail - + Home Home - + Media Media - + Search Search - + xinput version must be at least 2.0. No mouse acceleration changes will occur. wersja rozszerzenia xinput nie może być mniejsza od 2.0. Zmiany przy akceleracji myszki nie zostaną uwzględnione. @@ -5155,18 +5212,18 @@ pozycji kursora myszki, ustawionej przez niezależny tekst. QuickSetDialog - + Quick Set Szybkie ustawienie - + <html><head/><body><p>Please press a button or move an axis on %1 (<span style=" font-weight:600;">%2</span>).<br/>A dialog window will then appear which will<br/>allow you to make an assignment.</p></body></html> <html><head/><body><p>Naciśnij przycisk lub wykonaj ruch w kierunku osi %1 (<span style=" font-weight:600;">%2</span>).<br/>Pojawi się okno dialogowe<br/>które odblokuje możliwość tworzenia zadań.</p></body></html> - - + + Quick Set %1 Szybkie ustawienie %1 @@ -5174,12 +5231,12 @@ pozycji kursora myszki, ustawionej przez niezależny tekst. SetAxisThrottleDialog - + Throttle Change Zmiana przepustnicy analogowej - + The throttle setting for Axis %1 has been changed. Would you like to distribute this throttle change to all sets? @@ -5191,12 +5248,12 @@ Czy nowe ustawienia przepustnicy mają zostać uwzględnione we wszystkich zesta SetJoystick - + Set %1: %2 Zestawienie %1: %2 - + Set %1 Zestawienie %1 @@ -5204,52 +5261,52 @@ Czy nowe ustawienia przepustnicy mają zostać uwzględnione we wszystkich zesta SetNamesDialog - + Set Name Settings Ustawienia nazw zestawień - + Set 1 Zestawienie 1 - + Set 2 Zestawienie 2 - + Set 3 Zestawienie 3 - + Set 4 Zestawienie 4 - + Set 5 Zestawienie 5 - + Set 6 Zestawienie 6 - + Set 7 Zestawienie 7 - + Set 8 Zestawienie 8 - + Name Nazwa @@ -5257,7 +5314,7 @@ Czy nowe ustawienia przepustnicy mają zostać uwzględnione we wszystkich zesta SimpleKeyGrabberButton - + Mouse Mysz @@ -5265,7 +5322,7 @@ Czy nowe ustawienia przepustnicy mają zostać uwzględnione we wszystkich zesta SpringModeRegionPreview - + Spring Mode Preview Podgląd trybu tekstowego @@ -5273,7 +5330,7 @@ Czy nowe ustawienia przepustnicy mają zostać uwzględnione we wszystkich zesta UInputEventHandler - + Could not find a valid uinput device file. Please check that you have the uinput module loaded. lsmod | grep uinput @@ -5283,14 +5340,14 @@ Przykładowe polecenie sprawdzające: lsmod | grep uinput - + Could not open uinput device file Please check that you have permission to write to the device Nie można otworzyć pliku dla uinput. Sprawdź uprawnienia zapisu dla pliku - + Using uinput device file %1 Zastosowanie pliku %1 dla uinput @@ -5298,551 +5355,551 @@ Sprawdź uprawnienia zapisu dla pliku UInputHelper - + a a - + b b - + c c - + d d - + e e - + f f - + g g - + h h - + i i - + j j - + k k - + l l - + m m - + n n - + o o - + p p - + q q - + r r - + s s - + t t - + u u - + v v - + w w - + x x - + y y - + z z - + Esc Esc - + F1 F1 - + F2 F2 - + F3 F3 - + F4 F4 - + F5 F5 - + F6 F6 - + F7 F7 - + F8 F8 - + F9 F9 - + F10 F10 - + F11 F11 - + F12 F12 - + ` ` - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - - + + - - - + = = - + BackSpace BackSpace - + Tab Tab - + [ [ - + ] ] - + \ \ - + CapsLock CapsLock - + ; ; - + ' ' - + Enter Enter - + Shift_L Shift_L - + , , - - + + . . - - + + / / - + Ctrl_L Ctrl_L - - + + Super_L Super_L - + Alt_L Alt_L - + Space Space - + Alt_R Alt_R - + Menu Menu - + Ctrl_R Ctrl_R - + Shift_R Shift_R - + Up Góra - + Left Lewo - + Down Dół - + Right Prawo - + PrtSc PrtSc - + Ins Ins - + Del Del - + Home Home - + End End - + PgUp PgUp - + PgDn PgDn - + NumLock NumLock - + * * - + + + - + KP_Enter KP_Enter - + KP_1 KP_1 - + KP_2 KP_2 - + KP_3 KP_3 - + KP_4 KP_4 - + KP_5 KP_5 - + KP_6 KP_6 - + KP_7 KP_7 - + KP_8 KP_8 - + KP_9 KP_9 - + KP_0 KP_0 - + SCLK SCLK - + Pause Pause - + Super_R Super_R - + Mute Mute - + VolDn VolDn - + VolUp VolUp - + Play Play - + Stop Stop - + Prev Prev - + Next Next - + [NO KEY] [BRAK] @@ -5850,54 +5907,54 @@ Sprawdź uprawnienia zapisu dla pliku UnixWindowInfoDialog - + Captured Window Properties Uchwycone właściwości okna - + Information About Window Informacje o oknie - + Class: Klasa: - - - + + + TextLabel Etykieta - + Title: Tytuł: - + Path: Ścieżka: - + Match By Properties Dopasowanie według właściwości - + Class Klasa - + Title Tytuł - + Path Ścieżka @@ -5905,9 +5962,9 @@ Sprawdź uprawnienia zapisu dla pliku VDPad - - - + + + VDPad VDPad @@ -5915,263 +5972,263 @@ Sprawdź uprawnienia zapisu dla pliku VirtualKeyPushButton - + Space Space - + Tab Tab - + Shift (L) Shift (L) - + Shift (R) Shift(R) - + Ctrl (L) Ctrl (L) - + Ctrl (R) Ctrl (R) - + Alt (L) Alt (L) - - + + Alt (R) Alt (R) - + Alt Gr Alt Gr - + ` ` - + ~ ~ - - + + - - - + = = - + [ [ - + ] ] - + \ \ - + Caps Caps - + ; ; - + ' ' - + , , - - + + . . - - + + / / - + ESC ESC - + PRTSC PRTSC - + SCLK SCLK - + INS INS - + PGUP PGUP - + DEL DEL - + PGDN PGDN - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - + NUM LK NUM LK - - + + * * - + + + - + Enter Enter - + < < - + : : - + Super (L) Super (L) - + Menu Menu - + Up Góra - + Down Dół - + Left Lewo - + Right Prawo @@ -6179,233 +6236,233 @@ LK VirtualKeyboardMouseWidget - - + + Keyboard Klawiatura - - + + Mouse Mysz - + Left Mouse Myszki Lewo - + Up Mouse Myszki Góra - + Left Button Mouse Myszki Lewy przycisk - + Middle Button Mouse Myszki Środkowy przycisk - + Right Button Mouse Myszki Prawy przycisk - + Wheel Up Mouse Rolką w górę - + Wheel Left Mouse Rolką w lewo - + Wheel Right Mouse Rolką w prawo - + Wheel Down Mouse Rolką w dół - + Down Mouse Myszki Dół - + Right Mouse Myszki Prawo - + Button 4 Mouse Przycisk 4 - + Mouse 8 Mouse Przycisk myszy 8 - + Button 5 Mouse Przycisk 5 - + Mouse 9 Mouse Przycisk myszy 9 - + Mouse Settings Ustawienia myszki - + NONE BRAK - - + + Last button Ostatni przycisk - - + + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad Sloty dla wprowadzonych przycisków nie mogły zostać usunięte, ponieważ żadne dane nie zostały dotychczas wprowadzone z układu klawiatury do układu gamepad'a. Stwórz mapowanie co najmniej jednego przycisku dla gamepad'a - + Others Inne - + Applications Aplikacje - + Browser Back Browser Back - + Browser Favorites Browser Favorites - + Browser Forward Browser Forward - + Browser Home Browser Home - + Browser Refresh Browser Refresh - + Browser Search Browser Search - + Browser Stop Browser Stop - + Calc Calc - + Email Email - + Media Media - + Media Next Media Next - + Media Play Media Play - + Media Previous Media Previous - + Media Stop Media Stop - + Search Search - + Volume Down Volume Down - + Volume Mute Volume Mute - + Volume Up Volume Up @@ -6413,7 +6470,7 @@ LK VirtualMousePushButton - + INVALID NIEPRAWIDŁOWY @@ -6421,28 +6478,28 @@ LK WinAppProfileTimerDialog - - + + Capture Application Zrzut aplikacji - + After pressing the "Capture Application" button, please select the application window that you want to have a profile associated with. The active application will be captured after the selected number of seconds. Jeśli wybrałeś "Zrzut aplikacji", kliknij na okno dowolnej otwartej aplikacji, aby twój profil został z nim powiązany. Otwarta aplikacja zostanie uchwycona po podanym czasie. - + Timer: Licznik: - + Seconds Sekund - + Cancel Anuluj @@ -6450,12 +6507,12 @@ LK WinExtras - + [NO KEY] [BRAK] - + AntiMicro Profile Profil AntiMicro @@ -6463,67 +6520,66 @@ LK X11Extras - + ESC ESC - + Tab Tab - + Space Space - + DEL DEL - + Return Return - + KP_Enter KP_Enter - + Backspace Backspace - + Alt Gr Alt Gr - + xinput extension was not found. No mouse acceleration changes will occur. rozszerzenie xinput nie zostało znalezione. Zmiany przy akceleracji myszki nie zostaną uwzględnione. - + xinput version must be at least 2.0. No mouse acceleration changes will occur. wersja rozszerzenia xinput nie może być mniejsza od 2.0. Zmiany przy akceleracji myszki nie zostaną uwzględnione. - Virtual pointer found with id=%1. - Został znaleziony wirtualny wskaźnik dla urządzenia o id=%1. + Został znaleziony wirtualny wskaźnik dla urządzenia o id=%1. - + PtrFeedbackClass was not found for virtual pointer.No change to mouse acceleration will occur for device with id=%1 PtrFeedbackClass nie została znaleziona dla wskażnika wirtualnego. Zmiany akceleracji myszki nie zostaną uwzględnione dla urządzenia o id=%1 - + Changing mouse acceleration for device with id=%1 Zmiana akceleracji myszki dla urządzenia o numerze id=%1 @@ -6531,7 +6587,7 @@ LK XMLConfigReader - + Could not write updated profile XML to file %1. Zapis zaktualizowanego profilu XML do pliku %1 jest niemożliwy. @@ -6539,7 +6595,7 @@ LK XMLConfigWriter - + Could not write to profile at %1. Zapis do profilu %1 był niemożliwy. @@ -6547,7 +6603,7 @@ LK antimicro - + Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support. Aplikacja z nakładką graficzną do importowania ustawień przycisków klawiatury i myszki do gamepad'a. Program jest szczególnie przydatny dla gier bez wbudowanego wsparcia dla gamepad'ów. @@ -6555,99 +6611,99 @@ LK main - + Launch program in system tray only. Uruchom program w tacce systemowej. - + Launch program with the tray menu disabled Uruchom program bez udziału tacki systemowej - + Launch program without the main window displayed Uruchom program pomijając wyświetlenie głównego okna - + Launch program with the configuration file selected as the default for selected controllers. Defaults to all controllers Uruchom program ze wskazanym plikiem konfiguracyjnym jako domyślnym dla wskazanych kontrolerów - + location lokalizacja - + Apply configuration file to a specific controller. Value can be a controller index, name, or GUID Wybierz plik konfiguracyjny dla wskazanego kontrolera. Wartością może być indeks kontrolera, nazwa lub GUID - + value wartość - + Unload currently enabled profile(s) Odłącz aktualnie odblokowany profil(e) - + value(s) wartość(i) - + Start joysticks on a specific set. Value can be a controller index, name, or GUID Uruchom joystick(i) z numerem ustawienia. Wartością może być indeks kontrolera, nazwa lub GUID - + number value numer wartość - + Launch program as a daemon. Use only on Linux. Launch program as a daemon Uruchom program jako usługę w tle. Wyłącznie pod Linux. - + Enable logging Odblokuj generowanie logów - + log-type typ-logów - + Choose a file for logs writing Wybierz plik dla zapisywania logów - + filename nazwaPliku - + Choose between using XTest support and uinput support for event generation. Use only if you have enabled xtest and uinput options on Linux or vmulti on Windows. Default: xtest. Choose between using XTest support and uinput support for event generation. Default: xtest. Wybierz między wsparciem xtest a wsparciem uinput dla generatora zdarzeń. Do zastosowania wyłącznie w przypadku wykrywania przez program xtest oraz uinput pod Linux oraz w przypadku wykrywania opcji vmulti pod Windows. Domyślnie: xtest. - + event-generation-type typ-generatora-zdarzeń - + Print information about joysticks detected by SDL. Use only if you have sdl library. You can check your controller index, name or even GUID. Wyświetl informacje o wykrytych joystick'ach przez bibliotekę SDL. Zastosowanie wyłącznie z dostępną i odblokowaną biblioteką sdl. Wyświetlane informacje dotyczą indeksu kontrolerów, nazw i GUID. diff --git a/share/antimicro/translations/antimicro_ru.ts b/share/antimicro/translations/antimicro_ru.ts old mode 100644 new mode 100755 index 4f2fbe508..9544752b0 --- a/share/antimicro/translations/antimicro_ru.ts +++ b/share/antimicro/translations/antimicro_ru.ts @@ -4,17 +4,17 @@ AboutDialog - + About О программе - + Version Версия - + "juliagoda" (since March, 2018) Wanting only to play my favourite old games that din't support gamepads, I found this project (which map keyboard keys and mouse buttons to connected gamepads on Linux) as most proper and recent. But because of poor choices of such application on the internet and since it didn't compile properly, I decided to rescue the project. However, once I finished my work (enough to enjoy playing games) I thought about sharing this code with others. Of course all informations about past programmers will be held. "Ryochan7" (since December 30, 2012 until 2017), I have been working on antimicro in my spare time. What originally started as a fork of QJoyPad and a way to learn proper event-driven programming has turned into something much bigger than I originally intended. Although I have spent a lot of time learning new techniques, finding out more about the domain of KB+M emulation, and spending Friday nights bashing my head against my keyboard, it has been a fun and enriching experience overall. @@ -32,17 +32,17 @@ As of May 24, 2016, this project has moved to https://github.com/AntiMicro/antim - + Copyright: 2013 - 2018 - + Info Информация - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -86,7 +86,7 @@ p, li { white-space: pre-wrap; } - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -204,57 +204,57 @@ p, li { white-space: pre-wrap; } - + Changelog - + Credits Авторы - + antimicro - + About Development - + License Лицензия - + Program Version %1 Версия программы %1 - + Program Compiled on %1 at %2 Программа скомпилирована %1 в %2 - + Built Against SDL %1 Собрана на SDL %1 - + Running With SDL %1 Запускается на SDL %1 - + Using Qt %1 Версия Qt %1 - + Using Event Handler: %1 @@ -262,151 +262,160 @@ p, li { white-space: pre-wrap; } AddEditAutoProfileDialog - + Auto Profile Dialog Окно Авто Профиля - + Profile: Профиль: - - + + Browse Обзор - + Window: - - + + Select Window. Click on the appropriate application window and the application file path will be populated in the form. Кликните по нужному окну приложения чтобы автоматически добавить путь до него в форму. - + Detect Window Properties - + Class: - + Title: - + + set partial title + + + + Application: - + Select Выбор - + + De&vices: + + + Devices: - Устройства: + Устройства: - - + + Select this profile to be the default loaded for the specified device. The selection will be used instead of the all default profile option. Выберите профиль, который будет автоматически загружаться для выбранного устройства. Выбранный профиль загрузится даже если выбран профиль по-умолчанию. - + Set as Default for Controller Установить по-умолчанию для этого контроллера - - + + A different profile is already selected as the default for this device. Для этого контроллера уже назначен профиль по-умолчанию. - + Current (%1) Текущий (%1) - + Open Config Открыть Конфигурацию - - + + Select Program Выбрать Программу - + Programs (*.exe) - + Please use the main default profile selection. Пожалуйста, используйте основной профиль по-умолчанию. - + Please select a window by using the mouse. Press Escape if you want to cancel. - + Capture Application Window - + Could not obtain information for the selected window. - + Application Capture Failed - + Profile file path is invalid. Неверный путь до профиля. - + No window matching property was specified. - + Program path is invalid or not executable. Путь до программы содержит ошибку или не может быть выполнен. - + File is not an .exe file. - + No window matching property was selected. @@ -414,187 +423,187 @@ of the all default profile option. AdvanceButtonDialog - - + + Advanced Продвинутые настройки - + Assignments Назначения - + Toggle Переключатель - + Turbo Турбо - + Set Selector Установить Селектор - + Blank or KB/M - + Hold Удерживать - + Pause Пауза - + Cycle Цикл - + Distance Дистанция - + Insert Вставить - + Delete Удалить - + Clear All Очистить Все - + Time: Время: - + 0.01s 0,01 сек - + 0s 0 сек - + Insert a pause that occurs in between key presses. Вставить паузу между нажатиями на кнопку. - + Release Отпускание - - + + Insert a new blank slot. Вставить новый пустой слот. - + Delete a slot. Удалить слот. - + Clear all currently assigned slots. Очистить все заполненные слоты. - + Specify the duration of an inserted Pause or Hold slot. Определяет продолжительность для слотов Пауза и Удерживание. - + 0m 0 мин - + &Mouse Speed Mod: - - + + Specify the range past an axis dead zone in which a sequence of actions will execute. Определяет диапазон оси для мертвой зоны в котором следует выполнять действия. - + Distance: Дистанция: - - + + % % - + Mouse Mod Скорость Мыши - + Press Time Время Нажатия - + Delay Задержка - + Execute - + Load Загрузить - + Set Change - + Text Entry - + Placeholder Заполнитель - - + + 0 0 @@ -603,317 +612,317 @@ of the all default profile option. Модификатор Скорости Мыши: - + Set the percentage that mouse speeds will be modified by. Определяет в процентах на сколько должна быть изменена скорость мыши. - + Auto Reset Cycle After Автоматически сбросить цикл после - + seconds секунд - + Executable: - + ... - + Arguments: - - - + + + Enabled Включено - + Mode: - + <html><head/><body><p>Normal: Repeatedly press and release a button by the chosen rate.</p><p>Gradient: Modify the button press and button release delay based on how far an axis has been moved. The rate will remain the same.</p><p>Pulse: Modify how many times a button is pressed and released per second. The button delay will remain the same.</p></body></html> - + Normal Нормально - + Gradient - + Pulse - + Delay: Задержка: - + 0.10s 0,10 сек - + Rate: Частота: - + 10.0/s 10,0/сек - - + + Disabled Отключено - + Select Set 1 One Way Установить Набор 1 Односторонним - + Select Set 1 Two Way Установить Набор 1 Двусторонним - + Select Set 1 While Held Установить Набор 1 Пока Нажато - + Select Set 2 One Way Установить Набор 2 Односторонним - + Select Set 2 Two Way Установить Набор 2 Двусторонним - + Select Set 2 While Held Установить Набор 2 Пока Нажато - + Select Set 3 One Way Установить Набор 3 Односторонним - + Select Set 3 Two Way Установить Набор 3 Двусторонним - + Select Set 3 While Held Установить Набор 3 Пока Нажато - + Select Set 4 One Way Установить Набор 4 Односторонним - + Select Set 4 Two Way Установить Набор 4 Двусторонним - + Select Set 4 While Held Установить Набор 4 Пока Нажато - + Select Set 5 One Way Установить Набор 5 Односторонним - + Select Set 5 Two Way Установить Набор 5 Двусторонним - + Select Set 5 While Held Установить Набор 5 Пока Нажато - + Select Set 6 One Way Установить Набор 6 Односторонним - + Select Set 6 Two Way Установить Набор 6 Двусторонним - + Select Set 6 While Held Установить Набор 6 Пока Нажато - + Select Set 7 One Way Установить Набор 7 Односторонним - + Select Set 7 Two Way Установить Набор 7 Двусторонним - + Select Set 7 While Held Установить Набор 7 Пока Нажато - + Select Set 8 One Way Установить Набор 8 Односторонним - + Select Set 8 Two Way Установить Набор 8 Двусторонним - + Select Set 8 While Held Установить Набор 8 Пока Нажато - + sec. сек. - + /sec. /сек. - + Set %1 Набор %1 - - + + Select Set %1 Установить Набор %1 - + One Way Односторонним - + Two Way Двусторонним - + While Held Пока Нажато - + Choose Executable - + Slots past a Cycle action will be executed on the next button press. Multiple cycles can be added in order to create partitions in a sequence. - + Delays the time that the next slot is activated by the time specified. Slots activated before the delay will remain active after the delay time has passed. - + Distance action specifies that the slots afterwards will only be executed when an axis is moved a certain range past the designated dead zone. - + Insert a hold action. Slots after the action will only be executed if the button is held past the interval specified. - + Chose a profile to load when this slot is activated. - + Mouse mod action will modify all mouse speed settings by a specified percentage while the action is being processed. This can be useful for slowing down the mouse while sniping. - + Specify the time that keys past this slot should be held down. - + Insert a release action. Slots after the action will only be executed after a button release if the button was held past the interval specified. - + Change to selected set once slot is activated. - + Full string will be typed when a slot is activated. - + Execute program when slot is activated. - - + + Choose Profile - + Config Files (*.amgp *.xml) @@ -921,157 +930,157 @@ of the all default profile option. AdvanceStickAssignmentDialog - + Stick/Pad Assignment Настройки Стиков / Крестовин - + Sticks Стики - + DPads Крестовины - - + + %1 (Joystick %2) %1 (Геймпад %2) - + Stick 1 Стик 1 - - - + + + Enabled Включено - - - - - - + + + + + + Assign Назначить - - + + X Axis: Ось X: - - + + Y Axis: Ось Y: - + Stick 2 Стик 2 - + Number of Physical DPads: %1 Количество физических крестовин: %1 - + Virtual DPad 1 Виртуальная Крестовина 1 - + Up: Вверх: - + Down: Вниз: - + Note: This window is meant for backwards compatibility with profiles made before antimicro 2.0. Since version 2.0, use of the Game Controller Mapping window is preferred. - + Left: Влево: - + Right: Вправо: - - - - + + + + Axis %1 Ось %1 - - - - + + + + Axis %1 - Ось %1 - - - - - + + + + Axis %1 + Ось %1 + - - - - + + + + Button %1 Кнопка %1 - + Move stick 1 along the X axis Переместите Cтик 1 по оси X - + Move stick 1 along the Y axis Переместите Cтик 1 по оси Y - + Move stick 2 along the X axis Переместите Cтик 2 по оси X - + Move stick 2 along the Y axis Переместите Cтик 2 по оси Y - - - - + + + + Press a button or move an axis Нажмите кнопку или подвигайте стик @@ -1079,179 +1088,179 @@ of the all default profile option. AxisEditDialog - + Axis Ось - - + + Mouse (Horizontal) Мышь (горизонталь) - - + + Mouse (Inverted Horizontal) Мышь (инвертированная горизонталь) - - + + Mouse (Vertical) Мышь (вертикаль) - - + + Mouse (Inverted Vertical) Мышь (инвертированная вертикаль) - - + + Arrows: Up | Down Стрелки: Вверх | Вниз - - + + Arrows: Left | Right Стрелки: Влево | Вправо - - + + Keys: W | S Клавиши: W | S - - + + Keys: A | D Клавиши: A | D - - + + NumPad: KP_8 | KP_2 NumPad: 8 | 2 - - + + NumPad: KP_4 | KP_6 NumPad: 4 | 6 - - - + + + None Отсутствует - - + + Set the value to use as the limit for an axis. Useful for a worn out analog stick. - + Negative Half Throttle Отрицательная Полутяга - + Positive Half Throttle Положительная Полутяга - + Name: Имя: - + Specify the name of an axis. Укажите имя для оси. - + Mouse Settings Настройки Мыши - - + + Set the value of the dead zone for an axis. Устанавливает значение мертвой зоны для оси. - + Presets: Пресет: - + Dead Zone: Мертвая Зона: - + Max Zone: Лимит: - - + + [NO KEY] [ПУСТО] - + Throttle setting that determines the behavior of how to interpret an axis hold or release. Настройки тяги определяют как программа будет расценивать удерживание или отпускание оси. - + Negative Throttle Отрицательная Тяга - + Normal Нормально - + Positive Throttle Положительная Тяга - + Current Value: Текущее значение: - + Set Установки для - + Set %1 Набор %1 - + Left Mouse Button - + Right Mouse Button @@ -1259,37 +1268,37 @@ interpret an axis hold or release. ButtonEditDialog - + Dialog Окно - + To make a new assignment, press any keyboard key or click a button in the Keyboard or Mouse tab <center>Чтобы назначить новое действие нажмите на соответствующую кнопку во вкладках "Клавиатура" или "Мышь"</center> - + Placeholder Заполнитель - + Toggle Переключатель - + Enables a key press or release to only occur when a controller button is pressed. Добавляет возможность производить действие только в случае нажатия или отпускания кнопки. - + Enables rapid key presses and releases. Turbo controller. Добавляет возможность быстрого нажатия кнопок (как в турбо контроллере). - + Turbo Турбо @@ -1298,38 +1307,38 @@ interpret an axis hold or release. Текущая: - + Last keyboard/mouse button: - + Slots Слоты - + Na&me: Имя: - + Specify the name of a button. Укажите название кнопки. - + Action: Действие: - + Specify the action that will be performed in game while this button is being used. Укажите какое действие будет производится при нажатии данной кнопки. - + Advanced Дополнительно @@ -1342,52 +1351,52 @@ this button is being used. Набор %1 - - - + + + Choose your keyboard key - + No button - - - - + + + + Last button - + To change settings for last button, it must be at least one assignment from keyboard to gamepad - + To change settings of turbo for last button, it must be at least one assignment from keyboard to gamepad - + To open advanced dialog, it's needed to map at least one button from keyboard to gamepad - + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + As last gamepad button has been set - + Index %1 @@ -1395,190 +1404,190 @@ this button is being used. Calibration - + Form - - + + Start calibration - + Controller: - + Sticks: - - Use settings from jstest-gtk - - - - + Reset settings - + Cancel Отмена - - + + Save Сохранить - - + + Calibration - - Do you really want to reset settings of current axes? + + Do you really want to reset settings of current axis? - + Calibration was saved for the preset. Do you really want to reset settings? - + Place the joystick in the center position. It's the part, where often you don't have to move. Just skip it in such situation. - + Calibrating center - + Start second step - + Center X: %1 - + Center Y: %1 - + Place the joystick in the top-left corner many times - - + + Calibrating position - - + + X: %1 - - + + Y: %1 - + Place the joystick in the bottom-right corner - + Start final step - + range X: %1 - %2 - + range Y: %1 - %2 - + deadzone X: %1 - + deadzone Y: %1 - + ---Calibration done!--- - + Calibration values have been saved - - + + Dead zone calibration - - You must move X axis to the right at least five times! Keep moving! + + You have to move axes to the top-left corner at least five times. - - You must move X axis to the left at least five times! Keep moving! + + You have to move axes to the bottom-right corner at least five times. - - - - + + Do you want to save calibration of current axis? + + + + + + + Axis %1 Ось %1 @@ -1586,64 +1595,64 @@ deadzone Y: %1 CapturedWindowInfoDialog - + Captured Window Properties - + Information About Window - + Class: - - - + + + TextLabel - + Title: - + Path: - + Match By Properties - + Class - + Title - + Path - + Full Path - + File Name @@ -1732,67 +1741,67 @@ deadzone Y: %1 DPadContextMenu - + Mouse (Normal) Мышь (Нормально) - + Mouse (Inverted Horizontal) - + Mouse (Inverted Vertical) - + Mouse (Inverted Horizontal + Vertical) - + Arrows Стрелки - + Keys: W | A | S | D Клавиши: W | A | S | D - + NumPad NumPad - + None Отсутствует - + Standard Стандартный - + Eight Way 8-ми сторонний - + 4 Way Cardinal 4-х сторонний основной - + 4 Way Diagonal 4-х сторонний диагональный - + Mouse Settings @@ -1800,108 +1809,108 @@ deadzone Y: %1 DPadEditDialog - + Dialog Окно - + Presets: Пресет: - + Mouse (Normal) Мышь (Нормально) - + Mouse (Inverted Horizontal) Мышь (Инвертированная Горизонталь) - + Mouse (Inverted Vertical) Мышь (Инвертированная Вертикаль) - + Mouse (Inverted Horizontal + Vertical) Мышь (Инвертированная Горизонталь + Вертикаль) - + Arrows Стрелки - + Keys: W | A | S | D Клавиши: W | A | S | D - + NumPad NumPad - + None Отсутствует - + Dpad Mode: Режим Крестовины: - + &Name: - + 4 Way Cardinal 4-х сторонний основной - + 4 Way Diagonal 4-х сторонний диагональный - + DPad Delay: - - + + Time lapsed before a direction change is taken into effect. - + s - + Specify the name of a dpad. Укажите имя для крестовины. - + Mouse Settings Настройки Мыши - + Standard Стандартный - + Standard: 8 region dpad with two direction buttons active when the dpad is in a diagonal region. @@ -1917,17 +1926,17 @@ to a diagonal zone. - + Eight Way 8-ми сторонний - + Set Установки для - + Set %1 Набор %1 @@ -1935,27 +1944,27 @@ to a diagonal zone. EditAllDefaultAutoProfileDialog - + Default Profile Профиль По-Умолчанию - + Profile: Профиль: - + Browse Обзор - + Open Config Открыть Конфигурацию - + Profile file path is invalid. Путь до профиля неверен. @@ -1963,29 +1972,29 @@ to a diagonal zone. ExtraProfileSettingsDialog - + Extra Profile Settings Дополнительные настройки профиля - + Key Press Time: Отклик Клавиш: - + 0.00 ms 0,00 мс - + Profile Name: Имя Профиля: - - - + + + s сек @@ -1993,7 +2002,7 @@ to a diagonal zone. GameController - + Game Controller Геймпад @@ -2001,9 +2010,9 @@ to a diagonal zone. GameControllerDPad - - - + + + DPad Крестовина @@ -2011,187 +2020,187 @@ to a diagonal zone. GameControllerMappingDialog - + Game Controller Mapping Настройка Игрового Контроллера - + <html><head/><body><p>antimicro makes use of the <a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;">Game Controller API</span></a> provided by SDL 2 in order to abstract various gamepads to fit a unified standard. In order to make a button assignment, please highlight the mapping cell for the appropriate button row below. You can then press a button or move an axis on your gamepad and the cell will update with the physical button or axis that will be used.</p><p>antimicro will use the mapping that you specify to save a mapping string that will be loaded into SDL.</p></body></html> - + A A - + B B - + X X - + Y Y - + Back Back - + Start Start - + Guide Guide - + Left Shoulder Левый Бампер - + Right Shoulder Правый Бампер - + Left Stick Click Кнопка Левого Стика - + Right Stick Click Кнопка Правого Стика - + Left Stick X Ось X Левого Стика - + Left Stick Y Ось Y Левого Стика - + Right Stick X Ось X Правого Стика - + Right Stick Y Ось Y Правого Стика - + Left Trigger Левый Триггер - + Right Trigger Правый Триггер - + DPad Up Крестовина Вверх - + DPad Left Крестовина Влево - + DPad Down Крестовина Вниз - + DPad Right Крестовина Вправо - + Mapping Настройка - + SDL 2 Game Controller Mapping String Вывод настройщика контроллеров SDL 2 - + Last Axis Event: - + Current Axis Detection Dead Zone: - + 5000 5000 - + 10000 10000 - + 15000 15000 - + 20000 20000 - + 25000 25000 - + 30000 30000 - + 32000 32000 - + Game Controller Mapping (%1) (#%2) - + Discard Controller Mapping? Сбросить настройки контроллера? - + Discard mapping for this controller? If discarded, the controller will be reverted to a joystick once you refresh all joysticks. @@ -2203,47 +2212,47 @@ If discarded, the controller will be reverted to a joystick once you refresh all GameControllerSet - + Back Back - + Guide Guide - + Start Start - + LS Click - + RS Click - + L Shoulder - + R Shoulder - + L Trigger - + R Trigger @@ -2251,9 +2260,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all GameControllerTrigger - - - + + + Trigger Триггер @@ -2261,9 +2270,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxis - - - + + + Axis Ось @@ -2271,24 +2280,24 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxisButton - + Negative Отрицательно - + Positive Положительно - + Unknown Неизвестно - - - + + + Button Кнопка @@ -2296,74 +2305,74 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxisContextMenu - + Mouse (Horizontal) Мышь (горизонталь) - + Mouse (Inverted Horizontal) - + Mouse (Vertical) Мышь (вертикаль) - + Mouse (Inverted Vertical) - + Arrows: Up | Down Стрелки: Вверх | Вниз - + Arrows: Left | Right Стрелки: Влево | Вправо - + Keys: W | S Клавиши: W | S - + Keys: A | D Клавиши: A | D - + NumPad: KP_8 | KP_2 NumPad: 8 | 2 - + NumPad: KP_4 | KP_6 NumPad: 4 | 6 - - + + None Отсутствует - - + + Mouse Settings - + Left Mouse Button - + Right Mouse Button @@ -2371,57 +2380,57 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButton - + Processing turbo for #%1 - %2 - + Finishing turbo for button #%1 - %2 - + Processing press for button #%1 - %2 - + Processing release for button #%1 - %2 - + Distance change for button #%1 - %2 - - - + + + Button Кнопка - - - - + + + + [NO KEY] [ПУСТО] - + [Set %1 1W] - + [Set %1 2W] - + [Set %1 WH] @@ -2429,47 +2438,47 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButtonContextMenu - + Toggle Переключатель - + Turbo Турбо - + Clear - + Set Select - + Disabled Отключено - + Set %1 - + Set %1 1W Набор %1 1W - + Set %1 2W Набор %1 2W - + Set %1 WH @@ -2477,118 +2486,118 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButtonSlot - - + + Mouse Мышь - + Up Вверх - + Down Вниз - + Left Влево - + Right Вправо - + LB LB - + MB MB - + RB RB - + B4 B4 - + B5 B5 - + Pause Пауза - + Hold Удерживание - + Cycle Цикл - + Distance Дистанция - + Release Отпускание - + Mouse Mod Скорость Мыши - + Press Time Время Нажатия - + Delay Задержка - + Load %1 - + Set Change %1 - + [Text] %1 - + [Exec] %1 - + [NO KEY] [ПУСТО] @@ -2596,9 +2605,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStick - - - + + + Stick Стик @@ -2606,37 +2615,37 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickButton - - - + + + Up Вверх - - - + + + Down Вниз - - - + + + Left Влево - - - + + + Right Вправо - - - + + + Button Кнопка @@ -2644,67 +2653,67 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickContextMenu - + Mouse (Normal) Мышь (Нормально) - + Mouse (Inverted Horizontal) - + Mouse (Inverted Vertical) - + Mouse (Inverted Horizontal + Vertical) - + Arrows Стрелки - + Keys: W | A | S | D Клавиши: W | A | S | D - + NumPad NumPad - + None Отсутствует - + Standard Стандартный - + Eight Way 8-ми сторонний - + 4 Way Cardinal 4-х сторонний основной - + 4 Way Diagonal 4-х сторонний диагональный - + Mouse Settings @@ -2712,86 +2721,86 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickEditDialog - + Dialog Окно - + X: Х: - - - - - + + + + + 0 0 - + Y: Y: - + Distance: Дистанция: - + Presets: Пресет: - + Mouse (Normal) Мышь (Нормально) - + Mouse (Inverted Horizontal) Мышь (инвертированная горизонталь) - + Mouse (Inverted Vertical) Мышь (инвертированная вертикаль) - + Mouse (Inverted Horizontal + Vertical) Мышь (инвертированная горизонталь + вертикаль) - + Arrows Стрелки - + Keys: W | A | S | D Клавиши: W | A | S | D - + NumPad NumPad - + None Отсутствует - + Stick Mode: Режим Стика: - + Standard: 8 region stick with two direction buttons active when the stick is in a diagonal region. @@ -2807,72 +2816,72 @@ to a diagonal zone of the stick. - + 4 Way Cardinal 4-х сторонний основной - + 4 Way Diagonal 4-х сторонний диагональный - - + + Dead zone value to use for an analog stick. - - + + Value when an analog stick is considered moved 100%. - - + + The area (in degrees) that each diagonal region occupies. - + Square Stick: - - + + Percentage to modify a square stick coordinates to confine values to a circle - + % % - + Stick Delay: - - + + Time lapsed before a direction change is taken into effect. - + s - + Modifier: - + Edit button that is active while the stick is active. This button is useful for assigning zones with @@ -2881,68 +2890,68 @@ functionality to an analog stick. - + PushButton - + Na&me: Name: Имя: - + Specify the name of an analog stick. Укажите имя для аналогового стика. - + Mouse Settings Настройки Мыши - + Standard Стандартный - + Bearing: Точка Опоры: - + % Safe Zone: % ограничения: - + Eight Way 8-ми сторонний - + Dead Zone: Мертвая Зона: - + Max Zone: Лимит: - + Diagonal Range: Диагональный диапазон: - + Set Установки для - + Set %1 Установки для %1 @@ -2950,9 +2959,9 @@ functionality to an analog stick. JoyControlStickModifierButton - - - + + + Modifier @@ -2960,9 +2969,9 @@ functionality to an analog stick. JoyDPad - - - + + + DPad Крестовина @@ -2970,37 +2979,37 @@ functionality to an analog stick. JoyDPadButton - - - + + + Up Вверх - - - + + + Down Вниз - - - + + + Left Влево - - - + + + Right Вправо - - - + + + Button Кнопка @@ -3008,266 +3017,271 @@ functionality to an analog stick. JoyTabWidget - - - - - - + + + + + + <New> <Новый> - - + + Remove Удалить - - + + Remove configuration from recent list. Удалить конфигурацию из списка недавно использованных файлов. - - + + Load Загрузить - - + + Load configuration file. Загрузить файл конфигурации. - - + + Save Сохранить - - + + Save changes to configuration file. Сохранить изменения в файл конфигурации. - - + + Save As Сохранить Как - - + + Save changes to a new configuration file. Сохранить изменения в новый файл конфигурации. - - + + Sets Наборы - + Copy from Set - + Settings Настройки - - + + Set 1 Набор 1 - - + + Set 2 Набор 2 - - + + Set 3 Набор 3 - - + + Set 4 Набор 4 - - + + Set 5 Набор 5 - - + + Set 6 Набор 6 - - + + Set 7 Набор 7 - - + + Set 8 Набор 8 - - + + Stick/Pad Assign Настройка Стиков/Крестровин - - + + Controller Mapping Настройка Контроллера - - + + Quick Set Быстрая Настройка - - + + Names Бирки - - + + Toggle button name displaying. Вкл. / Выкл. отображение названий команд на кнопках. - - + + Pref Настройки Профиля - - + + Change global profile settings. Изменить общие настройки профиля. - - - + + + Reset Сброс - - + + Revert changes to the configuration. Reload configuration file. Отменяет изменения конфигурации. Перезагружает конфигурационный файл. - + Open Config Открыть Конфигурацию - + Config Files (*.amgp *.xml) - - - + + + Config File (*.%1.amgp) - - + + Do you really want to reset buttons settings for joystick? + + + + + Save Profile Changes? Сохранить изменения в профиле? - - + + Changes to the new profile have not been saved. Would you like to save or discard the current profile? Изменения в новом профиле не были сохранены. Сохранить или отменить изменения в текущем профиле? - - + + Changes to the profile "%1" have not been saved. Would you like to save or discard changes to the current profile? Изменения в профиле "%1" не были сохранены. Сохранить или отменить изменения в текущем профиле? - + Sticks Стики - - + + DPads Крестовины - + No buttons have been assigned. Please use Quick Set to assign keys to buttons or disable hiding empty buttons. <center>Не было назначено ни одной кнопки. Воспользуйтесь "Быстрой Настройкой" <br>для назначения кнопок или отключите сокрытие пустых кнопок.</center> - - + + Set %1: %2 Набор %1: %2 - - + + Set %1 Набор %1 - + Copy Set Assignments Скопировать Набор Настроек - + Are you sure you want to copy the assignments and device properties from %1? Вы уверены что хотите скопировать настройки и параметры устройства из %1? - - - + + + Save Config Сохранить Конфигурацию - - + + Set Набор @@ -3275,7 +3289,7 @@ to buttons or disable hiding empty buttons. Joystick - + Joystick Геймпад @@ -3283,98 +3297,98 @@ to buttons or disable hiding empty buttons. JoystickStatusWindow - + Properties Свойства - + Details Детали - + Name: Имя: - - - - - - - + + + + + + + %1 %1 - + Number: Номер: - + Axes: Осей: - + Buttons: Кнопок: - + Hats: Мини-джойстиков: - + GUID: GUID: - + Game Controller: - + Axes Оси - + Buttons Кнопки - + Hats Мини-джойстики - + %1 (#%2) Properties %1 (#%2) Свойства - + Axis %1 Ось %1 - + Hat %1 Мини-джойстик %1 - + No - + Yes @@ -3382,62 +3396,67 @@ to buttons or disable hiding empty buttons. MainSettingsDialog - + Edit Settings Редактировать настройки - + General Общие - + Controller Mappings Настройки Контроллера - + Language Язык - + Auto Profile АвтоПрофиль - + Mouse Мышь - + Advanced - + + Profile Direc&tory: + + + + <html><head/><body><p>Specify the default directory that the program should use in file dialogs when loading a profile or saving a new profile.</p></body></html> <html><head/><body><p>Укажите путь до директории, которую программа будет использовать для хранения профилей.</p></body></html> - + Recent Profile Count: Количество недавних профилей: - + <html><head/><body><p>Number of profiles that can be placed in recent profile list. 0 will result in the program not enforcing a limit on the number of profiles displayed.</p></body></html> <html><head/><body><p>Количество профилей, которые будут хранится в списке недавних. Если выставить "0" то программа не будет ограничивать количество отображаемых профилей.</p></body></html> - + Gamepad Poll Rate: - + Change the poll rate that the program uses to discover new events from gamepads. Defaults to 10 ms. @@ -3447,52 +3466,52 @@ before using antimicro unattended. - + Hide main window when the main window close button is clicked instead of quitting the program. Прятать главное окно программы по нажатию на кнопку выхода вместо того чтобы закрывать программу. - + Close To Tray Сворачивать в трей - + Have Windows start antimicro at system startup. - + Launch At Windows Startup Загружать вместе с Windows - + Display recent profiles for all controllers as a single list in the tray menu. Defaults to using sub-menus. Отображает недавно открытые профили для всех контроллеров в виде единого списка под иконкой в трее. По-умолчанию использует подменю. - + Single Profile List in Tray Единый лист профилей в трее - + Have the program minimize to the taskbar. By default, the program minimizes to the system tray if available. Заставляет программу сворачиватся в панель задач. По-умолчанию программа сворачивается в системный трей. - + Minimize to Taskbar Сворачивать в панель задач - + This option will cause the program to hide all buttons that have no slots assigned to them. The Quick Set dialog window will have to be used @@ -3500,184 +3519,194 @@ to bring up the edit dialog for gamepad buttons. Эта опция заставит программу скрывать все кнопки, к которым не привязаны слоты с командами. Воспользуйтесь окном "Быстрой Настройки" для отображения скрытых кнопок. - + Hide Empty Buttons Скрыть пустые кнопки - + When the program is launched, open the last known profile that was opened during the previous session. Когда программа запустится, будет открыт последний профиль, использованный в предыдущей сессии. - + Auto Load Last Opened Profile Автоматически загружать последний открытый профиль - + Only show the system tray icon when the program first launches. При запуске программы появится лишь значок в системном трее. - + Launch in Tray Запускаться в свернутом виде - + Associate .amgp files with antimicro in Windows Explorer. - + Associate Profiles - + Key Repeat Повтор клавиш - + Active keys will be repeatedly pressed when this option is enabled. Если активировать данную опцию то активные клавиши будут нажиматься автоматически. - - + + Enable - + Specifies how much time should elapse before key repeating begins. - + Specifies how many times key presses will be performed per seconds. - + <html><head/><body><p>antimicro has been translated into many different languages by contributors. By default, the program will choose an appropriate translation based on your system's locale setting. However, you can make antimicro load a different translation depending on the language that you choose from the list below.</p></body></html> - + Português do Brasil - + Français - + Deutsch - + Italiano - + 日本語 - + Русский - + српски / srpski - + 简体中文 - + Español - + українська - + Polski - + + History Si&ze: + + + + Log File: - + Log Level: - + None Отсутствует - + Error - + Warning - + Info Информация - + Debug - + + Reset + Сброс + + + Class - + Title - + Program - + Disable the "Enhanced Pointer Precision" Windows setting while antimicro is running. Disabling "Enhanced Pointer Precision" will allow mouse movement within antimicro to be more @@ -3685,32 +3714,27 @@ precise. - + Disable Enhance Pointer Precision - + Smoothing - - Histor&y Size: - - - - + Weight &Modifier: - + Refresh Rate: - + The refresh rate is the amount of time that will elapse in between mouse events. Please be cautious when editing this setting as it will cause the program to use @@ -3720,46 +3744,46 @@ it unattended. - + Spring Пружина - + Screen: - + Utilize the specified screen for spring mode. On Linux, the default is to use the primary screen. On Windows, the default is to use all available screens. - + Accel Numerator: - - - + + + 0 0 - + Accel Denominator: - + Accel Threshold: - + If the acceleration values for the virtual mouse have been changed by a different process, particularly when quitting an older game, then you might want to reset the acceleration @@ -3767,37 +3791,32 @@ values used by the virtual mouse. - + Reset Acceleration - + Delay: Задержка: - - Profi&le Directory: - - - - + ms мс - + Rate: Частота: - + times/s раз/сек - + Below is a list of the custom mappings that have been saved. You can use the following table to delete mappings or have mappings temporarily disabled. You can also disable mappings that are included with SDL; just insert a new row with the appropriate joystick GUID and check disable. Settings will not take affect until you either refresh all joysticks or unplug that particular joystick. @@ -3806,34 +3825,34 @@ Settings will not take affect until you either refresh all joysticks or unplug t Изменения не вступят в силу пока вы не обновите или переподключите все геймпады. - + GUID GUID - + Mapping String Строка Настроек - + Disable? Отключить? - - + + Delete Удалить - + Insert Вставить - - + + Default По-умолчанию @@ -3842,7 +3861,7 @@ Settings will not take affect until you either refresh all joysticks or unplug t Бразильский / Португальский - + English Английский @@ -3851,198 +3870,208 @@ Settings will not take affect until you either refresh all joysticks or unplug t Немецкий - - + + Active Активировать - + Devices: Устройства: - - + + All Все - + Device Устройство - + Profile Профиль - + Default? По-умолчанию? - + Add Добавить - + Edit Редактировать - + Also, Windows users who want to use a low value should also check the "Disable Enhance Pointer Precision" checkbox if you haven't disabled the option in Windows. - + Select Default Profile Directory Выбрать как профиль по-умолчанию - + Are you sure you want to delete the profile? Вы уверены что хотите удалить этот профиль? - + Save Log File As - + Log Files (*.log) + + + Do you really want to reset setting? + + + + + Would you like to reset mappings too? + + MainWindow - + antimicro - + No Joysticks have been found. Please plug in a joystick and then choose the "Update Joysticks" option in the main menu Геймпады не обнаружены. Пожалуйста, подключите геймпад к компьютеру и выберете опцию "Обновить Геймпады" из главного меню. - + If events are not seen by a game, please click here to run this application as Administrator. - + &App &Приложение - + &Options &Опции - + &Help &Помощь - - + + &Quit &Выход - + Ctrl+Q Ctrl+Q - - + + &Update Joysticks &Обновить Геймпады - + Ctrl+U Ctrl+U - - + + &Hide &Скрыть - + Ctrl+H Ctrl+H - + &About &О программе - + Ctrl+A Ctrl+A - + About &Qt - + &Properties - + &Key Checker - + &GitHub Page - + &Game Controller Mapping - + S&ettings - + &Stick/Pad Assign - + &Wiki - + &Issues - + &Calibration @@ -4059,7 +4088,7 @@ the option in Windows. Проверка Клавиш - + Home Page Домашняя страница @@ -4080,66 +4109,66 @@ the option in Windows. Настройки Стиков / Крестовин - + Could not find a proper controller identifier. Exiting. - - - - - - - + + + + + + + (%1) (%1) - - + + Open File Открыть файл - + &Restore &Восстановить - + Calibration couldn't be opened - + You must connect at least one controller to open the window - + Run as Administrator? - + Are you sure that you want to run this program as Adminstrator? Some games run as Administrator which will cause events generated by antimicro to not be used by those games unless antimicro is also run as the Adminstrator. This is due to permission problems caused by User Account Control (UAC) options in Windows Vista and later. - + Failed to elevate program - + Failed to restart this program as the Administrator - + Could not find controller. Exiting. @@ -4147,12 +4176,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseAxisSettingsDialog - + Mouse Settings - Настройки Мыши - - + Set %1 Установки для %1 @@ -4160,12 +4189,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseButtonSettingsDialog - + Mouse Settings - Настройки Мыши - - + Set %1 Установки для %1 @@ -4173,12 +4202,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseControlStickSettingsDialog - + Mouse Settings Настройки Мыши - + Set %1 Установки для %1 @@ -4186,12 +4215,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseDPadSettingsDialog - + Mouse Settings Настройки Мыши - + Set %1 Установки для %1 @@ -4199,17 +4228,17 @@ Some games run as Administrator which will cause events generated by antimicro t MouseSettingsDialog - + Mouse Settings Настройки Мыши - + Mouse Mode: Режим Мыши: - + Cursor mode is used to move the mouse cursor around the screen relative to its current position depending on how much you move an axis @@ -4232,79 +4261,79 @@ axis is moved back to the dead zone. ось переместится обратно к мертвой зоне. - + Cursor Курсор - + Spring Пружина - + Acceleration: Усиление: - + Enhanced Precision Улучшенная Точность - - + + Linear Линейное - + Quadratic Квадратное - + Cubic Кубическое - + Quadratic Extreme Экстримально Кубическое - + Power Function Степенная Функция - + Easing Quadratic - + Easing Cubic - + Mouse Speed Settings Настройки скорости мыши - + Enable to change the horizontal and vertical speed boxes at the same time. Позволяет увеличивать скорость мыши по горизонтали и вертикали одновременно. - + Change Together Изменять совместно - + Options for adding more acceleration to the mouse movement beyond what the acceleration curve would produce. Acceleration is added based on how quickly an axis is @@ -4314,17 +4343,17 @@ using typical gamepad analog sticks. - + Delta Acceleration - + &Multiplier: - + Mi&n Threshold: @@ -4336,8 +4365,8 @@ Speed: горизонтали: - - + + 1 = 20 pps 1 = 20 pps @@ -4348,31 +4377,31 @@ Speed: вертикали: - + Wheel Hori. Speed: Скорость колесика по горизонтали: - + Set the speed used for horizontal mouse wheel movement according to number of simulated notches per second. Устанавливает скорость движения колесика мыши по горизонтали. - + Set the speed used for vertical mouse wheel movement according to number of simulated notches per second. Устанавливает скорость движения колесика мыши по вертикали. - + Sensitivit&y: - + For Power Function acceleration curve. Specifies the factor to use for curve sensitivity. When the value is above 1.0, the mouse movement will be accelerated @@ -4380,122 +4409,122 @@ faster at the low end of an axis. - + Easing Duration: - - + + s - + Highest value to accelerate mouse movement by - + x x - + Start %: - + Acceleration begins at this percentage of the base multiplier - + Minimum amount of axis travel required for acceleration to begin - + Max Threshold: - + Maximum axis travel before acceleration has reached the multiplier value - + E&xtra Duration: - + Curve: - + Ease Out Sine - + Ease Out Quad - + Ease Out Cubic - + Release Radius: - + Specifies that the spring area will be relative to the mouse position set by a non-relative spring. Привязывает пружину к позиции мыши. - + Relative Привязка - + Mouse Status - + X: Х: - - + + 0 (0 pps) - + Y: Y: - - + + 1 = 1 notch(es)/s 1 = 1 шаг(ов)/сек - + Enhanced: Three tier curve that makes the mouse move slow on the low end of an axis and fast on the high end. @@ -4517,19 +4546,19 @@ a period of time using a Cubic curve. - + Hori&zontal Speed: - + &Vertical Speed: - + Wheel Vert. Speed: Скорость колесика @@ -4540,59 +4569,59 @@ Speed: Чувствительность: - + Specifies the amount of time (in seconds) that will be required before the mouse is fully accelerated after reaching the high end of an axis. - - - - + + + + % % - + Extend the time that extra acceleration is applied. Axis travel will be taken into account. A slower flick will decrease the actual time that extra acceleration will be applied. - + Spring Settings Настройки Пружины - + Spring Width: Ширина Пружины: - + Changes the width of the region that the cursor can move in spring mode. 0 will use the entire width of your screen. Изменяет ширину области, по которой будет двигаться курсор в режиме Пружины. Если выставить "0" будет использоваться вся ширина экрана. - + Spring Height: Высота Пружины: - + Changes the height of the region that the cursor can move in spring mode. 0 will use the entire height of your screen. Изменяет высоту области, по которой будет двигаться курсор в режиме Пружины. Если выставить "0" будет использоваться вся высота экрана. - - + + %n notch(es)/s %n шаг/сек @@ -4604,39 +4633,39 @@ of your screen. QKeyDisplayDialog - + Key Checker Проверка Клавиш - - <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> + + <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="http://doc.qt.io/qt-5/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">http://doc.qt.io/qt-5/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> - + Event Handler: - + Native Key Value: Родное Значение Клавиши: - - - + + + 0x00000000 0x00000000 - + Qt Key Value: Значение Клавиши в Qt: - + antimicro Key Value: @@ -4644,265 +4673,265 @@ of your screen. QObject - + Super Super - + Menu Меню - + Mute - + Vol+ - + Vol- - + Play/Pause - + Play - + Pause Пауза - + Prev - + Next Next - + Mail - + Home Home - + Media - + Search - + Daemon launched Демон запущен - + Failed to launch daemon Не удалось запустить демон - + Launching daemon Демон запускается - - + + Display string "%1" is not valid. - + Failed to set a signature id for the daemon Не удалось подписать демон - + Failed to change working directory to / Не удалось менить рабочую директорию на "/" - + Quitting Program - + # of joysticks found: %1 - + List Joysticks: - + --------------- - + Joystick %1: - + Index: %1 - + GUID: %1 - + Name: %1 - + Yes - + No - + Game Controller: %1 - + # of Axes: %1 - + # of Buttons: %1 - + # of Hats: %1 - + Attempting to use fallback option %1 for event generation. - + Failed to open event generator. Exiting. - + Using %1 as the event generator. - + Could not raise process priority. - + Last button - + There isn't a last button pressed from gamepad in data. Did you set at least one button from gamepad for keyboard? - + Active window changed to: Title = "%1", Class = "%2", Program = "%3" or "%4". - + Profile location %1 is not an XML file. Профиль, находящийся в %1 не является XML файлом. - + Profile location %1 does not exist. Профиль, находящийся в %1 не существует. - - - + + + Controller identifier is not a valid value. Идентификатор контроллера имеет недопустимое значение. - + An invalid set number '%1' was specified. - + Controller identifier '%s'' is not a valid value. - + No set number was specified. Не указан набор значений. - + No controller was specified. - + No display string was specified. Не указана строка для отображения. - + An invalid event generator was specified. - + No event generator string was specified. - + No log file specified. @@ -4965,22 +4994,22 @@ of your screen. Запускать программу в качестве демона. - + Logging started - + Auto-switching to profile "%1". - + Auto-switching to nullptr profile! - + xinput version must be at least 2.0. No mouse acceleration changes will occur. @@ -4988,18 +5017,18 @@ of your screen. QuickSetDialog - + Quick Set Быстрая настройка - + <html><head/><body><p>Please press a button or move an axis on %1 (<span style=" font-weight:600;">%2</span>).<br/>A dialog window will then appear which will<br/>allow you to make an assignment.</p></body></html> <html><head/><body><p>Пожалуйста, нажмите кнопку или подвигайте стик на %1 (<span style=" font-weight:600;">%2</span>).<br/>Появится окно, которое позволит вам назначить кнопку.</p></body></html> - - + + Quick Set %1 Быстрая Настройка %1 @@ -5007,12 +5036,12 @@ of your screen. SetAxisThrottleDialog - + Throttle Change Смена Тяги - + The throttle setting for Axis %1 has been changed. Would you like to distribute this throttle change to all sets? @@ -5024,12 +5053,12 @@ Would you like to distribute this throttle change to all sets? SetJoystick - + Set %1: %2 Набор %1: %2 - + Set %1 Набор %1 @@ -5037,52 +5066,52 @@ Would you like to distribute this throttle change to all sets? SetNamesDialog - + Set Name Settings Установить имена для наборов - + Set 1 Набор 1 - + Set 2 Набор 2 - + Set 3 Набор 3 - + Set 4 Набор 4 - + Set 5 Набор 5 - + Set 6 Набор 6 - + Set 7 Набор 7 - + Set 8 Набор 8 - + Name Имя @@ -5090,7 +5119,7 @@ Would you like to distribute this throttle change to all sets? SimpleKeyGrabberButton - + Mouse Мышь @@ -5098,7 +5127,7 @@ Would you like to distribute this throttle change to all sets? SpringModeRegionPreview - + Spring Mode Preview Предпросмотр Режима Пружины @@ -5106,20 +5135,20 @@ Would you like to distribute this throttle change to all sets? UInputEventHandler - + Could not find a valid uinput device file. Please check that you have the uinput module loaded. lsmod | grep uinput - + Could not open uinput device file Please check that you have permission to write to the device - + Using uinput device file %1 @@ -5127,551 +5156,551 @@ Please check that you have permission to write to the device UInputHelper - + a a - + b b - + c c - + d d - + e e - + f f - + g g - + h h - + i i - + j j - + k k - + l l - + m m - + n n - + o o - + p p - + q q - + r r - + s сек - + t t - + u u - + v v - + w w - + x x - + y y - + z z - + Esc - + F1 F1 - + F2 F2 - + F3 F3 - + F4 F4 - + F5 F5 - + F6 F6 - + F7 F7 - + F8 F8 - + F9 F9 - + F10 F10 - + F11 F11 - + F12 F12 - + ` ` - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - - + + - - - + = = - + BackSpace BackSpace - + Tab Tab - + [ [ - + ] ] - + \ \ - + CapsLock - + ; ; - + ' ' - + Enter - + Shift_L Shift_L - + , , - - + + . . - - + + / / - + Ctrl_L - - + + Super_L Super_L - + Alt_L Alt_L - + Space Пробел - + Alt_R Alt_R - + Menu Меню - + Ctrl_R - + Shift_R Shift_R - + Up - + Left - + Down - + Right - + PrtSc - + Ins - + Del - + Home Home - + End End - + PgUp - + PgDn - + NumLock - + * * - + + + - + KP_Enter KP_Enter - + KP_1 KP_1 - + KP_2 KP_2 - + KP_3 KP_3 - + KP_4 KP_4 - + KP_5 KP_5 - + KP_6 KP_6 - + KP_7 KP_7 - + KP_8 KP_8 - + KP_9 KP_9 - + KP_0 KP_0 - + SCLK SCLK - + Pause Пауза - + Super_R - + Mute - + VolDn - + VolUp - + Play - + Stop - + Prev - + Next Next - + [NO KEY] [ПУСТО] @@ -5679,54 +5708,54 @@ Please check that you have permission to write to the device UnixWindowInfoDialog - + Captured Window Properties - + Information About Window - + Class: - - - + + + TextLabel - + Title: - + Path: - + Match By Properties - + Class - + Title - + Path @@ -5734,9 +5763,9 @@ Please check that you have permission to write to the device VDPad - - - + + + VDPad Виртуальная Крестовина @@ -5744,223 +5773,223 @@ Please check that you have permission to write to the device VirtualKeyPushButton - + Space Пробел - + Tab Tab - + Shift (L) Shift (Л) - + Shift (R) Shift (П) - + Ctrl (L) Ctrl (Л) - + Ctrl (R) Ctrl (П) - + Alt (L) Alt (Л) - - + + Alt (R) Alt (П) - + Alt Gr - + ` ` - + ~ ~ - - + + - - - + = = - + [ [ - + ] ] - + \ \ - + Caps Caps - + ; ; - + ' ' - + , , - - + + . . - - + + / / - + ESC ESC - + PRTSC PRTSC - + SCLK SCLK - + INS INS - + PGUP PGUP - + DEL DEL - + PGDN PGDN - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - + NUM LK NUM - - + + * * - + + + - + Enter @@ -5977,42 +6006,42 @@ E R - + < < - + : : - + Super (L) Super - + Menu Меню - + Up Вверх - + Down Вниз - + Left Влево - + Right Вправо @@ -6020,226 +6049,226 @@ R VirtualKeyboardMouseWidget - - + + Keyboard Клавиатура - - + + Mouse Мышь - + Mouse Settings Наcтройка Мыши - + Left Mouse Left - + Up Mouse Up - + Left Button Mouse Left Button - + Middle Button Mouse Middle Button - + Right Button Mouse Right Button - + Wheel Up Mouse Wheel Up - + Wheel Left Mouse Wheel Left - + Wheel Right Mouse Wheel Right - + Wheel Down Mouse Wheel Down - + Down Mouse Down - + Right Mouse Right - + Button 4 Mouse Button 4 - + Mouse 8 Mouse Mouse 8 - + Button 5 Mouse Button 5 - + Mouse 9 Mouse Mouse 9 - + NONE ПУСТО - - + + Last button - - + + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + Others - + Applications - + Browser Back - + Browser Favorites - + Browser Forward - + Browser Home - + Browser Refresh - + Browser Search - + Browser Stop - + Calc - + Email - + Media - + Media Next - + Media Play - + Media Previous - + Media Stop - + Search - + Volume Down - + Volume Mute - + Volume Up @@ -6247,7 +6276,7 @@ R VirtualMousePushButton - + INVALID ОШИБКА @@ -6255,28 +6284,28 @@ R WinAppProfileTimerDialog - - + + Capture Application Звхватить Приложение - + After pressing the "Capture Application" button, please select the application window that you want to have a profile associated with. The active application will be captured after the selected number of seconds. После нажатия на кнопку "Захватить Приложение" кликните по приложению с которым хотите ассоциировать данный профиль. Активное приложение будет захвачено после выбранного количества секунд. - + Timer: Таймер: - + Seconds Секунды - + Cancel Отмена @@ -6284,12 +6313,12 @@ R WinExtras - + [NO KEY] [ПУСТО] - + AntiMicro Profile @@ -6297,67 +6326,62 @@ R X11Extras - + ESC ESC - + Tab Tab - + Space Пробел - + DEL DEL - + Return Return - + KP_Enter KP_Enter - + Backspace Backspace - + Alt Gr - + xinput extension was not found. No mouse acceleration changes will occur. - + xinput version must be at least 2.0. No mouse acceleration changes will occur. - - Virtual pointer found with id=%1. - - - - + PtrFeedbackClass was not found for virtual pointer.No change to mouse acceleration will occur for device with id=%1 - + Changing mouse acceleration for device with id=%1 @@ -6365,7 +6389,7 @@ R XMLConfigReader - + Could not write updated profile XML to file %1. @@ -6373,7 +6397,7 @@ R XMLConfigWriter - + Could not write to profile at %1. @@ -6381,7 +6405,7 @@ R antimicro - + Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support. @@ -6389,97 +6413,97 @@ R main - + Launch program in system tray only. Запускать программу только в системном трее. - + Launch program with the tray menu disabled - + Launch program without the main window displayed - + Launch program with the configuration file selected as the default for selected controllers. Defaults to all controllers - + location - + Apply configuration file to a specific controller. Value can be a controller index, name, or GUID - + value - + Unload currently enabled profile(s) - + value(s) - + Start joysticks on a specific set. Value can be a controller index, name, or GUID - + number value - + Launch program as a daemon. Use only on Linux. - + Enable logging - + log-type - + Choose a file for logs writing - + filename - + Choose between using XTest support and uinput support for event generation. Use only if you have enabled xtest and uinput options on Linux or vmulti on Windows. Default: xtest. - + event-generation-type - + Print information about joysticks detected by SDL. Use only if you have sdl library. You can check your controller index, name or even GUID. diff --git a/share/antimicro/translations/antimicro_sr.ts b/share/antimicro/translations/antimicro_sr.ts old mode 100644 new mode 100755 index 29b0e7915..d8f794b67 --- a/share/antimicro/translations/antimicro_sr.ts +++ b/share/antimicro/translations/antimicro_sr.ts @@ -4,17 +4,17 @@ AboutDialog - + About О програму - + Version Издање - + "juliagoda" (since March, 2018) Wanting only to play my favourite old games that din't support gamepads, I found this project (which map keyboard keys and mouse buttons to connected gamepads on Linux) as most proper and recent. But because of poor choices of such application on the internet and since it didn't compile properly, I decided to rescue the project. However, once I finished my work (enough to enjoy playing games) I thought about sharing this code with others. Of course all informations about past programmers will be held. "Ryochan7" (since December 30, 2012 until 2017), I have been working on antimicro in my spare time. What originally started as a fork of QJoyPad and a way to learn proper event-driven programming has turned into something much bigger than I originally intended. Although I have spent a lot of time learning new techniques, finding out more about the domain of KB+M emulation, and spending Friday nights bashing my head against my keyboard, it has been a fun and enriching experience overall. @@ -32,17 +32,17 @@ As of May 24, 2016, this project has moved to https://github.com/AntiMicro/antim - + Copyright: 2013 - 2018 Ауторска права: 2013 - 2018. {2013 ?} {2013 ?} - + Info Подаци - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -86,7 +86,7 @@ p, li { white-space: pre-wrap; } - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -204,7 +204,7 @@ p, li { white-space: pre-wrap; } - + Changelog Дневник измена @@ -229,52 +229,52 @@ Once the Steam controller is finally released to the public, the need for this p Овај се програм, највероватније, неће даље развијати, када се званично појави програм Стим-контролер. Управо заснован на идеји самог контролера, Стим-контролер ће имати толико предности у односу на друге програме који обезбеђују симулацију тастатуре и миша. - + Credits Заслуге - + antimicro Анти-микро - + About Development О развоју програма - + License Лиценца - + Program Version %1 Издање програма %1 - + Program Compiled on %1 at %2 Програмски код је превођен дана %1 у %2 - + Built Against SDL %1 Изграђен помоћу СДЛ %1 - + Running With SDL %1 Употребљава СДЛ %1 - + Using Qt %1 Уз КјуТ-библиотеке %1 - + Using Event Handler: %1 Употребљава руковаоца догађајима („Event Handler“) : %1 @@ -282,29 +282,29 @@ Once the Steam controller is finally released to the public, the need for this p AddEditAutoProfileDialog - + Auto Profile Dialog Самостално профилисање - + Profile: Профил: - - + + Browse Разгледај - + Window: Прозор: - - + + Select Window. Click on the appropriate application window and the application file path will be populated in the form. @@ -313,38 +313,47 @@ in the form. програма. - + Detect Window Properties Сам откриј особине прозора - + Class: Класа: - + Title: Наслов: - + + set partial title + + + + Application: Програм: - + Select Одабери - + + De&vices: + + + Devices: - Уређаји: + Уређаји: - - + + Select this profile to be the default loaded for the specified device. The selection will be used instead of the all default profile option. @@ -353,84 +362,84 @@ of the all default profile option. уместо свеопштих опција профила. - + Set as Default for Controller Постави као подразумевано за контролер - - + + A different profile is already selected as the default for this device. За овај уређај је већ одабран други подразумевани профил. - + Current (%1) Текући (%1) - + Open Config Отвори подешавања - - + + Select Program Одабери програм - + Programs (*.exe) Програми (*.exe) - + Please use the main default profile selection. Користите главни избор подразумеваног профила. - + Please select a window by using the mouse. Press Escape if you want to cancel. Одабирајте прозор употребом миша, а поништите одабир тастером <Esc>. - + Capture Application Window Разоткривање графичког сучеља програма - + Could not obtain information for the selected window. Не могу да добавим податке о одабраном прозору. - + Application Capture Failed Није успело разоткривање програма - + Profile file path is invalid. Путања до датотеке профила није ваљана. - + No window matching property was specified. Није била одређена одговарајућа особина прозора. - + Program path is invalid or not executable. Путања до програма није ваљана или није извршна. - + File is not an .exe file. Ово није извршна датотека. - + No window matching property was selected. Није била одабрана одговарајућа особина прозора. @@ -438,187 +447,187 @@ of the all default profile option. AdvanceButtonDialog - - + + Advanced Напредно - + Assignments Придруживања - + Toggle Преклопник - + Turbo Набуџи - + Set Selector Изборник скупа - + Blank or KB/M Празно или „Таст./Миш“ - + Hold Држи - + Pause Пауза - + Cycle Врти - + Distance Раздаљина - + Insert Уметни - + Delete Уклони - + Clear All Уклони све - + Time: Време: - + 0.01s 0,01 сек - + 0s 0 сек - + Insert a pause that occurs in between key presses. Време између притиска два притиска дугмета. - + Release Пусти - - + + Insert a new blank slot. Унеси нов, празан слот. - + Delete a slot. Уклони слот. - + Clear all currently assigned slots. Уклони све већ придружене слотове. - + Specify the duration of an inserted Pause or Hold slot. Одређивање трајања за већ унет Пауза/Држи слот. - + 0m 0 мин - + &Mouse Speed Mod: - - + + Specify the range past an axis dead zone in which a sequence of actions will execute. Поставите област изван мртве области правца, у којој ће се извршити низ радњи. - + Distance: Раздаљина: - - + + % % - + Mouse Mod Мишар - + Press Time Трајање притиска - + Delay Кашњење - + Execute Изврши - + Load Учитај - + Set Change Измени скуп - + Text Entry Унос текста - + Placeholder Препознавач положаја - - + + 0 0 @@ -627,317 +636,317 @@ of the all default profile option. Брзина Мишара: - + Set the percentage that mouse speeds will be modified by. Поставите промену брзине померања миша у процентима. - + Auto Reset Cycle After Самопоништавање „вртње“ након - + seconds секунди - + Executable: - + ... ... - + Arguments: - - - + + + Enabled Омогућено - + Mode: Режим: - + <html><head/><body><p>Normal: Repeatedly press and release a button by the chosen rate.</p><p>Gradient: Modify the button press and button release delay based on how far an axis has been moved. The rate will remain the same.</p><p>Pulse: Modify how many times a button is pressed and released per second. The button delay will remain the same.</p></body></html> <html><head/><body><p>Обично: Узастопно притискање-пуштање дугмета одабраном брзином.</p><p>Постепено: Измена кашњења код притиска-пуштања дугмета засновано на померају осног растојањ. Брзина остаје неизмењена.</p><p>Импулсно: Измена броја притисака-пуштања дугмета по секунди. Кашњење остаје неизмењено.</p></body></html> - + Normal Обично - + Gradient Постепено - + Pulse Импулсно - + Delay: Кашњење: - + 0.10s 0,10 сек - + Rate: Брзина: - + 10.0/s 10,0/сек - - + + Disabled Онемогућено - + Select Set 1 One Way Изабери 1. скуп, једносмерно - + Select Set 1 Two Way Изабери 1. скуп, двосмерно - + Select Set 1 While Held Изабери 1. скуп, док држим - + Select Set 2 One Way Изабери 2. скуп, једносмерно - + Select Set 2 Two Way Изабери 2. скуп, двосмерно - + Select Set 2 While Held Изабери 2. скуп, док држим - + Select Set 3 One Way Изабери 3. скуп, једносмерно - + Select Set 3 Two Way Изабери 3. скуп, двосмерно - + Select Set 3 While Held Изабери 3. скуп, док држим - + Select Set 4 One Way Изабери 4. скуп, једносмерно - + Select Set 4 Two Way Изабери 4. скуп, двосмерно - + Select Set 4 While Held Изабери 4. скуп, док држим - + Select Set 5 One Way Изабери 5. скуп, једносмерно - + Select Set 5 Two Way Изабери 5. скуп, двосмерно - + Select Set 5 While Held Изабери 5. скуп, док држим - + Select Set 6 One Way Изабери 6. скуп, једносмерно - + Select Set 6 Two Way Изабери 6. скуп, двосмерно - + Select Set 6 While Held Изабери 6. скуп, док држим - + Select Set 7 One Way Изабери 7. скуп, једносмерно - + Select Set 7 Two Way Изабери 7. скуп, двосмерно - + Select Set 7 While Held Изабери 7. скуп, док држим - + Select Set 8 One Way Изабери 8. скуп, једносмерно - + Select Set 8 Two Way Изабери 8. скуп, двосмерно - + Select Set 8 While Held Изабери 8. скуп, док држим - + sec. сек. - + /sec. /сек. - + Set %1 Скуп %1 - - + + Select Set %1 Одабери %1. скуп - + One Way Једносмерно - + Two Way Двосмерно - + While Held Док држим - + Choose Executable Избор извршне датотеке - + Slots past a Cycle action will be executed on the next button press. Multiple cycles can be added in order to create partitions in a sequence. Слотови изван „вртње“ ће се извршити по наредном притиску тастера. Вишеструке „вртње“ се могу додавати код стварање делова једног низа. - + Delays the time that the next slot is activated by the time specified. Slots activated before the delay will remain active after the delay time has passed. Покретање наредног слота биће одложено за наведено време.Слотови покренути пре овог одлагања ће остати покренути и по његовом истеку. - + Distance action specifies that the slots afterwards will only be executed when an axis is moved a certain range past the designated dead zone. Овом се радњом одређује да накнадни слотови могу да се изврше само када се нека оса помери за одређени опсег изван дате мртве области. - + Insert a hold action. Slots after the action will only be executed if the button is held past the interval specified. Уметање задржавања. Слотови након дате радње ће да се изврше само ако се тастер задржи ван наведеног периода. - + Chose a profile to load when this slot is activated. Одабир профила који ће се учитати по укључењу овог слота. - + Mouse mod action will modify all mouse speed settings by a specified percentage while the action is being processed. This can be useful for slowing down the mouse while sniping. Радња за управљањем начином рада миша ће изменити све поставке брзине миша за одређен проценат,а док је радња у току. Ово може бити корисно за успоравање миша при нишањењу. - + Specify the time that keys past this slot should be held down. Одређује колико ће дуго бити задржани у доњем положају (притиснути) тастери ван овог слота. - + Insert a release action. Slots after the action will only be executed after a button release if the button was held past the interval specified. Уметање отпуштања. Слотови након дате радње ће да се изврше само по отпуштању тастера ако је он задржан ван наведеног периода. - + Change to selected set once slot is activated. Промени на одабрани скуп по отпочињању слота. - + Full string will be typed when a slot is activated. Уписује пуну ниску знакова по отпочињању слота. - + Execute program when slot is activated. Извршава програм по отпочињању слота. - - + + Choose Profile Одабир профила - + Config Files (*.amgp *.xml) Датотеке подешавања (*.amgp *.xml) @@ -945,159 +954,159 @@ of the all default profile option. AdvanceStickAssignmentDialog - + Stick/Pad Assignment Придружвање Управљача/Тастера - + Sticks Управљачи - + DPads Тастери правца или смера (дирекционални) Д-тастери - - + + %1 (Joystick %2) %1 (Џојстик %2) - + Stick 1 Управљач 1 - - - + + + Enabled Омогућен - - - - - - + + + + + + Assign Придружи - - + + X Axis: »X« правац: - - + + Y Axis: »Y« правац: - + Stick 2 Управљач 2 - + Number of Physical DPads: %1 Број стварних Д-тастера: %1 - + Virtual DPad 1 Патворено = Виртуелно Патворен Д-тастатер 1 - + Up: Горе: - + Down: Доле: - + Note: This window is meant for backwards compatibility with profiles made before antimicro 2.0. Since version 2.0, use of the Game Controller Mapping window is preferred. Обавештење: Ово прозорче још увек постоји само због усаглашености са ранијим издањима програма (пре издања 2.0). Придруживач тастера контролера се препоручује од издања 2.0. - + Left: Лево: - + Right: Десно: - - - - + + + + Axis %1 Правац %1 - - - - + + + + Axis %1 - Правац %1 - - - - - + + + + Axis %1 + Правац %1 + - - - - + + + + Button %1 Дугме %1 - + Move stick 1 along the X axis Померајте по »Х-оси« 1. управљач - + Move stick 1 along the Y axis Померајте по »У-оси« 1. управљач - + Move stick 2 along the X axis Померајте по »Х-оси« 2. управљач - + Move stick 2 along the Y axis Померајте по »У-оси« 2. управљач - - - - + + + + Press a button or move an axis Притисните тастер или померите управљач @@ -1105,181 +1114,181 @@ of the all default profile option. AxisEditDialog - + Axis Правац - - + + Mouse (Horizontal) Миш (водоравно) - - + + Mouse (Inverted Horizontal) Миш (обрнуто водоравно) - - + + Mouse (Vertical) Миш (усправно) - - + + Mouse (Inverted Vertical) Миш (обрнуто усправно) - - + + Arrows: Up | Down Стрелице: Горе | Доле - - + + Arrows: Left | Right Стрелице: Лево | Десно - - + + Keys: W | S Тастери: Њ | С - - + + Keys: A | D Тастери: А | Д - - + + NumPad: KP_8 | KP_2 Број.Тастатура: КП_8 | КП_2 - - + + NumPad: KP_4 | KP_6 Број.Тастатура: КП_4 | КП_6 - - - + + + None Ништа - - + + Set the value to use as the limit for an axis. Useful for a worn out analog stick. Постави ову вредност као граничну за правац. Употребљиво у раду са истрошеним аналогним управљачем. - + Negative Half Throttle Полу-регулатор умањења - + Positive Half Throttle Полу-регулатор увећавања - + Name: Назив: - + Specify the name of an axis. Одредите Назив осе(правца). - + Mouse Settings Поставке миша - - + + Set the value of the dead zone for an axis. Подеси вредност мртве области за правaц. - + Presets: Поставке: - + Dead Zone: Мртва област: - + Max Zone: Највиша област: - - + + [NO KEY] [Без тастера] - + Throttle setting that determines the behavior of how to interpret an axis hold or release. Поставке регулатора које одређују понашање при тумачењу држи („hold“) или пусти („release“) за правац. - + Negative Throttle Регулатор умањења - + Normal Нормално - + Positive Throttle Регулатор увећавања - + Current Value: Текућа вредност: - + Set Постави - + Set %1 Скуп %1 - + Left Mouse Button Леви тастер миша - + Right Mouse Button Десни тастер миша @@ -1287,40 +1296,40 @@ interpret an axis hold or release. ButtonEditDialog - + Dialog Прозорче - + To make a new assignment, press any keyboard key or click a button in the Keyboard or Mouse tab Да би сте створили ново придруживање, притисните неко од дугмади тастатуре или кликните мишем на неко дугме у неком од језичака „Тастатура“ или „Миш“ - + Placeholder Препознавач положаја - + Toggle Преклопник - + Enables a key press or release to only occur when a controller button is pressed. Омогућава да се догоди дугме „притисни“ или „пусти“, и то, само ако је дугме контролера притиснуто. - + Enables rapid key presses and releases. Turbo controller. Омогућава хитрије дугме „притисни“ или дугме „пусти“. Контролер набуџивања. - + Turbo Набуџи @@ -1329,39 +1338,39 @@ interpret an axis hold or release. Тренутно стање: - + Last keyboard/mouse button: - + Slots Слотови - + Na&me: Назив: - + Specify the name of a button. Унесите назив за дугме. - + Action: Радња: - + Specify the action that will be performed in game while this button is being used. Одредите радњу која ће се извршавати при употреби овог дугмета. - + Advanced Напредно @@ -1374,52 +1383,52 @@ this button is being used. Скуп %1 - - - + + + Choose your keyboard key - + No button - - - - + + + + Last button - + To change settings for last button, it must be at least one assignment from keyboard to gamepad - + To change settings of turbo for last button, it must be at least one assignment from keyboard to gamepad - + To open advanced dialog, it's needed to map at least one button from keyboard to gamepad - + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + As last gamepad button has been set - + Index %1 @@ -1427,190 +1436,190 @@ this button is being used. Calibration - + Form - - + + Start calibration - + Controller: - + Sticks: - - Use settings from jstest-gtk - - - - + Reset settings - + Cancel Поништи - - + + Save Сачувај - - + + Calibration - - Do you really want to reset settings of current axes? + + Do you really want to reset settings of current axis? - + Calibration was saved for the preset. Do you really want to reset settings? - + Place the joystick in the center position. It's the part, where often you don't have to move. Just skip it in such situation. - + Calibrating center - + Start second step - + Center X: %1 - + Center Y: %1 - + Place the joystick in the top-left corner many times - - + + Calibrating position - - + + X: %1 - - + + Y: %1 - + Place the joystick in the bottom-right corner - + Start final step - + range X: %1 - %2 - + range Y: %1 - %2 - + deadzone X: %1 - + deadzone Y: %1 - + ---Calibration done!--- - + Calibration values have been saved - - + + Dead zone calibration - - You must move X axis to the right at least five times! Keep moving! + + You have to move axes to the top-left corner at least five times. - - You must move X axis to the left at least five times! Keep moving! + + You have to move axes to the bottom-right corner at least five times. - - - - + + Do you want to save calibration of current axis? + + + + + + + Axis %1 Правац %1 @@ -1618,64 +1627,64 @@ deadzone Y: %1 CapturedWindowInfoDialog - + Captured Window Properties Особине откривеног прозора - + Information About Window Подаци о прозору - + Class: Класа: - - - + + + TextLabel Текст-натпис - + Title: Наслов: - + Path: Путања: - + Match By Properties Прилагоди по - + Class класи - + Title наслову - + Path путањи - + Full Path Пуна путања - + File Name Назив датотеке @@ -1826,67 +1835,67 @@ deadzone Y: %1 DPadContextMenu - + Mouse (Normal) Миш (обично) - + Mouse (Inverted Horizontal) Миш (обрнуто водоравно) - + Mouse (Inverted Vertical) Миш (обрнуто усправно) - + Mouse (Inverted Horizontal + Vertical) Миш (обрнуто водоравно и усправно) - + Arrows Стрелице - + Keys: W | A | S | D Тастери: Њ | А | С | Д - + NumPad Број.тастатура - + None Ништа - + Standard Уобичајено - + Eight Way Осмосмерно - + 4 Way Cardinal Уобичајено четворосмерно - + 4 Way Diagonal Четворосмерно-дијагонално - + Mouse Settings Поставке миша @@ -1894,108 +1903,108 @@ deadzone Y: %1 DPadEditDialog - + Dialog Прозорче - + Presets: Поставке: - + Mouse (Normal) Миш (нормално) - + Mouse (Inverted Horizontal) Миш (обрнуто водоравно) - + Mouse (Inverted Vertical) Миш (обрнуто усправно) - + Mouse (Inverted Horizontal + Vertical) Миш (обрнуто водоравно и усправно) - + Arrows Стрелице - + Keys: W | A | S | D Тастери: Њ | А | С | Д - + NumPad Бројчана тастатура - + None Ништа - + Dpad Mode: Употреба Д-тастера: - + &Name: - + 4 Way Cardinal Уобичајено четворосмерно - + 4 Way Diagonal Четворосмерно-дијагонално - + DPad Delay: Д-тастери — кашњење: - - + + Time lapsed before a direction change is taken into effect. Кашњење пре но промена смера приметно наступи. - + s с - + Specify the name of a dpad. Унесите назив за Д-тастер. - + Mouse Settings Поставке миша - + Standard Уобичајено - + Standard: 8 region dpad with two direction buttons active when the dpad is in a diagonal region. @@ -2011,17 +2020,17 @@ to a diagonal zone. - + Eight Way Осмосмерно - + Set Подеси - + Set %1 Скуп %1 @@ -2029,27 +2038,27 @@ to a diagonal zone. EditAllDefaultAutoProfileDialog - + Default Profile Подразумеван профил - + Profile: Профил: - + Browse Разгледај - + Open Config Отвори подешавања - + Profile file path is invalid. Путања до датотеке профила није ваљана. @@ -2057,29 +2066,29 @@ to a diagonal zone. ExtraProfileSettingsDialog - + Extra Profile Settings Додатна подешавања профила - + Key Press Time: Време притиска тастера: - + 0.00 ms 0.00 мс - + Profile Name: Назив профила: - - - + + + s сек. @@ -2087,7 +2096,7 @@ to a diagonal zone. GameController - + Game Controller Контролер програма @@ -2095,9 +2104,9 @@ to a diagonal zone. GameControllerDPad - - - + + + DPad Д-тастер @@ -2105,187 +2114,187 @@ to a diagonal zone. GameControllerMappingDialog - + Game Controller Mapping Придруживач тастера контролера - + <html><head/><body><p>antimicro makes use of the <a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;">Game Controller API</span></a> provided by SDL 2 in order to abstract various gamepads to fit a unified standard. In order to make a button assignment, please highlight the mapping cell for the appropriate button row below. You can then press a button or move an axis on your gamepad and the cell will update with the physical button or axis that will be used.</p><p>antimicro will use the mapping that you specify to save a mapping string that will be loaded into SDL.</p></body></html> <html><head/><body><p>Да би се у већини програма различити контролери (гејмпедови) употребљавали на јединствен начин програм Анти-микро употребљава програмско сучеље дефинисано у пројекту СДЛ издања2, а названо „Гејм-контролер АПИ“ (енг. <a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;">„Game Controller API“</span></a>). За придруживање тастера одаберите поље за придруживање у реду одговарајућег тастера, а након тога притисните неки тастер на гејмпеду или померите ручицу управљача правца на њему. У пољу за придруживање ће се појавити подаци стварног (физичког) тастера или ручице управљача који ће се употребљавати.</p><p>Анти-микро ће да употреби ова придруживања за чување знаковних ниски придруживања које се могу учитавати помоћу СДЛ програма.</p></body></html> - + A 3 - + B 2 - + X 4 - + Y 1 - + Back Назад - + Start Почни - + Guide Водич - + Left Shoulder Леви окидач 1 - + Right Shoulder Десни окидач 1 - + Left Stick Click Притисак на леви управљач - + Right Stick Click Притисак на десни управљач - + Left Stick X Леви управљач — водоравно - + Left Stick Y Леви управљач — усправно - + Right Stick X Десни управљач — водоравно - + Right Stick Y Десни управљач — усправно - + Left Trigger Леви окидач 2 - + Right Trigger Десни окидач 2 - + DPad Up Д-тастер — Горе - + DPad Left Д-тастер — Лево - + DPad Down Д-тастер — Доле - + DPad Right Д-тастер — Десно - + Mapping Придруживања - + SDL 2 Game Controller Mapping String СДЛ-2 ниска придруживања тастера контролера - + Last Axis Event: Задњи догађај на правцу: - + Current Axis Detection Dead Zone: Откривање мртве области текућег правца: - + 5000 5000 - + 10000 10000 - + 15000 15000 - + 20000 20000 - + 25000 25000 - + 30000 30000 - + 32000 32000 - + Game Controller Mapping (%1) (#%2) Придруживач тастера контролера (%1) (#%2) - + Discard Controller Mapping? Поништавање придруживања контролера? - + Discard mapping for this controller? If discarded, the controller will be reverted to a joystick once you refresh all joysticks. @@ -2297,47 +2306,47 @@ If discarded, the controller will be reverted to a joystick once you refresh all GameControllerSet - + Back Назад - + Guide Водич - + Start Почни - + LS Click Притисак 1. левог окидача - + RS Click Притисак 1. десног окидача - + L Shoulder 1. леви окидач - + R Shoulder 1. десни окидач - + L Trigger 2. леви окидач - + R Trigger 2. десни окидач @@ -2345,9 +2354,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all GameControllerTrigger - - - + + + Trigger Окидач @@ -2355,9 +2364,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxis - - - + + + Axis Правац @@ -2365,24 +2374,24 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxisButton - + Negative Умањи - + Positive Увећај - + Unknown Непознато - - - + + + Button Дугме @@ -2390,74 +2399,74 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxisContextMenu - + Mouse (Horizontal) Миш (водоравно) - + Mouse (Inverted Horizontal) Миш (обрнуто водоравно) - + Mouse (Vertical) Миш (усправно) - + Mouse (Inverted Vertical) Миш (обрнуто усправно) - + Arrows: Up | Down Стрелице: Горе | Доле - + Arrows: Left | Right Стрелице: Лево | Десно - + Keys: W | S Тастери: Њ | С - + Keys: A | D Тастери: А | Д - + NumPad: KP_8 | KP_2 Број.Тастатура: КП_8 | КП_2 - + NumPad: KP_4 | KP_6 Број.Тастатура: КП_4 | КП_6 - - + + None Ништа - - + + Mouse Settings Поставке миша - + Left Mouse Button Леви тастер миша - + Right Mouse Button Десни тастер миша @@ -2465,57 +2474,57 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButton - + Processing turbo for #%1 - %2 Буџим за #%1 - %2 - + Finishing turbo for button #%1 - %2 Завршено набуџивање тастера #%1 - %2 - + Processing press for button #%1 - %2 Притискам за тастер #%1 - %2 - + Processing release for button #%1 - %2 Отпуштам за тастер #%1 - %2 - + Distance change for button #%1 - %2 Промена раздаљине за тастер #%1 - %2 - - - + + + Button Тастер - - - - + + + + [NO KEY] [Без тастера] - + [Set %1 1W] [Скуп %1 1-смерно] - + [Set %1 2W] [Скуп %1 2-смерно] - + [Set %1 WH] [Скуп %1 WH] @@ -2523,47 +2532,47 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButtonContextMenu - + Toggle Преклопи - + Turbo Набуџи - + Clear Очисти - + Set Select Одабир скупа - + Disabled Онемогућено - + Set %1 Скуп %1 - + Set %1 1W Скуп %1 1-смерно - + Set %1 2W Скуп %1 2-смерно - + Set %1 WH Скуп %1 WH @@ -2571,118 +2580,118 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButtonSlot - - + + Mouse Миш - + Up Напред - + Down Назад - + Left Лево - + Right Десно - + LB Л.дугме - + MB С.дугме - + RB Д.дугме - + B4 Дугме 4 - + B5 Дугме 5 - + Pause Пауза - + Hold Држи - + Cycle Врти - + Distance Раздаљина - + Release Пусти - + Mouse Mod Мишар - + Press Time Трајање притиска - + Delay Кашњење - + Load %1 Учитај %1 - + Set Change %1 Измена скупа %1 - + [Text] %1 [Текст] %1 - + [Exec] %1 [Извршавам] %1 - + [NO KEY] [Без тастера] @@ -2690,9 +2699,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStick - - - + + + Stick Управљач @@ -2700,37 +2709,37 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickButton - - - + + + Up Напред - - - + + + Down Назад - - - + + + Left Лево - - - + + + Right Десно - - - + + + Button Дугме @@ -2738,67 +2747,67 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickContextMenu - + Mouse (Normal) Миш (обично) - + Mouse (Inverted Horizontal) Миш (обрнуто водоравно) - + Mouse (Inverted Vertical) Миш (обрнуто усправно) - + Mouse (Inverted Horizontal + Vertical) Миш (обрнуто водоравно и усправно) - + Arrows Стрелице - + Keys: W | A | S | D Тастери: Њ | А | С | Д - + NumPad Број.тастатура - + None Ништа - + Standard Уобичајено - + Eight Way Осмосмерно - + 4 Way Cardinal Уобичајено четворосмерно - + 4 Way Diagonal Четворосмерно-дијагонално - + Mouse Settings Поставке миша @@ -2806,86 +2815,86 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickEditDialog - + Dialog Прозорче - + X: X: - - - - - + + + + + 0 0 - + Y: Y: - + Distance: Раздаљина: - + Presets: Поставке: - + Mouse (Normal) Миш (обично) - + Mouse (Inverted Horizontal) Миш (обрнуто водоравно) - + Mouse (Inverted Vertical) Миш (обрнуто усправно) - + Mouse (Inverted Horizontal + Vertical) Миш (обрнуто водоравно и усправно) - + Arrows Стрелице - + Keys: W | A | S | D Тастери: Њ | А | С | Д - + NumPad Бројчана тастатура - + None Ништа - + Stick Mode: Начин рада управљача: - + Standard: 8 region stick with two direction buttons active when the stick is in a diagonal region. @@ -2912,72 +2921,72 @@ to a diagonal zone of the stick. област одговара дијагоналној области датог управљача. - + 4 Way Cardinal Уобичајено четворосмерно - + 4 Way Diagonal Четворосмерно-дијагонално - - + + Dead zone value to use for an analog stick. Вредност мртве области код аналогних управљача. - - + + Value when an analog stick is considered moved 100%. Вредност у којој је аналогни управљач у крајњем положају. - - + + The area (in degrees) that each diagonal region occupies. Област (у степенима) коју свака област на дијагонали заузима. - + Square Stick: Четвртаст управљач: - - + + Percentage to modify a square stick coordinates to confine values to a circle Постотак промене квадратних координата управљача за ограничавање вредности у кружници - + % % - + Stick Delay: Кашњење управљача: - - + + Time lapsed before a direction change is taken into effect. Кашњење пре но промена смера приметно наступи. - + s с - + Modifier: Измењивач: - + Edit button that is active while the stick is active. This button is useful for assigning zones with @@ -2990,68 +2999,68 @@ functionality to an analog stick. ходај-трчи аналогним управљачима. - + PushButton Дугме - + Na&me: Name: Назив: - + Specify the name of an analog stick. Унесите назив за аналогни управљач. - + Mouse Settings Поставке миша - + Standard Уобичајено - + Bearing: Азимут: - + % Safe Zone: % Безбедна област: - + Eight Way Осмосмерно - + Dead Zone: Мртва област: - + Max Zone: Највиша област: - + Diagonal Range: Дијагонални опсег: - + Set Постави - + Set %1 Скуп %1 @@ -3059,9 +3068,9 @@ functionality to an analog stick. JoyControlStickModifierButton - - - + + + Modifier Измењивач @@ -3069,9 +3078,9 @@ functionality to an analog stick. JoyDPad - - - + + + DPad Д-тастер @@ -3079,37 +3088,37 @@ functionality to an analog stick. JoyDPadButton - - - + + + Up Горе - - - + + + Down Доле - - - + + + Left Лево - - - + + + Right Десно - - - + + + Button Дугме @@ -3117,267 +3126,272 @@ functionality to an analog stick. JoyTabWidget - - - - - - + + + + + + <New> <Ново> - - + + Remove Уклони - - + + Remove configuration from recent list. Уклони подешавање са текуће листе. - - + + Load Учитај - - + + Load configuration file. Учитај датотеку са подешавањима. - - + + Save Сачувај - - + + Save changes to configuration file. Сачувај измене у датотеку подешавања. - - + + Save As Сачувај као - - + + Save changes to a new configuration file. Сачувај измене у новој датотеци подешавања. - - + + Sets Скупови - + Copy from Set Умножи из ... - + Settings Постави називе - - + + Set 1 1. скупа - - + + Set 2 2. скупа - - + + Set 3 3. скупа - - + + Set 4 4. скупа - - + + Set 5 5. скупа - - + + Set 6 6. скупа - - + + Set 7 7. скупа - - + + Set 8 8. скупа - - + + Stick/Pad Assign Придружи Управљач/Тастатуру - - + + Controller Mapping Придруживач тастера контролера - - + + Quick Set Брзе поставке - - + + Names Називи - - + + Toggle button name displaying. Приказивање назива преклопника. - - + + Pref Опште поставке - - + + Change global profile settings. Измените опште поставке профила. - - - + + + Reset Поништи - - + + Revert changes to the configuration. Reload configuration file. Поништи измене и учитај опет датотеку са подешавањем. - + Open Config Отвори подешавања - + Config Files (*.amgp *.xml) Датотеке подешавања (*.amgp *.xml) - - - + + + Config File (*.%1.amgp) Датотека подешавања (*.%1.amgp) - - + + Do you really want to reset buttons settings for joystick? + + + + + Save Profile Changes? Да ли да сачувам измене профила? - - + + Changes to the new profile have not been saved. Would you like to save or discard the current profile? Имате несачуваних промена новог профила. Да ли желите да их сачувам или да их поништим? - - + + Changes to the profile "%1" have not been saved. Would you like to save or discard changes to the current profile? Имате несачуваних промена у профилу "%1" . Да ли желите да их сачувам или да их поништим? - + Sticks Управљачи - - + + DPads Д-тастери - + No buttons have been assigned. Please use Quick Set to assign keys to buttons or disable hiding empty buttons. Нема придруживања за дугмад. Можете да употребите „Брзе поставке“ за придруживања дугмадима или да искључите скривање „празних“ дугмади. - - + + Set %1: %2 Скуп %1: %2 - - + + Set %1 Скуп %1 - + Copy Set Assignments Умножи придруживања из скупа - + Are you sure you want to copy the assignments and device properties from %1? Да ли заиста желите да умножите придруживања и особине уређаја из %1? - - - + + + Save Config Сачувај подешавања - - + + Set Постави @@ -3385,7 +3399,7 @@ to buttons or disable hiding empty buttons. Joystick - + Joystick Џојстик @@ -3393,98 +3407,98 @@ to buttons or disable hiding empty buttons. JoystickStatusWindow - + Properties Особине - + Details Детаљи - + Name: Назив: - - - - - - - + + + + + + + %1 %1 - + Number: Број: - + Axes: Праваца: - + Buttons: Дугмад: - + Hats: Капице: - + GUID: ЈИБГ: - + Game Controller: Контролер за игре: - + Axes Правци - + Buttons Дугмад - + Hats Капице - + %1 (#%2) Properties %1 (#%2) Особине - + Axis %1 Правац %1 - + Hat %1 Хат %1 - + No Не - + Yes Да @@ -3492,62 +3506,67 @@ to buttons or disable hiding empty buttons. MainSettingsDialog - + Edit Settings Уређивање поставки - + General Опште поставке - + Controller Mappings Придруживања контролера - + Language Језик - + Auto Profile Ауто-профил - + Mouse Миш - + Advanced Напредно - + + Profile Direc&tory: + + + + <html><head/><body><p>Specify the default directory that the program should use in file dialogs when loading a profile or saving a new profile.</p></body></html> <html><head/><body><p>Постављање уобичајеног директоријума за учитавање постојећих или чување нових профила.</p></body></html> - + Recent Profile Count: Број скорашњих профила: - + <html><head/><body><p>Number of profiles that can be placed in recent profile list. 0 will result in the program not enforcing a limit on the number of profiles displayed.</p></body></html> <html><head/><body><p>Број профила који се може сместити у листу недавно употребљаваних профила. Број 0 означава приказ свих употребљаваних профила.</p></body></html> - + Gamepad Poll Rate: Провера порука џојстика након: - + Change the poll rate that the program uses to discover new events from gamepads. Defaults to 10 ms. @@ -3561,29 +3580,29 @@ before using antimicro unattended. ЦПЈ (процесора), Проверите ову поставку пре озбиљније употребе. - + Hide main window when the main window close button is clicked instead of quitting the program. Притиском на дугме затварања главног прозора, он се затвара али програм остаје покренут у обавештајној зони. - + Close To Tray Смести у обавештајну зону - + Have Windows start antimicro at system startup. Покрени програм са покретањем система. - + Launch At Windows Startup Покрени по покретању система - + Display recent profiles for all controllers as a single list in the tray menu. Defaults to using sub-menus. @@ -3592,12 +3611,12 @@ to using sub-menus. Уобичајено је употреба под-изборника. - + Single Profile List in Tray Јединствен списак профила у обавештајној зони - + Have the program minimize to the taskbar. By default, the program minimizes to the system tray if available. @@ -3606,12 +3625,12 @@ tray if available. зони ако је она доступна. - + Minimize to Taskbar Смести у траку покренутих задатака - + This option will cause the program to hide all buttons that have no slots assigned to them. The Quick Set dialog window will have to be used @@ -3622,12 +3641,12 @@ to bring up the edit dialog for gamepad buttons. подесите придруживања тастера гејмпеда. - + Hide Empty Buttons Сакриј „празну“ дугмад - + When the program is launched, open the last known profile that was opened during the previous session. @@ -3636,159 +3655,169 @@ previous session. претходној сесији. - + Auto Load Last Opened Profile Отвори сам последњи употребљени профил - + Only show the system tray icon when the program first launches. Приказује само икону у обавештајној зони по првом покретању програма. - + Launch in Tray Покрени у обавештајној зони - + Associate .amgp files with antimicro in Windows Explorer. Придружуј „.amgp“-датотеке програму Анти-микро (виндоуз експлорер). - + Associate Profiles Придружени профили - + Key Repeat Вишеструки притисци тастера - + Active keys will be repeatedly pressed when this option is enabled. Ако је укључено омогућени су вишеструки, узастопни притисци тастера. - - + + Enable Омогућено - + Specifies how much time should elapse before key repeating begins. Кашњење пре започињања вишеструког, узастопног притискања тастера. - + Specifies how many times key presses will be performed per seconds. Одређује број притисака тастера у секунди код вишеструког, узастопног притискања тастера. - + <html><head/><body><p>antimicro has been translated into many different languages by contributors. By default, the program will choose an appropriate translation based on your system's locale setting. However, you can make antimicro load a different translation depending on the language that you choose from the list below.</p></body></html> <html><head/><body><p>Сарадници аутора су локализовали програм за разне језике. Уобичајено, програм ће употребљавати језичке поставке самог система за приказ, али, уколико то желите, можете употребљавати програм и на језику који одаберете на листи испод.</p></body></html> - + Português do Brasil - + Français - + Deutsch - + Italiano - + 日本語 - + Русский - + српски / srpski - + 简体中文 - + Español - + українська - + Polski - + + History Si&ze: + + + + Log File: - + Log Level: - + None Ништа - + Error - + Warning - + Info Подаци - + Debug + + + Reset + Поништи + French француски @@ -3806,22 +3835,22 @@ per seconds. украјински - + Class класи - + Title наслову - + Program Програм - + Disable the "Enhanced Pointer Precision" Windows setting while antimicro is running. Disabling "Enhanced Pointer Precision" will allow mouse movement within antimicro to be more @@ -3832,32 +3861,27 @@ precise. програму. - + Disable Enhance Pointer Precision Искључи побољшања прецизности показивача - + Smoothing Углађеност - - Histor&y Size: - - - - + Weight &Modifier: - + Refresh Rate: Брзина освежавања: - + The refresh rate is the amount of time that will elapse in between mouse events. Please be cautious when editing this setting as it will cause the program to use @@ -3872,17 +3896,17 @@ it unattended. поставку пре озбиљније употребе. - + Spring Скоковито - + Screen: Екран: - + Utilize the specified screen for spring mode. On Linux, the default is to use the primary screen. On Windows, the default is to use all available screens. @@ -3891,29 +3915,29 @@ is to use all available screens. а на Виндоузу свих расположивих екрана. - + Accel Numerator: Бројилац убрзања: - - - + + + 0 0 - + Accel Denominator: Именилац убрзања: - + Accel Threshold: Праг убрзања: - + If the acceleration values for the virtual mouse have been changed by a different process, particularly when quitting an older game, then you might want to reset the acceleration @@ -3924,37 +3948,32 @@ values used by the virtual mouse. вредности убрзања патвореног миша на оне претходне. - + Reset Acceleration Поврати убрзање - + Delay: Кашњење: - - Profi&le Directory: - - - - + ms мс - + Rate: Брзина: - + times/s пута/сек. - + Below is a list of the custom mappings that have been saved. You can use the following table to delete mappings or have mappings temporarily disabled. You can also disable mappings that are included with SDL; just insert a new row with the appropriate joystick GUID and check disable. Settings will not take affect until you either refresh all joysticks or unplug that particular joystick. @@ -3963,34 +3982,34 @@ Settings will not take affect until you either refresh all joysticks or unplug t Подешавања се неће узети у обзир док се не освежи листа доступних џојстика или док не искључите дати, конкретан џојстик. - + GUID ЈИБГ - + Mapping String Ниска придруживања - + Disable? Искључи? - - + + Delete Уклони - + Insert Уметни - - + + Default подразумевано @@ -3999,7 +4018,7 @@ Settings will not take affect until you either refresh all joysticks or unplug t португалски (Бразил) - + English енглески @@ -4008,49 +4027,49 @@ Settings will not take affect until you either refresh all joysticks or unplug t немачки - - + + Active Омогућен - + Devices: Уређаји: - - + + All Сви - + Device Уређај - + Profile Профил - + Default? Подразумевано? - + Add Додај - + Edit Уреди - + Also, Windows users who want to use a low value should also check the "Disable Enhance Pointer Precision" checkbox if you haven't disabled the option in Windows. @@ -4059,42 +4078,52 @@ the option in Windows. нису онемогућили ову опцију у самом систему. - + Select Default Profile Directory Одабир уобичајеног директоријум профила - + Are you sure you want to delete the profile? Да ли заиста желите да уклоните овај профил? - + Save Log File As - + Log Files (*.log) + + + Do you really want to reset setting? + + + + + Would you like to reset mappings too? + + MainWindow - + No Joysticks have been found. Please plug in a joystick and then choose the "Update Joysticks" option in the main menu Нисам пронашао џојстик. Када га прикључите покрените „Поставке > Пронађи џојстике“ из главног менија - + If events are not seen by a game, please click here to run this application as Administrator. - + &App &Датотека @@ -4103,12 +4132,12 @@ the option in Windows. Придружи Управљач/Тастатуру - + &Options П&оставке - + antimicro Анти-микро @@ -4117,100 +4146,100 @@ the option in Windows. Ако догађаје игра не „види“, притисните ово дугме за покретање овог програма као администратор. - + &Help &Помоћ - - + + &Quit &Затвори - + Ctrl+Q Ctrl+Q - - + + &Update Joysticks Про&нађи џојстике - + Ctrl+U Ctrl+U - - + + &Hide &Сакриј - + Ctrl+H Ctrl+H - + &About О прогр&аму - + Ctrl+A Ctrl+A - + About &Qt - + &Properties - + &Key Checker - + &GitHub Page - + &Game Controller Mapping - + S&ettings - + &Stick/Pad Assign - + &Wiki - + &Issues - + &Calibration @@ -4227,7 +4256,7 @@ the option in Windows. Провера тастера тастатуре - + Home Page Матична страна @@ -4248,49 +4277,49 @@ the option in Windows. Вики-стране - + Could not find a proper controller identifier. Exiting. - - - - - - - + + + + + + + (%1) (%1) - - + + Open File Отвори датотеку - + &Restore В&рати - + Calibration couldn't be opened - + You must connect at least one controller to open the window - + Run as Administrator? Покрени као администратор? - + Are you sure that you want to run this program as Adminstrator? Some games run as Administrator which will cause events generated by antimicro to not be used by those games unless antimicro is also run as the Adminstrator. This is due to permission problems caused by User Account Control (UAC) options in Windows Vista and later. @@ -4299,17 +4328,17 @@ Some games run as Administrator which will cause events generated by antimicro t Неки програми покренути уз администраторске дозволе могу да доведу до тога да радње које захтева Анти-микро не буду ваљано препознате све док се и сам Анти-микро не покрене уз исте дозволе. Код Видоуз-Виста или новијих виндоуза ово је изазвано проблемима са дозволама које ствара опција за управљање корисничким налозима (енг. скр. „UAC“). - + Failed to elevate program Не могу да покренем програм - + Failed to restart this program as the Administrator Неуспело покретање програма са админ. дозволама - + Could not find controller. Exiting. @@ -4317,12 +4346,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseAxisSettingsDialog - + Mouse Settings - Поставке миша - - + Set %1 Скуп %1 @@ -4330,12 +4359,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseButtonSettingsDialog - + Mouse Settings - Поставке миша - - + Set %1 Скуп %1 @@ -4343,12 +4372,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseControlStickSettingsDialog - + Mouse Settings Поставке миша - + Set %1 Скуп %1 @@ -4356,12 +4385,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseDPadSettingsDialog - + Mouse Settings Поставке миша - + Set %1 Скуп %1 @@ -4369,17 +4398,17 @@ Some games run as Administrator which will cause events generated by antimicro t MouseSettingsDialog - + Mouse Settings Поставке миша - + Mouse Mode: Мишар: - + Cursor mode is used to move the mouse cursor around the screen relative to its current position depending on how much you move an axis @@ -4400,79 +4429,79 @@ axis is moved back to the dead zone. програм га враћа на средину екрана. - + Cursor Показивач - + Spring Скоковито - + Acceleration: Убрзавање: - + Enhanced Precision Побољшана прецизност - - + + Linear Линеарно - + Quadratic Квадратно - + Cubic Кубно - + Quadratic Extreme Набуџено квадратно - + Power Function Нај-функција - + Easing Quadratic Квадратно попуштање - + Easing Cubic Кубно попуштање - + Mouse Speed Settings Брзина померања - + Enable to change the horizontal and vertical speed boxes at the same time. Омогућује истовремену промену брзине у оба правца. - + Change Together Измењуј повезано - + Options for adding more acceleration to the mouse movement beyond what the acceleration curve would produce. Acceleration is added based on how quickly an axis is @@ -4482,17 +4511,17 @@ using typical gamepad analog sticks. - + Delta Acceleration - + &Multiplier: - + Mi&n Threshold: @@ -4503,8 +4532,8 @@ Speed: Лево→Десно: - - + + 1 = 20 pps 1 = 20 тачака/сек. @@ -4514,33 +4543,33 @@ Speed: Горе→Доле: - + Wheel Hori. Speed: Tочкић водоравно: - + Set the speed used for horizontal mouse wheel movement according to number of simulated notches per second. Постављање брзине водоравног померања миша према одговарајућем, симулираном броју зареза по секунди. - + Set the speed used for vertical mouse wheel movement according to number of simulated notches per second. Постављање брзине усправног померања миша према одговарајућем, симулираном броју зареза по секунди. - + Sensitivit&y: - + For Power Function acceleration curve. Specifies the factor to use for curve sensitivity. When the value is above 1.0, the mouse movement will be accelerated @@ -4551,13 +4580,13 @@ faster at the low end of an axis. убрзавати у крајњем доњем положају осе. - + Easing Duration: Трајање попуштањa: - - + + s с @@ -4570,22 +4599,22 @@ faster at the low end of an axis. Чинилац: - + Highest value to accelerate mouse movement by Највиша вредност за убрзање померања миша - + x x - + Start %: Почетак %: - + Acceleration begins at this percentage of the base multiplier Убрзање почиње након оволико процената од основног чиниоца @@ -4596,54 +4625,54 @@ Threshold: праг: - + Minimum amount of axis travel required for acceleration to begin Најмања количина осног померања неопходна за отпочињање убрзања - + Max Threshold: Највећи праг: - + Maximum axis travel before acceleration has reached the multiplier value Највиша количина осног померања пре но се достигне вредност датог чиниоца - + E&xtra Duration: - + Curve: - + Ease Out Sine - + Ease Out Quad - + Ease Out Cubic - + Release Radius: Пречник пуштања: - + Specifies that the spring area will be relative to the mouse position set by a non-relative spring. Одређује да ће „скоковито“ подручје бити @@ -4651,39 +4680,39 @@ mouse position set by a non-relative spring. не-релативним скоком. - + Relative Релативно - + Mouse Status Стање миша - + X: X: - - + + 0 (0 pps) 0 (0 тачака/сек) - + Y: Y: - - + + 1 = 1 notch(es)/s 1 = 1 зарез(а)/сек. - + Enhanced: Three tier curve that makes the mouse move slow on the low end of an axis and fast on the high end. @@ -4724,19 +4753,19 @@ a period of time using a Cubic curve. употребљавајући кубну кривуљу. - + Hori&zontal Speed: - + &Vertical Speed: - + Wheel Vert. Speed: Tочкић @@ -4747,7 +4776,7 @@ Speed: Осетљивост: - + Specifies the amount of time (in seconds) that will be required before the mouse is fully accelerated after reaching the high end of an axis. @@ -4756,10 +4785,10 @@ after reaching the high end of an axis. након достизања горњег краја осе. - - - - + + + + % % @@ -4768,7 +4797,7 @@ after reaching the high end of an axis. Додатно трајање: - + Extend the time that extra acceleration is applied. Axis travel will be taken into account. A slower flick will decrease the actual time that extra acceleration will be applied. @@ -4777,17 +4806,17 @@ actual time that extra acceleration will be applied. стварно време након кога ће се примењивати додатно убрзање. - + Spring Settings Скоковито померање - + Spring Width: По ширини: - + Changes the width of the region that the cursor can move in spring mode. 0 will use the entire width of your screen. @@ -4796,12 +4825,12 @@ of your screen. укупне ширине Вашег екрана. - + Spring Height: По висини: - + Changes the height of the region that the cursor can move in spring mode. 0 will use the entire height of your screen. @@ -4810,8 +4839,8 @@ of your screen. укупне висине Вашег екрана. - - + + %n notch(es)/s %n зарез/сек. @@ -4823,7 +4852,7 @@ of your screen. QKeyDisplayDialog - + Key Checker Провера тастера тастатуре @@ -4832,34 +4861,34 @@ of your screen. <html><head/><body><p>Притисните тастер на тастатури да бисте видели како је овај програм открио одговарајућу вредност. У прозору ће се приказати вредност руковаоца догађаја, вредност у КјуТ-библиотекама (по потреби), као и прилагођена вредност у Анти-микро програму.</p><p>Вредности које су откривене програмима Анти-микро и КјуТ ће обично бити идентичне. јер Анти-микро употребљава вредности КјуТ-библиотека када је то могуће. Погледајте страницу на мрежи <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum (енг.)</span></a> за вредности одређене за употребу КјуТ-програмима. Ако откријете неке неподржане вредности за тастере у овом програму, известите о том проблему на <a href="https://github.com/AntiMicro/antimicro"><span style=" text-decoration: underline; color:#0057ae;">Анти-микро гит-странама</span></a>, а у циљу исправљања уочених недостатака. Како год, додат је предложак за непознате вредности да би се програм могао употребљавати, али остаје главни проблем који се односи на преносивост профила.</p></body></html> - - <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> + + <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="http://doc.qt.io/qt-5/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">http://doc.qt.io/qt-5/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> - + Event Handler: Руковалац догађајем: - + Native Key Value: Очитана вредност: - - - + + + 0x00000000 0x00000000 - + Qt Key Value: КјуТ вредност: - + antimicro Key Value: Анти-микро вредност: @@ -4867,260 +4896,260 @@ of your screen. QObject - + Super Супер - + Menu Изборник - + Mute Мук - + Vol+ Гласније - + Vol- Тише - + Play/Pause Пусти/Пауза - + Play Пусти - + Pause Пауза - + Prev Претходно - + Next Наредно - + Mail Е-пошта - + Home Почетно - + Media Медији - + Search Нађи - + Daemon launched Покренут је позадински процес - + Failed to launch daemon Није успело покретање позадинског процеса - + Launching daemon Покрећем позадински процес - - + + Display string "%1" is not valid. Није ваљана »Display string „%1“«. - + Failed to set a signature id for the daemon Није успело постављање ИБ-потписа за позадински процес - + Failed to change working directory to / Не могу да поставим „/“ као радни директоријум - + Quitting Program Излазак из програма - + # of joysticks found: %1 # џојстика пронађено: %1 - + List Joysticks: Списак џојстика: - + --------------- --------------- - + Joystick %1: Џојстик %1: - + Index: %1 Индекс: %1 - + GUID: %1 ЈИБГ: %1 - + Name: %1 Назив: %1 - + Yes Да - + No Не - + Game Controller: %1 Контролер програма: %1 - + # of Axes: %1 # праваца: %1 - + # of Buttons: %1 # тастера: %1 - + # of Hats: %1 # капица: %1 - + Attempting to use fallback option %1 for event generation. Покушавам да користим резервну опцију %1 у стварању догађаја. - + Failed to open event generator. Exiting. Не могу да отворим ствараоца догађаја. Излазим. - + Using %1 as the event generator. Употребљавам %1 као ствараоца догађаја. - + Could not raise process priority. Не могу да повисим приоритет процеса. - + Last button - + There isn't a last button pressed from gamepad in data. Did you set at least one button from gamepad for keyboard? - + Active window changed to: Title = "%1", Class = "%2", Program = "%3" or "%4". - + Profile location %1 is not an XML file. Путања до профила „%1“ није ИксМЛ датотека. - + Profile location %1 does not exist. Путања до профила „%1“ не постоји. - - - + + + Controller identifier is not a valid value. Означивач контролера нема ваљану вредност. - + An invalid set number '%1' was specified. - + Controller identifier '%s'' is not a valid value. - + No set number was specified. Није одређен број скупа. - + No controller was specified. Није одређен контролер. - + No display string was specified. Није постављено »Display string«. - + An invalid event generator was specified. Одређен је неважећи стваралац догађаја. - + No event generator string was specified. Није одређен назив ствараоца догађаја. @@ -5129,7 +5158,7 @@ of your screen. Откривен је белег Кјут-стила али сам стил није одређен. - + No log file specified. @@ -5234,22 +5263,22 @@ of your screen. контролера или ЈИБГ (енг. „GUID“). - + Logging started - + Auto-switching to profile "%1". - + Auto-switching to nullptr profile! - + xinput version must be at least 2.0. No mouse acceleration changes will occur. Издање проширење „xinput“ је старије од издања 2.0. Нису могуће измене брзина при руковању мишем. @@ -5257,18 +5286,18 @@ of your screen. QuickSetDialog - + Quick Set Брзе поставке - + <html><head/><body><p>Please press a button or move an axis on %1 (<span style=" font-weight:600;">%2</span>).<br/>A dialog window will then appear which will<br/>allow you to make an assignment.</p></body></html> <html><head/><body><p>Притисните неки тастер или померите управљач на уређају <br/>„%1“ (<span style=" font-weight:600;">%2</span>). Након тога, појавиће се прозорче <br/>у којем ћете моћи да придружите том тастеру-управљачу <br/>одговарајући тастер тастатуре, догађај и сл.</p></body></html> - - + + Quick Set %1 Брзе поставке — %1 @@ -5276,12 +5305,12 @@ of your screen. SetAxisThrottleDialog - + Throttle Change Промена регулатора - + The throttle setting for Axis %1 has been changed. Would you like to distribute this throttle change to all sets? @@ -5293,12 +5322,12 @@ Would you like to distribute this throttle change to all sets? SetJoystick - + Set %1: %2 Скуп %1: %2 - + Set %1 Скуп %1 @@ -5306,52 +5335,52 @@ Would you like to distribute this throttle change to all sets? SetNamesDialog - + Set Name Settings Поставке назива скупова - + Set 1 1. скуп - + Set 2 2. скуп - + Set 3 3. скуп - + Set 4 4. скуп - + Set 5 5. скуп - + Set 6 6. скуп - + Set 7 7. скуп - + Set 8 8. скуп - + Name Назив @@ -5359,7 +5388,7 @@ Would you like to distribute this throttle change to all sets? SimpleKeyGrabberButton - + Mouse Миш @@ -5367,7 +5396,7 @@ Would you like to distribute this throttle change to all sets? SpringModeRegionPreview - + Spring Mode Preview Преглед за начин „Скоковито“ @@ -5375,7 +5404,7 @@ Would you like to distribute this throttle change to all sets? UInputEventHandler - + Could not find a valid uinput device file. Please check that you have the uinput module loaded. lsmod | grep uinput @@ -5384,14 +5413,14 @@ lsmod | grep uinput lsmod | grep uinput - + Could not open uinput device file Please check that you have permission to write to the device Не могу да отворим „uinput“-датотеку уређаја Проверите да ли имате дозволу за уписивање на уређај - + Using uinput device file %1 Употребљавам „uinput“-датотеку уређаја %1 @@ -5399,554 +5428,554 @@ Please check that you have permission to write to the device UInputHelper - + a а - + b б - + c ц - + d д - + e е - + f ф - + g г - + h х - + i и - + j ј - + k к - + l л - + m м - + n н - + o о - + p п - + q љ - + r р - + s с - + t т - + u у - + v в - + w њ - + x џ - + y ж - + z з - + Esc Врати („Esc“) - + F1 Ф1 - + F2 Ф2 - + F3 Ф3 - + F4 Ф4 - + F5 Ф5 - + F6 Ф6 - + F7 Ф7 - + F8 Ф8 - + F9 Ф9 - + F10 Ф10 - + F11 Ф11 - + F12 Ф12 - + ` ` - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - - + + - - - + = = - + BackSpace Уназад - + Tab Таб - + [ [ - + ] ] - + \ \ - + CapsLock В.слова - + ; ; - + ' ' - + Enter Унеси - + Shift_L л.Мењач - + , , - - + + . . - - + + / / - + Ctrl_L л.Ктрл - - + + Super_L л.Супер - + Alt_L л.Алт - + Space Размакница - + Alt_R д.Алт - + Menu Изборник - + Ctrl_R д.Ктрл - + Shift_R д.Мењач - + Up Горе - + Left Лево - + Down Доле - + Right Десно - + PrtSc Сликај - + Ins Уметни - + Del Бриши - + Home Почетак - + End Крај - + PgUp Страна изнад - + PgDn Страна испод - + NumLock УКЉ/ ИСКЉ - + * * - + + + - + KP_Enter КП_Унеси - + KP_1 КП_1 - + KP_2 КП_2 - + KP_3 КП_3 - + KP_4 КП_4 - + KP_5 КП_5 - + KP_6 КП_6 - + KP_7 КП_7 - + KP_8 КП_8 - + KP_9 КП_9 - + KP_0 КП_0 - + SCLK SCLK - + Pause Пауза - + Super_R д.Супер - + Mute Мук - + VolDn Тише - + VolUp Гласније - + Play Пусти - + Stop Заустави - + Prev Претходно - + Next Наредно - + [NO KEY] [Без тастера] @@ -5954,54 +5983,54 @@ Please check that you have permission to write to the device UnixWindowInfoDialog - + Captured Window Properties Особине откривеног прозора - + Information About Window Подаци о прозору - + Class: Класа: - - - + + + TextLabel Текст-натпис - + Title: Наслов: - + Path: Путања: - + Match By Properties Прилагоди по - + Class класи - + Title наслову - + Path путањи @@ -6009,9 +6038,9 @@ Please check that you have permission to write to the device VDPad - - - + + + VDPad Патворен Д-тастер @@ -6019,226 +6048,226 @@ Please check that you have permission to write to the device VirtualKeyPushButton - + Space Размакница - + Tab Таб - + Shift (L) л. Мењач - + Shift (R) д. Мењач - + Ctrl (L) л. Ктрл - + Ctrl (R) д. Ктрл - + Alt (L) л. Алт - - + + Alt (R) д. Алт - + Alt Gr - + ` ` - + ~ ~ - - + + - - - + = = - + [ [ - + ] ] - + \ \ - + Caps В.слова - + ; ; - + ' ' - + , , - - + + . . - - + + / / - + ESC Врати - + PRTSC Сликај - + SCLK SCLK - + INS Уметни - + PGUP Страна изнад - + DEL Бриши - + PGDN Страна испод - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - + NUM LK УКЉ/ ИСКЉ - - + + * * - + + + - + Enter Унеси @@ -6255,42 +6284,42 @@ R И - + < < - + : : - + Super (L) л.Супер - + Menu Избор - + Up Горе - + Down Доле - + Left Лево - + Right Десно @@ -6298,226 +6327,226 @@ R VirtualKeyboardMouseWidget - - + + Keyboard Тастатура - - + + Mouse Миш - + Mouse Settings Поставке миша - + Left Mouse Лево - + Up Mouse Горе - + Left Button Mouse Леви тастер - + Middle Button Mouse Средњи тастер - + Right Button Mouse Десни тастер - + Wheel Up Mouse Точкић унапред - + Wheel Left Mouse Точкић улево - + Wheel Right Mouse Точкић удесно - + Wheel Down Mouse Точкић уназад - + Down Mouse Доле - + Right Mouse Десно - + Button 4 Mouse Тастер 4 - + Mouse 8 Mouse Миш 8 - + Button 5 Mouse Тастер 5 - + Mouse 9 Mouse Миш 9 - + NONE НИШТА - - + + Last button - - + + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + Others - + Applications Програми - + Browser Back Претходно (веб прегледник) - + Browser Favorites Обележивачи (веб прегледник) - + Browser Forward Наредно (веб прегледник) - + Browser Home Почетна страна (веб прегледник) - + Browser Refresh Освежи (веб прегледник) - + Browser Search Претрага (веб прегледник) - + Browser Stop Заустави учитавање (веб прегледник) - + Calc Калкулатор - + Email Е-пошта - + Media Медији - + Media Next Медији — Наредно - + Media Play Медији — Пусти - + Media Previous Медији — Претходно - + Media Stop Медији — Заустави - + Search Нађи - + Volume Down Тише - + Volume Mute Мук - + Volume Up Гласније @@ -6525,7 +6554,7 @@ R VirtualMousePushButton - + INVALID ОШТЕЋЕНО @@ -6533,28 +6562,28 @@ R WinAppProfileTimerDialog - - + + Capture Application Разоткриј прозор - + After pressing the "Capture Application" button, please select the application window that you want to have a profile associated with. The active application will be captured after the selected number of seconds. По притиску дугмета „Разоткриј прозор“, одаберите прозор програма који желите да повежете са профилом. Разоткривање тог прозора отпочеће након истека доле задатог времена. - + Timer: Након: - + Seconds секунди(е,а) - + Cancel Поништи @@ -6562,12 +6591,12 @@ R WinExtras - + [NO KEY] [Без тастера] - + AntiMicro Profile Профил за Анти-микро @@ -6575,69 +6604,68 @@ R X11Extras - + ESC Врати - + Tab Таб - + Space Размакница - + DEL Бриши - + Return Унеси („Return“) („Enter“) - + KP_Enter КП_Унеси - + Backspace Уназад - + Alt Gr - + xinput extension was not found. No mouse acceleration changes will occur. Није нађено проширење „xinput“. Нису могуће измене брзина при руковању мишем. - + xinput version must be at least 2.0. No mouse acceleration changes will occur. Издање проширење „xinput“ је старије од издања 2.0. Нису могуће измене брзина при руковању мишем. - Virtual pointer found with id=%1. - Нађен је патворени показивач са ИБ=%1. + Нађен је патворени показивач са ИБ=%1. - + PtrFeedbackClass was not found for virtual pointer.No change to mouse acceleration will occur for device with id=%1 Није нађено „НPtrFeedbackClass“ за патворени показивач. Нису могуће измене брзина при руковању мишем за уређај чији је ИБ=%1 - + Changing mouse acceleration for device with id=%1 Измена убрзања при употреби миша за уређај чији је ИБ=%1 @@ -6645,7 +6673,7 @@ R XMLConfigReader - + Could not write updated profile XML to file %1. Не могу да упишем зановљен ИксМЛ-профил у датотеку %1. @@ -6653,7 +6681,7 @@ R XMLConfigWriter - + Could not write to profile at %1. Не могу да уписујем у профил у %1. @@ -6661,7 +6689,7 @@ R antimicro - + Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support. @@ -6669,97 +6697,97 @@ R main - + Launch program in system tray only. Покреће програм само у обавештајној зони. - + Launch program with the tray menu disabled - + Launch program without the main window displayed - + Launch program with the configuration file selected as the default for selected controllers. Defaults to all controllers - + location - + Apply configuration file to a specific controller. Value can be a controller index, name, or GUID - + value - + Unload currently enabled profile(s) - + value(s) - + Start joysticks on a specific set. Value can be a controller index, name, or GUID - + number value - + Launch program as a daemon. Use only on Linux. - + Enable logging - + log-type - + Choose a file for logs writing - + filename - + Choose between using XTest support and uinput support for event generation. Use only if you have enabled xtest and uinput options on Linux or vmulti on Windows. Default: xtest. - + event-generation-type - + Print information about joysticks detected by SDL. Use only if you have sdl library. You can check your controller index, name or even GUID. diff --git a/share/antimicro/translations/antimicro_uk.ts b/share/antimicro/translations/antimicro_uk.ts old mode 100644 new mode 100755 index 0ef0b10d1..c1ff9ab60 --- a/share/antimicro/translations/antimicro_uk.ts +++ b/share/antimicro/translations/antimicro_uk.ts @@ -4,22 +4,22 @@ AboutDialog - + About Про програму - + Version Версія - + Credits Розробники - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -137,7 +137,7 @@ p, li { white-space: pre-wrap; } - + "juliagoda" (since March, 2018) Wanting only to play my favourite old games that din't support gamepads, I found this project (which map keyboard keys and mouse buttons to connected gamepads on Linux) as most proper and recent. But because of poor choices of such application on the internet and since it didn't compile properly, I decided to rescue the project. However, once I finished my work (enough to enjoy playing games) I thought about sharing this code with others. Of course all informations about past programmers will be held. "Ryochan7" (since December 30, 2012 until 2017), I have been working on antimicro in my spare time. What originally started as a fork of QJoyPad and a way to learn proper event-driven programming has turned into something much bigger than I originally intended. Although I have spent a lot of time learning new techniques, finding out more about the domain of KB+M emulation, and spending Friday nights bashing my head against my keyboard, it has been a fun and enriching experience overall. @@ -155,17 +155,17 @@ As of May 24, 2016, this project has moved to https://github.com/AntiMicro/antim - + Copyright: 2013 - 2018 - + Changelog - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -209,52 +209,52 @@ p, li { white-space: pre-wrap; } - + Info Інформація - + antimicro - + About Development - + License Ліцензія - + Program Version %1 Версія програми %1 - + Program Compiled on %1 at %2 Програму скомпільовано %1 о %2 - + Built Against SDL %1 Зібрано на SDL %1 - + Running With SDL %1 Запущено з SDL %1 - + Using Qt %1 Використано Qt %1 - + Using Event Handler: %1 Обробник подій: %1 @@ -262,29 +262,29 @@ p, li { white-space: pre-wrap; } AddEditAutoProfileDialog - + Auto Profile Dialog Вікно автоматичного профілю - + Profile: Профіль: - - + + Browse Оглянути - + Window: - - + + Select Window. Click on the appropriate application window and the application file path will be populated in the form. @@ -293,38 +293,47 @@ in the form. в поле вводу. - + Detect Window Properties - + Class: - + Title: - + + set partial title + + + + Application: - + Select Обрати - + + De&vices: + + + Devices: - Пристрої: + Пристрої: - - + + Select this profile to be the default loaded for the specified device. The selection will be used instead of the all default profile option. @@ -333,84 +342,84 @@ of the all default profile option. налаштування типового профілю. - + Set as Default for Controller Встановити типовим для контролера - - + + A different profile is already selected as the default for this device. Інший профіль вже встановлено типовим для вказаного пристрою. - + Current (%1) Поточний (%1) - + Open Config Відкрити конфігурацію - - + + Select Program Обрати програму - + Programs (*.exe) - + Please use the main default profile selection. Використовуйте основний типовий профіль. - + Please select a window by using the mouse. Press Escape if you want to cancel. Оберіть мишкою вікно. Аби скасувати вибір натисніть Escape. - + Capture Application Window Захоплення вікна програми - + Could not obtain information for the selected window. Не отримано інформації для обраного вікна. - + Application Capture Failed Захоплення програми зазнало невдачі - + Profile file path is invalid. Шлях до профілю хибний. - + No window matching property was specified. - + Program path is invalid or not executable. Шлях до програми хибний, або вона не має прав на виконання. - + File is not an .exe file. - + No window matching property was selected. @@ -418,165 +427,165 @@ of the all default profile option. AdvanceButtonDialog - - + + Advanced Розширені параметри - + Assignments Призначення - + Toggle Перемикач - + Turbo Турбо - + Set Selector Встановити селектор - + Press Time Час натиску - + Insert a pause that occurs in between key presses. Вставте паузу між натисканнями клавіш. - + Pause Пауза - + Hold Утримання - + Mouse Mod Мод. мишки - + Cycle Цикл - + Distance Дистанція - + Release Віджати - + Blank or KB/M - + Delay Затримка - + Execute - + Load Завантажити - + Set Change - + Text Entry - - + + Insert a new blank slot. Вставити новий пустий слот. - + Insert Вставити - + Delete a slot. Вилучити слот. - + Delete Вилучити - + Clear all currently assigned slots. Очистити всі поточні слоти. - + Clear All Очистити все - + Placeholder Заповнювач - + Specify the duration of an inserted Pause or Hold slot. Встановити тривалість слотів Пауза чи Утримання. - + Time: Час: - + 0.01s 0.01с - + 0m 0хв - - + + 0 0 - + 0s @@ -585,339 +594,339 @@ of the all default profile option. Зміна швидкості мишки: - + &Mouse Speed Mod: - + Set the percentage that mouse speeds will be modified by. Встановіть зміну швидкості миші у відсотковому співвідношенні. - - + + % % - - + + Specify the range past an axis dead zone in which a sequence of actions will execute. - + Distance: Дистанція: - + Auto Reset Cycle After Автоматично скидати цикл опісля - + seconds секунд - + Executable: - + ... - + Arguments: - - - + + + Enabled Включити - + Mode: Режим: - + <html><head/><body><p>Normal: Repeatedly press and release a button by the chosen rate.</p><p>Gradient: Modify the button press and button release delay based on how far an axis has been moved. The rate will remain the same.</p><p>Pulse: Modify how many times a button is pressed and released per second. The button delay will remain the same.</p></body></html> - + Normal Звичайний - + Gradient Наростаючий - + Pulse Пульсуючий - + Delay: Затримка: - + 0.10s 0.10с - + Rate: Частота: - + 10.0/s 10.0/с - - + + Disabled Вимкнено - + Select Set 1 One Way Встановити набір 1 одностороннім - + Select Set 1 Two Way Встановити набір 1 двостороннім - + Select Set 1 While Held Встановити набір 1 доки натиснуто - + Select Set 2 One Way Встановити набір 2 одностороннім - + Select Set 2 Two Way Встановити набір 2 двостороннім - + Select Set 2 While Held Встановити набір 2 доки натиснуто - + Select Set 3 One Way Встановити набір 3 одностороннім - + Select Set 3 Two Way Встановити набір 3 двостороннім - + Select Set 3 While Held Встановити набір 3 доки натиснуто - + Select Set 4 One Way Встановити набір 4 одностороннім - + Select Set 4 Two Way Встановити набір 4 двостороннім - + Select Set 4 While Held Встановити набір 4 доки натиснуто - + Select Set 5 One Way Встановити набір 5 одностороннім - + Select Set 5 Two Way Встановити набір 5 двостороннім - + Select Set 5 While Held Встановити набір 5 доки натиснуто - + Select Set 6 One Way Встановити набір 6 одностороннім - + Select Set 6 Two Way Встановити набір 6 двостороннім - + Select Set 6 While Held Встановити набір 6 доки натиснуто - + Select Set 7 One Way Встановити набір 7 одностороннім - + Select Set 7 Two Way Встановити набір 7 двостороннім - + Select Set 7 While Held Встановити набір 7 доки натиснуто - + Select Set 8 One Way Встановити набір 8 одностороннім - + Select Set 8 Two Way Встановити набір 8 двостороннім - + Select Set 8 While Held Встановити набір 8 доки натиснуто - + sec. сек. - + /sec. /сек. - + Set %1 Набір %1 - - + + Select Set %1 Обрати набір %1 - + One Way Односторонній - + Two Way Двосторонній - + While Held Доки натиснуто - + Choose Executable - + Slots past a Cycle action will be executed on the next button press. Multiple cycles can be added in order to create partitions in a sequence. - + Delays the time that the next slot is activated by the time specified. Slots activated before the delay will remain active after the delay time has passed. - + Distance action specifies that the slots afterwards will only be executed when an axis is moved a certain range past the designated dead zone. - + Insert a hold action. Slots after the action will only be executed if the button is held past the interval specified. - + Chose a profile to load when this slot is activated. - + Mouse mod action will modify all mouse speed settings by a specified percentage while the action is being processed. This can be useful for slowing down the mouse while sniping. - + Specify the time that keys past this slot should be held down. - + Insert a release action. Slots after the action will only be executed after a button release if the button was held past the interval specified. - + Change to selected set once slot is activated. - + Full string will be typed when a slot is activated. - + Execute program when slot is activated. - - + + Choose Profile - + Config Files (*.amgp *.xml) @@ -925,157 +934,157 @@ of the all default profile option. AdvanceStickAssignmentDialog - + Stick/Pad Assignment Призначення стіків/хрестовин - + Sticks Стіки - + DPads DPad'и - + Note: This window is meant for backwards compatibility with profiles made before antimicro 2.0. Since version 2.0, use of the Game Controller Mapping window is preferred. - - + + %1 (Joystick %2) %1 (джойстик %2) - + Stick 1 Стік 1 - - - + + + Enabled Активний - - - - - - + + + + + + Assign Призначити - - + + X Axis: Вісь X: - - + + Y Axis: Вісь Y: - + Stick 2 Стік 2 - + Number of Physical DPads: %1 Кількість фізичних DPad'ів: %1 - + Virtual DPad 1 Віртуальний DPad 1 - + Down: Вниз: - + Left: Вліво: - + Right: Вправо: - + Up: Вверх: - - - - + + + + Axis %1 Вісь %1 - - - - + + + + Axis %1 - Вісь %1 - - - - - + + + + Axis %1 + Вісь %1 + - - - - + + + + Button %1 Кнопка %1 - + Move stick 1 along the X axis Рухайте стік 1 по вісі X - + Move stick 1 along the Y axis Рухайте стік 1 по вісі Y - + Move stick 2 along the X axis Рухайте стік 2 по вісі X - + Move stick 2 along the Y axis Рухайте стік 2 по вісі Y - - - - + + + + Press a button or move an axis Натисніть кнопки чи змістіть вісь @@ -1083,180 +1092,180 @@ of the all default profile option. AxisEditDialog - + Axis Вісь - + Presets: Типовий набір: - - + + Mouse (Horizontal) Мишка (Горизонтально) - - + + Mouse (Inverted Horizontal) Мишка (Горизонтально інвертовано) - - + + Mouse (Vertical) Мишка (Вертикально) - - + + Mouse (Inverted Vertical) Мишка (Вертикально інвертовано) - - + + Arrows: Up | Down Стрілки: Вверх | Вниз - - + + Arrows: Left | Right Стрілки: Вліво | Вправо - - + + Keys: W | S Клавіші: W | S - - + + Keys: A | D Клавіші: A | D - - + + NumPad: KP_8 | KP_2 NumPad: KP_8 | KP_2 - - + + NumPad: KP_4 | KP_6 NumPad: KP_4 | KP_6 - - - + + + None Відсутній - - + + Set the value to use as the limit for an axis. Useful for a worn out analog stick. - + Dead Zone: Сліпа зона: - - + + Set the value of the dead zone for an axis. Встановіть значення сліпої зони для вісі. - + Max Zone: Максимальна зона: - - + + [NO KEY] [НЕМАЄ КНОПКИ] - + Throttle setting that determines the behavior of how to interpret an axis hold or release. Параметри тяги визначають, як програма має реагувати на утримання та натискання вісі. - + Negative Half Throttle Зворотня напівтяга - + Negative Throttle Зворотня тяга - + Normal Звичайний - + Positive Throttle Пряма тяга - + Positive Half Throttle Пряма напівтяга - + Current Value: Поточне значення: - + Name: Ім'я: - + Specify the name of an axis. Назначте ім'я для вісі. - + Mouse Settings Параметри мишки - + Set Набір - + Set %1 Набір %1 - + Left Mouse Button - + Right Mouse Button @@ -1264,42 +1273,42 @@ interpret an axis hold or release. ButtonEditDialog - + Dialog Діалог - + To make a new assignment, press any keyboard key or click a button in the Keyboard or Mouse tab Аби зробити нове призначення, натисніть клавішу на клавіатурі, чи клацніть по кнопці розташованій на вкладках «Клавіатура» чи «Мишка» - + Placeholder Заповнювач - + Enables a key press or release to only occur when a controller button is pressed. Дозволяє виконувати дію тільки при натисканні чи відпусканні клавіші. - + Toggle Перемикач - + Enables rapid key presses and releases. Turbo controller. Дозволити прискорене натискання клавіш. Турбо контролер. - + Turbo Турбо - + Last keyboard/mouse button: @@ -1308,33 +1317,33 @@ interpret an axis hold or release. Поточний: - + Slots Слоти - + Na&me: Ім'я: - + Specify the name of a button. Назначте ім'я для кнопки. - + Action: Дія: - + Specify the action that will be performed in game while this button is being used. - + Advanced Розширені параметри @@ -1347,52 +1356,52 @@ this button is being used. Набір %1 - - - + + + Choose your keyboard key - + No button - - - - + + + + Last button - + To change settings for last button, it must be at least one assignment from keyboard to gamepad - + To change settings of turbo for last button, it must be at least one assignment from keyboard to gamepad - + To open advanced dialog, it's needed to map at least one button from keyboard to gamepad - + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + As last gamepad button has been set - + Index %1 @@ -1400,190 +1409,190 @@ this button is being used. Calibration - + Form - - + + Start calibration - + Controller: - + Sticks: - - Use settings from jstest-gtk - - - - + Reset settings - + Cancel Скасувати - - + + Save Зберегти - - + + Calibration - - Do you really want to reset settings of current axes? + + Do you really want to reset settings of current axis? - + Calibration was saved for the preset. Do you really want to reset settings? - + Place the joystick in the center position. It's the part, where often you don't have to move. Just skip it in such situation. - + Calibrating center - + Start second step - + Center X: %1 - + Center Y: %1 - + Place the joystick in the top-left corner many times - - + + Calibrating position - - + + X: %1 - - + + Y: %1 - + Place the joystick in the bottom-right corner - + Start final step - + range X: %1 - %2 - + range Y: %1 - %2 - + deadzone X: %1 - + deadzone Y: %1 - + ---Calibration done!--- - + Calibration values have been saved - - + + Dead zone calibration - - You must move X axis to the right at least five times! Keep moving! + + You have to move axes to the top-left corner at least five times. - - You must move X axis to the left at least five times! Keep moving! + + You have to move axes to the bottom-right corner at least five times. - - - - + + Do you want to save calibration of current axis? + + + + + + + Axis %1 Вісь %1 @@ -1591,64 +1600,64 @@ deadzone Y: %1 CapturedWindowInfoDialog - + Captured Window Properties - + Information About Window - + Class: - - - + + + TextLabel - + Title: - + Path: - + Match By Properties - + Class - + Title - + Path - + Full Path - + File Name @@ -1713,67 +1722,67 @@ deadzone Y: %1 DPadContextMenu - + Mouse (Normal) Мишка (стандарт) - + Mouse (Inverted Horizontal) Мишка (Горизонтально інвертовано) - + Mouse (Inverted Vertical) Мишка (Вертикально інвертовано) - + Mouse (Inverted Horizontal + Vertical) Мишка (Інвертовано гор.+верт.) - + Arrows Стрілки - + Keys: W | A | S | D Клавіші: W | A | S | D - + NumPad NumPad - + None Відсутній - + Standard Стандарт - + Eight Way Вісім сторін - + 4 Way Cardinal 4 основні сторони - + 4 Way Diagonal 4 діагональні сторони - + Mouse Settings Параметри мишки @@ -1781,62 +1790,62 @@ deadzone Y: %1 DPadEditDialog - + Dialog Діалог - + Presets: Типовий набір: - + Mouse (Normal) Мишка (стандарт) - + Mouse (Inverted Horizontal) Мишка (Горизонтально інвертовано) - + Mouse (Inverted Vertical) Мишка (Вертикально інвертовано) - + Mouse (Inverted Horizontal + Vertical) Мишка (Інвертовано гор.+верт.) - + Arrows Стрілки - + Keys: W | A | S | D Клавіші: W | A | S | D - + NumPad NumPad - + None Відсутній - + Dpad Mode: Режим DPad: - + Standard: 8 region dpad with two direction buttons active when the dpad is in a diagonal region. @@ -1852,63 +1861,63 @@ to a diagonal zone. - + &Name: - + Standard Стандарт - + Eight Way Вісім сторін - + 4 Way Cardinal 4 основні сторони - + 4 Way Diagonal 4 діагональні сторони - + DPad Delay: Затримка DPad'а: - - + + Time lapsed before a direction change is taken into effect. Час затримки, через який зміна напрямку набуде чинності. - + s с - + Specify the name of a dpad. Назначте ім'я для DPad. - + Mouse Settings Параметри мишки - + Set Набір - + Set %1 Набір %1 @@ -1916,27 +1925,27 @@ to a diagonal zone. EditAllDefaultAutoProfileDialog - + Default Profile Типовий профіль - + Profile: Профіль: - + Browse Оглянути - + Open Config Відкрити конфігурацію - + Profile file path is invalid. Шлях до профілю некоректний. @@ -1944,29 +1953,29 @@ to a diagonal zone. ExtraProfileSettingsDialog - + Extra Profile Settings Розширені параметри профілю - + Key Press Time: Час натиску клавіші: - + 0.00 ms 0.00 мс - + Profile Name: Ім'я профілю: - - - + + + s с @@ -1974,7 +1983,7 @@ to a diagonal zone. GameController - + Game Controller Ігровий контролер @@ -1982,9 +1991,9 @@ to a diagonal zone. GameControllerDPad - - - + + + DPad DPad @@ -1992,187 +2001,187 @@ to a diagonal zone. GameControllerMappingDialog - + Game Controller Mapping Відображення ігрового контролеру - + <html><head/><body><p>antimicro makes use of the <a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;">Game Controller API</span></a> provided by SDL 2 in order to abstract various gamepads to fit a unified standard. In order to make a button assignment, please highlight the mapping cell for the appropriate button row below. You can then press a button or move an axis on your gamepad and the cell will update with the physical button or axis that will be used.</p><p>antimicro will use the mapping that you specify to save a mapping string that will be loaded into SDL.</p></body></html> - + A A - + B B - + X X - + Y Y - + Back Назад - + Start Старт - + Guide Guide - + Left Shoulder Ліве плече - + Right Shoulder Праве плече - + Left Stick Click Клік лівого стіку - + Right Stick Click Клік правого стіку - + Left Stick X Лівий стік X - + Left Stick Y Лівий стік Y - + Right Stick X Правий стік X - + Right Stick Y Правий стік Y - + Left Trigger Лівий триґер - + Right Trigger Правий триґер - + DPad Up DPad Верх - + DPad Left DPad Ліво - + DPad Down DPad Низ - + DPad Right DPad Право - + Mapping Відображення - + SDL 2 Game Controller Mapping String Рядок відображення контролеру від SDL 2 - + Last Axis Event: - + Current Axis Detection Dead Zone: - + 5000 5000 - + 10000 10000 - + 15000 15000 - + 20000 20000 - + 25000 25000 - + 30000 30000 - + 32000 32000 - + Game Controller Mapping (%1) (#%2) Відображення ігрового контролеру (%1) (#%2) - + Discard Controller Mapping? Скинути відображення контролеру? - + Discard mapping for this controller? If discarded, the controller will be reverted to a joystick once you refresh all joysticks. @@ -2182,47 +2191,47 @@ If discarded, the controller will be reverted to a joystick once you refresh all GameControllerSet - + Back Назад - + Guide Guide - + Start Старт - + LS Click Клік ЛС - + RS Click Клік ПС - + L Shoulder Л плече - + R Shoulder П плече - + L Trigger Л триґер - + R Trigger П триґер @@ -2230,9 +2239,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all GameControllerTrigger - - - + + + Trigger Триґер @@ -2240,9 +2249,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxis - - - + + + Axis Вісь @@ -2250,24 +2259,24 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxisButton - - - + + + Button Кнопка - + Negative Зворотній - + Positive Прямий - + Unknown Невідомо @@ -2275,74 +2284,74 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxisContextMenu - + Mouse (Horizontal) Мишка (Горизонтально) - + Mouse (Inverted Horizontal) Мишка (Горизонтально інвертовано) - + Mouse (Vertical) Мишка (Вертикально) - + Mouse (Inverted Vertical) Мишка (Вертикально інвертовано) - + Arrows: Up | Down Стрілки: Вверх | Вниз - + Arrows: Left | Right Стрілки: Вліво | Вправо - + Keys: W | S Клавіші: W | S - + Keys: A | D Клавіші: A | D - + NumPad: KP_8 | KP_2 NumPad: KP_8 | KP_2 - + NumPad: KP_4 | KP_6 NumPad: KP_4 | KP_6 - - + + None Відсутній - - + + Mouse Settings Параметри мишки - + Left Mouse Button - + Right Mouse Button @@ -2350,57 +2359,57 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButton - + Processing turbo for #%1 - %2 - + Finishing turbo for button #%1 - %2 - + Processing press for button #%1 - %2 - + Processing release for button #%1 - %2 - + Distance change for button #%1 - %2 - - - + + + Button Кнопка - - - - + + + + [NO KEY] [НЕМАЄ КНОПКИ] - + [Set %1 1W] [Набір %1 1W] - + [Set %1 2W] [Набір %1 2W] - + [Set %1 WH] [Набір %1 WH] @@ -2408,47 +2417,47 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButtonContextMenu - + Toggle Перемкнути - + Turbo Турбо - + Clear Очистити - + Set Select Встановити вибір - + Disabled Вимкнено - + Set %1 Набір %1 - + Set %1 1W Набір %1 1W - + Set %1 2W Набір %1 2W - + Set %1 WH Набір %1 WH @@ -2456,118 +2465,118 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButtonSlot - - + + Mouse Мишка - + Up Вверх - + Down Вниз - + Left Вліво - + Right Вправо - + LB ЛК - + MB СК - + RB ПК - + B4 К4 - + B5 К5 - + Pause Пауза - + Hold Утримання - + Cycle Цикл - + Distance Дистанція - + Release Віджати - + Mouse Mod Мод. мишки - + Press Time Час натиску - + Delay Затримка - + Load %1 - + Set Change %1 - + [Text] %1 - + [Exec] %1 - + [NO KEY] [НЕМАЄ КНОПКИ] @@ -2575,9 +2584,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStick - - - + + + Stick Стік @@ -2585,37 +2594,37 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickButton - - - + + + Up Верх - - - + + + Down Низ - - - + + + Left Ліво - - - + + + Right Право - - - + + + Button Кнопка @@ -2623,67 +2632,67 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickContextMenu - + Mouse (Normal) Мишка (Стандарт) - + Mouse (Inverted Horizontal) Мишка (Горизонтально інвертовано) - + Mouse (Inverted Vertical) Мишка (Вертикально інвертовано) - + Mouse (Inverted Horizontal + Vertical) Мишка (Інвертовано гор.+верт.) - + Arrows Стрілки - + Keys: W | A | S | D Клавіші: W | A | S | D - + NumPad NumPad - + None Відсутній - + Standard Стандарт - + Eight Way Вісім сторін - + 4 Way Cardinal 4 основні сторони - + 4 Way Diagonal 4 діагональні сторони - + Mouse Settings Параметри мишки @@ -2691,96 +2700,96 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickEditDialog - + Dialog Діалог - + X: X: - - - - - + + + + + 0 0 - + Y: Y: - + Distance: Дистанція: - + Bearing: Напрям: - + % Safe Zone: % Безпечна зона: - + Presets: Типовий набір: - + Mouse (Normal) Мишка (стандарт) - + Mouse (Inverted Horizontal) Мишка (Горизонтально інвертовано) - + Mouse (Inverted Vertical) Мишка (Вертикально інвертовано) - + Mouse (Inverted Horizontal + Vertical) Мишка (Інвертовано гор.+верт.) - + Arrows Стрілки - + Keys: W | A | S | D Клавіші: W | A | S | D - + NumPad NumPad - + None Відсутній - + Stick Mode: Режим стіка: - + Standard: 8 region stick with two direction buttons active when the stick is in a diagonal region. @@ -2796,97 +2805,97 @@ to a diagonal zone of the stick. - + Standard Стандарт - + Eight Way Вісім сторін - + 4 Way Cardinal 4 основні сторони - + 4 Way Diagonal 4 діагональні сторони - + Dead Zone: Сліпа зона: - - + + Dead zone value to use for an analog stick. - + Max Zone: Максимальна зона: - - + + Value when an analog stick is considered moved 100%. - + Diagonal Range: Діагональний діапазон: - - + + The area (in degrees) that each diagonal region occupies. - + Square Stick: Квадратність стіку: - - + + Percentage to modify a square stick coordinates to confine values to a circle - + % % - + Stick Delay: Затримка стіка: - - + + Time lapsed before a direction change is taken into effect. Час затримки, через який зміна напрямку набуде чинності. - + s с - + Modifier: - + Edit button that is active while the stick is active. This button is useful for assigning zones with @@ -2895,33 +2904,33 @@ functionality to an analog stick. - + PushButton - + Na&me: Name: Ім'я: - + Specify the name of an analog stick. Назначте ім'я для аналогового стіка. - + Mouse Settings Параметри мишки - + Set Набір - + Set %1 Набір %1 @@ -2929,9 +2938,9 @@ functionality to an analog stick. JoyControlStickModifierButton - - - + + + Modifier @@ -2939,9 +2948,9 @@ functionality to an analog stick. JoyDPad - - - + + + DPad DPad @@ -2949,37 +2958,37 @@ functionality to an analog stick. JoyDPadButton - - - + + + Up Верх - - - + + + Down Низ - - - + + + Left Ліво - - - + + + Right Право - - - + + + Button Кнопка @@ -2987,267 +2996,272 @@ functionality to an analog stick. JoyTabWidget - - - - - - + + + + + + <New> <Новий> - - + + Remove Вилучити - - + + Remove configuration from recent list. Вилучити конфігурацію з переліку частого користування. - - + + Load Завантажити - - + + Load configuration file. Завантажити файл конфігурації. - - + + Save Зберегти - - + + Save changes to configuration file. Зберегти зміни до файлу конфігурації. - - + + Save As Зберегти як - - + + Save changes to a new configuration file. Зберегти зміни в новий файл конфігурації. - - + + Sets Набори - + Copy from Set Копіювати з набору - + Settings Параметри - - + + Set 1 Набір 1 - - + + Set 2 Набір 2 - - + + Set 3 Набір 3 - - + + Set 4 Набір 4 - - + + Set 5 Набір 5 - - + + Set 6 Набір 6 - - + + Set 7 Набір 7 - - + + Set 8 Набір 8 - - + + Stick/Pad Assign Призначення стіків/DPad - - + + Controller Mapping Відображення контролеру - - + + Quick Set Швидкий набір - - + + Names Імена - - + + Toggle button name displaying. Перемкнути показ команд на кнопках. - - + + Pref Параметри - - + + Change global profile settings. Змінити глобальні параметри профілю. - - - + + + Reset Скинути - - + + Revert changes to the configuration. Reload configuration file. Відновити зміни. Перезавантажити файл конфігурації. - + Open Config Відкрити конфігурацію - + Config Files (*.amgp *.xml) - - - + + + Save Config Зберегти конфігурацію - - - + + + Config File (*.%1.amgp) - - + + Do you really want to reset buttons settings for joystick? + + + + + Set Набір - - + + Save Profile Changes? Зберегти зміни профілю? - - + + Changes to the new profile have not been saved. Would you like to save or discard the current profile? Зміни до нового профілю не збережені. Зберегти їх до поточного профілю? - - + + Changes to the profile "%1" have not been saved. Would you like to save or discard changes to the current profile? Зміни до профілю "%1" не збережені. Зберегти їх до поточного профілю? - + Sticks Стіки - - + + DPads DPad'и - + No buttons have been assigned. Please use Quick Set to assign keys to buttons or disable hiding empty buttons. Жодної кнопки не назначено. Використовуйте «Швидкий набір» для призначення клавіш, або ж вимкніть приховування пустих кнопок. - - + + Set %1: %2 Набір %1: %2 - - + + Set %1 Набір %1 - + Copy Set Assignments Скопіювати набір значень - + Are you sure you want to copy the assignments and device properties from %1? Дійсно бажаєте скопіювати значення і властивості пристрою з %1? @@ -3255,7 +3269,7 @@ to buttons or disable hiding empty buttons. Joystick - + Joystick Джойстик @@ -3263,98 +3277,98 @@ to buttons or disable hiding empty buttons. JoystickStatusWindow - + Properties Властивості - + Details Деталі - + Name: Ім'я: - - - - - - - + + + + + + + %1 %1 - + Number: Кількість: - + Axes: Вісь: - + Buttons: Кнопок: - + Hats: Міні джойстиків: - + GUID: GUID: - + Game Controller: Ігровий контролер: - + Axes Вісь - + Buttons Кнопки - + Hats Міні джойстики - + %1 (#%2) Properties Властивості %1 (#%2) - + Axis %1 Вісь %1 - + Hat %1 Міні джойстик %1 - + No Ні - + Yes Так @@ -3362,62 +3376,67 @@ to buttons or disable hiding empty buttons. MainSettingsDialog - + Edit Settings Змінити параметри - + General Основні - + Controller Mappings Відображення контролеру - + Language Мова - + Auto Profile Авто-профіль - + Mouse Мишка - + Advanced Розширені параметри - + + Profile Direc&tory: + + + + <html><head/><body><p>Specify the default directory that the program should use in file dialogs when loading a profile or saving a new profile.</p></body></html> <html><head/><body><p>Вкажіть типову теку, яку програма використовуватиме для збереження профілів.</p></body></html> - + Recent Profile Count: Кількість швидких профілів: - + <html><head/><body><p>Number of profiles that can be placed in recent profile list. 0 will result in the program not enforcing a limit on the number of profiles displayed.</p></body></html> <html><head/><body><p>Кількість профілів, які будуть показані в переліку часто уживаних. Значення 0 трактується програмою, як необмежена кількість профілів для показу.</p></body></html> - + Gamepad Poll Rate: - + Change the poll rate that the program uses to discover new events from gamepads. Defaults to 10 ms. @@ -3427,29 +3446,29 @@ before using antimicro unattended. - + Hide main window when the main window close button is clicked instead of quitting the program. Приховувати головне вікно кнопкою закриття замість виходу з програми. - + Close To Tray Закривати до лотку - + Have Windows start antimicro at system startup. - + Launch At Windows Startup Запускати разом із Windows - + Display recent profiles for all controllers as a single list in the tray menu. Defaults to using sub-menus. @@ -3458,12 +3477,12 @@ to using sub-menus. Типово використовується підменю. - + Single Profile List in Tray Один перелік профілів в лотку - + Have the program minimize to the taskbar. By default, the program minimizes to the system tray if available. @@ -3472,12 +3491,12 @@ tray if available. лотку, якщо є можливість. - + Minimize to Taskbar Згортати до панелі завдань - + This option will cause the program to hide all buttons that have no slots assigned to them. The Quick Set dialog window will have to be used @@ -3489,12 +3508,12 @@ to bring up the edit dialog for gamepad buttons. ігрового контролера. - + Hide Empty Buttons Приховати пусті кнопки - + When the program is launched, open the last known profile that was opened during the previous session. @@ -3503,174 +3522,184 @@ previous session. у попередній сесії. - + Auto Load Last Opened Profile Автоматично завантажувати останній відкритий профіль - + Only show the system tray icon when the program first launches. Показувати лише піктограму в системному лотку під час першого запуску. - + Launch in Tray Запускати в лотку - + Associate .amgp files with antimicro in Windows Explorer. - + Associate Profiles Прив'язати профілі - + Key Repeat Повтор клавіш - + Active keys will be repeatedly pressed when this option is enabled. Активні клавіші повторно натискатимуться коли цей параметр активний. - - + + Enable - + Specifies how much time should elapse before key repeating begins. - + Specifies how many times key presses will be performed per seconds. - + <html><head/><body><p>antimicro has been translated into many different languages by contributors. By default, the program will choose an appropriate translation based on your system's locale setting. However, you can make antimicro load a different translation depending on the language that you choose from the list below.</p></body></html> - + Português do Brasil - + Français - + Deutsch - + Italiano - + 日本語 - + Русский - + српски / srpski - + 简体中文 - + Español - + українська - + Polski - + + History Si&ze: + + + + Log File: - + Log Level: - + None Відсутній - + Error - + Warning - + Info Інформація - + Debug - + + Reset + Скинути + + + Class - + Title - + Program - + Disable the "Enhanced Pointer Precision" Windows setting while antimicro is running. Disabling "Enhanced Pointer Precision" will allow mouse movement within antimicro to be more @@ -3678,32 +3707,27 @@ precise. - + Disable Enhance Pointer Precision - + Smoothing - - Histor&y Size: - - - - + Weight &Modifier: - + Refresh Rate: - + The refresh rate is the amount of time that will elapse in between mouse events. Please be cautious when editing this setting as it will cause the program to use @@ -3713,46 +3737,46 @@ it unattended. - + Spring Пружинний - + Screen: - + Utilize the specified screen for spring mode. On Linux, the default is to use the primary screen. On Windows, the default is to use all available screens. - + Accel Numerator: - - - + + + 0 0 - + Accel Denominator: - + Accel Threshold: - + If the acceleration values for the virtual mouse have been changed by a different process, particularly when quitting an older game, then you might want to reset the acceleration @@ -3760,71 +3784,66 @@ values used by the virtual mouse. - + Reset Acceleration - + Delay: Затримка: - - Profi&le Directory: - - - - + ms мс - + Rate: Частота: - + times/s разів/с - + Below is a list of the custom mappings that have been saved. You can use the following table to delete mappings or have mappings temporarily disabled. You can also disable mappings that are included with SDL; just insert a new row with the appropriate joystick GUID and check disable. Settings will not take affect until you either refresh all joysticks or unplug that particular joystick. - + GUID GUID - + Mapping String Рядок відображення - + Disable? Вимкнути? - - + + Delete Вилучити - + Insert Вставити - - + + Default Типова @@ -3833,7 +3852,7 @@ Settings will not take affect until you either refresh all joysticks or unplug t Brazilian Portuguese - + English English @@ -3842,84 +3861,94 @@ Settings will not take affect until you either refresh all joysticks or unplug t German - - + + Active Активний - + Devices: Пристрої: - - + + All Всі - + Device Пристрій - + Profile Профіль - + Default? Типовий? - + Add Додати - + Edit Змінити - + Also, Windows users who want to use a low value should also check the "Disable Enhance Pointer Precision" checkbox if you haven't disabled the option in Windows. - + Select Default Profile Directory Обрати типову теку профілю - + Are you sure you want to delete the profile? Дійсно вилучити профіль? - + Save Log File As - + Log Files (*.log) + + + Do you really want to reset setting? + + + + + Would you like to reset mappings too? + + MainWindow - + antimicro - + No Joysticks have been found. Please plug in a joystick and then choose the "Update Joysticks" option in the main menu Не знайдено жодного джойстика. @@ -3930,115 +3959,115 @@ the option in Windows. Якщо події в грі не спостерігаються, натисніть тут, аби запустити програму з правами Адміністратора. - + If events are not seen by a game, please click here to run this application as Administrator. - + &App Прогр&ама - + &Options &Параметри - + &Help &Допомога - - + + &Quit &Вихід - + Ctrl+Q Ctrl+Q - - + + &Update Joysticks &Оновити джойстики - + Ctrl+U Ctrl+U - - + + &Hide &Згорнути - + Ctrl+H Ctrl+H - + &About Пр&о програму - + Ctrl+A Ctrl+A - + About &Qt - + &Properties - + &Key Checker - + &GitHub Page - + &Game Controller Mapping - + S&ettings - + &Stick/Pad Assign - + &Wiki - + &Issues - + &Calibration @@ -4055,7 +4084,7 @@ the option in Windows. Перевірка клавіш - + Home Page Домашня сторінка @@ -4080,66 +4109,66 @@ the option in Windows. Wiki - + Could not find a proper controller identifier. Exiting. - - - - - - - + + + + + + + (%1) (%1) - - + + Open File Відкрити файл - + &Restore &Відновити - + Calibration couldn't be opened - + You must connect at least one controller to open the window - + Run as Administrator? Запустити із правами Адміністратора? - + Are you sure that you want to run this program as Adminstrator? Some games run as Administrator which will cause events generated by antimicro to not be used by those games unless antimicro is also run as the Adminstrator. This is due to permission problems caused by User Account Control (UAC) options in Windows Vista and later. - + Failed to elevate program Не вдалося підняти права програмі - + Failed to restart this program as the Administrator Не вдалось перезапустити програму із правами Адміністратора - + Could not find controller. Exiting. @@ -4147,12 +4176,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseAxisSettingsDialog - + Mouse Settings - Параметри мишки - - + Set %1 Набір %1 @@ -4160,12 +4189,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseButtonSettingsDialog - + Mouse Settings - Параметри мишки - - + Set %1 Набір %1 @@ -4173,12 +4202,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseControlStickSettingsDialog - + Mouse Settings Параметри мишки - + Set %1 Набір %1 @@ -4186,12 +4215,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseDPadSettingsDialog - + Mouse Settings Параметри мишки - + Set %1 Набір %1 @@ -4199,17 +4228,17 @@ Some games run as Administrator which will cause events generated by antimicro t MouseSettingsDialog - + Mouse Settings Параметри мишки - + Mouse Mode: Режим мишки: - + Cursor mode is used to move the mouse cursor around the screen relative to its current position depending on how much you move an axis @@ -4223,80 +4252,80 @@ axis is moved back to the dead zone. - + Cursor Курсор - + Spring Пружинний - + Acceleration: Прискорення: - + Enhanced Precision Покращена точність - - + + Linear Лінійне - + Quadratic Квадратичне - + Cubic Кубічне - + Quadratic Extreme Екстремально квадратичне - + Power Function По степеневій функції - + Easing Quadratic Просте квадратичне - + Easing Cubic Просте кубічне - + Mouse Speed Settings Параметри швидкості мишки - + Enable to change the horizontal and vertical speed boxes at the same time. Змінювати значення гоизонтальної та вертикальної швидкості разом. - + Change Together Змінювати разом - + Options for adding more acceleration to the mouse movement beyond what the acceleration curve would produce. Acceleration is added based on how quickly an axis is @@ -4306,23 +4335,23 @@ using typical gamepad analog sticks. - + Delta Acceleration - + &Multiplier: - + Mi&n Threshold: - + E&xtra Duration: @@ -4333,8 +4362,8 @@ Speed: швидкість: - - + + 1 = 20 pps 1 = 20 pps @@ -4345,34 +4374,34 @@ Speed: швидкість: - + Wheel Hori. Speed: Коліщатко горизонт.: - + Set the speed used for horizontal mouse wheel movement according to number of simulated notches per second. Встановіть швидкість для горизонтальної прокрутки коліщатка миші відносно від числа симуляції кроків за секунду. - - + + 1 = 1 notch(es)/s 1 = 1 крок(ів)/с - + Wheel Vert. Speed: Коліщатко вертикаль.: - + Set the speed used for vertical mouse wheel movement according to number of simulated notches per second. Встановіть швидкість для вертикальної прокрутки коліщатка @@ -4383,7 +4412,7 @@ according to number of simulated notches per second. Чутливість: - + For Power Function acceleration curve. Specifies the factor to use for curve sensitivity. When the value is above 1.0, the mouse movement will be accelerated @@ -4391,20 +4420,20 @@ faster at the low end of an axis. - + Easing Duration: - - - - + + + + % % - + Enhanced: Three tier curve that makes the mouse move slow on the low end of an axis and fast on the high end. @@ -4426,167 +4455,167 @@ a period of time using a Cubic curve. - + Hori&zontal Speed: - + &Vertical Speed: - + Sensitivit&y: - + Specifies the amount of time (in seconds) that will be required before the mouse is fully accelerated after reaching the high end of an axis. - - + + s с - + Highest value to accelerate mouse movement by - + x x - + Start %: - + Acceleration begins at this percentage of the base multiplier - + Minimum amount of axis travel required for acceleration to begin - + Max Threshold: - + Maximum axis travel before acceleration has reached the multiplier value - + Extend the time that extra acceleration is applied. Axis travel will be taken into account. A slower flick will decrease the actual time that extra acceleration will be applied. - + Curve: - + Ease Out Sine - + Ease Out Quad - + Ease Out Cubic - + Spring Settings Параметри пружини - + Spring Width: Ширина пружини: - + Changes the width of the region that the cursor can move in spring mode. 0 will use the entire width of your screen. - + Spring Height: Висота пружини: - + Changes the height of the region that the cursor can move in spring mode. 0 will use the entire height of your screen. - + Release Radius: - + Specifies that the spring area will be relative to the mouse position set by a non-relative spring. - + Relative Відносний - + Mouse Status Стан мишки - + X: X: - - + + 0 (0 pps) 0 (0 pps) - + Y: Y: - - + + %n notch(es)/s %n крок/с @@ -4598,39 +4627,39 @@ mouse position set by a non-relative spring. QKeyDisplayDialog - + Key Checker Перевірка клавіш - - <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> + + <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="http://doc.qt.io/qt-5/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">http://doc.qt.io/qt-5/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> - + Event Handler: Обробник подій: - + Native Key Value: Нативне значення клавіші: - - - + + + 0x00000000 0x00000000 - + Qt Key Value: Значення клавіші Qt: - + antimicro Key Value: @@ -4638,265 +4667,265 @@ mouse position set by a non-relative spring. QObject - + Daemon launched Демон завантажений - + Failed to launch daemon Помилка під час завантаження демону - + Launching daemon Запуск демона - - + + Display string "%1" is not valid. Виведений рядок «%1» не є вірним. - + Failed to set a signature id for the daemon - + Failed to change working directory to / Не вдалось змінити робочу теку на / - + Quitting Program - + # of joysticks found: %1 # джойстиків знайдено: %1 - + List Joysticks: Перелік джойстиків: - + --------------- --------------- - + Joystick %1: Джойстик %1: - + Index: %1 Індекс: %1 - + GUID: %1 GUID: %1 - + Name: %1 Ім'я: %1 - + Yes Так - + No Ні - + Game Controller: %1 Ігровий контролер: %1 - + # of Axes: %1 # Вісі: %1 - + # of Buttons: %1 # Кнопок: %1 - + # of Hats: %1 # Міні-падів: %1 - + Attempting to use fallback option %1 for event generation. - + Failed to open event generator. Exiting. - + Using %1 as the event generator. - + Could not raise process priority. - + Super Super - + Menu Меню - + Mute Mute - + Vol+ Vol+ - + Vol- Vol- - + Play/Pause Play/Pause - + Play Play - + Pause Pause - + Prev Prev - + Next Next - + Mail Пошта - + Home Home - + Media Media - + Search Пошук - + Last button - + There isn't a last button pressed from gamepad in data. Did you set at least one button from gamepad for keyboard? - + Active window changed to: Title = "%1", Class = "%2", Program = "%3" or "%4". - + Profile location %1 is not an XML file. Профіль %1 не є XML файлом. - + Profile location %1 does not exist. Профіль %1 не існує. - - - + + + Controller identifier is not a valid value. Контролер має хибне значення ідентифікатора. - + An invalid set number '%1' was specified. - + Controller identifier '%s'' is not a valid value. - + No set number was specified. Не вказаний набір значень. - + No controller was specified. Жодного контролеру не було вказано. - + No display string was specified. Жодного рядка для показу не було вказано. - + An invalid event generator was specified. - + No event generator string was specified. - + No log file specified. @@ -4931,22 +4960,22 @@ mouse position set by a non-relative spring. Запустити програму в режимі демона. - + Logging started - + Auto-switching to profile "%1". - + Auto-switching to nullptr profile! - + xinput version must be at least 2.0. No mouse acceleration changes will occur. Версія xinput має бути вище 2.0. Зміна швидкості миші не використовується. @@ -4954,18 +4983,18 @@ mouse position set by a non-relative spring. QuickSetDialog - + Quick Set Швидкий набір - + <html><head/><body><p>Please press a button or move an axis on %1 (<span style=" font-weight:600;">%2</span>).<br/>A dialog window will then appear which will<br/>allow you to make an assignment.</p></body></html> <html><head/><body><p>Натисніть кнопку, чи змістіть вісь по %1 (<span style=" font-weight:600;">%2</span>).<br/>З'явиться діалогове вікно<br/>в якому зможете зробити переназначення.</p></body></html> - - + + Quick Set %1 Швидкий набір %1 @@ -4973,12 +5002,12 @@ mouse position set by a non-relative spring. SetAxisThrottleDialog - + Throttle Change Зміна тяги - + The throttle setting for Axis %1 has been changed. Would you like to distribute this throttle change to all sets? @@ -4990,12 +5019,12 @@ Would you like to distribute this throttle change to all sets? SetJoystick - + Set %1: %2 Набір %1: %2 - + Set %1 Набір %1 @@ -5003,52 +5032,52 @@ Would you like to distribute this throttle change to all sets? SetNamesDialog - + Set Name Settings Параметри наборів - + Set 1 Набір 1 - + Set 2 Набір 2 - + Set 3 Набір 3 - + Set 4 Набір 4 - + Set 5 Набір 5 - + Set 6 Набір 6 - + Set 7 Набір 7 - + Set 8 Набір 8 - + Name Ім'я @@ -5056,7 +5085,7 @@ Would you like to distribute this throttle change to all sets? SimpleKeyGrabberButton - + Mouse Мишка @@ -5064,7 +5093,7 @@ Would you like to distribute this throttle change to all sets? SpringModeRegionPreview - + Spring Mode Preview Перегляд пружинного режиму @@ -5072,7 +5101,7 @@ Would you like to distribute this throttle change to all sets? UInputEventHandler - + Could not find a valid uinput device file. Please check that you have the uinput module loaded. lsmod | grep uinput @@ -5081,14 +5110,14 @@ lsmod | grep uinput lsmod | grep uinput - + Could not open uinput device file Please check that you have permission to write to the device Неможливо відкрити uinput файл пристрою Перевірте, чи маєте ви права на запис до пристрою - + Using uinput device file %1 @@ -5096,551 +5125,551 @@ Please check that you have permission to write to the device UInputHelper - + a a - + b b - + c c - + d d - + e e - + f f - + g g - + h h - + i i - + j j - + k k - + l l - + m m - + n n - + o o - + p p - + q q - + r r - + s s - + t t - + u u - + v v - + w w - + x x - + y y - + z z - + Esc Esc - + F1 F1 - + F2 F2 - + F3 F3 - + F4 F4 - + F5 F5 - + F6 F6 - + F7 F7 - + F8 F8 - + F9 F9 - + F10 F10 - + F11 F11 - + F12 F12 - + ` ` - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - - + + - - - + = = - + BackSpace BackSpace - + Tab Tab - + [ [ - + ] ] - + \ \ - + CapsLock CapsLock - + ; ; - + ' ' - + Enter Enter - + Shift_L Shift_Л - + , , - - + + . . - - + + / / - + Ctrl_L Ctrl_Л - - + + Super_L Super_Л - + Alt_L Alt_Л - + Space Пробіл - + Alt_R Alt_П - + Menu Меню - + Ctrl_R Ctrl_П - + Shift_R Shift_П - + Up Вверх - + Left Вліво - + Down Вниз - + Right Вправо - + PrtSc PrtSc - + Ins Ins - + Del Del - + Home Home - + End End - + PgUp PgUp - + PgDn PgDn - + NumLock NumLock - + * * - + + + - + KP_Enter KP_Enter - + KP_1 KP_1 - + KP_2 KP_2 - + KP_3 KP_3 - + KP_4 KP_4 - + KP_5 KP_5 - + KP_6 KP_6 - + KP_7 KP_7 - + KP_8 KP_8 - + KP_9 KP_9 - + KP_0 KP_0 - + SCLK SCLK - + Pause Pause - + Super_R Super_П - + Mute Mute - + VolDn VolDn - + VolUp VolUp - + Play Play - + Stop Stop - + Prev Prev - + Next Next - + [NO KEY] [НЕМАЄ КНОПКИ] @@ -5648,54 +5677,54 @@ Please check that you have permission to write to the device UnixWindowInfoDialog - + Captured Window Properties - + Information About Window - + Class: - - - + + + TextLabel - + Title: - + Path: - + Match By Properties - + Class - + Title - + Path @@ -5703,9 +5732,9 @@ Please check that you have permission to write to the device VDPad - - - + + + VDPad VDPad @@ -5713,224 +5742,224 @@ Please check that you have permission to write to the device VirtualKeyPushButton - + Space Пробіл - + Tab Tab - + Shift (L) Shift (Л) - + Shift (R) Shift (П) - + Ctrl (L) Ctrl (Л) - + Ctrl (R) Ctrl (П) - + Alt (L) Alt (Л) - - + + Alt (R) Alt (П) - + Alt Gr - + ` ` - + ~ ~ - - + + - - - + = = - + [ [ - + ] ] - + \ \ - + Caps Caps - + ; ; - + ' ' - + , , - - + + . . - - + + / / - + ESC ESC - + PRTSC PRTSC - + SCLK SCLK - + INS INS - + PGUP PGUP - + DEL DEL - + PGDN PGDN - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - + NUM LK NUM LK - - + + * * - + + + - + Enter Enter @@ -5947,42 +5976,42 @@ E R - + < < - + : : - + Super (L) Super (Л) - + Menu Меню - + Up Вверх - + Down Вниз - + Left Вліво - + Right Вправо @@ -5990,226 +6019,226 @@ R VirtualKeyboardMouseWidget - - + + Keyboard Клавіатура - - + + Mouse Мишка - + Left Mouse Вліво - + Up Mouse Вверх - + Left Button Mouse Ліва кнопка - + Middle Button Mouse Середня кнопка - + Right Button Mouse Права кнопка - + Wheel Up Mouse Коліщатко вверх - + Wheel Left Mouse Коліщатко вліво - + Wheel Right Mouse Коліщатко вправо - + Wheel Down Mouse Коліщатко вниз - + Down Mouse Вниз - + Right Mouse Вправо - + Button 4 Mouse Кнопка 4 - + Mouse 8 Mouse Мишка 8 - + Button 5 Mouse Кнопка 5 - + Mouse 9 Mouse Мишка 9 - + Mouse Settings Параметри мишки - + NONE Відсутній - - + + Last button - - + + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + Others - + Applications - + Browser Back - + Browser Favorites - + Browser Forward - + Browser Home - + Browser Refresh - + Browser Search - + Browser Stop - + Calc - + Email - + Media Media - + Media Next - + Media Play - + Media Previous - + Media Stop - + Search Пошук - + Volume Down - + Volume Mute - + Volume Up @@ -6217,7 +6246,7 @@ R VirtualMousePushButton - + INVALID ХИБНИЙ @@ -6225,28 +6254,28 @@ R WinAppProfileTimerDialog - - + + Capture Application Захопити програму - + After pressing the "Capture Application" button, please select the application window that you want to have a profile associated with. The active application will be captured after the selected number of seconds. Після натискання «Захопити програму», зробіть активним вікно програм, яку ви хочете прив'язати до поточного профілю. Активне вікно буде захоплено через вказаний проміжок часу. - + Timer: Таймер: - + Seconds Секунд - + Cancel Скасувати @@ -6254,12 +6283,12 @@ R WinExtras - + [NO KEY] [НЕМАЄ КНОПКИ] - + AntiMicro Profile AntiMicro профіль @@ -6267,67 +6296,66 @@ R X11Extras - + ESC ESC - + Tab Tab - + Space Пробіл - + DEL DEL - + Return Return - + KP_Enter KP_Enter - + Backspace Backspace - + Alt Gr - + xinput extension was not found. No mouse acceleration changes will occur. Розширення xinput не знайдено. Зміна швидкості миші не використовується. - + xinput version must be at least 2.0. No mouse acceleration changes will occur. Версія xinput має бути вище 2.0. Зміна швидкості миші не використовується. - Virtual pointer found with id=%1. - Віртуальний вказівник знайдено із id=%1. + Віртуальний вказівник знайдено із id=%1. - + PtrFeedbackClass was not found for virtual pointer.No change to mouse acceleration will occur for device with id=%1 Не знайдено PtrFeedbackClass для віртуального вказівника. Зміна швидкості миші не використовується для пристрою із id=%1 - + Changing mouse acceleration for device with id=%1 Зміна прискорення мишки для пристрою із id=%1 @@ -6335,7 +6363,7 @@ R XMLConfigReader - + Could not write updated profile XML to file %1. Неможливо записати оновлений профіль до файлу %1. @@ -6343,7 +6371,7 @@ R XMLConfigWriter - + Could not write to profile at %1. Неможливо записати профіль як %1. @@ -6351,7 +6379,7 @@ R antimicro - + Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support. @@ -6359,97 +6387,97 @@ R main - + Launch program in system tray only. Запустити програму згорнутою у системний лоток. - + Launch program with the tray menu disabled - + Launch program without the main window displayed - + Launch program with the configuration file selected as the default for selected controllers. Defaults to all controllers - + location - + Apply configuration file to a specific controller. Value can be a controller index, name, or GUID - + value - + Unload currently enabled profile(s) - + value(s) - + Start joysticks on a specific set. Value can be a controller index, name, or GUID - + number value - + Launch program as a daemon. Use only on Linux. - + Enable logging - + log-type - + Choose a file for logs writing - + filename - + Choose between using XTest support and uinput support for event generation. Use only if you have enabled xtest and uinput options on Linux or vmulti on Windows. Default: xtest. - + event-generation-type - + Print information about joysticks detected by SDL. Use only if you have sdl library. You can check your controller index, name or even GUID. diff --git a/share/antimicro/translations/antimicro_zh_CN.ts b/share/antimicro/translations/antimicro_zh_CN.ts old mode 100644 new mode 100755 index ae17569d0..7875d1237 --- a/share/antimicro/translations/antimicro_zh_CN.ts +++ b/share/antimicro/translations/antimicro_zh_CN.ts @@ -4,22 +4,22 @@ AboutDialog - + About 关于 - + antimicro antimicro - + Version 版本 - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -63,12 +63,12 @@ p, li { white-space: pre-wrap; } - + Info 信息 - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -186,12 +186,12 @@ p, li { white-space: pre-wrap; } - + Changelog 更新日志 - + "juliagoda" (since March, 2018) Wanting only to play my favourite old games that din't support gamepads, I found this project (which map keyboard keys and mouse buttons to connected gamepads on Linux) as most proper and recent. But because of poor choices of such application on the internet and since it didn't compile properly, I decided to rescue the project. However, once I finished my work (enough to enjoy playing games) I thought about sharing this code with others. Of course all informations about past programmers will be held. "Ryochan7" (since December 30, 2012 until 2017), I have been working on antimicro in my spare time. What originally started as a fork of QJoyPad and a way to learn proper event-driven programming has turned into something much bigger than I originally intended. Although I have spent a lot of time learning new techniques, finding out more about the domain of KB+M emulation, and spending Friday nights bashing my head against my keyboard, it has been a fun and enriching experience overall. @@ -209,7 +209,7 @@ As of May 24, 2016, this project has moved to https://github.com/AntiMicro/antim - + Copyright: 2013 - 2018 版权:2013 - 2018 {2013 ?} @@ -243,7 +243,7 @@ As of May 24, 2016, this project has moved to https://github.com/AntiMicro/antim 版权:2013 - 2016 - + Credits 致谢 @@ -546,42 +546,42 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.</span></p></body></html> - + About Development 关于开发 - + License 许可 - + Program Version %1 程序版本 %1 - + Program Compiled on %1 at %2 编译时间 %1 %2 - + Built Against SDL %1 使用 SDL %1 构建 - + Running With SDL %1 使用 SDL %1 运行 - + Using Qt %1 使用 Qt %1 - + Using Event Handler: %1 使用事件处理程序:%1 @@ -589,29 +589,29 @@ p, li { white-space: pre-wrap; } AddEditAutoProfileDialog - + Auto Profile Dialog 自动配置文件对话框 - + Profile: 配置文件: - - + + Browse 浏览 - + Window: 窗口: - - + + Select Window. Click on the appropriate application window and the application file path will be populated in the form. @@ -619,38 +619,47 @@ in the form. 单击应用程序的窗口,程序文件路径将被自动填入表格。 - + Detect Window Properties 检测窗口属性 - + Class: 类: - + Title: 标题: - + + set partial title + + + + Application: 应用程序: - + Select 选择 - + + De&vices: + + + Devices: - 设备: + 设备: - - + + Select this profile to be the default loaded for the specified device. The selection will be used instead of the all default profile option. @@ -658,84 +667,84 @@ of the all default profile option. 这个配置文件将取代全局默认配置文件选项。 - + Set as Default for Controller 设为上述设备的默认配置文件 - - + + A different profile is already selected as the default for this device. 这个设备已被指定了另一个不同的默认配置文件。 - + Current (%1) 当前 (%1) - + Open Config 打开配置文件 - - + + Select Program 选择程序 - + Programs (*.exe) 程序 (*.exe) - + Please use the main default profile selection. 请使用全局默认配置文件选项。 - + Please select a window by using the mouse. Press Escape if you want to cancel. 请使用鼠标选择窗口。按 Esc 键取消。 - + Capture Application Window 捕捉应用程序窗口 - + Could not obtain information for the selected window. 无法获得所选窗口的信息。 - + Application Capture Failed 应用程序捕捉失败 - + Profile file path is invalid. 配置文件路径无效。 - + No window matching property was specified. 未指定窗口匹配属性。 - + Program path is invalid or not executable. 程序路径无效或非可执行文件。 - + File is not an .exe file. 文件不是 .exe 文件。 - + No window matching property was selected. 未选择窗口匹配属性。 @@ -743,502 +752,502 @@ of the all default profile option. AdvanceButtonDialog - - + + Advanced 高级选项 - + Assignments 分配 - + Toggle 开关 - + Turbo 连发 - + Set Selector 设置选择器 - + Blank or KB/M 空白或键鼠 - + Hold 按下 - + Pause 暂停 - + Cycle 周期 - + Distance 距离 - + Insert 插入 - + Delete 删除 - + Clear All 清除所有 - + Time: 时间: - + 0.01s 0.01秒 - + 0s 0秒 - + Insert a pause that occurs in between key presses. 在按键间插入暂停。 - + Release 释放 - - + + Insert a new blank slot. 插入新动作。 - + Delete a slot. 删除所选动作。 - + Clear all currently assigned slots. 清除所有动作。 - + Specify the duration of an inserted Pause or Hold slot. 为“暂停”或“按下”动作指定所需时长。 - + 0m 0分 - + &Mouse Speed Mod: 鼠标速度更改 (&M): - - + + Specify the range past an axis dead zone in which a sequence of actions will execute. 为“距离”动作指定所需的超过不灵敏区的距离。 - + Distance: 距离: - - + + % % - + Mouse Mod 鼠标变速 - + Press Time 按下时间 - + Delay 延迟 - + Execute 运行 - + Load 载入 - + Set Change 设置改变 - + Text Entry 文本键入 - + Placeholder 占位符 - - + + 0 0 - + Set the percentage that mouse speeds will be modified by. 设置鼠标移动速度百分比。 - + Auto Reset Cycle After 在此时间之后取消未完成的“周期”动作 - + seconds - + Executable: 可执行文件: - + ... ... - + Arguments: 参数: - - - + + + Enabled 启用 - + Mode: 模式: - + <html><head/><body><p>Normal: Repeatedly press and release a button by the chosen rate.</p><p>Gradient: Modify the button press and button release delay based on how far an axis has been moved. The rate will remain the same.</p><p>Pulse: Modify how many times a button is pressed and released per second. The button delay will remain the same.</p></body></html> <html><head/><body><p>正常:以所选频率重复按下并释放按键。</p><p>梯度:根据轴移动幅度调整按钮被按下和释放的延迟。频率保持不变。</p><p>脉冲:调整每秒按钮被按下和释放的次数。按钮延迟保持不变。</p></body></html> - + Normal 正常 - + Gradient 梯度 - + Pulse 脉冲 - + Delay: 延迟: - + 0.10s 0.10秒 - + Rate: 频率: - + 10.0/s 10.0/秒 - - + + Disabled 禁用 - + Select Set 1 One Way 单向选择设置1 - + Select Set 1 Two Way 双向选择设置1 - + Select Set 1 While Held 按下时选择设置1 - + Select Set 2 One Way 单向选择设置2 - + Select Set 2 Two Way 双向选择设置2 - + Select Set 2 While Held 按下时选择设置2 - + Select Set 3 One Way 单向选择设置3 - + Select Set 3 Two Way 双向选择设置3 - + Select Set 3 While Held 按下时选择设置3 - + Select Set 4 One Way 单向选择设置4 - + Select Set 4 Two Way 双向选择设置4 - + Select Set 4 While Held 按下时选择设置4 - + Select Set 5 One Way 单向选择设置5 - + Select Set 5 Two Way 双向选择设置5 - + Select Set 5 While Held 按下时选择设置5 - + Select Set 6 One Way 单向选择设置6 - + Select Set 6 Two Way 双向选择设置6 - + Select Set 6 While Held 按下时选择设置6 - + Select Set 7 One Way 单向选择设置7 - + Select Set 7 Two Way 双向选择设置7 - + Select Set 7 While Held 按下时选择设置7 - + Select Set 8 One Way 单向选择设置8 - + Select Set 8 Two Way 双向选择设置8 - + Select Set 8 While Held 按下时选择设置8 - + sec. 秒。 - + /sec. /秒。 - + Set %1 设置%1 - - + + Select Set %1 选择设置%1 - + One Way 单向 - + Two Way 双向 - + While Held 按下时 - + Choose Executable 选择可执行文件 - + Slots past a Cycle action will be executed on the next button press. Multiple cycles can be added in order to create partitions in a sequence. “周期”动作之后的动作将在下一次按下相同按钮的时候被执行。可以添加多个“周期”动作来创建一个按键序列中不同的子序列。 - + Delays the time that the next slot is activated by the time specified. Slots activated before the delay will remain active after the delay time has passed. 根据指定时长延迟下个动作开始执行的时间。延迟之前处于活动状态的动作将在延迟结束后保持活动状态。 - + Distance action specifies that the slots afterwards will only be executed when an axis is moved a certain range past the designated dead zone. “距离”动作之后的动作只有在轴移出不灵敏区并超过指定距离之后才会被执行。 - + Insert a hold action. Slots after the action will only be executed if the button is held past the interval specified. 插入一个“按下”动作。“按下”动作之后的动作只有在按钮被按下超过指定的时长之后才会被执行。 - + Chose a profile to load when this slot is activated. 当该动作被执行时,载入所选配置文件。 - + Mouse mod action will modify all mouse speed settings by a specified percentage while the action is being processed. This can be useful for slowing down the mouse while sniping. “鼠标变速”动作被处理时,将根据指定的百分比改变所有鼠标速度。这可以用在狙击时减缓鼠标速度。 - + Specify the time that keys past this slot should be held down. 按钮被按下超过指定的时长将保持被按下的状态。 - + Insert a release action. Slots after the action will only be executed after a button release if the button was held past the interval specified. 插入一个“释放”动作。“释放”动作之后的动作只有在按钮被按下超过指定时长并被释放之后才会被执行。 - + Change to selected set once slot is activated. 该动作被执行时,切换到所选的设置。 - + Full string will be typed when a slot is activated. 当该动作被执行时,整个字符串将被键入。 - + Execute program when slot is activated. 当该动作被执行时,运行一个程序。 - - + + Choose Profile 选择配置文件 - + Config Files (*.amgp *.xml) 配置文件 (*.amgp *.xml) @@ -1246,157 +1255,157 @@ of the all default profile option. AdvanceStickAssignmentDialog - + Stick/Pad Assignment 摇杆/十字键分配 - + Sticks 摇杆 - + DPads 十字键 - - + + %1 (Joystick %2) %1(手柄%2) - + Stick 1 手柄1 - - - + + + Enabled 启用 - - - - - - + + + + + + Assign 分配 - - + + X Axis: X轴: - - + + Y Axis: Y轴: - + Stick 2 手柄2 - + Number of Physical DPads: %1 物理十字键数:%1 - + Virtual DPad 1 虚拟十字键1 - + Up: 上: - + Down: 下: - + Note: This window is meant for backwards compatibility with profiles made before antimicro 2.0. Since version 2.0, use of the Game Controller Mapping window is preferred. 注意:这个窗口是为了兼容 antimicro 2.0 版之前创建的配置文件。自 antimicro 2.0 起,推荐使用游戏控制器映射窗口。 - + Left: 左: - + Right: 右: - - - - + + + + Axis %1 轴%1 - - - - + + + + Axis %1 - 轴%1 - - - - - + + + + Axis %1 + 轴%1 + - - - - + + + + Button %1 按钮%1 - + Move stick 1 along the X axis 沿X轴移动摇杆1 - + Move stick 1 along the Y axis 沿Y轴移动摇杆1 - + Move stick 2 along the X axis 沿X轴移动摇杆2 - + Move stick 2 along the Y axis 沿Y轴移动摇杆2 - - - - + + + + Press a button or move an axis 按任意键或移动任意轴 @@ -1404,180 +1413,180 @@ of the all default profile option. AxisEditDialog - + Axis - - + + Mouse (Horizontal) 鼠标(水平) - - + + Mouse (Inverted Horizontal) 鼠标(水平翻转) - - + + Mouse (Vertical) 鼠标(垂直) - - + + Mouse (Inverted Vertical) 鼠标(垂直翻转) - - + + Arrows: Up | Down 方向键:上|下 - - + + Arrows: Left | Right 方向键:左|右 - - + + Keys: W | S 按键:W | S - - + + Keys: A | D 按键:A | D - - + + NumPad: KP_8 | KP_2 数字键盘:8 | 2 - - + + NumPad: KP_4 | KP_6 数字键盘:4 | 6 - - - + + + None - - + + Set the value to use as the limit for an axis. Useful for a worn out analog stick. 设置轴的最大值。 对老旧磨损的模拟摇杆尤其有帮助。 - + Negative Half Throttle 负半阀 - + Positive Half Throttle 正半阀 - + Name: 名称: - + Specify the name of an axis. 指定轴的名称。 - + Mouse Settings 鼠标设置 - - + + Set the value of the dead zone for an axis. 设置轴的不灵敏区。 - + Presets: 预设: - + Dead Zone: 不灵敏区: - + Max Zone: 最大区: - - + + [NO KEY] [无按键] - + Throttle setting that determines the behavior of how to interpret an axis hold or release. 阀设置决定如何判断一个轴的按下和释放。 - + Negative Throttle 负阀 - + Normal 正常 - + Positive Throttle 正阀 - + Current Value: 当前值: - + Set 设置 - + Set %1 设置%1 - + Left Mouse Button 鼠标左键 - + Right Mouse Button 鼠标右键 @@ -1585,38 +1594,38 @@ interpret an axis hold or release. ButtonEditDialog - + Dialog 对话框 - + To make a new assignment, press any keyboard key or click a button in the Keyboard or Mouse tab 若想分配按键,请按键盘上任意键或在键盘、鼠标页上点击按钮 - + Placeholder 占位符 - + Toggle 开关 - + Enables a key press or release to only occur when a controller button is pressed. 当游戏控制器按钮被按下时,按下或释放某个按键,并一直保持此状态。 - + Enables rapid key presses and releases. Turbo controller. 快速按下和释放某个键。 连发游戏控制器。 - + Turbo 连发 @@ -1625,38 +1634,38 @@ interpret an axis hold or release. 当前: - + Last keyboard/mouse button: - + Slots 动作 - + Na&me: 名称 (&m): - + Specify the name of a button. 指定按钮的名称。 - + Action: 动作: - + Specify the action that will be performed in game while this button is being used. 指定游戏中这个按钮被按下时的动作。 - + Advanced 高级选项 @@ -1669,52 +1678,52 @@ this button is being used. 设置%1 - - - + + + Choose your keyboard key - + No button - - - - + + + + Last button - + To change settings for last button, it must be at least one assignment from keyboard to gamepad - + To change settings of turbo for last button, it must be at least one assignment from keyboard to gamepad - + To open advanced dialog, it's needed to map at least one button from keyboard to gamepad - + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + As last gamepad button has been set - + Index %1 @@ -1722,190 +1731,190 @@ this button is being used. Calibration - + Form - - + + Start calibration - + Controller: - + Sticks: - - Use settings from jstest-gtk - - - - + Reset settings - + Cancel 取消 - - + + Save 保存 - - + + Calibration - - Do you really want to reset settings of current axes? + + Do you really want to reset settings of current axis? - + Calibration was saved for the preset. Do you really want to reset settings? - + Place the joystick in the center position. It's the part, where often you don't have to move. Just skip it in such situation. - + Calibrating center - + Start second step - + Center X: %1 - + Center Y: %1 - + Place the joystick in the top-left corner many times - - + + Calibrating position - - + + X: %1 - - + + Y: %1 - + Place the joystick in the bottom-right corner - + Start final step - + range X: %1 - %2 - + range Y: %1 - %2 - + deadzone X: %1 - + deadzone Y: %1 - + ---Calibration done!--- - + Calibration values have been saved - - + + Dead zone calibration - - You must move X axis to the right at least five times! Keep moving! + + You have to move axes to the top-left corner at least five times. + + + + + You have to move axes to the bottom-right corner at least five times. - - You must move X axis to the left at least five times! Keep moving! + + Do you want to save calibration of current axis? - - - - + + + + Axis %1 轴%1 @@ -1913,64 +1922,64 @@ deadzone Y: %1 CapturedWindowInfoDialog - + Captured Window Properties 捕获的窗口属性 - + Information About Window 窗口信息 - + Class: 类: - - - + + + TextLabel 文本标签 - + Title: 标题: - + Path: 路径: - + Match By Properties 根据属性匹配 - + Class - + Title 标题 - + Path 路径 - + Full Path 全路径 - + File Name 文件名 @@ -2122,67 +2131,67 @@ deadzone Y: %1 DPadContextMenu - + Mouse (Normal) 鼠标(正常) - + Mouse (Inverted Horizontal) 鼠标(水平翻转) - + Mouse (Inverted Vertical) 鼠标(垂直翻转) - + Mouse (Inverted Horizontal + Vertical) 鼠标(水平翻转 + 垂直翻转) - + Arrows 方向键 - + Keys: W | A | S | D 按键:W | A | S | D - + NumPad 数字键盘 - + None - + Standard 标准 - + Eight Way 八向 - + 4 Way Cardinal 正四向 - + 4 Way Diagonal 斜四向 - + Mouse Settings 鼠标设置 @@ -2190,108 +2199,108 @@ deadzone Y: %1 DPadEditDialog - + Dialog 对话框 - + Presets: 预设: - + Mouse (Normal) 鼠标(正常) - + Mouse (Inverted Horizontal) 鼠标(水平翻转) - + Mouse (Inverted Vertical) 鼠标(垂直翻转) - + Mouse (Inverted Horizontal + Vertical) 鼠标(水平翻转 + 垂直翻转) - + Arrows 方向键 - + Keys: W | A | S | D 按键:W | A | S | D - + NumPad 数字键盘 - + None - + Dpad Mode: 十字键模式: - + &Name: 名称 (&N): - + 4 Way Cardinal 正四向 - + 4 Way Diagonal 斜四向 - + DPad Delay: 十字键延迟: - - + + Time lapsed before a direction change is taken into effect. 方向改变生效前的延迟。 - + s - + Specify the name of a dpad. 指定十字键的名称。 - + Mouse Settings 鼠标设置 - + Standard 标准 - + Standard: 8 region dpad with two direction buttons active when the dpad is in a diagonal region. @@ -2310,17 +2319,17 @@ to a diagonal zone. 斜四向:十字键有四个区域,分别对应对角线的四个方向。 - + Eight Way 八向 - + Set 设置 - + Set %1 设置%1 @@ -2328,27 +2337,27 @@ to a diagonal zone. EditAllDefaultAutoProfileDialog - + Default Profile 默认配置文件 - + Profile: 配置文件: - + Browse 浏览 - + Open Config 打开配置文件 - + Profile file path is invalid. 配置文件路径无效。 @@ -2356,29 +2365,29 @@ to a diagonal zone. ExtraProfileSettingsDialog - + Extra Profile Settings 附加配置文件设置 - + Key Press Time: 按键按下时间: - + 0.00 ms 0.00毫秒 - + Profile Name: 配置文件名称: - - - + + + s @@ -2386,7 +2395,7 @@ to a diagonal zone. GameController - + Game Controller 游戏控制器 @@ -2394,9 +2403,9 @@ to a diagonal zone. GameControllerDPad - - - + + + DPad 十字键 @@ -2404,187 +2413,187 @@ to a diagonal zone. GameControllerMappingDialog - + Game Controller Mapping 游戏控制器映射 - + <html><head/><body><p>antimicro makes use of the <a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;">Game Controller API</span></a> provided by SDL 2 in order to abstract various gamepads to fit a unified standard. In order to make a button assignment, please highlight the mapping cell for the appropriate button row below. You can then press a button or move an axis on your gamepad and the cell will update with the physical button or axis that will be used.</p><p>antimicro will use the mapping that you specify to save a mapping string that will be loaded into SDL.</p></body></html> <html><head/><body><p>antimicro 使用 SDL 2 的<a href="https://wiki.libsdl.org/CategoryGameController"><span style=" text-decoration: underline; color:#0057ae;">游戏控制器应用程序接口</span></a>把各式各样的手柄进行抽象,使它们适用于统一的标准。若要进行按钮分配,请选择下面相应的按钮映射单元格。之后您可以按一个按钮或者移动手柄上的一个轴,映射单元格将更新以匹配这个物理按键或轴。</p><p>antimicro 将把您指定的映射保存为一个字符串,而这个字符串将被加载到 SDL 中。</p></body></html> - + A A键 - + B B键 - + X X键 - + Y Y键 - + Back 后退键 - + Start 开始键 - + Guide 导航键 - + Left Shoulder 左肩键 - + Right Shoulder 右肩键 - + Left Stick Click 左摇杆点击 - + Right Stick Click 右摇杆点击 - + Left Stick X 左摇杆X轴 - + Left Stick Y 左摇杆Y轴 - + Right Stick X 右摇杆X轴 - + Right Stick Y 右摇杆Y轴 - + Left Trigger 左扳机 - + Right Trigger 右扳机 - + DPad Up 十字键上 - + DPad Left 十字键左 - + DPad Down 十字键下 - + DPad Right 十字键右 - + Mapping 映射 - + SDL 2 Game Controller Mapping String SDL 游戏控制器映射字符串 - + Last Axis Event: 最近轴事件: - + Current Axis Detection Dead Zone: 当前轴不灵敏区: - + 5000 5000 - + 10000 10000 - + 15000 15000 - + 20000 20000 - + 25000 25000 - + 30000 30000 - + 32000 32000 - + Game Controller Mapping (%1) (#%2) 游戏控制器映射 (%1) (#%2) - + Discard Controller Mapping? 放弃修改游戏控制器映射? - + Discard mapping for this controller? If discarded, the controller will be reverted to a joystick once you refresh all joysticks. @@ -2596,47 +2605,47 @@ If discarded, the controller will be reverted to a joystick once you refresh all GameControllerSet - + Back 后退键 - + Guide 导航键 - + Start 开始键 - + LS Click 左摇杆点击 - + RS Click 右摇杆点击 - + L Shoulder 左肩键 - + R Shoulder 右肩键 - + L Trigger 左扳机 - + R Trigger 右扳机 @@ -2644,9 +2653,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all GameControllerTrigger - - - + + + Trigger 扳机 @@ -2654,9 +2663,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxis - - - + + + Axis @@ -2664,24 +2673,24 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxisButton - + Negative - + Positive - + Unknown 未知 - - - + + + Button 按钮 @@ -2689,74 +2698,74 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyAxisContextMenu - + Mouse (Horizontal) 鼠标(水平) - + Mouse (Inverted Horizontal) 鼠标(水平翻转) - + Mouse (Vertical) 鼠标(垂直) - + Mouse (Inverted Vertical) 鼠标(垂直翻转) - + Arrows: Up | Down 方向键:上|下 - + Arrows: Left | Right 方向键:左|右 - + Keys: W | S 按键:W | S - + Keys: A | D 按键:A | D - + NumPad: KP_8 | KP_2 数字键盘:8 | 2 - + NumPad: KP_4 | KP_6 数字键盘:4 | 6 - - + + None - - + + Mouse Settings 鼠标设置 - + Left Mouse Button 鼠标左键 - + Right Mouse Button 鼠标右键 @@ -2764,57 +2773,57 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButton - + Processing turbo for #%1 - %2 正在处理按钮#%1-%2的连发 - + Finishing turbo for button #%1 - %2 正在完成按钮#%1-%2的连发 - + Processing press for button #%1 - %2 正在处理按下按钮#%1-%2 - + Processing release for button #%1 - %2 正在处理释放按钮#%1-%2 - + Distance change for button #%1 - %2 按钮#%1-%2距离改变 - - - + + + Button 按钮 - - - - + + + + [NO KEY] [无按键] - + [Set %1 1W] [单向选择设置%1] - + [Set %1 2W] [双向选择设置%1] - + [Set %1 WH] [按下时选择设置%1] @@ -2822,47 +2831,47 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButtonContextMenu - + Toggle 开关 - + Turbo 连发 - + Clear 清除 - + Set Select 选择设置 - + Disabled 禁用 - + Set %1 设置%1 - + Set %1 1W 单向选择设置%1 - + Set %1 2W 双向选择设置%1 - + Set %1 WH 按下时选择设置%1 @@ -2870,118 +2879,118 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyButtonSlot - - + + Mouse 鼠标 - + Up - + Down - + Left - + Right - + LB 鼠标左键 - + MB 鼠标中键 - + RB 鼠标右键 - + B4 按钮4 - + B5 按钮5 - + Pause 暂停 - + Hold 按下 - + Cycle 周期 - + Distance 距离 - + Release 释放 - + Mouse Mod 鼠标变速 - + Press Time 按下时间 - + Delay 延迟 - + Load %1 载入%1 - + Set Change %1 设置改变%1 - + [Text] %1 [文本]%1 - + [Exec] %1 [运行]%1 - + [NO KEY] [无按键] @@ -2989,9 +2998,9 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStick - - - + + + Stick 摇杆 @@ -2999,37 +3008,37 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickButton - - - + + + Up - - - + + + Down - - - + + + Left - - - + + + Right - - - + + + Button 按钮 @@ -3037,67 +3046,67 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickContextMenu - + Mouse (Normal) 鼠标(正常) - + Mouse (Inverted Horizontal) 鼠标(水平翻转) - + Mouse (Inverted Vertical) 鼠标(垂直翻转) - + Mouse (Inverted Horizontal + Vertical) 鼠标(水平翻转 + 垂直翻转) - + Arrows 方向键 - + Keys: W | A | S | D 按键:W | A | S | D - + NumPad 数字键盘 - + None - + Standard 标准 - + Eight Way 八向 - + 4 Way Cardinal 正四向 - + 4 Way Diagonal 斜四向 - + Mouse Settings 鼠标设置 @@ -3105,86 +3114,86 @@ If discarded, the controller will be reverted to a joystick once you refresh all JoyControlStickEditDialog - + Dialog 对话框 - + X: X轴: - - - - - + + + + + 0 0 - + Y: Y轴: - + Distance: 距离: - + Presets: 预设: - + Mouse (Normal) 鼠标(正常) - + Mouse (Inverted Horizontal) 鼠标(水平翻转) - + Mouse (Inverted Vertical) 鼠标(垂直翻转) - + Mouse (Inverted Horizontal + Vertical) 鼠标(水平翻转 + 垂直翻转) - + Arrows 方向键 - + Keys: W | A | S | D 按键:W | A | S | D - + NumPad 数字键盘 - + None - + Stick Mode: 摇杆模式: - + Standard: 8 region stick with two direction buttons active when the stick is in a diagonal region. @@ -3203,72 +3212,72 @@ to a diagonal zone of the stick. 斜四向:摇杆有四个区域,分别对应对角线的四个方向。 - + 4 Way Cardinal 正四向 - + 4 Way Diagonal 斜四向 - - + + Dead zone value to use for an analog stick. 设置模拟摇杆的不灵敏区。 - - + + Value when an analog stick is considered moved 100%. 设置模拟摇杆的最大值。当达到这个值时,模拟摇杆被认为移动到了100%的位置。 - - + + The area (in degrees) that each diagonal region occupies. 每个对角线区域的角度数。 - + Square Stick: 方形摇杆: - - + + Percentage to modify a square stick coordinates to confine values to a circle 这个百分比用来调整方形摇杆的坐标值使其被限制在一个圆里 - + % % - + Stick Delay: 摇杆延迟: - - + + Time lapsed before a direction change is taken into effect. 方向改变生效前的延迟。 - + s - + Modifier: 修饰键: - + Edit button that is active while the stick is active. This button is useful for assigning zones with @@ -3278,68 +3287,68 @@ functionality to an analog stick. 这个按钮尤其适用于分配带有修饰键的区域,例如在模拟摇杆上分配行走/跑步的功能。 - + PushButton 按钮 - + Na&me: Name: 名称: - + Specify the name of an analog stick. 指定模拟摇杆的名称。 - + Mouse Settings 鼠标设置 - + Standard 标准 - + Bearing: 方向: - + % Safe Zone: 安全区(%): - + Eight Way 八向 - + Dead Zone: 不灵敏区: - + Max Zone: 最大区: - + Diagonal Range: 对角线区域范围: - + Set 设置 - + Set %1 设置%1 @@ -3347,9 +3356,9 @@ functionality to an analog stick. JoyControlStickModifierButton - - - + + + Modifier 修饰 @@ -3357,9 +3366,9 @@ functionality to an analog stick. JoyDPad - - - + + + DPad 十字键 @@ -3367,37 +3376,37 @@ functionality to an analog stick. JoyDPadButton - - - + + + Up - - - + + + Down - - - + + + Left - - - + + + Right - - - + + + Button 按钮 @@ -3405,266 +3414,271 @@ functionality to an analog stick. JoyTabWidget - - - - - - + + + + + + <New> <新> - - + + Remove 移除 - - + + Remove configuration from recent list. 从最近使用列表中移除配置。 - - + + Load 载入 - - + + Load configuration file. 载入配置文件。 - - + + Save 保存 - - + + Save changes to configuration file. 保存更改到配置文件。 - - + + Save As 另存为 - - + + Save changes to a new configuration file. 保存更改到新的配置文件。 - - + + Sets 设置 - + Copy from Set 从设置复制 - + Settings 设置 - - + + Set 1 设置1 - - + + Set 2 设置2 - - + + Set 3 设置3 - - + + Set 4 设置4 - - + + Set 5 设置5 - - + + Set 6 设置6 - - + + Set 7 设置7 - - + + Set 8 设置8 - - + + Stick/Pad Assign 摇杆/十字键分配 - - + + Controller Mapping 游戏控制器映射 - - + + Quick Set 快速设置 - - + + Names 名称 - - + + Toggle button name displaying. 开关按钮名称显示。 - - + + Pref 偏好设置 - - + + Change global profile settings. 改变全局配置文件设置。 - - - + + + Reset 重置 - - + + Revert changes to the configuration. Reload configuration file. 还原设置的更改。重新加载配置文件。 - + Open Config 打开配置文件 - + Config Files (*.amgp *.xml) 配置文件 (*.amgp *.xml) - - - + + + Config File (*.%1.amgp) 配置文件 (*.%1.amgp) - - + + Do you really want to reset buttons settings for joystick? + + + + + Save Profile Changes? 保存配置文件更改? - - + + Changes to the new profile have not been saved. Would you like to save or discard the current profile? 新配置文件的更改尚未保存。您想保存还是放弃修改当前的配置文件? - - + + Changes to the profile "%1" have not been saved. Would you like to save or discard changes to the current profile? 配置文件“%1”的更改尚未保存。您想保存还是放弃修改此配置文件? - + Sticks 摇杆 - - + + DPads 十字键 - + No buttons have been assigned. Please use Quick Set to assign keys to buttons or disable hiding empty buttons. 按钮未被分配。请使用“快速设置”来将按键分配到按钮,或取消隐藏空白按钮。 - - + + Set %1: %2 设置%1:%2 - - + + Set %1 设置%1 - + Copy Set Assignments 复制设置分配信息 - + Are you sure you want to copy the assignments and device properties from %1? 您确定要从 %1 复制分配信息和设备属性吗? - - - + + + Save Config 保存配置文件 - - + + Set 设置 @@ -3672,7 +3686,7 @@ to buttons or disable hiding empty buttons. Joystick - + Joystick 摇杆 @@ -3680,98 +3694,98 @@ to buttons or disable hiding empty buttons. JoystickStatusWindow - + Properties 属性 - + Details 详细信息 - + Name: 名称: - - - - - - - + + + + + + + %1 %1 - + Number: 编号: - + Axes: 轴数: - + Buttons: 按钮数: - + Hats: 帽子开关数: - + GUID: 全局唯一标识符: - + Game Controller: 是否为手柄: - + Axes - + Buttons 按钮 - + Hats 帽子开关 - + %1 (#%2) Properties %1 (#%2) 属性 - + Axis %1 轴%1 - + Hat %1 帽子开关%1 - + No - + Yes @@ -3779,62 +3793,67 @@ to buttons or disable hiding empty buttons. MainSettingsDialog - + Edit Settings 编辑设置 - + General 常规 - + Controller Mappings 游戏控制器映射 - + Language 语言 - + Auto Profile 自动配置文件 - + Mouse 鼠标 - + Advanced 高级选项 - + + Profile Direc&tory: + + + + <html><head/><body><p>Specify the default directory that the program should use in file dialogs when loading a profile or saving a new profile.</p></body></html> <html><head/><body><p>指定本程序在加载或保存一个配置文件时,文件对话框中默认使用的路径。</p></body></html> - + Recent Profile Count: 最近使用的配置文件数: - + <html><head/><body><p>Number of profiles that can be placed in recent profile list. 0 will result in the program not enforcing a limit on the number of profiles displayed.</p></body></html> <html><head/><body><p>最近使用的配置文件列表中配置文件的数量。设为0将显示所有最近使用的配置文件。</p></body></html> - + Gamepad Poll Rate: 手柄轮询速率: - + Change the poll rate that the program uses to discover new events from gamepads. Defaults to 10 ms. @@ -3845,23 +3864,23 @@ before using antimicro unattended. 降低轮询速率可能会导致本程序使用更多的处理器资源。请在以无人值守方式使用前测试此选项。 - + Hide main window when the main window close button is clicked instead of quitting the program. 点击关闭按钮时,最小化主窗口到系统托盘而不是退出程序。 - + Close To Tray 关闭时最小化到系统托盘 - + Launch At Windows Startup Windows 开机自启动 - + Display recent profiles for all controllers as a single list in the tray menu. Defaults to using sub-menus. @@ -3869,12 +3888,12 @@ to using sub-menus. 默认是使用子菜单。 - + Single Profile List in Tray 系统托盘菜单中使用单一配置文件列表 - + Have the program minimize to the taskbar. By default, the program minimizes to the system tray if available. @@ -3882,12 +3901,12 @@ tray if available. 如果可能,默认情况下本程序将最小化到系统托盘。 - + Minimize to Taskbar 最小化到任务栏 - + This option will cause the program to hide all buttons that have no slots assigned to them. The Quick Set dialog window will have to be used @@ -3896,157 +3915,167 @@ to bring up the edit dialog for gamepad buttons. 您需要使用“快速设置”对话框来打开手柄按钮的编辑对话框。 - + Hide Empty Buttons 隐藏空白按钮 - + When the program is launched, open the last known profile that was opened during the previous session. 本程序启动时,打开上次使用的配置文件。 - + Auto Load Last Opened Profile 自动加载上次打开的配置文件 - + Only show the system tray icon when the program first launches. 首次启动本程序时只显示系统托盘。 - + Launch in Tray 启动时最小化到系统托盘 - + Associate Profiles 关联配置文件 - + Key Repeat 键重复 - + Active keys will be repeatedly pressed when this option is enabled. 此选项启用后,处于活动状态的按键将一直被重复按下。 - - + + Enable 启用 - + Português do Brasil 巴西葡萄牙语 - + Français 法语 - + Deutsch 德语 - + Italiano 意大利语 - + 日本語 日本语 - + Русский 俄语 - + српски / srpski 塞尔维亚语 - + Español 西班牙语 - + українська 乌克兰语 - + Polski - + + History Si&ze: + + + + Log File: 日志文件: - + Log Level: 日志级别: - + None - + Error 错误 - + Warning 警告 - + Info 信息 - + Debug 调试 - + + Reset + 重置 + + + Class - + Title 标题 - + Program 程序 - + Disable the "Enhanced Pointer Precision" Windows setting while antimicro is running. Disabling "Enhanced Pointer Precision" will allow mouse movement within antimicro to be more @@ -4055,22 +4084,22 @@ precise. 禁用“提高指针精确度”可使鼠标在开启 antimicro 的情况下更精准地移动。 - + Disable Enhance Pointer Precision 禁用提高指针精确度 - + Smoothing 平滑 - + Refresh Rate: 刷新率: - + The refresh rate is the amount of time that will elapse in between mouse events. Please be cautious when editing this setting as it will cause the program to use @@ -4083,29 +4112,29 @@ it unattended. 请在以无人值守方式使用前测试此选项。 - + Accel Numerator: 加速度分子: - - - + + + 0 0 - + Accel Denominator: 加速度分母: - + Accel Threshold: 加速度阈值: - + If the acceleration values for the virtual mouse have been changed by a different process, particularly when quitting an older game, then you might want to reset the acceleration @@ -4113,59 +4142,58 @@ values used by the virtual mouse. 如果虚拟鼠标的加速度值被另一个进程改变,尤其是在退出老游戏的时候,您可能需要重置虚拟鼠标使用的加速度值。 - + Reset Acceleration 重置加速度 - + Delay: 延迟: - Profi&le Directory: - 配置文件目录 (&l): + 配置文件目录 (&l): - + Have Windows start antimicro at system startup. 在 Windows 启动时运行本程序。 - + Associate .amgp files with antimicro in Windows Explorer. 在 Windows 资源管理器中将 .amgp 文件关联到 antimicro。 - + Specifies how much time should elapse before key repeating begins. 指定开始键重复之前的延迟时间。 - + ms 毫秒 - + Rate: 频率: - + Specifies how many times key presses will be performed per seconds. 指定每秒按键多少次。 - + times/s 次/秒 - + Below is a list of the custom mappings that have been saved. You can use the following table to delete mappings or have mappings temporarily disabled. You can also disable mappings that are included with SDL; just insert a new row with the appropriate joystick GUID and check disable. Settings will not take affect until you either refresh all joysticks or unplug that particular joystick. @@ -4174,116 +4202,115 @@ Settings will not take affect until you either refresh all joysticks or unplug t 设置仅在您刷新所有摇杆或者拔出那个被禁用的摇杆之后生效。 - + GUID 全局唯一标识符 - + Mapping String 映射字符串 - + Disable? 禁用? - - + + Delete 删除 - + Insert 插入 - + <html><head/><body><p>antimicro has been translated into many different languages by contributors. By default, the program will choose an appropriate translation based on your system's locale setting. However, you can make antimicro load a different translation depending on the language that you choose from the list below.</p></body></html> <html><head/><body><p>antimicro 已被贡献者翻译为多种语言。默认情况下,本程序将根据您系统的区域设置选择相应的语言。然而,您也可以让 antimicro 加载以下列表中的任意语言。</p></body></html> - - + + Default 默认 - + English 英语 - + 简体中文 简体中文 - - + + Active 启用 - + Devices: 设备: - - + + All 所有 - + Device 设备 - + Profile 配置文件 - + Default? 默认? - + Add 添加 - + Edit 编辑 - Histor&y Size: - 历史缓冲大小 (&y): + 历史缓冲大小 (&y): - + Weight &Modifier: 权重修饰因数 (&M): - + Spring 弹簧 - + Screen: 屏幕: - + Utilize the specified screen for spring mode. On Linux, the default is to use the primary screen. On Windows, the default is to use all available screens. @@ -4292,157 +4319,167 @@ is to use all available screens. 在 Windows 系统上,默认使用所有可用屏幕。 - + Also, Windows users who want to use a low value should also check the "Disable Enhance Pointer Precision" checkbox if you haven't disabled the option in Windows. 另外,对于希望使用较低值的 Windows 用户,如果您未禁用 Windows 的“提高指针精确度”选项,请勾选本程序中的“禁用提高指针精确度”复选框。 - + Select Default Profile Directory 选择默认配置文件目录 - + Are you sure you want to delete the profile? 您确认要删除这个配置文件吗? - + Save Log File As 日志文件另存为 - + Log Files (*.log) 日志文件 (*.log) + + + Do you really want to reset setting? + + + + + Would you like to reset mappings too? + + MainWindow - + antimicro antimicro - + No Joysticks have been found. Please plug in a joystick and then choose the "Update Joysticks" option in the main menu 未找到摇杆。 请插入一个摇杆然后选择“选项”菜单下的“更新摇杆” - + If events are not seen by a game, please click here to run this application as Administrator. 如果游戏无法检测到事件,请单击这里以管理员身份运行。 - + &App 程序 (&A) - + &Options 选项 (&O) - + &Help 帮助 (&H) - - + + &Quit 退出 (&Q) - + Ctrl+Q Ctrl+Q - - + + &Update Joysticks 更新摇杆 (&U) - + Ctrl+U Ctrl+U - - + + &Hide 隐藏 (&H) - + Ctrl+H Ctrl+H - + &About 关于 (&A) - + Ctrl+A Ctrl+A - + About &Qt - + &Properties - + &Key Checker - + &GitHub Page - + &Game Controller Mapping - + S&ettings - + &Stick/Pad Assign - + &Wiki - + &Issues - + &Calibration @@ -4459,7 +4496,7 @@ the option in Windows. 按键检查器 - + Home Page 主页 @@ -4484,49 +4521,49 @@ the option in Windows. 维基页面 - + Could not find a proper controller identifier. Exiting. 无法找到合适的游戏控制器标识符。正在退出。 - - - - - - - + + + + + + + (%1) (%1) - - + + Open File 打开文件 - + &Restore 还原 (&R) - + Calibration couldn't be opened - + You must connect at least one controller to open the window - + Run as Administrator? 以管理员权限运行? - + Are you sure that you want to run this program as Adminstrator? Some games run as Administrator which will cause events generated by antimicro to not be used by those games unless antimicro is also run as the Adminstrator. This is due to permission problems caused by User Account Control (UAC) options in Windows Vista and later. @@ -4534,17 +4571,17 @@ Some games run as Administrator which will cause events generated by antimicro t 有些以管理员权限运行的游戏无法识别 antimicro 生成的事件,除非 antimicro 也使用管理员权限运行。这是由于 Windows Vista 及以后系统中用户帐户控制 (UAC) 导致的权限问题。 - + Failed to elevate program 无法提升本程序权限 - + Failed to restart this program as the Administrator 无法以管理员权限重新运行本程序 - + Could not find controller. Exiting. 无法找到游戏控制器。正在退出。 @@ -4552,12 +4589,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseAxisSettingsDialog - + Mouse Settings - 鼠标设置 - - + Set %1 设置%1 @@ -4565,12 +4602,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseButtonSettingsDialog - + Mouse Settings - 鼠标设置 - - + Set %1 设置%1 @@ -4578,12 +4615,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseControlStickSettingsDialog - + Mouse Settings 鼠标设置 - + Set %1 设置%1 @@ -4591,12 +4628,12 @@ Some games run as Administrator which will cause events generated by antimicro t MouseDPadSettingsDialog - + Mouse Settings 鼠标设置 - + Set %1 设置%1 @@ -4604,17 +4641,17 @@ Some games run as Administrator which will cause events generated by antimicro t MouseSettingsDialog - + Mouse Settings 鼠标设置 - + Mouse Mode: 鼠标模式: - + Cursor mode is used to move the mouse cursor around the screen relative to its current position depending on how much you move an axis @@ -4629,22 +4666,22 @@ axis is moved back to the dead zone. 弹簧:移动时,鼠标光标以屏幕中心为基准,移动距离取决于您移动轴的幅度。轴移回不灵敏区之后,鼠标光标将回到屏幕中心。 - + Cursor 光标 - + Spring 弹簧 - + Acceleration: 加速模式: - + Enhanced: Three tier curve that makes the mouse move slow on the low end of an axis and fast on the high end. @@ -4673,64 +4710,64 @@ a period of time using a Cubic curve. 立方缓动:轴移动幅度较大时,鼠标速度随时间以立方曲线增加。 - + Enhanced Precision 增强精度 - - + + Linear 线性 - + Quadratic 平方 - + Cubic 立方 - + Quadratic Extreme 极限平方 - + Power Function 指数函数 - + Easing Quadratic 平方缓动 - + Easing Cubic 立方缓动 - + Mouse Speed Settings 鼠标速度设置 - + Enable to change the horizontal and vertical speed boxes at the same time. 同时改变水平和垂直速度。 - + Change Together 同时更改 - + Options for adding more acceleration to the mouse movement beyond what the acceleration curve would produce. Acceleration is added based on how quickly an axis is @@ -4742,57 +4779,57 @@ using typical gamepad analog sticks. 这些选项是为了绕过某些由于手柄模拟摇杆的输入范围有限所带来的问题。 - + Delta Acceleration 额外加速 - + &Multiplier: 倍数 (&M): - + Mi&n Threshold: 最小阈值 (&N): - + E&xtra Duration: 额外加速时长 (&X): - - + + 1 = 20 pps 1级=20像素/秒 - + Wheel Hori. Speed: 滚轮水平速度: - + Set the speed used for horizontal mouse wheel movement according to number of simulated notches per second. 根据每秒模拟滚动凹槽数设置鼠标滚轮水平滚动速度。 - + Set the speed used for vertical mouse wheel movement according to number of simulated notches per second. 根据每秒模拟滚动凹槽数设置鼠标滚轮垂直滚动速度。 - + Sensitivit&y: 灵敏度 (&Y): - + For Power Function acceleration curve. Specifies the factor to use for curve sensitivity. When the value is above 1.0, the mouse movement will be accelerated @@ -4801,69 +4838,69 @@ faster at the low end of an axis. 指定曲线敏感度系数。当该值大于1.0时,增大轴移动幅度较小时的鼠标加速度。 - + Easing Duration: 缓动时长: - + Specifies the amount of time (in seconds) that will be required before the mouse is fully accelerated after reaching the high end of an axis. 轴移动幅度达到最大后,鼠标在此时长(以秒为单位)内加速到最大速度。 - - + + s - + Highest value to accelerate mouse movement by 鼠标速度的最大加速值 - + x x - + Start %: 起始百分比: - + Acceleration begins at this percentage of the base multiplier 加速以基础倍数的此百分比速率开始 - - - - + + + + % % - + Minimum amount of axis travel required for acceleration to begin 轴的移动幅度大于此最小阈值之后加速才开始 - + Max Threshold: 最大阈值: - + Maximum axis travel before acceleration has reached the multiplier value 轴的移动幅度达到此最大阈值时加速达到上述倍数值 - + Extend the time that extra acceleration is applied. Axis travel will be taken into account. A slower flick will decrease the actual time that extra acceleration will be applied. @@ -4871,118 +4908,118 @@ actual time that extra acceleration will be applied. 轴的移动幅度考虑在内。缓慢的轴移动将减小实际的额外加速生效时间。 - + Curve: 曲线: - + Ease Out Sine 正弦滑出缓动 - + Ease Out Quad 平方滑出缓动 - + Ease Out Cubic 立方滑出缓动 - + Release Radius: 释放半径: - + Specifies that the spring area will be relative to the mouse position set by a non-relative spring. 弹簧区域将相对于鼠标指针的位置。鼠标指针的位置可由其它非弹簧模式指定。 - + Relative 相对 - + Mouse Status 鼠标状态 - + X: X轴: - - + + 0 (0 pps) 0(0像素/秒) - + Y: Y轴: - - + + 1 = 1 notch(es)/s 1级=1凹槽/秒 - + Hori&zontal Speed: 水平速度 (&Z): - + &Vertical Speed: 垂直速度 (&V): - + Wheel Vert. Speed: 滚轮垂直速度: - + Spring Settings 弹簧设置 - + Spring Width: 弹簧区域宽度: - + Changes the width of the region that the cursor can move in spring mode. 0 will use the entire width of your screen. 设置鼠标以弹簧模式移动的区域的宽度。设为0时将使用您整个屏幕的宽度。 - + Spring Height: 弹簧区域高度: - + Changes the height of the region that the cursor can move in spring mode. 0 will use the entire height of your screen. 设置鼠标以弹簧模式移动的区域的高度。设为0时将使用您整个屏幕的高度。 - - + + %n notch(es)/s %n凹槽/秒 @@ -4992,7 +5029,7 @@ of your screen. QKeyDisplayDialog - + Key Checker 按键检查器 @@ -5001,34 +5038,34 @@ of your screen. <html><head/><body><p>按下您键盘上的一个键来观察本程序如何检测按键。本窗口将显示系统原生键值、Qt 原始键值(如果可用)和 antimicro 使用的自定义键值。</p><p>antimicro 键值和 Qt 键值通常是一样的。如果可能,antimicro 将优先使用 Qt 中已定义的键值。如果想了解 Qt 中已定义的键值列表,请查看页面 <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum</span></a>。如果您发现某个键没有被本程序原生支持,请将问题报告至 antimicro 的 <a href="https://github.com/AntiMicro/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub 页面</span></a>,以便我们修改程序后直接支持这个键。如您所见,未知的键值将被附加一个自定义前缀。这样一来,它们就能被使用了,不过最大的问题是含有这个键的配置文件将无法在其它地方使用。</p></body></html> - - <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> + + <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="http://doc.qt.io/qt-5/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">http://doc.qt.io/qt-5/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> - + Event Handler: 事件处理程序: - + Native Key Value: 系统原生键值: - - - + + + 0x00000000 0x00000000 - + Qt Key Value: Qt 原始键值: - + antimicro Key Value: antimicro 自定义键值: @@ -5036,203 +5073,203 @@ of your screen. QObject - + Super Super - + Menu Menu - + Mute Mute - + Vol+ Vol+ - + Vol- Vol- - + Play/Pause Play/Pause - + Play Play - + Pause Pause - + Prev Prev - + Next Next - + Mail Mail - + Home Home - + Media Media - + Search Search - + Daemon launched 后台服务已启动 - + Failed to launch daemon 无法启动后台服务 - + Launching daemon 正在启动后台服务 - - + + Display string "%1" is not valid. 显示字符串“%1”无效。 - + Failed to set a signature id for the daemon 无法为后台服务设置签名ID - + Failed to change working directory to / 无法切换工作路径到根目录 - + Quitting Program 正在退出程序 - + # of joysticks found: %1 已发现摇杆数:%1 - + List Joysticks: 摇杆列表: - + --------------- --------------- - + Joystick %1: 摇杆%1: - + Index: %1 编号:%1 - + GUID: %1 全局唯一标识符:%1 - + Name: %1 名称:%1 - + Yes - + No - + Game Controller: %1 游戏控制器:%1 - + # of Axes: %1 轴数:%1 - + # of Buttons: %1 按钮数:%1 - + # of Hats: %1 帽子开关数:%1 - + Attempting to use fallback option %1 for event generation. 尝试为事件生成使用后备选项 %1。 - + Failed to open event generator. Exiting. 无法打开事件发生器。正在退出。 - + Using %1 as the event generator. 使用 %1 作为事件发生器。 - + Could not raise process priority. 无法提升进程优先级。 - + Auto-switching to profile "%1". 自动切换到配置文件“%1”。 - + Auto-switching to nullptr profile! @@ -5241,74 +5278,74 @@ of your screen. 自动切换到空配置文件! - + Logging started 日志记录已开始 - + Active window changed to: Title = "%1", Class = "%2", Program = "%3" or "%4". 活动窗口已更改至:标题 = “%1”,类 = “%2”,程序 = “%3”或“%4”。 - + Last button - + There isn't a last button pressed from gamepad in data. Did you set at least one button from gamepad for keyboard? - + Profile location %1 is not an XML file. 配置文件 %1 不是一个 XML 文件。 - + Profile location %1 does not exist. 配置文件 %1 不存在。 - - - + + + Controller identifier is not a valid value. 游戏控制器标识符无效。 - + An invalid set number '%1' was specified. 指定的设置编号 "%1" 无效。 - + Controller identifier '%s'' is not a valid value. 游戏控制器标识符 "%s" 无效。 - + No set number was specified. 未指定设置编号。 - + No controller was specified. 未指定游戏控制器。 - + No display string was specified. 未指定显示字符串。 - + An invalid event generator was specified. 指定的事件发生器无效。 - + No event generator string was specified. 未指定事件发生器字符串。 @@ -5317,7 +5354,7 @@ of your screen. 检测到 Qt 样式标识,但未指定样式。 - + No log file specified. 未指定日志文件。 @@ -5415,7 +5452,7 @@ of your screen. 为所选的游戏控制器打开游戏控制器映射窗口。值可以是控制器编号或全局唯一标识符。 - + xinput version must be at least 2.0. No mouse acceleration changes will occur. XInput 版本必需至少为2.0。鼠标加速选项将无效。 @@ -5423,18 +5460,18 @@ of your screen. QuickSetDialog - + Quick Set 快速设置 - + <html><head/><body><p>Please press a button or move an axis on %1 (<span style=" font-weight:600;">%2</span>).<br/>A dialog window will then appear which will<br/>allow you to make an assignment.</p></body></html> <html><head/><body><p>请在 %1(<span style=" font-weight:600;">%2</span>)上按任意键或移动任意轴。<br/>之后一个对话框会弹出并允许您设置按键分配。</p></body></html> - - + + Quick Set %1 快速设置 %1 @@ -5442,12 +5479,12 @@ of your screen. SetAxisThrottleDialog - + Throttle Change 阀设置改变 - + The throttle setting for Axis %1 has been changed. Would you like to distribute this throttle change to all sets? @@ -5458,12 +5495,12 @@ Would you like to distribute this throttle change to all sets? SetJoystick - + Set %1: %2 设置%1:%2 - + Set %1 设置%1 @@ -5471,52 +5508,52 @@ Would you like to distribute this throttle change to all sets? SetNamesDialog - + Set Name Settings 指定设置名称 - + Set 1 设置1 - + Set 2 设置2 - + Set 3 设置3 - + Set 4 设置4 - + Set 5 设置5 - + Set 6 设置6 - + Set 7 设置7 - + Set 8 设置8 - + Name 名称 @@ -5524,7 +5561,7 @@ Would you like to distribute this throttle change to all sets? SimpleKeyGrabberButton - + Mouse 鼠标 @@ -5532,7 +5569,7 @@ Would you like to distribute this throttle change to all sets? SpringModeRegionPreview - + Spring Mode Preview 弹簧模式预览 @@ -5540,7 +5577,7 @@ Would you like to distribute this throttle change to all sets? UInputEventHandler - + Could not find a valid uinput device file. Please check that you have the uinput module loaded. lsmod | grep uinput @@ -5549,14 +5586,14 @@ lsmod | grep uinput lsmod | grep uinput - + Could not open uinput device file Please check that you have permission to write to the device 无法打开 uinput 设备文件 请确认您有写入该设备的权限 - + Using uinput device file %1 使用 uinput 设备文件%1 @@ -5564,551 +5601,551 @@ Please check that you have permission to write to the device UInputHelper - + a a - + b b - + c c - + d d - + e e - + f f - + g g - + h h - + i i - + j j - + k k - + l l - + m m - + n n - + o o - + p p - + q q - + r r - + s s - + t t - + u u - + v v - + w w - + x x - + y y - + z z - + Esc Esc - + F1 F1 - + F2 F2 - + F3 F3 - + F4 F4 - + F5 F5 - + F6 F6 - + F7 F7 - + F8 F8 - + F9 F9 - + F10 F10 - + F11 F11 - + F12 F12 - + ` ` - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - - + + - - - + = = - + BackSpace BackSpace - + Tab Tab - + [ [ - + ] ] - + \ \ - + CapsLock CapsLock - + ; ; - + ' ' - + Enter Enter - + Shift_L Shift_L - + , , - - + + . . - - + + / / - + Ctrl_L Ctrl_L - - + + Super_L Super_L - + Alt_L Alt_L - + Space Space - + Alt_R Alt_R - + Menu Menu - + Ctrl_R Ctrl_R - + Shift_R Shift_R - + Up Up - + Left Left - + Down Down - + Right Right - + PrtSc PrtSc - + Ins Ins - + Del Del - + Home Home - + End End - + PgUp PgUp - + PgDn PgDn - + NumLock NumLock - + * * - + + + - + KP_Enter KP_Enter - + KP_1 KP_1 - + KP_2 KP_2 - + KP_3 KP_3 - + KP_4 KP_4 - + KP_5 KP_5 - + KP_6 KP_6 - + KP_7 KP_7 - + KP_8 KP_8 - + KP_9 KP_9 - + KP_0 KP_0 - + SCLK SCLK - + Pause Pause - + Super_R Super_R - + Mute Mute - + VolDn VolDn - + VolUp VolUp - + Play Play - + Stop Stop - + Prev Prev - + Next Next - + [NO KEY] [NO KEY] @@ -6116,54 +6153,54 @@ Please check that you have permission to write to the device UnixWindowInfoDialog - + Captured Window Properties 捕获的窗口属性 - + Information About Window 窗口信息 - + Class: 类: - - - + + + TextLabel 文本标签 - + Title: 标题: - + Path: 路径: - + Match By Properties 根据属性匹配 - + Class - + Title 标题 - + Path 路径 @@ -6171,9 +6208,9 @@ Please check that you have permission to write to the device VDPad - - - + + + VDPad 虚拟十字键 @@ -6181,224 +6218,224 @@ Please check that you have permission to write to the device VirtualKeyPushButton - + Space Space - + Tab Tab - + Shift (L) Shift (L) - + Shift (R) Shift (R) - + Ctrl (L) Ctrl (L) - + Ctrl (R) Ctrl (R) - + Alt (L) Alt (L) - - + + Alt (R) Alt (R) - + Alt Gr - + ` ` - + ~ ~ - - + + - - - + = = - + [ [ - + ] ] - + \ \ - + Caps Caps - + ; ; - + ' ' - + , , - - + + . . - - + + / / - + ESC ESC - + PRTSC PRTSC - + SCLK SCLK - + INS INS - + PGUP PGUP - + DEL DEL - + PGDN PGDN - + 1 1 - + 2 2 - + 3 3 - + 4 4 - + 5 5 - + 6 6 - + 7 7 - + 8 8 - + 9 9 - + 0 0 - + NUM LK NUM LK - - + + * * - + + + - + Enter Enter @@ -6415,42 +6452,42 @@ E R - + < < - + : : - + Super (L) Super (L) - + Menu Menu - + Up Up - + Down Down - + Left Left - + Right Right @@ -6458,226 +6495,226 @@ R VirtualKeyboardMouseWidget - - + + Keyboard 键盘 - - + + Mouse 鼠标 - + Mouse Settings 鼠标设置 - + Left Mouse - + Up Mouse - + Left Button Mouse 左键 - + Middle Button Mouse 中键 - + Right Button Mouse 右键 - + Wheel Up Mouse 滚轮向上 - + Wheel Left Mouse 滚轮向左 - + Wheel Right Mouse 滚轮向右 - + Wheel Down Mouse 滚轮向下 - + Down Mouse - + Right Mouse - + Button 4 Mouse 按钮4 - + Mouse 8 Mouse 按钮8 - + Button 5 Mouse 按钮5 - + Mouse 9 Mouse 按钮9 - + NONE - - + + Last button - - + + Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad - + Others - + Applications 应用程序 - + Browser Back 浏览器后退 - + Browser Favorites 浏览器收藏 - + Browser Forward 浏览器前进 - + Browser Home 浏览器主页 - + Browser Refresh 浏览器刷新 - + Browser Search 浏览器搜索 - + Browser Stop 浏览器停止 - + Calc 计算器 - + Email 邮件 - + Media 多媒体 - + Media Next 多媒体下一首 - + Media Play 多媒体播放 - + Media Previous 多媒体上一首 - + Media Stop 多媒体停止 - + Search 搜索 - + Volume Down 音量减小 - + Volume Mute 静音 - + Volume Up 音量增加 @@ -6685,7 +6722,7 @@ R VirtualMousePushButton - + INVALID 无效 @@ -6693,28 +6730,28 @@ R WinAppProfileTimerDialog - - + + Capture Application 捕捉应用程序 - + After pressing the "Capture Application" button, please select the application window that you want to have a profile associated with. The active application will be captured after the selected number of seconds. 按下“捕捉应用程序”按钮之后,请选择您想要关联配置文件的应用程序窗口。活动的应用程序将在指定的秒数之后被捕捉。 - + Timer: 计时器: - + Seconds - + Cancel 取消 @@ -6722,12 +6759,12 @@ R WinExtras - + [NO KEY] [无按键] - + AntiMicro Profile antimicro 配置文件 @@ -6735,67 +6772,66 @@ R X11Extras - + ESC ESC - + Tab Tab - + Space Space - + DEL DEL - + Return Return - + KP_Enter KP_Enter - + Backspace Backspace - + Alt Gr - + xinput extension was not found. No mouse acceleration changes will occur. 未找到 XInput 扩展。鼠标加速选项将无效。 - + xinput version must be at least 2.0. No mouse acceleration changes will occur. XInput 版本必需至少为2.0。鼠标加速选项将无效。 - Virtual pointer found with id=%1. - 发现虚拟指针 ID=%1。 + 发现虚拟指针 ID=%1。 - + PtrFeedbackClass was not found for virtual pointer.No change to mouse acceleration will occur for device with id=%1 未找到虚拟指针的 PtrFeedbackClass。鼠标加速选项在 ID=%1 的设备上将无效 - + Changing mouse acceleration for device with id=%1 正在改变 ID=%1 的设备上的鼠标加速选项 @@ -6803,7 +6839,7 @@ R XMLConfigReader - + Could not write updated profile XML to file %1. 无法将更新后的配置 XML 写入文件 %1。 @@ -6811,7 +6847,7 @@ R XMLConfigWriter - + Could not write to profile at %1. 无法写入配置文件 %1。 @@ -6819,7 +6855,7 @@ R antimicro - + Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support. @@ -6827,97 +6863,97 @@ R main - + Launch program in system tray only. 启动后最小化到系统托盘。 - + Launch program with the tray menu disabled - + Launch program without the main window displayed - + Launch program with the configuration file selected as the default for selected controllers. Defaults to all controllers - + location - + Apply configuration file to a specific controller. Value can be a controller index, name, or GUID - + value - + Unload currently enabled profile(s) - + value(s) - + Start joysticks on a specific set. Value can be a controller index, name, or GUID - + number value - + Launch program as a daemon. Use only on Linux. - + Enable logging - + log-type - + Choose a file for logs writing - + filename - + Choose between using XTest support and uinput support for event generation. Use only if you have enabled xtest and uinput options on Linux or vmulti on Windows. Default: xtest. - + event-generation-type - + Print information about joysticks detected by SDL. Use only if you have sdl library. You can check your controller index, name or even GUID. diff --git a/share/blank.txt b/share/blank.txt old mode 100644 new mode 100755 diff --git a/src/aboutdialog.cpp b/src/aboutdialog.cpp old mode 100644 new mode 100755 index 9a1cba930..1f15141c8 --- a/src/aboutdialog.cpp +++ b/src/aboutdialog.cpp @@ -22,6 +22,7 @@ #include "eventhandlerfactory.h" #include +#include #include #include @@ -29,7 +30,6 @@ #include #include #include -#include #include AboutDialog::AboutDialog(QWidget *parent) : @@ -58,8 +58,7 @@ void AboutDialog::fillInfoTextBrowser() QStringList finalInfoText = QStringList(); finalInfoText.append(trUtf8("Program Version %1").arg(PadderCommon::programVersion)); - // __DATE__, __TIME__ - finalInfoText.append(trUtf8("Program Compiled on %1 at %2").arg(QDate::currentDate().toString("MMM dd yyyy")).arg(QTime::currentTime().toString("hh:mm:ss"))); + finalInfoText.append(trUtf8("Program Compiled on %1 at %2").arg(__DATE__).arg(__TIME__)); QString sdlCompiledVersionNumber("%1.%2.%3"); QString sdlLinkedVersionNumber("%1.%2.%3"); @@ -79,6 +78,7 @@ void AboutDialog::fillInfoTextBrowser() BaseEventHandler *handler = nullptr; EventHandlerFactory *factory = EventHandlerFactory::getInstance(); + if (factory != nullptr) { handler = factory->handler(); @@ -105,10 +105,7 @@ void AboutDialog::changeEvent(QEvent *event) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (event->type() == QEvent::LanguageChange) - { - retranslateUi(); - } + if (event->type() == QEvent::LanguageChange) retranslateUi(); QDialog::changeEvent(event); } diff --git a/src/aboutdialog.h b/src/aboutdialog.h old mode 100644 new mode 100755 diff --git a/src/aboutdialog.ui b/src/aboutdialog.ui old mode 100644 new mode 100755 index 849a43d6c..b6353100c --- a/src/aboutdialog.ui +++ b/src/aboutdialog.ui @@ -52,7 +52,7 @@ - :/images/antimicro.png + :/images/16x16/com.github.juliagoda.antimicro.png @@ -136,7 +136,7 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">Originally developed by Travis Nickles &lt;nickles.travis@gmail.com&gt;, next maintained by the AntiMicro group at https://github.com/AntiMicro, and now by juliagoda at https://github.com/juliagoda</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt; font-weight:600;">Contributors:</span></p> @@ -162,8 +162,8 @@ p, li { white-space: pre-wrap; } <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-weight:600;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">VaGNaroK &lt;vagnarokalkimist@gmail.com&gt; - Brazilian Portuguese</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">zzpxyx - Chinese</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Belleguic Terence &lt;hizo@free.fr&gt; - French</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Leonard Koenig &lt;leonard.r.koenig@googlemail.com&gt; - German</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'DejaVu Sans'; font-size:9pt;">Belleguic Terence &lt;hizo@free.fr&gt; - French</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'DejaVu Sans'; font-size:9pt;">Leonard Koenig &lt;leonard.r.koenig@googlemail.com&gt; - German</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">phob - German</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">tou omiya - Japanese</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">Dmitriy Koshel &lt;form.eater@gmail.com&gt; - Russian</span></p> @@ -211,7 +211,7 @@ p, li { white-space: pre-wrap; } <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif';">GNU GENERAL PUBLIC LICENSE</span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif';">Version 3, 29 June 2007</span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif';">Copyright (C) 2007 Free Software Foundation, Inc. &lt;http://fsf.org/&gt;</span></p> diff --git a/src/addeditautoprofiledialog.cpp b/src/addeditautoprofiledialog.cpp old mode 100644 new mode 100755 index 1348a232c..0e48d5d2e --- a/src/addeditautoprofiledialog.cpp +++ b/src/addeditautoprofiledialog.cpp @@ -73,20 +73,20 @@ AddEditAutoProfileDialog::AddEditAutoProfileDialog(AutoProfileInfo *info, AntiMi this->originalWindowClass = info->getWindowClass(); this->originalWindowName = info->getWindowName(); + bool allowDefault = false; + if (info->isPartialState()) ui->setPartialCheckBox->setChecked(true); else ui->setPartialCheckBox->setChecked(false); QListIterator iterGUIDs(reservedGUIDS); + while (iterGUIDs.hasNext()) { QString guid = iterGUIDs.next(); - if (!getReservedGUIDs().contains(guid)) - { - this->reservedGUIDs.append(guid); - } + + if (!getReservedGUIDs().contains(guid)) this->reservedGUIDs.append(guid); } - bool allowDefault = false; if ((info->getGUID() != "all") && (info->getGUID() != "") && !getReservedGUIDs().contains(info->getGUID())) @@ -97,10 +97,8 @@ AddEditAutoProfileDialog::AddEditAutoProfileDialog(AutoProfileInfo *info, AntiMi if (allowDefault && info->getExe().isEmpty()) { ui->asDefaultCheckBox->setEnabled(true); - if (info->isCurrentDefault()) - { - ui->asDefaultCheckBox->setChecked(true); - } + + if (info->isCurrentDefault()) ui->asDefaultCheckBox->setChecked(true); } else { @@ -111,14 +109,14 @@ AddEditAutoProfileDialog::AddEditAutoProfileDialog(AutoProfileInfo *info, AntiMi QListIterator iter(*devices); int found = -1; int numItems = 1; + while (iter.hasNext()) { InputDevice *device = iter.next(); ui->devicesComboBox->addItem(device->getSDLName(), QVariant::fromValue(device)); - if (device->getGUIDString() == info->getGUID()) - { - found = numItems; - } + + if (device->getGUIDString() == info->getGUID()) found = numItems; + numItems++; } @@ -166,6 +164,7 @@ AddEditAutoProfileDialog::AddEditAutoProfileDialog(AutoProfileInfo *info, AntiMi connect(this, &AddEditAutoProfileDialog::accepted, this, &AddEditAutoProfileDialog::saveAutoProfileInformation); } + AddEditAutoProfileDialog::~AddEditAutoProfileDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -173,18 +172,18 @@ AddEditAutoProfileDialog::~AddEditAutoProfileDialog() delete ui; } + void AddEditAutoProfileDialog::openProfileBrowseDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); QString lookupDir = PadderCommon::preferredProfileDir(settings); QString filename = QFileDialog::getOpenFileName(this, trUtf8("Open Config"), lookupDir, QString("Config Files (*.amgp *.xml)")); - if (!filename.isNull() && !filename.isEmpty()) - { - ui->profileLineEdit->setText(QDir::toNativeSeparators(filename)); - } + + if (!filename.isNull() && !filename.isEmpty()) ui->profileLineEdit->setText(QDir::toNativeSeparators(filename)); } + void AddEditAutoProfileDialog::openApplicationBrowseDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -194,16 +193,16 @@ void AddEditAutoProfileDialog::openApplicationBrowseDialog() #elif defined(Q_OS_LINUX) QString filename = QFileDialog::getOpenFileName(this, trUtf8("Select Program"), QDir::homePath(), QString()); #endif + if (!filename.isNull() && !filename.isEmpty()) { QFileInfo exe(filename); - if (exe.exists() && exe.isExecutable()) - { - ui->applicationLineEdit->setText(filename); - } + + if (exe.exists() && exe.isExecutable()) ui->applicationLineEdit->setText(filename); } } + AutoProfileInfo* AddEditAutoProfileDialog::getAutoProfile() const { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -211,6 +210,7 @@ AutoProfileInfo* AddEditAutoProfileDialog::getAutoProfile() const return info; } + void AddEditAutoProfileDialog::saveAutoProfileInformation() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -220,11 +220,9 @@ void AddEditAutoProfileDialog::saveAutoProfileInformation() if (deviceIndex > 0) { - QVariant temp = ui->devicesComboBox->itemData(deviceIndex, Qt::UserRole); - // Assume that if the following is not true, the GUID should // not be changed. - if (!temp.isNull()) + if (!ui->devicesComboBox->itemData(deviceIndex, Qt::UserRole).isNull()) { InputDevice *device = ui->devicesComboBox->itemData(deviceIndex, Qt::UserRole).value(); info->setGUID(device->getGUIDString()); @@ -242,34 +240,31 @@ void AddEditAutoProfileDialog::saveAutoProfileInformation() info->setWindowName(ui->winNameLineEdit->text()); info->setDefaultState(ui->asDefaultCheckBox->isChecked()); info->setPartialState(ui->setPartialCheckBox->isChecked()); - } + void AddEditAutoProfileDialog::checkForReservedGUIDs(int index) { qInstallMessageHandler(MessageHandler::myMessageOutput); QVariant data = ui->devicesComboBox->itemData(index); + if (index == 0) { ui->asDefaultCheckBox->setChecked(false); ui->asDefaultCheckBox->setEnabled(false); ui->asDefaultCheckBox->setToolTip(trUtf8("Please use the main default profile selection.")); } - else if (!data.isNull()) + else if (!data.isNull() && getReservedGUIDs().contains(data.value()->getGUIDString())) + { + ui->asDefaultCheckBox->setChecked(false); + ui->asDefaultCheckBox->setEnabled(false); + ui->asDefaultCheckBox->setToolTip(trUtf8("A different profile is already selected as the default for this device.")); + } + else { - InputDevice *device = data.value(); - if (getReservedGUIDs().contains(device->getGUIDString())) - { - ui->asDefaultCheckBox->setChecked(false); - ui->asDefaultCheckBox->setEnabled(false); - ui->asDefaultCheckBox->setToolTip(trUtf8("A different profile is already selected as the default for this device.")); - } - else - { - ui->asDefaultCheckBox->setEnabled(true); - ui->asDefaultCheckBox->setToolTip(trUtf8("Select this profile to be the default loaded for\nthe specified device. The selection will be used instead\nof the all default profile option.")); - } + ui->asDefaultCheckBox->setEnabled(true); + ui->asDefaultCheckBox->setToolTip(trUtf8("Select this profile to be the default loaded for\nthe specified device. The selection will be used instead\nof the all default profile option.")); } } @@ -312,27 +307,27 @@ void AddEditAutoProfileDialog::showCaptureHelpWindow() if (QApplication::platformName() == QStringLiteral("xcb")) { - QMessageBox *box = new QMessageBox(this); - box->setText(trUtf8("Please select a window by using the mouse. Press Escape if you want to cancel.")); - box->setWindowTitle(trUtf8("Capture Application Window")); - box->setStandardButtons(QMessageBox::NoButton); - box->setModal(true); - box->show(); - - UnixCaptureWindowUtility *util = new UnixCaptureWindowUtility(); - QThread *thread = new QThread; // QTHREAD(this) - util->moveToThread(thread); - - connect(thread, &QThread::started, util, &UnixCaptureWindowUtility::attemptWindowCapture); - connect(util, &UnixCaptureWindowUtility::captureFinished, thread, &QThread::quit); - connect(util, &UnixCaptureWindowUtility::captureFinished, box, &QMessageBox::hide); - connect(util, &UnixCaptureWindowUtility::captureFinished, this, [this, util]() { - checkForGrabbedWindow(util); - }, Qt::QueuedConnection); - - connect(thread, &QThread::finished, box, &QMessageBox::deleteLater); - connect(util, &UnixCaptureWindowUtility::destroyed, thread, &QThread::deleteLater); - thread->start(); + QMessageBox *box = new QMessageBox(this); + box->setText(trUtf8("Please select a window by using the mouse. Press Escape if you want to cancel.")); + box->setWindowTitle(trUtf8("Capture Application Window")); + box->setStandardButtons(QMessageBox::NoButton); + box->setModal(true); + box->show(); + + UnixCaptureWindowUtility *util = new UnixCaptureWindowUtility(); + QThread *thread = new QThread; // QTHREAD(this) + util->moveToThread(thread); + + connect(thread, &QThread::started, util, &UnixCaptureWindowUtility::attemptWindowCapture); + connect(util, &UnixCaptureWindowUtility::captureFinished, thread, &QThread::quit); + connect(util, &UnixCaptureWindowUtility::captureFinished, box, &QMessageBox::hide); + connect(util, &UnixCaptureWindowUtility::captureFinished, this, [this, util]() { + checkForGrabbedWindow(util); + }, Qt::QueuedConnection); + + connect(thread, &QThread::finished, box, &QMessageBox::deleteLater); + connect(util, &UnixCaptureWindowUtility::destroyed, thread, &QThread::deleteLater); + thread->start(); } #endif @@ -349,59 +344,59 @@ void AddEditAutoProfileDialog::checkForGrabbedWindow(UnixCaptureWindowUtility* u #ifdef WITH_X11 if (QApplication::platformName() == QStringLiteral("xcb")) { - long targetWindow = util->getTargetWindow(); - bool escaped = !util->hasFailed(); - bool failed = false; - QString path = QString(); + long targetWindow = util->getTargetWindow(); + bool escaped = !util->hasFailed(); + bool failed = false; + QString path = QString(); - if (targetWindow != None) - { - // Attempt to find the appropriate window below the root window - // that was clicked. - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "ORIGINAL: " << QString::number(targetWindow, 16); - #endif - - long tempWindow = static_cast(X11Extras::getInstance()->findClientWindow(static_cast(targetWindow))); - if (tempWindow > 0) + if (targetWindow != None) { - targetWindow = tempWindow; + // Attempt to find the appropriate window below the root window + // that was clicked. + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "ORIGINAL: " << QString::number(targetWindow, 16); + #endif + + long tempWindow = X11Extras::getInstance()->findClientWindow(targetWindow); + if (tempWindow > 0) + { + targetWindow = tempWindow; + } + + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "ADJUSTED: " << QString::number(targetWindow, 16); + #endif } - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "ADJUSTED: " << QString::number(targetWindow, 16); - #endif - } - if (targetWindow != None) - { - CapturedWindowInfoDialog *dialog = new CapturedWindowInfoDialog(targetWindow, this); - connect(dialog, &CapturedWindowInfoDialog::accepted, [this, dialog]() { + if (targetWindow != None) + { + CapturedWindowInfoDialog *dialog = new CapturedWindowInfoDialog(targetWindow, this); + connect(dialog, &CapturedWindowInfoDialog::accepted, [this, dialog]() { + windowPropAssignment(dialog); + }); - windowPropAssignment(dialog); - }); + dialog->show(); + } + else if (!escaped) + { + failed = true; + } - dialog->show(); - } - else if (!escaped) - { - failed = true; - } + // Ensure that the operation was not cancelled (Escape wasn't pressed). + if (failed) + { + QMessageBox box; + box.setText(trUtf8("Could not obtain information for the selected window.")); + box.setWindowTitle(trUtf8("Application Capture Failed")); + box.setStandardButtons(QMessageBox::Close); + box.raise(); + box.exec(); + } - // Ensure that the operation was not cancelled (Escape wasn't pressed). - if (failed) - { - QMessageBox box; - box.setText(trUtf8("Could not obtain information for the selected window.")); - box.setWindowTitle(trUtf8("Application Capture Failed")); - box.setStandardButtons(QMessageBox::Close); - box.raise(); - box.exec(); + util->deleteLater(); } - util->deleteLater(); - } #endif - } #endif @@ -414,18 +409,13 @@ void AddEditAutoProfileDialog::windowPropAssignment(CapturedWindowInfoDialog *di disconnect(ui->winClassLineEdit, &QLineEdit::textChanged, this, &AddEditAutoProfileDialog::checkForDefaultStatus); disconnect(ui->winNameLineEdit, &QLineEdit::textChanged, this, &AddEditAutoProfileDialog::checkForDefaultStatus); - if (dialog->getSelectedOptions() & CapturedWindowInfoDialog::WindowPath) + if (dialog->useFullWindowPath() && dialog->getSelectedOptions() & CapturedWindowInfoDialog::WindowPath) { - if (dialog->useFullWindowPath()) - { - ui->applicationLineEdit->setText(dialog->getWindowPath()); - } - else - { - QString temp = QString(); - temp = QFileInfo(dialog->getWindowPath()).fileName(); - ui->applicationLineEdit->setText(temp); - } + ui->applicationLineEdit->setText(dialog->getWindowPath()); + } + else if (!dialog->useFullWindowPath() && dialog->getSelectedOptions() & CapturedWindowInfoDialog::WindowPath) + { + ui->applicationLineEdit->setText(QFileInfo(dialog->getWindowPath()).fileName()); } else { @@ -463,8 +453,8 @@ void AddEditAutoProfileDialog::checkForDefaultStatus() qInstallMessageHandler(MessageHandler::myMessageOutput); bool status = ui->applicationLineEdit->text().length() > 0; - status = status ? status : ui->winClassLineEdit->text().length() > 0; - status = status ? status : ui->winNameLineEdit->text().length() > 0; + status = status ? status : (ui->winClassLineEdit->text().length() > 0); + status = status ? status : (ui->winNameLineEdit->text().length() > 0); if (status) { @@ -486,13 +476,13 @@ void AddEditAutoProfileDialog::accept() bool validForm = true; bool propertyFound = false; - QString errorString = QString(); + if (ui->profileLineEdit->text().length() > 0) { - QString profileFilename = ui->profileLineEdit->text(); - QFileInfo info(profileFilename); - if (!info.exists()) + QFileInfo profileFileName(ui->profileLineEdit->text()); + + if (!profileFileName.exists()) { validForm = false; errorString = trUtf8("Profile file path is invalid."); @@ -516,6 +506,7 @@ void AddEditAutoProfileDialog::accept() { QString exeFileName = ui->applicationLineEdit->text(); QFileInfo info(exeFileName); + if (info.isAbsolute() && (!info.exists() || !info.isExecutable())) { validForm = false; diff --git a/src/addeditautoprofiledialog.h b/src/addeditautoprofiledialog.h old mode 100644 new mode 100755 diff --git a/src/addeditautoprofiledialog.ui b/src/addeditautoprofiledialog.ui old mode 100644 new mode 100755 index 587dc56e9..e190af6d1 --- a/src/addeditautoprofiledialog.ui +++ b/src/addeditautoprofiledialog.ui @@ -7,7 +7,7 @@ 0 0 478 - 408 + 418 @@ -22,7 +22,7 @@ - Profile: + Pro&file: profileLineEdit @@ -80,7 +80,7 @@ in the form. - Class: + &Class: applicationLineEdit @@ -97,7 +97,7 @@ in the form. - Title: + T&itle: applicationLineEdit diff --git a/src/advancebuttondialog.cpp b/src/advancebuttondialog.cpp old mode 100644 new mode 100755 index 6d410bc6e..d00b3639f --- a/src/advancebuttondialog.cpp +++ b/src/advancebuttondialog.cpp @@ -18,6 +18,7 @@ #include "advancebuttondialog.h" #include "ui_advancebuttondialog.h" +#include "globalvariables.h" #include "messagehandler.h" #include "event.h" #include "inputdevice.h" @@ -40,8 +41,6 @@ #include -const int AdvanceButtonDialog::MINIMUMTURBO = 2; - AdvanceButtonDialog::AdvanceButtonDialog(JoyButton *button, QWidget *parent) : QDialog(parent, Qt::Window), ui(new Ui::AdvanceButtonDialog), @@ -54,73 +53,79 @@ AdvanceButtonDialog::AdvanceButtonDialog(JoyButton *button, QWidget *parent) : PadderCommon::inputDaemonMutex.lock(); - this->button = button; + m_button = button; oldRow = 0; + int interval = m_button->getTurboInterval() / 10; getHelperLocal().moveToThread(button->thread()); - if (this->button->getToggleState()) - { - ui->toggleCheckbox->setChecked(true); - } + if (m_button->getToggleState()) ui->toggleCheckbox->setChecked(true); - if (this->button->isUsingTurbo()) + if (m_button->isUsingTurbo()) { ui->turboCheckbox->setChecked(true); ui->turboSlider->setEnabled(true); } - int interval = this->button->getTurboInterval() / 10; - if (interval < MINIMUMTURBO) - { - interval = JoyButton::ENABLEDTURBODEFAULT / 10; - } + if (interval < GlobalVariables::AdvanceButtonDialog::MINIMUMTURBO) + interval = GlobalVariables::JoyButton::ENABLEDTURBODEFAULT / 10; + ui->turboSlider->setValue(interval); this->changeTurboText(interval); - QListIterator iter(*(this->button->getAssignedSlots())); + QListIterator iter(*(m_button->getAssignedSlots())); + while (iter.hasNext()) { JoyButtonSlot *buttonslot = iter.next(); SimpleKeyGrabberButton *existingCode = new SimpleKeyGrabberButton(this); existingCode->setText(buttonslot->getSlotString()); - if (buttonslot->getSlotMode() == JoyButtonSlot::JoyLoadProfile) - { - if (!buttonslot->getTextData().isEmpty()) - { - existingCode->setValue(buttonslot->getTextData(), JoyButtonSlot::JoyLoadProfile); - existingCode->setToolTip(buttonslot->getTextData()); - } - } - else if (buttonslot->getSlotMode() == JoyButtonSlot::JoyTextEntry) - { - if (!buttonslot->getTextData().isEmpty()) - { - existingCode->setValue(buttonslot->getTextData(), JoyButtonSlot::JoyTextEntry); - existingCode->setToolTip(buttonslot->getTextData()); - } - } - else if (buttonslot->getSlotMode() == JoyButtonSlot::JoyExecute) + + switch(static_cast(buttonslot->getSlotMode())) { - if (!buttonslot->getTextData().isEmpty()) - { - existingCode->setValue(buttonslot->getTextData(), JoyButtonSlot::JoyExecute); - existingCode->setToolTip(buttonslot->getTextData()); + case 11: - if (buttonslot->getExtraData().canConvert()) + if (!buttonslot->getTextData().isEmpty()) { - QString argumentsTemp = buttonslot->getExtraData().toString(); - existingCode->getValue()->setExtraData(argumentsTemp); + existingCode->setValue(buttonslot->getTextData(), JoyButtonSlot::JoyLoadProfile); + existingCode->setToolTip(buttonslot->getTextData()); } - } - } - else - { - existingCode->setValue(buttonslot->getSlotCode(), + + break; + + case 13: + + if (!buttonslot->getTextData().isEmpty()) + { + existingCode->setValue(buttonslot->getTextData(), JoyButtonSlot::JoyTextEntry); + existingCode->setToolTip(buttonslot->getTextData()); + } + + break; + + case 14: + + if (!buttonslot->getTextData().isEmpty()) + { + existingCode->setValue(buttonslot->getTextData(), JoyButtonSlot::JoyExecute); + existingCode->setToolTip(buttonslot->getTextData()); + + if (buttonslot->getExtraData().canConvert()) + existingCode->getValue()->setExtraData(buttonslot->getExtraData().toString()); + } + + break; + + default: + + existingCode->setValue(buttonslot->getSlotCode(), buttonslot->getSlotCodeAlias(), buttonslot->getSlotMode()); + break; + } + QListWidgetItem *item = new QListWidgetItem(ui->slotListWidget); item->setData(Qt::UserRole, QVariant::fromValue(existingCode)); QHBoxLayout *layout= new QHBoxLayout(); @@ -138,22 +143,19 @@ AdvanceButtonDialog::AdvanceButtonDialog(JoyButton *button, QWidget *parent) : populateSetSelectionComboBox(); populateSlotSetSelectionComboBox(); - if ((this->button->getSetSelection() > -1) && - (this->button->getChangeSetCondition() != JoyButton::SetChangeDisabled)) + if ((m_button->getSetSelection() > -1) && + (m_button->getChangeSetCondition() != JoyButton::SetChangeDisabled)) { - int selectIndex = static_cast(this->button->getChangeSetCondition()); - selectIndex += this->button->getSetSelection() * 3; - if (this->button->getOriginSet() < this->button->getSetSelection()) - { - selectIndex -= 3; - } + int selectIndex = m_button->getChangeSetCondition(); + selectIndex += m_button->getSetSelection() * 3; + + if (m_button->getOriginSet() < m_button->getSetSelection()) selectIndex -= 3; ui->setSelectionComboBox->setCurrentIndex(selectIndex); } fillTimeComboBoxes(); ui->actionTenthsComboBox->setCurrentIndex(1); - updateActionTimeLabel(); changeTurboForSequences(); @@ -164,18 +166,15 @@ AdvanceButtonDialog::AdvanceButtonDialog(JoyButton *button, QWidget *parent) : checkCycleResetWidgetStatus(true); } - if (button->getCycleResetTime() != 0) - { - populateAutoResetInterval(); - } + if (button->getCycleResetTime() != 0) populateAutoResetInterval(); updateWindowTitleButtonName(); - if (this->button->isPartRealAxis() && this->button->isUsingTurbo()) + if (m_button->isPartRealAxis() && m_button->isUsingTurbo()) { ui->turboModeComboBox->setEnabled(true); } - else if (!this->button->isPartRealAxis()) + else if (!m_button->isPartRealAxis()) { ui->turboModeComboBox->setVisible(false); ui->turboModeLabel->setVisible(false); @@ -184,17 +183,13 @@ AdvanceButtonDialog::AdvanceButtonDialog(JoyButton *button, QWidget *parent) : findTurboModeComboIndex(); // Don't show Set Selector page for modifier buttons - if (this->button->isModifierButton()) - { - delete ui->listWidget->item(3); - } + if (m_button->isModifierButton()) delete ui->listWidget->item(3); - //performStatsWidgetRefresh(ui->slotListWidget->currentItem()); changeSlotHelpText(ui->slotTypeComboBox->currentIndex()); PadderCommon::inputDaemonMutex.unlock(); - ui->resetCycleDoubleSpinBox->setMaximum(JoyButton::MAXCYCLERESETTIME * 0.001); // static_cast + ui->resetCycleDoubleSpinBox->setMaximum(GlobalVariables::JoyButton::MAXCYCLERESETTIME * 0.001); // static_cast connect(ui->turboCheckbox, &QCheckBox::clicked, ui->turboSlider, &QSlider::setEnabled); connect(ui->turboSlider, &QSlider::valueChanged, this, &AdvanceButtonDialog::checkTurboIntervalValue); @@ -233,11 +228,13 @@ AdvanceButtonDialog::AdvanceButtonDialog(JoyButton *button, QWidget *parent) : connect(button, &JoyButton::toggleChanged, ui->toggleCheckbox, &QCheckBox::setChecked); connect(button, &JoyButton::turboChanged, this, &AdvanceButtonDialog::checkTurboSetting); + connect(ui->turboModeComboBox, static_cast(&QComboBox::currentIndexChanged), this, &AdvanceButtonDialog::setButtonTurboMode); connect(ui->loadProfilePushButton, &QPushButton::clicked, this, &AdvanceButtonDialog::showSelectProfileWindow); connect(ui->execToolButton, &QToolButton::clicked, this, &AdvanceButtonDialog::showFindExecutableWindow); } + AdvanceButtonDialog::~AdvanceButtonDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -245,14 +242,15 @@ AdvanceButtonDialog::~AdvanceButtonDialog() delete ui; } + void AdvanceButtonDialog::changeTurboText(int value) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (value >= MINIMUMTURBO) + if (value >= GlobalVariables::AdvanceButtonDialog::MINIMUMTURBO) { double delay = value / 100.0; - double clicks = 100.0 / static_cast(value); + double clicks = 100.0 / value; QString delaytext = QString::number(delay, 'g', 3).append(" ").append(trUtf8("sec.")); QString labeltext = QString::number(clicks, 'g', 2).append(" ").append(trUtf8("/sec.")); @@ -261,6 +259,7 @@ void AdvanceButtonDialog::changeTurboText(int value) } } + void AdvanceButtonDialog::updateSlotsScrollArea(int value) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -289,6 +288,7 @@ void AdvanceButtonDialog::updateSlotsScrollArea(int value) emit slotsChanged(); } + void AdvanceButtonDialog::connectButtonEvents(SimpleKeyGrabberButton *button) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -296,6 +296,7 @@ void AdvanceButtonDialog::connectButtonEvents(SimpleKeyGrabberButton *button) connect(button, &SimpleKeyGrabberButton::clicked, [this, button]() { bool leave = false; + for (int i = 0; (i < ui->slotListWidget->count()) && !leave; i++) { QListWidgetItem *item = ui->slotListWidget->item(i); @@ -313,36 +314,34 @@ void AdvanceButtonDialog::connectButtonEvents(SimpleKeyGrabberButton *button) connect(button, &SimpleKeyGrabberButton::buttonCodeChanged, [this, button](int value) { - JoyButtonSlot *tempbuttonslot = button->getValue(); - int index = ui->slotListWidget->currentRow(); + JoyButtonSlot *tempbuttonslot = button->getValue(); + int index = ui->slotListWidget->currentRow(); - QMetaObject::invokeMethod(&helper, "setAssignedSlot", Qt::BlockingQueuedConnection, - Q_ARG(int, tempbuttonslot->getSlotCode()), - Q_ARG(int, tempbuttonslot->getSlotCodeAlias()), - Q_ARG(int, index), - Q_ARG(JoyButtonSlot::JoySlotInputAction, tempbuttonslot->getSlotMode())); + QMetaObject::invokeMethod(&helper, "setAssignedSlot", Qt::BlockingQueuedConnection, + Q_ARG(int, tempbuttonslot->getSlotCode()), + Q_ARG(int, tempbuttonslot->getSlotCodeAlias()), + Q_ARG(int, index), + Q_ARG(JoyButtonSlot::JoySlotInputAction, tempbuttonslot->getSlotMode())); - updateSlotsScrollArea(value); + updateSlotsScrollArea(value); }); } + void AdvanceButtonDialog::deleteSlot() { qInstallMessageHandler(MessageHandler::myMessageOutput); int index = ui->slotListWidget->currentRow(); int itemcount = ui->slotListWidget->count(); - QListWidgetItem *item = ui->slotListWidget->takeItem(index); + delete item; item = nullptr; // Deleted last button. Replace with new blank button - if (index == (itemcount - 1)) - { - appendBlankKeyGrabber(); - } + if (index == (itemcount - 1)) appendBlankKeyGrabber(); changeTurboForSequences(); @@ -379,6 +378,7 @@ void AdvanceButtonDialog::appendBlankKeyGrabber() ui->slotTypeComboBox->setCurrentIndex(static_cast(KBMouseSlot)); } + void AdvanceButtonDialog::insertSlot() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -387,188 +387,148 @@ void AdvanceButtonDialog::insertSlot() int count = ui->slotListWidget->count(); int slotTypeIndex = ui->slotTypeComboBox->currentIndex(); - if (slotTypeIndex == static_cast(KBMouseSlot)) - { - if (current != (count - 1)) - { - SimpleKeyGrabberButton *blankButton = new SimpleKeyGrabberButton(this); - QListWidgetItem *item = new QListWidgetItem(); - ui->slotListWidget->insertItem(current, item); - item->setData(Qt::UserRole, - QVariant::fromValue(blankButton)); - - QHBoxLayout *layout= new QHBoxLayout(); - layout->addWidget(blankButton); - QWidget *widget = new QWidget(); - widget->setLayout(layout); - item->setSizeHint(widget->sizeHint()); - ui->slotListWidget->setItemWidget(item, widget); - ui->slotListWidget->setCurrentItem(item); - connectButtonEvents(blankButton); - blankButton->refreshButtonLabel(); - - QMetaObject::invokeMethod(&helper, "insertAssignedSlot", Qt::BlockingQueuedConnection, - Q_ARG(int, 0), Q_ARG(uint, 0), - Q_ARG(int, current)); - - updateSlotsScrollArea(0); - } - } - else if (slotTypeIndex == static_cast(CycleSlot)) + switch(slotTypeIndex) { + case 0: + + if (current != (count - 1)) + { + SimpleKeyGrabberButton *blankButton = new SimpleKeyGrabberButton(this); + QListWidgetItem *item = new QListWidgetItem(); + ui->slotListWidget->insertItem(current, item); + item->setData(Qt::UserRole, + QVariant::fromValue(blankButton)); + + QHBoxLayout *layout= new QHBoxLayout(); + layout->addWidget(blankButton); + QWidget *widget = new QWidget(); + widget->setLayout(layout); + item->setSizeHint(widget->sizeHint()); + ui->slotListWidget->setItemWidget(item, widget); + ui->slotListWidget->setCurrentItem(item); + connectButtonEvents(blankButton); + blankButton->refreshButtonLabel(); + + QMetaObject::invokeMethod(&helper, "insertAssignedSlot", Qt::BlockingQueuedConnection, + Q_ARG(int, 0), Q_ARG(uint, 0), + Q_ARG(int, current)); + + updateSlotsScrollArea(0); + } + + break; + + case 1: insertCycleSlot(); - } - else if (slotTypeIndex == static_cast(DelaySlot)) - { - insertDelaySlot(); - } - else if (slotTypeIndex == static_cast(DistanceSlot)) - { - insertDistanceSlot(); - } - else if (slotTypeIndex == static_cast(HoldSlot)) - { - insertHoldSlot(); - } - else if (slotTypeIndex == static_cast(LoadSlot)) - { - showSelectProfileWindow(); - } - else if (slotTypeIndex == static_cast(MouseModSlot)) - { - insertMouseSpeedModSlot(); - } - else if (slotTypeIndex == static_cast(PauseSlot)) - { - insertPauseSlot(); - } - else if (slotTypeIndex == static_cast(PressTimeSlot)) - { - insertKeyPressSlot(); - } - else if (slotTypeIndex == static_cast(ReleaseSlot)) - { - insertReleaseSlot(); - } - else if (slotTypeIndex == static_cast(SetChangeSlot)) - { - insertSetChangeSlot(); - } - else if (slotTypeIndex == static_cast(TextEntry)) - { - insertTextEntrySlot(); - } - else if (slotTypeIndex == static_cast(ExecuteSlot)) - { + break; + + case 2: + insertKindOfSlot(actionTimeConvert(), JoyButtonSlot::JoyDelay); + break; + + case 3: + insertKindOfSlot(ui->distanceSpinBox->value(), JoyButtonSlot::JoyDistance); + break; + + case 4: insertExecuteSlot(); - } -} + break; -void AdvanceButtonDialog::insertPauseSlot() -{ - qInstallMessageHandler(MessageHandler::myMessageOutput); + case 5: + insertKindOfSlot(actionTimeConvert(), JoyButtonSlot::JoyHold); + break; - int index = ui->slotListWidget->currentRow(); - SimpleKeyGrabberButton *tempbutton = ui->slotListWidget->currentItem() - ->data(Qt::UserRole).value(); - int actionTime = actionTimeConvert(); - if (actionTime >= 0) - { - tempbutton->setValue(actionTime, JoyButtonSlot::JoyPause); - QMetaObject::invokeMethod(&helper, "setAssignedSlot", Qt::BlockingQueuedConnection, - Q_ARG(int, actionTime), - Q_ARG(int, 0), - Q_ARG(int, index), - Q_ARG(JoyButtonSlot::JoySlotInputAction, JoyButtonSlot::JoyPause)); + case 6: + showSelectProfileWindow(); + break; - updateSlotsScrollArea(actionTime); - } -} + case 7: + insertKindOfSlot(ui->mouseSpeedModSpinBox->value(), JoyButtonSlot::JoyMouseSpeedMod); + break; -void AdvanceButtonDialog::insertReleaseSlot() -{ - qInstallMessageHandler(MessageHandler::myMessageOutput); + case 8: + insertKindOfSlot(actionTimeConvert(), JoyButtonSlot::JoyPause); + break; - int index = ui->slotListWidget->currentRow(); - SimpleKeyGrabberButton *tempbutton = ui->slotListWidget->currentItem() - ->data(Qt::UserRole).value(); - int actionTime = actionTimeConvert(); - if (actionTime >= 0) - { - tempbutton->setValue(actionTime, JoyButtonSlot::JoyRelease); + case 9: + insertKindOfSlot(actionTimeConvert(), JoyButtonSlot::JoyKeyPress); + break; - QMetaObject::invokeMethod(&helper, "setAssignedSlot", Qt::BlockingQueuedConnection, - Q_ARG(int, actionTime), - Q_ARG(int, 0), - Q_ARG(int, index), - Q_ARG(JoyButtonSlot::JoySlotInputAction, JoyButtonSlot::JoyRelease)); + case 10: + insertKindOfSlot(actionTimeConvert(), JoyButtonSlot::JoyRelease); + break; + + case 11: + insertKindOfSlot(ui->slotSetChangeComboBox->itemData(ui->slotSetChangeComboBox->currentIndex()).toInt(), JoyButtonSlot::JoySetChange); + break; + + case 12: + insertTextEntrySlot(); + break; - updateSlotsScrollArea(actionTime); } } -void AdvanceButtonDialog::insertHoldSlot() -{ - qInstallMessageHandler(MessageHandler::myMessageOutput); +void AdvanceButtonDialog::insertKindOfSlot(int slotProperty, JoyButtonSlot::JoySlotInputAction inputAction) +{ + int actionTime = slotProperty; int index = ui->slotListWidget->currentRow(); SimpleKeyGrabberButton *tempbutton = ui->slotListWidget->currentItem() ->data(Qt::UserRole).value(); - int actionTime = actionTimeConvert(); - if (actionTime > 0) - { - tempbutton->setValue(actionTime, JoyButtonSlot::JoyHold); - QMetaObject::invokeMethod(&helper, "setAssignedSlot", Qt::BlockingQueuedConnection, - Q_ARG(int, actionTime), - Q_ARG(int, 0), - Q_ARG(int, index), - Q_ARG(JoyButtonSlot::JoySlotInputAction, JoyButtonSlot::JoyHold)); + int tempDistance = 0; + bool slotPropertyAboveLimit = actionTime >= 0; - updateSlotsScrollArea(actionTime); - } -} + if (inputAction == JoyButtonSlot::JoyDistance) { + for (int i = 0; i < ui->slotListWidget->count(); i++) + { + SimpleKeyGrabberButton *button = ui->slotListWidget->item(i) + ->data(Qt::UserRole).value(); + JoyButtonSlot *tempbuttonslot = button->getValue(); -void AdvanceButtonDialog::insertSetChangeSlot() -{ - qInstallMessageHandler(MessageHandler::myMessageOutput); + if (tempbuttonslot->getSlotMode() == JoyButtonSlot::JoyDistance) + { + tempDistance += tempbuttonslot->getSlotCode(); + } + else if (tempbuttonslot->getSlotMode() == JoyButtonSlot::JoyCycle) + { + tempDistance = 0; + } + } - int index = ui->slotListWidget->currentRow(); - SimpleKeyGrabberButton *tempbutton = ui->slotListWidget->currentItem() - ->data(Qt::UserRole).value(); + tempDistance += actionTime; + slotPropertyAboveLimit = tempDistance <= 100; + } - int currentIndex = ui->slotSetChangeComboBox->currentIndex(); - int setIndex = ui->slotSetChangeComboBox->itemData(currentIndex).toInt(); - if (setIndex >= 0) + if (slotPropertyAboveLimit) { - tempbutton->setValue(setIndex, JoyButtonSlot::JoySetChange); + tempbutton->setValue(actionTime, inputAction); QMetaObject::invokeMethod(&helper, "setAssignedSlot", Qt::BlockingQueuedConnection, - Q_ARG(int, setIndex), + Q_ARG(int, actionTime), Q_ARG(int, 0), Q_ARG(int, index), - Q_ARG(JoyButtonSlot::JoySlotInputAction, JoyButtonSlot::JoySetChange)); + Q_ARG(JoyButtonSlot::JoySlotInputAction, inputAction)); - updateSlotsScrollArea(setIndex); + updateSlotsScrollArea(actionTime); } } + int AdvanceButtonDialog::actionTimeConvert() { qInstallMessageHandler(MessageHandler::myMessageOutput); - int minutesIndex = ui->actionMinutesComboBox->currentIndex(); - int secondsIndex = ui->actionSecondsComboBox->currentIndex(); - int hundredthsIndex = ui->actionHundredthsComboBox->currentIndex(); - int tenthsIndex = ui->actionTenthsComboBox->currentIndex(); + int tempMilliSeconds = ui->actionMinutesComboBox->currentIndex() * 1000 * 60; + tempMilliSeconds += ui->actionSecondsComboBox->currentIndex() * 1000; + tempMilliSeconds += ui->actionTenthsComboBox->currentIndex() * 100; + tempMilliSeconds += ui->actionHundredthsComboBox->currentIndex() * 10; - int tempMilliSeconds = minutesIndex * 1000 * 60; - tempMilliSeconds += secondsIndex * 1000; - tempMilliSeconds += tenthsIndex * 100; - tempMilliSeconds += hundredthsIndex * 10; return tempMilliSeconds; } + void AdvanceButtonDialog::refreshTimeComboBoxes(JoyButtonSlot *slot) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -576,20 +536,17 @@ void AdvanceButtonDialog::refreshTimeComboBoxes(JoyButtonSlot *slot) disconnectTimeBoxesEvents(); int slottime = slot->getSlotCode(); - int tempMinutes = slottime / 1000 / 60; - int tempSeconds = slottime / 1000 % 60; - int tempTenthsSeconds = (slottime % 1000) / 100; - int tempHundredthsSeconds = (slottime % 1000 % 100) / 10; - - ui->actionMinutesComboBox->setCurrentIndex(tempMinutes); - ui->actionSecondsComboBox->setCurrentIndex(tempSeconds); - ui->actionTenthsComboBox->setCurrentIndex(tempTenthsSeconds); - ui->actionHundredthsComboBox->setCurrentIndex(tempHundredthsSeconds); + + ui->actionMinutesComboBox->setCurrentIndex(slottime / 1000 / 60); + ui->actionSecondsComboBox->setCurrentIndex(slottime / 1000 % 60); + ui->actionTenthsComboBox->setCurrentIndex((slottime % 1000) / 100); + ui->actionHundredthsComboBox->setCurrentIndex((slottime % 1000 % 100) / 10); updateActionTimeLabel(); connectTimeBoxesEvents(); } + void AdvanceButtonDialog::updateActionTimeLabel() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -598,12 +555,14 @@ void AdvanceButtonDialog::updateActionTimeLabel() int minutes = actionTime / 1000 / 60; double hundredths = actionTime % 1000 / 1000.0; double seconds = (actionTime / 1000 % 60) + hundredths; - QString temp = QString(); - temp.append(QString::number(minutes)).append("m "); - temp.append(QString::number(seconds, 'f', 2)).append("s"); - ui->actionTimeLabel->setText(temp); + QString actionTimeLabel = QString(); + + actionTimeLabel.append(QString::number(minutes)).append("m "); + actionTimeLabel.append(QString::number(seconds, 'f', 2)).append("s"); + ui->actionTimeLabel->setText(actionTimeLabel); } + void AdvanceButtonDialog::clearAllSlots() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -612,22 +571,25 @@ void AdvanceButtonDialog::clearAllSlots() appendBlankKeyGrabber(); changeTurboForSequences(); - QMetaObject::invokeMethod(button, "clearSlotsEventReset", Qt::BlockingQueuedConnection); + QMetaObject::invokeMethod(m_button, "clearSlotsEventReset", Qt::BlockingQueuedConnection); performStatsWidgetRefresh(ui->slotListWidget->currentItem()); emit slotsChanged(); } + void AdvanceButtonDialog::changeTurboForSequences() { qInstallMessageHandler(MessageHandler::myMessageOutput); bool containsSequences = false; + for (int i = 0; (i < ui->slotListWidget->count()) && !containsSequences; i++) { SimpleKeyGrabberButton *button = ui->slotListWidget->item(i) ->data(Qt::UserRole).value(); JoyButtonSlot *tempbuttonslot = button->getValue(); + if ((tempbuttonslot->getSlotCode() > 0) && ((tempbuttonslot->getSlotMode() == JoyButtonSlot::JoyPause) || (tempbuttonslot->getSlotMode() == JoyButtonSlot::JoyHold) || @@ -644,7 +606,7 @@ void AdvanceButtonDialog::changeTurboForSequences() if (ui->turboCheckbox->isChecked()) { ui->turboCheckbox->setChecked(false); - this->button->setUseTurbo(false); + m_button->setUseTurbo(false); emit turboChanged(false); } @@ -654,13 +616,10 @@ void AdvanceButtonDialog::changeTurboForSequences() emit turboButtonEnabledChange(false); } } - else + else if (!ui->turboCheckbox->isEnabled()) { - if (!ui->turboCheckbox->isEnabled()) - { - ui->turboCheckbox->setEnabled(true); - emit turboButtonEnabledChange(true); - } + ui->turboCheckbox->setEnabled(true); + emit turboButtonEnabledChange(true); } } @@ -682,44 +641,6 @@ void AdvanceButtonDialog::insertCycleSlot() updateSlotsScrollArea(1); } -void AdvanceButtonDialog::insertDistanceSlot() -{ - - qInstallMessageHandler(MessageHandler::myMessageOutput); - int index = ui->slotListWidget->currentRow(); - SimpleKeyGrabberButton *tempbutton = ui->slotListWidget->currentItem() - ->data(Qt::UserRole).value(); - - int tempDistance = 0; - for (int i = 0; i < ui->slotListWidget->count(); i++) - { - SimpleKeyGrabberButton *button = ui->slotListWidget->item(i) - ->data(Qt::UserRole).value(); - JoyButtonSlot *tempbuttonslot = button->getValue(); - if (tempbuttonslot->getSlotMode() == JoyButtonSlot::JoyDistance) - { - tempDistance += tempbuttonslot->getSlotCode(); - } - else if (tempbuttonslot->getSlotMode() == JoyButtonSlot::JoyCycle) - { - tempDistance = 0; - } - } - - int testDistance = ui->distanceSpinBox->value(); - if ((testDistance + tempDistance) <= 100) - { - tempbutton->setValue(testDistance, JoyButtonSlot::JoyDistance); - - QMetaObject::invokeMethod(&helper, "setAssignedSlot", Qt::BlockingQueuedConnection, - Q_ARG(int, testDistance), - Q_ARG(int, 0), - Q_ARG(int, index), - Q_ARG(JoyButtonSlot::JoySlotInputAction, JoyButtonSlot::JoyDistance)); - - updateSlotsScrollArea(testDistance); - } -} void AdvanceButtonDialog::placeNewSlot(JoyButtonSlot *slot) { @@ -741,16 +662,18 @@ void AdvanceButtonDialog::placeNewSlot(JoyButtonSlot *slot) slot->deleteLater(); } + void AdvanceButtonDialog::updateTurboIntervalValue(int value) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (value >= MINIMUMTURBO) + if (value >= GlobalVariables::AdvanceButtonDialog::MINIMUMTURBO) { - button->setTurboInterval(value * 10); + m_button->setTurboInterval(value * 10); } } + void AdvanceButtonDialog::checkTurboSetting(bool state) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -758,19 +681,19 @@ void AdvanceButtonDialog::checkTurboSetting(bool state) ui->turboCheckbox->setChecked(state); ui->turboSlider->setEnabled(state); - if (this->button->isPartRealAxis()) - { + if (m_button->isPartRealAxis()) ui->turboModeComboBox->setEnabled(state); - } changeTurboForSequences(); - button->setUseTurbo(state); - if ((button->getTurboInterval() / 10) >= MINIMUMTURBO) + m_button->setUseTurbo(state); + + if ((m_button->getTurboInterval() / 10) >= GlobalVariables::AdvanceButtonDialog::MINIMUMTURBO) { - ui->turboSlider->setValue(button->getTurboInterval() / 10); + ui->turboSlider->setValue(m_button->getTurboInterval() / 10); } } + void AdvanceButtonDialog::updateSetSelection() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -782,17 +705,14 @@ void AdvanceButtonDialog::updateSetSelection() if (ui->setSelectionComboBox->currentIndex() > 0) { - int condition_choice = 0; - condition_choice = (ui->setSelectionComboBox->currentIndex() + 2) % 3; + int condition_choice = (ui->setSelectionComboBox->currentIndex() + 2) % 3; chosen_set = (ui->setSelectionComboBox->currentIndex() - 1) / 3; - // Above removed rows - if (button->getOriginSet() > chosen_set) + if (m_button->getOriginSet() > chosen_set) // Above removed rows { chosen_set = (ui->setSelectionComboBox->currentIndex() - 1) / 3; } - // Below removed rows - else + else // Below removed rows { chosen_set = (ui->setSelectionComboBox->currentIndex() + 2) / 3; } @@ -801,17 +721,19 @@ void AdvanceButtonDialog::updateSetSelection() qDebug() << "CONDITION: " << QString::number(condition_choice) << endl; #endif - if (condition_choice == 0) - { - set_selection_condition = JoyButton::SetChangeOneWay; - } - else if (condition_choice == 1) - { - set_selection_condition = JoyButton::SetChangeTwoWay; - } - else if (condition_choice == 2) + switch(condition_choice) { - set_selection_condition = JoyButton::SetChangeWhileHeld; + case 0: + set_selection_condition = JoyButton::SetChangeOneWay; + break; + + case 1: + set_selection_condition = JoyButton::SetChangeTwoWay; + break; + + case 2: + set_selection_condition = JoyButton::SetChangeWhileHeld; + break; } #ifndef QT_DEBUG_NO_OUTPUT @@ -828,34 +750,35 @@ void AdvanceButtonDialog::updateSetSelection() { // First, remove old condition for the button in both sets. // After that, make the new assignment. - button->setChangeSetCondition(JoyButton::SetChangeDisabled); - - button->setChangeSetSelection(chosen_set); - button->setChangeSetCondition(set_selection_condition); + m_button->setChangeSetCondition(JoyButton::SetChangeDisabled); + m_button->setChangeSetSelection(chosen_set); + m_button->setChangeSetCondition(set_selection_condition); } else { - button->setChangeSetCondition(JoyButton::SetChangeDisabled); + m_button->setChangeSetCondition(JoyButton::SetChangeDisabled); } PadderCommon::inputDaemonMutex.unlock(); } + void AdvanceButtonDialog::checkTurboIntervalValue(int value) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (value >= MINIMUMTURBO) + if (value >= GlobalVariables::AdvanceButtonDialog::MINIMUMTURBO) { changeTurboText(value); updateTurboIntervalValue(value); } else { - ui->turboSlider->setValue(MINIMUMTURBO); + ui->turboSlider->setValue(GlobalVariables::AdvanceButtonDialog::MINIMUMTURBO); } } + void AdvanceButtonDialog::fillTimeComboBoxes() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -865,214 +788,154 @@ void AdvanceButtonDialog::fillTimeComboBoxes() ui->actionHundredthsComboBox->clear(); ui->actionTenthsComboBox->clear(); - for (double i=0; i <= 10; i++) + for (int i = 0; i <= 10; i++) { - QString temp = QString::number(i, 'g', 2).append("m"); - ui->actionMinutesComboBox->addItem(temp); + QString minText = QString::number(i, 'g', 2).append("m"); + ui->actionMinutesComboBox->addItem(minText); } - for (double i=0; i <= 59; i++) + for (int i = 0; i <= 59; i++) { - QString temp = QString::number(i, 'g', 2); - ui->actionSecondsComboBox->addItem(temp); + QString secsText = QString::number(i, 'g', 2); + ui->actionSecondsComboBox->addItem(secsText); } - for (int i=0; i < 10; i++) + for (int i = 0; i < 10; i++) { - QString temp = QString(".%1").arg(i, 1, 10, QChar('0')); - ui->actionTenthsComboBox->addItem(temp); + QString tenthsText = QString(".%1").arg(i, 1, 10, QChar('0')); + ui->actionTenthsComboBox->addItem(tenthsText); } - for (int i=0; i < 10; i++) + for (int i = 0; i < 10; i++) { - QString temp = QString("%1s").arg(i, 1, 10, QChar('0')); - ui->actionHundredthsComboBox->addItem(temp); + QString hundrText = QString("%1s").arg(i, 1, 10, QChar('0')); + ui->actionHundredthsComboBox->addItem(hundrText); } } -void AdvanceButtonDialog::insertMouseSpeedModSlot() -{ - qInstallMessageHandler(MessageHandler::myMessageOutput); - - int index = ui->slotListWidget->currentRow(); - SimpleKeyGrabberButton *tempbutton = ui->slotListWidget->currentItem() - ->data(Qt::UserRole).value(); - int tempMouseMod = ui->mouseSpeedModSpinBox->value(); - if (tempMouseMod > 0) - { - tempbutton->setValue(tempMouseMod, JoyButtonSlot::JoyMouseSpeedMod); - - QMetaObject::invokeMethod(&helper, "setAssignedSlot", Qt::BlockingQueuedConnection, - Q_ARG(int, tempMouseMod), - Q_ARG(int, 0), - Q_ARG(int, index), - Q_ARG(JoyButtonSlot::JoySlotInputAction, JoyButtonSlot::JoyMouseSpeedMod)); - - updateSlotsScrollArea(tempMouseMod); - } -} - -void AdvanceButtonDialog::insertKeyPressSlot() -{ - qInstallMessageHandler(MessageHandler::myMessageOutput); - - int index = ui->slotListWidget->currentRow(); - SimpleKeyGrabberButton *tempbutton = ui->slotListWidget->currentItem() - ->data(Qt::UserRole).value(); - int actionTime = actionTimeConvert(); - if (actionTime > 0) - { - tempbutton->setValue(actionTime, JoyButtonSlot::JoyKeyPress); - - QMetaObject::invokeMethod(&helper, "setAssignedSlot", Qt::BlockingQueuedConnection, - Q_ARG(int, actionTime), - Q_ARG(int, 0), - Q_ARG(int, index), - Q_ARG(JoyButtonSlot::JoySlotInputAction, JoyButtonSlot::JoyKeyPress)); - - updateSlotsScrollArea(actionTime); - } -} - -void AdvanceButtonDialog::insertDelaySlot() -{ - qInstallMessageHandler(MessageHandler::myMessageOutput); - - int index = ui->slotListWidget->currentRow(); - SimpleKeyGrabberButton *tempbutton = ui->slotListWidget->currentItem() - ->data(Qt::UserRole).value(); - int actionTime = actionTimeConvert(); - if (actionTime > 0) - { - tempbutton->setValue(actionTime, JoyButtonSlot::JoyDelay); - - QMetaObject::invokeMethod(&helper, "setAssignedSlot", Qt::BlockingQueuedConnection, - Q_ARG(int, actionTime), - Q_ARG(int, 0), - Q_ARG(int, index), - Q_ARG(JoyButtonSlot::JoySlotInputAction, JoyButtonSlot::JoyDelay)); - - updateSlotsScrollArea(actionTime); - } -} void AdvanceButtonDialog::insertTextEntrySlot() { qInstallMessageHandler(MessageHandler::myMessageOutput); + QString entryText = ui->textEntryLineEdit->text(); int index = ui->slotListWidget->currentRow(); - SimpleKeyGrabberButton *tempbutton = ui->slotListWidget->currentItem() + SimpleKeyGrabberButton *textEntryButton = ui->slotListWidget->currentItem() ->data(Qt::UserRole).value(); - QString temp = ui->textEntryLineEdit->text(); - if (!temp.isEmpty()) + + if (!entryText.isEmpty()) { - tempbutton->setValue(temp, JoyButtonSlot::JoyTextEntry); + textEntryButton->setValue(entryText, JoyButtonSlot::JoyTextEntry); QMetaObject::invokeMethod(&helper, "setAssignedSlot", Qt::BlockingQueuedConnection, - Q_ARG(JoyButtonSlot*, tempbutton->getValue()), + Q_ARG(JoyButtonSlot*, textEntryButton->getValue()), Q_ARG(int, index)); - tempbutton->setToolTip(temp); + + textEntryButton->setToolTip(entryText); updateSlotsScrollArea(0); } } + void AdvanceButtonDialog::insertExecuteSlot() { qInstallMessageHandler(MessageHandler::myMessageOutput); + QString execSlotName = ui->execLineEdit->text(); + QString argsExecSlot = ui->execArgumentsLineEdit->text(); + QFileInfo execSlotNameInfo(execSlotName); int index = ui->slotListWidget->currentRow(); - SimpleKeyGrabberButton *tempbutton = ui->slotListWidget->currentItem() + SimpleKeyGrabberButton *execbutton = ui->slotListWidget->currentItem() ->data(Qt::UserRole).value(); - QString temp = ui->execLineEdit->text(); - QString argumentsTemp = ui->execArgumentsLineEdit->text(); - if (!temp.isEmpty()) + + if (!execSlotName.isEmpty() && execSlotNameInfo.exists() && execSlotNameInfo.isExecutable()) { - QFileInfo tempFileInfo(temp); - if (tempFileInfo.exists() && tempFileInfo.isExecutable()) - { - tempbutton->setValue(temp, JoyButtonSlot::JoyExecute); - if (!argumentsTemp.isEmpty()) - { - tempbutton->getValue()->setExtraData(QVariant(argumentsTemp)); - } + execbutton->setValue(execSlotName, JoyButtonSlot::JoyExecute); - QMetaObject::invokeMethod(&helper, "setAssignedSlot", Qt::BlockingQueuedConnection, - Q_ARG(JoyButtonSlot*, tempbutton->getValue()), + if (!argsExecSlot.isEmpty()) + execbutton->getValue()->setExtraData(QVariant(argsExecSlot)); + + QMetaObject::invokeMethod(&helper, "setAssignedSlot", Qt::BlockingQueuedConnection, + Q_ARG(JoyButtonSlot*, execbutton->getValue()), Q_ARG(int, index)); - tempbutton->setToolTip(temp); - updateSlotsScrollArea(0); - } + execbutton->setToolTip(execSlotName); + updateSlotsScrollArea(0); } } + void AdvanceButtonDialog::performStatsWidgetRefresh(QListWidgetItem *item) { qInstallMessageHandler(MessageHandler::myMessageOutput); - SimpleKeyGrabberButton *tempbutton = item->data(Qt::UserRole).value(); - JoyButtonSlot *slot = tempbutton->getValue(); + SimpleKeyGrabberButton *button = item->data(Qt::UserRole).value(); + JoyButtonSlot *slot = button->getValue(); if ((slot->getSlotMode() == JoyButtonSlot::JoyKeyboard) && (slot->getSlotCode() != 0)) { - ui->slotTypeComboBox->setCurrentIndex(static_cast(KBMouseSlot)); + ui->slotTypeComboBox->setCurrentIndex(0); } else if ((slot->getSlotMode() == JoyButtonSlot::JoyMouseButton) || (slot->getSlotMode() == JoyButtonSlot::JoyMouseMovement)) { - ui->slotTypeComboBox->setCurrentIndex(static_cast(KBMouseSlot)); + ui->slotTypeComboBox->setCurrentIndex(0); } else if (slot->getSlotMode() == JoyButtonSlot::JoyCycle) { - ui->slotTypeComboBox->setCurrentIndex(static_cast(CycleSlot)); + ui->slotTypeComboBox->setCurrentIndex(1); } else if (slot->getSlotMode() == JoyButtonSlot::JoyDelay) { - ui->slotTypeComboBox->setCurrentIndex(static_cast(DelaySlot)); + ui->slotTypeComboBox->setCurrentIndex(2); refreshTimeComboBoxes(slot); } else if (slot->getSlotMode() == JoyButtonSlot::JoyDistance) { - ui->slotTypeComboBox->setCurrentIndex(static_cast(DistanceSlot)); + ui->slotTypeComboBox->setCurrentIndex(3); disconnect(ui->distanceSpinBox, static_cast(&QSpinBox::valueChanged), this, &AdvanceButtonDialog::checkSlotDistanceUpdate); + ui->distanceSpinBox->setValue(slot->getSlotCode()); + connect(ui->distanceSpinBox, static_cast(&QSpinBox::valueChanged), this, &AdvanceButtonDialog::checkSlotDistanceUpdate); } else if (slot->getSlotMode() == JoyButtonSlot::JoyHold) { - ui->slotTypeComboBox->setCurrentIndex(static_cast(HoldSlot)); + ui->slotTypeComboBox->setCurrentIndex(5); refreshTimeComboBoxes(slot); } else if (slot->getSlotMode() == JoyButtonSlot::JoyLoadProfile) { - ui->slotTypeComboBox->setCurrentIndex(static_cast(LoadSlot)); + ui->slotTypeComboBox->setCurrentIndex(6); } else if (slot->getSlotMode() == JoyButtonSlot::JoyMouseSpeedMod) { - ui->slotTypeComboBox->setCurrentIndex(static_cast(MouseModSlot)); + ui->slotTypeComboBox->setCurrentIndex(7); disconnect(ui->mouseSpeedModSpinBox, static_cast(&QSpinBox::valueChanged), this, &AdvanceButtonDialog::checkSlotMouseModUpdate); + ui->mouseSpeedModSpinBox->setValue(slot->getSlotCode()); + connect(ui->mouseSpeedModSpinBox, static_cast(&QSpinBox::valueChanged), this, &AdvanceButtonDialog::checkSlotMouseModUpdate); } else if (slot->getSlotMode() == JoyButtonSlot::JoyPause) { - ui->slotTypeComboBox->setCurrentIndex(static_cast(PauseSlot)); + ui->slotTypeComboBox->setCurrentIndex(8); refreshTimeComboBoxes(slot); } else if (slot->getSlotMode() == JoyButtonSlot::JoyKeyPress) { - ui->slotTypeComboBox->setCurrentIndex(static_cast(PressTimeSlot)); + ui->slotTypeComboBox->setCurrentIndex(9); refreshTimeComboBoxes(slot); } else if (slot->getSlotMode() == JoyButtonSlot::JoyRelease) { - ui->slotTypeComboBox->setCurrentIndex(static_cast(ReleaseSlot)); + ui->slotTypeComboBox->setCurrentIndex(10); refreshTimeComboBoxes(slot); } else if (slot->getSlotMode() == JoyButtonSlot::JoySetChange) @@ -1080,72 +943,72 @@ void AdvanceButtonDialog::performStatsWidgetRefresh(QListWidgetItem *item) disconnect(ui->slotSetChangeComboBox, static_cast(&QComboBox::currentIndexChanged), this, &AdvanceButtonDialog::checkSlotSetChangeUpdate); - ui->slotTypeComboBox->setCurrentIndex(static_cast(SetChangeSlot)); + ui->slotTypeComboBox->setCurrentIndex(11); int chooseIndex = slot->getSlotCode(); - int foundIndex = ui->slotSetChangeComboBox->findData(QVariant(chooseIndex)); + if (foundIndex >= 0) - { ui->slotSetChangeComboBox->setCurrentIndex(foundIndex); - } connect(ui->slotSetChangeComboBox, static_cast(&QComboBox::currentIndexChanged), this, &AdvanceButtonDialog::checkSlotSetChangeUpdate); } else if (slot->getSlotMode() == JoyButtonSlot::JoyTextEntry) { - ui->slotTypeComboBox->setCurrentIndex(static_cast(TextEntry)); + ui->slotTypeComboBox->setCurrentIndex(12); ui->textEntryLineEdit->setText(slot->getTextData()); } else if (slot->getSlotMode() == JoyButtonSlot::JoyExecute) { - ui->slotTypeComboBox->setCurrentIndex(static_cast(ExecuteSlot)); + ui->slotTypeComboBox->setCurrentIndex(4); ui->execLineEdit->setText(slot->getTextData()); ui->execArgumentsLineEdit->setText(slot->getExtraData().toString()); } } + void AdvanceButtonDialog::checkSlotTimeUpdate() { qInstallMessageHandler(MessageHandler::myMessageOutput); + int actionTime = actionTimeConvert(); int index = ui->slotListWidget->currentRow(); - SimpleKeyGrabberButton *tempbutton = ui->slotListWidget->currentItem() + SimpleKeyGrabberButton *button = ui->slotListWidget->currentItem() ->data(Qt::UserRole).value(); - JoyButtonSlot *tempbuttonslot = tempbutton->getValue(); - if ((tempbuttonslot->getSlotMode() == JoyButtonSlot::JoyPause) || - (tempbuttonslot->getSlotMode() == JoyButtonSlot::JoyHold) || - (tempbuttonslot->getSlotMode() == JoyButtonSlot::JoyRelease) || - (tempbuttonslot->getSlotMode() == JoyButtonSlot::JoyKeyPress) || - (tempbuttonslot->getSlotMode() == JoyButtonSlot::JoyDelay)) + JoyButtonSlot *buttonSlot = button->getValue(); + + if ((buttonSlot->getSlotMode() == JoyButtonSlot::JoyPause) || + (buttonSlot->getSlotMode() == JoyButtonSlot::JoyHold) || + (buttonSlot->getSlotMode() == JoyButtonSlot::JoyRelease) || + (buttonSlot->getSlotMode() == JoyButtonSlot::JoyKeyPress) || + (buttonSlot->getSlotMode() == JoyButtonSlot::JoyDelay)) { - int actionTime = actionTimeConvert(); if (actionTime > 0) { - tempbutton->setValue(actionTime, tempbuttonslot->getSlotMode()); + button->setValue(actionTime, buttonSlot->getSlotMode()); QMetaObject::invokeMethod(&helper, "setAssignedSlot", Qt::BlockingQueuedConnection, Q_ARG(int, actionTime), Q_ARG(int, 0), Q_ARG(int, index), - Q_ARG(JoyButtonSlot::JoySlotInputAction, tempbuttonslot->getSlotMode())); + Q_ARG(JoyButtonSlot::JoySlotInputAction, buttonSlot->getSlotMode())); updateSlotsScrollArea(actionTime); } } - } + void AdvanceButtonDialog::checkSlotMouseModUpdate() { qInstallMessageHandler(MessageHandler::myMessageOutput); + int tempMouseMod = ui->mouseSpeedModSpinBox->value(); int index = ui->slotListWidget->currentRow(); SimpleKeyGrabberButton *tempbutton = ui->slotListWidget->currentItem() ->data(Qt::UserRole).value(); JoyButtonSlot *tempbuttonslot = tempbutton->getValue(); - int tempMouseMod = ui->mouseSpeedModSpinBox->value(); if ((tempbuttonslot->getSlotMode() == JoyButtonSlot::JoyMouseSpeedMod) && (tempMouseMod > 0)) { @@ -1161,6 +1024,7 @@ void AdvanceButtonDialog::checkSlotMouseModUpdate() } } + void AdvanceButtonDialog::checkSlotSetChangeUpdate() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -1169,26 +1033,24 @@ void AdvanceButtonDialog::checkSlotSetChangeUpdate() SimpleKeyGrabberButton *tempbutton = ui->slotListWidget->currentItem() ->data(Qt::UserRole).value(); JoyButtonSlot *buttonslot = tempbutton->getValue(); - if (buttonslot->getSlotMode() == JoyButtonSlot::JoySetChange) - { - int comboIndex = ui->slotSetChangeComboBox->currentIndex(); - int setIndex = ui->slotSetChangeComboBox->itemData(comboIndex).toInt(); - if (setIndex >= 0) - { - tempbutton->setValue(setIndex, buttonslot->getSlotMode()); + if (buttonslot->getSlotMode() == JoyButtonSlot::JoySetChange && (ui->slotSetChangeComboBox->itemData(ui->slotSetChangeComboBox->currentIndex()).toInt() >= 0)) + { + int comboIndex = ui->slotSetChangeComboBox->currentIndex(); + int setIndex = ui->slotSetChangeComboBox->itemData(comboIndex).toInt(); + tempbutton->setValue(setIndex, buttonslot->getSlotMode()); - QMetaObject::invokeMethod(&helper, "setAssignedSlot", Qt::BlockingQueuedConnection, + QMetaObject::invokeMethod(&helper, "setAssignedSlot", Qt::BlockingQueuedConnection, Q_ARG(int, setIndex), Q_ARG(int, 0), Q_ARG(int, index), Q_ARG(JoyButtonSlot::JoySlotInputAction, buttonslot->getSlotMode())); - updateSlotsScrollArea(setIndex); - } + updateSlotsScrollArea(setIndex); } } + void AdvanceButtonDialog::checkSlotDistanceUpdate() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -1207,6 +1069,7 @@ void AdvanceButtonDialog::checkSlotDistanceUpdate() SimpleKeyGrabberButton *button = ui->slotListWidget->item(i) ->data(Qt::UserRole).value(); JoyButtonSlot *tempbuttonslot = button->getValue(); + if (tempbuttonslot->getSlotMode() == JoyButtonSlot::JoyDistance) { tempDistance += tempbuttonslot->getSlotCode(); @@ -1219,6 +1082,7 @@ void AdvanceButtonDialog::checkSlotDistanceUpdate() int testDistance = ui->distanceSpinBox->value(); tempDistance += testDistance - buttonslot->getSlotCode(); + if (tempDistance <= 100) { tempbutton->setValue(testDistance, buttonslot->getSlotMode()); @@ -1234,68 +1098,65 @@ void AdvanceButtonDialog::checkSlotDistanceUpdate() } } + void AdvanceButtonDialog::updateWindowTitleButtonName() { qInstallMessageHandler(MessageHandler::myMessageOutput); - QString temp = QString(); - temp.append(trUtf8("Advanced").append(": ")).append(button->getPartialName(false, true)); + QString windTitleBtnName = QString().append(trUtf8("Advanced").append(": ")).append(m_button->getPartialName(false, true)); - if (button->getParentSet()->getIndex() != 0) + if (m_button->getParentSet()->getIndex() != 0) { - int setIndex = button->getParentSet()->getRealIndex(); - temp.append(" [").append(trUtf8("Set %1").arg(setIndex)); + int setIndex = m_button->getParentSet()->getRealIndex(); + windTitleBtnName.append(" [").append(trUtf8("Set %1").arg(setIndex)); + QString setName = m_button->getParentSet()->getName(); - QString setName = button->getParentSet()->getName(); if (!setName.isEmpty()) - { - temp.append(": ").append(setName); - } + windTitleBtnName.append(": ").append(setName); - temp.append("]"); + windTitleBtnName.append("]"); } - setWindowTitle(temp); + setWindowTitle(windTitleBtnName); } + void AdvanceButtonDialog::checkCycleResetWidgetStatus(bool enabled) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (enabled) - { - ui->resetCycleDoubleSpinBox->setEnabled(true); - } - else - { - ui->resetCycleDoubleSpinBox->setEnabled(false); - } + if (enabled) ui->resetCycleDoubleSpinBox->setEnabled(true); + else ui->resetCycleDoubleSpinBox->setEnabled(false); } + void AdvanceButtonDialog::setButtonCycleResetInterval(double value) { qInstallMessageHandler(MessageHandler::myMessageOutput); - int milliseconds = (static_cast(value) * 1000) + static_cast(fmod(value, 1.0) * 1000); - button->setCycleResetTime(milliseconds); + int milliseconds = (value * 1000) + (fmod(value, 1.0) * 1000); + m_button->setCycleResetTime(milliseconds); } + void AdvanceButtonDialog::populateAutoResetInterval() { qInstallMessageHandler(MessageHandler::myMessageOutput); - double seconds = button->getCycleResetTime() / 1000.0; + double seconds = m_button->getCycleResetTime() / 1000.0; ui->resetCycleDoubleSpinBox->setValue(seconds); } + void AdvanceButtonDialog::setButtonCycleReset(bool enabled) { qInstallMessageHandler(MessageHandler::myMessageOutput); if (enabled) { - button->setCycleResetStatus(true); - if ((button->getCycleResetTime() == 0) && (ui->resetCycleDoubleSpinBox->value() > 0.0)) + m_button->setCycleResetStatus(true); + + if ((m_button->getCycleResetTime() == 0) && (ui->resetCycleDoubleSpinBox->value() > 0.0)) { double current = ui->resetCycleDoubleSpinBox->value(); setButtonCycleResetInterval(current); @@ -1303,10 +1164,11 @@ void AdvanceButtonDialog::setButtonCycleReset(bool enabled) } else { - button->setCycleResetStatus(false); + m_button->setCycleResetStatus(false); } } + void AdvanceButtonDialog::resetTimeBoxes() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -1322,6 +1184,7 @@ void AdvanceButtonDialog::resetTimeBoxes() connectTimeBoxesEvents(); } + void AdvanceButtonDialog::disconnectTimeBoxesEvents() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -1345,6 +1208,7 @@ void AdvanceButtonDialog::disconnectTimeBoxesEvents() this, &AdvanceButtonDialog::checkSlotTimeUpdate); } + void AdvanceButtonDialog::connectTimeBoxesEvents() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -1368,41 +1232,34 @@ void AdvanceButtonDialog::connectTimeBoxesEvents() this, &AdvanceButtonDialog::checkSlotTimeUpdate); } + void AdvanceButtonDialog::populateSetSelectionComboBox() { qInstallMessageHandler(MessageHandler::myMessageOutput); ui->setSelectionComboBox->clear(); ui->setSelectionComboBox->insertItem(0, trUtf8("Disabled")); - int currentIndex = 1; - for (int i = 0; i < InputDevice::NUMBER_JOYSETS; i++) + + QHash::iterator set; + int originset = 0; + + for (set = m_button->getParentSet()->getInputDevice()->getJoystick_sets().begin(); set != m_button->getParentSet()->getInputDevice()->getJoystick_sets().end(); ++set) { - if (this->button->getOriginSet() != i) + if (m_button->getOriginSet() != originset) { - QString temp = QString(); - temp.append(trUtf8("Select Set %1").arg(i+1)); + QString selectedSetText = QString(trUtf8("Select Set %1").arg(originset+1)); + QString setName = set.value()->getName(); - InputDevice *tempdevice = button->getParentSet()->getInputDevice(); - SetJoystick *tempset = tempdevice->getSetJoystick(i); - if (tempset != nullptr) + if (!setName.isEmpty()) { - QString setName = tempset->getName(); - if (!setName.isEmpty()) - { - temp.append(" ").append("["); - temp.append(setName).append("]").append(" "); - } + selectedSetText.append(" ").append("["); + selectedSetText.append(setName).append("]").append(" "); } - QString oneWayText = QString(); - oneWayText.append(temp).append(" ").append(trUtf8("One Way")); - - QString twoWayText = QString(); - twoWayText.append(temp).append(" ").append(trUtf8("Two Way")); - - QString whileHeldText = QString(); - whileHeldText.append(temp).append(" ").append(trUtf8("While Held")); + QString oneWayText = QString(selectedSetText).append(" ").append(trUtf8("One Way")); + QString twoWayText = QString(selectedSetText).append(" ").append(trUtf8("Two Way")); + QString whileHeldText = QString(selectedSetText).append(" ").append(trUtf8("While Held")); QStringList setChoices = QStringList(); setChoices.append(oneWayText); @@ -1412,275 +1269,281 @@ void AdvanceButtonDialog::populateSetSelectionComboBox() ui->setSelectionComboBox->insertItems(currentIndex, setChoices); currentIndex += 3; } + + originset++; } } + void AdvanceButtonDialog::populateSlotSetSelectionComboBox() { qInstallMessageHandler(MessageHandler::myMessageOutput); ui->slotSetChangeComboBox->clear(); - int currentIndex = 0; - for (int i=0; i < InputDevice::NUMBER_JOYSETS; i++) + + QHash::iterator set; + int originset = 0; + + for (set = m_button->getParentSet()->getInputDevice()->getJoystick_sets().begin(); set != m_button->getParentSet()->getInputDevice()->getJoystick_sets().end(); ++set) { - if (this->button->getOriginSet() != i) + if (m_button->getOriginSet() != originset) { - QString temp = QString(); - temp.append(trUtf8("Select Set %1").arg(i+1)); + QString selectedSetSlotText = QString(trUtf8("Select Set %1").arg(originset+1)); + QString setName = set.value()->getName(); - InputDevice *tempdevice = button->getParentSet()->getInputDevice(); - SetJoystick *tempset = tempdevice->getSetJoystick(i); - if (tempset != nullptr) + if (!setName.isEmpty()) { - QString setName = tempset->getName(); - if (!setName.isEmpty()) - { - temp.append(" ").append("["); - temp.append(setName).append("]").append(" "); - } + selectedSetSlotText.append(" ").append("["); + selectedSetSlotText.append(setName).append("]").append(" "); } - ui->slotSetChangeComboBox->insertItem(currentIndex, temp, QVariant(i)); + ui->slotSetChangeComboBox->insertItem(currentIndex, selectedSetSlotText, QVariant(originset)); currentIndex++; } + + originset++; } } + void AdvanceButtonDialog::findTurboModeComboIndex() { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyButton::TurboMode currentTurboMode = this->button->getTurboMode(); - if (currentTurboMode == JoyButton::NormalTurbo) - { - ui->turboModeComboBox->setCurrentIndex(0); - } - else if (currentTurboMode == JoyButton::GradientTurbo) - { - ui->turboModeComboBox->setCurrentIndex(1); - } - else if (currentTurboMode == JoyButton::PulseTurbo) + JoyButton::TurboMode currentTurboMode = m_button->getTurboMode(); + + switch(static_cast(currentTurboMode)) { - ui->turboModeComboBox->setCurrentIndex(2); + case 0: + ui->turboModeComboBox->setCurrentIndex(0); + break; + + case 1: + ui->turboModeComboBox->setCurrentIndex(1); + break; + + case 2: + ui->turboModeComboBox->setCurrentIndex(2); + break; } } + void AdvanceButtonDialog::setButtonTurboMode(int value) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (value == 0) + switch(value) { - this->button->setTurboMode(JoyButton::NormalTurbo); - } - else if (value == 1) - { - this->button->setTurboMode(JoyButton::GradientTurbo); - } - else if (value == 2) - { - this->button->setTurboMode(JoyButton::PulseTurbo); + case 0: + m_button->setTurboMode(JoyButton::NormalTurbo); + break; + + case 1: + m_button->setTurboMode(JoyButton::GradientTurbo); + break; + + case 2: + m_button->setTurboMode(JoyButton::PulseTurbo); + break; } } + void AdvanceButtonDialog::showSelectProfileWindow() { qInstallMessageHandler(MessageHandler::myMessageOutput); - AntiMicroSettings *settings = this->button->getParentSet()->getInputDevice()->getSettings(); - - QString lookupDir = PadderCommon::preferredProfileDir(settings); - QString filename = QFileDialog::getOpenFileName(this, trUtf8("Choose Profile"), - lookupDir, trUtf8("Config Files (*.amgp *.xml)")); - if (!filename.isEmpty()) + AntiMicroSettings *settings = m_button->getParentSet()->getInputDevice()->getSettings(); + QString preferredDir = PadderCommon::preferredProfileDir(settings); + QString profileName = QFileDialog::getOpenFileName(this, trUtf8("Choose Profile"), + preferredDir, trUtf8("Config Files (*.amgp *.xml)")); + if (!profileName.isEmpty()) { int index = ui->slotListWidget->currentRow(); - SimpleKeyGrabberButton *tempbutton = ui->slotListWidget->currentItem() + SimpleKeyGrabberButton *button = ui->slotListWidget->currentItem() ->data(Qt::UserRole).value(); - tempbutton->setValue(filename, JoyButtonSlot::JoyLoadProfile); + button->setValue(profileName, JoyButtonSlot::JoyLoadProfile); QMetaObject::invokeMethod(&helper, "setAssignedSlot", Qt::BlockingQueuedConnection, - Q_ARG(JoyButtonSlot*, tempbutton->getValue()), + Q_ARG(JoyButtonSlot*, button->getValue()), Q_ARG(int, index)); - tempbutton->setToolTip(filename); + button->setToolTip(profileName); updateSlotsScrollArea(0); } } + void AdvanceButtonDialog::showFindExecutableWindow(bool) { qInstallMessageHandler(MessageHandler::myMessageOutput); - QString temp = ui->execLineEdit->text(); - QString lookupDir = QDir::homePath(); - if (!temp.isEmpty()) + QString execWindText = ui->execLineEdit->text(); + QString preferredPath = QDir::homePath(); + + if (!execWindText.isEmpty()) { - QFileInfo tempFileInfo(temp); - if (tempFileInfo.absoluteDir().exists()) - { - lookupDir = tempFileInfo.absoluteDir().absolutePath(); - } + QFileInfo execWindFileInfo(execWindText); + + if (execWindFileInfo.absoluteDir().exists()) + preferredPath = execWindFileInfo.absoluteDir().absolutePath(); } - QString filepath = QFileDialog::getOpenFileName(this, trUtf8("Choose Executable"), lookupDir); - if (!filepath.isEmpty()) + QString execWindFilepath = QFileDialog::getOpenFileName(this, trUtf8("Choose Executable"), preferredPath); + + if (!execWindFilepath.isEmpty()) { - QFileInfo tempFileInfo(filepath); - if (tempFileInfo.exists() && tempFileInfo.isExecutable()) - { - ui->execLineEdit->setText(filepath); - } + QFileInfo execWindFileInfo(execWindFilepath); + + if (execWindFileInfo.exists() && execWindFileInfo.isExecutable()) + ui->execLineEdit->setText(execWindFilepath); } } + void AdvanceButtonDialog::changeSlotTypeDisplay(int index) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (index == static_cast(KBMouseSlot)) - { - ui->slotControlsStackedWidget->setCurrentIndex(0); - } - else if (index == static_cast(CycleSlot)) - { - ui->slotControlsStackedWidget->setCurrentIndex(3); - } - else if (index == static_cast(DelaySlot)) - { - ui->slotControlsStackedWidget->setCurrentIndex(0); - } - else if (index == static_cast(DistanceSlot)) - { - ui->slotControlsStackedWidget->setCurrentIndex(2); - } - else if (index == static_cast(HoldSlot)) - { - ui->slotControlsStackedWidget->setCurrentIndex(0); - } - else if (index == static_cast(LoadSlot)) - { - ui->slotControlsStackedWidget->setCurrentIndex(4); - } - else if (index == static_cast(MouseModSlot)) - { - ui->slotControlsStackedWidget->setCurrentIndex(1); - } - else if (index == static_cast(PauseSlot)) - { - ui->slotControlsStackedWidget->setCurrentIndex(0); - } - else if (index == static_cast(PressTimeSlot)) - { - ui->slotControlsStackedWidget->setCurrentIndex(0); - } - else if (index == static_cast(ReleaseSlot)) - { - ui->slotControlsStackedWidget->setCurrentIndex(0); - } - else if (index == static_cast(SetChangeSlot)) - { - ui->slotControlsStackedWidget->setCurrentIndex(5); - } - else if (index == static_cast(TextEntry)) - { - ui->slotControlsStackedWidget->setCurrentIndex(6); - } - else if (index == static_cast(ExecuteSlot)) + switch(index) { - ui->slotControlsStackedWidget->setCurrentIndex(7); + case 0: + case 2: + case 5: + case 8: + case 9: + case 10: + ui->slotControlsStackedWidget->setCurrentIndex(0); + break; + + case 1: + ui->slotControlsStackedWidget->setCurrentIndex(3); + break; + + case 3: + ui->slotControlsStackedWidget->setCurrentIndex(2); + break; + + case 4: + ui->slotControlsStackedWidget->setCurrentIndex(7); + break; + + case 6: + ui->slotControlsStackedWidget->setCurrentIndex(4); + break; + + case 7: + ui->slotControlsStackedWidget->setCurrentIndex(1); + break; + + case 11: + ui->slotControlsStackedWidget->setCurrentIndex(5); + break; + + case 12: + ui->slotControlsStackedWidget->setCurrentIndex(6); + break; } } + void AdvanceButtonDialog::changeSlotHelpText(int index) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (index == static_cast(KBMouseSlot)) - { - ui->slotTypeHelpLabel->setText(trUtf8("Insert a new blank slot.")); - } - else if (index == static_cast(CycleSlot)) + switch(index) { - ui->slotTypeHelpLabel->setText(trUtf8("Slots past a Cycle action will be executed " + case 0: + ui->slotTypeHelpLabel->setText(trUtf8("Insert a new blank slot.")); + break; + + case 1: + ui->slotTypeHelpLabel->setText(trUtf8("Slots past a Cycle action will be executed " "on the next button press. Multiple cycles can be added " "in order to create partitions in a sequence.")); - } - else if (index == static_cast(DelaySlot)) - { - ui->slotTypeHelpLabel->setText(trUtf8("Delays the time that the next slot is activated " + break; + + case 2: + ui->slotTypeHelpLabel->setText(trUtf8("Delays the time that the next slot is activated " "by the time specified. Slots activated before the " "delay will remain active after the delay time " "has passed.")); - } - else if (index == static_cast(DistanceSlot)) - { - ui->slotTypeHelpLabel->setText(trUtf8("Distance action specifies that the slots afterwards " + break; + + case 3: + ui->slotTypeHelpLabel->setText(trUtf8("Distance action specifies that the slots afterwards " "will only be executed when an axis is moved " "a certain range past the designated dead zone.")); - } - else if (index == static_cast(HoldSlot)) - { - ui->slotTypeHelpLabel->setText(trUtf8("Insert a hold action. Slots after the action will only be " + break; + + case 4: + ui->slotTypeHelpLabel->setText(trUtf8("Execute program when slot is activated.")); + break; + + case 5: + ui->slotTypeHelpLabel->setText(trUtf8("Insert a hold action. Slots after the action will only be " "executed if the button is held past the interval specified.")); - } - else if (index == static_cast(LoadSlot)) - { - ui->slotTypeHelpLabel->setText(trUtf8("Chose a profile to load when this slot is activated.")); - } - else if (index == static_cast(MouseModSlot)) - { - ui->slotTypeHelpLabel->setText(trUtf8("Mouse mod action will modify all mouse speed settings " + break; + + case 6: + ui->slotTypeHelpLabel->setText(trUtf8("Chose a profile to load when this slot is activated.")); + break; + + case 7: + ui->slotTypeHelpLabel->setText(trUtf8("Mouse mod action will modify all mouse speed settings " "by a specified percentage while the action is being processed. " "This can be useful for slowing down the mouse while " "sniping.")); - } - else if (index == static_cast(PauseSlot)) - { - ui->slotTypeHelpLabel->setText(trUtf8("Insert a pause that occurs in between key presses.")); - } - else if (index == static_cast(PressTimeSlot)) - { - ui->slotTypeHelpLabel->setText(trUtf8("Specify the time that keys past this slot should be " + break; + + case 8: + ui->slotTypeHelpLabel->setText(trUtf8("Insert a pause that occurs in between key presses.")); + break; + + case 9: + ui->slotTypeHelpLabel->setText(trUtf8("Specify the time that keys past this slot should be " "held down.")); - } - else if (index == static_cast(ReleaseSlot)) - { - ui->slotTypeHelpLabel->setText(trUtf8("Insert a release action. Slots after the action will only be " + break; + + case 10: + ui->slotTypeHelpLabel->setText(trUtf8("Insert a release action. Slots after the action will only be " "executed after a button release if the button was held " "past the interval specified.")); - } - else if (index == static_cast(SetChangeSlot)) - { - ui->slotTypeHelpLabel->setText(trUtf8("Change to selected set once slot is activated.")); - } - else if (index == static_cast(TextEntry)) - { - ui->slotTypeHelpLabel->setText(trUtf8("Full string will be typed when a " + break; + + case 11: + ui->slotTypeHelpLabel->setText(trUtf8("Change to selected set once slot is activated.")); + break; + + case 12: + ui->slotTypeHelpLabel->setText(trUtf8("Full string will be typed when a " "slot is activated.")); - } - else if (index == static_cast(ExecuteSlot)) - { - ui->slotTypeHelpLabel->setText(trUtf8("Execute program when slot is activated.")); + break; + } } + int AdvanceButtonDialog::getOldRow() const { return oldRow; } + JoyButton *AdvanceButtonDialog::getButton() const { - return button; + return m_button; } + AdvanceButtonDialogHelper const& AdvanceButtonDialog::getHelper() { return helper; } + AdvanceButtonDialogHelper& AdvanceButtonDialog::getHelperLocal() { return helper; diff --git a/src/advancebuttondialog.h b/src/advancebuttondialog.h old mode 100644 new mode 100755 index 757fd544f..74eddbe1b --- a/src/advancebuttondialog.h +++ b/src/advancebuttondialog.h @@ -43,9 +43,6 @@ class AdvanceButtonDialog : public QDialog JoyButton *getButton() const; AdvanceButtonDialogHelper const& getHelper(); - static const int MINIMUMTURBO; - - protected: void connectButtonEvents(SimpleKeyGrabberButton *button); void appendBlankKeyGrabber(); @@ -62,8 +59,6 @@ class AdvanceButtonDialog : public QDialog void populateSlotSetSelectionComboBox(); void findTurboModeComboIndex(); - - signals: void toggleChanged(bool state); void turboChanged(bool state); @@ -83,15 +78,7 @@ private slots: void deleteSlot(); void insertSlot(); - void insertPauseSlot(); - void insertHoldSlot(); void insertCycleSlot(); - void insertDistanceSlot(); - void insertReleaseSlot(); - void insertMouseSpeedModSlot(); - void insertKeyPressSlot(); - void insertDelaySlot(); - void insertSetChangeSlot(); void insertTextEntrySlot(); void insertExecuteSlot(); @@ -128,9 +115,11 @@ private slots: }; int oldRow; - JoyButton *button; + JoyButton *m_button; AdvanceButtonDialogHelper helper; + void insertKindOfSlot(int slotProperty, JoyButtonSlot::JoySlotInputAction inputAction); + }; #endif // ADVANCEBUTTONDIALOG_H diff --git a/src/advancebuttondialog.ui b/src/advancebuttondialog.ui old mode 100644 new mode 100755 diff --git a/src/advancestickassignmentdialog.cpp b/src/advancestickassignmentdialog.cpp old mode 100644 new mode 100755 index 87d1c41e8..7220ca1c9 --- a/src/advancestickassignmentdialog.cpp +++ b/src/advancestickassignmentdialog.cpp @@ -18,6 +18,7 @@ #include "advancestickassignmentdialog.h" #include "ui_advancestickassignmentdialog.h" +#include "globalvariables.h" #include "messagehandler.h" #include "joycontrolstick.h" #include "joystick.h" @@ -59,11 +60,10 @@ AdvanceStickAssignmentDialog::AdvanceStickAssignmentDialog(Joystick *joystick, Q ui->xAxisOneComboBox->addItem("", QVariant(0)); ui->yAxisOneComboBox->addItem("", QVariant(0)); - ui->xAxisTwoComboBox->addItem("", QVariant(0)); ui->yAxisTwoComboBox->addItem("", QVariant(0)); - for (int i=0; i < joystick->getNumberAxes(); i++) + for (int i = 0; i < joystick->getNumberAxes(); i++) { ui->xAxisOneComboBox->addItem(trUtf8("Axis %1").arg(i+1), QVariant(i)); ui->yAxisOneComboBox->addItem(trUtf8("Axis %1").arg(i+1), QVariant(i)); @@ -72,18 +72,16 @@ AdvanceStickAssignmentDialog::AdvanceStickAssignmentDialog(Joystick *joystick, Q ui->yAxisTwoComboBox->addItem(trUtf8("Axis %1").arg(i+1), QVariant(i)); } - refreshStickConfiguration(); - + JoyControlStick *stick1 = joystick->getActiveSetJoystick()->getJoyStick(0); + JoyControlStick *stick2 = joystick->getActiveSetJoystick()->getJoyStick(1); + refreshStickConfiguration(stick1, stick2); populateDPadComboBoxes(); - refreshVDPadConfiguration(); + refreshVDPadsConfiguration(); ui->versionTwoMessageLabel->setVisible(false); - - connect(ui->enableOneCheckBox, &QCheckBox::clicked, this, &AdvanceStickAssignmentDialog::changeStateStickOneWidgets); connect(ui->enableTwoCheckBox, &QCheckBox::clicked, this, &AdvanceStickAssignmentDialog::changeStateStickTwoWidgets); - connect(ui->vdpadEnableCheckBox, &QCheckBox::clicked, this, &AdvanceStickAssignmentDialog::changeStateVDPadWidgets); QSignalMapper *signalMapper = new QSignalMapper(this); @@ -95,7 +93,6 @@ AdvanceStickAssignmentDialog::AdvanceStickAssignmentDialog(Joystick *joystick, Q connect(ui->xAxisOneComboBox, static_cast(&QComboBox::currentIndexChanged), [signalMapper]() { signalMapper->map(); }); connect(ui->yAxisOneComboBox, static_cast(&QComboBox::currentIndexChanged), [signalMapper]() { signalMapper->map(); }); - connect(ui->quickAssignStick1PushButton, &QPushButton::clicked, this, &AdvanceStickAssignmentDialog::openQuickAssignDialogStick1); connect(ui->quickAssignStick2PushButton, &QPushButton::clicked, this, &AdvanceStickAssignmentDialog::openQuickAssignDialogStick2); @@ -103,7 +100,7 @@ AdvanceStickAssignmentDialog::AdvanceStickAssignmentDialog(Joystick *joystick, Q connect(this, &AdvanceStickAssignmentDialog::stickConfigurationChanged, this, &AdvanceStickAssignmentDialog::disableVDPadComboBoxes); connect(this, &AdvanceStickAssignmentDialog::stickConfigurationChanged, this, &AdvanceStickAssignmentDialog::populateDPadComboBoxes); - connect(this, &AdvanceStickAssignmentDialog::stickConfigurationChanged, this, &AdvanceStickAssignmentDialog::refreshVDPadConfiguration); + connect(this, &AdvanceStickAssignmentDialog::stickConfigurationChanged, this, &AdvanceStickAssignmentDialog::refreshVDPadsConfiguration); connect(this, &AdvanceStickAssignmentDialog::stickConfigurationChanged, this, &AdvanceStickAssignmentDialog::enableVDPadComboBoxes); connect(ui->vdpadUpPushButton, &QPushButton::clicked, this, &AdvanceStickAssignmentDialog::openAssignVDPadUp); @@ -114,6 +111,7 @@ AdvanceStickAssignmentDialog::AdvanceStickAssignmentDialog(Joystick *joystick, Q connect(this, &AdvanceStickAssignmentDialog::finished, this, &AdvanceStickAssignmentDialog::reenableButtonEvents); } + AdvanceStickAssignmentDialog::~AdvanceStickAssignmentDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -121,147 +119,105 @@ AdvanceStickAssignmentDialog::~AdvanceStickAssignmentDialog() delete ui; } + void AdvanceStickAssignmentDialog::checkForAxisAssignmentStickOne(QWidget* comboBox) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((ui->xAxisOneComboBox->currentIndex() > 0) && (ui->yAxisOneComboBox->currentIndex() > 0)) - { - if (ui->xAxisOneComboBox->currentIndex() != ui->yAxisOneComboBox->currentIndex()) - { - for (int i = 0; i < joystick->NUMBER_JOYSETS; i++) - { - SetJoystick *currentset = joystick->getSetJoystick(i); - JoyAxis *axis1 = currentset->getJoyAxis(ui->xAxisOneComboBox->currentIndex()-1); - JoyAxis *axis2 = currentset->getJoyAxis(ui->yAxisOneComboBox->currentIndex()-1); + checkForAxisAssignmentSticks(comboBox, ui->xAxisTwoComboBox, ui->yAxisTwoComboBox, 0); +} - if (axis1 && axis2) - { - JoyControlStick *controlstick = currentset->getJoyStick(0); - if (controlstick != nullptr) - { - controlstick->replaceAxes(axis1, axis2); - } - else - { - JoyControlStick *controlstick = new JoyControlStick(axis1, axis2, 0, i, currentset); - currentset->addControlStick(0, controlstick); - } - } - } - refreshStickConfiguration(); - emit stickConfigurationChanged(); - } - else - { - if (comboBox == ui->xAxisOneComboBox) - { - ui->yAxisOneComboBox->setCurrentIndex(0); - } - else if (comboBox == ui->yAxisOneComboBox) - { - ui->xAxisOneComboBox->setCurrentIndex(0); - } - } - } +void AdvanceStickAssignmentDialog::checkForAxisAssignmentStickTwo(QWidget* comboBox) +{ + qInstallMessageHandler(MessageHandler::myMessageOutput); + + checkForAxisAssignmentSticks(comboBox, ui->xAxisTwoComboBox, ui->yAxisTwoComboBox, 1); } -void AdvanceStickAssignmentDialog::checkForAxisAssignmentStickTwo(QWidget* comboBox) + +void AdvanceStickAssignmentDialog::checkForAxisAssignmentSticks(QWidget* comboBox, QComboBox* xAxisComboBox, QComboBox* yAxisComboBox, int controlStickNumber) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((ui->xAxisTwoComboBox->currentIndex() > 0) && (ui->yAxisTwoComboBox->currentIndex() > 0)) + if ((xAxisComboBox->currentIndex() > 0) && (yAxisComboBox->currentIndex() > 0)) { - if (ui->xAxisTwoComboBox->currentIndex() != ui->yAxisTwoComboBox->currentIndex()) + if (xAxisComboBox->currentIndex() != yAxisComboBox->currentIndex()) { - for (int i=0; i < joystick->NUMBER_JOYSETS; i++) + QHash::iterator set; + int originset = 0; + + for (set = joystick->getJoystick_sets().begin(); set != joystick->getJoystick_sets().end(); ++set) { - SetJoystick *currentset = joystick->getSetJoystick(i); - JoyAxis *axis1 = currentset->getJoyAxis(ui->xAxisTwoComboBox->currentIndex()-1); - JoyAxis *axis2 = currentset->getJoyAxis(ui->yAxisTwoComboBox->currentIndex()-1); - if ((axis1 != nullptr) && (axis2 != nullptr)) + SetJoystick *currentset = set.value(); + JoyAxis *axis1 = currentset->getJoyAxis(xAxisComboBox->currentIndex() - 1); + JoyAxis *axis2 = currentset->getJoyAxis(yAxisComboBox->currentIndex() - 1); + + if ((axis1 != nullptr) && (axis2 != nullptr) && (currentset->getJoyStick(controlStickNumber) != nullptr)) { - JoyControlStick *controlstick = currentset->getJoyStick(1); - if (controlstick != nullptr) - { - controlstick->replaceXAxis(axis1); - controlstick->replaceYAxis(axis2); - } - else - { - JoyControlStick *controlstick = new JoyControlStick(axis1, axis2, 1, i, currentset); - currentset->addControlStick(1, controlstick); - } + currentset->getJoyStick(controlStickNumber)->replaceAxes(axis1, axis2); } + else if ((axis1 != nullptr) && (axis2 != nullptr) && (currentset->getJoyStick(controlStickNumber) == nullptr)) + { + JoyControlStick *controlstick = new JoyControlStick(axis1, axis2, controlStickNumber, originset, currentset); + currentset->addControlStick(controlStickNumber, controlstick); + } + + originset++; } - refreshStickConfiguration(); + JoyControlStick *stick1 = joystick->getActiveSetJoystick()->getJoyStick(0); + JoyControlStick *stick2 = joystick->getActiveSetJoystick()->getJoyStick(1); + refreshStickConfiguration(stick1, stick2); emit stickConfigurationChanged(); } - else + else if (comboBox == xAxisComboBox) { - if (comboBox == ui->xAxisTwoComboBox) - { - ui->yAxisTwoComboBox->setCurrentIndex(0); - } - else if (comboBox == ui->yAxisTwoComboBox) - { - ui->xAxisTwoComboBox->setCurrentIndex(0); - } + yAxisComboBox->setCurrentIndex(0); + } + else if (comboBox == yAxisComboBox) + { + xAxisComboBox->setCurrentIndex(0); } } } -void AdvanceStickAssignmentDialog::changeStateVDPadWidgets(bool enabled) + +void AdvanceStickAssignmentDialog::changeStateVDPadWidgets(bool enabledVDPads) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (enabled) - { - ui->vdpadUpComboBox->setEnabled(true); - ui->vdpadDownComboBox->setEnabled(true); - ui->vdpadLeftComboBox->setEnabled(true); - ui->vdpadRightComboBox->setEnabled(true); + ui->vdpadUpComboBox->setEnabled(enabledVDPads); + ui->vdpadDownComboBox->setEnabled(enabledVDPads); + ui->vdpadLeftComboBox->setEnabled(enabledVDPads); + ui->vdpadRightComboBox->setEnabled(enabledVDPads); - ui->vdpadUpPushButton->setEnabled(true); - ui->vdpadDownPushButton->setEnabled(true); - ui->vdpadLeftPushButton->setEnabled(true); - ui->vdpadRightPushButton->setEnabled(true); + ui->vdpadUpPushButton->setEnabled(enabledVDPads); + ui->vdpadDownPushButton->setEnabled(enabledVDPads); + ui->vdpadLeftPushButton->setEnabled(enabledVDPads); + ui->vdpadRightPushButton->setEnabled(enabledVDPads); - for (int i=0; i < joystick->NUMBER_JOYSETS; i++) - { - SetJoystick *currentset = joystick->getSetJoystick(i); - if (!currentset->getVDPad(0)) - { - VDPad *vdpad = new VDPad(0, i, currentset, currentset); - currentset->addVDPad(0, vdpad); - } - } - } - else - { - ui->vdpadUpComboBox->setEnabled(false); - ui->vdpadDownComboBox->setEnabled(false); - ui->vdpadLeftComboBox->setEnabled(false); - ui->vdpadRightComboBox->setEnabled(false); + QHash::iterator set; + int originset = 0; - ui->vdpadUpPushButton->setEnabled(false); - ui->vdpadDownPushButton->setEnabled(false); - ui->vdpadLeftPushButton->setEnabled(false); - ui->vdpadRightPushButton->setEnabled(false); + for (set = joystick->getJoystick_sets().begin(); set != joystick->getJoystick_sets().end(); ++set) + { + SetJoystick *currentset = set.value(); - for (int i=0; i < joystick->NUMBER_JOYSETS; i++) + if (!currentset->getVDPad(0) && enabledVDPads) { - SetJoystick *currentset = joystick->getSetJoystick(i); - if (currentset->getVDPad(0)) - { - currentset->removeVDPad(0); - } + currentset->addVDPad(0, new VDPad(0, originset, currentset, currentset)); } + else + { + currentset->removeVDPad(0); + } + + originset++; } } + void AdvanceStickAssignmentDialog::changeStateStickOneWidgets(bool enabled) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -288,21 +244,15 @@ void AdvanceStickAssignmentDialog::changeStateStickOneWidgets(bool enabled) ui->enableTwoCheckBox->setChecked(false); ui->quickAssignStick1PushButton->setEnabled(false); - JoyControlStick *controlstick = joystick->getActiveSetJoystick()->getJoyStick(0); - JoyControlStick *controlstick2 = joystick->getActiveSetJoystick()->getJoyStick(1); - - if (controlstick2 != nullptr) - { + if (joystick->getActiveSetJoystick()->getJoyStick(1) != nullptr) joystick->removeControlStick(1); - } - if (controlstick != nullptr) - { + if (joystick->getActiveSetJoystick()->getJoyStick(0) != nullptr) joystick->removeControlStick(0); - } } } + void AdvanceStickAssignmentDialog::changeStateStickTwoWidgets(bool enabled) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -321,82 +271,61 @@ void AdvanceStickAssignmentDialog::changeStateStickTwoWidgets(bool enabled) ui->yAxisTwoComboBox->setCurrentIndex(0); ui->quickAssignStick2PushButton->setEnabled(false); - JoyControlStick *controlstick = joystick->getActiveSetJoystick()->getJoyStick(1); - if (controlstick != nullptr) + if (joystick->getActiveSetJoystick()->getJoyStick(1) != nullptr) { - for (int i=0; i < joystick->NUMBER_JOYSETS; i++) + QHash::iterator set; + + for (set = joystick->getJoystick_sets().begin(); set != joystick->getJoystick_sets().end(); ++set) { - SetJoystick *currentset = joystick->getSetJoystick(i); - currentset->removeControlStick(1); + set.value()->removeControlStick(1); } } } } -void AdvanceStickAssignmentDialog::refreshStickConfiguration() + +void AdvanceStickAssignmentDialog::refreshStickConfiguration(JoyControlStick *stick1, JoyControlStick *stick2) { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyControlStick *stick1 = joystick->getActiveSetJoystick()->getJoyStick(0); - JoyControlStick *stick2 = joystick->getActiveSetJoystick()->getJoyStick(1); - if (stick1) + if ((stick1 != nullptr) && (stick1->getAxisX() != nullptr) && (stick1->getAxisY() != nullptr)) { - JoyAxis *axisX = stick1->getAxisX(); - JoyAxis *axisY = stick1->getAxisY(); - if ((axisX != nullptr) && (axisY != nullptr)) - { - ui->xAxisOneComboBox->setCurrentIndex(axisX->getRealJoyIndex()); - ui->yAxisOneComboBox->setCurrentIndex(axisY->getRealJoyIndex()); - ui->xAxisOneComboBox->setEnabled(true); - ui->yAxisOneComboBox->setEnabled(true); - ui->enableOneCheckBox->setEnabled(true); - ui->enableOneCheckBox->setChecked(true); - ui->enableTwoCheckBox->setEnabled(true); - ui->quickAssignStick1PushButton->setEnabled(true); - } + refreshSticksForAxes(true, stick1->getAxisX()->getRealJoyIndex(), stick1->getAxisY()->getRealJoyIndex(), ui->xAxisOneComboBox, ui->yAxisOneComboBox, ui->enableOneCheckBox, ui->quickAssignStick1PushButton); } else { - ui->xAxisOneComboBox->setCurrentIndex(0); - ui->xAxisOneComboBox->setEnabled(false); - ui->yAxisOneComboBox->setCurrentIndex(0); - ui->yAxisOneComboBox->setEnabled(false); - ui->enableOneCheckBox->setChecked(false); - ui->enableTwoCheckBox->setEnabled(false); - ui->quickAssignStick1PushButton->setEnabled(false); + refreshSticksForAxes(false, 0, 0, ui->xAxisOneComboBox, ui->yAxisOneComboBox, ui->enableOneCheckBox, ui->quickAssignStick1PushButton); } - if (stick2) + if ((stick2 != nullptr) && (stick2->getAxisX() != nullptr) && (stick2->getAxisY() != nullptr)) { - JoyAxis *axisX = stick2->getAxisX(); - JoyAxis *axisY = stick2->getAxisY(); - if ((axisX != nullptr) && (axisY != nullptr)) - { - ui->xAxisTwoComboBox->setCurrentIndex(axisX->getRealJoyIndex()); - ui->yAxisTwoComboBox->setCurrentIndex(axisY->getRealJoyIndex()); - ui->xAxisTwoComboBox->setEnabled(true); - ui->yAxisTwoComboBox->setEnabled(true); - ui->enableTwoCheckBox->setEnabled(true); - ui->enableTwoCheckBox->setChecked(true); - ui->quickAssignStick2PushButton->setEnabled(true); - } + refreshSticksForAxes(true, stick2->getAxisX()->getRealJoyIndex(), stick2->getAxisY()->getRealJoyIndex(), ui->xAxisTwoComboBox, ui->yAxisTwoComboBox, ui->enableTwoCheckBox, ui->quickAssignStick2PushButton); } else { - ui->xAxisTwoComboBox->setCurrentIndex(0); - ui->xAxisTwoComboBox->setEnabled(false); - ui->yAxisTwoComboBox->setCurrentIndex(0); - ui->yAxisTwoComboBox->setEnabled(false); - ui->enableTwoCheckBox->setChecked(false); - ui->quickAssignStick2PushButton->setEnabled(false); + refreshSticksForAxes(false, 0, 0, ui->xAxisTwoComboBox, ui->yAxisTwoComboBox, ui->enableTwoCheckBox, ui->quickAssignStick2PushButton); } } -void AdvanceStickAssignmentDialog::refreshVDPadConfiguration() + +void AdvanceStickAssignmentDialog::refreshSticksForAxes(bool axesExist, int xAxisComboBoxIndex, int yAxisComboBoxIndex, QComboBox* xAxisComboBox, QComboBox* yAxisComboBox, QCheckBox* enabledSticksCheckbox, QPushButton* quickAssignBtn) +{ + xAxisComboBox->setCurrentIndex(xAxisComboBoxIndex); + yAxisComboBox->setCurrentIndex(yAxisComboBoxIndex); + xAxisComboBox->setEnabled(axesExist); + yAxisComboBox->setEnabled(axesExist); + enabledSticksCheckbox->setEnabled(axesExist); + enabledSticksCheckbox->setChecked(axesExist); + quickAssignBtn->setEnabled(axesExist); +} + + +void AdvanceStickAssignmentDialog::refreshVDPadsConfiguration() { qInstallMessageHandler(MessageHandler::myMessageOutput); VDPad *vdpad = joystick->getActiveSetJoystick()->getVDPad(0); + if (vdpad != nullptr) { ui->vdpadEnableCheckBox->setChecked(true); @@ -411,128 +340,16 @@ void AdvanceStickAssignmentDialog::refreshVDPadConfiguration() ui->vdpadRightPushButton->setEnabled(true); JoyButton *upButton = vdpad->getVButton(JoyDPadButton::DpadUp); - if (upButton != nullptr) - { - int buttonindex = 0; - if (typeid(*upButton) == typeid(JoyAxisButton)) - { - JoyAxisButton *axisbutton = qobject_cast(upButton); // static_cast - JoyAxis *axis = axisbutton->getAxis(); - QList templist; - templist.append(QVariant(axis->getRealJoyIndex())); - templist.append(QVariant(axisbutton->getJoyNumber())); - buttonindex = ui->vdpadUpComboBox->findData(templist); - } - else - { - QList templist; - templist.append(QVariant(0)); - templist.append(QVariant(upButton->getRealJoyNumber())); - buttonindex = ui->vdpadUpComboBox->findData(templist); - } - - if (buttonindex == -1) - { - vdpad->removeVButton(upButton); - } - else - { - ui->vdpadUpComboBox->setCurrentIndex(buttonindex); - } - } + refreshVDPadConf(upButton, ui->vdpadUpComboBox); JoyButton *downButton = vdpad->getVButton(JoyDPadButton::DpadDown); - if (downButton != nullptr) - { - int buttonindex = 0; - if (typeid(*downButton) == typeid(JoyAxisButton)) - { - JoyAxisButton *axisbutton = qobject_cast(downButton); // static_cast - JoyAxis *axis = axisbutton->getAxis(); - QList templist; - templist.append(QVariant(axis->getRealJoyIndex())); - templist.append(QVariant(axisbutton->getJoyNumber())); - buttonindex = ui->vdpadDownComboBox->findData(templist); - } - else - { - QList templist; - templist.append(QVariant(0)); - templist.append(QVariant(downButton->getRealJoyNumber())); - buttonindex = ui->vdpadDownComboBox->findData(templist); - } - - if (buttonindex == -1) - { - vdpad->removeVButton(downButton); - } - else - { - ui->vdpadDownComboBox->setCurrentIndex(buttonindex); - } - } + refreshVDPadConf(downButton, ui->vdpadDownComboBox); JoyButton *leftButton = vdpad->getVButton(JoyDPadButton::DpadLeft); - if (leftButton != nullptr) - { - int buttonindex = 0; - if (typeid(*leftButton) == typeid(JoyAxisButton)) - { - JoyAxisButton *axisbutton = qobject_cast(leftButton); // static_cast - JoyAxis *axis = axisbutton->getAxis(); - QList templist; - templist.append(QVariant(axis->getRealJoyIndex())); - templist.append(QVariant(axisbutton->getJoyNumber())); - buttonindex = ui->vdpadLeftComboBox->findData(templist); - } - else - { - QList templist; - templist.append(QVariant(0)); - templist.append(QVariant(leftButton->getRealJoyNumber())); - buttonindex = ui->vdpadLeftComboBox->findData(templist); - } - - if (buttonindex == -1) - { - vdpad->removeVButton(leftButton); - } - else - { - ui->vdpadLeftComboBox->setCurrentIndex(buttonindex); - } - } + refreshVDPadConf(leftButton, ui->vdpadLeftComboBox); JoyButton *rightButton = vdpad->getVButton(JoyDPadButton::DpadRight); - if (rightButton != nullptr) - { - int buttonindex = 0; - if (typeid(*rightButton) == typeid(JoyAxisButton)) - { - JoyAxisButton *axisbutton = qobject_cast(rightButton); // static_cast - JoyAxis *axis = axisbutton->getAxis(); - QList templist; - templist.append(QVariant(axis->getRealJoyIndex())); - templist.append(QVariant(axisbutton->getJoyNumber())); - buttonindex = ui->vdpadRightComboBox->findData(templist); - } - else - { - QList templist; - templist.append(QVariant(0)); - templist.append(QVariant(rightButton->getRealJoyNumber())); - buttonindex = ui->vdpadRightComboBox->findData(templist); - } - - if (buttonindex == -1) - { - vdpad->removeVButton(rightButton); - } - else - { - ui->vdpadRightComboBox->setCurrentIndex(buttonindex); - } - } + refreshVDPadConf(rightButton, ui->vdpadRightComboBox); } else { @@ -557,6 +374,36 @@ void AdvanceStickAssignmentDialog::refreshVDPadConfiguration() } } + +void AdvanceStickAssignmentDialog::refreshVDPadConf(JoyButton *vdpadButton, QComboBox* vpadComboBox) +{ + if (vdpadButton != nullptr) + { + int buttonindex = 0; + + if (typeid(*vdpadButton) == typeid(JoyAxisButton)) + { + JoyAxisButton *axisbutton = qobject_cast(vdpadButton); + JoyAxis *axis = axisbutton->getAxis(); + QList templist; + templist.append(QVariant(axis->getRealJoyIndex())); + templist.append(QVariant(axisbutton->getJoyNumber())); + buttonindex = vpadComboBox->findData(templist); + } + else + { + QList templist; + templist.append(QVariant(0)); + templist.append(QVariant(vdpadButton->getRealJoyNumber())); + buttonindex = vpadComboBox->findData(templist); + } + + if (buttonindex == -1) vdpadButton->getVDPad()->removeVButton(vdpadButton); + else vpadComboBox->setCurrentIndex(buttonindex); + } +} + + void AdvanceStickAssignmentDialog::populateDPadComboBoxes() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -574,6 +421,7 @@ void AdvanceStickAssignmentDialog::populateDPadComboBoxes() for (int i = 0; i < joystick->getNumberAxes(); i++) { JoyAxis *axis = joystick->getActiveSetJoystick()->getJoyAxis(i); + if (!axis->isPartControlStick()) { QList templist; @@ -588,6 +436,7 @@ void AdvanceStickAssignmentDialog::populateDPadComboBoxes() templist.clear(); templist.append(QVariant(i+1)); templist.append(QVariant(1)); + ui->vdpadUpComboBox->addItem(trUtf8("Axis %1 +").arg(QString::number(i+1)), templist); ui->vdpadDownComboBox->addItem(trUtf8("Axis %1 +").arg(QString::number(i+1)), templist); ui->vdpadLeftComboBox->addItem(trUtf8("Axis %1 +").arg(QString::number(i+1)), templist); @@ -608,6 +457,7 @@ void AdvanceStickAssignmentDialog::populateDPadComboBoxes() } } + void AdvanceStickAssignmentDialog::changeVDPadUpButton(int index) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -629,18 +479,23 @@ void AdvanceStickAssignmentDialog::changeVDPadUpButton(int index) QVariant temp = ui->vdpadUpComboBox->itemData(index); QList templist = temp.toList(); + if (templist.size() == 2) { int axis = templist.at(0).toInt(); int button = templist.at(1).toInt(); + if ((axis > 0) && (button >= 0)) { - for (int i=0; i < joystick->NUMBER_JOYSETS; i++) + QHash::iterator set; + + for (set = joystick->getJoystick_sets().begin(); set != joystick->getJoystick_sets().end(); ++set) { - SetJoystick *currentset = joystick->getSetJoystick(i); + SetJoystick *currentset = set.value(); VDPad *vdpad = currentset->getVDPad(0); JoyAxis *currentaxis = currentset->getJoyAxis(axis-1); JoyButton *currentbutton = nullptr; + if (button == 0) { currentbutton = currentaxis->getNAxisButton(); @@ -655,11 +510,14 @@ void AdvanceStickAssignmentDialog::changeVDPadUpButton(int index) } else if (button > 0) { - for (int i=0; i < joystick->NUMBER_JOYSETS; i++) + QHash::iterator set; + + for (set = joystick->getJoystick_sets().begin(); set != joystick->getJoystick_sets().end(); ++set) { - SetJoystick *currentset = joystick->getSetJoystick(i); + SetJoystick *currentset = set.value(); VDPad *vdpad = currentset->getVDPad(0); JoyButton *currentbutton = currentset->getJoyButton(button-1); + if (currentbutton != nullptr) { vdpad->addVButton(JoyDPadButton::DpadUp, currentbutton); @@ -670,10 +528,13 @@ void AdvanceStickAssignmentDialog::changeVDPadUpButton(int index) } else { - for (int i=0; i < joystick->NUMBER_JOYSETS; i++) + QHash::iterator set; + + for (set = joystick->getJoystick_sets().begin(); set != joystick->getJoystick_sets().end(); ++set) { - SetJoystick *currentset = joystick->getSetJoystick(i); + SetJoystick *currentset = set.value(); VDPad *vdpad = currentset->getVDPad(0); + if ((vdpad != nullptr) && vdpad->getVButton(JoyDPadButton::DpadUp)) { vdpad->removeVButton(JoyDPadButton::DpadUp); @@ -703,18 +564,23 @@ void AdvanceStickAssignmentDialog::changeVDPadDownButton(int index) QVariant temp = ui->vdpadDownComboBox->itemData(index); QList templist = temp.toList(); + if (templist.size() == 2) { int axis = templist.at(0).toInt(); int button = templist.at(1).toInt(); + if ((axis > 0) && (button >= 0)) { - for (int i = 0; i < joystick->NUMBER_JOYSETS; i++) + QHash::iterator set; + + for (set = joystick->getJoystick_sets().begin(); set != joystick->getJoystick_sets().end(); ++set) { - SetJoystick *currentset = joystick->getSetJoystick(i); + SetJoystick *currentset = set.value(); VDPad *vdpad = currentset->getVDPad(0); JoyAxis *currentaxis = currentset->getJoyAxis(axis-1); JoyButton *currentbutton = nullptr; + if (button == 0) { currentbutton = currentaxis->getNAxisButton(); @@ -729,11 +595,14 @@ void AdvanceStickAssignmentDialog::changeVDPadDownButton(int index) } else if (button > 0) { - for (int i=0; i < joystick->NUMBER_JOYSETS; i++) + QHash::iterator set; + + for (set = joystick->getJoystick_sets().begin(); set != joystick->getJoystick_sets().end(); ++set) { - SetJoystick *currentset = joystick->getSetJoystick(i); + SetJoystick *currentset = set.value(); VDPad *vdpad = currentset->getVDPad(0); JoyButton *currentbutton = currentset->getJoyButton(button-1); + if (currentbutton != nullptr) { vdpad->addVButton(JoyDPadButton::DpadDown, currentbutton); @@ -744,10 +613,13 @@ void AdvanceStickAssignmentDialog::changeVDPadDownButton(int index) } else { - for (int i=0; i < joystick->NUMBER_JOYSETS; i++) + QHash::iterator set; + + for (set = joystick->getJoystick_sets().begin(); set != joystick->getJoystick_sets().end(); ++set) { - SetJoystick *currentset = joystick->getSetJoystick(i); + SetJoystick *currentset = set.value(); VDPad *vdpad = currentset->getVDPad(0); + if ((vdpad != nullptr) && vdpad->getVButton(JoyDPadButton::DpadDown)) { vdpad->removeVButton(JoyDPadButton::DpadDown); @@ -777,18 +649,23 @@ void AdvanceStickAssignmentDialog::changeVDPadLeftButton(int index) QVariant temp = ui->vdpadLeftComboBox->itemData(index); QList templist = temp.toList(); + if (templist.size() == 2) { int axis = templist.at(0).toInt(); int button = templist.at(1).toInt(); + if ((axis > 0) && (button >= 0)) { - for (int i=0; i < joystick->NUMBER_JOYSETS; i++) + QHash::iterator set; + + for (set = joystick->getJoystick_sets().begin(); set != joystick->getJoystick_sets().end(); ++set) { - SetJoystick *currentset = joystick->getSetJoystick(i); + SetJoystick *currentset = set.value(); VDPad *vdpad = currentset->getVDPad(0); JoyAxis *currentaxis = currentset->getJoyAxis(axis-1); JoyButton *currentbutton = nullptr; + if (button == 0) { currentbutton = currentaxis->getNAxisButton(); @@ -803,11 +680,14 @@ void AdvanceStickAssignmentDialog::changeVDPadLeftButton(int index) } else if (button > 0) { - for (int i=0; i < joystick->NUMBER_JOYSETS; i++) + QHash::iterator set; + + for (set = joystick->getJoystick_sets().begin(); set != joystick->getJoystick_sets().end(); ++set) { - SetJoystick *currentset = joystick->getSetJoystick(i); + SetJoystick *currentset = set.value(); VDPad *vdpad = currentset->getVDPad(0); JoyButton *currentbutton = currentset->getJoyButton(button-1); + if (currentbutton != nullptr) { vdpad->addVButton(JoyDPadButton::DpadLeft, currentbutton); @@ -818,10 +698,13 @@ void AdvanceStickAssignmentDialog::changeVDPadLeftButton(int index) } else { - for (int i=0; i < joystick->NUMBER_JOYSETS; i++) + QHash::iterator set; + + for (set = joystick->getJoystick_sets().begin(); set != joystick->getJoystick_sets().end(); ++set) { - SetJoystick *currentset = joystick->getSetJoystick(i); + SetJoystick *currentset = set.value(); VDPad *vdpad = currentset->getVDPad(0); + if ((vdpad != nullptr) && vdpad->getVButton(JoyDPadButton::DpadLeft)) { vdpad->removeVButton(JoyDPadButton::DpadLeft); @@ -851,18 +734,23 @@ void AdvanceStickAssignmentDialog::changeVDPadRightButton(int index) QVariant temp = ui->vdpadRightComboBox->itemData(index); QList templist = temp.toList(); + if (templist.size() == 2) { int axis = templist.at(0).toInt(); int button = templist.at(1).toInt(); + if ((axis > 0) && (button >= 0)) { - for (int i=0; i < joystick->NUMBER_JOYSETS; i++) + QHash::iterator set; + + for (set = joystick->getJoystick_sets().begin(); set != joystick->getJoystick_sets().end(); ++set) { - SetJoystick *currentset = joystick->getSetJoystick(i); + SetJoystick *currentset = set.value(); VDPad *vdpad = currentset->getVDPad(0); JoyAxis *currentaxis = currentset->getJoyAxis(axis-1); JoyButton *currentbutton = nullptr; + if (button == 0) { currentbutton = currentaxis->getNAxisButton(); @@ -877,11 +765,14 @@ void AdvanceStickAssignmentDialog::changeVDPadRightButton(int index) } else if (button > 0) { - for (int i=0; i < joystick->NUMBER_JOYSETS; i++) + QHash::iterator set; + + for (set = joystick->getJoystick_sets().begin(); set != joystick->getJoystick_sets().end(); ++set) { - SetJoystick *currentset = joystick->getSetJoystick(i); + SetJoystick *currentset = set.value(); VDPad *vdpad = currentset->getVDPad(0); JoyButton *currentbutton = currentset->getJoyButton(button-1); + if (currentbutton != nullptr) { vdpad->addVButton(JoyDPadButton::DpadRight, currentbutton); @@ -892,10 +783,13 @@ void AdvanceStickAssignmentDialog::changeVDPadRightButton(int index) } else { - for (int i=0; i < joystick->NUMBER_JOYSETS; i++) + QHash::iterator set; + + for (set = joystick->getJoystick_sets().begin(); set != joystick->getJoystick_sets().end(); ++set) { - SetJoystick *currentset = joystick->getSetJoystick(i); + SetJoystick *currentset = set.value(); VDPad *vdpad = currentset->getVDPad(0); + if ((vdpad != nullptr) && vdpad->getVButton(JoyDPadButton::DpadRight)) { vdpad->removeVButton(JoyDPadButton::DpadRight); @@ -931,25 +825,27 @@ void AdvanceStickAssignmentDialog::openQuickAssignDialogStick1() QMessageBox msgBox; msgBox.setText(trUtf8("Move stick 1 along the X axis")); msgBox.setStandardButtons(QMessageBox::Close); - for (int i=0; i < joystick->getNumberAxes(); i++) + + for (int i = 0; i < joystick->getNumberAxes(); i++) { JoyAxis *axis = joystick->getActiveSetJoystick()->getJoyAxis(i); + if (axis != nullptr) { connect(axis, &JoyAxis::active, &msgBox, &QMessageBox::close); connect(axis, &JoyAxis::active, this, [this, axis] { - ui->xAxisOneComboBox->setCurrentIndex(axis->getRealJoyIndex()); }); } } msgBox.exec(); - msgBox.setText(trUtf8("Move stick 1 along the Y axis")); - for (int i=0; i < joystick->getNumberAxes(); i++) + + for (int i = 0; i < joystick->getNumberAxes(); i++) { JoyAxis *axis = joystick->getActiveSetJoystick()->getJoyAxis(i); + if (axis != nullptr) { disconnect(axis, &JoyAxis::active, &msgBox, &QMessageBox::close); @@ -963,9 +859,11 @@ void AdvanceStickAssignmentDialog::openQuickAssignDialogStick1() } msgBox.exec(); - for (int i=0; i < joystick->getNumberAxes(); i++) + + for (int i = 0; i < joystick->getNumberAxes(); i++) { JoyAxis *axis = joystick->getActiveSetJoystick()->getJoyAxis(i); + if (axis != nullptr) { disconnect(axis, &JoyAxis::active, &msgBox, &QMessageBox::close); @@ -981,9 +879,11 @@ void AdvanceStickAssignmentDialog::openQuickAssignDialogStick2() QMessageBox msgBox; msgBox.setText(trUtf8("Move stick 2 along the X axis")); msgBox.setStandardButtons(QMessageBox::Close); - for (int i=0; i < joystick->getNumberAxes(); i++) + + for (int i = 0; i < joystick->getNumberAxes(); i++) { JoyAxis *axis = joystick->getActiveSetJoystick()->getJoyAxis(i); + if (axis != nullptr) { connect(axis, &JoyAxis::active, &msgBox, &QMessageBox::close); @@ -994,10 +894,9 @@ void AdvanceStickAssignmentDialog::openQuickAssignDialogStick2() } msgBox.exec(); - - msgBox.setText(trUtf8("Move stick 2 along the Y axis")); - for (int i=0; i < joystick->getNumberAxes(); i++) + + for (int i = 0; i < joystick->getNumberAxes(); i++) { JoyAxis *axis = joystick->getActiveSetJoystick()->getJoyAxis(i); if (axis != nullptr) @@ -1013,9 +912,11 @@ void AdvanceStickAssignmentDialog::openQuickAssignDialogStick2() } msgBox.exec(); - for (int i=0; i < joystick->getNumberAxes(); i++) + + for (int i = 0; i < joystick->getNumberAxes(); i++) { JoyAxis *axis = joystick->getActiveSetJoystick()->getJoyAxis(i); + if (axis != nullptr) { disconnect(axis, &JoyAxis::active, &msgBox, &QMessageBox::close); @@ -1043,6 +944,7 @@ void AdvanceStickAssignmentDialog::openAssignVDPadUp() for (int i = 0; i < joystick->getNumberAxes(); i++) { JoyAxis *axis = joystick->getActiveSetJoystick()->getJoyAxis(i); + if ((axis != nullptr) && !axis->isPartControlStick()) { JoyAxisButton* axbtn = axis->getNAxisButton(); @@ -1062,6 +964,7 @@ void AdvanceStickAssignmentDialog::openAssignVDPadUp() for (int i = 0; i < joystick->getNumberButtons(); i++) { JoyButton *button = joystick->getActiveSetJoystick()->getJoyButton(i); + if (button != nullptr) { connect(button, &JoyButton::clicked, &msgBox, &QMessageBox::close); @@ -1076,6 +979,7 @@ void AdvanceStickAssignmentDialog::openAssignVDPadUp() for (int i = 0; i < joystick->getNumberAxes(); i++) { JoyAxis *axis = joystick->getActiveSetJoystick()->getJoyAxis(i); + if ((axis != nullptr) && !axis->isPartControlStick()) { disconnect(axis->getNAxisButton(), &JoyAxisButton::clicked, &msgBox, &QMessageBox::close); @@ -1089,6 +993,7 @@ void AdvanceStickAssignmentDialog::openAssignVDPadUp() for (int i = 0; i < joystick->getNumberButtons(); i++) { JoyButton *button = joystick->getActiveSetJoystick()->getJoyButton(i); + if (button != nullptr) { disconnect(button, &JoyButton::clicked, &msgBox, &QMessageBox::close); @@ -1108,6 +1013,7 @@ void AdvanceStickAssignmentDialog::openAssignVDPadDown() for (int i = 0; i < joystick->getNumberAxes(); i++) { JoyAxis *axis = joystick->getActiveSetJoystick()->getJoyAxis(i); + if ((axis != nullptr) && !axis->isPartControlStick()) { JoyAxisButton* axbtn = axis->getNAxisButton(); @@ -1127,6 +1033,7 @@ void AdvanceStickAssignmentDialog::openAssignVDPadDown() for (int i = 0; i < joystick->getNumberButtons(); i++) { JoyButton *button = joystick->getActiveSetJoystick()->getJoyButton(i); + if (button != nullptr) { connect(button, &JoyButton::clicked, &msgBox, &QMessageBox::close); @@ -1141,6 +1048,7 @@ void AdvanceStickAssignmentDialog::openAssignVDPadDown() for (int i = 0; i < joystick->getNumberAxes(); i++) { JoyAxis *axis = joystick->getActiveSetJoystick()->getJoyAxis(i); + if ((axis != nullptr) && !axis->isPartControlStick()) { disconnect(axis->getNAxisButton(), &JoyAxisButton::clicked, &msgBox, &QMessageBox::close); @@ -1154,6 +1062,7 @@ void AdvanceStickAssignmentDialog::openAssignVDPadDown() for (int i = 0; i < joystick->getNumberButtons(); i++) { JoyButton *button = joystick->getActiveSetJoystick()->getJoyButton(i); + if (button != nullptr) { disconnect(button, &JoyButton::clicked, &msgBox, &QMessageBox::close); @@ -1173,6 +1082,7 @@ void AdvanceStickAssignmentDialog::openAssignVDPadLeft() for (int i = 0; i < joystick->getNumberAxes(); i++) { JoyAxis *axis = joystick->getActiveSetJoystick()->getJoyAxis(i); + if ((axis != nullptr) && !axis->isPartControlStick()) { JoyAxisButton* joyaxisN = axis->getNAxisButton(); @@ -1192,6 +1102,7 @@ void AdvanceStickAssignmentDialog::openAssignVDPadLeft() for (int i = 0; i < joystick->getNumberButtons(); i++) { JoyButton *button = joystick->getActiveSetJoystick()->getJoyButton(i); + if (button != nullptr) { connect(button, &JoyButton::clicked, &msgBox, &QMessageBox::close); @@ -1206,6 +1117,7 @@ void AdvanceStickAssignmentDialog::openAssignVDPadLeft() for (int i = 0; i < joystick->getNumberAxes(); i++) { JoyAxis *axis = joystick->getActiveSetJoystick()->getJoyAxis(i); + if ((axis != nullptr) && !axis->isPartControlStick()) { disconnect(axis->getNAxisButton(), &JoyAxisButton::clicked, &msgBox, &QMessageBox::close); @@ -1219,6 +1131,7 @@ void AdvanceStickAssignmentDialog::openAssignVDPadLeft() for (int i = 0; i < joystick->getNumberButtons(); i++) { JoyButton *button = joystick->getActiveSetJoystick()->getJoyButton(i); + if (button != nullptr) { disconnect(button, &JoyButton::clicked, &msgBox, &QMessageBox::close); @@ -1239,6 +1152,7 @@ void AdvanceStickAssignmentDialog::openAssignVDPadRight() for (int i = 0; i < joystick->getNumberAxes(); i++) { JoyAxis *axis = joystick->getActiveSetJoystick()->getJoyAxis(i); + if ((axis != nullptr) && !axis->isPartControlStick()) { JoyAxisButton* joyaxisbtnN = axis->getNAxisButton(); @@ -1258,6 +1172,7 @@ void AdvanceStickAssignmentDialog::openAssignVDPadRight() for (int i = 0; i < joystick->getNumberButtons(); i++) { JoyButton *button = joystick->getActiveSetJoystick()->getJoyButton(i); + if (button != nullptr) { connect(button, &JoyButton::clicked, &msgBox, &QMessageBox::close); @@ -1272,6 +1187,7 @@ void AdvanceStickAssignmentDialog::openAssignVDPadRight() for (int i = 0; i < joystick->getNumberAxes(); i++) { JoyAxis *axis = joystick->getActiveSetJoystick()->getJoyAxis(i); + if ((axis != nullptr) && !axis->isPartControlStick()) { disconnect(axis->getNAxisButton(), &JoyAxisButton::clicked, &msgBox, &QMessageBox::close); @@ -1285,6 +1201,7 @@ void AdvanceStickAssignmentDialog::openAssignVDPadRight() for (int i = 0; i < joystick->getNumberButtons(); i++) { JoyButton *button = joystick->getActiveSetJoystick()->getJoyButton(i); + if (button != nullptr) { disconnect(button, &JoyButton::clicked, &msgBox, &QMessageBox::close); @@ -1299,16 +1216,12 @@ void AdvanceStickAssignmentDialog::quickAssignVDPadUp(JoyAxisButton* joyaxisbtn) QList templist; templist.append(QVariant(joyaxisbtn->getAxis()->getRealJoyIndex())); - if (joyaxisbtn->getAxis()->getNAxisButton() == joyaxisbtn) - { - templist.append(QVariant(0)); - } - else - { - templist.append(QVariant(1)); - } + + if (joyaxisbtn->getAxis()->getNAxisButton() == joyaxisbtn) templist.append(QVariant(0)); + else templist.append(QVariant(1)); int index = ui->vdpadUpComboBox->findData(templist); + if (index > 0) { ui->vdpadUpComboBox->setCurrentIndex(index); @@ -1324,6 +1237,7 @@ void AdvanceStickAssignmentDialog::quickAssignVDPadUpBtn(JoyButton* joybtn) { templist.append(QVariant(joybtn->getJoyNumber()+1)); int index = ui->vdpadUpComboBox->findData(templist); + if (index > 0) { ui->vdpadUpComboBox->setCurrentIndex(index); @@ -1337,20 +1251,13 @@ void AdvanceStickAssignmentDialog::quickAssignVDPadDown(JoyAxisButton* axbtn) QList templist; templist.append(QVariant(axbtn->getAxis()->getRealJoyIndex())); - if (axbtn->getAxis()->getNAxisButton() == axbtn) - { - templist.append(QVariant(0)); - } - else - { - templist.append(QVariant(1)); - } + + if (axbtn->getAxis()->getNAxisButton() == axbtn) templist.append(QVariant(0)); + else templist.append(QVariant(1)); int index = ui->vdpadDownComboBox->findData(templist); - if (index > 0) - { - ui->vdpadDownComboBox->setCurrentIndex(index); - } + + if (index > 0) ui->vdpadDownComboBox->setCurrentIndex(index); } void AdvanceStickAssignmentDialog::quickAssignVDPadDownJbtn(JoyButton* joybtn) @@ -1360,10 +1267,8 @@ void AdvanceStickAssignmentDialog::quickAssignVDPadDownJbtn(JoyButton* joybtn) templist.append(QVariant(joybtn->getJoyNumber()+1)); int index = ui->vdpadDownComboBox->findData(templist); - if (index > 0) - { - ui->vdpadDownComboBox->setCurrentIndex(index); - } + + if (index > 0) ui->vdpadDownComboBox->setCurrentIndex(index); } void AdvanceStickAssignmentDialog::quickAssignVDPadLeft(JoyAxisButton* joyaxisbtn) @@ -1372,20 +1277,13 @@ void AdvanceStickAssignmentDialog::quickAssignVDPadLeft(JoyAxisButton* joyaxisbt QList templist; templist.append(QVariant(joyaxisbtn->getAxis()->getRealJoyIndex())); - if (joyaxisbtn->getAxis()->getNAxisButton() == joyaxisbtn) - { - templist.append(QVariant(0)); - } - else - { - templist.append(QVariant(1)); - } + + if (joyaxisbtn->getAxis()->getNAxisButton() == joyaxisbtn) templist.append(QVariant(0)); + else templist.append(QVariant(1)); int index = ui->vdpadLeftComboBox->findData(templist); - if (index > 0) - { - ui->vdpadLeftComboBox->setCurrentIndex(index); - } + + if (index > 0) ui->vdpadLeftComboBox->setCurrentIndex(index); } void AdvanceStickAssignmentDialog::quickAssignVDPadLeftJbtn(JoyButton* joybtn) @@ -1395,10 +1293,8 @@ void AdvanceStickAssignmentDialog::quickAssignVDPadLeftJbtn(JoyButton* joybtn) templist.append(QVariant(joybtn->getJoyNumber() + 1)); int index = ui->vdpadLeftComboBox->findData(templist); - if (index > 0) - { - ui->vdpadLeftComboBox->setCurrentIndex(index); - } + + if (index > 0) ui->vdpadLeftComboBox->setCurrentIndex(index); } void AdvanceStickAssignmentDialog::quickAssignVDPadRight(JoyAxisButton* joyaxisbtn) @@ -1407,20 +1303,13 @@ void AdvanceStickAssignmentDialog::quickAssignVDPadRight(JoyAxisButton* joyaxisb QList templist; templist.append(QVariant(joyaxisbtn->getAxis()->getRealJoyIndex())); - if (joyaxisbtn->getAxis()->getNAxisButton() == joyaxisbtn) - { - templist.append(QVariant(0)); - } - else - { - templist.append(QVariant(1)); - } + + if (joyaxisbtn->getAxis()->getNAxisButton() == joyaxisbtn) templist.append(QVariant(0)); + else templist.append(QVariant(1)); int index = ui->vdpadRightComboBox->findData(templist); - if (index > 0) - { - ui->vdpadRightComboBox->setCurrentIndex(index); - } + + if (index > 0) ui->vdpadRightComboBox->setCurrentIndex(index); } void AdvanceStickAssignmentDialog::quickAssignVDPadRightJbtn(JoyButton* joybtn) @@ -1430,10 +1319,8 @@ void AdvanceStickAssignmentDialog::quickAssignVDPadRightJbtn(JoyButton* joybtn) templist.append(QVariant(joybtn->getJoyNumber()+1)); int index = ui->vdpadRightComboBox->findData(templist); - if (index > 0) - { - ui->vdpadRightComboBox->setCurrentIndex(index); - } + + if (index > 0) ui->vdpadRightComboBox->setCurrentIndex(index); } Joystick *AdvanceStickAssignmentDialog::getJoystick() const { diff --git a/src/advancestickassignmentdialog.h b/src/advancestickassignmentdialog.h old mode 100644 new mode 100755 index c34823b15..4dc861a02 --- a/src/advancestickassignmentdialog.h +++ b/src/advancestickassignmentdialog.h @@ -23,7 +23,9 @@ class Joystick; class JoyAxisButton; class JoyButton; - +class QComboBox; +class QCheckBox; +class JoyControlStick; namespace Ui { class AdvanceStickAssignmentDialog; @@ -45,15 +47,15 @@ class AdvanceStickAssignmentDialog : public QDialog void vdpadConfigurationChanged(); private slots: - void refreshStickConfiguration(); - void refreshVDPadConfiguration(); + void refreshStickConfiguration(JoyControlStick *stick1, JoyControlStick *stick2); + void refreshVDPadsConfiguration(); void checkForAxisAssignmentStickOne(QWidget* comboBox); void checkForAxisAssignmentStickTwo(QWidget* comboBox); void changeStateStickOneWidgets(bool enabled); void changeStateStickTwoWidgets(bool enabled); - void changeStateVDPadWidgets(bool enabled); + void changeStateVDPadWidgets(bool enabledVDPads); void populateDPadComboBoxes(); @@ -89,6 +91,9 @@ private slots: Joystick *joystick; + void checkForAxisAssignmentSticks(QWidget* comboBox, QComboBox* xAxisComboBox, QComboBox* yAxisComboBox, int controlStickNumber); + void refreshSticksForAxes(bool axesExist, int xAxisComboBoxIndex, int yAxisComboBoxIndex, QComboBox* xAxisComboBox, QComboBox* yAxisComboBox, QCheckBox* enabledSticksCheckbox, QPushButton* quickAssignBtn); + void refreshVDPadConf(JoyButton *vdpadButton, QComboBox* vpadComboBox); }; #endif // ADVANCESTICKASSIGNMENTDIALOG_H diff --git a/src/advancestickassignmentdialog.ui b/src/advancestickassignmentdialog.ui old mode 100644 new mode 100755 diff --git a/src/antimicro.exe.manifest b/src/antimicro.exe.manifest old mode 100644 new mode 100755 diff --git a/src/antimicro.exe.uiaccess.manifest b/src/antimicro.exe.uiaccess.manifest old mode 100644 new mode 100755 diff --git a/src/antimicro.rc b/src/antimicro.rc old mode 100644 new mode 100755 index 8ee7fabe2..a836b9717 --- a/src/antimicro.rc +++ b/src/antimicro.rc @@ -1,6 +1,6 @@ #include "winuser.h" - IDI_ICON1 ICON DISCARDABLE "images/antimicro.ico" + IDI_ICON1 ICON DISCARDABLE "images/32x32/antimicro.ico" #ifndef PERFORM_SIGNING CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "antimicro.exe.manifest" #else diff --git a/src/antimicrosettings.cpp b/src/antimicrosettings.cpp old mode 100644 new mode 100755 index c4ae36809..cfb73f7c0 --- a/src/antimicrosettings.cpp +++ b/src/antimicrosettings.cpp @@ -21,10 +21,6 @@ #include -const bool AntiMicroSettings::defaultDisabledWinEnhanced = false; -const bool AntiMicroSettings::defaultAssociateProfiles = true; -const int AntiMicroSettings::defaultSpringScreen = -1; -const int AntiMicroSettings::defaultSDLGamepadPollRate = 10; // unsigned AntiMicroSettings::AntiMicroSettings(const QString &fileName, Format format, QObject *parent) : QSettings(fileName, format, parent) @@ -46,14 +42,9 @@ QVariant AntiMicroSettings::runtimeValue(const QString &key, const QVariant &def QVariant settingValue; QString inGroup = group(); QString fullKey = QString(inGroup).append("/").append(key); - if (cmdSettings.contains(fullKey)) - { - settingValue = cmdSettings.value(fullKey, defaultValue); - } - else - { - settingValue = value(key, defaultValue); - } + + if (cmdSettings.contains(fullKey)) settingValue = cmdSettings.value(fullKey, defaultValue); + else settingValue = value(key, defaultValue); return settingValue; } diff --git a/src/antimicrosettings.h b/src/antimicrosettings.h old mode 100644 new mode 100755 index 67d98568c..1a76a876e --- a/src/antimicrosettings.h +++ b/src/antimicrosettings.h @@ -37,11 +37,6 @@ class AntiMicroSettings : public QSettings QMutex* getLock(); QSettings& getCmdSettings(); - static const bool defaultDisabledWinEnhanced; - static const bool defaultAssociateProfiles; - static const int defaultSpringScreen; - static const int defaultSDLGamepadPollRate; // unsigned - protected: QSettings cmdSettings; QMutex lock; diff --git a/src/antkeymapper.cpp b/src/antkeymapper.cpp old mode 100644 new mode 100755 diff --git a/src/antkeymapper.h b/src/antkeymapper.h old mode 100644 new mode 100755 diff --git a/src/applaunchhelper.cpp b/src/applaunchhelper.cpp old mode 100644 new mode 100755 index 932adf5bc..1a61756a3 --- a/src/applaunchhelper.cpp +++ b/src/applaunchhelper.cpp @@ -17,6 +17,7 @@ #include "applaunchhelper.h" +#include "globalvariables.h" #include "messagehandler.h" #include "inputdevice.h" #include "joybutton.h" @@ -66,18 +67,21 @@ void AppLaunchHelper::enablePossibleMouseSmoothing() qInstallMessageHandler(MessageHandler::myMessageOutput); bool smoothingEnabled = settings->value("Mouse/Smoothing", false).toBool(); + if (smoothingEnabled) { int historySize = settings->value("Mouse/HistorySize", 0).toInt(); + if (historySize > 0) { - JoyButton::setMouseHistorySize(historySize); + JoyButton::setMouseHistorySize(historySize, GlobalVariables::JoyButton::MAXIMUMMOUSEHISTORYSIZE, GlobalVariables::JoyButton::mouseHistorySize, &GlobalVariables::JoyButton::mouseHistoryX, &GlobalVariables::JoyButton::mouseHistoryY); } double weightModifier = settings->value("Mouse/WeightModifier", 0.0).toDouble(); + if (weightModifier > 0.0) { - JoyButton::setWeightModifier(weightModifier); + JoyButton::setWeightModifier(weightModifier, GlobalVariables::JoyButton::MAXIMUMWEIGHTMODIFIER, GlobalVariables::JoyButton::weightModifier); } } } @@ -87,9 +91,10 @@ void AppLaunchHelper::changeMouseRefreshRate() qInstallMessageHandler(MessageHandler::myMessageOutput); int refreshRate = settings->value("Mouse/RefreshRate", 0).toInt(); + if (refreshRate > 0) { - JoyButton::setMouseRefreshRate(refreshRate); + JoyButton::setMouseRefreshRate(refreshRate, GlobalVariables::JoyButton::mouseRefreshRate, GlobalVariables::JoyButton::IDLEMOUSEREFRESHRATE, JoyButton::getMouseHelper(), &GlobalVariables::JoyButton::mouseHistoryX, &GlobalVariables::JoyButton::mouseHistoryY, JoyButton::getTestOldMouseTime(), JoyButton::getStaticMouseEventTimer()); } } @@ -98,10 +103,10 @@ void AppLaunchHelper::changeGamepadPollRate() qInstallMessageHandler(MessageHandler::myMessageOutput); int pollRate = settings->value("GamepadPollRate", - AntiMicroSettings::defaultSDLGamepadPollRate).toInt(); + GlobalVariables::AntimicroSettings::defaultSDLGamepadPollRate).toInt(); if (pollRate > 0) { - JoyButton::setGamepadRefreshRate(pollRate); + JoyButton::setGamepadRefreshRate(pollRate, GlobalVariables::JoyButton::gamepadRefreshRate, JoyButton::getMouseHelper()); } } @@ -117,6 +122,7 @@ void AppLaunchHelper::printControllerList(QMap *j outstream << QObject::trUtf8("---------------") << endl; QMapIterator iter(*joysticks); int indexNumber = 1; + while (iter.hasNext()) { InputDevice *tempdevice = iter.next().value(); @@ -146,18 +152,19 @@ void AppLaunchHelper::changeSpringModeScreen() QDesktopWidget deskWid; int springScreen = settings->value("Mouse/SpringScreen", - AntiMicroSettings::defaultSpringScreen).toInt(); + GlobalVariables::AntimicroSettings::defaultSpringScreen).toInt(); if (springScreen >= deskWid.screenCount()) { springScreen = -1; settings->setValue("Mouse/SpringScreen", - AntiMicroSettings::defaultSpringScreen); + GlobalVariables::AntimicroSettings::defaultSpringScreen); settings->sync(); } - JoyButton::setSpringModeScreen(springScreen); + JoyButton::setSpringModeScreen(springScreen, GlobalVariables::JoyButton::springModeScreen); } + #ifdef Q_OS_WIN void AppLaunchHelper::checkPointerPrecision() { @@ -165,7 +172,7 @@ void AppLaunchHelper::checkPointerPrecision() qInstallMessageHandler(MessageHandler::myMessageOutput); WinExtras::grabCurrentPointerPrecision(); bool disableEnhandedPoint = settings->value("Mouse/DisableWinEnhancedPointer", - AntiMicroSettings::defaultDisabledWinEnhanced).toBool(); + GlobalVariables::defaultDisabledWinEnhanced).toBool(); if (disableEnhandedPoint) { WinExtras::disablePointerPrecision(); @@ -177,7 +184,7 @@ void AppLaunchHelper::appQuitPointerPrecision() qInstallMessageHandler(MessageHandler::myMessageOutput); bool disableEnhancedPoint = settings->value("Mouse/DisableWinEnhancedPointer", - AntiMicroSettings::defaultDisabledWinEnhanced).toBool(); + GlobalVariables::defaultDisabledWinEnhanced).toBool(); if (disableEnhancedPoint && !WinExtras::isUsingEnhancedPointerPrecision()) { WinExtras::enablePointerPrecision(); @@ -190,14 +197,14 @@ void AppLaunchHelper::revertMouseThread() { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyButton::indirectStaticMouseThread(QThread::currentThread()); + JoyButton::indirectStaticMouseThread(QThread::currentThread(), JoyButton::getStaticMouseEventTimer(), JoyButton::getMouseHelper()); } void AppLaunchHelper::changeMouseThread(QThread *thread) { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyButton::setStaticMouseThread(thread); + JoyButton::setStaticMouseThread(thread, JoyButton::getStaticMouseEventTimer(), JoyButton::getTestOldMouseTime(), GlobalVariables::JoyButton::IDLEMOUSEREFRESHRATE, JoyButton::getMouseHelper()); } void AppLaunchHelper::establishMouseTimerConnections() diff --git a/src/applaunchhelper.h b/src/applaunchhelper.h old mode 100644 new mode 100755 diff --git a/src/autoprofileinfo.cpp b/src/autoprofileinfo.cpp old mode 100644 new mode 100755 index 97abe6470..712f49ada --- a/src/autoprofileinfo.cpp +++ b/src/autoprofileinfo.cpp @@ -110,6 +110,7 @@ void AutoProfileInfo::setExe(QString exe) if (!exe.isEmpty()) { QFileInfo info(exe); + if ((exe != this->exe) && info.exists() && info.isExecutable()) { this->exe = exe; diff --git a/src/autoprofileinfo.h b/src/autoprofileinfo.h old mode 100644 new mode 100755 diff --git a/src/autoprofilewatcher.cpp b/src/autoprofilewatcher.cpp old mode 100644 new mode 100755 index 3f90b3f36..14f0a43d2 --- a/src/autoprofilewatcher.cpp +++ b/src/autoprofilewatcher.cpp @@ -37,6 +37,10 @@ #endif +AutoProfileWatcher* AutoProfileWatcher::_instance = nullptr; +QTimer AutoProfileWatcher::checkWindowTimer; + + AutoProfileWatcher::AutoProfileWatcher(AntiMicroSettings *settings, QObject *parent) : QObject(parent) { @@ -45,28 +49,47 @@ AutoProfileWatcher::AutoProfileWatcher(AntiMicroSettings *settings, QObject *par this->settings = settings; allDefaultInfo = nullptr; currentApplication = ""; + _instance = this; syncProfileAssignment(); - checkWindowTimer.setInterval(1000); - checkWindowTimer.start(); + connect(&(checkWindowTimer), &QTimer::timeout, _instance, &AutoProfileWatcher::runAppCheck); +} + +AutoProfileWatcher::~AutoProfileWatcher() +{ + if (checkWindowTimer.isActive()) { - connect(&(checkWindowTimer), &QTimer::timeout, this, &AutoProfileWatcher::runAppCheck); + checkWindowTimer.stop(); + disconnect(&(checkWindowTimer), &QTimer::timeout, _instance, nullptr); + } + _instance = nullptr; +} + +AutoProfileWatcher* AutoProfileWatcher::getAutoProfileWatcherInstance() +{ + return _instance; +} + +void AutoProfileWatcher::disconnectWindowTimer() +{ + checkWindowTimer.stop(); + disconnect(&(checkWindowTimer), &QTimer::timeout, _instance, nullptr); } void AutoProfileWatcher::startTimer() { qInstallMessageHandler(MessageHandler::myMessageOutput); - appTimer.start(CHECKTIME); + checkWindowTimer.start(CHECKTIME); } void AutoProfileWatcher::stopTimer() { qInstallMessageHandler(MessageHandler::myMessageOutput); - appTimer.stop(); + checkWindowTimer.stop(); } void AutoProfileWatcher::runAppCheck() @@ -74,7 +97,7 @@ void AutoProfileWatcher::runAppCheck() qInstallMessageHandler(MessageHandler::myMessageOutput); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << qApp->applicationFilePath(); + qDebug() << qApp->applicationFilePath(); #endif QString appLocation = QString(); @@ -100,7 +123,6 @@ void AutoProfileWatcher::runAppCheck() // More portable check for whether antimicro is the current application // with focus. QWidget *focusedWidget = qApp->activeWindow(); - QString nowWindow = QString(); QString nowWindowClass = QString(); QString nowWindowName = QString(); @@ -109,21 +131,21 @@ void AutoProfileWatcher::runAppCheck() nowWindowName = WinExtras::getCurrentWindowText(); #elif defined(Q_OS_UNIX) - long currentWindow = static_cast(X11Extras::getInstance()->getWindowInFocus()); + long currentWindow = X11Extras::getInstance()->getWindowInFocus(); + if (currentWindow > 0) { - long tempWindow = static_cast(X11Extras::getInstance()->findParentClient(static_cast(currentWindow))); - if (tempWindow > 0) - { - currentWindow = tempWindow; - } + long tempWindow = X11Extras::getInstance()->findParentClient(currentWindow); + + if (tempWindow > 0) currentWindow = tempWindow; + nowWindow = QString::number(currentWindow); nowWindowClass = X11Extras::getInstance()->getWindowClass(static_cast(currentWindow)); nowWindowName = X11Extras::getInstance()->getWindowTitle(static_cast(currentWindow)); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << nowWindowClass; - qDebug() << nowWindowName; + qDebug() << nowWindowClass; + qDebug() << nowWindowName; #endif } #endif @@ -155,9 +177,9 @@ void AutoProfileWatcher::runAppCheck() currentAppWindowTitle = nowWindowName; - Logger::LogDebug(QObject::trUtf8("Active window changed to: Title = \"%1\", " - "Class = \"%2\", Program = \"%3\" or \"%4\"."). - arg(nowWindowName, nowWindowClass, appLocation, baseAppFileName)); + Logger::LogDebug(QObject::trUtf8("Active window changed to: Title = \"%1\", " + "Class = \"%2\", Program = \"%3\" or \"%4\"."). + arg(nowWindowName, nowWindowClass, appLocation, baseAppFileName)); QSet fullSet; @@ -274,27 +296,25 @@ void AutoProfileWatcher::runAppCheck() } - if (numProps == numMatched) + if (numProps == numMatched && highestMatchCount.contains(info->getGUID())) { - if (highestMatchCount.contains(info->getGUID())) - { - int currentHigh = highestMatchCount.value(info->getGUID()); - if (numMatched > currentHigh) - { - highestMatchCount.insert(info->getGUID(), numMatched); - highestMatches.insert(info->getGUID(), info); - } - } - else + int currentHigh = highestMatchCount.value(info->getGUID()); + if (numMatched > currentHigh) { highestMatchCount.insert(info->getGUID(), numMatched); highestMatches.insert(info->getGUID(), info); } } + else if (numProps == numMatched && !highestMatchCount.contains(info->getGUID())) + { + highestMatchCount.insert(info->getGUID(), numMatched); + highestMatches.insert(info->getGUID(), info); + } } } QHashIterator highIter(highestMatches); + while (highIter.hasNext()) { AutoProfileInfo *info = highIter.next().value(); @@ -304,19 +324,18 @@ void AutoProfileWatcher::runAppCheck() if ((!getDefaultProfileAssignments().isEmpty() || allDefaultInfo) && !focusedWidget) { - if (allDefaultInfo != nullptr) + if (allDefaultInfo != nullptr && allDefaultInfo->isActive() && !getGuidSetLocal().contains("all")) { - if (allDefaultInfo->isActive() && !getGuidSetLocal().contains("all")) - { - emit foundApplicableProfile(allDefaultInfo); - } + emit foundApplicableProfile(allDefaultInfo); } QHashIterator iter(getDefaultProfileAssignments()); + while (iter.hasNext()) { iter.next(); AutoProfileInfo *info = iter.value(); + if (info->isActive() && !getGuidSetLocal().contains(info->getGUID())) { emit foundApplicableProfile(info); @@ -352,6 +371,7 @@ void AutoProfileWatcher::syncProfileAssignment() // Handle overall Default profile assignment bool defaultActive = allActive == "1" ? true : false; + if (defaultActive) { allDefaultInfo = new AutoProfileInfo("all", allProfile, defaultActive, 0, this); @@ -360,17 +380,18 @@ void AutoProfileWatcher::syncProfileAssignment() // Handle device specific Default profile assignments QStringListIterator iter(registeredGUIDs); + while (iter.hasNext()) { QString tempkey = iter.next(); QString guid = QString(tempkey).replace("GUID", ""); - QString profile = settings->value(QString("DefaultAutoProfile-%1/Profile").arg(guid), "").toString(); QString active = settings->value(QString("DefaultAutoProfile-%1/Active").arg(guid), "").toString(); if (!guid.isEmpty() && !profile.isEmpty()) { bool profileActive = active == "1" ? true : false; + if (profileActive && guid != "all") { AutoProfileInfo *info = new AutoProfileInfo(guid, profile, profileActive, 0, this); @@ -406,6 +427,7 @@ void AutoProfileWatcher::syncProfileAssignment() !guid.isEmpty()) { bool profileActive = active == "1" ? true : false; + if (profileActive) { AutoProfileInfo *info = new AutoProfileInfo(guid, profile, profileActive, partialTitleBool, this); @@ -415,16 +437,14 @@ void AutoProfileWatcher::syncProfileAssignment() info->setWindowClass(windowClass); QList templist; + if (getWindowClassProfileAssignments().contains(windowClass)) - { templist = getWindowClassProfileAssignments().value(windowClass); - } templist.append(info); windowClassProfileAssignments.insert(windowClass, templist); } - // look here! // partly watching is needed for window title if (!windowName.isEmpty()) { @@ -440,7 +460,6 @@ void AutoProfileWatcher::syncProfileAssignment() while(windows.hasNext()) { windows.next(); - qDebug() << windows.key(); } @@ -463,22 +482,20 @@ void AutoProfileWatcher::syncProfileAssignment() info->setExe(exe); QList templist; + if (getAppProfileAssignments().contains(exe)) - { templist = getAppProfileAssignments().value(exe); - } templist.append(info); appProfileAssignments.insert(exe, templist); - QString baseExe = QFileInfo(exe).fileName(); + if (!baseExe.isEmpty() && baseExe != exe) { QList templist; + if (getAppProfileAssignments().contains(baseExe)) - { templist = getAppProfileAssignments().value(baseExe); - } templist.append(info); appProfileAssignments.insert(baseExe, templist); @@ -501,36 +518,42 @@ void AutoProfileWatcher::clearProfileAssignments() qInstallMessageHandler(MessageHandler::myMessageOutput); QSet terminateProfiles; - QListIterator > iterDelete(getAppProfileAssignments().values()); + while (iterDelete.hasNext()) { QList templist = iterDelete.next(); terminateProfiles.unite(templist.toSet()); } + appProfileAssignments.clear(); QListIterator > iterClassDelete(getWindowClassProfileAssignments().values()); + while (iterClassDelete.hasNext()) { QList templist = iterClassDelete.next(); terminateProfiles.unite(templist.toSet()); } + windowClassProfileAssignments.clear(); QListIterator > iterNameDelete(getWindowNameProfileAssignments().values()); + while (iterNameDelete.hasNext()) { QList templist = iterNameDelete.next(); terminateProfiles.unite(templist.toSet()); } + windowNameProfileAssignments.clear(); QSetIterator iterTerminate(terminateProfiles); + while (iterTerminate.hasNext()) { AutoProfileInfo *info = iterTerminate.next(); - if (info) + if (info != nullptr) { delete info; info = nullptr; @@ -538,17 +561,18 @@ void AutoProfileWatcher::clearProfileAssignments() } QListIterator iterDefaultsDelete(getDefaultProfileAssignments().values()); + while (iterDefaultsDelete.hasNext()) { AutoProfileInfo *info = iterDefaultsDelete.next(); - if (info) + if (info != nullptr) { delete info; info = nullptr; } } - defaultProfileAssignments.clear(); + defaultProfileAssignments.clear(); allDefaultInfo = nullptr; getGuidSetLocal().clear(); } @@ -565,15 +589,8 @@ QString AutoProfileWatcher::findAppLocation() int pid = 0; currentWindow = X11Extras::getInstance()->getWindowInFocus(); - if (currentWindow) - { - pid = X11Extras::getInstance()->getApplicationPid(currentWindow); - } - - if (pid > 0) - { - exepath = X11Extras::getInstance()->getApplicationLocation(pid); - } + if (currentWindow) pid = X11Extras::getInstance()->getApplicationPid(currentWindow); + if (pid > 0) exepath = X11Extras::getInstance()->getApplicationLocation(pid); #endif #elif defined(Q_OS_WIN) @@ -592,11 +609,13 @@ QList* AutoProfileWatcher::getCustomDefaults() QList *temp = new QList(); QHashIterator iter(getDefaultProfileAssignments()); + while (iter.hasNext()) { iter.next(); temp->append(iter.value()); } + return temp; } diff --git a/src/autoprofilewatcher.h b/src/autoprofilewatcher.h old mode 100644 new mode 100755 index 141fa546c..a9bc376b5 --- a/src/autoprofilewatcher.h +++ b/src/autoprofilewatcher.h @@ -33,8 +33,12 @@ class AutoProfileWatcher : public QObject public: explicit AutoProfileWatcher(AntiMicroSettings *settings, QObject *parent = nullptr); + ~AutoProfileWatcher(); + void startTimer(); void stopTimer(); + static void disconnectWindowTimer(); + static AutoProfileWatcher* getAutoProfileWatcherInstance(); QList* getCustomDefaults(); AutoProfileInfo* getDefaultAllProfile(); bool isGUIDLocked(QString guid); @@ -45,6 +49,7 @@ class AutoProfileWatcher : public QObject static const int CHECKTIME = 500; // time in ms + protected: QString findAppLocation(); void clearProfileAssignments(); @@ -61,8 +66,8 @@ private slots: private: QSet& getGuidSetLocal(); - QTimer appTimer; - QTimer checkWindowTimer; + static AutoProfileWatcher* _instance; + static QTimer checkWindowTimer; AntiMicroSettings *settings; QHash > appProfileAssignments; QHash > windowClassProfileAssignments; diff --git a/src/axiseditdialog.cpp b/src/axiseditdialog.cpp old mode 100644 new mode 100755 index 1fb8090eb..2b7eb0d9f --- a/src/axiseditdialog.cpp +++ b/src/axiseditdialog.cpp @@ -41,27 +41,23 @@ AxisEditDialog::AxisEditDialog(JoyAxis *axis, QWidget *parent) : { ui->setupUi(this); qInstallMessageHandler(MessageHandler::myMessageOutput); - setAttribute(Qt::WA_DeleteOnClose); setAxisThrottleConfirm = new SetAxisThrottleDialog(axis, this); - - this->axis = axis; + m_axis = axis; updateWindowTitleAxisName(); initialThrottleState = axis->getThrottle(); bool actAsTrigger = false; + if ((initialThrottleState == static_cast(JoyAxis::PositiveThrottle)) || (initialThrottleState == static_cast(JoyAxis::PositiveHalfThrottle))) { actAsTrigger = true; } - if (actAsTrigger) - { - buildTriggerPresetsMenu(); - } + if (actAsTrigger) buildTriggerPresetsMenu(); ui->horizontalSlider->setValue(axis->getDeadZone()); ui->lineEdit->setText(QString::number(axis->getDeadZone())); @@ -115,19 +111,11 @@ AxisEditDialog::AxisEditDialog(JoyAxis *axis, QWidget *parent) : ui->joyValueLabel->setText(QString::number(axis->getCurrentRawValue())); ui->axisstatusBox->setValue(axis->getCurrentRawValue()); - if (!actAsTrigger) - { - selectAxisCurrentPreset(); - } - else - { - selectTriggerPreset(); - } + if (!actAsTrigger) selectAxisCurrentPreset(); + else selectTriggerPreset(); ui->axisNameLineEdit->setText(axis->getAxisName()); - - connect(ui->presetsComboBox, static_cast(&QComboBox::currentIndexChanged), this, &AxisEditDialog::implementPresets); connect(ui->horizontalSlider, &QSlider::valueChanged, this, &AxisEditDialog::updateDeadZoneBox); @@ -178,21 +166,16 @@ void AxisEditDialog::implementPresets(int index) qInstallMessageHandler(MessageHandler::myMessageOutput); bool actAsTrigger = false; - int currentThrottle = axis->getThrottle(); + int currentThrottle = m_axis->getThrottle(); + if ((currentThrottle == static_cast(JoyAxis::PositiveThrottle)) || (currentThrottle == static_cast(JoyAxis::PositiveHalfThrottle))) { actAsTrigger = true; } - if (actAsTrigger) - { - implementTriggerPresets(index); - } - else - { - implementAxisPresets(index); - } + if (actAsTrigger) implementTriggerPresets(index); + else implementAxisPresets(index); } void AxisEditDialog::implementAxisPresets(int index) @@ -203,74 +186,78 @@ void AxisEditDialog::implementAxisPresets(int index) JoyButtonSlot *pbuttonslot = nullptr; PadderCommon::lockInputDevices(); - InputDevice *tempDevice = axis->getParentSet()->getInputDevice(); + InputDevice *tempDevice = m_axis->getParentSet()->getInputDevice(); QMetaObject::invokeMethod(tempDevice, "haltServices", Qt::BlockingQueuedConnection); - if (index == 1) - { - nbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - } - else if (index == 2) - { - nbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - } - else if (index == 3) - { - nbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - } - else if (index == 4) - { - nbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - } - else if (index == 5) - { - nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Up), Qt::Key_Up, JoyButtonSlot::JoyKeyboard, this); - pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Down), Qt::Key_Down, JoyButtonSlot::JoyKeyboard, this); - } - else if (index == 6) - { - nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Left), Qt::Key_Left, JoyButtonSlot::JoyKeyboard, this); - pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Right), Qt::Key_Right, JoyButtonSlot::JoyKeyboard, this); - } - else if (index == 7) - { - nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_W), Qt::Key_W, JoyButtonSlot::JoyKeyboard, this); - pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_S), Qt::Key_S, JoyButtonSlot::JoyKeyboard, this); - } - else if (index == 8) - { - nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_A), Qt::Key_A, JoyButtonSlot::JoyKeyboard, this); - pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_D), Qt::Key_D, JoyButtonSlot::JoyKeyboard, this); - } - else if (index == 9) - { - nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); - pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); - } - else if (index == 10) - { - nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); - pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); - } - else if (index == 11) - { - JoyAxisButton *nbutton = axis->getNAxisButton(); - JoyAxisButton *pbutton = axis->getPAxisButton(); + switch(index) + { + case 1: + nbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + break; + + case 2: + nbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + break; + + case 3: + nbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + break; + + case 4: + nbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + break; + + case 5: + nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Up), Qt::Key_Up, JoyButtonSlot::JoyKeyboard, this); + pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Down), Qt::Key_Down, JoyButtonSlot::JoyKeyboard, this); + break; + + case 6: + nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Left), Qt::Key_Left, JoyButtonSlot::JoyKeyboard, this); + pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Right), Qt::Key_Right, JoyButtonSlot::JoyKeyboard, this); + break; + + case 7: + nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_W), Qt::Key_W, JoyButtonSlot::JoyKeyboard, this); + pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_S), Qt::Key_S, JoyButtonSlot::JoyKeyboard, this); + break; + + case 8: + nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_A), Qt::Key_A, JoyButtonSlot::JoyKeyboard, this); + pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_D), Qt::Key_D, JoyButtonSlot::JoyKeyboard, this); + break; + + case 9: + nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); + pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); + break; + + case 10: + nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); + pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); + break; + + case 11: + JoyAxisButton *nbutton = m_axis->getNAxisButton(); + JoyAxisButton *pbutton = m_axis->getPAxisButton(); + + QMetaObject::invokeMethod(nbutton, "clearSlotsEventReset"); + QMetaObject::invokeMethod(pbutton, "clearSlotsEventReset", Qt::BlockingQueuedConnection); - QMetaObject::invokeMethod(nbutton, "clearSlotsEventReset"); - QMetaObject::invokeMethod(pbutton, "clearSlotsEventReset", Qt::BlockingQueuedConnection); + refreshNButtonLabel(); + refreshPButtonLabel(); + break; - refreshNButtonLabel(); - refreshPButtonLabel(); } + if (nbuttonslot != nullptr) { - JoyAxisButton *button = axis->getNAxisButton(); + JoyAxisButton *button = m_axis->getNAxisButton(); QMetaObject::invokeMethod(button, "clearSlotsEventReset", Q_ARG(bool, false)); @@ -285,7 +272,7 @@ void AxisEditDialog::implementAxisPresets(int index) if (pbuttonslot != nullptr) { - JoyAxisButton *button = axis->getPAxisButton(); + JoyAxisButton *button = m_axis->getPAxisButton(); QMetaObject::invokeMethod(button, "clearSlotsEventReset", Q_ARG(bool, false)); QMetaObject::invokeMethod(button, "setAssignedSlot", Qt::BlockingQueuedConnection, @@ -319,6 +306,7 @@ void AxisEditDialog::updateThrottleUi(int index) qInstallMessageHandler(MessageHandler::myMessageOutput); int tempthrottle = 0; + if ((index == 0) || (index == 1)) { ui->nPushButton->setEnabled(true); @@ -338,7 +326,7 @@ void AxisEditDialog::updateThrottleUi(int index) tempthrottle = (index == 3) ? static_cast(JoyAxis::PositiveThrottle) : static_cast(JoyAxis::PositiveHalfThrottle); } - axis->setThrottle(tempthrottle); + m_axis->setThrottle(tempthrottle); ui->axisstatusBox->setThrottle(tempthrottle); } @@ -354,7 +342,8 @@ void AxisEditDialog::updateDeadZoneSlider(QString value) qInstallMessageHandler(MessageHandler::myMessageOutput); int temp = value.toInt(); - if ((temp >= this->axis->getAxisMinCal()) && (temp <= this->axis->getAxisMaxCal())) + + if ((temp >= m_axis->getAxisMinCal()) && (temp <= m_axis->getAxisMaxCal())) { ui->horizontalSlider->setValue(temp); } @@ -365,7 +354,8 @@ void AxisEditDialog::updateMaxZoneSlider(QString value) qInstallMessageHandler(MessageHandler::myMessageOutput); int temp = value.toInt(); - if ((temp >= this->axis->getAxisMinCal()) && (temp <= this->axis->getAxisMaxCal())) + + if ((temp >= m_axis->getAxisMinCal()) && (temp <= m_axis->getAxisMaxCal())) { ui->horizontalSlider_2->setValue(temp); } @@ -375,7 +365,7 @@ void AxisEditDialog::openAdvancedPDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); - ButtonEditDialog *dialog = new ButtonEditDialog(axis->getPAxisButton(), axis->getControlStick()->getParentSet()->getInputDevice(), this); + ButtonEditDialog *dialog = new ButtonEditDialog(m_axis->getPAxisButton(), m_axis->getPAxisButton()->getParentSet()->getInputDevice(), this); dialog->show(); connect(dialog, &ButtonEditDialog::finished, this, &AxisEditDialog::refreshPButtonLabel); @@ -386,7 +376,7 @@ void AxisEditDialog::openAdvancedNDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); - ButtonEditDialog *dialog = new ButtonEditDialog(axis->getNAxisButton(), axis->getControlStick()->getParentSet()->getInputDevice(), this); + ButtonEditDialog *dialog = new ButtonEditDialog(m_axis->getNAxisButton(), m_axis->getNAxisButton()->getParentSet()->getInputDevice(), this); dialog->show(); connect(dialog, &ButtonEditDialog::finished, this, &AxisEditDialog::refreshNButtonLabel); @@ -397,14 +387,14 @@ void AxisEditDialog::refreshNButtonLabel() { qInstallMessageHandler(MessageHandler::myMessageOutput); - ui->nPushButton->setText(axis->getNAxisButton()->getSlotsSummary()); + ui->nPushButton->setText(m_axis->getNAxisButton()->getSlotsSummary()); } void AxisEditDialog::refreshPButtonLabel() { qInstallMessageHandler(MessageHandler::myMessageOutput); - ui->pPushButton->setText(axis->getPAxisButton()->getSlotsSummary()); + ui->pPushButton->setText(m_axis->getPAxisButton()->getSlotsSummary()); } @@ -412,25 +402,24 @@ void AxisEditDialog::checkFinalSettings() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (axis->getThrottle() != initialThrottleState) - { + if (m_axis->getThrottle() != initialThrottleState) setAxisThrottleConfirm->exec(); - } } void AxisEditDialog::selectAxisCurrentPreset() { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyAxisButton *naxisbutton = axis->getNAxisButton(); + JoyAxisButton *naxisbutton = m_axis->getNAxisButton(); QList *naxisslots = naxisbutton->getAssignedSlots(); - JoyAxisButton *paxisbutton = axis->getPAxisButton(); + JoyAxisButton *paxisbutton = m_axis->getPAxisButton(); QList *paxisslots = paxisbutton->getAssignedSlots(); if ((naxisslots->length() == 1) && (paxisslots->length() == 1)) { JoyButtonSlot *nslot = naxisslots->at(0); JoyButtonSlot *pslot = paxisslots->at(0); + if ((nslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement) && (nslot->getSlotCode() == JoyButtonSlot::MouseLeft) && (pslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement) && (pslot->getSlotCode() == JoyButtonSlot::MouseRight)) { @@ -500,12 +489,13 @@ void AxisEditDialog::selectTriggerPreset() { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyAxisButton *paxisbutton = axis->getPAxisButton(); + JoyAxisButton *paxisbutton = m_axis->getPAxisButton(); QList *paxisslots = paxisbutton->getAssignedSlots(); if (paxisslots->length() == 1) { JoyButtonSlot *pslot = paxisslots->at(0); + if ((pslot->getSlotMode() == JoyButtonSlot::JoyMouseButton) && (pslot->getSlotCode() == JoyButtonSlot::MouseLB)) { ui->presetsComboBox->setCurrentIndex(1); @@ -545,8 +535,8 @@ void AxisEditDialog::implementTriggerPresets(int index) } else if (index == 3) { - JoyAxisButton *nbutton = axis->getNAxisButton(); - JoyAxisButton *pbutton = axis->getPAxisButton(); + JoyAxisButton *nbutton = m_axis->getNAxisButton(); + JoyAxisButton *pbutton = m_axis->getPAxisButton(); QMetaObject::invokeMethod(nbutton, "clearSlotsEventReset"); QMetaObject::invokeMethod(pbutton, "clearSlotsEventReset", Qt::BlockingQueuedConnection); @@ -557,9 +547,9 @@ void AxisEditDialog::implementTriggerPresets(int index) if (pbuttonslot != nullptr) { + JoyAxisButton *nbutton = m_axis->getNAxisButton(); + JoyAxisButton *pbutton = m_axis->getPAxisButton(); - JoyAxisButton *nbutton = axis->getNAxisButton(); - JoyAxisButton *pbutton = axis->getPAxisButton(); if (nbutton->getAssignedSlots()->length() > 0) { QMetaObject::invokeMethod(nbutton, "clearSlotsEventReset", Qt::BlockingQueuedConnection, @@ -598,7 +588,7 @@ void AxisEditDialog::openMouseSettingsDialog() ui->mouseSettingsPushButton->setEnabled(false); - MouseAxisSettingsDialog *dialog = new MouseAxisSettingsDialog(this->axis, this); + MouseAxisSettingsDialog *dialog = new MouseAxisSettingsDialog(m_axis, this); dialog->show(); connect(this, &AxisEditDialog::finished, dialog, &MouseAxisSettingsDialog::close); connect(dialog, &MouseAxisSettingsDialog::finished, this, &AxisEditDialog::enableMouseSettingButton); @@ -617,25 +607,22 @@ void AxisEditDialog::updateWindowTitleAxisName() QString temp = QString(trUtf8("Set")).append(" "); - if (!axis->getAxisName().isEmpty()) + if (!m_axis->getAxisName().isEmpty()) { - temp.append(axis->getPartialName(false, true)); + temp.append(m_axis->getPartialName(false, true)); } else { - temp.append(axis->getPartialName()); + temp.append(m_axis->getPartialName()); } - if (axis->getParentSet()->getIndex() != 0) + if (m_axis->getParentSet()->getIndex() != 0) { - int setIndex = axis->getParentSet()->getRealIndex(); + int setIndex = m_axis->getParentSet()->getRealIndex(); temp.append(" [").append(trUtf8("Set %1").arg(setIndex)); - QString setName = axis->getParentSet()->getName(); - if (!setName.isEmpty()) - { - temp.append(": ").append(setName); - } + QString setName = m_axis->getParentSet()->getName(); + if (!setName.isEmpty()) temp.append(": ").append(setName); temp.append("]"); } @@ -648,7 +635,6 @@ void AxisEditDialog::buildAxisPresetsMenu() qInstallMessageHandler(MessageHandler::myMessageOutput); ui->presetsComboBox->clear(); - ui->presetsComboBox->addItem(trUtf8("")); ui->presetsComboBox->addItem(trUtf8("Mouse (Horizontal)")); ui->presetsComboBox->addItem(trUtf8("Mouse (Inverted Horizontal)")); @@ -668,7 +654,6 @@ void AxisEditDialog::buildTriggerPresetsMenu() qInstallMessageHandler(MessageHandler::myMessageOutput); ui->presetsComboBox->clear(); - ui->presetsComboBox->addItem(trUtf8("")); ui->presetsComboBox->addItem(trUtf8("Left Mouse Button")); ui->presetsComboBox->addItem(trUtf8("Right Mouse Button")); @@ -682,7 +667,8 @@ void AxisEditDialog::presetForThrottleChange(int index) Q_UNUSED(index); bool actAsTrigger = false; - int currentThrottle = axis->getThrottle(); + int currentThrottle = m_axis->getThrottle(); + if ((currentThrottle == static_cast(JoyAxis::PositiveThrottle)) || (currentThrottle == static_cast(JoyAxis::PositiveHalfThrottle))) { @@ -690,6 +676,7 @@ void AxisEditDialog::presetForThrottleChange(int index) } disconnect(ui->presetsComboBox, static_cast(&QComboBox::currentIndexChanged), this, &AxisEditDialog::implementPresets); + if (actAsTrigger) { buildTriggerPresetsMenu(); diff --git a/src/axiseditdialog.h b/src/axiseditdialog.h old mode 100644 new mode 100755 index 9db808abd..be44bf71d --- a/src/axiseditdialog.h +++ b/src/axiseditdialog.h @@ -47,7 +47,7 @@ class AxisEditDialog : public QDialog private: Ui::AxisEditDialog *ui; - JoyAxis *axis; + JoyAxis *m_axis; SetAxisThrottleDialog *setAxisThrottleConfirm; int initialThrottleState; diff --git a/src/axiseditdialog.ui b/src/axiseditdialog.ui old mode 100644 new mode 100755 diff --git a/src/axisvaluebox.cpp b/src/axisvaluebox.cpp old mode 100644 new mode 100755 index b889088b7..e7ddeb1d3 --- a/src/axisvaluebox.cpp +++ b/src/axisvaluebox.cpp @@ -17,6 +17,7 @@ #include "axisvaluebox.h" +#include "globalvariables.h" #include "messagehandler.h" #include "joyaxis.h" @@ -33,15 +34,19 @@ AxisValueBox::AxisValueBox(QWidget *parent) : { qInstallMessageHandler(MessageHandler::myMessageOutput); - axis = nullptr; - deadZone = 0; - maxZone = 0; + m_axis = nullptr; + m_deadZone = 0; + m_maxZone = 0; joyValue = 0; - throttle = 0; + m_throttle = 0; lboxstart = 0; lboxend = 0; rboxstart = 0; rboxend = 0; + boxwidth = 0; + boxheight = 0; + singlewidth = 0; + singleend = 0; } void AxisValueBox::setThrottle(int throttle) @@ -57,9 +62,10 @@ void AxisValueBox::setThrottle(int throttle) #ifndef QT_DEBUG_NO_OUTPUT qDebug() << "throttle variable has been set in setThrottle with: " << throttle; #endif - this->throttle = throttle; + m_throttle = throttle; setValue(joyValue); } + update(); } @@ -69,34 +75,36 @@ void AxisValueBox::setValue(int value) #ifndef QT_DEBUG_NO_OUTPUT qDebug() << "Value for axis from value box at start is: " << value; - qDebug() << "throttle variable has value: " << throttle; + qDebug() << "throttle variable has value: " << m_throttle; #endif - if ((value >= JoyAxis::AXISMIN) && (value <= JoyAxis::AXISMAX)) + if ((value >= GlobalVariables::JoyAxis::AXISMIN) && (value <= GlobalVariables::JoyAxis::AXISMAX)) { #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Value for axis from value box is between : " << JoyAxis::AXISMIN << " and " << JoyAxis::AXISMAX; + qDebug() << "Value for axis from value box is between : " << GlobalVariables::JoyAxis::AXISMIN << " and " << GlobalVariables::JoyAxis::AXISMAX; #endif - if (throttle == static_cast(JoyAxis::NormalThrottle)) - { - this->joyValue = value; - } - else if (throttle == static_cast(JoyAxis::NegativeThrottle)) - { - this->joyValue = ((value + JoyAxis::AXISMIN) / 2); - } - else if (throttle == static_cast(JoyAxis::PositiveThrottle)) - { - this->joyValue = (value + JoyAxis::AXISMAX) / 2; - } - else if (throttle == static_cast(JoyAxis::NegativeHalfThrottle)) + switch(m_throttle) { - this->joyValue = (value <= 0) ? value : (-value); - } - else if (throttle == static_cast(JoyAxis::PositiveHalfThrottle)) - { - this->joyValue = (value >= 0) ? value : (-value); + case -2: + this->joyValue = (value <= 0) ? value : (-value); + break; + + case -1: + this->joyValue = ((value + GlobalVariables::JoyAxis::AXISMIN) / 2); + break; + + case 0: + this->joyValue = value; + break; + + case 1: + this->joyValue = (value + GlobalVariables::JoyAxis::AXISMAX) / 2; + break; + + case 2: + this->joyValue = (value >= 0) ? value : (-value); + break; } } @@ -107,11 +115,11 @@ void AxisValueBox::setValue(JoyAxis* axis, int value) { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->axis = axis; + m_axis = axis; #ifndef QT_DEBUG_NO_OUTPUT qDebug() << "Value for axis from value box at start is: " << value; - qDebug() << "throttle variable has value: " << throttle; + qDebug() << "throttle variable has value: " << m_throttle; #endif if ((value >= axis->getAxisMinCal()) && (value <= axis->getAxisMaxCal())) @@ -120,25 +128,28 @@ void AxisValueBox::setValue(JoyAxis* axis, int value) qDebug() << "Value for axis from value box is between : " << axis->getAxisMinCal() << " and " << axis->getAxisMaxCal(); #endif - if (throttle == static_cast(JoyAxis::NormalThrottle)) + switch(m_throttle) { - this->joyValue = value; - } - else if (throttle == static_cast(JoyAxis::NegativeThrottle)) - { - this->joyValue = ((value + axis->getAxisMinCal()) / 2); - } - else if (throttle == static_cast(JoyAxis::PositiveThrottle)) - { - this->joyValue = (value + axis->getAxisMaxCal()) / 2; - } - else if (throttle == static_cast(JoyAxis::NegativeHalfThrottle)) - { - this->joyValue = (value <= 0) ? value : (-value); - } - else if (throttle == static_cast(JoyAxis::PositiveHalfThrottle)) - { - this->joyValue = (value >= 0) ? value : (-value); + + case -2: + this->joyValue = (value <= 0) ? value : (-value); + break; + + case -1: + this->joyValue = ((value + axis->getAxisMinCal()) / 2); + break; + + case 0: + this->joyValue = value; + break; + + case 1: + this->joyValue = (value + axis->getAxisMaxCal()) / 2; + break; + + case 2: + this->joyValue = (value >= 0) ? value : (-value); + break; } } @@ -149,9 +160,9 @@ void AxisValueBox::setDeadZone(int deadZone) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((deadZone >= JoyAxis::AXISMIN) && (deadZone <= JoyAxis::AXISMAX)) + if ((deadZone >= GlobalVariables::JoyAxis::AXISMIN) && (deadZone <= GlobalVariables::JoyAxis::AXISMAX)) { - this->deadZone = deadZone; + m_deadZone = deadZone; } update(); @@ -161,11 +172,11 @@ void AxisValueBox::setDeadZone(JoyAxis* axis, int deadZone) { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->axis = axis; + m_axis = axis; if ((deadZone >= axis->getAxisMinCal()) && (deadZone <= axis->getAxisMaxCal())) { - this->deadZone = deadZone; + m_deadZone = deadZone; } update(); @@ -175,16 +186,16 @@ int AxisValueBox::getDeadZone() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return deadZone; + return m_deadZone; } void AxisValueBox::setMaxZone(int maxZone) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((maxZone >= JoyAxis::AXISMIN) && (maxZone <= JoyAxis::AXISMAX)) + if ((maxZone >= GlobalVariables::JoyAxis::AXISMIN) && (maxZone <= GlobalVariables::JoyAxis::AXISMAX)) { - this->maxZone = maxZone; + m_maxZone = maxZone; } update(); @@ -194,11 +205,11 @@ void AxisValueBox::setMaxZone(JoyAxis* axis, int maxZone) { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->axis = axis; + m_axis = axis; if ((maxZone >= axis->getAxisMinCal()) && (maxZone <= axis->getAxisMaxCal())) { - this->maxZone = maxZone; + m_maxZone = maxZone; } update(); @@ -208,7 +219,7 @@ int AxisValueBox::getMaxZone() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return maxZone; + return m_maxZone; } int AxisValueBox::getJoyValue() @@ -222,7 +233,7 @@ int AxisValueBox::getThrottle() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return throttle; + return m_throttle; } void AxisValueBox::resizeEvent(QResizeEvent *event) @@ -256,7 +267,7 @@ void AxisValueBox::paintEvent(QPaintEvent *event) paint.setBrush(palette().base().color()); QBrush brush(palette().light().color()); - if (throttle == 0) + if (m_throttle == 0) { qDrawShadeRect(&paint, lboxstart, 0, lboxend, height(), palette(), true, 2, 0, &brush); qDrawShadeRect(&paint, rboxstart, 0, rboxend, height(), palette(), true, 2, 0, &brush); @@ -267,11 +278,11 @@ void AxisValueBox::paintEvent(QPaintEvent *event) } QColor innerColor; - if (abs(joyValue) <= deadZone) + if (abs(joyValue) <= m_deadZone) { innerColor = Qt::gray; } - else if (abs(joyValue) >= maxZone) + else if (abs(joyValue) >= m_maxZone) { innerColor = Qt::red; } @@ -279,15 +290,16 @@ void AxisValueBox::paintEvent(QPaintEvent *event) { innerColor = Qt::blue; } + paint.setPen(innerColor); paint.setBrush(innerColor); - int barwidth = (throttle == 0) ? boxwidth : singlewidth; + int barwidth = (m_throttle == 0) ? boxwidth : singlewidth; int barlength = abs((barwidth - 2) * joyValue) / getMaxAxValue(); if (joyValue > 0) { - paint.drawRect(((throttle == 0) ? rboxstart : lboxstart) + 2, 2, barlength, boxheight); + paint.drawRect(((m_throttle == 0) ? rboxstart : lboxstart) + 2, 2, barlength, boxheight); } else if (joyValue < 0) { @@ -295,14 +307,14 @@ void AxisValueBox::paintEvent(QPaintEvent *event) } // Draw marker for deadZone - int deadLine = abs((barwidth - 2) * deadZone) / getMaxAxValue(); - int maxLine = abs((barwidth - 2) * maxZone) / getMaxAxValue(); + int deadLine = abs((barwidth - 2) * m_deadZone) / getMaxAxValue(); + int maxLine = abs((barwidth - 2) * m_maxZone) / getMaxAxValue(); paint.setPen(Qt::blue); brush.setColor(Qt::blue); QBrush maxBrush(Qt::red); - if (throttle == static_cast(JoyAxis::NormalThrottle)) + if (m_throttle == static_cast(JoyAxis::NormalThrottle)) { qDrawPlainRect(&paint, rboxstart + 2 + deadLine, 2, 4, boxheight + 2, Qt::black, 1, &brush); qDrawPlainRect(&paint, lboxend - deadLine - 2, 2, 4, boxheight + 2, Qt::black, 1, &brush); @@ -311,14 +323,14 @@ void AxisValueBox::paintEvent(QPaintEvent *event) qDrawPlainRect(&paint, rboxstart + 2 + maxLine, 2, 4, boxheight + 2, Qt::black, 1, &maxBrush); qDrawPlainRect(&paint, lboxend - maxLine - 2, 2, 4, boxheight + 2, Qt::black, 1, &maxBrush); } - else if ((throttle == static_cast(JoyAxis::PositiveThrottle)) || (throttle == static_cast(JoyAxis::PositiveHalfThrottle))) + else if ((m_throttle == static_cast(JoyAxis::PositiveThrottle)) || (m_throttle == static_cast(JoyAxis::PositiveHalfThrottle))) { qDrawPlainRect(&paint, lboxstart + deadLine - 2, 2, 4, boxheight + 2, Qt::black, 1, &brush); paint.setPen(Qt::red); qDrawPlainRect(&paint, lboxstart + maxLine, 2, 4, boxheight + 2, Qt::black, 1, &maxBrush); } - else if ((throttle == static_cast(JoyAxis::NegativeThrottle)) || (throttle == static_cast(JoyAxis::NegativeHalfThrottle))) + else if ((m_throttle == static_cast(JoyAxis::NegativeThrottle)) || (m_throttle == static_cast(JoyAxis::NegativeHalfThrottle))) { qDrawPlainRect(&paint, singleend - deadLine - 2, 2, 4, boxheight + 2, Qt::black, 1, &brush); paint.setPen(Qt::red); @@ -330,17 +342,17 @@ void AxisValueBox::paintEvent(QPaintEvent *event) int AxisValueBox::getMaxAxValue() { bool axisDefined = false; - if (axis != nullptr) axisDefined = true; + if (m_axis != nullptr) axisDefined = true; - return (axisDefined && (axis->getAxisMaxCal() != -1)) ? axis->getAxisMaxCal() : JoyAxis::AXISMAX; + return (axisDefined && (m_axis->getAxisMaxCal() != -1)) ? m_axis->getAxisMaxCal() : GlobalVariables::JoyAxis::AXISMAX; } int AxisValueBox::getMinAxValue() { bool axisDefined = false; - if (axis != nullptr) axisDefined = true; + if (m_axis != nullptr) axisDefined = true; - return (axisDefined && (axis->getAxisMinCal() != -1)) ? axis->getAxisMinCal() : JoyAxis::AXISMIN; + return (axisDefined && (m_axis->getAxisMinCal() != -1)) ? m_axis->getAxisMinCal() : GlobalVariables::JoyAxis::AXISMIN; } diff --git a/src/axisvaluebox.h b/src/axisvaluebox.h old mode 100644 new mode 100755 index 944df8852..2659ef197 --- a/src/axisvaluebox.h +++ b/src/axisvaluebox.h @@ -51,11 +51,11 @@ public slots: void setMaxZone(JoyAxis* axis, int deadZone); private: - JoyAxis* axis; - int deadZone; - int maxZone; + JoyAxis* m_axis; + int m_deadZone; + int m_maxZone; int joyValue; - int throttle; + int m_throttle; int boxwidth; int boxheight; int lboxstart; diff --git a/src/buttoneditdialog.cpp b/src/buttoneditdialog.cpp old mode 100644 new mode 100755 index 1498ad1b3..8d57a8f69 --- a/src/buttoneditdialog.cpp +++ b/src/buttoneditdialog.cpp @@ -33,14 +33,12 @@ #include "common.h" #ifdef Q_OS_WIN -#include -#include "winextras.h" - + #include + #include "winextras.h" #elif defined(Q_OS_UNIX) -#include + #include #endif - #include #include #include @@ -59,9 +57,10 @@ ButtonEditDialog::ButtonEditDialog(InputDevice* joystick, QWidget *parent) : { ui->setupUi(this); + withoutQuickSetDialog = false; + setAttribute(Qt::WA_DeleteOnClose); setWindowTitle(trUtf8("Choose your keyboard key")); - ui->advancedPushButton->setEnabled(false); update(); instance = this; @@ -89,7 +88,7 @@ ButtonEditDialog::ButtonEditDialog(InputDevice* joystick, QWidget *parent) : ui->virtualKeyMouseTabWidget->hide(); ui->virtualKeyMouseTabWidget->deleteLater(); - ui->virtualKeyMouseTabWidget = new VirtualKeyboardMouseWidget(joystick ,&helper, currentQuickDialog, this); + ui->virtualKeyMouseTabWidget = new VirtualKeyboardMouseWidget(joystick , &helper, currentQuickDialog, nullptr, this); ui->verticalLayout->insertWidget(1, ui->virtualKeyMouseTabWidget); PadderCommon::inputDaemonMutex.unlock(); @@ -113,13 +112,15 @@ ButtonEditDialog::ButtonEditDialog(InputDevice* joystick, QWidget *parent) : ButtonEditDialog::ButtonEditDialog(JoyButton* button, InputDevice* joystick, QWidget *parent) : QDialog(parent, Qt::Window), + helper(), ui(new Ui::ButtonEditDialog) { ui->setupUi(this); + withoutQuickSetDialog = true; + setAttribute(Qt::WA_DeleteOnClose); setWindowTitle(trUtf8("Choose your keyboard key")); - ui->advancedPushButton->setEnabled(false); update(); instance = this; @@ -143,14 +144,13 @@ ButtonEditDialog::ButtonEditDialog(JoyButton* button, InputDevice* joystick, QWi ui->virtualKeyMouseTabWidget->hide(); ui->virtualKeyMouseTabWidget->deleteLater(); - ui->virtualKeyMouseTabWidget = new VirtualKeyboardMouseWidget(joystick, &helper, currentQuickDialog, this); + ui->virtualKeyMouseTabWidget = new VirtualKeyboardMouseWidget(joystick, &helper, currentQuickDialog, button, this); ui->verticalLayout->insertWidget(1, ui->virtualKeyMouseTabWidget); PadderCommon::inputDaemonMutex.unlock(); connect(qApp, &QApplication::focusChanged, this, &ButtonEditDialog::checkForKeyboardWidgetFocus); - connect(ui->virtualKeyMouseTabWidget, &VirtualKeyboardMouseWidget::selectionCleared, this, &ButtonEditDialog::refreshSlotSummaryLabel); connect(this, &ButtonEditDialog::keyGrabbed, this, &ButtonEditDialog::processSlotAssignment); @@ -194,12 +194,10 @@ ButtonEditDialog::~ButtonEditDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (instance != nullptr) { + if (instance != nullptr) instance = nullptr; - } delete ui; - } @@ -223,12 +221,11 @@ void ButtonEditDialog::keyPressEvent(QKeyEvent *event) ignore = true; break; } + default: + break; } - if (!ignore) - { - QDialog::keyPressEvent(event); - } + if (!ignore) QDialog::keyPressEvent(event); } void ButtonEditDialog::keyReleaseEvent(QKeyEvent *event) @@ -292,7 +289,6 @@ void ButtonEditDialog::keyReleaseEvent(QKeyEvent *event) int finalvirtual = 0; int checkalias = 0; - if (QApplication::platformName() == QStringLiteral("xcb")) { // Obtain group 1 X11 keysym. Removes effects from modifiers. @@ -306,8 +302,7 @@ void ButtonEditDialog::keyReleaseEvent(QKeyEvent *event) QtKeyMapperBase *x11KeyMapper = AntKeyMapper::getInstance()->getNativeKeyMapper(); Q_ASSERT(x11KeyMapper != nullptr); checkalias = x11KeyMapper->returnQtKey(finalvirtual); - // Find corresponding Linux input key for the Qt key. - finalvirtual = AntKeyMapper::getInstance()->returnVirtualKey(checkalias); + finalvirtual = AntKeyMapper::getInstance()->returnVirtualKey(checkalias); // Find corresponding Linux input key for the Qt key. } #endif @@ -317,9 +312,7 @@ void ButtonEditDialog::keyReleaseEvent(QKeyEvent *event) // Check for alias against group 1 keysym. checkalias = AntKeyMapper::getInstance()->returnQtKey(finalvirtual); } - #endif - } else { @@ -328,7 +321,6 @@ void ButtonEditDialog::keyReleaseEvent(QKeyEvent *event) checkalias = AntKeyMapper::getInstance()->returnQtKey(finalvirtual); } - #else int finalvirtual = 0; int checkalias = 0; @@ -348,42 +340,32 @@ void ButtonEditDialog::keyReleaseEvent(QKeyEvent *event) #endif - if (!ignoreRelease) + if (!ignoreRelease && (event->modifiers() & Qt::ControlModifier) && (event->key() == Qt::Key_X)) { - if ((event->modifiers() & Qt::ControlModifier) && (event->key() == Qt::Key_X)) - { - controlcode = 0; - ignoreRelease = true; - emit selectionCleared(); - } - else if (controlcode <= 0) - { - controlcode = 0; - } + controlcode = 0; + ignoreRelease = true; + emit selectionCleared(); } - else + else if (!ignoreRelease && (controlcode <= 0)) + { + controlcode = 0; + } + else if (ignoreRelease) { controlcode = 0; ignoreRelease = false; } - if (controlcode > 0) + if (controlcode > 0 && (checkalias > 0) && (finalvirtual > 0)) { - if ((checkalias > 0) && (finalvirtual > 0)) - { - JoyButtonSlot *tempslot = new JoyButtonSlot(finalvirtual, checkalias, JoyButtonSlot::JoyKeyboard, this); - emit keyGrabbed(tempslot); - } - else if (virtualactual > 0) - { - JoyButtonSlot *tempslot = new JoyButtonSlot(virtualactual, JoyButtonSlot::JoyKeyboard, this); - emit keyGrabbed(tempslot); - } - else - { - QDialog::keyReleaseEvent(event); - } + JoyButtonSlot *tempslot = new JoyButtonSlot(finalvirtual, checkalias, JoyButtonSlot::JoyKeyboard, this); + emit keyGrabbed(tempslot); + } + else if ((controlcode > 0) && (virtualactual > 0)) + { + JoyButtonSlot *tempslot = new JoyButtonSlot(virtualactual, JoyButtonSlot::JoyKeyboard, this); + emit keyGrabbed(tempslot); } else { @@ -400,24 +382,24 @@ void ButtonEditDialog::refreshSlotSummaryLabel() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (lastJoyButton != nullptr) ui->slotSummaryLabel->setText(lastJoyButton->getSlotsString().replace("&", "&&")); - else ui->slotSummaryLabel->setText(trUtf8("No button")); + if (lastJoyButton != nullptr) ui->slotSummaryLabel->setText(lastJoyButton->getSlotsString().replace("&", "&&")); + else ui->slotSummaryLabel->setText(trUtf8("No button")); } void ButtonEditDialog::changeToggleSetting() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (lastJoyButton != nullptr) lastJoyButton->setToggle(ui->toggleCheckBox->isChecked()); - else QMessageBox::information(this, trUtf8("Last button"), trUtf8("To change settings for last button, it must be at least one assignment from keyboard to gamepad")); + if (lastJoyButton != nullptr) lastJoyButton->setToggle(ui->toggleCheckBox->isChecked()); + else QMessageBox::information(this, trUtf8("Last button"), trUtf8("To change settings for last button, it must be at least one assignment from keyboard to gamepad")); } void ButtonEditDialog::changeTurboSetting() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (lastJoyButton != nullptr) lastJoyButton->setUseTurbo(ui->turboCheckBox->isChecked()); - else QMessageBox::information(this, trUtf8("Last button"), trUtf8("To change settings of turbo for last button, it must be at least one assignment from keyboard to gamepad")); + if (lastJoyButton != nullptr) lastJoyButton->setUseTurbo(ui->turboCheckBox->isChecked()); + else QMessageBox::information(this, trUtf8("Last button"), trUtf8("To change settings of turbo for last button, it must be at least one assignment from keyboard to gamepad")); } void ButtonEditDialog::openAdvancedDialog() @@ -427,28 +409,29 @@ void ButtonEditDialog::openAdvancedDialog() ui->advancedPushButton->setEnabled(false); if (lastJoyButton != nullptr) { - AdvanceButtonDialog *dialog = new AdvanceButtonDialog(lastJoyButton, this); - dialog->show(); - // Disconnect event to allow for placing slot to AdvanceButtonDialog - disconnect(this, &ButtonEditDialog::keyGrabbed, 0, 0); - disconnect(this, &ButtonEditDialog::selectionCleared, 0, 0); - disconnect(this, &ButtonEditDialog::selectionFinished, 0, 0); + AdvanceButtonDialog *dialog = new AdvanceButtonDialog(lastJoyButton, this); + dialog->show(); - connect(dialog, &AdvanceButtonDialog::finished, ui->virtualKeyMouseTabWidget, &VirtualKeyboardMouseWidget::establishVirtualKeyboardSingleSignalConnections); - connect(dialog, &AdvanceButtonDialog::finished, ui->virtualKeyMouseTabWidget, &VirtualKeyboardMouseWidget::establishVirtualMouseSignalConnections); - connect(dialog, &AdvanceButtonDialog::finished, this, &ButtonEditDialog::closedAdvancedDialog); - connect(dialog, &AdvanceButtonDialog::turboButtonEnabledChange, this, &ButtonEditDialog::setTurboButtonEnabled); + // Disconnect event to allow for placing slot to AdvanceButtonDialog + disconnect(this, &ButtonEditDialog::keyGrabbed, nullptr, nullptr); + disconnect(this, &ButtonEditDialog::selectionCleared, nullptr, nullptr); + disconnect(this, &ButtonEditDialog::selectionFinished, nullptr, nullptr); - connect(this, &ButtonEditDialog::sendTempSlotToAdvanced, dialog, &AdvanceButtonDialog::placeNewSlot); - connect(this, &ButtonEditDialog::keyGrabbed, dialog, &AdvanceButtonDialog::placeNewSlot); - connect(this, &ButtonEditDialog::selectionCleared, dialog, &AdvanceButtonDialog::clearAllSlots); - connect(ui->virtualKeyMouseTabWidget, static_cast(&VirtualKeyboardMouseWidget::selectionMade), dialog, &AdvanceButtonDialog::placeNewSlot); - connect(ui->virtualKeyMouseTabWidget, static_cast(&VirtualKeyboardMouseWidget::selectionMade), this, &ButtonEditDialog::createTempSlot); - connect(ui->virtualKeyMouseTabWidget, &VirtualKeyboardMouseWidget::selectionCleared, dialog, &AdvanceButtonDialog::clearAllSlots); + connect(dialog, &AdvanceButtonDialog::finished, ui->virtualKeyMouseTabWidget, &VirtualKeyboardMouseWidget::establishVirtualKeyboardSingleSignalConnections); + connect(dialog, &AdvanceButtonDialog::finished, ui->virtualKeyMouseTabWidget, &VirtualKeyboardMouseWidget::establishVirtualMouseSignalConnections); + connect(dialog, &AdvanceButtonDialog::finished, this, &ButtonEditDialog::closedAdvancedDialog); + connect(dialog, &AdvanceButtonDialog::turboButtonEnabledChange, this, &ButtonEditDialog::setTurboButtonEnabled); - connect(this, &ButtonEditDialog::finished, dialog, &AdvanceButtonDialog::close); - emit advancedDialogOpened(); + connect(this, &ButtonEditDialog::sendTempSlotToAdvanced, dialog, &AdvanceButtonDialog::placeNewSlot); + connect(this, &ButtonEditDialog::keyGrabbed, dialog, &AdvanceButtonDialog::placeNewSlot); + connect(this, &ButtonEditDialog::selectionCleared, dialog, &AdvanceButtonDialog::clearAllSlots); + connect(ui->virtualKeyMouseTabWidget, static_cast(&VirtualKeyboardMouseWidget::selectionMade), dialog, &AdvanceButtonDialog::placeNewSlot); + connect(ui->virtualKeyMouseTabWidget, static_cast(&VirtualKeyboardMouseWidget::selectionMade), this, &ButtonEditDialog::createTempSlot); + connect(ui->virtualKeyMouseTabWidget, &VirtualKeyboardMouseWidget::selectionCleared, dialog, &AdvanceButtonDialog::clearAllSlots); + + connect(this, &ButtonEditDialog::finished, dialog, &AdvanceButtonDialog::close); + emit advancedDialogOpened(); } else { @@ -470,19 +453,17 @@ void ButtonEditDialog::checkTurboSetting(bool state) qInstallMessageHandler(MessageHandler::myMessageOutput); if (lastJoyButton != nullptr) { - if (lastJoyButton->containsSequence()) - { - ui->turboCheckBox->setChecked(false); - ui->turboCheckBox->setEnabled(false); - } - else - { - ui->turboCheckBox->setChecked(state); - ui->turboCheckBox->setEnabled(true); - } - - getHelperLocal().setUseTurbo(state); + if (lastJoyButton->containsSequence()) + { + ui->turboCheckBox->setChecked(false); + ui->turboCheckBox->setEnabled(false); + } + else + { + ui->turboCheckBox->setChecked(state); + ui->turboCheckBox->setEnabled(true); + } } } @@ -497,9 +478,9 @@ void ButtonEditDialog::closedAdvancedDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); - ui->advancedPushButton->setEnabled(true); + refreshForLastBtn(); - disconnect(ui->virtualKeyMouseTabWidget, static_cast(&VirtualKeyboardMouseWidget::selectionMade), this, 0); + disconnect(ui->virtualKeyMouseTabWidget, static_cast(&VirtualKeyboardMouseWidget::selectionMade), this, nullptr); // Re-connect previously disconnected event connect(this, &ButtonEditDialog::keyGrabbed, this, &ButtonEditDialog::processSlotAssignment); @@ -510,26 +491,28 @@ void ButtonEditDialog::closedAdvancedDialog() void ButtonEditDialog::processSlotAssignment(JoyButtonSlot *tempslot) { - qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((currentQuickDialog == nullptr) && (buttonEventInterval.isNull() || (buttonEventInterval.elapsed() > 1000))) + if (withoutQuickSetDialog) { - // for better security, force pausing for 1 sec between key presses, - // because mapped joystick buttons and axes become keys too - // it's good for oversensitive buttons and axes, which can - // create QuickSetDialog windows many times for one key - if (buttonEventInterval.isNull()) - buttonEventInterval.start(); - else - buttonEventInterval.restart(); - - - currentQuickDialog = new QuickSetDialog(joystick, &helper, "setAssignedSlot", tempslot->getSlotCode(), tempslot->getSlotCodeAlias(), -1, tempslot->getSlotMode(), false, false, this); + invokeMethodLastBtn(lastJoyButton, &helper, "setAssignedSlot", tempslot->getSlotCode(), tempslot->getSlotCodeAlias(), -1, tempslot->getSlotMode(), false, false, Qt::QueuedConnection, Qt::QueuedConnection, Qt::QueuedConnection); + } + else + { + if ((currentQuickDialog == nullptr) && (buttonEventInterval.isNull() || (buttonEventInterval.elapsed() > 1000))) + { + // for better security, force pausing for 1 sec between key presses, + // because mapped joystick buttons and axes become keys too + // it's good for oversensitive buttons and axes, which can + // create QuickSetDialog windows many times for one key - currentQuickDialog->show(); + if (buttonEventInterval.isNull()) buttonEventInterval.start(); + else buttonEventInterval.restart(); - connect(currentQuickDialog, &QuickSetDialog::finished, this, &ButtonEditDialog::nullifyDialogPointer); + currentQuickDialog = new QuickSetDialog(joystick, &helper, "setAssignedSlot", tempslot->getSlotCode(), tempslot->getSlotCodeAlias(), -1, tempslot->getSlotMode(), false, false, this); + currentQuickDialog->show(); + connect(currentQuickDialog, &QuickSetDialog::finished, this, &ButtonEditDialog::nullifyDialogPointer); + } } tempslot->deleteLater(); @@ -561,26 +544,23 @@ void ButtonEditDialog::updateWindowTitleButtonName() QString temp = QString(trUtf8("As last gamepad button has been set")).append(" \"").append(lastJoyButton->getPartialName(false, true)).append("\" "); - if (lastJoyButton->getParentSet()->getIndex() != 0) - { - int setIndex = lastJoyButton->getParentSet()->getRealIndex(); - temp.append(" [").append(trUtf8("Index %1").arg(setIndex)); - QString setName = lastJoyButton->getParentSet()->getName(); - if (!setName.isEmpty()) + if (lastJoyButton->getParentSet()->getIndex() != 0) { - temp.append(": ").append(setName); - } + int setIndex = lastJoyButton->getParentSet()->getRealIndex(); + temp.append(" [").append(trUtf8("Index %1").arg(setIndex)); + QString setName = lastJoyButton->getParentSet()->getName(); - temp.append("]"); - } + if (!setName.isEmpty()) temp.append(": ").append(setName); - setWindowTitle(temp); + temp.append("]"); + } + + setWindowTitle(temp); } else { setWindowTitle(trUtf8("Choose your keyboard key")); } - } @@ -603,36 +583,109 @@ void ButtonEditDialog::refreshForLastBtn() { if (lastJoyButton != nullptr) { - ui->advancedPushButton->setEnabled(true); + ui->slotSummaryLabel->setText(lastJoyButton->getSlotsString()); + updateWindowTitleButtonName(); - ui->slotSummaryLabel->setText(lastJoyButton->getSlotsString()); - updateWindowTitleButtonName(); + ui->toggleCheckBox->setChecked(lastJoyButton->getToggleState()); + ui->turboCheckBox->setChecked(lastJoyButton->isUsingTurbo()); - ui->toggleCheckBox->setChecked(lastJoyButton->getToggleState()); - ui->turboCheckBox->setChecked(lastJoyButton->isUsingTurbo()); + if (!lastJoyButton->getActionName().isEmpty()) + ui->actionNameLineEdit->setText(lastJoyButton->getActionName()); - if (!lastJoyButton->getActionName().isEmpty()) - { - ui->actionNameLineEdit->setText(lastJoyButton->getActionName()); + if (!lastJoyButton->getButtonName().isEmpty()) + ui->buttonNameLineEdit->setText(lastJoyButton->getButtonName()); + + if ((lastJoyButton->getAssignedSlots()->count() > 0) || (ui->slotSummaryLabel->text() != trUtf8("[NO KEY]"))) + { + ui->advancedPushButton->setEnabled(true); + ui->advancedPushButton->setEnabled(true); + } + else + { + ui->advancedPushButton->setEnabled(false); + } + + if (lastJoyButton != nullptr) { + + QListIterator iter(*(lastJoyButton->getAssignedSlots())); + + ui->virtualKeyMouseTabWidget->disableMouseSettingButton(); + + while (iter.hasNext()) + { + JoyButtonSlot *buttonslot = iter.next(); + + switch(buttonslot->getSlotMode()) + { + case JoyButtonSlot::JoyMouseMovement: + case JoyButtonSlot::JoyMouseButton: + ui->virtualKeyMouseTabWidget->enableMouseSettingButton(); + break; + } + } + } + + connect(ui->actionNameLineEdit, &QLineEdit::textEdited, lastJoyButton, &JoyButton::setActionName); + connect(ui->buttonNameLineEdit, &QLineEdit::textEdited, lastJoyButton, &JoyButton::setButtonName); + + connect(lastJoyButton, &JoyButton::toggleChanged, ui->toggleCheckBox, &QCheckBox::setChecked); + connect(lastJoyButton, &JoyButton::turboChanged, this, &ButtonEditDialog::checkTurboSetting); + connect(lastJoyButton, &JoyButton::slotsChanged, this, &ButtonEditDialog::refreshSlotSummaryLabel); + connect(lastJoyButton, &JoyButton::buttonNameChanged, this, &ButtonEditDialog::updateWindowTitleButtonName); } - if (!lastJoyButton->getButtonName().isEmpty()) + update(); +} + +void ButtonEditDialog::invokeMethodLastBtn(JoyButton* lastJoyBtn, ButtonEditDialogHelper* helper, const char* invokeString, int code, int alias, int index, JoyButtonSlot::JoySlotInputAction mode, bool withClear, bool withTrue, Qt::ConnectionType connTypeForAlias, Qt::ConnectionType connTypeForNothing, Qt::ConnectionType connTypeForAll) +{ + QPointer lastBtn = lastJoyBtn; + if (helper != nullptr) helper = new ButtonEditDialogHelper(); + + QPointer btnEditDHelper = helper; + + if (lastJoyBtn != nullptr) { - ui->buttonNameLineEdit->setText(lastJoyButton->getButtonName()); - } + helper->setThisButton(lastJoyBtn); + helper->moveToThread(lastJoyBtn->thread()); + + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "Thread in QuickSetDialog"; + #endif + + if (withClear) QMetaObject::invokeMethod(lastJoyBtn, "clearSlotsEventReset", Q_ARG(bool, withTrue)); + + // when alias exists but not index + if ((alias != -1) && (index == -1)) { - connect(ui->actionNameLineEdit, &QLineEdit::textEdited, lastJoyButton, &JoyButton::setActionName); - connect(ui->buttonNameLineEdit, &QLineEdit::textEdited, lastJoyButton, &JoyButton::setButtonName); + QMetaObject::invokeMethod(helper, invokeString, connTypeForAlias, + Q_ARG(int, code), + Q_ARG(int, alias), + Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); - connect(lastJoyButton, &JoyButton::toggleChanged, ui->toggleCheckBox, &QCheckBox::setChecked); - connect(lastJoyButton, &JoyButton::turboChanged, this, &ButtonEditDialog::checkTurboSetting); - connect(lastJoyButton, &JoyButton::slotsChanged, this, &ButtonEditDialog::refreshSlotSummaryLabel); - connect(lastJoyButton, &JoyButton::buttonNameChanged, this, &ButtonEditDialog::updateWindowTitleButtonName); + // when alias doesn't exists and index too + } else if ((alias == -1) && (index == -1)) { + QMetaObject::invokeMethod(helper, invokeString, connTypeForNothing, + Q_ARG(int, code), + Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); + + // when all exist (code, alias, index) + } else { + + if (lastJoyBtn->isPartVDPad()) connTypeForAll = Qt::BlockingQueuedConnection; + + QMetaObject::invokeMethod(helper, invokeString, connTypeForAll, + Q_ARG(int, code), + Q_ARG(int, alias), + Q_ARG(int, index), + Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); + } } - update(); + if (lastBtn.isNull()) lastBtn.clear(); + if (btnEditDHelper.isNull()) btnEditDHelper.clear(); } diff --git a/src/buttoneditdialog.h b/src/buttoneditdialog.h old mode 100644 new mode 100755 index e23b1c0fc..847199dd1 --- a/src/buttoneditdialog.h +++ b/src/buttoneditdialog.h @@ -38,20 +38,22 @@ class ButtonEditDialog : public QDialog Q_OBJECT public: - explicit ButtonEditDialog(JoyButton* button, InputDevice* joystick, QWidget *parent = nullptr); - explicit ButtonEditDialog(InputDevice* joystick, QWidget *parent = nullptr); + explicit ButtonEditDialog(JoyButton* button, InputDevice* joystick, QWidget *parent = nullptr); // called for chosen button + explicit ButtonEditDialog(InputDevice* joystick, QWidget *parent = nullptr); // Accessed by pressing the "Quick Set" button ~ButtonEditDialog(); static ButtonEditDialog* getInstance(); JoyButton* getLastJoyButton(); void setUpLastJoyButton(JoyButton*); void refreshForLastBtn(); + void invokeMethodLastBtn(JoyButton* lastJoyBtn, ButtonEditDialogHelper* helper, const char* invokeString, int code, int alias, int index, JoyButtonSlot::JoySlotInputAction mode, bool withClear, bool withTrue, Qt::ConnectionType connTypeForAlias, Qt::ConnectionType connTypeForNothing, Qt::ConnectionType connTypeForAll); protected: virtual void keyReleaseEvent(QKeyEvent *event); virtual void keyPressEvent(QKeyEvent *event); private: + ButtonEditDialogHelper helper; Ui::ButtonEditDialog *ui; ButtonEditDialogHelper& getHelperLocal(); @@ -59,8 +61,9 @@ class ButtonEditDialog : public QDialog InputDevice *joystick; QuickSetDialog *currentQuickDialog; bool ignoreRelease; + bool withoutQuickSetDialog; JoyButton* lastJoyButton; - ButtonEditDialogHelper helper; + static ButtonEditDialog *instance; signals: diff --git a/src/buttoneditdialog.ui b/src/buttoneditdialog.ui old mode 100644 new mode 100755 diff --git a/src/calibration.cpp b/src/calibration.cpp old mode 100644 new mode 100755 index 4866e277c..e96abdc77 --- a/src/calibration.cpp +++ b/src/calibration.cpp @@ -1,6 +1,7 @@ #include "calibration.h" #include "ui_calibration.h" +#include "globalvariables.h" #include "joycontrolstick.h" #include "joytabwidget.h" #include "inputdevice.h" @@ -17,6 +18,7 @@ #include + Calibration::Calibration(QMap* joysticks, QWidget *parent) : QWidget(parent), ui(new Ui::Calibration), @@ -27,7 +29,6 @@ Calibration::Calibration(QMap* joysticks, QWidget qInstallMessageHandler(MessageHandler::myMessageOutput); setAttribute(Qt::WA_DeleteOnClose); - setWindowTitle(trUtf8("Calibration")); sumX = 0; @@ -48,15 +49,14 @@ Calibration::Calibration(QMap* joysticks, QWidget calibrated = this->stick->wasCalibrated(); ui->Informations->setText(stick->getCalibrationSummary()); - // temporarily, until functionality is implemented - ui->jstestgtkCheckbox->hide(); + ui->resetBtn->setEnabled(calibrated); + ui->saveBtn->setEnabled(false); controlstick.data()->getModifierButton()->establishPropertyUpdatedConnections(); helper.moveToThread(controlstick.data()->thread()); setProgressBars(0, 0, 0); ui->stickStatusBoxWidget->setFocus(); - ui->stickStatusBoxWidget->setStick(controlstick.data()); ui->stickStatusBoxWidget->update(); @@ -83,10 +83,10 @@ Calibration::Calibration(QMap* joysticks, QWidget connect(ui->cancelBtn, &QPushButton::clicked, this, &Calibration::close); connect(ui->controllersBox, &QComboBox::currentTextChanged, this, &Calibration::setController); connect(ui->axesBox, static_cast(&QComboBox::currentIndexChanged), this, &Calibration::createAxesConnection); - connect(ui->jstestgtkCheckbox, &QCheckBox::stateChanged, this, &Calibration::loadSetFromJstest); connect(ui->startButton, &QPushButton::clicked, this, &Calibration::startCalibration); - connect(ui->resetBtn, &QPushButton::clicked, this, &Calibration::resetSettings); - + connect(ui->resetBtn, &QPushButton::clicked, [this](bool clicked){ + resetSettings(false, clicked); + }); update(); } @@ -103,58 +103,74 @@ Calibration::~Calibration() * @brief Resets memory of all variables to default, updates window and shows message * @return Nothing */ -void Calibration::resetSettings() +void Calibration::resetSettings(bool silentReset, bool) { - QMessageBox msgBox; - msgBox.setText(trUtf8("Do you really want to reset settings of current axes?")); - msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); + if (!silentReset) { - switch(msgBox.exec()) - { - case QMessageBox::Ok: - sumX = 0; - sumY = 0; - center_calibrated_x = -1; - center_calibrated_y = -1; - max_axis_val_x = -1; - min_axis_val_x = -1; - max_axis_val_y = -1; - min_axis_val_y = -1; - deadzone_calibrated_x = -1; - deadzone_calibrated_y = -1; - calibrated = false; - x_es_val.clear(); - y_es_val.clear(); + QMessageBox msgBox; + msgBox.setText(trUtf8("Do you really want to reset settings of current axis?")); + msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - joyAxisX->setAxisCenterCal(center_calibrated_x); - joyAxisY->setAxisCenterCal(center_calibrated_y); - joyAxisX->setDeadZone(JoyAxis::AXISDEADZONE); - joyAxisY->setDeadZone(JoyAxis::AXISDEADZONE); - joyAxisX->setAxisMinCal(min_axis_val_x); - joyAxisY->setAxisMinCal(min_axis_val_y); - joyAxisX->setAxisMaxCal(max_axis_val_x); - joyAxisY->setAxisMaxCal(max_axis_val_y); - joyAxisX->setMaxZoneValue(JoyAxis::AXISMAXZONE); - joyAxisY->setMaxZoneValue(JoyAxis::AXISMAXZONE); - stick->setDeadZone(JoyAxis::AXISDEADZONE); - stick->setMaxZone(JoyAxis::AXISMAXZONE); - calibrated = false; - stick->setCalibrationFlag(false); - stick->setCalibrationSummary(QString()); + switch(msgBox.exec()) + { + case QMessageBox::Yes: + restoreCalValues(); - update(); - ui->stickStatusBoxWidget->update(); - break; + break; - case QMessageBox::Cancel: - break; + case QMessageBox::No: + break; - default: - break; + default: + break; + } + } + else + { + restoreCalValues(); } } +void Calibration::restoreCalValues() +{ + sumX = 0; + sumY = 0; + center_calibrated_x = -1; + center_calibrated_y = -1; + max_axis_val_x = -1; + min_axis_val_x = -1; + max_axis_val_y = -1; + min_axis_val_y = -1; + deadzone_calibrated_x = -1; + deadzone_calibrated_y = -1; + calibrated = false; + x_es_val.clear(); + y_es_val.clear(); + + joyAxisX->setAxisCenterCal(center_calibrated_x); + joyAxisY->setAxisCenterCal(center_calibrated_y); + joyAxisX->setDeadZone(GlobalVariables::JoyAxis::AXISDEADZONE); + joyAxisY->setDeadZone(GlobalVariables::JoyAxis::AXISDEADZONE); + joyAxisX->setAxisMinCal(min_axis_val_x); + joyAxisY->setAxisMinCal(min_axis_val_y); + joyAxisX->setAxisMaxCal(max_axis_val_x); + joyAxisY->setAxisMaxCal(max_axis_val_y); + joyAxisX->setMaxZoneValue(GlobalVariables::JoyAxis::AXISMAXZONE); + joyAxisY->setMaxZoneValue(GlobalVariables::JoyAxis::AXISMAXZONE); + stick->setDeadZone(GlobalVariables::JoyAxis::AXISDEADZONE); + stick->setMaxZone(GlobalVariables::JoyAxis::AXISMAXZONE); + calibrated = false; + stick->setCalibrationFlag(false); + stick->setCalibrationSummary(QString()); + ui->Informations->setText(QString()); + + ui->saveBtn->setEnabled(false); + ui->resetBtn->setEnabled(false); + update(); + ui->stickStatusBoxWidget->update(); +} + /** * @brief Creates quadratic field in a case, when max value is not equal to negative min value. It always chooses less value * @param max value for X - positive value @@ -165,17 +181,11 @@ void Calibration::resetSettings() */ void Calibration::setQuadraticZoneCalibrated(int &max_axis_val_x, int &min_axis_val_x, int &max_axis_val_y, int &min_axis_val_y) { - if(max_axis_val_x > abs(min_axis_val_x)) { - max_axis_val_x = abs(min_axis_val_x); - } else { - min_axis_val_x = -(max_axis_val_x); - } + if (max_axis_val_x > abs(min_axis_val_x)) max_axis_val_x = abs(min_axis_val_x); + else min_axis_val_x = -(max_axis_val_x); - if(max_axis_val_y > abs(min_axis_val_y)) { - max_axis_val_y = abs(min_axis_val_y); - } else { - min_axis_val_y = -(max_axis_val_y); - } + if (max_axis_val_y > abs(min_axis_val_y)) max_axis_val_y = abs(min_axis_val_y); + else min_axis_val_y = -(max_axis_val_y); } /** @@ -207,6 +217,7 @@ void Calibration::startCalibration() { case QMessageBox::Ok: confirmed = true; + ui->resetBtn->setEnabled(false); break; case QMessageBox::Cancel: @@ -216,7 +227,6 @@ void Calibration::startCalibration() default: confirmed = true; break; - } } @@ -226,47 +236,43 @@ void Calibration::startCalibration() stick->setCalibrationFlag(false); calibrated = false; - ui->steps->setText(trUtf8("Place the joystick in the center position.\n\nIt's the part, where often you don't have to move. Just skip it in such situation.")); - update(); + ui->steps->setText(trUtf8("Place the joystick in the center position.\n\nIt's the part, where often you don't have to move. Just skip it in such situation.")); + this->setWindowTitle(trUtf8("Calibrating center")); + ui->startButton->setText(trUtf8("Start second step")); + update(); - this->setWindowTitle(trUtf8("Calibrating center")); - ui->startButton->setText(trUtf8("Start second step")); - update(); + for (int i = 0; i < x_es_val.count(); i++) + sumX += x_es_val.values().at(i); - for (int i = 0; i < x_es_val.count(); i++) { - sumX += x_es_val.values().at(i); - } + for (int i = 0; i < y_es_val.count(); i++) + sumY += y_es_val.values().at(i); - for (int i = 0; i < y_es_val.count(); i++) { - sumY += y_es_val.values().at(i); - } - if ((sumX != 0) && (sumY != 0)) { - center_calibrated_x = sumX / x_es_val.count(); - center_calibrated_y = sumY / y_es_val.count(); - } else { - center_calibrated_x = 0; - center_calibrated_y = 0; - } + if ((sumX != 0) && (sumY != 0)) { - // deadzone_calibrated_x = calibratedDeadZone(center_calibrated_x, joyAxisX->getDeadZone()); - // deadzone_calibrated_y = calibratedDeadZone(center_calibrated_y, joyAxisY->getDeadZone()); + center_calibrated_x = sumX / x_es_val.count(); + center_calibrated_y = sumY / y_es_val.count(); - QString text = QString(); - text.append(trUtf8("\n\nCenter X: %1").arg(center_calibrated_x)); - text.append(trUtf8("\nCenter Y: %1").arg(center_calibrated_y)); - ui->Informations->setText(text); - this->text = text; + } else { - x_es_val.clear(); - y_es_val.clear(); - sumX = 0; - sumY = 0; - update(); + center_calibrated_x = 0; + center_calibrated_y = 0; + } - disconnect(ui->startButton, &QPushButton::clicked, this, nullptr); - connect(ui->startButton, &QPushButton::clicked, this, &Calibration::startSecondStep); + QString text = QString(); + text.append(trUtf8("\n\nCenter X: %1").arg(center_calibrated_x)); + text.append(trUtf8("\nCenter Y: %1").arg(center_calibrated_y)); + ui->Informations->setText(text); + this->text = text; + + x_es_val.clear(); + y_es_val.clear(); + sumX = 0; + sumY = 0; + update(); + disconnect(ui->startButton, &QPushButton::clicked, this, nullptr); + connect(ui->startButton, &QPushButton::clicked, this, &Calibration::startSecondStep); } } @@ -281,8 +287,6 @@ void Calibration::startSecondStep() if ((joyAxisX != nullptr) && (joyAxisY != nullptr)) { ui->steps->setText(trUtf8("\nPlace the joystick in the top-left corner many times")); - update(); - this->setWindowTitle(trUtf8("Calibrating position")); update(); @@ -290,13 +294,12 @@ void Calibration::startSecondStep() qDebug() << "Y_ES_VAL: " << y_es_val.count(QString("-")); - if (enoughProb(x_es_val.count(QString("-")), y_es_val.count(QString("-")))) { + if (enoughProb(x_es_val.count(QString("-")), y_es_val.count(QString("-")), QString("-"))) { int min_x = 0; int min_y = 0; for (int i = 0; i < x_es_val.count(QString("-")); i++) { - // if ((abs(x_es_val.values(QString("-")).at(i)) > deadzone_calibrated_x)) if (i > 0) { if (x_es_val.values(QString("-")).at(i) < x_es_val.values(QString("-")).at(i-1)) { min_x = x_es_val.values(QString("-")).at(i); @@ -307,7 +310,6 @@ void Calibration::startSecondStep() } for (int i = 0; i < y_es_val.count(QString("-")); i++) { - // if ((abs(y_es_val.values(QString("-")).at(i)) > deadzone_calibrated_y)) if (i > 0) { if (y_es_val.values(QString("-")).at(i) < y_es_val.values(QString("-")).at(i-1)) { min_y = y_es_val.values(QString("-")).at(i); @@ -325,16 +327,17 @@ void Calibration::startSecondStep() text.append(trUtf8("\nY: %1").arg(min_axis_val_y)); ui->Informations->setText(text); this->text = text; - update(); x_es_val.clear(); y_es_val.clear(); sumX = 0; sumY = 0; + update(); disconnect(ui->startButton, &QPushButton::clicked, this, nullptr); connect(ui->startButton, &QPushButton::clicked, this, &Calibration::startLastStep); - } + + } } } @@ -349,19 +352,16 @@ void Calibration::startLastStep() if ((joyAxisX != nullptr) && (joyAxisY != nullptr)) { ui->steps->setText(trUtf8("\nPlace the joystick in the bottom-right corner")); - update(); - this->setWindowTitle(trUtf8("Calibrating position")); ui->startButton->setText(trUtf8("Start final step")); update(); - if (enoughProb(x_es_val.count(QString("+")), y_es_val.count(QString("+")))) { + if (enoughProb(x_es_val.count(QString("+")), y_es_val.count(QString("+")), QString("+"))) { int max_x = 0; int max_y = 0; for (int i = 0; i < x_es_val.count(QString("+")); i++) { - // if ((x_es_val.values(QString("+")).at(i) > deadzone_calibrated_x)) if (i > 0) { if (x_es_val.values(QString("+")).at(i) > x_es_val.values(QString("+")).at(i-1)) { max_x = x_es_val.values(QString("+")).at(i); @@ -372,7 +372,6 @@ void Calibration::startLastStep() } for (int i = 0; i < y_es_val.count(QString("+")); i++) { - // if ((y_es_val.values(QString("+")).at(i) > deadzone_calibrated_y)) if (i > 0) { if (y_es_val.values(QString("+")).at(i) > y_es_val.values(QString("+")).at(i-1)) { max_y = y_es_val.values(QString("+")).at(i); @@ -405,11 +404,21 @@ void Calibration::startLastStep() ui->Informations->setText(text3); this->text = text3; + if (stick != nullptr) + { + ui->saveBtn->setEnabled(true); + } + ui->steps->setText(trUtf8("\n---Calibration done!---\n")); ui->startButton->setText(trUtf8("Start calibration")); this->setWindowTitle(trUtf8("Calibration")); update(); + x_es_val.clear(); + y_es_val.clear(); + sumX = 0; + sumY = 0; + disconnect(ui->startButton, &QPushButton::clicked, this, nullptr); connect(ui->startButton, &QPushButton::clicked, this, &Calibration::startCalibration); @@ -425,7 +434,6 @@ void Calibration::saveSettings() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((joyAxisX != nullptr) && (joyAxisY != nullptr)) { joyAxisX->setAxisCenterCal(center_calibrated_x); @@ -444,37 +452,39 @@ void Calibration::saveSettings() stick->setCalibrationFlag(true); stick->setCalibrationSummary(this->text); + ui->resetBtn->setEnabled(true); + ui->saveBtn->setEnabled(false); + ui->stickStatusBoxWidget->update(); update(); QMessageBox::information(this, trUtf8("Save"), trUtf8("Calibration values have been saved")); } } -/** - * @brief Gets settings from gtk-jstest profile - * @return text of settings from found profile - */ -const QString Calibration::getSetfromGtkJstest() -{ - qInstallMessageHandler(MessageHandler::myMessageOutput); - - return QString(); -} - /** * @brief checks whether axes were moved at least 5 times in both ways. If not, it shows a message * @param counts of ax X moving values * @param counts of ax Y moving values * @return if counts of values for X and Y axes were greater than 4 */ -bool Calibration::enoughProb(int x_count, int y_count) +bool Calibration::enoughProb(int x_count, int y_count, QString character) { qInstallMessageHandler(MessageHandler::myMessageOutput); bool enough = true; - if (x_count < 5) { enough = false; QMessageBox::information(this, trUtf8("Dead zone calibration"), trUtf8("You must move X axis to the right at least five times! Keep moving!")); } - else if (y_count < 5) { enough = false; QMessageBox::information(this, trUtf8("Dead zone calibration"), trUtf8("You must move X axis to the left at least five times! Keep moving!")); } + if ((x_count < 5) || (y_count < 5)) { + if (character == QString("-")) + { + enough = false; + QMessageBox::information(this, trUtf8("Dead zone calibration"), trUtf8("You have to move axes to the top-left corner at least five times.")); + } + else if (character == QString("+")) + { + enough = false; + QMessageBox::information(this, trUtf8("Dead zone calibration"), trUtf8("You have to move axes to the bottom-right corner at least five times.")); + } + } return enough; } @@ -533,9 +543,14 @@ void Calibration::checkY(int value) qInstallMessageHandler(MessageHandler::myMessageOutput); if (value > 0) { - if (y_es_val.count(QString("+")) <= 100) y_es_val.insert(QString("+"), value); + + if (y_es_val.count(QString("+")) <= 100) + y_es_val.insert(QString("+"), value); + } else if (value < 0) { - if (y_es_val.count(QString("-")) <= 100) y_es_val.insert(QString("-"), value); + + if (y_es_val.count(QString("-")) <= 100) + y_es_val.insert(QString("-"), value); } axisBarY->setValue(value); @@ -589,44 +604,74 @@ void Calibration::updateAxesBox() } /** - * @brief Tries to load profile for gtk-jstest application + * @brief Initializes widget for moving axes (animations) and changes storing data for variables * @return nothing */ -void Calibration::loadSetFromJstest() +void Calibration::createAxesConnection() { qInstallMessageHandler(MessageHandler::myMessageOutput); -} + if (ui->saveBtn->isEnabled()) { -/** - * @brief Tries to find profile for gtk-jstest application - * @return if gtk-jstest profile for calibration was found - */ -bool Calibration::ifGtkJstestRunToday() -{ - qInstallMessageHandler(MessageHandler::myMessageOutput); + QMessageBox msgBox; + msgBox.setText(trUtf8("Do you want to save calibration of current axis?")); + msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - return true; -} + switch(msgBox.exec()) + { + case QMessageBox::Yes: + saveSettings(); + break; -/** - * @brief Initializes widget for moving axes (animations) and changes storing data for variables - * @return nothing - */ -void Calibration::createAxesConnection() -{ - qInstallMessageHandler(MessageHandler::myMessageOutput); + case QMessageBox::No: + break; + + default: + break; + + } + } + + while(!ui->progressBarsLayout->isEmpty()) { + + QLayout *hb = ui->progressBarsLayout->takeAt(0)->layout(); - qDeleteAll(ui->axesWidget->findChildren()); + while(!hb->isEmpty()) { + + QWidget *w = hb->takeAt(0)->widget(); + delete w; + } + + delete hb; + } + + update(); QPointer controlstick = joysticks->value(ui->controllersBox->currentIndex())->getSetJoystick(0)->getJoyStick(ui->axesBox->currentIndex()); this->stick = controlstick.data(); + + center_calibrated_x = controlstick->getAxisX()->getAxisCenterCal(); + center_calibrated_y = controlstick->getAxisY()->getAxisCenterCal(); + deadzone_calibrated_x = controlstick->getAxisX()->getDeadZone(); + deadzone_calibrated_y = controlstick->getAxisY()->getDeadZone(); + min_axis_val_x = controlstick->getAxisX()->getAxisMinCal(); + min_axis_val_y = controlstick->getAxisY()->getAxisMinCal(); + max_axis_val_x = controlstick->getAxisX()->getAxisMaxCal(); + max_axis_val_y = controlstick->getAxisY()->getAxisMaxCal(); + calibrated = controlstick->wasCalibrated(); + text = controlstick->getCalibrationSummary(); + + if (calibrated) ui->resetBtn->setEnabled(true); + else ui->resetBtn->setEnabled(false); + controlstick.data()->getModifierButton()->establishPropertyUpdatedConnections(); helper.moveToThread(controlstick.data()->thread()); ui->stickStatusBoxWidget->setStick(controlstick.data()); ui->stickStatusBoxWidget->update(); setProgressBars(controlstick.data()); + update(); + if (controlstick.isNull()) controlstick.clear(); } @@ -652,24 +697,28 @@ void Calibration::setProgressBars(JoyControlStick* controlstick) QLabel *axisLabel = new QLabel(); QLabel *axisLabel2 = new QLabel(); + axisLabel->setText(trUtf8("Axis %1").arg(joyAxisX->getRealJoyIndex())); axisLabel2->setText(trUtf8("Axis %1").arg(joyAxisY->getRealJoyIndex())); + axisBarX = new QProgressBar(); axisBarY = new QProgressBar(); - axisBarX->setMinimum(JoyAxis::AXISMIN); - axisBarX->setMaximum(JoyAxis::AXISMAX); + axisBarX->setMinimum(GlobalVariables::JoyAxis::AXISMIN); + axisBarX->setMaximum(GlobalVariables::JoyAxis::AXISMAX); axisBarX->setFormat("%v"); axisBarX->setValue(joyAxisX->getCurrentRawValue()); - axisBarY->setMinimum(JoyAxis::AXISMIN); - axisBarY->setMaximum(JoyAxis::AXISMAX); + axisBarY->setMinimum(GlobalVariables::JoyAxis::AXISMIN); + axisBarY->setMaximum(GlobalVariables::JoyAxis::AXISMAX); axisBarY->setFormat("%v"); axisBarY->setValue(joyAxisY->getCurrentRawValue()); + hbox->addWidget(axisLabel); hbox->addWidget(axisBarX); hbox->addSpacing(10); hbox2->addWidget(axisLabel2); hbox2->addWidget(axisBarY); hbox2->addSpacing(10); + ui->progressBarsLayout->addLayout(hbox); ui->progressBarsLayout->addLayout(hbox2); @@ -710,22 +759,25 @@ void Calibration::setProgressBars(int inputDevNr, int setJoyNr, int stickNr) QLabel *axisLabel2 = new QLabel(); axisLabel->setText(trUtf8("Axis %1").arg(joyAxisX->getRealJoyIndex())); axisLabel2->setText(trUtf8("Axis %1").arg(joyAxisY->getRealJoyIndex())); + axisBarX = new QProgressBar(); axisBarY = new QProgressBar(); - axisBarX->setMinimum(JoyAxis::AXISMIN); - axisBarX->setMaximum(JoyAxis::AXISMAX); + axisBarX->setMinimum(GlobalVariables::JoyAxis::AXISMIN); + axisBarX->setMaximum(GlobalVariables::JoyAxis::AXISMAX); axisBarX->setFormat("%v"); axisBarX->setValue(joyAxisX->getCurrentRawValue()); - axisBarY->setMinimum(JoyAxis::AXISMIN); - axisBarY->setMaximum(JoyAxis::AXISMAX); + axisBarY->setMinimum(GlobalVariables::JoyAxis::AXISMIN); + axisBarY->setMaximum(GlobalVariables::JoyAxis::AXISMAX); axisBarY->setFormat("%v"); axisBarY->setValue(joyAxisY->getCurrentRawValue()); + hbox->addWidget(axisLabel); hbox->addWidget(axisBarX); hbox->addSpacing(10); hbox2->addWidget(axisLabel2); hbox2->addWidget(axisBarY); hbox2->addSpacing(10); + ui->progressBarsLayout->addLayout(hbox); ui->progressBarsLayout->addLayout(hbox2); diff --git a/src/calibration.h b/src/calibration.h old mode 100644 new mode 100755 index c4d8b229e..584325d5b --- a/src/calibration.h +++ b/src/calibration.h @@ -26,16 +26,14 @@ class Calibration : public QWidget ~Calibration(); int chooseMinMax(QString min_max_sign, QList ax_values); - bool ifGtkJstestRunToday(); - const QString getSetfromGtkJstest(); void setQuadraticZoneCalibrated(int &max_axis_val_x, int &min_axis_val_x, int &max_axis_val_y, int &min_axis_val_y); - protected: void setProgressBars(int inputDevNr, int setJoyNr, int stickNr); void setProgressBars(JoyControlStick* controlstick); void updateAxesBox(); - bool enoughProb(int x_count, int y_count); + void restoreCalValues(); + bool enoughProb(int x_count, int y_count, QString character); int calibratedDeadZone(int center, int deadzone); @@ -69,13 +67,12 @@ public slots: void checkY(int value); void createAxesConnection(); void setController(QString controllerName); - void loadSetFromJstest(); void startCalibration(); void startSecondStep(); void startLastStep(); protected slots: - void resetSettings(); + void resetSettings(bool silentReset, bool clicked = false); signals: void deadZoneChanged(int value); diff --git a/src/calibration.ui b/src/calibration.ui old mode 100644 new mode 100755 index f6e5efa6f..85c76ecfb --- a/src/calibration.ui +++ b/src/calibration.ui @@ -150,13 +150,6 @@ - - - - Use settings from jstest-gtk - - - diff --git a/src/capturedwindowinfodialog.cpp b/src/capturedwindowinfodialog.cpp old mode 100644 new mode 100755 index 680fd56af..a0fa19d2b --- a/src/capturedwindowinfodialog.cpp +++ b/src/capturedwindowinfodialog.cpp @@ -60,8 +60,10 @@ CapturedWindowInfoDialog::CapturedWindowInfoDialog(long window, QWidget *parent) ui->winClassLabel->setVisible(false); ui->winClassHeadLabel->setVisible(false); #elif defined(Q_OS_UNIX) + winClass = info->getWindowClass(static_cast(window)); ui->winClassLabel->setText(winClass); + if (winClass.isEmpty()) { ui->winClassCheckBox->setEnabled(false); @@ -84,6 +86,7 @@ CapturedWindowInfoDialog::CapturedWindowInfoDialog(long window, QWidget *parent) #endif ui->winTitleLabel->setText(winName); + if (winName.isEmpty()) { ui->winTitleCheckBox->setEnabled(false); @@ -114,13 +117,16 @@ CapturedWindowInfoDialog::CapturedWindowInfoDialog(long window, QWidget *parent) #elif defined(Q_OS_UNIX) int pid = info->getApplicationPid(static_cast(window)); + if (pid > 0) { QString exepath = X11Extras::getInstance()->getApplicationLocation(pid); + if (!exepath.isEmpty()) { ui->winPathLabel->setText(exepath); winPath = exepath; + if (!setRadioDefault) { ui->winTitleCheckBox->setChecked(true); @@ -162,27 +168,17 @@ void CapturedWindowInfoDialog::populateOption() qInstallMessageHandler(MessageHandler::myMessageOutput); if (ui->winClassCheckBox->isChecked()) - { selectedMatch = selectedMatch | WindowClass; - } if (ui->winTitleCheckBox->isChecked()) - { selectedMatch = selectedMatch | WindowName; - } if (ui->winPathCheckBox->isChecked()) { selectedMatch = selectedMatch | WindowPath; - if (ui->winPathChoiceComboBox->currentIndex() == 0) - { - fullWinPath = true; - } - else - { - fullWinPath = false; - } + if (ui->winPathChoiceComboBox->currentIndex() == 0) fullWinPath = true; + else fullWinPath = false; } } diff --git a/src/capturedwindowinfodialog.h b/src/capturedwindowinfodialog.h old mode 100644 new mode 100755 diff --git a/src/capturedwindowinfodialog.ui b/src/capturedwindowinfodialog.ui old mode 100644 new mode 100755 diff --git a/src/commandlineutility.cpp b/src/commandlineutility.cpp old mode 100644 new mode 100755 index 918a22433..2120d28a7 --- a/src/commandlineutility.cpp +++ b/src/commandlineutility.cpp @@ -31,7 +31,6 @@ QStringList CommandLineUtility::eventGeneratorsList = EventHandlerFactory::buildEventGeneratorList(); - CommandLineUtility::CommandLineUtility(QObject *parent) : QObject(parent) { @@ -58,6 +57,7 @@ CommandLineUtility::CommandLineUtility(QObject *parent) : eventGenerator = EventHandlerFactory::fallBackIdentifier(); } + void CommandLineUtility::parseArguments(QCommandLineParser* parser) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -86,57 +86,11 @@ void CommandLineUtility::parseArguments(QCommandLineParser* parser) { } else if (parser->isSet("profile")) { - - QFileInfo fileInfo(parser->value("profile")); - if (fileInfo.exists()) - { - if ((fileInfo.suffix() != "amgp") && (fileInfo.suffix() != "xml")) - { - setErrorMessage(QObject::trUtf8("Profile location %1 is not an XML file.").arg(parser->value("profile"))); - } - else - { - QString tempProfileLocation = fileInfo.absoluteFilePath(); - ControllerOptionsInfo tempInfo = getControllerOptionsList().at(currentListsIndex); - tempInfo.setProfileLocation(tempProfileLocation); - controllerOptionsList.replace(currentListsIndex, tempInfo); - } - } - else - { - setErrorMessage(QObject::trUtf8("Profile location %1 does not exist.").arg(parser->value("profile"))); - } + parseArgsProfile(parser); } else if (parser->isSet("profile-controller")) { - bool validNumber = false; - int tempNumber = parser->value("profile-controller").toInt(&validNumber); - if (validNumber) - { - if (controllerNumber == 0) - { - controllerNumber = tempNumber; - } - - ControllerOptionsInfo tempInfo = getControllerOptionsList().at(currentListsIndex); - tempInfo.setControllerNumber(tempNumber); - controllerOptionsList.replace(currentListsIndex, tempInfo); - } - else if (!parser->value("profile-controller").isEmpty()) - { - if (controllerIDString.isEmpty()) - { - controllerIDString = parser->value("profile-controller"); - } - - ControllerOptionsInfo tempInfo = getControllerOptionsList().at(currentListsIndex); - tempInfo.setControllerID(parser->value("profile-controller")); - controllerOptionsList.replace(currentListsIndex, tempInfo); - } - else - { - setErrorMessage(QObject::trUtf8("Controller identifier is not a valid value.")); - } + parseArgsPrControle(parser); } else if (parser->isSet("hidden")) { @@ -144,154 +98,35 @@ void CommandLineUtility::parseArguments(QCommandLineParser* parser) { } else if (parser->isSet("unload")) { - ControllerOptionsInfo tempInfo = getControllerOptionsList().at(currentListsIndex); - tempInfo.setProfileLocation(""); - tempInfo.setUnloadRequest(true); - controllerOptionsList.replace(currentListsIndex, tempInfo); - - QStringList values = QStringList() << parser->values("unload"); - QListIterator unloaded_profile(values); - QString temp = QString(); - - if (unloaded_profile.hasNext()) - { - - temp = unloaded_profile.next(); - - // A value has been passed. Attempt - // to validate the value. - bool validNumber = false; - int tempNumber = temp.toInt(&validNumber); - if (validNumber) - { - controllerNumber = tempNumber; - tempInfo = getControllerOptionsList().at(currentListsIndex); - tempInfo.setControllerNumber(controllerNumber); - controllerOptionsList.replace(currentListsIndex, tempInfo); - } - else if (!temp.isEmpty()) - { - controllerIDString = temp; - tempInfo = getControllerOptionsList().at(currentListsIndex); - tempInfo.setControllerID(controllerIDString); - controllerOptionsList.replace(currentListsIndex, tempInfo); - } - else - { - setErrorMessage(QObject::trUtf8("Controller identifier is not a valid value.")); - } - - } - else - { - unloadProfile = true; - profileLocation = ""; - } + parseArgsUnload(parser); } else if (parser->isSet("startSet")) { - QStringList values = QStringList() << parser->values("startSet"); - QListIterator unloaded_profile(values); - QString temp = QString(); - - if (unloaded_profile.hasNext()) - { - temp = unloaded_profile.next(); - - bool validNumber = false; - int tempNumber = temp.toInt(&validNumber); - if (validNumber && (tempNumber >= 1) && (tempNumber <= 8)) - { - startSetNumber = tempNumber; - ControllerOptionsInfo tempInfo = getControllerOptionsList().at(currentListsIndex); - tempInfo.setStartSetNumber(startSetNumber); - controllerOptionsList.replace(currentListsIndex, tempInfo); - } - else if (validNumber) - { - setErrorMessage(QObject::trUtf8("An invalid set number '%1' was specified.").arg(tempNumber)); - } - - if (unloaded_profile.hasNext()) - { - temp = unloaded_profile.next(); - - if (validNumber) - { - controllerNumber = tempNumber; - ControllerOptionsInfo tempInfo = getControllerOptionsList().at(currentListsIndex); - tempInfo.setControllerNumber(controllerNumber); - controllerOptionsList.replace(currentListsIndex, tempInfo); - } - else if (!temp.isEmpty()) - { - controllerIDString = temp; - ControllerOptionsInfo tempInfo = getControllerOptionsList().at(currentListsIndex); - tempInfo.setControllerID(controllerIDString); - controllerOptionsList.replace(currentListsIndex, tempInfo); - } - else - { - setErrorMessage(QObject::trUtf8("Controller identifier '%s'' is not a valid value.").arg(temp)); - } - } - } - else - { - setErrorMessage(QObject::trUtf8("No set number was specified.")); - } + parseArgsStartSet(parser); } else if (parser->isSet("next")) { currentListsIndex++; - ControllerOptionsInfo tempInfo; controllerOptionsList.append(tempInfo); - } - -#ifdef USE_SDL_2 + #ifdef USE_SDL_2 else if (parser->isSet("list")) { listControllers = true; } else if (parser->isSet("map")) { - QString temp = parser->value("map"); - - if (!temp.isEmpty()) { - - bool validNumber = false; - int tempNumber = temp.toInt(&validNumber); - if (validNumber) - { - controllerNumber = tempNumber; - mappingController = true; - } - else if (!temp.isEmpty()) - { - controllerIDString = temp; - mappingController = true; - } - else - { - setErrorMessage(QObject::trUtf8("Controller identifier is not a valid value.")); - } - } - else - { - setErrorMessage(QObject::trUtf8("No controller was specified.")); - } - + parseArgsMap(parser); } -#endif + #endif -#ifdef Q_OS_UNIX + #ifdef Q_OS_UNIX else if (parser->isSet("daemon")) { daemonMode = true; } - #ifdef WITH_X11 + #ifdef WITH_X11 else if (parser->isSet("display")) { if (!parser->value("display").isEmpty()) @@ -303,55 +138,39 @@ void CommandLineUtility::parseArguments(QCommandLineParser* parser) { setErrorMessage(QObject::trUtf8("No display string was specified.")); } } - #endif -#endif + #endif + #endif -#if (defined (Q_OS_UNIX) && defined(WITH_UINPUT) && defined(WITH_XTEST)) \ + #if (defined (Q_OS_UNIX) && defined(WITH_UINPUT) && defined(WITH_XTEST)) \ || (defined(Q_OS_WIN) && defined(WITH_VMULTI)) + else if (parser->isSet("eventgen")) { - QString temp = parser->value("eventgen"); + QString eventGenText = parser->value("eventgen"); - - if (!temp.isEmpty()) { - - if (!eventGeneratorsList.contains(temp)) - { - eventGenerator = ""; - setErrorMessage(QObject::trUtf8("An invalid event generator was specified.")); - } - else - { - eventGenerator = temp; - } + if (!eventGenText.isEmpty() && !eventGeneratorsList.contains(eventGenText)) + { + eventGenerator = ""; + setErrorMessage(QObject::trUtf8("An invalid event generator was specified.")); + } + else if (!eventGenText.isEmpty() && eventGeneratorsList.contains(eventGenText)) + { + eventGenerator = eventGenText; } else { setErrorMessage(QObject::trUtf8("No event generator string was specified.")); } } - -#endif - + #endif else if (parser->isSet("log-level")) { - QString temp = parser->value("log-level"); - if (temp == "debug") - { - currentLogLevel = Logger::LOG_DEBUG; - } - else if (temp == "info") - { - currentLogLevel = Logger::LOG_INFO; - } - else if (temp == "warn") - { - currentLogLevel = Logger::LOG_WARNING; - } - else if (temp == "error") - { - currentLogLevel = Logger::LOG_ERROR; - } + QString logLevelText = parser->value("log-level"); + + if (logLevelText == "debug") currentLogLevel = Logger::LOG_DEBUG; + else if (logLevelText == "info") currentLogLevel = Logger::LOG_INFO; + else if (logLevelText == "warn") currentLogLevel = Logger::LOG_WARNING; + else if (logLevelText == "error") currentLogLevel = Logger::LOG_ERROR; } else if (parser->isSet("log-file")) { @@ -369,6 +188,186 @@ void CommandLineUtility::parseArguments(QCommandLineParser* parser) { } } +void CommandLineUtility::parseArgsProfile(QCommandLineParser* parser) +{ + QFileInfo profileFileInfo(parser->value("profile")); + + if (profileFileInfo.exists() && (profileFileInfo.suffix() != "amgp") && (profileFileInfo.suffix() != "xml")) + { + setErrorMessage(QObject::trUtf8("Profile location %1 is not an XML file.").arg(parser->value("profile"))); + } + else if (profileFileInfo.exists() && ((profileFileInfo.suffix() == "amgp") || (profileFileInfo.suffix() == "xml"))) + { + QString tempProfileLocation = profileFileInfo.absoluteFilePath(); + ControllerOptionsInfo tempInfo = getControllerOptionsList().at(currentListsIndex); + tempInfo.setProfileLocation(tempProfileLocation); + controllerOptionsList.replace(currentListsIndex, tempInfo); + } + else + { + setErrorMessage(QObject::trUtf8("Profile location %1 does not exist.").arg(parser->value("profile"))); + } +} + +void CommandLineUtility::parseArgsPrControle(QCommandLineParser* parser) +{ + bool validNumber = false; + int tempNumber = parser->value("profile-controller").toInt(&validNumber); + + if (validNumber) + { + if (controllerNumber == 0) controllerNumber = tempNumber; + + ControllerOptionsInfo tempInfo = getControllerOptionsList().at(currentListsIndex); + tempInfo.setControllerNumber(tempNumber); + controllerOptionsList.replace(currentListsIndex, tempInfo); + } + else if (!parser->value("profile-controller").isEmpty()) + { + if (controllerIDString.isEmpty()) controllerIDString = parser->value("profile-controller"); + + ControllerOptionsInfo tempInfo = getControllerOptionsList().at(currentListsIndex); + tempInfo.setControllerID(parser->value("profile-controller")); + controllerOptionsList.replace(currentListsIndex, tempInfo); + } + else + { + setErrorMessage(QObject::trUtf8("Controller identifier is not a valid value.")); + } +} + +void CommandLineUtility::parseArgsUnload(QCommandLineParser* parser) +{ + ControllerOptionsInfo gameControllerOptionInfo = getControllerOptionsList().at(currentListsIndex); + gameControllerOptionInfo.setProfileLocation(""); + gameControllerOptionInfo.setUnloadRequest(true); + controllerOptionsList.replace(currentListsIndex, gameControllerOptionInfo); + + QStringList parserVals = QStringList() << parser->values("unload"); + QListIterator profileForUnload(parserVals); + QString unloadedProfText = QString(); + + if (profileForUnload.hasNext()) + { + unloadedProfText = profileForUnload.next(); + + // A value has been passed. Attempt + // to validate the value. + + bool validNumber = false; + int tempNumber = unloadedProfText.toInt(&validNumber); + + if (validNumber) + { + controllerNumber = tempNumber; + gameControllerOptionInfo = getControllerOptionsList().at(currentListsIndex); + gameControllerOptionInfo.setControllerNumber(controllerNumber); + controllerOptionsList.replace(currentListsIndex, gameControllerOptionInfo); + } + else if (!unloadedProfText.isEmpty()) + { + controllerIDString = unloadedProfText; + gameControllerOptionInfo = getControllerOptionsList().at(currentListsIndex); + gameControllerOptionInfo.setControllerID(controllerIDString); + controllerOptionsList.replace(currentListsIndex, gameControllerOptionInfo); + } + else + { + setErrorMessage(QObject::trUtf8("Controller identifier is not a valid value.")); + } + } + else + { + unloadProfile = true; + profileLocation = ""; + } +} + +void CommandLineUtility::parseArgsStartSet(QCommandLineParser* parser) +{ + QStringList parserValues = QStringList() << parser->values("startSet"); + QListIterator profileForStartset(parserValues); + QString startSetText = QString(); + + if (profileForStartset.hasNext()) + { + startSetText = profileForStartset.next(); + + bool validNumber = false; + int tempNumber = startSetText.toInt(&validNumber); + + if (validNumber && (tempNumber >= 1) && (tempNumber <= 8)) + { + startSetNumber = tempNumber; + ControllerOptionsInfo tempInfo = getControllerOptionsList().at(currentListsIndex); + tempInfo.setStartSetNumber(startSetNumber); + controllerOptionsList.replace(currentListsIndex, tempInfo); + } + else if (validNumber) + { + setErrorMessage(QObject::trUtf8("An invalid set number '%1' was specified.").arg(tempNumber)); + } + + if (profileForStartset.hasNext()) + { + startSetText = profileForStartset.next(); + + if (validNumber) + { + controllerNumber = tempNumber; + ControllerOptionsInfo tempInfo = getControllerOptionsList().at(currentListsIndex); + tempInfo.setControllerNumber(controllerNumber); + controllerOptionsList.replace(currentListsIndex, tempInfo); + } + else if (!startSetText.isEmpty()) + { + controllerIDString = startSetText; + ControllerOptionsInfo tempInfo = getControllerOptionsList().at(currentListsIndex); + tempInfo.setControllerID(controllerIDString); + controllerOptionsList.replace(currentListsIndex, tempInfo); + } + else + { + setErrorMessage(QObject::trUtf8("Controller identifier '%s'' is not a valid value.").arg(startSetText)); + } + } + } + else + { + setErrorMessage(QObject::trUtf8("No set number was specified.")); + } +} + +void CommandLineUtility::parseArgsMap(QCommandLineParser* parser) +{ + QString mapOptionText = parser->value("map"); + + if (!mapOptionText.isEmpty()) { + + bool validNumber = false; + int tempNumber = mapOptionText.toInt(&validNumber); + + if (validNumber) + { + controllerNumber = tempNumber; + mappingController = true; + } + else if (!mapOptionText.isEmpty()) + { + controllerIDString = mapOptionText; + mappingController = true; + } + else + { + setErrorMessage(QObject::trUtf8("Controller identifier is not a valid value.")); + } + } + else + { + setErrorMessage(QObject::trUtf8("No controller was specified.")); + } +} + bool CommandLineUtility::isLaunchInTrayEnabled() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -539,11 +538,12 @@ bool CommandLineUtility::hasProfileInOptions() qInstallMessageHandler(MessageHandler::myMessageOutput); bool result = false; - QListIterator iter(getControllerOptionsList()); + while (iter.hasNext()) { ControllerOptionsInfo temp = iter.next(); + if (temp.hasProfile()) { result = true; diff --git a/src/commandlineutility.h b/src/commandlineutility.h old mode 100644 new mode 100755 index 89e893747..dedff6ea8 --- a/src/commandlineutility.h +++ b/src/commandlineutility.h @@ -188,6 +188,12 @@ class CommandLineUtility : public QObject QList controllerOptionsList; static QStringList eventGeneratorsList; + + void parseArgsProfile(QCommandLineParser* parser); + void parseArgsPrControle(QCommandLineParser* parser); + void parseArgsUnload(QCommandLineParser* parser); + void parseArgsStartSet(QCommandLineParser* parser); + void parseArgsMap(QCommandLineParser* parser); }; diff --git a/src/common.cpp b/src/common.cpp old mode 100644 new mode 100755 index e2f50f3da..f4ba7d299 --- a/src/common.cpp +++ b/src/common.cpp @@ -40,27 +40,25 @@ namespace PadderCommon if (!defaultProfileDir.isEmpty()) { QFileInfo dirinfo(defaultProfileDir); - if (dirinfo.isDir() && dirinfo.isReadable()) - { - lookupDir = defaultProfileDir; - } + + if (dirinfo.isDir() && dirinfo.isReadable()) lookupDir = defaultProfileDir; } if (lookupDir.isEmpty() && !lastProfileDir.isEmpty()) { QFileInfo dirinfo(lastProfileDir); - if (dirinfo.isDir() && dirinfo.isReadable()) - { - lookupDir = lastProfileDir; - } + + if (dirinfo.isDir() && dirinfo.isReadable()) lookupDir = lastProfileDir; } if (lookupDir.isEmpty()) { #ifdef Q_OS_WIN #ifdef WIN_PORTABLE_PACKAGE + QString portableProDir = QDir::currentPath().append("/profiles"); QFileInfo portableProDirInfo(portableProDir); + if (portableProDirInfo.isDir() && portableProDirInfo.isReadable()) { lookupDir = portableProDir; @@ -86,9 +84,8 @@ namespace PadderCommon QStringList list = QStringList(); - for (int a = 0; a < argc; ++a) { + for (int a = 0; a < argc; ++a) list << QString::fromLocal8Bit(argv[a]); - } return list; } @@ -101,17 +98,13 @@ namespace PadderCommon QStringList tempList = tempString.split(QRegExp("\""), QString::SkipEmptyParts); QStringList finalList = QStringList(); QStringListIterator iter(tempList); + while (iter.hasNext()) { QString temp = iter.next(); - if (inside) - { - finalList.append(temp); - } - else - { - finalList.append(temp.split(QRegExp("\\s+"), QString::SkipEmptyParts)); - } + + if (inside) finalList.append(temp); + else finalList.append(temp.split(QRegExp("\\s+"), QString::SkipEmptyParts)); inside = !inside; } diff --git a/src/common.h b/src/common.h old mode 100644 new mode 100755 diff --git a/src/config.h.in b/src/config.h.in old mode 100644 new mode 100755 diff --git a/src/dpadcontextmenu.cpp b/src/dpadcontextmenu.cpp old mode 100644 new mode 100755 index 0d8f449e7..b72675839 --- a/src/dpadcontextmenu.cpp +++ b/src/dpadcontextmenu.cpp @@ -48,141 +48,64 @@ void DPadContextMenu::buildMenu() { qInstallMessageHandler(MessageHandler::myMessageOutput); - QAction *action = nullptr; - QActionGroup *presetGroup = new QActionGroup(this); + QAction* action = nullptr; int presetMode = 0; int currentPreset = getPresetIndex(); - action = this->addAction(trUtf8("Mouse (Normal)")); - action->setCheckable(true); - action->setChecked(currentPreset == presetMode+1); - action->setData(QVariant(presetMode)); - connect(action, &QAction::triggered, this, [this, action] { - setDPadPreset(action); - }); - presetGroup->addAction(action); + generateActionPreset(action, trUtf8("Mouse (Normal)"), currentPreset, presetMode, presetGroup); + generateActionPreset(action, trUtf8("Mouse (Inverted Horizontal)"), currentPreset, presetMode, presetGroup); + generateActionPreset(action, trUtf8("Mouse (Inverted Vertical)"), currentPreset, presetMode, presetGroup); + generateActionPreset(action, trUtf8("Mouse (Inverted Horizontal + Vertical)"), currentPreset, presetMode, presetGroup); + generateActionPreset(action, trUtf8("Arrows"), currentPreset, presetMode, presetGroup); + generateActionPreset(action, trUtf8("Keys: W | A | S | D"), currentPreset, presetMode, presetGroup); + generateActionPreset(action, trUtf8("NumPad"), currentPreset, presetMode, presetGroup); + generateActionPreset(action, trUtf8("None"), currentPreset, presetMode, presetGroup); - presetMode++; - action = this->addAction(trUtf8("Mouse (Inverted Horizontal)")); - action->setCheckable(true); - action->setChecked(currentPreset == presetMode+1); - action->setData(QVariant(presetMode)); - connect(action, &QAction::triggered, this, [this, action] { - setDPadPreset(action); - }); - presetGroup->addAction(action); + this->addSeparator(); - presetMode++; - action = this->addAction(trUtf8("Mouse (Inverted Vertical)")); - action->setCheckable(true); - action->setChecked(currentPreset == presetMode+1); - action->setData(QVariant(presetMode)); - connect(action, &QAction::triggered, this, [this, action] { - setDPadPreset(action); - }); - presetGroup->addAction(action); + QActionGroup *modesGroup = new QActionGroup(this); - presetMode++; - action = this->addAction(trUtf8("Mouse (Inverted Horizontal + Vertical)")); - action->setCheckable(true); - action->setChecked(currentPreset == presetMode+1); - action->setData(QVariant(presetMode)); - connect(action, &QAction::triggered, this, [this, action] { - setDPadPreset(action); - }); - presetGroup->addAction(action); + generateActionMode(modesGroup, action, trUtf8("Standard"), static_cast(dpad->getJoyMode()), static_cast(JoyDPad::StandardMode)); + generateActionMode(modesGroup, action, trUtf8("Eight Way"), static_cast(dpad->getJoyMode()), static_cast(JoyDPad::EightWayMode)); + generateActionMode(modesGroup, action, trUtf8("4 Way Cardinal"), static_cast(dpad->getJoyMode()), static_cast(JoyDPad::FourWayCardinal)); + generateActionMode(modesGroup, action, trUtf8("4 Way Diagonal"), static_cast(dpad->getJoyMode()), static_cast(JoyDPad::FourWayDiagonal)); - presetMode++; - action = this->addAction(trUtf8("Arrows")); - action->setCheckable(true); - action->setChecked(currentPreset == presetMode+1); - action->setData(QVariant(presetMode)); - connect(action, &QAction::triggered, this, [this, action] { - setDPadPreset(action); - }); - presetGroup->addAction(action); + this->addSeparator(); - presetMode++; - action = this->addAction(trUtf8("Keys: W | A | S | D")); - action->setCheckable(true); - action->setChecked(currentPreset == presetMode+1); - action->setData(QVariant(presetMode)); - connect(action, &QAction::triggered, this, [this, action] { - setDPadPreset(action); - }); - presetGroup->addAction(action); + action = this->addAction(trUtf8("Mouse Settings")); + action->setCheckable(false); - presetMode++; - action = this->addAction(trUtf8("NumPad")); - action->setCheckable(true); - action->setChecked(currentPreset == presetMode+1); - action->setData(QVariant(presetMode)); - connect(action, &QAction::triggered, this, [this, action] { - setDPadPreset(action); - }); - presetGroup->addAction(action); + connect(action, &QAction::triggered, this, &DPadContextMenu::openMouseSettingsDialog); +} - presetMode++; - action = this->addAction(trUtf8("None")); +void DPadContextMenu::generateActionPreset(QAction* action, QString actionText, int currentPreset, int& presetMode, QActionGroup* presetGroup) +{ + action = this->addAction(actionText); action->setCheckable(true); - action->setChecked(currentPreset == presetMode+1); + action->setChecked(currentPreset == presetMode + 1); action->setData(QVariant(presetMode)); - connect(action, &QAction::triggered, this, [this, action] { - setDPadPreset(action); - }); - presetGroup->addAction(action); - - this->addSeparator(); - QActionGroup *modesGroup = new QActionGroup(this); - int mode = static_cast(JoyDPad::StandardMode); - - action = this->addAction(trUtf8("Standard")); - action->setCheckable(true); - action->setChecked(dpad->getJoyMode() == JoyDPad::StandardMode); - action->setData(QVariant(mode)); connect(action, &QAction::triggered, this, [this, action] { - setDPadMode(action); + setDPadPreset(action); }); - modesGroup->addAction(action); - action = this->addAction(trUtf8("Eight Way")); - action->setCheckable(true); - action->setChecked(dpad->getJoyMode() == JoyDPad::EightWayMode); - mode = static_cast(JoyDPad::EightWayMode); - action->setData(QVariant(mode)); - connect(action, &QAction::triggered, this, [this, action] { - setDPadMode(action); - }); - modesGroup->addAction(action); + presetGroup->addAction(action); + presetMode++; +} - action = this->addAction(trUtf8("4 Way Cardinal")); +void DPadContextMenu::generateActionMode(QActionGroup *modesGroup, QAction* action, QString actionText, int currentPreset, int presetMode) +{ + action = this->addAction(actionText); action->setCheckable(true); - action->setChecked(dpad->getJoyMode() == JoyDPad::FourWayCardinal); - mode = static_cast(JoyDPad::FourWayCardinal); - action->setData(QVariant(mode)); - connect(action, &QAction::triggered, this, [this, action] { - setDPadMode(action); - }); - modesGroup->addAction(action); + action->setChecked(currentPreset == presetMode); + action->setData(QVariant(presetMode)); - action = this->addAction(trUtf8("4 Way Diagonal")); - action->setCheckable(true); - action->setChecked(dpad->getJoyMode() == JoyDPad::FourWayDiagonal); - mode = static_cast(JoyDPad::FourWayDiagonal); - action->setData(QVariant(mode)); connect(action, &QAction::triggered, this, [this, action] { setDPadMode(action); }); modesGroup->addAction(action); - - this->addSeparator(); - - action = this->addAction(trUtf8("Mouse Settings")); - action->setCheckable(false); - connect(action, &QAction::triggered, this, &DPadContextMenu::openMouseSettingsDialog); } /** @@ -215,115 +138,134 @@ void DPadContextMenu::setDPadPreset(QAction* action) JoyButtonSlot *downLeftButtonSlot = nullptr; JoyButtonSlot *downRightButtonSlot = nullptr; - if (item == 0) + + switch(item) { - PadderCommon::inputDaemonMutex.lock(); + case 0: - upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - dpad->setJoyMode(JoyDPad::StandardMode); + PadderCommon::inputDaemonMutex.lock(); - PadderCommon::inputDaemonMutex.unlock(); - } - else if (item == 1) - { - PadderCommon::inputDaemonMutex.lock(); + upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + dpad->setJoyMode(JoyDPad::StandardMode); - upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - dpad->setJoyMode(JoyDPad::StandardMode); + PadderCommon::inputDaemonMutex.unlock(); - PadderCommon::inputDaemonMutex.unlock(); - } - else if (item == 2) - { - PadderCommon::inputDaemonMutex.lock(); + break; - upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - dpad->setJoyMode(JoyDPad::StandardMode); + case 1: - PadderCommon::inputDaemonMutex.unlock(); - } - else if (item == 3) - { - PadderCommon::inputDaemonMutex.lock(); + PadderCommon::inputDaemonMutex.lock(); - upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - dpad->setJoyMode(JoyDPad::StandardMode); + upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + dpad->setJoyMode(JoyDPad::StandardMode); - PadderCommon::inputDaemonMutex.unlock(); - } - else if (item == 4) - { - PadderCommon::inputDaemonMutex.lock(); + PadderCommon::inputDaemonMutex.unlock(); - upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Up), Qt::Key_Up, JoyButtonSlot::JoyKeyboard, this); - downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Down), Qt::Key_Down, JoyButtonSlot::JoyKeyboard, this); - leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Left), Qt::Key_Left, JoyButtonSlot::JoyKeyboard, this); - rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Right), Qt::Key_Right, JoyButtonSlot::JoyKeyboard, this); - dpad->setJoyMode(JoyDPad::StandardMode); + break; - PadderCommon::inputDaemonMutex.unlock(); - } - else if (item == 5) - { - PadderCommon::inputDaemonMutex.lock(); + case 2: - upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_W), Qt::Key_W, JoyButtonSlot::JoyKeyboard, this); - downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_S), Qt::Key_S, JoyButtonSlot::JoyKeyboard, this); - leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_A), Qt::Key_A, JoyButtonSlot::JoyKeyboard, this); - rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_D), Qt::Key_D, JoyButtonSlot::JoyKeyboard, this); - dpad->setJoyMode(JoyDPad::StandardMode); + PadderCommon::inputDaemonMutex.lock(); - PadderCommon::inputDaemonMutex.unlock(); - } - else if (item == 6) - { - PadderCommon::inputDaemonMutex.lock(); + upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + dpad->setJoyMode(JoyDPad::StandardMode); - if ((dpad->getJoyMode() == JoyDPad::StandardMode) || - (dpad->getJoyMode() == JoyDPad::FourWayCardinal)) - { - upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); - downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); - leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); - rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); - } - else if (dpad->getJoyMode() == JoyDPad::EightWayMode) - { - upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); - downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); - leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); - rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); - - upLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_7), QtKeyMapperBase::AntKey_KP_7, JoyButtonSlot::JoyKeyboard, this); - upRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_9), QtKeyMapperBase::AntKey_KP_9, JoyButtonSlot::JoyKeyboard, this); - downLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_1), QtKeyMapperBase::AntKey_KP_1, JoyButtonSlot::JoyKeyboard, this); - downRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_3), QtKeyMapperBase::AntKey_KP_3, JoyButtonSlot::JoyKeyboard, this); - } - else if (dpad->getJoyMode() == JoyDPad::FourWayDiagonal) - { - upLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_7), QtKeyMapperBase::AntKey_KP_7, JoyButtonSlot::JoyKeyboard, this); - upRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_9), QtKeyMapperBase::AntKey_KP_9, JoyButtonSlot::JoyKeyboard, this); - downLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_1), QtKeyMapperBase::AntKey_KP_1, JoyButtonSlot::JoyKeyboard, this); - downRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_3), QtKeyMapperBase::AntKey_KP_3, JoyButtonSlot::JoyKeyboard, this); - } + PadderCommon::inputDaemonMutex.unlock(); - PadderCommon::inputDaemonMutex.unlock(); - } - else if (item == 7) - { - QMetaObject::invokeMethod(&helper, "clearButtonsSlotsEventReset", Qt::BlockingQueuedConnection); + break; + + case 3: + + PadderCommon::inputDaemonMutex.lock(); + + upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + dpad->setJoyMode(JoyDPad::StandardMode); + + PadderCommon::inputDaemonMutex.unlock(); + + break; + + case 4: + + PadderCommon::inputDaemonMutex.lock(); + + upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Up), Qt::Key_Up, JoyButtonSlot::JoyKeyboard, this); + downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Down), Qt::Key_Down, JoyButtonSlot::JoyKeyboard, this); + leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Left), Qt::Key_Left, JoyButtonSlot::JoyKeyboard, this); + rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Right), Qt::Key_Right, JoyButtonSlot::JoyKeyboard, this); + dpad->setJoyMode(JoyDPad::StandardMode); + + PadderCommon::inputDaemonMutex.unlock(); + + break; + + case 5: + + PadderCommon::inputDaemonMutex.lock(); + + upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_W), Qt::Key_W, JoyButtonSlot::JoyKeyboard, this); + downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_S), Qt::Key_S, JoyButtonSlot::JoyKeyboard, this); + leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_A), Qt::Key_A, JoyButtonSlot::JoyKeyboard, this); + rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_D), Qt::Key_D, JoyButtonSlot::JoyKeyboard, this); + dpad->setJoyMode(JoyDPad::StandardMode); + + PadderCommon::inputDaemonMutex.unlock(); + + break; + + case 6: + + PadderCommon::inputDaemonMutex.lock(); + + if ((dpad->getJoyMode() == JoyDPad::StandardMode) || + (dpad->getJoyMode() == JoyDPad::FourWayCardinal)) + { + upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); + downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); + leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); + rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); + } + else if (dpad->getJoyMode() == JoyDPad::EightWayMode) + { + upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); + downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); + leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); + rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); + + upLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_7), QtKeyMapperBase::AntKey_KP_7, JoyButtonSlot::JoyKeyboard, this); + upRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_9), QtKeyMapperBase::AntKey_KP_9, JoyButtonSlot::JoyKeyboard, this); + downLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_1), QtKeyMapperBase::AntKey_KP_1, JoyButtonSlot::JoyKeyboard, this); + downRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_3), QtKeyMapperBase::AntKey_KP_3, JoyButtonSlot::JoyKeyboard, this); + } + else if (dpad->getJoyMode() == JoyDPad::FourWayDiagonal) + { + upLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_7), QtKeyMapperBase::AntKey_KP_7, JoyButtonSlot::JoyKeyboard, this); + upRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_9), QtKeyMapperBase::AntKey_KP_9, JoyButtonSlot::JoyKeyboard, this); + downLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_1), QtKeyMapperBase::AntKey_KP_1, JoyButtonSlot::JoyKeyboard, this); + downRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_3), QtKeyMapperBase::AntKey_KP_3, JoyButtonSlot::JoyKeyboard, this); + } + + PadderCommon::inputDaemonMutex.unlock(); + + break; + + case 7: + + QMetaObject::invokeMethod(&helper, "clearButtonsSlotsEventReset", Qt::BlockingQueuedConnection); + + break; } QHash tempHash; diff --git a/src/dpadcontextmenu.h b/src/dpadcontextmenu.h old mode 100644 new mode 100755 index 015fc81c5..55178a2de --- a/src/dpadcontextmenu.h +++ b/src/dpadcontextmenu.h @@ -46,6 +46,9 @@ private slots: JoyDPad *dpad; DPadContextMenuHelper helper; + + void generateActionPreset(QAction* action, QString actionText, int currentPreset, int& presetMode, QActionGroup* presetGroup); + void generateActionMode(QActionGroup *modesGroup, QAction* action, QString actionText, int currentPreset, int presetMode); }; #endif // DPADCONTEXTMENU_H diff --git a/src/dpadeditdialog.cpp b/src/dpadeditdialog.cpp old mode 100644 new mode 100755 index ce093bb61..fcf1b7076 --- a/src/dpadeditdialog.cpp +++ b/src/dpadeditdialog.cpp @@ -50,21 +50,25 @@ DPadEditDialog::DPadEditDialog(JoyDPad *dpad, QWidget *parent) : updateWindowTitleDPadName(); - if (dpad->getJoyMode() == JoyDPad::StandardMode) - { - ui->joyModeComboBox->setCurrentIndex(0); - } - else if (dpad->getJoyMode() == JoyDPad::EightWayMode) - { - ui->joyModeComboBox->setCurrentIndex(1); - } - else if (dpad->getJoyMode() == JoyDPad::FourWayCardinal) - { - ui->joyModeComboBox->setCurrentIndex(2); - } - else if (dpad->getJoyMode() == JoyDPad::FourWayDiagonal) + + switch(dpad->getJoyMode()) { - ui->joyModeComboBox->setCurrentIndex(3); + case JoyDPad::StandardMode: + ui->joyModeComboBox->setCurrentIndex(0); + break; + + case JoyDPad::EightWayMode: + ui->joyModeComboBox->setCurrentIndex(1); + break; + + case JoyDPad::FourWayCardinal: + ui->joyModeComboBox->setCurrentIndex(2); + break; + + case JoyDPad::FourWayDiagonal: + ui->joyModeComboBox->setCurrentIndex(3); + break; + } selectCurrentPreset(); @@ -72,7 +76,7 @@ DPadEditDialog::DPadEditDialog(JoyDPad *dpad, QWidget *parent) : ui->dpadNameLineEdit->setText(dpad->getDpadName()); int dpadDelay = dpad->getDPadDelay(); - ui->dpadDelaySlider->setValue(static_cast(dpadDelay * .1)); + ui->dpadDelaySlider->setValue(dpadDelay * .1); ui->dpadDelayDoubleSpinBox->setValue(dpadDelay * .001); PadderCommon::inputDaemonMutex.unlock(); @@ -109,123 +113,138 @@ void DPadEditDialog::implementPresets(int index) JoyButtonSlot *downLeftButtonSlot = nullptr; JoyButtonSlot *downRightButtonSlot = nullptr; - if (index == 1) + switch(index) { - PadderCommon::inputDaemonMutex.lock(); + case 1: + PadderCommon::inputDaemonMutex.lock(); - upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - PadderCommon::inputDaemonMutex.unlock(); + PadderCommon::inputDaemonMutex.unlock(); - ui->joyModeComboBox->setCurrentIndex(0); - } - else if (index == 2) - { - PadderCommon::inputDaemonMutex.lock(); + ui->joyModeComboBox->setCurrentIndex(0); + break; - upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + case 2: - PadderCommon::inputDaemonMutex.unlock(); + PadderCommon::inputDaemonMutex.lock(); - ui->joyModeComboBox->setCurrentIndex(0); - } - else if (index == 3) - { - PadderCommon::inputDaemonMutex.lock(); + upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + PadderCommon::inputDaemonMutex.unlock(); - PadderCommon::inputDaemonMutex.unlock(); + ui->joyModeComboBox->setCurrentIndex(0); - ui->joyModeComboBox->setCurrentIndex(0); - } - else if (index == 4) - { - PadderCommon::inputDaemonMutex.lock(); + break; - upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + case 3: - PadderCommon::inputDaemonMutex.unlock(); + PadderCommon::inputDaemonMutex.lock(); - ui->joyModeComboBox->setCurrentIndex(0); - } - else if (index == 5) - { - PadderCommon::inputDaemonMutex.lock(); + upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Up), Qt::Key_Up, JoyButtonSlot::JoyKeyboard, this); - downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Down), Qt::Key_Down, JoyButtonSlot::JoyKeyboard, this); - leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Left), Qt::Key_Left, JoyButtonSlot::JoyKeyboard, this); - rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Right), Qt::Key_Right, JoyButtonSlot::JoyKeyboard, this); + PadderCommon::inputDaemonMutex.unlock(); - PadderCommon::inputDaemonMutex.unlock(); + ui->joyModeComboBox->setCurrentIndex(0); - ui->joyModeComboBox->setCurrentIndex(0); - } - else if (index == 6) - { - PadderCommon::inputDaemonMutex.lock(); + break; - upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_W), Qt::Key_W, JoyButtonSlot::JoyKeyboard, this); - downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_S), Qt::Key_S, JoyButtonSlot::JoyKeyboard, this); - leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_A), Qt::Key_A, JoyButtonSlot::JoyKeyboard, this); - rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_D), Qt::Key_D, JoyButtonSlot::JoyKeyboard, this); + case 4: - PadderCommon::inputDaemonMutex.unlock(); + PadderCommon::inputDaemonMutex.lock(); - ui->joyModeComboBox->setCurrentIndex(0); - } - else if (index == 7) - { - PadderCommon::inputDaemonMutex.lock(); + upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - if ((ui->joyModeComboBox->currentIndex() == 0) || - (ui->joyModeComboBox->currentIndex() == 2)) - { - upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); - downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); - leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); - rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); - } - else if (ui->joyModeComboBox->currentIndex() == 1) - { - upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); - downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); - leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); - rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); - - upLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_7), QtKeyMapperBase::AntKey_KP_7, JoyButtonSlot::JoyKeyboard, this); - upRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_9), QtKeyMapperBase::AntKey_KP_9, JoyButtonSlot::JoyKeyboard, this); - downLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_1), QtKeyMapperBase::AntKey_KP_1, JoyButtonSlot::JoyKeyboard, this); - downRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_3), QtKeyMapperBase::AntKey_KP_3, JoyButtonSlot::JoyKeyboard, this); - } - else if (ui->joyModeComboBox->currentIndex() == 3) - { - upLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_7), QtKeyMapperBase::AntKey_KP_7, JoyButtonSlot::JoyKeyboard, this); - upRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_9), QtKeyMapperBase::AntKey_KP_9, JoyButtonSlot::JoyKeyboard, this); - downLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_1), QtKeyMapperBase::AntKey_KP_1, JoyButtonSlot::JoyKeyboard, this); - downRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_3), QtKeyMapperBase::AntKey_KP_3, JoyButtonSlot::JoyKeyboard, this); - } + PadderCommon::inputDaemonMutex.unlock(); - PadderCommon::inputDaemonMutex.unlock(); - } - else if (index == 8) - { - QMetaObject::invokeMethod(&helper, "clearButtonsSlotsEventReset", Qt::BlockingQueuedConnection); - } + ui->joyModeComboBox->setCurrentIndex(0); + + break; + + case 5: + + PadderCommon::inputDaemonMutex.lock(); + + upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Up), Qt::Key_Up, JoyButtonSlot::JoyKeyboard, this); + downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Down), Qt::Key_Down, JoyButtonSlot::JoyKeyboard, this); + leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Left), Qt::Key_Left, JoyButtonSlot::JoyKeyboard, this); + rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Right), Qt::Key_Right, JoyButtonSlot::JoyKeyboard, this); + + PadderCommon::inputDaemonMutex.unlock(); + ui->joyModeComboBox->setCurrentIndex(0); + + break; + + case 6: + + PadderCommon::inputDaemonMutex.lock(); + + upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_W), Qt::Key_W, JoyButtonSlot::JoyKeyboard, this); + downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_S), Qt::Key_S, JoyButtonSlot::JoyKeyboard, this); + leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_A), Qt::Key_A, JoyButtonSlot::JoyKeyboard, this); + rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_D), Qt::Key_D, JoyButtonSlot::JoyKeyboard, this); + + PadderCommon::inputDaemonMutex.unlock(); + + ui->joyModeComboBox->setCurrentIndex(0); + + break; + + case 7: + + PadderCommon::inputDaemonMutex.lock(); + + if ((ui->joyModeComboBox->currentIndex() == 0) || + (ui->joyModeComboBox->currentIndex() == 2)) + { + upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); + downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); + leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); + rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); + } + else if (ui->joyModeComboBox->currentIndex() == 1) + { + upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); + downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); + leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); + rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); + + upLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_7), QtKeyMapperBase::AntKey_KP_7, JoyButtonSlot::JoyKeyboard, this); + upRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_9), QtKeyMapperBase::AntKey_KP_9, JoyButtonSlot::JoyKeyboard, this); + downLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_1), QtKeyMapperBase::AntKey_KP_1, JoyButtonSlot::JoyKeyboard, this); + downRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_3), QtKeyMapperBase::AntKey_KP_3, JoyButtonSlot::JoyKeyboard, this); + } + else if (ui->joyModeComboBox->currentIndex() == 3) + { + upLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_7), QtKeyMapperBase::AntKey_KP_7, JoyButtonSlot::JoyKeyboard, this); + upRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_9), QtKeyMapperBase::AntKey_KP_9, JoyButtonSlot::JoyKeyboard, this); + downLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_1), QtKeyMapperBase::AntKey_KP_1, JoyButtonSlot::JoyKeyboard, this); + downRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_3), QtKeyMapperBase::AntKey_KP_3, JoyButtonSlot::JoyKeyboard, this); + } + + PadderCommon::inputDaemonMutex.unlock(); + + break; + + case 8: + + QMetaObject::invokeMethod(&helper, "clearButtonsSlotsEventReset", Qt::BlockingQueuedConnection); + + break; + } QHash tempHash; tempHash.insert(JoyDPadButton::DpadUp, upButtonSlot); @@ -241,6 +260,7 @@ void DPadEditDialog::implementPresets(int index) QMetaObject::invokeMethod(&helper, "setFromPendingSlots", Qt::BlockingQueuedConnection); } + void DPadEditDialog::implementModes(int index) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -249,21 +269,23 @@ void DPadEditDialog::implementModes(int index) dpad->releaseButtonEvents(); - if (index == 0) + switch(index) { - dpad->setJoyMode(JoyDPad::StandardMode); - } - else if (index == 1) - { - dpad->setJoyMode(JoyDPad::EightWayMode); - } - else if (index == 2) - { - dpad->setJoyMode(JoyDPad::FourWayCardinal); - } - else if (index == 3) - { - dpad->setJoyMode(JoyDPad::FourWayDiagonal); + case 0: + dpad->setJoyMode(JoyDPad::StandardMode); + break; + + case 1: + dpad->setJoyMode(JoyDPad::EightWayMode); + break; + + case 2: + dpad->setJoyMode(JoyDPad::FourWayCardinal); + break; + + case 3: + dpad->setJoyMode(JoyDPad::FourWayDiagonal); + break; } PadderCommon::inputDaemonMutex.unlock(); @@ -275,10 +297,13 @@ void DPadEditDialog::selectCurrentPreset() JoyDPadButton *upButton = dpad->getJoyButton(JoyDPadButton::DpadUp); QList *upslots = upButton->getAssignedSlots(); + JoyDPadButton *downButton = dpad->getJoyButton(JoyDPadButton::DpadDown); QList *downslots = downButton->getAssignedSlots(); + JoyDPadButton *leftButton = dpad->getJoyButton(JoyDPadButton::DpadLeft); QList *leftslots = leftButton->getAssignedSlots(); + JoyDPadButton *rightButton = dpad->getJoyButton(JoyDPadButton::DpadRight); QList *rightslots = rightButton->getAssignedSlots(); @@ -373,7 +398,7 @@ void DPadEditDialog::updateDPadDelaySpinBox(int value) { qInstallMessageHandler(MessageHandler::myMessageOutput); - double temp = (value * 0.001); // static_cast + double temp = value * 0.001; ui->dpadDelayDoubleSpinBox->setValue(temp); } @@ -385,10 +410,11 @@ void DPadEditDialog::updateDPadDelaySlider(double value) { qInstallMessageHandler(MessageHandler::myMessageOutput); - int temp = static_cast(value) * 100; - if (ui->dpadDelaySlider->value() != temp) + int currentDpadDelay = value * 100; + + if (ui->dpadDelaySlider->value() != currentDpadDelay) { - ui->dpadDelaySlider->setValue(temp); + ui->dpadDelaySlider->setValue(currentDpadDelay); } } @@ -398,21 +424,15 @@ void DPadEditDialog::updateWindowTitleDPadName() QString temp = QString(trUtf8("Set")).append(" "); - if (!dpad->getDpadName().isEmpty()) - { - temp.append(dpad->getName(false, true)); - } - else - { - temp.append(dpad->getName()); - } + if (!dpad->getDpadName().isEmpty()) temp.append(dpad->getName(false, true)); + else temp.append(dpad->getName()); if (dpad->getParentSet()->getIndex() != 0) { int setIndex = dpad->getParentSet()->getRealIndex(); temp.append(" [").append(trUtf8("Set %1").arg(setIndex)); - QString setName = dpad->getParentSet()->getName(); + if (!setName.isEmpty()) { temp.append(": ").append(setName); diff --git a/src/dpadeditdialog.h b/src/dpadeditdialog.h old mode 100644 new mode 100755 diff --git a/src/dpadeditdialog.ui b/src/dpadeditdialog.ui old mode 100644 new mode 100755 diff --git a/src/dpadpushbutton.cpp b/src/dpadpushbutton.cpp old mode 100644 new mode 100755 index 19c6ac100..a6a458b32 --- a/src/dpadpushbutton.cpp +++ b/src/dpadpushbutton.cpp @@ -23,7 +23,6 @@ #include - DPadPushButton::DPadPushButton(JoyDPad *dpad, bool displayNames, QWidget *parent) : FlashButtonWidget(displayNames, parent) { @@ -54,14 +53,9 @@ QString DPadPushButton::generateLabel() qInstallMessageHandler(MessageHandler::myMessageOutput); QString temp = QString(); - if (!dpad->getDpadName().isEmpty()) - { - temp.append(dpad->getName(false, ifDisplayNames())); - } - else - { - temp.append(dpad->getName()); - } + + if (!dpad->getDpadName().isEmpty()) temp.append(dpad->getName(false, ifDisplayNames())); + else temp.append(dpad->getName()); #ifndef QT_DEBUG_NO_OUTPUT qDebug() << "Dpad button name is: " << temp; @@ -76,6 +70,7 @@ void DPadPushButton::disableFlashes() disconnect(dpad, &JoyDPad::active, this, &DPadPushButton::flash); disconnect(dpad, &JoyDPad::released, this, &DPadPushButton::unflash); + this->unflash(); } @@ -93,6 +88,7 @@ void DPadPushButton::showContextMenu(const QPoint &point) QPoint globalPos = this->mapToGlobal(point); DPadContextMenu *contextMenu = new DPadContextMenu(dpad, this); + contextMenu->buildMenu(); contextMenu->popup(globalPos); } diff --git a/src/dpadpushbutton.h b/src/dpadpushbutton.h old mode 100644 new mode 100755 index 87be97a7c..5e374985a --- a/src/dpadpushbutton.h +++ b/src/dpadpushbutton.h @@ -37,11 +37,11 @@ class DPadPushButton : public FlashButtonWidget void tryFlash(); protected: - QString generateLabel(); + QString generateLabel() override; public slots: - void disableFlashes(); - void enableFlashes(); + void disableFlashes() override; + void enableFlashes() override; private slots: void showContextMenu(const QPoint &point); diff --git a/src/dpadpushbuttongroup.cpp b/src/dpadpushbuttongroup.cpp old mode 100644 new mode 100755 index a4fe4c0b0..ad0ea871c --- a/src/dpadpushbuttongroup.cpp +++ b/src/dpadpushbuttongroup.cpp @@ -29,7 +29,6 @@ #include #include - DPadPushButtonGroup::DPadPushButtonGroup(JoyDPad *dpad, bool displayNames, QWidget *parent) : QGridLayout(parent) { @@ -50,115 +49,36 @@ void DPadPushButtonGroup::generateButtons() QHash *buttons = dpad->getJoyButtons(); - JoyDPadButton *button = nullptr; - JoyDPadButtonWidget *pushbutton = nullptr; - - button = buttons->value(JoyDPadButton::DpadLeftUp); - upLeftButton = new JoyDPadButtonWidget(button, displayNames, parentWidget()); - pushbutton = upLeftButton; - connect(pushbutton, &JoyDPadButtonWidget::clicked, this, [this, pushbutton] { - openDPadButtonDialog(pushbutton); - }); - - button->establishPropertyUpdatedConnections(); - - connect(button, &JoyDPadButton::slotsChanged, this, &DPadPushButtonGroup::propogateSlotsChanged); - - addWidget(pushbutton, 0, 0); - - - button = buttons->value(JoyDPadButton::DpadUp); - upButton = new JoyDPadButtonWidget(button, displayNames, parentWidget()); - pushbutton = upButton; - connect(pushbutton, &JoyDPadButtonWidget::clicked, this, [this, pushbutton] { - openDPadButtonDialog(pushbutton); - }); - - button->establishPropertyUpdatedConnections(); - - connect(button, &JoyDPadButton::slotsChanged, this, &DPadPushButtonGroup::propogateSlotsChanged); - - addWidget(pushbutton, 0, 1); - - button = buttons->value(JoyDPadButton::DpadRightUp); - upRightButton = new JoyDPadButtonWidget(button, displayNames, parentWidget()); - pushbutton = upRightButton; - connect(pushbutton, &JoyDPadButtonWidget::clicked, this, [this, pushbutton] { - openDPadButtonDialog(pushbutton); - }); - - button->establishPropertyUpdatedConnections(); - - connect(button, &JoyDPadButton::slotsChanged, this, &DPadPushButtonGroup::propogateSlotsChanged); - - addWidget(pushbutton, 0, 2); - - button = buttons->value(JoyDPadButton::DpadLeft); - leftButton = new JoyDPadButtonWidget(button, displayNames, parentWidget()); - pushbutton = leftButton; - connect(pushbutton, &JoyDPadButtonWidget::clicked, this, [this, pushbutton] { - openDPadButtonDialog(pushbutton); - }); - - button->establishPropertyUpdatedConnections(); - - connect(button, &JoyDPadButton::slotsChanged, this, &DPadPushButtonGroup::propogateSlotsChanged); - - addWidget(pushbutton, 1, 0); + upLeftButton = generateBtnForGrid(buttons, 9, 0, 0); + upButton = generateBtnForGrid(buttons, 1, 0, 1); + upRightButton = generateBtnForGrid(buttons, 3, 0, 2); + leftButton = generateBtnForGrid(buttons, 8, 1, 0); dpadWidget = new DPadPushButton(dpad, displayNames, parentWidget()); dpadWidget->setIcon(QIcon::fromTheme(QString::fromUtf8("games-config-options"))); connect(dpadWidget, &DPadPushButton::clicked, this, &DPadPushButtonGroup::showDPadDialog); addWidget(dpadWidget, 1, 1); - button = buttons->value(JoyDPadButton::DpadRight); - rightButton = new JoyDPadButtonWidget(button, displayNames, parentWidget()); - pushbutton = rightButton; - connect(pushbutton, &JoyDPadButtonWidget::clicked, this, [this, pushbutton] { - openDPadButtonDialog(pushbutton); - }); - - button->establishPropertyUpdatedConnections(); - - connect(button, &JoyDPadButton::slotsChanged, this, &DPadPushButtonGroup::propogateSlotsChanged); - - addWidget(pushbutton, 1, 2); - - button = buttons->value(JoyDPadButton::DpadLeftDown); - downLeftButton = new JoyDPadButtonWidget(button, displayNames, parentWidget()); - pushbutton = downLeftButton; - connect(pushbutton, &JoyDPadButtonWidget::clicked, this, [this, pushbutton] { - openDPadButtonDialog(pushbutton); - }); - - button->establishPropertyUpdatedConnections(); - connect(button, &JoyDPadButton::slotsChanged, this, &DPadPushButtonGroup::propogateSlotsChanged); - - addWidget(pushbutton, 2, 0); - - button = buttons->value(JoyDPadButton::DpadDown); - downButton = new JoyDPadButtonWidget(button, displayNames, parentWidget()); - pushbutton = downButton; - connect(pushbutton, &JoyDPadButtonWidget::clicked, this, [this, pushbutton] { - openDPadButtonDialog(pushbutton); - }); - - button->establishPropertyUpdatedConnections(); - connect(button, &JoyDPadButton::slotsChanged, this, &DPadPushButtonGroup::propogateSlotsChanged); + rightButton = generateBtnForGrid(buttons, 2, 1, 2); + downLeftButton = generateBtnForGrid(buttons, 12, 2, 0); + downButton = generateBtnForGrid(buttons, 4, 2, 1); + downRightButton = generateBtnForGrid(buttons, 6, 2, 2); +} - addWidget(pushbutton, 2, 1); +JoyDPadButtonWidget* DPadPushButtonGroup::generateBtnForGrid(QHash *buttons, int dpadDirection, int cellRow, int cellCol) +{ + JoyDPadButton *button = buttons->value(static_cast(dpadDirection)); + JoyDPadButtonWidget *pushbutton = new JoyDPadButtonWidget(button, displayNames, parentWidget()); - button = buttons->value(JoyDPadButton::DpadRightDown); - downRightButton = new JoyDPadButtonWidget(button, displayNames, parentWidget()); - pushbutton = downRightButton; connect(pushbutton, &JoyDPadButtonWidget::clicked, this, [this, pushbutton] { openDPadButtonDialog(pushbutton); }); button->establishPropertyUpdatedConnections(); connect(button, &JoyDPadButton::slotsChanged, this, &DPadPushButtonGroup::propogateSlotsChanged); + addWidget(pushbutton, cellRow, cellCol); - addWidget(pushbutton, 2, 2); + return pushbutton; } void DPadPushButtonGroup::changeButtonLayout() diff --git a/src/dpadpushbuttongroup.h b/src/dpadpushbuttongroup.h old mode 100644 new mode 100755 index 44e82e55a..180ab437e --- a/src/dpadpushbuttongroup.h +++ b/src/dpadpushbuttongroup.h @@ -25,6 +25,7 @@ class QWidget; class JoyDPadButtonWidget; class DPadPushButton; class JoyButtonWidget; +class JoyDPadButton; class DPadPushButtonGroup : public QGridLayout { @@ -65,6 +66,8 @@ private slots: JoyDPadButtonWidget *downRightButton; DPadPushButton *dpadWidget; + + JoyDPadButtonWidget * generateBtnForGrid(QHash *buttons, int dpadDirection , int cellRow, int cellCol); }; #endif // DPADPUSHBUTTONGROUP_H diff --git a/src/editalldefaultautoprofiledialog.cpp b/src/editalldefaultautoprofiledialog.cpp old mode 100644 new mode 100755 index 56c36885e..3a1f2c597 --- a/src/editalldefaultautoprofiledialog.cpp +++ b/src/editalldefaultautoprofiledialog.cpp @@ -36,6 +36,7 @@ EditAllDefaultAutoProfileDialog::EditAllDefaultAutoProfileDialog(AutoProfileInfo ui(new Ui::EditAllDefaultAutoProfileDialog) { ui->setupUi(this); + qInstallMessageHandler(MessageHandler::myMessageOutput); setAttribute(Qt::WA_DeleteOnClose); @@ -44,9 +45,7 @@ EditAllDefaultAutoProfileDialog::EditAllDefaultAutoProfileDialog(AutoProfileInfo this->settings = settings; if (!info->getProfileLocation().isEmpty()) - { ui->profileLineEdit->setText(info->getProfileLocation()); - } connect(ui->profileBrowsePushButton, &QPushButton::clicked, this, &EditAllDefaultAutoProfileDialog::openProfileBrowseDialog); connect(this, &EditAllDefaultAutoProfileDialog::accepted, this, &EditAllDefaultAutoProfileDialog::saveAutoProfileInformation); @@ -63,12 +62,10 @@ void EditAllDefaultAutoProfileDialog::openProfileBrowseDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); - QString lookupDir = PadderCommon::preferredProfileDir(settings); - QString filename = QFileDialog::getOpenFileName(this, trUtf8("Open Config"), lookupDir, QString("Config Files (*.amgp *.xml)")); - if (!filename.isNull() && !filename.isEmpty()) - { - ui->profileLineEdit->setText(filename); - } + QString preferredProfileDir = PadderCommon::preferredProfileDir(settings); + QString profileFilename = QFileDialog::getOpenFileName(this, trUtf8("Open Config"), preferredProfileDir, QString("Config Files (*.amgp *.xml)")); + + if (!profileFilename.isNull() && !profileFilename.isEmpty()) ui->profileLineEdit->setText(profileFilename); } void EditAllDefaultAutoProfileDialog::saveAutoProfileInformation() @@ -93,11 +90,12 @@ void EditAllDefaultAutoProfileDialog::accept() bool validForm = true; QString errorString = QString(); + if (ui->profileLineEdit->text().length() > 0) { - QString profileFilename = ui->profileLineEdit->text(); - QFileInfo info(profileFilename); - if (!info.exists()) + QFileInfo profileInfo(ui->profileLineEdit->text()); + + if (!profileInfo.exists()) { validForm = false; errorString = trUtf8("Profile file path is invalid."); diff --git a/src/editalldefaultautoprofiledialog.h b/src/editalldefaultautoprofiledialog.h old mode 100644 new mode 100755 diff --git a/src/editalldefaultautoprofiledialog.ui b/src/editalldefaultautoprofiledialog.ui old mode 100644 new mode 100755 diff --git a/src/event.cpp b/src/event.cpp old mode 100644 new mode 100755 index 3611368b3..f602e171a --- a/src/event.cpp +++ b/src/event.cpp @@ -28,7 +28,7 @@ #include #include "event.h" - +#include "globalvariables.h" #include "messagehandler.h" #include "eventhandlerfactory.h" #include "joybutton.h" @@ -62,7 +62,7 @@ // based around a fixed bounding box resolution. void fakeAbsMouseCoordinates(double springX, double springY, int width, int height, - int &finalx, int &finaly, int screen=-1) + int &finalx, int &finaly, int screen) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -100,14 +100,13 @@ void fakeAbsMouseCoordinates(double springX, double springY, destMidWidth = destSpringWidth / 2; destMidHeight = destSpringHeight / 2; - finalx = (screenMidwidth + (static_cast(springX) * destMidWidth) + deskRect.x()); - finaly = (screenMidheight + (static_cast(springY) * destMidHeight) + deskRect.y()); + finalx = (screenMidwidth + (springX * destMidWidth) + deskRect.x()); + finaly = (screenMidheight + (springY * destMidHeight) + deskRect.y()); } // Create the event used by the operating system. void sendevent(JoyButtonSlot *slot, bool pressed) { - qInstallMessageHandler(MessageHandler::myMessageOutput); JoyButtonSlot::JoySlotInputAction device = slot->getSlotMode(); @@ -126,16 +125,15 @@ void sendevent(JoyButtonSlot *slot, bool pressed) } else if ((device == JoyButtonSlot::JoyExecute) && pressed && !slot->getTextData().isEmpty()) { - QString execString = slot->getTextData(); if (slot->getExtraData().canConvert()) { QString argumentsString = slot->getExtraData().toString(); QStringList argumentsTempList(PadderCommon::parseArgumentsString(argumentsString)); - QProcess::startDetached(execString, argumentsTempList); + QProcess::startDetached(slot->getTextData(), argumentsTempList); } else { - QProcess::startDetached(execString); + QProcess::startDetached(slot->getTextData()); } } } @@ -200,31 +198,25 @@ void sendSpringEventRefactor(PadderCommon::springModeInfo *fullSpring, int pivotY = 0; if (PadderCommon::mouseHelperObj.pivotPoint[0] != -1) - { pivotX = PadderCommon::mouseHelperObj.pivotPoint[0]; - } if (PadderCommon::mouseHelperObj.pivotPoint[1] != -1) - { pivotY = PadderCommon::mouseHelperObj.pivotPoint[1]; - } - if ((pivotX >= 0) && (pivotY >= 0)) { + if ((pivotX >= 0) && (pivotY >= 0)) + { + // Find a use for this routine in this context. int destRelativeWidth = relativeSpring->width; int destRelativeHeight = relativeSpring->height; - int xRelativeMoovCoor = 0; + int yRelativeMoovCoor = 0; + if (relativeSpring->displacementX >= -1.0) - { - xRelativeMoovCoor = (static_cast(relativeSpring->displacementX) * destRelativeWidth) / 2; - } + xRelativeMoovCoor = (relativeSpring->displacementX * destRelativeWidth) / 2; - int yRelativeMoovCoor = 0; if (relativeSpring->displacementY >= -1.0) - { - yRelativeMoovCoor = (static_cast(relativeSpring->displacementY) * destRelativeHeight) / 2; - } + yRelativeMoovCoor = (relativeSpring->displacementY * destRelativeHeight) / 2; xmovecoor += xRelativeMoovCoor; ymovecoor += yRelativeMoovCoor; @@ -239,7 +231,6 @@ void sendSpringEventRefactor(PadderCommon::springModeInfo *fullSpring, } else if (handler->getIdentifier() == "uinput") { - fakeAbsMouseCoordinates(displacementX, displacementY, springWidth, springHeight, xmovecoor, ymovecoor, fullSpring->screen); @@ -273,14 +264,17 @@ void sendSpringEvent(PadderCommon::springModeInfo *fullSpring, { int xmovecoor = 0; int ymovecoor = 0; + int width = 0; int height = 0; int midwidth = 0; int midheight = 0; + int destSpringWidth = 0; int destSpringHeight = 0; int destMidWidth = 0; int destMidHeight = 0; + int currentMouseX = 0; int currentMouseY = 0; @@ -335,6 +329,7 @@ void sendSpringEvent(PadderCommon::springModeInfo *fullSpring, int pivotX = currentMouseX; int pivotY = currentMouseY; + if (relativeSpring != nullptr) { if (PadderCommon::mouseHelperObj.pivotPoint[0] != -1) @@ -356,44 +351,36 @@ void sendSpringEvent(PadderCommon::springModeInfo *fullSpring, } } - xmovecoor = (fullSpring->displacementX >= -1.0) ? (midwidth + (static_cast(fullSpring->displacementX) * destMidWidth) + deskRect.x()): pivotX; - ymovecoor = (fullSpring->displacementY >= -1.0) ? (midheight + (static_cast(fullSpring->displacementY) * destMidHeight) + deskRect.y()) : pivotY; + xmovecoor = (fullSpring->displacementX >= -1.0) ? (midwidth + (fullSpring->displacementX * destMidWidth) + deskRect.x()): pivotX; + ymovecoor = (fullSpring->displacementY >= -1.0) ? (midheight + (fullSpring->displacementY * destMidHeight) + deskRect.y()) : pivotY; int fullSpringDestX = xmovecoor; int fullSpringDestY = ymovecoor; int destRelativeWidth = 0; int destRelativeHeight = 0; + if ((relativeSpring != nullptr) && (relativeSpring->width >= 2) && (relativeSpring->height >= 2)) { destRelativeWidth = relativeSpring->width; destRelativeHeight = relativeSpring->height; int xRelativeMoovCoor = 0; + int yRelativeMoovCoor = 0; + if (relativeSpring->displacementX >= -1.0) - { - xRelativeMoovCoor = (static_cast(relativeSpring->displacementX) * destRelativeWidth) / 2; - } + xRelativeMoovCoor = (relativeSpring->displacementX * destRelativeWidth) / 2; - int yRelativeMoovCoor = 0; if (relativeSpring->displacementY >= -1.0) - { - yRelativeMoovCoor = (static_cast(relativeSpring->displacementY) * destRelativeHeight) / 2; - } + yRelativeMoovCoor = (relativeSpring->displacementY * destRelativeHeight) / 2; xmovecoor += xRelativeMoovCoor; ymovecoor += yRelativeMoovCoor; } - if (mousePosX) - { - *mousePosX = xmovecoor; - } + if (mousePosX) *mousePosX = xmovecoor; - if (mousePosY) - { - *mousePosY = ymovecoor; - } + if (mousePosY) *mousePosY = ymovecoor; if ((xmovecoor != currentMouseX) || (ymovecoor != currentMouseY)) { @@ -404,6 +391,7 @@ void sendSpringEvent(PadderCommon::springModeInfo *fullSpring, if ((xmovecoor == (deskRect.x() + midwidth)) || (ymovecoor == (deskRect.y() + midheight))) { #if defined(Q_OS_UNIX) + BaseEventHandler *handler = EventHandlerFactory::getInstance()->handler(); if (fullSpring->screen <= -1) { @@ -481,8 +469,8 @@ void sendSpringEvent(PadderCommon::springModeInfo *fullSpring, } #endif PadderCommon::mouseHelperObj.mouseTimer.start( - qMax(JoyButton::getMouseRefreshRate(), - JoyButton::getGamepadRefreshRate()) + 1); + qMax(GlobalVariables::JoyButton::mouseRefreshRate, + GlobalVariables::JoyButton::gamepadRefreshRate) + 1); } else if (!PadderCommon::mouseHelperObj.springMouseMoving && ((diffx >= (destSpringWidth * .013)) || (diffy >= (destSpringHeight * .013)))) @@ -528,8 +516,8 @@ void sendSpringEvent(PadderCommon::springModeInfo *fullSpring, #endif PadderCommon::mouseHelperObj.mouseTimer.start( - qMax(JoyButton::getMouseRefreshRate(), - JoyButton::getGamepadRefreshRate()) + 1); + qMax(GlobalVariables::JoyButton::mouseRefreshRate, + GlobalVariables::JoyButton::gamepadRefreshRate) + 1); } else if (PadderCommon::mouseHelperObj.springMouseMoving && ((diffx < 2) && (diffy < 2))) @@ -577,8 +565,8 @@ void sendSpringEvent(PadderCommon::springModeInfo *fullSpring, #endif PadderCommon::mouseHelperObj.mouseTimer.start( - qMax(JoyButton::getMouseRefreshRate(), - JoyButton::getGamepadRefreshRate()) + 1); + qMax(GlobalVariables::JoyButton::mouseRefreshRate, + GlobalVariables::JoyButton::gamepadRefreshRate) + 1); } @@ -600,8 +588,8 @@ void sendSpringEvent(PadderCommon::springModeInfo *fullSpring, PadderCommon::mouseHelperObj.pivotPoint[1] = fullSpringDestY; PadderCommon::mouseHelperObj.mouseTimer.start( - qMax(JoyButton::getMouseRefreshRate(), - JoyButton::getGamepadRefreshRate()) + 1); + qMax(GlobalVariables::JoyButton::mouseRefreshRate, + GlobalVariables::JoyButton::gamepadRefreshRate) + 1); } } else @@ -653,6 +641,7 @@ int X11KeySymToKeycode(QString key) tempcode = VkKeyScan(ordinal); int modifiers = tempcode >> 8; tempcode = tempcode & 0xff; + if ((modifiers & 1) != 0) tempcode |= VK_SHIFT; if ((modifiers & 2) != 0) tempcode |= VK_CONTROL; if ((modifiers & 4) != 0) tempcode |= VK_MENU; @@ -689,6 +678,7 @@ QString keycodeToKeyString(int keycode, int alias) newkey = QString("0x%1").arg(keycode, 0, 16); QString tempkey = XKeysymToString(XkbKeycodeToKeysym(display, static_cast(keycode), 0, 0)); QString tempalias = X11Extras::getInstance()->getDisplayString(tempkey); + if (!tempalias.isEmpty()) { newkey = tempalias; @@ -696,7 +686,7 @@ QString keycodeToKeyString(int keycode, int alias) else { XKeyPressedEvent tempevent; - tempevent.keycode = static_cast(keycode); + tempevent.keycode = keycode; tempevent.type = KeyPress; tempevent.display = display; tempevent.state = 0; @@ -705,14 +695,15 @@ QString keycodeToKeyString(int keycode, int alias) memset(tempstring, 0, sizeof(tempstring)); int bitestoreturn = sizeof(tempstring) - 1; int numchars = XLookupString(&tempevent, tempstring, bitestoreturn, nullptr, nullptr); + if (numchars > 0) { tempstring[numchars] = '\0'; newkey = QString::fromUtf8(tempstring); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "NEWKEY:" << newkey << endl; - qDebug() << "NEWKEY LEGNTH:" << numchars << endl; + qDebug() << "NEWKEY:" << newkey << endl; + qDebug() << "NEWKEY LEGNTH:" << numchars << endl; #endif } else @@ -727,20 +718,14 @@ QString keycodeToKeyString(int keycode, int alias) if (handler->getIdentifier() == "uinput") { QString tempalias = UInputHelper::getInstance()->getDisplayString(keycode); - if (!tempalias.isEmpty()) - { - newkey = tempalias; - } - else - { - newkey = QString("0x%1").arg(keycode, 0, 16); - } + + if (!tempalias.isEmpty()) newkey = tempalias; + else newkey = QString("0x%1").arg(keycode, 0, 16); } #endif } #elif defined (Q_OS_WIN) - wchar_t buffer[50] = {0}; QString tempalias = WinExtras::getDisplayString(keycode); if (!tempalias.isEmpty()) @@ -757,15 +742,11 @@ QString keycodeToKeyString(int keycode, int alias) } else { + wchar_t buffer[50] = {0}; int length = GetKeyNameTextW(scancode << 16, buffer, sizeof(buffer)); - if (length > 0) - { - newkey = QString::fromWCharArray(buffer); - } - else - { - newkey.append(QString("0x%1").arg(keycode, 0, 16)); - } + + if (length > 0) newkey = QString::fromWCharArray(buffer); + else newkey.append(QString("0x%1").arg(keycode, 0, 16)); } } @@ -779,17 +760,21 @@ int X11KeyCodeToX11KeySym(int keycode) qInstallMessageHandler(MessageHandler::myMessageOutput); #ifdef Q_OS_WIN + Q_UNUSED(keycode); return 0; + #elif defined(Q_OS_UNIX) #ifdef WITH_X11 + Display* display = X11Extras::getInstance()->display(); - int tempcode = static_cast(XkbKeycodeToKeysym(display, static_cast(keycode), 0, 0)); - return tempcode; + return XkbKeycodeToKeysym(display, static_cast(keycode), 0, 0); + #else Q_UNUSED(keycode); return 0; + #endif #endif } @@ -809,10 +794,10 @@ QString keysymToKeyString(int keysym, int alias) { Display* display = X11Extras::getInstance()->display(); int keycode = 0; + if (keysym > 0) - { keycode = XKeysymToKeycode(display, static_cast(keysym)); - } + newkey = keycodeToKeyString(keycode); } else if (handler->getIdentifier() == "uinput") @@ -823,5 +808,6 @@ QString keysymToKeyString(int keysym, int alias) #elif defined(Q_OS_WIN) newkey = keycodeToKeyString(keysym, alias); #endif + return newkey; } diff --git a/src/event.h b/src/event.h old mode 100644 new mode 100755 index 9c57c0be1..0cb83ccec --- a/src/event.h +++ b/src/event.h @@ -37,6 +37,10 @@ void sendSpringEvent(PadderCommon::springModeInfo *fullSpring, PadderCommon::springModeInfo *relativeSpring=0, int* const mousePosX=0, int* const mousePos=0); +void fakeAbsMouseCoordinates(double springX, double springY, + int width, int height, + int &finalx, int &finaly, int screen=-1); + int X11KeySymToKeycode(QString key); QString keycodeToKeyString(int keycode, int alias=0); // .., .., unsigned int X11KeyCodeToX11KeySym(int keycode); // unsigned, unisigned diff --git a/src/eventhandlerfactory.cpp b/src/eventhandlerfactory.cpp old mode 100644 new mode 100755 index c474670eb..43ea21c58 --- a/src/eventhandlerfactory.cpp +++ b/src/eventhandlerfactory.cpp @@ -45,6 +45,8 @@ QHash handlerDisplayNames = buildDisplayNames(); EventHandlerFactory* EventHandlerFactory::instance = nullptr; + + EventHandlerFactory::EventHandlerFactory(QString handler, QObject *parent) : QObject(parent) { @@ -52,17 +54,17 @@ EventHandlerFactory::EventHandlerFactory(QString handler, QObject *parent) : #ifdef Q_OS_UNIX #ifdef WITH_UINPUT + if (handler == "uinput") - { eventHandler = new UInputEventHandler(this); - } - #endif + +#endif #ifdef WITH_XTEST + if (handler == "xtest") - { eventHandler = new XTestEventHandler(this); - } + #endif #elif defined(Q_OS_WIN) if (handler == "sendinput") @@ -96,14 +98,9 @@ EventHandlerFactory* EventHandlerFactory::getInstance(QString handler) if (instance == nullptr) { QStringList temp = buildEventGeneratorList(); - if (!handler.isEmpty() && temp.contains(handler)) - { - instance = new EventHandlerFactory(handler); - } - else - { - instance = new EventHandlerFactory(fallBackIdentifier()); - } + + if (!handler.isEmpty() && temp.contains(handler)) instance = new EventHandlerFactory(handler); + else instance = new EventHandlerFactory(fallBackIdentifier()); } return instance; @@ -169,11 +166,10 @@ QString EventHandlerFactory::handlerDisplayName(QString handler) { qInstallMessageHandler(MessageHandler::myMessageOutput); - QString temp = QString(); + QString handlerDispName = QString(); + if (handlerDisplayNames.contains(handler)) - { - temp = handlerDisplayNames.value(handler); - } + handlerDispName = handlerDisplayNames.value(handler); - return temp; + return handlerDispName; } diff --git a/src/eventhandlerfactory.h b/src/eventhandlerfactory.h old mode 100644 new mode 100755 diff --git a/src/eventhandlers/baseeventhandler.cpp b/src/eventhandlers/baseeventhandler.cpp old mode 100644 new mode 100755 index 65c9f98e4..37a05404d --- a/src/eventhandlers/baseeventhandler.cpp +++ b/src/eventhandlers/baseeventhandler.cpp @@ -35,9 +35,11 @@ BaseEventHandler::~BaseEventHandler() qInstallMessageHandler(MessageHandler::myMessageOutput); } + QString BaseEventHandler::getErrorString() { qInstallMessageHandler(MessageHandler::myMessageOutput); + return lastErrorString; } @@ -59,6 +61,7 @@ void BaseEventHandler::printPostMessages() void BaseEventHandler::sendMouseAbsEvent(int xDis, int yDis, int screen) { qInstallMessageHandler(MessageHandler::myMessageOutput); + Q_UNUSED(xDis); Q_UNUSED(yDis); Q_UNUSED(screen); @@ -75,6 +78,7 @@ void BaseEventHandler::sendMouseSpringEvent(int xDis, int yDis, int width, int height) { qInstallMessageHandler(MessageHandler::myMessageOutput); + Q_UNUSED(xDis); Q_UNUSED(yDis); Q_UNUSED(width); @@ -100,6 +104,3 @@ void BaseEventHandler::sendTextEntryEvent(QString maintext) Q_UNUSED(maintext); } - - - diff --git a/src/eventhandlers/baseeventhandler.h b/src/eventhandlers/baseeventhandler.h old mode 100644 new mode 100755 diff --git a/src/eventhandlers/uinputeventhandler.cpp b/src/eventhandlers/uinputeventhandler.cpp old mode 100644 new mode 100755 index 8a6077747..fe15ecf7e --- a/src/eventhandlers/uinputeventhandler.cpp +++ b/src/eventhandlers/uinputeventhandler.cpp @@ -27,7 +27,6 @@ #include #include - #include #include #include @@ -37,6 +36,7 @@ static const QString mouseDeviceName = PadderCommon::mouseDeviceName; static const QString keyboardDeviceName = PadderCommon::keyboardDeviceName; static const QString springMouseDeviceName = PadderCommon::springMouseDeviceName; + #ifdef WITH_X11 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #include @@ -45,9 +45,11 @@ static const QString springMouseDeviceName = PadderCommon::springMouseDeviceName #include #endif + #include "uinputeventhandler.h" #include "messagehandler.h" + UInputEventHandler::UInputEventHandler(QObject *parent) : BaseEventHandler(parent) { @@ -56,9 +58,10 @@ UInputEventHandler::UInputEventHandler(QObject *parent) : springMouseFileHandler = 0; } + UInputEventHandler::~UInputEventHandler() { - cleanup(); + cleanupUinputEvHand(); } /** @@ -72,68 +75,80 @@ bool UInputEventHandler::init() bool result = true; // Open file handle for keyboard emulation. - keyboardFileHandler = openUInputHandle(); - if (keyboardFileHandler > 0) - { - setKeyboardEvents(keyboardFileHandler); - populateKeyCodes(keyboardFileHandler); - createUInputKeyboardDevice(keyboardFileHandler); - } - else - { - result = false; - } + initDevice(keyboardFileHandler, "keyboardFileHandler", result); + // two separate statements for "result" are needed anyway because of possible changing its + // statement in "initDevice" method if (result) { // Open mouse file handle to use for relative mouse emulation. - mouseFileHandler = openUInputHandle(); - if (mouseFileHandler > 0) - { - setRelMouseEvents(mouseFileHandler); - createUInputMouseDevice(mouseFileHandler); - } - else - { - result = false; - } + initDevice(mouseFileHandler, "mouseFileHandler", result); } if (result) { // Open mouse file handle to use for absolute mouse emulation. - springMouseFileHandler = openUInputHandle(); - if (springMouseFileHandler > 0) - { - setSpringMouseEvents(springMouseFileHandler); - createUInputSpringMouseDevice(springMouseFileHandler); - } - else - { - result = false; - } + initDevice(springMouseFileHandler, "springMouseFileHandler", result); } #ifdef WITH_X11 + if (result) { - #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) + #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) + + if (QApplication::platformName() == QStringLiteral("xcb")) + { + + #endif - if (QApplication::platformName() == QStringLiteral("xcb")) - { - #endif // Some time needs to elapse after device creation before changing // pointer settings. Otherwise, settings will not take effect. QTimer::singleShot(2000, this, SLOT(x11ResetMouseAccelerationChange())); - #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) - } - #endif + + #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) + + } + + #endif } + #endif return result; } + +void UInputEventHandler::initDevice(int device, QString name, bool& result) +{ + device = openUInputHandle(); + + if (device > 0) + { + if (name == "springMouseFileHandler") + { + setSpringMouseEvents(device); + createUInputSpringMouseDevice(device); + } + else if (name == "mouseFileHandler") + { + setRelMouseEvents(device); + createUInputMouseDevice(device); + } + else if (name == "keyboardFileHandler") + { + setKeyboardEvents(device); + populateKeyCodes(device); + createUInputKeyboardDevice(device); + } + } + else + { + result = false; + } +} + + #ifdef WITH_X11 void UInputEventHandler::x11ResetMouseAccelerationChange() { @@ -144,7 +159,14 @@ void UInputEventHandler::x11ResetMouseAccelerationChange() } #endif + bool UInputEventHandler::cleanup() +{ + return cleanupUinputEvHand(); +} + + +bool UInputEventHandler::cleanupUinputEvHand() { if (keyboardFileHandler > 0) { @@ -167,6 +189,7 @@ bool UInputEventHandler::cleanup() return true; } + void UInputEventHandler::sendKeyboardEvent(JoyButtonSlot *slot, bool pressed) { JoyButtonSlot::JoySlotInputAction device = slot->getSlotMode(); @@ -178,6 +201,7 @@ void UInputEventHandler::sendKeyboardEvent(JoyButtonSlot *slot, bool pressed) } } + void UInputEventHandler::sendMouseButtonEvent(JoyButtonSlot *slot, bool pressed) { JoyButtonSlot::JoySlotInputAction device = slot->getSlotMode(); @@ -207,7 +231,7 @@ void UInputEventHandler::sendMouseButtonEvent(JoyButtonSlot *slot, bool pressed) } } - write_uinput_event(mouseFileHandler, EV_KEY, static_cast(tempcode), pressed ? 1 : 0); + write_uinput_event(mouseFileHandler, EV_KEY, tempcode, pressed ? 1 : 0); } else if (code == 4) { @@ -249,12 +273,14 @@ void UInputEventHandler::sendMouseButtonEvent(JoyButtonSlot *slot, bool pressed) } } + void UInputEventHandler::sendMouseEvent(int xDis, int yDis) { write_uinput_event(mouseFileHandler, EV_REL, REL_X, xDis, false); write_uinput_event(mouseFileHandler, EV_REL, REL_Y, yDis); } + void UInputEventHandler::sendMouseAbsEvent(int xDis, int yDis, int screen) { Q_UNUSED(screen); @@ -263,33 +289,34 @@ void UInputEventHandler::sendMouseAbsEvent(int xDis, int yDis, int screen) write_uinput_event(springMouseFileHandler, EV_ABS, ABS_Y, yDis); } + void UInputEventHandler::sendMouseSpringEvent(int xDis, int yDis, int width, int height) { if ((width > 0) && (height > 0)) { - double midwidth = static_cast(width) / 2.0; - double midheight = static_cast(height) / 2.0; + double midwidth = width / 2.0; + double midheight = height / 2.0; - int fx = static_cast(ceil(32767 * ((xDis - midwidth) / midwidth))); - int fy = static_cast(ceil(32767 * ((yDis - midheight) / midheight))); + int fx = ceil(32767 * ((xDis - midwidth) / midwidth)); + int fy = ceil(32767 * ((yDis - midheight) / midheight)); sendMouseAbsEvent(fx, fy, -1); } - - } + void UInputEventHandler::sendMouseSpringEvent(int xDis, int yDis) { if ((xDis >= -1.0) && (xDis <= 1.0) && (yDis >= -1.0) && (yDis <= 1.0)) { - int fx = static_cast(ceil(32767 * xDis)); - int fy = static_cast(ceil(32767 * yDis)); + int fx = ceil(32767 * xDis); + int fy = ceil(32767 * yDis); sendMouseAbsEvent(fx, fy, -1); } } + int UInputEventHandler::openUInputHandle() { int filehandle = -1; @@ -301,10 +328,12 @@ int UInputEventHandler::openUInputHandle() QString possibleLocation; QStringListIterator iter(locations); + while (iter.hasNext()) { QString temp = iter.next(); QFileInfo tempFileInfo(temp); + if (tempFileInfo.exists()) { possibleLocation = temp; @@ -322,6 +351,7 @@ int UInputEventHandler::openUInputHandle() { QByteArray tempArray = possibleLocation.toUtf8(); filehandle = open(tempArray.constData(), O_WRONLY | O_NONBLOCK); + if (filehandle < 0) { lastErrorString = tr("Could not open uinput device file\n" @@ -344,9 +374,9 @@ void UInputEventHandler::setKeyboardEvents(int filehandle) ioctl(filehandle, UI_SET_EVBIT, EV_SYN); } + void UInputEventHandler::setRelMouseEvents(int filehandle) { - ioctl(filehandle, UI_SET_EVBIT, EV_KEY); ioctl(filehandle, UI_SET_EVBIT, EV_SYN); ioctl(filehandle, UI_SET_EVBIT, EV_REL); @@ -363,9 +393,9 @@ void UInputEventHandler::setRelMouseEvents(int filehandle) ioctl(filehandle, UI_SET_KEYBIT, BTN_EXTRA); } + void UInputEventHandler::setSpringMouseEvents(int filehandle) { - ioctl(filehandle, UI_SET_EVBIT, EV_KEY); ioctl(filehandle, UI_SET_EVBIT, EV_SYN); @@ -379,20 +409,22 @@ void UInputEventHandler::setSpringMouseEvents(int filehandle) ioctl(filehandle, UI_SET_ABSBIT, ABS_X); ioctl(filehandle, UI_SET_ABSBIT, ABS_Y); ioctl(filehandle, UI_SET_KEYBIT, BTN_TOUCH); + // BTN_TOOL_PEN is required for the mouse to be seen as an // absolute mouse as opposed to a relative mouse. ioctl(filehandle, UI_SET_KEYBIT, BTN_TOOL_PEN); } + void UInputEventHandler::populateKeyCodes(int filehandle) { - - for (unsigned int i=KEY_ESC; i <= KEY_MICMUTE; i++) + for (unsigned int i = KEY_ESC; i <= KEY_MICMUTE; i++) { ioctl(filehandle, UI_SET_KEYBIT, i); } } + void UInputEventHandler::createUInputKeyboardDevice(int filehandle) { struct uinput_user_dev uidev; @@ -405,11 +437,11 @@ void UInputEventHandler::createUInputKeyboardDevice(int filehandle) uidev.id.product = 0x0; uidev.id.version = 1; - write(filehandle, &uidev, sizeof(uidev)); ioctl(filehandle, UI_DEV_CREATE); } + void UInputEventHandler::createUInputMouseDevice(int filehandle) { struct uinput_user_dev uidev; @@ -422,11 +454,11 @@ void UInputEventHandler::createUInputMouseDevice(int filehandle) uidev.id.product = 0x0; uidev.id.version = 1; - write(filehandle, &uidev, sizeof(uidev)); ioctl(filehandle, UI_DEV_CREATE); } + void UInputEventHandler::createUInputSpringMouseDevice(int filehandle) { struct uinput_user_dev uidev; @@ -447,14 +479,13 @@ void UInputEventHandler::createUInputSpringMouseDevice(int filehandle) uidev.absmax[ABS_Y] = 32767; uidev.absflat[ABS_Y] = 0; - write(filehandle, &uidev, sizeof(uidev)); ioctl(filehandle, UI_DEV_CREATE); } + void UInputEventHandler::closeUInputDevice(int filehandle) { - ioctl(filehandle, UI_DEV_DESTROY); close(filehandle); } @@ -468,8 +499,8 @@ void UInputEventHandler::write_uinput_event(int filehandle, int type, memset(&ev, 0, sizeof(struct input_event)); gettimeofday(&ev.time, nullptr); - ev.type = static_cast(type); - ev.code = static_cast(code); + ev.type = type; + ev.code = code; ev.value = value; write(filehandle, &ev, sizeof(struct input_event)); @@ -486,11 +517,13 @@ void UInputEventHandler::write_uinput_event(int filehandle, int type, } } + QString UInputEventHandler::getName() { return QString("uinput"); } + QString UInputEventHandler::getIdentifier() { return getName(); @@ -512,21 +545,24 @@ void UInputEventHandler::printPostMessages() } } + void UInputEventHandler::sendTextEntryEvent(QString maintext) { AntKeyMapper *mapper = AntKeyMapper::getInstance(); - if (mapper && mapper->getKeyMapper()) + if ((mapper != nullptr) && mapper->getKeyMapper()) { QtUInputKeyMapper *keymapper = qobject_cast(mapper->getKeyMapper()); QtX11KeyMapper *nativeWinKeyMapper = nullptr; + if (mapper->getNativeKeyMapper()) { nativeWinKeyMapper = qobject_cast(mapper->getNativeKeyMapper()); } QList tempList; - for (int i=0; i < maintext.size(); i++) + + for (int i = 0; i < maintext.size(); i++) { tempList.clear(); @@ -538,10 +574,11 @@ void UInputEventHandler::sendTextEntryEvent(QString maintext) { QtX11KeyMapper::charKeyInformation tempX11 = nativeWinKeyMapper->getCharKeyInformation(maintext.at(i)); tempX11.virtualkey = X11Extras::getInstance()->getGroup1KeySym(tempX11.virtualkey); - unsigned int tempQtKey = static_cast(nativeWinKeyMapper->returnQtKey(tempX11.virtualkey)); + unsigned int tempQtKey = nativeWinKeyMapper->returnQtKey(tempX11.virtualkey); + if (tempQtKey > 0) { - temp.virtualkey = keymapper->returnVirtualKey(static_cast(tempQtKey)); + temp.virtualkey = keymapper->returnVirtualKey(tempQtKey); temp.modifiers = tempX11.modifiers; } else @@ -558,32 +595,13 @@ void UInputEventHandler::sendTextEntryEvent(QString maintext) { if (temp.modifiers != Qt::NoModifier) { - if (temp.modifiers.testFlag(Qt::ShiftModifier)) - { - tempList.append(KEY_LEFTSHIFT); - write_uinput_event(keyboardFileHandler, EV_KEY, KEY_LEFTSHIFT, 1, false); - } - - if (temp.modifiers.testFlag(Qt::ControlModifier)) - { - tempList.append(KEY_LEFTCTRL); - write_uinput_event(keyboardFileHandler, EV_KEY, KEY_LEFTCTRL, 1, false); - } - - if (temp.modifiers.testFlag(Qt::AltModifier)) - { - tempList.append(KEY_LEFTALT); - write_uinput_event(keyboardFileHandler, EV_KEY, KEY_LEFTALT, 1, false); - } - - if (temp.modifiers.testFlag(Qt::MetaModifier)) - { - tempList.append(KEY_LEFTMETA); - write_uinput_event(keyboardFileHandler, EV_KEY, KEY_LEFTMETA, 1, false); - } + testAndAppend(temp.modifiers.testFlag(Qt::ShiftModifier), tempList, KEY_LEFTSHIFT); + testAndAppend(temp.modifiers.testFlag(Qt::ControlModifier), tempList, KEY_LEFTCTRL); + testAndAppend(temp.modifiers.testFlag(Qt::AltModifier), tempList, KEY_LEFTALT); + testAndAppend(temp.modifiers.testFlag(Qt::MetaModifier), tempList, KEY_LEFTMETA); } - tempList.append(static_cast(temp.virtualkey)); + tempList.append(temp.virtualkey); write_uinput_event(keyboardFileHandler, EV_KEY, temp.virtualkey, 1, true); } @@ -591,17 +609,29 @@ void UInputEventHandler::sendTextEntryEvent(QString maintext) { QListIterator tempiter(tempList); tempiter.toBack(); + while (tempiter.hasPrevious()) { unsigned int currentcode = tempiter.previous(); bool sync = !tempiter.hasPrevious() ? true : false; - write_uinput_event(keyboardFileHandler, EV_KEY, static_cast(currentcode), 0, sync); + write_uinput_event(keyboardFileHandler, EV_KEY, currentcode, 0, sync); } } } } } + +void UInputEventHandler::testAndAppend(bool tested, QList& tempList, unsigned int key) +{ + if (tested) + { + tempList.append(key); + write_uinput_event(keyboardFileHandler, EV_KEY, key, 1, false); + } +} + + int UInputEventHandler::getKeyboardFileHandler() { return keyboardFileHandler; diff --git a/src/eventhandlers/uinputeventhandler.h b/src/eventhandlers/uinputeventhandler.h old mode 100644 new mode 100755 index b28fc6272..0c03ceee0 --- a/src/eventhandlers/uinputeventhandler.h +++ b/src/eventhandlers/uinputeventhandler.h @@ -32,22 +32,22 @@ class UInputEventHandler : public BaseEventHandler explicit UInputEventHandler(QObject *parent = nullptr); ~UInputEventHandler(); - virtual bool init(); - virtual bool cleanup(); - virtual void sendKeyboardEvent(JoyButtonSlot *slot, bool pressed); - virtual void sendMouseButtonEvent(JoyButtonSlot *slot, bool pressed); - virtual void sendMouseEvent(int xDis, int yDis); - virtual void sendMouseAbsEvent(int xDis, int yDis, int screen); + virtual bool init() override; + virtual bool cleanup() override; + virtual void sendKeyboardEvent(JoyButtonSlot *slot, bool pressed) override; + virtual void sendMouseButtonEvent(JoyButtonSlot *slot, bool pressed) override; + virtual void sendMouseEvent(int xDis, int yDis) override; + virtual void sendMouseAbsEvent(int xDis, int yDis, int screen) override; virtual void sendMouseSpringEvent(int xDis, int yDis, - int width, int height); // unsigned, unsigned, unsigned, unsigned - virtual void sendMouseSpringEvent(int xDis, int yDis); + int width, int height) override; + virtual void sendMouseSpringEvent(int xDis, int yDis) override; - virtual QString getName(); - virtual QString getIdentifier(); - virtual void printPostMessages(); + virtual QString getName() override; + virtual QString getIdentifier() override; + virtual void printPostMessages() override; - virtual void sendTextEntryEvent(QString maintext); + virtual void sendTextEntryEvent(QString maintext) override; int getKeyboardFileHandler(); int getMouseFileHandler(); @@ -78,6 +78,10 @@ private slots: int springMouseFileHandler; QString uinputDeviceLocation; + bool cleanupUinputEvHand(); + void testAndAppend(bool tested, QList& tempList, unsigned int key); + void initDevice(int device, QString name, bool& result); + }; #endif // UINPUTEVENTHANDLER_H diff --git a/src/eventhandlers/winsendinputeventhandler.cpp b/src/eventhandlers/winsendinputeventhandler.cpp old mode 100644 new mode 100755 diff --git a/src/eventhandlers/winsendinputeventhandler.h b/src/eventhandlers/winsendinputeventhandler.h old mode 100644 new mode 100755 index 894bbedb4..c280b6e36 --- a/src/eventhandlers/winsendinputeventhandler.h +++ b/src/eventhandlers/winsendinputeventhandler.h @@ -32,17 +32,17 @@ class WinSendInputEventHandler : public BaseEventHandler public: explicit WinSendInputEventHandler(QObject *parent = nullptr); - virtual bool init(); - virtual bool cleanup(); - virtual void sendKeyboardEvent(JoyButtonSlot *slot, bool pressed); - virtual void sendMouseButtonEvent(JoyButtonSlot *slot, bool pressed); - virtual void sendMouseEvent(int xDis, int yDis); + virtual bool init() override; + virtual bool cleanup() override; + virtual void sendKeyboardEvent(JoyButtonSlot *slot, bool pressed) override; + virtual void sendMouseButtonEvent(JoyButtonSlot *slot, bool pressed) override; + virtual void sendMouseEvent(int xDis, int yDis) override; virtual void sendMouseSpringEvent(int xDis, int yDis, - int width, int height); // .., unsigned, unsigned, unsigned, unsigned - virtual void sendTextEntryEvent(QString maintext); + int width, int height) override; // .., unsigned, unsigned, unsigned, unsigned + virtual void sendTextEntryEvent(QString maintext) override; - virtual QString getName(); - virtual QString getIdentifier(); + virtual QString getName() override; + virtual QString getIdentifier() override; }; diff --git a/src/eventhandlers/winvmultieventhandler.cpp b/src/eventhandlers/winvmultieventhandler.cpp old mode 100644 new mode 100755 index 3f27dd80f..116531ec2 --- a/src/eventhandlers/winvmultieventhandler.cpp +++ b/src/eventhandlers/winvmultieventhandler.cpp @@ -42,7 +42,7 @@ WinVMultiEventHandler::WinVMultiEventHandler(QObject *parent) : WinVMultiEventHandler::~WinVMultiEventHandler() { - cleanup(); + cleanupWinVmEvHand(); } bool WinVMultiEventHandler::init() @@ -77,8 +77,11 @@ bool WinVMultiEventHandler::init() bool WinVMultiEventHandler::cleanup() { - bool result = true; + return cleanupWinVmEvHand(); +} +bool WinVMultiEventHandler::cleanupWinVmEvHand() +{ if (vmulti) { vmulti_disconnect(vmulti); @@ -89,7 +92,7 @@ bool WinVMultiEventHandler::cleanup() nativeKeyMapper = 0; - return result; + return true; } void WinVMultiEventHandler::sendKeyboardEvent(JoyButtonSlot *slot, bool pressed) diff --git a/src/eventhandlers/winvmultieventhandler.h b/src/eventhandlers/winvmultieventhandler.h old mode 100644 new mode 100755 index 195b5c1aa..67cc38399 --- a/src/eventhandlers/winvmultieventhandler.h +++ b/src/eventhandlers/winvmultieventhandler.h @@ -38,20 +38,20 @@ class WinVMultiEventHandler : public BaseEventHandler explicit WinVMultiEventHandler(QObject *parent = nullptr); ~WinVMultiEventHandler(); - virtual bool init(); - virtual bool cleanup(); - virtual void sendKeyboardEvent(JoyButtonSlot *slot, bool pressed); - virtual void sendMouseButtonEvent(JoyButtonSlot *slot, bool pressed); - virtual void sendMouseEvent(int xDis, int yDis); - virtual void sendMouseAbsEvent(int xDis, int yDis, int screen); + virtual bool init() override; + virtual bool cleanup() override; + virtual void sendKeyboardEvent(JoyButtonSlot *slot, bool pressed) override; + virtual void sendMouseButtonEvent(JoyButtonSlot *slot, bool pressed) override; + virtual void sendMouseEvent(int xDis, int yDis) override; + virtual void sendMouseAbsEvent(int xDis, int yDis, int screen) override; virtual void sendMouseSpringEvent(int xDis, int yDis, - int width, int height); // unsigned, unsigned, unsigned, unsigned + int width, int height) override; // unsigned, unsigned, unsigned, unsigned // TODO: Implement text event using information from QtWinKeyMapper. - virtual void sendTextEntryEvent(QString maintext); + virtual void sendTextEntryEvent(QString maintext) override; - virtual QString getName(); - virtual QString getIdentifier(); + virtual QString getName() override; + virtual QString getIdentifier() override; protected: pvmulti_client vmulti; @@ -63,6 +63,8 @@ class WinVMultiEventHandler : public BaseEventHandler WinSendInputEventHandler sendInputHandler; QtKeyMapperBase *nativeKeyMapper; + bool cleanupWinVmEvHand(); + }; #endif // WINVMULTIEVENTHANDLER_H diff --git a/src/eventhandlers/xtesteventhandler.cpp b/src/eventhandlers/xtesteventhandler.cpp old mode 100644 new mode 100755 index fc62bb700..7aa5c4663 --- a/src/eventhandlers/xtesteventhandler.cpp +++ b/src/eventhandlers/xtesteventhandler.cpp @@ -17,6 +17,7 @@ #include "xtesteventhandler.h" +#include "globalvariables.h" #include "joybuttonslot.h" #include "antkeymapper.h" #include "messagehandler.h" @@ -32,7 +33,6 @@ #include "x11extras.h" - XTestEventHandler::XTestEventHandler(QObject *parent) : BaseEventHandler(parent) { @@ -49,159 +49,154 @@ XTestEventHandler::~XTestEventHandler() bool XTestEventHandler::init() { qInstallMessageHandler(MessageHandler::myMessageOutput); + X11Extras *instance = X11Extras::getInstance(); + if (instance != nullptr) { - instance->x11ResetMouseAccelerationChange(X11Extras::xtestMouseDeviceName); + instance->x11ResetMouseAccelerationChange(GlobalVariables::X11Extras::xtestMouseDeviceName); } return true; } + bool XTestEventHandler::cleanup() { qInstallMessageHandler(MessageHandler::myMessageOutput); + return true; } + void XTestEventHandler::sendKeyboardEvent(JoyButtonSlot *slot, bool pressed) { qInstallMessageHandler(MessageHandler::myMessageOutput); + Display* display = X11Extras::getInstance()->display(); JoyButtonSlot::JoySlotInputAction device = slot->getSlotMode(); + int code = slot->getSlotCode(); if (device == JoyButtonSlot::JoyKeyboard) { - int tempcode = XKeysymToKeycode(display, static_cast(code)); + int tempcode = XKeysymToKeycode(display, static_cast(code)); + if (tempcode > 0) { - XTestFakeKeyEvent(display, static_cast(tempcode), pressed, 0); + XTestFakeKeyEvent(display, tempcode, pressed, 0); XFlush(display); } } } + void XTestEventHandler::sendMouseButtonEvent(JoyButtonSlot *slot, bool pressed) { qInstallMessageHandler(MessageHandler::myMessageOutput); + Display* display = X11Extras::getInstance()->display(); JoyButtonSlot::JoySlotInputAction device = slot->getSlotMode(); + int code = slot->getSlotCode(); if (device == JoyButtonSlot::JoyMouseButton) { - XTestFakeButtonEvent(display, static_cast(code), pressed, 0); + XTestFakeButtonEvent(display, code, pressed, 0); XFlush(display); } } + void XTestEventHandler::sendMouseEvent(int xDis, int yDis) { qInstallMessageHandler(MessageHandler::myMessageOutput); + Display* display = X11Extras::getInstance()->display(); XTestFakeRelativeMotionEvent(display, xDis, yDis, 0); XFlush(display); } + void XTestEventHandler::sendMouseAbsEvent(int xDis, int yDis, int screen) { qInstallMessageHandler(MessageHandler::myMessageOutput); + Display* display = X11Extras::getInstance()->display(); XTestFakeMotionEvent(display, screen, xDis, yDis, 0); XFlush(display); } + QString XTestEventHandler::getName() { qInstallMessageHandler(MessageHandler::myMessageOutput); + return QString("XTest"); } + QString XTestEventHandler::getIdentifier() { qInstallMessageHandler(MessageHandler::myMessageOutput); + return QString("xtest"); } + void XTestEventHandler::sendTextEntryEvent(QString maintext) { qInstallMessageHandler(MessageHandler::myMessageOutput); + AntKeyMapper *mapper = AntKeyMapper::getInstance(); if ((mapper != nullptr) && mapper->getKeyMapper()) { Display* display = X11Extras::getInstance()->display(); - QtX11KeyMapper *keymapper = qobject_cast(mapper->getKeyMapper()); // static_cast + QtX11KeyMapper *keymapper = qobject_cast(mapper->getKeyMapper()); - for (int i=0; i < maintext.size(); i++) + for (int i = 0; i < maintext.size(); i++) { QtX11KeyMapper::charKeyInformation temp = keymapper->getCharKeyInformation(maintext.at(i)); - int tempcode = XKeysymToKeycode(display, static_cast(temp.virtualkey)); + int tempcode = XKeysymToKeycode(display, static_cast(temp.virtualkey)); + if (tempcode > 0) { QList tempList; - if (temp.modifiers != Qt::NoModifier) + if ((temp.modifiers != Qt::NoModifier) && temp.modifiers.testFlag(Qt::ShiftModifier)) { - if (temp.modifiers.testFlag(Qt::ShiftModifier)) - { - int shiftcode = 0; - - if (shiftcode == 0) - { - shiftcode = XKeysymToKeycode(display, XK_Shift_L); - } - - int modifiercode = shiftcode; - XTestFakeKeyEvent(display, static_cast(modifiercode), 1, 0); - tempList.append(modifiercode); - } - - if (temp.modifiers.testFlag(Qt::ControlModifier)) - { - int controlcode = 0; - - if (controlcode == 0) - { - controlcode = XKeysymToKeycode(display, XK_Control_L); - } - - int modifiercode = controlcode; - XTestFakeKeyEvent(display, static_cast(modifiercode), 1, 0); - tempList.append(modifiercode); - } - - if (temp.modifiers.testFlag(Qt::AltModifier)) - { - int altcode = 0; - - if (altcode == 0) - { - altcode = XKeysymToKeycode(display, XK_Alt_L); - } - - int modifiercode = altcode; - XTestFakeKeyEvent(display, static_cast(modifiercode), 1, 0); - tempList.append(modifiercode); - } + int shiftcode = XKeysymToKeycode(display, XK_Shift_L); + int modifiercode = shiftcode; + XTestFakeKeyEvent(display, modifiercode, 1, 0); + tempList.append(modifiercode); + } - if (temp.modifiers.testFlag(Qt::MetaModifier)) - { - int metacode = 0; + if ((temp.modifiers != Qt::NoModifier) && temp.modifiers.testFlag(Qt::ControlModifier)) + { + int controlcode = XKeysymToKeycode(display, XK_Control_L); + int modifiercode = controlcode; + XTestFakeKeyEvent(display, modifiercode, 1, 0); + tempList.append(modifiercode); + } - if (metacode == 0) - { - metacode = XKeysymToKeycode(display, XK_Meta_L); - } + if ((temp.modifiers != Qt::NoModifier) && temp.modifiers.testFlag(Qt::AltModifier)) + { + int altcode = XKeysymToKeycode(display, XK_Alt_L); + int modifiercode = altcode; + XTestFakeKeyEvent(display, modifiercode, 1, 0); + tempList.append(modifiercode); + } - int modifiercode = metacode; - XTestFakeKeyEvent(display, static_cast(modifiercode), 1, 0); - tempList.append(modifiercode); - } + if ((temp.modifiers != Qt::NoModifier) && temp.modifiers.testFlag(Qt::MetaModifier)) + { + int metacode = XKeysymToKeycode(display, XK_Meta_L); + int modifiercode = metacode; + XTestFakeKeyEvent(display, modifiercode, 1, 0); + tempList.append(modifiercode); } - XTestFakeKeyEvent(display, static_cast(tempcode), 1, 0); + XTestFakeKeyEvent(display, tempcode, 1, 0); tempList.append(tempcode); XFlush(display); @@ -210,10 +205,11 @@ void XTestEventHandler::sendTextEntryEvent(QString maintext) { QListIterator tempiter(tempList); tempiter.toBack(); + while (tempiter.hasPrevious()) { int currentcode = tempiter.previous(); - XTestFakeKeyEvent(display, static_cast(currentcode), 0, 0); + XTestFakeKeyEvent(display, currentcode, 0, 0); } XFlush(display); @@ -227,6 +223,7 @@ void XTestEventHandler::sendTextEntryEvent(QString maintext) void XTestEventHandler::sendMouseSpringEvent(int xDis, int yDis, int width, int height) { qInstallMessageHandler(MessageHandler::myMessageOutput); + Q_UNUSED(xDis); Q_UNUSED(yDis); Q_UNUSED(width); @@ -234,17 +231,13 @@ void XTestEventHandler::sendMouseSpringEvent(int xDis, int yDis, int width, int } -void XTestEventHandler::sendMouseSpringEvent(int, int) { - +void XTestEventHandler::sendMouseSpringEvent(int, int) +{ qInstallMessageHandler(MessageHandler::myMessageOutput); - } -void XTestEventHandler::printPostMessages() { - +void XTestEventHandler::printPostMessages() +{ qInstallMessageHandler(MessageHandler::myMessageOutput); - } - - diff --git a/src/eventhandlers/xtesteventhandler.h b/src/eventhandlers/xtesteventhandler.h old mode 100644 new mode 100755 index 725674c72..bd57ea282 --- a/src/eventhandlers/xtesteventhandler.h +++ b/src/eventhandlers/xtesteventhandler.h @@ -20,6 +20,7 @@ #include "baseeventhandler.h" + class JoyButtonSlot; @@ -49,7 +50,6 @@ class XTestEventHandler : public BaseEventHandler QString getIdentifier() override; void printPostMessages() override; - }; #endif // XTESTEVENTHANDLER_H diff --git a/src/extraprofilesettingsdialog.cpp b/src/extraprofilesettingsdialog.cpp old mode 100644 new mode 100755 index 8015d2dc7..7e87b3727 --- a/src/extraprofilesettingsdialog.cpp +++ b/src/extraprofilesettingsdialog.cpp @@ -34,8 +34,8 @@ ExtraProfileSettingsDialog::ExtraProfileSettingsDialog(InputDevice *device, QWid setAttribute(Qt::WA_DeleteOnClose); this->device = device; - ui->pressValueLabel->setText(QString::number(0.10, 'g', 3).append("").append(trUtf8("s"))); + if (device->getDeviceKeyPressTime() > 0) { int temppress = device->getDeviceKeyPressTime(); @@ -44,9 +44,7 @@ ExtraProfileSettingsDialog::ExtraProfileSettingsDialog(InputDevice *device, QWid } if (!device->getProfileName().isEmpty()) - { ui->profileNameLineEdit->setText(device->getProfileName()); - } connect(ui->keyPressHorizontalSlider, &QSlider::valueChanged, this, &ExtraProfileSettingsDialog::changeDeviceKeyPress); connect(ui->profileNameLineEdit, &QLineEdit::textChanged, device, &InputDevice::setProfileName); diff --git a/src/extraprofilesettingsdialog.h b/src/extraprofilesettingsdialog.h old mode 100644 new mode 100755 diff --git a/src/extraprofilesettingsdialog.ui b/src/extraprofilesettingsdialog.ui old mode 100644 new mode 100755 diff --git a/src/flashbuttonwidget.cpp b/src/flashbuttonwidget.cpp old mode 100644 new mode 100755 index 094d37f86..3cfd490e6 --- a/src/flashbuttonwidget.cpp +++ b/src/flashbuttonwidget.cpp @@ -33,7 +33,7 @@ FlashButtonWidget::FlashButtonWidget(QWidget *parent) : qInstallMessageHandler(MessageHandler::myMessageOutput); isflashing = false; - displayNames = false; + m_displayNames = false; leftAlignText = false; } @@ -43,7 +43,7 @@ FlashButtonWidget::FlashButtonWidget(bool displayNames, QWidget *parent) : qInstallMessageHandler(MessageHandler::myMessageOutput); isflashing = false; - this->displayNames = displayNames; + m_displayNames = displayNames; leftAlignText = false; } @@ -78,7 +78,7 @@ void FlashButtonWidget::refreshLabel() setText(generateLabel()); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "label has been set: " << generateLabel(); + qDebug() << "label has been set: " << generateLabel(); #endif } @@ -93,7 +93,7 @@ void FlashButtonWidget::toggleNameDisplay() { qInstallMessageHandler(MessageHandler::myMessageOutput); - displayNames = !displayNames; + m_displayNames = !m_displayNames; refreshLabel(); } @@ -101,14 +101,14 @@ void FlashButtonWidget::setDisplayNames(bool display) { qInstallMessageHandler(MessageHandler::myMessageOutput); - displayNames = display; + m_displayNames = display; } bool FlashButtonWidget::isDisplayingNames() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return displayNames; + return m_displayNames; } void FlashButtonWidget::paintEvent(QPaintEvent *event) @@ -123,7 +123,8 @@ void FlashButtonWidget::paintEvent(QPaintEvent *event) QFontMetrics fm(tempScaledFont); bool reduce = false; - while ((this->width() < fm.width(text())) && tempScaledFont.pointSize() >= 7) + + while ((this->width() < fm.width(text())) && (tempScaledFont.pointSize() >= 7)) { tempScaledFont.setPointSize(tempScaledFont.pointSize()-1); painter.setFont(tempScaledFont); @@ -132,6 +133,7 @@ void FlashButtonWidget::paintEvent(QPaintEvent *event) } bool changeFontSize = this->font().pointSize() != tempScaledFont.pointSize(); + if (changeFontSize) { if (reduce && !leftAlignText) @@ -164,5 +166,5 @@ void FlashButtonWidget::retranslateUi() bool FlashButtonWidget::ifDisplayNames() { - return displayNames; + return m_displayNames; } diff --git a/src/flashbuttonwidget.h b/src/flashbuttonwidget.h old mode 100644 new mode 100755 index 30489b6b1..cf43939a0 --- a/src/flashbuttonwidget.h +++ b/src/flashbuttonwidget.h @@ -58,7 +58,7 @@ protected slots: private: bool isflashing; - bool displayNames; + bool m_displayNames; bool leftAlignText; }; diff --git a/src/gamecontroller/gamecontroller.cpp b/src/gamecontroller/gamecontroller.cpp old mode 100644 new mode 100755 index f70f85c65..c882d8103 --- a/src/gamecontroller/gamecontroller.cpp +++ b/src/gamecontroller/gamecontroller.cpp @@ -17,6 +17,7 @@ #include "gamecontroller.h" +#include "globalvariables.h" #include "gamecontrollerdpad.h" #include "gamecontrollerset.h" #include "antimicrosettings.h" @@ -33,19 +34,19 @@ #include - -const QString GameController::xmlName = "gamecontroller"; - GameController::GameController(SDL_GameController *controller, int deviceIndex, AntiMicroSettings *settings, QObject *parent) : InputDevice(deviceIndex, settings, parent) { + qInstallMessageHandler(MessageHandler::myMessageOutput); + this->controller = controller; + SDL_Joystick *joyhandle = SDL_GameControllerGetJoystick(controller); joystickID = SDL_JoystickInstanceID(joyhandle); - for (int i = 0; i < NUMBER_JOYSETS; i++) + for (int i = 0; i < GlobalVariables::InputDevice::NUMBER_JOYSETS; i++) { GameControllerSet *controllerset = new GameControllerSet(this, i, this); getJoystick_sets().insert(i, controllerset); @@ -53,16 +54,21 @@ GameController::GameController(SDL_GameController *controller, int deviceIndex, } } + QString GameController::getName() { qInstallMessageHandler(MessageHandler::myMessageOutput); + return QString(trUtf8("Game Controller")).append(" ").append(QString::number(getRealJoyNumber())); } + QString GameController::getSDLName() { qInstallMessageHandler(MessageHandler::myMessageOutput); + QString temp = QString(); + if (controller != nullptr) { temp = SDL_GameControllerName(controller); @@ -71,21 +77,25 @@ QString GameController::getSDLName() return temp; } + QString GameController::getGUIDString() { qInstallMessageHandler(MessageHandler::myMessageOutput); - QString temp = getRawGUIDString(); - return temp; + return getRawGUIDString(); } + QString GameController::getRawGUIDString() { qInstallMessageHandler(MessageHandler::myMessageOutput); + QString temp = QString(); + if (controller != nullptr) { SDL_Joystick *joyhandle = SDL_GameControllerGetJoystick(controller); + if (joyhandle != nullptr) { SDL_JoystickGUID tempGUID = SDL_JoystickGetGUID(joyhandle); @@ -98,15 +108,19 @@ QString GameController::getRawGUIDString() return temp; } + QString GameController::getXmlName() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->xmlName; + + return GlobalVariables::GameController::xmlName; } + void GameController::closeSDLDevice() { qInstallMessageHandler(MessageHandler::myMessageOutput); + if ((controller != nullptr) && SDL_GameControllerGetAttached(controller)) { SDL_GameControllerClose(controller); @@ -114,12 +128,15 @@ void GameController::closeSDLDevice() } } + int GameController::getNumberRawButtons() { qInstallMessageHandler(MessageHandler::myMessageOutput); + return SDL_CONTROLLER_BUTTON_MAX; } + int GameController::getNumberRawAxes() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -131,15 +148,23 @@ int GameController::getNumberRawAxes() return SDL_CONTROLLER_AXIS_MAX; } + int GameController::getNumberRawHats() { qInstallMessageHandler(MessageHandler::myMessageOutput); + return 0; } + void GameController::readJoystickConfig(QXmlStreamReader *xml) { qInstallMessageHandler(MessageHandler::myMessageOutput); + + int index = 0; + int buttonIndex = 0; + QString temp = QString(); + if (xml->isStartElement() && (xml->name() == "joystick")) { transferReset(); @@ -148,51 +173,11 @@ void GameController::readJoystickConfig(QXmlStreamReader *xml) QHash axes; QList hatButtons; - for (int i = 0; i < SDL_JoystickNumHats(this->joyhandle); i++) - { - - SDL_GameControllerButton currentButton = static_cast(i); - SDL_GameControllerButtonBind bound = SDL_GameControllerGetBindForButton(this->controller, currentButton); - - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Hat " << (i + 1); - #endif - - if (bound.bindType == SDL_CONTROLLER_BINDTYPE_HAT) - { - hatButtons.append(bound); - } - } - - for (int i = 0; i < SDL_JoystickNumButtons(this->joyhandle); i++) - { - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Button " << (i + 1); - #endif - - SDL_GameControllerButton currentButton = static_cast(i); - SDL_GameControllerButtonBind bound = SDL_GameControllerGetBindForButton(this->controller, currentButton); - if (bound.bindType == SDL_CONTROLLER_BINDTYPE_BUTTON) - { - buttons.insert(bound.value.button, currentButton); - } - } + fillContainers(buttons, axes, hatButtons); - for (int i = 0; i < SDL_JoystickNumAxes(this->joyhandle); i++) - { - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Axis " << (i + 1); - #endif + xml->readNextStartElement(); - SDL_GameControllerAxis currentAxis = static_cast(i); - SDL_GameControllerButtonBind bound = SDL_GameControllerGetBindForAxis(this->controller, currentAxis); - if (bound.bindType == SDL_CONTROLLER_BINDTYPE_AXIS) - { - axes.insert(bound.value.axis, currentAxis); - } - } - xml->readNextStartElement(); while (!xml->atEnd() && (!xml->isEndElement() && (xml->name() != "joystick"))) { if ((xml->name() == "sets") && xml->isStartElement()) @@ -205,6 +190,7 @@ void GameController::readJoystickConfig(QXmlStreamReader *xml) { int index = xml->attributes().value("index").toString().toInt(); index = index - 1; + if ((index >= 0) && (index < getJoystick_sets().size())) { GameControllerSet *currentSet = qobject_cast(getJoystick_sets().value(index)); // static_cast @@ -226,17 +212,19 @@ void GameController::readJoystickConfig(QXmlStreamReader *xml) bool vdpadNameExists = false; xml->readNextStartElement(); - while (!xml->atEnd() && (!xml->isEndElement() && xml->name() != "names")) + + while (!xml->atEnd() && (!xml->isEndElement() && (xml->name() != "names"))) { if ((xml->name() == "buttonname") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - QString temp = xml->readElementText(); - index = index - 1; + assignVariablesShort(xml, index, temp); + + if ((index >= 0) && !temp.isEmpty()) { SDL_GameControllerButton current = buttons.value(index); - if (current) + + if (static_cast(current) != -1) { setButtonName(current, temp); } @@ -244,37 +232,30 @@ void GameController::readJoystickConfig(QXmlStreamReader *xml) } else if ((xml->name() == "axisbuttonname") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - int buttonIndex = xml->attributes().value("button").toString().toInt(); - QString temp = xml->readElementText(); - index = index - 1; - buttonIndex = buttonIndex - 1; + assignVariables(xml, index, buttonIndex, temp, true); + + if ((index >= 0) && !temp.isEmpty()) { SDL_GameControllerAxis current = axes.value(index); - if (current) + int currentInt = static_cast(current); + + switch (currentInt) { - if (current == SDL_CONTROLLER_AXIS_LEFTX) - { - setStickButtonName(0, buttonIndex, temp); - } - else if (current == SDL_CONTROLLER_AXIS_LEFTY) + case SDL_CONTROLLER_AXIS_LEFTX: + case SDL_CONTROLLER_AXIS_LEFTY: { setStickButtonName(0, buttonIndex, temp); + break; } - else if (current == SDL_CONTROLLER_AXIS_RIGHTX) - { - setStickButtonName(1, buttonIndex, temp); - } - else if (current == SDL_CONTROLLER_AXIS_RIGHTY) + case SDL_CONTROLLER_AXIS_RIGHTX: + case SDL_CONTROLLER_AXIS_RIGHTY: { setStickButtonName(1, buttonIndex, temp); + break; } - else if (current == SDL_CONTROLLER_AXIS_TRIGGERLEFT) - { - setAxisName(current, temp); - } - else if (current == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) + case SDL_CONTROLLER_AXIS_TRIGGERLEFT: + case SDL_CONTROLLER_AXIS_TRIGGERRIGHT: { setAxisName(current, temp); } @@ -283,10 +264,9 @@ void GameController::readJoystickConfig(QXmlStreamReader *xml) } else if ((xml->name() == "controlstickbuttonname") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - int buttonIndex = xml->attributes().value("button").toString().toInt(); - QString temp = xml->readElementText(); - index = index - 1; + assignVariables(xml, index, buttonIndex, temp, false); + + if ((index >= 0) && !temp.isEmpty()) { setStickButtonName(index, buttonIndex, temp); @@ -294,18 +274,19 @@ void GameController::readJoystickConfig(QXmlStreamReader *xml) } else if ((xml->name() == "dpadbuttonname") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - int buttonIndex = xml->attributes().value("button").toString().toInt(); - QString temp = xml->readElementText(); - index = index - 1; + assignVariables(xml, index, buttonIndex, temp, false); + + if ((index >= 0) && !temp.isEmpty()) { bool found = false; QListIterator iter(hatButtons); SDL_GameControllerButtonBind current; + while (iter.hasNext()) { current = iter.next(); + if (current.value.hat.hat == index) { found = true; @@ -316,10 +297,12 @@ void GameController::readJoystickConfig(QXmlStreamReader *xml) if (found) { VDPad *dpad = getActiveSetJoystick()->getVDPad(0); + if (dpad != nullptr) { JoyDPadButton *dpadbutton = dpad->getJoyButton(buttonIndex); - if ((dpad != nullptr) && dpadbutton->getActionName().isEmpty()) + + if ((dpad != nullptr) && (dpadbutton != nullptr) && dpadbutton->getActionName().isEmpty()) { setVDPadButtonName(index, buttonIndex, temp); } @@ -329,15 +312,15 @@ void GameController::readJoystickConfig(QXmlStreamReader *xml) } else if ((xml->name() == "vdpadbuttonname") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - int buttonIndex = xml->attributes().value("button").toString().toInt(); - QString temp = xml->readElementText(); - index = index - 1; + assignVariables(xml, index, buttonIndex, temp, false); + + if ((index >= 0) && !temp.isEmpty()) { bool found = false; QListIterator iter(hatButtons); SDL_GameControllerButtonBind current; + while (iter.hasNext()) { current = iter.next(); @@ -351,10 +334,12 @@ void GameController::readJoystickConfig(QXmlStreamReader *xml) if (found) { VDPad *dpad = getActiveSetJoystick()->getVDPad(0); + if (dpad != nullptr) { JoyDPadButton *dpadbutton = dpad->getJoyButton(buttonIndex); - if ((dpad != nullptr) && dpadbutton->getActionName().isEmpty()) + + if ((dpad != nullptr) && (dpadbutton != nullptr) && dpadbutton->getActionName().isEmpty()) { setVDPadButtonName(index, buttonIndex, temp); } @@ -364,9 +349,9 @@ void GameController::readJoystickConfig(QXmlStreamReader *xml) } else if ((xml->name() == "axisname") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - QString temp = xml->readElementText(); - index = index - 1; + assignVariablesShort(xml, index, temp); + + if ((index >= 0) && !temp.isEmpty()) { if (axes.contains(index)) @@ -378,9 +363,9 @@ void GameController::readJoystickConfig(QXmlStreamReader *xml) } else if ((xml->name() == "controlstickname") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - QString temp = xml->readElementText(); - index = index - 1; + assignVariablesShort(xml, index, temp); + + if ((index >= 0) && !temp.isEmpty()) { setStickName(index, temp); @@ -388,73 +373,11 @@ void GameController::readJoystickConfig(QXmlStreamReader *xml) } else if ((xml->name() == "dpadname") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - QString temp = xml->readElementText(); - index = index - 1; - if ((index >= 0) && !temp.isEmpty() && !vdpadNameExists) - { - bool found = false; - QListIterator iter(hatButtons); - SDL_GameControllerButtonBind current; - while (iter.hasNext()) - { - current = iter.next(); - if (current.value.hat.hat == index) - { - found = true; - iter.toBack(); - } - } - - if (found) - { - dpadNameExists = true; - - VDPad *dpad = getActiveSetJoystick()->getVDPad(0); - if (dpad != nullptr) - { - if (dpad->getDpadName().isEmpty()) - { - setVDPadName(index, temp); - } - } - } - } + readJoystickConfigXmlLong(hatButtons, dpadNameExists, vdpadNameExists, xml); } else if ((xml->name() == "vdpadname") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - QString temp = xml->readElementText(); - index = index - 1; - if ((index >= 0) && !temp.isEmpty() && !dpadNameExists) - { - bool found = false; - QListIterator iter(hatButtons); - SDL_GameControllerButtonBind current; - while (iter.hasNext()) - { - current = iter.next(); - if (current.value.hat.hat == index) - { - found = true; - iter.toBack(); - } - } - - if (found) - { - vdpadNameExists = true; - - VDPad *dpad = getActiveSetJoystick()->getVDPad(0); - if (dpad != nullptr) - { - if (dpad->getDpadName().isEmpty()) - { - setVDPadName(index, temp); - } - } - } - } + readJoystickConfigXmlLong(hatButtons, dpadNameExists, vdpadNameExists, xml); } else { @@ -469,10 +392,9 @@ void GameController::readJoystickConfig(QXmlStreamReader *xml) { QString temptext = xml->readElementText(); int tempchoice = temptext.toInt(); - if (tempchoice >= 10) - { - this->setDeviceKeyPressTime(tempchoice); - } + + if (tempchoice >= 10) this->setDeviceKeyPressTime(tempchoice); + } else if ((xml->name() == "profilename") && xml->isStartElement()) { @@ -493,14 +415,139 @@ void GameController::readJoystickConfig(QXmlStreamReader *xml) } +inline void GameController::assignVariables(QXmlStreamReader *xml, int& index, int& buttonIndex, QString& temp, bool buttonDecreased) +{ + index = xml->attributes().value("index").toString().toInt(); + buttonIndex = xml->attributes().value("button").toString().toInt(); + temp = xml->readElementText(); + index = index - 1; + + if (buttonDecreased) buttonIndex = buttonIndex - 1; +} + + +inline void GameController::assignVariablesShort(QXmlStreamReader *xml, int& index, QString& temp) +{ + index = xml->attributes().value("index").toString().toInt(); + temp = xml->readElementText(); + index = index - 1; +} + + +void GameController::fillContainers(QHash &buttons, QHash &axes, QList &hatButtons) +{ + + for (int i = 0; i < SDL_JoystickNumHats(getJoyHandle()); i++) + { + SDL_GameControllerButton currentButton = static_cast(i); + SDL_GameControllerButtonBind bound = SDL_GameControllerGetBindForButton(this->controller, currentButton); + + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "Hat " << (i + 1); + #endif + + if (bound.bindType == SDL_CONTROLLER_BINDTYPE_HAT) + { + hatButtons.append(bound); + } + } + + for (int i = 0; i < SDL_JoystickNumButtons(getJoyHandle()); i++) + { + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "Button " << (i + 1); + #endif + + SDL_GameControllerButton currentButton = static_cast(i); + SDL_GameControllerButtonBind bound = SDL_GameControllerGetBindForButton(this->controller, currentButton); + + if (bound.bindType == SDL_CONTROLLER_BINDTYPE_BUTTON) + { + buttons.insert(bound.value.button, currentButton); + } + } + + for (int i = 0; i < SDL_JoystickNumAxes(getJoyHandle()); i++) + { + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "Axis " << (i + 1); + #endif + + SDL_GameControllerAxis currentAxis = static_cast(i); + SDL_GameControllerButtonBind bound = SDL_GameControllerGetBindForAxis(this->controller, currentAxis); + + if (bound.bindType == SDL_CONTROLLER_BINDTYPE_AXIS) + { + axes.insert(bound.value.axis, currentAxis); + } + } +} + + +void GameController::readJoystickConfigXmlLong(QList& hatButtons, bool& dpadNameExists, bool& vdpadNameExists, QXmlStreamReader *xml) +{ + int index = -1; + bool first = false; + bool second = false; + QString temp = QString(); + + assignVariablesShort(xml, index, temp); + + + if (xml->name() == "vdpadname") + { + first = dpadNameExists; + second = vdpadNameExists; + } + else if (xml->name() == "dpadname") + { + first = vdpadNameExists; + second = dpadNameExists; + } + + if ((index >= 0) && !temp.isEmpty() && !first) + { + bool found = false; + QListIterator iter(hatButtons); + SDL_GameControllerButtonBind current; + + while (iter.hasNext()) + { + current = iter.next(); + + if (current.value.hat.hat == index) + { + found = true; + iter.toBack(); + } + } + + if (found) + { + second = true; + VDPad *dpad = getActiveSetJoystick()->getVDPad(0); + + if (dpad != nullptr) + { + if (dpad->getDpadName().isEmpty()) + setVDPadName(index, temp); + } + } + } +} + + void GameController::readConfig(QXmlStreamReader *xml) { qInstallMessageHandler(MessageHandler::myMessageOutput); + + if (xml->isStartElement() && (xml->name() == getXmlName())) { transferReset(); xml->readNextStartElement(); + while (!xml->atEnd() && (!xml->isEndElement() && (xml->name() != getXmlName()))) { if ((xml->name() == "sets") && xml->isStartElement()) @@ -513,6 +560,7 @@ void GameController::readConfig(QXmlStreamReader *xml) { int index = xml->attributes().value("index").toString().toInt(); index = index - 1; + if ((index >= 0) && (index < getJoystick_sets().size())) { getJoystick_sets().value(index)->readConfig(xml); @@ -530,83 +578,36 @@ void GameController::readConfig(QXmlStreamReader *xml) else if ((xml->name() == "names") && xml->isStartElement()) { xml->readNextStartElement(); + while (!xml->atEnd() && (!xml->isEndElement() && (xml->name() != "names"))) { if ((xml->name() == "buttonname") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - QString temp = xml->readElementText(); - index = index - 1; - if ((index >= 0) && !temp.isEmpty()) - { - setButtonName(index, temp); - } + readXmlNamesShort("buttonname", xml); } else if ((xml->name() == "triggerbuttonname") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - int buttonIndex = xml->attributes().value("button").toString().toInt(); - QString temp = xml->readElementText(); - index = (index - 1) + SDL_CONTROLLER_AXIS_TRIGGERLEFT; - buttonIndex = buttonIndex - 1; - if (((index == SDL_CONTROLLER_AXIS_TRIGGERLEFT) || - (index == SDL_CONTROLLER_AXIS_TRIGGERRIGHT)) && !temp.isEmpty()) - { - setAxisButtonName(index, buttonIndex, temp); - } + readXmlNamesLong("triggerbuttonname", xml); } else if ((xml->name() == "controlstickbuttonname") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - int buttonIndex = xml->attributes().value("button").toString().toInt(); - QString temp = xml->readElementText(); - index = index - 1; - if ((index >= 0) && !temp.isEmpty()) - { - setStickButtonName(index, buttonIndex, temp); - } + readXmlNamesMiddle("controlstickbuttonname", xml); } else if ((xml->name() == "dpadbuttonname") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - int buttonIndex = xml->attributes().value("button").toString().toInt(); - QString temp = xml->readElementText(); - index = index - 1; - if ((index >= 0) && !temp.isEmpty()) - { - setVDPadButtonName(index, buttonIndex, temp); - } + readXmlNamesMiddle("dpadbuttonname", xml); } else if ((xml->name() == "triggername") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - QString temp = xml->readElementText(); - index = (index - 1) + SDL_CONTROLLER_AXIS_TRIGGERLEFT; - if ((index == SDL_CONTROLLER_AXIS_TRIGGERLEFT || - index == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) && !temp.isEmpty()) - { - setAxisName(index, temp); - } + readXmlNamesLong("triggername", xml); } else if ((xml->name() == "controlstickname") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - QString temp = xml->readElementText(); - index = index - 1; - if ((index >= 0) && !temp.isEmpty()) - { - setStickName(index, temp); - } + readXmlNamesShort("controlstickname", xml); } else if ((xml->name() == "dpadname") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - QString temp = xml->readElementText(); - index = index - 1; - if ((index >= 0) && !temp.isEmpty()) - { - setVDPadName(index, temp); - } + readXmlNamesShort("dpadname", xml); } else { @@ -621,6 +622,7 @@ void GameController::readConfig(QXmlStreamReader *xml) { QString temptext = xml->readElementText(); int tempchoice = temptext.toInt(); + if (tempchoice >= 10) { this->setDeviceKeyPressTime(tempchoice); @@ -641,6 +643,7 @@ void GameController::readConfig(QXmlStreamReader *xml) } reInitButtons(); + } else if (xml->isStartElement() && (xml->name() == "joystick")) { @@ -648,9 +651,63 @@ void GameController::readConfig(QXmlStreamReader *xml) } } + +void GameController::readXmlNamesShort(QString name, QXmlStreamReader *xml) +{ + int index = -1; + QString temp = QString(); + + assignVariablesShort(xml, index, temp); + + if ((index >= 0) && !temp.isEmpty()) + { + if (name == "buttonname") setButtonName(index, temp); + else if (name == "controlstickname") setStickName(index, temp); + else if (name == "dpadname") setVDPadName(index, temp); + } +} + + +void GameController::readXmlNamesMiddle(QString name, QXmlStreamReader *xml) +{ + int index = -1; + int buttonIndex = -1; + QString temp = QString(); + + assignVariables(xml, index, buttonIndex, temp, false); + + if ((name == "dpadbuttonname") && (index >= 0) && !temp.isEmpty()) setVDPadButtonName(index, buttonIndex, temp); + else if ((name == "controlstickbuttonname") && (index >= 0) && !temp.isEmpty()) setStickButtonName(index, buttonIndex, temp); +} + + +void GameController::readXmlNamesLong(QString name, QXmlStreamReader *xml) +{ + int index = xml->attributes().value("index").toString().toInt(); + QString temp = xml->readElementText(); + index = (index - 1) + SDL_CONTROLLER_AXIS_TRIGGERLEFT; + + if ((index == SDL_CONTROLLER_AXIS_TRIGGERLEFT || + index == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) && !temp.isEmpty()) + { + if (name == "triggername") + { + setAxisName(index, temp); + } + else if (name == "triggerbuttonname") + { + int buttonIndex = xml->attributes().value("button").toString().toInt(); + buttonIndex = buttonIndex - 1; + setAxisButtonName(index, buttonIndex, temp); + } + } +} + + void GameController::writeConfig(QXmlStreamWriter *xml) { qInstallMessageHandler(MessageHandler::myMessageOutput); + xml->writeStartElement(getXmlName()); xml->writeAttribute("configversion", QString::number(PadderCommon::LATESTCONFIGFILEVERSION)); xml->writeAttribute("appversion", PadderCommon::programVersion); @@ -668,9 +725,38 @@ void GameController::writeConfig(QXmlStreamWriter *xml) xml->writeStartElement("names"); // SetJoystick *tempSet = getActiveSetJoystick(); - for (int i=0; i < getNumberButtons(); i++) + + writeXmlForButtons(tempSet, xml); + writeXmlForAxes(tempSet, xml); + writeXmlForSticks(tempSet, xml); + writeXmlForVDpad(xml); + + xml->writeEndElement(); // + + if ((keyPressTime > 0) && (keyPressTime != GlobalVariables::InputDevice::DEFAULTKEYPRESSTIME)) + { + xml->writeTextElement("keyPressTime", QString::number(keyPressTime)); + } + + xml->writeStartElement("sets"); + + for (int i = 0; i < getJoystick_sets().size(); i++) + { + getJoystick_sets().value(i)->writeConfig(xml); + } + + xml->writeEndElement(); + + xml->writeEndElement(); +} + + +void GameController::writeXmlForButtons(SetJoystick *tempSet, QXmlStreamWriter *xml) +{ + for (int i = 0; i < getNumberButtons(); i++) { JoyButton *button = tempSet->getJoyButton(i); + if ((button != nullptr) && !button->getButtonName().isEmpty()) { xml->writeStartElement("buttonname"); @@ -679,10 +765,15 @@ void GameController::writeConfig(QXmlStreamWriter *xml) xml->writeEndElement(); } } +} - for (int i=0; i < getNumberAxes(); i++) + +void GameController::writeXmlForAxes(SetJoystick *tempSet, QXmlStreamWriter *xml) +{ + for (int i = 0; i < getNumberAxes(); i++) { JoyAxis *axis = tempSet->getJoyAxis(i); + if (axis != nullptr) { if (!axis->getAxisName().isEmpty()) @@ -693,31 +784,33 @@ void GameController::writeConfig(QXmlStreamWriter *xml) xml->writeEndElement(); } - JoyAxisButton *naxisbutton = axis->getNAxisButton(); - if (!naxisbutton->getButtonName().isEmpty()) - { - xml->writeStartElement("axisbuttonname"); - xml->writeAttribute("index", QString::number(axis->getRealJoyIndex())); - xml->writeAttribute("button", QString::number(naxisbutton->getRealJoyNumber())); - xml->writeCharacters(naxisbutton->getButtonName()); - xml->writeEndElement(); - } + writeXmlAxBtn(axis, axis->getNAxisButton(), xml); + writeXmlAxBtn(axis, axis->getPAxisButton(), xml); - JoyAxisButton *paxisbutton = axis->getPAxisButton(); - if (!paxisbutton->getButtonName().isEmpty()) - { - xml->writeStartElement("axisbuttonname"); - xml->writeAttribute("index", QString::number(axis->getRealJoyIndex())); - xml->writeAttribute("button", QString::number(paxisbutton->getRealJoyNumber())); - xml->writeCharacters(paxisbutton->getButtonName()); - xml->writeEndElement(); - } } } +} - for (int i=0; i < getNumberSticks(); i++) + +void GameController::writeXmlAxBtn(JoyAxis *axis, JoyAxisButton *axisbutton, QXmlStreamWriter *xml) +{ + if (!axisbutton->getButtonName().isEmpty()) + { + xml->writeStartElement("axisbuttonname"); + xml->writeAttribute("index", QString::number(axis->getRealJoyIndex())); + xml->writeAttribute("button", QString::number(axisbutton->getRealJoyNumber())); + xml->writeCharacters(axisbutton->getButtonName()); + xml->writeEndElement(); + } +} + + +void GameController::writeXmlForSticks(SetJoystick *tempSet, QXmlStreamWriter *xml) +{ + for (int i = 0; i < getNumberSticks(); i++) { JoyControlStick *stick = tempSet->getJoyStick(i); + if (stick != nullptr) { if (!stick->getStickName().isEmpty()) @@ -730,10 +823,12 @@ void GameController::writeConfig(QXmlStreamWriter *xml) QHash *buttons = stick->getButtons(); QHashIterator iter(*buttons); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); - if (button && !button->getButtonName().isEmpty()) + + if ((button != nullptr) && !button->getButtonName().isEmpty()) { xml->writeStartElement("controlstickbuttonname"); xml->writeAttribute("index", QString::number(stick->getRealJoyIndex())); @@ -744,189 +839,144 @@ void GameController::writeConfig(QXmlStreamWriter *xml) } } } +} - for (int i=0; i < getNumberVDPads(); i++) - { - VDPad *vdpad = getActiveSetJoystick()->getVDPad(i); - if (vdpad != nullptr) + +void GameController::writeXmlForVDpad(QXmlStreamWriter *xml) +{ + for (int i = 0; i < getNumberVDPads(); i++) { - if (!vdpad->getDpadName().isEmpty()) - { - xml->writeStartElement("dpadname"); - xml->writeAttribute("index", QString::number(vdpad->getRealJoyNumber())); - xml->writeCharacters(vdpad->getDpadName()); - xml->writeEndElement(); - } + VDPad *vdpad = getActiveSetJoystick()->getVDPad(i); - QHash *temp = vdpad->getButtons(); - QHashIterator iter(*temp); - while (iter.hasNext()) + if (vdpad != nullptr) { - JoyDPadButton *button = iter.next().value(); - if ((button != nullptr) && !button->getButtonName().isEmpty()) + if (!vdpad->getDpadName().isEmpty()) { - xml->writeStartElement("dpadbutton"); + xml->writeStartElement("dpadname"); xml->writeAttribute("index", QString::number(vdpad->getRealJoyNumber())); - xml->writeAttribute("button", QString::number(button->getRealJoyNumber())); - xml->writeCharacters(button->getButtonName()); + xml->writeCharacters(vdpad->getDpadName()); xml->writeEndElement(); } - } - } - } - xml->writeEndElement(); // - if ((keyPressTime > 0) && (keyPressTime != DEFAULTKEYPRESSTIME)) - { - xml->writeTextElement("keyPressTime", QString::number(keyPressTime)); - } + QHash *temp = vdpad->getButtons(); + QHashIterator iter(*temp); - xml->writeStartElement("sets"); - for (int i=0; i < getJoystick_sets().size(); i++) - { - getJoystick_sets().value(i)->writeConfig(xml); - } - xml->writeEndElement(); + while (iter.hasNext()) + { + JoyDPadButton *button = iter.next().value(); - xml->writeEndElement(); + if ((button != nullptr) && !button->getButtonName().isEmpty()) + { + xml->writeStartElement("dpadbutton"); + xml->writeAttribute("index", QString::number(vdpad->getRealJoyNumber())); + xml->writeAttribute("button", QString::number(button->getRealJoyNumber())); + xml->writeCharacters(button->getButtonName()); + xml->writeEndElement(); + } + } + } + } } + QString GameController::getBindStringForAxis(int index, bool) { qInstallMessageHandler(MessageHandler::myMessageOutput); + QString temp = QString(); + SDL_GameControllerButtonBind bind = SDL_GameControllerGetBindForAxis(controller, static_cast(index)); - if (bind.bindType != SDL_CONTROLLER_BINDTYPE_NONE) - { - if (bind.bindType == SDL_CONTROLLER_BINDTYPE_BUTTON) - { - temp.append(QString("Button %1").arg(bind.value.button)); // bind.value.button + offset - } - else if (bind.bindType == SDL_CONTROLLER_BINDTYPE_AXIS) - { - temp.append(QString("Axis %1").arg(bind.value.axis + 1)); - } + + if (bind.bindType == SDL_CONTROLLER_BINDTYPE_BUTTON) + { + temp.append(QString("Button %1").arg(bind.value.button)); + } + else if (bind.bindType == SDL_CONTROLLER_BINDTYPE_AXIS) + { + temp.append(QString("Axis %1").arg(bind.value.axis + 1)); } + return temp; } + QString GameController::getBindStringForButton(int index, bool trueIndex) { qInstallMessageHandler(MessageHandler::myMessageOutput); + QString temp = QString(); + SDL_GameControllerButtonBind bind = SDL_GameControllerGetBindForButton(controller, static_cast(index)); - if (bind.bindType != SDL_CONTROLLER_BINDTYPE_NONE) - { - int offset = trueIndex ? 0 : 1; - if (bind.bindType == SDL_CONTROLLER_BINDTYPE_BUTTON) - { - temp.append(QString("Button %1").arg(bind.value.button + offset)); - } - else if (bind.bindType == SDL_CONTROLLER_BINDTYPE_AXIS) - { - temp.append(QString("Axis %1").arg(bind.value.axis + offset)); - } - else if (bind.bindType == SDL_CONTROLLER_BINDTYPE_HAT) - { - temp.append(QString("Hat %1.%2").arg(bind.value.hat.hat + offset) + int offset = trueIndex ? 0 : 1; + int bindInt = static_cast(bind.bindType); + + switch(bindInt) { + + case SDL_CONTROLLER_BINDTYPE_BUTTON: + temp.append(QString("Button %1").arg(bind.value.button + offset)); + break; + + + case SDL_CONTROLLER_BINDTYPE_AXIS: + temp.append(QString("Axis %1").arg(bind.value.axis + offset)); + break; + + + case SDL_CONTROLLER_BINDTYPE_HAT: + temp.append(QString("Hat %1.%2").arg(bind.value.hat.hat + offset) .arg(bind.value.hat.hat_mask)); - } + break; } + return temp; } + SDL_GameControllerButtonBind GameController::getBindForAxis(int index) { qInstallMessageHandler(MessageHandler::myMessageOutput); - SDL_GameControllerButtonBind bind = SDL_GameControllerGetBindForAxis(controller, static_cast(index)); - return bind; + + return SDL_GameControllerGetBindForAxis(controller, static_cast(index)); } + SDL_GameControllerButtonBind GameController::getBindForButton(int index) { qInstallMessageHandler(MessageHandler::myMessageOutput); - SDL_GameControllerButtonBind bind = SDL_GameControllerGetBindForButton(controller, static_cast(index)); - return bind; + + return SDL_GameControllerGetBindForButton(controller, static_cast(index)); } -void GameController::buttonClickEvent(int buttonindex) + +void GameController::buttonClickEvent(int) { qInstallMessageHandler(MessageHandler::myMessageOutput); - SDL_GameControllerButtonBind bind = getBindForButton(buttonindex); // static_cast - if (bind.bindType != SDL_CONTROLLER_BINDTYPE_NONE) - { - if (bind.bindType == SDL_CONTROLLER_BINDTYPE_AXIS) - { - //emit rawAxisButtonClick(bind.value.axis, 0); - //emit rawAxisActivated(bind.value.axis, JoyAxis::AXISMAX); - } - else if (bind.bindType == SDL_CONTROLLER_BINDTYPE_BUTTON) - { - //emit rawButtonClick(bind.value.button); - } - else if (bind.bindType == SDL_CONTROLLER_BINDTYPE_HAT) - { - //emit rawDPadButtonClick(bind.value.hat.hat, bind.value.hat.hat_mask); - } - } } -void GameController::buttonReleaseEvent(int buttonindex) + +void GameController::buttonReleaseEvent(int) { qInstallMessageHandler(MessageHandler::myMessageOutput); - SDL_GameControllerButtonBind bind = getBindForButton(buttonindex); // static_cast - if (bind.bindType != SDL_CONTROLLER_BINDTYPE_NONE) - { - if (bind.bindType == SDL_CONTROLLER_BINDTYPE_AXIS) - { - //emit rawAxisButtonRelease(bind.value.axis, 0); - } - else if (bind.bindType == SDL_CONTROLLER_BINDTYPE_BUTTON) - { - //emit rawButtonRelease(bind.value.button); - } - else if (bind.bindType == SDL_CONTROLLER_BINDTYPE_HAT) - { - //emit rawDPadButtonRelease(bind.value.hat.hat, bind.value.hat.hat_mask); - } - } } -void GameController::axisActivatedEvent(int setindex, int axisindex, int value) + +void GameController::axisActivatedEvent(int, int, int) { qInstallMessageHandler(MessageHandler::myMessageOutput); - Q_UNUSED(setindex); - Q_UNUSED(value); - - SDL_GameControllerButtonBind bind = getBindForAxis(axisindex); // static_cast - if (bind.bindType != SDL_CONTROLLER_BINDTYPE_NONE) - { - if (bind.bindType == SDL_CONTROLLER_BINDTYPE_AXIS) - { - //emit rawAxisButtonClick(bind.value.axis, 0); - //emit rawAxisActivated(bind.value.axis, value); - } - else if (bind.bindType == SDL_CONTROLLER_BINDTYPE_BUTTON) - { - //emit rawButtonClick(bind.value.button); - } - else if (bind.bindType == SDL_CONTROLLER_BINDTYPE_HAT) - { - //emit rawDPadButtonClick(bind.value.hat.hat, bind.value.hat.hat_mask); - } - } } + SDL_JoystickID GameController::getSDLJoystickID() { qInstallMessageHandler(MessageHandler::myMessageOutput); + return joystickID; } @@ -937,9 +987,11 @@ SDL_JoystickID GameController::getSDLJoystickID() bool GameController::isGameController() { qInstallMessageHandler(MessageHandler::myMessageOutput); + return true; } + /** * @brief Check if GUID passed matches the expected GUID for a device. * Needed for xinput GUID abstraction. @@ -949,20 +1001,17 @@ bool GameController::isGameController() bool GameController::isRelevantGUID(QString tempGUID) { qInstallMessageHandler(MessageHandler::myMessageOutput); - bool result = false; - if (InputDevice::isRelevantGUID(tempGUID))// || isEmptyGUID(tempGUID)) - { - result = true; - } - - return result; + return InputDevice::isRelevantGUID(tempGUID); } + void GameController::rawButtonEvent(int index, bool pressed) { qInstallMessageHandler(MessageHandler::myMessageOutput); + bool knownbutton = getRawbuttons().contains(index); + if (!knownbutton && pressed) { rawbuttons.insert(index, pressed); @@ -975,9 +1024,11 @@ void GameController::rawButtonEvent(int index, bool pressed) } } + void GameController::rawAxisEvent(int index, int value) { qInstallMessageHandler(MessageHandler::myMessageOutput); + bool knownaxis = getAxisvalues().contains(index); if (!knownaxis && (fabs(value) > rawAxisDeadZone)) @@ -994,10 +1045,13 @@ void GameController::rawAxisEvent(int index, int value) emit rawAxisMoved(index, value); } + void GameController::rawDPadEvent(int index, int value) { qInstallMessageHandler(MessageHandler::myMessageOutput); + bool knowndpad = getDpadvalues().contains(index); + if (!knowndpad && (value != 0)) { dpadvalues.insert(index, value); @@ -1016,16 +1070,19 @@ QHash const& GameController::getRawbuttons() { return rawbuttons; } + QHash const& GameController::getAxisvalues() { return axisvalues; } + QHash const& GameController::getDpadvalues() { return dpadvalues; } + SDL_GameController* GameController::getController() const { return controller; diff --git a/src/gamecontroller/gamecontroller.h b/src/gamecontroller/gamecontroller.h old mode 100644 new mode 100755 index 325aa9c2e..7e1bd7022 --- a/src/gamecontroller/gamecontroller.h +++ b/src/gamecontroller/gamecontroller.h @@ -34,21 +34,21 @@ class GameController : public InputDevice public: explicit GameController(SDL_GameController *controller, int deviceIndex, AntiMicroSettings *settings, QObject *parent = nullptr); - virtual QString getName(); - virtual QString getSDLName(); + virtual QString getName() override; + virtual QString getSDLName() override; // GUID available on SDL 2. - virtual QString getGUIDString(); - virtual QString getRawGUIDString(); + virtual QString getGUIDString() override; + virtual QString getRawGUIDString() override; - virtual QString getXmlName(); - virtual bool isGameController(); - virtual void closeSDLDevice(); - virtual SDL_JoystickID getSDLJoystickID(); + virtual QString getXmlName() override; + virtual bool isGameController() override; + virtual void closeSDLDevice() override; + virtual SDL_JoystickID getSDLJoystickID() override; - virtual int getNumberRawButtons(); - virtual int getNumberRawAxes(); - virtual int getNumberRawHats(); + virtual int getNumberRawButtons() override; + virtual int getNumberRawAxes() override; + virtual int getNumberRawHats() override; QString getBindStringForAxis(int index, bool trueIndex=true); QString getBindStringForButton(int index, bool trueIndex=true); @@ -67,19 +67,17 @@ class GameController : public InputDevice SDL_GameController *getController() const; - static const QString xmlName; - protected: void readJoystickConfig(QXmlStreamReader *xml); public slots: - virtual void readConfig(QXmlStreamReader *xml); - virtual void writeConfig(QXmlStreamWriter *xml); + virtual void readConfig(QXmlStreamReader *xml) override; + virtual void writeConfig(QXmlStreamWriter *xml) override; protected slots: - virtual void axisActivatedEvent(int setindex, int axisindex, int value); - virtual void buttonClickEvent(int buttonindex); - virtual void buttonReleaseEvent(int buttonindex); + virtual void axisActivatedEvent(int setindex, int axisindex, int value) override; + virtual void buttonClickEvent(int buttonindex) override; + virtual void buttonReleaseEvent(int buttonindex) override; private: QHash rawbuttons; @@ -89,6 +87,21 @@ protected slots: SDL_JoystickID joystickID; SDL_GameController *controller; + void writeXmlForButtons(SetJoystick *tempSet, QXmlStreamWriter *xml); + void writeXmlForAxes(SetJoystick *tempSet, QXmlStreamWriter *xml); + void writeXmlAxBtn(JoyAxis *axis, JoyAxisButton *naxisbutton, QXmlStreamWriter *xml); + void writeXmlForSticks(SetJoystick *tempSet, QXmlStreamWriter *xml); + void writeXmlForVDpad(QXmlStreamWriter *xml); + void readXmlNamesShort(QString name, QXmlStreamReader *xml); + void readXmlNamesMiddle(QString name, QXmlStreamReader *xml); + void readXmlNamesLong(QString name, QXmlStreamReader *xml); + void readJoystickConfigXmlLong(QList& hatButtons, bool& dpadNameExists, bool& vdpadNameExists, QXmlStreamReader *xml); + void fillContainers(QHash &buttons, QHash &axes, QList &hatButtons); + + inline void assignVariables(QXmlStreamReader *xml, int& index, int& buttonIndex, QString& temp, bool buttonDecreased); + inline void assignVariablesShort(QXmlStreamReader *xml, int& index, QString& temp); + + }; #endif // GAMECONTROLLER_H diff --git a/src/gamecontroller/gamecontrollerdpad.cpp b/src/gamecontroller/gamecontrollerdpad.cpp old mode 100644 new mode 100755 index 909cf63e6..f24e983d0 --- a/src/gamecontroller/gamecontrollerdpad.cpp +++ b/src/gamecontroller/gamecontrollerdpad.cpp @@ -17,6 +17,7 @@ #include "gamecontrollerdpad.h" +#include "globalvariables.h" #include "messagehandler.h" #include "setjoystick.h" #include "joybutton.h" @@ -24,8 +25,6 @@ #include #include -const QString GameControllerDPad::xmlName = "dpad"; - GameControllerDPad::GameControllerDPad(JoyButton *upButton, JoyButton *downButton, JoyButton *leftButton, JoyButton *rightButton, int index, int originset, SetJoystick *parentSet, QObject *parent) : @@ -34,9 +33,11 @@ GameControllerDPad::GameControllerDPad(JoyButton *upButton, JoyButton *downButto qInstallMessageHandler(MessageHandler::myMessageOutput); } + QString GameControllerDPad::getName(bool forceFullFormat, bool displayName) { qInstallMessageHandler(MessageHandler::myMessageOutput); + QString label = QString(); if (!getDpadName().isEmpty() && displayName) @@ -66,21 +67,27 @@ QString GameControllerDPad::getName(bool forceFullFormat, bool displayName) return label; } + QString GameControllerDPad::getXmlName() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->xmlName; + + return GlobalVariables::GameControllerDPad::xmlName; } + void GameControllerDPad::readJoystickConfig(QXmlStreamReader *xml) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (xml->isStartElement() && (xml->name() == VDPad::xmlName)) + + if (xml->isStartElement() && (xml->name() == GlobalVariables::VDPad::xmlName)) { xml->readNextStartElement(); - while (!xml->atEnd() && (!xml->isEndElement() && xml->name() != VDPad::xmlName)) + + while (!xml->atEnd() && (!xml->isEndElement() && (xml->name() != GlobalVariables::VDPad::xmlName))) { bool found = readMainConfig(xml); + if (!found) { xml->skipCurrentElement(); diff --git a/src/gamecontroller/gamecontrollerdpad.h b/src/gamecontroller/gamecontrollerdpad.h old mode 100644 new mode 100755 index 196443e31..b55b9363a --- a/src/gamecontroller/gamecontrollerdpad.h +++ b/src/gamecontroller/gamecontrollerdpad.h @@ -39,8 +39,6 @@ class GameControllerDPad : public VDPad void readJoystickConfig(QXmlStreamReader *xml); - static const QString xmlName; - }; #endif // GAMECONTROLLERDPAD_H diff --git a/src/gamecontroller/gamecontrollerset.cpp b/src/gamecontroller/gamecontrollerset.cpp old mode 100644 new mode 100755 index 7cba172e4..5e2e670c9 --- a/src/gamecontroller/gamecontrollerset.cpp +++ b/src/gamecontroller/gamecontrollerset.cpp @@ -26,16 +26,25 @@ #include #include + GameControllerSet::GameControllerSet(InputDevice *device, int index, QObject *parent) : SetJoystick(device, index, false, parent) { qInstallMessageHandler(MessageHandler::myMessageOutput); - reset(); + + resetSticks(); } + void GameControllerSet::reset() { qInstallMessageHandler(MessageHandler::myMessageOutput); + + resetSticks(); +} + +void GameControllerSet::resetSticks() +{ SetJoystick::reset(); populateSticksDPad(); } @@ -43,6 +52,7 @@ void GameControllerSet::reset() void GameControllerSet::populateSticksDPad() { qInstallMessageHandler(MessageHandler::myMessageOutput); + // Left Stick Assignment JoyAxis *axisX = getJoyAxis(SDL_CONTROLLER_AXIS_LEFTX); JoyAxis *axisY = getJoyAxis(SDL_CONTROLLER_AXIS_LEFTY); @@ -85,18 +95,72 @@ void GameControllerSet::populateSticksDPad() getJoyAxis(SDL_CONTROLLER_AXIS_TRIGGERRIGHT)->setDefaultAxisName(trUtf8("R Trigger")); } + +template +void readConf(T* x, QXmlStreamReader *xml) +{ + if (x != nullptr) + { + x->readConfig(xml); + } + else + { + xml->skipCurrentElement(); + } +} + + +void GameControllerSet::readConfDpad(QXmlStreamReader *xml, QList &hatButtons, bool vdpadExists, bool dpadExists) +{ + int index = xml->attributes().value("index").toString().toInt(); + index = index - 1; + bool found = false; + QListIterator iter(hatButtons); + SDL_GameControllerButtonBind current; + + while (iter.hasNext()) + { + current = iter.next(); + + if (current.value.hat.hat == index) + { + found = true; + iter.toBack(); + } + } + + VDPad *dpad = nullptr; + + if (found) + { + dpad = getVDPad(0); + } + + if ((dpad != nullptr) && !vdpadExists) + { + dpadExists = true; + dpad->readConfig(xml); + } + else + { + xml->skipCurrentElement(); + } +} + + void GameControllerSet::readJoystickConfig(QXmlStreamReader *xml, QHash &buttons, QHash &axes, QList &hatButtons) { + qInstallMessageHandler(MessageHandler::myMessageOutput); if (xml->isStartElement() && (xml->name() == "set")) { xml->readNextStartElement(); - while (!xml->atEnd() && (!xml->isEndElement() && xml->name() != "set")) + while (!xml->atEnd() && (!xml->isEndElement() && (xml->name() != "set"))) { bool dpadExists = false; bool vdpadExists = false; @@ -105,25 +169,21 @@ void GameControllerSet::readJoystickConfig(QXmlStreamReader *xml, { int index = xml->attributes().value("index").toString().toInt(); JoyButton *button = nullptr; + if (buttons.contains(index-1)) { SDL_GameControllerButton current = buttons.value(index-1); button = getJoyButton(current); } - if (button != nullptr) - { - button->readConfig(xml); - } - else - { - xml->skipCurrentElement(); - } + readConf(button, xml); + } else if ((xml->name() == "axis") && xml->isStartElement()) { int index = xml->attributes().value("index").toString().toInt(); GameControllerTrigger *trigger = nullptr; + if (axes.contains(index-1)) { SDL_GameControllerAxis current = axes.value(index-1); @@ -141,96 +201,20 @@ void GameControllerSet::readJoystickConfig(QXmlStreamReader *xml, } else if ((xml->name() == "dpad") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - index = index - 1; - bool found = false; - QListIterator iter(hatButtons); - SDL_GameControllerButtonBind current; - while (iter.hasNext()) - { - current = iter.next(); - if (current.value.hat.hat == index) - { - found = true; - iter.toBack(); - } - } - - VDPad *dpad = nullptr; - if (found) - { - dpad = getVDPad(0); - } - - if ((dpad != nullptr) && !vdpadExists) - { - dpadExists = true; - dpad->readConfig(xml); - } - else - { - xml->skipCurrentElement(); - } + readConfDpad(xml, hatButtons, vdpadExists, dpadExists); } else if ((xml->name() == "stick") && xml->isStartElement()) { - int stickIndex = xml->attributes().value("index").toString().toInt(); - - if (stickIndex > 0) - { - stickIndex -= 1; - JoyControlStick *stick = getJoyStick(stickIndex); - if (stick != nullptr) - { - stick->readConfig(xml); - } - else - { - xml->skipCurrentElement(); - } - } - else - { - xml->skipCurrentElement(); - } + getElemFromXml("stick", xml); } else if ((xml->name() == "vdpad") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - index = index - 1; - bool found = false; - QListIterator iter(hatButtons); - SDL_GameControllerButtonBind current; - while (iter.hasNext()) - { - current = iter.next(); - if (current.value.hat.hat == index) - { - found = true; - iter.toBack(); - } - } - - VDPad *dpad = nullptr; - if (found) - { - dpad = getVDPad(0); - } - - if ((dpad != nullptr) && !dpadExists) - { - vdpadExists = true; - - dpad->readConfig(xml); - } - else - { - xml->skipCurrentElement(); - } + readConfDpad(xml, hatButtons, vdpadExists, dpadExists); } else if ((xml->name() == "name") && xml->isStartElement()) { QString temptext = xml->readElementText(); + if (!temptext.isEmpty()) { setName(temptext); @@ -247,6 +231,7 @@ void GameControllerSet::readJoystickConfig(QXmlStreamReader *xml, } } + void GameControllerSet::readConfig(QXmlStreamReader *xml) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -254,72 +239,29 @@ void GameControllerSet::readConfig(QXmlStreamReader *xml) if (xml->isStartElement() && (xml->name() == "set")) { xml->readNextStartElement(); + while (!xml->atEnd() && (!xml->isEndElement() && xml->name() != "set")) { if ((xml->name() == "button") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - JoyButton *button = getJoyButton(index-1); - if (button != nullptr) - { - button->readConfig(xml); - } - else - { - xml->skipCurrentElement(); - } + getElemFromXml("button", xml); } else if ((xml->name() == "trigger") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - GameControllerTrigger *axis = qobject_cast(getJoyAxis((index-1) + SDL_CONTROLLER_AXIS_TRIGGERLEFT)); - if (axis != nullptr) - { - axis->readConfig(xml); - } - else - { - xml->skipCurrentElement(); - } + getElemFromXml("trigger", xml); } else if ((xml->name() == "stick") && xml->isStartElement()) { - int stickIndex = xml->attributes().value("index").toString().toInt(); - - if (stickIndex > 0) - { - stickIndex -= 1; - JoyControlStick *stick = getJoyStick(stickIndex); - if (stick != nullptr) - { - stick->readConfig(xml); - } - else - { - xml->skipCurrentElement(); - } - } - else - { - xml->skipCurrentElement(); - } + getElemFromXml("stick", xml); } else if ((xml->name() == "dpad") && xml->isStartElement()) { - int index = xml->attributes().value("index").toString().toInt(); - GameControllerDPad *vdpad = qobject_cast(getVDPad(index-1)); - if (vdpad != nullptr) - { - vdpad->readConfig(xml); - } - else - { - xml->skipCurrentElement(); - } + getElemFromXml("dpad", xml); } else if ((xml->name() == "name") && xml->isStartElement()) { QString temptext = xml->readElementText(); + if (!temptext.isEmpty()) { setName(temptext); @@ -336,16 +278,48 @@ void GameControllerSet::readConfig(QXmlStreamReader *xml) } } + +void GameControllerSet::getElemFromXml(QString elemName, QXmlStreamReader *xml) +{ + int index = xml->attributes().value("index").toString().toInt(); + + if (elemName == "button") { + JoyButton *button = getJoyButton(index-1); + readConf(button, xml); + } + else if (elemName == "dpad") { + GameControllerDPad *vdpad = qobject_cast(getVDPad(index-1)); + readConf(vdpad, xml); + } + else if (elemName == "trigger") { + GameControllerTrigger *axis = qobject_cast(getJoyAxis((index-1) + SDL_CONTROLLER_AXIS_TRIGGERLEFT)); + readConf(axis, xml); + } + else if (elemName == "stick") { + if (index > 0) + { + index -= 1; + JoyControlStick *stick = getJoyStick(index); + readConf(stick, xml); + } + else + { + xml->skipCurrentElement(); + } + } +} + + void GameControllerSet::refreshAxes() { qInstallMessageHandler(MessageHandler::myMessageOutput); deleteAxes(); - for (int i=0; i < getInputDevice()->getNumberRawAxes(); i++) + for (int i = 0; i < getInputDevice()->getNumberRawAxes(); i++) { - if ((i == SDL_CONTROLLER_AXIS_TRIGGERLEFT) || - (i == SDL_CONTROLLER_AXIS_TRIGGERRIGHT)) + if ((i == static_cast(SDL_CONTROLLER_AXIS_TRIGGERLEFT)) || + (i == static_cast(SDL_CONTROLLER_AXIS_TRIGGERRIGHT))) { GameControllerTrigger *trigger = new GameControllerTrigger(i, getIndex(), this, this); getAxes()->insert(i, trigger); diff --git a/src/gamecontroller/gamecontrollerset.h b/src/gamecontroller/gamecontrollerset.h old mode 100644 new mode 100755 index 7fa39f340..9cc022a48 --- a/src/gamecontroller/gamecontrollerset.h +++ b/src/gamecontroller/gamecontrollerset.h @@ -48,6 +48,11 @@ class GameControllerSet : public SetJoystick public slots: virtual void reset(); + +private: + void getElemFromXml(QString elemName, QXmlStreamReader *xml); + void readConfDpad(QXmlStreamReader *xml, QList &hatButtons, bool vdpadExists, bool dpadExists); + void resetSticks(); }; #endif // GAMECONTROLLERSET_H diff --git a/src/gamecontroller/gamecontrollertrigger.cpp b/src/gamecontroller/gamecontrollertrigger.cpp old mode 100644 new mode 100755 index b76109855..1fa43ce88 --- a/src/gamecontroller/gamecontrollertrigger.cpp +++ b/src/gamecontroller/gamecontrollertrigger.cpp @@ -19,6 +19,7 @@ #include "gamecontrollertrigger.h" +#include "globalvariables.h" #include "messagehandler.h" #include "gamecontrollertriggerbutton.h" @@ -29,12 +30,8 @@ #include -const int GameControllerTrigger::AXISDEADZONE = 2000; -const int GameControllerTrigger::AXISMAXZONE = 32000; const GameControllerTrigger::ThrottleTypes GameControllerTrigger::DEFAULTTHROTTLE = GameControllerTrigger::PositiveHalfThrottle; -const QString GameControllerTrigger::xmlName = "trigger"; - GameControllerTrigger::GameControllerTrigger(int index, int originset, SetJoystick *parentSet, QObject *parent) : JoyAxis(index, originset, parentSet, parent) { @@ -45,13 +42,15 @@ GameControllerTrigger::GameControllerTrigger(int index, int originset, SetJoysti reset(index); } + QString GameControllerTrigger::getXmlName() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->xmlName; + return GlobalVariables::GameControllerTrigger::xmlName; } + QString GameControllerTrigger::getPartialName(bool forceFullFormat, bool displayNames) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -85,38 +84,46 @@ QString GameControllerTrigger::getPartialName(bool forceFullFormat, bool display return label; } + void GameControllerTrigger::readJoystickConfig(QXmlStreamReader *xml) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (xml->isStartElement() && (xml->name() == JoyAxis::xmlName)) + if (xml->isStartElement() && (xml->name() == GlobalVariables::JoyAxis::xmlName)) { xml->readNextStartElement(); - while (!xml->atEnd() && (!xml->isEndElement() && (xml->name() != JoyAxis::xmlName))) + + while (!xml->atEnd() && (!xml->isEndElement() && (xml->name() != GlobalVariables::JoyAxis::xmlName))) { bool found = readMainConfig(xml); - if (!found && (xml->name() == JoyAxisButton::xmlName) && xml->isStartElement()) + + if (!found && (xml->name() == GlobalVariables::JoyAxisButton::xmlName) && xml->isStartElement()) { int index = xml->attributes().value("index").toString().toInt(); + GameControllerTriggerButton *triggerButton = nullptr; #ifndef QT_DEBUG_NO_OUTPUT qDebug() << "Index for axis in readJoystickConfig is: " << index; #endif - if (index == 1) - { - found = true; - GameControllerTriggerButton *triggerButton = - qobject_cast(naxisbutton); // static_cast - triggerButton->readJoystickConfig(xml); - } - else if (index == 2) - { - found = true; - GameControllerTriggerButton *triggerButton = - qobject_cast(paxisbutton); // static_cast - triggerButton->readJoystickConfig(xml); + switch (index) { + + case 1: + found = true; + triggerButton = + qobject_cast(naxisbutton); + triggerButton->readJoystickConfig(xml); + break; + + + case 2: + found = true; + triggerButton = + qobject_cast(paxisbutton); + triggerButton->readJoystickConfig(xml); + break; } + } if (!found) @@ -137,6 +144,7 @@ void GameControllerTrigger::readJoystickConfig(QXmlStreamReader *xml) } } + void GameControllerTrigger::correctJoystickThrottle() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -150,6 +158,7 @@ void GameControllerTrigger::correctJoystickThrottle() } } + void GameControllerTrigger::writeConfig(QXmlStreamWriter *xml) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -157,44 +166,48 @@ void GameControllerTrigger::writeConfig(QXmlStreamWriter *xml) bool currentlyDefault = isDefault(); xml->writeStartElement(getXmlName()); - xml->writeAttribute("index", QString::number((index+1)-SDL_CONTROLLER_AXIS_TRIGGERLEFT)); + xml->writeAttribute("index", QString::number((m_index+1)-SDL_CONTROLLER_AXIS_TRIGGERLEFT)); - if (!currentlyDefault) + + if (!currentlyDefault && (deadZone != GlobalVariables::GameControllerTrigger::AXISDEADZONE)) { - if (deadZone != AXISDEADZONE) - { - xml->writeTextElement("deadZone", QString::number(deadZone)); - } + xml->writeTextElement("deadZone", QString::number(deadZone)); + } - if (maxZoneValue != AXISMAXZONE) - { - xml->writeTextElement("maxZone", QString::number(maxZoneValue)); - } + if (!currentlyDefault && (maxZoneValue != GlobalVariables::GameControllerTrigger::AXISMAXZONE)) + { + xml->writeTextElement("maxZone", QString::number(maxZoneValue)); } - xml->writeStartElement("throttle"); - if (throttle == static_cast(JoyAxis::NegativeHalfThrottle)) - { - xml->writeCharacters("negativehalf"); - } - else if (throttle == static_cast(JoyAxis::NegativeThrottle)) - { - xml->writeCharacters("negative"); - } - else if (throttle == static_cast(JoyAxis::NormalThrottle)) - { - xml->writeCharacters("normal"); - } - else if (throttle == static_cast(JoyAxis::PositiveThrottle)) - { - xml->writeCharacters("positive"); - } - else if (throttle == static_cast(JoyAxis::PositiveHalfThrottle)) + xml->writeStartElement("throttle"); + + + switch(throttle) { - xml->writeCharacters("positivehalf"); + case -2: + xml->writeCharacters("negativehalf"); + break; + + case -1: + xml->writeCharacters("negative"); + break; + + case 0: + xml->writeCharacters("normal"); + break; + + case 1: + xml->writeCharacters("positive"); + break; + + case 2: + xml->writeCharacters("positivehalf"); + break; + } + xml->writeEndElement(); if (!currentlyDefault) @@ -207,20 +220,23 @@ void GameControllerTrigger::writeConfig(QXmlStreamWriter *xml) xml->writeEndElement(); } + int GameControllerTrigger::getDefaultDeadZone() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->AXISDEADZONE; + return GlobalVariables::GameControllerTrigger::AXISDEADZONE; } + int GameControllerTrigger::getDefaultMaxZone() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->AXISMAXZONE; + return GlobalVariables::GameControllerTrigger::AXISMAXZONE; } + JoyAxis::ThrottleTypes GameControllerTrigger::getDefaultThrottle() { qInstallMessageHandler(MessageHandler::myMessageOutput); diff --git a/src/gamecontroller/gamecontrollertrigger.h b/src/gamecontroller/gamecontrollertrigger.h old mode 100644 new mode 100755 index 817039a3d..e0b5af9fe --- a/src/gamecontroller/gamecontrollertrigger.h +++ b/src/gamecontroller/gamecontrollertrigger.h @@ -46,12 +46,8 @@ class GameControllerTrigger : public JoyAxis virtual void writeConfig(QXmlStreamWriter *xml); - static const int AXISDEADZONE; - static const int AXISMAXZONE; static const ThrottleTypes DEFAULTTHROTTLE; - static const QString xmlName; - protected: void correctJoystickThrottle(); diff --git a/src/gamecontroller/gamecontrollertriggerbutton.cpp b/src/gamecontroller/gamecontrollertriggerbutton.cpp old mode 100644 new mode 100755 index ed63d22c2..1b5933a01 --- a/src/gamecontroller/gamecontrollertriggerbutton.cpp +++ b/src/gamecontroller/gamecontrollertriggerbutton.cpp @@ -17,6 +17,7 @@ #include "gamecontrollertriggerbutton.h" +#include "globalvariables.h" #include "messagehandler.h" #include "setjoystick.h" #include "joyaxis.h" @@ -25,7 +26,6 @@ #include #include -const QString GameControllerTriggerButton::xmlName = "triggerbutton"; GameControllerTriggerButton::GameControllerTriggerButton(JoyAxis *axis, int index, int originset, SetJoystick *parentSet, QObject *parent) : JoyAxisButton(axis, index, originset, parentSet, parent) @@ -33,24 +33,31 @@ GameControllerTriggerButton::GameControllerTriggerButton(JoyAxis *axis, int inde qInstallMessageHandler(MessageHandler::myMessageOutput); } + QString GameControllerTriggerButton::getXmlName() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->xmlName; + + return GlobalVariables::GameControllerTriggerButton::xmlName; } + void GameControllerTriggerButton::readJoystickConfig(QXmlStreamReader *xml) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (xml->isStartElement() && (xml->name() == JoyAxisButton::xmlName)) + + if (xml->isStartElement() && (xml->name() == GlobalVariables::JoyAxisButton::xmlName)) { - disconnect(this, &GameControllerTriggerButton::slotsChanged, parentSet->getInputDevice(), &InputDevice::profileEdited); + disconnect(this, &GameControllerTriggerButton::slotsChanged, m_parentSet->getInputDevice(), &InputDevice::profileEdited); xml->readNextStartElement(); - while (!xml->atEnd() && (!xml->isEndElement() && xml->name() != JoyAxisButton::xmlName)) + + + while (!xml->atEnd() && (!xml->isEndElement() && (xml->name() != GlobalVariables::JoyAxisButton::xmlName))) { bool found = readButtonConfig(xml); + if (!found) { xml->skipCurrentElement(); @@ -59,6 +66,6 @@ void GameControllerTriggerButton::readJoystickConfig(QXmlStreamReader *xml) xml->readNextStartElement(); } - connect(this, &GameControllerTriggerButton::slotsChanged, parentSet->getInputDevice(), &InputDevice::profileEdited); + connect(this, &GameControllerTriggerButton::slotsChanged, m_parentSet->getInputDevice(), &InputDevice::profileEdited); } } diff --git a/src/gamecontroller/gamecontrollertriggerbutton.h b/src/gamecontroller/gamecontrollertriggerbutton.h old mode 100644 new mode 100755 index 23360fb9a..57bf898fc --- a/src/gamecontroller/gamecontrollertriggerbutton.h +++ b/src/gamecontroller/gamecontrollertriggerbutton.h @@ -36,8 +36,6 @@ class GameControllerTriggerButton : public JoyAxisButton virtual QString getXmlName(); void readJoystickConfig(QXmlStreamReader *xml); - static const QString xmlName; - }; #endif // GAMECONTROLLERBUTTON_H diff --git a/src/gamecontrollerexample.cpp b/src/gamecontrollerexample.cpp old mode 100644 new mode 100755 index a9e327451..98b578dba --- a/src/gamecontrollerexample.cpp +++ b/src/gamecontrollerexample.cpp @@ -87,17 +87,22 @@ void GameControllerExample::paintEvent(QPaintEvent *event) ButtonImagePlacement current = buttonLocations[currentIndex]; paint.setOpacity(0.85); - if (current.buttontype == Button) + + switch(current.buttontype) { + + case Button: paint.drawImage(QRect(current.x, current.y, buttonimage.width(), buttonimage.height()), buttonimage); - } - else if (current.buttontype == AxisX) - { + break; + + case AxisX: paint.drawImage(QRect(current.x, current.y, axisimage.width(), axisimage.height()), axisimage); - } - else if (current.buttontype == AxisY) - { + break; + + case AxisY: paint.drawImage(QRect(current.x, current.y, rotatedaxisimage.width(), rotatedaxisimage.height()), rotatedaxisimage); + break; + } paint.setOpacity(1.0); diff --git a/src/gamecontrollerexample.h b/src/gamecontrollerexample.h old mode 100644 new mode 100755 diff --git a/src/gamecontrollermappingdialog.cpp b/src/gamecontrollermappingdialog.cpp old mode 100644 new mode 100755 index 41087b9ca..6760f7bff --- a/src/gamecontrollermappingdialog.cpp +++ b/src/gamecontrollermappingdialog.cpp @@ -134,6 +134,7 @@ GameControllerMappingDialog::GameControllerMappingDialog(InputDevice *device, QMetaObject::invokeMethod(&helper, "setupDeadZones", Qt::BlockingQueuedConnection); GameController *controller = qobject_cast(device); + if (controller != nullptr) { usingGameController = true; @@ -148,16 +149,13 @@ GameControllerMappingDialog::GameControllerMappingDialog(InputDevice *device, enableDeviceConnections(); ui->buttonMappingTableWidget->setCurrentCell(0, 0); - ui->axisDeadZoneComboBox->clear(); populateAxisDeadZoneComboBox(); currentDeadZoneValue = 20000; int index = ui->axisDeadZoneComboBox->findData(currentDeadZoneValue); - if (index != -1) - { - ui->axisDeadZoneComboBox->setCurrentIndex(index); - } + + if (index != -1) ui->axisDeadZoneComboBox->setCurrentIndex(index); connect(device, &InputDevice::destroyed, this, &GameControllerMappingDialog::obliterate); connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &GameControllerMappingDialog::saveChanges); @@ -181,9 +179,9 @@ void GameControllerMappingDialog::buttonAssign(int buttonindex) qInstallMessageHandler(MessageHandler::myMessageOutput); // Only perform assignment if no other control is currently active. + if (ui->buttonMappingTableWidget->currentRow() > -1) { - QTableWidgetItem* item = ui->buttonMappingTableWidget->currentItem(); int column = ui->buttonMappingTableWidget->currentColumn(); int row = ui->buttonMappingTableWidget->currentRow(); @@ -202,6 +200,7 @@ void GameControllerMappingDialog::buttonAssign(int buttonindex) foreach (const QModelIndex &index, matchlist) { QTableWidgetItem *existingItem = ui->buttonMappingTableWidget->item(index.row(), index.column()); + if (existingItem != nullptr) { existingItem->setText(""); @@ -217,9 +216,7 @@ void GameControllerMappingDialog::buttonAssign(int buttonindex) item->setText(QString("Button %1").arg(buttonindex+1)); if (row < (ui->buttonMappingTableWidget->rowCount() - 1)) - { ui->buttonMappingTableWidget->setCurrentCell(row + 1, column); - } ui->mappingStringPlainTextEdit->document()->setPlainText(generateSDLMappingString()); } @@ -231,13 +228,10 @@ void GameControllerMappingDialog::axisAssign(int axis, int value) bool skip = false; - if (usingGameController) + if (usingGameController && getEventTriggerAxesLocal().contains(axis) && (value < (-currentDeadZoneValue))) { - if (getEventTriggerAxesLocal().contains(axis) && (value < (-currentDeadZoneValue))) - { - skip = true; - getEventTriggerAxesLocal().removeAll(axis); - } + skip = true; + getEventTriggerAxesLocal().removeAll(axis); } if (!skip && (ui->buttonMappingTableWidget->currentRow() > -1)) @@ -246,20 +240,17 @@ void GameControllerMappingDialog::axisAssign(int axis, int value) int column = ui->buttonMappingTableWidget->currentColumn(); int row = ui->buttonMappingTableWidget->currentRow(); - if (usingGameController) - { - if ((value > currentDeadZoneValue) && !getEventTriggerAxesLocal().contains(axis)) - { - getEventTriggerAxesLocal().append(axis); - } - else if (value < currentDeadZoneValue) - { - skip = true; - } - } + if (usingGameController && (value > currentDeadZoneValue) && !getEventTriggerAxesLocal().contains(axis)) + { + getEventTriggerAxesLocal().append(axis); + } + else if (usingGameController && (value < currentDeadZoneValue)) + { + skip = true; + } - if (!skip) - { + if (!skip) + { if (item == nullptr) { item = new QTableWidgetItem(QString("Axis %1").arg(axis+1)); @@ -274,6 +265,7 @@ void GameControllerMappingDialog::axisAssign(int axis, int value) foreach (const QModelIndex &index, matchlist) { QTableWidgetItem *existingItem = ui->buttonMappingTableWidget->item(index.row(), index.column()); + if (existingItem != nullptr) { existingItem->setText(""); @@ -289,13 +281,10 @@ void GameControllerMappingDialog::axisAssign(int axis, int value) item->setText(QString("Axis %1").arg(axis+1)); if (row < (ui->buttonMappingTableWidget->rowCount()-1)) - { ui->buttonMappingTableWidget->setCurrentCell(row+1, column); - } ui->mappingStringPlainTextEdit->document()->setPlainText(generateSDLMappingString()); - } - + } else { skip = true; @@ -327,6 +316,7 @@ void GameControllerMappingDialog::dpadAssign(int dpad, int buttonindex) foreach (const QModelIndex &index, matchlist) { QTableWidgetItem *existingItem = ui->buttonMappingTableWidget->item(index.row(), index.column()); + if (existingItem != nullptr) { existingItem->setText(""); @@ -342,9 +332,7 @@ void GameControllerMappingDialog::dpadAssign(int dpad, int buttonindex) item->setText(QString("Hat %1.%2").arg(dpad+1).arg(buttonindex)); if (row < (ui->buttonMappingTableWidget->rowCount() - 1)) - { ui->buttonMappingTableWidget->setCurrentCell(row + 1, column); - } ui->mappingStringPlainTextEdit->document()->setPlainText(generateSDLMappingString()); } @@ -357,7 +345,6 @@ void GameControllerMappingDialog::saveChanges() QString mappingString = generateSDLMappingString(); settings->getLock()->lock(); - settings->setValue(QString("Mappings/").append(device->getGUIDString()), mappingString); settings->setValue(QString("Mappings/%1%2").arg(device->getGUIDString()).arg("Disable"), "0"); settings->sync(); @@ -410,7 +397,6 @@ void GameControllerMappingDialog::populateGameControllerBindings(GameController for (int i = 0; i < controller->getNumberAxes(); i++) { - int associatedRow = axisPlacement.value(static_cast(i)); SDL_GameControllerButtonBind bind = controller->getBindForAxis(i); QString temptext = bindingString(bind); @@ -437,22 +423,22 @@ QString GameControllerMappingDialog::bindingString(SDL_GameControllerButtonBind QString temp = QString(); - if (bind.bindType != SDL_CONTROLLER_BINDTYPE_NONE) - { - if (bind.bindType == SDL_CONTROLLER_BINDTYPE_BUTTON) + switch(bind.bindType) { - temp.append(QString("Button %1").arg(bind.value.button+1)); - } - else if (bind.bindType == SDL_CONTROLLER_BINDTYPE_AXIS) - { - temp.append(QString("Axis %1").arg(bind.value.axis+1)); - } - else if (bind.bindType == SDL_CONTROLLER_BINDTYPE_HAT) - { - temp.append(QString("Hat %1.%2").arg(bind.value.hat.hat+1) + case SDL_CONTROLLER_BINDTYPE_BUTTON: + temp.append(QString("Button %1").arg(bind.value.button+1)); + break; + + case SDL_CONTROLLER_BINDTYPE_AXIS: + temp.append(QString("Axis %1").arg(bind.value.axis+1)); + break; + + case SDL_CONTROLLER_BINDTYPE_HAT: + temp.append(QString("Hat %1.%2").arg(bind.value.hat.hat+1) .arg(bind.value.hat.hat_mask)); + break; + } - } return temp; } @@ -463,24 +449,24 @@ QList GameControllerMappingDialog::bindingValues(SDL_GameControllerBut QList temp; - if (bind.bindType != SDL_CONTROLLER_BINDTYPE_NONE) - { - if (bind.bindType == SDL_CONTROLLER_BINDTYPE_BUTTON) - { - temp.append(QVariant(0)); - temp.append(QVariant(bind.value.button)); - } - else if (bind.bindType == SDL_CONTROLLER_BINDTYPE_AXIS) + switch(bind.bindType) { - temp.append(QVariant(bind.value.axis+1)); - temp.append(QVariant(0)); + case SDL_CONTROLLER_BINDTYPE_BUTTON: + temp.append(QVariant(0)); + temp.append(QVariant(bind.value.button)); + break; + + case SDL_CONTROLLER_BINDTYPE_AXIS: + temp.append(QVariant(bind.value.axis+1)); + temp.append(QVariant(0)); + break; + + case SDL_CONTROLLER_BINDTYPE_HAT: + temp.append(QVariant(-bind.value.hat.hat-1)); + temp.append(QVariant(bind.value.hat.hat_mask)); + break; } - else if (bind.bindType == SDL_CONTROLLER_BINDTYPE_HAT) - { - temp.append(QVariant(-bind.value.hat.hat-1)); - temp.append(QVariant(bind.value.hat.hat_mask)); - } - } + return temp; } @@ -491,6 +477,7 @@ void GameControllerMappingDialog::discardMapping(QAbstractButton *button) disableDeviceConnections(); QDialogButtonBox::ButtonRole currentRole = ui->buttonBox->buttonRole(button); + if (currentRole == QDialogButtonBox::DestructiveRole) { QMessageBox msgBox; @@ -499,6 +486,7 @@ void GameControllerMappingDialog::discardMapping(QAbstractButton *button) msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel); int status = msgBox.exec(); + if (status == QMessageBox::Yes) { removeControllerMapping(); @@ -577,16 +565,19 @@ QString GameControllerMappingDialog::generateSDLMappingString() templist.append(device->getSDLName()); templist.append(QString("platform:").append(device->getSDLPlatform())); - for (int i=0; i < ui->buttonMappingTableWidget->rowCount(); i++) + for (int i = 0; i < ui->buttonMappingTableWidget->rowCount(); i++) { QTableWidgetItem *item = ui->buttonMappingTableWidget->item(i, 0); + if (item != nullptr) { QString mapNative = QString(); QList tempassociation = item->data(Qt::UserRole).toList(); + if (tempassociation.size() == 2) { int bindingType = tempassociation.value(0).toInt(); + if (bindingType == 0) { mapNative.append("b"); @@ -687,6 +678,7 @@ void GameControllerMappingDialog::changeAxisDeadZone(int index) qInstallMessageHandler(MessageHandler::myMessageOutput); int value = ui->axisDeadZoneComboBox->itemData(index).toInt(); + if ((value >= 5000) && (value <= 32000)) { QMetaObject::invokeMethod(&helper, "raiseDeadZones", Qt::BlockingQueuedConnection, @@ -701,20 +693,21 @@ void GameControllerMappingDialog::updateLastAxisLineEdit(JoyAxis *tempAxis, int if (abs(value) >= 2000) { - QString temp = QString(); + QString axisText = QString(); + if (device->isGameController()) { - GameController *controller = qobject_cast(device); // static_cast - temp = QString("%1: %2").arg(controller->getBindStringForAxis(tempAxis->getIndex(), true)) + GameController *controller = qobject_cast(device); + axisText = QString("%1: %2").arg(controller->getBindStringForAxis(tempAxis->getIndex(), true)) .arg(value); } else { - temp = QString("Axis %1: %2").arg(tempAxis->getRealJoyIndex()) + axisText = QString("Axis %1: %2").arg(tempAxis->getRealJoyIndex()) .arg(value); } - ui->lastAxisEventLineEdit->setText(temp); + ui->lastAxisEventLineEdit->setText(axisText); } } @@ -724,11 +717,10 @@ void GameControllerMappingDialog::updateLastAxisLineEditRaw(int index, int value if (abs(value) >= 2000) { - QString temp = QString(); - temp = QString("Axis %1: %2").arg(index+1) + QString axisText = QString("Axis %1: %2").arg(index+1) .arg(value); - ui->lastAxisEventLineEdit->setText(temp); + ui->lastAxisEventLineEdit->setText(axisText); } } diff --git a/src/gamecontrollermappingdialog.h b/src/gamecontrollermappingdialog.h old mode 100644 new mode 100755 diff --git a/src/gamecontrollermappingdialog.ui b/src/gamecontrollermappingdialog.ui old mode 100644 new mode 100755 diff --git a/src/globalvariables.cpp b/src/globalvariables.cpp new file mode 100644 index 000000000..e7594fa71 --- /dev/null +++ b/src/globalvariables.cpp @@ -0,0 +1,214 @@ + + +#include "globalvariables.h" +#include "common.h" + +#include + + + +// ---- JOYBUTTON --- // + +const QString GlobalVariables::JoyButton::xmlName = "button"; + +// Set default values for many properties. +const int GlobalVariables::JoyButton::ENABLEDTURBODEFAULT = 100; +const double GlobalVariables::JoyButton::DEFAULTMOUSESPEEDMOD = 1.0; +double GlobalVariables::JoyButton::mouseSpeedModifier = GlobalVariables::JoyButton::DEFAULTMOUSESPEEDMOD; +const int GlobalVariables::JoyButton::DEFAULTKEYREPEATDELAY = 600; // 600 ms +const int GlobalVariables::JoyButton::DEFAULTKEYREPEATRATE = 40; // 40 ms. 25 times per second +const bool GlobalVariables::JoyButton::DEFAULTTOGGLE = false; +const int GlobalVariables::JoyButton::DEFAULTTURBOINTERVAL = 0; +const bool GlobalVariables::JoyButton::DEFAULTUSETURBO = false; +const int GlobalVariables::JoyButton::DEFAULTMOUSESPEEDX = 50; +const int GlobalVariables::JoyButton::DEFAULTMOUSESPEEDY = 50; +const int GlobalVariables::JoyButton::DEFAULTSETSELECTION = -1; +const int GlobalVariables::JoyButton::DEFAULTSPRINGWIDTH = 0; +const int GlobalVariables::JoyButton::DEFAULTSPRINGHEIGHT = 0; +const double GlobalVariables::JoyButton::DEFAULTSENSITIVITY = 1.0; +const int GlobalVariables::JoyButton::DEFAULTWHEELX = 20; +const int GlobalVariables::JoyButton::DEFAULTWHEELY = 20; +const bool GlobalVariables::JoyButton::DEFAULTCYCLERESETACTIVE = false; +const int GlobalVariables::JoyButton::DEFAULTCYCLERESET = 0; +const bool GlobalVariables::JoyButton::DEFAULTRELATIVESPRING = false; +const double GlobalVariables::JoyButton::DEFAULTEASINGDURATION = 0.5; +const double GlobalVariables::JoyButton::MINIMUMEASINGDURATION = 0.2; +const double GlobalVariables::JoyButton::MAXIMUMEASINGDURATION = 5.0; +const int GlobalVariables::JoyButton::MINCYCLERESETTIME = 10; +const int GlobalVariables::JoyButton::MAXCYCLERESETTIME = 60000; + +const int GlobalVariables::JoyButton::DEFAULTMOUSEHISTORYSIZE = 10; +const double GlobalVariables::JoyButton::DEFAULTWEIGHTMODIFIER = 0.2; +const int GlobalVariables::JoyButton::MAXIMUMMOUSEHISTORYSIZE = 100; +const double GlobalVariables::JoyButton::MAXIMUMWEIGHTMODIFIER = 1.0; +const int GlobalVariables::JoyButton::MAXIMUMMOUSEREFRESHRATE = 16; +int GlobalVariables::JoyButton::IDLEMOUSEREFRESHRATE = (5 * 20); +const int GlobalVariables::JoyButton::DEFAULTIDLEMOUSEREFRESHRATE = 100; +const double GlobalVariables::JoyButton::DEFAULTEXTRACCELVALUE = 2.0; +const double GlobalVariables::JoyButton::DEFAULTMINACCELTHRESHOLD = 10.0; +const double GlobalVariables::JoyButton::DEFAULTMAXACCELTHRESHOLD = 100.0; +const double GlobalVariables::JoyButton::DEFAULTSTARTACCELMULTIPLIER = 0.0; +const double GlobalVariables::JoyButton::DEFAULTACCELEASINGDURATION = 0.1; +const int GlobalVariables::JoyButton::DEFAULTSPRINGRELEASERADIUS = 0; + +// Keep references to active keys and mouse buttons. +QHash GlobalVariables::JoyButton::activeKeys; +QHash GlobalVariables::JoyButton::activeMouseButtons; + +// History buffers used for mouse smoothing routine. +QList GlobalVariables::JoyButton::mouseHistoryX; +QList GlobalVariables::JoyButton::mouseHistoryY; + +// Carry over remainder of a cursor move for the next mouse event. +double GlobalVariables::JoyButton::cursorRemainderX = 0.0; +double GlobalVariables::JoyButton::cursorRemainderY = 0.0; + +double GlobalVariables::JoyButton::weightModifier = 0; +// Mouse history buffer size +int GlobalVariables::JoyButton::mouseHistorySize = 1; + +int GlobalVariables::JoyButton::mouseRefreshRate = 5; +int GlobalVariables::JoyButton::springModeScreen = -1; +int GlobalVariables::JoyButton::gamepadRefreshRate = 10; + + +// ---- ANTIMICROSETTINGS --- // + +const bool GlobalVariables::AntimicroSettings::defaultDisabledWinEnhanced = false; +const bool GlobalVariables::AntimicroSettings::defaultAssociateProfiles = true; +const int GlobalVariables::AntimicroSettings::defaultSpringScreen = -1; +const int GlobalVariables::AntimicroSettings::defaultSDLGamepadPollRate = 10; // unsigned + +// ---- INPUTDEVICE ---- // + +const int GlobalVariables::InputDevice::NUMBER_JOYSETS = 8; +const int GlobalVariables::InputDevice::DEFAULTKEYPRESSTIME = 100; +const int GlobalVariables::InputDevice::RAISEDDEADZONE = 20000; +const int GlobalVariables::InputDevice::DEFAULTKEYREPEATDELAY = 660; // 660 ms +const int GlobalVariables::InputDevice::DEFAULTKEYREPEATRATE = 40; // 40 ms. 25 times per second + +QRegExp GlobalVariables::InputDevice::emptyGUID("^[0]+$"); + +// ---- JOYAXIS ---- // + +// Set default values for many properties. +const int GlobalVariables::JoyAxis::AXISMIN = -32767; +const int GlobalVariables::JoyAxis::AXISMAX = 32767; +const int GlobalVariables::JoyAxis::AXISDEADZONE = 6000; +const int GlobalVariables::JoyAxis::AXISMAXZONE = 32000; + +// Speed in pixels/second +const float GlobalVariables::JoyAxis::JOYSPEED = 20.0; + +const QString GlobalVariables::JoyAxis::xmlName = "axis"; + + +#if defined(Q_OS_UNIX) + #ifdef WITH_X11 + +// ---- X11EXTRAS ---- // + +const QString GlobalVariables::X11Extras::mouseDeviceName = PadderCommon::mouseDeviceName; +const QString GlobalVariables::X11Extras::keyboardDeviceName = PadderCommon::keyboardDeviceName; +const QString GlobalVariables::X11Extras::xtestMouseDeviceName = QString("Virtual core XTEST pointer"); + +QString GlobalVariables::X11Extras::_customDisplayString = QString(""); + + #endif +#endif + + +// ---- GameController ---- // + +const QString GlobalVariables::GameController::xmlName = "gamecontroller"; + + +// ---- GameControllerDPad ---- // + +const QString GlobalVariables::GameControllerDPad::xmlName = "dpad"; + + +// ---- GameControllerTrigger ---- // + +const int GlobalVariables::GameControllerTrigger::AXISDEADZONE = 2000; +const int GlobalVariables::GameControllerTrigger::AXISMAXZONE = 32000; + +const QString GlobalVariables::GameControllerTrigger::xmlName = "trigger"; + + +// ---- GameControllerTriggerButton ---- // + +const QString GlobalVariables::GameControllerTriggerButton::xmlName = "triggerbutton"; + + +// ---- InputDaemon ---- // + +const int GlobalVariables::InputDaemon::GAMECONTROLLERTRIGGERRELEASE = 16384; + + +// ---- VDPad ---- // + +const QString GlobalVariables::VDPad::xmlName = "vdpad"; + + +// ---- SetJoystick ---- // + +const int GlobalVariables::SetJoystick::MAXNAMELENGTH = 30; +const int GlobalVariables::SetJoystick::RAISEDDEADZONE = 20000; + + +// ---- Joystick ---- // + +const QString GlobalVariables::Joystick::xmlName = "joystick"; + + +// ---- JoyDPad ---- // + +const QString GlobalVariables::JoyDPad::xmlName = "dpad"; +const int GlobalVariables::JoyDPad::DEFAULTDPADDELAY = 0; + + +// ---- JoyControlStick ---- // + +// Define Pi here. +const double GlobalVariables::JoyControlStick::PI = acos(-1.0); + +// Set default values used for stick properties. +const int GlobalVariables::JoyControlStick::DEFAULTDEADZONE = 8000; +const int GlobalVariables::JoyControlStick::DEFAULTMAXZONE = GlobalVariables::GameControllerTrigger::AXISMAXZONE; +const int GlobalVariables::JoyControlStick::DEFAULTDIAGONALRANGE = 90; +const double GlobalVariables::JoyControlStick::DEFAULTCIRCLE = 0.0; +const int GlobalVariables::JoyControlStick::DEFAULTSTICKDELAY = 0; + + +// ---- JoyButtonSlot ---- // + +const int GlobalVariables::JoyButtonSlot::JOYSPEED = 20; +const QString GlobalVariables::JoyButtonSlot::xmlName = "slot"; +const int GlobalVariables::JoyButtonSlot::MAXTEXTENTRYDISPLAYLENGTH = 40; + + + +// ---- AdvanceButtonDialog ---- // + +const int GlobalVariables::AdvanceButtonDialog::MINIMUMTURBO = 2; + + +// ---- JoyAxisButton ---- // + +const QString GlobalVariables::JoyAxisButton::xmlName = "axisbutton"; + + +// ---- JoyControlStickButton ---- // + +const QString GlobalVariables::JoyControlStickButton::xmlName = "stickbutton"; + + +// ---- JoyControlStickModifierButton ---- // + +const QString GlobalVariables::JoyControlStickModifierButton::xmlName = "stickmodifierbutton"; + + +// ---- JoyDPadButton ---- // + +const QString GlobalVariables::JoyDPadButton::xmlName = "dpadbutton"; diff --git a/src/globalvariables.h b/src/globalvariables.h new file mode 100644 index 000000000..bc8782afa --- /dev/null +++ b/src/globalvariables.h @@ -0,0 +1,257 @@ +#ifndef GLOBALVARIABLES_H +#define GLOBALVARIABLES_H + +#include +#include + + +namespace GlobalVariables +{ + class JoyButton + { + public: + + static const QString xmlName; + + static int IDLEMOUSEREFRESHRATE; + static int mouseHistorySize; + // Get active mouse movement refresh rate + static int mouseRefreshRate; + static int springModeScreen; + // gamepad poll rate used by the application in ms + static int gamepadRefreshRate; + + static double cursorRemainderX; + static double cursorRemainderY; + static double mouseSpeedModifier; + // Weight modifier in the range of 0.0 - 1.0 + static double weightModifier; + + static const bool DEFAULTTOGGLE; + static const bool DEFAULTUSETURBO; + static const bool DEFAULTCYCLERESETACTIVE; + static const bool DEFAULTRELATIVESPRING; + + static const double DEFAULTMOUSESPEEDMOD; + static const double DEFAULTSENSITIVITY; + static const double DEFAULTEASINGDURATION; + static const double MINIMUMEASINGDURATION; + static const double MAXIMUMEASINGDURATION; + static const double DEFAULTWEIGHTMODIFIER; + static const double MAXIMUMWEIGHTMODIFIER; + static const double DEFAULTEXTRACCELVALUE; + static const double DEFAULTMINACCELTHRESHOLD; + static const double DEFAULTMAXACCELTHRESHOLD; + static const double DEFAULTSTARTACCELMULTIPLIER; + static const double DEFAULTACCELEASINGDURATION; + + // Define default values for many properties. + static const int ENABLEDTURBODEFAULT; + static const int DEFAULTKEYREPEATDELAY; // unsigned + static const int DEFAULTKEYREPEATRATE; // unsigned + static const int DEFAULTTURBOINTERVAL; + static const int DEFAULTMOUSESPEEDX; + static const int DEFAULTMOUSESPEEDY; + static const int DEFAULTSETSELECTION; + static const int DEFAULTSPRINGWIDTH; + static const int DEFAULTSPRINGHEIGHT; + static const int DEFAULTWHEELX; + static const int DEFAULTWHEELY; + static const int DEFAULTCYCLERESET; + static const int DEFAULTMOUSEHISTORYSIZE; + static const int MAXIMUMMOUSEHISTORYSIZE; + static const int MAXIMUMMOUSEREFRESHRATE; + static const int DEFAULTIDLEMOUSEREFRESHRATE; + static const int MINCYCLERESETTIME; // unsigned + static const int MAXCYCLERESETTIME; // unsigned + static const int DEFAULTSPRINGRELEASERADIUS; + + static QHash activeKeys; // QHash activeMouseButtons; // QHash mouseHistoryX; + static QList mouseHistoryY; + }; + + class AntimicroSettings + { + public: + + static const bool defaultDisabledWinEnhanced; + static const bool defaultAssociateProfiles; + static const int defaultSpringScreen; + static const int defaultSDLGamepadPollRate; // unsigned + }; + + class InputDevice + { + public: + + static const int NUMBER_JOYSETS; + static const int DEFAULTKEYPRESSTIME; + static const int RAISEDDEADZONE; + static const int DEFAULTKEYREPEATDELAY; // unsigned + static const int DEFAULTKEYREPEATRATE; // unsigned + + static QRegExp emptyGUID; + }; + + class JoyAxis + { + public: + + static const int AXISMIN; + static const int AXISMAX; + static const int AXISDEADZONE; + static const int AXISMAXZONE; + + static const float JOYSPEED; + + static const QString xmlName; + }; + +#if defined(Q_OS_UNIX) + #ifdef WITH_X11 + + class X11Extras + { + public: + + static const QString mouseDeviceName; + static const QString keyboardDeviceName; + static const QString xtestMouseDeviceName; + + static QString _customDisplayString; + }; + + #endif +#endif + + class GameController + { + public: + + static const QString xmlName; + }; + + class GameControllerDPad + { + public: + + static const QString xmlName; + }; + + class GameControllerTrigger + { + public: + + static const int AXISDEADZONE; + static const int AXISMAXZONE; + + static const QString xmlName; + }; + + class GameControllerTriggerButton + { + public: + + static const QString xmlName; + }; + + class InputDaemon + { + public: + + static const int GAMECONTROLLERTRIGGERRELEASE; + }; + + class VDPad + { + public: + + static const QString xmlName; + }; + + class SetJoystick + { + public: + + static const int MAXNAMELENGTH; + static const int RAISEDDEADZONE; + }; + + class Joystick + { + public: + + static const QString xmlName; + }; + + class JoyDPad + { + public: + + static const QString xmlName; + static const int DEFAULTDPADDELAY; // unsigned + }; + + class JoyControlStick + { + public: + + static const double PI; + + // Define default values for stick properties. + static const int DEFAULTDEADZONE; + static const int DEFAULTMAXZONE; + static const int DEFAULTDIAGONALRANGE; + static const double DEFAULTCIRCLE; + static const int DEFAULTSTICKDELAY; // unsigned + }; + + class JoyButtonSlot + { + public: + + static const int JOYSPEED; + static const QString xmlName; + static const int MAXTEXTENTRYDISPLAYLENGTH; + }; + + class AdvanceButtonDialog + { + public: + + static const int MINIMUMTURBO; + }; + + class JoyAxisButton + { + public: + + static const QString xmlName; + }; + + class JoyControlStickButton + { + public: + + static const QString xmlName; + }; + + class JoyControlStickModifierButton + { + public: + + static const QString xmlName; + }; + + class JoyDPadButton + { + public: + + static const QString xmlName; + }; + +} + +#endif // GLOBALVARIABLES_H diff --git a/src/icons/16x16/actions/application-exit.png b/src/icons/16x16/actions/application-exit.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/archive-insert.png b/src/icons/16x16/actions/archive-insert.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/dialog-cancel.png b/src/icons/16x16/actions/dialog-cancel.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/dialog-close.png b/src/icons/16x16/actions/dialog-close.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/dialog-ok.png b/src/icons/16x16/actions/dialog-ok.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/document-close.png b/src/icons/16x16/actions/document-close.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/document-open-folder.png b/src/icons/16x16/actions/document-open-folder.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/document-open.png b/src/icons/16x16/actions/document-open.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/document-revert-small.png b/src/icons/16x16/actions/document-revert-small.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/document-revert.png b/src/icons/16x16/actions/document-revert.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/document-save-as.png b/src/icons/16x16/actions/document-save-as.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/document-save.png b/src/icons/16x16/actions/document-save.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/edit-clear-list.png b/src/icons/16x16/actions/edit-clear-list.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/edit-clear.png b/src/icons/16x16/actions/edit-clear.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/edit-delete.png b/src/icons/16x16/actions/edit-delete.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/edit-select.png b/src/icons/16x16/actions/edit-select.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/edit-table-delete-row.png b/src/icons/16x16/actions/edit-table-delete-row.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/edit-table-insert-row-below.png b/src/icons/16x16/actions/edit-table-insert-row-below.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/games-config-custom.png b/src/icons/16x16/actions/games-config-custom.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/games-config-options.png b/src/icons/16x16/actions/games-config-options.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/help-about.png b/src/icons/16x16/actions/help-about.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/text-field.png b/src/icons/16x16/actions/text-field.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/view-fullscreen.png b/src/icons/16x16/actions/view-fullscreen.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/view-refresh.png b/src/icons/16x16/actions/view-refresh.png old mode 100644 new mode 100755 diff --git a/src/icons/16x16/actions/view-restore.png b/src/icons/16x16/actions/view-restore.png old mode 100644 new mode 100755 diff --git a/src/icons/README.txt b/src/icons/README.txt old mode 100644 new mode 100755 diff --git a/src/icons/index.theme b/src/icons/index.theme old mode 100644 new mode 100755 diff --git a/src/icons/lgpl-2.1.txt b/src/icons/lgpl-2.1.txt old mode 100644 new mode 100755 diff --git a/src/icons/lgpl-3.0.txt b/src/icons/lgpl-3.0.txt old mode 100644 new mode 100755 diff --git a/src/images/16x16/antimicro.ico b/src/images/16x16/antimicro.ico new file mode 100755 index 000000000..55aa47a54 Binary files /dev/null and b/src/images/16x16/antimicro.ico differ diff --git a/src/images/16x16/com.github.juliagoda.antimicro.png b/src/images/16x16/com.github.juliagoda.antimicro.png new file mode 100755 index 000000000..e6916f2a7 Binary files /dev/null and b/src/images/16x16/com.github.juliagoda.antimicro.png differ diff --git a/src/images/24x24/antimicro.ico b/src/images/24x24/antimicro.ico new file mode 100755 index 000000000..cba452302 Binary files /dev/null and b/src/images/24x24/antimicro.ico differ diff --git a/src/images/24x24/com.github.juliagoda.antimicro.png b/src/images/24x24/com.github.juliagoda.antimicro.png new file mode 100755 index 000000000..8a522e5dc Binary files /dev/null and b/src/images/24x24/com.github.juliagoda.antimicro.png differ diff --git a/src/images/32x32/antimicro.ico b/src/images/32x32/antimicro.ico new file mode 100755 index 000000000..d6165865d Binary files /dev/null and b/src/images/32x32/antimicro.ico differ diff --git a/src/images/32x32/com.github.juliagoda.antimicro.png b/src/images/32x32/com.github.juliagoda.antimicro.png new file mode 100755 index 000000000..b1e4e5db8 Binary files /dev/null and b/src/images/32x32/com.github.juliagoda.antimicro.png differ diff --git a/src/images/48x48/antimicro.ico b/src/images/48x48/antimicro.ico new file mode 100755 index 000000000..82a5c7184 Binary files /dev/null and b/src/images/48x48/antimicro.ico differ diff --git a/src/images/48x48/com.github.juliagoda.antimicro.png b/src/images/48x48/com.github.juliagoda.antimicro.png new file mode 100755 index 000000000..4cd54d008 Binary files /dev/null and b/src/images/48x48/com.github.juliagoda.antimicro.png differ diff --git a/src/images/64x64/antimicro.ico b/src/images/64x64/antimicro.ico new file mode 100755 index 000000000..c3266cab8 Binary files /dev/null and b/src/images/64x64/antimicro.ico differ diff --git a/src/images/64x64/com.github.juliagoda.antimicro.png b/src/images/64x64/com.github.juliagoda.antimicro.png new file mode 100755 index 000000000..699b24cd4 Binary files /dev/null and b/src/images/64x64/com.github.juliagoda.antimicro.png differ diff --git a/src/images/antimicro_trayicon.png b/src/images/antimicro_trayicon.png old mode 100644 new mode 100755 diff --git a/src/images/axis.png b/src/images/axis.png old mode 100644 new mode 100755 diff --git a/src/images/button.png b/src/images/button.png old mode 100644 new mode 100755 diff --git a/src/images/controllermap.png b/src/images/controllermap.png old mode 100644 new mode 100755 index fd14a5f3f..1318f81bf Binary files a/src/images/controllermap.png and b/src/images/controllermap.png differ diff --git a/src/images/profile.jpg b/src/images/profile.jpg old mode 100644 new mode 100755 diff --git a/src/inputdaemon.cpp b/src/inputdaemon.cpp old mode 100644 new mode 100755 index 92b7583f2..7d6db021f --- a/src/inputdaemon.cpp +++ b/src/inputdaemon.cpp @@ -17,6 +17,7 @@ #include "inputdaemon.h" +#include "globalvariables.h" #include "messagehandler.h" #include "logger.h" #include "common.h" @@ -35,9 +36,6 @@ #define USE_NEW_REFRESH -const int InputDaemon::GAMECONTROLLERTRIGGERRELEASE = 16384; - - InputDaemon::InputDaemon(QMap *joysticks, AntiMicroSettings *settings, bool graphical, QObject *parent) : @@ -46,23 +44,20 @@ InputDaemon::InputDaemon(QMap *joysticks, { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->joysticks = joysticks; + m_joysticks = joysticks; this->stopped = false; - this->graphical = graphical; - this->settings = settings; + m_graphical = graphical; + m_settings = settings; eventWorker = new SDLEventReader(joysticks, settings); refreshJoysticks(); - sdlWorkerThread = nullptr; - if (graphical) + + if (m_graphical) { sdlWorkerThread = new QThread; eventWorker->moveToThread(sdlWorkerThread); - } - if (graphical) - { connect(sdlWorkerThread, &QThread::started, eventWorker, &SDLEventReader::performWork); connect(eventWorker, &SDLEventReader::eventRaised, this, &InputDaemon::run); @@ -78,8 +73,8 @@ InputDaemon::InputDaemon(QMap *joysticks, // poll. pollResetTimer.setSingleShot(true); pollResetTimer.setInterval( - qMax(JoyButton::getMouseRefreshRate(), - JoyButton::getGamepadRefreshRate()) + 1); + qMax(GlobalVariables::JoyButton::mouseRefreshRate, + GlobalVariables::JoyButton::gamepadRefreshRate) + 1); connect(&pollResetTimer, &QTimer::timeout, this, &InputDaemon::resetActiveButtonMouseDistances); @@ -90,10 +85,7 @@ InputDaemon::~InputDaemon() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (eventWorker != nullptr) - { - quit(); - } + if (eventWorker != nullptr) quit(); if (sdlWorkerThread != nullptr) { @@ -109,9 +101,7 @@ void InputDaemon::startWorker() qInstallMessageHandler(MessageHandler::myMessageOutput); if (!sdlWorkerThread->isRunning()) - { sdlWorkerThread->start(QThread::HighPriority); - } } void InputDaemon::run () @@ -125,25 +115,19 @@ void InputDaemon::run () if (!stopped) { - JoyButton::resetActiveButtonMouseDistances(); + JoyButton::resetActiveButtonMouseDistances(JoyButton::getMouseHelper()); QQueue sdlEventQueue; - firstInputPass(&sdlEventQueue); - modifyUnplugEvents(&sdlEventQueue); - secondInputPass(&sdlEventQueue); - clearBitArrayStatusInstances(); } if (stopped) { - if (joysticks->size() > 0) - { - emit complete(joysticks->value(0)); - } + if (m_joysticks->size() > 0) emit complete(m_joysticks->value(0)); + emit complete(); stopped = false; } @@ -160,11 +144,12 @@ void InputDaemon::refreshJoysticks() { qInstallMessageHandler(MessageHandler::myMessageOutput); - QMapIterator iter(*joysticks); + QMapIterator iter(*m_joysticks); while (iter.hasNext()) { InputDevice *joystick = iter.next().value(); + if (joystick != nullptr) { delete joystick; @@ -172,14 +157,14 @@ void InputDaemon::refreshJoysticks() } } - joysticks->clear(); + m_joysticks->clear(); getTrackjoysticksLocal().clear(); trackcontrollers.clear(); - settings->getLock()->lock(); - settings->beginGroup("Mappings"); + m_settings->getLock()->lock(); + m_settings->beginGroup("Mappings"); - for (int i=0; i < SDL_NumJoysticks(); i++) + for (int i = 0; i < SDL_NumJoysticks(); i++) { #ifdef USE_NEW_REFRESH int index = i; @@ -188,29 +173,29 @@ void InputDaemon::refreshJoysticks() if (SDL_IsGameController(index)) { SDL_GameController *controller = SDL_GameControllerOpen(index); + if (controller != nullptr) { SDL_Joystick *sdlStick = SDL_GameControllerGetJoystick(controller); SDL_JoystickID tempJoystickID = SDL_JoystickInstanceID(sdlStick); // Check if device has already been grabbed. - if (!joysticks->contains(tempJoystickID)) + if (!m_joysticks->contains(tempJoystickID)) { - - QString temp = QString(); + QString guidText = QString(); SDL_JoystickGUID tempGUID = SDL_JoystickGetGUID(sdlStick); char guidString[65] = {'0'}; SDL_JoystickGetGUIDString(tempGUID, guidString, sizeof(guidString)); - temp = QString(guidString); + guidText = QString(guidString); - bool disableGameController = settings->value(QString("%1Disable").arg(temp), false).toBool(); + bool disableGameController = m_settings->value(QString("%1Disable").arg(guidText), false).toBool(); // Check if user has designated device Joystick mode. if (!disableGameController) { - GameController *damncontroller = new GameController(controller, index, settings, this); + GameController *damncontroller = new GameController(controller, index, m_settings, this); connect(damncontroller, &GameController::requestWait, eventWorker, &SDLEventReader::haltServices); - joysticks->insert(tempJoystickID, damncontroller); + m_joysticks->insert(tempJoystickID, damncontroller); trackcontrollers.insert(tempJoystickID, damncontroller); emit deviceAdded(damncontroller); @@ -218,27 +203,23 @@ void InputDaemon::refreshJoysticks() else { Joystick *joystick = openJoystickDevice(index); + if (joystick != nullptr) - { emit deviceAdded(joystick); - } - } } else - { - // Make sure to decrement reference count - SDL_GameControllerClose(controller); + { + SDL_GameControllerClose(controller); // Make sure to decrement reference count } } } else { Joystick *joystick = openJoystickDevice(index); + if (joystick != nullptr) - { emit deviceAdded(joystick); - } } @@ -252,45 +233,46 @@ void InputDaemon::refreshJoysticks() SDL_JoystickGetGUIDString(tempGUID, guidString, sizeof(guidString)); temp = QString(guidString); - bool disableGameController = settings->value(QString("%1Disable").arg(temp), false).toBool(); + bool disableGameController = m_settings->value(QString("%1Disable").arg(temp), false).toBool(); if (SDL_IsGameController(i) && !disableGameController) { SDL_GameController *controller = SDL_GameControllerOpen(i); - GameController *damncontroller = new GameController(controller, i, settings, this); + GameController *damncontroller = new GameController(controller, i, m_settings, this); connect(damncontroller, &GameController::requestWait, eventWorker, &SDLEventReader::haltServices); SDL_Joystick *sdlStick = SDL_GameControllerGetJoystick(controller); SDL_JoystickID joystickID = SDL_JoystickInstanceID(sdlStick); - joysticks->insert(joystickID, damncontroller); + m_joysticks->insert(joystickID, damncontroller); trackcontrollers.insert(joystickID, damncontroller); } else { - Joystick *curJoystick = new Joystick(joystick, i, settings, this); + Joystick *curJoystick = new Joystick(joystick, i, m_settings, this); connect(curJoystick, &Joystick::requestWait, eventWorker, &SDLEventReader::haltServices); SDL_JoystickID joystickID = SDL_JoystickInstanceID(joystick); - joysticks->insert(joystickID, curJoystick); + m_joysticks->insert(joystickID, curJoystick); trackjoysticks.insert(joystickID, curJoystick); } } #endif } - settings->endGroup(); - settings->getLock()->unlock(); + m_settings->endGroup(); + m_settings->getLock()->unlock(); - emit joysticksRefreshed(joysticks); + emit joysticksRefreshed(m_joysticks); } void InputDaemon::deleteJoysticks() { qInstallMessageHandler(MessageHandler::myMessageOutput); - QMapIterator iter(*joysticks); + QMapIterator iter(*m_joysticks); while (iter.hasNext()) { InputDevice *joystick = iter.next().value(); + if (joystick != nullptr) { delete joystick; @@ -298,10 +280,9 @@ void InputDaemon::deleteJoysticks() } } - joysticks->clear(); + m_joysticks->clear(); getTrackjoysticksLocal().clear(); trackcontrollers.clear(); - } void InputDaemon::stop() @@ -315,6 +296,7 @@ void InputDaemon::stop() void InputDaemon::refresh() { qInstallMessageHandler(MessageHandler::myMessageOutput); + qDebug() << "REFRESH"; stop(); @@ -324,10 +306,7 @@ void InputDaemon::refresh() connect(eventWorker, &SDLEventReader::sdlStarted, &q, &QEventLoop::quit); QMetaObject::invokeMethod(eventWorker, "refresh", Qt::BlockingQueuedConnection); - if (eventWorker->isSDLOpen()) - { - q.exec(); - } + if (eventWorker->isSDLOpen()) q.exec(); disconnect(eventWorker, &SDLEventReader::sdlStarted, &q, &QEventLoop::quit); @@ -365,7 +344,7 @@ void InputDaemon::quit() // Wait for SDL to finish. Let worker destructor close SDL. // Let InputDaemon destructor close thread instance. - if (graphical) + if (m_graphical) { QMetaObject::invokeMethod(eventWorker, "stop"); QMetaObject::invokeMethod(eventWorker, "quit"); @@ -415,14 +394,14 @@ void InputDaemon::refreshMapping(QString mapping, InputDevice *device) { device->closeSDLDevice(); getTrackjoysticksLocal().remove(joystickID); - joysticks->remove(joystickID); + m_joysticks->remove(joystickID); SDL_GameController *controller = SDL_GameControllerOpen(i); - GameController *damncontroller = new GameController(controller, i, settings, this); + GameController *damncontroller = new GameController(controller, i, m_settings, this); connect(damncontroller, &GameController::requestWait, eventWorker, &SDLEventReader::haltServices); SDL_Joystick *sdlStick = SDL_GameControllerGetJoystick(controller); joystickID = SDL_JoystickInstanceID(sdlStick); - joysticks->insert(joystickID, damncontroller); + m_joysticks->insert(joystickID, damncontroller); trackcontrollers.insert(joystickID, damncontroller); emit deviceUpdated(i, damncontroller); } @@ -442,7 +421,7 @@ void InputDaemon::removeDevice(InputDevice *device) { SDL_JoystickID deviceID = device->getSDLJoystickID(); - joysticks->remove(deviceID); + m_joysticks->remove(deviceID); getTrackjoysticksLocal().remove(deviceID); trackcontrollers.remove(deviceID); @@ -460,14 +439,12 @@ void InputDaemon::refreshIndexes() { SDL_Joystick *joystick = SDL_JoystickOpen(i); SDL_JoystickID joystickID = SDL_JoystickInstanceID(joystick); - // Make sure to decrement reference count - SDL_JoystickClose(joystick); + SDL_JoystickClose(joystick); // Make sure to decrement reference count + InputDevice *tempdevice = m_joysticks->value(joystickID); - InputDevice *tempdevice = joysticks->value(joystickID); if (tempdevice != nullptr) - { tempdevice->setIndex(i); - } + } } @@ -486,10 +463,10 @@ void InputDaemon::addInputDevice(int index) SDL_JoystickID tempJoystickID = SDL_JoystickInstanceID(sdlStick); // Check if device has already been grabbed. - if (!joysticks->contains(tempJoystickID)) + if (!m_joysticks->contains(tempJoystickID)) { - settings->getLock()->lock(); - settings->beginGroup("Mappings"); + m_settings->getLock()->lock(); + m_settings->beginGroup("Mappings"); QString temp = QString(); SDL_JoystickGUID tempGUID = SDL_JoystickGetGUID(sdlStick); @@ -497,17 +474,17 @@ void InputDaemon::addInputDevice(int index) SDL_JoystickGetGUIDString(tempGUID, guidString, sizeof(guidString)); temp = QString(guidString); - bool disableGameController = settings->value(QString("%1Disable").arg(temp), false).toBool(); + bool disableGameController = m_settings->value(QString("%1Disable").arg(temp), false).toBool(); - settings->endGroup(); - settings->getLock()->unlock(); + m_settings->endGroup(); + m_settings->getLock()->unlock(); // Check if user has designated device Joystick mode. if (!disableGameController) { - GameController *damncontroller = new GameController(controller, index, settings, this); + GameController *damncontroller = new GameController(controller, index, m_settings, this); connect(damncontroller, &GameController::requestWait, eventWorker, &SDLEventReader::haltServices); - joysticks->insert(tempJoystickID, damncontroller); + m_joysticks->insert(tempJoystickID, damncontroller); trackcontrollers.insert(tempJoystickID, damncontroller); Logger::LogInfo(QString("New game controller found - #%1 [%2]") @@ -553,14 +530,15 @@ void InputDaemon::addInputDevice(int index) } #else SDL_Joystick *joystick = SDL_JoystickOpen(index); + if (joystick != nullptr) { - SDL_JoystickID tempJoystickID = SDL_JoystickInstanceID(joystick); + SDL_JoystickID tempJoystickID_local = SDL_JoystickInstanceID(joystick); - if (!joysticks->contains(tempJoystickID)) + if (!m_joysticks->contains(tempJoystickID_local)) { - settings->getLock()->lock(); - settings->beginGroup("Mappings"); + m_settings->getLock()->lock(); + m_settings->beginGroup("Mappings"); QString temp = QString(); SDL_JoystickGUID tempGUID = SDL_JoystickGetGUID(joystick); @@ -568,7 +546,7 @@ void InputDaemon::addInputDevice(int index) SDL_JoystickGetGUIDString(tempGUID, guidString, sizeof(guidString)); temp = QString(guidString); - bool disableGameController = settings->value(QString("%1Disable").arg(temp), false).toBool(); + bool disableGameController = m_settings->value(QString("%1Disable").arg(temp), false).toBool(); if (SDL_IsGameController(index) && !disableGameController) { @@ -579,34 +557,35 @@ void InputDaemon::addInputDevice(int index) if (controller != nullptr) { SDL_Joystick *sdlStick = SDL_GameControllerGetJoystick(controller); - SDL_JoystickID tempJoystickID = SDL_JoystickInstanceID(sdlStick); - if (!joysticks->contains(tempJoystickID)) + SDL_JoystickID tempJoystickID_local_2 = SDL_JoystickInstanceID(sdlStick); + + if (!m_joysticks->contains(tempJoystickID_local_2)) { - GameController *damncontroller = new GameController(controller, index, settings, this); + GameController *damncontroller = new GameController(controller, index, m_settings, this); connect(damncontroller, &GameController::requestWait, eventWorker, &SDLEventReader::haltServices); - joysticks->insert(tempJoystickID, damncontroller); - trackcontrollers.insert(tempJoystickID, damncontroller); + m_joysticks->insert(tempJoystickID_local_2, damncontroller); + trackcontrollers.insert(tempJoystickID_local_2, damncontroller); - settings->endGroup(); - settings->getLock()->unlock(); + m_settings->endGroup(); + m_settings->getLock()->unlock(); emit deviceAdded(damncontroller); } } else { - settings->endGroup(); - settings->getLock()->unlock(); + m_settings->endGroup(); + m_settings->getLock()->unlock(); } } else { - Joystick *curJoystick = new Joystick(joystick, index, settings, this); - joysticks->insert(tempJoystickID, curJoystick); - getTrackjoysticksLocal().insert(tempJoystickID, curJoystick); + Joystick *curJoystick = new Joystick(joystick, index, m_settings, this); + m_joysticks->insert(tempJoystickID_local, curJoystick); + getTrackjoysticksLocal().insert(tempJoystickID_local, curJoystick); - settings->endGroup(); - settings->getLock()->unlock(); + m_settings->endGroup(); + m_settings->getLock()->unlock(); emit deviceAdded(curJoystick); } @@ -627,12 +606,13 @@ Joystick *InputDaemon::openJoystickDevice(int index) // Check if joystick is considered connected. SDL_Joystick *joystick = SDL_JoystickOpen(index); Joystick *curJoystick = nullptr; + if (joystick != nullptr) { SDL_JoystickID tempJoystickID = SDL_JoystickInstanceID(joystick); - curJoystick = new Joystick(joystick, index, settings, this); - joysticks->insert(tempJoystickID, curJoystick); + curJoystick = new Joystick(joystick, index, m_settings, this); + m_joysticks->insert(tempJoystickID, curJoystick); getTrackjoysticksLocal().insert(tempJoystickID, curJoystick); } @@ -641,7 +621,6 @@ Joystick *InputDaemon::openJoystickDevice(int index) } - InputDeviceBitArrayStatus* InputDaemon::createOrGrabBitStatusEntry(QHash *statusHash, InputDevice *device, bool readCurrent) @@ -676,7 +655,6 @@ void InputDaemon::firstInputPass(QQueue *sdlEventQueue) case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: { - InputDevice *joy = getTrackjoysticksLocal().value(event.jbutton.which); if (joy != nullptr) @@ -752,13 +730,16 @@ void InputDaemon::firstInputPass(QQueue *sdlEventQueue) case SDL_CONTROLLERAXISMOTION: { InputDevice *joy = trackcontrollers.value(event.caxis.which); + if (joy != nullptr) { SetJoystick* set = joy->getActiveSetJoystick(); JoyAxis *axis = set->getJoyAxis(event.caxis.axis); + if (axis != nullptr) { InputDeviceBitArrayStatus *temp = createOrGrabBitStatusEntry(&releaseEventsGenerated, joy, false); + if ((event.caxis.axis != SDL_CONTROLLER_AXIS_TRIGGERLEFT) && (event.caxis.axis != SDL_CONTROLLER_AXIS_TRIGGERRIGHT)) { @@ -766,7 +747,7 @@ void InputDaemon::firstInputPass(QQueue *sdlEventQueue) } else { - temp->changeAxesStatus(event.caxis.axis, event.caxis.value == GAMECONTROLLERTRIGGERRELEASE); + temp->changeAxesStatus(event.caxis.axis, event.caxis.value == GlobalVariables::InputDaemon::GAMECONTROLLERTRIGGERRELEASE); } InputDeviceBitArrayStatus *pending = createOrGrabBitStatusEntry(&pendingEventValues, joy); @@ -781,6 +762,7 @@ void InputDaemon::firstInputPass(QQueue *sdlEventQueue) case SDL_CONTROLLERBUTTONUP: { InputDevice *joy = trackcontrollers.value(event.cbutton.which); + if (joy != nullptr) { SetJoystick* set = joy->getActiveSetJoystick(); @@ -808,6 +790,10 @@ void InputDaemon::firstInputPass(QQueue *sdlEventQueue) sdlEventQueue->append(event); break; } + default: + { + break; + } } } } @@ -818,6 +804,7 @@ void InputDaemon::modifyUnplugEvents(QQueue *sdlEventQueue) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator genIter(getReleaseEventsGeneratedLocal()); + while (genIter.hasNext()) { genIter.next(); @@ -826,13 +813,13 @@ void InputDaemon::modifyUnplugEvents(QQueue *sdlEventQueue) QBitArray tempBitArray = generatedTemp->generateFinalBitArray(); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "ARRAY: " << tempBitArray; + qDebug() << "ARRAY: " << tempBitArray; #endif int bitArraySize = tempBitArray.size(); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "ARRAY SIZE: " << bitArraySize; + qDebug() << "ARRAY SIZE: " << bitArraySize; #endif if ((bitArraySize > 0) && (tempBitArray.count(true) == device->getNumberAxes())) @@ -848,9 +835,11 @@ void InputDaemon::modifyUnplugEvents(QQueue *sdlEventQueue) (pendingBitArray == unplugBitArray)) { QQueue tempQueue; + while (!sdlEventQueue->isEmpty()) { SDL_Event event = sdlEventQueue->dequeue(); + switch (event.type) { case SDL_JOYBUTTONDOWN: @@ -876,7 +865,7 @@ void InputDaemon::modifyUnplugEvents(QQueue *sdlEventQueue) { if (axis->getThrottle() != static_cast(JoyAxis::NormalThrottle)) { - event.jaxis.value = static_cast(axis->getProperReleaseValue()); + event.jaxis.value = axis->getProperReleaseValue(); } } } @@ -900,16 +889,18 @@ void InputDaemon::modifyUnplugEvents(QQueue *sdlEventQueue) else { InputDevice *joy = trackcontrollers.value(event.caxis.which); + if (joy != nullptr) { SetJoystick* set = joy->getActiveSetJoystick(); JoyAxis *axis = set->getJoyAxis(event.caxis.axis); + if (axis != nullptr) { if ((event.caxis.axis == SDL_CONTROLLER_AXIS_TRIGGERLEFT) || (event.caxis.axis == SDL_CONTROLLER_AXIS_TRIGGERRIGHT)) { - event.caxis.value = static_cast(axis->getProperReleaseValue()); + event.caxis.value = axis->getProperReleaseValue(); } } } @@ -947,7 +938,6 @@ void InputDaemon::modifyUnplugEvents(QQueue *sdlEventQueue) } - QBitArray InputDaemon::createUnplugEventBitArray(InputDevice *device) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -957,10 +947,9 @@ QBitArray InputDaemon::createUnplugEventBitArray(InputDevice *device) for (int i = 0; i < device->getNumberRawAxes(); i++) { JoyAxis *axis = device->getActiveSetJoystick()->getJoyAxis(i); + if ((axis != nullptr) && (axis->getThrottle() != static_cast(JoyAxis::NormalThrottle))) - { tempStatus.changeAxesStatus(i, true); - } } QBitArray unplugBitArray = tempStatus.generateFinalBitArray(); @@ -983,7 +972,6 @@ void InputDaemon::secondInputPass(QQueue *sdlEventQueue) case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: { - InputDevice *joy = getTrackjoysticksLocal().value(event.jbutton.which); if (joy != nullptr) @@ -996,9 +984,7 @@ void InputDaemon::secondInputPass(QQueue *sdlEventQueue) button->queuePendingEvent(event.type == SDL_JOYBUTTONDOWN ? true : false); if (!activeDevices.contains(event.jbutton.which)) - { activeDevices.insert(event.jbutton.which, joy); - } } } else if (trackcontrollers.contains(event.jbutton.which)) @@ -1019,14 +1005,13 @@ void InputDaemon::secondInputPass(QQueue *sdlEventQueue) { SetJoystick* set = joy->getActiveSetJoystick(); JoyAxis *axis = set->getJoyAxis(event.jaxis.axis); + if (axis != nullptr) { axis->queuePendingEvent(event.jaxis.value); if (!activeDevices.contains(event.jaxis.which)) - { activeDevices.insert(event.jaxis.which, joy); - } } joy->rawAxisEvent(event.jaxis.which, event.jaxis.value); @@ -1048,14 +1033,13 @@ void InputDaemon::secondInputPass(QQueue *sdlEventQueue) { SetJoystick* set = joy->getActiveSetJoystick(); JoyDPad *dpad = set->getJoyDPad(event.jhat.hat); + if (dpad != nullptr) { dpad->joyEvent(event.jhat.value); if (!activeDevices.contains(event.jhat.which)) - { activeDevices.insert(event.jhat.which, joy); - } } } else if (trackcontrollers.contains(event.jhat.which)) @@ -1070,20 +1054,21 @@ void InputDaemon::secondInputPass(QQueue *sdlEventQueue) case SDL_CONTROLLERAXISMOTION: { InputDevice *joy = trackcontrollers.value(event.caxis.which); + if (joy != nullptr) { SetJoystick* set = joy->getActiveSetJoystick(); JoyAxis *axis = set->getJoyAxis(event.caxis.axis); + if (axis != nullptr) { axis->queuePendingEvent(event.caxis.value); if (!activeDevices.contains(event.caxis.which)) - { activeDevices.insert(event.caxis.which, joy); - } } } + break; } @@ -1091,6 +1076,7 @@ void InputDaemon::secondInputPass(QQueue *sdlEventQueue) case SDL_CONTROLLERBUTTONUP: { InputDevice *joy = trackcontrollers.value(event.cbutton.which); + if (joy != nullptr) { SetJoystick* set = joy->getActiveSetJoystick(); @@ -1101,9 +1087,7 @@ void InputDaemon::secondInputPass(QQueue *sdlEventQueue) button->queuePendingEvent(event.type == SDL_CONTROLLERBUTTONDOWN ? true : false); if (!activeDevices.contains(event.cbutton.which)) - { activeDevices.insert(event.cbutton.which, joy); - } } } @@ -1112,7 +1096,8 @@ void InputDaemon::secondInputPass(QQueue *sdlEventQueue) case SDL_JOYDEVICEREMOVED: { - InputDevice *device = joysticks->value(event.jdevice.which); + InputDevice *device = m_joysticks->value(event.jdevice.which); + if (device != nullptr) { Logger::LogInfo(QString("Removing joystick #%1 [%2]") @@ -1143,6 +1128,7 @@ void InputDaemon::secondInputPass(QQueue *sdlEventQueue) // Active possible queued events. QHashIterator activeDevIter(activeDevices); + while (activeDevIter.hasNext()) { InputDevice *tempDevice = activeDevIter.next().value(); @@ -1153,11 +1139,8 @@ void InputDaemon::secondInputPass(QQueue *sdlEventQueue) tempDevice->activatePossibleButtonEvents(); } - if (JoyButton::shouldInvokeMouseEvents()) - { - // Do not wait for next event loop run. Execute immediately. - JoyButton::invokeMouseEvents(); - } + if (JoyButton::shouldInvokeMouseEvents(JoyButton::getPendingMouseButtons(), JoyButton::getStaticMouseEventTimer(), JoyButton::getTestOldMouseTime())) + JoyButton::invokeMouseEvents(JoyButton::getMouseHelper()); // Do not wait for next event loop run. Execute immediately. } } @@ -1166,9 +1149,11 @@ void InputDaemon::clearBitArrayStatusInstances() qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator genIter(getReleaseEventsGeneratedLocal()); + while (genIter.hasNext()) { InputDeviceBitArrayStatus *temp = genIter.next().value(); + if (temp != nullptr) { delete temp; @@ -1179,9 +1164,11 @@ void InputDaemon::clearBitArrayStatusInstances() getReleaseEventsGeneratedLocal().clear(); QHashIterator pendIter(getPendingEventValuesLocal()); + while (pendIter.hasNext()) { InputDeviceBitArrayStatus *temp = pendIter.next().value(); + if (temp != nullptr) { delete temp; @@ -1198,7 +1185,7 @@ void InputDaemon::resetActiveButtonMouseDistances() pollResetTimer.stop(); - JoyButton::resetActiveButtonMouseDistances(); + JoyButton::resetActiveButtonMouseDistances(JoyButton::getMouseHelper()); } void InputDaemon::updatePollResetRate(int tempPollRate) @@ -1207,18 +1194,13 @@ void InputDaemon::updatePollResetRate(int tempPollRate) Q_UNUSED(tempPollRate); - bool wasActive = pollResetTimer.isActive(); pollResetTimer.stop(); - pollResetTimer.setInterval( - qMax(JoyButton::getMouseRefreshRate(), - JoyButton::getGamepadRefreshRate()) + 1); + qMax(GlobalVariables::JoyButton::mouseRefreshRate, + GlobalVariables::JoyButton::gamepadRefreshRate) + 1); - if (wasActive) - { - pollResetTimer.start(); - } + if (wasActive) pollResetTimer.start(); } QHash& InputDaemon::getTrackjoysticksLocal() { diff --git a/src/inputdaemon.h b/src/inputdaemon.h old mode 100644 new mode 100755 index 9ca82f0ea..031ded439 --- a/src/inputdaemon.h +++ b/src/inputdaemon.h @@ -57,8 +57,6 @@ class InputDaemon : public QObject void clearBitArrayStatusInstances(); - static const int GAMECONTROLLERTRIGGERRELEASE; - signals: void joystickRefreshed (InputDevice *joystick); void joysticksRefreshed(QMap *joysticks); @@ -93,7 +91,7 @@ private slots: QHash& getReleaseEventsGeneratedLocal(); QHash& getPendingEventValuesLocal(); - QMap *joysticks; + QMap *m_joysticks; QHash trackjoysticks; QHash trackcontrollers; @@ -101,11 +99,11 @@ private slots: QHash pendingEventValues; bool stopped; - bool graphical; + bool m_graphical; SDLEventReader *eventWorker; QThread *sdlWorkerThread; - AntiMicroSettings *settings; + AntiMicroSettings *m_settings; QTimer pollResetTimer; }; diff --git a/src/inputdevice.cpp b/src/inputdevice.cpp old mode 100644 new mode 100755 index a0750500b..7feeb25d8 --- a/src/inputdevice.cpp +++ b/src/inputdevice.cpp @@ -17,6 +17,7 @@ #include "inputdevice.h" +#include "globalvariables.h" #include "messagehandler.h" #include "common.h" #include "antimicrosettings.h" @@ -33,14 +34,6 @@ #include -const int InputDevice::NUMBER_JOYSETS = 8; -const int InputDevice::DEFAULTKEYPRESSTIME = 100; -const int InputDevice::DEFAULTKEYREPEATDELAY = 660; // 660 ms -const int InputDevice::DEFAULTKEYREPEATRATE = 40; // 40 ms. 25 times per second -const int InputDevice::RAISEDDEADZONE = 20000; - -QRegExp InputDevice::emptyGUID("^[0]+$"); - InputDevice::InputDevice(int deviceIndex, AntiMicroSettings *settings, QObject *parent) : QObject(parent) { @@ -60,8 +53,8 @@ InputDevice::InputDevice(int deviceIndex, AntiMicroSettings *settings, QObject * keyRepeatDelay = 0; keyRepeatRate = 0; - rawAxisDeadZone = RAISEDDEADZONE; - this->settings = settings; + rawAxisDeadZone = GlobalVariables::InputDevice::RAISEDDEADZONE; + m_settings = settings; } InputDevice::~InputDevice() @@ -69,9 +62,11 @@ InputDevice::~InputDevice() qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getJoystick_sets()); + while (iter.hasNext()) { SetJoystick *setjoystick = iter.next().value(); + if (setjoystick != nullptr) { delete setjoystick; @@ -105,7 +100,7 @@ void InputDevice::reset() deviceEdited = false; profileName = ""; - for (int i = 0; i < NUMBER_JOYSETS; i++) + for (int i = 0; i < GlobalVariables::InputDevice::NUMBER_JOYSETS; i++) { SetJoystick* set = getJoystick_sets().value(i); set->reset(); @@ -149,6 +144,7 @@ void InputDevice::reInitButtons() qInstallMessageHandler(MessageHandler::myMessageOutput); SetJoystick *current_set = getJoystick_sets().value(active_set); + for (int i = 0; i < current_set->getNumberButtons(); i++) { bool value = getButtonstatesLocal().at(i); @@ -185,7 +181,7 @@ void InputDevice::setActiveSetNumber(int index) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (((index >= 0) && (index < NUMBER_JOYSETS)) && (index != active_set)) + if (((index >= 0) && (index < GlobalVariables::InputDevice::NUMBER_JOYSETS)) && (index != active_set)) { QList buttonstates; QList axesstates; @@ -214,6 +210,7 @@ void InputDevice::setActiveSetNumber(int index) tempSet->getJoyAxis(i)->copyRawValues(axis); tempSet->getJoyAxis(i)->copyThrottledValues(axis); JoyAxisButton *button = tempSet->getJoyAxis(i)->getAxisButtonByValue(axis->getCurrentRawValue()); + if (button != nullptr) { button->setUpdateInitAccel(false); @@ -256,7 +253,7 @@ void InputDevice::setActiveSetNumber(int index) // Activate all buttons in the switched set current_set = getJoystick_sets().value(active_set); - for (int i=0; i < current_set->getNumberSticks(); i++) + for (int i = 0; i < current_set->getNumberSticks(); i++) { JoyControlStick::JoyStickDirections value = stickstates.at(i); QList buttonList; @@ -370,7 +367,6 @@ void InputDevice::setActiveSetNumber(int index) oldButtonList.append(old_set->getVDPad(i)->getJoyButton(JoyDPadButton::DpadRight)); break; } - case JoyDPadButton::DpadRightDown: { buttonList.append(dpad->getJoyButton(JoyDPadButton::DpadRight)); @@ -409,10 +405,12 @@ void InputDevice::setActiveSetNumber(int index) } QHashIterator iter(*dpad->getJoyButtons()); + while (iter.hasNext()) { // Ensure that set change events are performed if needed. JoyDPadButton *button = iter.next().value(); + if (!buttonList.contains(button)) { button->setWhileHeldStatus(false); @@ -424,30 +422,19 @@ void InputDevice::setActiveSetNumber(int index) JoyDPadButton *button = buttonList.at(j); JoyDPadButton *oldButton = oldButtonList.at(j); - if ((button != nullptr) && (oldButton != nullptr)) + if ((button != nullptr) && (oldButton != nullptr) && (button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) + && valueTrue && (oldButton->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) && oldButton->getWhileHeldStatus()) { - if (button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) - { - if (valueTrue) - { - if ((oldButton->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) && oldButton->getWhileHeldStatus()) - { - // Button from old set involved in a while held set - // change. Carry over to new set button to ensure - // set changes are done in the proper order. - button->setWhileHeldStatus(true); - } - else if (!button->getWhileHeldStatus()) - { - // Ensure that set change events are performed if needed. - //tempignore = false; - } - } - else - { - button->setWhileHeldStatus(false); - } - } + // Button from old set involved in a while held set + // change. Carry over to new set button to ensure + // set changes are done in the proper order. + + button->setWhileHeldStatus(true); + } + else if ((button != nullptr) && (oldButton != nullptr) && (button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) + && !valueTrue) + { + button->setWhileHeldStatus(false); } } } @@ -458,28 +445,24 @@ void InputDevice::setActiveSetNumber(int index) bool tempignore = false; JoyButton *button = current_set->getJoyButton(i); JoyButton *oldButton = old_set->getJoyButton(i); - if (button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) + + if (button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld && value && (oldButton->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) && oldButton->getWhileHeldStatus()) { - if (value) - { - if ((oldButton->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) && oldButton->getWhileHeldStatus()) - { - // Button from old set involved in a while held set - // change. Carry over to new set button to ensure - // set changes are done in the proper order. - button->setWhileHeldStatus(true); - } - else if (!button->getWhileHeldStatus()) - { - // Ensure that set change events are performed if needed. - tempignore = false; - } - } - else - { - // Ensure that set change events are performed if needed. - button->setWhileHeldStatus(false); - } + // Button from old set involved in a while held set + // change. Carry over to new set button to ensure + // set changes are done in the proper order. + + button->setWhileHeldStatus(true); + } + else if (button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld && value && !button->getWhileHeldStatus()) + { + // Ensure that set change events are performed if needed. + tempignore = false; + } + else if (button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld && !value) + { + // Ensure that set change events are performed if needed. + button->setWhileHeldStatus(false); } button->queuePendingEvent(value, tempignore); @@ -494,23 +477,20 @@ void InputDevice::setActiveSetNumber(int index) JoyAxisButton *oldButton = old_set->getJoyAxis(i)->getAxisButtonByValue(value); JoyAxisButton *button = axis->getAxisButtonByValue(value); - if ((button != nullptr) && (oldButton != nullptr)) + if ((button != nullptr) && (oldButton != nullptr) && (button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) && + (oldButton->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) && oldButton->getWhileHeldStatus()) { - if (button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) - { - if ((oldButton->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) && oldButton->getWhileHeldStatus()) - { - // Button from old set involved in a while held set - // change. Carry over to new set button to ensure - // set changes are done in the proper order. - button->setWhileHeldStatus(true); - } - else if (!button->getWhileHeldStatus()) - { - // Ensure that set change events are performed if needed. - tempignore = false; - } - } + // Button from old set involved in a while held set + // change. Carry over to new set button to ensure + // set changes are done in the proper order. + + button->setWhileHeldStatus(true); + } + else if ((button != nullptr) && (oldButton != nullptr) && (button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) && + !button->getWhileHeldStatus()) + { + // Ensure that set change events are performed if needed. + tempignore = false; } else if (button == nullptr) { @@ -544,7 +524,6 @@ void InputDevice::setActiveSetNumber(int index) oldButtonList.append(old_set->getJoyDPad(i)->getJoyButton(JoyDPadButton::DpadRight)); break; } - case JoyDPadButton::DpadRightDown: { buttonList.append(dpad->getJoyButton(JoyDPadButton::DpadRight)); @@ -583,14 +562,14 @@ void InputDevice::setActiveSetNumber(int index) } QHashIterator iter(*dpad->getJoyButtons()); + while (iter.hasNext()) { // Ensure that set change events are performed if needed. JoyDPadButton *button = iter.next().value(); + if (!buttonList.contains(button)) - { button->setWhileHeldStatus(false); - } } for (int j = 0; j < buttonList.size(); j++) @@ -598,31 +577,25 @@ void InputDevice::setActiveSetNumber(int index) JoyDPadButton *button = buttonList.at(j); JoyDPadButton *oldButton = oldButtonList.at(j); - if ((button != nullptr) && (oldButton != nullptr)) + if ((button != nullptr) && (oldButton != nullptr) && (button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) + && valueTrue && (oldButton->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) && oldButton->getWhileHeldStatus()) { - if (button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) - { - if (valueTrue) - { - if ((oldButton->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) && oldButton->getWhileHeldStatus()) - { - // Button from old set involved in a while held set - // change. Carry over to new set button to ensure - // set changes are done in the proper order. - button->setWhileHeldStatus(true); - } - else if (!button->getWhileHeldStatus()) - { - // Ensure that set change events are performed if needed. - tempignore = false; - } - } - else - { - button->setWhileHeldStatus(false); - } + // Button from old set involved in a while held set + // change. Carry over to new set button to ensure + // set changes are done in the proper order. - } + button->setWhileHeldStatus(true); + } + else if ((button != nullptr) && (oldButton != nullptr) && (button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) + && valueTrue && !button->getWhileHeldStatus()) + { + // Ensure that set change events are performed if needed. + tempignore = false; + } + else if ((button != nullptr) && (oldButton != nullptr) && (button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) + && !valueTrue) + { + button->setWhileHeldStatus(false); } } @@ -717,8 +690,8 @@ void InputDevice::readConfig(QXmlStreamReader *xml) if (xml->isStartElement() && (xml->name() == getXmlName())) { transferReset(); - xml->readNextStartElement(); + while (!xml->atEnd() && (!xml->isEndElement() && (xml->name() != getXmlName()))) { if ((xml->name() == "sets") && xml->isStartElement()) @@ -731,10 +704,9 @@ void InputDevice::readConfig(QXmlStreamReader *xml) { int index = xml->attributes().value("index").toString().toInt(); index = index - 1; + if ((index >= 0) && (index < getJoystick_sets().size())) - { getJoystick_sets().value(index)->readConfig(xml); - } } else { @@ -762,6 +734,7 @@ void InputDevice::readConfig(QXmlStreamReader *xml) SetJoystick *currentset = getJoystick_sets().value(i); JoyAxis *axis1 = currentset->getJoyAxis(xAxis); JoyAxis *axis2 = currentset->getJoyAxis(yAxis); + if ((axis1 != nullptr) && (axis2 != nullptr)) { JoyControlStick *stick = new JoyControlStick(axis1, axis2, stickIndex, i, this); @@ -784,7 +757,8 @@ void InputDevice::readConfig(QXmlStreamReader *xml) for (int i = 0; i < getJoystick_sets().size(); i++) { SetJoystick *currentset = getJoystick_sets().value(i); - VDPad *vdpad = currentset->getVDPad(vdpadIndex-1); + VDPad *vdpad = currentset->getVDPad(vdpadIndex - 1); + if (vdpad == nullptr) { vdpad = new VDPad(vdpadIndex-1, i, currentset, currentset); @@ -793,6 +767,7 @@ void InputDevice::readConfig(QXmlStreamReader *xml) } xml->readNextStartElement(); + while (!xml->atEnd() && (!xml->isEndElement() && (xml->name() != "vdpadButtonAssociations"))) { if ((xml->name() == "vdpadButtonAssociation") && xml->isStartElement()) @@ -804,29 +779,25 @@ void InputDevice::readConfig(QXmlStreamReader *xml) if ((vdpadAxisIndex > 0) && (vdpadDirection > 0)) { vdpadAxisIndex -= 1; - for (int i=0; i < getJoystick_sets().size(); i++) + + for (int i = 0; i < getJoystick_sets().size(); i++) { SetJoystick *currentset = getJoystick_sets().value(i); - VDPad *vdpad = currentset->getVDPad(vdpadIndex-1); + VDPad *vdpad = currentset->getVDPad(vdpadIndex - 1); + if (vdpad != nullptr) { JoyAxis *axis = currentset->getJoyAxis(vdpadAxisIndex); + if (axis != nullptr) { JoyButton *button = nullptr; - if (vdpadButtonIndex == 0) - { - button = axis->getNAxisButton(); - } - else if (vdpadButtonIndex == 1) - { - button = axis->getPAxisButton(); - } + + if (vdpadButtonIndex == 0) button = axis->getNAxisButton(); + else if (vdpadButtonIndex == 1) button = axis->getPAxisButton(); if (button != nullptr) - { vdpad->addVButton(static_cast(vdpadDirection), button); - } } } } @@ -838,14 +809,14 @@ void InputDevice::readConfig(QXmlStreamReader *xml) for (int i = 0; i < getJoystick_sets().size(); i++) { SetJoystick *currentset = getJoystick_sets().value(i); - VDPad *vdpad = currentset->getVDPad(vdpadIndex-1); + VDPad *vdpad = currentset->getVDPad(vdpadIndex - 1); + if (vdpad != nullptr) { JoyButton *button = currentset->getJoyButton(vdpadButtonIndex); + if (button != nullptr) - { vdpad->addVButton(static_cast(vdpadDirection), button); - } } } } @@ -860,22 +831,23 @@ void InputDevice::readConfig(QXmlStreamReader *xml) } } - for (int i=0; i < getJoystick_sets().size(); i++) + for (int i = 0; i < getJoystick_sets().size(); i++) { SetJoystick *currentset = getJoystick_sets().value(i); - for (int j=0; j < currentset->getNumberVDPads(); j++) + + for (int j = 0; j < currentset->getNumberVDPads(); j++) { VDPad *vdpad = currentset->getVDPad(j); + if ((vdpad != nullptr) && vdpad->isEmpty()) - { currentset->removeVDPad(j); - } } } } else if ((xml->name() == "names") && xml->isStartElement()) { xml->readNextStartElement(); + while (!xml->atEnd() && (!xml->isEndElement() && (xml->name() != "names"))) { if ((xml->name() == "buttonname") && xml->isStartElement()) @@ -883,6 +855,7 @@ void InputDevice::readConfig(QXmlStreamReader *xml) int index = xml->attributes().value("index").toString().toInt(); QString temp = xml->readElementText(); index = index - 1; + if ((index >= 0) && !temp.isEmpty()) { setButtonName(index, temp); @@ -895,6 +868,7 @@ void InputDevice::readConfig(QXmlStreamReader *xml) QString temp = xml->readElementText(); index = index - 1; buttonIndex = buttonIndex - 1; + if ((index >= 0) && !temp.isEmpty()) { setAxisButtonName(index, buttonIndex, temp); @@ -906,6 +880,7 @@ void InputDevice::readConfig(QXmlStreamReader *xml) int buttonIndex = xml->attributes().value("button").toString().toInt(); QString temp = xml->readElementText(); index = index - 1; + if ((index >= 0) && !temp.isEmpty()) { setStickButtonName(index, buttonIndex, temp); @@ -917,6 +892,7 @@ void InputDevice::readConfig(QXmlStreamReader *xml) int buttonIndex = xml->attributes().value("button").toString().toInt(); QString temp = xml->readElementText(); index = index - 1; + if ((index >= 0) && !temp.isEmpty()) { setDPadButtonName(index, buttonIndex, temp); @@ -928,6 +904,7 @@ void InputDevice::readConfig(QXmlStreamReader *xml) int buttonIndex = xml->attributes().value("button").toString().toInt(); QString temp = xml->readElementText(); index = index - 1; + if ((index >= 0) && !temp.isEmpty()) { setVDPadButtonName(index, buttonIndex, temp); @@ -938,6 +915,7 @@ void InputDevice::readConfig(QXmlStreamReader *xml) int index = xml->attributes().value("index").toString().toInt(); QString temp = xml->readElementText(); index = index - 1; + if ((index >= 0) && !temp.isEmpty()) { setAxisName(index, temp); @@ -948,6 +926,7 @@ void InputDevice::readConfig(QXmlStreamReader *xml) int index = xml->attributes().value("index").toString().toInt(); QString temp = xml->readElementText(); index = index - 1; + if ((index >= 0) && !temp.isEmpty()) { setStickName(index, temp); @@ -958,6 +937,7 @@ void InputDevice::readConfig(QXmlStreamReader *xml) int index = xml->attributes().value("index").toString().toInt(); QString temp = xml->readElementText(); index = index - 1; + if ((index >= 0) && !temp.isEmpty()) { setDPadName(index, temp); @@ -968,6 +948,7 @@ void InputDevice::readConfig(QXmlStreamReader *xml) int index = xml->attributes().value("index").toString().toInt(); QString temp = xml->readElementText(); index = index - 1; + if ((index >= 0) && !temp.isEmpty()) { setVDPadName(index, temp); @@ -984,8 +965,8 @@ void InputDevice::readConfig(QXmlStreamReader *xml) } else if ((xml->name() == "keyPressTime") && xml->isStartElement()) { - QString temptext = xml->readElementText(); - int tempchoice = temptext.toInt(); + int tempchoice = xml->readElementText().toInt(); + if (tempchoice >= 10) { this->setDeviceKeyPressTime(tempchoice); @@ -993,8 +974,7 @@ void InputDevice::readConfig(QXmlStreamReader *xml) } else if ((xml->name() == "profilename") && xml->isStartElement()) { - QString temptext = xml->readElementText(); - this->setProfileName(temptext); + this->setProfileName(xml->readElementText()); } else { @@ -1023,13 +1003,12 @@ void InputDevice::writeConfig(QXmlStreamWriter *xml) xml->writeTextElement("guid", getGUIDString()); if (!profileName.isEmpty()) - { xml->writeTextElement("profilename", profileName); - } - for (int i=0; i < getNumberSticks(); i++) + for (int i = 0; i < getNumberSticks(); i++) { JoyControlStick *stick = getActiveSetJoystick()->getJoyStick(i); + xml->writeStartElement("stickAxisAssociation"); xml->writeAttribute("index", QString::number(stick->getRealJoyIndex())); xml->writeAttribute("xAxis", QString::number(stick->getAxisX()->getRealJoyIndex())); @@ -1037,20 +1016,20 @@ void InputDevice::writeConfig(QXmlStreamWriter *xml) xml->writeEndElement(); } - for (int i=0; i < getNumberVDPads(); i++) + for (int i = 0; i < getNumberVDPads(); i++) { VDPad *vdpad = getActiveSetJoystick()->getVDPad(i); xml->writeStartElement("vdpadButtonAssociations"); xml->writeAttribute("index", QString::number(vdpad->getRealJoyNumber())); - JoyButton *button = vdpad->getVButton(JoyDPadButton::DpadUp); + if (button != nullptr) { xml->writeStartElement("vdpadButtonAssociation"); if (typeid(*button) == typeid(JoyAxisButton)) { - JoyAxisButton *axisbutton = qobject_cast(button); // static_cast + JoyAxisButton *axisbutton = qobject_cast(button); xml->writeAttribute("axis", QString::number(axisbutton->getAxis()->getRealJoyIndex())); xml->writeAttribute("button", QString::number(button->getJoyNumber())); } @@ -1065,13 +1044,14 @@ void InputDevice::writeConfig(QXmlStreamWriter *xml) } button = vdpad->getVButton(JoyDPadButton::DpadDown); + if (button != nullptr) { xml->writeStartElement("vdpadButtonAssociation"); if (typeid(*button) == typeid(JoyAxisButton)) { - JoyAxisButton *axisbutton = qobject_cast(button); // static_cast + JoyAxisButton *axisbutton = qobject_cast(button); xml->writeAttribute("axis", QString::number(axisbutton->getAxis()->getRealJoyIndex())); xml->writeAttribute("button", QString::number(button->getJoyNumber())); } @@ -1086,13 +1066,14 @@ void InputDevice::writeConfig(QXmlStreamWriter *xml) } button = vdpad->getVButton(JoyDPadButton::DpadLeft); + if (button != nullptr) { xml->writeStartElement("vdpadButtonAssociation"); if (typeid(*button) == typeid(JoyAxisButton)) { - JoyAxisButton *axisbutton = qobject_cast(button); // static_cast + JoyAxisButton *axisbutton = qobject_cast(button); xml->writeAttribute("axis", QString::number(axisbutton->getAxis()->getRealJoyIndex())); xml->writeAttribute("button", QString::number(button->getJoyNumber())); } @@ -1107,13 +1088,14 @@ void InputDevice::writeConfig(QXmlStreamWriter *xml) } button = vdpad->getVButton(JoyDPadButton::DpadRight); + if (button != nullptr) { xml->writeStartElement("vdpadButtonAssociation"); if (typeid(*button) == typeid(JoyAxisButton)) { - JoyAxisButton *axisbutton = qobject_cast(button); // static_cast + JoyAxisButton *axisbutton = qobject_cast(button); xml->writeAttribute("axis", QString::number(axisbutton->getAxis()->getRealJoyIndex())); xml->writeAttribute("button", QString::number(button->getJoyNumber())); } @@ -1131,14 +1113,16 @@ void InputDevice::writeConfig(QXmlStreamWriter *xml) } bool tempHasNames = elementsHaveNames(); + if (tempHasNames) { xml->writeStartElement("names"); // - SetJoystick *tempSet = getActiveSetJoystick(); - for (int i=0; i < getNumberButtons(); i++) + + for (int i = 0; i < getNumberButtons(); i++) { JoyButton *button = tempSet->getJoyButton(i); + if ((button != nullptr) && !button->getButtonName().isEmpty()) { xml->writeStartElement("buttonname"); @@ -1148,9 +1132,10 @@ void InputDevice::writeConfig(QXmlStreamWriter *xml) } } - for (int i=0; i < getNumberAxes(); i++) + for (int i = 0; i < getNumberAxes(); i++) { JoyAxis *axis = tempSet->getJoyAxis(i); + if (axis != nullptr) { if (!axis->getAxisName().isEmpty()) @@ -1162,6 +1147,7 @@ void InputDevice::writeConfig(QXmlStreamWriter *xml) } JoyAxisButton *naxisbutton = axis->getNAxisButton(); + if (!naxisbutton->getButtonName().isEmpty()) { xml->writeStartElement("axisbuttonname"); @@ -1172,6 +1158,7 @@ void InputDevice::writeConfig(QXmlStreamWriter *xml) } JoyAxisButton *paxisbutton = axis->getPAxisButton(); + if (!paxisbutton->getButtonName().isEmpty()) { xml->writeStartElement("axisbuttonname"); @@ -1183,9 +1170,10 @@ void InputDevice::writeConfig(QXmlStreamWriter *xml) } } - for (int i=0; i < getNumberSticks(); i++) + for (int i = 0; i < getNumberSticks(); i++) { JoyControlStick *stick = tempSet->getJoyStick(i); + if (stick != nullptr) { if (!stick->getStickName().isEmpty()) @@ -1198,9 +1186,11 @@ void InputDevice::writeConfig(QXmlStreamWriter *xml) QHash *buttons = stick->getButtons(); QHashIterator iter(*buttons); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); + if (button && !button->getButtonName().isEmpty()) { xml->writeStartElement("controlstickbuttonname"); @@ -1213,9 +1203,10 @@ void InputDevice::writeConfig(QXmlStreamWriter *xml) } } - for (int i=0; i < getNumberHats(); i++) + for (int i = 0; i < getNumberHats(); i++) { JoyDPad *dpad = tempSet->getJoyDPad(i); + if (dpad != nullptr) { if (!dpad->getDpadName().isEmpty()) @@ -1228,9 +1219,11 @@ void InputDevice::writeConfig(QXmlStreamWriter *xml) QHash *temp = dpad->getButtons(); QHashIterator iter(*temp); + while (iter.hasNext()) { JoyDPadButton *button = iter.next().value(); + if (button && !button->getButtonName().isEmpty()) { xml->writeStartElement("dpadbuttonname"); @@ -1243,9 +1236,10 @@ void InputDevice::writeConfig(QXmlStreamWriter *xml) } } - for (int i=0; i < getNumberVDPads(); i++) + for (int i = 0; i < getNumberVDPads(); i++) { VDPad *vdpad = getActiveSetJoystick()->getVDPad(i); + if (vdpad != nullptr) { if (!vdpad->getDpadName().isEmpty()) @@ -1258,9 +1252,11 @@ void InputDevice::writeConfig(QXmlStreamWriter *xml) QHash *temp = vdpad->getButtons(); QHashIterator iter(*temp); + while (iter.hasNext()) { JoyDPadButton *button = iter.next().value(); + if ((button != nullptr) && !button->getButtonName().isEmpty()) { xml->writeStartElement("vdpadbutton"); @@ -1276,20 +1272,16 @@ void InputDevice::writeConfig(QXmlStreamWriter *xml) xml->writeEndElement(); // } - - if ((keyPressTime > 0) && (keyPressTime != DEFAULTKEYPRESSTIME)) - { + if ((keyPressTime > 0) && (keyPressTime != GlobalVariables::InputDevice::DEFAULTKEYPRESSTIME)) xml->writeTextElement("keyPressTime", QString::number(keyPressTime)); - } xml->writeStartElement("sets"); + for (int i = 0; i < getJoystick_sets().size(); i++) - { getJoystick_sets().value(i)->writeConfig(xml); - } - xml->writeEndElement(); xml->writeEndElement(); + xml->writeEndElement(); } void InputDevice::changeSetAxisButtonAssociation(int button_index, int axis_index, int originset, int newset, int mode) @@ -1297,6 +1289,7 @@ void InputDevice::changeSetAxisButtonAssociation(int button_index, int axis_inde qInstallMessageHandler(MessageHandler::myMessageOutput); JoyAxisButton *button = nullptr; + if (button_index == 0) { button = getJoystick_sets().value(newset)->getJoyAxis(axis_index)->getNAxisButton(); @@ -1349,23 +1342,24 @@ void InputDevice::propogateSetAxisThrottleChange(int index, int originset) qInstallMessageHandler(MessageHandler::myMessageOutput); SetJoystick *currentSet = getJoystick_sets().value(originset); + if (currentSet != nullptr) { JoyAxis *axis = currentSet->getJoyAxis(index); + if (axis != nullptr) { int throttleSetting = axis->getThrottle(); - QHashIterator iter(getJoystick_sets()); + while (iter.hasNext()) { iter.next(); SetJoystick *temp = iter.value(); + // Ignore change for set axis that initiated the change if (temp != currentSet) - { temp->getJoyAxis(index)->setThrottle(throttleSetting); - } } } } @@ -1375,13 +1369,12 @@ void InputDevice::removeControlStick(int index) { qInstallMessageHandler(MessageHandler::myMessageOutput); - for (int i=0; i < NUMBER_JOYSETS; i++) + for (int i = 0; i < GlobalVariables::InputDevice::NUMBER_JOYSETS; i++) { SetJoystick *currentset = getSetJoystick(i); + if (currentset->getJoyStick(index)) - { currentset->removeControlStick(index); - } } } @@ -1401,10 +1394,9 @@ void InputDevice::buttonDownEvent(int setindex, int buttonindex) bool old = isActive(); buttonDownCount += 1; + if (isActive() != old) - { emit clicked(joyNumber); - } } void InputDevice::buttonUpEvent(int setindex, int buttonindex) @@ -1416,15 +1408,10 @@ void InputDevice::buttonUpEvent(int setindex, int buttonindex) bool old = isActive(); buttonDownCount -= 1; - if (buttonDownCount < 0) - { - buttonDownCount = 0; - } - if (isActive() != old) - { - emit released(joyNumber); - } + if (buttonDownCount < 0) buttonDownCount = 0; + + if (isActive() != old) emit released(joyNumber); } void InputDevice::buttonClickEvent(int buttonindex) @@ -1463,22 +1450,20 @@ void InputDevice::dpadButtonClickEvent(int buttonindex) { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyDPadButton *dpadbutton = qobject_cast(sender()); // static_cast + JoyDPadButton *dpadbutton = qobject_cast(sender()); + if (dpadbutton != nullptr) - { emit rawDPadButtonClick(dpadbutton->getDPad()->getIndex(), buttonindex); - } } void InputDevice::dpadButtonReleaseEvent(int buttonindex) { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyDPadButton *dpadbutton = qobject_cast(sender()); // static_cast + JoyDPadButton *dpadbutton = qobject_cast(sender()); + if (dpadbutton != nullptr) - { emit rawDPadButtonRelease(dpadbutton->getDPad()->getIndex(), buttonindex); - } } void InputDevice::dpadButtonDownEvent(int setindex, int dpadindex, int buttonindex) @@ -1522,15 +1507,16 @@ void InputDevice::setButtonName(int index, QString tempName) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getJoystick_sets()); + while (iter.hasNext()) { SetJoystick *tempSet = iter.next().value(); disconnect(tempSet, &SetJoystick::setButtonNameChange, this, &InputDevice::updateSetButtonNames); JoyButton *button = tempSet->getJoyButton(index); + if (button != nullptr) - { button->setButtonName(tempName); - } + connect(tempSet, &SetJoystick::setButtonNameChange, this, &InputDevice::updateSetButtonNames); } } @@ -1540,28 +1526,23 @@ void InputDevice::setAxisButtonName(int axisIndex, int buttonIndex, QString temp qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getJoystick_sets()); + while (iter.hasNext()) { SetJoystick *tempSet = iter.next().value(); disconnect(tempSet, &SetJoystick::setAxisButtonNameChange, this, &InputDevice::updateSetAxisButtonNames); JoyAxis *axis = tempSet->getJoyAxis(axisIndex); + if (axis != nullptr) { JoyAxisButton *button = nullptr; - if (buttonIndex == 0) - { - button = axis->getNAxisButton(); - } - else if (buttonIndex == 1) - { - button = axis->getPAxisButton(); - } - if (button != nullptr) - { - button->setButtonName(tempName); - } + if (buttonIndex == 0) button = axis->getNAxisButton(); + else if (buttonIndex == 1) button = axis->getPAxisButton(); + + if (button != nullptr) button->setButtonName(tempName); } + connect(tempSet, &SetJoystick::setAxisButtonNameChange, this, &InputDevice::updateSetAxisButtonNames); } } @@ -1571,19 +1552,21 @@ void InputDevice::setStickButtonName(int stickIndex, int buttonIndex, QString te qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getJoystick_sets()); + while (iter.hasNext()) { SetJoystick *tempSet = iter.next().value(); disconnect(tempSet, &SetJoystick::setStickButtonNameChange, this, &InputDevice::updateSetStickButtonNames); JoyControlStick *stick = tempSet->getJoyStick(stickIndex); + if (stick != nullptr) { JoyControlStickButton *button = stick->getDirectionButton(JoyControlStick::JoyStickDirections(buttonIndex)); + if (button != nullptr) - { button->setButtonName(tempName); - } } + connect(tempSet, &SetJoystick::setStickButtonNameChange, this, &InputDevice::updateSetStickButtonNames); } } @@ -1593,19 +1576,20 @@ void InputDevice::setDPadButtonName(int dpadIndex, int buttonIndex, QString temp qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getJoystick_sets()); + while (iter.hasNext()) { SetJoystick *tempSet = iter.next().value(); disconnect(tempSet, &SetJoystick::setDPadButtonNameChange, this, &InputDevice::updateSetDPadButtonNames); JoyDPad *dpad = tempSet->getJoyDPad(dpadIndex); + if (dpad != nullptr) { JoyDPadButton *button = dpad->getJoyButton(buttonIndex); - if (button != nullptr) - { - button->setButtonName(tempName); - } + + if (button != nullptr) button->setButtonName(tempName); } + connect(tempSet, &SetJoystick::setDPadButtonNameChange, this, &InputDevice::updateSetDPadButtonNames); } } @@ -1615,19 +1599,20 @@ void InputDevice::setVDPadButtonName(int vdpadIndex, int buttonIndex, QString te qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getJoystick_sets()); + while (iter.hasNext()) { SetJoystick *tempSet = iter.next().value(); disconnect(tempSet, &SetJoystick::setVDPadButtonNameChange, this, &InputDevice::updateSetVDPadButtonNames); VDPad *vdpad = tempSet->getVDPad(vdpadIndex); + if (vdpad != nullptr) { JoyDPadButton *button = vdpad->getJoyButton(buttonIndex); - if (button != nullptr) - { - button->setButtonName(tempName); - } + + if (button != nullptr) button->setButtonName(tempName); } + connect(tempSet, &SetJoystick::setVDPadButtonNameChange, this, &InputDevice::updateSetVDPadButtonNames); } } @@ -1637,15 +1622,15 @@ void InputDevice::setAxisName(int axisIndex, QString tempName) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getJoystick_sets()); + while (iter.hasNext()) { SetJoystick *tempSet = iter.next().value(); disconnect(tempSet, &SetJoystick::setAxisNameChange, this, &InputDevice::updateSetAxisNames); JoyAxis *axis = tempSet->getJoyAxis(axisIndex); - if (axis != nullptr) - { - axis->setAxisName(tempName); - } + + if (axis != nullptr) axis->setAxisName(tempName); + connect(tempSet, &SetJoystick::setAxisNameChange, this, &InputDevice::updateSetAxisNames); } } @@ -1655,15 +1640,15 @@ void InputDevice::setStickName(int stickIndex, QString tempName) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getJoystick_sets()); + while (iter.hasNext()) { SetJoystick *tempSet = iter.next().value(); disconnect(tempSet, &SetJoystick::setStickNameChange, this, &InputDevice::updateSetStickNames); JoyControlStick *stick = tempSet->getJoyStick(stickIndex); - if (stick != nullptr) - { - stick->setStickName(tempName); - } + + if (stick != nullptr) stick->setStickName(tempName); + connect(tempSet, &SetJoystick::setStickNameChange, this, &InputDevice::updateSetStickNames); } } @@ -1673,15 +1658,15 @@ void InputDevice::setDPadName(int dpadIndex, QString tempName) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getJoystick_sets()); + while (iter.hasNext()) { SetJoystick *tempSet = iter.next().value(); disconnect(tempSet, &SetJoystick::setDPadNameChange, this, &InputDevice::updateSetDPadNames); JoyDPad *dpad = tempSet->getJoyDPad(dpadIndex); - if (dpad != nullptr) - { - dpad->setDPadName(tempName); - } + + if (dpad != nullptr) dpad->setDPadName(tempName); + connect(tempSet, &SetJoystick::setDPadNameChange, this, &InputDevice::updateSetDPadNames); } } @@ -1691,15 +1676,15 @@ void InputDevice::setVDPadName(int vdpadIndex, QString tempName) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getJoystick_sets()); + while (iter.hasNext()) { SetJoystick *tempSet = iter.next().value(); disconnect(tempSet, &SetJoystick::setVDPadNameChange, this, &InputDevice::updateSetVDPadNames); VDPad *vdpad = tempSet->getVDPad(vdpadIndex); - if (vdpad != nullptr) - { - vdpad->setDPadName(tempName); - } + + if (vdpad != nullptr) vdpad->setDPadName(tempName); + connect(tempSet, &SetJoystick::setVDPadNameChange, this, &InputDevice::updateSetVDPadNames); } } @@ -1710,10 +1695,8 @@ void InputDevice::updateSetButtonNames(int index) qInstallMessageHandler(MessageHandler::myMessageOutput); JoyButton *button = getActiveSetJoystick()->getJoyButton(index); - if (button != nullptr) - { - setButtonName(index, button->getButtonName()); - } + + if (button != nullptr) setButtonName(index, button->getButtonName()); } void InputDevice::updateSetAxisButtonNames(int axisIndex, int buttonIndex) @@ -1721,22 +1704,16 @@ void InputDevice::updateSetAxisButtonNames(int axisIndex, int buttonIndex) qInstallMessageHandler(MessageHandler::myMessageOutput); JoyAxis *axis = getActiveSetJoystick()->getJoyAxis(axisIndex); + if (axis != nullptr) { JoyAxisButton *button = nullptr; - if (buttonIndex == 0) - { - button = axis->getNAxisButton(); - } - else if (buttonIndex == 1) - { - button = axis->getPAxisButton(); - } + + if (buttonIndex == 0) button = axis->getNAxisButton(); + else if (buttonIndex == 1) button = axis->getPAxisButton(); if (button != nullptr) - { setAxisButtonName(axisIndex, buttonIndex, button->getButtonName()); - } } } @@ -1745,13 +1722,13 @@ void InputDevice::updateSetStickButtonNames(int stickIndex, int buttonIndex) qInstallMessageHandler(MessageHandler::myMessageOutput); JoyControlStick *stick = getActiveSetJoystick()->getJoyStick(stickIndex); + if (stick != nullptr) { JoyControlStickButton *button = stick->getDirectionButton(JoyControlStick::JoyStickDirections(buttonIndex)); + if (button != nullptr) - { setStickButtonName(stickIndex, buttonIndex, button->getButtonName()); - } } } @@ -1760,13 +1737,13 @@ void InputDevice::updateSetDPadButtonNames(int dpadIndex, int buttonIndex) qInstallMessageHandler(MessageHandler::myMessageOutput); JoyDPad *dpad = getActiveSetJoystick()->getJoyDPad(dpadIndex); + if (dpad != nullptr) { JoyDPadButton *button = dpad->getJoyButton(buttonIndex); + if (button != nullptr) - { setDPadButtonName(dpadIndex, buttonIndex, button->getButtonName()); - } } } @@ -1775,13 +1752,13 @@ void InputDevice::updateSetVDPadButtonNames(int vdpadIndex, int buttonIndex) qInstallMessageHandler(MessageHandler::myMessageOutput); VDPad *vdpad = getActiveSetJoystick()->getVDPad(vdpadIndex); + if (vdpad != nullptr) { JoyDPadButton *button = vdpad->getJoyButton(buttonIndex); + if (button != nullptr) - { setVDPadButtonName(vdpadIndex, buttonIndex, button->getButtonName()); - } } } @@ -1790,10 +1767,9 @@ void InputDevice::updateSetAxisNames(int axisIndex) qInstallMessageHandler(MessageHandler::myMessageOutput); JoyAxis *axis = getActiveSetJoystick()->getJoyAxis(axisIndex); + if (axis != nullptr) - { setAxisName(axisIndex, axis->getAxisName()); - } } void InputDevice::updateSetStickNames(int stickIndex) @@ -1801,10 +1777,9 @@ void InputDevice::updateSetStickNames(int stickIndex) qInstallMessageHandler(MessageHandler::myMessageOutput); JoyControlStick *stick = getActiveSetJoystick()->getJoyStick(stickIndex); + if (stick != nullptr) - { setStickName(stickIndex, stick->getStickName()); - } } void InputDevice::updateSetDPadNames(int dpadIndex) @@ -1812,10 +1787,9 @@ void InputDevice::updateSetDPadNames(int dpadIndex) qInstallMessageHandler(MessageHandler::myMessageOutput); JoyDPad *dpad = getActiveSetJoystick()->getJoyDPad(dpadIndex); + if (dpad != nullptr) - { setDPadName(dpadIndex, dpad->getDpadName()); - } } void InputDevice::updateSetVDPadNames(int vdpadIndex) @@ -1823,10 +1797,9 @@ void InputDevice::updateSetVDPadNames(int vdpadIndex) qInstallMessageHandler(MessageHandler::myMessageOutput); VDPad *vdpad = getActiveSetJoystick()->getVDPad(vdpadIndex); + if (vdpad != nullptr) - { setVDPadName(vdpadIndex, vdpad->getDpadName()); - } } void InputDevice::resetButtonDownCount() @@ -1901,14 +1874,8 @@ void InputDevice::setIndex(int index) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (index >= 0) - { - joyNumber = index; - } - else - { - joyNumber = 0; - } + if (index >= 0) joyNumber = index; + else joyNumber = 0; } void InputDevice::setDeviceKeyPressTime(int newPressTime) @@ -1958,14 +1925,9 @@ QString InputDevice::getStringIdentifier() QString identifier = QString(); QString tempGUID = getGUIDString(); QString tempName = getSDLName(); - if (!tempGUID.isEmpty()) - { - identifier = tempGUID; - } - else if (!tempName.isEmpty()) - { - identifier = tempName; - } + + if (!tempGUID.isEmpty()) identifier = tempGUID; + else if (!tempName.isEmpty()) identifier = tempName; return identifier; } @@ -2022,7 +1984,8 @@ int InputDevice::getKeyRepeatDelay() { qInstallMessageHandler(MessageHandler::myMessageOutput); - int tempKeyRepeatDelay = DEFAULTKEYREPEATDELAY; + int tempKeyRepeatDelay = GlobalVariables::InputDevice::DEFAULTKEYREPEATDELAY; + if (keyRepeatDelay != 0) { tempKeyRepeatDelay = keyRepeatDelay; @@ -2035,7 +1998,8 @@ int InputDevice::getKeyRepeatRate() { qInstallMessageHandler(MessageHandler::myMessageOutput); - int tempKeyRepeatRate = DEFAULTKEYREPEATRATE; + int tempKeyRepeatRate = GlobalVariables::InputDevice::DEFAULTKEYREPEATRATE; + if (keyRepeatRate != 0) { tempKeyRepeatRate = keyRepeatRate; @@ -2084,7 +2048,6 @@ QString InputDevice::getSDLPlatform() return temp; } - /** * @brief Check if device is using the SDL Game Controller API * @return Status showing if device is using the Game Controller API @@ -2101,10 +2064,8 @@ bool InputDevice::hasCalibrationThrottle(int axisNum) qInstallMessageHandler(MessageHandler::myMessageOutput); bool result = false; - if (getCali().contains(axisNum)) - { - result = true; - } + + if (getCali().contains(axisNum)) result = true; return result; } @@ -2122,7 +2083,7 @@ void InputDevice::setCalibrationThrottle(int axisNum, JoyAxis::ThrottleTypes thr if (!getCali().contains(axisNum)) { - for (int i = 0; i < NUMBER_JOYSETS; i++) + for (int i = 0; i < GlobalVariables::InputDevice::NUMBER_JOYSETS; i++) { getJoystick_sets().value(i)->setAxisThrottle(axisNum, throttle); } @@ -2136,9 +2097,7 @@ void InputDevice::setCalibrationStatus(int axisNum, JoyAxis::ThrottleTypes throt qInstallMessageHandler(MessageHandler::myMessageOutput); if (!getCali().contains(axisNum)) - { getCali().insert(axisNum, throttle); - } } void InputDevice::removeCalibrationStatus(int axisNum) @@ -2146,9 +2105,7 @@ void InputDevice::removeCalibrationStatus(int axisNum) qInstallMessageHandler(MessageHandler::myMessageOutput); if (getCali().contains(axisNum)) - { getCali().remove(axisNum); - } } void InputDevice::sendLoadProfileRequest(QString location) @@ -2156,16 +2113,14 @@ void InputDevice::sendLoadProfileRequest(QString location) qInstallMessageHandler(MessageHandler::myMessageOutput); if (!location.isEmpty()) - { emit requestProfileLoad(location); - } } AntiMicroSettings* InputDevice::getSettings() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return settings; + return m_settings; } bool InputDevice::isKnownController() @@ -2173,23 +2128,19 @@ bool InputDevice::isKnownController() qInstallMessageHandler(MessageHandler::myMessageOutput); bool result = false; + if (isGameController()) { result = true; } else { - settings->beginGroup("Mappings"); - if (settings->contains(getGUIDString())) - { - result = true; - } - else if (settings->contains(QString("%1%2").arg(getGUIDString()).arg("Disabled"))) - { - result = true; - } + m_settings->beginGroup("Mappings"); + + if (m_settings->contains(getGUIDString())) result = true; + else if (m_settings->contains(QString("%1%2").arg(getGUIDString()).arg("Disabled"))) result = true; - settings->endGroup(); + m_settings->endGroup(); } return result; @@ -2211,9 +2162,11 @@ void InputDevice::activatePossibleControlStickEvents() qInstallMessageHandler(MessageHandler::myMessageOutput); SetJoystick *currentSet = getActiveSetJoystick(); - for (int i=0; i < currentSet->getNumberSticks(); i++) + + for (int i = 0; i < currentSet->getNumberSticks(); i++) { JoyControlStick *tempStick = currentSet->getJoyStick(i); + if ((tempStick != nullptr) && tempStick->hasPendingEvent()) { tempStick->activatePendingEvent(); @@ -2226,9 +2179,11 @@ void InputDevice::activatePossibleAxisEvents() qInstallMessageHandler(MessageHandler::myMessageOutput); SetJoystick *currentSet = getActiveSetJoystick(); - for (int i=0; i < currentSet->getNumberAxes(); i++) + + for (int i = 0; i < currentSet->getNumberAxes(); i++) { JoyAxis *tempAxis = currentSet->getJoyAxis(i); + if ((tempAxis != nullptr) && tempAxis->hasPendingEvent()) { tempAxis->activatePendingEvent(); @@ -2241,13 +2196,13 @@ void InputDevice::activatePossibleDPadEvents() qInstallMessageHandler(MessageHandler::myMessageOutput); SetJoystick *currentSet = getActiveSetJoystick(); - for (int i=0; i < currentSet->getNumberHats(); i++) + + for (int i = 0; i < currentSet->getNumberHats(); i++) { JoyDPad *tempDPad = currentSet->getJoyDPad(i); + if ((tempDPad != nullptr) && tempDPad->hasPendingEvent()) - { tempDPad->activatePendingEvent(); - } } } @@ -2256,13 +2211,13 @@ void InputDevice::activatePossibleVDPadEvents() qInstallMessageHandler(MessageHandler::myMessageOutput); SetJoystick *currentSet = getActiveSetJoystick(); - for (int i=0; i < currentSet->getNumberVDPads(); i++) + + for (int i = 0; i < currentSet->getNumberVDPads(); i++) { VDPad *tempVDPad = currentSet->getVDPad(i); + if ((tempVDPad != nullptr) && tempVDPad->hasPendingEvent()) - { tempVDPad->activatePendingEvent(); - } } } @@ -2271,13 +2226,13 @@ void InputDevice::activatePossibleButtonEvents() qInstallMessageHandler(MessageHandler::myMessageOutput); SetJoystick *currentSet = getActiveSetJoystick(); - for (int i=0; i < currentSet->getNumberButtons(); i++) + + for (int i = 0; i < currentSet->getNumberButtons(); i++) { JoyButton *tempButton = currentSet->getJoyButton(i); + if ((tempButton != nullptr) && tempButton->hasPendingEvent()) - { tempButton->activatePendingEvent(); - } } } @@ -2288,104 +2243,88 @@ bool InputDevice::elementsHaveNames() bool result = false; SetJoystick *tempSet = getActiveSetJoystick(); - for (int i=0; i < getNumberButtons() && !result; i++) + + for (int i = 0; i < getNumberButtons() && !result; i++) { JoyButton *button = tempSet->getJoyButton(i); - if ((button != nullptr) && !button->getButtonName().isEmpty()) - { - result = true; - } + + if ((button != nullptr) && !button->getButtonName().isEmpty()) result = true; } - for (int i=0; (i < getNumberAxes()) && !result; i++) + for (int i = 0; (i < getNumberAxes()) && !result; i++) { JoyAxis *axis = tempSet->getJoyAxis(i); + if (axis != nullptr) { - if (!axis->getAxisName().isEmpty()) - { - result = true; - } + if (!axis->getAxisName().isEmpty()) result = true; JoyAxisButton *naxisbutton = axis->getNAxisButton(); - if (!naxisbutton->getButtonName().isEmpty()) - { - result = true; - } + + if (!naxisbutton->getButtonName().isEmpty()) result = true; JoyAxisButton *paxisbutton = axis->getPAxisButton(); - if (!paxisbutton->getButtonName().isEmpty()) - { - result = true; - } + + if (!paxisbutton->getButtonName().isEmpty()) result = true; } } - for (int i=0; (i < getNumberSticks()) && !result; i++) + for (int i = 0; (i < getNumberSticks()) && !result; i++) { JoyControlStick *stick = tempSet->getJoyStick(i); + if (stick != nullptr) { - if (!stick->getStickName().isEmpty()) - { - result = true; - } + if (!stick->getStickName().isEmpty()) result = true; QHash *buttons = stick->getButtons(); QHashIterator iter(*buttons); + while (iter.hasNext() && !result) { JoyControlStickButton *button = iter.next().value(); - if (button && !button->getButtonName().isEmpty()) - { - result = true; - } + + if (button && !button->getButtonName().isEmpty()) result = true; } } } - for (int i=0; (i < getNumberHats()) && !result; i++) + for (int i = 0; (i < getNumberHats()) && !result; i++) { JoyDPad *dpad = tempSet->getJoyDPad(i); + if (dpad != nullptr) { - if (!dpad->getDpadName().isEmpty()) - { - result = true; - } + if (!dpad->getDpadName().isEmpty()) result = true; QHash *temp = dpad->getButtons(); QHashIterator iter(*temp); + while (iter.hasNext() && !result) { JoyDPadButton *button = iter.next().value(); - if (button && !button->getButtonName().isEmpty()) - { - result = true; - } + + if (button && !button->getButtonName().isEmpty()) result = true; } } } - for (int i=0; (i < getNumberVDPads()) && !result; i++) + for (int i = 0; (i < getNumberVDPads()) && !result; i++) { VDPad *vdpad = getActiveSetJoystick()->getVDPad(i); + if (vdpad != nullptr) { - if (!vdpad->getDpadName().isEmpty()) - { - result = true; - } + if (!vdpad->getDpadName().isEmpty()) result = true; QHash *temp = vdpad->getButtons(); QHashIterator iter(*temp); + while (iter.hasNext() && !result) { JoyDPadButton *button = iter.next().value(); - if ((button != nullptr) && !button->getButtonName().isEmpty()) - { - result = true; - } + + if ((button != nullptr) && !button->getButtonName().isEmpty()) result = true; } } } @@ -2404,10 +2343,7 @@ bool InputDevice::isEmptyGUID(QString tempGUID) bool result = false; - if (tempGUID.contains(emptyGUID)) - { - result = true; - } + if (tempGUID.contains(GlobalVariables::InputDevice::emptyGUID)) result = true; return result; } @@ -2423,10 +2359,8 @@ bool InputDevice::isRelevantGUID(QString tempGUID) qInstallMessageHandler(MessageHandler::myMessageOutput); bool result = false; - if (tempGUID == getGUIDString()) - { - result = true; - } + + if (tempGUID == getGUIDString()) result = true; return result; } @@ -2435,8 +2369,7 @@ QString InputDevice::getRawGUIDString() { qInstallMessageHandler(MessageHandler::myMessageOutput); - QString temp = getGUIDString(); - return temp; + return getGUIDString(); } void InputDevice::haltServices() @@ -2458,13 +2391,13 @@ void InputDevice::setRawAxisDeadZone(int deadZone) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((deadZone > 0) && (deadZone <= JoyAxis::AXISMAX)) + if ((deadZone > 0) && (deadZone <= GlobalVariables::JoyAxis::AXISMAX)) { this->rawAxisDeadZone = deadZone; } else { - this->rawAxisDeadZone = RAISEDDEADZONE; + this->rawAxisDeadZone = GlobalVariables::InputDevice::RAISEDDEADZONE; } } @@ -2511,3 +2444,8 @@ QList& InputDevice::getDpadstatesLocal() { return dpadstates; } + +SDL_Joystick* InputDevice::getJoyHandle() const +{ + return m_joyhandle; +} diff --git a/src/inputdevice.h b/src/inputdevice.h old mode 100644 new mode 100755 index 36fd70560..4a9915c03 --- a/src/inputdevice.h +++ b/src/inputdevice.h @@ -124,24 +124,21 @@ class InputDevice : public QObject int getRawAxisDeadZone(); void rawAxisEvent(int index, int value); - static const int NUMBER_JOYSETS; - static const int DEFAULTKEYPRESSTIME; - static const int DEFAULTKEYREPEATDELAY; // unsigned - static const int DEFAULTKEYREPEATRATE; // unsigned - static const int RAISEDDEADZONE; + QHash& getJoystick_sets(); protected: void enableSetConnections(SetJoystick *setstick); bool elementsHaveNames(); + SDL_Joystick* getJoyHandle() const; + - QHash& getJoystick_sets(); QHash& getCali(); SDL_JoystickID* getJoystickID(); int rawAxisDeadZone; int keyPressTime; // unsigned QString profileName; - SDL_Joystick* joyhandle; + signals: void setChangeActivated(int index); @@ -221,9 +218,10 @@ protected slots: QList& getAxesstatesLocal(); QList& getDpadstatesLocal(); + SDL_Joystick* m_joyhandle; QHash joystick_sets; QHash cali; - AntiMicroSettings *settings; + AntiMicroSettings *m_settings; int active_set; int joyNumber; int buttonDownCount; @@ -237,8 +235,6 @@ protected slots: QList buttonstates; QList axesstates; QList dpadstates; - - static QRegExp emptyGUID; }; Q_DECLARE_METATYPE(InputDevice*) diff --git a/src/inputdevicebitarraystatus.cpp b/src/inputdevicebitarraystatus.cpp old mode 100644 new mode 100755 index 3af51e624..f5656cf0e --- a/src/inputdevicebitarraystatus.cpp +++ b/src/inputdevicebitarraystatus.cpp @@ -31,7 +31,7 @@ InputDeviceBitArrayStatus::InputDeviceBitArrayStatus(InputDevice *device, bool r { qInstallMessageHandler(MessageHandler::myMessageOutput); - for (int i=0; i < device->getNumberRawAxes(); i++) + for (int i = 0; i < device->getNumberRawAxes(); i++) { SetJoystick *currentSet = device->getActiveSetJoystick(); JoyAxis *axis = currentSet->getJoyAxis(i); @@ -46,10 +46,11 @@ InputDeviceBitArrayStatus::InputDeviceBitArrayStatus(InputDevice *device, bool r } } - for (int i=0; i < device->getNumberRawHats(); i++) + for (int i = 0; i < device->getNumberRawHats(); i++) { SetJoystick *currentSet = device->getActiveSetJoystick(); JoyDPad *dpad = currentSet->getJoyDPad(i); + if ((dpad != nullptr) && readCurrent) { hatButtonStatus.append(dpad->getCurrentDirection() != JoyDPadButton::DpadCentered ? true : false); @@ -63,10 +64,11 @@ InputDeviceBitArrayStatus::InputDeviceBitArrayStatus(InputDevice *device, bool r getButtonStatusLocal().resize(device->getNumberRawButtons()); getButtonStatusLocal().fill(0); - for (int i=0; i < device->getNumberRawButtons(); i++) + for (int i = 0; i < device->getNumberRawButtons(); i++) { SetJoystick *currentSet = device->getActiveSetJoystick(); JoyButton *button = currentSet->getJoyButton(i); + if ((button != nullptr) && readCurrent) { getButtonStatusLocal().setBit(i, button->getButtonState()); @@ -110,17 +112,16 @@ QBitArray InputDeviceBitArrayStatus::generateFinalBitArray() int totalArraySize = 0; totalArraySize = axesStatus.size() + hatButtonStatus.size() + getButtonStatusLocal().size(); - QBitArray aggregateBitArray(totalArraySize, false); int currentBit = 0; - for (int i=0; i < axesStatus.size(); i++) + for (int i = 0; i < axesStatus.size(); i++) { aggregateBitArray.setBit(currentBit, axesStatus.at(i)); currentBit++; } - for (int i=0; i < hatButtonStatus.size(); i++) + for (int i = 0; i < hatButtonStatus.size(); i++) { aggregateBitArray.setBit(currentBit, hatButtonStatus.at(i)); currentBit++; @@ -139,15 +140,11 @@ void InputDeviceBitArrayStatus::clearStatusValues() { qInstallMessageHandler(MessageHandler::myMessageOutput); - for (int i=0; i < axesStatus.size(); i++) - { + for (int i = 0; i < axesStatus.size(); i++) axesStatus.replace(i, false); - } - for (int i=0; i < hatButtonStatus.size(); i++) - { + for (int i = 0; i < hatButtonStatus.size(); i++) hatButtonStatus.replace(i, false); - } getButtonStatusLocal().fill(false); } diff --git a/src/inputdevicebitarraystatus.h b/src/inputdevicebitarraystatus.h old mode 100644 new mode 100755 diff --git a/src/joyaxis.cpp b/src/joyaxis.cpp old mode 100644 new mode 100755 index 6df8a6946..29b83b18f --- a/src/joyaxis.cpp +++ b/src/joyaxis.cpp @@ -17,6 +17,7 @@ #include "joyaxis.h" +#include "globalvariables.h" #include "messagehandler.h" #include "joycontrolstick.h" #include "setjoystick.h" @@ -31,18 +32,7 @@ #include #include -// Set default values for many properties. -const int JoyAxis::AXISMIN = -32767; -const int JoyAxis::AXISMAX = 32767; -const int JoyAxis::AXISDEADZONE = 6000; -const int JoyAxis::AXISMAXZONE = 32000; - -// Speed in pixels/second -const float JoyAxis::JOYSPEED = 20.0; const JoyAxis::ThrottleTypes JoyAxis::DEFAULTTHROTTLE = JoyAxis::NormalThrottle; -const QString JoyAxis::xmlName = "axis"; - - JoyAxis::JoyAxis(int index, int originset, SetJoystick *parentSet, QObject *parent) : @@ -50,26 +40,26 @@ JoyAxis::JoyAxis(int index, int originset, SetJoystick *parentSet, { qInstallMessageHandler(MessageHandler::myMessageOutput); - stick = nullptr; + m_stick = nullptr; lastKnownThottledValue = 0; lastKnownRawValue = 0; axis_max_cal = -1; axis_min_cal = -1; axis_center_cal = -1; - this->originset = originset; - this->parentSet = parentSet; + m_originset = originset; + m_parentSet = parentSet; naxisbutton = new JoyAxisButton(this, 0, originset, parentSet, this); paxisbutton = new JoyAxisButton(this, 1, originset, parentSet, this); - reset(); - this->index = index; + resetPrivateVars(); + m_index = index; } JoyAxis::~JoyAxis() { qInstallMessageHandler(MessageHandler::myMessageOutput); - reset(); + resetPrivateVars(); } void JoyAxis::queuePendingEvent(int value, bool ignoresets, bool updateLastValues) @@ -80,7 +70,7 @@ void JoyAxis::queuePendingEvent(int value, bool ignoresets, bool updateLastValue pendingValue = 0; pendingIgnoreSets = false; - if (this->stick != nullptr) + if (m_stick != nullptr) { stickPassEvent(value, ignoresets, updateLastValues); } @@ -126,7 +116,7 @@ void JoyAxis::stickPassEvent(int value, bool ignoresets, bool updateLastValues) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (this->stick != nullptr) + if (m_stick != nullptr) { if (updateLastValues) { @@ -150,14 +140,8 @@ void JoyAxis::stickPassEvent(int value, bool ignoresets, bool updateLastValues) emit released(value); } - if (!ignoresets) - { - stick->queueJoyEvent(ignoresets); - } - else - { - stick->joyEvent(ignoresets); - } + if (!ignoresets) m_stick->queueJoyEvent(ignoresets); + else m_stick->joyEvent(ignoresets); emit moved(currentRawValue); } @@ -167,7 +151,7 @@ void JoyAxis::joyEvent(int value, bool ignoresets, bool updateLastValues) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((this->stick != nullptr) && !pendingEvent) + if ((m_stick != nullptr) && !pendingEvent) { stickPassEvent(value, ignoresets, updateLastValues); } @@ -187,8 +171,9 @@ void JoyAxis::joyEvent(int value, bool ignoresets, bool updateLastValues) // If in joystick mode and this is the first detected event, // use the current value as the axis center point. If the value // is below -30,000 then consider it a trigger. - InputDevice *device = parentSet->getInputDevice(); - if (!device->isGameController() && !device->hasCalibrationThrottle(index)) + InputDevice *device = m_parentSet->getInputDevice(); + + if (!device->isGameController() && !device->hasCalibrationThrottle(m_index)) { performCalibration(currentRawValue); safezone = !inDeadZone(currentRawValue); @@ -205,7 +190,6 @@ void JoyAxis::joyEvent(int value, bool ignoresets, bool updateLastValues) { isActive = eventActive = false; emit released(value); - createDeskEvent(ignoresets); } else if (isActive) @@ -227,7 +211,7 @@ bool JoyAxis::inDeadZone(int value) if (abs(temp) <= deadZone) { #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Value of throttle is in (less than) dead zone: " << abs(temp) << " <= " << deadZone; + qDebug() << "Value of throttle is in (less than) dead zone: " << abs(temp) << " <= " << deadZone; #endif result = true; @@ -235,7 +219,7 @@ bool JoyAxis::inDeadZone(int value) } else { #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Value of throttle is not in (greater than) dead zone: " << abs(temp) << " > " << deadZone; + qDebug() << "Value of throttle is not in (greater than) dead zone: " << abs(temp) << " > " << deadZone; #endif } @@ -247,12 +231,12 @@ QString JoyAxis::getName(bool forceFullFormat, bool displayNames) qInstallMessageHandler(MessageHandler::myMessageOutput); QString label = getPartialName(forceFullFormat, displayNames); - label.append(": "); if (throttle == static_cast(NormalThrottle)) { label.append("-"); + if (!naxisbutton->getActionName().isEmpty() && displayNames) { label.append(naxisbutton->getActionName()); @@ -263,6 +247,7 @@ QString JoyAxis::getName(bool forceFullFormat, bool displayNames) } label.append(" | +"); + if (!paxisbutton->getActionName().isEmpty() && displayNames) { label.append(paxisbutton->getActionName()); @@ -275,6 +260,7 @@ QString JoyAxis::getName(bool forceFullFormat, bool displayNames) else if ((throttle == static_cast(PositiveThrottle)) || (throttle == static_cast(PositiveHalfThrottle))) { label.append("+"); + if (!paxisbutton->getActionName().isEmpty() && displayNames) { label.append(paxisbutton->getActionName()); @@ -287,6 +273,7 @@ QString JoyAxis::getName(bool forceFullFormat, bool displayNames) else if ((throttle == static_cast(NegativeThrottle)) || (throttle == static_cast(NegativeHalfThrottle))) { label.append("-"); + if (!naxisbutton->getActionName().isEmpty() && displayNames) { label.append(naxisbutton->getActionName()); @@ -304,7 +291,7 @@ int JoyAxis::getRealJoyIndex() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return index + 1; + return m_index + 1; } int JoyAxis::getCurrentThrottledValue() @@ -319,48 +306,53 @@ int JoyAxis::calculateThrottledValue(int value) qInstallMessageHandler(MessageHandler::myMessageOutput); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Throtted value at start of function is: " << value; + qDebug() << "Throtted value at start of function is: " << value; #endif int temp = value; - if (throttle == static_cast(NegativeHalfThrottle)) + switch(throttle) { - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "It's a negative half throttle"; - #endif - value = (value <= 0) ? value : -value; - temp = value; - } - else if (throttle == static_cast(NegativeThrottle)) - { - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "It's a negative throttle"; - #endif + case -2: + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "It's a negative half throttle"; + #endif - temp = (value + getAxisMinCal()) / 2; - } - else if (throttle == static_cast(PositiveThrottle)) - { - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "It's a positive throttle"; - #endif + value = (value <= 0) ? value : -value; + temp = value; + break; - temp = (value + getAxisMaxCal()) / 2; - } - else if (throttle == static_cast(PositiveHalfThrottle)) - { - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "It's a positive half throttle"; - #endif + case -1: + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "It's a negative throttle"; + #endif + + temp = (value + getAxisMinCal()) / 2; + break; + + case 1: + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "It's a positive throttle"; + #endif + + temp = (value + getAxisMaxCal()) / 2; + break; + + case 2: + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "It's a positive half throttle"; + #endif + + value = (value >= 0) ? value : -value; + temp = value; + break; - value = (value >= 0) ? value : -value; - temp = value; } + #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Calculated value of throttle is: " << temp; + qDebug() << "Calculated value of throttle is: " << temp; #endif return temp; @@ -370,14 +362,14 @@ void JoyAxis::setIndex(int index) { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->index = index; + m_index = index; } int JoyAxis::getIndex() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return index; + return m_index; } @@ -386,14 +378,9 @@ void JoyAxis::createDeskEvent(bool ignoresets) qInstallMessageHandler(MessageHandler::myMessageOutput); JoyAxisButton *eventbutton = nullptr; - if (currentThrottledValue > deadZone) - { - eventbutton = paxisbutton; - } - else if (currentThrottledValue < -deadZone) - { - eventbutton = naxisbutton; - } + + if (currentThrottledValue > deadZone) eventbutton = paxisbutton; + else if (currentThrottledValue < -deadZone) eventbutton = naxisbutton; if ((eventbutton != nullptr) && !activeButton) { @@ -444,6 +431,7 @@ void JoyAxis::setMaxZoneValue(int value) qInstallMessageHandler(MessageHandler::myMessageOutput); value = abs(value); + if (value >=getAxisMaxCal()) { maxZoneValue = getAxisMaxCal(); @@ -472,7 +460,7 @@ void JoyAxis::setThrottle(int value) qInstallMessageHandler(MessageHandler::myMessageOutput); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Value of throttle for axis in setThrottle is: " << value; + qDebug() << "Value of throttle for axis in setThrottle is: " << value; #endif if ((value >= static_cast(JoyAxis::NegativeHalfThrottle)) && (value <= static_cast(JoyAxis::PositiveHalfThrottle))) @@ -480,7 +468,7 @@ void JoyAxis::setThrottle(int value) if (value != throttle) { #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Throttle value for variable \"throttle\" has been set: " << value; + qDebug() << "Throttle value for variable \"throttle\" has been set: " << value; #endif throttle = value; @@ -500,14 +488,12 @@ void JoyAxis::setInitialThrottle(int value) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((value >= static_cast(JoyAxis::NegativeHalfThrottle)) && (value <= static_cast(JoyAxis::PositiveHalfThrottle))) + if ((value >= static_cast(JoyAxis::NegativeHalfThrottle)) && (value <= static_cast(JoyAxis::PositiveHalfThrottle)) + && (value != throttle)) { - if (value != throttle) - { - throttle = value; - adjustRange(); - emit throttleChanged(); - } + throttle = value; + adjustRange(); + emit throttleChanged(); } } @@ -524,22 +510,19 @@ void JoyAxis::readConfig(QXmlStreamReader *xml) if (xml->isStartElement() && (xml->name() == getXmlName())) { - xml->readNextStartElement(); + while (!xml->atEnd() && (!xml->isEndElement() && (xml->name() != getXmlName()))) { - bool found = false; - found = readMainConfig(xml); + bool found = readMainConfig(xml); + if (!found && (xml->name() == naxisbutton->getXmlName()) && xml->isStartElement()) { found = true; readButtonConfig(xml); } - if (!found) - { - xml->skipCurrentElement(); - } + if (!found) xml->skipCurrentElement(); xml->readNextStartElement(); } @@ -553,50 +536,46 @@ void JoyAxis::writeConfig(QXmlStreamWriter *xml) bool currentlyDefault = isDefault(); xml->writeStartElement(getXmlName()); - xml->writeAttribute("index", QString::number(index+1)); + xml->writeAttribute("index", QString::number(m_index+1)); if (!currentlyDefault) { - if (deadZone != AXISDEADZONE) - { + if (deadZone != GlobalVariables::JoyAxis::AXISDEADZONE) xml->writeTextElement("deadZone", QString::number(deadZone)); - } - if (maxZoneValue != AXISMAXZONE) - { + if (maxZoneValue != GlobalVariables::JoyAxis::AXISMAXZONE) xml->writeTextElement("maxZone", QString::number(maxZoneValue)); - } } - xml->writeTextElement("center_value", QString::number(axis_center_cal)); - xml->writeTextElement("min_value", QString::number(axis_min_cal)); - xml->writeTextElement("max_value", QString::number(axis_max_cal)); + xml->writeTextElement("center_value", QString::number(axis_center_cal)); + xml->writeTextElement("min_value", QString::number(axis_min_cal)); + xml->writeTextElement("max_value", QString::number(axis_max_cal)); + xml->writeStartElement("throttle"); + switch(throttle) + { + case -2: + xml->writeCharacters("negativehalf"); + break; - xml->writeStartElement("throttle"); + case -1: + xml->writeCharacters("negative"); + break; - if (throttle == static_cast(JoyAxis::NegativeHalfThrottle)) - { - xml->writeCharacters("negativehalf"); - } - else if (throttle == static_cast(JoyAxis::NegativeThrottle)) - { - xml->writeCharacters("negative"); - } - else if (throttle == static_cast(JoyAxis::NormalThrottle)) - { - xml->writeCharacters("normal"); - } - else if (throttle == static_cast(JoyAxis::PositiveThrottle)) - { - xml->writeCharacters("positive"); - } - else if (throttle == JoyAxis::PositiveHalfThrottle) - { - xml->writeCharacters("positivehalf"); + case 0: + xml->writeCharacters("normal"); + break; + + case 1: + xml->writeCharacters("positive"); + break; + + case 2: + xml->writeCharacters("positivehalf"); + break; } - xml->writeEndElement(); + xml->writeEndElement(); if (!currentlyDefault) { @@ -621,7 +600,7 @@ bool JoyAxis::readMainConfig(QXmlStreamReader *xml) int tempchoice = temptext.toInt(); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "From xml config dead zone is: " << tempchoice; + qDebug() << "From xml config dead zone is: " << tempchoice; #endif this->setDeadZone(tempchoice); @@ -633,7 +612,7 @@ bool JoyAxis::readMainConfig(QXmlStreamReader *xml) int tempchoice = temptext.toInt(); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "From xml config max zone is: " << tempchoice; + qDebug() << "From xml config max zone is: " << tempchoice; #endif this->setMaxZoneValue(tempchoice); @@ -645,7 +624,7 @@ bool JoyAxis::readMainConfig(QXmlStreamReader *xml) int tempchoice = temptext.toInt(); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "From xml config center value is: " << tempchoice; + qDebug() << "From xml config center value is: " << tempchoice; #endif this->setAxisCenterCal(tempchoice); @@ -657,7 +636,7 @@ bool JoyAxis::readMainConfig(QXmlStreamReader *xml) int tempchoice = temptext.toInt(); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "From xml config min value is: " << tempchoice; + qDebug() << "From xml config min value is: " << tempchoice; #endif this->setAxisMinCal(tempchoice); @@ -670,7 +649,7 @@ bool JoyAxis::readMainConfig(QXmlStreamReader *xml) int tempchoice = temptext.toInt(); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "From xml config max value is: " << tempchoice; + qDebug() << "From xml config max value is: " << tempchoice; #endif this->setAxisMaxCal(tempchoice); @@ -681,7 +660,7 @@ bool JoyAxis::readMainConfig(QXmlStreamReader *xml) QString temptext = xml->readElementText(); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "From xml config throttle name is: " << temptext; + qDebug() << "From xml config throttle name is: " << temptext; #endif if (temptext == "negativehalf") @@ -705,10 +684,11 @@ bool JoyAxis::readMainConfig(QXmlStreamReader *xml) this->setThrottle(static_cast(JoyAxis::PositiveHalfThrottle)); } - InputDevice *device = parentSet->getInputDevice(); - if (!device->hasCalibrationThrottle(index)) + InputDevice *device = m_parentSet->getInputDevice(); + + if (!device->hasCalibrationThrottle(m_index)) { - device->setCalibrationStatus(index, + device->setCalibrationStatus(m_index, static_cast(throttle)); } @@ -725,13 +705,14 @@ bool JoyAxis::readButtonConfig(QXmlStreamReader *xml) bool found = false; - int index = xml->attributes().value("index").toString().toInt(); - if (index == 1) + int index_local = xml->attributes().value("index").toString().toInt(); + + if (index_local == 1) { found = true; naxisbutton->readConfig(xml); } - else if (index == 2) + else if (index_local == 2) { found = true; paxisbutton->readConfig(xml); @@ -743,13 +724,17 @@ bool JoyAxis::readButtonConfig(QXmlStreamReader *xml) void JoyAxis::reset() { qInstallMessageHandler(MessageHandler::myMessageOutput); + resetPrivateVars(); +} - deadZone = getDefaultDeadZone(); +void JoyAxis::resetPrivateVars() +{ + deadZone = GlobalVariables::JoyAxis::AXISDEADZONE; isActive = false; eventActive = false; - maxZoneValue = getDefaultMaxZone(); - throttle = getDefaultThrottle(); + maxZoneValue = GlobalVariables::JoyAxis::AXISMAXZONE; + throttle = this->DEFAULTTHROTTLE; paxisbutton->reset(); naxisbutton->reset(); @@ -772,7 +757,7 @@ void JoyAxis::reset(int index) qInstallMessageHandler(MessageHandler::myMessageOutput); reset(); - this->index = index; + m_index = index; } JoyAxisButton* JoyAxis::getPAxisButton() @@ -837,19 +822,17 @@ double JoyAxis::getDistanceFromDeadZone(int value) qInstallMessageHandler(MessageHandler::myMessageOutput); double distance = 0.0; - int currentValue = value; - if (currentValue >= deadZone) + if (value >= deadZone) { - distance = static_cast((currentValue - deadZone)/(maxZoneValue - deadZone)); + distance = static_cast(value - deadZone)/(maxZoneValue - deadZone); } - else if (currentValue <= -deadZone) + else if (value <= -deadZone) { - distance = static_cast((currentValue + deadZone)/( (-maxZoneValue) + deadZone)); + distance = static_cast(value + deadZone)/( (-maxZoneValue) + deadZone); } - distance = qBound(0.0, distance, 1.0); - return distance; + return qBound(0.0, distance, 1.0); } /** @@ -862,27 +845,21 @@ double JoyAxis::getRawDistance(int value) { qInstallMessageHandler(MessageHandler::myMessageOutput); - double distance = 0.0; - int currentValue = value; - - distance = static_cast(currentValue / maxZoneValue); - distance = qBound(-1.0, distance, 1.0); - - return distance; + return qBound(-1.0, static_cast(value) / maxZoneValue, 1.0); } void JoyAxis::propogateThrottleChange() { qInstallMessageHandler(MessageHandler::myMessageOutput); - emit throttleChangePropogated(this->index); + emit throttleChangePropogated(m_index); } int JoyAxis::getCurrentlyAssignedSet() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return originset; + return m_originset; } void JoyAxis::setControlStick(JoyControlStick *stick) @@ -891,7 +868,7 @@ void JoyAxis::setControlStick(JoyControlStick *stick) removeVDPads(); removeControlStick(); - this->stick = stick; + m_stick = stick; emit propertyUpdated(); } @@ -899,28 +876,26 @@ bool JoyAxis::isPartControlStick() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return (this->stick != nullptr); + return (m_stick != nullptr); } JoyControlStick* JoyAxis::getControlStick() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->stick; + return m_stick; } void JoyAxis::removeControlStick(bool performRelease) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (stick != nullptr) + if (m_stick != nullptr) { if (performRelease) - { - stick->releaseButtonEvents(); - } + m_stick->releaseButtonEvents(); - this->stick = nullptr; + m_stick = nullptr; emit propertyUpdated(); } } @@ -931,6 +906,7 @@ bool JoyAxis::hasControlOfButtons() qInstallMessageHandler(MessageHandler::myMessageOutput); bool value = true; + if (paxisbutton->isPartVDPad() || naxisbutton->isPartVDPad()) { value = false; @@ -965,6 +941,7 @@ bool JoyAxis::isDefault() value = value && (maxZoneValue == getDefaultMaxZone()); value = value && (paxisbutton->isDefault()); value = value && (naxisbutton->isDefault()); + return value; } @@ -980,7 +957,7 @@ void JoyAxis::setCurrentRawValue(int value) if ((value >= getAxisMinCal()) && (value <= getAxisMaxCal())) { #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Raw value is less than " << getAxisMaxCal() << " and greather than " << getAxisMinCal(); + qDebug() << "Raw value is less than " << getAxisMaxCal() << " and greather than " << getAxisMinCal(); #endif currentRawValue = value; @@ -988,7 +965,7 @@ void JoyAxis::setCurrentRawValue(int value) else if (value > getAxisMaxCal()) { #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Raw value is greather than " << getAxisMaxCal(); + qDebug() << "Raw value is greather than " << getAxisMaxCal(); #endif currentRawValue = getAxisMaxCal(); @@ -996,14 +973,14 @@ void JoyAxis::setCurrentRawValue(int value) else if (value < getAxisMinCal()) { #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Raw value is less than " << getAxisMinCal(); + qDebug() << "Raw value is less than " << getAxisMinCal(); #endif currentRawValue = getAxisMinCal(); } #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Raw value for axis is: " << currentRawValue; + qDebug() << "Raw value for axis is: " << currentRawValue; #endif } @@ -1020,6 +997,7 @@ bool JoyAxis::hasSameButtonsMouseMode() qInstallMessageHandler(MessageHandler::myMessageOutput); bool result = true; + if (paxisbutton->getMouseMode() != naxisbutton->getMouseMode()) { result = false; @@ -1033,10 +1011,9 @@ JoyButton::JoyMouseMovementMode JoyAxis::getButtonsPresetMouseMode() qInstallMessageHandler(MessageHandler::myMessageOutput); JoyButton::JoyMouseMovementMode resultMode = JoyButton::MouseCursor; + if (paxisbutton->getMouseMode() == naxisbutton->getMouseMode()) - { resultMode = paxisbutton->getMouseMode(); - } return resultMode; } @@ -1098,9 +1075,7 @@ int JoyAxis::getButtonsPresetSpringWidth() int presetSpringWidth = 0; if (paxisbutton->getSpringWidth() == naxisbutton->getSpringWidth()) - { presetSpringWidth = paxisbutton->getSpringWidth(); - } return presetSpringWidth; } @@ -1112,9 +1087,7 @@ int JoyAxis::getButtonsPresetSpringHeight() int presetSpringHeight = 0; if (paxisbutton->getSpringHeight() == naxisbutton->getSpringHeight()) - { presetSpringHeight = paxisbutton->getSpringHeight(); - } return presetSpringHeight; } @@ -1134,9 +1107,7 @@ double JoyAxis::getButtonsPresetSensitivity() double presetSensitivity = 1.0; if (qFuzzyCompare(paxisbutton->getSensitivity(), naxisbutton->getSensitivity())) - { presetSensitivity = paxisbutton->getSensitivity(); - } return presetSensitivity; } @@ -1149,13 +1120,13 @@ JoyAxisButton* JoyAxis::getAxisButtonByValue(int value) int throttledValue = calculateThrottledValue(value); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "throttledValue in getAxisButtonByValue is: " << throttledValue; + qDebug() << "throttledValue in getAxisButtonByValue is: " << throttledValue; #endif if (throttledValue > deadZone) { #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "throtted value is positive"; + qDebug() << "throtted value is positive"; #endif eventbutton = paxisbutton; @@ -1195,16 +1166,16 @@ void JoyAxis::setButtonsWheelSpeedX(int value) { qInstallMessageHandler(MessageHandler::myMessageOutput); - paxisbutton->setWheelSpeedX(value); - naxisbutton->setWheelSpeedX(value); + paxisbutton->setWheelSpeed(value, 'X'); + naxisbutton->setWheelSpeed(value, 'X'); } void JoyAxis::setButtonsWheelSpeedY(int value) { qInstallMessageHandler(MessageHandler::myMessageOutput); - paxisbutton->setWheelSpeedY(value); - naxisbutton->setWheelSpeedY(value); + paxisbutton->setWheelSpeed(value, 'Y'); + naxisbutton->setWheelSpeed(value, 'Y'); } void JoyAxis::setDefaultAxisName(QString tempname) @@ -1242,6 +1213,7 @@ QString JoyAxis::getPartialName(bool forceFullFormat, bool displayNames) { label.append(trUtf8("Axis")).append(" "); } + label.append(defaultAxisName); } else @@ -1257,21 +1229,21 @@ QString JoyAxis::getXmlName() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->xmlName; + return GlobalVariables::JoyAxis::xmlName; } int JoyAxis::getDefaultDeadZone() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->AXISDEADZONE; + return GlobalVariables::JoyAxis::AXISDEADZONE; } int JoyAxis::getDefaultMaxZone() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->AXISMAXZONE; + return GlobalVariables::JoyAxis::AXISMAXZONE; } JoyAxis::ThrottleTypes JoyAxis::getDefaultThrottle() @@ -1285,7 +1257,7 @@ SetJoystick* JoyAxis::getParentSet() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return parentSet; + return m_parentSet; } void JoyAxis::establishPropertyUpdatedConnection() @@ -1317,9 +1289,7 @@ bool JoyAxis::isRelativeSpring() bool relative = false; if (paxisbutton->isRelativeSpring() == naxisbutton->isRelativeSpring()) - { relative = paxisbutton->isRelativeSpring(); - } return relative; } @@ -1328,16 +1298,17 @@ void JoyAxis::performCalibration(int value) { qInstallMessageHandler(MessageHandler::myMessageOutput); - InputDevice *device = parentSet->getInputDevice(); + InputDevice *device = m_parentSet->getInputDevice(); + if (value <= -30000) { // Assume axis is a trigger. Set default throttle to Positive. - device->setCalibrationThrottle(index, PositiveThrottle); + device->setCalibrationThrottle(m_index, PositiveThrottle); } else { // Ensure that default throttle is used when a device is reset. - device->setCalibrationThrottle(index, + device->setCalibrationThrottle(m_index, static_cast(throttle)); } } @@ -1354,9 +1325,7 @@ void JoyAxis::copyAssignments(JoyAxis *destAxis) naxisbutton->copyAssignments(destAxis->naxisbutton); if (!destAxis->isDefault()) - { emit propertyUpdated(); - } } void JoyAxis::setButtonsEasingDuration(double value) @@ -1371,7 +1340,8 @@ double JoyAxis::getButtonsEasingDuration() { qInstallMessageHandler(MessageHandler::myMessageOutput); - double result = JoyButton::DEFAULTEASINGDURATION; + double result = GlobalVariables::JoyButton::DEFAULTEASINGDURATION; + if (qFuzzyCompare(paxisbutton->getEasingDuration(), naxisbutton->getEasingDuration())) { result = paxisbutton->getEasingDuration(); @@ -1439,6 +1409,7 @@ JoyButton::JoyExtraAccelerationCurve JoyAxis::getExtraAccelerationCurve() qInstallMessageHandler(MessageHandler::myMessageOutput); JoyButton::JoyExtraAccelerationCurve result = JoyButton::LinearAccelCurve; + if (paxisbutton->getExtraAccelerationCurve() == naxisbutton->getExtraAccelerationCurve()) { result = paxisbutton->getExtraAccelerationCurve(); @@ -1478,7 +1449,7 @@ void JoyAxis::setAxisMinCal(int value) { int JoyAxis::getAxisMinCal() { - return ((axis_min_cal != -1) ? axis_min_cal : JoyAxis::AXISMIN); + return ((axis_min_cal != -1) ? axis_min_cal : GlobalVariables::JoyAxis::AXISMIN); } void JoyAxis::setAxisMaxCal(int value) { @@ -1488,7 +1459,7 @@ void JoyAxis::setAxisMaxCal(int value) { int JoyAxis::getAxisMaxCal() { - return ((axis_max_cal != -1) ? axis_max_cal : JoyAxis::AXISMAX); + return ((axis_max_cal != -1) ? axis_max_cal : GlobalVariables::JoyAxis::AXISMAX); } void JoyAxis::setAxisCenterCal(int value) { diff --git a/src/joyaxis.h b/src/joyaxis.h old mode 100644 new mode 100755 index 5199f3118..a4d913119 --- a/src/joyaxis.h +++ b/src/joyaxis.h @@ -155,17 +155,8 @@ class JoyAxis : public QObject virtual void eventReset(); - // Define default values for many properties. - static const int AXISMIN; - static const int AXISMAX; - static const int AXISDEADZONE; - static const int AXISMAXZONE; static const ThrottleTypes DEFAULTTHROTTLE; - static const float JOYSPEED; - - static const QString xmlName; - protected: void createDeskEvent(bool ignoresets = false); void adjustRange(); @@ -189,7 +180,7 @@ class JoyAxis : public QObject int currentRawValue; int currentThrottledValue; int currentThrottledDeadValue; - int index; + int m_index; int axis_center_cal; int axis_min_cal; int axis_max_cal; @@ -225,11 +216,11 @@ public slots: bool eventActive; JoyAxisButton *activeButton; - int originset; + int m_originset; - JoyControlStick *stick; + JoyControlStick *m_stick; - SetJoystick *parentSet; + SetJoystick *m_parentSet; int lastKnownThottledValue; int lastKnownRawValue; @@ -237,6 +228,7 @@ public slots: bool pendingEvent; bool pendingIgnoreSets; + void resetPrivateVars(); }; #endif // JOYAXIS_H diff --git a/src/joyaxiscontextmenu.cpp b/src/joyaxiscontextmenu.cpp old mode 100644 new mode 100755 index 6c5548188..52e17b463 --- a/src/joyaxiscontextmenu.cpp +++ b/src/joyaxiscontextmenu.cpp @@ -27,7 +27,6 @@ #include #include - JoyAxisContextMenu::JoyAxisContextMenu(JoyAxis *axis, QWidget *parent) : QMenu(parent), helper(axis) @@ -56,118 +55,119 @@ void JoyAxisContextMenu::buildMenu() PadderCommon::inputDaemonMutex.unlock(); - if (actAsTrigger) - { - buildTriggerMenu(); - } - else - { - buildAxisMenu(); - } + if (actAsTrigger)buildTriggerMenu(); + else buildAxisMenu(); } void JoyAxisContextMenu::buildAxisMenu() { qInstallMessageHandler(MessageHandler::myMessageOutput); - QAction *action = nullptr; - QActionGroup *presetGroup = new QActionGroup(this); int presetMode = 0; int currentPreset = getPresetIndex(); - action = this->addAction(trUtf8("Mouse (Horizontal)")); + QAction *action = this->addAction(trUtf8("Mouse (Horizontal)")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); + connect(action, &QAction::triggered, this, [this, action]() { setAxisPreset(action); }); presetGroup->addAction(action); - presetMode++; + action = this->addAction(trUtf8("Mouse (Inverted Horizontal)")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); + connect(action, &QAction::triggered, this, [this, action]() { setAxisPreset(action); }); presetGroup->addAction(action); - presetMode++; + action = this->addAction(trUtf8("Mouse (Vertical)")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); + connect(action, &QAction::triggered, this, [this, action]() { setAxisPreset(action); }); presetGroup->addAction(action); - presetMode++; + action = this->addAction(trUtf8("Mouse (Inverted Vertical)")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); + connect(action, &QAction::triggered, this, [this, action]() { setAxisPreset(action); }); presetGroup->addAction(action); - presetMode++; + action = this->addAction(trUtf8("Arrows: Up | Down")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); + connect(action, &QAction::triggered, this, [this, action]() { setAxisPreset(action); }); presetGroup->addAction(action); - presetMode++; + action = this->addAction(trUtf8("Arrows: Left | Right")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); + connect(action, &QAction::triggered, this, [this, action]() { setAxisPreset(action); }); presetGroup->addAction(action); - presetMode++; + action = this->addAction(trUtf8("Keys: W | S")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); + connect(action, &QAction::triggered, this, [this, action]() { setAxisPreset(action); }); presetGroup->addAction(action); - presetMode++; + action = this->addAction(trUtf8("Keys: A | D")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); + connect(action, &QAction::triggered, this, [this, action]() { setAxisPreset(action); }); presetGroup->addAction(action); - presetMode++; + action = this->addAction(trUtf8("NumPad: KP_8 | KP_2")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); + connect(action, &QAction::triggered, this, [this, action]() { setAxisPreset(action); }); @@ -184,12 +184,13 @@ void JoyAxisContextMenu::buildAxisMenu() }); presetGroup->addAction(action); - presetMode++; + action = this->addAction(trUtf8("None")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); + connect(action, &QAction::triggered, this, [this, action]() { setAxisPreset(action); }); @@ -200,6 +201,7 @@ void JoyAxisContextMenu::buildAxisMenu() action = this->addAction(trUtf8("Mouse Settings")); action->setCheckable(false); + connect(action, &QAction::triggered, this, &JoyAxisContextMenu::openMouseSettingsDialog); } @@ -217,6 +219,7 @@ int JoyAxisContextMenu::getPresetIndex() { JoyButtonSlot *nslot = naxisslots->at(0); JoyButtonSlot *pslot = paxisslots->at(0); + if ((nslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement) && (nslot->getSlotCode() == JoyButtonSlot::MouseLeft) && (pslot->getSlotMode() == JoyButtonSlot::JoyMouseMovement) && (pslot->getSlotCode() == JoyButtonSlot::MouseRight)) { @@ -287,59 +290,61 @@ void JoyAxisContextMenu::setAxisPreset(QAction* action) JoyButtonSlot *nbuttonslot = nullptr; JoyButtonSlot *pbuttonslot = nullptr; - if (item == 0) - { - nbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - } - else if (item == 1) - { - nbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - } - else if (item == 2) - { - nbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - } - else if (item == 3) - { - nbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - } - else if (item == 4) + switch(item) { - nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Up), Qt::Key_Up, JoyButtonSlot::JoyKeyboard, this); - pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Down), Qt::Key_Down, JoyButtonSlot::JoyKeyboard, this); - } - else if (item == 5) - { - nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Left), Qt::Key_Left, JoyButtonSlot::JoyKeyboard, this); - pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Right), Qt::Key_Right, JoyButtonSlot::JoyKeyboard, this); - } - else if (item == 6) - { - nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_W), Qt::Key_W, JoyButtonSlot::JoyKeyboard, this); - pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_S), Qt::Key_S, JoyButtonSlot::JoyKeyboard, this); - } - else if (item == 7) - { - nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_A), Qt::Key_A, JoyButtonSlot::JoyKeyboard, this); - pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_D), Qt::Key_D, JoyButtonSlot::JoyKeyboard, this); - } - else if (item == 8) - { - nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); - pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); - } - else if (item == 9) - { - nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); - pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); - } - else if (item == 10) - { - QMetaObject::invokeMethod(&helper, "clearAndResetAxisButtons", Qt::BlockingQueuedConnection); + case 0: + nbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + break; + + case 1: + nbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + break; + + case 2: + nbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + break; + + case 3: + nbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + break; + + case 4: + nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Up), Qt::Key_Up, JoyButtonSlot::JoyKeyboard, this); + pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Down), Qt::Key_Down, JoyButtonSlot::JoyKeyboard, this); + break; + + case 5: + nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Left), Qt::Key_Left, JoyButtonSlot::JoyKeyboard, this); + pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Right), Qt::Key_Right, JoyButtonSlot::JoyKeyboard, this); + break; + + case 6: + nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_W), Qt::Key_W, JoyButtonSlot::JoyKeyboard, this); + pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_S), Qt::Key_S, JoyButtonSlot::JoyKeyboard, this); + break; + + case 7: + nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_A), Qt::Key_A, JoyButtonSlot::JoyKeyboard, this); + pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_D), Qt::Key_D, JoyButtonSlot::JoyKeyboard, this); + break; + + case 8: + nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); + pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); + break; + + case 9: + nbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); + pbuttonslot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); + break; + + case 10: + QMetaObject::invokeMethod(&helper, "clearAndResetAxisButtons", Qt::BlockingQueuedConnection); + break; } if (nbuttonslot != nullptr) @@ -375,38 +380,39 @@ void JoyAxisContextMenu::buildTriggerMenu() { qInstallMessageHandler(MessageHandler::myMessageOutput); - QAction *action = nullptr; - QActionGroup *presetGroup = new QActionGroup(this); int presetMode = 0; int currentPreset = getTriggerPresetIndex(); - action = this->addAction(trUtf8("Left Mouse Button")); + QAction *action = this->addAction(trUtf8("Left Mouse Button")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); + connect(action, &QAction::triggered, this, [this, action]() { setTriggerPreset(action); }); presetGroup->addAction(action); - presetMode++; + action = this->addAction(trUtf8("Right Mouse Button")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); + connect(action, &QAction::triggered, this, [this, action]() { setTriggerPreset(action); }); presetGroup->addAction(action); - presetMode++; + action = this->addAction(trUtf8("None")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); + connect(action, &QAction::triggered, this, [this, action]() { setTriggerPreset(action); }); @@ -434,6 +440,7 @@ int JoyAxisContextMenu::getTriggerPresetIndex() if (paxisslots->length() == 1) { JoyButtonSlot *pslot = paxisslots->at(0); + if ((pslot->getSlotMode() == JoyButtonSlot::JoyMouseButton) && (pslot->getSlotCode() == JoyButtonSlot::MouseLB)) { @@ -463,20 +470,23 @@ void JoyAxisContextMenu::setTriggerPreset(QAction* action) JoyButtonSlot *pbuttonslot = nullptr; - if (item == 0) - { - pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseLB, JoyButtonSlot::JoyMouseButton, this); - } - else if (item == 1) - { - pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseRB, JoyButtonSlot::JoyMouseButton, this); - } - else if (item == 2) + switch(item) { - JoyAxisButton *pbutton = axis->getPAxisButton(); - QMetaObject::invokeMethod(pbutton, "clearSlotsEventReset", Qt::BlockingQueuedConnection); + case 0: + pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseLB, JoyButtonSlot::JoyMouseButton, this); + break; + + case 1: + pbuttonslot = new JoyButtonSlot(JoyButtonSlot::MouseRB, JoyButtonSlot::JoyMouseButton, this); + break; + + case 2: + JoyAxisButton *pbutton = axis->getPAxisButton(); + QMetaObject::invokeMethod(pbutton, "clearSlotsEventReset", Qt::BlockingQueuedConnection); + break; } + if (pbuttonslot != nullptr) { QMetaObject::invokeMethod(&helper, "setPAssignedSlot", Qt::BlockingQueuedConnection, diff --git a/src/joyaxiscontextmenu.h b/src/joyaxiscontextmenu.h old mode 100644 new mode 100755 diff --git a/src/joyaxiswidget.cpp b/src/joyaxiswidget.cpp old mode 100644 new mode 100755 index af97c3c23..71c144cf7 --- a/src/joyaxiswidget.cpp +++ b/src/joyaxiswidget.cpp @@ -23,13 +23,12 @@ #include - JoyAxisWidget::JoyAxisWidget(JoyAxis *axis, bool displayNames, QWidget *parent) : FlashButtonWidget(displayNames, parent) { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->axis = axis; + m_axis = axis; refreshLabel(); enableFlashes(); @@ -37,19 +36,19 @@ JoyAxisWidget::JoyAxisWidget(JoyAxis *axis, bool displayNames, QWidget *parent) this->setContextMenuPolicy(Qt::CustomContextMenu); connect(this, &JoyAxisWidget::customContextMenuRequested, this, &JoyAxisWidget::showContextMenu); - JoyAxisButton *nAxisButton = axis->getNAxisButton(); - JoyAxisButton *pAxisButton = axis->getPAxisButton(); + JoyAxisButton *nAxisButton = m_axis->getNAxisButton(); + JoyAxisButton *pAxisButton = m_axis->getPAxisButton(); tryFlash(); - connect(axis, &JoyAxis::throttleChanged, this, &JoyAxisWidget::refreshLabel); - connect(axis, &JoyAxis::axisNameChanged, this, &JoyAxisWidget::refreshLabel); + connect(m_axis, &JoyAxis::throttleChanged, this, &JoyAxisWidget::refreshLabel); + connect(m_axis, &JoyAxis::axisNameChanged, this, &JoyAxisWidget::refreshLabel); connect(nAxisButton, &JoyAxisButton::propertyUpdated, this, &JoyAxisWidget::refreshLabel); connect(pAxisButton, &JoyAxisButton::propertyUpdated, this, &JoyAxisWidget::refreshLabel); connect(nAxisButton, &JoyAxisButton::activeZoneChanged, this, &JoyAxisWidget::refreshLabel); connect(pAxisButton, &JoyAxisButton::activeZoneChanged, this, &JoyAxisWidget::refreshLabel); - axis->establishPropertyUpdatedConnection(); + m_axis->establishPropertyUpdatedConnection(); nAxisButton->establishPropertyUpdatedConnections(); pAxisButton->establishPropertyUpdatedConnections(); } @@ -58,15 +57,15 @@ JoyAxis* JoyAxisWidget::getAxis() const { qInstallMessageHandler(MessageHandler::myMessageOutput); - return axis; + return m_axis; } void JoyAxisWidget::disableFlashes() { qInstallMessageHandler(MessageHandler::myMessageOutput); - disconnect(axis, &JoyAxis::active, this, &JoyAxisWidget::flash); - disconnect(axis, &JoyAxis::released, this, &JoyAxisWidget::unflash); + disconnect(m_axis, &JoyAxis::active, this, &JoyAxisWidget::flash); + disconnect(m_axis, &JoyAxis::released, this, &JoyAxisWidget::unflash); this->unflash(); } @@ -74,8 +73,8 @@ void JoyAxisWidget::enableFlashes() { qInstallMessageHandler(MessageHandler::myMessageOutput); - connect(axis, &JoyAxis::active, this, &JoyAxisWidget::flash, Qt::QueuedConnection); - connect(axis, &JoyAxis::released, this, &JoyAxisWidget::unflash, Qt::QueuedConnection); + connect(m_axis, &JoyAxis::active, this, &JoyAxisWidget::flash, Qt::QueuedConnection); + connect(m_axis, &JoyAxis::released, this, &JoyAxisWidget::unflash, Qt::QueuedConnection); } /** @@ -86,11 +85,10 @@ QString JoyAxisWidget::generateLabel() { qInstallMessageHandler(MessageHandler::myMessageOutput); - QString temp = QString(); - temp = axis->getName(false, ifDisplayNames()).replace("&", "&&"); + QString temp = m_axis->getName(false, ifDisplayNames()).replace("&", "&&"); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Name of joy axis is: " << temp; + qDebug() << "Name of joy axis is: " << temp; #endif return temp; @@ -101,7 +99,7 @@ void JoyAxisWidget::showContextMenu(const QPoint &point) qInstallMessageHandler(MessageHandler::myMessageOutput); QPoint globalPos = this->mapToGlobal(point); - JoyAxisContextMenu *contextMenu = new JoyAxisContextMenu(axis, this); + JoyAxisContextMenu *contextMenu = new JoyAxisContextMenu(m_axis, this); contextMenu->buildMenu(); contextMenu->popup(globalPos); } @@ -110,8 +108,8 @@ void JoyAxisWidget::tryFlash() { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyAxisButton *nAxisButton = axis->getNAxisButton(); - JoyAxisButton *pAxisButton = axis->getPAxisButton(); + JoyAxisButton *nAxisButton = m_axis->getNAxisButton(); + JoyAxisButton *pAxisButton = m_axis->getPAxisButton(); if (nAxisButton->getButtonState() || pAxisButton->getButtonState()) { diff --git a/src/joyaxiswidget.h b/src/joyaxiswidget.h old mode 100644 new mode 100755 index ffc6c9d10..a316c648e --- a/src/joyaxiswidget.h +++ b/src/joyaxiswidget.h @@ -38,17 +38,17 @@ class JoyAxisWidget : public FlashButtonWidget void tryFlash(); protected: - virtual QString generateLabel(); + virtual QString generateLabel() override; public slots: - void disableFlashes(); - void enableFlashes(); + void disableFlashes() override; + void enableFlashes() override; private slots: void showContextMenu(const QPoint &point); private: - JoyAxis *axis; + JoyAxis *m_axis; }; #endif // JOYAXISWIDGET_H diff --git a/src/joybutton.cpp b/src/joybutton.cpp old mode 100644 new mode 100755 index 7660694a3..a281b6845 --- a/src/joybutton.cpp +++ b/src/joybutton.cpp @@ -29,68 +29,19 @@ #include "eventhandlerfactory.h" #endif -#include - #include #include -#include #include #include #include #include -const QString JoyButton::xmlName = "button"; - -// Set default values for many properties. -const int JoyButton::ENABLEDTURBODEFAULT = 100; -const double JoyButton::DEFAULTMOUSESPEEDMOD = 1.0; -double JoyButton::mouseSpeedModifier = JoyButton::DEFAULTMOUSESPEEDMOD; -const int JoyButton::DEFAULTKEYREPEATDELAY = 600; // 600 ms -const int JoyButton::DEFAULTKEYREPEATRATE = 40; // 40 ms. 25 times per second const JoyButton::JoyMouseCurve JoyButton::DEFAULTMOUSECURVE = JoyButton::EnhancedPrecisionCurve; -const bool JoyButton::DEFAULTTOGGLE = false; -const int JoyButton::DEFAULTTURBOINTERVAL = 0; -const bool JoyButton::DEFAULTUSETURBO = false; -const int JoyButton::DEFAULTMOUSESPEEDX = 50; -const int JoyButton::DEFAULTMOUSESPEEDY = 50; -const int JoyButton::DEFAULTSETSELECTION = -1; const JoyButton::SetChangeCondition JoyButton::DEFAULTSETCONDITION = JoyButton::SetChangeDisabled; const JoyButton::JoyMouseMovementMode JoyButton::DEFAULTMOUSEMODE = JoyButton::MouseCursor; -const int JoyButton::DEFAULTSPRINGWIDTH = 0; -const int JoyButton::DEFAULTSPRINGHEIGHT = 0; -const double JoyButton::DEFAULTSENSITIVITY = 1.0; -const int JoyButton::DEFAULTWHEELX = 20; -const int JoyButton::DEFAULTWHEELY = 20; -const bool JoyButton::DEFAULTCYCLERESETACTIVE = false; -const int JoyButton::DEFAULTCYCLERESET = 0; -const bool JoyButton::DEFAULTRELATIVESPRING = false; const JoyButton::TurboMode JoyButton::DEFAULTTURBOMODE = JoyButton::NormalTurbo; -const double JoyButton::DEFAULTEASINGDURATION = 0.5; -const double JoyButton::MINIMUMEASINGDURATION = 0.2; -const double JoyButton::MAXIMUMEASINGDURATION = 5.0; -const int JoyButton::MINCYCLERESETTIME = 10; -const int JoyButton::MAXCYCLERESETTIME = 60000; - -const int JoyButton::DEFAULTMOUSEHISTORYSIZE = 10; -const double JoyButton::DEFAULTWEIGHTMODIFIER = 0.2; -const int JoyButton::MAXIMUMMOUSEHISTORYSIZE = 100; -const double JoyButton::MAXIMUMWEIGHTMODIFIER = 1.0; -const int JoyButton::MAXIMUMMOUSEREFRESHRATE = 16; -int JoyButton::IDLEMOUSEREFRESHRATE = (5 * 20); -const int JoyButton::DEFAULTIDLEMOUSEREFRESHRATE = 100; -const double JoyButton::DEFAULTEXTRACCELVALUE = 2.0; -const double JoyButton::DEFAULTMINACCELTHRESHOLD = 10.0; -const double JoyButton::DEFAULTMAXACCELTHRESHOLD = 100.0; -const double JoyButton::DEFAULTSTARTACCELMULTIPLIER = 0.0; -const double JoyButton::DEFAULTACCELEASINGDURATION = 0.1; -const JoyButton::JoyExtraAccelerationCurve -JoyButton::DEFAULTEXTRAACCELCURVE = JoyButton::LinearAccelCurve; - -const int JoyButton::DEFAULTSPRINGRELEASERADIUS = 0; - -// Keep references to active keys and mouse buttons. -QHash JoyButton::activeKeys; -QHash JoyButton::activeMouseButtons; +const JoyButton::JoyExtraAccelerationCurve JoyButton::DEFAULTEXTRAACCELCURVE = JoyButton::LinearAccelCurve; + JoyButtonSlot* JoyButton::lastActiveKey = nullptr; // Keep track of active Mouse Speed Mod slots. @@ -114,26 +65,10 @@ JoyButtonMouseHelper JoyButton::mouseHelper; QTimer JoyButton::staticMouseEventTimer; QList JoyButton::pendingMouseButtons; -// History buffers used for mouse smoothing routine. -QList JoyButton::mouseHistoryX; -QList JoyButton::mouseHistoryY; - -// Carry over remainder of a cursor move for the next mouse event. -double JoyButton::cursorRemainderX = 0.0; -double JoyButton::cursorRemainderY = 0.0; - -double JoyButton::weightModifier = 0; -int JoyButton::mouseHistorySize = 1; - -int JoyButton::mouseRefreshRate = 5; -int JoyButton::springModeScreen = -1; -int JoyButton::gamepadRefreshRate = 10; - #ifdef Q_OS_WIN JoyKeyRepeatHelper JoyButton::repeatHelper; #endif -static const double PI = acos(-1.0); JoyButton::JoyButton(int index, int originset, SetJoystick *parentSet, QObject *parent) : @@ -145,7 +80,7 @@ JoyButton::JoyButton(int index, int originset, SetJoystick *parentSet, qDebug() << "Thread in Joybutton"; #endif - vdpad = nullptr; + m_vdpad = nullptr; slotiter = nullptr; turboTimer.setParent(this); @@ -161,10 +96,9 @@ JoyButton::JoyButton(int index, int originset, SetJoystick *parentSet, delayTimer.setParent(this); slotSetChangeTimer.setParent(this); activeZoneTimer.setParent(this); - setChangeTimer.setSingleShot(true); slotSetChangeTimer.setSingleShot(true); - this->parentSet = parentSet; + m_parentSet = parentSet; connect(&pauseWaitTimer, &QTimer::timeout, this, &JoyButton::pauseWaitEvent); connect(&keyPressTimer, &QTimer::timeout, this, &JoyButton::keyPressEvent); @@ -186,11 +120,10 @@ JoyButton::JoyButton(int index, int originset, SetJoystick *parentSet, establishMouseTimerConnections(); // Make sure to call before calling reset - this->resetProperties(); - - this->index = index; - this->originset = originset; + resetAllProperties(); + m_index = index; + m_originset = originset; quitEvent = true; } @@ -198,27 +131,17 @@ JoyButton::~JoyButton() { qInstallMessageHandler(MessageHandler::myMessageOutput); - reset(); + resetPrivVars(); } void JoyButton::queuePendingEvent(bool pressed, bool ignoresets) { qInstallMessageHandler(MessageHandler::myMessageOutput); - pendingEvent = false; - pendingPress = false; - pendingIgnoreSets = false; + updatePendingParams(false, false, false); - if (this->vdpad != nullptr) - { - vdpadPassEvent(pressed, ignoresets); - } - else - { - pendingEvent = true; - pendingPress = pressed; - pendingIgnoreSets = ignoresets; - } + if (m_vdpad != nullptr) vdpadPassEvent(pressed, ignoresets); + else updatePendingParams(true, pressed, ignoresets); } void JoyButton::activatePendingEvent() @@ -228,10 +151,7 @@ void JoyButton::activatePendingEvent() if (pendingEvent) { joyEvent(pendingPress, pendingIgnoreSets); - - pendingEvent = false; - pendingPress = false; - pendingIgnoreSets = false; + updatePendingParams(false, false, false); } } @@ -246,35 +166,22 @@ void JoyButton::clearPendingEvent() { qInstallMessageHandler(MessageHandler::myMessageOutput); - pendingEvent = false; - pendingPress = false; - pendingIgnoreSets = false; + updatePendingParams(false, false, false); } void JoyButton::vdpadPassEvent(bool pressed, bool ignoresets) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((this->vdpad != nullptr) && (pressed != isButtonPressed)) + if ((m_vdpad != nullptr) && (pressed != isButtonPressed)) { isButtonPressed = pressed; - if (isButtonPressed) - { - emit clicked(index); - } - else - { - emit released(index); - } - if (!ignoresets) - { - this->vdpad->queueJoyEvent(ignoresets); - } - else - { - this->vdpad->joyEvent(pressed, ignoresets); - } + if (isButtonPressed) emit clicked(m_index); + else emit released(m_index); + + if (!ignoresets) m_vdpad->queueJoyEvent(ignoresets); + else m_vdpad->joyEvent(pressed, ignoresets); } } @@ -282,24 +189,15 @@ void JoyButton::joyEvent(bool pressed, bool ignoresets) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((this->vdpad != nullptr) && !pendingEvent) + if ((m_vdpad != nullptr) && !pendingEvent) { vdpadPassEvent(pressed, ignoresets); } - else if (ignoreEvents) + else if (ignoreEvents && (pressed != isButtonPressed)) { - if (pressed != isButtonPressed) - { - isButtonPressed = pressed; - if (isButtonPressed) - { - emit clicked(index); - } - else - { - emit released(index); - } - } + isButtonPressed = pressed; + if (isButtonPressed) emit clicked(m_index); + else emit released(m_index); } else { @@ -307,29 +205,26 @@ void JoyButton::joyEvent(bool pressed, bool ignoresets) { if (pressed) { - emit clicked(index); + emit clicked(m_index); if (updateInitAccelValues) - { - oldAccelMulti = updateOldAccelMulti = 0.0; - accelTravel = 0.0; - } + oldAccelMulti = updateOldAccelMulti = accelTravel = 0.0; } else { - emit released(index); + emit released(m_index); } bool activePress = pressed; setChangeTimer.stop(); - if (toggle && pressed) + if (m_toggle && pressed) { isDown = true; toggleActiveState = !toggleActiveState; if (!isButtonPressed) { - this->ignoresets = ignoresets; + m_ignoresets = ignoresets; isButtonPressed = !isButtonPressed; ignoreSetQueue.enqueue(ignoresets); @@ -340,13 +235,13 @@ void JoyButton::joyEvent(bool pressed, bool ignoresets) activePress = false; } } - else if (toggle && !pressed && isDown) + else if (m_toggle && !pressed && isDown) { isDown = false; if (!toggleActiveState) { - this->ignoresets = ignoresets; + m_ignoresets = ignoresets; isButtonPressed = !isButtonPressed; ignoreSetQueue.enqueue(ignoresets); @@ -355,168 +250,123 @@ void JoyButton::joyEvent(bool pressed, bool ignoresets) } else { - this->ignoresets = ignoresets; + m_ignoresets = ignoresets; isButtonPressed = isDown = pressed; ignoreSetQueue.enqueue(ignoresets); isButtonPressedQueue.enqueue(isButtonPressed); } - if (useTurbo) + if (m_useTurbo) { if (isButtonPressed && activePress && !turboTimer.isActive()) { - if (cycleResetActive && - (cycleResetHold.elapsed() >= cycleResetInterval) && (slotiter != nullptr)) - { - slotiter->toFront(); - currentCycle = nullptr; - previousCycle = nullptr; - } - - buttonHold.restart(); - buttonHeldRelease.restart(); - keyPressHold.restart(); - cycleResetHold.restart(); - turboTimer.start(); - - // Newly activated button. Just entered safe zone. - if (updateInitAccelValues) - { - initializeDistanceValues(); - } - currentAccelerationDistance = getAccelerationDistance(); - - Logger::LogDebug(trUtf8("Processing turbo for #%1 - %2") - .arg(parentSet->getInputDevice()->getRealJoyNumber()) - .arg(getPartialName())); - + startSequenceOfPressActive(true, trUtf8("Processing turbo for #%1 - %2")); turboEvent(); } else if (!isButtonPressed && !activePress && turboTimer.isActive()) { turboTimer.stop(); Logger::LogDebug(trUtf8("Finishing turbo for button #%1 - %2") - .arg(parentSet->getInputDevice()->getRealJoyNumber()) + .arg(m_parentSet->getInputDevice()->getRealJoyNumber()) .arg(getPartialName())); - if (isKeyPressed) - { - turboEvent(); - } - else - { - lastDistance = getMouseDistanceFromDeadZone(); - } + if (isKeyPressed) turboEvent(); + else lastDistance = getMouseDistanceFromDeadZone(); activeZoneTimer.start(); } } // Toogle is enabled and a controller button change has occurred. // Switch to a different distance zone if appropriate - else if (toggle && !activePress && isButtonPressed) + else if (m_toggle && !activePress && isButtonPressed) { - bool releasedCalled = distanceEvent(); - if (releasedCalled) - { - quitEvent = true; - buttonHold.restart(); - buttonHeldRelease.restart(); - keyPressHold.restart(); - releaseDeskTimer.stop(); - if (!keyPressTimer.isActive()) - { - waitForDeskEvent(); - } - } + updateParamsAfterDistEvent(); } else if (isButtonPressed && activePress) { - if (cycleResetActive && - (cycleResetHold.elapsed() >= cycleResetInterval) && (slotiter != nullptr)) - { - slotiter->toFront(); - currentCycle = nullptr; - previousCycle = nullptr; - } - - buttonHold.restart(); - buttonHeldRelease.restart(); - cycleResetHold.restart(); - keyPressHold.restart(); - releaseDeskTimer.stop(); - - // Newly activated button. Just entered safe zone. - if (updateInitAccelValues) - { - initializeDistanceValues(); - } - - currentAccelerationDistance = getAccelerationDistance(); - - Logger::LogDebug(trUtf8("Processing press for button #%1 - %2") - .arg(parentSet->getInputDevice()->getRealJoyNumber()) - .arg(getPartialName())); + startSequenceOfPressActive(false, trUtf8("Processing press for button #%1 - %2")); if (!keyPressTimer.isActive()) { checkForPressedSetChange(); - if (!setChangeTimer.isActive()) - { - waitForDeskEvent(); - } - } - + if (!setChangeTimer.isActive()) waitForDeskEvent(); + } } else if (!isButtonPressed && !activePress) { Logger::LogDebug(trUtf8("Processing release for button #%1 - %2") - .arg(parentSet->getInputDevice()->getRealJoyNumber()) + .arg(m_parentSet->getInputDevice()->getRealJoyNumber()) .arg(getPartialName())); waitForReleaseDeskEvent(); } - if (updateInitAccelValues) - { - updateLastMouseDistance = false; - updateStartingMouseDistance = false; - updateOldAccelMulti = 0.0; - } - + if (updateInitAccelValues) updateMouseParams(false, false, 0.0); } - else if (!useTurbo && isButtonPressed) + else if (!m_useTurbo && isButtonPressed) { resetAccelerationDistances(); currentAccelerationDistance = getAccelerationDistance(); if (!setChangeTimer.isActive()) - { - bool releasedCalled = distanceEvent(); - if (releasedCalled) - { - Logger::LogDebug(trUtf8("Distance change for button #%1 - %2") - .arg(parentSet->getInputDevice()->getRealJoyNumber()) - .arg(getPartialName())); - - quitEvent = true; - buttonHold.restart(); - buttonHeldRelease.restart(); - keyPressHold.restart(); - releaseDeskTimer.stop(); - if (!keyPressTimer.isActive()) - { - waitForDeskEvent(); - } - } - } + updateParamsAfterDistEvent(); } } updateInitAccelValues = true; } + +void JoyButton::updateParamsAfterDistEvent() +{ + if (distanceEvent()) + { + Logger::LogDebug(trUtf8("Distance change for button #%1 - %2") + .arg(m_parentSet->getInputDevice()->getRealJoyNumber()) + .arg(getPartialName())); + + quitEvent = true; + buttonHold.restart(); + buttonHeldRelease.restart(); + keyPressHold.restart(); + releaseDeskTimer.stop(); + + if (!keyPressTimer.isActive()) waitForDeskEvent(); + } +} + + +void JoyButton::startSequenceOfPressActive(bool isTurbo, QString debugText) +{ + if (cycleResetActive && + (cycleResetHold.elapsed() >= cycleResetInterval) && (slotiter != nullptr)) + { + slotiter->toFront(); + currentCycle = nullptr; + previousCycle = nullptr; + } + + buttonHold.restart(); + buttonHeldRelease.restart(); + keyPressHold.restart(); + cycleResetHold.restart(); + if (isTurbo) turboTimer.start(); + else releaseDeskTimer.stop(); + + // Newly activated button. Just entered safe zone. + if (updateInitAccelValues) initializeDistanceValues(); + + currentAccelerationDistance = getAccelerationDistance(); + + Logger::LogDebug(debugText + .arg(m_parentSet->getInputDevice()->getRealJoyNumber()) + .arg(getPartialName())); + +} + + /** * @brief Get 0 indexed number of button * @return 0 indexed button index number @@ -525,7 +375,7 @@ int JoyButton::getJoyNumber() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return index; + return m_index; } /** @@ -536,23 +386,23 @@ int JoyButton::getRealJoyNumber() const { qInstallMessageHandler(MessageHandler::myMessageOutput); - return index + 1; + return m_index + 1; } void JoyButton::setJoyNumber(int index) { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->index = index; + m_index = index; } void JoyButton::setToggle(bool toggle) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (toggle != this->toggle) + if (toggle != m_toggle) { - this->toggle = toggle; + m_toggle = toggle; emit toggleChanged(toggle); emit propertyUpdated(); } @@ -562,61 +412,32 @@ void JoyButton::setTurboInterval(int interval) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((interval >= 10) && (interval != this->turboInterval)) - { - this->turboInterval = interval; - emit turboIntervalChanged(interval); - emit propertyUpdated(); - } - else if ((interval < 10) && (interval != this->turboInterval)) + if ((interval < 10) && (interval != this->turboInterval)) { - interval = 0; this->setUseTurbo(false); - this->turboInterval = interval; - emit turboIntervalChanged(interval); - emit propertyUpdated(); + interval = 0; } + + this->turboInterval = interval; + emit turboIntervalChanged(interval); + emit propertyUpdated(); } void JoyButton::reset() { qInstallMessageHandler(MessageHandler::myMessageOutput); - disconnectPropertyUpdatedConnections(); - - turboTimer.stop(); - pauseWaitTimer.stop(); - createDeskTimer.stop(); - releaseDeskTimer.stop(); - holdTimer.stop(); - mouseWheelVerticalEventTimer.stop(); - mouseWheelHorizontalEventTimer.stop(); - setChangeTimer.stop(); - keyPressTimer.stop(); - delayTimer.stop(); - -#ifdef Q_OS_WIN - repeatHelper.getRepeatTimer()->stop(); -#endif - - slotSetChangeTimer.stop(); - - if (slotiter != nullptr) - { - delete slotiter; - slotiter = nullptr; - } + resetPrivVars(); +} +void JoyButton::resetPrivVars() +{ + disconnectPropertyUpdatedConnections(); + stopTimers(false, false, true); releaseActiveSlots(); clearAssignedSlots(); - - isButtonPressedQueue.clear(); - ignoreSetQueue.clear(); - mouseEventQueue.clear(); - mouseWheelVerticalEventQueue.clear(); - mouseWheelHorizontalEventQueue.clear(); - - resetProperties(); // quitEvent changed here + clearQueues(); + resetAllProperties(); // quitEvent changed here } void JoyButton::reset(int index) @@ -624,14 +445,14 @@ void JoyButton::reset(int index) qInstallMessageHandler(MessageHandler::myMessageOutput); JoyButton::reset(); - this->index = index; + m_index = index; } bool JoyButton::getToggleState() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return toggle; + return m_toggle; } int JoyButton::getTurboInterval() @@ -645,49 +466,38 @@ void JoyButton::turboEvent() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (!isKeyPressed) + if (!isKeyPressed) changeTurboParams(!isKeyPressed, isButtonPressed); + else changeTurboParams(isKeyPressed, isButtonPressed); +} + +void JoyButton::changeTurboParams(bool _isKeyPressed, bool isButtonPressed) +{ + if (!isButtonPressedQueue.isEmpty()) { - if (!isButtonPressedQueue.isEmpty()) + if (!_isKeyPressed) { ignoreSetQueue.clear(); isButtonPressedQueue.clear(); - - ignoreSetQueue.enqueue(false); isButtonPressedQueue.enqueue(isButtonPressed); } - - createDeskEvent(); - isKeyPressed = true; - if (turboTimer.isActive()) - { - int tempInterval = turboInterval / 2; - if (turboTimer.interval() != tempInterval) - { - turboTimer.start(tempInterval); - } - } - } - else - { - if (!isButtonPressedQueue.isEmpty()) + else { - ignoreSetQueue.enqueue(false); isButtonPressedQueue.enqueue(!isButtonPressed); } - releaseDeskEvent(); + ignoreSetQueue.enqueue(false); + } - isKeyPressed = false; - if (turboTimer.isActive()) - { - int tempInterval = turboInterval / 2; - if (turboTimer.interval() != tempInterval) - { - turboTimer.start(tempInterval); - } + if (!_isKeyPressed) createDeskEvent(); + else releaseDeskEvent(); + isKeyPressed = true; - } + if (turboTimer.isActive()) + { + int tempInterval = turboInterval / 2; + if (turboTimer.interval() != tempInterval) + turboTimer.start(tempInterval); } } @@ -701,9 +511,7 @@ bool JoyButton::distanceEvent() { QReadLocker tempLocker(&assignmentsLock); - bool distanceFound = containsDistanceSlots(); - - if (distanceFound) + if (containsDistanceSlots()) { double currentDistance = getDistanceFromDeadZone(); double tempDistance = 0.0; @@ -723,18 +531,13 @@ bool JoyButton::distanceEvent() { JoyButtonSlot *slot = iter.next(); int tempcode = slot->getSlotCode(); + if (slot->getSlotMode() == JoyButtonSlot::JoyDistance) { tempDistance += (tempcode / 100.0); - if (currentDistance < tempDistance) - { - iter.toBack(); - } - else - { - previousDistanceSlot = slot; - } + if (currentDistance < tempDistance) iter.toBack(); + else previousDistanceSlot = slot; } else if (slot->getSlotMode() == JoyButtonSlot::JoyCycle) { @@ -746,7 +549,7 @@ bool JoyButton::distanceEvent() // No applicable distance slot if (!previousDistanceSlot) { - if (this->currentDistance != nullptr) + if (m_currentDistance != nullptr) { // Distance slot is currently active. // Release slots, return iterator to @@ -759,19 +562,16 @@ bool JoyButton::distanceEvent() currentPause = currentHold = nullptr; slotiter->toFront(); - if (previousCycle != nullptr) - { - slotiter->findNext(previousCycle); - } + if (previousCycle != nullptr) slotiter->findNext(previousCycle); - this->currentDistance = nullptr; + m_currentDistance = nullptr; released = true; } } // An applicable distance slot was found else if (previousDistanceSlot) { - if (this->currentDistance != previousDistanceSlot) + if (m_currentDistance != previousDistanceSlot) { // Active distance slot is not the applicable slot. // Deactive slots in previous distance range and @@ -789,6 +589,7 @@ bool JoyButton::distanceEvent() #endif slotiter->toFront(); + if (previousCycle != nullptr) { #ifndef QT_DEBUG_NO_OUTPUT @@ -800,7 +601,7 @@ bool JoyButton::distanceEvent() slotiter->findNext(previousDistanceSlot); - this->currentDistance = previousDistanceSlot; + m_currentDistance = previousDistanceSlot; released = true; } } @@ -816,7 +617,7 @@ void JoyButton::createDeskEvent() quitEvent = false; - if (slotiter == nullptr) + if (slotiter == nullptr) { assignmentsLock.lockForRead(); slotiter = new QListIterator(*getAssignedSlots()); @@ -832,33 +633,28 @@ void JoyButton::createDeskEvent() { currentCycle = nullptr; distanceEvent(); - } assignmentsLock.lockForRead(); activateSlots(); assignmentsLock.unlock(); - if (currentCycle != nullptr) - { - quitEvent = true; - } - else if ((currentPause == nullptr) && (currentHold == nullptr) && !keyPressTimer.isActive()) - { - quitEvent = true; - } + if (currentCycle != nullptr) quitEvent = true; + else if ((currentPause == nullptr) && (currentHold == nullptr) && !keyPressTimer.isActive()) quitEvent = true; + } void JoyButton::activateSlots() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (slotiter != nullptr) + if (slotiter != nullptr) { QWriteLocker tempLocker(&activeZoneLock); bool exit = false; bool delaySequence = false; + #ifdef Q_OS_WIN bool changeRepeatState = false; #endif @@ -870,327 +666,344 @@ void JoyButton::activateSlots() int tempcode = slot->getSlotCode(); JoyButtonSlot::JoySlotInputAction mode = slot->getSlotMode(); - if (mode == JoyButtonSlot::JoyKeyboard) + switch(mode) { - i++; - - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << i << ": It's a JoyKeyboard with code: " << tempcode << " and name: " << slot->getSlotString(); - #endif - - sendevent(slot, true); - getActiveSlotsLocal().append(slot); - int oldvalue = activeKeys.value(tempcode, 0) + 1; - activeKeys.insert(tempcode, oldvalue); - if (!slot->isModifierKey()) + case JoyButtonSlot::JoyKeyboard: { - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "There has been assigned a lastActiveKey"; - #endif + i++; - lastActiveKey = slot; - #ifdef Q_OS_WIN - changeRepeatState = true; - #endif - } - else - { #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "It's not modifier key. lastActiveKey is null pointer"; + qDebug() << i << ": It's a JoyKeyboard with code: " << tempcode << " and name: " << slot->getSlotString(); #endif - lastActiveKey = nullptr; - - #ifdef Q_OS_WIN - changeRepeatState = true; - #endif - } - } - else if (mode == JoyButtonSlot::JoyMouseButton) - { - i++; - - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << i << ": It's a JoyMouseButton with code: " << tempcode << " and name: " << slot->getSlotString(); - #endif - - if ((tempcode == static_cast(JoyButtonSlot::MouseWheelUp)) || - (tempcode == static_cast(JoyButtonSlot::MouseWheelDown))) - { - slot->getMouseInterval()->restart(); - wheelVerticalTime.restart(); - currentWheelVerticalEvent = slot; - getActiveSlotsLocal().append(slot); - wheelEventVertical(); - currentWheelVerticalEvent = nullptr; - } - else if ((tempcode == static_cast(JoyButtonSlot::MouseWheelLeft)) || - (tempcode == static_cast(JoyButtonSlot::MouseWheelRight))) - { - slot->getMouseInterval()->restart(); - wheelHorizontalTime.restart(); - currentWheelHorizontalEvent = slot; - getActiveSlotsLocal().append(slot); - wheelEventHorizontal(); - currentWheelHorizontalEvent = nullptr; - } - else - { sendevent(slot, true); getActiveSlotsLocal().append(slot); - int oldvalue = activeMouseButtons.value(tempcode, 0) + 1; - activeMouseButtons.insert(tempcode, oldvalue); - } - } - else if (mode == JoyButtonSlot::JoyMouseMovement) - { - i++; - - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << i << ": It's a JoyMouseMovement with code: " << tempcode << " and name: " << slot->getSlotString(); - #endif - - slot->getMouseInterval()->restart(); + int oldvalue = GlobalVariables::JoyButton::JoyButton::activeKeys.value(tempcode, 0) + 1; + GlobalVariables::JoyButton::JoyButton::activeKeys.insert(tempcode, oldvalue); - getActiveSlotsLocal().append(slot); + if (!slot->isModifierKey()) + { + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "There has been assigned a lastActiveKey"; + #endif - if (pendingMouseButtons.size() == 0) - { - mouseHelper.setFirstSpringStatus(true); - } + lastActiveKey = slot; + #ifdef Q_OS_WIN + changeRepeatState = true; + #endif + } + else + { + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "It's not modifier key. lastActiveKey is null pointer"; + #endif - pendingMouseButtons.append(this); - mouseEventQueue.enqueue(slot); + lastActiveKey = nullptr; - // Temporarily lower timer interval. Helps improve mouse control - // precision on the lower end of an axis. - if (!staticMouseEventTimer.isActive() || (staticMouseEventTimer.interval() != 0)) - { - if (!staticMouseEventTimer.isActive() || (staticMouseEventTimer.interval() == IDLEMOUSEREFRESHRATE)) - { - int tempRate = qBound(0, mouseRefreshRate - gamepadRefreshRate, MAXIMUMMOUSEREFRESHRATE); - staticMouseEventTimer.start(tempRate); - testOldMouseTime.restart(); - accelExtraDurationTime.restart(); + #ifdef Q_OS_WIN + changeRepeatState = true; + #endif } - } - } - else if (mode == JoyButtonSlot::JoyPause) - { - i++; - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << i << ": It's a JoyPause with code: " << tempcode << " and name: " << slot->getSlotString(); - #endif - - if (!getActiveSlots().isEmpty()) + break; + } + case JoyButtonSlot::JoyMouseButton: { + i++; + #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "active slots QHash is not empty"; + qDebug() << i << ": It's a JoyMouseButton with code: " << tempcode << " and name: " << slot->getSlotString(); #endif - if (slotiter->hasPrevious()) + if ((tempcode == static_cast(JoyButtonSlot::MouseWheelUp)) || + (tempcode == static_cast(JoyButtonSlot::MouseWheelDown))) { - i--; - slotiter->previous(); + slot->getMouseInterval()->restart(); + wheelVerticalTime.restart(); + currentWheelVerticalEvent = slot; + getActiveSlotsLocal().append(slot); + wheelEventVertical(); + currentWheelVerticalEvent = nullptr; } - delaySequence = true; - exit = true; + else if ((tempcode == static_cast(JoyButtonSlot::MouseWheelLeft)) || + (tempcode == static_cast(JoyButtonSlot::MouseWheelRight))) + { + slot->getMouseInterval()->restart(); + wheelHorizontalTime.restart(); + currentWheelHorizontalEvent = slot; + getActiveSlotsLocal().append(slot); + wheelEventHorizontal(); + currentWheelHorizontalEvent = nullptr; + } + else + { + sendevent(slot, true); + getActiveSlotsLocal().append(slot); + int oldvalue = GlobalVariables::JoyButton::JoyButton::activeMouseButtons.value(tempcode, 0) + 1; + GlobalVariables::JoyButton::JoyButton::activeMouseButtons.insert(tempcode, oldvalue); + } + + break; } - // Segment can be ignored on a 0 interval pause - else if (tempcode > 0) + case JoyButtonSlot::JoyMouseMovement: { + i++; + #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "active slots QHash is empty"; + qDebug() << i << ": It's a JoyMouseMovement with code: " << tempcode << " and name: " << slot->getSlotString(); #endif - currentPause = slot; - pauseHold.restart(); - inpauseHold.restart(); - pauseWaitTimer.start(0); - exit = true; + slot->getMouseInterval()->restart(); + + getActiveSlotsLocal().append(slot); + + if (pendingMouseButtons.size() == 0) + mouseHelper.setFirstSpringStatus(true); + + pendingMouseButtons.append(this); + mouseEventQueue.enqueue(slot); + + // Temporarily lower timer interval. Helps improve mouse control + // precision on the lower end of an axis. + if (!staticMouseEventTimer.isActive() || (staticMouseEventTimer.interval() != 0)) + { + if (!staticMouseEventTimer.isActive() || (staticMouseEventTimer.interval() == GlobalVariables::JoyButton::IDLEMOUSEREFRESHRATE)) + { + int tempRate = qBound(0, GlobalVariables::JoyButton::mouseRefreshRate - GlobalVariables::JoyButton::gamepadRefreshRate, GlobalVariables::JoyButton::MAXIMUMMOUSEREFRESHRATE); + staticMouseEventTimer.start(tempRate); + testOldMouseTime.restart(); + accelExtraDurationTime.restart(); + } + } + + break; } - } - else if (mode == JoyButtonSlot::JoyHold) - { - i++; + case JoyButtonSlot::JoyPause: + { + i++; - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << i << ": It's a JoyHold with code: " << tempcode << " and name: " << slot->getSlotString(); - #endif + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << i << ": It's a JoyPause with code: " << tempcode << " and name: " << slot->getSlotString(); + #endif - currentHold = slot; - holdTimer.start(0); - exit = true; - } - else if (mode == JoyButtonSlot::JoyDelay) - { - i++; + if (!getActiveSlots().isEmpty()) + { + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "active slots QHash is not empty"; + #endif - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << i << ": It's a JoyDelay with code: " << tempcode << " and name: " << slot->getSlotString(); - #endif + if (slotiter->hasPrevious()) + { + i--; + slotiter->previous(); + } - currentDelay = slot; - buttonDelay.restart(); - delayTimer.start(0); - exit = true; - } - else if (mode == JoyButtonSlot::JoyCycle) - { - i++; + delaySequence = true; + exit = true; + } + // Segment can be ignored on a 0 interval pause + else if (tempcode > 0) + { + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "active slots QHash is empty"; + #endif - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << i << ": It's a JoyCycle with code: " << tempcode << " and name: " << slot->getSlotString(); - #endif + currentPause = slot; + pauseHold.restart(); + inpauseHold.restart(); + pauseWaitTimer.start(0); + exit = true; + } - currentCycle = slot; - exit = true; - } - else if (mode == JoyButtonSlot::JoyDistance) - { - i++; + break; + } + case JoyButtonSlot::JoyHold: + { + i++; - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << i << ": It's a JoyDistance with code: " << tempcode << " and name: " << slot->getSlotString(); - #endif + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << i << ": It's a JoyHold with code: " << tempcode << " and name: " << slot->getSlotString(); + #endif - exit = true; - } - else if (mode == JoyButtonSlot::JoyRelease) - { - i++; + currentHold = slot; + holdTimer.start(0); + exit = true; + break; + } + case JoyButtonSlot::JoyDelay: + { + i++; - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << i << ": It's a JoyRelease with code: " << tempcode << " and name: " << slot->getSlotString(); - #endif + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << i << ": It's a JoyDelay with code: " << tempcode << " and name: " << slot->getSlotString(); + #endif - if (currentRelease == nullptr) + currentDelay = slot; + buttonDelay.restart(); + delayTimer.start(0); + exit = true; + break; + } + case JoyButtonSlot::JoyCycle: { - findReleaseEventEnd(); + i++; + + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << i << ": It's a JoyCycle with code: " << tempcode << " and name: " << slot->getSlotString(); + #endif + + currentCycle = slot; + exit = true; + break; } - else if ((currentRelease != nullptr) && getActiveSlots().isEmpty()) + case JoyButtonSlot::JoyDistance: { + i++; + #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "current is release but activeSlots is empty"; + qDebug() << i << ": It's a JoyDistance with code: " << tempcode << " and name: " << slot->getSlotString(); #endif exit = true; + break; } - else if ((currentRelease != nullptr) && !getActiveSlots().isEmpty()) + case JoyButtonSlot::JoyRelease: { + i++; + #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "current is release and activeSlots is not empty"; + qDebug() << i << ": It's a JoyRelease with code: " << tempcode << " and name: " << slot->getSlotString(); #endif - if (slotiter->hasPrevious()) + if (currentRelease == nullptr) + { + findJoySlotsEnd(slotiter); + } + else if ((currentRelease != nullptr) && getActiveSlots().isEmpty()) { #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Back to previous slotiter from release"; + qDebug() << "current is release but activeSlots is empty"; #endif - i--; - slotiter->previous(); + exit = true; } - delaySequence = true; - exit = true; - } - } - else if (mode == JoyButtonSlot::JoyMouseSpeedMod) - { - i++; + else if ((currentRelease != nullptr) && !getActiveSlots().isEmpty()) + { + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "current is release and activeSlots is not empty"; + #endif - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << i << ": It's a JoyMouseSpeedMod with code: " << tempcode << " and name: " << slot->getSlotString(); - #endif + if (slotiter->hasPrevious()) + { + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "Back to previous slotiter from release"; + #endif - mouseSpeedModifier = tempcode * 0.01; - mouseSpeedModList.append(slot); - getActiveSlotsLocal().append(slot); - } - else if (mode == JoyButtonSlot::JoyKeyPress) - { - i++; + i--; + slotiter->previous(); + } - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << i << ": It's a JoyKeyPress with code: " << tempcode << " and name: " << slot->getSlotString(); - #endif + delaySequence = true; + exit = true; + } - if (getActiveSlots().isEmpty()) + break; + } + case JoyButtonSlot::JoyMouseSpeedMod: { + i++; + #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "activeSlots is empty. It's a true delaySequence and assigned currentKeyPress"; + qDebug() << i << ": It's a JoyMouseSpeedMod with code: " << tempcode << " and name: " << slot->getSlotString(); #endif - delaySequence = true; - currentKeyPress = slot; + GlobalVariables::JoyButton::mouseSpeedModifier = tempcode * 0.01; + mouseSpeedModList.append(slot); + getActiveSlotsLocal().append(slot); + + break; } - else + case JoyButtonSlot::JoyKeyPress: { + i++; + #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "activeSlots is not empty. It's a true delaySequence and exit"; + qDebug() << i << ": It's a JoyKeyPress with code: " << tempcode << " and name: " << slot->getSlotString(); #endif - if (slotiter->hasPrevious()) + if (getActiveSlots().isEmpty()) { #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Back to previous slotiter from JoyKeyPress"; + qDebug() << "activeSlots is empty. It's a true delaySequence and assigned currentKeyPress"; #endif - i--; - slotiter->previous(); + delaySequence = true; + currentKeyPress = slot; } - delaySequence = true; - exit = true; - } - } - else if (mode == JoyButtonSlot::JoyLoadProfile) - { - i++; + else + { + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "activeSlots is not empty. It's a true delaySequence and exit"; + #endif - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << i << ": It's a JoyLoadProfile with code: " << tempcode << " and name: " << slot->getSlotString(); - #endif + if (slotiter->hasPrevious()) + { + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "Back to previous slotiter from JoyKeyPress"; + #endif - releaseActiveSlots(); - slotiter->toBack(); - exit = true; + i--; + slotiter->previous(); + } - QString location = slot->getTextData(); - if (!location.isEmpty()) - { - parentSet->getInputDevice()->sendLoadProfileRequest(location); + delaySequence = true; + exit = true; + } + + break; } - } - else if (mode == JoyButtonSlot::JoySetChange) - { - i++; + case JoyButtonSlot::JoyLoadProfile: + { + i++; - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << i << ": It's a JoySetChange with code: " << tempcode << " and name: " << slot->getSlotString(); - #endif + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << i << ": It's a JoyLoadProfile with code: " << tempcode << " and name: " << slot->getSlotString(); + #endif - getActiveSlotsLocal().append(slot); - } - else if (mode == JoyButtonSlot::JoyTextEntry) - { - i++; + releaseActiveSlots(); + slotiter->toBack(); + exit = true; - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << i << ": It's a JoyTextEntry with code: " << tempcode << " and name: " << slot->getSlotString(); - #endif + QString location = slot->getTextData(); - sendevent(slot, true); - } - else if (mode == JoyButtonSlot::JoyExecute) - { - i++; + if (!location.isEmpty()) + m_parentSet->getInputDevice()->sendLoadProfileRequest(location); - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << i << ": It's a JoyExecute with code: " << tempcode << " and name: " << slot->getSlotString(); - #endif + break; + } + case JoyButtonSlot::JoySetChange: + { + i++; - sendevent(slot, true); + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << i << ": It's a JoySetChange with code: " << tempcode << " and name: " << slot->getSlotString(); + #endif + + getActiveSlotsLocal().append(slot); + break; + } + case JoyButtonSlot::JoyTextEntry: + case JoyButtonSlot::JoyExecute: + { + i++; + + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << i << ": It's a JoyExecute or JoyTextEntry with code: " << tempcode << " and name: " << slot->getSlotString(); + #endif + + sendevent(slot, true); + break; + } } } @@ -1206,7 +1019,7 @@ void JoyButton::activateSlots() #ifdef Q_OS_WIN else if (handler && (handler->getIdentifier() == "sendinput") && - changeRepeatState && !useTurbo) + changeRepeatState && !m_useTurbo) { InputDevice *device = getParentSet()->getInputDevice(); if (device->isKeyRepeatEnabled()) @@ -1241,9 +1054,9 @@ void JoyButton::slotSetChange() currentSetChangeSlot = nullptr; // Ensure that a change to the current set is not attempted. - if (setChangeIndex != originset) + if (setChangeIndex != m_originset) { - emit released(index); + emit released(m_index); emit setChangeActivated(setChangeIndex); } } @@ -1259,6 +1072,7 @@ void JoyButton::mouseEvent() JoyButtonSlot *buttonslot = nullptr; bool singleShot = false; + if (currentMouseEvent != nullptr) { buttonslot = currentMouseEvent; @@ -1267,24 +1081,20 @@ void JoyButton::mouseEvent() if ((buttonslot != nullptr) || !mouseEventQueue.isEmpty()) { - updateLastMouseDistance = true; - updateStartingMouseDistance = true; - updateOldAccelMulti = 0.0; + updateMouseParams(true, true, 0.0); QQueue tempQueue; if (buttonslot == nullptr) - { buttonslot = mouseEventQueue.dequeue(); - } int timeElapsed = testOldMouseTime.elapsed(); // Presumed initial mouse movement. Use full duration rather than // partial. - if (staticMouseEventTimer.interval() < mouseRefreshRate) + if (staticMouseEventTimer.interval() < GlobalVariables::JoyButton::mouseRefreshRate) { - timeElapsed = getMouseRefreshRate() + (timeElapsed - staticMouseEventTimer.interval()); + timeElapsed = GlobalVariables::JoyButton::mouseRefreshRate + (timeElapsed - staticMouseEventTimer.interval()); } while (buttonslot != nullptr) @@ -1295,31 +1105,27 @@ void JoyButton::mouseEvent() JoyButton::JoyMouseMovementMode mousemode = getMouseMode(); bool isActive = getActiveSlots().contains(buttonslot); + if (isActive) { int mousespeed = 0; if (mousemode == JoyButton::MouseCursor) { - if (mousedirection == static_cast(JoyButtonSlot::MouseRight)) - { - mousespeed = mouseSpeedX; - } - else if (mousedirection == static_cast(JoyButtonSlot::MouseLeft)) - { - mousespeed = mouseSpeedX; - } - else if (mousedirection == static_cast(JoyButtonSlot::MouseDown)) + switch(mousedirection) { - mousespeed = mouseSpeedY; - } - else if (mousedirection == static_cast(JoyButtonSlot::MouseUp)) - { - mousespeed = mouseSpeedY; + case 1: + case 2: + mousespeed = mouseSpeedY; + break; + + case 3: + case 4: + mousespeed = mouseSpeedX; + break; } double difference = getMouseDistanceFromDeadZone(); - double mouse1 = 0; double mouse2 = 0; double sumDist = buttonslot->getMouseDistance(); @@ -1327,10 +1133,6 @@ void JoyButton::mouseEvent() switch (currentCurve) { - case LinearCurve: - { - break; - } case QuadraticCurve: { difference = difference * difference; @@ -1372,7 +1174,7 @@ void JoyButton::mouseEvent() // offset. difference = (difference - 0.252); } - else if (temp > 0.75) + else { // Perform mouse acceleration. Make up the difference // due to the previous two segments. Maxes out at 1.0. @@ -1413,12 +1215,12 @@ void JoyButton::mouseEvent() buttonslot->getEasingTime()->restart(); } } - else if (temp > 0.75) + else { // Gradually increase the mouse speed until the specified elapsed duration // time has passed. int easingElapsed = buttonslot->getEasingTime()->elapsed(); - double easingDuration = this->easingDuration; // Time in seconds + double easingDuration = m_easingDuration; // Time in seconds if (!buttonslot->isEasingActive()) { buttonslot->setEasingStatus(true); @@ -1452,15 +1254,16 @@ void JoyButton::mouseEvent() difference = (difference * 1.33067 - 0.496005); } break; - } + } + default: + break; } double distance = 0; - difference = (mouseSpeedModifier == 1.0) ? difference : (difference * mouseSpeedModifier); + difference = (GlobalVariables::JoyButton::mouseSpeedModifier == 1.0) ? difference : (difference * GlobalVariables::JoyButton::mouseSpeedModifier); double mintravel = minMouseDistanceAccelThreshold * 0.01; double minstop = qMax(0.05, mintravel); - //double currentTravel = getAccelerationDistance() - lastAccelerationDistance; // Last check ensures that acceleration is only applied for the same direction. if (extraAccelerationEnabled && isPartRealAxis() && @@ -1468,7 +1271,7 @@ void JoyButton::mouseEvent() (((getAccelerationDistance() - lastAccelerationDistance) >= 0) == (getAccelerationDistance() >= 0))) { double magfactor = extraAccelerationMultiplier; - double minfactor = qMax((DEFAULTSTARTACCELMULTIPLIER * 0.001) + 1.0, magfactor * (startAccelMultiplier * 0.01)); + double minfactor = qMax((GlobalVariables::JoyButton::DEFAULTSTARTACCELMULTIPLIER * 0.001) + 1.0, magfactor * (startAccelMultiplier * 0.01)); double maxtravel = maxMouseDistanceAccelThreshold * 0.01; double slope = (magfactor - minfactor)/(maxtravel - mintravel); double intercept = minfactor - (slope * mintravel); @@ -1483,7 +1286,7 @@ void JoyButton::mouseEvent() if (extraAccelCurve == EaseOutSineCurve) { double getMultiDiff2 = ((currentAccelMultiTemp - minfactor) / (extraAccelerationMultiplier - minfactor)); - currentAccelMultiTemp = (extraAccelerationMultiplier - minfactor) * sin(getMultiDiff2 * (PI/2.0)) + minfactor; + currentAccelMultiTemp = (extraAccelerationMultiplier - minfactor) * sin(getMultiDiff2 * (GlobalVariables::JoyControlStick::PI/2.0)) + minfactor; } else if (extraAccelCurve == EaseOutQuadAccelCurve) { @@ -1513,7 +1316,7 @@ void JoyButton::mouseEvent() updateStartingMouseDistance = true; double magfactor = extraAccelerationMultiplier; - double minfactor = qMax((DEFAULTSTARTACCELMULTIPLIER * 0.001) + 1.0, magfactor * (startAccelMultiplier * 0.01)); + double minfactor = qMax((GlobalVariables::JoyButton::DEFAULTSTARTACCELMULTIPLIER * 0.001) + 1.0, magfactor * (startAccelMultiplier * 0.01)); double maxtravel = maxMouseDistanceAccelThreshold * 0.01; double slope = (magfactor - minfactor)/(maxtravel - mintravel); double intercept = minfactor - (slope * mintravel); @@ -1532,35 +1335,44 @@ void JoyButton::mouseEvent() double elapsedDuration = accelDuration * ((currentAccelMultiTemp - minfactor) / (extraAccelerationMultiplier - minfactor)); - if (extraAccelCurve == EaseOutSineCurve) + switch(extraAccelCurve) { - double multiDiff = ((currentAccelMultiTemp - minfactor) / (extraAccelerationMultiplier - minfactor)); - double temp = sin(multiDiff * (PI/2.0)); - elapsedDuration = accelDuration * temp + 0; - currentAccelMultiTemp = (extraAccelerationMultiplier - minfactor) * sin(multiDiff * (PI/2.0)) + minfactor; - } - else if (extraAccelCurve == EaseOutQuadAccelCurve) - { - double getMultiDiff2 = ((currentAccelMultiTemp - minfactor) / (extraAccelerationMultiplier - minfactor)); - double temp = (getMultiDiff2 * (getMultiDiff2 - 2)); - elapsedDuration = -accelDuration * temp + 0; - currentAccelMultiTemp = -(extraAccelerationMultiplier - minfactor) * temp + minfactor; - } - else if (extraAccelCurve == EaseOutCubicAccelCurve) - { - double getMultiDiff = ((currentAccelMultiTemp - minfactor) / (extraAccelerationMultiplier - minfactor)) - 1; - double temp = ((getMultiDiff) * (getMultiDiff) * (getMultiDiff) + 1); - elapsedDuration = accelDuration * temp + 0; - currentAccelMultiTemp = (extraAccelerationMultiplier - minfactor) * temp + minfactor; + case EaseOutSineCurve: + { + double multiDiff = ((currentAccelMultiTemp - minfactor) / (extraAccelerationMultiplier - minfactor)); + double temp = sin(multiDiff * (GlobalVariables::JoyControlStick::PI/2.0)); + elapsedDuration = accelDuration * temp + 0; + currentAccelMultiTemp = (extraAccelerationMultiplier - minfactor) * sin(multiDiff * (GlobalVariables::JoyControlStick::PI/2.0)) + minfactor; + + break; + } + case EaseOutQuadAccelCurve: + { + double getMultiDiff2 = ((currentAccelMultiTemp - minfactor) / (extraAccelerationMultiplier - minfactor)); + double temp = (getMultiDiff2 * (getMultiDiff2 - 2)); + elapsedDuration = -accelDuration * temp + 0; + currentAccelMultiTemp = -(extraAccelerationMultiplier - minfactor) * temp + minfactor; + + break; + } + case EaseOutCubicAccelCurve: + { + double getMultiDiff = ((currentAccelMultiTemp - minfactor) / (extraAccelerationMultiplier - minfactor)) - 1; + double temp = ((getMultiDiff) * (getMultiDiff) * (getMultiDiff) + 1); + elapsedDuration = accelDuration * temp + 0; + currentAccelMultiTemp = (extraAccelerationMultiplier - minfactor) * temp + minfactor; + + break; + } } double tempAccel = currentAccelMultiTemp; double elapsedDiff = 1.0; + if ((elapsedDuration > 0.0) && ((elapsedElapsed * 0.001) < elapsedDuration)) { elapsedDiff = ((elapsedElapsed * 0.001) / elapsedDuration); elapsedDiff = (1.0 - tempAccel) * (elapsedDiff * elapsedDiff * elapsedDiff) + tempAccel; - difference = elapsedDiff * difference; // As acceleration is applied, do not update last @@ -1584,24 +1396,27 @@ void JoyButton::mouseEvent() accelTravel = 0.0; } - sumDist += difference * (mousespeed * JoyButtonSlot::JOYSPEED * timeElapsed) * 0.001; + sumDist += difference * (mousespeed * GlobalVariables::JoyButtonSlot::JOYSPEED * timeElapsed) * 0.001; distance = sumDist; - if (mousedirection == static_cast(JoyButtonSlot::MouseRight)) - { - mouse1 = distance; - } - else if (mousedirection == static_cast(JoyButtonSlot::MouseLeft)) - { - mouse1 = -distance; - } - else if (mousedirection == static_cast(JoyButtonSlot::MouseDown)) + switch(mousedirection) { - mouse2 = distance; - } - else if (mousedirection == static_cast(JoyButtonSlot::MouseUp)) - { - mouse2 = -distance; + case 1: + mouse2 = -distance; + break; + + case 2: + mouse2 = distance; + break; + + case 3: + mouse1 = -distance; + break; + + case 4: + mouse1 = distance; + break; + } mouseCursorInfo infoX; @@ -1623,77 +1438,40 @@ void JoyButton::mouseEvent() double mouse2 = -2.0; double difference = getMouseDistanceFromDeadZone(); - if (mousedirection == static_cast(JoyButtonSlot::MouseRight)) - { - mouse1 = difference; - if (mouseHelper.getFirstSpringStatus()) - { - mouse2 = 0.0; - mouseHelper.setFirstSpringStatus(false); - } - } - else if (mousedirection == static_cast(JoyButtonSlot::MouseLeft)) - { - mouse1 = -difference; - if (mouseHelper.getFirstSpringStatus()) - { - mouse2 = 0.0; - mouseHelper.setFirstSpringStatus(false); - } - } - else if (mousedirection == static_cast(JoyButtonSlot::MouseDown)) + switch(mousedirection) { - if (mouseHelper.getFirstSpringStatus()) - { - mouse1 = 0.0; - mouseHelper.setFirstSpringStatus(false); - } + case 1: - mouse2 = difference; - } - else if (mousedirection == static_cast(JoyButtonSlot::MouseUp)) - { - if (mouseHelper.getFirstSpringStatus()) - { - mouse1 = 0.0; - mouseHelper.setFirstSpringStatus(false); - } + setDistanceForSpring(mouseHelper, mouse1, mouse2, -difference); + break; - mouse2 = -difference; - } + case 2: - PadderCommon::springModeInfo infoX; - infoX.displacementX = mouse1; - infoX.springDeadX = 0.0; - infoX.width = springWidth; - infoX.height = springHeight; - infoX.relative = relativeSpring; - infoX.screen = springModeScreen; - springXSpeeds.append(infoX); - - PadderCommon::springModeInfo infoY; - infoY.displacementY = mouse2; - infoY.springDeadY = 0.0; - infoY.width = springWidth; - infoY.height = springHeight; - infoY.relative = relativeSpring; - infoY.screen = springModeScreen; - springYSpeeds.append(infoY); + setDistanceForSpring(mouseHelper, mouse1, mouse2, difference); + break; + case 3: + + setDistanceForSpring(mouseHelper, mouse2, mouse1, -difference); + break; + + case 4: + + setDistanceForSpring(mouseHelper, mouse2, mouse1, difference); + break; + } + + updateMouseProperties(mouse1, 0.0, springWidth, springHeight, relativeSpring, GlobalVariables::JoyButton::springModeScreen, springXSpeeds, 'X'); + updateMouseProperties(mouse2, 0.0, springWidth, springHeight, relativeSpring, GlobalVariables::JoyButton::springModeScreen, springYSpeeds, 'Y'); mouseInterval->restart(); } tempQueue.enqueue(buttonslot); } - if (!mouseEventQueue.isEmpty() && !singleShot) - { - buttonslot = mouseEventQueue.dequeue(); - } - else - { - buttonslot = nullptr; - } + if (!mouseEventQueue.isEmpty() && !singleShot) buttonslot = mouseEventQueue.dequeue(); + else buttonslot = nullptr; + } if (!tempQueue.isEmpty()) @@ -1707,19 +1485,62 @@ void JoyButton::mouseEvent() } } + +void JoyButton::setDistanceForSpring(JoyButtonMouseHelper& mouseHelper, double& mouseFirstAx, double& mouseSecondAx, double distanceFromDeadZone) +{ + if (mouseHelper.getFirstSpringStatus()) + { + mouseFirstAx = 0.0; + mouseHelper.setFirstSpringStatus(false); + } + + mouseSecondAx = distanceFromDeadZone; +} + + +void JoyButton::updateMouseProperties(double newAxisValue, double newSpringDead, int newSpringWidth, int newSpringHeight, bool relatived, int modeScreen, QList& springSpeeds, QChar axis, double newAxisValueY, double newSpringDeadY) +{ + PadderCommon::springModeInfo axisInfo; + + if (axis == 'X') { + + axisInfo.displacementX = newAxisValue; + axisInfo.springDeadX = newSpringDead; + + } else if (axis == 'Y') { + + axisInfo.displacementY = newAxisValue; + axisInfo.springDeadY = newSpringDead; + + } else { + + axisInfo.displacementX = newAxisValue; + axisInfo.springDeadX = newSpringDead; + axisInfo.displacementY = newAxisValueY; + axisInfo.springDeadY = newSpringDeadY; + } + + axisInfo.width = newSpringWidth; + axisInfo.height = newSpringHeight; + axisInfo.relative = relatived; + axisInfo.screen = modeScreen; + springSpeeds.append(axisInfo); +} + + void JoyButton::wheelEventVertical() { qInstallMessageHandler(MessageHandler::myMessageOutput); JoyButtonSlot *buttonslot = nullptr; + if (currentWheelVerticalEvent != nullptr) - { - buttonslot = currentWheelVerticalEvent; - } + buttonslot = currentWheelVerticalEvent; if (buttonslot && (wheelSpeedY != 0)) { bool isActive = getActiveSlots().contains(buttonslot); + if (isActive) { sendevent(buttonslot, true); @@ -1735,10 +1556,12 @@ void JoyButton::wheelEventVertical() else if (!mouseWheelVerticalEventQueue.isEmpty() && (wheelSpeedY != 0)) { QQueue tempQueue; + while (!mouseWheelVerticalEventQueue.isEmpty()) { buttonslot = mouseWheelVerticalEventQueue.dequeue(); bool isActive = getActiveSlots().contains(buttonslot); + if (isActive) { sendevent(buttonslot, true); @@ -1768,14 +1591,14 @@ void JoyButton::wheelEventHorizontal() qInstallMessageHandler(MessageHandler::myMessageOutput); JoyButtonSlot *buttonslot = nullptr; + if (currentWheelHorizontalEvent != nullptr) - { buttonslot = currentWheelHorizontalEvent; - } if (buttonslot && (wheelSpeedX != 0)) { bool isActive = getActiveSlots().contains(buttonslot); + if (isActive) { sendevent(buttonslot, true); @@ -1791,10 +1614,12 @@ void JoyButton::wheelEventHorizontal() else if (!mouseWheelHorizontalEventQueue.isEmpty() && (wheelSpeedX != 0)) { QQueue tempQueue; + while (!mouseWheelHorizontalEventQueue.isEmpty()) { buttonslot = mouseWheelHorizontalEventQueue.dequeue(); bool isActive = getActiveSlots().contains(buttonslot); + if (isActive) { sendevent(buttonslot, true); @@ -1823,28 +1648,20 @@ void JoyButton::setUseTurbo(bool useTurbo) { qInstallMessageHandler(MessageHandler::myMessageOutput); - bool initialState = this->useTurbo; + bool initialState = m_useTurbo; - if (useTurbo != this->useTurbo) + if (useTurbo != m_useTurbo) { - if (useTurbo && this->containsSequence()) - { - this->useTurbo = false; - } - else - { - this->useTurbo = useTurbo; - } + if (useTurbo && this->containsSequence()) m_useTurbo = false; + else m_useTurbo = useTurbo; - if (initialState != this->useTurbo) + if (initialState != m_useTurbo) { - emit turboChanged(this->useTurbo); + emit turboChanged(m_useTurbo); emit propertyUpdated(); - if (this->useTurbo && (this->turboInterval == 0)) - { - this->setTurboInterval(ENABLEDTURBODEFAULT); - } + if (m_useTurbo && (this->turboInterval == 0)) + this->setTurboInterval(GlobalVariables::JoyButton::ENABLEDTURBODEFAULT); } } } @@ -1853,14 +1670,14 @@ bool JoyButton::isUsingTurbo() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return useTurbo; + return m_useTurbo; } QString JoyButton::getXmlName() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->xmlName; + return GlobalVariables::JoyButton::xmlName; } void JoyButton::readConfig(QXmlStreamReader *xml) @@ -1870,17 +1687,13 @@ void JoyButton::readConfig(QXmlStreamReader *xml) if (xml->isStartElement() && (xml->name() == getXmlName())) { xml->readNextStartElement(); + while (!xml->atEnd() && (!xml->isEndElement() && (xml->name() != getXmlName()))) { bool found = readButtonConfig(xml); - if (!found) - { - xml->skipCurrentElement(); - } - else - { - buildActiveZoneSummaryString(); - } + + if (!found) xml->skipCurrentElement(); + else buildActiveZoneSummaryString(); xml->readNextStartElement(); } @@ -1889,7 +1702,6 @@ void JoyButton::readConfig(QXmlStreamReader *xml) void JoyButton::writeConfig(QXmlStreamWriter *xml) { - qInstallMessageHandler(MessageHandler::myMessageOutput); if (!isDefault()) @@ -1897,212 +1709,167 @@ void JoyButton::writeConfig(QXmlStreamWriter *xml) xml->writeStartElement(getXmlName()); xml->writeAttribute("index", QString::number(getRealJoyNumber())); - if (toggle != DEFAULTTOGGLE) - { - xml->writeTextElement("toggle", toggle ? "true" : "false"); - } - - if (turboInterval != DEFAULTTURBOINTERVAL) - { - xml->writeTextElement("turbointerval", QString::number(turboInterval)); - } - - if (currentTurboMode != DEFAULTTURBOMODE) - { - if (currentTurboMode == GradientTurbo) - { - xml->writeTextElement("turbomode", "gradient"); - } - else if (currentTurboMode == PulseTurbo) - { - xml->writeTextElement("turbomode", "pulse"); - } - } - - if (useTurbo != DEFAULTUSETURBO) - { - xml->writeTextElement("useturbo", useTurbo ? "true" : "false"); - } + if (m_toggle != GlobalVariables::JoyButton::DEFAULTTOGGLE) + xml->writeTextElement("toggle", m_toggle ? "true" : "false"); - if (mouseSpeedX != DEFAULTMOUSESPEEDX) - { + if (turboInterval != GlobalVariables::JoyButton::DEFAULTTURBOINTERVAL) + xml->writeTextElement("turbointerval", QString::number(turboInterval)); + + if ((currentTurboMode != DEFAULTTURBOMODE) && (currentTurboMode == GradientTurbo)) xml->writeTextElement("turbomode", "gradient"); + else if ((currentTurboMode != DEFAULTTURBOMODE) && (currentTurboMode == PulseTurbo)) xml->writeTextElement("turbomode", "pulse"); + + if (m_useTurbo != GlobalVariables::JoyButton::DEFAULTUSETURBO) + xml->writeTextElement("useturbo", m_useTurbo ? "true" : "false"); + + if (mouseSpeedX != GlobalVariables::JoyButton::DEFAULTMOUSESPEEDX) xml->writeTextElement("mousespeedx", QString::number(mouseSpeedX)); - } - if (mouseSpeedY != DEFAULTMOUSESPEEDY) - { + if (mouseSpeedY != GlobalVariables::JoyButton::DEFAULTMOUSESPEEDY) xml->writeTextElement("mousespeedy", QString::number(mouseSpeedY)); - } - - if (mouseMode != DEFAULTMOUSEMODE) + if ((mouseMode != DEFAULTMOUSEMODE) && (mouseMode == MouseCursor)) { - if (mouseMode == MouseCursor) - { - xml->writeTextElement("mousemode", "cursor"); - } - else if (mouseMode == MouseSpring) - { - xml->writeTextElement("mousemode", "spring"); - xml->writeTextElement("mousespringwidth", QString::number(springWidth)); - xml->writeTextElement("mousespringheight", QString::number(springHeight)); - } + xml->writeTextElement("mousemode", "cursor"); + } + else if ((mouseMode != DEFAULTMOUSEMODE) && (mouseMode == MouseSpring)) + { + xml->writeTextElement("mousemode", "spring"); + xml->writeTextElement("mousespringwidth", QString::number(springWidth)); + xml->writeTextElement("mousespringheight", QString::number(springHeight)); } if (mouseCurve != DEFAULTMOUSECURVE) { - if (mouseCurve == LinearCurve) - { - xml->writeTextElement("mouseacceleration", "linear"); - } - else if (mouseCurve == QuadraticCurve) - { - xml->writeTextElement("mouseacceleration", "quadratic"); - } - else if (mouseCurve == CubicCurve) - { - xml->writeTextElement("mouseacceleration", "cubic"); - } - else if (mouseCurve == QuadraticExtremeCurve) - { - xml->writeTextElement("mouseacceleration", "quadratic-extreme"); - } - else if (mouseCurve == PowerCurve) - { - xml->writeTextElement("mouseacceleration", "power"); - xml->writeTextElement("mousesensitivity", QString::number(sensitivity)); - } - else if (mouseCurve == EnhancedPrecisionCurve) - { - xml->writeTextElement("mouseacceleration", "precision"); - } - else if (mouseCurve == EasingQuadraticCurve) - { - xml->writeTextElement("mouseacceleration", "easing-quadratic"); - } - else if (mouseCurve == EasingCubicCurve) + switch(mouseCurve) { - xml->writeTextElement("mouseacceleration", "easing-cubic"); + case LinearCurve: + xml->writeTextElement("mouseacceleration", "linear"); + break; + + case QuadraticCurve: + xml->writeTextElement("mouseacceleration", "quadratic"); + break; + + case CubicCurve: + xml->writeTextElement("mouseacceleration", "cubic"); + break; + + case QuadraticExtremeCurve: + xml->writeTextElement("mouseacceleration", "quadratic-extreme"); + break; + + case PowerCurve: + xml->writeTextElement("mouseacceleration", "power"); + xml->writeTextElement("mousesensitivity", QString::number(sensitivity)); + break; + + case EnhancedPrecisionCurve: + xml->writeTextElement("mouseacceleration", "precision"); + break; + + case EasingQuadraticCurve: + xml->writeTextElement("mouseacceleration", "easing-quadratic"); + break; + + case EasingCubicCurve: + xml->writeTextElement("mouseacceleration", "easing-cubic"); + break; } } - if (wheelSpeedX != DEFAULTWHEELX) - { + if (wheelSpeedX != GlobalVariables::JoyButton::DEFAULTWHEELX) xml->writeTextElement("wheelspeedx", QString::number(wheelSpeedX)); - } - if (wheelSpeedY != DEFAULTWHEELY) - { + if (wheelSpeedY != GlobalVariables::JoyButton::DEFAULTWHEELY) xml->writeTextElement("wheelspeedy", QString::number(wheelSpeedY)); - } if (!isModifierButton()) { if (setSelectionCondition != SetChangeDisabled) { xml->writeTextElement("setselect", QString::number(setSelection+1)); - QString temptext = QString(); - if (setSelectionCondition == SetChangeOneWay) - { - temptext = "one-way"; - } - else if (setSelectionCondition == SetChangeTwoWay) - { - temptext = "two-way"; - } - else if (setSelectionCondition == SetChangeWhileHeld) + + switch(setSelectionCondition) { - temptext = "while-held"; + case SetChangeOneWay: + temptext = "one-way"; + break; + + case SetChangeTwoWay: + temptext = "two-way"; + break; + + case SetChangeWhileHeld: + temptext = "while-held"; + break; } + xml->writeTextElement("setselectcondition", temptext); } } if (!actionName.isEmpty()) - { xml->writeTextElement("actionname", actionName); - } if (cycleResetActive) - { xml->writeTextElement("cycleresetactive", "true"); - } - if (cycleResetInterval >= MINCYCLERESETTIME) - { + if (cycleResetInterval >= GlobalVariables::JoyButton::MINCYCLERESETTIME) xml->writeTextElement("cycleresetinterval", QString::number(cycleResetInterval)); - } - if (relativeSpring == true) - { + if (relativeSpring) xml->writeTextElement("relativespring", "true"); - } - if (qFuzzyCompare(easingDuration, DEFAULTEASINGDURATION)) - { - xml->writeTextElement("easingduration", QString::number(easingDuration)); - } + if (!qFuzzyCompare(m_easingDuration, GlobalVariables::JoyButton::DEFAULTEASINGDURATION)) + xml->writeTextElement("easingduration", QString::number(m_easingDuration)); if (extraAccelerationEnabled) - { xml->writeTextElement("extraacceleration", "true"); - } - if (qFuzzyCompare(extraAccelerationMultiplier, DEFAULTEXTRACCELVALUE)) - { + if (!qFuzzyCompare(extraAccelerationMultiplier, GlobalVariables::JoyButton::DEFAULTEXTRACCELVALUE)) xml->writeTextElement("accelerationmultiplier", QString::number(extraAccelerationMultiplier)); - } - if (qFuzzyCompare(startAccelMultiplier, DEFAULTSTARTACCELMULTIPLIER)) - { + if (!qFuzzyCompare(startAccelMultiplier, GlobalVariables::JoyButton::DEFAULTSTARTACCELMULTIPLIER)) xml->writeTextElement("startaccelmultiplier", QString::number(startAccelMultiplier)); - } - if (qFuzzyCompare(minMouseDistanceAccelThreshold, DEFAULTMINACCELTHRESHOLD)) - { + if (!qFuzzyCompare(minMouseDistanceAccelThreshold, GlobalVariables::JoyButton::DEFAULTMINACCELTHRESHOLD)) xml->writeTextElement("minaccelthreshold", QString::number(minMouseDistanceAccelThreshold)); - } - if (qFuzzyCompare(maxMouseDistanceAccelThreshold, DEFAULTMAXACCELTHRESHOLD)) - { + if (!qFuzzyCompare(maxMouseDistanceAccelThreshold, GlobalVariables::JoyButton::DEFAULTMAXACCELTHRESHOLD)) xml->writeTextElement("maxaccelthreshold", QString::number(maxMouseDistanceAccelThreshold)); - } - if (qFuzzyCompare(accelDuration, DEFAULTACCELEASINGDURATION)) - { + if (!qFuzzyCompare(accelDuration, GlobalVariables::JoyButton::DEFAULTACCELEASINGDURATION)) xml->writeTextElement("accelextraduration", QString::number(accelDuration)); - } - if (springDeadCircleMultiplier != DEFAULTSPRINGRELEASERADIUS) - { + if (springDeadCircleMultiplier != GlobalVariables::JoyButton::DEFAULTSPRINGRELEASERADIUS) xml->writeTextElement("springreleaseradius", QString::number(springDeadCircleMultiplier)); - } if (extraAccelCurve != DEFAULTEXTRAACCELCURVE) { QString temp = QString(); - if (extraAccelCurve == LinearAccelCurve) - { - temp = "linear"; - } - else if (extraAccelCurve == EaseOutSineCurve) - { - temp = "easeoutsine"; - } - else if (extraAccelCurve == EaseOutQuadAccelCurve) - { - temp = "easeoutquad"; - } - else if (extraAccelCurve == EaseOutCubicAccelCurve) + + switch(extraAccelCurve) { - temp = "easeoutcubic"; + case LinearAccelCurve: + temp = "linear"; + break; + + case EaseOutSineCurve: + temp = "easeoutsine"; + break; + + case EaseOutQuadAccelCurve: + temp = "easeoutquad"; + break; + + case EaseOutCubicAccelCurve: + temp = "easeoutcubic"; + break; } if (!temp.isEmpty()) - { xml->writeTextElement("extraaccelerationcurve", temp); - } } // Write information about assigned slots. @@ -2110,15 +1877,16 @@ void JoyButton::writeConfig(QXmlStreamWriter *xml) { xml->writeStartElement("slots"); QListIterator iter(*getAssignedSlots()); + while (iter.hasNext()) { JoyButtonSlot *buttonslot = iter.next(); buttonslot->writeConfig(xml); } + xml->writeEndElement(); } - xml->writeEndElement(); } } @@ -2133,10 +1901,8 @@ bool JoyButton::readButtonConfig(QXmlStreamReader *xml) { found = true; QString temptext = xml->readElementText(); - if (temptext == "true") - { - this->setToggle(true); - } + + if (temptext == "true") this->setToggle(true); } else if ((xml->name() == "turbointerval") && xml->isStartElement()) { @@ -2149,27 +1915,17 @@ bool JoyButton::readButtonConfig(QXmlStreamReader *xml) { found = true; QString temptext = xml->readElementText(); - if (temptext == "normal") - { - this->setTurboMode(NormalTurbo); - } - else if (temptext == "gradient") - { - this->setTurboMode(GradientTurbo); - } - else if (temptext == "pulse") - { - this->setTurboMode(PulseTurbo); - } + + if (temptext == "normal") this->setTurboMode(NormalTurbo); + else if (temptext == "gradient") this->setTurboMode(GradientTurbo); + else if (temptext == "pulse") this->setTurboMode(PulseTurbo); } else if ((xml->name() == "useturbo") && xml->isStartElement()) { found = true; QString temptext = xml->readElementText(); - if (temptext == "true") - { - this->setUseTurbo(true); - } + + if (temptext == "true") this->setUseTurbo(true); } else if ((xml->name() == "mousespeedx") && xml->isStartElement()) { @@ -2189,35 +1945,34 @@ bool JoyButton::readButtonConfig(QXmlStreamReader *xml) { found = true; QString temptext = xml->readElementText(); - if (temptext == "true") - { - this->setCycleResetStatus(true); - } + + if (temptext == "true") this->setCycleResetStatus(true); } else if ((xml->name() == "cycleresetinterval") && xml->isStartElement()) { found = true; QString temptext = xml->readElementText(); int tempchoice = temptext.toInt(); - if (tempchoice >= MINCYCLERESETTIME) - { + + if (tempchoice >= GlobalVariables::JoyButton::MINCYCLERESETTIME) this->setCycleResetTime(tempchoice); - } } else if ((xml->name() == "slots") && xml->isStartElement()) { found = true; xml->readNextStartElement(); + while (!xml->atEnd() && (!xml->isEndElement() && (xml->name() != "slots"))) { if ((xml->name() == "slot") && xml->isStartElement()) { JoyButtonSlot *buttonslot = new JoyButtonSlot(this); buttonslot->readConfig(xml); - bool validSlot = buttonslot->isValidSlot(); - if (validSlot) + + if (buttonslot->isValidSlot()) { bool inserted = insertAssignedSlot(buttonslot, false); + if (!inserted) { delete buttonslot; @@ -2245,10 +2000,9 @@ bool JoyButton::readButtonConfig(QXmlStreamReader *xml) found = true; QString temptext = xml->readElementText(); int tempchoice = temptext.toInt(); - if ((tempchoice >= 0) && (tempchoice <= InputDevice::NUMBER_JOYSETS)) - { + + if ((tempchoice >= 0) && (tempchoice <= GlobalVariables::InputDevice::NUMBER_JOYSETS)) this->setChangeSetSelection(tempchoice - 1, false); - } } } else if ((xml->name() == "setselectcondition") && xml->isStartElement()) @@ -2258,74 +2012,36 @@ bool JoyButton::readButtonConfig(QXmlStreamReader *xml) found = true; QString temptext = xml->readElementText(); SetChangeCondition tempcondition = SetChangeDisabled; - if (temptext == "one-way") - { - tempcondition = SetChangeOneWay; - } - else if (temptext == "two-way") - { - tempcondition = SetChangeTwoWay; - } - else if (temptext == "while-held") - { - tempcondition = SetChangeWhileHeld; - } + + if (temptext == "one-way") tempcondition = SetChangeOneWay; + else if (temptext == "two-way") tempcondition = SetChangeTwoWay; + else if (temptext == "while-held") tempcondition = SetChangeWhileHeld; if (tempcondition != SetChangeDisabled) - { this->setChangeSetCondition(tempcondition, false, false); - } } } else if ((xml->name() == "mousemode") && xml->isStartElement()) { found = true; QString temptext = xml->readElementText(); - if (temptext == "cursor") - { - setMouseMode(MouseCursor); - } - else if (temptext == "spring") - { - setMouseMode(MouseSpring); - } + + if (temptext == "cursor") setMouseMode(MouseCursor); + else if (temptext == "spring") setMouseMode(MouseSpring); } else if ((xml->name() == "mouseacceleration") && xml->isStartElement()) { found = true; QString temptext = xml->readElementText(); - if (temptext == "linear") - { - setMouseCurve(LinearCurve); - } - else if (temptext == "quadratic") - { - setMouseCurve(QuadraticCurve); - } - else if (temptext == "cubic") - { - setMouseCurve(CubicCurve); - } - else if (temptext == "quadratic-extreme") - { - setMouseCurve(QuadraticExtremeCurve); - } - else if (temptext == "power") - { - setMouseCurve(PowerCurve); - } - else if (temptext == "precision") - { - setMouseCurve(EnhancedPrecisionCurve); - } - else if (temptext == "easing-quadratic") - { - setMouseCurve(EasingQuadraticCurve); - } - else if (temptext == "easing-cubic") - { - setMouseCurve(EasingCubicCurve); - } + + if (temptext == "linear") setMouseCurve(LinearCurve); + else if (temptext == "quadratic") setMouseCurve(QuadraticCurve); + else if (temptext == "cubic") setMouseCurve(CubicCurve); + else if (temptext == "quadratic-extreme") setMouseCurve(QuadraticExtremeCurve); + else if (temptext == "power") setMouseCurve(PowerCurve); + else if (temptext == "precision") setMouseCurve(EnhancedPrecisionCurve); + else if (temptext == "easing-quadratic") setMouseCurve(EasingQuadraticCurve); + else if (temptext == "easing-cubic") setMouseCurve(EasingCubicCurve); } else if ((xml->name() == "mousespringwidth") && xml->isStartElement()) { @@ -2352,33 +2068,29 @@ bool JoyButton::readButtonConfig(QXmlStreamReader *xml) { found = true; QString temptext = xml->readElementText(); - if (!temptext.isEmpty()) - { - setActionName(temptext); - } + + if (!temptext.isEmpty()) setActionName(temptext); } else if ((xml->name() == "wheelspeedx") && xml->isStartElement()) { found = true; QString temptext = xml->readElementText(); int tempchoice = temptext.toInt(); - setWheelSpeedX(tempchoice); + setWheelSpeed(tempchoice, 'X'); } else if ((xml->name() == "wheelspeedy") && xml->isStartElement()) { found = true; QString temptext = xml->readElementText(); int tempchoice = temptext.toInt(); - setWheelSpeedY(tempchoice); + setWheelSpeed(tempchoice, 'Y'); } else if ((xml->name() == "relativespring") && xml->isStartElement()) { found = true; QString temptext = xml->readElementText(); - if (temptext == "true") - { - this->setSpringRelativeStatus(true); - } + + if (temptext == "true") this->setSpringRelativeStatus(true); } else if ((xml->name() == "easingduration") && xml->isStartElement()) { @@ -2391,10 +2103,8 @@ bool JoyButton::readButtonConfig(QXmlStreamReader *xml) { found = true; QString temptext = xml->readElementText(); - if (temptext == "true") - { - setExtraAccelerationStatus(true); - } + + if (temptext == "true") setExtraAccelerationStatus(true); } else if ((xml->name() == "accelerationmultiplier") && xml->isStartElement()) { @@ -2437,22 +2147,11 @@ bool JoyButton::readButtonConfig(QXmlStreamReader *xml) QString temptext = xml->readElementText(); JoyExtraAccelerationCurve tempcurve = DEFAULTEXTRAACCELCURVE; - if (temptext == "linear") - { - tempcurve = LinearAccelCurve; - } - else if (temptext == "easeoutsine") - { - tempcurve = EaseOutSineCurve; - } - else if (temptext == "easeoutquad") - { - tempcurve = EaseOutQuadAccelCurve; - } - else if (temptext == "easeoutcubic") - { - tempcurve = EaseOutCubicAccelCurve; - } + + if (temptext == "linear") tempcurve = LinearAccelCurve; + else if (temptext == "easeoutsine") tempcurve = EaseOutSineCurve; + else if (temptext == "easeoutquad") tempcurve = EaseOutQuadAccelCurve; + else if (temptext == "easeoutcubic") tempcurve = EaseOutCubicAccelCurve; setExtraAccelerationCurve(tempcurve); } @@ -2461,10 +2160,8 @@ bool JoyButton::readButtonConfig(QXmlStreamReader *xml) found = true; QString temptext = xml->readElementText(); int tempchoice = temptext.toInt(); - if (!relativeSpring) - { - setSpringDeadCircleMultiplier(tempchoice); - } + + if (!relativeSpring) setSpringDeadCircleMultiplier(tempchoice); } return found; @@ -2476,14 +2173,10 @@ QString JoyButton::getName(bool forceFullFormat, bool displayNames) QString newlabel = getPartialName(forceFullFormat, displayNames); newlabel.append(": "); - if (!actionName.isEmpty() && displayNames) - { - newlabel.append(actionName); - } - else - { - newlabel.append(getCalculatedActiveZoneSummary()); - } + + if (!actionName.isEmpty() && displayNames) newlabel.append(actionName); + else newlabel.append(getCalculatedActiveZoneSummary()); + return newlabel; } @@ -2492,20 +2185,19 @@ QString JoyButton::getPartialName(bool forceFullFormat, bool displayNames) const qInstallMessageHandler(MessageHandler::myMessageOutput); QString temp = QString(); + if (!buttonName.isEmpty() && displayNames) { if (forceFullFormat) - { temp.append(trUtf8("Button")).append(" "); - } + temp.append(buttonName); } else if (!defaultButtonName.isEmpty()) { if (forceFullFormat) - { temp.append(trUtf8("Button")).append(" "); - } + temp.append(defaultButtonName); } else @@ -2532,8 +2224,8 @@ QString JoyButton::getSlotsSummary() { QListIterator iter(*getAssignedSlots()); QStringList stringlist = QStringList(); - int i = 0; + while (iter.hasNext()) { JoyButtonSlot *slot = iter.next(); @@ -2567,17 +2259,15 @@ QString JoyButton::getActiveZoneSummary() qInstallMessageHandler(MessageHandler::myMessageOutput); QList tempList = getActiveZoneList(); - QString temp = buildActiveZoneSummary(tempList); - return temp; + return buildActiveZoneSummary(tempList); } QString JoyButton::getCalculatedActiveZoneSummary() { qInstallMessageHandler(MessageHandler::myMessageOutput); - activeZoneStringLock.lockForRead(); - QString temp = this->activeZoneString; - activeZoneStringLock.unlock(); + QString temp = QString(); + lockForWritedString(temp, activeZoneString); return temp; } @@ -2588,10 +2278,7 @@ void JoyButton::buildActiveZoneSummaryString() { qInstallMessageHandler(MessageHandler::myMessageOutput); - activeZoneStringLock.lockForWrite(); - this->activeZoneString = getActiveZoneSummary(); - activeZoneStringLock.unlock(); - + lockForWritedString(activeZoneString, getActiveZoneSummary()); emit activeZoneChanged(); } @@ -2602,9 +2289,7 @@ void JoyButton::localBuildActiveZoneSummaryString() { qInstallMessageHandler(MessageHandler::myMessageOutput); - activeZoneStringLock.lockForWrite(); - this->activeZoneString = getActiveZoneSummary(); - activeZoneStringLock.unlock(); + lockForWritedString(activeZoneString, getActiveZoneSummary()); } QString JoyButton::buildActiveZoneSummary(QList &tempList) @@ -2620,18 +2305,12 @@ QString JoyButton::buildActiveZoneSummary(QList &tempList) if (setSelectionCondition == SetChangeOneWay) { newlabel.append(trUtf8("[Set %1 1W]").arg(setSelection+1)); - if (iter.hasNext()) - { - newlabel.append(" "); - } + if (iter.hasNext()) newlabel.append(" "); } else if (setSelectionCondition == SetChangeTwoWay) { newlabel = newlabel.append(trUtf8("[Set %1 2W]").arg(setSelection+1)); - if (iter.hasNext()) - { - newlabel.append(" "); - } + if (iter.hasNext()) newlabel.append(" "); } if (setSelectionCondition == SetChangeWhileHeld) @@ -2641,10 +2320,12 @@ QString JoyButton::buildActiveZoneSummary(QList &tempList) else if (iter.hasNext()) { bool behindHold = false; + while (iter.hasNext()) { JoyButtonSlot *slot = iter.next(); JoyButtonSlot::JoySlotInputAction mode = slot->getSlotMode(); + switch (mode) { case JoyButtonSlot::JoyKeyboard: @@ -2652,6 +2333,7 @@ QString JoyButton::buildActiveZoneSummary(QList &tempList) case JoyButtonSlot::JoyMouseMovement: { QString temp = slot->getSlotString(); + if (behindHold) { temp.prepend("[H] "); @@ -2689,6 +2371,7 @@ QString JoyButton::buildActiveZoneSummary(QList &tempList) case JoyButtonSlot::JoyExecute: { QString temp = slot->getSlotString(); + if (behindHold) { temp.prepend("[H] "); @@ -2702,19 +2385,15 @@ QString JoyButton::buildActiveZoneSummary(QList &tempList) case JoyButtonSlot::JoyRelease: { if (currentRelease == nullptr) - { - findReleaseEventIterEnd(&iter); - } + findJoySlotsEnd(&iter); break; } - case JoyButtonSlot::JoyDistance: { iter.toBack(); break; } - case JoyButtonSlot::JoyDelay: { iter.toBack(); @@ -2753,7 +2432,6 @@ QList JoyButton::getActiveZoneList() QListIterator activeSlotsIter(getActiveSlots()); QListIterator assignmentsIter(*getAssignedSlots()); - QListIterator *iter = nullptr; QReadWriteLock *tempLock = nullptr; @@ -2795,15 +2473,12 @@ QList JoyButton::getActiveZoneList() { JoyButtonSlot *slot = iter->next(); JoyButtonSlot::JoySlotInputAction mode = slot->getSlotMode(); + switch (mode) { case JoyButtonSlot::JoyKeyboard: case JoyButtonSlot::JoyMouseButton: case JoyButtonSlot::JoyMouseMovement: - { - tempSlotList.append(slot); - break; - } case JoyButtonSlot::JoyKeyPress: case JoyButtonSlot::JoyHold: case JoyButtonSlot::JoyLoadProfile: @@ -2817,38 +2492,20 @@ QList JoyButton::getActiveZoneList() case JoyButtonSlot::JoyRelease: { if (currentRelease == nullptr) - { - findReleaseEventIterEnd(iter); - } + findJoySlotsEnd(iter); break; } case JoyButtonSlot::JoyDistance: + case JoyButtonSlot::JoyCycle: { iter->toBack(); break; } - case JoyButtonSlot::JoyCycle: + default: { - iter->toBack(); break; } - case JoyButtonSlot::JoyPause: - { - - break; - } - case JoyButtonSlot::JoyMouseSpeedMod: - { - - break; - } - case JoyButtonSlot::JoyDelay: - { - - break; - } - } } } @@ -2924,21 +2581,15 @@ bool JoyButton::setAssignedSlot(int code, JoyButtonSlot::JoySlotInputAction mode bool slotInserted = false; JoyButtonSlot *slot = new JoyButtonSlot(code, mode, this); - if (slot->getSlotMode() == JoyButtonSlot::JoyDistance) + + if (slot->getSlotMode() == JoyButtonSlot::JoyDistance && (slot->getSlotCode() >= 1) && (slot->getSlotCode() <= 100) && (getTotalSlotDistance(slot) <= 1.0)) { - if ((slot->getSlotCode() >= 1) && (slot->getSlotCode() <= 100)) - { - double tempDistance = getTotalSlotDistance(slot); - if (tempDistance <= 1.0) - { - assignmentsLock.lockForWrite(); - getAssignmentsLocal().append(slot); - assignmentsLock.unlock(); + assignmentsLock.lockForWrite(); + getAssignmentsLocal().append(slot); + assignmentsLock.unlock(); - buildActiveZoneSummaryString(); - slotInserted = true; - } - } + buildActiveZoneSummaryString(); + slotInserted = true; } else if (slot->getSlotCode() >= 0) { @@ -2955,13 +2606,10 @@ bool JoyButton::setAssignedSlot(int code, JoyButtonSlot::JoySlotInputAction mode checkTurboCondition(slot); emit slotsChanged(); } - else + else if (slot != nullptr) { - if (slot != nullptr) - { - delete slot; - slot = nullptr; - } + delete slot; + slot = nullptr; } return slotInserted; @@ -2983,21 +2631,14 @@ bool JoyButton::setAssignedSlot(int code, int alias, bool slotInserted = false; JoyButtonSlot *slot = new JoyButtonSlot(code, alias, mode, this); - if (slot->getSlotMode() == JoyButtonSlot::JoyDistance) + if (slot->getSlotMode() == JoyButtonSlot::JoyDistance && (slot->getSlotCode() >= 1) && (slot->getSlotCode() <= 100) && (getTotalSlotDistance(slot) <= 1.0)) { - if ((slot->getSlotCode() >= 1) && (slot->getSlotCode() <= 100)) - { - double tempDistance = getTotalSlotDistance(slot); - if (tempDistance <= 1.0) - { - assignmentsLock.lockForWrite(); - getAssignmentsLocal().append(slot); - assignmentsLock.unlock(); + assignmentsLock.lockForWrite(); + getAssignmentsLocal().append(slot); + assignmentsLock.unlock(); - buildActiveZoneSummaryString(); - slotInserted = true; - } - } + buildActiveZoneSummaryString(); + slotInserted = true; } else if (slot->getSlotCode() >= 0) { @@ -3014,13 +2655,10 @@ bool JoyButton::setAssignedSlot(int code, int alias, checkTurboCondition(slot); emit slotsChanged(); } - else + else if (slot != nullptr) { - if (slot != nullptr) - { - delete slot; - slot = nullptr; - } + delete slot; + slot = nullptr; } return slotInserted; @@ -3041,22 +2679,11 @@ bool JoyButton::setAssignedSlot(int code, int alias, int index, qInstallMessageHandler(MessageHandler::myMessageOutput); bool permitSlot = true; - JoyButtonSlot *slot = new JoyButtonSlot(code, alias, mode, this); - if (slot->getSlotMode() == JoyButtonSlot::JoyDistance) + + if ((slot->getSlotMode() == JoyButtonSlot::JoyDistance) && (slot->getSlotCode() >= 1) && (slot->getSlotCode() <= 100)) { - if ((slot->getSlotCode() >= 1) && (slot->getSlotCode() <= 100)) - { - double tempDistance = getTotalSlotDistance(slot); - if (tempDistance > 1.0) - { - permitSlot = false; - } - } - else - { - permitSlot = false; - } + if (getTotalSlotDistance(slot) > 1.0) permitSlot = false; } else if (slot->getSlotCode() < 0) { @@ -3071,7 +2698,7 @@ bool JoyButton::setAssignedSlot(int code, int alias, int index, { // Insert slot and move existing slots. JoyButtonSlot *temp = getAssignedSlots()->at(index); - if (temp) + if (temp != nullptr) { delete temp; temp = nullptr; @@ -3087,18 +2714,13 @@ bool JoyButton::setAssignedSlot(int code, int alias, int index, checkTurboCondition(slot); assignmentsLock.unlock(); - buildActiveZoneSummaryString(); - emit slotsChanged(); } - else + else if (slot != nullptr) { - if (slot != nullptr) - { - delete slot; - slot = nullptr; - } + delete slot; + slot = nullptr; } return permitSlot; @@ -3119,22 +2741,11 @@ bool JoyButton::insertAssignedSlot(int code, int alias, int index, qInstallMessageHandler(MessageHandler::myMessageOutput); bool permitSlot = true; - JoyButtonSlot *slot = new JoyButtonSlot(code, alias, mode, this); - if (slot->getSlotMode() == JoyButtonSlot::JoyDistance) + + if (slot->getSlotMode() == JoyButtonSlot::JoyDistance && (slot->getSlotCode() >= 1) && (slot->getSlotCode() <= 100)) { - if ((slot->getSlotCode() >= 1) && (slot->getSlotCode() <= 100)) - { - double tempDistance = getTotalSlotDistance(slot); - if (tempDistance > 1.0) - { - permitSlot = false; - } - } - else - { - permitSlot = false; - } + if (getTotalSlotDistance(slot) > 1.0) permitSlot = false; } else if (slot->getSlotCode() < 0) { @@ -3162,18 +2773,13 @@ bool JoyButton::insertAssignedSlot(int code, int alias, int index, checkTurboCondition(slot); assignmentsLock.unlock(); - buildActiveZoneSummaryString(); - emit slotsChanged(); } - else + else if (slot != nullptr) { - if (slot != nullptr) - { - delete slot; - slot = nullptr; - } + delete slot; + slot = nullptr; } return permitSlot; @@ -3185,32 +2791,16 @@ bool JoyButton::insertAssignedSlot(JoyButtonSlot *newSlot, bool updateActiveStri bool permitSlot = false; - if (newSlot->getSlotMode() == JoyButtonSlot::JoyDistance) - { - if ((newSlot->getSlotCode() >= 1) && (newSlot->getSlotCode() <= 100)) - { - double tempDistance = getTotalSlotDistance(newSlot); - if (tempDistance <= 1.0) - { - permitSlot = true; - } - } - } - else if (newSlot->getSlotMode() == JoyButtonSlot::JoyLoadProfile) - { - permitSlot = true; - } - else if (newSlot->getSlotMode() == JoyButtonSlot::JoyTextEntry && - !newSlot->getTextData().isEmpty()) + if ((newSlot->getSlotMode() == JoyButtonSlot::JoyDistance) && (newSlot->getSlotCode() >= 1) && (newSlot->getSlotCode() <= 100)) { - permitSlot = true; + if (getTotalSlotDistance(newSlot) <= 1.0) permitSlot = true; } - else if (newSlot->getSlotMode() == JoyButtonSlot::JoyExecute && + else if ((newSlot->getSlotMode() == JoyButtonSlot::JoyTextEntry || newSlot->getSlotMode() == JoyButtonSlot::JoyExecute) && !newSlot->getTextData().isEmpty()) { permitSlot = true; } - else if (newSlot->getSlotCode() >= 0) + else if ((newSlot->getSlotMode() == JoyButtonSlot::JoyLoadProfile) || newSlot->getSlotCode() >= 0) { permitSlot = true; } @@ -3223,10 +2813,7 @@ bool JoyButton::insertAssignedSlot(JoyButtonSlot *newSlot, bool updateActiveStri assignmentsLock.unlock(); if (updateActiveString) - { buildActiveZoneSummaryString(); - } - emit slotsChanged(); } @@ -3242,27 +2829,15 @@ bool JoyButton::setAssignedSlot(JoyButtonSlot *otherSlot, int index) bool permitSlot = false; JoyButtonSlot *newslot = new JoyButtonSlot(otherSlot, this); - if (newslot->getSlotMode() == JoyButtonSlot::JoyDistance) + if (newslot->getSlotMode() == JoyButtonSlot::JoyDistance && (newslot->getSlotCode() >= 1) && (newslot->getSlotCode() <= 100)) { - if ((newslot->getSlotCode() >= 1) && (newslot->getSlotCode() <= 100)) - { - double tempDistance = getTotalSlotDistance(newslot); - if (tempDistance <= 1.0) - { - permitSlot = true; - } - } + if (getTotalSlotDistance(newslot) <= 1.0) permitSlot = true; } else if (newslot->getSlotMode() == JoyButtonSlot::JoyLoadProfile) { permitSlot = true; } - else if ((newslot->getSlotMode() == JoyButtonSlot::JoyTextEntry) && - !newslot->getTextData().isEmpty()) - { - permitSlot = true; - } - else if ((newslot->getSlotMode() == JoyButtonSlot::JoyExecute) && + else if ((newslot->getSlotMode() == JoyButtonSlot::JoyExecute || newslot->getSlotMode() == JoyButtonSlot::JoyTextEntry) && !newslot->getTextData().isEmpty()) { permitSlot = true; @@ -3275,13 +2850,13 @@ bool JoyButton::setAssignedSlot(JoyButtonSlot *otherSlot, int index) if (permitSlot) { assignmentsLock.lockForWrite(); - checkTurboCondition(newslot); if ((index >= 0) && (index < getAssignedSlots()->count())) { // Slot already exists. Override code and place into desired slot JoyButtonSlot *temp = getAssignedSlots()->at(index); + if (temp != nullptr) { delete temp; @@ -3297,12 +2872,10 @@ bool JoyButton::setAssignedSlot(JoyButtonSlot *otherSlot, int index) } assignmentsLock.unlock(); - buildActiveZoneSummaryString(); - emit slotsChanged(); } - else + else if (newslot != nullptr) { delete newslot; newslot = nullptr; @@ -3375,9 +2948,7 @@ void JoyButton::setChangeSetSelection(int index, bool updateActiveString) setSelection = index; if (updateActiveString) - { buildActiveZoneSummaryString(); - } emit propertyUpdated(); } @@ -3402,12 +2973,12 @@ void JoyButton::setChangeSetCondition(SetChangeCondition condition, if ((condition == SetChangeWhileHeld) || (condition == SetChangeTwoWay)) { // Set new condition - emit setAssignmentChanged(index, setSelection, condition); + emit setAssignmentChanged(m_index, setSelection, condition); } else if ((setSelectionCondition == SetChangeWhileHeld) || (setSelectionCondition == SetChangeTwoWay)) { // Remove old condition - emit setAssignmentChanged(index, setSelection, SetChangeDisabled); + emit setAssignmentChanged(m_index, setSelection, SetChangeDisabled); } setSelectionCondition = condition; @@ -3418,16 +2989,12 @@ void JoyButton::setChangeSetCondition(SetChangeCondition condition, } if (setSelectionCondition == SetChangeDisabled) - { setChangeSetSelection(-1); - } if (setSelectionCondition != oldCondition) { if (updateActiveString) - { buildActiveZoneSummaryString(); - } emit propertyUpdated(); } @@ -3451,7 +3018,7 @@ int JoyButton::getOriginSet() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return originset; + return m_originset; } void JoyButton::pauseWaitEvent() @@ -3462,7 +3029,7 @@ void JoyButton::pauseWaitEvent() { if (!isButtonPressedQueue.isEmpty() && createDeskTimer.isActive()) { - if (slotiter != nullptr) + if (slotiter != nullptr) { slotiter->toBack(); @@ -3479,10 +3046,9 @@ void JoyButton::pauseWaitEvent() pauseWaitTimer.stop(); slotiter->toFront(); + if (previousCycle != nullptr) - { slotiter->findNext(previousCycle); - } quitEvent = true; keyPressHold.restart(); @@ -3495,16 +3061,11 @@ void JoyButton::pauseWaitEvent() // If release timer is active, temporarily // disable it if (releaseDeskTimer.isActive()) - { releaseDeskTimer.stop(); - } if (inpauseHold.elapsed() < currentPause->getSlotCode()) { - int proposedInterval = currentPause->getSlotCode() - inpauseHold.elapsed(); - proposedInterval = proposedInterval > 0 ? proposedInterval : 0; - int newTimerInterval = qMin(10, proposedInterval); - pauseWaitTimer.start(newTimerInterval); + startTimerOverrun(currentPause->getSlotCode(), &inpauseHold, &pauseWaitTimer, 0); } else { @@ -3516,9 +3077,7 @@ void JoyButton::pauseWaitEvent() // If release timer was disabled but if the button // is not pressed, restart the release timer. if (!releaseDeskTimer.isActive() && (isButtonPressedQueue.isEmpty() || !isButtonPressedQueue.last())) - { waitForReleaseDeskEvent(); - } } } else @@ -3540,72 +3099,18 @@ void JoyButton::checkForSetChange() { if (!tempFinalState && (setSelectionCondition == SetChangeOneWay) && (setSelection > -1)) { - // If either timer is currently active, - // stop the timer - if (createDeskTimer.isActive()) - { - createDeskTimer.stop(); - } - - if (releaseDeskTimer.isActive()) - { - releaseDeskTimer.stop(); - } - - isButtonPressedQueue.clear(); - ignoreSetQueue.clear(); - - emit released(index); - emit setChangeActivated(setSelection); + restartAllForSetChange(); } else if (!tempFinalState && (setSelectionCondition == SetChangeTwoWay) && (setSelection > -1)) { - // If either timer is currently active, - // stop the timer - if (createDeskTimer.isActive()) - { - createDeskTimer.stop(); - } - - if (releaseDeskTimer.isActive()) - { - releaseDeskTimer.stop(); - } - - isButtonPressedQueue.clear(); - ignoreSetQueue.clear(); - - emit released(index); - emit setChangeActivated(setSelection); + restartAllForSetChange(); } else if ((setSelectionCondition == SetChangeWhileHeld) && (setSelection > -1)) { - if (tempFinalState) - { - whileHeldStatus = true; - } - else if (!tempFinalState) - { - whileHeldStatus = false; - } - - // If either timer is currently active, - // stop the timer - if (createDeskTimer.isActive()) - { - createDeskTimer.stop(); - } - - if (releaseDeskTimer.isActive()) - { - releaseDeskTimer.stop(); - } - - isButtonPressedQueue.clear(); - ignoreSetQueue.clear(); + if (tempFinalState) whileHeldStatus = true; + else if (!tempFinalState) whileHeldStatus = false; - emit released(index); - emit setChangeActivated(setSelection); + restartAllForSetChange(); } } @@ -3613,25 +3118,38 @@ void JoyButton::checkForSetChange() if (!isButtonPressedQueue.isEmpty()) { isButtonPressedQueue.clear(); + if (tempFinalState) - { isButtonPressedQueue.enqueue(tempFinalState); - } } // Clear queue except for a press if it is last in if (!ignoreSetQueue.isEmpty()) { - bool tempFinalIgnoreSetsState = ignoreSetQueue.last(); + bool tempFinalIgnoreSetsState_local = ignoreSetQueue.last(); ignoreSetQueue.clear(); + if (tempFinalState) - { - ignoreSetQueue.enqueue(tempFinalIgnoreSetsState); - } + ignoreSetQueue.enqueue(tempFinalIgnoreSetsState_local); } } } +void JoyButton::restartAllForSetChange() +{ + if (createDeskTimer.isActive()) + createDeskTimer.stop(); + + if (releaseDeskTimer.isActive()) + releaseDeskTimer.stop(); + + isButtonPressedQueue.clear(); + ignoreSetQueue.clear(); + + emit released(m_index); + emit setChangeActivated(setSelection); +} + void JoyButton::waitForDeskEvent() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -3677,22 +3195,21 @@ void JoyButton::waitForReleaseDeskEvent() if (quitEvent && !keyPressTimer.isActive()) { if (releaseDeskTimer.isActive()) - { releaseDeskTimer.stop(); - } + createDeskTimer.stop(); keyPressTimer.stop(); releaseDeskEvent(); } else if (!releaseDeskTimer.isActive()) { -#ifdef Q_CC_MSVC - releaseDeskTimer.start(1); - createDeskTimer.stop(); -#else - releaseDeskTimer.start(1); - createDeskTimer.stop(); -#endif + #ifdef Q_CC_MSVC + releaseDeskTimer.start(1); + createDeskTimer.stop(); + #else + releaseDeskTimer.start(1); + createDeskTimer.stop(); + #endif } else if (releaseDeskTimer.isActive()) { @@ -3708,10 +3225,12 @@ bool JoyButton::containsSequence() assignmentsLock.lockForRead(); QListIterator tempiter(*getAssignedSlots()); + while (tempiter.hasNext()) { JoyButtonSlot *slot = tempiter.next(); JoyButtonSlot::JoySlotInputAction mode = slot->getSlotMode(); + if ((mode == JoyButtonSlot::JoyPause) || (mode == JoyButtonSlot::JoyHold) || (mode == JoyButtonSlot::JoyDistance) @@ -3721,6 +3240,7 @@ bool JoyButton::containsSequence() tempiter.toBack(); } } + assignmentsLock.unlock(); return result; @@ -3733,10 +3253,9 @@ void JoyButton::holdEvent() if (currentHold != nullptr) { bool currentlyPressed = false; + if (!isButtonPressedQueue.isEmpty()) - { currentlyPressed = isButtonPressedQueue.last(); - } // Activate hold event if (currentlyPressed && (buttonHold.elapsed() > currentHold->getSlotCode())) @@ -3759,11 +3278,7 @@ void JoyButton::holdEvent() qDebug() << "Elapsed time has not occurred, because buttonHold: " << buttonHold.elapsed() << " is not greater than currentHoldCode: " << currentHold->getSlotCode(); #endif - int holdTime = currentHold->getSlotCode(); - int proposedInterval = holdTime - buttonHold.elapsed(); - proposedInterval = (proposedInterval > 0) ? proposedInterval : 0; - int newTimerInterval = qMin(10, proposedInterval); - holdTimer.start(newTimerInterval); + startTimerOverrun(currentHold->getSlotCode(), &buttonHold, &holdTimer); } // Pre-emptive release else @@ -3775,13 +3290,13 @@ void JoyButton::holdEvent() currentHold = nullptr; holdTimer.stop(); - if (slotiter != nullptr) + if (slotiter != nullptr) { #ifndef QT_DEBUG_NO_OUTPUT qDebug() << "slotiter exists"; #endif - findHoldEventEnd(); + findJoySlotsEnd(slotiter); createDeskEvent(); } } @@ -3792,6 +3307,23 @@ void JoyButton::holdEvent() } } +void JoyButton::startTimerOverrun(int slotCode, QTime* currSlotTime, QTimer* currSlotTimer, bool releasedDeskTimer) +{ + int proposedInterval = slotCode - currSlotTime->elapsed(); + proposedInterval = (proposedInterval > 0) ? proposedInterval : 0; + int newTimerInterval = qMin(10, proposedInterval); + currSlotTimer->start(newTimerInterval); + + if (releasedDeskTimer) { + + // If release timer is active, push next run until + // after keyDelayTimer will timeout again. Helps + // reduce CPU usage of an excessively repeating timer. + if (releaseDeskTimer.isActive()) + releaseDeskTimer.start(proposedInterval); + } +} + void JoyButton::delayEvent() { @@ -3800,31 +3332,26 @@ void JoyButton::delayEvent() if (currentDelay != nullptr) { bool currentlyPressed = false; + if (!isButtonPressedQueue.isEmpty()) - { currentlyPressed = isButtonPressedQueue.last(); - } - // Delay time has elapsed. Continue processing slots. if ((currentDelay != nullptr) && (buttonDelay.elapsed() > currentDelay->getSlotCode())) { + // Delay time has elapsed. Continue processing slots. currentDelay = nullptr; delayTimer.stop(); buttonDelay.restart(); createDeskEvent(); } - // Elapsed time has not occurred else if (currentlyPressed) { - int delayTime = currentDelay->getSlotCode(); - int proposedInterval = delayTime - buttonDelay.elapsed(); - proposedInterval = (proposedInterval > 0) ? proposedInterval : 0; - int newTimerInterval = qMin(10, proposedInterval); - delayTimer.start(newTimerInterval); + // Elapsed time has not occurred + startTimerOverrun(currentDelay->getSlotCode(), &buttonDelay, &delayTimer); } - // Pre-emptive release else { + // Pre-emptive release currentDelay = nullptr; delayTimer.stop(); } @@ -3850,16 +3377,10 @@ void JoyButton::releaseDeskEvent(bool skipsetchange) repeatHelper.getRepeatTimer()->stop(); #endif setChangeTimer.stop(); - releaseActiveSlots(); - if (!isButtonPressedQueue.isEmpty() && (currentRelease == nullptr)) - { - releaseSlotEvent(); - } - else if (currentRelease != nullptr) - { - currentRelease = nullptr; - } + + if (!isButtonPressedQueue.isEmpty() && (currentRelease == nullptr)) releaseSlotEvent(); + else if (currentRelease != nullptr) currentRelease = nullptr; if (!skipsetchange && (setSelectionCondition != SetChangeDisabled) && !isButtonPressedQueue.isEmpty() && (currentRelease == nullptr)) @@ -3869,73 +3390,22 @@ void JoyButton::releaseDeskEvent(bool skipsetchange) if (!tempButtonPressed && !tempFinalIgnoreSetsState) { - if ((setSelectionCondition == SetChangeWhileHeld) && whileHeldStatus) - { - setChangeTimer.start(0); - } - else if (setSelectionCondition != SetChangeWhileHeld) - { - setChangeTimer.start(); - } + if ((setSelectionCondition == SetChangeWhileHeld) && whileHeldStatus) setChangeTimer.start(0); + else if (setSelectionCondition != SetChangeWhileHeld) setChangeTimer.start(); } else { - bool tempFinalState = false; - if (!isButtonPressedQueue.isEmpty()) - { - tempFinalState = isButtonPressedQueue.last(); - isButtonPressedQueue.clear(); - if (tempFinalState) - { - isButtonPressedQueue.enqueue(tempFinalState); - } - } - - if (!ignoreSetQueue.isEmpty()) - { - bool tempFinalIgnoreSetsState = ignoreSetQueue.last(); - ignoreSetQueue.clear(); - if (tempFinalState) - { - ignoreSetQueue.enqueue(tempFinalIgnoreSetsState); - } - } + changeStatesQueue(false); } } else { - bool tempFinalState = false; - if (!isButtonPressedQueue.isEmpty()) - { - tempFinalState = isButtonPressedQueue.last(); - isButtonPressedQueue.clear(); - if (tempFinalState || (currentRelease != nullptr)) - { - isButtonPressedQueue.enqueue(tempFinalState); - } - } - - if (!ignoreSetQueue.isEmpty()) - { - bool tempFinalIgnoreSetsState = ignoreSetQueue.last(); - ignoreSetQueue.clear(); - if (tempFinalState || (currentRelease != nullptr)) - { - ignoreSetQueue.enqueue(tempFinalIgnoreSetsState); - } - } + changeStatesQueue(true); } if (currentRelease == nullptr) { - lastAccelerationDistance = 0.0; - currentAccelMulti = 0.0; - currentAccelerationDistance = 0.0; - startingAccelerationDistance = 0.0; - oldAccelMulti = updateOldAccelMulti = 0.0; - accelTravel = 0.0; - accelExtraDurationTime.restart(); - + restartAccelParams(true, true, false); lastMouseDistance = 0.0; currentMouseDistance = 0.0; updateStartingMouseDistance = true; @@ -3974,9 +3444,11 @@ void JoyButton::releaseDeskEvent(bool skipsetchange) JoyButtonSlot *tempslot = nullptr; bool exit = false; + while (slotiter->hasNext() && !exit) { tempslot = slotiter->next(); + if (tempslot->getSlotMode() == JoyButtonSlot::JoyCycle) { currentCycle = tempslot; @@ -4017,12 +3489,43 @@ void JoyButton::releaseDeskEvent(bool skipsetchange) slotiter->toFront(); } - this->currentDistance = nullptr; + m_currentDistance = nullptr; this->currentKeyPress = nullptr; quitEvent = true; } +} + +void JoyButton::changeStatesQueue(bool currentReleased) +{ + bool tempFinalState = false; + + if (!isButtonPressedQueue.isEmpty()) + { + tempFinalState = isButtonPressedQueue.last(); + isButtonPressedQueue.clear(); + + if (currentReleased) { + + if (tempFinalState || (currentRelease != nullptr)) + isButtonPressedQueue.enqueue(tempFinalState); + } else { + if (tempFinalState) isButtonPressedQueue.enqueue(tempFinalState); + } + } + + if (!ignoreSetQueue.isEmpty()) + { + bool tempFinalIgnoreSetsState = ignoreSetQueue.last(); + ignoreSetQueue.clear(); + if (currentReleased) { + if (tempFinalState || (currentRelease != nullptr)) + ignoreSetQueue.enqueue(tempFinalIgnoreSetsState); + } else { + if (tempFinalState) ignoreSetQueue.enqueue(tempFinalIgnoreSetsState); + } + } } /** @@ -4034,13 +3537,7 @@ double JoyButton::getDistanceFromDeadZone() { qInstallMessageHandler(MessageHandler::myMessageOutput); - double distance = 0.0; - if (isButtonPressed) - { - distance = 1.0; - } - - return distance; + return isButtonPressed ? 1.0 : 0.0; } double JoyButton::getAccelerationDistance() @@ -4068,23 +3565,22 @@ double JoyButton::getTotalSlotDistance(JoyButtonSlot *slot) double tempDistance = 0.0; QListIterator iter(*getAssignedSlots()); + while (iter.hasNext()) { JoyButtonSlot *currentSlot = iter.next(); int tempcode = currentSlot->getSlotCode(); JoyButtonSlot::JoySlotInputAction mode = currentSlot->getSlotMode(); + if (mode == JoyButtonSlot::JoyDistance) { tempDistance += tempcode / 100.0; + if (slot == currentSlot) - { - // Current slot found. Go to end of iterator - // so loop will exit iter.toBack(); - } + } - // Reset tempDistance - else if (mode == JoyButtonSlot::JoyCycle) + else if (mode == JoyButtonSlot::JoyCycle) // Reset tempDistance { tempDistance = 0.0; } @@ -4099,9 +3595,11 @@ bool JoyButton::containsDistanceSlots() bool result = false; QListIterator iter(*getAssignedSlots()); + while (iter.hasNext()) { JoyButtonSlot *slot = iter.next(); + if (slot->getSlotMode() == JoyButtonSlot::JoyDistance) { result = true; @@ -4117,9 +3615,11 @@ void JoyButton::clearAssignedSlots(bool signalEmit) qInstallMessageHandler(MessageHandler::myMessageOutput); QListIterator iter(*getAssignedSlots()); + while (iter.hasNext()) { JoyButtonSlot *slot = iter.next(); + if (slot != nullptr) { delete slot; @@ -4128,11 +3628,7 @@ void JoyButton::clearAssignedSlots(bool signalEmit) } getAssignmentsLocal().clear(); - - if (signalEmit) - { - emit slotsChanged(); - } + if (signalEmit) emit slotsChanged(); } void JoyButton::removeAssignedSlot(int index) @@ -4144,6 +3640,7 @@ void JoyButton::removeAssignedSlot(int index) if ((index >= 0) && (index < getAssignedSlots()->size())) { JoyButtonSlot *slot = getAssignedSlots()->takeAt(index); + if (slot != nullptr) { delete slot; @@ -4151,7 +3648,6 @@ void JoyButton::removeAssignedSlot(int index) } tempAssignLocker.unlock(); - buildActiveZoneSummaryString(); emit slotsChanged(); } @@ -4161,62 +3657,18 @@ void JoyButton::clearSlotsEventReset(bool clearSignalEmit) { qInstallMessageHandler(MessageHandler::myMessageOutput); - QWriteLocker tempAssignLocker(&assignmentsLock); - - turboTimer.stop(); - pauseWaitTimer.stop(); - createDeskTimer.stop(); - releaseDeskTimer.stop(); - holdTimer.stop(); - mouseWheelVerticalEventTimer.stop(); - mouseWheelHorizontalEventTimer.stop(); - setChangeTimer.stop(); - keyPressTimer.stop(); - delayTimer.stop(); - activeZoneTimer.stop(); - -#ifdef Q_OS_WIN - repeatHelper.getRepeatTimer()->stop(); -#endif - - if (slotiter != nullptr) - { - delete slotiter; - slotiter = nullptr; - } + QWriteLocker tempAssignLocker(&assignmentsLock); + resetSlotsProp(); + stopTimers(true, true, false); releaseActiveSlots(); clearAssignedSlots(clearSignalEmit); - - isButtonPressedQueue.clear(); - ignoreSetQueue.clear(); - mouseEventQueue.clear(); - mouseWheelVerticalEventQueue.clear(); - mouseWheelHorizontalEventQueue.clear(); + clearQueues(); #ifndef QT_DEBUG_NO_OUTPUT qDebug() << "all current slots and previous slots ale cleared"; #endif - currentCycle = nullptr; - previousCycle = nullptr; - currentPause = nullptr; - currentHold = nullptr; - currentDistance = nullptr; - currentRawValue = 0; - currentMouseEvent = nullptr; - currentRelease = nullptr; - currentWheelVerticalEvent = nullptr; - currentWheelHorizontalEvent = nullptr; - currentKeyPress = nullptr; - currentDelay = nullptr; - - isKeyPressed = isButtonPressed = false; - - activeZoneTimer.start(); - quitEvent = true; - - } void JoyButton::eventReset() @@ -4225,56 +3677,15 @@ void JoyButton::eventReset() QWriteLocker tempAssignLocker(&assignmentsLock); - turboTimer.stop(); - pauseWaitTimer.stop(); - createDeskTimer.stop(); - releaseDeskTimer.stop(); - holdTimer.stop(); - mouseWheelVerticalEventTimer.stop(); - mouseWheelHorizontalEventTimer.stop(); - setChangeTimer.stop(); - keyPressTimer.stop(); - delayTimer.stop(); - activeZoneTimer.stop(); - -#ifdef Q_OS_WIN - repeatHelper.getRepeatTimer()->stop(); -#endif - - if (slotiter != nullptr) - { - delete slotiter; - slotiter = nullptr; - } - - isButtonPressedQueue.clear(); - ignoreSetQueue.clear(); - mouseEventQueue.clear(); - mouseWheelVerticalEventQueue.clear(); - mouseWheelHorizontalEventQueue.clear(); + resetSlotsProp(); + stopTimers(false, true, false); + clearQueues(); #ifndef QT_DEBUG_NO_OUTPUT qDebug() << "all current slots and previous slots ale cleared"; #endif - currentCycle = nullptr; - previousCycle = nullptr; - currentPause = nullptr; - currentHold = nullptr; - currentDistance = nullptr; - currentRawValue = 0; - currentMouseEvent = nullptr; - currentRelease = nullptr; - currentWheelVerticalEvent = nullptr; - currentWheelHorizontalEvent = nullptr; - currentKeyPress = nullptr; - currentDelay = nullptr; - - isKeyPressed = isButtonPressed = false; - releaseActiveSlots(); - - quitEvent = true; } void JoyButton::releaseActiveSlots() @@ -4285,38 +3696,24 @@ void JoyButton::releaseActiveSlots() { QWriteLocker tempLocker(&activeZoneLock); - #ifdef Q_OS_WIN - bool changeRepeatState = false; - #endif - QListIterator iter(getActiveSlots()); + bool changeRepeatState = false; + QListIterator iter(getActiveSlots()); iter.toBack(); + while (iter.hasPrevious()) { JoyButtonSlot *slot = iter.previous(); int tempcode = slot->getSlotCode(); + int references = 0; JoyButtonSlot::JoySlotInputAction mode = slot->getSlotMode(); if (mode == JoyButtonSlot::JoyKeyboard) { - int referencecount = activeKeys.value(tempcode, 1) - 1; - if (referencecount <= 0) - { - sendevent(slot, false); - activeKeys.remove(tempcode); - #ifdef Q_OS_WIN - changeRepeatState = true; - #endif - } - else - { - activeKeys.insert(tempcode, referencecount); - } + countActiveSlots(tempcode, references, slot, GlobalVariables::JoyButton::activeKeys, changeRepeatState, true); - if ((lastActiveKey == slot) && (referencecount <= 0)) - { + if ((lastActiveKey == slot) && (references <= 0)) lastActiveKey = nullptr; - } } else if (mode == JoyButtonSlot::JoyMouseButton) { @@ -4325,16 +3722,7 @@ void JoyButton::releaseActiveSlots() (tempcode != static_cast(JoyButtonSlot::MouseWheelLeft)) && (tempcode != static_cast(JoyButtonSlot::MouseWheelRight))) { - int referencecount = (activeMouseButtons.value(tempcode, 1) - 1); - if (referencecount <= 0) - { - sendevent(slot, false); - activeMouseButtons.remove(tempcode); - } - else - { - activeMouseButtons.insert(tempcode, referencecount); - } + countActiveSlots(tempcode, references, slot, GlobalVariables::JoyButton::activeMouseButtons, changeRepeatState); } else if ((tempcode == static_cast(JoyButtonSlot::MouseWheelUp)) || (tempcode == static_cast(JoyButtonSlot::MouseWheelDown))) @@ -4353,52 +3741,13 @@ void JoyButton::releaseActiveSlots() else if (mode == JoyButtonSlot::JoyMouseMovement) { JoyMouseMovementMode mousemode = getMouseMode(); + if (mousemode == MouseCursor) { - QListIterator iterX(cursorXSpeeds); - int i = cursorXSpeeds.length(); - QList indexesToRemove; - while (iterX.hasNext()) - { - mouseCursorInfo info = iterX.next(); - if (info.slot == slot) - { - indexesToRemove.append(i); - } - - i++; - } - - QListIterator removeXIter(indexesToRemove); - while (removeXIter.hasPrevious()) - { - int index = removeXIter.previous(); - cursorXSpeeds.removeAt(index); - } - indexesToRemove.clear(); - - i = cursorYSpeeds.length(); - - QListIterator iterY(cursorYSpeeds); - while (iterY.hasNext()) - { - mouseCursorInfo info = iterY.next(); - if (info.slot == slot) - { - indexesToRemove.append(i); - } - i++; - } - - QListIterator removeYIter(indexesToRemove); - while (removeYIter.hasPrevious()) - { - int index = removeYIter.previous(); - cursorYSpeeds.removeAt(index); - } - indexesToRemove.clear(); + releaseMoveSlots(cursorXSpeeds, slot, indexesToRemove); + releaseMoveSlots(cursorYSpeeds, slot, indexesToRemove); slot->getEasingTime()->restart(); slot->setEasingStatus(false); } @@ -4410,84 +3759,13 @@ void JoyButton::releaseActiveSlots() tempcode == static_cast(JoyButtonSlot::MouseDown)) ? 0.0 : -2.0; double springDeadCircleX = 0.0; - if (getSpringDeadCircleMultiplier() > 0) - { - if (tempcode == static_cast(JoyButtonSlot::MouseLeft)) - { - double temp = getCurrentSpringDeadCircle(); - if (temp > getLastMouseDistanceFromDeadZone()) - { - springDeadCircleX = -getLastMouseDistanceFromDeadZone(); - } - else - { - springDeadCircleX = -temp; - } - } - else if (tempcode == static_cast(JoyButtonSlot::MouseRight)) - { - double temp = getCurrentSpringDeadCircle(); - if (temp > getLastMouseDistanceFromDeadZone()) - { - springDeadCircleX = getLastMouseDistanceFromDeadZone(); - } - else - { - springDeadCircleX = temp; - } - } - } - double springDeadCircleY = 0.0; - if (getSpringDeadCircleMultiplier() > 0) - { - if (tempcode == static_cast(JoyButtonSlot::MouseUp)) - { - double temp = getCurrentSpringDeadCircle(); - if (temp > getLastMouseDistanceFromDeadZone()) - { - springDeadCircleY = -getLastMouseDistanceFromDeadZone(); - } - else - { - springDeadCircleY = -temp; - } - } - else if (tempcode == static_cast(JoyButtonSlot::MouseDown)) - { - double temp = getCurrentSpringDeadCircle(); - if (temp > getLastMouseDistanceFromDeadZone()) - { - springDeadCircleY = getLastMouseDistanceFromDeadZone(); - } - else - { - springDeadCircleY = temp; - } - } - } - PadderCommon::springModeInfo infoX; - infoX.displacementX = mouse1; - infoX.displacementY = -2.0; - infoX.springDeadX = springDeadCircleX; - infoX.springDeadY = springDeadCircleY; - infoX.width = springWidth; - infoX.height = springHeight; - infoX.relative = relativeSpring; - infoX.screen = springModeScreen; - springXSpeeds.append(infoX); - - PadderCommon::springModeInfo infoY; - infoY.displacementX = -2.0; - infoY.displacementY = mouse2; - infoY.springDeadX = springDeadCircleX; - infoY.springDeadY = springDeadCircleY; - infoY.width = springWidth; - infoY.height = springHeight; - infoY.relative = relativeSpring; - infoY.screen = springModeScreen; - springYSpeeds.append(infoY); + checkSpringDeadCircle(tempcode, springDeadCircleX, JoyButtonSlot::MouseLeft, JoyButtonSlot::MouseRight); + checkSpringDeadCircle(tempcode, springDeadCircleY, JoyButtonSlot::MouseUp, JoyButtonSlot::MouseDown); + updateMouseProperties(mouse1, springDeadCircleX, springWidth, springHeight, relativeSpring, GlobalVariables::JoyButton::springModeScreen, springXSpeeds, 'n', -2.0, springDeadCircleY); + updateMouseProperties(-2.0, springDeadCircleX, springWidth, springHeight, relativeSpring, GlobalVariables::JoyButton::springModeScreen, springYSpeeds, 'n', mouse2, springDeadCircleY); + } mouseEventQueue.removeAll(slot); @@ -4497,6 +3775,7 @@ void JoyButton::releaseActiveSlots() else if (mode == JoyButtonSlot::JoyMouseSpeedMod) { int queueLength = mouseSpeedModList.length(); + if (!mouseSpeedModList.isEmpty()) { mouseSpeedModList.removeAll(slot); @@ -4504,9 +3783,7 @@ void JoyButton::releaseActiveSlots() } if (queueLength <= 0) - { - mouseSpeedModifier = DEFAULTMOUSESPEEDMOD; - } + GlobalVariables::JoyButton::mouseSpeedModifier = GlobalVariables::JoyButton::DEFAULTMOUSESPEEDMOD; } else if (mode == JoyButtonSlot::JoySetChange) { @@ -4516,12 +3793,10 @@ void JoyButton::releaseActiveSlots() } getActiveSlotsLocal().clear(); - currentMouseEvent = nullptr; + if (!mouseEventQueue.isEmpty()) - { mouseEventQueue.clear(); - } pendingMouseButtons.removeAll(this); currentWheelVerticalEvent = nullptr; @@ -4549,8 +3824,8 @@ void JoyButton::releaseActiveSlots() if ((pendingMouseButtons.length() == 0) && (cursorXSpeeds.length() == 0) && (springXSpeeds.length() == 0)) { - cursorRemainderX = 0; - cursorRemainderY = 0; + GlobalVariables::JoyButton::cursorRemainderX = 0; + GlobalVariables::JoyButton::cursorRemainderY = 0; } activeZoneTimer.start(); @@ -4559,7 +3834,7 @@ void JoyButton::releaseActiveSlots() BaseEventHandler *handler = EventHandlerFactory::getInstance()->handler(); if (handler && (handler->getIdentifier() == "sendinput") && - changeRepeatState && lastActiveKey && !useTurbo) + changeRepeatState && lastActiveKey && !m_useTurbo) { InputDevice *device = getParentSet()->getInputDevice(); if (device->isKeyRepeatEnabled()) @@ -4582,16 +3857,82 @@ void JoyButton::releaseActiveSlots() } } +void JoyButton::countActiveSlots(int tempcode, int& references, JoyButtonSlot* slot, QHash& activeSlotsHash, bool& changeRepeatState, bool activeSlotHashWindows) +{ + changeRepeatState = false; + references = activeSlotsHash.value(tempcode, 1) - 1; + + if (references <= 0) + { + sendevent(slot, false); + activeSlotsHash.remove(tempcode); + + // only if activeKeys + #ifdef Q_OS_WIN + if (activeSlotHashWindows) changeRepeatState = true; + #endif + } + else + { + activeSlotsHash.insert(tempcode, references); + } +} + +void JoyButton::setSpringDeadCircle(double& springDeadCircle, int mouseDirection) +{ + if (getCurrentSpringDeadCircle() > getLastMouseDistanceFromDeadZone()) + springDeadCircle = (mouseDirection == JoyButtonSlot::MouseLeft || mouseDirection == JoyButtonSlot::MouseUp) ? -getLastMouseDistanceFromDeadZone() : getLastMouseDistanceFromDeadZone(); + else + springDeadCircle = (mouseDirection == JoyButtonSlot::MouseLeft || mouseDirection == JoyButtonSlot::MouseUp) ? -getCurrentSpringDeadCircle() : getCurrentSpringDeadCircle(); +} + +void JoyButton::checkSpringDeadCircle(int tempcode, double& springDeadCircle, int mouseSlot1, int mouseSlot2) +{ + if (getSpringDeadCircleMultiplier() > 0) + { + if (tempcode == mouseSlot1) + { + setSpringDeadCircle(springDeadCircle, mouseSlot1); + } + else if (tempcode == mouseSlot2) + { + setSpringDeadCircle(springDeadCircle, mouseSlot2); + } + } +} + +void JoyButton::releaseMoveSlots(QList& cursorSpeeds, JoyButtonSlot *slot, QList& indexesToRemove) +{ + QListIterator iter(cursorSpeeds); + int i = cursorSpeeds.length(); + + while (iter.hasNext()) + { + mouseCursorInfo info = iter.next(); + if (info.slot == slot) indexesToRemove.append(i); + i++; + } + + QListIterator removeIter(indexesToRemove); + while (removeIter.hasPrevious()) + { + int index = removeIter.previous(); + cursorSpeeds.removeAt(index); + } + + indexesToRemove.clear(); +} + bool JoyButton::containsReleaseSlots() { qInstallMessageHandler(MessageHandler::myMessageOutput); bool result = false; QListIterator iter(*getAssignedSlots()); + while (iter.hasNext()) { - JoyButtonSlot *slot = iter.next(); - if (slot->getSlotMode() == JoyButtonSlot::JoyRelease) + if (iter.next()->getSlotMode() == JoyButtonSlot::JoyRelease) { result = true; iter.toBack(); @@ -4612,10 +3953,9 @@ void JoyButton::releaseSlotEvent() if (containsReleaseSlots()) { QListIterator iter(*getAssignedSlots()); + if (previousCycle != nullptr) - { iter.findNext(previousCycle); - } int tempElapsed = 0; @@ -4624,19 +3964,13 @@ void JoyButton::releaseSlotEvent() JoyButtonSlot *currentSlot = iter.next(); int tempcode = currentSlot->getSlotCode(); JoyButtonSlot::JoySlotInputAction mode = currentSlot->getSlotMode(); + if (mode == JoyButtonSlot::JoyRelease) { - - tempElapsed += tempcode; - if (tempElapsed <= timeElapsed) - { - temp = currentSlot; - } - else if (tempElapsed > timeElapsed) - { - iter.toBack(); - } + + if (tempElapsed <= timeElapsed) temp = currentSlot; + else iter.toBack(); } else if (mode == JoyButtonSlot::JoyCycle) { @@ -4650,8 +3984,8 @@ void JoyButton::releaseSlotEvent() slotiter->toFront(); slotiter->findNext(temp); currentRelease = temp; - activateSlots(); + if (!keyPressTimer.isActive() && !pauseWaitTimer.isActive()) { releaseActiveSlots(); @@ -4662,126 +3996,39 @@ void JoyButton::releaseSlotEvent() // a hold timer that could be activated // during a release event is stopped. holdTimer.stop(); + if (currentHold != nullptr) - { currentHold = nullptr; - } - } - } -} - - - -void JoyButton::findReleaseEventEnd() -{ - qInstallMessageHandler(MessageHandler::myMessageOutput); - - bool found = false; - while (!found && slotiter->hasNext()) - { - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "slotiter has next element"; - #endif - - JoyButtonSlot *currentSlot = slotiter->next(); - JoyButtonSlot::JoySlotInputAction mode = currentSlot->getSlotMode(); - - if (mode == JoyButtonSlot::JoyRelease) - { - found = true; - } - else if (mode == JoyButtonSlot::JoyCycle) - { - found = true; - } - else if (mode == JoyButtonSlot::JoyHold) - { - found = true; } } - - if (found && slotiter->hasPrevious()) - { - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "There has been found end release. Back to previous slotiter element"; - #endif - - slotiter->previous(); - } } -void JoyButton::findReleaseEventIterEnd(QListIterator *tempiter) +void JoyButton::findJoySlotsEnd(QListIterator *slotiter) { - qInstallMessageHandler(MessageHandler::myMessageOutput); + if (slotiter != nullptr) { - if (tempiter) - { bool found = false; - - while (!found && tempiter->hasNext()) - { - JoyButtonSlot *currentSlot = tempiter->next(); - JoyButtonSlot::JoySlotInputAction mode = currentSlot->getSlotMode(); - - if (mode == JoyButtonSlot::JoyRelease) - { - found = true; - } - else if (mode == JoyButtonSlot::JoyCycle) - { - found = true; - } - else if (mode == JoyButtonSlot::JoyHold) - { - found = true; - } - } - - if (found && tempiter->hasPrevious()) + while (!found && slotiter->hasNext()) { - tempiter->previous(); - } - } -} - -void JoyButton::findHoldEventEnd() -{ - qInstallMessageHandler(MessageHandler::myMessageOutput); - - bool found = false; + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "slotiter has next element"; + #endif - while (!found && slotiter->hasNext()) - { - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "There is next element in slotiter"; - #endif + JoyButtonSlot::JoySlotInputAction mode = slotiter->next()->getSlotMode(); - JoyButtonSlot *currentSlot = slotiter->next(); - JoyButtonSlot::JoySlotInputAction mode = currentSlot->getSlotMode(); + switch(mode) + { + case JoyButtonSlot::JoyRelease: + case JoyButtonSlot::JoyCycle: + case JoyButtonSlot::JoyHold: - if (mode == JoyButtonSlot::JoyRelease) - { - found = true; - } - else if (mode == JoyButtonSlot::JoyCycle) - { - found = true; - } - else if (mode == JoyButtonSlot::JoyHold) - { - found = true; + found = true; + break; + } } - } - - if (found && slotiter->hasPrevious()) - { - slotiter->previous(); - - } else { - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "There wasn't end for hold"; - #endif + if (found && slotiter->hasPrevious()) + slotiter->previous(); } } @@ -4790,7 +4037,7 @@ void JoyButton::setVDPad(VDPad *vdpad) qInstallMessageHandler(MessageHandler::myMessageOutput); joyEvent(false, true); - this->vdpad = vdpad; + m_vdpad = vdpad; emit propertyUpdated(); } @@ -4798,21 +4045,21 @@ bool JoyButton::isPartVDPad() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return (this->vdpad != nullptr); + return (m_vdpad != nullptr); } VDPad* JoyButton::getVDPad() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->vdpad; + return m_vdpad; } void JoyButton::removeVDPad() { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->vdpad = nullptr; + m_vdpad = nullptr; emit propertyUpdated(); } @@ -4825,36 +4072,37 @@ bool JoyButton::isDefault() qInstallMessageHandler(MessageHandler::myMessageOutput); bool value = true; - value = value && (toggle == DEFAULTTOGGLE); - value = value && (turboInterval == DEFAULTTURBOINTERVAL); + + value = value && (m_toggle == GlobalVariables::JoyButton::DEFAULTTOGGLE); + value = value && (turboInterval == GlobalVariables::JoyButton::DEFAULTTURBOINTERVAL); value = value && (currentTurboMode == NormalTurbo); - value = value && (useTurbo == DEFAULTUSETURBO); - value = value && (mouseSpeedX == DEFAULTMOUSESPEEDX); - value = value && (mouseSpeedY == DEFAULTMOUSESPEEDY); - value = value && (setSelection == DEFAULTSETSELECTION); + value = value && (m_useTurbo == GlobalVariables::JoyButton::DEFAULTUSETURBO); + value = value && (mouseSpeedX == GlobalVariables::JoyButton::DEFAULTMOUSESPEEDX); + value = value && (mouseSpeedY == GlobalVariables::JoyButton::DEFAULTMOUSESPEEDY); + value = value && (setSelection == GlobalVariables::JoyButton::DEFAULTSETSELECTION); value = value && (setSelectionCondition == DEFAULTSETCONDITION); value = value && (getAssignedSlots()->isEmpty()); value = value && (mouseMode == DEFAULTMOUSEMODE); value = value && (mouseCurve == DEFAULTMOUSECURVE); - value = value && (springWidth == DEFAULTSPRINGWIDTH); - value = value && (springHeight == DEFAULTSPRINGHEIGHT); - value = value && (qFuzzyCompare(sensitivity, DEFAULTSENSITIVITY)); + value = value && (springWidth == GlobalVariables::JoyButton::DEFAULTSPRINGWIDTH); + value = value && (springHeight == GlobalVariables::JoyButton::DEFAULTSPRINGHEIGHT); + value = value && qFuzzyCompare(sensitivity, GlobalVariables::JoyButton::DEFAULTSENSITIVITY); value = value && (actionName.isEmpty()); - value = value && (wheelSpeedX == DEFAULTWHEELX); - value = value && (wheelSpeedY == DEFAULTWHEELY); - value = value && (cycleResetActive == DEFAULTCYCLERESETACTIVE); - value = value && (cycleResetInterval == DEFAULTCYCLERESET); - value = value && (relativeSpring == DEFAULTRELATIVESPRING); - value = value && (qFuzzyCompare(easingDuration, DEFAULTEASINGDURATION)); - - value = value && (extraAccelerationEnabled == false); - value = value && (qFuzzyCompare(extraAccelerationMultiplier, DEFAULTEXTRACCELVALUE)); - value = value && (qFuzzyCompare(minMouseDistanceAccelThreshold, DEFAULTMINACCELTHRESHOLD)); - value = value && (qFuzzyCompare(maxMouseDistanceAccelThreshold, DEFAULTMAXACCELTHRESHOLD)); - value = value && (qFuzzyCompare(startAccelMultiplier, DEFAULTSTARTACCELMULTIPLIER)); - value = value && (qFuzzyCompare(accelDuration, DEFAULTACCELEASINGDURATION)); - value = value && (springDeadCircleMultiplier == DEFAULTSPRINGRELEASERADIUS); + value = value && (wheelSpeedX == GlobalVariables::JoyButton::DEFAULTWHEELX); + value = value && (wheelSpeedY == GlobalVariables::JoyButton::DEFAULTWHEELY); + value = value && (cycleResetActive == GlobalVariables::JoyButton::DEFAULTCYCLERESETACTIVE); + value = value && (cycleResetInterval == GlobalVariables::JoyButton::DEFAULTCYCLERESET); + value = value && (relativeSpring == GlobalVariables::JoyButton::DEFAULTRELATIVESPRING); + value = value && qFuzzyCompare(m_easingDuration, GlobalVariables::JoyButton::DEFAULTEASINGDURATION); + value = value && !extraAccelerationEnabled; + value = value && qFuzzyCompare(extraAccelerationMultiplier, GlobalVariables::JoyButton::DEFAULTEXTRACCELVALUE); + value = value && qFuzzyCompare(minMouseDistanceAccelThreshold, GlobalVariables::JoyButton::DEFAULTMINACCELTHRESHOLD); + value = value && qFuzzyCompare(maxMouseDistanceAccelThreshold, GlobalVariables::JoyButton::DEFAULTMAXACCELTHRESHOLD); + value = value && qFuzzyCompare(startAccelMultiplier, GlobalVariables::JoyButton::DEFAULTSTARTACCELMULTIPLIER); + value = value && qFuzzyCompare(accelDuration, GlobalVariables::JoyButton::DEFAULTACCELEASINGDURATION); + value = value && (springDeadCircleMultiplier == GlobalVariables::JoyButton::DEFAULTSPRINGRELEASERADIUS); value = value && (extraAccelCurve == DEFAULTEXTRAACCELCURVE); + return value; } @@ -5012,24 +4260,14 @@ QString JoyButton::getButtonName() return buttonName; } -void JoyButton::setWheelSpeedX(int speed) -{ - qInstallMessageHandler(MessageHandler::myMessageOutput); - - if ((speed >= 1) && (speed <= 100)) - { - wheelSpeedX = speed; - emit propertyUpdated(); - } -} - -void JoyButton::setWheelSpeedY(int speed) +void JoyButton::setWheelSpeed(int speed, QChar ax) { qInstallMessageHandler(MessageHandler::myMessageOutput); if ((speed >= 1) && (speed <= 100)) { - wheelSpeedY = speed; + if (ax == 'X') wheelSpeedX = speed; + else if (ax == 'Y') wheelSpeedY = speed; emit propertyUpdated(); } } @@ -5066,30 +4304,23 @@ QString JoyButton::getDefaultButtonName() * @brief Take cursor mouse information provided by all buttons and * send a cursor mode mouse event to the display server. */ -void JoyButton::moveMouseCursor(int &movedX, int &movedY, int &movedElapsed) +void JoyButton::moveMouseCursor(int &movedX, int &movedY, int &movedElapsed, QList* mouseHistoryX, QList* mouseHistoryY, QTime* testOldMouseTime, QTimer* staticMouseEventTimer, int mouseRefreshRate, int mouseHistorySize, QList* cursorXSpeeds, QList* cursorYSpeeds, double& cursorRemainderX, double& cursorRemainderY, double weightModifier, int idleMouseRefrRate, QList* pendingMouseButtons) { // qInstallMessageHandler(MessageHandler::myMessageOutput); movedX = 0; movedY = 0; - int elapsedTime = testOldMouseTime.elapsed(); - + int elapsedTime = testOldMouseTime->elapsed(); movedElapsed = elapsedTime; - if (staticMouseEventTimer.interval() < mouseRefreshRate) - { - elapsedTime = mouseRefreshRate + (elapsedTime - staticMouseEventTimer.interval()); - movedElapsed = elapsedTime; - } - if (mouseHistoryX.size() >= mouseHistorySize) - { - mouseHistoryX.removeLast(); - } + if (staticMouseEventTimer->interval() < mouseRefreshRate) + movedElapsed = mouseRefreshRate + (elapsedTime - staticMouseEventTimer->interval()); - if (mouseHistoryY.size() >= mouseHistorySize) - { - mouseHistoryY.removeLast(); - } + if (mouseHistoryX->size() >= mouseHistorySize) + mouseHistoryX->removeLast(); + + if (mouseHistoryY->size() >= mouseHistorySize) + mouseHistoryY->removeLast(); /* * Combine all mouse events to find the distance to move the mouse @@ -5097,28 +4328,20 @@ void JoyButton::moveMouseCursor(int &movedX, int &movedY, int &movedElapsed) * The mouse smoothing technique used is an interpretation of the method * outlined at http://flipcode.net/archives/Smooth_Mouse_Filtering.shtml. */ - if ((cursorXSpeeds.length() == cursorYSpeeds.length()) && - (cursorXSpeeds.length() > 0)) + if ((cursorXSpeeds->length() == cursorYSpeeds->length()) && + (cursorXSpeeds->length() > 0)) { - int queueLength = cursorXSpeeds.length(); + int queueLength = cursorXSpeeds->length(); double finalx = 0.0; double finaly = 0.0; - for (int i=0; i < queueLength; i++) + for (int i = 0; i < queueLength; i++) { - mouseCursorInfo infoX = cursorXSpeeds.takeFirst(); - mouseCursorInfo infoY = cursorYSpeeds.takeFirst(); - if (qFuzzyCompare(infoX.code, 0)) - { - finalx = (infoX.code < 0) ? qMin(infoX.code, finalx) : - qMax(infoX.code, finalx); - } + mouseCursorInfo infoX = cursorXSpeeds->takeFirst(); + mouseCursorInfo infoY = cursorYSpeeds->takeFirst(); - if (qFuzzyCompare(infoY.code, 0)) - { - finaly = (infoY.code < 0) ? qMin(infoY.code, finaly) : - qMax(infoY.code, finaly); - } + distanceForMovingAx(finalx, infoX); + distanceForMovingAx(finaly, infoY); infoX.slot->getMouseInterval()->restart(); infoY.slot->getMouseInterval()->restart(); @@ -5126,133 +4349,60 @@ void JoyButton::moveMouseCursor(int &movedX, int &movedY, int &movedElapsed) // Only apply remainder if both current displacement and remainder // follow the same direction. - if ((cursorRemainderX >= 0) == (finalx >= 0)) - { - finalx += cursorRemainderX; - } + if ((cursorRemainderX >= 0) == (finalx >= 0)) finalx += cursorRemainderX; // Cap maximum relative mouse movement. - if (abs(finalx) > 127) - { - finalx = (finalx < 0) ? -127 : 127; - } + if (abs(finalx) > 127) finalx = (finalx < 0) ? -127 : 127; - mouseHistoryX.prepend(finalx); + mouseHistoryX->prepend(finalx); // Only apply remainder if both current displacement and remainder // follow the same direction. - if ((cursorRemainderY >= 0) == (finaly >= 0)) - { - finaly += cursorRemainderY; - } + if ((cursorRemainderY >= 0) == (finaly >= 0)) finaly += cursorRemainderY; // Cap maximum relative mouse movement. - if (abs(finaly) > 127) - { - finaly = (finaly < 0) ? -127 : 127; - } + if (abs(finaly) > 127) finaly = (finaly < 0) ? -127 : 127; - mouseHistoryY.prepend(finaly); + mouseHistoryY->prepend(finaly); cursorRemainderX = 0; cursorRemainderY = 0; - double adjustedX = 0; double adjustedY = 0; - QListIterator iterX(mouseHistoryX); - double currentWeight = 1.0; - double weightModifier = JoyButton::weightModifier; - double finalWeight = 0.0; - - while (iterX.hasNext()) - { - double temp = iterX.next(); - adjustedX += temp * currentWeight; - finalWeight += currentWeight; - currentWeight *= weightModifier; - } - - if (fabs(adjustedX) > 0) - { - adjustedX = adjustedX / finalWeight; - - if (adjustedX > 0) - { - double oldX = adjustedX; - adjustedX = floor(adjustedX); - cursorRemainderX = oldX - adjustedX; - } - else - { - double oldX = adjustedX; - adjustedX = static_cast(ceil(adjustedX)); - cursorRemainderX = oldX - adjustedX; - } - - } - - QListIterator iterY(mouseHistoryY); - currentWeight = 1.0; - finalWeight = 0.0; - - while (iterY.hasNext()) - { - double temp = iterY.next(); - adjustedY += temp * currentWeight; - finalWeight += currentWeight; - currentWeight *= weightModifier; - } - - if (fabs(adjustedY) > 0) - { - adjustedY = adjustedY / finalWeight; - if (adjustedY > 0) - { - double oldY = adjustedY; - adjustedY = floor(adjustedY); - cursorRemainderY = oldY - adjustedY; - } - else - { - double oldY = adjustedY; - adjustedY = ceil(adjustedY); - cursorRemainderY = oldY - adjustedY; - } - } + adjustAxForCursor(mouseHistoryX, adjustedX, cursorRemainderX, weightModifier); + adjustAxForCursor(mouseHistoryY, adjustedY, cursorRemainderY, weightModifier); // This check is more of a precaution than anything. No need to cause // a sync to happen when not needed. - if ((qFuzzyCompare(adjustedX, 0)) || (qFuzzyCompare(adjustedY, 0))) - { - sendevent(static_cast(adjustedX), static_cast(adjustedY)); - } + if (!qFuzzyIsNull(adjustedX) || !qFuzzyIsNull(adjustedY)) + sendevent(adjustedX, adjustedY); - movedX = static_cast(adjustedX); - movedY = static_cast(adjustedY); + movedX = adjustedX; + movedY = adjustedY; } else { - mouseHistoryX.prepend(0); - mouseHistoryY.prepend(0); + mouseHistoryX->prepend(0); + mouseHistoryY->prepend(0); } // Check if mouse event timer should use idle time. - if (pendingMouseButtons.length() == 0) + if (pendingMouseButtons->length() == 0) { - if (staticMouseEventTimer.interval() != IDLEMOUSEREFRESHRATE) + if (staticMouseEventTimer->interval() != idleMouseRefrRate) { - staticMouseEventTimer.start(IDLEMOUSEREFRESHRATE); + staticMouseEventTimer->start(idleMouseRefrRate); // Clear current mouse history - mouseHistoryX.clear(); - mouseHistoryY.clear(); + mouseHistoryX->clear(); + mouseHistoryY->clear(); // Fill history with zeroes. - for (int i=0; i < mouseHistorySize; i++) + for (int i = 0; i < mouseHistorySize; i++) { - mouseHistoryX.append(0); - mouseHistoryY.append(0); + mouseHistoryX->append(0); + mouseHistoryY->append(0); } } @@ -5261,29 +4411,61 @@ void JoyButton::moveMouseCursor(int &movedX, int &movedY, int &movedElapsed) } else { - if (staticMouseEventTimer.interval() != mouseRefreshRate) - { - // Restore intended QTimer interval. - staticMouseEventTimer.start(mouseRefreshRate); - } + if (staticMouseEventTimer->interval() != mouseRefreshRate) + staticMouseEventTimer->start(mouseRefreshRate); // Restore intended QTimer interval. + } + + cursorXSpeeds->clear(); + cursorYSpeeds->clear(); +} + +void JoyButton::distanceForMovingAx(double& finalAx, mouseCursorInfo infoAx) +{ + if (!qFuzzyIsNull(infoAx.code)) + { + finalAx = (infoAx.code < 0) ? qMin(infoAx.code, finalAx) : + qMax(infoAx.code, finalAx); + } +} + + +void JoyButton::adjustAxForCursor(QList* mouseHistoryList, double& adjustedAx, double& cursorRemainder, double weightModifier) +{ + double currentWeight = 1.0; + double finalWeight = 0.0; + + QListIterator mouseHist(*mouseHistoryList); + while (mouseHist.hasNext()) + { + adjustedAx += mouseHist.next() * currentWeight; + finalWeight += currentWeight; + currentWeight *= weightModifier; } + if (fabs(adjustedAx) > 0) + { + adjustedAx = adjustedAx / finalWeight; + double oldAx = adjustedAx; + + if (adjustedAx > 0) adjustedAx = floor(adjustedAx); + else adjustedAx = ceil(adjustedAx); - cursorXSpeeds.clear(); - cursorYSpeeds.clear(); + cursorRemainder = oldAx - adjustedAx; + } } /** * @brief Take spring mouse information provided by all buttons and * send a spring mode mouse event to the display server. */ -void JoyButton::moveSpringMouse(int &movedX, int &movedY, bool &hasMoved) +void JoyButton::moveSpringMouse(int &movedX, int &movedY, bool &hasMoved, int springModeScreen, QList* springXSpeeds, QList* springYSpeeds, QList* pendingMouseButtons, int mouseRefreshRate, int idleMouseRefrRate, QTimer* staticMouseEventTimer) { qInstallMessageHandler(MessageHandler::myMessageOutput); PadderCommon::springModeInfo fullSpring = { -2.0, -2.0, 0, 0, false, springModeScreen, 0.0, 0.0 }; + PadderCommon::springModeInfo relativeSpring = { -2.0, -2.0, 0, 0, false, springModeScreen, 0.0, 0.0 }; @@ -5292,37 +4474,34 @@ void JoyButton::moveSpringMouse(int &movedX, int &movedY, bool &hasMoved) int realMouseY = movedY = 0; hasMoved = false; - if ((springXSpeeds.length() == springYSpeeds.length()) && - (springXSpeeds.length() > 0)) + if ((springXSpeeds->length() == springYSpeeds->length()) && + (springXSpeeds->length() > 0)) { - int queueLength = springXSpeeds.length(); bool complete = false; - for (int i=queueLength-1; i >= 0 && !complete; i--) + + for (int i = (springXSpeeds->length() - 1); (i >= 0) && !complete; i--) { + double tempx = -2.0; double tempy = -2.0; - double tempSpringDeadX = 0.0; double tempSpringDeadY = 0.0; PadderCommon::springModeInfo infoX; PadderCommon::springModeInfo infoY; - infoX = springXSpeeds.takeLast(); - infoY = springYSpeeds.takeLast(); + infoX = springXSpeeds->takeLast(); + infoY = springYSpeeds->takeLast(); tempx = infoX.displacementX; tempy = infoY.displacementY; - tempSpringDeadX = infoX.springDeadX; tempSpringDeadY = infoY.springDeadY; if (infoX.relative) { if (qFuzzyCompare(relativeSpring.displacementX, -2.0)) - { relativeSpring.displacementX = tempx; - } relativeSpring.relative = true; @@ -5333,14 +4512,10 @@ void JoyButton::moveSpringMouse(int &movedX, int &movedY, bool &hasMoved) else { if (qFuzzyCompare(fullSpring.displacementX, -2.0)) - { fullSpring.displacementX = tempx; - } if (fullSpring.springDeadX == 0.0) - { fullSpring.springDeadX = tempSpringDeadX; - } // Use largest found width for spring // mode dimensions. @@ -5350,9 +4525,7 @@ void JoyButton::moveSpringMouse(int &movedX, int &movedY, bool &hasMoved) if (infoY.relative) { if (qFuzzyCompare(relativeSpring.displacementY, -2.0)) - { relativeSpring.displacementY = tempy; - } relativeSpring.relative = true; @@ -5363,22 +4536,18 @@ void JoyButton::moveSpringMouse(int &movedX, int &movedY, bool &hasMoved) else { if (qFuzzyCompare(fullSpring.displacementY, -2.0)) - { fullSpring.displacementY = tempy; - } if (fullSpring.springDeadY == 0.0) - { fullSpring.springDeadY = tempSpringDeadY; - } // Use largest found height for spring // mode dimensions. fullSpring.height = qMax(infoX.height, fullSpring.height); } - if (((qFuzzyCompare(relativeSpring.displacementX, -2.0)) && (qFuzzyCompare(relativeSpring.displacementY, -2.0))) && - ((qFuzzyCompare(fullSpring.displacementX, -2.0)) && (qFuzzyCompare(fullSpring.displacementY, -2.0)))) + if ((!qFuzzyCompare(relativeSpring.displacementX, -2.0) && !qFuzzyCompare(relativeSpring.displacementY, -2.0)) && + (!qFuzzyCompare(fullSpring.displacementX, -2.0) && !qFuzzyCompare(fullSpring.displacementY, -2.0))) { complete = true; } @@ -5398,17 +4567,13 @@ void JoyButton::moveSpringMouse(int &movedX, int &movedY, bool &hasMoved) } else { - if (!hasFutureSpringEvents()) + if (!hasFutureSpringEvents(JoyButton::getPendingMouseButtons())) { if (fullSpring.springDeadX != 0.0) - { fullSpring.displacementX = fullSpring.springDeadX; - } if (fullSpring.springDeadY != 0.0) - { fullSpring.displacementY = fullSpring.springDeadY; - } sendSpringEvent(&fullSpring, nullptr, &realMouseX, &realMouseY); } @@ -5416,7 +4581,6 @@ void JoyButton::moveSpringMouse(int &movedX, int &movedY, bool &hasMoved) { sendSpringEvent(&fullSpring, nullptr, &realMouseX, &realMouseY); } - } movedX = realMouseX; @@ -5425,42 +4589,36 @@ void JoyButton::moveSpringMouse(int &movedX, int &movedY, bool &hasMoved) } // Check if mouse event timer should use idle time. - if (pendingMouseButtons.length() == 0) + if (pendingMouseButtons->length() == 0) { - staticMouseEventTimer.start(IDLEMOUSEREFRESHRATE); + staticMouseEventTimer->start(idleMouseRefrRate); } else { - if (staticMouseEventTimer.interval() != mouseRefreshRate) - { + if (staticMouseEventTimer->interval() != mouseRefreshRate) // Restore intended QTimer interval. - staticMouseEventTimer.start(mouseRefreshRate); - } + staticMouseEventTimer->start(mouseRefreshRate); } - springXSpeeds.clear(); - springYSpeeds.clear(); + springXSpeeds->clear(); + springYSpeeds->clear(); } void JoyButton::keyPressEvent() { qInstallMessageHandler(MessageHandler::myMessageOutput); - //qDebug() << "RADIO EDIT: " << keyDelayHold.elapsed(); if (keyPressTimer.isActive() && (keyPressHold.elapsed() >= getPreferredKeyPressTime())) { currentKeyPress = nullptr; - keyPressTimer.stop(); keyPressHold.restart(); releaseActiveSlots(); - createDeskTimer.stop(); if (currentRelease != nullptr) { releaseDeskTimer.stop(); - createDeskEvent(); waitForReleaseDeskEvent(); } @@ -5472,19 +4630,7 @@ void JoyButton::keyPressEvent() else { createDeskTimer.stop(); - - int preferredDelay = getPreferredKeyPressTime(); - int proposedInterval = preferredDelay - keyPressHold.elapsed(); - proposedInterval = proposedInterval > 0 ? proposedInterval : 0; - int newTimerInterval = qMin(10, proposedInterval); - keyPressTimer.start(newTimerInterval); - // If release timer is active, push next run until - // after keyDelayTimer will timeout again. Helps - // reduce CPU usage of an excessively repeating timer. - if (releaseDeskTimer.isActive()) - { - releaseDeskTimer.start(proposedInterval); - } + startTimerOverrun(getPreferredKeyPressTime(), &keyPressHold, &keyPressTimer, true); } } @@ -5497,25 +4643,22 @@ bool JoyButton::checkForDelaySequence() qInstallMessageHandler(MessageHandler::myMessageOutput); bool result = false; - QListIterator tempiter(*getAssignedSlots()); // Move iterator to start of cycle. if (previousCycle != nullptr) - { tempiter.findNext(previousCycle); - } while (tempiter.hasNext()) { JoyButtonSlot *slot = tempiter.next(); - JoyButtonSlot::JoySlotInputAction mode = slot->getSlotMode(); - if ((mode == JoyButtonSlot::JoyPause) || (mode == JoyButtonSlot::JoyRelease)) + + if ((slot->getSlotMode() == JoyButtonSlot::JoyPause) || (slot->getSlotMode() == JoyButtonSlot::JoyRelease)) { result = true; tempiter.toBack(); } - else if (mode == JoyButtonSlot::JoyCycle) + else if (slot->getSlotMode() == JoyButtonSlot::JoyCycle) { result = false; tempiter.toBack(); @@ -5529,26 +4672,23 @@ SetJoystick* JoyButton::getParentSet() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return parentSet; + return m_parentSet; } void JoyButton::checkForPressedSetChange() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (!isButtonPressedQueue.isEmpty()) + if (!isButtonPressedQueue.isEmpty() && !whileHeldStatus) { bool tempButtonPressed = isButtonPressedQueue.last(); bool tempFinalIgnoreSetsState = ignoreSetQueue.last(); - if (!whileHeldStatus) - { - if (tempButtonPressed && !tempFinalIgnoreSetsState && + if (tempButtonPressed && !tempFinalIgnoreSetsState && (setSelectionCondition == SetChangeWhileHeld) && (currentRelease == nullptr)) - { - setChangeTimer.start(0); - quitEvent = true; - } + { + setChangeTimer.start(0); + quitEvent = true; } } } @@ -5563,36 +4703,28 @@ int JoyButton::getPreferredKeyPressTime() { qInstallMessageHandler(MessageHandler::myMessageOutput); - int tempPressTime = InputDevice::DEFAULTKEYPRESSTIME; if ((currentKeyPress != nullptr) && (currentKeyPress->getSlotCode() > 0)) { - tempPressTime = currentKeyPress->getSlotCode(); + return currentKeyPress->getSlotCode(); } - else if (parentSet->getInputDevice()->getDeviceKeyPressTime() > 0) + else if ((m_parentSet != nullptr) && (m_parentSet->getInputDevice()->getDeviceKeyPressTime() > 0)) { - tempPressTime = parentSet->getInputDevice()->getDeviceKeyPressTime(); + return m_parentSet->getInputDevice()->getDeviceKeyPressTime(); } - return tempPressTime; + return GlobalVariables::InputDevice::NUMBER_JOYSETS; } void JoyButton::setCycleResetTime(int interval) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (interval >= MINCYCLERESETTIME) - { - int ceiling = MAXCYCLERESETTIME; - int temp = qBound(MINCYCLERESETTIME, interval, ceiling); - cycleResetInterval = temp; - emit propertyUpdated(); - } + if (interval >= GlobalVariables::JoyButton::MINCYCLERESETTIME) + cycleResetInterval = qBound(GlobalVariables::JoyButton::MINCYCLERESETTIME, interval, GlobalVariables::JoyButton::MAXCYCLERESETTIME); else - { - interval = 0; cycleResetActive = false; - emit propertyUpdated(); - } + + emit propertyUpdated(); } int JoyButton::getCycleResetTime() @@ -5621,8 +4753,8 @@ void JoyButton::establishPropertyUpdatedConnections() { qInstallMessageHandler(MessageHandler::myMessageOutput); - connect(this, &JoyButton::slotsChanged, parentSet->getInputDevice(), &InputDevice::profileEdited); - connect(this, &JoyButton::propertyUpdated, parentSet->getInputDevice(), &InputDevice::profileEdited); + connect(this, &JoyButton::slotsChanged, m_parentSet->getInputDevice(), &InputDevice::profileEdited); + connect(this, &JoyButton::propertyUpdated, m_parentSet->getInputDevice(), &InputDevice::profileEdited); } void JoyButton::disconnectPropertyUpdatedConnections() @@ -5630,7 +4762,7 @@ void JoyButton::disconnectPropertyUpdatedConnections() qInstallMessageHandler(MessageHandler::myMessageOutput); disconnect(this, &JoyButton::slotsChanged, nullptr, nullptr); - disconnect(this, &JoyButton::propertyUpdated, parentSet->getInputDevice(), &InputDevice::profileEdited); + disconnect(this, &JoyButton::propertyUpdated, m_parentSet->getInputDevice(), &InputDevice::profileEdited); } /** @@ -5642,18 +4774,14 @@ void JoyButton::establishMouseTimerConnections() qInstallMessageHandler(MessageHandler::myMessageOutput); if (staticMouseEventTimer.timerType() != Qt::PreciseTimer) - { staticMouseEventTimer.setTimerType(Qt::PreciseTimer); - } // Only one connection will be made for each. connect(&staticMouseEventTimer, &QTimer::timeout, &mouseHelper, &JoyButtonMouseHelper::mouseEvent, Qt::UniqueConnection); - if (staticMouseEventTimer.interval() != IDLEMOUSEREFRESHRATE) - { - staticMouseEventTimer.setInterval(IDLEMOUSEREFRESHRATE); - } + if (staticMouseEventTimer.interval() != GlobalVariables::JoyButton::IDLEMOUSEREFRESHRATE) + staticMouseEventTimer.setInterval(GlobalVariables::JoyButton::IDLEMOUSEREFRESHRATE); } void JoyButton::setSpringRelativeStatus(bool value) @@ -5662,10 +4790,7 @@ void JoyButton::setSpringRelativeStatus(bool value) if (value != relativeSpring) { - if (value) - { - setSpringDeadCircleMultiplier(0); - } + if (value) setSpringDeadCircleMultiplier(0); relativeSpring = value; emit propertyUpdated(); @@ -5695,17 +4820,19 @@ void JoyButton::copyAssignments(JoyButton *destButton) assignmentsLock.lockForWrite(); QListIterator iter(*getAssignedSlots()); + while (iter.hasNext()) { JoyButtonSlot *slot = iter.next(); JoyButtonSlot *newslot = new JoyButtonSlot(slot, destButton); destButton->insertAssignedSlot(newslot, false); } + assignmentsLock.unlock(); - destButton->toggle = toggle; + destButton->m_toggle = m_toggle; destButton->turboInterval = turboInterval; - destButton->useTurbo = useTurbo; + destButton->m_useTurbo = m_useTurbo; destButton->mouseSpeedX = mouseSpeedX; destButton->mouseSpeedY = mouseSpeedY; destButton->wheelSpeedX = wheelSpeedX; @@ -5721,7 +4848,7 @@ void JoyButton::copyAssignments(JoyButton *destButton) destButton->cycleResetInterval = cycleResetInterval; destButton->relativeSpring = relativeSpring; destButton->currentTurboMode = currentTurboMode; - destButton->easingDuration = easingDuration; + destButton->m_easingDuration = m_easingDuration; destButton->extraAccelerationEnabled = extraAccelerationEnabled; destButton->extraAccelerationMultiplier = extraAccelerationMultiplier; destButton->minMouseDistanceAccelThreshold = minMouseDistanceAccelThreshold; @@ -5731,10 +4858,9 @@ void JoyButton::copyAssignments(JoyButton *destButton) destButton->extraAccelCurve = extraAccelCurve; destButton->buildActiveZoneSummaryString(); + if (!destButton->isDefault()) - { emit propertyUpdated(); - } } /** @@ -5778,11 +4904,12 @@ bool JoyButton::isPartRealAxis() * @param Mouse speed value * @return Final mouse speed */ -int JoyButton::calculateFinalMouseSpeed(JoyMouseCurve curve, int value) +int JoyButton::calculateFinalMouseSpeed(JoyMouseCurve curve, int value, const float joyspeed) { qInstallMessageHandler(MessageHandler::myMessageOutput); - int result = static_cast(JoyAxis::JOYSPEED) * value; + int result = joyspeed * value; + switch (curve) { case QuadraticExtremeCurve: @@ -5792,26 +4919,10 @@ int JoyButton::calculateFinalMouseSpeed(JoyMouseCurve curve, int value) result *= 1.5; break; } - case LinearCurve: - { - break; - } - case QuadraticCurve: - { - break; - } - case CubicCurve: - { - break; - } - case PowerCurve: - { - break; - } - default: - { - break; - } + default: + { + break; + } } return result; @@ -5821,10 +4932,10 @@ void JoyButton::setEasingDuration(double value) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((value >= MINIMUMEASINGDURATION) && (value <= MAXIMUMEASINGDURATION) && - (qFuzzyCompare(value, easingDuration))) + if ((value >= GlobalVariables::JoyButton::MINIMUMEASINGDURATION) && (value <= GlobalVariables::JoyButton::MAXIMUMEASINGDURATION) && + (!qFuzzyCompare(value, m_easingDuration))) { - easingDuration = value; + m_easingDuration = value; emit propertyUpdated(); } } @@ -5833,7 +4944,7 @@ double JoyButton::getEasingDuration() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return easingDuration; + return m_easingDuration; } JoyButtonMouseHelper* JoyButton::getMouseHelper() @@ -5854,152 +4965,140 @@ QList* JoyButton::getPendingMouseButtons() return &pendingMouseButtons; } -bool JoyButton::hasCursorEvents() + +QList* JoyButton::getCursorXSpeeds() { - // qInstallMessageHandler(MessageHandler::myMessageOutput); + return &cursorXSpeeds; +} - return (cursorXSpeeds.length() != 0) || (cursorYSpeeds.length() != 0); + +QList* JoyButton::getCursorYSpeeds() +{ + return &cursorYSpeeds; } -bool JoyButton::hasSpringEvents() + +QList* JoyButton::getSpringXSpeeds() { - // qInstallMessageHandler(MessageHandler::myMessageOutput); + return &springXSpeeds; +} + - return (springXSpeeds.length() != 0) || (springYSpeeds.length() != 0); +QList* JoyButton::getSpringYSpeeds() +{ + return &springYSpeeds; } -/** - * @brief Get the weight modifier being used for mouse smoothing. - * @return Weight modifier in the range of 0.0 - 1.0. - */ -double JoyButton::getWeightModifier() + +QTimer* JoyButton::getStaticMouseEventTimer() { - qInstallMessageHandler(MessageHandler::myMessageOutput); + return &staticMouseEventTimer; +} - return weightModifier; + +QTime* JoyButton::getTestOldMouseTime() +{ + return &testOldMouseTime; } -/** - * @brief Set the weight modifier to use for mouse smoothing. - * @param Weight modifier in the range of 0.0 - 1.0. - */ -void JoyButton::setWeightModifier(double modifier) + +bool JoyButton::hasCursorEvents(QList* cursorXSpeedsList, QList* cursorYSpeedsList) { - qInstallMessageHandler(MessageHandler::myMessageOutput); + // qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((modifier >= 0.0) && (modifier <= MAXIMUMWEIGHTMODIFIER)) - { - weightModifier = modifier; - } + return (cursorXSpeedsList->length() != 0) || (cursorYSpeedsList->length() != 0); } -/** - * @brief Get mouse history buffer size. - * @return Mouse history buffer size - */ -int JoyButton::getMouseHistorySize() + +bool JoyButton::hasSpringEvents(QList* springXSpeedsList, QList* springYSpeedsList) { - qInstallMessageHandler(MessageHandler::myMessageOutput); + // qInstallMessageHandler(MessageHandler::myMessageOutput); - return mouseHistorySize; + return (springXSpeedsList->length() != 0) || (springYSpeedsList->length() != 0); } /** - * @brief Set mouse history buffer size used for mouse smoothing. - * @param Mouse history buffer size + * @brief Set the weight modifier to use for mouse smoothing. + * @param Weight modifier in the range of 0.0 - 1.0. */ -void JoyButton::setMouseHistorySize(int size) +void JoyButton::setWeightModifier(double modifier, double maxWeightModifier, double& weightModifier) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((size >= 1) && (size <= MAXIMUMMOUSEHISTORYSIZE)) - { - mouseHistoryX.clear(); - mouseHistoryY.clear(); - - mouseHistorySize = size; - } + if ((modifier >= 0.0) && (modifier <= maxWeightModifier)) + weightModifier = modifier; } /** - * @brief Get active mouse movement refresh rate. - * @return + * @brief Set mouse history buffer size used for mouse smoothing. + * @param Mouse history buffer size */ -int JoyButton::getMouseRefreshRate() +void JoyButton::setMouseHistorySize(int size, int maxMouseHistSize, int& mouseHistSize, QList* mouseHistoryX, QList* mouseHistoryY) { qInstallMessageHandler(MessageHandler::myMessageOutput); - return mouseRefreshRate; + if ((size >= 1) && (size <= maxMouseHistSize)) + { + mouseHistoryX->clear(); + mouseHistoryY->clear(); + mouseHistSize = size; + } } /** * @brief Set the mouse refresh rate when a mouse slot is active. * @param Refresh rate in ms. */ -void JoyButton::setMouseRefreshRate(int refresh) +void JoyButton::setMouseRefreshRate(int refresh, int& mouseRefreshRate, int idleMouseRefrRate, JoyButtonMouseHelper* mouseHelper, QList* mouseHistoryX, QList* mouseHistoryY, QTime* testOldMouseTime, QTimer* staticMouseEventTimer) { qInstallMessageHandler(MessageHandler::myMessageOutput); if ((refresh >= 1) && (refresh <= 16)) { mouseRefreshRate = refresh; - int temp = IDLEMOUSEREFRESHRATE; - if (staticMouseEventTimer.isActive()) + if (staticMouseEventTimer->isActive()) { - testOldMouseTime.restart(); - - int tempInterval = staticMouseEventTimer.interval(); + testOldMouseTime->restart(); - if (tempInterval != temp && - tempInterval != 0) + if (staticMouseEventTimer->interval() != idleMouseRefrRate && staticMouseEventTimer->interval() != 0) { - QMetaObject::invokeMethod(&staticMouseEventTimer, "start", + QMetaObject::invokeMethod(staticMouseEventTimer, "start", Q_ARG(int, mouseRefreshRate)); } else { // Restart QTimer to keep QTimer in line with QTime - QMetaObject::invokeMethod(&staticMouseEventTimer, "start", - Q_ARG(int, temp)); + QMetaObject::invokeMethod(staticMouseEventTimer, "start", + Q_ARG(int, idleMouseRefrRate)); } // Clear current mouse history - mouseHistoryX.clear(); - mouseHistoryY.clear(); + mouseHistoryX->clear(); + mouseHistoryY->clear(); } else { - staticMouseEventTimer.setInterval(IDLEMOUSEREFRESHRATE); + staticMouseEventTimer->setInterval(idleMouseRefrRate); } - mouseHelper.carryMouseRefreshRateUpdate(mouseRefreshRate); + mouseHelper->carryMouseRefreshRateUpdate(mouseRefreshRate); } } -/** - * @brief Get the gamepad poll rate used by the application. - * @return Poll rate in ms. - */ -int JoyButton::getGamepadRefreshRate() -{ - qInstallMessageHandler(MessageHandler::myMessageOutput); - - return gamepadRefreshRate; -} - /** * @brief Set the gamepad poll rate to be used in the application. * @param Poll rate in ms. */ -void JoyButton::setGamepadRefreshRate(int refresh) + +void JoyButton::setGamepadRefreshRate(int refresh, int& gamepadRefreshRate, JoyButtonMouseHelper* mouseHelper) { qInstallMessageHandler(MessageHandler::myMessageOutput); if ((refresh >= 1) && (refresh <= 16)) { gamepadRefreshRate = refresh; - mouseHelper.carryGamePollRateUpdate(gamepadRefreshRate); + mouseHelper->carryGamePollRateUpdate(gamepadRefreshRate); } } @@ -6012,6 +5111,7 @@ void JoyButton::checkTurboCondition(JoyButtonSlot *slot) qInstallMessageHandler(MessageHandler::myMessageOutput); JoyButtonSlot::JoySlotInputAction mode = slot->getSlotMode(); + switch (mode) { case JoyButtonSlot::JoyPause: @@ -6024,42 +5124,10 @@ void JoyButton::checkTurboCondition(JoyButtonSlot *slot) setUseTurbo(false); break; } - case JoyButtonSlot::JoyMouseButton: - { - break; - } - case JoyButtonSlot::JoyMouseMovement: - { - break; - } - case JoyButtonSlot::JoyCycle: - { - break; - } - case JoyButtonSlot::JoyMouseSpeedMod: - { - break; - } - case JoyButtonSlot::JoyKeyPress: - { - break; - } - case JoyButtonSlot::JoyDelay: - { - break; - } - case JoyButtonSlot::JoyTextEntry: - { - break; - } - case JoyButtonSlot::JoyExecute: - { - break; - } - default: - { - break; - } + default: + { + break; + } } } @@ -6071,28 +5139,18 @@ void JoyButton::resetProperties() qDebug() << "all current slots and previous slots ale cleared"; #endif - currentCycle = nullptr; - previousCycle = nullptr; - currentPause = nullptr; - currentHold = nullptr; - currentDistance = nullptr; - currentRawValue = 0; - currentMouseEvent = nullptr; - currentRelease = nullptr; - currentWheelVerticalEvent = nullptr; - currentWheelHorizontalEvent = nullptr; - currentKeyPress = nullptr; - currentDelay = nullptr; - currentSetChangeSlot = nullptr; - - isKeyPressed = isButtonPressed = false; - quitEvent = true; + resetAllProperties(); +} - toggle = false; +void JoyButton::resetAllProperties() +{ + resetSlotsProp(true); + + m_toggle = false; turboInterval = 0; isDown = false; toggleActiveState = false; - useTurbo = false; + m_useTurbo = false; mouseSpeedX = 50; mouseSpeedY = 50; wheelSpeedX = 20; @@ -6104,7 +5162,7 @@ void JoyButton::resetProperties() sensitivity = 1.0; setSelection = -1; setSelectionCondition = SetChangeDisabled; - ignoresets = false; + m_ignoresets = false; ignoreEvents = false; whileHeldStatus = false; buttonName.clear(); @@ -6113,41 +5171,19 @@ void JoyButton::resetProperties() cycleResetInterval = 0; relativeSpring = false; lastDistance = 0.0; - currentAccelMulti = 0.0; - lastAccelerationDistance = 0.0; lastMouseDistance = 0.0; currentMouseDistance = 0.0; - updateLastMouseDistance = false; - updateStartingMouseDistance = false; - updateOldAccelMulti = 0.0; - updateInitAccelValues = true; - - currentAccelerationDistance = 0.0; - startingAccelerationDistance = 0.0; + updateMouseParams(false, false, 0.0); + restartAccelParams(false, false, true); lastWheelVerticalDistance = 0.0; lastWheelHorizontalDistance = 0.0; tempTurboInterval = 0; - oldAccelMulti = 0.0; - accelTravel = 0.0; currentTurboMode = DEFAULTTURBOMODE; - easingDuration = DEFAULTEASINGDURATION; - springDeadCircleMultiplier = DEFAULTSPRINGRELEASERADIUS; + m_easingDuration = GlobalVariables::JoyButton::DEFAULTEASINGDURATION; + springDeadCircleMultiplier = GlobalVariables::JoyButton::DEFAULTSPRINGRELEASERADIUS; - pendingEvent = false; - pendingPress = false; - pendingIgnoreSets = false; - - extraAccelerationEnabled = false; - extraAccelerationMultiplier = DEFAULTEXTRACCELVALUE; - minMouseDistanceAccelThreshold = DEFAULTMINACCELTHRESHOLD; - maxMouseDistanceAccelThreshold = DEFAULTMAXACCELTHRESHOLD; - startAccelMultiplier = DEFAULTSTARTACCELMULTIPLIER; - accelDuration = DEFAULTACCELEASINGDURATION; - extraAccelCurve = LinearAccelCurve; - - activeZoneStringLock.lockForWrite(); - activeZoneString = trUtf8("[NO KEY]"); - activeZoneStringLock.unlock(); + updatePendingParams(false, false, false); + lockForWritedString(activeZoneString, trUtf8("[NO KEY]")); } bool JoyButton::isModifierButton() @@ -6157,11 +5193,11 @@ bool JoyButton::isModifierButton() return false; } -void JoyButton::resetActiveButtonMouseDistances() +void JoyButton::resetActiveButtonMouseDistances(JoyButtonMouseHelper* mouseHelper) { qInstallMessageHandler(MessageHandler::myMessageOutput); - mouseHelper.resetButtonMouseDistances(); + mouseHelper->resetButtonMouseDistances(); } void JoyButton::resetAccelerationDistances() @@ -6278,7 +5314,7 @@ void JoyButton::setMinAccelThreshold(double value) if ((value >= 1.0) && (value <= 100.0) && (value <= maxMouseDistanceAccelThreshold)) { minMouseDistanceAccelThreshold = value; - emit propertyUpdated(); + //emit propertyUpdated(); } } @@ -6325,21 +5361,11 @@ double JoyButton::getStartAccelMultiplier() return startAccelMultiplier; } -int JoyButton::getSpringModeScreen() -{ - qInstallMessageHandler(MessageHandler::myMessageOutput); - - return springModeScreen; -} - -void JoyButton::setSpringModeScreen(int screen) +void JoyButton::setSpringModeScreen(int screen, int& springModeScreen) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (screen >= -1) - { - springModeScreen = screen; - } + if (screen >= -1) springModeScreen = screen; } void JoyButton::setAccelExtraDuration(double value) @@ -6360,15 +5386,18 @@ double JoyButton::getAccelExtraDuration() return accelDuration; } -bool JoyButton::hasFutureSpringEvents() + +bool JoyButton::hasFutureSpringEvents(QList* pendingMouseButtons) { qInstallMessageHandler(MessageHandler::myMessageOutput); bool result = false; - QListIterator iter(pendingMouseButtons); + QListIterator iter(*pendingMouseButtons); + while (iter.hasNext()) { JoyButton *temp = iter.next(); + if (temp->getMouseMode() == MouseSpring) { result = true; @@ -6400,65 +5429,58 @@ double JoyButton::getCurrentSpringDeadCircle() return (springDeadCircleMultiplier * 0.01); } -void JoyButton::restartLastMouseTime() +void JoyButton::restartLastMouseTime(QTime* testOldMouseTime) { - testOldMouseTime.restart(); + testOldMouseTime->restart(); } -void JoyButton::setStaticMouseThread(QThread *thread) + +void JoyButton::setStaticMouseThread(QThread *thread, QTimer* staticMouseEventTimer, QTime* testOldMouseTime, int idleMouseRefrRate, JoyButtonMouseHelper* mouseHelper) { - int oldInterval = staticMouseEventTimer.interval(); + int oldInterval = staticMouseEventTimer->interval(); + if (oldInterval == 0) - { - oldInterval = IDLEMOUSEREFRESHRATE; - } + oldInterval = idleMouseRefrRate; - staticMouseEventTimer.moveToThread(thread); - mouseHelper.moveToThread(thread); + staticMouseEventTimer->moveToThread(thread); + mouseHelper->moveToThread(thread); - QMetaObject::invokeMethod(&staticMouseEventTimer, "start", + QMetaObject::invokeMethod(staticMouseEventTimer, "start", Q_ARG(int, oldInterval)); - testOldMouseTime.start(); + testOldMouseTime->start(); #ifdef Q_OS_WIN repeatHelper.moveToThread(thread); #endif + } -void JoyButton::indirectStaticMouseThread(QThread *thread) + +void JoyButton::indirectStaticMouseThread(QThread *thread, QTimer* staticMouseEventTimer, JoyButtonMouseHelper* mouseHelper) { - QMetaObject::invokeMethod(&staticMouseEventTimer, "stop"); + QMetaObject::invokeMethod(staticMouseEventTimer, "stop"); #ifdef Q_OS_WIN QMetaObject::invokeMethod(repeatHelper.getRepeatTimer(), "stop"); #endif - QMetaObject::invokeMethod(&mouseHelper, "changeThread", + QMetaObject::invokeMethod(mouseHelper, "changeThread", Q_ARG(QThread*, thread)); } -bool JoyButton::shouldInvokeMouseEvents() + +bool JoyButton::shouldInvokeMouseEvents(QList* pendingMouseButtons, QTimer* staticMouseEventTimer, QTime* testOldMouseTime) { bool result = false; - if ((pendingMouseButtons.size() > 0) && staticMouseEventTimer.isActive()) - { - int timerInterval = staticMouseEventTimer.interval(); - if (timerInterval == 0) - { - result = true; - } - else if (testOldMouseTime.elapsed() >= timerInterval) - { - result = true; - } - } + if ((staticMouseEventTimer->interval() == 0) && (pendingMouseButtons->size() > 0) && staticMouseEventTimer->isActive()) result = true; + else if ((testOldMouseTime->elapsed() >= staticMouseEventTimer->interval()) && (pendingMouseButtons->size() > 0) && staticMouseEventTimer->isActive()) result = true; return result; } -void JoyButton::invokeMouseEvents() +void JoyButton::invokeMouseEvents(JoyButtonMouseHelper* mouseHelper) { - mouseHelper.mouseEvent(); + mouseHelper->mouseEvent(); } bool JoyButton::hasActiveSlots() @@ -6492,9 +5514,7 @@ void JoyButton::copyExtraAccelerationState(JoyButton *srcButton) srcButton->accelExtraDurationTime.second(), srcButton->accelExtraDurationTime.msec()); - this->updateOldAccelMulti = srcButton->updateOldAccelMulti; - this->updateStartingMouseDistance = srcButton->updateStartingMouseDistance; - this->updateLastMouseDistance = static_cast(srcButton->lastMouseDistance); + updateMouseParams((srcButton->lastMouseDistance != 0.0), srcButton->updateStartingMouseDistance, srcButton->updateOldAccelMulti); } void JoyButton::setUpdateInitAccel(bool state) diff --git a/src/joybutton.h b/src/joybutton.h old mode 100644 new mode 100755 index 028aa9d4d..e36232082 --- a/src/joybutton.h +++ b/src/joybutton.h @@ -20,6 +20,7 @@ #include "joybuttonslot.h" +#include "globalvariables.h" #include "springmousemoveinfo.h" #include "joybuttonmousehelper.h" @@ -62,6 +63,12 @@ class JoyButton : public QObject EaseOutQuadAccelCurve, EaseOutCubicAccelCurve}; enum TurboMode {NormalTurbo=0, GradientTurbo, PulseTurbo}; + typedef struct _mouseCursorInfo + { + JoyButtonSlot *slot; + double code; + } mouseCursorInfo; + void joyEvent(bool pressed, bool ignoresets=false); void queuePendingEvent(bool pressed, bool ignoresets=false); void activatePendingEvent(); @@ -179,92 +186,42 @@ class JoyButton : public QObject TurboMode getTurboMode(); - - static int calculateFinalMouseSpeed(JoyMouseCurve curve, int value); - static int getMouseHistorySize(); - static int getSpringModeScreen(); - static int getMouseRefreshRate(); - static int getGamepadRefreshRate(); - - static double getWeightModifier(); - static double cursorRemainderX; - static double cursorRemainderY; - - static bool hasCursorEvents(); - static bool hasSpringEvents(); - static bool shouldInvokeMouseEvents(); - - static void setWeightModifier(double modifier); - static void moveMouseCursor(int &movedX, int &movedY, int &movedElapsed); - static void moveSpringMouse(int &movedX, int &movedY, bool &hasMoved); - static void setMouseHistorySize(int size); - static void setMouseRefreshRate(int refresh); - static void setSpringModeScreen(int screen); - static void resetActiveButtonMouseDistances(); - static void setGamepadRefreshRate(int refresh); - static void restartLastMouseTime(); - static void setStaticMouseThread(QThread *thread); - static void indirectStaticMouseThread(QThread *thread); - static void invokeMouseEvents(); + static int calculateFinalMouseSpeed(JoyMouseCurve curve, int value, const float joyspeed); + + static bool hasCursorEvents(QList* cursorXSpeedsList, QList* cursorYSpeedsList); + static bool hasSpringEvents(QList* springXSpeedsList, QList* springYSpeedsList); + static bool shouldInvokeMouseEvents(QList* pendingMouseButtons, QTimer* staticMouseEventTimer, QTime* testOldMouseTime); + + static void setWeightModifier(double modifier, double maxWeightModifier, double& weightModifier); + static void moveMouseCursor(int &movedX, int &movedY, int &movedElapsed, QList* mouseHistoryX, QList* mouseHistoryY, QTime* testOldMouseTime, QTimer* staticMouseEventTimer, int mouseRefreshRate, int mouseHistorySize, QList* cursorXSpeeds, QList* cursorYSpeeds, double& cursorRemainderX, double& cursorRemainderY, double weightModifier, int idleMouseRefrRate, QList* pendingMouseButtonse); + static void moveSpringMouse(int &movedX, int &movedY, bool &hasMoved, int springModeScreen, QList* springXSpeeds, QList* springYSpeeds, QList* pendingMouseButtons, int mouseRefreshRate, int idleMouseRefrRate, QTimer* staticMouseEventTimer); + static void setMouseHistorySize(int size, int maxMouseHistSize, int& mouseHistSize, QList* mouseHistoryX, QList* mouseHistoryY); + static void setMouseRefreshRate(int refresh, int& mouseRefreshRate, int idleMouseRefrRate, JoyButtonMouseHelper* mouseHelper, QList* mouseHistoryX, QList* mouseHistoryY, QTime* testOldMouseTime, QTimer* staticMouseEventTimer); + static void setSpringModeScreen(int screen, int& springModeScreen); + static void resetActiveButtonMouseDistances(JoyButtonMouseHelper* mouseHelper); + static void setGamepadRefreshRate(int refresh, int& gamepadRefreshRate, JoyButtonMouseHelper* mouseHelper); + static void restartLastMouseTime(QTime* testOldMouseTime); + static void setStaticMouseThread(QThread *thread, QTimer* staticMouseEventTimer, QTime* testOldMouseTime, int idleMouseRefrRate, JoyButtonMouseHelper* mouseHelper); + static void indirectStaticMouseThread(QThread *thread, QTimer* staticMouseEventTimer, JoyButtonMouseHelper* mouseHelper); + static void invokeMouseEvents(JoyButtonMouseHelper* mouseHelper); static JoyButtonMouseHelper* getMouseHelper(); static QList* getPendingMouseButtons(); - static QList mouseHistoryX; - static QList mouseHistoryY; + static QList* getCursorXSpeeds(); + static QList* getCursorYSpeeds(); + static QList* getSpringXSpeeds(); + static QList* getSpringYSpeeds(); + static QTimer* getStaticMouseEventTimer(); + static QTime* getTestOldMouseTime(); JoyExtraAccelerationCurve getExtraAccelerationCurve(); - static const QString xmlName; - - // Define default values for many properties. - static const int ENABLEDTURBODEFAULT; - static const double DEFAULTMOUSESPEEDMOD; - static const int DEFAULTKEYREPEATDELAY; // unsigned - static const int DEFAULTKEYREPEATRATE; // unsigned static const JoyMouseCurve DEFAULTMOUSECURVE; - static const bool DEFAULTTOGGLE; - static const int DEFAULTTURBOINTERVAL; - static const bool DEFAULTUSETURBO; - static const int DEFAULTMOUSESPEEDX; - static const int DEFAULTMOUSESPEEDY; - static const int DEFAULTSETSELECTION; static const SetChangeCondition DEFAULTSETCONDITION; static const JoyMouseMovementMode DEFAULTMOUSEMODE; - static const int DEFAULTSPRINGWIDTH; - static const int DEFAULTSPRINGHEIGHT; - static const double DEFAULTSENSITIVITY; - static const int DEFAULTWHEELX; - static const int DEFAULTWHEELY; - static const bool DEFAULTCYCLERESETACTIVE; - static const int DEFAULTCYCLERESET; - static const bool DEFAULTRELATIVESPRING; static const TurboMode DEFAULTTURBOMODE; - static const double DEFAULTEASINGDURATION; - static const double MINIMUMEASINGDURATION; - static const double MAXIMUMEASINGDURATION; - - static const int DEFAULTMOUSEHISTORYSIZE; - static const double DEFAULTWEIGHTMODIFIER; - - static const int MAXIMUMMOUSEHISTORYSIZE; - static const double MAXIMUMWEIGHTMODIFIER; - - static const int MAXIMUMMOUSEREFRESHRATE; - static const int DEFAULTIDLEMOUSEREFRESHRATE; - static int IDLEMOUSEREFRESHRATE; - - static const int MINCYCLERESETTIME; // unsigned - static const int MAXCYCLERESETTIME; // unsigned - - static const double DEFAULTEXTRACCELVALUE; - static const double DEFAULTMINACCELTHRESHOLD; - static const double DEFAULTMAXACCELTHRESHOLD; - static const double DEFAULTSTARTACCELMULTIPLIER; - static const double DEFAULTACCELEASINGDURATION; static const JoyExtraAccelerationCurve DEFAULTEXTRAACCELCURVE; - static const int DEFAULTSPRINGRELEASERADIUS; - protected: int getPreferredKeyPressTime(); // unsigned @@ -274,18 +231,14 @@ class JoyButton : public QObject bool distanceEvent(); bool checkForDelaySequence(); bool insertAssignedSlot(JoyButtonSlot *newSlot, bool updateActiveString=true); - void clearAssignedSlots(bool signalEmit=true); void releaseSlotEvent(); - void findReleaseEventEnd(); - void findReleaseEventIterEnd(QListIterator *tempiter); - void findHoldEventEnd(); void checkForPressedSetChange(); void checkTurboCondition(JoyButtonSlot *slot); void vdpadPassEvent(bool pressed, bool ignoresets=false); void localBuildActiveZoneSummaryString(); - static bool hasFutureSpringEvents(); + static bool hasFutureSpringEvents(QList* pendingMouseButtons); virtual double getCurrentSpringDeadCircle(); @@ -295,14 +248,6 @@ class JoyButton : public QObject QString buildActiveZoneSummary(QList &tempList); - - typedef struct _mouseCursorInfo - { - JoyButtonSlot *slot; - double code; - } mouseCursorInfo; - - static double mouseSpeedModifier; static QList mouseSpeedModList; static QList cursorXSpeeds; static QList cursorYSpeeds; @@ -310,22 +255,14 @@ class JoyButton : public QObject static QList springYSpeeds; static QList pendingMouseButtons; - static QHash activeKeys; // QHash activeMouseButtons; // QHashstop(); + #endif + + if (stoppedSlotSetTimer) slotSetChangeTimer.stop(); + + if (slotiter != nullptr) + { + delete slotiter; + slotiter = nullptr; + } + } + + inline void clearQueues() + { + isButtonPressedQueue.clear(); + ignoreSetQueue.clear(); + mouseEventQueue.clear(); + mouseWheelVerticalEventQueue.clear(); + mouseWheelHorizontalEventQueue.clear(); + } + + inline void restartAccelParams(bool updatedOldAccel, bool restartedAccelDurTimer, bool restartedRestParams) + { + lastAccelerationDistance = 0.0; + currentAccelMulti = 0.0; + currentAccelerationDistance = 0.0; + startingAccelerationDistance = 0.0; + + if (updatedOldAccel) oldAccelMulti = updateOldAccelMulti = 0.0; + else oldAccelMulti = 0.0; + + accelTravel = 0.0; + if (restartedAccelDurTimer) accelExtraDurationTime.restart(); + + if (restartedRestParams) + { + updateInitAccelValues = true; + extraAccelerationEnabled = false; + extraAccelerationMultiplier = GlobalVariables::JoyButton::DEFAULTEXTRACCELVALUE; + minMouseDistanceAccelThreshold = GlobalVariables::JoyButton::DEFAULTMINACCELTHRESHOLD; + maxMouseDistanceAccelThreshold = GlobalVariables::JoyButton::DEFAULTMAXACCELTHRESHOLD; + startAccelMultiplier = GlobalVariables::JoyButton::DEFAULTSTARTACCELMULTIPLIER; + accelDuration = GlobalVariables::JoyButton::DEFAULTACCELEASINGDURATION; + extraAccelCurve = LinearAccelCurve; + } + } + + inline void lockForWritedString(QString& param, QString value) + { + activeZoneStringLock.lockForWrite(); + param = value; + activeZoneStringLock.unlock(); + } + + void resetAllProperties(); + void resetPrivVars(); + void restartAllForSetChange(); + void startTimerOverrun(int slotCode, QTime* currSlotTime, QTimer* currSlotTimer, bool releasedDeskTimer = false); + void findJoySlotsEnd(QListIterator *slotiter); + void changeStatesQueue(bool currentReleased); + void countActiveSlots(int tempcode, int& references, JoyButtonSlot* slot, QHash& activeSlotsHash, bool& changeRepeatState, bool activeSlotHashWindows = false); + void releaseMoveSlots(QList& cursorSpeeds, JoyButtonSlot *slot, QList& indexesToRemove); + void setSpringDeadCircle(double& springDeadCircle, int mouseDirection); + void checkSpringDeadCircle(int tempcode, double& springDeadCircle, int mouseSlot1, int mouseSlot2); + static void distanceForMovingAx(double& finalAx, mouseCursorInfo infoAx); + static void adjustAxForCursor(QList* mouseHistoryList, double& adjustedAx, double& cursorRemainder, double weightModifier); + void setDistanceForSpring(JoyButtonMouseHelper& mouseHelper, double& mouseFirstAx, double& mouseSecondAx, double distanceFromDeadZone); + void changeTurboParams(bool _isKeyPressed, bool isButtonPressed); + void updateParamsAfterDistEvent(); + void startSequenceOfPressActive(bool isTurbo, QString debugText); QList& getAssignmentsLocal(); QList& getActiveSlotsLocal(); + void updateMouseProperties(double newAxisValue, double newSpringDead, int newSpringWidth, int newSpringHeight, bool relatived, int modeScreen, QList& springSpeeds, QChar axis, double newAxisValueY = 0, double newSpringDeadY = 0); - bool toggle; + bool m_toggle; bool quitEvent; bool isDown; bool toggleActiveState; - bool useTurbo; + bool m_useTurbo; bool lastUnlessInList; - bool ignoresets; + bool m_ignoresets; bool ignoreEvents; bool whileHeldStatus; bool updateLastMouseDistance; // Should lastMouseDistance be updated. Set after mouse event. @@ -467,7 +526,7 @@ private slots: int mouseSpeedX; int mouseSpeedY; - int originset; + int m_originset; int springWidth; int springHeight; int currentRawValue; @@ -487,7 +546,7 @@ private slots: double minMouseDistanceAccelThreshold; double maxMouseDistanceAccelThreshold; double startAccelMultiplier; - double easingDuration; + double m_easingDuration; double extraAccelerationMultiplier; QTimer pauseTimer; @@ -514,7 +573,7 @@ private slots: JoyButtonSlot *currentHold; JoyButtonSlot *currentCycle; JoyButtonSlot *previousCycle; - JoyButtonSlot *currentDistance; + JoyButtonSlot *m_currentDistance; JoyButtonSlot *currentMouseEvent; JoyButtonSlot *currentRelease; JoyButtonSlot *currentKeyPress; @@ -531,7 +590,7 @@ private slots: QTime cycleResetHold; static QTime testOldMouseTime; - VDPad *vdpad; + VDPad *m_vdpad; JoyMouseMovementMode mouseMode; JoyMouseCurve mouseCurve; JoyExtraAccelerationCurve extraAccelCurve; diff --git a/src/joybuttoncontextmenu.cpp b/src/joybuttoncontextmenu.cpp old mode 100644 new mode 100755 index d80cf115e..aaa13c8a0 --- a/src/joybuttoncontextmenu.cpp +++ b/src/joybuttoncontextmenu.cpp @@ -17,6 +17,7 @@ #include "joybuttoncontextmenu.h" +#include "globalvariables.h" #include "messagehandler.h" #include "inputdevice.h" #include "common.h" @@ -41,11 +42,9 @@ void JoyButtonContextMenu::buildMenu() { qInstallMessageHandler(MessageHandler::myMessageOutput); - QAction *action = nullptr; - PadderCommon::inputDaemonMutex.lock(); - action = this->addAction(trUtf8("Toggle")); + QAction *action = this->addAction(trUtf8("Toggle")); action->setCheckable(true); action->setChecked(button->getToggleState()); connect(action, &QAction::triggered, this, &JoyButtonContextMenu::switchToggle); @@ -64,21 +63,21 @@ void JoyButtonContextMenu::buildMenu() this->addSeparator(); QMenu *setSectionMenu = this->addMenu(trUtf8("Set Select")); - action = setSectionMenu->addAction(trUtf8("Disabled")); + if (button->getChangeSetCondition() == JoyButton::SetChangeDisabled) { action->setCheckable(true); action->setChecked(true); } - connect(action, &QAction::triggered, this, &JoyButtonContextMenu::disableSetMode); + connect(action, &QAction::triggered, this, &JoyButtonContextMenu::disableSetMode); setSectionMenu->addSeparator(); - for (int i=0; i < InputDevice::NUMBER_JOYSETS; i++) + for (int i = 0; i < GlobalVariables::InputDevice::NUMBER_JOYSETS; i++) { QMenu *tempSetMenu = setSectionMenu->addMenu(trUtf8("Set %1").arg(i+1)); - int setSelection = i*3; + int setSelection = i * 3; if (i == button->getSetSelection()) { @@ -88,58 +87,38 @@ void JoyButtonContextMenu::buildMenu() } QActionGroup *tempGroup = new QActionGroup(tempSetMenu); + createActionForGroup(tempGroup, trUtf8("Set %1 1W"), action, tempSetMenu, setSelection, i, 0, 1); + createActionForGroup(tempGroup, trUtf8("Set %1 2W"), action, tempSetMenu, setSelection, i, 1, 2); + createActionForGroup(tempGroup, trUtf8("Set %1 WH"), action, tempSetMenu, setSelection, i, 2, 3); - action = tempSetMenu->addAction(trUtf8("Set %1 1W").arg(i+1)); - action->setData(QVariant(setSelection + 0)); - action->setCheckable(true); - if ((button->getSetSelection() == i) && - (button->getChangeSetCondition() == JoyButton::SetChangeOneWay)) - { - action->setChecked(true); - } - connect(action, &QAction::triggered, this, [this, action]() { - switchSetMode(action); - }); - - tempGroup->addAction(action); - - action = tempSetMenu->addAction(trUtf8("Set %1 2W").arg(i+1)); - action->setData(QVariant(setSelection + 1)); - action->setCheckable(true); - if ((button->getSetSelection() == i) && - (button->getChangeSetCondition() == JoyButton::SetChangeTwoWay)) - { - action->setChecked(true); - } - connect(action, &QAction::triggered, this, [this, action]() { - switchSetMode(action); - }); + if (i == button->getParentSet()->getIndex()) + tempSetMenu->setEnabled(false); + } - tempGroup->addAction(action); + PadderCommon::inputDaemonMutex.unlock(); +} - action = tempSetMenu->addAction(trUtf8("Set %1 WH").arg(i+1)); - action->setData(QVariant(setSelection + 2)); - action->setCheckable(true); - if ((button->getSetSelection() == i) && - (button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld)) - { - action->setChecked(true); - } - connect(action, &QAction::triggered, this, [this, action]() { - switchSetMode(action); - }); - tempGroup->addAction(action); +void JoyButtonContextMenu::createActionForGroup(QActionGroup *tempGroup, QString actionText, QAction *action, QMenu *tempSetMenu, int setSelection, int currentSelection, int setDataInc, int setCondition) +{ + action = tempSetMenu->addAction(actionText.arg(currentSelection + 1)); + action->setData(QVariant(setSelection + setDataInc)); + action->setCheckable(true); - if (i == button->getParentSet()->getIndex()) - { - tempSetMenu->setEnabled(false); - } + if ((button->getSetSelection() == currentSelection) && + (button->getChangeSetCondition() == static_cast(setCondition))) + { + action->setChecked(true); } - PadderCommon::inputDaemonMutex.unlock(); + connect(action, &QAction::triggered, this, [this, action]() { + switchSetMode(action); + }); + + tempGroup->addAction(action); } + void JoyButtonContextMenu::switchToggle() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -167,20 +146,24 @@ void JoyButtonContextMenu::switchSetMode(QAction* action) int setChangeCondition = item % 3; JoyButton::SetChangeCondition temp = JoyButton::SetChangeOneWay; - if (setChangeCondition == 0) - { - temp = JoyButton::SetChangeOneWay; - } - else if (setChangeCondition == 1) - { - temp = JoyButton::SetChangeTwoWay; - } - else if (setChangeCondition == 2) + switch(setChangeCondition) { - temp = JoyButton::SetChangeWhileHeld; + case 0: + temp = JoyButton::SetChangeOneWay; + break; + + case 1: + temp = JoyButton::SetChangeTwoWay; + break; + + case 2: + temp = JoyButton::SetChangeWhileHeld; + break; } + PadderCommon::inputDaemonMutex.lock(); + // First, remove old condition for the button in both sets. // After that, make the new assignment. button->setChangeSetCondition(JoyButton::SetChangeDisabled); diff --git a/src/joybuttoncontextmenu.h b/src/joybuttoncontextmenu.h old mode 100644 new mode 100755 index 51f9c3093..68ee27b01 --- a/src/joybuttoncontextmenu.h +++ b/src/joybuttoncontextmenu.h @@ -41,6 +41,7 @@ private slots: void switchSetMode(QAction* action); void disableSetMode(); void clearButton(); + void createActionForGroup(QActionGroup *tempGroup, QString actionText, QAction *action, QMenu *tempSetMenu, int setSelection, int currentSelection, int setDataInc, int setCondition); }; #endif // JOYBUTTONCONTEXTMENU_H diff --git a/src/joybuttonmousehelper.cpp b/src/joybuttonmousehelper.cpp old mode 100644 new mode 100755 index fc6937cc3..d905aa5db --- a/src/joybuttonmousehelper.cpp +++ b/src/joybuttonmousehelper.cpp @@ -17,6 +17,7 @@ #include "joybuttonmousehelper.h" +#include "globalvariables.h" #include "messagehandler.h" #include "joybutton.h" @@ -42,11 +43,10 @@ void JoyButtonMouseHelper::moveMouseCursor() int finalx = 0; int finaly = 0; int elapsedTime = 5; - JoyButton::moveMouseCursor(finalx, finaly, elapsedTime); + JoyButton::moveMouseCursor(finalx, finaly, elapsedTime, &GlobalVariables::JoyButton::mouseHistoryX, &GlobalVariables::JoyButton::mouseHistoryY, JoyButton::getTestOldMouseTime(), JoyButton::getStaticMouseEventTimer(), GlobalVariables::JoyButton::mouseRefreshRate, GlobalVariables::JoyButton::mouseHistorySize, JoyButton::getCursorXSpeeds(), JoyButton::getCursorYSpeeds(), GlobalVariables::JoyButton::cursorRemainderX, GlobalVariables::JoyButton::cursorRemainderY, GlobalVariables::JoyButton::weightModifier, GlobalVariables::JoyButton::IDLEMOUSEREFRESHRATE, JoyButton::getPendingMouseButtons()); + if ((finalx != 0) || (finaly != 0)) - { emit mouseCursorMoved(finalx, finaly, elapsedTime); - } } /** @@ -59,11 +59,10 @@ void JoyButtonMouseHelper::moveSpringMouse() int finalx = 0; int finaly = 0; bool hasMoved = false; - JoyButton::moveSpringMouse(finalx, finaly, hasMoved); + JoyButton::moveSpringMouse(finalx, finaly, hasMoved, GlobalVariables::JoyButton::springModeScreen, JoyButton::getSpringXSpeeds(), JoyButton::getSpringYSpeeds(), JoyButton::getPendingMouseButtons(), GlobalVariables::JoyButton::mouseRefreshRate, GlobalVariables::JoyButton::IDLEMOUSEREFRESHRATE, JoyButton::getStaticMouseEventTimer()); + if (hasMoved) - { emit mouseSpringMoved(finalx, finaly); - } } /** @@ -73,10 +72,11 @@ void JoyButtonMouseHelper::mouseEvent() { // qInstallMessageHandler(MessageHandler::myMessageOutput); - if (!JoyButton::hasCursorEvents() && !JoyButton::hasSpringEvents()) + if (!JoyButton::hasCursorEvents(JoyButton::getCursorXSpeeds(), JoyButton::getCursorYSpeeds()) && !JoyButton::hasSpringEvents(JoyButton::getSpringXSpeeds(), JoyButton::getSpringYSpeeds())) { QList *buttonList = JoyButton::getPendingMouseButtons(); QListIterator iter(*buttonList); + while (iter.hasNext()) { JoyButton *temp = iter.next(); @@ -86,12 +86,12 @@ void JoyButtonMouseHelper::mouseEvent() moveMouseCursor(); - if (JoyButton::hasSpringEvents()) + if (JoyButton::hasSpringEvents(JoyButton::getSpringXSpeeds(), JoyButton::getSpringYSpeeds())) { moveSpringMouse(); } - JoyButton::restartLastMouseTime(); + JoyButton::restartLastMouseTime(JoyButton::getTestOldMouseTime()); firstSpringEvent = false; } @@ -101,6 +101,7 @@ void JoyButtonMouseHelper::resetButtonMouseDistances() QList *buttonList = JoyButton::getPendingMouseButtons(); QListIterator iter(*buttonList); + while (iter.hasNext()) { JoyButton *temp = iter.next(); @@ -140,5 +141,5 @@ void JoyButtonMouseHelper::changeThread(QThread *thread) { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyButton::setStaticMouseThread(thread); + JoyButton::setStaticMouseThread(thread, JoyButton::getStaticMouseEventTimer(), JoyButton::getTestOldMouseTime(), GlobalVariables::JoyButton::IDLEMOUSEREFRESHRATE, JoyButton::getMouseHelper()); } diff --git a/src/joybuttonmousehelper.h b/src/joybuttonmousehelper.h old mode 100644 new mode 100755 diff --git a/src/joybuttonslot.cpp b/src/joybuttonslot.cpp old mode 100644 new mode 100755 index 404db1db1..eb85de92b --- a/src/joybuttonslot.cpp +++ b/src/joybuttonslot.cpp @@ -17,6 +17,7 @@ #include "joybuttonslot.h" +#include "globalvariables.h" #include "messagehandler.h" #include "inputdevice.h" #include "antkeymapper.h" @@ -27,9 +28,6 @@ #include #include -const int JoyButtonSlot::JOYSPEED = 20; -const QString JoyButtonSlot::xmlName = "slot"; -const int JoyButtonSlot::MAXTEXTENTRYDISPLAYLENGTH = 40; JoyButtonSlot::JoyButtonSlot(QObject *parent) : QObject(parent), @@ -38,8 +36,8 @@ JoyButtonSlot::JoyButtonSlot(QObject *parent) : qInstallMessageHandler(MessageHandler::myMessageOutput); deviceCode = 0; - mode = JoyKeyboard; - distance = 0.0; + m_mode = JoyKeyboard; + m_distance = 0.0; previousDistance = 0.0; qkeyaliasCode = 0; easingActive = false; @@ -54,13 +52,10 @@ JoyButtonSlot::JoyButtonSlot(int code, JoySlotInputAction mode, QObject *parent) deviceCode = 0; qkeyaliasCode = 0; - if (code > 0) - { - deviceCode = code; - } + if (code > 0) deviceCode = code; - this->mode = mode; - distance = 0.0; + m_mode = mode; + m_distance = 0.0; easingActive = false; } @@ -73,18 +68,12 @@ JoyButtonSlot::JoyButtonSlot(int code, int alias, JoySlotInputAction mode, QObje deviceCode = 0; qkeyaliasCode = 0; - if (code > 0) - { - deviceCode = code; - } + if (code > 0) deviceCode = code; - if (alias > 0) - { - qkeyaliasCode = alias; - } + if (alias > 0) qkeyaliasCode = alias; - this->mode = mode; - distance = 0.0; + m_mode = mode; + m_distance = 0.0; easingActive = false; } @@ -96,10 +85,10 @@ JoyButtonSlot::JoyButtonSlot(JoyButtonSlot *slot, QObject *parent) : deviceCode = slot->deviceCode; qkeyaliasCode = slot->qkeyaliasCode; - mode = slot->mode; - distance = slot->distance; + m_mode = slot->m_mode; + m_distance = slot->m_distance; easingActive = false; - textData = slot->getTextData(); + m_textData = slot->getTextData(); extraData = slot->getExtraData(); } @@ -111,14 +100,15 @@ JoyButtonSlot::JoyButtonSlot(QString text, JoySlotInputAction mode, QObject *par deviceCode = 0; qkeyaliasCode = 0; - this->mode = mode; - distance = 0.0; + m_mode = mode; + m_distance = 0.0; easingActive = false; + if ((mode == JoyLoadProfile) || (mode == JoyTextEntry) || (mode == JoyExecute)) { - textData = text; + m_textData = text; } } @@ -137,7 +127,7 @@ void JoyButtonSlot::setSlotCode(int code, int alias) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((mode == JoyButtonSlot::JoyKeyboard) && (code > 0)) + if ((m_mode == JoyButtonSlot::JoyKeyboard) && (code > 0)) { deviceCode = code; qkeyaliasCode = alias; @@ -167,14 +157,14 @@ void JoyButtonSlot::setSlotMode(JoySlotInputAction selectedMode) { qInstallMessageHandler(MessageHandler::myMessageOutput); - mode = selectedMode; + m_mode = selectedMode; } JoyButtonSlot::JoySlotInputAction JoyButtonSlot::getSlotMode() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return mode; + return m_mode; } QString JoyButtonSlot::movementString() @@ -183,24 +173,27 @@ QString JoyButtonSlot::movementString() QString newlabel = QString(); - if (mode == JoyMouseMovement) + if (m_mode == JoyMouseMovement) { newlabel.append(trUtf8("Mouse")).append(" "); - if (deviceCode == JoyButtonSlot::MouseUp) - { - newlabel.append(trUtf8("Up")); - } - else if (deviceCode == JoyButtonSlot::MouseDown) - { - newlabel.append(trUtf8("Down")); - } - else if (deviceCode == JoyButtonSlot::MouseLeft) - { - newlabel.append(trUtf8("Left")); - } - else if (deviceCode == JoyButtonSlot::MouseRight) + + switch(deviceCode) { - newlabel.append(trUtf8("Right")); + case 1: + newlabel.append(trUtf8("Up")); + break; + + case 2: + newlabel.append(trUtf8("Down")); + break; + + case 3: + newlabel.append(trUtf8("Left")); + break; + + case 4: + newlabel.append(trUtf8("Right")); + break; } } @@ -211,14 +204,14 @@ void JoyButtonSlot::setDistance(double distance) { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->distance = distance; + m_distance = distance; } double JoyButtonSlot::getMouseDistance() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return distance; + return m_distance; } QElapsedTimer* JoyButtonSlot::getMouseInterval() @@ -246,6 +239,7 @@ void JoyButtonSlot::readConfig(QXmlStreamReader *xml) QString extraStringData = QString(); xml->readNextStartElement(); + while (!xml->atEnd() && (!xml->isEndElement() && (xml->name() != "slot"))) { if ((xml->name() == "code") && xml->isStartElement()) @@ -253,10 +247,8 @@ void JoyButtonSlot::readConfig(QXmlStreamReader *xml) QString temptext = xml->readElementText(); bool ok = false; int tempchoice = temptext.toInt(&ok, 0); - if (ok) - { - this->setSlotCode(tempchoice); - } + + if (ok) this->setSlotCode(tempchoice); } else if ((xml->name() == "profile") && xml->isStartElement()) { @@ -372,6 +364,7 @@ void JoyButtonSlot::readConfig(QXmlStreamReader *xml) else if ((this->getSlotMode() == JoyButtonSlot::JoyLoadProfile) && !profile.isEmpty()) { QFileInfo profileInfo(profile); + if (!profileInfo.exists() || !((profileInfo.suffix() == "amgp") || (profileInfo.suffix() == "xml"))) { this->setTextData(""); @@ -381,12 +374,9 @@ void JoyButtonSlot::readConfig(QXmlStreamReader *xml) this->setTextData(profile); } } - else if (this->getSlotMode() == JoySetChange) + else if (this->getSlotMode() == JoySetChange && !(this->getSlotCode() >= 0) && !(this->getSlotCode() < GlobalVariables::InputDevice::NUMBER_JOYSETS)) { - if (!(this->getSlotCode() >= 0) && !(this->getSlotCode() < InputDevice::NUMBER_JOYSETS)) - { - this->setSlotCode(-1); - } + this->setSlotCode(-1); } else if ((this->getSlotMode() == JoyTextEntry) && !tempStringData.isEmpty()) { @@ -395,13 +385,13 @@ void JoyButtonSlot::readConfig(QXmlStreamReader *xml) else if ((this->getSlotMode() == JoyExecute) && !tempStringData.isEmpty()) { QFileInfo tempFile(tempStringData); + if (tempFile.exists() && tempFile.isExecutable()) { this->setTextData(tempStringData); + if (!extraStringData.isEmpty()) - { this->setExtraData(QVariant(extraStringData)); - } } } } @@ -413,22 +403,20 @@ void JoyButtonSlot::writeConfig(QXmlStreamWriter *xml) xml->writeStartElement(getXmlName()); - if (mode == JoyKeyboard) + if (m_mode == JoyKeyboard) { int basekey = AntKeyMapper::getInstance()->returnQtKey(deviceCode); int qtkey = this->getSlotCodeAlias(); + if ((qtkey > 0) || (basekey > 0)) { // Did not add an alias to slot. If a possible Qt key value // was found, use it. - if ((qtkey == 0) && (basekey > 0)) - { - qtkey = basekey; - } + if ((qtkey == 0) && (basekey > 0)) qtkey = basekey; // Found a valid abstract keysym. #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "ANT KEY: " << QString::number(qtkey, 16); + qDebug() << "ANT KEY: " << QString::number(qtkey, 16); #endif xml->writeTextElement("code", QString("0x%1").arg(qtkey, 0, 16)); @@ -439,23 +427,24 @@ void JoyButtonSlot::writeConfig(QXmlStreamWriter *xml) int tempkey = deviceCode | QtKeyMapperBase::nativeKeyPrefix; #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "ANT KEY: " << QString::number(tempkey, 16); + qDebug() << "ANT KEY: " << QString::number(tempkey, 16); #endif xml->writeTextElement("code", QString("0x%1").arg(tempkey, 0, 16)); } } - else if ((mode == JoyLoadProfile) && !textData.isEmpty()) + else if ((m_mode == JoyLoadProfile) && !m_textData.isEmpty()) { - xml->writeTextElement("profile", textData); + xml->writeTextElement("profile", m_textData); } - else if ((mode == JoyTextEntry) && !textData.isEmpty()) + else if ((m_mode == JoyTextEntry) && !m_textData.isEmpty()) { - xml->writeTextElement("text", textData); + xml->writeTextElement("text", m_textData); } - else if ((mode == JoyExecute) && !textData.isEmpty()) + else if ((m_mode == JoyExecute) && !m_textData.isEmpty()) { - xml->writeTextElement("path", textData); + xml->writeTextElement("path", m_textData); + if (!extraData.isNull() && extraData.canConvert()) { xml->writeTextElement("arguments", extraData.toString()); @@ -467,69 +456,71 @@ void JoyButtonSlot::writeConfig(QXmlStreamWriter *xml) } xml->writeStartElement("mode"); - if (mode == JoyKeyboard) - { - xml->writeCharacters("keyboard"); - } - else if (mode == JoyMouseButton) - { - xml->writeCharacters("mousebutton"); - } - else if (mode == JoyMouseMovement) - { - xml->writeCharacters("mousemovement"); - } - else if (mode == JoyPause) - { - xml->writeCharacters("pause"); - } - else if (mode == JoyHold) - { - xml->writeCharacters("hold"); - } - else if (mode == JoyCycle) - { - xml->writeCharacters("cycle"); - } - else if (mode == JoyDistance) - { - xml->writeCharacters("distance"); - } - else if (mode == JoyRelease) - { - xml->writeCharacters("release"); - } - else if (mode == JoyMouseSpeedMod) - { - xml->writeCharacters("mousespeedmod"); - } - else if (mode == JoyKeyPress) - { - xml->writeCharacters("keypress"); - } - else if (mode == JoyDelay) - { - xml->writeCharacters("delay"); - } - else if (mode == JoyLoadProfile) - { - xml->writeCharacters("loadprofile"); - } - else if (mode == JoySetChange) - { - xml->writeCharacters("setchange"); - } - else if (mode == JoyTextEntry) - { - xml->writeCharacters("textentry"); - } - else if (mode == JoyExecute) + + switch(m_mode) { - xml->writeCharacters("execute"); + case JoyKeyboard: + xml->writeCharacters("keyboard"); + break; + + case JoyMouseButton: + xml->writeCharacters("mousebutton"); + break; + + case JoyMouseMovement: + xml->writeCharacters("mousemovement"); + break; + + case JoyPause: + xml->writeCharacters("pause"); + break; + + case JoyHold: + xml->writeCharacters("hold"); + break; + + case JoyCycle: + xml->writeCharacters("cycle"); + break; + + case JoyDistance: + xml->writeCharacters("distance"); + break; + + case JoyRelease: + xml->writeCharacters("release"); + break; + + case JoyMouseSpeedMod: + xml->writeCharacters("mousespeedmod"); + break; + + case JoyKeyPress: + xml->writeCharacters("keypress"); + break; + + case JoyDelay: + xml->writeCharacters("delay"); + break; + + case JoyLoadProfile: + xml->writeCharacters("loadprofile"); + break; + + case JoySetChange: + xml->writeCharacters("setchange"); + break; + + case JoyTextEntry: + xml->writeCharacters("textentry"); + break; + + case JoyExecute: + xml->writeCharacters("execute"); + break; } xml->writeEndElement(); - xml->writeEndElement(); } @@ -537,7 +528,7 @@ QString JoyButtonSlot::getXmlName() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->xmlName; + return GlobalVariables::JoyButtonSlot::xmlName; } QString JoyButtonSlot::getSlotString() @@ -548,186 +539,209 @@ QString JoyButtonSlot::getSlotString() if (deviceCode >= 0) { - if (mode == JoyButtonSlot::JoyKeyboard) + switch(m_mode) { - int tempDeviceCode = deviceCode; -#ifdef Q_OS_WIN - QtKeyMapperBase *nativeWinKeyMapper = AntKeyMapper::getInstance()->getNativeKeyMapper(); - if (nativeWinKeyMapper) + case JoyButtonSlot::JoyKeyboard: { - tempDeviceCode = nativeWinKeyMapper->returnVirtualKey(qkeyaliasCode); + int tempDeviceCode = deviceCode; + #ifdef Q_OS_WIN + QtKeyMapperBase *nativeWinKeyMapper = AntKeyMapper::getInstance()->getNativeKeyMapper(); + if (nativeWinKeyMapper) + tempDeviceCode = nativeWinKeyMapper->returnVirtualKey(qkeyaliasCode); + #endif + newlabel = newlabel.append(keysymToKeyString(tempDeviceCode, qkeyaliasCode).toUpper()); + break; + } -#endif - newlabel = newlabel.append(keysymToKeyString(tempDeviceCode, qkeyaliasCode).toUpper()); - } - else if (mode == JoyButtonSlot::JoyMouseButton) - { - newlabel.append(trUtf8("Mouse")).append(" "); - switch (deviceCode) + case JoyButtonSlot::JoyMouseButton: { - case 1: - newlabel.append(trUtf8("LB")); - break; - case 2: - newlabel.append(trUtf8("MB")); - break; - case 3: - newlabel.append(trUtf8("RB")); - break; -#ifdef Q_OS_WIN - case 8: - newlabel.append(trUtf8("B4")); - break; - case 9: - newlabel.append(trUtf8("B5")); - break; -#endif - default: - newlabel.append(QString::number(deviceCode)); - break; - } - } - else if (mode == JoyMouseMovement) - { - newlabel.append(movementString()); - } - else if (mode == JoyPause) - { - int minutes = deviceCode / 1000 / 60; - int seconds = (deviceCode / 1000 % 60); - int hundredths = deviceCode % 1000 / 10; + newlabel.append(trUtf8("Mouse")).append(" "); - newlabel.append(trUtf8("Pause")).append(" "); - if (minutes > 0) + switch (deviceCode) + { + case 1: + newlabel.append(trUtf8("LB")); + break; + case 2: + newlabel.append(trUtf8("MB")); + break; + case 3: + newlabel.append(trUtf8("RB")); + break; + #ifdef Q_OS_WIN + case 8: + newlabel.append(trUtf8("B4")); + break; + case 9: + newlabel.append(trUtf8("B5")); + break; + #endif + default: + newlabel.append(QString::number(deviceCode)); + break; + } + + break; + } + case JoyMouseMovement: { - newlabel.append(QString("%1:").arg(minutes, 2, 10, QChar('0'))); + newlabel.append(movementString()); + break; } + case JoyPause: + { + int minutes = deviceCode / 1000 / 60; + int seconds = (deviceCode / 1000 % 60); + int hundredths = deviceCode % 1000 / 10; - newlabel.append(QString("%1.%2") - .arg(seconds, 2, 10, QChar('0')) - .arg(hundredths, 2, 10, QChar('0'))); - } - else if (mode == JoyHold) - { - int minutes = deviceCode / 1000 / 60; - int seconds = (deviceCode / 1000 % 60); - int hundredths = deviceCode % 1000 / 10; + newlabel.append(trUtf8("Pause")).append(" "); - newlabel.append(trUtf8("Hold")).append(" "); - if (minutes > 0) - { - newlabel.append(QString("%1:").arg(minutes, 2, 10, QChar('0'))); - } + if (minutes > 0) + newlabel.append(QString("%1:").arg(minutes, 2, 10, QChar('0'))); - newlabel.append(QString("%1.%2") - .arg(seconds, 2, 10, QChar('0')) - .arg(hundredths, 2, 10, QChar('0'))); - } - else if (mode == JoyButtonSlot::JoyCycle) - { - newlabel.append(trUtf8("Cycle")); - } - else if (mode == JoyDistance) - { - QString temp(trUtf8("Distance")); - temp.append(" ").append(QString::number(deviceCode).append("%")); - newlabel.append(temp); - } - else if (mode == JoyRelease) - { - int minutes = deviceCode / 1000 / 60; - int seconds = (deviceCode / 1000 % 60); - int hundredths = deviceCode % 1000 / 10; + newlabel.append(QString("%1.%2") + .arg(seconds, 2, 10, QChar('0')) + .arg(hundredths, 2, 10, QChar('0'))); - newlabel.append(trUtf8("Release")).append(" "); - if (minutes > 0) - { - newlabel.append(QString("%1:").arg(minutes, 2, 10, QChar('0'))); + break; } + case JoyHold: + { + int minutes = deviceCode / 1000 / 60; + int seconds = (deviceCode / 1000 % 60); + int hundredths = deviceCode % 1000 / 10; - newlabel.append(QString("%1.%2") - .arg(seconds, 2, 10, QChar('0')) - .arg(hundredths, 2, 10, QChar('0'))); - } - else if (mode == JoyMouseSpeedMod) - { - QString temp = QString(); - temp.append(trUtf8("Mouse Mod")).append(" "); - temp.append(QString::number(deviceCode).append("%")); - newlabel.append(temp); - } - else if (mode == JoyKeyPress) - { - int minutes = deviceCode / 1000 / 60; - int seconds = (deviceCode / 1000 % 60); - int hundredths = deviceCode % 1000 / 10; + newlabel.append(trUtf8("Hold")).append(" "); + + if (minutes > 0) + newlabel.append(QString("%1:").arg(minutes, 2, 10, QChar('0'))); - QString temp = QString(); - temp.append(trUtf8("Press Time")).append(" "); - if (minutes > 0) + newlabel.append(QString("%1.%2") + .arg(seconds, 2, 10, QChar('0')) + .arg(hundredths, 2, 10, QChar('0'))); + + break; + } + case JoyButtonSlot::JoyCycle: { - temp.append(QString("%1:").arg(minutes, 2, 10, QChar('0'))); + newlabel.append(trUtf8("Cycle")); + break; } + case JoyDistance: + { + QString temp(trUtf8("Distance")); + temp.append(" ").append(QString::number(deviceCode).append("%")); + newlabel.append(temp); - temp.append(QString("%1.%2") - .arg(seconds, 2, 10, QChar('0')) - .arg(hundredths, 2, 10, QChar('0'))); + break; + } + case JoyRelease: + { + int minutes = deviceCode / 1000 / 60; + int seconds = (deviceCode / 1000 % 60); + int hundredths = deviceCode % 1000 / 10; - newlabel.append(temp); - } - else if (mode == JoyDelay) - { - int minutes = deviceCode / 1000 / 60; - int seconds = (deviceCode / 1000 % 60); - int hundredths = deviceCode % 1000 / 10; + newlabel.append(trUtf8("Release")).append(" "); + + if (minutes > 0) + newlabel.append(QString("%1:").arg(minutes, 2, 10, QChar('0'))); + + newlabel.append(QString("%1.%2") + .arg(seconds, 2, 10, QChar('0')) + .arg(hundredths, 2, 10, QChar('0'))); - QString temp = QString(); - temp.append(trUtf8("Delay")).append(" "); - if (minutes > 0) + break; + } + case JoyMouseSpeedMod: { - temp.append(QString("%1:").arg(minutes, 2, 10, QChar('0'))); + QString temp = QString(); + temp.append(trUtf8("Mouse Mod")).append(" "); + temp.append(QString::number(deviceCode).append("%")); + newlabel.append(temp); + + break; } + case JoyKeyPress: + { + int minutes = deviceCode / 1000 / 60; + int seconds = (deviceCode / 1000 % 60); + int hundredths = deviceCode % 1000 / 10; + QString temp(trUtf8("Press Time").append(" ")); - temp.append(QString("%1.%2") - .arg(seconds, 2, 10, QChar('0')) - .arg(hundredths, 2, 10, QChar('0'))); + if (minutes > 0) + temp.append(QString("%1:").arg(minutes, 2, 10, QChar('0'))); - newlabel.append(temp); - } - else if (mode == JoyLoadProfile) - { - if (!textData.isEmpty()) + temp.append(QString("%1.%2") + .arg(seconds, 2, 10, QChar('0')) + .arg(hundredths, 2, 10, QChar('0'))); + + newlabel.append(temp); + + break; + } + case JoyDelay: { - QFileInfo profileInfo(textData); - QString temp = QString(); - temp.append(trUtf8("Load %1").arg(PadderCommon::getProfileName(profileInfo))); + int minutes = deviceCode / 1000 / 60; + int seconds = (deviceCode / 1000 % 60); + int hundredths = deviceCode % 1000 / 10; + QString temp(trUtf8("Delay").append(" ")); + + if (minutes > 0) + temp.append(QString("%1:").arg(minutes, 2, 10, QChar('0'))); + + temp.append(QString("%1.%2") + .arg(seconds, 2, 10, QChar('0')) + .arg(hundredths, 2, 10, QChar('0'))); + newlabel.append(temp); + + break; } - } - else if (mode == JoySetChange) - { - newlabel.append(trUtf8("Set Change %1").arg(deviceCode+1)); - } - else if (mode == JoyTextEntry) - { - QString temp = textData; - if (temp.length() > MAXTEXTENTRYDISPLAYLENGTH) + case JoyLoadProfile: { - temp.truncate(MAXTEXTENTRYDISPLAYLENGTH - 3); - temp.append("..."); + if (!m_textData.isEmpty()) + { + QFileInfo profileInfo(m_textData); + QString temp(trUtf8("Load %1").arg(PadderCommon::getProfileName(profileInfo))); + newlabel.append(temp); + } + + break; } - newlabel.append(trUtf8("[Text] %1").arg(temp)); - } - else if (mode == JoyExecute) - { - QString temp = QString(); - if (!textData.isEmpty()) + case JoySetChange: { - QFileInfo tempFileInfo(textData); - temp.append(tempFileInfo.fileName()); + newlabel.append(trUtf8("Set Change %1").arg(deviceCode+1)); + + break; + } + case JoyTextEntry: + { + QString temp = m_textData; + + if (temp.length() > GlobalVariables::JoyButtonSlot::MAXTEXTENTRYDISPLAYLENGTH) + { + temp.truncate(GlobalVariables::JoyButtonSlot::MAXTEXTENTRYDISPLAYLENGTH - 3); + temp.append("..."); + } + + newlabel.append(trUtf8("[Text] %1").arg(temp)); + + break; } + case JoyExecute: + { + QString temp = QString(); + + if (!m_textData.isEmpty()) + { + QFileInfo tempFileInfo(m_textData); + temp.append(tempFileInfo.fileName()); + } + + newlabel.append(trUtf8("[Exec] %1").arg(temp)); - newlabel.append(trUtf8("[Exec] %1").arg(temp)); + break; + } } } else @@ -757,7 +771,8 @@ bool JoyButtonSlot::isModifierKey() qInstallMessageHandler(MessageHandler::myMessageOutput); bool modifier = false; - if ((mode == JoyKeyboard) && AntKeyMapper::getInstance()->isModifierKey(qkeyaliasCode)) + + if ((m_mode == JoyKeyboard) && AntKeyMapper::getInstance()->isModifierKey(qkeyaliasCode)) { modifier = true; } @@ -790,14 +805,14 @@ void JoyButtonSlot::setTextData(QString textData) { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->textData = textData; + m_textData = textData; } QString JoyButtonSlot::getTextData() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return textData; + return m_textData; } void JoyButtonSlot::setExtraData(QVariant data) @@ -819,72 +834,27 @@ bool JoyButtonSlot::isValidSlot() qInstallMessageHandler(MessageHandler::myMessageOutput); bool result = true; - switch (mode) + + switch (m_mode) { case JoyLoadProfile: case JoyTextEntry: case JoyExecute: { - if (textData.isEmpty()) - { - result = false; - } + if (m_textData.isEmpty()) result = false; break; } case JoySetChange: { - if (deviceCode < 0) - { - result = false; - } + if (deviceCode < 0) result = false; break; } - case JoyKeyboard: - { - break; - } - case JoyMouseButton: - { - break; - } - case JoyMouseMovement: - { - break; - } - case JoyPause: - { - break; - } - case JoyHold: - { - break; - } - case JoyCycle: - { - break; - } - case JoyDistance: - { - break; - } - case JoyRelease: - { - break; - } - case JoyMouseSpeedMod: - { - break; - } - case JoyKeyPress: - { - break; - } - case JoyDelay: - { - break; - } + default: + { + break; + } } return result; diff --git a/src/joybuttonslot.h b/src/joybuttonslot.h old mode 100644 new mode 100755 index 76e80e866..8ab94bcb7 --- a/src/joybuttonslot.h +++ b/src/joybuttonslot.h @@ -80,23 +80,18 @@ class JoyButtonSlot : public QObject virtual void readConfig(QXmlStreamReader *xml); virtual void writeConfig(QXmlStreamWriter *xml); - - static const int JOYSPEED; - static const QString xmlName; private: int deviceCode; int qkeyaliasCode; // unsigned - JoySlotInputAction mode; - double distance; + JoySlotInputAction m_mode; + double m_distance; double previousDistance; QElapsedTimer mouseInterval; QTime easingTime; bool easingActive; - QString textData; + QString m_textData; QVariant extraData; - - static const int MAXTEXTENTRYDISPLAYLENGTH; }; diff --git a/src/joybuttonstatusbox.cpp b/src/joybuttonstatusbox.cpp old mode 100644 new mode 100755 index 16511f125..a192e725b --- a/src/joybuttonstatusbox.cpp +++ b/src/joybuttonstatusbox.cpp @@ -24,7 +24,6 @@ #include #include - JoyButtonStatusBox::JoyButtonStatusBox(JoyButton *button, QWidget *parent) : QPushButton(parent) { diff --git a/src/joybuttonstatusbox.h b/src/joybuttonstatusbox.h old mode 100644 new mode 100755 diff --git a/src/joybuttontypes/joyaxisbutton.cpp b/src/joybuttontypes/joyaxisbutton.cpp old mode 100644 new mode 100755 index cf43ffbe4..656e3f027 --- a/src/joybuttontypes/joyaxisbutton.cpp +++ b/src/joybuttontypes/joyaxisbutton.cpp @@ -17,6 +17,7 @@ #include "joyaxisbutton.h" +#include "globalvariables.h" #include "messagehandler.h" #include "joyaxis.h" #include "joybutton.h" @@ -28,20 +29,21 @@ #include -const QString JoyAxisButton::xmlName = "axisbutton"; JoyAxisButton::JoyAxisButton(JoyAxis *axis, int index, int originset, SetJoystick *parentSet, QObject *parent) : JoyGradientButton(index, originset, parentSet, parent) { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->axis = axis; + + m_axis = axis; } -QString JoyAxisButton::getPartialName(bool forceFullFormat, bool displayNames) + +QString JoyAxisButton::getPartialName(bool forceFullFormat, bool displayNames) const { qInstallMessageHandler(MessageHandler::myMessageOutput); - QString temp = QString(axis->getPartialName(forceFullFormat, displayNames)); + QString temp = QString(m_axis->getPartialName(forceFullFormat, displayNames)); temp.append(": "); if (!buttonName.isEmpty() && displayNames) @@ -50,6 +52,7 @@ QString JoyAxisButton::getPartialName(bool forceFullFormat, bool displayNames) { temp.append(trUtf8("Button")).append(" "); } + temp.append(buttonName); } else if (!defaultButtonName.isEmpty() && displayNames) @@ -58,22 +61,28 @@ QString JoyAxisButton::getPartialName(bool forceFullFormat, bool displayNames) { temp.append(trUtf8("Button")).append(" "); } + temp.append(defaultButtonName); } else { QString buttontype = QString(); - if (index == 0) + + switch(m_index) { + + case 0: buttontype = trUtf8("Negative"); - } - else if (index == 1) - { + break; + + case 1: buttontype = trUtf8("Positive"); - } - else - { + break; + + default: buttontype = trUtf8("Unknown"); + break; + } temp.append(trUtf8("Button")).append(" ").append(buttontype); @@ -82,17 +91,20 @@ QString JoyAxisButton::getPartialName(bool forceFullFormat, bool displayNames) return temp; } + QString JoyAxisButton::getXmlName() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->xmlName; + return GlobalVariables::JoyAxisButton::xmlName; } + void JoyAxisButton::setChangeSetCondition(SetChangeCondition condition, bool passive, bool updateActiveString) { qInstallMessageHandler(MessageHandler::myMessageOutput); + SetChangeCondition oldCondition = setSelectionCondition; if ((condition != setSelectionCondition) && !passive) @@ -100,12 +112,12 @@ void JoyAxisButton::setChangeSetCondition(SetChangeCondition condition, bool pas if ((condition == SetChangeWhileHeld) || (condition == SetChangeTwoWay)) { // Set new condition - emit setAssignmentChanged(index, this->axis->getIndex(), setSelection, condition); + emit setAssignmentChanged(m_index, m_axis->getIndex(), setSelection, condition); } else if ((setSelectionCondition == SetChangeWhileHeld) || (setSelectionCondition == SetChangeTwoWay)) { // Remove old condition - emit setAssignmentChanged(index, this->axis->getIndex(), setSelection, SetChangeDisabled); + emit setAssignmentChanged(m_index, m_axis->getIndex(), setSelection, SetChangeDisabled); } setSelectionCondition = condition; @@ -140,7 +152,7 @@ double JoyAxisButton::getDistanceFromDeadZone() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return axis->getDistanceFromDeadZone(); + return m_axis->getDistanceFromDeadZone(); } /** @@ -154,13 +166,14 @@ double JoyAxisButton::getMouseDistanceFromDeadZone() return this->getDistanceFromDeadZone(); } + void JoyAxisButton::setVDPad(VDPad *vdpad) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (axis->isPartControlStick()) + if (m_axis->isPartControlStick()) { - axis->removeControlStick(); + m_axis->removeControlStick(); } JoyButton::setVDPad(vdpad); @@ -193,33 +206,32 @@ bool JoyAxisButton::isPartRealAxis() return true; } + double JoyAxisButton::getAccelerationDistance() { qInstallMessageHandler(MessageHandler::myMessageOutput); - double distance = 0.0; - distance = axis->getRawDistance(axis->getCurrentThrottledValue()); - return distance; + return m_axis->getRawDistance(m_axis->getCurrentThrottledValue()); } + double JoyAxisButton::getLastAccelerationDistance() { qInstallMessageHandler(MessageHandler::myMessageOutput); - double distance = 0.0; - distance = axis->getRawDistance(axis->getLastKnownThrottleValue()); - - return distance; + return m_axis->getRawDistance(m_axis->getLastKnownThrottleValue()); } + double JoyAxisButton::getLastMouseDistanceFromDeadZone() { qInstallMessageHandler(MessageHandler::myMessageOutput); double distance = 0.0; - if (axis->getAxisButtonByValue(axis->getLastKnownThrottleValue()) == this) + + if (m_axis->getAxisButtonByValue(m_axis->getLastKnownThrottleValue()) == this) { - distance = axis->getDistanceFromDeadZone(axis->getLastKnownThrottleValue()); + distance = m_axis->getDistanceFromDeadZone(m_axis->getLastKnownThrottleValue()); } return distance; @@ -228,5 +240,5 @@ double JoyAxisButton::getLastMouseDistanceFromDeadZone() JoyAxis* JoyAxisButton::getAxis() const { - return axis; + return m_axis; } diff --git a/src/joybuttontypes/joyaxisbutton.h b/src/joybuttontypes/joyaxisbutton.h old mode 100644 new mode 100755 index 182dace03..07d495b30 --- a/src/joybuttontypes/joyaxisbutton.h +++ b/src/joybuttontypes/joyaxisbutton.h @@ -34,7 +34,7 @@ class JoyAxisButton : public JoyGradientButton public: explicit JoyAxisButton(JoyAxis *axis, int index, int originset, SetJoystick *parentSet, QObject *parent=0); - virtual QString getPartialName(bool forceFullFormat=false, bool displayNames=false); + virtual QString getPartialName(bool forceFullFormat=false, bool displayNames=false) const; virtual QString getXmlName(); virtual double getDistanceFromDeadZone(); @@ -51,13 +51,12 @@ class JoyAxisButton : public JoyGradientButton virtual double getLastAccelerationDistance(); JoyAxis* getAxis() const; - static const QString xmlName; signals: void setAssignmentChanged(int current_button, int axis_index, int associated_set, int mode); private: - JoyAxis *axis; + JoyAxis *m_axis; }; #endif // JOYAXISBUTTON_H diff --git a/src/joybuttontypes/joycontrolstickbutton.cpp b/src/joybuttontypes/joycontrolstickbutton.cpp old mode 100644 new mode 100755 index 6769cfb75..cbc4c4f59 --- a/src/joybuttontypes/joycontrolstickbutton.cpp +++ b/src/joybuttontypes/joycontrolstickbutton.cpp @@ -17,6 +17,7 @@ #include "joycontrolstickbutton.h" +#include "globalvariables.h" #include "messagehandler.h" #include "joycontrolstick.h" #include "joycontrolstickmodifierbutton.h" @@ -29,8 +30,6 @@ #include -const QString JoyControlStickButton::xmlName = "stickbutton"; - JoyControlStickButton::JoyControlStickButton(JoyControlStick *stick, int index, int originset, SetJoystick *parentSet, QObject *parent) : JoyGradientButton(index, originset, parentSet, parent) { @@ -39,56 +38,63 @@ JoyControlStickButton::JoyControlStickButton(JoyControlStick *stick, int index, this->stick = stick; } + JoyControlStickButton::JoyControlStickButton(JoyControlStick *stick, JoyStickDirectionsType::JoyStickDirections index, int originset, SetJoystick *parentSet, QObject *parent) : - JoyGradientButton(static_cast(index), originset, parentSet, parent) + JoyGradientButton(index, originset, parentSet, parent) { qInstallMessageHandler(MessageHandler::myMessageOutput); this->stick = stick; } + QString JoyControlStickButton::getDirectionName() const { qInstallMessageHandler(MessageHandler::myMessageOutput); QString label = QString(); - if (index == static_cast(JoyControlStick::StickUp)) + + switch(m_index) { + case 1: label.append(trUtf8("Up")); - } - else if (index == static_cast(JoyControlStick::StickDown)) - { + break; + + case 2: + label.append(trUtf8("Up")).append("+").append(trUtf8("Right")); + break; + + case 3: + label.append(trUtf8("Right")); + break; + + case 4: + label.append(trUtf8("Down")).append("+").append(trUtf8("Right")); + break; + + case 5: label.append(trUtf8("Down")); - } - else if (index == static_cast(JoyControlStick::StickLeft)) - { + break; + + case 6: + label.append(trUtf8("Down")).append("+").append(trUtf8("Left")); + break; + + case 7: label.append(trUtf8("Left")); - } - else if (index == static_cast(JoyControlStick::StickRight)) - { - label.append(trUtf8("Right")); - } - else if (index == static_cast(JoyControlStick::StickLeftUp)) - { + break; + + case 8: label.append(trUtf8("Up")).append("+").append(trUtf8("Left")); - } - else if (index == static_cast(JoyControlStick::StickLeftDown)) - { - label.append(trUtf8("Down")).append("+").append(trUtf8("Left")); - } - else if (index == static_cast(JoyControlStick::StickRightUp)) - { - label.append(trUtf8("Up")).append("+").append(trUtf8("Right")); - } - else if (index == static_cast(JoyControlStick::StickRightDown)) - { - label.append(trUtf8("Down")).append("+").append(trUtf8("Right")); + break; + } return label; } -QString JoyControlStickButton::getPartialName(bool forceFullFormat, bool displayNames) + +QString JoyControlStickButton::getPartialName(bool forceFullFormat, bool displayNames) const { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -119,14 +125,16 @@ QString JoyControlStickButton::getPartialName(bool forceFullFormat, bool display temp.append(trUtf8("Button")).append(" "); temp.append(getDirectionName()); } + return temp; } + QString JoyControlStickButton::getXmlName() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->xmlName; + return GlobalVariables::JoyControlStickButton::xmlName; } /** @@ -152,8 +160,11 @@ double JoyControlStickButton::getMouseDistanceFromDeadZone() return stick->calculateMouseDirectionalDistance(this); } -void JoyControlStickButton::setChangeSetCondition(SetChangeCondition condition, bool passive) + +void JoyControlStickButton::setChangeSetCondition(SetChangeCondition condition, bool passive, bool updateActiveString) { + Q_UNUSED(updateActiveString); + qInstallMessageHandler(MessageHandler::myMessageOutput); SetChangeCondition oldCondition = setSelectionCondition; @@ -163,12 +174,12 @@ void JoyControlStickButton::setChangeSetCondition(SetChangeCondition condition, if ((condition == SetChangeWhileHeld) || (condition == SetChangeTwoWay)) { // Set new condition - emit setAssignmentChanged(index, this->stick->getIndex(), setSelection, condition); + emit setAssignmentChanged(m_index, this->stick->getIndex(), setSelection, condition); } else if ((setSelectionCondition == SetChangeWhileHeld) || (setSelectionCondition == SetChangeTwoWay)) { // Remove old condition - emit setAssignmentChanged(index, this->stick->getIndex(), setSelection, SetChangeDisabled); + emit setAssignmentChanged(m_index, this->stick->getIndex(), setSelection, SetChangeDisabled); } setSelectionCondition = condition; @@ -190,18 +201,20 @@ void JoyControlStickButton::setChangeSetCondition(SetChangeCondition condition, } } -int JoyControlStickButton::getRealJoyNumber() + +int JoyControlStickButton::getRealJoyNumber() const { qInstallMessageHandler(MessageHandler::myMessageOutput); - return index; + return m_index; } + JoyStickDirectionsType::JoyStickDirections JoyControlStickButton::getDirection() const { qInstallMessageHandler(MessageHandler::myMessageOutput); - return static_cast(index); + return static_cast(m_index); } /** @@ -231,6 +244,7 @@ bool JoyControlStickButton::isPartRealAxis() return true; } + double JoyControlStickButton::getLastAccelerationDistance() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -239,6 +253,7 @@ double JoyControlStickButton::getLastAccelerationDistance() return temp; } + double JoyControlStickButton::getAccelerationDistance() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -263,6 +278,7 @@ QString JoyControlStickButton::getActiveZoneSummary() return temp; } + QString JoyControlStickButton::getCalculatedActiveZoneSummary() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -291,6 +307,7 @@ QString JoyControlStickButton::getCalculatedActiveZoneSummary() return temp; } + double JoyControlStickButton::getLastMouseDistanceFromDeadZone() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -298,21 +315,23 @@ double JoyControlStickButton::getLastMouseDistanceFromDeadZone() return stick->calculateLastMouseDirectionalDistance(this); } + double JoyControlStickButton::getCurrentSpringDeadCircle() { qInstallMessageHandler(MessageHandler::myMessageOutput); double result = (springDeadCircleMultiplier * 0.01); - if ((index == static_cast(JoyControlStick::StickLeft)) || (index == static_cast(JoyControlStick::StickRight))) + + if ((m_index == static_cast(JoyControlStick::StickLeft)) || (m_index == static_cast(JoyControlStick::StickRight))) { result = stick->getSpringDeadCircleX() * (springDeadCircleMultiplier * 0.01); } - else if ((index == static_cast(JoyControlStick::StickUp)) || (index == static_cast(JoyControlStick::StickDown))) + else if ((m_index == static_cast(JoyControlStick::StickUp)) || (m_index == static_cast(JoyControlStick::StickDown))) { result = stick->getSpringDeadCircleY() * (springDeadCircleMultiplier * 0.01); } - else if ((index == static_cast(JoyControlStick::StickRightUp)) || (index == static_cast(JoyControlStick::StickRightDown)) || - (index == static_cast(JoyControlStick::StickLeftDown)) || (index == static_cast(JoyControlStick::StickLeftUp))) + else if ((m_index == static_cast(JoyControlStick::StickRightUp)) || (m_index == static_cast(JoyControlStick::StickRightDown)) || + (m_index == static_cast(JoyControlStick::StickLeftDown)) || (m_index == static_cast(JoyControlStick::StickLeftUp))) { result = 0.0; } diff --git a/src/joybuttontypes/joycontrolstickbutton.h b/src/joybuttontypes/joycontrolstickbutton.h old mode 100644 new mode 100755 index b7434f35b..17e18881d --- a/src/joybuttontypes/joycontrolstickbutton.h +++ b/src/joybuttontypes/joycontrolstickbutton.h @@ -34,15 +34,15 @@ class JoyControlStickButton : public JoyGradientButton explicit JoyControlStickButton(JoyControlStick *stick, int index, int originset, SetJoystick *parentSet, QObject *parent = nullptr); explicit JoyControlStickButton(JoyControlStick *stick, JoyStickDirectionsType::JoyStickDirections index, int originset, SetJoystick *parentSet, QObject *parent = nullptr); - virtual int getRealJoyNumber(); - virtual QString getPartialName(bool forceFullFormat=false, bool displayNames=false); + virtual int getRealJoyNumber() const; + virtual QString getPartialName(bool forceFullFormat=false, bool displayNames=false) const; virtual QString getXmlName(); virtual double getDistanceFromDeadZone(); virtual double getMouseDistanceFromDeadZone(); virtual double getLastMouseDistanceFromDeadZone(); - virtual void setChangeSetCondition(SetChangeCondition condition, bool passive=false); + virtual void setChangeSetCondition(SetChangeCondition condition, bool passive=false, bool updateActiveString=true); virtual void setTurboMode(TurboMode mode); virtual bool isPartRealAxis(); virtual QString getActiveZoneSummary(); @@ -55,8 +55,6 @@ class JoyControlStickButton : public JoyGradientButton QString getDirectionName() const; JoyStickDirectionsType::JoyStickDirections getDirection() const; - static const QString xmlName; - protected: virtual double getCurrentSpringDeadCircle(); diff --git a/src/joybuttontypes/joycontrolstickmodifierbutton.cpp b/src/joybuttontypes/joycontrolstickmodifierbutton.cpp old mode 100644 new mode 100755 index b8d3cc26d..64590e401 --- a/src/joybuttontypes/joycontrolstickmodifierbutton.cpp +++ b/src/joybuttontypes/joycontrolstickmodifierbutton.cpp @@ -17,6 +17,7 @@ #include "joycontrolstickmodifierbutton.h" +#include "globalvariables.h" #include "messagehandler.h" #include "joycontrolstick.h" #include "setjoystick.h" @@ -26,7 +27,6 @@ #include #include -const QString JoyControlStickModifierButton::xmlName = "stickmodifierbutton"; JoyControlStickModifierButton::JoyControlStickModifierButton(JoyControlStick *stick, int originset, SetJoystick *parentSet, QObject *parent) : JoyGradientButton(0, originset, parentSet, parent) @@ -36,7 +36,8 @@ JoyControlStickModifierButton::JoyControlStickModifierButton(JoyControlStick *st this->stick = stick; } -QString JoyControlStickModifierButton::getPartialName(bool forceFullFormat, bool displayNames) + +QString JoyControlStickModifierButton::getPartialName(bool forceFullFormat, bool displayNames) const { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -66,14 +67,16 @@ QString JoyControlStickModifierButton::getPartialName(bool forceFullFormat, bool { temp.append(trUtf8("Modifier")); } + return temp; } + QString JoyControlStickModifierButton::getXmlName() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->xmlName; + return GlobalVariables::JoyControlStickModifierButton::xmlName; } /** @@ -99,14 +102,17 @@ double JoyControlStickModifierButton::getMouseDistanceFromDeadZone() return getDistanceFromDeadZone(); } -void JoyControlStickModifierButton::setChangeSetCondition(SetChangeCondition condition, bool passive) + +void JoyControlStickModifierButton::setChangeSetCondition(SetChangeCondition condition, bool passive, bool updateActiveString) { qInstallMessageHandler(MessageHandler::myMessageOutput); + Q_UNUSED(updateActiveString); Q_UNUSED(condition); Q_UNUSED(passive); } + JoyControlStick* JoyControlStickModifierButton::getStick() const { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -141,6 +147,7 @@ bool JoyControlStickModifierButton::isPartRealAxis() return true; } + bool JoyControlStickModifierButton::isModifierButton() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -148,6 +155,7 @@ bool JoyControlStickModifierButton::isModifierButton() return true; } + double JoyControlStickModifierButton::getAccelerationDistance() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -156,6 +164,7 @@ double JoyControlStickModifierButton::getAccelerationDistance() return temp; } + double JoyControlStickModifierButton::getLastAccelerationDistance() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -164,6 +173,7 @@ double JoyControlStickModifierButton::getLastAccelerationDistance() return temp; } + double JoyControlStickModifierButton::getLastMouseDistanceFromDeadZone() { qInstallMessageHandler(MessageHandler::myMessageOutput); diff --git a/src/joybuttontypes/joycontrolstickmodifierbutton.h b/src/joybuttontypes/joycontrolstickmodifierbutton.h old mode 100644 new mode 100755 index 10c023de3..e82da5c61 --- a/src/joybuttontypes/joycontrolstickmodifierbutton.h +++ b/src/joybuttontypes/joycontrolstickmodifierbutton.h @@ -30,13 +30,13 @@ class JoyControlStickModifierButton : public JoyGradientButton public: explicit JoyControlStickModifierButton(JoyControlStick *stick, int originset, SetJoystick *parentSet, QObject *parent = nullptr); - virtual QString getPartialName(bool forceFullFormat=false, bool displayNames=false); + virtual QString getPartialName(bool forceFullFormat=false, bool displayNames=false) const; virtual QString getXmlName(); virtual double getDistanceFromDeadZone(); virtual double getMouseDistanceFromDeadZone(); virtual double getLastMouseDistanceFromDeadZone(); - virtual void setChangeSetCondition(SetChangeCondition condition, bool passive=false); + virtual void setChangeSetCondition(SetChangeCondition condition, bool passive=false, bool updateActiveString=true); virtual void setTurboMode(TurboMode mode); virtual bool isPartRealAxis(); @@ -47,8 +47,6 @@ class JoyControlStickModifierButton : public JoyGradientButton JoyControlStick *getStick() const; - static const QString xmlName; - private: JoyControlStick *stick; diff --git a/src/joybuttontypes/joydpadbutton.cpp b/src/joybuttontypes/joydpadbutton.cpp old mode 100644 new mode 100755 index 341e2bca0..630045733 --- a/src/joybuttontypes/joydpadbutton.cpp +++ b/src/joybuttontypes/joydpadbutton.cpp @@ -17,6 +17,7 @@ #include "joydpadbutton.h" +#include "globalvariables.h" #include "messagehandler.h" #include "joydpad.h" #include "setjoystick.h" @@ -24,7 +25,6 @@ #include -const QString JoyDPadButton::xmlName = "dpadbutton"; // Initially, qualify direction as the button's index JoyDPadButton::JoyDPadButton(int direction, int originset, JoyDPad* dpad, SetJoystick *parentSet, QObject *parent) : @@ -32,76 +32,85 @@ JoyDPadButton::JoyDPadButton(int direction, int originset, JoyDPad* dpad, SetJoy { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->direction = direction; - this->dpad = dpad; + m_direction = direction; + m_dpad = dpad; } + QString JoyDPadButton::getDirectionName() const { qInstallMessageHandler(MessageHandler::myMessageOutput); QString label = QString (); - if (direction == DpadUp) - { - label.append(trUtf8("Up")); - } - else if (direction == DpadDown) - { - label.append(trUtf8("Down")); - } - else if (direction == DpadLeft) - { - label.append(trUtf8("Left")); - } - else if (direction == DpadRight) - { - label.append(trUtf8("Right")); - } - else if (direction == DpadLeftUp) - { - label.append(trUtf8("Up")).append("+").append(trUtf8("Left")); - } - else if (direction == DpadLeftDown) - { - label.append(trUtf8("Down")).append("+").append(trUtf8("Left")); - } - else if (direction == DpadRightUp) - { - label.append(trUtf8("Up")).append("+").append(trUtf8("Right")); - } - else if (direction == DpadRightDown) + + switch(m_direction) { - label.append(trUtf8("Down")).append("+").append(trUtf8("Right")); + case 1: + label.append(trUtf8("Up")); + break; + + case 2: + label.append(trUtf8("Right")); + break; + + case 3: + label.append(trUtf8("Up")).append("+").append(trUtf8("Right")); + break; + + case 4: + label.append(trUtf8("Down")); + break; + + case 6: + label.append(trUtf8("Down")).append("+").append(trUtf8("Right")); + break; + + case 8: + label.append(trUtf8("Left")); + break; + + case 9: + label.append(trUtf8("Up")).append("+").append(trUtf8("Left")); + break; + + case 12: + label.append(trUtf8("Down")).append("+").append(trUtf8("Left")); + break; } return label; } + QString JoyDPadButton::getXmlName() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->xmlName; + return GlobalVariables::JoyDPadButton::xmlName; } -int JoyDPadButton::getRealJoyNumber() + +int JoyDPadButton::getRealJoyNumber() const { qInstallMessageHandler(MessageHandler::myMessageOutput); - return index; + return m_index; } -QString JoyDPadButton::getPartialName(bool forceFullFormat, bool displayNames) + +QString JoyDPadButton::getPartialName(bool forceFullFormat, bool displayNames) const { qInstallMessageHandler(MessageHandler::myMessageOutput); - QString temp = dpad->getName().append(" - "); + QString temp = m_dpad->getName().append(" - "); + if (!buttonName.isEmpty() && displayNames) { if (forceFullFormat) { temp.append(trUtf8("Button")).append(" "); } + temp.append(buttonName); } else if (!defaultButtonName.isEmpty() && displayNames) @@ -110,6 +119,7 @@ QString JoyDPadButton::getPartialName(bool forceFullFormat, bool displayNames) { temp.append(trUtf8("Button")).append(" "); } + temp.append(defaultButtonName); } else @@ -117,6 +127,7 @@ QString JoyDPadButton::getPartialName(bool forceFullFormat, bool displayNames) temp.append(trUtf8("Button")).append(" "); temp.append(getDirectionName()); } + return temp; } @@ -128,6 +139,7 @@ void JoyDPadButton::reset() JoyButton::reset(); } + void JoyDPadButton::reset(int index) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -136,8 +148,11 @@ void JoyDPadButton::reset(int index) reset(); } -void JoyDPadButton::setChangeSetCondition(SetChangeCondition condition, bool passive) + +void JoyDPadButton::setChangeSetCondition(SetChangeCondition condition, bool passive, bool updateActiveString) { + Q_UNUSED(updateActiveString); + qInstallMessageHandler(MessageHandler::myMessageOutput); SetChangeCondition oldCondition = setSelectionCondition; @@ -147,12 +162,12 @@ void JoyDPadButton::setChangeSetCondition(SetChangeCondition condition, bool pas if ((condition == SetChangeWhileHeld) || (condition == SetChangeTwoWay)) { // Set new condition - emit setAssignmentChanged(index, this->dpad->getJoyNumber(), setSelection, condition); + emit setAssignmentChanged(m_index, m_dpad->getJoyNumber(), setSelection, condition); } else if ((setSelectionCondition == SetChangeWhileHeld) || (setSelectionCondition == SetChangeTwoWay)) { // Remove old condition - emit setAssignmentChanged(index, this->dpad->getJoyNumber(), setSelection, SetChangeDisabled); + emit setAssignmentChanged(m_index, m_dpad->getJoyNumber(), setSelection, SetChangeDisabled); } setSelectionCondition = condition; @@ -174,16 +189,18 @@ void JoyDPadButton::setChangeSetCondition(SetChangeCondition condition, bool pas } } + JoyDPad* JoyDPadButton::getDPad() const { qInstallMessageHandler(MessageHandler::myMessageOutput); - return dpad; + return m_dpad; } + int JoyDPadButton::getDirection() const { qInstallMessageHandler(MessageHandler::myMessageOutput); - return direction; + return m_direction; } diff --git a/src/joybuttontypes/joydpadbutton.h b/src/joybuttontypes/joydpadbutton.h old mode 100644 new mode 100755 index cd4ad4c0d..3363d9adb --- a/src/joybuttontypes/joydpadbutton.h +++ b/src/joybuttontypes/joydpadbutton.h @@ -30,11 +30,11 @@ class JoyDPadButton : public JoyButton public: JoyDPadButton(int direction, int originset, JoyDPad* dpad, SetJoystick *parentSet, QObject *parent=0); - virtual int getRealJoyNumber(); - virtual QString getPartialName(bool forceFullFormat=false, bool displayNames=false); - virtual QString getXmlName(); + virtual int getRealJoyNumber() const override; + virtual QString getPartialName(bool forceFullFormat=false, bool displayNames=false) const override; + virtual QString getXmlName() override; - virtual void setChangeSetCondition(SetChangeCondition condition, bool passive=false); + virtual void setChangeSetCondition(SetChangeCondition condition, bool passive=false, bool updateActiveString=true) override; enum JoyDPadDirections { DpadCentered = 0, DpadUp = 1, DpadRight = 2, @@ -46,18 +46,16 @@ class JoyDPadButton : public JoyButton int getDirection() const; JoyDPad *getDPad() const; - static const QString xmlName; - signals: void setAssignmentChanged(int current_button, int dpad_index, int associated_set, int mode); public slots: - virtual void reset(); - virtual void reset(int index); + virtual void reset() override; + virtual void reset(int index) override; private: - int direction; - JoyDPad *dpad; + int m_direction; + JoyDPad *m_dpad; }; #endif // JOYDPADBUTTON_H diff --git a/src/joybuttontypes/joygradientbutton.cpp b/src/joybuttontypes/joygradientbutton.cpp old mode 100644 new mode 100755 index 989882091..1646aab0d --- a/src/joybuttontypes/joygradientbutton.cpp +++ b/src/joybuttontypes/joygradientbutton.cpp @@ -25,6 +25,7 @@ #include + JoyGradientButton::JoyGradientButton(int index, int originset, SetJoystick *parentSet, QObject *parent) : JoyButton(index, originset, parentSet, parent) { @@ -62,6 +63,7 @@ void JoyGradientButton::turboEvent() if (isKeyPressed) { changeState = false; + if (!turboTimer.isActive() || (turboTimer.interval() != 5)) { turboTimer.start(5); @@ -88,25 +90,26 @@ void JoyGradientButton::turboEvent() { if (getTurboMode() == GradientTurbo) { - tempInterval2 = static_cast(floor((getMouseDistanceFromDeadZone() * turboInterval) + 0.5)); + tempInterval2 = floor((getMouseDistanceFromDeadZone() * turboInterval) + 0.5); } else { - tempInterval2 = static_cast(floor((turboInterval * 0.5) + 0.5)); + tempInterval2 = floor((turboInterval * 0.5) + 0.5); } } else { if (getTurboMode() == GradientTurbo) { - tempInterval2 = static_cast(floor(((1 - getMouseDistanceFromDeadZone()) * turboInterval) + 0.5)); + tempInterval2 = floor(((1 - getMouseDistanceFromDeadZone()) * turboInterval) + 0.5); } else { double distance = getMouseDistanceFromDeadZone(); + if (distance > 0.0) { - tempInterval2 = static_cast(floor(((turboInterval / getMouseDistanceFromDeadZone()) * 0.5) + 0.5)); + tempInterval2 = floor(((turboInterval / getMouseDistanceFromDeadZone()) * 0.5) + 0.5); } else { @@ -121,6 +124,7 @@ void JoyGradientButton::turboEvent() // remaining time left. tempTurboInterval = tempInterval2 - turboHold.elapsed(); int timerInterval = qMin(tempTurboInterval, 5); + if (!turboTimer.isActive() || (turboTimer.interval() != timerInterval)) { turboTimer.start(timerInterval); @@ -165,11 +169,11 @@ void JoyGradientButton::turboEvent() { if (getTurboMode() == GradientTurbo) { - tempTurboInterval = static_cast(floor((getMouseDistanceFromDeadZone() * turboInterval) + 0.5)); + tempTurboInterval = floor((getMouseDistanceFromDeadZone() * turboInterval) + 0.5); } else { - tempTurboInterval = static_cast(floor((turboInterval * 0.5) + 0.5)); + tempTurboInterval = floor((turboInterval * 0.5) + 0.5); } int timerInterval = qMin(tempTurboInterval, 5); @@ -198,18 +202,20 @@ void JoyGradientButton::turboEvent() releaseDeskEvent(); isKeyPressed = false; + if (turboTimer.isActive()) { if (getTurboMode() == GradientTurbo) { - tempTurboInterval = static_cast(floor(((1 - getMouseDistanceFromDeadZone()) * turboInterval) + 0.5)); + tempTurboInterval = floor(((1 - getMouseDistanceFromDeadZone()) * turboInterval) + 0.5); } else { double distance = getMouseDistanceFromDeadZone(); + if (distance > 0.0) { - tempTurboInterval = static_cast(floor(((turboInterval / getMouseDistanceFromDeadZone()) * 0.5) + 0.5)); + tempTurboInterval = floor(((turboInterval / getMouseDistanceFromDeadZone()) * 0.5) + 0.5); } else { @@ -282,9 +288,10 @@ void JoyGradientButton::wheelEventVertical() else if ((diff >= 0.1) && (wheelSpeedY != 0)) { double distance = getMouseDistanceFromDeadZone(); + if (distance > 0.0) { - tempInterval = 1000 / wheelSpeedY / static_cast(distance); + tempInterval = 1000 / wheelSpeedY / distance; } else { @@ -297,6 +304,7 @@ void JoyGradientButton::wheelEventVertical() // remaining time left. tempInterval = tempInterval - wheelVerticalTime.elapsed(); tempInterval = qMin(tempInterval, 5); + if (!mouseWheelVerticalEventTimer.isActive() || (mouseWheelVerticalEventTimer.interval() != tempInterval)) { mouseWheelVerticalEventTimer.start(tempInterval); @@ -313,15 +321,17 @@ void JoyGradientButton::wheelEventVertical() if ((buttonslot != nullptr) && (wheelSpeedY != 0)) { bool isActive = getActiveSlots().contains(buttonslot); + if (isActive && activateEvent) { sendevent(buttonslot, true); sendevent(buttonslot, false); mouseWheelVerticalEventQueue.enqueue(buttonslot); double distance = getMouseDistanceFromDeadZone(); + if (distance > 0.0) { - tempInterval = 1000 / wheelSpeedY / static_cast(distance); + tempInterval = 1000 / wheelSpeedY / distance; } else { @@ -329,6 +339,7 @@ void JoyGradientButton::wheelEventVertical() } tempInterval = qMin(tempInterval, 5); + if (!mouseWheelVerticalEventTimer.isActive() || (mouseWheelVerticalEventTimer.interval() != tempInterval)) { mouseWheelVerticalEventTimer.start(tempInterval); @@ -342,10 +353,12 @@ void JoyGradientButton::wheelEventVertical() else if (!mouseWheelVerticalEventQueue.isEmpty() && (wheelSpeedY != 0)) { QQueue tempQueue; + while (!mouseWheelVerticalEventQueue.isEmpty()) { buttonslot = mouseWheelVerticalEventQueue.dequeue(); bool isActive = getActiveSlots().contains(buttonslot); + if (isActive && activateEvent) { sendevent(buttonslot, true); @@ -362,9 +375,10 @@ void JoyGradientButton::wheelEventVertical() { mouseWheelVerticalEventQueue = tempQueue; double distance = getMouseDistanceFromDeadZone(); + if (distance > 0.0) { - tempInterval = 1000 / wheelSpeedY / static_cast(distance); + tempInterval = 1000 / wheelSpeedY / distance; } else { @@ -372,6 +386,7 @@ void JoyGradientButton::wheelEventVertical() } tempInterval = qMin(tempInterval, 5); + if (!mouseWheelVerticalEventTimer.isActive() || (mouseWheelVerticalEventTimer.interval() != tempInterval)) { mouseWheelVerticalEventTimer.start(tempInterval); @@ -436,9 +451,10 @@ void JoyGradientButton::wheelEventHorizontal() else if ((diff >= 0.1) && (wheelSpeedX != 0)) { double distance = getMouseDistanceFromDeadZone(); + if (distance > 0.0) { - tempInterval = 1000 / wheelSpeedX / static_cast(distance); + tempInterval = 1000 / wheelSpeedX / distance; } else { @@ -451,6 +467,7 @@ void JoyGradientButton::wheelEventHorizontal() // remaining time left. tempInterval = tempInterval - wheelHorizontalTime.elapsed(); tempInterval = qMin(tempInterval, 5); + if (!mouseWheelHorizontalEventTimer.isActive() || (mouseWheelHorizontalEventTimer.interval() != tempInterval)) { mouseWheelHorizontalEventTimer.start(tempInterval); @@ -473,9 +490,10 @@ void JoyGradientButton::wheelEventHorizontal() sendevent(buttonslot, false); mouseWheelHorizontalEventQueue.enqueue(buttonslot); double distance = getMouseDistanceFromDeadZone(); + if (distance > 0.0) { - tempInterval = 1000 / wheelSpeedX / static_cast(distance); + tempInterval = 1000 / wheelSpeedX / distance; } else { @@ -501,6 +519,7 @@ void JoyGradientButton::wheelEventHorizontal() { buttonslot = mouseWheelHorizontalEventQueue.dequeue(); bool isActive = getActiveSlots().contains(buttonslot); + if (isActive) { sendevent(buttonslot, true); @@ -513,9 +532,10 @@ void JoyGradientButton::wheelEventHorizontal() { mouseWheelHorizontalEventQueue = tempQueue; double distance = getMouseDistanceFromDeadZone(); + if (distance > 0.0) { - tempInterval = 1000 / wheelSpeedX / static_cast(distance); + tempInterval = 1000 / wheelSpeedX / distance; } else { diff --git a/src/joybuttontypes/joygradientbutton.h b/src/joybuttontypes/joygradientbutton.h old mode 100644 new mode 100755 index 5374d4e54..b9e6be150 --- a/src/joybuttontypes/joygradientbutton.h +++ b/src/joybuttontypes/joygradientbutton.h @@ -29,6 +29,9 @@ class JoyGradientButton : public JoyButton public: explicit JoyGradientButton(int index, int originset, SetJoystick *parentSet, QObject *parent=0); + using JoyButton::getPartialName; + using JoyButton::setChangeSetCondition; + protected slots: virtual void turboEvent(); virtual void wheelEventVertical(); diff --git a/src/joybuttonwidget.cpp b/src/joybuttonwidget.cpp old mode 100644 new mode 100755 index cd4c40f40..08e3b9ec7 --- a/src/joybuttonwidget.cpp +++ b/src/joybuttonwidget.cpp @@ -29,7 +29,7 @@ JoyButtonWidget::JoyButtonWidget(JoyButton *button, bool displayNames, QWidget * { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->button = button; + m_button = button; refreshLabel(); enableFlashes(); @@ -47,15 +47,16 @@ JoyButton* JoyButtonWidget::getJoyButton() const { qInstallMessageHandler(MessageHandler::myMessageOutput); - return button; + return m_button; } void JoyButtonWidget::disableFlashes() { qInstallMessageHandler(MessageHandler::myMessageOutput); - disconnect(button, &JoyButton::clicked, this, &JoyButtonWidget::flash); - disconnect(button, &JoyButton::released, this, &JoyButtonWidget::unflash); + disconnect(m_button, &JoyButton::clicked, this, &JoyButtonWidget::flash); + disconnect(m_button, &JoyButton::released, this, &JoyButtonWidget::unflash); + this->unflash(); } @@ -63,19 +64,18 @@ void JoyButtonWidget::enableFlashes() { qInstallMessageHandler(MessageHandler::myMessageOutput); - connect(button, &JoyButton::clicked, this, &JoyButtonWidget::flash, Qt::QueuedConnection); - connect(button, &JoyButton::released, this, &JoyButtonWidget::unflash, Qt::QueuedConnection); + connect(m_button, &JoyButton::clicked, this, &JoyButtonWidget::flash, Qt::QueuedConnection); + connect(m_button, &JoyButton::released, this, &JoyButtonWidget::unflash, Qt::QueuedConnection); } QString JoyButtonWidget::generateLabel() { qInstallMessageHandler(MessageHandler::myMessageOutput); - QString temp = QString(); - temp = button->getName(false, ifDisplayNames()).replace("&", "&&"); + QString temp = m_button->getName(false, ifDisplayNames()).replace("&", "&&"); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Name of joy button is: " << temp; + qDebug() << "Name of joy button is: " << temp; #endif return temp; @@ -86,7 +86,7 @@ void JoyButtonWidget::showContextMenu(const QPoint &point) qInstallMessageHandler(MessageHandler::myMessageOutput); QPoint globalPos = this->mapToGlobal(point); - JoyButtonContextMenu *contextMenu = new JoyButtonContextMenu(button, this); + JoyButtonContextMenu *contextMenu = new JoyButtonContextMenu(m_button, this); contextMenu->buildMenu(); contextMenu->popup(globalPos); } @@ -95,8 +95,5 @@ void JoyButtonWidget::tryFlash() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (button->getButtonState()) - { - flash(); - } + if (m_button->getButtonState()) flash(); } diff --git a/src/joybuttonwidget.h b/src/joybuttonwidget.h old mode 100644 new mode 100755 index 391dee603..97634bc42 --- a/src/joybuttonwidget.h +++ b/src/joybuttonwidget.h @@ -36,17 +36,17 @@ class JoyButtonWidget : public FlashButtonWidget void tryFlash(); protected: - virtual QString generateLabel(); + virtual QString generateLabel() override; public slots: - void disableFlashes(); - void enableFlashes(); + void disableFlashes() override; + void enableFlashes() override; private slots: void showContextMenu(const QPoint &point); private: - JoyButton* button; + JoyButton* m_button; }; #endif // JOYBUTTONWIDGET_H diff --git a/src/joycontrolstick.cpp b/src/joycontrolstick.cpp old mode 100644 new mode 100755 index 22517d5da..8dbf61cb6 --- a/src/joycontrolstick.cpp +++ b/src/joycontrolstick.cpp @@ -17,14 +17,13 @@ #include "joycontrolstick.h" +#include "globalvariables.h" #include "messagehandler.h" #include "inputdevice.h" #include "joybuttontypes/joycontrolstickbutton.h" #include "joybuttontypes/joycontrolstickmodifierbutton.h" #include "joyaxis.h" -#include - #include #include #include @@ -32,17 +31,7 @@ #include #include -// Define Pi here. -const double JoyControlStick::PI = acos(-1.0); - -// Set default values used for stick properties. -const int JoyControlStick::DEFAULTDEADZONE = 8000; -const int JoyControlStick::DEFAULTMAXZONE = JoyAxis::AXISMAXZONE; -const int JoyControlStick::DEFAULTDIAGONALRANGE = 90; const JoyControlStick::JoyMode JoyControlStick::DEFAULTMODE = JoyControlStick::StandardMode; -const double JoyControlStick::DEFAULTCIRCLE = 0.0; -const int JoyControlStick::DEFAULTSTICKDELAY = 0; - JoyControlStick::JoyControlStick(JoyAxis *axis1, JoyAxis *axis2, int index, int originset, QObject *parent) : @@ -59,10 +48,9 @@ JoyControlStick::JoyControlStick(JoyAxis *axis1, JoyAxis *axis2, this->index = index; this->originset = originset; this->modifierButton = nullptr; - reset(); - - populateButtons(); + reset(); + populateStickBtns(); directionDelayTimer.setSingleShot(true); connect(&directionDelayTimer, &QTimer::timeout, this, &JoyControlStick::stickDirectionChangeEvent); @@ -93,42 +81,36 @@ void JoyControlStick::joyEvent(bool ignoresets) { isActive = true; emit active(axisX->getCurrentRawValue(), axisY->getCurrentRawValue()); + if (ignoresets || (stickDelay == 0)) { if (directionDelayTimer.isActive()) - { directionDelayTimer.stop(); - } createDeskEvent(ignoresets); } else { if (!directionDelayTimer.isActive()) - { directionDelayTimer.start(stickDelay); - } } } else if (!safezone && isActive) { isActive = false; emit released(axisX->getCurrentRawValue(), axisY->getCurrentRawValue()); + if (ignoresets || (stickDelay == 0)) { if (directionDelayTimer.isActive()) - { directionDelayTimer.stop(); - } createDeskEvent(ignoresets); } else { if (!directionDelayTimer.isActive()) - { directionDelayTimer.start(stickDelay); - } } } else if (isActive) @@ -136,28 +118,23 @@ void JoyControlStick::joyEvent(bool ignoresets) if (ignoresets || (stickDelay == 0)) { if (directionDelayTimer.isActive()) - { directionDelayTimer.stop(); - } createDeskEvent(ignoresets); } else { JoyStickDirections pendingDirection = calculateStickDirection(); + if (currentDirection != pendingDirection) { if (!directionDelayTimer.isActive()) - { directionDelayTimer.start(stickDelay); - } } else { if (directionDelayTimer.isActive()) - { directionDelayTimer.stop(); - } createDeskEvent(ignoresets); } @@ -194,6 +171,11 @@ void JoyControlStick::populateButtons() { qInstallMessageHandler(MessageHandler::myMessageOutput); + populateStickBtns(); +} + +void JoyControlStick::populateStickBtns() +{ JoyControlStickButton *button = new JoyControlStickButton(this, StickUp, originset, getParentSet(), this); buttons.insert(StickUp, button); @@ -269,21 +251,23 @@ void JoyControlStick::createDeskEvent(bool ignoresets) if (safezone) { - if (currentMode == StandardMode) - { - determineStandardModeEvent(eventbutton1, eventbutton2); - } - else if (currentMode == EightWayMode) - { - determineEightWayModeEvent(eventbutton1, eventbutton2, eventbutton3); - } - else if (currentMode == FourWayCardinal) - { - determineFourWayCardinalEvent(eventbutton1, eventbutton2); - } - else if (currentMode == FourWayDiagonal) + switch(currentMode) { - determineFourWayDiagonalEvent(eventbutton3); + case StandardMode: + determineStandardModeEvent(eventbutton1, eventbutton2); + break; + + case EightWayMode: + determineEightWayModeEvent(eventbutton1, eventbutton2, eventbutton3); + break; + + case FourWayCardinal: + determineFourWayCardinalEvent(eventbutton1, eventbutton2); + break; + + case FourWayDiagonal: + determineFourWayDiagonalEvent(eventbutton3); + break; } } else @@ -418,8 +402,7 @@ double JoyControlStick::calculateBearing(int axisXValue, int axisYValue) { double temp1 = axis1Value; double temp2 = axis2Value; - - double angle = (atan2(temp1, -temp2) * 180) / PI; + double angle = (atan2(temp1, -temp2) * 180) / GlobalVariables::JoyControlStick::PI ; if ((axis1Value >= 0) && (axis2Value <= 0)) { @@ -481,16 +464,16 @@ double JoyControlStick::getDistanceFromDeadZone(int axisXValue, int axisYValue) int squared_dist = (axis1Value * axis1Value) + (axis2Value * axis2Value); - int dist = static_cast(sqrt(squared_dist)); + int dist = sqrt(squared_dist); - double squareStickFullPhi = qMin(static_cast(ang_sin) ? 1/fabs(ang_sin) : 2, static_cast(ang_cos) ? 1/fabs(ang_cos) : 2); + double squareStickFullPhi = qMin((ang_sin != 0.0) ? 1/fabs(ang_sin) : 2, ang_cos != 0.0 ? 1/fabs(ang_cos) : 2); double circle = this->circle; double circleStickFull = (squareStickFullPhi - 1) * circle + 1; double adjustedDist = (circleStickFull > 1.0) ? (dist / circleStickFull) : dist; double adjustedDeadZone = (circleStickFull > 1.0) ? (deadZone / circleStickFull) : deadZone; - distance = (adjustedDist - adjustedDeadZone)/static_cast(maxZone - adjustedDeadZone); + distance = (adjustedDist - adjustedDeadZone)/(static_cast(maxZone) - adjustedDeadZone); distance = qBound(0.0, distance, 1.0); return distance; } @@ -531,9 +514,9 @@ double JoyControlStick::calculateYDistanceFromDeadZone(int axisXValue, double ang_sin = sin(angle2); double ang_cos = cos(angle2); - int deadY = static_cast(abs(floor(deadZone * ang_cos + 0.5))); + int deadY = abs(floor(deadZone * ang_cos + 0.5)); - double squareStickFullPhi = qMin(static_cast(ang_sin) ? 1/fabs(ang_sin) : 2, static_cast(ang_cos) ? 1/fabs(ang_cos) : 2); + double squareStickFullPhi = qMin(ang_sin != 0.0 ? 1/fabs(ang_sin) : 2, ang_cos != 0.0 ? 1/fabs(ang_cos) : 2); double circle = this->circle; double circleStickFull = (squareStickFullPhi - 1) * circle + 1; @@ -551,14 +534,13 @@ double JoyControlStick::calculateYDistanceFromDeadZone(int axisXValue, double minangle = tempangles.at(1); double square_dist = getAbsoluteRawDistance(axis1Value, axis2Value); - double mindeadY = fabs(square_dist * sin(minangle * PI / 180.0)); + double mindeadY = fabs(square_dist * sin(minangle * GlobalVariables::JoyControlStick::PI / 180.0)); double currentDeadY = qMax(adjustedDeadYZone, mindeadY); double maxRange = static_cast(maxZone) - currentDeadY; double tempdist4 = 0.0; + if (maxRange != 0.0) - { tempdist4 = (fabs(adjustedAxis2Value) - currentDeadY) / maxRange; - } distance = tempdist4; } @@ -568,14 +550,13 @@ double JoyControlStick::calculateYDistanceFromDeadZone(int axisXValue, double minangle = tempfuck.at(4); double square_dist = getAbsoluteRawDistance(axis1Value, axis2Value); - double mindeadY = fabs(square_dist * sin((minangle - 90.0) * PI / 180.0)); + double mindeadY = fabs(square_dist * sin((minangle - 90.0) * GlobalVariables::JoyControlStick::PI / 180.0)); double currentDeadY = qMax(adjustedDeadYZone, mindeadY); double maxRange = static_cast(maxZone) - currentDeadY; double tempdist4 = 0.0; + if (maxRange != 0.0) - { tempdist4 = (fabs(adjustedAxis2Value) - currentDeadY) / maxRange; - } distance = tempdist4; } @@ -585,14 +566,13 @@ double JoyControlStick::calculateYDistanceFromDeadZone(int axisXValue, double minangle = tempangles.at(6); double square_dist = getAbsoluteRawDistance(axis1Value, axis2Value); - double mindeadY = fabs(square_dist * sin((minangle - 180.0) * PI / 180.0)); + double mindeadY = fabs(square_dist * sin((minangle - 180.0) * GlobalVariables::JoyControlStick::PI / 180.0)); double currentDeadY = qMax(adjustedDeadYZone, mindeadY); double maxRange = static_cast(maxZone) - currentDeadY; double tempdist4 = 0.0; + if (maxRange != 0.0) - { tempdist4 = (fabs(adjustedAxis2Value) - currentDeadY) / maxRange; - } distance = tempdist4; } @@ -602,14 +582,13 @@ double JoyControlStick::calculateYDistanceFromDeadZone(int axisXValue, double minangle = tempangles.at(8); double square_dist = getAbsoluteRawDistance(axis1Value, axis2Value); - double mindeadY = fabs(square_dist * sin((minangle - 270.0) * PI / 180.0)); + double mindeadY = fabs(square_dist * sin((minangle - 270.0) * GlobalVariables::JoyControlStick::PI / 180.0)); double currentDeadY = qMax(adjustedDeadYZone, mindeadY); double maxRange = static_cast(maxZone) - currentDeadY; double tempdist4 = 0.0; + if (maxRange != 0.0) - { tempdist4 = (fabs(adjustedAxis2Value) - currentDeadY) / maxRange; - } distance = tempdist4; } @@ -618,10 +597,9 @@ double JoyControlStick::calculateYDistanceFromDeadZone(int axisXValue, // Backup plan. Should not arrive here. double maxRange = static_cast(maxZone) - adjustedDeadYZone; double tempdist4 = 0.0; + if (maxRange != 0.0) - { tempdist4 = (fabs(adjustedAxis2Value) - adjustedDeadYZone) / maxRange; - } distance = tempdist4; } @@ -631,10 +609,9 @@ double JoyControlStick::calculateYDistanceFromDeadZone(int axisXValue, // No interpolation desired or diagonal range is 90 degrees. double maxRange = static_cast(maxZone) - adjustedDeadYZone; double tempdist4 = 0.0; + if (maxRange != 0.0) - { tempdist4 = (fabs(adjustedAxis2Value) - adjustedDeadYZone) / maxRange; - } distance = tempdist4; } @@ -679,8 +656,8 @@ double JoyControlStick::calculateXDistanceFromDeadZone(int axisXValue, double ang_sin = sin(angle2); double ang_cos = cos(angle2); - int deadX = abs(static_cast(floor(deadZone * ang_sin + 0.5))); - double squareStickFullPhi = qMin(static_cast(ang_sin) ? 1/fabs(ang_sin) : 2, static_cast(ang_cos) ? 1/fabs(ang_cos) : 2); + int deadX = abs(floor(deadZone * ang_sin + 0.5)); + double squareStickFullPhi = qMin(ang_sin != 0.0 ? 1/fabs(ang_sin) : 2, ang_cos != 0.0 ? 1/fabs(ang_cos) : 2); double circle = this->circle; double circleStickFull = (squareStickFullPhi - 1) * circle + 1; @@ -692,20 +669,20 @@ double JoyControlStick::calculateXDistanceFromDeadZone(int axisXValue, if (interpolate && (diagonalRange < 90)) { JoyStickDirections direction = calculateStickDirection(axis1Value, axis2Value); + if ((direction == StickRightUp) || (direction == StickRight)) { QList tempangles = getDiagonalZoneAngles(); double maxangle = tempangles.at(3); double square_dist = getAbsoluteRawDistance(axis1Value, axis2Value); - double mindeadX = fabs(square_dist * cos(maxangle * PI / 180.0)); + double mindeadX = fabs(square_dist * cos(maxangle * GlobalVariables::JoyControlStick::PI / 180.0)); double currentDeadX = qMax(mindeadX, adjustedDeadXZone); double maxRange = static_cast(maxZone) - currentDeadX; double tempdist4 = 0.0; + if (maxRange != 0.0) - { tempdist4 = (fabs(adjustedAxis1Value) - currentDeadX) / maxRange; - } distance = tempdist4; } @@ -715,14 +692,13 @@ double JoyControlStick::calculateXDistanceFromDeadZone(int axisXValue, double maxangle = tempangles.at(5); double square_dist = getAbsoluteRawDistance(axis1Value, axis2Value); - double mindeadX = fabs(square_dist * cos((maxangle - 90.0) * PI / 180.0)); + double mindeadX = fabs(square_dist * cos((maxangle - 90.0) * GlobalVariables::JoyControlStick::PI / 180.0)); double currentDeadX = qMax(mindeadX, adjustedDeadXZone); double maxRange = static_cast(maxZone) - currentDeadX; double tempdist4 = 0.0; + if (maxRange != 0.0) - { tempdist4 = (fabs(adjustedAxis1Value) - currentDeadX) / maxRange; - } distance = tempdist4; } @@ -732,14 +708,13 @@ double JoyControlStick::calculateXDistanceFromDeadZone(int axisXValue, double maxangle = tempangles.at(7); double square_dist = getAbsoluteRawDistance(axis1Value, axis2Value); - double mindeadX = fabs(square_dist * cos((maxangle - 180.0) * PI / 180.0)); + double mindeadX = fabs(square_dist * cos((maxangle - 180.0) * GlobalVariables::JoyControlStick::PI / 180.0)); double currentDeadX = qMax(mindeadX, adjustedDeadXZone); double maxRange = static_cast(maxZone) - currentDeadX; double tempdist4 = 0.0; + if (maxRange != 0.0) - { tempdist4 = (fabs(adjustedAxis1Value) - currentDeadX) / maxRange; - } distance = tempdist4; } @@ -749,14 +724,13 @@ double JoyControlStick::calculateXDistanceFromDeadZone(int axisXValue, double maxangle = tempangles.at(1); double square_dist = getAbsoluteRawDistance(axis1Value, axis2Value); - double mindeadX = fabs(square_dist * cos((maxangle - 270.0) * PI / 180.0)); + double mindeadX = fabs(square_dist * cos((maxangle - 270.0) * GlobalVariables::JoyControlStick::PI / 180.0)); double currentDeadX = qMax(mindeadX, adjustedDeadXZone); double maxRange = static_cast(maxZone) - currentDeadX; double tempdist4 = 0.0; + if (maxRange != 0.0) - { tempdist4 = (fabs(adjustedAxis1Value) - currentDeadX) / maxRange; - } distance = tempdist4; } @@ -765,10 +739,9 @@ double JoyControlStick::calculateXDistanceFromDeadZone(int axisXValue, // Backup plan. Should not arrive here. double maxRange = static_cast(maxZone) - adjustedDeadXZone; double tempdist4 = 0.0; + if (maxRange != 0.0) - { tempdist4 = (fabs(adjustedAxis1Value) - adjustedDeadXZone) / maxRange; - } distance = tempdist4; } @@ -778,10 +751,9 @@ double JoyControlStick::calculateXDistanceFromDeadZone(int axisXValue, // No interpolation desired or diagonal range is 90 degrees. double maxRange = static_cast(maxZone) - adjustedDeadXZone; double tempdist4 = 0.0; + if (maxRange != 0.0) - { tempdist4 = (fabs(adjustedAxis1Value) - adjustedDeadXZone) / maxRange; - } distance = tempdist4; } @@ -808,39 +780,29 @@ double JoyControlStick::getAbsoluteRawDistance(int axisXValue, int axisYValue) { qInstallMessageHandler(MessageHandler::myMessageOutput); - double distance = 0.0; - int axis1Value = axisXValue; int axis2Value = axisYValue; int square_dist = (axis1Value * axis1Value) + (axis2Value * axis2Value); - distance = sqrt(square_dist); - return distance; + return sqrt(square_dist); } double JoyControlStick::getNormalizedAbsoluteDistance() { qInstallMessageHandler(MessageHandler::myMessageOutput); - double distance = 0.0; - int axis1Value = axisX->getCurrentRawValue(); int axis2Value = axisY->getCurrentRawValue(); int square_dist = (axis1Value * axis1Value) + (axis2Value * axis2Value); - distance = sqrt(square_dist)/static_cast(maxZone); - if (distance > 1.0) - { - distance = 1.0; - } - else if (distance < 0.0) - { - distance = 0.0; - } + double distance = sqrt(square_dist)/static_cast(maxZone); + + if (distance > 1.0) distance = 1.0; + else if (distance < 0.0) distance = 0.0; return distance; } @@ -849,23 +811,16 @@ double JoyControlStick::getRadialDistance(int axisXValue, int axisYValue) { qInstallMessageHandler(MessageHandler::myMessageOutput); - double distance = 0.0; - int axis1Value = axisXValue; int axis2Value = axisYValue; int square_dist = (axis1Value * axis1Value) + (axis2Value * axis2Value); - distance = sqrt(square_dist)/static_cast(maxZone); - if (distance > 1.0) - { - distance = 1.0; - } - else if (distance < 0.0) - { - distance = 0.0; - } + double distance = sqrt(square_dist)/static_cast(maxZone); + + if (distance > 1.0) distance = 1.0; + else if (distance < 0.0) distance = 0.0; return distance; } @@ -899,56 +854,37 @@ QString JoyControlStick::getName(bool forceFullFormat, bool displayNames) label.append(": "); QStringList tempList = QStringList(); + if (buttons.contains(StickUp)) { JoyControlStickButton *button = buttons.value(StickUp); - if (!button->getButtonName().isEmpty()) - { - tempList.append(button->getButtonName()); - } - else - { - tempList.append(button->getSlotsSummary()); - } + + if (!button->getButtonName().isEmpty()) tempList.append(button->getButtonName()); + else tempList.append(button->getSlotsSummary()); } if (buttons.contains(StickLeft)) { JoyControlStickButton *button = buttons.value(StickLeft); - if (!button->getButtonName().isEmpty()) - { - tempList.append(button->getButtonName()); - } - else - { - tempList.append(button->getSlotsSummary()); - } + + if (!button->getButtonName().isEmpty()) tempList.append(button->getButtonName()); + else tempList.append(button->getSlotsSummary()); } if (buttons.contains(StickDown)) { JoyControlStickButton *button = buttons.value(StickDown); - if (!button->getButtonName().isEmpty()) - { - tempList.append(button->getButtonName()); - } - else - { - tempList.append(button->getSlotsSummary()); - } + + if (!button->getButtonName().isEmpty()) tempList.append(button->getButtonName()); + else tempList.append(button->getSlotsSummary()); } if (buttons.contains(StickRight)) { JoyControlStickButton *button = buttons.value(StickRight); - if (!button->getButtonName().isEmpty()) - { - tempList.append(button->getButtonName()); - } - else - { - tempList.append(button->getSlotsSummary()); - } + + if (!button->getButtonName().isEmpty()) tempList.append(button->getButtonName()); + else tempList.append(button->getSlotsSummary()); } label.append(tempList.join(", ")); @@ -964,24 +900,19 @@ QString JoyControlStick::getPartialName(bool forceFullFormat, bool displayNames) if (!stickName.isEmpty() && displayNames) { if (forceFullFormat) - { label.append(trUtf8("Stick")).append(" "); - } label.append(stickName); } else if (!defaultStickName.isEmpty()) { if (forceFullFormat) - { label.append(trUtf8("Stick")).append(" "); - } label.append(defaultStickName); } else { - label.append(trUtf8("Stick")).append(" "); label.append(QString::number(getRealJoyIndex())); } @@ -1024,7 +955,7 @@ void JoyControlStick::reset() qInstallMessageHandler(MessageHandler::myMessageOutput); deadZone = 8000; - maxZone = JoyAxis::AXISMAXZONE; + maxZone = GlobalVariables::JoyAxis::AXISMAXZONE; diagonalRange = 45; isActive = false; pendingStickEvent = false; @@ -1036,8 +967,9 @@ void JoyControlStick::reset() currentDirection = StickCentered; currentMode = StandardMode; stickName.clear(); - circle = DEFAULTCIRCLE; - stickDelay = DEFAULTSTICKDELAY; + circle = GlobalVariables::JoyControlStick::DEFAULTCIRCLE; + stickDelay = GlobalVariables::JoyControlStick::DEFAULTSTICKDELAY; + resetButtons(); } @@ -1046,10 +978,9 @@ void JoyControlStick::setDeadZone(int value) qInstallMessageHandler(MessageHandler::myMessageOutput); value = abs(value); + if (value > getAxisX()->getAxisMaxCal()) - { value = getAxisX()->getAxisMaxCal(); - } if ((value != deadZone) && (value <= maxZone)) { @@ -1064,10 +995,9 @@ void JoyControlStick::setMaxZone(int value) qInstallMessageHandler(MessageHandler::myMessageOutput); value = abs(value); + if (value >= getAxisX()->getAxisMaxCal()) - { value = getAxisX()->getAxisMaxCal(); - } if ((value != maxZone) && (value > deadZone)) { @@ -1107,14 +1037,8 @@ void JoyControlStick::setDiagonalRange(int value) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (value < 1) - { - value = 1; - } - else if (value > 90) - { - value = 90; - } + if (value < 1) value = 1; + else if (value > 90) value = 90; if (value != diagonalRange) { @@ -1147,6 +1071,7 @@ void JoyControlStick::deleteButtons() while (iter.hasNext()) { JoyButton *button = iter.next().value(); + if (button != nullptr) { delete button; @@ -1226,29 +1151,20 @@ void JoyControlStick::readConfig(QXmlStreamReader *xml) } else if ((xml->name() == "squareStick") && xml->isStartElement()) { - QString temptext = xml->readElementText(); - int tempchoice = temptext.toInt(); + int tempchoice = xml->readElementText().toInt(); if ((tempchoice > 0) && (tempchoice <= 100)) - { this->setCircleAdjust(tempchoice / 100.0); - } } - else if ((xml->name() == JoyControlStickButton::xmlName) && xml->isStartElement()) + else if ((xml->name() == GlobalVariables::JoyControlStickButton::xmlName) && xml->isStartElement()) { int index = xml->attributes().value("index").toString().toInt(); JoyControlStickButton *button = buttons.value(static_cast(index)); - if (button != nullptr) - { - button->readConfig(xml); - } - else - { - xml->skipCurrentElement(); - } + if (button != nullptr) button->readConfig(xml); + else xml->skipCurrentElement(); } - else if ((xml->name() == JoyControlStickModifierButton::xmlName) && xml->isStartElement()) + else if ((xml->name() == GlobalVariables::JoyControlStickModifierButton::xmlName) && xml->isStartElement()) { modifierButton->readConfig(xml); } @@ -1282,52 +1198,44 @@ void JoyControlStick::writeConfig(QXmlStreamWriter *xml) xml->writeStartElement("stick"); xml->writeAttribute("index", QString::number(index+1)); - if (deadZone != DEFAULTDEADZONE) - { + if (deadZone != GlobalVariables::JoyControlStick::DEFAULTDEADZONE) xml->writeTextElement("deadZone", QString::number(deadZone)); - } - if (maxZone != DEFAULTMAXZONE) - { + if (maxZone != GlobalVariables::JoyControlStick::DEFAULTMAXZONE) xml->writeTextElement("maxZone", QString::number(maxZone)); - } xml->writeTextElement("calibrated", (calibrated ? "true" : "false")); xml->writeTextElement("summary", (getCalibrationSummary().isEmpty() ? "" : calibrationSummary)); - if ((currentMode == StandardMode) || (currentMode == EightWayMode)) + if ((currentMode == StandardMode || currentMode == EightWayMode) && (diagonalRange != GlobalVariables::JoyControlStick::DEFAULTDIAGONALRANGE)) { - if (diagonalRange != DEFAULTDIAGONALRANGE) - { - xml->writeTextElement("diagonalRange", QString::number(diagonalRange)); - } + xml->writeTextElement("diagonalRange", QString::number(diagonalRange)); } - if (currentMode == EightWayMode) - { - xml->writeTextElement("mode", "eight-way"); - } - else if (currentMode == FourWayCardinal) - { - xml->writeTextElement("mode", "four-way"); - } - else if (currentMode == FourWayDiagonal) + switch(currentMode) { - xml->writeTextElement("mode", "diagonal"); + case EightWayMode: + xml->writeTextElement("mode", "eight-way"); + break; + + case FourWayCardinal: + xml->writeTextElement("mode", "four-way"); + break; + + case FourWayDiagonal: + xml->writeTextElement("mode", "diagonal"); + break; } - if (circle > DEFAULTCIRCLE) - { + if (circle > GlobalVariables::JoyControlStick::DEFAULTCIRCLE) xml->writeTextElement("squareStick", QString::number(circle * 100)); - } - if (stickDelay > DEFAULTSTICKDELAY) - { + if (stickDelay > GlobalVariables::JoyControlStick::DEFAULTSTICKDELAY) xml->writeTextElement("stickDelay", QString::number(stickDelay)); - } QHashIterator iter(buttons); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); @@ -1335,9 +1243,7 @@ void JoyControlStick::writeConfig(QXmlStreamWriter *xml) } if (!modifierButton->isDefault()) - { modifierButton->writeConfig(xml); - } xml->writeEndElement(); } @@ -1352,19 +1258,16 @@ void JoyControlStick::resetButtons() qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(buttons); + while (iter.hasNext()) { JoyButton *button = iter.next().value(); - if (button != nullptr) - { - button->reset(); - } + + if (button != nullptr) button->reset(); } if (modifierButton != nullptr) - { modifierButton->reset(); - } } /** @@ -1379,6 +1282,7 @@ JoyControlStickButton* JoyControlStick::getDirectionButton(JoyStickDirections di qInstallMessageHandler(MessageHandler::myMessageOutput); JoyControlStickButton *button = buttons.value(direction); + return button; } @@ -1394,80 +1298,98 @@ double JoyControlStick::calculateMouseDirectionalDistance(JoyControlStickButton double finalDistance = 0.0; - if (currentDirection == StickUp) - { - finalDistance = calculateYDistanceFromDeadZone(true); - } - else if (currentDirection == StickRightUp) + switch(currentDirection) { - if ((activeButton1 != nullptr) && (activeButton1 == button)) - { - finalDistance = calculateXDistanceFromDeadZone(true); - } - else if ((activeButton2 != nullptr) && (activeButton2 == button)) + case StickUp: { finalDistance = calculateYDistanceFromDeadZone(true); + break; } - else if ((activeButton3 != nullptr) && (activeButton3 == button)) + case StickRightUp: { - finalDistance = calculateEightWayDiagonalDistanceFromDeadZone(); + if ((activeButton1 != nullptr) && (activeButton1 == button)) + { + finalDistance = calculateXDistanceFromDeadZone(true); + } + else if ((activeButton2 != nullptr) && (activeButton2 == button)) + { + finalDistance = calculateYDistanceFromDeadZone(true); + } + else if ((activeButton3 != nullptr) && (activeButton3 == button)) + { + finalDistance = calculateEightWayDiagonalDistanceFromDeadZone(); + } + + break; } - } - else if (currentDirection == StickRight) - { - finalDistance = calculateXDistanceFromDeadZone(true); - } - else if (currentDirection == StickRightDown) - { - if ((activeButton1 != nullptr) && (activeButton1 == button)) + case StickRight: { finalDistance = calculateXDistanceFromDeadZone(true); + + break; } - else if ((activeButton2 != nullptr) && (activeButton2 == button)) - { - finalDistance = calculateYDistanceFromDeadZone(true); - } - else if ((activeButton3 != nullptr) && (activeButton3 == button)) - { - finalDistance = calculateEightWayDiagonalDistanceFromDeadZone(); - } - } - else if (currentDirection == StickDown) - { - finalDistance = calculateYDistanceFromDeadZone(true); - } - else if (currentDirection == StickLeftDown) - { - if ((activeButton1 != nullptr) && (activeButton1 == button)) + case StickRightDown: { - finalDistance = calculateXDistanceFromDeadZone(true); + if ((activeButton1 != nullptr) && (activeButton1 == button)) + { + finalDistance = calculateXDistanceFromDeadZone(true); + } + else if ((activeButton2 != nullptr) && (activeButton2 == button)) + { + finalDistance = calculateYDistanceFromDeadZone(true); + } + else if ((activeButton3 != nullptr) && (activeButton3 == button)) + { + finalDistance = calculateEightWayDiagonalDistanceFromDeadZone(); + } + + break; } - else if ((activeButton2 != nullptr) && (activeButton2 == button)) + case StickDown: { finalDistance = calculateYDistanceFromDeadZone(true); + + break; } - else if ((activeButton3 != nullptr) && (activeButton3 == button)) + case StickLeftDown: { - finalDistance = calculateEightWayDiagonalDistanceFromDeadZone(); + if ((activeButton1 != nullptr) && (activeButton1 == button)) + { + finalDistance = calculateXDistanceFromDeadZone(true); + } + else if ((activeButton2 != nullptr) && (activeButton2 == button)) + { + finalDistance = calculateYDistanceFromDeadZone(true); + } + else if ((activeButton3 != nullptr) && (activeButton3 == button)) + { + finalDistance = calculateEightWayDiagonalDistanceFromDeadZone(); + } + + break; } - } - else if (currentDirection == StickLeft) - { - finalDistance = calculateXDistanceFromDeadZone(true); - } - else if (currentDirection == StickLeftUp) - { - if ((activeButton1 != nullptr) && (activeButton1 == button)) + case StickLeft: { finalDistance = calculateXDistanceFromDeadZone(true); + + break; } - else if ((activeButton2 != nullptr) && (activeButton2 == button)) - { - finalDistance = calculateYDistanceFromDeadZone(true); - } - else if ((activeButton3 != nullptr) && (activeButton3 == button)) + case StickLeftUp: { - finalDistance = calculateEightWayDiagonalDistanceFromDeadZone(); + if ((activeButton1 != nullptr) && (activeButton1 == button)) + { + finalDistance = calculateXDistanceFromDeadZone(true); + } + else if ((activeButton2 != nullptr) && (activeButton2 == button)) + { + finalDistance = calculateYDistanceFromDeadZone(true); + } + else if ((activeButton3 != nullptr) && (activeButton3 == button)) + { + finalDistance = calculateEightWayDiagonalDistanceFromDeadZone(); + } + + break; } } @@ -1483,6 +1405,7 @@ double JoyControlStick::calculateLastMouseDirectionalDistance(JoyControlStickBut JoyStickDirections direction = calculateStickDirection(axisX->getLastKnownThrottleValue(), axisY->getLastKnownThrottleValue()); + if ((direction == StickUp) && (button->getJoyNumber() == static_cast(StickUp))) { if (axisY->getLastKnownThrottleValue() >= 0) @@ -1711,68 +1634,88 @@ double JoyControlStick::calculateLastDirectionalDistance() JoyStickDirections direction = calculateStickDirection(axisX->getLastKnownThrottleValue(), axisY->getLastKnownThrottleValue()); - if (direction == StickUp) + + switch(direction) { - if (!(axisX->getLastKnownThrottleValue() >= 0)) + case StickUp: { - finalDistance = calculateYDistanceFromDeadZone(axisX->getLastKnownThrottleValue(), - axisY->getLastKnownThrottleValue()); + if (!(axisX->getLastKnownThrottleValue() >= 0)) + { + finalDistance = calculateYDistanceFromDeadZone(axisX->getLastKnownThrottleValue(), + axisY->getLastKnownThrottleValue()); + } + + break; } - } - else if (direction == StickRightUp) - { - if (!(axisY->getLastKnownThrottleValue() <= 0) && !(axisY->getLastKnownThrottleValue() >= 0)) + case StickRightUp: { - finalDistance = calculateEightWayDiagonalDistanceFromDeadZone(axisX->getLastKnownThrottleValue(), - axisY->getLastKnownThrottleValue()); + if (!(axisY->getLastKnownThrottleValue() <= 0) && !(axisY->getLastKnownThrottleValue() >= 0)) + { + finalDistance = calculateEightWayDiagonalDistanceFromDeadZone(axisX->getLastKnownThrottleValue(), + axisY->getLastKnownThrottleValue()); + } + + break; } - } - else if (direction == StickRight) - { - if (!(axisX->getLastKnownThrottleValue() <= 0)) + case StickRight: { - finalDistance = calculateXDistanceFromDeadZone(axisX->getLastKnownThrottleValue(), - axisY->getLastKnownThrottleValue()); + if (!(axisX->getLastKnownThrottleValue() <= 0)) + { + finalDistance = calculateXDistanceFromDeadZone(axisX->getLastKnownThrottleValue(), + axisY->getLastKnownThrottleValue()); + } + + break; } - } - else if (direction == StickRightDown) - { - if (!(axisY->getLastKnownThrottleValue() <= 0) && !(axisY->getLastKnownThrottleValue() <= 0)) + case StickRightDown: { - finalDistance = calculateEightWayDiagonalDistanceFromDeadZone(axisX->getLastKnownThrottleValue(), - axisY->getLastKnownThrottleValue()); - } - } - else if (direction == StickDown) - { - if (!(axisY->getLastKnownThrottleValue() <= 0)) + if (!(axisY->getLastKnownThrottleValue() <= 0) && !(axisY->getLastKnownThrottleValue() <= 0)) + { + finalDistance = calculateEightWayDiagonalDistanceFromDeadZone(axisX->getLastKnownThrottleValue(), + axisY->getLastKnownThrottleValue()); + } + + break; + } + case StickDown: { - finalDistance = calculateYDistanceFromDeadZone(axisX->getLastKnownThrottleValue(), - axisY->getLastKnownThrottleValue()); + if (!(axisY->getLastKnownThrottleValue() <= 0)) + { + finalDistance = calculateYDistanceFromDeadZone(axisX->getLastKnownThrottleValue(), + axisY->getLastKnownThrottleValue()); + } + + break; } - } - else if (direction == StickLeftDown) - { - if (!(axisY->getLastKnownThrottleValue() >= 0) && !(axisY->getLastKnownThrottleValue() <= 0)) + case StickLeftDown: { - finalDistance = calculateEightWayDiagonalDistanceFromDeadZone(axisX->getLastKnownThrottleValue(), - axisY->getLastKnownThrottleValue()); + if (!(axisY->getLastKnownThrottleValue() >= 0) && !(axisY->getLastKnownThrottleValue() <= 0)) + { + finalDistance = calculateEightWayDiagonalDistanceFromDeadZone(axisX->getLastKnownThrottleValue(), + axisY->getLastKnownThrottleValue()); + } + + break; } - } - else if (direction == StickLeft) - { - if (!(axisX->getLastKnownThrottleValue() >= 0)) + case StickLeft: { - finalDistance = calculateXDistanceFromDeadZone(axisX->getLastKnownThrottleValue(), - axisY->getLastKnownThrottleValue()); + if (!(axisX->getLastKnownThrottleValue() >= 0)) + { + finalDistance = calculateXDistanceFromDeadZone(axisX->getLastKnownThrottleValue(), + axisY->getLastKnownThrottleValue()); + } + + break; } - } - else if (direction == StickLeftUp) - { - if (!(axisY->getLastKnownThrottleValue() >= 0) && !(axisY->getLastKnownThrottleValue() >= 0)) + case StickLeftUp: { - finalDistance = calculateEightWayDiagonalDistanceFromDeadZone(axisX->getLastKnownThrottleValue(), - axisY->getLastKnownThrottleValue()); + if (!(axisY->getLastKnownThrottleValue() >= 0) && !(axisY->getLastKnownThrottleValue() >= 0)) + { + finalDistance = calculateEightWayDiagonalDistanceFromDeadZone(axisX->getLastKnownThrottleValue(), + axisY->getLastKnownThrottleValue()); + } + + break; } } @@ -1785,61 +1728,65 @@ double JoyControlStick::calculateLastAccelerationDirectionalDistance() double finalDistance = 0.0; - if (currentDirection == StickUp) + switch(currentDirection) { - if (!(axisX->getLastKnownRawValue() >= 0)) + case StickUp: { - finalDistance = calculateYAxisDistance(axisY->getLastKnownRawValue()); + if (!(axisX->getLastKnownRawValue() >= 0)) + finalDistance = calculateYAxisDistance(axisY->getLastKnownRawValue()); + + break; } - } - else if (currentDirection == StickRightUp) - { - if (!(axisY->getLastKnownRawValue() <= 0) && !(axisY->getLastKnownRawValue() >= 0)) + case StickRightUp: { - finalDistance = calculateEightWayDiagonalDistance(axisX->getLastKnownRawValue(), axisY->getLastKnownRawValue()); + if (!(axisY->getLastKnownRawValue() <= 0) && !(axisY->getLastKnownRawValue() >= 0)) + finalDistance = calculateEightWayDiagonalDistance(axisX->getLastKnownRawValue(), axisY->getLastKnownRawValue()); + + break; } - } - else if (currentDirection == StickRight) - { - if (!(axisX->getLastKnownRawValue() <= 0)) + case StickRight: { - finalDistance = calculateXAxisDistance(axisX->getLastKnownRawValue()); + if (!(axisX->getLastKnownRawValue() <= 0)) + finalDistance = calculateXAxisDistance(axisX->getLastKnownRawValue()); + + break; } - } - else if (currentDirection == StickRightDown) - { - if (!(axisY->getLastKnownRawValue() <= 0) && !(axisY->getLastKnownRawValue() <= 0)) + case StickRightDown: { - finalDistance = calculateEightWayDiagonalDistance(axisX->getLastKnownRawValue(), axisY->getLastKnownRawValue()); + if (!(axisY->getLastKnownRawValue() <= 0) && !(axisY->getLastKnownRawValue() <= 0)) + finalDistance = calculateEightWayDiagonalDistance(axisX->getLastKnownRawValue(), axisY->getLastKnownRawValue()); + + break; } - } - else if (currentDirection == StickDown) - { - if (!(axisY->getLastKnownRawValue() <= 0)) + case StickDown: { - finalDistance = calculateYAxisDistance(axisY->getLastKnownRawValue()); + if (!(axisY->getLastKnownRawValue() <= 0)) + finalDistance = calculateYAxisDistance(axisY->getLastKnownRawValue()); + + break; } - } - else if (currentDirection == StickLeftDown) - { - if (!(axisY->getLastKnownRawValue() >= 0) && !(axisY->getLastKnownRawValue() <= 0)) + case StickLeftDown: { - finalDistance = calculateEightWayDiagonalDistance(axisX->getLastKnownRawValue(), axisY->getLastKnownRawValue()); + if (!(axisY->getLastKnownRawValue() >= 0) && !(axisY->getLastKnownRawValue() <= 0)) + finalDistance = calculateEightWayDiagonalDistance(axisX->getLastKnownRawValue(), axisY->getLastKnownRawValue()); + + break; } - } - else if (currentDirection == StickLeft) - { - if (!(axisX->getLastKnownRawValue() >= 0)) + case StickLeft: { - finalDistance = calculateXAxisDistance(axisX->getLastKnownRawValue()); + if (!(axisX->getLastKnownRawValue() >= 0)) + finalDistance = calculateXAxisDistance(axisX->getLastKnownRawValue()); + + break; } - } - else if (currentDirection == StickLeftUp) - { - if (!(axisY->getLastKnownRawValue() >= 0) && !(axisY->getLastKnownRawValue() >= 0)) + case StickLeftUp: { - finalDistance = calculateEightWayDiagonalDistance(axisX->getLastKnownRawValue(), axisY->getLastKnownRawValue()); + if (!(axisY->getLastKnownRawValue() >= 0) && !(axisY->getLastKnownRawValue() >= 0)) + finalDistance = calculateEightWayDiagonalDistance(axisX->getLastKnownRawValue(), axisY->getLastKnownRawValue()); + + break; } + } return finalDistance; @@ -1857,37 +1804,48 @@ double JoyControlStick::calculateDirectionalDistance() double finalDistance = 0.0; - if (currentDirection == StickUp) - { - finalDistance = calculateYDistanceFromDeadZone(); - } - else if (currentDirection == StickRightUp) - { - finalDistance = getDistanceFromDeadZone(); - } - else if (currentDirection == StickRight) - { - finalDistance = calculateXDistanceFromDeadZone(); - } - else if (currentDirection == StickRightDown) - { - finalDistance = getDistanceFromDeadZone(); - } - else if (currentDirection == StickDown) - { - finalDistance = calculateYDistanceFromDeadZone(); - } - else if (currentDirection == StickLeftDown) - { - finalDistance = getDistanceFromDeadZone(); - } - else if (currentDirection == StickLeft) - { - finalDistance = calculateXDistanceFromDeadZone(); - } - else if (currentDirection == StickLeftUp) + switch(currentDirection) { - finalDistance = getDistanceFromDeadZone(); + case StickUp: + { + finalDistance = calculateYDistanceFromDeadZone(); + break; + } + case StickRightUp: + { + finalDistance = getDistanceFromDeadZone(); + break; + } + case StickRight: + { + finalDistance = calculateXDistanceFromDeadZone(); + break; + } + case StickRightDown: + { + finalDistance = getDistanceFromDeadZone(); + break; + } + case StickDown: + { + finalDistance = calculateYDistanceFromDeadZone(); + break; + } + case StickLeftDown: + { + finalDistance = getDistanceFromDeadZone(); + break; + } + case StickLeft: + { + finalDistance = calculateXDistanceFromDeadZone(); + break; + } + case StickLeftUp: + { + finalDistance = getDistanceFromDeadZone(); + break; + } } return finalDistance; @@ -1932,10 +1890,9 @@ int JoyControlStick::getCircleXCoordinate() int axisXValue = axisX->getCurrentRawValue(); int axisYValue = axisX->getCurrentRawValue(); + if (this->circle > 0.0) - { axisXValue = calculateCircleXValue(axisXValue, axisYValue); - } return axisXValue; } @@ -1946,10 +1903,9 @@ int JoyControlStick::getCircleYCoordinate() int axisXValue = axisX->getCurrentRawValue(); int axisYValue = axisY->getCurrentRawValue(); + if (this->circle > 0.0) - { axisYValue = calculateCircleYValue(axisXValue, axisYValue); - } return axisYValue; } @@ -1959,6 +1915,7 @@ int JoyControlStick::calculateCircleXValue(int axisXValue, int axisYValue) qInstallMessageHandler(MessageHandler::myMessageOutput); int value = axisXValue; + if (this->circle > 0.0) { int axis1Value = axisXValue; @@ -1968,11 +1925,11 @@ int JoyControlStick::calculateCircleXValue(int axisXValue, int axisYValue) double ang_sin = sin(angle2); double ang_cos = cos(angle2); - double squareStickFull = qMin(static_cast(ang_sin) ? 1/fabs(ang_sin) : 2, static_cast(ang_cos) ? 1/fabs(ang_cos) : 2); + double squareStickFull = qMin(ang_sin != 0.0 ? 1/fabs(ang_sin) : 2, ang_cos != 0.0 ? 1/fabs(ang_cos) : 2); double circle = this->circle; double circleStickFull = (squareStickFull - 1) * circle + 1; - value = (circleStickFull > 1.0) ? static_cast(floor((axisXValue / circleStickFull) + 0.5)) : value; + value = (circleStickFull > 1.0) ? floor((axisXValue / circleStickFull) + 0.5) : value; } return value; @@ -1983,6 +1940,7 @@ int JoyControlStick::calculateCircleYValue(int axisXValue, int axisYValue) qInstallMessageHandler(MessageHandler::myMessageOutput); int value = axisYValue; + if (this->circle > 0.0) { int axis1Value = axisXValue; @@ -1992,11 +1950,11 @@ int JoyControlStick::calculateCircleYValue(int axisXValue, int axisYValue) double ang_sin = sin(angle2); double ang_cos = cos(angle2); - double squareStickFull = qMin(static_cast(ang_sin) ? 1/fabs(ang_sin) : 2, static_cast(ang_cos) ? 1/fabs(ang_cos) : 2); + double squareStickFull = qMin(ang_sin != 0.0 ? 1/fabs(ang_sin) : 2, ang_cos != 0.0 ? 1/fabs(ang_cos) : 2); double circle = this->circle; double circleStickFull = (squareStickFull - 1) * circle + 1; - value = (circleStickFull > 1.0) ? static_cast(floor((axisYValue / circleStickFull) + 0.5)) : value; + value = (circleStickFull > 1.0) ? floor((axisYValue / circleStickFull) + 0.5) : value; } return value; @@ -2053,6 +2011,7 @@ QList JoyControlStick::getFourWayCardinalZoneAngles() anglesList.append(downInitial); anglesList.append(leftInitial); anglesList.append(upInitial); + return anglesList; } @@ -2073,6 +2032,7 @@ QList JoyControlStick::getFourWayDiagonalZoneAngles() anglesList.append(downRightInitial); anglesList.append(downLeftInitial); anglesList.append(upLeftInitial); + return anglesList; } @@ -2159,6 +2119,7 @@ void JoyControlStick::releaseButtonEvents() qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(buttons); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); @@ -2171,14 +2132,15 @@ bool JoyControlStick::isDefault() qInstallMessageHandler(MessageHandler::myMessageOutput); bool value = true; - value = value && (deadZone == DEFAULTDEADZONE); - value = value && (maxZone == DEFAULTMAXZONE); - value = value && (diagonalRange == DEFAULTDIAGONALRANGE); + value = value && (deadZone == GlobalVariables::JoyControlStick::DEFAULTDEADZONE); + value = value && (maxZone == GlobalVariables::JoyControlStick::DEFAULTMAXZONE); + value = value && (diagonalRange == GlobalVariables::JoyControlStick::DEFAULTDIAGONALRANGE); value = value && (currentMode == DEFAULTMODE); - value = value && (qFuzzyCompare(circle, DEFAULTCIRCLE)); - value = value && (stickDelay == DEFAULTSTICKDELAY); + value = value && qFuzzyCompare(circle, GlobalVariables::JoyControlStick::DEFAULTCIRCLE); + value = value && (stickDelay == GlobalVariables::JoyControlStick::DEFAULTSTICKDELAY); QHashIterator iter(buttons); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); @@ -2186,9 +2148,7 @@ bool JoyControlStick::isDefault() } if (modifierButton != nullptr) - { value = value && modifierButton->isDefault(); - } return value; } @@ -2198,6 +2158,7 @@ void JoyControlStick::setButtonsMouseMode(JoyButton::JoyMouseMovementMode mode) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(buttons); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); @@ -2212,9 +2173,9 @@ bool JoyControlStick::hasSameButtonsMouseMode() bool result = true; JoyButton::JoyMouseMovementMode initialMode = JoyButton::MouseCursor; - QHash temphash = getApplicableButtons(); QHashIterator iter(temphash); + while (iter.hasNext()) { if (!iter.hasPrevious()) @@ -2226,6 +2187,7 @@ bool JoyControlStick::hasSameButtonsMouseMode() { JoyControlStickButton *button = iter.next().value(); JoyButton::JoyMouseMovementMode temp = button->getMouseMode(); + if (temp != initialMode) { result = false; @@ -2242,9 +2204,9 @@ JoyButton::JoyMouseMovementMode JoyControlStick::getButtonsPresetMouseMode() qInstallMessageHandler(MessageHandler::myMessageOutput); JoyButton::JoyMouseMovementMode resultMode = JoyButton::MouseCursor; - QHash temphash = getApplicableButtons(); QHashIterator iter(temphash); + while (iter.hasNext()) { if (!iter.hasPrevious()) @@ -2256,6 +2218,7 @@ JoyButton::JoyMouseMovementMode JoyControlStick::getButtonsPresetMouseMode() { JoyControlStickButton *button = iter.next().value(); JoyButton::JoyMouseMovementMode temp = button->getMouseMode(); + if (temp != resultMode) { resultMode = JoyButton::MouseCursor; @@ -2272,6 +2235,7 @@ void JoyControlStick::setButtonsMouseCurve(JoyButton::JoyMouseCurve mouseCurve) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(buttons); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); @@ -2286,9 +2250,9 @@ bool JoyControlStick::hasSameButtonsMouseCurve() bool result = true; JoyButton::JoyMouseCurve initialCurve = JoyButton::LinearCurve; - QHash temphash = getApplicableButtons(); QHashIterator iter(temphash); + while (iter.hasNext()) { if (!iter.hasPrevious()) @@ -2300,6 +2264,7 @@ bool JoyControlStick::hasSameButtonsMouseCurve() { JoyControlStickButton *button = iter.next().value(); JoyButton::JoyMouseCurve temp = button->getMouseCurve(); + if (temp != initialCurve) { result = false; @@ -2316,9 +2281,9 @@ JoyButton::JoyMouseCurve JoyControlStick::getButtonsPresetMouseCurve() qInstallMessageHandler(MessageHandler::myMessageOutput); JoyButton::JoyMouseCurve resultCurve = JoyButton::LinearCurve; - QHash temphash = getApplicableButtons(); QHashIterator iter(temphash); + while (iter.hasNext()) { if (!iter.hasPrevious()) @@ -2330,6 +2295,7 @@ JoyButton::JoyMouseCurve JoyControlStick::getButtonsPresetMouseCurve() { JoyControlStickButton *button = iter.next().value(); JoyButton::JoyMouseCurve temp = button->getMouseCurve(); + if (temp != resultCurve) { resultCurve = JoyButton::LinearCurve; @@ -2346,6 +2312,7 @@ void JoyControlStick::setButtonsSpringWidth(int value) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(buttons); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); @@ -2358,6 +2325,7 @@ void JoyControlStick::setButtonsSpringHeight(int value) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(buttons); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); @@ -2373,6 +2341,7 @@ int JoyControlStick::getButtonsPresetSpringWidth() QHash temphash = getApplicableButtons(); QHashIterator iter(temphash); + while (iter.hasNext()) { if (!iter.hasPrevious()) @@ -2383,7 +2352,9 @@ int JoyControlStick::getButtonsPresetSpringWidth() else { JoyControlStickButton *button = iter.next().value(); + int temp = button->getSpringWidth(); + if (temp != presetSpringWidth) { presetSpringWidth = 0; @@ -2403,6 +2374,7 @@ int JoyControlStick::getButtonsPresetSpringHeight() QHash temphash = getApplicableButtons(); QHashIterator iter(temphash); + while (iter.hasNext()) { if (!iter.hasPrevious()) @@ -2414,6 +2386,7 @@ int JoyControlStick::getButtonsPresetSpringHeight() { JoyControlStickButton *button = iter.next().value(); int temp = button->getSpringHeight(); + if (temp != presetSpringHeight) { presetSpringHeight = 0; @@ -2430,6 +2403,7 @@ void JoyControlStick::setButtonsSensitivity(double value) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(buttons); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); @@ -2445,6 +2419,7 @@ double JoyControlStick::getButtonsPresetSensitivity() QHash temphash = getApplicableButtons(); QHashIterator iter(temphash); + while (iter.hasNext()) { if (!iter.hasPrevious()) @@ -2456,7 +2431,8 @@ double JoyControlStick::getButtonsPresetSensitivity() { JoyControlStickButton *button = iter.next().value(); double temp = button->getSensitivity(); - if (qFuzzyCompare(temp, presetSensitivity)) + + if (!qFuzzyCompare(temp, presetSensitivity)) { presetSensitivity = 1.0; iter.toBack(); @@ -2501,7 +2477,7 @@ void JoyControlStick::setStickName(QString tempName) { stickName = tempName; emit stickNameChanged(); - emit propertyUpdated(); + // emit propertyUpdated(); } } @@ -2517,10 +2493,11 @@ void JoyControlStick::setButtonsWheelSpeedX(int value) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(buttons); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); - button->setWheelSpeedX(value); + button->setWheelSpeed(value, 'X'); } } @@ -2529,10 +2506,11 @@ void JoyControlStick::setButtonsWheelSpeedY(int value) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(buttons); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); - button->setWheelSpeedY(value); + button->setWheelSpeed(value, 'Y'); } } @@ -2545,14 +2523,10 @@ SetJoystick* JoyControlStick::getParentSet() qInstallMessageHandler(MessageHandler::myMessageOutput); SetJoystick *temp = nullptr; - if (axisX != nullptr) - { - temp = axisX->getParentSet(); - } - else if (axisY != nullptr) - { - temp = axisY->getParentSet(); - } + + if (axisX != nullptr) temp = axisX->getParentSet(); + else if (axisY != nullptr) temp = axisY->getParentSet(); + return temp; } @@ -2819,15 +2793,15 @@ JoyControlStick::determineStandardModeDirection(int axisXValue, int axisYValue) double bearing = calculateBearing(axisXValue, axisYValue); QList anglesList = getDiagonalZoneAngles(); - int initialLeft = static_cast(anglesList.value(0)); - int initialRight = static_cast(anglesList.value(1)); - int upRightInitial = static_cast(anglesList.value(2)); - int rightInitial = static_cast(anglesList.value(3)); - int downRightInitial = static_cast(anglesList.value(4)); - int downInitial = static_cast(anglesList.value(5)); - int downLeftInitial = static_cast(anglesList.value(6)); - int leftInitial = static_cast(anglesList.value(7)); - int upLeftInitial = static_cast(anglesList.value(8)); + int initialLeft = anglesList.value(0); + int initialRight = anglesList.value(1); + int upRightInitial = anglesList.value(2); + int rightInitial = anglesList.value(3); + int downRightInitial = anglesList.value(4); + int downInitial = anglesList.value(5); + int downLeftInitial = anglesList.value(6); + int leftInitial = anglesList.value(7); + int upLeftInitial = anglesList.value(8); if ((bearing <= initialRight) || (bearing >= initialLeft)) { @@ -2955,9 +2929,7 @@ JoyControlStick::determineFourWayDiagonalDirection(int axisXValue, int axisYValu qInstallMessageHandler(MessageHandler::myMessageOutput); JoyStickDirections result = StickCentered; - double bearing = calculateBearing(axisXValue, axisYValue); - QList anglesList = getFourWayDiagonalZoneAngles(); int upRightInitial = anglesList.value(0); int downRightInitial = anglesList.value(1); @@ -3005,21 +2977,28 @@ JoyControlStick::calculateStickDirection(int axisXValue, int axisYValue) JoyStickDirections result = StickCentered; - if (currentMode == StandardMode) - { - result = determineStandardModeDirection(axisXValue, axisYValue); - } - else if (currentMode == EightWayMode) - { - result = determineEightWayModeDirection(axisXValue, axisYValue); - } - else if (currentMode == FourWayCardinal) - { - result = determineFourWayCardinalDirection(axisXValue, axisYValue); - } - else if (currentMode == FourWayDiagonal) + switch(currentMode) { - result = determineFourWayDiagonalDirection(axisXValue, axisYValue); + case StandardMode: + { + result = determineStandardModeDirection(axisXValue, axisYValue); + break; + } + case EightWayMode: + { + result = determineEightWayModeDirection(axisXValue, axisYValue); + break; + } + case FourWayCardinal: + { + result = determineFourWayCardinalDirection(axisXValue, axisYValue); + break; + } + case FourWayDiagonal: + { + result = determineFourWayDiagonalDirection(axisXValue, axisYValue); + break; + } } return result; @@ -3048,11 +3027,12 @@ bool JoyControlStick::hasSlotsAssigned() qInstallMessageHandler(MessageHandler::myMessageOutput); bool hasSlots = false; - QHashIterator iter(buttons); + while (iter.hasNext()) { JoyButton *button = iter.next().value(); + if (button != nullptr) { if (button->getAssignedSlots()->count() > 0) @@ -3071,6 +3051,7 @@ void JoyControlStick::setButtonsSpringRelativeStatus(bool value) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(buttons); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); @@ -3086,6 +3067,7 @@ bool JoyControlStick::isRelativeSpring() QHash temphash = getApplicableButtons(); QHashIterator iter(temphash); + while (iter.hasNext()) { if (!iter.hasPrevious()) @@ -3097,6 +3079,7 @@ bool JoyControlStick::isRelativeSpring() { JoyControlStickButton *button = iter.next().value(); bool temp = button->isRelativeSpring(); + if (temp != relative) { relative = false; @@ -3129,16 +3112,17 @@ void JoyControlStick::copyAssignments(JoyControlStick *destStick) destStick->stickDelay = stickDelay; QHashIterator iter(destStick->buttons); + while (iter.hasNext()) { JoyControlStickButton *destButton = iter.next().value(); + if (destButton != nullptr) { JoyControlStickButton *sourceButton = buttons.value(destButton->getDirection()); + if (sourceButton != nullptr) - { sourceButton->copyAssignments(destButton); - } } } @@ -3149,9 +3133,7 @@ void JoyControlStick::copyAssignments(JoyControlStick *destStick) } if (!destStick->isDefault()) - { emit propertyUpdated(); - } } /** @@ -3218,6 +3200,7 @@ void JoyControlStick::setButtonsEasingDuration(double value) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(buttons); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); @@ -3229,10 +3212,10 @@ double JoyControlStick::getButtonsEasingDuration() { qInstallMessageHandler(MessageHandler::myMessageOutput); - double result = JoyButton::DEFAULTEASINGDURATION; - + double result = GlobalVariables::JoyButton::DEFAULTEASINGDURATION; QHash temphash = getApplicableButtons(); QHashIterator iter(temphash); + while (iter.hasNext()) { if (!iter.hasPrevious()) @@ -3244,9 +3227,10 @@ double JoyControlStick::getButtonsEasingDuration() { JoyControlStickButton *button = iter.next().value(); double temp = button->getEasingDuration(); - if (qFuzzyCompare(temp, result)) + + if (!qFuzzyCompare(temp, result)) { - result = JoyButton::DEFAULTEASINGDURATION; + result = GlobalVariables::JoyButton::DEFAULTEASINGDURATION; iter.toBack(); } } @@ -3303,13 +3287,13 @@ void JoyControlStick::setButtonsExtraAccelerationStatus(bool enabled) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getApplicableButtons()); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); + if (button != nullptr) - { button->setExtraAccelerationStatus(enabled); - } } } @@ -3323,9 +3307,11 @@ bool JoyControlStick::getButtonsExtraAccelerationStatus() while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); + if (button != nullptr) { bool temp = button->isExtraAccelerationEnabled(); + if (!temp) { result = false; @@ -3349,10 +3335,9 @@ void JoyControlStick::setButtonsExtraAccelerationMultiplier(double value) while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); + if (button != nullptr) - { button->setExtraAccelerationMultiplier(value); - } } } @@ -3360,28 +3345,30 @@ double JoyControlStick::getButtonsExtraAccelerationMultiplier() { qInstallMessageHandler(MessageHandler::myMessageOutput); - double result = JoyButton::DEFAULTEXTRACCELVALUE; + double result = GlobalVariables::JoyButton::DEFAULTEXTRACCELVALUE; QHashIterator iter(getApplicableButtons()); + while (iter.hasNext()) { if (!iter.hasPrevious()) { JoyControlStickButton *button = iter.next().value(); + if (button != nullptr) - { result = button->getExtraAccelerationMultiplier(); - } } else { JoyControlStickButton *button = iter.next().value(); + if (button != nullptr) { double temp = button->getExtraAccelerationMultiplier(); - if (qFuzzyCompare(temp, result)) + + if (!qFuzzyCompare(temp, result)) { - result = JoyButton::DEFAULTEXTRACCELVALUE; + result = GlobalVariables::JoyButton::DEFAULTEXTRACCELVALUE; iter.toBack(); } } @@ -3397,13 +3384,13 @@ void JoyControlStick::setButtonsStartAccelerationMultiplier(double value) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getApplicableButtons()); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); + if (button != nullptr) - { button->setStartAccelMultiplier(value); - } } } @@ -3411,28 +3398,29 @@ double JoyControlStick::getButtonsStartAccelerationMultiplier() { qInstallMessageHandler(MessageHandler::myMessageOutput); - double result = JoyButton::DEFAULTSTARTACCELMULTIPLIER; - + double result = GlobalVariables::JoyButton::DEFAULTSTARTACCELMULTIPLIER; QHashIterator iter(getApplicableButtons()); + while (iter.hasNext()) { if (!iter.hasPrevious()) { JoyControlStickButton *button = iter.next().value(); + if (button != nullptr) - { result = button->getStartAccelMultiplier(); - } } else { JoyControlStickButton *button = iter.next().value(); + if (button != nullptr) { double temp = button->getStartAccelMultiplier(); - if (qFuzzyCompare(temp, result)) + + if (!qFuzzyCompare(temp, result)) { - result = JoyButton::DEFAULTSTARTACCELMULTIPLIER; + result = GlobalVariables::JoyButton::DEFAULTSTARTACCELMULTIPLIER; iter.toBack(); } } @@ -3447,13 +3435,13 @@ void JoyControlStick::setButtonsMinAccelerationThreshold(double value) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getApplicableButtons()); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); + if (button != nullptr) - { button->setMinAccelThreshold(value); - } } } @@ -3461,28 +3449,30 @@ double JoyControlStick::getButtonsMinAccelerationThreshold() { qInstallMessageHandler(MessageHandler::myMessageOutput); - double result = JoyButton::DEFAULTMINACCELTHRESHOLD; + double result = GlobalVariables::JoyButton::DEFAULTMINACCELTHRESHOLD; QHashIterator iter(getApplicableButtons()); + while (iter.hasNext()) { if (!iter.hasPrevious()) { JoyControlStickButton *button = iter.next().value(); + if (button != nullptr) - { result = button->getMinAccelThreshold(); - } } else { JoyControlStickButton *button = iter.next().value(); + if (button != nullptr) { double temp = button->getMinAccelThreshold(); - if (qFuzzyCompare(temp, result)) + + if (!qFuzzyCompare(temp, result)) { - result = JoyButton::DEFAULTMINACCELTHRESHOLD; + result = GlobalVariables::JoyButton::DEFAULTMINACCELTHRESHOLD; iter.toBack(); } } @@ -3497,13 +3487,13 @@ void JoyControlStick::setButtonsMaxAccelerationThreshold(double value) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getApplicableButtons()); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); + if (button != nullptr) - { button->setMaxAccelThreshold(value); - } } } @@ -3511,7 +3501,7 @@ double JoyControlStick::getButtonsMaxAccelerationThreshold() { qInstallMessageHandler(MessageHandler::myMessageOutput); - double result = JoyButton::DEFAULTMAXACCELTHRESHOLD; + double result = GlobalVariables::JoyButton::DEFAULTMAXACCELTHRESHOLD; QHashIterator iter(getApplicableButtons()); while (iter.hasNext()) @@ -3519,20 +3509,21 @@ double JoyControlStick::getButtonsMaxAccelerationThreshold() if (!iter.hasPrevious()) { JoyControlStickButton *button = iter.next().value(); + if (button != nullptr) - { result = button->getMaxAccelThreshold(); - } } else { JoyControlStickButton *button = iter.next().value(); + if (button != nullptr) { double temp = button->getMaxAccelThreshold(); - if (qFuzzyCompare(temp, result)) + + if (!qFuzzyCompare(temp, result)) { - result = JoyButton::DEFAULTMAXACCELTHRESHOLD; + result = GlobalVariables::JoyButton::DEFAULTMAXACCELTHRESHOLD; iter.toBack(); } } @@ -3548,13 +3539,13 @@ void JoyControlStick::setButtonsAccelerationExtraDuration(double value) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getApplicableButtons()); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); + if (button != nullptr) - { button->setAccelExtraDuration(value); - } } } @@ -3562,7 +3553,7 @@ double JoyControlStick::getButtonsAccelerationEasingDuration() { qInstallMessageHandler(MessageHandler::myMessageOutput); - double result = JoyButton::DEFAULTACCELEASINGDURATION; + double result = GlobalVariables::JoyButton::DEFAULTACCELEASINGDURATION; QHashIterator iter(getApplicableButtons()); while (iter.hasNext()) @@ -3570,10 +3561,9 @@ double JoyControlStick::getButtonsAccelerationEasingDuration() if (!iter.hasPrevious()) { JoyControlStickButton *button = iter.next().value(); + if (button != nullptr) - { result = button->getAccelExtraDuration(); - } } else { @@ -3581,9 +3571,9 @@ double JoyControlStick::getButtonsAccelerationEasingDuration() if (button != nullptr) { double temp = button->getAccelExtraDuration(); - if (qFuzzyCompare(temp, result)) + if (!qFuzzyCompare(temp, result)) { - result = JoyButton::DEFAULTACCELEASINGDURATION; + result = GlobalVariables::JoyButton::DEFAULTACCELEASINGDURATION; iter.toBack(); } } @@ -3612,7 +3602,7 @@ int JoyControlStick::getButtonsSpringDeadCircleMultiplier() { qInstallMessageHandler(MessageHandler::myMessageOutput); - int result = JoyButton::DEFAULTSPRINGRELEASERADIUS; + int result = GlobalVariables::JoyButton::DEFAULTSPRINGRELEASERADIUS; QHashIterator iter(getApplicableButtons()); while (iter.hasNext()) @@ -3633,7 +3623,7 @@ int JoyControlStick::getButtonsSpringDeadCircleMultiplier() int temp = button->getSpringDeadCircleMultiplier(); if (temp != result) { - result = JoyButton::DEFAULTSPRINGRELEASERADIUS; + result = GlobalVariables::JoyButton::DEFAULTSPRINGRELEASERADIUS; iter.toBack(); } } @@ -3649,32 +3639,9 @@ double JoyControlStick::calculateAccelerationDistance(JoyControlStickButton *but double finalDistance = 0.0; - if (currentDirection == StickUp) - { - if (axisY->getCurrentRawValue() >= 0) - { - finalDistance = 0.0; - } - else - { - finalDistance = calculateYAxisDistance(axisY->getCurrentRawValue()); - } - } - else if (currentDirection == StickRightUp) + switch(currentDirection) { - if (button->getJoyNumber() == static_cast(StickRight)) - { - if (axisX->getCurrentRawValue() < 0) - { - finalDistance = 0.0; - } - else - { - finalDistance = calculateXAxisDistance(axisX->getCurrentRawValue()); - } - - } - else if (button->getJoyNumber() == static_cast(StickUp)) + case StickUp: { if (axisY->getCurrentRawValue() >= 0) { @@ -3684,33 +3651,56 @@ double JoyControlStick::calculateAccelerationDistance(JoyControlStickButton *but { finalDistance = calculateYAxisDistance(axisY->getCurrentRawValue()); } + + break; } - else if (button->getJoyNumber() == static_cast(StickRightUp)) + case StickRightUp: { - if ((axisX->getCurrentRawValue() <= 0) || (axisY->getCurrentRawValue() >= 0)) - { - finalDistance = 0.0; - } - else + switch(button->getJoyNumber()) { - finalDistance = calculateEightWayDiagonalDistance(axisX->getCurrentRawValue(), axisY->getCurrentRawValue()); + case 1: + + if (axisY->getCurrentRawValue() >= 0) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateYAxisDistance(axisY->getCurrentRawValue()); + } + + break; + + case 2: + + if ((axisX->getCurrentRawValue() <= 0) || (axisY->getCurrentRawValue() >= 0)) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateEightWayDiagonalDistance(axisX->getCurrentRawValue(), axisY->getCurrentRawValue()); + } + + break; + + case 3: + + if (axisX->getCurrentRawValue() < 0) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateXAxisDistance(axisX->getCurrentRawValue()); + } + + break; } + + break; } - } - else if (currentDirection == StickRight) - { - if (axisX->getCurrentRawValue() < 0) - { - finalDistance = 0.0; - } - else - { - finalDistance = calculateXAxisDistance(axisX->getCurrentRawValue()); - } - } - else if (currentDirection == StickRightDown) - { - if (button->getJoyNumber() == static_cast(StickRight)) + case StickRight: { if (axisX->getCurrentRawValue() < 0) { @@ -3720,57 +3710,61 @@ double JoyControlStick::calculateAccelerationDistance(JoyControlStickButton *but { finalDistance = calculateXAxisDistance(axisX->getCurrentRawValue()); } + + break; } - else if (button->getJoyNumber() == static_cast(StickDown)) - { - if (axisY->getCurrentRawValue() < 0) - { - finalDistance = 0.0; - } - else - { - finalDistance = calculateYAxisDistance(axisY->getCurrentRawValue()); - } - } - else if (button->getJoyNumber() == static_cast(StickRightDown)) - { - if ((axisX->getCurrentRawValue() <= 0) || (axisY->getCurrentRawValue() <= 0)) - { - finalDistance = 0.0; - } - else - { - finalDistance = calculateEightWayDiagonalDistance(axisX->getCurrentRawValue(), axisY->getCurrentRawValue()); - } - } - } - else if (currentDirection == StickDown) - { - if (axisY->getCurrentRawValue() <= 0) - { - finalDistance = 0.0; - } - else + case StickRightDown: { - finalDistance = calculateYAxisDistance(axisY->getCurrentRawValue()); - } - } - else if (currentDirection == StickLeftDown) - { - if (button->getJoyNumber() == static_cast(StickLeft)) - { - if (axisX->getCurrentRawValue() >= 0) - { - finalDistance = 0.0; - } - else + + switch(button->getJoyNumber()) { - finalDistance = calculateXAxisDistance(axisX->getCurrentRawValue()); + + case 3: + + if (axisX->getCurrentRawValue() < 0) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateXAxisDistance(axisX->getCurrentRawValue()); + } + + break; + + case 4: + + if ((axisX->getCurrentRawValue() <= 0) || (axisY->getCurrentRawValue() <= 0)) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateEightWayDiagonalDistance(axisX->getCurrentRawValue(), axisY->getCurrentRawValue()); + } + + break; + + case 5: + + if (axisY->getCurrentRawValue() < 0) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateYAxisDistance(axisY->getCurrentRawValue()); + } + + break; + } + + break; } - else if (button->getJoyNumber() == static_cast(StickDown)) + case StickDown: { - if (axisY->getCurrentRawValue() < 0) + if (axisY->getCurrentRawValue() <= 0) { finalDistance = 0.0; } @@ -3778,33 +3772,58 @@ double JoyControlStick::calculateAccelerationDistance(JoyControlStickButton *but { finalDistance = calculateYAxisDistance(axisY->getCurrentRawValue()); } + + break; } - else if (button->getJoyNumber() == static_cast(StickLeftDown)) + case StickLeftDown: { - if ((axisX->getCurrentRawValue() >= 0) || (axisY->getCurrentRawValue() <= 0)) + switch(button->getJoyNumber()) { - finalDistance = 0.0; - } - else - { - finalDistance = calculateEightWayDiagonalDistance(axisX->getCurrentRawValue(), axisY->getCurrentRawValue()); + + case 5: + + if (axisY->getCurrentRawValue() < 0) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateYAxisDistance(axisY->getCurrentRawValue()); + } + + break; + + case 6: + + if ((axisX->getCurrentRawValue() >= 0) || (axisY->getCurrentRawValue() <= 0)) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateEightWayDiagonalDistance(axisX->getCurrentRawValue(), axisY->getCurrentRawValue()); + } + + break; + + case 7: + + if (axisX->getCurrentRawValue() >= 0) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateXAxisDistance(axisX->getCurrentRawValue()); + } + + break; + } + + break; } - } - else if (currentDirection == StickLeft) - { - if (axisX->getCurrentRawValue() >= 0) - { - finalDistance = 0.0; - } - else - { - finalDistance = calculateXAxisDistance(axisX->getCurrentRawValue()); - } - } - else if (currentDirection == StickLeftUp) - { - if (button->getJoyNumber() == static_cast(StickLeft)) + case StickLeft: { if (axisX->getCurrentRawValue() >= 0) { @@ -3814,31 +3833,62 @@ double JoyControlStick::calculateAccelerationDistance(JoyControlStickButton *but { finalDistance = calculateXAxisDistance(axisX->getCurrentRawValue()); } + + break; } - else if (button->getJoyNumber() == static_cast(StickUp)) - { - if (axisY->getCurrentRawValue() >= 0) - { - finalDistance = 0.0; - } - else - { - finalDistance = calculateYAxisDistance(axisY->getCurrentRawValue()); - } - } - else if (button->getJoyNumber() == static_cast(StickLeftUp)) + case StickLeftUp: { - if ((axisX->getCurrentRawValue() >= 0) || (axisY->getCurrentRawValue() >= 0)) - { - finalDistance = 0.0; - } - else + + switch(button->getJoyNumber()) { - finalDistance = calculateEightWayDiagonalDistance(axisX->getCurrentRawValue(), axisY->getCurrentRawValue()); + + case 1: + + if (axisY->getCurrentRawValue() >= 0) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateYAxisDistance(axisY->getCurrentRawValue()); + } + + break; + + case 7: + + if (axisX->getCurrentRawValue() >= 0) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateXAxisDistance(axisX->getCurrentRawValue()); + } + + break; + + case 8: + + if ((axisX->getCurrentRawValue() >= 0) || (axisY->getCurrentRawValue() >= 0)) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateEightWayDiagonalDistance(axisX->getCurrentRawValue(), axisY->getCurrentRawValue()); + } + + break; + } + + break; } } + + return finalDistance; } @@ -3849,32 +3899,9 @@ double JoyControlStick::calculateLastAccelerationButtonDistance(JoyControlStickB double finalDistance = 0.0; - if (currentDirection == StickUp) - { - if (axisY->getLastKnownRawValue() >= 0) - { - finalDistance = 0.0; - } - else - { - finalDistance = calculateYAxisDistance(axisY->getLastKnownRawValue()); - } - } - else if (currentDirection == StickRightUp) + switch(currentDirection) { - if (button->getJoyNumber() == static_cast(StickRight)) - { - if (axisX->getLastKnownRawValue() <= 0) - { - finalDistance = 0.0; - } - else - { - finalDistance = calculateXAxisDistance(axisX->getLastKnownRawValue()); - } - - } - else if (button->getJoyNumber() == static_cast(StickUp)) + case StickUp: { if (axisY->getLastKnownRawValue() >= 0) { @@ -3884,33 +3911,57 @@ double JoyControlStick::calculateLastAccelerationButtonDistance(JoyControlStickB { finalDistance = calculateYAxisDistance(axisY->getLastKnownRawValue()); } + + break; } - else if (button->getJoyNumber() == static_cast(StickRightUp)) + case StickRightUp: { - if ((axisX->getLastKnownRawValue() <= 0) || (axisY->getLastKnownRawValue() >= 0)) + switch(button->getJoyNumber()) { - finalDistance = 0.0; - } - else - { - finalDistance = calculateEightWayDiagonalDistance(axisX->getLastKnownRawValue(), axisY->getLastKnownRawValue()); + case StickRight: + { + if (axisX->getLastKnownRawValue() <= 0) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateXAxisDistance(axisX->getLastKnownRawValue()); + } + + break; + } + case StickUp: + { + if (axisY->getLastKnownRawValue() >= 0) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateYAxisDistance(axisY->getLastKnownRawValue()); + } + + break; + } + case StickRightUp: + { + if ((axisX->getLastKnownRawValue() <= 0) || (axisY->getLastKnownRawValue() >= 0)) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateEightWayDiagonalDistance(axisX->getLastKnownRawValue(), axisY->getLastKnownRawValue()); + } + + break; + } } + + break; } - } - else if (currentDirection == static_cast(StickRight)) - { - if (axisX->getLastKnownRawValue() <= 0) - { - finalDistance = 0.0; - } - else - { - finalDistance = calculateXAxisDistance(axisX->getLastKnownRawValue()); - } - } - else if (currentDirection == StickRightDown) - { - if (button->getJoyNumber() == static_cast(StickRight)) + case StickRight: { if (axisX->getLastKnownRawValue() <= 0) { @@ -3920,55 +3971,59 @@ double JoyControlStick::calculateLastAccelerationButtonDistance(JoyControlStickB { finalDistance = calculateXAxisDistance(axisX->getLastKnownRawValue()); } + + break; } - else if (button->getJoyNumber() == static_cast(StickDown)) - { - if (axisY->getLastKnownRawValue() <= 0) - { - finalDistance = 0.0; - } - else - { - finalDistance = calculateYAxisDistance(axisY->getLastKnownRawValue()); - } - } - else if (button->getJoyNumber() == static_cast(StickRightDown)) - { - if ((axisX->getLastKnownRawValue() <= 0) || (axisY->getLastKnownRawValue() <= 0)) - { - finalDistance = 0.0; - } - else - { - finalDistance = calculateEightWayDiagonalDistance(axisX->getLastKnownRawValue(), axisY->getLastKnownRawValue()); - } - } - } - else if (currentDirection == StickDown) - { - if (axisY->getLastKnownRawValue() <= 0) - { - finalDistance = 0.0; - } - else - { - finalDistance = calculateYAxisDistance(axisY->getLastKnownRawValue()); - } - } - else if (currentDirection == StickLeftDown) - { - if (button->getJoyNumber() == static_cast(StickLeft)) + case StickRightDown: { - if (axisX->getLastKnownRawValue() >= 0) + switch(button->getJoyNumber()) { - finalDistance = 0.0; - } - else - { - finalDistance = calculateXAxisDistance(axisX->getLastKnownRawValue()); + + case StickRight: + { + if (axisX->getLastKnownRawValue() <= 0) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateXAxisDistance(axisX->getLastKnownRawValue()); + } + + break; + } + case StickDown: + { + if (axisY->getLastKnownRawValue() <= 0) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateYAxisDistance(axisY->getLastKnownRawValue()); + } + + break; + } + case StickRightDown: + { + if ((axisX->getLastKnownRawValue() <= 0) || (axisY->getLastKnownRawValue() <= 0)) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateEightWayDiagonalDistance(axisX->getLastKnownRawValue(), axisY->getLastKnownRawValue()); + } + + break; + } + } + + break; } - else if (button->getJoyNumber() == static_cast(StickDown)) + case StickDown: { if (axisY->getLastKnownRawValue() <= 0) { @@ -3978,33 +4033,59 @@ double JoyControlStick::calculateLastAccelerationButtonDistance(JoyControlStickB { finalDistance = calculateYAxisDistance(axisY->getLastKnownRawValue()); } + + break; } - else if (button->getJoyNumber() == static_cast(StickLeftDown)) + case StickLeftDown: { - if ((axisX->getLastKnownRawValue() >= 0) || (axisY->getLastKnownRawValue() <= 0)) - { - finalDistance = 0.0; - } - else + switch(button->getJoyNumber()) { - finalDistance = calculateEightWayDiagonalDistance(axisX->getLastKnownRawValue(), axisY->getLastKnownRawValue()); + + case 7: + { + if (axisX->getLastKnownRawValue() >= 0) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateXAxisDistance(axisX->getLastKnownRawValue()); + } + + break; + } + case 5: + { + if (axisY->getLastKnownRawValue() <= 0) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateYAxisDistance(axisY->getLastKnownRawValue()); + } + + break; + } + case 6: + { + if ((axisX->getLastKnownRawValue() >= 0) || (axisY->getLastKnownRawValue() <= 0)) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateEightWayDiagonalDistance(axisX->getLastKnownRawValue(), axisY->getLastKnownRawValue()); + } + + break; + } + } + + break; } - } - else if (currentDirection == StickLeft) - { - if (axisX->getLastKnownRawValue() >= 0) - { - finalDistance = 0.0; - } - else - { - finalDistance = calculateXAxisDistance(axisX->getLastKnownRawValue()); - } - } - else if (currentDirection == StickLeftUp) - { - if (button->getJoyNumber() == static_cast(StickLeft)) + case StickLeft: { if (axisX->getLastKnownRawValue() >= 0) { @@ -4014,28 +4095,57 @@ double JoyControlStick::calculateLastAccelerationButtonDistance(JoyControlStickB { finalDistance = calculateXAxisDistance(axisX->getLastKnownRawValue()); } + + break; } - else if (button->getJoyNumber() == static_cast(StickUp)) - { - if (axisY->getLastKnownRawValue() >= 0) - { - finalDistance = 0.0; - } - else - { - finalDistance = calculateYAxisDistance(axisY->getLastKnownRawValue()); - } - } - else if (button->getJoyNumber() == static_cast(StickLeftUp)) + case StickLeftUp: { - if ((axisX->getLastKnownRawValue() >= 0) || (axisY->getLastKnownRawValue() >= 0)) + switch(button->getJoyNumber()) { - finalDistance = 0.0; - } - else - { - finalDistance = calculateEightWayDiagonalDistance(axisX->getLastKnownRawValue(), axisY->getLastKnownRawValue()); + + case 7: + { + if (axisX->getLastKnownRawValue() >= 0) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateXAxisDistance(axisX->getLastKnownRawValue()); + } + + break; + } + case 1: + { + if (axisY->getLastKnownRawValue() >= 0) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateYAxisDistance(axisY->getLastKnownRawValue()); + } + + break; + } + case 8: + { + if ((axisX->getLastKnownRawValue() >= 0) || (axisY->getLastKnownRawValue() >= 0)) + { + finalDistance = 0.0; + } + else + { + finalDistance = calculateEightWayDiagonalDistance(axisX->getLastKnownRawValue(), axisY->getLastKnownRawValue()); + } + + break; + } + } + + break; } } @@ -4046,21 +4156,14 @@ double JoyControlStick::calculateXAxisDistance(int axisXValue) { qInstallMessageHandler(MessageHandler::myMessageOutput); - double distance = 0.0; int axis1Value = axisXValue; + double distance = axis1Value / static_cast(maxZone); - distance = axis1Value / static_cast(maxZone); - if (distance < -1.0) - { - distance = -1.0; - } - else if (distance > 1.0) - { - distance = 1.0; - } + if (distance < -1.0) distance = -1.0; + else if (distance > 1.0) distance = 1.0; #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "DISTANCE: " << distance; + qDebug() << "DISTANCE: " << distance; #endif return distance; @@ -4070,18 +4173,11 @@ double JoyControlStick::calculateYAxisDistance(int axisYValue) { qInstallMessageHandler(MessageHandler::myMessageOutput); - double distance = 0.0; int axis2Value = axisYValue; + double distance = axis2Value / static_cast(maxZone); - distance = axis2Value / static_cast(maxZone); - if (distance < -1.0) - { - distance = -1.0; - } - else if (distance > 1.0) - { - distance = 1.0; - } + if (distance < -1.0) distance = -1.0; + else if (distance > 1.0) distance = 1.0; return distance; } @@ -4090,9 +4186,8 @@ double JoyControlStick::calculateEightWayDiagonalDistanceFromDeadZone() { qInstallMessageHandler(MessageHandler::myMessageOutput); - double temp = calculateEightWayDiagonalDistanceFromDeadZone(axisX->getCurrentRawValue(), + return calculateEightWayDiagonalDistanceFromDeadZone(axisX->getCurrentRawValue(), axisY->getCurrentRawValue()); - return temp; } double JoyControlStick::calculateEightWayDiagonalDistanceFromDeadZone(int axisXValue, int axisYValue) @@ -4100,16 +4195,13 @@ double JoyControlStick::calculateEightWayDiagonalDistanceFromDeadZone(int axisXV qInstallMessageHandler(MessageHandler::myMessageOutput); double distance = 0.0; - double radius = getDistanceFromDeadZone(axisXValue, axisYValue); double bearing = calculateBearing(axisXValue, axisYValue); int relativeBearing = static_cast(bearing) % 90; - int diagonalAngle = relativeBearing; + if (relativeBearing > 45) - { diagonalAngle = 90 - relativeBearing; - } distance = radius * (diagonalAngle / 45.0); @@ -4121,16 +4213,13 @@ double JoyControlStick::calculateEightWayDiagonalDistance(int axisXValue, int ax qInstallMessageHandler(MessageHandler::myMessageOutput); double distance = 0.0; - double radius = getRadialDistance(axisXValue, axisYValue); double bearing = calculateBearing(axisXValue, axisYValue); int relativeBearing = static_cast(bearing) % 90; - int diagonalAngle = relativeBearing; + if (relativeBearing > 45) - { diagonalAngle = 90 - relativeBearing; - } distance = radius * (diagonalAngle / 45.0); @@ -4151,7 +4240,7 @@ double JoyControlStick::calculateXDiagonalDeadZone(int axisXValue, int axisYValu QList tempangles = getDiagonalZoneAngles(); double maxangle = tempangles.at(3); - double mindeadX = fabs(deadZone * cos(maxangle * PI / 180.0)); + double mindeadX = fabs(deadZone * cos(maxangle * GlobalVariables::JoyControlStick::PI / 180.0)); diagonalDeadZone = mindeadX; } else if ((direction == StickRightDown) || (direction == StickDown)) @@ -4159,7 +4248,7 @@ double JoyControlStick::calculateXDiagonalDeadZone(int axisXValue, int axisYValu QList tempangles = getDiagonalZoneAngles(); double maxangle = tempangles.at(5); - double mindeadX = fabs(deadZone * cos((maxangle - 90.0) * PI / 180.0)); + double mindeadX = fabs(deadZone * cos((maxangle - 90.0) * GlobalVariables::JoyControlStick::PI / 180.0)); diagonalDeadZone = mindeadX; } else if ((direction == StickLeftDown) || (direction == StickLeft)) @@ -4167,7 +4256,7 @@ double JoyControlStick::calculateXDiagonalDeadZone(int axisXValue, int axisYValu QList tempangles = getDiagonalZoneAngles(); double maxangle = tempangles.at(7); - double mindeadX = fabs(deadZone * cos((maxangle - 180.0) * PI / 180.0)); + double mindeadX = fabs(deadZone * cos((maxangle - 180.0) * GlobalVariables::JoyControlStick::PI / 180.0)); diagonalDeadZone = mindeadX; } else if ((direction == StickLeftUp) || (direction == StickUp)) @@ -4175,7 +4264,7 @@ double JoyControlStick::calculateXDiagonalDeadZone(int axisXValue, int axisYValu QList tempangles = getDiagonalZoneAngles(); double maxangle = tempangles.at(1); - double mindeadX = fabs(deadZone * cos((maxangle - 270.0) * PI / 180.0)); + double mindeadX = fabs(deadZone * cos((maxangle - 270.0) * GlobalVariables::JoyControlStick::PI / 180.0)); diagonalDeadZone = mindeadX; } else @@ -4205,7 +4294,7 @@ double JoyControlStick::calculateYDiagonalDeadZone(int axisXValue, int axisYValu QList tempangles = getDiagonalZoneAngles(); double minangle = tempangles.at(1); - double mindeadY = fabs(deadZone * sin(minangle * PI / 180.0)); + double mindeadY = fabs(deadZone * sin(minangle * GlobalVariables::JoyControlStick::PI / 180.0)); diagonalDeadZone = mindeadY; } else if ((direction == StickRightDown) || (direction == StickRight)) @@ -4213,7 +4302,7 @@ double JoyControlStick::calculateYDiagonalDeadZone(int axisXValue, int axisYValu QList tempfuck = getDiagonalZoneAngles(); double minangle = tempfuck.at(4); - double mindeadY = fabs(deadZone * sin((minangle - 90.0) * PI / 180.0)); + double mindeadY = fabs(deadZone * sin((minangle - 90.0) * GlobalVariables::JoyControlStick::PI / 180.0)); diagonalDeadZone = mindeadY; } else if ((direction == StickLeftDown) || (direction == StickDown)) @@ -4221,7 +4310,7 @@ double JoyControlStick::calculateYDiagonalDeadZone(int axisXValue, int axisYValu QList tempangles = getDiagonalZoneAngles(); double minangle = tempangles.at(6); - double mindeadY = fabs(deadZone * sin((minangle - 180.0) * PI / 180.0)); + double mindeadY = fabs(deadZone * sin((minangle - 180.0) * GlobalVariables::JoyControlStick::PI / 180.0)); diagonalDeadZone = mindeadY; } else if ((direction == StickLeftUp) || (direction == StickLeft)) @@ -4229,7 +4318,7 @@ double JoyControlStick::calculateYDiagonalDeadZone(int axisXValue, int axisYValu QList tempangles = getDiagonalZoneAngles(); double minangle = tempangles.at(8); - double mindeadY = fabs(deadZone * sin((minangle - 270.0) * PI / 180.0)); + double mindeadY = fabs(deadZone * sin((minangle - 270.0) * GlobalVariables::JoyControlStick::PI / 180.0)); diagonalDeadZone = mindeadY; } else @@ -4250,7 +4339,6 @@ double JoyControlStick::getSpringDeadCircleX() qInstallMessageHandler(MessageHandler::myMessageOutput); double result = 0.0; - double angle2 = 0.0; int axis1Value = 0; int axis2Value = 0; @@ -4274,10 +4362,10 @@ double JoyControlStick::getSpringDeadCircleX() double ang_sin = sin(angle2); double ang_cos = cos(angle2); - int deadX = abs(static_cast(floor(deadZone * ang_sin + 0.5))); + int deadX = abs(floor(deadZone * ang_sin + 0.5)); double diagonalDeadX = calculateXDiagonalDeadZone(axis1Value, axis2Value); - double squareStickFullPhi = qMin(static_cast(ang_sin) ? 1/fabs(ang_sin) : 2, static_cast(ang_cos) ? 1/fabs(ang_cos) : 2); + double squareStickFullPhi = qMin(ang_sin != 0.0 ? 1/fabs(ang_sin) : 2, ang_cos != 0.0 ? 1/fabs(ang_cos) : 2); double circle = this->circle; double circleStickFull = (squareStickFullPhi - 1) * circle + 1; @@ -4286,9 +4374,7 @@ double JoyControlStick::getSpringDeadCircleX() double maxRange = static_cast(deadZone) - diagonalDeadX; if (maxRange != 0.0) - { result = finalDeadZoneX / maxRange; - } return result; } @@ -4298,7 +4384,6 @@ double JoyControlStick::getSpringDeadCircleY() qInstallMessageHandler(MessageHandler::myMessageOutput); double result = 0.0; - double angle2 = 0.0; int axis1Value = 0; int axis2Value = 0; @@ -4322,10 +4407,10 @@ double JoyControlStick::getSpringDeadCircleY() double ang_sin = sin(angle2); double ang_cos = cos(angle2); - int deadY = abs(static_cast(floor(deadZone * ang_cos + 0.5))); + int deadY = abs(floor(deadZone * ang_cos + 0.5)); double diagonalDeadY = calculateYDiagonalDeadZone(axis1Value, axis2Value); - double squareStickFullPhi = qMin(static_cast(ang_sin) ? 1/fabs(ang_sin) : 2, static_cast(ang_cos) ? 1/fabs(ang_cos) : 2); + double squareStickFullPhi = qMin(ang_sin != 0.0 ? 1/fabs(ang_sin) : 2, ang_cos != 0.0 ? 1/fabs(ang_cos) : 2); double circle = this->circle; double circleStickFull = (squareStickFullPhi - 1) * circle + 1; @@ -4334,9 +4419,7 @@ double JoyControlStick::getSpringDeadCircleY() double maxRange = static_cast(deadZone) - diagonalDeadY; if (maxRange != 0.0) - { result = finalDeadZoneY / maxRange; - } return result; } @@ -4412,56 +4495,68 @@ JoyControlStick::getButtonsForDirection(JoyControlStick::JoyStickDirections dire qInstallMessageHandler(MessageHandler::myMessageOutput); QHash temphash; - if (currentMode == StandardMode) + + switch(currentMode) { - if (direction & JoyControlStick::StickUp) + case StandardMode: { - JoyControlStickButton *button = this->buttons.value(JoyControlStick::StickUp); - temphash.insert(JoyControlStick::StickUp, button); - } + if (direction & JoyControlStick::StickUp) + { + JoyControlStickButton *button = this->buttons.value(JoyControlStick::StickUp); + temphash.insert(JoyControlStick::StickUp, button); + } - if (direction & JoyControlStick::StickRight) - { - JoyControlStickButton *button = this->buttons.value(JoyControlStick::StickRight); - temphash.insert(JoyControlStick::StickRight, button); - } + if (direction & JoyControlStick::StickRight) + { + JoyControlStickButton *button = this->buttons.value(JoyControlStick::StickRight); + temphash.insert(JoyControlStick::StickRight, button); + } - if (direction & JoyControlStick::StickDown) - { - JoyControlStickButton *button = this->buttons.value(JoyControlStick::StickDown); - temphash.insert(JoyControlStick::StickDown, button); - } + if (direction & JoyControlStick::StickDown) + { + JoyControlStickButton *button = this->buttons.value(JoyControlStick::StickDown); + temphash.insert(JoyControlStick::StickDown, button); + } - if (direction & JoyControlStick::StickLeft) - { - JoyControlStickButton *button = this->buttons.value(JoyControlStick::StickLeft); - temphash.insert(JoyControlStick::StickLeft, button); + if (direction & JoyControlStick::StickLeft) + { + JoyControlStickButton *button = this->buttons.value(JoyControlStick::StickLeft); + temphash.insert(JoyControlStick::StickLeft, button); + } + + break; } - } - else if (currentMode == EightWayMode) - { - temphash.insert(direction, buttons.value(direction)); - } - else if (currentMode == FourWayCardinal) - { - if ((direction == JoyControlStick::StickUp) || - (direction == JoyControlStick::StickDown) || - (direction == JoyControlStick::StickLeft) || - (direction == JoyControlStick::StickRight)) + case EightWayMode: { temphash.insert(direction, buttons.value(direction)); + break; } + case FourWayCardinal: + { + if ((direction == JoyControlStick::StickUp) || + (direction == JoyControlStick::StickDown) || + (direction == JoyControlStick::StickLeft) || + (direction == JoyControlStick::StickRight)) + { + temphash.insert(direction, buttons.value(direction)); + } - } - else if (currentMode == FourWayDiagonal) - { - if ((direction == JoyControlStick::StickRightUp) || - (direction == JoyControlStick::StickRightDown) || - (direction == JoyControlStick::StickLeftDown) || - (direction == JoyControlStick::StickLeftUp)) + break; + + } + case FourWayDiagonal: { - temphash.insert(direction, buttons.value(direction)); + if ((direction == JoyControlStick::StickRightUp) || + (direction == JoyControlStick::StickRightDown) || + (direction == JoyControlStick::StickLeftDown) || + (direction == JoyControlStick::StickLeftUp)) + { + temphash.insert(direction, buttons.value(direction)); + } + + break; } + } return temphash; diff --git a/src/joycontrolstick.h b/src/joycontrolstick.h old mode 100644 new mode 100755 index 3828a79df..b889e3abf --- a/src/joycontrolstick.h +++ b/src/joycontrolstick.h @@ -177,16 +177,7 @@ class JoyControlStick : public QObject, public JoyStickDirectionsType virtual void readConfig(QXmlStreamReader *xml); virtual void writeConfig(QXmlStreamWriter *xml); - static const double PI; - - // Define default values for stick properties. - static const int DEFAULTDEADZONE; - static const int DEFAULTMAXZONE; - static const int DEFAULTDIAGONALRANGE; static const JoyMode DEFAULTMODE; - static const double DEFAULTCIRCLE; - static const int DEFAULTSTICKDELAY; // unsigned - protected: virtual void populateButtons(); @@ -298,6 +289,8 @@ private slots: QHash buttons; JoyControlStickModifierButton *modifierButton; + + void populateStickBtns(); }; #endif // JOYCONTROLSTICK_H diff --git a/src/joycontrolstickbuttonpushbutton.cpp b/src/joycontrolstickbuttonpushbutton.cpp old mode 100644 new mode 100755 index 859940ecc..42e948306 --- a/src/joycontrolstickbuttonpushbutton.cpp +++ b/src/joycontrolstickbuttonpushbutton.cpp @@ -27,7 +27,6 @@ #include #include - JoyControlStickButtonPushButton::JoyControlStickButtonPushButton(JoyControlStickButton *button, bool displayNames, QWidget *parent) : FlashButtonWidget(displayNames, parent) { diff --git a/src/joycontrolstickbuttonpushbutton.h b/src/joycontrolstickbuttonpushbutton.h old mode 100644 new mode 100755 index adced37d7..cf7c717ad --- a/src/joycontrolstickbuttonpushbutton.h +++ b/src/joycontrolstickbuttonpushbutton.h @@ -38,11 +38,11 @@ class JoyControlStickButtonPushButton : public FlashButtonWidget void tryFlash(); protected: - virtual QString generateLabel(); + virtual QString generateLabel() override; public slots: - void disableFlashes(); - void enableFlashes(); + void disableFlashes() override; + void enableFlashes() override; private slots: void showContextMenu(const QPoint &point); diff --git a/src/joycontrolstickcontextmenu.cpp b/src/joycontrolstickcontextmenu.cpp old mode 100644 new mode 100755 index 6e1a4ad9f..cd8c814e5 --- a/src/joycontrolstickcontextmenu.cpp +++ b/src/joycontrolstickcontextmenu.cpp @@ -30,7 +30,6 @@ #include #include - JoyControlStickContextMenu::JoyControlStickContextMenu(JoyControlStick *stick, QWidget *parent) : QMenu(parent), helper(stick) @@ -47,13 +46,11 @@ void JoyControlStickContextMenu::buildMenu() { qInstallMessageHandler(MessageHandler::myMessageOutput); - QAction *action = nullptr; - QActionGroup *presetGroup = new QActionGroup(this); int presetMode = 0; int currentPreset = getPresetIndex(); - action = this->addAction(trUtf8("Mouse (Normal)")); + QAction *action = this->addAction(trUtf8("Mouse (Normal)")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); @@ -218,131 +215,153 @@ void JoyControlStickContextMenu::setStickPreset(QAction* action) JoyButtonSlot *downLeftButtonSlot = nullptr; JoyButtonSlot *downRightButtonSlot = nullptr; - if (item == 0) + + switch(item) { - PadderCommon::inputDaemonMutex.lock(); + case 0: + { + PadderCommon::inputDaemonMutex.lock(); - upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - stick->setJoyMode(JoyControlStick::StandardMode); - stick->setDiagonalRange(65); + stick->setJoyMode(JoyControlStick::StandardMode); + stick->setDiagonalRange(65); - PadderCommon::inputDaemonMutex.unlock(); - } - else if (item == 1) - { - PadderCommon::inputDaemonMutex.lock(); + PadderCommon::inputDaemonMutex.unlock(); - upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + break; + } + case 1: + { + PadderCommon::inputDaemonMutex.lock(); - stick->setJoyMode(JoyControlStick::StandardMode); - stick->setDiagonalRange(65); + upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - PadderCommon::inputDaemonMutex.unlock(); - } - else if (item == 2) - { - PadderCommon::inputDaemonMutex.lock(); + stick->setJoyMode(JoyControlStick::StandardMode); + stick->setDiagonalRange(65); - upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + PadderCommon::inputDaemonMutex.unlock(); - stick->setJoyMode(JoyControlStick::StandardMode); - stick->setDiagonalRange(65); + break; + } + case 2: + { + PadderCommon::inputDaemonMutex.lock(); - PadderCommon::inputDaemonMutex.unlock(); - } - else if (item == 3) - { - PadderCommon::inputDaemonMutex.lock(); + upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + stick->setJoyMode(JoyControlStick::StandardMode); + stick->setDiagonalRange(65); - stick->setJoyMode(JoyControlStick::StandardMode); - stick->setDiagonalRange(65); + PadderCommon::inputDaemonMutex.unlock(); - PadderCommon::inputDaemonMutex.unlock(); - } - else if (item == 4) - { - PadderCommon::inputDaemonMutex.lock(); + break; + } + case 3: + { + PadderCommon::inputDaemonMutex.lock(); - upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Up), Qt::Key_Up, JoyButtonSlot::JoyKeyboard, this); - downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Down), Qt::Key_Down, JoyButtonSlot::JoyKeyboard, this); - leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Left), Qt::Key_Left, JoyButtonSlot::JoyKeyboard, this); - rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Right), Qt::Key_Right, JoyButtonSlot::JoyKeyboard, this); + upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - stick->setJoyMode(JoyControlStick::StandardMode); - stick->setDiagonalRange(45); + stick->setJoyMode(JoyControlStick::StandardMode); + stick->setDiagonalRange(65); - PadderCommon::inputDaemonMutex.unlock(); - } - else if (item == 5) - { - PadderCommon::inputDaemonMutex.lock(); + PadderCommon::inputDaemonMutex.unlock(); - upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_W), Qt::Key_W, JoyButtonSlot::JoyKeyboard, this); - downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_S), Qt::Key_S, JoyButtonSlot::JoyKeyboard, this); - leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_A), Qt::Key_A, JoyButtonSlot::JoyKeyboard, this); - rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_D), Qt::Key_D, JoyButtonSlot::JoyKeyboard, this); + break; + } + case 4: + { + PadderCommon::inputDaemonMutex.lock(); - stick->setJoyMode(JoyControlStick::StandardMode); - stick->setDiagonalRange(45); + upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Up), Qt::Key_Up, JoyButtonSlot::JoyKeyboard, this); + downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Down), Qt::Key_Down, JoyButtonSlot::JoyKeyboard, this); + leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Left), Qt::Key_Left, JoyButtonSlot::JoyKeyboard, this); + rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Right), Qt::Key_Right, JoyButtonSlot::JoyKeyboard, this); - PadderCommon::inputDaemonMutex.unlock(); - } - else if (item == 6) - { - PadderCommon::inputDaemonMutex.lock(); + stick->setJoyMode(JoyControlStick::StandardMode); + stick->setDiagonalRange(45); + + PadderCommon::inputDaemonMutex.unlock(); - if ((stick->getJoyMode() == JoyControlStick::StandardMode) || - (stick->getJoyMode() == JoyControlStick::FourWayCardinal)) + break; + } + case 5: { - upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); - downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); - leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); - rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); + PadderCommon::inputDaemonMutex.lock(); + + upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_W), Qt::Key_W, JoyButtonSlot::JoyKeyboard, this); + downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_S), Qt::Key_S, JoyButtonSlot::JoyKeyboard, this); + leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_A), Qt::Key_A, JoyButtonSlot::JoyKeyboard, this); + rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_D), Qt::Key_D, JoyButtonSlot::JoyKeyboard, this); + + stick->setJoyMode(JoyControlStick::StandardMode); + stick->setDiagonalRange(45); + + PadderCommon::inputDaemonMutex.unlock(); + + break; } - else if (stick->getJoyMode() == JoyControlStick::EightWayMode) + case 6: { - upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); - downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); - leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); - rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); - - upLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_7), QtKeyMapperBase::AntKey_KP_7, JoyButtonSlot::JoyKeyboard, this); - upRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_9), QtKeyMapperBase::AntKey_KP_9, JoyButtonSlot::JoyKeyboard, this); - downLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_1), QtKeyMapperBase::AntKey_KP_1, JoyButtonSlot::JoyKeyboard, this); - downRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_3), QtKeyMapperBase::AntKey_KP_3, JoyButtonSlot::JoyKeyboard, this); + PadderCommon::inputDaemonMutex.lock(); + + if ((stick->getJoyMode() == JoyControlStick::StandardMode) || + (stick->getJoyMode() == JoyControlStick::FourWayCardinal)) + { + upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); + downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); + leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); + rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); + } + else if (stick->getJoyMode() == JoyControlStick::EightWayMode) + { + upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); + downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); + leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); + rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); + + upLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_7), QtKeyMapperBase::AntKey_KP_7, JoyButtonSlot::JoyKeyboard, this); + upRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_9), QtKeyMapperBase::AntKey_KP_9, JoyButtonSlot::JoyKeyboard, this); + downLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_1), QtKeyMapperBase::AntKey_KP_1, JoyButtonSlot::JoyKeyboard, this); + downRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_3), QtKeyMapperBase::AntKey_KP_3, JoyButtonSlot::JoyKeyboard, this); + } + else if (stick->getJoyMode() == JoyControlStick::FourWayDiagonal) + { + upLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_7), QtKeyMapperBase::AntKey_KP_7, JoyButtonSlot::JoyKeyboard, this); + upRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_9), QtKeyMapperBase::AntKey_KP_9, JoyButtonSlot::JoyKeyboard, this); + downLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_1), QtKeyMapperBase::AntKey_KP_1, JoyButtonSlot::JoyKeyboard, this); + downRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_3), QtKeyMapperBase::AntKey_KP_3, JoyButtonSlot::JoyKeyboard, this); + } + + stick->setDiagonalRange(45); + + PadderCommon::inputDaemonMutex.unlock(); + + break; } - else if (stick->getJoyMode() == JoyControlStick::FourWayDiagonal) + case 7: { - upLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_7), QtKeyMapperBase::AntKey_KP_7, JoyButtonSlot::JoyKeyboard, this); - upRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_9), QtKeyMapperBase::AntKey_KP_9, JoyButtonSlot::JoyKeyboard, this); - downLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_1), QtKeyMapperBase::AntKey_KP_1, JoyButtonSlot::JoyKeyboard, this); - downRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_3), QtKeyMapperBase::AntKey_KP_3, JoyButtonSlot::JoyKeyboard, this); + QMetaObject::invokeMethod(&helper, "clearButtonsSlotsEventReset"); + QMetaObject::invokeMethod(stick, "setDiagonalRange", Q_ARG(int, 45)); + + break; } + } - stick->setDiagonalRange(45); - PadderCommon::inputDaemonMutex.unlock(); - } - else if (item == 7) - { - QMetaObject::invokeMethod(&helper, "clearButtonsSlotsEventReset"); - QMetaObject::invokeMethod(stick, "setDiagonalRange", Q_ARG(int, 45)); - } QHash tempHash; tempHash.insert(JoyControlStick::StickUp, upButtonSlot); diff --git a/src/joycontrolstickcontextmenu.h b/src/joycontrolstickcontextmenu.h old mode 100644 new mode 100755 diff --git a/src/joycontrolstickdirectionstype.h b/src/joycontrolstickdirectionstype.h old mode 100644 new mode 100755 diff --git a/src/joycontrolstickeditdialog.cpp b/src/joycontrolstickeditdialog.cpp old mode 100644 new mode 100755 index 01e50d638..46a839c17 --- a/src/joycontrolstickeditdialog.cpp +++ b/src/joycontrolstickeditdialog.cpp @@ -80,27 +80,36 @@ JoyControlStickEditDialog::JoyControlStickEditDialog(JoyControlStick *stick, QWi ui->distanceLabel->setText(QString::number(stick->getAbsoluteRawDistance())); ui->diagonalLabel->setText(QString::number(stick->calculateBearing())); - if (stick->getJoyMode() == JoyControlStick::StandardMode) - { - ui->joyModeComboBox->setCurrentIndex(0); - } - else if (stick->getJoyMode() == JoyControlStick::EightWayMode) - { - ui->joyModeComboBox->setCurrentIndex(1); - } - else if (stick->getJoyMode() == JoyControlStick::FourWayCardinal) - { - ui->joyModeComboBox->setCurrentIndex(2); - ui->diagonalRangeSlider->setEnabled(false); - ui->diagonalRangeSpinBox->setEnabled(false); - } - else if (stick->getJoyMode() == JoyControlStick::FourWayDiagonal) + + switch(stick->getJoyMode()) { - ui->joyModeComboBox->setCurrentIndex(3); - ui->diagonalRangeSlider->setEnabled(false); - ui->diagonalRangeSpinBox->setEnabled(false); + case JoyControlStick::StandardMode: + { + ui->joyModeComboBox->setCurrentIndex(0); + break; + } + case JoyControlStick::EightWayMode: + { + ui->joyModeComboBox->setCurrentIndex(1); + break; + } + case JoyControlStick::FourWayCardinal: + { + ui->joyModeComboBox->setCurrentIndex(2); + ui->diagonalRangeSlider->setEnabled(false); + ui->diagonalRangeSpinBox->setEnabled(false); + break; + } + case JoyControlStick::FourWayDiagonal: + { + ui->joyModeComboBox->setCurrentIndex(3); + ui->diagonalRangeSlider->setEnabled(false); + ui->diagonalRangeSpinBox->setEnabled(false); + break; + } } + ui->stickStatusBoxWidget->setStick(stick); selectCurrentPreset(); @@ -110,11 +119,11 @@ JoyControlStickEditDialog::JoyControlStickEditDialog(JoyControlStick *stick, QWi ui->fromSafeZoneValueLabel->setText(QString::number(validDistance)); double circleValue = stick->getCircleAdjust(); - ui->squareStickSlider->setValue(static_cast(circleValue) * 100); - ui->squareStickSpinBox->setValue(static_cast(circleValue) * 100); + ui->squareStickSlider->setValue(circleValue * 100); + ui->squareStickSpinBox->setValue(circleValue * 100); int stickDelay = stick->getStickDelay(); - ui->stickDelaySlider->setValue(static_cast(stickDelay * .1)); + ui->stickDelaySlider->setValue(stickDelay * .1); ui->stickDelayDoubleSpinBox->setValue(stickDelay * .001); ui->modifierPushButton->setText(stick->getModifierButton()->getSlotsSummary()); @@ -174,131 +183,152 @@ void JoyControlStickEditDialog::implementPresets(int index) JoyButtonSlot *downLeftButtonSlot = nullptr; JoyButtonSlot *downRightButtonSlot = nullptr; - if (index == 1) + switch(index) { - PadderCommon::inputDaemonMutex.lock(); - upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + case 1: + { + PadderCommon::inputDaemonMutex.lock(); - PadderCommon::inputDaemonMutex.unlock(); + upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - ui->joyModeComboBox->setCurrentIndex(0); - ui->diagonalRangeSlider->setValue(65); - } - else if (index == 2) - { - PadderCommon::inputDaemonMutex.lock(); + PadderCommon::inputDaemonMutex.unlock(); - upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + ui->joyModeComboBox->setCurrentIndex(0); + ui->diagonalRangeSlider->setValue(65); - PadderCommon::inputDaemonMutex.unlock(); + break; + } + case 2: + { + PadderCommon::inputDaemonMutex.lock(); - ui->joyModeComboBox->setCurrentIndex(0); - ui->diagonalRangeSlider->setValue(65); - } - else if (index == 3) - { - PadderCommon::inputDaemonMutex.lock(); + upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + PadderCommon::inputDaemonMutex.unlock(); - PadderCommon::inputDaemonMutex.unlock(); + ui->joyModeComboBox->setCurrentIndex(0); + ui->diagonalRangeSlider->setValue(65); - ui->joyModeComboBox->setCurrentIndex(0); - ui->diagonalRangeSlider->setValue(65); - } - else if (index == 4) - { - PadderCommon::inputDaemonMutex.lock(); + break; + } + case 3: + { + PadderCommon::inputDaemonMutex.lock(); - upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); - downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); - leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); - PadderCommon::inputDaemonMutex.unlock(); + PadderCommon::inputDaemonMutex.unlock(); - ui->joyModeComboBox->setCurrentIndex(0); - ui->diagonalRangeSlider->setValue(65); - } - else if (index == 5) - { - PadderCommon::inputDaemonMutex.lock(); + ui->joyModeComboBox->setCurrentIndex(0); + ui->diagonalRangeSlider->setValue(65); - upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Up), Qt::Key_Up, JoyButtonSlot::JoyKeyboard, this); - downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Down), Qt::Key_Down, JoyButtonSlot::JoyKeyboard, this); - leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Left), Qt::Key_Left, JoyButtonSlot::JoyKeyboard, this); - rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Right), Qt::Key_Right, JoyButtonSlot::JoyKeyboard, this); + break; + } + case 4: + { + PadderCommon::inputDaemonMutex.lock(); - PadderCommon::inputDaemonMutex.unlock(); + upButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseDown, JoyButtonSlot::JoyMouseMovement, this); + downButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseUp, JoyButtonSlot::JoyMouseMovement, this); + leftButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseRight, JoyButtonSlot::JoyMouseMovement, this); + rightButtonSlot = new JoyButtonSlot(JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); - ui->joyModeComboBox->setCurrentIndex(0); - ui->diagonalRangeSlider->setValue(45); - } - else if (index == 6) - { - PadderCommon::inputDaemonMutex.lock(); + PadderCommon::inputDaemonMutex.unlock(); - upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_W), Qt::Key_W, JoyButtonSlot::JoyKeyboard, this); - downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_S), Qt::Key_S, JoyButtonSlot::JoyKeyboard, this); - leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_A), Qt::Key_A, JoyButtonSlot::JoyKeyboard, this); - rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_D), Qt::Key_D, JoyButtonSlot::JoyKeyboard, this); + ui->joyModeComboBox->setCurrentIndex(0); + ui->diagonalRangeSlider->setValue(65); - PadderCommon::inputDaemonMutex.unlock(); + break; + } + case 5: + { + PadderCommon::inputDaemonMutex.lock(); - ui->joyModeComboBox->setCurrentIndex(0); - ui->diagonalRangeSlider->setValue(45); - } - else if (index == 7) - { - PadderCommon::inputDaemonMutex.lock(); + upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Up), Qt::Key_Up, JoyButtonSlot::JoyKeyboard, this); + downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Down), Qt::Key_Down, JoyButtonSlot::JoyKeyboard, this); + leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Left), Qt::Key_Left, JoyButtonSlot::JoyKeyboard, this); + rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_Right), Qt::Key_Right, JoyButtonSlot::JoyKeyboard, this); - if ((ui->joyModeComboBox->currentIndex() == 0) || - (ui->joyModeComboBox->currentIndex() == 2)) - { - upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); - downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); - leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); - rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); + PadderCommon::inputDaemonMutex.unlock(); + + ui->joyModeComboBox->setCurrentIndex(0); + ui->diagonalRangeSlider->setValue(45); + + break; } - else if (ui->joyModeComboBox->currentIndex() == 1) + case 6: { - upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); - downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); - leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); - rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); - - upLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_7), QtKeyMapperBase::AntKey_KP_7, JoyButtonSlot::JoyKeyboard, this); - upRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_9), QtKeyMapperBase::AntKey_KP_9, JoyButtonSlot::JoyKeyboard, this); - downLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_1), QtKeyMapperBase::AntKey_KP_1, JoyButtonSlot::JoyKeyboard, this); - downRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_3), QtKeyMapperBase::AntKey_KP_3, JoyButtonSlot::JoyKeyboard, this); + PadderCommon::inputDaemonMutex.lock(); + + upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_W), Qt::Key_W, JoyButtonSlot::JoyKeyboard, this); + downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_S), Qt::Key_S, JoyButtonSlot::JoyKeyboard, this); + leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_A), Qt::Key_A, JoyButtonSlot::JoyKeyboard, this); + rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(Qt::Key_D), Qt::Key_D, JoyButtonSlot::JoyKeyboard, this); + + PadderCommon::inputDaemonMutex.unlock(); + + ui->joyModeComboBox->setCurrentIndex(0); + ui->diagonalRangeSlider->setValue(45); + + break; } - else if (ui->joyModeComboBox->currentIndex() == 3) + case 7: { - upLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_7), QtKeyMapperBase::AntKey_KP_7, JoyButtonSlot::JoyKeyboard, this); - upRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_9), QtKeyMapperBase::AntKey_KP_9, JoyButtonSlot::JoyKeyboard, this); - downLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_1), QtKeyMapperBase::AntKey_KP_1, JoyButtonSlot::JoyKeyboard, this); - downRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_3), QtKeyMapperBase::AntKey_KP_3, JoyButtonSlot::JoyKeyboard, this); + PadderCommon::inputDaemonMutex.lock(); + + if ((ui->joyModeComboBox->currentIndex() == 0) || + (ui->joyModeComboBox->currentIndex() == 2)) + { + upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); + downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); + leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); + rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); + } + else if (ui->joyModeComboBox->currentIndex() == 1) + { + upButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_8), QtKeyMapperBase::AntKey_KP_8, JoyButtonSlot::JoyKeyboard, this); + downButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_2), QtKeyMapperBase::AntKey_KP_2, JoyButtonSlot::JoyKeyboard, this); + leftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_4), QtKeyMapperBase::AntKey_KP_4, JoyButtonSlot::JoyKeyboard, this); + rightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_6), QtKeyMapperBase::AntKey_KP_6, JoyButtonSlot::JoyKeyboard, this); + + upLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_7), QtKeyMapperBase::AntKey_KP_7, JoyButtonSlot::JoyKeyboard, this); + upRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_9), QtKeyMapperBase::AntKey_KP_9, JoyButtonSlot::JoyKeyboard, this); + downLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_1), QtKeyMapperBase::AntKey_KP_1, JoyButtonSlot::JoyKeyboard, this); + downRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_3), QtKeyMapperBase::AntKey_KP_3, JoyButtonSlot::JoyKeyboard, this); + } + else if (ui->joyModeComboBox->currentIndex() == 3) + { + upLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_7), QtKeyMapperBase::AntKey_KP_7, JoyButtonSlot::JoyKeyboard, this); + upRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_9), QtKeyMapperBase::AntKey_KP_9, JoyButtonSlot::JoyKeyboard, this); + downLeftButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_1), QtKeyMapperBase::AntKey_KP_1, JoyButtonSlot::JoyKeyboard, this); + downRightButtonSlot = new JoyButtonSlot(AntKeyMapper::getInstance()->returnVirtualKey(QtKeyMapperBase::AntKey_KP_3), QtKeyMapperBase::AntKey_KP_3, JoyButtonSlot::JoyKeyboard, this); + } + + PadderCommon::inputDaemonMutex.unlock(); + + ui->diagonalRangeSlider->setValue(45); + + break; } + case 8: + { + QMetaObject::invokeMethod(&helper, "clearButtonsSlotsEventReset", Qt::BlockingQueuedConnection); - PadderCommon::inputDaemonMutex.unlock(); + ui->diagonalRangeSlider->setValue(45); - ui->diagonalRangeSlider->setValue(45); - } - else if (index == 8) - { - QMetaObject::invokeMethod(&helper, "clearButtonsSlotsEventReset", Qt::BlockingQueuedConnection); + break; + } - ui->diagonalRangeSlider->setValue(45); } QHash tempHash; @@ -365,29 +395,40 @@ void JoyControlStickEditDialog::implementModes(int index) stick->releaseButtonEvents(); - if (index == 0) - { - stick->setJoyMode(JoyControlStick::StandardMode); - ui->diagonalRangeSlider->setEnabled(true); - ui->diagonalRangeSpinBox->setEnabled(true); - } - else if (index == 1) + switch(index) { - stick->setJoyMode(JoyControlStick::EightWayMode); - ui->diagonalRangeSlider->setEnabled(true); - ui->diagonalRangeSpinBox->setEnabled(true); - } - else if (index == 2) - { - stick->setJoyMode(JoyControlStick::FourWayCardinal); - ui->diagonalRangeSlider->setEnabled(false); - ui->diagonalRangeSpinBox->setEnabled(false); - } - else if (index == 3) - { - stick->setJoyMode(JoyControlStick::FourWayDiagonal); - ui->diagonalRangeSlider->setEnabled(false); - ui->diagonalRangeSpinBox->setEnabled(false); + case 0: + { + stick->setJoyMode(JoyControlStick::StandardMode); + ui->diagonalRangeSlider->setEnabled(true); + ui->diagonalRangeSpinBox->setEnabled(true); + + break; + } + case 1: + { + stick->setJoyMode(JoyControlStick::EightWayMode); + ui->diagonalRangeSlider->setEnabled(true); + ui->diagonalRangeSpinBox->setEnabled(true); + + break; + } + case 2: + { + stick->setJoyMode(JoyControlStick::FourWayCardinal); + ui->diagonalRangeSlider->setEnabled(false); + ui->diagonalRangeSpinBox->setEnabled(false); + + break; + } + case 3: + { + stick->setJoyMode(JoyControlStick::FourWayDiagonal); + ui->diagonalRangeSlider->setEnabled(false); + ui->diagonalRangeSpinBox->setEnabled(false); + + break; + } } PadderCommon::inputDaemonMutex.unlock(); @@ -555,7 +596,7 @@ void JoyControlStickEditDialog::updateStickDelaySpinBox(int value) { qInstallMessageHandler(MessageHandler::myMessageOutput); - double temp = value * 0.001; // static_cast + double temp = value * 0.001; ui->stickDelayDoubleSpinBox->setValue(temp); } @@ -567,7 +608,8 @@ void JoyControlStickEditDialog::updateStickDelaySlider(double value) { qInstallMessageHandler(MessageHandler::myMessageOutput); - int temp = static_cast(value) * 100; + int temp = value * 100; + if (ui->stickDelaySlider->value() != temp) { ui->stickDelaySlider->setValue(temp); diff --git a/src/joycontrolstickeditdialog.h b/src/joycontrolstickeditdialog.h old mode 100644 new mode 100755 diff --git a/src/joycontrolstickeditdialog.ui b/src/joycontrolstickeditdialog.ui old mode 100644 new mode 100755 diff --git a/src/joycontrolstickpushbutton.cpp b/src/joycontrolstickpushbutton.cpp old mode 100644 new mode 100755 diff --git a/src/joycontrolstickpushbutton.h b/src/joycontrolstickpushbutton.h old mode 100644 new mode 100755 index adc5f7c68..1c4eff8f1 --- a/src/joycontrolstickpushbutton.h +++ b/src/joycontrolstickpushbutton.h @@ -37,11 +37,11 @@ class JoyControlStickPushButton : public FlashButtonWidget void tryFlash(); protected: - virtual QString generateLabel(); + virtual QString generateLabel() override; public slots: - void disableFlashes(); - void enableFlashes(); + void disableFlashes() override; + void enableFlashes() override; private slots: void showContextMenu(const QPoint &point); diff --git a/src/joycontrolstickstatusbox.cpp b/src/joycontrolstickstatusbox.cpp old mode 100644 new mode 100755 index b3ac1f0d6..2f732d72d --- a/src/joycontrolstickstatusbox.cpp +++ b/src/joycontrolstickstatusbox.cpp @@ -17,6 +17,7 @@ #include "joycontrolstickstatusbox.h" +#include "globalvariables.h" #include "messagehandler.h" #include "joycontrolstick.h" #include "joyaxis.h" @@ -146,8 +147,8 @@ void JoyControlStickStatusBox::drawEightWayBox() painter.drawRect(0, 0, side-1, side-1); painter.save(); - painter.scale(side / static_cast(JoyAxis::AXISMAX*2.0), side / static_cast(JoyAxis::AXISMAX*2.0)); - painter.translate(JoyAxis::AXISMAX, JoyAxis::AXISMAX); + painter.scale(side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0), side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0)); + painter.translate(GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX); // Draw diagonal zones QList anglesList = stick->getDiagonalZoneAngles(); @@ -157,10 +158,11 @@ void JoyControlStickStatusBox::drawEightWayBox() painter.setPen(penny); painter.setBrush(QBrush(Qt::green)); - painter.drawPie(-JoyAxis::AXISMAX, -JoyAxis::AXISMAX, JoyAxis::AXISMAX*2, JoyAxis::AXISMAX*2, static_cast(anglesList.value(2)*16), stick->getDiagonalRange()*16); - painter.drawPie(-JoyAxis::AXISMAX, -JoyAxis::AXISMAX, JoyAxis::AXISMAX*2, JoyAxis::AXISMAX*2, static_cast(anglesList.value(4)*16), stick->getDiagonalRange()*16); - painter.drawPie(-JoyAxis::AXISMAX, -JoyAxis::AXISMAX, JoyAxis::AXISMAX*2, JoyAxis::AXISMAX*2, static_cast(anglesList.value(6)*16), stick->getDiagonalRange()*16); - painter.drawPie(-JoyAxis::AXISMAX, -JoyAxis::AXISMAX, JoyAxis::AXISMAX*2, JoyAxis::AXISMAX*2, static_cast(anglesList.value(8)*16), stick->getDiagonalRange()*16); + painter.drawPie(-GlobalVariables::JoyAxis::AXISMAX, -GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX*2, GlobalVariables::JoyAxis::AXISMAX*2, static_cast(anglesList.value(2))*16, stick->getDiagonalRange()*16); + painter.drawPie(-GlobalVariables::JoyAxis::AXISMAX, -GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX*2, GlobalVariables::JoyAxis::AXISMAX*2, static_cast(anglesList.value(4))*16, stick->getDiagonalRange()*16); + painter.drawPie(-GlobalVariables::JoyAxis::AXISMAX, -GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX*2, GlobalVariables::JoyAxis::AXISMAX*2, static_cast(anglesList.value(6))*16, stick->getDiagonalRange()*16); + painter.drawPie(-GlobalVariables::JoyAxis::AXISMAX, -GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX*2, GlobalVariables::JoyAxis::AXISMAX*2, static_cast(anglesList.value(8)) + *16, stick->getDiagonalRange()*16); // Draw deadzone circle penny.setWidth(0); @@ -184,8 +186,8 @@ void JoyControlStickStatusBox::drawEightWayBox() painter.restore(); painter.save(); - painter.scale(side / static_cast(JoyAxis::AXISMAX*2.0), side / static_cast(JoyAxis::AXISMAX*2.0)); - painter.translate(JoyAxis::AXISMAX, JoyAxis::AXISMAX); + painter.scale(side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0), side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0)); + painter.translate(GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX); penny.setWidth(0); painter.setBrush(QBrush(Qt::black)); @@ -196,14 +198,14 @@ void JoyControlStickStatusBox::drawEightWayBox() int linexstart = stick->getXCoordinate()-1000; int lineystart = stick->getYCoordinate()-1000; - if (linexstart < JoyAxis::AXISMIN) + if (linexstart < GlobalVariables::JoyAxis::AXISMIN) { - linexstart = JoyAxis::AXISMIN; + linexstart = GlobalVariables::JoyAxis::AXISMIN; } - if (lineystart < JoyAxis::AXISMIN) + if (lineystart < GlobalVariables::JoyAxis::AXISMIN) { - lineystart = JoyAxis::AXISMIN; + lineystart = GlobalVariables::JoyAxis::AXISMIN; } painter.drawRect(linexstart, lineystart, 2000, 2000); @@ -215,14 +217,14 @@ void JoyControlStickStatusBox::drawEightWayBox() // Draw adjusted crosshair linexstart = stick->getCircleXCoordinate()-1000; lineystart = stick->getCircleYCoordinate()-1000; - if (linexstart < JoyAxis::AXISMIN) + if (linexstart < GlobalVariables::JoyAxis::AXISMIN) { - linexstart = JoyAxis::AXISMIN; + linexstart = GlobalVariables::JoyAxis::AXISMIN; } - if (lineystart < JoyAxis::AXISMIN) + if (lineystart < GlobalVariables::JoyAxis::AXISMIN) { - lineystart = JoyAxis::AXISMIN; + lineystart = GlobalVariables::JoyAxis::AXISMIN; } painter.drawRect(linexstart, lineystart, 2000, 2000); @@ -239,18 +241,18 @@ void JoyControlStickStatusBox::drawEightWayBox() paint.drawPixmap(pix.rect(), pix); paint.save(); - paint.scale(side / static_cast(JoyAxis::AXISMAX*2.0), side / static_cast(JoyAxis::AXISMAX*2.0)); - paint.translate(JoyAxis::AXISMAX, JoyAxis::AXISMAX); + paint.scale(side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0), side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0)); + paint.translate(GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX); // Draw max zone and initial inner clear circle int maxzone = stick->getMaxZone(); - int diffmaxzone = JoyAxis::AXISMAX - maxzone; + int diffmaxzone = GlobalVariables::JoyAxis::AXISMAX - maxzone; paint.setOpacity(0.5); paint.setBrush(Qt::darkGreen); - paint.drawEllipse(-JoyAxis::AXISMAX, -JoyAxis::AXISMAX, JoyAxis::AXISMAX*2, JoyAxis::AXISMAX*2); + paint.drawEllipse(-GlobalVariables::JoyAxis::AXISMAX, -GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX*2, GlobalVariables::JoyAxis::AXISMAX*2); paint.setCompositionMode(QPainter::CompositionMode_Clear); paint.setPen(Qt::NoPen); - paint.drawEllipse(-JoyAxis::AXISMAX+diffmaxzone, -JoyAxis::AXISMAX+diffmaxzone, JoyAxis::AXISMAX*2-(diffmaxzone*2), JoyAxis::AXISMAX*2-(diffmaxzone*2)); + paint.drawEllipse(-GlobalVariables::JoyAxis::AXISMAX+diffmaxzone, -GlobalVariables::JoyAxis::AXISMAX+diffmaxzone, GlobalVariables::JoyAxis::AXISMAX*2-(diffmaxzone*2), GlobalVariables::JoyAxis::AXISMAX*2-(diffmaxzone*2)); painter.setCompositionMode(QPainter::CompositionMode_SourceOver); paint.setOpacity(1.0); @@ -284,8 +286,8 @@ void JoyControlStickStatusBox::drawFourWayCardinalBox() painter.drawRect(0, 0, side-1, side-1); painter.save(); - painter.scale(side / static_cast(JoyAxis::AXISMAX*2.0), side / static_cast(JoyAxis::AXISMAX*2.0)); - painter.translate(JoyAxis::AXISMAX, JoyAxis::AXISMAX); + painter.scale(side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0), side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0)); + painter.translate(GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX); // Draw diagonal zones QList anglesList = stick->getFourWayCardinalZoneAngles(); @@ -295,8 +297,8 @@ void JoyControlStickStatusBox::drawFourWayCardinalBox() painter.setOpacity(0.25); painter.setBrush(QBrush(Qt::black)); - painter.drawPie(-JoyAxis::AXISMAX, -JoyAxis::AXISMAX, JoyAxis::AXISMAX*2, JoyAxis::AXISMAX*2, anglesList.value(1)*16, 90*16); - painter.drawPie(-JoyAxis::AXISMAX, -JoyAxis::AXISMAX, JoyAxis::AXISMAX*2, JoyAxis::AXISMAX*2, anglesList.value(3)*16, 90*16); + painter.drawPie(-GlobalVariables::JoyAxis::AXISMAX, -GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX*2, GlobalVariables::JoyAxis::AXISMAX*2, anglesList.value(1)*16, 90*16); + painter.drawPie(-GlobalVariables::JoyAxis::AXISMAX, -GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX*2, GlobalVariables::JoyAxis::AXISMAX*2, anglesList.value(3)*16, 90*16); painter.setOpacity(1.0); @@ -324,8 +326,8 @@ void JoyControlStickStatusBox::drawFourWayCardinalBox() painter.restore(); painter.save(); - painter.scale(side / static_cast(JoyAxis::AXISMAX*2.0), side / static_cast(JoyAxis::AXISMAX*2.0)); - painter.translate(JoyAxis::AXISMAX, JoyAxis::AXISMAX); + painter.scale(side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0), side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0)); + painter.translate(GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX); penny.setWidth(0); painter.setBrush(QBrush(Qt::black)); penny.setColor(Qt::black); @@ -335,14 +337,14 @@ void JoyControlStickStatusBox::drawFourWayCardinalBox() int linexstart = stick->getXCoordinate()-1000; int lineystart = stick->getYCoordinate()-1000; - if (linexstart < JoyAxis::AXISMIN) + if (linexstart < GlobalVariables::JoyAxis::AXISMIN) { - linexstart = JoyAxis::AXISMIN; + linexstart = GlobalVariables::JoyAxis::AXISMIN; } - if (lineystart < JoyAxis::AXISMIN) + if (lineystart < GlobalVariables::JoyAxis::AXISMIN) { - lineystart = JoyAxis::AXISMIN; + lineystart = GlobalVariables::JoyAxis::AXISMIN; } painter.drawRect(linexstart, lineystart, 2000, 2000); @@ -354,14 +356,14 @@ void JoyControlStickStatusBox::drawFourWayCardinalBox() // Draw adjusted crosshair linexstart = stick->getCircleXCoordinate()-1000; lineystart = stick->getCircleYCoordinate()-1000; - if (linexstart < JoyAxis::AXISMIN) + if (linexstart < GlobalVariables::JoyAxis::AXISMIN) { - linexstart = JoyAxis::AXISMIN; + linexstart = GlobalVariables::JoyAxis::AXISMIN; } - if (lineystart < JoyAxis::AXISMIN) + if (lineystart < GlobalVariables::JoyAxis::AXISMIN) { - lineystart = JoyAxis::AXISMIN; + lineystart = GlobalVariables::JoyAxis::AXISMIN; } painter.drawRect(linexstart, lineystart, 2000, 2000); @@ -378,18 +380,18 @@ void JoyControlStickStatusBox::drawFourWayCardinalBox() paint.drawPixmap(pix.rect(), pix); paint.save(); - paint.scale(side / static_cast(JoyAxis::AXISMAX*2.0), side / static_cast(JoyAxis::AXISMAX*2.0)); - paint.translate(JoyAxis::AXISMAX, JoyAxis::AXISMAX); + paint.scale(side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0), side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0)); + paint.translate(GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX); // Draw max zone and initial inner clear circle int maxzone = stick->getMaxZone(); - int diffmaxzone = JoyAxis::AXISMAX - maxzone; + int diffmaxzone = GlobalVariables::JoyAxis::AXISMAX - maxzone; paint.setOpacity(0.5); paint.setBrush(Qt::darkGreen); - paint.drawEllipse(-JoyAxis::AXISMAX, -JoyAxis::AXISMAX, JoyAxis::AXISMAX*2, JoyAxis::AXISMAX*2); + paint.drawEllipse(-GlobalVariables::JoyAxis::AXISMAX, -GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX*2, GlobalVariables::JoyAxis::AXISMAX*2); paint.setCompositionMode(QPainter::CompositionMode_Clear); paint.setPen(Qt::NoPen); - paint.drawEllipse(-JoyAxis::AXISMAX+diffmaxzone, -JoyAxis::AXISMAX+diffmaxzone, JoyAxis::AXISMAX*2-(diffmaxzone*2), JoyAxis::AXISMAX*2-(diffmaxzone*2)); + paint.drawEllipse(-GlobalVariables::JoyAxis::AXISMAX+diffmaxzone, -GlobalVariables::JoyAxis::AXISMAX+diffmaxzone, GlobalVariables::JoyAxis::AXISMAX*2-(diffmaxzone*2), GlobalVariables::JoyAxis::AXISMAX*2-(diffmaxzone*2)); painter.setCompositionMode(QPainter::CompositionMode_SourceOver); paint.setOpacity(1.0); @@ -423,8 +425,8 @@ void JoyControlStickStatusBox::drawFourWayDiagonalBox() painter.drawRect(0, 0, side-1, side-1); painter.save(); - painter.scale(side / static_cast(JoyAxis::AXISMAX*2.0), side / static_cast(JoyAxis::AXISMAX*2.0)); - painter.translate(JoyAxis::AXISMAX, JoyAxis::AXISMAX); + painter.scale(side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0), side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0)); + painter.translate(GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX); // Draw diagonal zones QList anglesList = stick->getFourWayDiagonalZoneAngles(); @@ -434,8 +436,8 @@ void JoyControlStickStatusBox::drawFourWayDiagonalBox() painter.setBrush(QBrush(Qt::black)); painter.setOpacity(0.25); - painter.drawPie(-JoyAxis::AXISMAX, -JoyAxis::AXISMAX, JoyAxis::AXISMAX*2, JoyAxis::AXISMAX*2, anglesList.value(1)*16, 90*16); - painter.drawPie(-JoyAxis::AXISMAX, -JoyAxis::AXISMAX, JoyAxis::AXISMAX*2, JoyAxis::AXISMAX*2, anglesList.value(3)*16, 90*16); + painter.drawPie(-GlobalVariables::JoyAxis::AXISMAX, -GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX*2, GlobalVariables::JoyAxis::AXISMAX*2, anglesList.value(1)*16, 90*16); + painter.drawPie(-GlobalVariables::JoyAxis::AXISMAX, -GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX*2, GlobalVariables::JoyAxis::AXISMAX*2, anglesList.value(3)*16, 90*16); painter.setOpacity(1.0); @@ -463,8 +465,8 @@ void JoyControlStickStatusBox::drawFourWayDiagonalBox() painter.restore(); painter.save(); - painter.scale(side / static_cast(JoyAxis::AXISMAX*2.0), side / static_cast(JoyAxis::AXISMAX*2.0)); - painter.translate(JoyAxis::AXISMAX, JoyAxis::AXISMAX); + painter.scale(side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0), side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0)); + painter.translate(GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX); penny.setWidth(0); painter.setBrush(QBrush(Qt::black)); penny.setColor(Qt::black); @@ -474,14 +476,14 @@ void JoyControlStickStatusBox::drawFourWayDiagonalBox() int linexstart = stick->getXCoordinate()-1000; int lineystart = stick->getYCoordinate()-1000; - if (linexstart < JoyAxis::AXISMIN) + if (linexstart < GlobalVariables::JoyAxis::AXISMIN) { - linexstart = JoyAxis::AXISMIN; + linexstart = GlobalVariables::JoyAxis::AXISMIN; } - if (lineystart < JoyAxis::AXISMIN) + if (lineystart < GlobalVariables::JoyAxis::AXISMIN) { - lineystart = JoyAxis::AXISMIN; + lineystart = GlobalVariables::JoyAxis::AXISMIN; } painter.drawRect(linexstart, lineystart, 2000, 2000); @@ -493,14 +495,14 @@ void JoyControlStickStatusBox::drawFourWayDiagonalBox() // Draw adjusted crosshair linexstart = stick->getCircleXCoordinate()-1000; lineystart = stick->getCircleYCoordinate()-1000; - if (linexstart < JoyAxis::AXISMIN) + if (linexstart < GlobalVariables::JoyAxis::AXISMIN) { - linexstart = JoyAxis::AXISMIN; + linexstart = GlobalVariables::JoyAxis::AXISMIN; } - if (lineystart < JoyAxis::AXISMIN) + if (lineystart < GlobalVariables::JoyAxis::AXISMIN) { - lineystart = JoyAxis::AXISMIN; + lineystart = GlobalVariables::JoyAxis::AXISMIN; } painter.drawRect(linexstart, lineystart, 2000, 2000); @@ -517,18 +519,18 @@ void JoyControlStickStatusBox::drawFourWayDiagonalBox() paint.drawPixmap(pix.rect(), pix); paint.save(); - paint.scale(side / static_cast(JoyAxis::AXISMAX*2.0), side / static_cast(JoyAxis::AXISMAX*2.0)); - paint.translate(JoyAxis::AXISMAX, JoyAxis::AXISMAX); + paint.scale(side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0), side / static_cast(GlobalVariables::JoyAxis::AXISMAX*2.0)); + paint.translate(GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX); // Draw max zone and initial inner clear circle int maxzone = stick->getMaxZone(); - int diffmaxzone = JoyAxis::AXISMAX - maxzone; + int diffmaxzone = GlobalVariables::JoyAxis::AXISMAX - maxzone; paint.setOpacity(0.5); paint.setBrush(Qt::darkGreen); - paint.drawEllipse(-JoyAxis::AXISMAX, -JoyAxis::AXISMAX, JoyAxis::AXISMAX*2, JoyAxis::AXISMAX*2); + paint.drawEllipse(-GlobalVariables::JoyAxis::AXISMAX, -GlobalVariables::JoyAxis::AXISMAX, GlobalVariables::JoyAxis::AXISMAX*2, GlobalVariables::JoyAxis::AXISMAX*2); paint.setCompositionMode(QPainter::CompositionMode_Clear); paint.setPen(Qt::NoPen); - paint.drawEllipse(-JoyAxis::AXISMAX+diffmaxzone, -JoyAxis::AXISMAX+diffmaxzone, JoyAxis::AXISMAX*2-(diffmaxzone*2), JoyAxis::AXISMAX*2-(diffmaxzone*2)); + paint.drawEllipse(-GlobalVariables::JoyAxis::AXISMAX+diffmaxzone, -GlobalVariables::JoyAxis::AXISMAX+diffmaxzone, GlobalVariables::JoyAxis::AXISMAX*2-(diffmaxzone*2), GlobalVariables::JoyAxis::AXISMAX*2-(diffmaxzone*2)); painter.setCompositionMode(QPainter::CompositionMode_SourceOver); paint.setOpacity(1.0); diff --git a/src/joycontrolstickstatusbox.h b/src/joycontrolstickstatusbox.h old mode 100644 new mode 100755 diff --git a/src/joydpad.cpp b/src/joydpad.cpp old mode 100644 new mode 100755 index c92bee159..2e29ce150 --- a/src/joydpad.cpp +++ b/src/joydpad.cpp @@ -17,6 +17,7 @@ #include "joydpad.h" +#include "globalvariables.h" #include "messagehandler.h" #include "inputdevice.h" @@ -26,23 +27,20 @@ #include -const QString JoyDPad::xmlName = "dpad"; -const int JoyDPad::DEFAULTDPADDELAY = 0; - JoyDPad::JoyDPad(int index, int originset, SetJoystick *parentSet, QObject *parent) : QObject(parent) { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->index = index; + m_index = index; buttons = QHash (); activeDiagonalButton = nullptr; prevDirection = JoyDPadButton::DpadCentered; pendingDirection = prevDirection; - this->originset = originset; + m_originset = originset; currentMode = StandardMode; - this->parentSet = parentSet; - this->dpadDelay = DEFAULTDPADDELAY; + m_parentSet = parentSet; + this->dpadDelay = GlobalVariables::JoyDPad::DEFAULTDPADDELAY; populateButtons(); @@ -69,39 +67,39 @@ JoyDPad::~JoyDPad() buttons.clear(); } -JoyDPadButton *JoyDPad::getJoyButton(int index) +JoyDPadButton *JoyDPad::getJoyButton(int index_local) { qInstallMessageHandler(MessageHandler::myMessageOutput); - return buttons.value(index); + return buttons.value(index_local); } void JoyDPad::populateButtons() { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyDPadButton* button = new JoyDPadButton (JoyDPadButton::DpadUp, originset, this, parentSet, this); + JoyDPadButton* button = new JoyDPadButton (JoyDPadButton::DpadUp, m_originset, this, m_parentSet, this); buttons.insert(JoyDPadButton::DpadUp, button); - button = new JoyDPadButton (JoyDPadButton::DpadDown, originset, this, parentSet, this); + button = new JoyDPadButton (JoyDPadButton::DpadDown, m_originset, this, m_parentSet, this); buttons.insert(JoyDPadButton::DpadDown, button); - button = new JoyDPadButton(JoyDPadButton::DpadRight, originset, this, parentSet, this); + button = new JoyDPadButton(JoyDPadButton::DpadRight, m_originset, this, m_parentSet, this); buttons.insert(JoyDPadButton::DpadRight, button); - button = new JoyDPadButton(JoyDPadButton::DpadLeft, originset, this, parentSet, this); + button = new JoyDPadButton(JoyDPadButton::DpadLeft, m_originset, this, m_parentSet, this); buttons.insert(JoyDPadButton::DpadLeft, button); - button = new JoyDPadButton(JoyDPadButton::DpadLeftUp, originset, this, parentSet, this); + button = new JoyDPadButton(JoyDPadButton::DpadLeftUp, m_originset, this, m_parentSet, this); buttons.insert(JoyDPadButton::DpadLeftUp, button); - button = new JoyDPadButton(JoyDPadButton::DpadRightUp, originset, this, parentSet, this); + button = new JoyDPadButton(JoyDPadButton::DpadRightUp, m_originset, this, m_parentSet, this); buttons.insert(JoyDPadButton::DpadRightUp, button); - button = new JoyDPadButton(JoyDPadButton::DpadRightDown, originset, this, parentSet, this); + button = new JoyDPadButton(JoyDPadButton::DpadRightDown, m_originset, this, m_parentSet, this); buttons.insert(JoyDPadButton::DpadRightDown, button); - button = new JoyDPadButton(JoyDPadButton::DpadLeftDown, originset, this, parentSet, this); + button = new JoyDPadButton(JoyDPadButton::DpadLeftDown, m_originset, this, m_parentSet, this); buttons.insert(JoyDPadButton::DpadLeftDown, button); } @@ -141,28 +139,28 @@ int JoyDPad::getJoyNumber() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return index; + return m_index; } int JoyDPad::getIndex() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return index; + return m_index; } int JoyDPad::getRealJoyNumber() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return index + 1; + return m_index + 1; } QString JoyDPad::getXmlName() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->xmlName; + return GlobalVariables::JoyDPad::xmlName; } void JoyDPad::readConfig(QXmlStreamReader *xml) @@ -194,8 +192,8 @@ bool JoyDPad::readMainConfig(QXmlStreamReader *xml) if ((xml->name() == "dpadbutton") && xml->isStartElement()) { found = true; - int index = xml->attributes().value("index").toString().toInt(); - JoyDPadButton* button = this->getJoyButton(index); + int index_local = xml->attributes().value("index").toString().toInt(); + JoyDPadButton* button = this->getJoyButton(index_local); if (button != nullptr) { button->readConfig(xml); @@ -240,7 +238,7 @@ void JoyDPad::writeConfig(QXmlStreamWriter *xml) if (!isDefault()) { xml->writeStartElement(getXmlName()); - xml->writeAttribute("index", QString::number(index+1)); + xml->writeAttribute("index", QString::number(m_index + 1)); if (currentMode == EightWayMode) { xml->writeTextElement("mode", "eight-way"); @@ -254,7 +252,7 @@ void JoyDPad::writeConfig(QXmlStreamWriter *xml) xml->writeTextElement("mode", "diagonal"); } - if (dpadDelay > DEFAULTDPADDELAY) + if (dpadDelay > GlobalVariables::JoyDPad::DEFAULTDPADDELAY) { xml->writeTextElement("dpadDelay", QString::number(dpadDelay)); } @@ -427,7 +425,7 @@ bool JoyDPad::isDefault() bool value = true; value = value && (currentMode == StandardMode); - value = value && (dpadDelay == DEFAULTDPADDELAY); + value = value && (dpadDelay == GlobalVariables::JoyDPad::DEFAULTDPADDELAY); QHashIterator iter(buttons); while (iter.hasNext()) @@ -701,7 +699,7 @@ double JoyDPad::getButtonsPresetSensitivity() { JoyDPadButton *button = iter.next().value(); double temp = button->getSensitivity(); - if (qFuzzyCompare(temp, presetSensitivity)) + if (!qFuzzyCompare(temp, presetSensitivity)) { presetSensitivity = 1.0; iter.toBack(); @@ -772,7 +770,7 @@ void JoyDPad::setButtonsWheelSpeedX(int value) while (iter.hasNext()) { JoyDPadButton *button = iter.next().value(); - button->setWheelSpeedX(value); + button->setWheelSpeed(value, 'X'); } } @@ -784,7 +782,7 @@ void JoyDPad::setButtonsWheelSpeedY(int value) while (iter.hasNext()) { JoyDPadButton *button = iter.next().value(); - button->setWheelSpeedY(value); + button->setWheelSpeed(value, 'Y'); } } @@ -807,7 +805,7 @@ SetJoystick* JoyDPad::getParentSet() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return parentSet; + return m_parentSet; } void JoyDPad::establishPropertyUpdatedConnection() @@ -1006,124 +1004,169 @@ void JoyDPad::createDeskEvent(bool ignoresets) } } - if (currentMode == StandardMode) + switch(currentMode) { - if ((value & JoyDPadButton::DpadUp) && (!(prevDirection & JoyDPadButton::DpadUp))) - { - curButton = buttons.value(JoyDPadButton::DpadUp); - curButton->joyEvent(true, ignoresets); - } - if ((value & JoyDPadButton::DpadDown) && (!(prevDirection & JoyDPadButton::DpadDown))) + case StandardMode: { - curButton = buttons.value(JoyDPadButton::DpadDown); - curButton->joyEvent(true, ignoresets); - } + if ((value & JoyDPadButton::DpadUp) && (!(prevDirection & JoyDPadButton::DpadUp))) + { + curButton = buttons.value(JoyDPadButton::DpadUp); + curButton->joyEvent(true, ignoresets); + } - if ((value & JoyDPadButton::DpadLeft) && (!(prevDirection & JoyDPadButton::DpadLeft))) - { - curButton = buttons.value(JoyDPadButton::DpadLeft); - curButton->joyEvent(true, ignoresets); - } + if ((value & JoyDPadButton::DpadDown) && (!(prevDirection & JoyDPadButton::DpadDown))) + { + curButton = buttons.value(JoyDPadButton::DpadDown); + curButton->joyEvent(true, ignoresets); + } - if ((value & JoyDPadButton::DpadRight) && (!(prevDirection & JoyDPadButton::DpadRight))) - { - curButton = buttons.value(JoyDPadButton::DpadRight); - curButton->joyEvent(true, ignoresets); - } - } - else if (currentMode == EightWayMode) - { - if (value == JoyDPadButton::DpadLeftUp) - { - activeDiagonalButton = buttons.value(JoyDPadButton::DpadLeftUp); - activeDiagonalButton->joyEvent(true, ignoresets); - } - else if (value == JoyDPadButton::DpadRightUp) - { - activeDiagonalButton = buttons.value(JoyDPadButton::DpadRightUp); - activeDiagonalButton->joyEvent(true, ignoresets); - } - else if (value == JoyDPadButton::DpadRightDown) - { - activeDiagonalButton = buttons.value(JoyDPadButton::DpadRightDown); - activeDiagonalButton->joyEvent(true, ignoresets); - } - else if (value == JoyDPadButton::DpadLeftDown) - { - activeDiagonalButton = buttons.value(JoyDPadButton::DpadLeftDown); - activeDiagonalButton->joyEvent(true, ignoresets); - } - else if (value == JoyDPadButton::DpadUp) - { - curButton = buttons.value(JoyDPadButton::DpadUp); - curButton->joyEvent(true, ignoresets); - } - else if (value == JoyDPadButton::DpadDown) - { - curButton = buttons.value(JoyDPadButton::DpadDown); - curButton->joyEvent(true, ignoresets); - } - else if (value == JoyDPadButton::DpadLeft) - { - curButton = buttons.value(JoyDPadButton::DpadLeft); - curButton->joyEvent(true, ignoresets); - } - else if (value == JoyDPadButton::DpadRight) - { - curButton = buttons.value(JoyDPadButton::DpadRight); - curButton->joyEvent(true, ignoresets); - } - } - else if (currentMode == FourWayCardinal) - { - if ((value == JoyDPadButton::DpadUp) || - (value == JoyDPadButton::DpadRightUp)) - { - curButton = buttons.value(JoyDPadButton::DpadUp); - curButton->joyEvent(true, ignoresets); - } - else if ((value == JoyDPadButton::DpadDown) || - (value == JoyDPadButton::DpadLeftDown)) - { - curButton = buttons.value(JoyDPadButton::DpadDown); - curButton->joyEvent(true, ignoresets); - } - else if ((value == JoyDPadButton::DpadLeft) || - (value == JoyDPadButton::DpadLeftUp)) - { - curButton = buttons.value(JoyDPadButton::DpadLeft); - curButton->joyEvent(true, ignoresets); - } - else if ((value == JoyDPadButton::DpadRight) || - (value == JoyDPadButton::DpadRightDown)) - { - curButton = buttons.value(JoyDPadButton::DpadRight); - curButton->joyEvent(true, ignoresets); - } - } - else if (currentMode == FourWayDiagonal) - { - if (value == JoyDPadButton::DpadLeftUp) - { - activeDiagonalButton = buttons.value(JoyDPadButton::DpadLeftUp); - activeDiagonalButton->joyEvent(true, ignoresets); + if ((value & JoyDPadButton::DpadLeft) && (!(prevDirection & JoyDPadButton::DpadLeft))) + { + curButton = buttons.value(JoyDPadButton::DpadLeft); + curButton->joyEvent(true, ignoresets); + } + + if ((value & JoyDPadButton::DpadRight) && (!(prevDirection & JoyDPadButton::DpadRight))) + { + curButton = buttons.value(JoyDPadButton::DpadRight); + curButton->joyEvent(true, ignoresets); + } + + break; } - else if (value == JoyDPadButton::DpadRightUp) + case EightWayMode: { - activeDiagonalButton = buttons.value(JoyDPadButton::DpadRightUp); - activeDiagonalButton->joyEvent(true, ignoresets); + switch(value) + { + + case JoyDPadButton::DpadLeftUp: + { + activeDiagonalButton = buttons.value(JoyDPadButton::DpadLeftUp); + activeDiagonalButton->joyEvent(true, ignoresets); + + break; + } + case JoyDPadButton::DpadRightUp: + { + activeDiagonalButton = buttons.value(JoyDPadButton::DpadRightUp); + activeDiagonalButton->joyEvent(true, ignoresets); + + break; + } + case JoyDPadButton::DpadRightDown: + { + activeDiagonalButton = buttons.value(JoyDPadButton::DpadRightDown); + activeDiagonalButton->joyEvent(true, ignoresets); + + break; + } + case JoyDPadButton::DpadLeftDown: + { + activeDiagonalButton = buttons.value(JoyDPadButton::DpadLeftDown); + activeDiagonalButton->joyEvent(true, ignoresets); + + break; + } + case JoyDPadButton::DpadUp: + { + curButton = buttons.value(JoyDPadButton::DpadUp); + curButton->joyEvent(true, ignoresets); + + break; + } + case JoyDPadButton::DpadDown: + { + curButton = buttons.value(JoyDPadButton::DpadDown); + curButton->joyEvent(true, ignoresets); + + break; + } + case JoyDPadButton::DpadLeft: + { + curButton = buttons.value(JoyDPadButton::DpadLeft); + curButton->joyEvent(true, ignoresets); + + break; + } + case JoyDPadButton::DpadRight: + { + curButton = buttons.value(JoyDPadButton::DpadRight); + curButton->joyEvent(true, ignoresets); + + break; + } + + } + + break; } - else if (value == JoyDPadButton::DpadRightDown) + case FourWayCardinal: { - activeDiagonalButton = buttons.value(JoyDPadButton::DpadRightDown); - activeDiagonalButton->joyEvent(true, ignoresets); + if ((value == JoyDPadButton::DpadUp) || + (value == JoyDPadButton::DpadRightUp)) + { + curButton = buttons.value(JoyDPadButton::DpadUp); + curButton->joyEvent(true, ignoresets); + } + else if ((value == JoyDPadButton::DpadDown) || + (value == JoyDPadButton::DpadLeftDown)) + { + curButton = buttons.value(JoyDPadButton::DpadDown); + curButton->joyEvent(true, ignoresets); + } + else if ((value == JoyDPadButton::DpadLeft) || + (value == JoyDPadButton::DpadLeftUp)) + { + curButton = buttons.value(JoyDPadButton::DpadLeft); + curButton->joyEvent(true, ignoresets); + } + else if ((value == JoyDPadButton::DpadRight) || + (value == JoyDPadButton::DpadRightDown)) + { + curButton = buttons.value(JoyDPadButton::DpadRight); + curButton->joyEvent(true, ignoresets); + } + + break; } - else if (value == JoyDPadButton::DpadLeftDown) + case FourWayDiagonal: { - activeDiagonalButton = buttons.value(JoyDPadButton::DpadLeftDown); - activeDiagonalButton->joyEvent(true, ignoresets); + switch(value) + { + case JoyDPadButton::DpadLeftUp: + { + activeDiagonalButton = buttons.value(JoyDPadButton::DpadLeftUp); + activeDiagonalButton->joyEvent(true, ignoresets); + + break; + } + case JoyDPadButton::DpadRightUp: + { + activeDiagonalButton = buttons.value(JoyDPadButton::DpadRightUp); + activeDiagonalButton->joyEvent(true, ignoresets); + + break; + } + case JoyDPadButton::DpadRightDown: + { + activeDiagonalButton = buttons.value(JoyDPadButton::DpadRightDown); + activeDiagonalButton->joyEvent(true, ignoresets); + + break; + } + case JoyDPadButton::DpadLeftDown: + { + activeDiagonalButton = buttons.value(JoyDPadButton::DpadLeftDown); + activeDiagonalButton->joyEvent(true, ignoresets); + + break; + } + } + + break; } + } prevDirection = pendingDirection; @@ -1173,7 +1216,7 @@ double JoyDPad::getButtonsEasingDuration() { qInstallMessageHandler(MessageHandler::myMessageOutput); - double result = JoyButton::DEFAULTEASINGDURATION; + double result = GlobalVariables::JoyButton::DEFAULTEASINGDURATION; QHash temphash = getApplicableButtons(); QHashIterator iter(temphash); @@ -1188,9 +1231,9 @@ double JoyDPad::getButtonsEasingDuration() { JoyDPadButton *button = iter.next().value(); double temp = button->getEasingDuration(); - if (qFuzzyCompare(temp, result)) + if (!qFuzzyCompare(temp, result)) { - result = JoyButton::DEFAULTEASINGDURATION; + result = GlobalVariables::JoyButton::DEFAULTEASINGDURATION; iter.toBack(); } } @@ -1216,7 +1259,7 @@ int JoyDPad::getButtonsSpringDeadCircleMultiplier() { qInstallMessageHandler(MessageHandler::myMessageOutput); - int result = JoyButton::DEFAULTSPRINGRELEASERADIUS; + int result = GlobalVariables::JoyButton::DEFAULTSPRINGRELEASERADIUS; QHash temphash = getApplicableButtons(); QHashIterator iter(temphash); @@ -1233,7 +1276,7 @@ int JoyDPad::getButtonsSpringDeadCircleMultiplier() int temp = button->getSpringDeadCircleMultiplier(); if (temp != result) { - result = JoyButton::DEFAULTSPRINGRELEASERADIUS; + result = GlobalVariables::JoyButton::DEFAULTSPRINGRELEASERADIUS; iter.toBack(); } } @@ -1290,54 +1333,68 @@ QHash JoyDPad::getDirectionButtons(JoyDPadButton::JoyDPadDi qInstallMessageHandler(MessageHandler::myMessageOutput); QHash temphash; - if (currentMode == StandardMode) + + switch(currentMode) { - if (direction & JoyDPadButton::DpadUp) - { - temphash.insert(JoyDPadButton::DpadUp, buttons.value(JoyDPadButton::DpadUp)); - } - if (direction & JoyDPadButton::DpadDown) + case StandardMode: { - temphash.insert(JoyDPadButton::DpadDown, buttons.value(JoyDPadButton::DpadDown)); - } + if (direction & JoyDPadButton::DpadUp) + { + temphash.insert(JoyDPadButton::DpadUp, buttons.value(JoyDPadButton::DpadUp)); + } - if (direction & JoyDPadButton::DpadLeft) - { - temphash.insert(JoyDPadButton::DpadLeft, buttons.value(JoyDPadButton::DpadLeft)); - } + if (direction & JoyDPadButton::DpadDown) + { + temphash.insert(JoyDPadButton::DpadDown, buttons.value(JoyDPadButton::DpadDown)); + } - if (direction & JoyDPadButton::DpadRight) - { - temphash.insert(JoyDPadButton::DpadRight, buttons.value(JoyDPadButton::DpadRight)); + if (direction & JoyDPadButton::DpadLeft) + { + temphash.insert(JoyDPadButton::DpadLeft, buttons.value(JoyDPadButton::DpadLeft)); + } + + if (direction & JoyDPadButton::DpadRight) + { + temphash.insert(JoyDPadButton::DpadRight, buttons.value(JoyDPadButton::DpadRight)); + } + + break; } - } - else if (currentMode == EightWayMode) - { - if (direction != JoyDPadButton::DpadCentered) + case EightWayMode: { - temphash.insert(direction, buttons.value(direction)); + if (direction != JoyDPadButton::DpadCentered) + { + temphash.insert(direction, buttons.value(direction)); + } + + break; } - } - else if (currentMode == FourWayCardinal) - { - if ((direction == JoyDPadButton::DpadUp) || - (direction == JoyDPadButton::DpadDown) || - (direction == JoyDPadButton::DpadLeft) || - (direction == JoyDPadButton::DpadRight)) + case FourWayCardinal: { - temphash.insert(direction, buttons.value(direction)); + if ((direction == JoyDPadButton::DpadUp) || + (direction == JoyDPadButton::DpadDown) || + (direction == JoyDPadButton::DpadLeft) || + (direction == JoyDPadButton::DpadRight)) + { + temphash.insert(direction, buttons.value(direction)); + } + + break; } - } - else if (currentMode == FourWayDiagonal) - { - if ((direction == JoyDPadButton::DpadRightUp) || - (direction == JoyDPadButton::DpadRightDown) || - (direction == JoyDPadButton::DpadLeftDown) || - (direction == JoyDPadButton::DpadLeftUp)) + case FourWayDiagonal: { - temphash.insert(direction, buttons.value(direction)); + if ((direction == JoyDPadButton::DpadRightUp) || + (direction == JoyDPadButton::DpadRightDown) || + (direction == JoyDPadButton::DpadLeftDown) || + (direction == JoyDPadButton::DpadLeftUp)) + { + temphash.insert(direction, buttons.value(direction)); + } + + break; } + } return temphash; diff --git a/src/joydpad.h b/src/joydpad.h old mode 100644 new mode 100755 index cba48d36d..afdf9ec5b --- a/src/joydpad.h +++ b/src/joydpad.h @@ -39,7 +39,7 @@ class JoyDPad : public QObject enum JoyMode {StandardMode=0, EightWayMode, FourWayCardinal, FourWayDiagonal}; - JoyDPadButton* getJoyButton(int index); + JoyDPadButton* getJoyButton(int index_local); QHash* getJoyButtons(); int getCurrentDirection(); @@ -116,9 +116,6 @@ class JoyDPad : public QObject virtual void eventReset(); - static const QString xmlName; - static const int DEFAULTDPADDELAY; // unsigned - signals: void active(int value); void released(int value); @@ -154,12 +151,12 @@ private slots: QString dpadName; QString defaultDPadName; - SetJoystick *parentSet; + SetJoystick *m_parentSet; QTimer directionDelayTimer; JoyMode currentMode; - int index; - int originset; + int m_index; + int m_originset; int dpadDelay; // unsigned int pendingEventDirection; diff --git a/src/joydpadbuttonwidget.cpp b/src/joydpadbuttonwidget.cpp old mode 100644 new mode 100755 index 43bd40ef8..a3129a671 --- a/src/joydpadbuttonwidget.cpp +++ b/src/joydpadbuttonwidget.cpp @@ -23,7 +23,6 @@ #include #include - JoyDPadButtonWidget::JoyDPadButtonWidget(JoyButton *button, bool displayNames, QWidget *parent) : JoyButtonWidget(button, displayNames, parent) { diff --git a/src/joydpadbuttonwidget.h b/src/joydpadbuttonwidget.h old mode 100644 new mode 100755 index bb2207de7..f0d5cef4b --- a/src/joydpadbuttonwidget.h +++ b/src/joydpadbuttonwidget.h @@ -31,7 +31,7 @@ class JoyDPadButtonWidget : public JoyButtonWidget explicit JoyDPadButtonWidget(JoyButton* button, bool displayNames, QWidget *parent = nullptr); protected: - virtual QString generateLabel(); + virtual QString generateLabel() override; }; diff --git a/src/joykeyrepeathelper.cpp b/src/joykeyrepeathelper.cpp old mode 100644 new mode 100755 diff --git a/src/joykeyrepeathelper.h b/src/joykeyrepeathelper.h old mode 100644 new mode 100755 diff --git a/src/joystick.cpp b/src/joystick.cpp old mode 100644 new mode 100755 index a8fefc14b..920e9b47d --- a/src/joystick.cpp +++ b/src/joystick.cpp @@ -17,6 +17,7 @@ #include "joystick.h" +#include "globalvariables.h" #include "messagehandler.h" #include "antimicrosettings.h" @@ -24,7 +25,6 @@ #include #include -const QString Joystick::xmlName = "joystick"; Joystick::Joystick(SDL_Joystick *joyhandle, int deviceIndex, @@ -33,11 +33,11 @@ Joystick::Joystick(SDL_Joystick *joyhandle, int deviceIndex, { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->joyhandle = joyhandle; + m_joyhandle = joyhandle; joystickID = SDL_JoystickInstanceID(joyhandle); - for (int i = 0; i < NUMBER_JOYSETS; i++) + for (int i = 0; i < GlobalVariables::InputDevice::NUMBER_JOYSETS; i++) { SetJoystick *setstick = new SetJoystick(this, i, this); getJoystick_sets().insert(i, setstick); @@ -58,9 +58,9 @@ QString Joystick::getSDLName() QString temp = QString(); - if (joyhandle != nullptr) + if (m_joyhandle != nullptr) { - temp = SDL_JoystickName(joyhandle); + temp = SDL_JoystickName(m_joyhandle); } return temp; @@ -72,7 +72,7 @@ QString Joystick::getGUIDString() QString temp = QString(); - SDL_JoystickGUID tempGUID = SDL_JoystickGetGUID(joyhandle); + SDL_JoystickGUID tempGUID = SDL_JoystickGetGUID(m_joyhandle); char guidString[65] = {'0'}; SDL_JoystickGetGUIDString(tempGUID, guidString, sizeof(guidString)); temp = QString(guidString); @@ -85,16 +85,16 @@ QString Joystick::getXmlName() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->xmlName; + return GlobalVariables::Joystick::xmlName; } void Joystick::closeSDLDevice() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((joyhandle != nullptr) && SDL_JoystickGetAttached(joyhandle)) + if ((m_joyhandle != nullptr) && SDL_JoystickGetAttached(m_joyhandle)) { - SDL_JoystickClose(joyhandle); + SDL_JoystickClose(m_joyhandle); } } @@ -102,7 +102,7 @@ int Joystick::getNumberRawButtons() { qInstallMessageHandler(MessageHandler::myMessageOutput); - int numbuttons = SDL_JoystickNumButtons(joyhandle); + int numbuttons = SDL_JoystickNumButtons(m_joyhandle); return numbuttons; } @@ -110,7 +110,7 @@ int Joystick::getNumberRawAxes() { qInstallMessageHandler(MessageHandler::myMessageOutput); - int numaxes = SDL_JoystickNumAxes(joyhandle); + int numaxes = SDL_JoystickNumAxes(m_joyhandle); return numaxes; } @@ -118,7 +118,7 @@ int Joystick::getNumberRawHats() { qInstallMessageHandler(MessageHandler::myMessageOutput); - int numhats = SDL_JoystickNumHats(joyhandle); + int numhats = SDL_JoystickNumHats(m_joyhandle); return numhats; } @@ -131,5 +131,5 @@ SDL_JoystickID Joystick::getSDLJoystickID() SDL_Joystick* Joystick::getJoyhandle() const { - return joyhandle; + return m_joyhandle; } diff --git a/src/joystick.h b/src/joystick.h old mode 100644 new mode 100755 index d9332876a..ebe6c2f71 --- a/src/joystick.h +++ b/src/joystick.h @@ -31,23 +31,21 @@ class Joystick : public InputDevice public: explicit Joystick(SDL_Joystick *joyhandle, int deviceIndex, AntiMicroSettings *settings, QObject *parent=0); - virtual QString getName(); - virtual QString getSDLName(); - virtual QString getGUIDString(); // GUID available on SDL 2. - virtual QString getXmlName(); - virtual void closeSDLDevice(); - virtual SDL_JoystickID getSDLJoystickID(); + virtual QString getName() override; + virtual QString getSDLName() override; + virtual QString getGUIDString() override; // GUID available on SDL 2. + virtual QString getXmlName() override; + virtual void closeSDLDevice() override; + virtual SDL_JoystickID getSDLJoystickID() override; - virtual int getNumberRawButtons(); - virtual int getNumberRawAxes(); - virtual int getNumberRawHats(); + virtual int getNumberRawButtons() override; + virtual int getNumberRawAxes() override; + virtual int getNumberRawHats() override; SDL_Joystick* getJoyhandle() const; - static const QString xmlName; - private: - SDL_Joystick *joyhandle; + SDL_Joystick *m_joyhandle; SDL_JoystickID joystickID; }; diff --git a/src/joystickstatuswindow.cpp b/src/joystickstatuswindow.cpp old mode 100644 new mode 100755 index 179b80547..d52ffd7a3 --- a/src/joystickstatuswindow.cpp +++ b/src/joystickstatuswindow.cpp @@ -18,6 +18,7 @@ #include "joystickstatuswindow.h" #include "ui_joystickstatuswindow.h" +#include "globalvariables.h" #include "messagehandler.h" #include "joybuttonstatusbox.h" #include "inputdevice.h" @@ -74,8 +75,8 @@ JoystickStatusWindow::JoystickStatusWindow(InputDevice *joystick, QWidget *paren QLabel *axisLabel = new QLabel(); axisLabel->setText(trUtf8("Axis %1").arg(axis->getRealJoyIndex())); QProgressBar *axisBar = new QProgressBar(); - axisBar->setMinimum(JoyAxis::AXISMIN); - axisBar->setMaximum(JoyAxis::AXISMAX); + axisBar->setMinimum(GlobalVariables::JoyAxis::AXISMIN); + axisBar->setMaximum(GlobalVariables::JoyAxis::AXISMAX); axisBar->setFormat("%v"); axisBar->setValue(axis->getCurrentRawValue()); hbox->addWidget(axisLabel); diff --git a/src/joystickstatuswindow.h b/src/joystickstatuswindow.h old mode 100644 new mode 100755 diff --git a/src/joystickstatuswindow.ui b/src/joystickstatuswindow.ui old mode 100644 new mode 100755 diff --git a/src/joytabwidget.cpp b/src/joytabwidget.cpp old mode 100644 new mode 100755 index f72e923b7..42cab0514 --- a/src/joytabwidget.cpp +++ b/src/joytabwidget.cpp @@ -17,6 +17,7 @@ #include "joytabwidget.h" +#include "globalvariables.h" #include "messagehandler.h" #include "joyaxiswidget.h" #include "joybuttonwidget.h" @@ -69,8 +70,8 @@ JoyTabWidget::JoyTabWidget(InputDevice *joystick, AntiMicroSettings *settings, Q { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->joystick = joystick; - this->settings = settings; + m_joystick = joystick; + m_settings = settings; tabHelper.moveToThread(joystick->thread()); @@ -502,14 +503,14 @@ void JoyTabWidget::openConfigFileDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); - settings->getLock()->lock(); + m_settings->getLock()->lock(); - int numberRecentProfiles = settings->value("NumberRecentProfiles", DEFAULTNUMBERPROFILES).toInt(); - QString lookupDir = PadderCommon::preferredProfileDir(settings); + int numberRecentProfiles = m_settings->value("NumberRecentProfiles", DEFAULTNUMBERPROFILES).toInt(); + QString lookupDir = PadderCommon::preferredProfileDir(m_settings); QString filename = QFileDialog::getOpenFileName(this, trUtf8("Open Config"), lookupDir, trUtf8("Config Files (*.amgp *.xml)")); - settings->getLock()->unlock(); + m_settings->getLock()->unlock(); if (!filename.isNull() && !filename.isEmpty()) { @@ -525,13 +526,13 @@ void JoyTabWidget::openConfigFileDialog() configBox->insertItem(1, PadderCommon::getProfileName(fileinfo), fileinfo.absoluteFilePath()); configBox->setCurrentIndex(1); saveDeviceSettings(); - emit joystickConfigChanged(joystick->getJoyNumber()); + emit joystickConfigChanged(m_joystick->getJoyNumber()); } else { configBox->setCurrentIndex(searchIndex); saveDeviceSettings(); - emit joystickConfigChanged(joystick->getJoyNumber()); + emit joystickConfigChanged(m_joystick->getJoyNumber()); } QString outputFilename = fileinfo.absoluteDir().absolutePath(); @@ -548,12 +549,12 @@ void JoyTabWidget::openConfigFileDialog() } #endif - settings->getLock()->lock(); + m_settings->getLock()->lock(); - settings->setValue("LastProfileDir", outputFilename); - settings->sync(); + m_settings->setValue("LastProfileDir", outputFilename); + m_settings->sync(); - settings->getLock()->unlock(); + m_settings->getLock()->unlock(); } } @@ -565,12 +566,12 @@ void JoyTabWidget::fillButtons() { qInstallMessageHandler(MessageHandler::myMessageOutput); - joystick->establishPropertyUpdatedConnection(); - connect(joystick, &InputDevice::setChangeActivated, this, &JoyTabWidget::changeCurrentSet, Qt::QueuedConnection); + m_joystick->establishPropertyUpdatedConnection(); + connect(m_joystick, &InputDevice::setChangeActivated, this, &JoyTabWidget::changeCurrentSet, Qt::QueuedConnection); - for (int i=0; i < Joystick::NUMBER_JOYSETS; i++) + for (int i=0; i < GlobalVariables::InputDevice::NUMBER_JOYSETS; i++) { - SetJoystick *currentSet = joystick->getSetJoystick(i); + SetJoystick *currentSet = m_joystick->getSetJoystick(i); fillSetButtons(currentSet); } @@ -584,7 +585,7 @@ void JoyTabWidget::showButtonDialog() JoyButtonWidget *buttonWidget = qobject_cast(sender()); // static_cast JoyButton *button = buttonWidget->getJoyButton(); - ButtonEditDialog *dialog = new ButtonEditDialog(button, joystick, this); + ButtonEditDialog *dialog = new ButtonEditDialog(button, m_joystick, this); dialog->show(); } @@ -605,21 +606,21 @@ void JoyTabWidget::saveConfigFile() int index = configBox->currentIndex(); - settings->getLock()->lock(); + m_settings->getLock()->lock(); - int numberRecentProfiles = settings->value("NumberRecentProfiles", DEFAULTNUMBERPROFILES).toInt(); + int numberRecentProfiles = m_settings->value("NumberRecentProfiles", DEFAULTNUMBERPROFILES).toInt(); QString filename = QString(); if (index == 0) { - QString lookupDir = PadderCommon::preferredProfileDir(settings); - settings->getLock()->unlock(); - QString tempfilename = QFileDialog::getSaveFileName(this, trUtf8("Save Config"), lookupDir, trUtf8("Config File (*.%1.amgp)").arg(joystick->getXmlName())); + QString lookupDir = PadderCommon::preferredProfileDir(m_settings); + m_settings->getLock()->unlock(); + QString tempfilename = QFileDialog::getSaveFileName(this, trUtf8("Save Config"), lookupDir, trUtf8("Config File (*.%1.amgp)").arg(m_joystick->getXmlName())); if (!tempfilename.isEmpty()) { filename = tempfilename; QFileInfo fileinfo(filename); - QString deviceTypeName = joystick->getXmlName(); + QString deviceTypeName = m_joystick->getXmlName(); QString fileSuffix = deviceTypeName.append(".amgp"); if ((fileinfo.suffix() != "xml") && (fileinfo.suffix() != "amgp")) { @@ -629,7 +630,7 @@ void JoyTabWidget::saveConfigFile() } else { - settings->getLock()->unlock(); + m_settings->getLock()->unlock(); filename = configBox->itemData(index).toString(); } @@ -665,11 +666,11 @@ void JoyTabWidget::saveConfigFile() configBox->removeItem(numberRecentProfiles); } - joystick->revertProfileEdited(); + m_joystick->revertProfileEdited(); QString tempProfileName = PadderCommon::getProfileName(fileinfo); - if (!joystick->getProfileName().isEmpty()) + if (!m_joystick->getProfileName().isEmpty()) { - oldProfileName = joystick->getProfileName(); + oldProfileName = m_joystick->getProfileName(); tempProfileName = oldProfileName; } @@ -684,20 +685,20 @@ void JoyTabWidget::saveConfigFile() configBox->setCurrentIndex(1); saveDeviceSettings(true); - emit joystickConfigChanged(joystick->getJoyNumber()); + emit joystickConfigChanged(m_joystick->getJoyNumber()); } else { - joystick->revertProfileEdited(); - if (!joystick->getProfileName().isEmpty()) + m_joystick->revertProfileEdited(); + if (!m_joystick->getProfileName().isEmpty()) { - oldProfileName = joystick->getProfileName(); + oldProfileName = m_joystick->getProfileName(); } configBox->setItemIcon(existingIndex, QIcon()); saveDeviceSettings(true); - emit joystickConfigChanged(joystick->getJoyNumber()); + emit joystickConfigChanged(m_joystick->getJoyNumber()); } } } @@ -707,65 +708,73 @@ void JoyTabWidget::resetJoystick() { qInstallMessageHandler(MessageHandler::myMessageOutput); - int currentIndex = configBox->currentIndex(); - if (currentIndex != 0) - { - QString filename = configBox->itemData(currentIndex).toString(); + QMessageBox msg; + msg.setStandardButtons(QMessageBox::Yes | QMessageBox::No); + msg.setText(trUtf8("Do you really want to reset buttons settings for joystick?")); + int result = msg.exec(); - removeCurrentButtons(); + if (result == QMessageBox::Yes) { - QMetaObject::invokeMethod(&tabHelper, "readConfigFileWithRevert", Qt::BlockingQueuedConnection, - Q_ARG(QString, filename)); + int currentIndex = configBox->currentIndex(); + if (currentIndex != 0) + { + QString filename = configBox->itemData(currentIndex).toString(); - fillButtons(); - refreshSetButtons(); - refreshCopySetActions(); + removeCurrentButtons(); - XMLConfigReader *reader = tabHelper.getReader(); - if (!reader->hasError()) - { - configBox->setItemIcon(currentIndex, QIcon()); + QMetaObject::invokeMethod(&tabHelper, "reInitDevice", Qt::BlockingQueuedConnection); + + fillButtons(); + refreshSetButtons(); + refreshCopySetActions(); - QString tempProfileName = QString(); - if (!joystick->getProfileName().isEmpty()) + XMLConfigReader *reader = tabHelper.getReader(); + if (!reader->hasError()) { - tempProfileName = joystick->getProfileName(); - configBox->setItemText(currentIndex, tempProfileName); + configBox->setItemIcon(currentIndex, QIcon()); + + QString tempProfileName = QString(); + + if (!m_joystick->getProfileName().isEmpty()) + { + tempProfileName = m_joystick->getProfileName(); + configBox->setItemText(currentIndex, tempProfileName); + } + else + { + tempProfileName = oldProfileName; + configBox->setItemText(currentIndex, oldProfileName); + } + + oldProfileName = tempProfileName; } - else + else if (reader->hasError() && this->window()->isEnabled()) { - tempProfileName = oldProfileName; - configBox->setItemText(currentIndex, oldProfileName); + QMessageBox msg; + msg.setStandardButtons(QMessageBox::Close); + msg.setText(reader->getErrorString()); + msg.setModal(true); + msg.exec(); + } + else if (reader->hasError() && !this->window()->isEnabled()) + { + QTextStream error(stderr); + error << reader->getErrorString() << endl; } - - oldProfileName = tempProfileName; - } - else if (reader->hasError() && this->window()->isEnabled()) - { - QMessageBox msg; - msg.setStandardButtons(QMessageBox::Close); - msg.setText(reader->getErrorString()); - msg.setModal(true); - msg.exec(); } - else if (reader->hasError() && !this->window()->isEnabled()) + else { - QTextStream error(stderr); - error << reader->getErrorString() << endl; - } - } - else - { - configBox->setItemText(0, trUtf8("")); - configBox->setItemIcon(0, QIcon()); + configBox->setItemText(0, trUtf8("")); + configBox->setItemIcon(0, QIcon()); - removeCurrentButtons(); + removeCurrentButtons(); - QMetaObject::invokeMethod(&tabHelper, "reInitDevice", Qt::BlockingQueuedConnection); + QMetaObject::invokeMethod(&tabHelper, "reInitDevice", Qt::BlockingQueuedConnection); - fillButtons(); - refreshSetButtons(); - refreshCopySetActions(); + fillButtons(); + refreshSetButtons(); + refreshCopySetActions(); + } } } @@ -775,16 +784,16 @@ void JoyTabWidget::saveAsConfig() int index = configBox->currentIndex(); - settings->getLock()->lock(); + m_settings->getLock()->lock(); - int numberRecentProfiles = settings->value("NumberRecentProfiles", DEFAULTNUMBERPROFILES).toInt(); + int numberRecentProfiles = m_settings->value("NumberRecentProfiles", DEFAULTNUMBERPROFILES).toInt(); QString filename = QString(); if (index == 0) { - QString lookupDir = PadderCommon::preferredProfileDir(settings); - settings->getLock()->unlock(); + QString lookupDir = PadderCommon::preferredProfileDir(m_settings); + m_settings->getLock()->unlock(); - QString tempfilename = QFileDialog::getSaveFileName(this, trUtf8("Save Config"), lookupDir, trUtf8("Config File (*.%1.amgp)").arg(joystick->getXmlName())); + QString tempfilename = QFileDialog::getSaveFileName(this, trUtf8("Save Config"), lookupDir, trUtf8("Config File (*.%1.amgp)").arg(m_joystick->getXmlName())); if (!tempfilename.isEmpty()) { filename = tempfilename; @@ -792,11 +801,11 @@ void JoyTabWidget::saveAsConfig() } else { - settings->getLock()->unlock(); + m_settings->getLock()->unlock(); QString configPath = configBox->itemData(index).toString(); QFileInfo temp(configPath); - QString tempfilename = QFileDialog::getSaveFileName(this, trUtf8("Save Config"), temp.absoluteDir().absolutePath(), trUtf8("Config File (*.%1.amgp)").arg(joystick->getXmlName())); + QString tempfilename = QFileDialog::getSaveFileName(this, trUtf8("Save Config"), temp.absoluteDir().absolutePath(), trUtf8("Config File (*.%1.amgp)").arg(m_joystick->getXmlName())); if (!tempfilename.isEmpty()) { filename = tempfilename; @@ -806,7 +815,7 @@ void JoyTabWidget::saveAsConfig() if (!filename.isEmpty()) { QFileInfo fileinfo(filename); - QString deviceTypeName = joystick->getXmlName(); + QString deviceTypeName = m_joystick->getXmlName(); QString fileSuffix = deviceTypeName.append(".amgp"); if ((fileinfo.suffix() != "xml") && (fileinfo.suffix() != "amgp")) { @@ -844,11 +853,11 @@ void JoyTabWidget::saveAsConfig() configBox->removeItem(numberRecentProfiles); } - joystick->revertProfileEdited(); + m_joystick->revertProfileEdited(); QString tempProfileName = PadderCommon::getProfileName(fileinfo); - if (!joystick->getProfileName().isEmpty()) + if (!m_joystick->getProfileName().isEmpty()) { - oldProfileName = joystick->getProfileName(); + oldProfileName = m_joystick->getProfileName(); tempProfileName = oldProfileName; } @@ -859,19 +868,19 @@ void JoyTabWidget::saveAsConfig() configBox->setCurrentIndex(1); saveDeviceSettings(true); - emit joystickConfigChanged(joystick->getJoyNumber()); + emit joystickConfigChanged(m_joystick->getJoyNumber()); } else { - joystick->revertProfileEdited(); - if (!joystick->getProfileName().isEmpty()) + m_joystick->revertProfileEdited(); + if (!m_joystick->getProfileName().isEmpty()) { - oldProfileName = joystick->getProfileName(); + oldProfileName = m_joystick->getProfileName(); } configBox->setItemIcon(existingIndex, QIcon()); saveDeviceSettings(true); - emit joystickConfigChanged(joystick->getJoyNumber()); + emit joystickConfigChanged(m_joystick->getJoyNumber()); } } } @@ -881,7 +890,7 @@ void JoyTabWidget::changeJoyConfig(int index) { qInstallMessageHandler(MessageHandler::myMessageOutput); - disconnect(joystick, &InputDevice::profileUpdated, this, &JoyTabWidget::displayProfileEditNotification); + disconnect(m_joystick, &InputDevice::profileUpdated, this, &JoyTabWidget::displayProfileEditNotification); QString filename = QString(); if (index > 0) @@ -906,9 +915,9 @@ void JoyTabWidget::changeJoyConfig(int index) if (!reader->hasError()) { QString profileName = QString(); - if (!joystick->getProfileName().isEmpty()) + if (!m_joystick->getProfileName().isEmpty()) { - profileName = joystick->getProfileName(); + profileName = m_joystick->getProfileName(); oldProfileName = profileName; } else @@ -949,7 +958,7 @@ void JoyTabWidget::changeJoyConfig(int index) comboBoxIndex = index; - connect(joystick, &InputDevice::profileUpdated, this, &JoyTabWidget::displayProfileEditNotification); + connect(m_joystick, &InputDevice::profileUpdated, this, &JoyTabWidget::displayProfileEditNotification); } void JoyTabWidget::saveSettings() @@ -959,27 +968,27 @@ void JoyTabWidget::saveSettings() QString filename = ""; QString lastfile = ""; - settings->getLock()->lock(); + m_settings->getLock()->lock(); int index = configBox->currentIndex(); int currentjoy = 1; - QString identifier = joystick->getStringIdentifier(); + QString identifier = m_joystick->getStringIdentifier(); QString controlEntryPrefix = QString("Controller%1").arg(identifier); QString controlEntryString = QString("Controller%1ConfigFile%2").arg(identifier); QString controlEntryLastSelected = QString("Controller%1LastSelected").arg(identifier); - QString controlEntryProfileName = QString("Controller%1ProfileName%2").arg(joystick->getStringIdentifier()); + QString controlEntryProfileName = QString("Controller%1ProfileName%2").arg(m_joystick->getStringIdentifier()); // Remove current settings for a controller - QStringList tempkeys = settings->allKeys(); + QStringList tempkeys = m_settings->allKeys(); QStringListIterator iter(tempkeys); while (iter.hasNext()) { QString tempstring = iter.next(); if (!identifier.isEmpty() && tempstring.startsWith(controlEntryPrefix)) { - settings->remove(tempstring); + m_settings->remove(tempstring); } } @@ -1007,11 +1016,11 @@ void JoyTabWidget::saveSettings() } #endif - settings->setValue(controlEntryString.arg(currentjoy), outputFilename); + m_settings->setValue(controlEntryString.arg(currentjoy), outputFilename); if (PadderCommon::getProfileName(profileBaseFile) != profileText) { - settings->setValue(controlEntryProfileName.arg(currentjoy), profileText); + m_settings->setValue(controlEntryProfileName.arg(currentjoy), profileText); } } @@ -1047,11 +1056,11 @@ void JoyTabWidget::saveSettings() } } #endif - settings->setValue(controlEntryString.arg(currentjoy), outputFilename); + m_settings->setValue(controlEntryString.arg(currentjoy), outputFilename); if (PadderCommon::getProfileName(profileBaseFile) != profileText) { - settings->setValue(controlEntryProfileName.arg(currentjoy), profileText); + m_settings->setValue(controlEntryProfileName.arg(currentjoy), profileText); } } @@ -1078,10 +1087,10 @@ void JoyTabWidget::saveSettings() } #endif - settings->setValue(controlEntryLastSelected, outputFilename); + m_settings->setValue(controlEntryLastSelected, outputFilename); } - settings->getLock()->unlock(); + m_settings->getLock()->unlock(); } void JoyTabWidget::loadSettings(bool forceRefresh) @@ -1090,7 +1099,7 @@ void JoyTabWidget::loadSettings(bool forceRefresh) disconnect(configBox, static_cast(&QComboBox::currentIndexChanged), this, &JoyTabWidget::changeJoyConfig); - settings->getLock()->lock(); + m_settings->getLock()->lock(); if (configBox->count() > 1) { @@ -1103,29 +1112,30 @@ void JoyTabWidget::loadSettings(bool forceRefresh) configBox->setCurrentIndex(-1); } - int shouldisplaynames = settings->value("DisplayNames", "0").toInt(); + + int shouldisplaynames = m_settings->value("DisplayNames", "0").toInt(); if (shouldisplaynames == 1) { changeNameDisplay(shouldisplaynames); } - int numberRecentProfiles = settings->value("NumberRecentProfiles", DEFAULTNUMBERPROFILES).toInt(); - bool autoOpenLastProfile = settings->value("AutoOpenLastProfile", true).toBool(); + int numberRecentProfiles = m_settings->value("NumberRecentProfiles", DEFAULTNUMBERPROFILES).toInt(); + bool autoOpenLastProfile = m_settings->value("AutoOpenLastProfile", true).toBool(); - settings->beginGroup("Controllers"); + m_settings->beginGroup("Controllers"); - QString controlEntryString = QString("Controller%1ConfigFile%2").arg(joystick->getStringIdentifier()); - QString controlEntryLastSelected = QString("Controller%1LastSelected").arg(joystick->getStringIdentifier()); - QString controlEntryProfileName = QString("Controller%1ProfileName%2").arg(joystick->getStringIdentifier()); + QString controlEntryString = QString("Controller%1ConfigFile%2").arg(m_joystick->getStringIdentifier()); + QString controlEntryLastSelected = QString("Controller%1LastSelected").arg(m_joystick->getStringIdentifier()); + QString controlEntryProfileName = QString("Controller%1ProfileName%2").arg(m_joystick->getStringIdentifier()); bool finished = false; for (int i=1; !finished; i++) { QString tempfilepath = QString(); - if (!joystick->getStringIdentifier().isEmpty()) + if (!m_joystick->getStringIdentifier().isEmpty()) { - tempfilepath = settings->value(controlEntryString.arg(i), "").toString(); + tempfilepath = m_settings->value(controlEntryString.arg(i), "").toString(); } if (!tempfilepath.isEmpty()) @@ -1134,7 +1144,7 @@ void JoyTabWidget::loadSettings(bool forceRefresh) if (fileInfo.exists() && (configBox->findData(fileInfo.absoluteFilePath()) == -1)) { - QString profileName = settings->value(controlEntryProfileName.arg(i), "").toString(); + QString profileName = m_settings->value(controlEntryProfileName.arg(i), "").toString(); profileName = !profileName.isEmpty() ? profileName : PadderCommon::getProfileName(fileInfo); configBox->addItem(profileName, fileInfo.absoluteFilePath()); } @@ -1154,13 +1164,14 @@ void JoyTabWidget::loadSettings(bool forceRefresh) QString lastfile = QString(); - if (!joystick->getStringIdentifier().isEmpty() && autoOpenLastProfile) + if (!m_joystick->getStringIdentifier().isEmpty() && autoOpenLastProfile) { - lastfile = settings->value(controlEntryLastSelected, "").toString(); + lastfile = m_settings->value(controlEntryLastSelected, "").toString(); } - settings->endGroup(); - settings->getLock()->unlock(); + m_settings->endGroup(); + m_settings->getLock()->unlock(); + if (!lastfile.isEmpty()) { @@ -1175,18 +1186,19 @@ void JoyTabWidget::loadSettings(bool forceRefresh) if (lastindex > 0) { configBox->setCurrentIndex(lastindex); - emit joystickConfigChanged(joystick->getJoyNumber()); + emit joystickConfigChanged(m_joystick->getJoyNumber()); } else if (configBox->currentIndex() != 0) { configBox->setCurrentIndex(0); - emit joystickConfigChanged(joystick->getJoyNumber()); + emit joystickConfigChanged(m_joystick->getJoyNumber()); } + } else if (configBox->currentIndex() != 0) { configBox->setCurrentIndex(0); - emit joystickConfigChanged(joystick->getJoyNumber()); + emit joystickConfigChanged(m_joystick->getJoyNumber()); } } @@ -1263,7 +1275,7 @@ void JoyTabWidget::changeCurrentSet(int index) oldSetButton->style()->polish(oldSetButton); } - joystick->setActiveSetNumber(index); + m_joystick->setActiveSetNumber(index); stackedWidget_2->setCurrentIndex(index); switch (index) @@ -1347,7 +1359,7 @@ void JoyTabWidget::showStickAssignmentDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); - Joystick *temp = qobject_cast(joystick); // static_cast + Joystick *temp = qobject_cast(m_joystick); // static_cast AdvanceStickAssignmentDialog *dialog = new AdvanceStickAssignmentDialog(temp, this); connect(dialog, &AdvanceStickAssignmentDialog::finished, this, &JoyTabWidget::refreshButtons); dialog->show(); @@ -1359,9 +1371,9 @@ void JoyTabWidget::loadConfigFile(QString fileLocation) checkForUnsavedProfile(-1); - if (!joystick->isDeviceEdited()) + if (!m_joystick->isDeviceEdited()) { - int numberRecentProfiles = settings->value("NumberRecentProfiles", DEFAULTNUMBERPROFILES).toInt(); + int numberRecentProfiles = m_settings->value("NumberRecentProfiles", DEFAULTNUMBERPROFILES).toInt(); QFileInfo fileinfo(fileLocation); if (fileinfo.exists() && ((fileinfo.suffix() == "xml") || (fileinfo.suffix() == "amgp"))) { @@ -1382,12 +1394,12 @@ void JoyTabWidget::loadConfigFile(QString fileLocation) reconnectMainComboBoxEvents(); configBox->setCurrentIndex(1); - emit joystickConfigChanged(joystick->getJoyNumber()); + emit joystickConfigChanged(m_joystick->getJoyNumber()); } else if (searchIndex != configBox->currentIndex()) { configBox->setCurrentIndex(searchIndex); - emit joystickConfigChanged(joystick->getJoyNumber()); + emit joystickConfigChanged(m_joystick->getJoyNumber()); } } } @@ -1397,7 +1409,7 @@ void JoyTabWidget::showQuickSetDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); - ButtonEditDialog *dialog = new ButtonEditDialog(joystick, this); + ButtonEditDialog *dialog = new ButtonEditDialog(m_joystick, this); connect(dialog, &ButtonEditDialog::finished, this, &JoyTabWidget::refreshButtons); dialog->show(); } @@ -1406,7 +1418,7 @@ void JoyTabWidget::showKeyDelayDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); - ExtraProfileSettingsDialog *dialog = new ExtraProfileSettingsDialog(joystick, this); + ExtraProfileSettingsDialog *dialog = new ExtraProfileSettingsDialog(m_joystick, this); dialog->show(); } @@ -1414,7 +1426,7 @@ void JoyTabWidget::showSetNamesDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); - SetNamesDialog *dialog = new SetNamesDialog(joystick, this); + SetNamesDialog *dialog = new SetNamesDialog(m_joystick, this); connect(dialog, &SetNamesDialog::accepted, this, &JoyTabWidget::refreshSetButtons); connect(dialog, &SetNamesDialog::accepted, this, &JoyTabWidget::refreshCopySetActions); dialog->show(); @@ -1424,12 +1436,12 @@ void JoyTabWidget::removeCurrentButtons() { qInstallMessageHandler(MessageHandler::myMessageOutput); - joystick->disconnectPropertyUpdatedConnection(); - disconnect(joystick, &InputDevice::setChangeActivated, this, &JoyTabWidget::changeCurrentSet); + m_joystick->disconnectPropertyUpdatedConnection(); + disconnect(m_joystick, &InputDevice::setChangeActivated, this, &JoyTabWidget::changeCurrentSet); - for (int i=0; i < Joystick::NUMBER_JOYSETS; i++) + for (int i=0; i < GlobalVariables::InputDevice::NUMBER_JOYSETS; i++) { - SetJoystick *currentSet = joystick->getSetJoystick(i); + SetJoystick *currentSet = m_joystick->getSetJoystick(i); removeSetButtons(currentSet); } } @@ -1438,7 +1450,7 @@ InputDevice *JoyTabWidget::getJoystick() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return joystick; + return m_joystick; } void JoyTabWidget::removeConfig() @@ -1450,7 +1462,7 @@ void JoyTabWidget::removeConfig() { configBox->removeItem(currentIndex); saveDeviceSettings(true); - emit joystickConfigChanged(joystick->getJoyNumber()); + emit joystickConfigChanged(m_joystick->getJoyNumber()); } } @@ -1476,19 +1488,19 @@ void JoyTabWidget::saveDeviceSettings(bool sync) { qInstallMessageHandler(MessageHandler::myMessageOutput); - settings->getLock()->lock(); - settings->beginGroup("Controllers"); - settings->getLock()->unlock(); + m_settings->getLock()->lock(); + m_settings->beginGroup("Controllers"); + m_settings->getLock()->unlock(); saveSettings(); - settings->getLock()->lock(); - settings->endGroup(); + m_settings->getLock()->lock(); + m_settings->endGroup(); if (sync) { - settings->sync(); + m_settings->sync(); } - settings->getLock()->unlock(); + m_settings->getLock()->unlock(); } void JoyTabWidget::loadDeviceSettings() @@ -1519,11 +1531,11 @@ void JoyTabWidget::refreshSetButtons() { qInstallMessageHandler(MessageHandler::myMessageOutput); - for (int i = 0; i < InputDevice::NUMBER_JOYSETS; i++) + for (int i = 0; i < GlobalVariables::InputDevice::NUMBER_JOYSETS; i++) { QPushButton *tempSetButton = nullptr; QAction *tempSetAction = nullptr; - SetJoystick *tempSet = joystick->getSetJoystick(i); + SetJoystick *tempSet = m_joystick->getSetJoystick(i); switch (i) { case 0: @@ -1558,6 +1570,8 @@ void JoyTabWidget::refreshSetButtons() tempSetButton = setPushButton8; tempSetAction = setAction8; break; + default: + break; } if (!tempSet->getName().isEmpty()) @@ -1651,7 +1665,7 @@ void JoyTabWidget::checkForUnsavedProfile(int newindex) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (joystick->isDeviceEdited()) + if (m_joystick->isDeviceEdited()) { disconnectCheckUnsavedEvent(); disconnectMainComboBoxEvents(); @@ -1675,34 +1689,48 @@ void JoyTabWidget::checkForUnsavedProfile(int newindex) } int status = msg.exec(); - if (status == QMessageBox::Save) + + switch(status) { - saveConfigFile(); - reconnectCheckUnsavedEvent(); - reconnectMainComboBoxEvents(); - if (newindex > -1) + + case QMessageBox::Save: { - configBox->setCurrentIndex(newindex); + saveConfigFile(); + reconnectCheckUnsavedEvent(); + reconnectMainComboBoxEvents(); + + if (newindex > -1) + { + configBox->setCurrentIndex(newindex); + } + + break; + } + case QMessageBox::Discard: + { + m_joystick->revertProfileEdited(); + configBox->setItemText(comboBoxIndex, oldProfileName); + reconnectCheckUnsavedEvent(); + reconnectMainComboBoxEvents(); - } - else if (status == QMessageBox::Discard) - { - joystick->revertProfileEdited(); - configBox->setItemText(comboBoxIndex, oldProfileName); - reconnectCheckUnsavedEvent(); - reconnectMainComboBoxEvents(); - if (newindex > -1) + if (newindex > -1) + { + configBox->setCurrentIndex(newindex); + } + + break; + + } + case QMessageBox::Cancel: { - configBox->setCurrentIndex(newindex); + reconnectCheckUnsavedEvent(); + reconnectMainComboBoxEvents(); + + break; } } - else if (status == QMessageBox::Cancel) - { - reconnectCheckUnsavedEvent(); - reconnectMainComboBoxEvents(); - } } } @@ -1712,7 +1740,7 @@ bool JoyTabWidget::discardUnsavedProfileChanges() bool discarded = true; - if (joystick->isDeviceEdited()) + if (m_joystick->isDeviceEdited()) { disconnectCheckUnsavedEvent(); @@ -1731,23 +1759,34 @@ bool JoyTabWidget::discardUnsavedProfileChanges() } int status = msg.exec(); - if (status == QMessageBox::Save) + + switch(status) { - saveConfigFile(); - if ((currentIndex == 0) && (currentIndex == configBox->currentIndex())) + + case QMessageBox::Save: + { + saveConfigFile(); + if ((currentIndex == 0) && (currentIndex == configBox->currentIndex())) + { + discarded = false; + } + + break; + } + case QMessageBox::Discard: + { + m_joystick->revertProfileEdited(); + configBox->setItemText(currentIndex, oldProfileName); + resetJoystick(); + + break; + } + case QMessageBox::Cancel: { discarded = false; + break; } - } - else if (status == QMessageBox::Discard) - { - joystick->revertProfileEdited(); - configBox->setItemText(currentIndex, oldProfileName); - resetJoystick(); - } - else if (status == QMessageBox::Cancel) - { - discarded = false; + } disconnectMainComboBoxEvents(); @@ -1764,7 +1803,7 @@ void JoyTabWidget::disconnectMainComboBoxEvents() disconnect(configBox, static_cast(&QComboBox::currentIndexChanged), this, &JoyTabWidget::changeJoyConfig); disconnect(configBox, static_cast(&QComboBox::currentIndexChanged), this, &JoyTabWidget::removeProfileEditNotification); - disconnect(joystick, &InputDevice::profileNameEdited, this, &JoyTabWidget::editCurrentProfileItemText); + disconnect(m_joystick, &InputDevice::profileNameEdited, this, &JoyTabWidget::editCurrentProfileItemText); } void JoyTabWidget::reconnectMainComboBoxEvents() @@ -1773,7 +1812,7 @@ void JoyTabWidget::reconnectMainComboBoxEvents() connect(configBox, static_cast(&QComboBox::currentIndexChanged), this, &JoyTabWidget::changeJoyConfig, Qt::QueuedConnection); connect(configBox, static_cast(&QComboBox::currentIndexChanged), this, &JoyTabWidget::removeProfileEditNotification, Qt::QueuedConnection); - connect(joystick, &InputDevice::profileNameEdited, this, &JoyTabWidget::editCurrentProfileItemText); + connect(m_joystick, &InputDevice::profileNameEdited, this, &JoyTabWidget::editCurrentProfileItemText); } void JoyTabWidget::disconnectCheckUnsavedEvent() @@ -1806,7 +1845,7 @@ void JoyTabWidget::checkStickDisplay() JoyControlStick *stick = button->getStick(); if ((stick != nullptr) && stick->hasSlotsAssigned()) { - SetJoystick *currentSet = joystick->getActiveSetJoystick(); + SetJoystick *currentSet = m_joystick->getActiveSetJoystick(); removeSetButtons(currentSet); fillSetButtons(currentSet); } @@ -1820,7 +1859,7 @@ void JoyTabWidget::checkDPadButtonDisplay() JoyDPad *dpad = button->getDPad(); if ((dpad != nullptr) && dpad->hasSlotsAssigned()) { - SetJoystick *currentSet = joystick->getActiveSetJoystick(); + SetJoystick *currentSet = m_joystick->getActiveSetJoystick(); removeSetButtons(currentSet); fillSetButtons(currentSet); } @@ -1833,7 +1872,7 @@ void JoyTabWidget::checkAxisButtonDisplay() JoyAxisButton *button = qobject_cast(sender()); // static_cast if (button->getAssignedSlots()->count() > 0) { - SetJoystick *currentSet = joystick->getActiveSetJoystick(); + SetJoystick *currentSet = m_joystick->getActiveSetJoystick(); removeSetButtons(currentSet); fillSetButtons(currentSet); } @@ -1846,7 +1885,7 @@ void JoyTabWidget::checkButtonDisplay() JoyButton *button = qobject_cast(sender()); // static_cast if (button->getAssignedSlots()->count() > 0) { - SetJoystick *currentSet = joystick->getActiveSetJoystick(); + SetJoystick *currentSet = m_joystick->getActiveSetJoystick(); removeSetButtons(currentSet); fillSetButtons(currentSet); } @@ -1862,7 +1901,7 @@ void JoyTabWidget::checkStickEmptyDisplay() //JoyControlStick *stick = button->getStick(); if ((stick != nullptr) && !stick->hasSlotsAssigned()) { - SetJoystick *currentSet = joystick->getActiveSetJoystick(); + SetJoystick *currentSet = m_joystick->getActiveSetJoystick(); removeSetButtons(currentSet); fillSetButtons(currentSet); } @@ -1878,7 +1917,7 @@ void JoyTabWidget::checkDPadButtonEmptyDisplay() //JoyDPad *dpad = button->getDPad(); if ((dpad != nullptr) && !dpad->hasSlotsAssigned()) { - SetJoystick *currentSet = joystick->getActiveSetJoystick(); + SetJoystick *currentSet = m_joystick->getActiveSetJoystick(); removeSetButtons(currentSet); fillSetButtons(currentSet); } @@ -1891,7 +1930,7 @@ void JoyTabWidget::checkAxisButtonEmptyDisplay() JoyAxisButton *button = qobject_cast(sender()); // static_cast if (button->getAssignedSlots()->count() == 0) { - SetJoystick *currentSet = joystick->getActiveSetJoystick(); + SetJoystick *currentSet = m_joystick->getActiveSetJoystick(); removeSetButtons(currentSet); fillSetButtons(currentSet); } @@ -1904,7 +1943,7 @@ void JoyTabWidget::checkButtonEmptyDisplay() JoyButton *button = qobject_cast(sender()); // static_cast if (button->getAssignedSlots()->count() == 0) { - SetJoystick *currentSet = joystick->getActiveSetJoystick(); + SetJoystick *currentSet = m_joystick->getActiveSetJoystick(); removeSetButtons(currentSet); fillSetButtons(currentSet); } @@ -1914,7 +1953,7 @@ void JoyTabWidget::checkHideEmptyOption() { qInstallMessageHandler(MessageHandler::myMessageOutput); - bool currentHideEmptyButtons = settings->value("HideEmptyButtons", false).toBool(); + bool currentHideEmptyButtons = m_settings->value("HideEmptyButtons", false).toBool(); if (currentHideEmptyButtons != hideEmptyButtons) { hideEmptyButtons = currentHideEmptyButtons; @@ -1985,7 +2024,7 @@ void JoyTabWidget::fillSetButtons(SetJoystick *set) int stickGridColumn = 0; int stickGridRow = 0; - for (int j=0; j < joystick->getNumberSticks(); j++) + for (int j=0; j < m_joystick->getNumberSticks(); j++) { JoyControlStick *stick = currentSet->getJoyStick(j); stick->establishPropertyUpdatedConnection(); @@ -2053,7 +2092,7 @@ void JoyTabWidget::fillSetButtons(SetJoystick *set) QGroupBox *hatGroup = nullptr; int hatGridColumn = 0; int hatGridRow = 0; - for (int j = 0; j < joystick->getNumberHats(); j++) + for (int j = 0; j < m_joystick->getNumberHats(); j++) { JoyDPad *dpad = currentSet->getJoyDPad(j); dpad->establishPropertyUpdatedConnection(); @@ -2104,7 +2143,7 @@ void JoyTabWidget::fillSetButtons(SetJoystick *set) } } - for (int j = 0; j < joystick->getNumberVDPads(); j++) + for (int j = 0; j < m_joystick->getNumberVDPads(); j++) { VDPad *vdpad = currentSet->getVDPad(j); vdpad->establishPropertyUpdatedConnection(); @@ -2169,7 +2208,7 @@ void JoyTabWidget::fillSetButtons(SetJoystick *set) column = 0; - for (int j = 0; j < joystick->getNumberAxes(); j++) + for (int j = 0; j < m_joystick->getNumberAxes(); j++) { JoyAxis *axis = currentSet->getJoyAxis(j); @@ -2214,7 +2253,7 @@ void JoyTabWidget::fillSetButtons(SetJoystick *set) } } - for (int j = 0; j < joystick->getNumberButtons(); j++) + for (int j = 0; j < m_joystick->getNumberButtons(); j++) { JoyButton *button = currentSet->getJoyButton(j); if ((button != nullptr) && !button->isPartVDPad()) @@ -2310,6 +2349,10 @@ void JoyTabWidget::removeSetButtons(SetJoystick *set) current_layout = gridLayout8; break; } + default: + { + break; + } } while (current_layout && ((child = current_layout->takeAt(0)) != nullptr)) @@ -2320,7 +2363,7 @@ void JoyTabWidget::removeSetButtons(SetJoystick *set) child = nullptr; } - for (int j=0; j < joystick->getNumberSticks(); j++) + for (int j=0; j < m_joystick->getNumberSticks(); j++) { JoyControlStick *stick = currentSet->getJoyStick(j); stick->disconnectPropertyUpdatedConnection(); @@ -2336,7 +2379,7 @@ void JoyTabWidget::removeSetButtons(SetJoystick *set) } } - for (int j=0; j < joystick->getNumberHats(); j++) + for (int j=0; j < m_joystick->getNumberHats(); j++) { JoyDPad *dpad = currentSet->getJoyDPad(j); dpad->establishPropertyUpdatedConnection(); @@ -2352,7 +2395,7 @@ void JoyTabWidget::removeSetButtons(SetJoystick *set) } } - for (int j=0; j < joystick->getNumberVDPads(); j++) + for (int j=0; j < m_joystick->getNumberVDPads(); j++) { VDPad *vdpad = currentSet->getVDPad(j); vdpad->establishPropertyUpdatedConnection(); @@ -2368,7 +2411,7 @@ void JoyTabWidget::removeSetButtons(SetJoystick *set) } } - for (int j=0; j < joystick->getNumberAxes(); j++) + for (int j=0; j < m_joystick->getNumberAxes(); j++) { JoyAxis *axis = currentSet->getJoyAxis(j); @@ -2387,7 +2430,7 @@ void JoyTabWidget::removeSetButtons(SetJoystick *set) } } - for (int j=0; j < joystick->getNumberButtons(); j++) + for (int j=0; j < m_joystick->getNumberButtons(); j++) { JoyButton *button = currentSet->getJoyButton(j); if ((button != nullptr) && !button->isPartVDPad()) @@ -2427,13 +2470,13 @@ void JoyTabWidget::deviceKeyRepeatSettings() { qInstallMessageHandler(MessageHandler::myMessageOutput); - bool keyRepeatActive = settings->value("KeyRepeat/KeyRepeatEnabled", true).toBool(); - int keyRepeatDelay = settings->value("KeyRepeat/KeyRepeatDelay", InputDevice::DEFAULTKEYREPEATDELAY).toInt(); - int keyRepeatRate = settings->value("KeyRepeat/KeyRepeatRate", InputDevice::DEFAULTKEYREPEATRATE).toInt(); + bool keyRepeatActive = m_settings->value("KeyRepeat/KeyRepeatEnabled", true).toBool(); + int keyRepeatDelay = m_settings->value("KeyRepeat/KeyRepeatDelay", InputDevice::DEFAULTKEYREPEATDELAY).toInt(); + int keyRepeatRate = m_settings->value("KeyRepeat/KeyRepeatRate", InputDevice::DEFAULTKEYREPEATRATE).toInt(); - joystick->setKeyRepeatStatus(keyRepeatActive); - joystick->setKeyRepeatDelay(keyRepeatDelay); - joystick->setKeyRepeatRate(keyRepeatRate); + m_joystick->setKeyRepeatStatus(keyRepeatActive); + m_joystick->setKeyRepeatDelay(keyRepeatDelay); + m_joystick->setKeyRepeatRate(keyRepeatRate); } #endif @@ -2443,9 +2486,9 @@ void JoyTabWidget::refreshCopySetActions() copySetMenu->clear(); - for (int i=0; i < InputDevice::NUMBER_JOYSETS; i++) + for (int i=0; i < GlobalVariables::InputDevice::NUMBER_JOYSETS; i++) { - SetJoystick *tempSet = joystick->getSetJoystick(i); + SetJoystick *tempSet = m_joystick->getSetJoystick(i); QAction *newaction = nullptr; if (!tempSet->getName().isEmpty()) { @@ -2473,7 +2516,7 @@ void JoyTabWidget::performSetCopy() QAction *action = qobject_cast(sender()); // static_cast int sourceSetIndex = action->data().toInt(); - SetJoystick *sourceSet = joystick->getSetJoystick(sourceSetIndex); + SetJoystick *sourceSet = m_joystick->getSetJoystick(sourceSetIndex); QString sourceName = QString(); if (!sourceSet->getName().isEmpty()) { @@ -2486,7 +2529,7 @@ void JoyTabWidget::performSetCopy() sourceName = trUtf8("Set %1").arg(sourceSetIndex+1); } - SetJoystick *destSet = joystick->getActiveSetJoystick(); + SetJoystick *destSet = m_joystick->getActiveSetJoystick(); if ((sourceSet != nullptr) && (destSet != nullptr)) { QMessageBox msgBox; @@ -2515,7 +2558,7 @@ void JoyTabWidget::disableCopyCurrentSet() { qInstallMessageHandler(MessageHandler::myMessageOutput); - SetJoystick *activeSet = joystick->getActiveSetJoystick(); + SetJoystick *activeSet = m_joystick->getActiveSetJoystick(); QMenu *menu = qobject_cast(sender()); // static_cast QList actions = menu->actions(); QListIterator iter(actions); @@ -2537,7 +2580,7 @@ void JoyTabWidget::openGameControllerMappingWindow() { qInstallMessageHandler(MessageHandler::myMessageOutput); - GameControllerMappingDialog *dialog = new GameControllerMappingDialog(joystick, settings, this); + GameControllerMappingDialog *dialog = new GameControllerMappingDialog(m_joystick, m_settings, this); dialog->show(); connect(dialog, &GameControllerMappingDialog::mappingUpdate, this, &JoyTabWidget::propogateMappingUpdate); } @@ -2554,7 +2597,7 @@ void JoyTabWidget::refreshHelperThread() { qInstallMessageHandler(MessageHandler::myMessageOutput); - tabHelper.moveToThread(joystick->thread()); + tabHelper.moveToThread(m_joystick->thread()); } void JoyTabWidget::changeEvent(QEvent *event) diff --git a/src/joytabwidget.h b/src/joytabwidget.h old mode 100644 new mode 100755 index 044d15d94..318fb59cd --- a/src/joytabwidget.h +++ b/src/joytabwidget.h @@ -209,9 +209,9 @@ private slots: QPushButton *pushButton; QSpacerItem *verticalSpacer_3; - InputDevice *joystick; + InputDevice *m_joystick; bool displayingNames; - AntiMicroSettings *settings; + AntiMicroSettings *m_settings; int comboBoxIndex; bool hideEmptyButtons; QString oldProfileName; diff --git a/src/joytabwidgetcontainer.cpp b/src/joytabwidgetcontainer.cpp old mode 100644 new mode 100755 index 8ca8aab6f..dfa6b29ef --- a/src/joytabwidgetcontainer.cpp +++ b/src/joytabwidgetcontainer.cpp @@ -25,7 +25,6 @@ #include #include - JoyTabWidgetContainer::JoyTabWidgetContainer(QWidget *parent) : QTabWidget(parent) { diff --git a/src/joytabwidgetcontainer.h b/src/joytabwidgetcontainer.h old mode 100644 new mode 100755 diff --git a/src/keyboard/virtualkeyboardmousewidget.cpp b/src/keyboard/virtualkeyboardmousewidget.cpp old mode 100644 new mode 100755 index 86fe185a3..07264fd1e --- a/src/keyboard/virtualkeyboardmousewidget.cpp +++ b/src/keyboard/virtualkeyboardmousewidget.cpp @@ -39,9 +39,6 @@ #include - - - #include #include #include @@ -63,15 +60,15 @@ QHash VirtualKeyboardMouseWidget::topRowKeys = QHash (); - - -VirtualKeyboardMouseWidget::VirtualKeyboardMouseWidget(InputDevice *joystick, ButtonEditDialogHelper* helper, QuickSetDialog* quickSetDialog, QWidget *parent) : +VirtualKeyboardMouseWidget::VirtualKeyboardMouseWidget(InputDevice *joystick, ButtonEditDialogHelper* helper, QuickSetDialog* quickSetDialog, JoyButton* button, QWidget *parent) : QTabWidget(parent) { qInstallMessageHandler(MessageHandler::myMessageOutput); this->joystick = joystick; this->helper = helper; + this->withoutQuickSetDialog = (button != nullptr); + lastPressedBtn = button; currentQuickDialog = quickSetDialog; keyboardTab = new QWidget(this); mouseTab = new QWidget(this); @@ -82,7 +79,6 @@ VirtualKeyboardMouseWidget::VirtualKeyboardMouseWidget(InputDevice *joystick, Bu this->addTab(keyboardTab, trUtf8("Keyboard")); this->addTab(mouseTab, trUtf8("Mouse")); - this->setTabPosition(QTabWidget::South); setupVirtualKeyboardLayout(); @@ -95,6 +91,7 @@ VirtualKeyboardMouseWidget::VirtualKeyboardMouseWidget(InputDevice *joystick, Bu connect(mouseSettingsPushButton, &QPushButton::clicked, this, &VirtualKeyboardMouseWidget::openMouseSettingsDialog); } + VirtualKeyboardMouseWidget::VirtualKeyboardMouseWidget(QWidget *parent) : QTabWidget(parent) { @@ -104,12 +101,13 @@ VirtualKeyboardMouseWidget::VirtualKeyboardMouseWidget(QWidget *parent) : mouseTab = new QWidget(this); isLaptopDevice = isLaptop(); noneButton = createNoneKey(); + withoutQuickSetDialog = false; + lastPressedBtn = nullptr; populateTopRowKeys(); this->addTab(keyboardTab, trUtf8("Keyboard")); this->addTab(mouseTab, trUtf8("Mouse")); - this->setTabPosition(QTabWidget::South); setupVirtualKeyboardLayout(); @@ -118,7 +116,6 @@ VirtualKeyboardMouseWidget::VirtualKeyboardMouseWidget(QWidget *parent) : establishVirtualMouseSignalConnections(); QTimer::singleShot(0, this, SLOT(setButtonFontSizes())); - } @@ -130,7 +127,7 @@ bool VirtualKeyboardMouseWidget::is_numlock_activated() #endif #ifdef Q_OS_UNIX - Display *dpy = XOpenDisplay(":0"); // X11Extras::getInstance()->display(); + Display *dpy = XOpenDisplay(X11Extras::getInstance()->getEnvVariable("DISPLAY")); XKeyboardState x; XGetKeyboardControl(dpy, &x); XCloseDisplay(dpy); @@ -138,13 +135,12 @@ bool VirtualKeyboardMouseWidget::is_numlock_activated() #endif } -bool VirtualKeyboardMouseWidget::isLaptop() { - +bool VirtualKeyboardMouseWidget::isLaptop() +{ int secs, pct; - if (SDL_GetPowerInfo(&secs, &pct) == SDL_POWERSTATE_UNKNOWN) - return false; - else - return true; + + if (SDL_GetPowerInfo(&secs, &pct) == SDL_POWERSTATE_UNKNOWN) return false; + else return true; } @@ -153,15 +149,16 @@ void VirtualKeyboardMouseWidget::setupVirtualKeyboardLayout() qInstallMessageHandler(MessageHandler::myMessageOutput); QVBoxLayout *finalVBoxLayout = new QVBoxLayout(keyboardTab); - QVBoxLayout *tempMainKeyLayout = setupMainKeyboardLayout(); QVBoxLayout *tempAuxKeyLayout = new QVBoxLayout(); QVBoxLayout *tempNumKeyPadLayout = new QVBoxLayout(); if (is_numlock_activated()) + { tempNumKeyPadLayout = setupKeyboardNumPadLayout(); - else { - + } + else + { QPushButton *othersKeysButton = createOtherKeysMenu(); tempNumKeyPadLayout->addWidget(noneButton); @@ -170,17 +167,19 @@ void VirtualKeyboardMouseWidget::setupVirtualKeyboardLayout() } QHBoxLayout *tempHBoxLayout = new QHBoxLayout(); - tempHBoxLayout->addLayout(tempMainKeyLayout); - if (!isLaptopDevice) { + if (!isLaptopDevice) + { tempAuxKeyLayout = setupAuxKeyboardLayout(); tempHBoxLayout->addLayout(tempAuxKeyLayout); - } else + } + else + { delete tempAuxKeyLayout; + } tempHBoxLayout->addLayout(tempNumKeyPadLayout); - finalVBoxLayout->addLayout(tempHBoxLayout); } @@ -190,8 +189,10 @@ QVBoxLayout *VirtualKeyboardMouseWidget::setupMainKeyboardLayout() QHBoxLayout *tempHBoxLayout = new QHBoxLayout(); tempHBoxLayout->setSpacing(0); + QVBoxLayout *tempVBoxLayout = new QVBoxLayout(); tempVBoxLayout->setSpacing(0); + QVBoxLayout *finalVBoxLayout = new QVBoxLayout(); if (isLaptopDevice) finalVBoxLayout->setSpacing(0); @@ -212,7 +213,8 @@ QVBoxLayout *VirtualKeyboardMouseWidget::setupMainKeyboardLayout() tempHBoxLayout->addWidget(createNewKey("F11")); tempHBoxLayout->addWidget(createNewKey("F12")); - if (isLaptopDevice) { + if (isLaptopDevice) + { tempHBoxLayout->addWidget(createNewKey("Print")); tempHBoxLayout->addWidget(createNewKey("Pause")); tempHBoxLayout->addWidget(createNewKey("Delete")); @@ -230,6 +232,7 @@ QVBoxLayout *VirtualKeyboardMouseWidget::setupMainKeyboardLayout() { tempHBoxLayout->addWidget(createNewKey(QString::number(i))); } + tempHBoxLayout->addWidget(createNewKey("0")); tempHBoxLayout->addWidget(createNewKey("minus")); tempHBoxLayout->addWidget(createNewKey("equal")); @@ -243,8 +246,10 @@ QVBoxLayout *VirtualKeyboardMouseWidget::setupMainKeyboardLayout() QVBoxLayout *tempMiddleVLayout = new QVBoxLayout(); tempMiddleVLayout->setSpacing(0); + QHBoxLayout *tempMiddleHLayout = new QHBoxLayout(); tempHBoxLayout = new QHBoxLayout(); + tempHBoxLayout->addWidget(createNewKey("Tab")); if (!isLaptopDevice) tempHBoxLayout->addSpacerItem(new QSpacerItem(10, 30, QSizePolicy::Fixed)); tempHBoxLayout->addWidget(createNewKey("q")); @@ -266,10 +271,13 @@ QVBoxLayout *VirtualKeyboardMouseWidget::setupMainKeyboardLayout() tempHBoxLayout->addWidget(createNewKey("backslash")); } - if (isLaptopDevice) { + if (isLaptopDevice) + { tempHBoxLayout->addWidget(createNewKey("Prior")); tempVBoxLayout->addLayout(tempHBoxLayout); - } else { + } + else + { tempMiddleVLayout->addLayout(tempHBoxLayout); } @@ -294,21 +302,22 @@ QVBoxLayout *VirtualKeyboardMouseWidget::setupMainKeyboardLayout() tempHBoxLayout->addWidget(createNewKey("asterisk")); } - if (!isLaptopDevice) { - + if (!isLaptopDevice) + { tempMiddleVLayout->addLayout(tempHBoxLayout); tempMiddleHLayout->addLayout(tempMiddleVLayout); tempMiddleHLayout->setSpacing(0); tempMiddleHLayout->addWidget(createNewKey("Return")); tempVBoxLayout->addLayout(tempMiddleHLayout); - - } else { - + } + else + { tempHBoxLayout->addWidget(createNewKey("Return")); tempHBoxLayout->addWidget(createNewKey("Next")); tempVBoxLayout->addLayout(tempHBoxLayout); + delete tempMiddleHLayout; delete tempMiddleVLayout; } @@ -334,7 +343,8 @@ QVBoxLayout *VirtualKeyboardMouseWidget::setupMainKeyboardLayout() tempHBoxLayout->addWidget(createNewKey("slash")); tempHBoxLayout->addWidget(createNewKey("Shift_R")); - if (isLaptopDevice) { + if (isLaptopDevice) + { tempHBoxLayout->addWidget(createNewKey("Up")); tempHBoxLayout->addWidget(createNewKey("End")); } @@ -350,16 +360,21 @@ QVBoxLayout *VirtualKeyboardMouseWidget::setupMainKeyboardLayout() VirtualKeyPushButton* altR = createNewKey("Alt_R"); - if (altR->getKeycode() <= 0) { + if (altR->getKeycode() <= 0) + { tempHBoxLayout->addWidget(createNewKey("ISO_Level3_Shift")); delete altR; - } else + } + else + { tempHBoxLayout->addWidget(altR); + } tempHBoxLayout->addWidget(createNewKey("Menu")); tempHBoxLayout->addWidget(createNewKey("Control_R")); - if (isLaptopDevice) { + if (isLaptopDevice) + { tempHBoxLayout->addWidget(createNewKey("Left")); tempHBoxLayout->addWidget(createNewKey("Down")); tempHBoxLayout->addWidget(createNewKey("Right")); @@ -367,19 +382,21 @@ QVBoxLayout *VirtualKeyboardMouseWidget::setupMainKeyboardLayout() tempVBoxLayout->addLayout(tempHBoxLayout); - if (!isLaptopDevice) { - tempVBoxLayout->setStretch(0, 1); - tempVBoxLayout->setStretch(1, 2); - tempVBoxLayout->setStretch(2, 1); - tempVBoxLayout->setStretch(3, 1); + if (!isLaptopDevice) + { + tempVBoxLayout->setStretch(0, 1); + tempVBoxLayout->setStretch(1, 2); + tempVBoxLayout->setStretch(2, 1); + tempVBoxLayout->setStretch(3, 1); } finalVBoxLayout->addLayout(tempVBoxLayout); - if (!isLaptopDevice) { - finalVBoxLayout->setStretch(0, 1); - finalVBoxLayout->setStretch(1, 0); - finalVBoxLayout->setStretch(2, 2); + if (!isLaptopDevice) + { + finalVBoxLayout->setStretch(0, 1); + finalVBoxLayout->setStretch(1, 0); + finalVBoxLayout->setStretch(2, 2); } return finalVBoxLayout; @@ -396,9 +413,11 @@ QVBoxLayout* VirtualKeyboardMouseWidget::setupAuxKeyboardLayout() tempHBoxLayout->setSpacing(0); tempVBoxLayout->setSpacing(0); tempGridLayout->setSpacing(0); + tempHBoxLayout->addWidget(createNewKey("Print")); tempHBoxLayout->addWidget(createNewKey("Scroll_Lock")); tempHBoxLayout->addWidget(createNewKey("Pause")); + tempVBoxLayout->addLayout(tempHBoxLayout); tempVBoxLayout->addSpacerItem(new QSpacerItem(20, 45, QSizePolicy::Minimum, QSizePolicy::Fixed)); @@ -429,10 +448,13 @@ QVBoxLayout* VirtualKeyboardMouseWidget::setupKeyboardNumPadLayout() QHBoxLayout *tempHBoxLayout = new QHBoxLayout(); tempHBoxLayout->setSpacing(0); + QVBoxLayout *tempVBoxLayout = new QVBoxLayout(); tempVBoxLayout->setSpacing(0); + QGridLayout *tempGridLayout = new QGridLayout(); tempGridLayout->setSpacing(0); + QVBoxLayout *finalVBoxLayout = new QVBoxLayout(); finalVBoxLayout->setSpacing(0); @@ -466,6 +488,7 @@ QVBoxLayout* VirtualKeyboardMouseWidget::setupKeyboardNumPadLayout() tempHBoxLayout = new QHBoxLayout(); tempHBoxLayout->setSpacing(0); + tempGridLayout = new QGridLayout(); tempGridLayout->setSpacing(0); tempGridLayout->addWidget(createNewKey("KP_1"), 1, 1, 1, 1); @@ -473,6 +496,7 @@ QVBoxLayout* VirtualKeyboardMouseWidget::setupKeyboardNumPadLayout() tempGridLayout->addWidget(createNewKey("KP_3"), 1, 3, 1, 1); tempGridLayout->addWidget(createNewKey("KP_0"), 2, 1, 1, 2); tempGridLayout->addWidget(createNewKey("KP_Decimal"), 2, 3, 1, 1); + tempHBoxLayout->addLayout(tempGridLayout); tempHBoxLayout->addWidget(createNewKey("KP_Enter")); @@ -491,10 +515,9 @@ void VirtualKeyboardMouseWidget::setupMouseControlLayout() QVBoxLayout *tempVBoxLayout = new QVBoxLayout(); QGridLayout *tempGridLayout = new QGridLayout(); QVBoxLayout *finalVBoxLayout = new QVBoxLayout(mouseTab); - VirtualMousePushButton *pushButton = nullptr; QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - pushButton = new VirtualMousePushButton(trUtf8("Left", "Mouse"), JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); + VirtualMousePushButton *pushButton = new VirtualMousePushButton(trUtf8("Left", "Mouse"), JoyButtonSlot::MouseLeft, JoyButtonSlot::JoyMouseMovement, this); pushButton->setSizePolicy(sizePolicy); pushButton->setMinimumHeight(50); tempVBoxLayout->addSpacerItem(new QSpacerItem(20, 50, QSizePolicy::Minimum, QSizePolicy::Expanding)); @@ -744,12 +767,16 @@ void VirtualKeyboardMouseWidget::processSingleKeyboardSelection(int keycode, int { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (currentQuickDialog == nullptr) { - - currentQuickDialog = new QuickSetDialog(joystick, helper, "setAssignedSlot", keycode, alias, 0, JoyButtonSlot::JoyKeyboard, true, true, this); - currentQuickDialog->show(); - connect(currentQuickDialog, &QuickSetDialog::finished, this, &VirtualKeyboardMouseWidget::nullifyDialogPointer); - + if ((currentQuickDialog == nullptr) && !withoutQuickSetDialog) + { + currentQuickDialog = new QuickSetDialog(joystick, helper, "setAssignedSlot", keycode, alias, 0, JoyButtonSlot::JoyKeyboard, true, true, this); + currentQuickDialog->show(); + connect(currentQuickDialog, &QuickSetDialog::finished, this, &VirtualKeyboardMouseWidget::nullifyDialogPointer); + } + else if (withoutQuickSetDialog) + { + ButtonEditDialog::getInstance()->invokeMethodLastBtn(lastPressedBtn, helper, "setAssignedSlot", keycode, alias, 0, JoyButtonSlot::JoyKeyboard, true, true, Qt::QueuedConnection, Qt::QueuedConnection, Qt::QueuedConnection); + ButtonEditDialog::getInstance()->refreshForLastBtn(); } } @@ -764,12 +791,16 @@ void VirtualKeyboardMouseWidget::processSingleMouseSelection(JoyButtonSlot *temp { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (currentQuickDialog == nullptr) { - - currentQuickDialog = new QuickSetDialog(joystick, helper, "setAssignedSlot", tempslot->getSlotCode(), -1, -1, tempslot->getSlotMode(), true, true, this); - currentQuickDialog->show(); - connect(currentQuickDialog, &QuickSetDialog::finished, this, &VirtualKeyboardMouseWidget::nullifyDialogPointer); - + if ((currentQuickDialog == nullptr) && !withoutQuickSetDialog) + { + currentQuickDialog = new QuickSetDialog(joystick, helper, "setAssignedSlot", tempslot->getSlotCode(), -1, -1, tempslot->getSlotMode(), true, true, this); + currentQuickDialog->show(); + connect(currentQuickDialog, &QuickSetDialog::finished, this, &VirtualKeyboardMouseWidget::nullifyDialogPointer); + } + else if (withoutQuickSetDialog) + { + ButtonEditDialog::getInstance()->invokeMethodLastBtn(lastPressedBtn, helper, "setAssignedSlot", tempslot->getSlotCode(), -1, -1, tempslot->getSlotMode(), true, true, Qt::QueuedConnection, Qt::QueuedConnection, Qt::QueuedConnection); + ButtonEditDialog::getInstance()->refreshForLastBtn(); } } @@ -808,6 +839,7 @@ void VirtualKeyboardMouseWidget::establishVirtualKeyboardSingleSignalConnections QList newlist = keyboardTab->findChildren (); QListIterator iter(newlist); + while (iter.hasNext()) { VirtualKeyPushButton *keybutton = iter.next(); @@ -816,22 +848,23 @@ void VirtualKeyboardMouseWidget::establishVirtualKeyboardSingleSignalConnections } QListIterator iterActions(otherKeysMenu->actions()); + while (iterActions.hasNext()) { QAction *temp = iterActions.next(); disconnect(temp, &QAction::triggered, nullptr, nullptr); + connect(temp, &QAction::triggered, this, [this, temp](bool checked) { otherKeysActionSingle(temp, checked); }); } + disconnect(noneButton, &QPushButton::clicked, nullptr, nullptr); + connect(noneButton, &QPushButton::clicked, this, &VirtualKeyboardMouseWidget::clearButtonSlotsFinish); - disconnect(noneButton, &QPushButton::clicked, nullptr, nullptr); - connect(noneButton, &QPushButton::clicked, this, &VirtualKeyboardMouseWidget::clearButtonSlotsFinish); - - #ifndef QT_DEBUG_NO_OUTPUT + #ifndef QT_DEBUG_NO_OUTPUT qDebug() << "COUNT: " << newlist.count(); - #endif + #endif } void VirtualKeyboardMouseWidget::establishVirtualKeyboardAdvancedSignalConnections() @@ -840,6 +873,7 @@ void VirtualKeyboardMouseWidget::establishVirtualKeyboardAdvancedSignalConnectio QList newlist = keyboardTab->findChildren (); QListIterator iter(newlist); + while (iter.hasNext()) { VirtualKeyPushButton *keybutton = iter.next(); @@ -848,10 +882,12 @@ void VirtualKeyboardMouseWidget::establishVirtualKeyboardAdvancedSignalConnectio } QListIterator iterActions(otherKeysMenu->actions()); + while (iterActions.hasNext()) { QAction *temp = iterActions.next(); disconnect(temp, &QAction::triggered, nullptr, nullptr); + connect(temp, &QAction::triggered, this, [this, temp](bool checked) { otherKeysActionAdvanced(temp, checked); }); @@ -867,6 +903,7 @@ void VirtualKeyboardMouseWidget::establishVirtualMouseSignalConnections() QList newlist = mouseTab->findChildren(); QListIterator iter(newlist); + while (iter.hasNext()) { VirtualMousePushButton *mousebutton = iter.next(); @@ -881,6 +918,7 @@ void VirtualKeyboardMouseWidget::establishVirtualMouseAdvancedSignalConnections( QList newlist = mouseTab->findChildren(); QListIterator iter(newlist); + while (iter.hasNext()) { VirtualMousePushButton *mousebutton = iter.next(); @@ -893,14 +931,16 @@ void VirtualKeyboardMouseWidget::clearButtonSlots() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (ButtonEditDialog::getInstance() != nullptr) { - if (ButtonEditDialog::getInstance()->getLastJoyButton() != nullptr) - QMetaObject::invokeMethod(ButtonEditDialog::getInstance()->getLastJoyButton(), "clearSlotsEventReset", Qt::BlockingQueuedConnection); - - emit selectionCleared(); + if (ButtonEditDialog::getInstance() != nullptr) + { + if (ButtonEditDialog::getInstance()->getLastJoyButton() != nullptr) + QMetaObject::invokeMethod(ButtonEditDialog::getInstance()->getLastJoyButton(), "clearSlotsEventReset", Qt::BlockingQueuedConnection); - } else { + emit selectionCleared(); + } + else + { QMessageBox::information(this, trUtf8("Last button"), trUtf8("Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad")); } } @@ -909,14 +949,15 @@ void VirtualKeyboardMouseWidget::clearButtonSlotsFinish() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (ButtonEditDialog::getInstance() != nullptr) { - if (ButtonEditDialog::getInstance()->getLastJoyButton() != nullptr) - QMetaObject::invokeMethod(ButtonEditDialog::getInstance()->getLastJoyButton(), "clearSlotsEventReset", Qt::BlockingQueuedConnection); - - emit selectionFinished(); - - } else { + if (ButtonEditDialog::getInstance() != nullptr) + { + if (ButtonEditDialog::getInstance()->getLastJoyButton() != nullptr) + QMetaObject::invokeMethod(ButtonEditDialog::getInstance()->getLastJoyButton(), "clearSlotsEventReset", Qt::BlockingQueuedConnection); + emit selectionFinished(); + } + else + { QMessageBox::information(this, trUtf8("Last button"), trUtf8("Slots for button couldn't be cleared, because there was not any set button from keyboard for gamepad. Map at least one button from keyboard to gamepad")); } } @@ -935,17 +976,18 @@ void VirtualKeyboardMouseWidget::openMouseSettingsDialog() mouseSettingsPushButton->setEnabled(false); // TODO instead of buttons, get pointer to static getInstance from ButtonEditDialog for last pressed button, and then getting button from public method - if (ButtonEditDialog::getInstance() != nullptr) { - if (ButtonEditDialog::getInstance()->getLastJoyButton() != nullptr) { - + if (ButtonEditDialog::getInstance() != nullptr) + { + if (ButtonEditDialog::getInstance()->getLastJoyButton() != nullptr) + { MouseButtonSettingsDialog *dialog = new MouseButtonSettingsDialog(ButtonEditDialog::getInstance()->getLastJoyButton(), this); dialog->show(); QDialog *parent = qobject_cast(this->parentWidget()); // static_cast connect(parent, &QDialog::finished, dialog, &MouseButtonSettingsDialog::close); connect(dialog, &MouseButtonSettingsDialog::finished, this, &VirtualKeyboardMouseWidget::enableMouseSettingButton); - - } else { - + } + else + { QMessageBox::information(this, QObject::trUtf8("Last button"), QObject::trUtf8("There isn't a last button pressed from gamepad in data. Did you set at least one button from gamepad for keyboard?")); } } @@ -958,6 +1000,13 @@ void VirtualKeyboardMouseWidget::enableMouseSettingButton() mouseSettingsPushButton->setEnabled(true); } +void VirtualKeyboardMouseWidget::disableMouseSettingButton() +{ + qInstallMessageHandler(MessageHandler::myMessageOutput); + + mouseSettingsPushButton->setEnabled(false); +} + void VirtualKeyboardMouseWidget::resizeEvent(QResizeEvent *event) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -974,13 +1023,13 @@ void VirtualKeyboardMouseWidget::setButtonFontSizes() QList buttonList = this->findChildren(); QListIterator iter(buttonList); + while (iter.hasNext()) { VirtualKeyPushButton *temp = iter.next(); QFont tempFont(temp->font()); tempFont.setPointSize(temp->calculateFontSize()); temp->setFont(tempFont); - } } @@ -1137,8 +1186,8 @@ void VirtualKeyboardMouseWidget::nullifyDialogPointer() } } -InputDevice* VirtualKeyboardMouseWidget::getJoystick() const { - +InputDevice* VirtualKeyboardMouseWidget::getJoystick() const +{ return joystick; } @@ -1147,32 +1196,32 @@ ButtonEditDialogHelper* VirtualKeyboardMouseWidget::getHelper() const { return helper; } -QWidget* VirtualKeyboardMouseWidget::getKeyboardTab() const { - +QWidget* VirtualKeyboardMouseWidget::getKeyboardTab() const +{ return keyboardTab; } -QWidget* VirtualKeyboardMouseWidget::getMouseTab() const { - +QWidget* VirtualKeyboardMouseWidget::getMouseTab() const +{ return mouseTab; } -QPushButton* VirtualKeyboardMouseWidget::getNoneButton() const { - +QPushButton* VirtualKeyboardMouseWidget::getNoneButton() const +{ return noneButton; } -QPushButton* VirtualKeyboardMouseWidget::getMouseSettingsPushButton() const { - +QPushButton* VirtualKeyboardMouseWidget::getMouseSettingsPushButton() const +{ return mouseSettingsPushButton; } -QMenu* VirtualKeyboardMouseWidget::getOtherKeysMenu() const { - +QMenu* VirtualKeyboardMouseWidget::getOtherKeysMenu() const +{ return otherKeysMenu; } -QuickSetDialog* VirtualKeyboardMouseWidget::getCurrentQuickDialog() const { - +QuickSetDialog* VirtualKeyboardMouseWidget::getCurrentQuickDialog() const +{ return currentQuickDialog; } diff --git a/src/keyboard/virtualkeyboardmousewidget.h b/src/keyboard/virtualkeyboardmousewidget.h old mode 100644 new mode 100755 index 354379289..7a5acd156 --- a/src/keyboard/virtualkeyboardmousewidget.h +++ b/src/keyboard/virtualkeyboardmousewidget.h @@ -40,7 +40,7 @@ class VirtualKeyboardMouseWidget : public QTabWidget Q_OBJECT public: - explicit VirtualKeyboardMouseWidget(InputDevice *joystick, ButtonEditDialogHelper* helper, QuickSetDialog* quickSetDialog = nullptr, QWidget *parent = nullptr); + explicit VirtualKeyboardMouseWidget(InputDevice *joystick, ButtonEditDialogHelper* helper, QuickSetDialog* quickSetDialog = nullptr, JoyButton* button = nullptr, QWidget *parent = nullptr); explicit VirtualKeyboardMouseWidget(QWidget *parent = nullptr); bool isKeyboardTabVisible(); bool is_numlock_activated(); @@ -84,6 +84,8 @@ public slots: void establishVirtualMouseSignalConnections(); void establishVirtualKeyboardAdvancedSignalConnections(); void establishVirtualMouseAdvancedSignalConnections(); + void enableMouseSettingButton(); + void disableMouseSettingButton(); private slots: void processSingleKeyboardSelection(int keycode, int alias); // (.., unsigned) @@ -93,7 +95,6 @@ private slots: void clearButtonSlots(); void clearButtonSlotsFinish(); void openMouseSettingsDialog(); - void enableMouseSettingButton(); void setButtonFontSizes(); void otherKeysActionSingle(QAction* action, bool triggered); void otherKeysActionAdvanced(QAction* action, bool triggered); @@ -101,7 +102,9 @@ private slots: private: bool isLaptopDevice; + bool withoutQuickSetDialog; InputDevice *joystick; + JoyButton* lastPressedBtn; ButtonEditDialogHelper* helper; QWidget *keyboardTab; QWidget *mouseTab; diff --git a/src/keyboard/virtualkeypushbutton.cpp b/src/keyboard/virtualkeypushbutton.cpp old mode 100644 new mode 100755 index c0752ad54..f100bba0d --- a/src/keyboard/virtualkeypushbutton.cpp +++ b/src/keyboard/virtualkeypushbutton.cpp @@ -31,8 +31,6 @@ QHash VirtualKeyPushButton::knownAliases = QHash (); - - VirtualKeyPushButton::VirtualKeyPushButton(QString xcodestring, QWidget *parent) : QPushButton(parent) { @@ -214,10 +212,11 @@ int VirtualKeyPushButton::calculateFontSize() QFont tempScaledFont(this->font()); tempScaledFont.setPointSize(10); QFontMetrics fm(tempScaledFont); + int less_width = this->width() - 4; - while (((this->width()-4) < fm.boundingRect(this->rect(), Qt::AlignCenter, this->text()).width()) && tempScaledFont.pointSize() >= 6) + while ((less_width < fm.boundingRect(this->rect(), Qt::AlignCenter, this->text()).width()) && (tempScaledFont.pointSize() > 5)) { - tempScaledFont.setPointSize(tempScaledFont.pointSize()-1); + tempScaledFont.setPointSize(tempScaledFont.pointSize() - 1); fm = QFontMetrics(tempScaledFont); } diff --git a/src/keyboard/virtualkeypushbutton.h b/src/keyboard/virtualkeypushbutton.h old mode 100644 new mode 100755 diff --git a/src/keyboard/virtualmousepushbutton.cpp b/src/keyboard/virtualmousepushbutton.cpp old mode 100644 new mode 100755 diff --git a/src/keyboard/virtualmousepushbutton.h b/src/keyboard/virtualmousepushbutton.h old mode 100644 new mode 100755 diff --git a/src/localantimicroserver.cpp b/src/localantimicroserver.cpp old mode 100644 new mode 100755 index a509519b5..51f6d1904 --- a/src/localantimicroserver.cpp +++ b/src/localantimicroserver.cpp @@ -25,7 +25,6 @@ #include #include - LocalAntiMicroServer::LocalAntiMicroServer(QObject *parent) : QObject(parent) { diff --git a/src/localantimicroserver.h b/src/localantimicroserver.h old mode 100644 new mode 100755 diff --git a/src/logger.cpp b/src/logger.cpp old mode 100644 new mode 100755 diff --git a/src/logger.h b/src/logger.h old mode 100644 new mode 100755 diff --git a/src/main.cpp b/src/main.cpp old mode 100644 new mode 100755 index b893cbb94..677dc918a --- a/src/main.cpp +++ b/src/main.cpp @@ -33,10 +33,7 @@ #include "messagehandler.h" #include "logger.h" -#ifdef Q_OS_UNIX #include -#endif - #include #include #include @@ -49,18 +46,19 @@ #include #include #include +#include #include #ifdef Q_OS_UNIX -#include -#include + #include + #include -#include -#include + #include + #include - #ifdef WITH_X11 - #include "x11extras.h" - #endif + #ifdef WITH_X11 + #include "x11extras.h" + #endif #endif @@ -69,15 +67,16 @@ #undef main #endif - #ifdef Q_OS_WIN -#include "winextras.h" -#include -#include + #include "winextras.h" + #include + #include #endif + + #ifndef Q_OS_WIN static void termSignalTermHandler(int signal) { @@ -99,7 +98,8 @@ static void termSignalIntHandler(int signal) #endif -void deleteInputDevices(QMap *joysticks) +// was non static +static void deleteInputDevices(QMap *joysticks) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -108,7 +108,7 @@ void deleteInputDevices(QMap *joysticks) while (iter.hasNext()) { InputDevice *joystick = iter.next().value(); - if (joystick) + if (joystick != nullptr) { delete joystick; joystick = nullptr; @@ -122,7 +122,6 @@ int main(int argc, char *argv[]) { qInstallMessageHandler(MessageHandler::myMessageOutput); - QApplication antimicro(argc, argv); QCoreApplication::setApplicationName("antimicro"); QCoreApplication::setApplicationVersion(PadderCommon::programVersion); @@ -136,15 +135,16 @@ int main(int argc, char *argv[]) qRegisterMetaType("JoyButtonSlot::JoySlotInputAction"); #if defined(Q_OS_UNIX) && defined(WITH_X11) + if (QApplication::platformName() == QStringLiteral("xcb")) { - XInitThreads(); + XInitThreads(); } + #endif QFile logFile; QTextStream logFileStream; - QTextStream outstream(stdout); QTextStream errorstream(stderr); @@ -157,6 +157,7 @@ int main(int argc, char *argv[]) { char *tempchrstr = argv[i]; QString temp = QString::fromUtf8(tempchrstr); + if (temp == "-style") { styleChangeFound = true; @@ -168,7 +169,6 @@ int main(int argc, char *argv[]) parser.setApplicationDescription(QCoreApplication::translate("antimicro", "Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support.")); parser.addHelpOption(); parser.addVersionOption(); - parser.addOptions({ // A boolean option with a single name (-p) {"tray", @@ -223,33 +223,38 @@ int main(int argc, char *argv[]) Logger appLogger(&outstream, &errorstream); // If a log level wasn't specified at the command-line, then use a default. - if( cmdutility.getCurrentLogLevel() == Logger::LOG_NONE ) { - appLogger.setLogLevel( Logger::LOG_WARNING ); - } else if (cmdutility.getCurrentLogLevel() != appLogger.getCurrentLogLevel()) + if( cmdutility.getCurrentLogLevel() == Logger::LOG_NONE ) + { + appLogger.setLogLevel( Logger::LOG_WARNING ); + } + else if (cmdutility.getCurrentLogLevel() != appLogger.getCurrentLogLevel()) { appLogger.setLogLevel(cmdutility.getCurrentLogLevel()); } if( !cmdutility.getCurrentLogFile().isEmpty() ) { - appLogger.setCurrentLogFile( cmdutility.getCurrentLogFile() ); - appLogger.setCurrentErrorStream(nullptr); + + appLogger.setCurrentLogFile( cmdutility.getCurrentLogFile() ); + appLogger.setCurrentErrorStream(nullptr); + } Q_INIT_RESOURCE(resources); - #if defined(Q_OS_WIN) && defined(WIN_PORTABLE_PACKAGE) + // If in portable mode, make sure the current directory is the same as the // config directory. This is to ensure that all relative paths resolve // correctly when loading on startup. + QDir::setCurrent( PadderCommon::configPath() ); #endif QDir configDir(PadderCommon::configPath()); if (!configDir.exists()) { - configDir.mkpath(PadderCommon::configPath()); + configDir.mkpath(PadderCommon::configPath()); } QMap *joysticks = new QMap(); @@ -262,39 +267,43 @@ int main(int argc, char *argv[]) QLocalSocket socket; socket.connectToServer(PadderCommon::localSocketKey); socket.waitForConnected(1000); + if (socket.state() == QLocalSocket::ConnectedState) { // An instance of this program is already running. // Save app config and exit. AntiMicroSettings settings(PadderCommon::configFilePath(), QSettings::IniFormat); - // Update log info based on config values - if( cmdutility.getCurrentLogLevel() == Logger::LOG_NONE && - settings.contains("LogLevel")) { - appLogger.setLogLevel( static_cast(settings.value("LogLevel").toInt()) ); - } - if( cmdutility.getCurrentLogFile().isEmpty() && - settings.contains("LogFile")) { - appLogger.setCurrentLogFile( settings.value("LogFile").toString() ); - appLogger.setCurrentErrorStream(nullptr); - } + // Update log info based on config values + if( cmdutility.getCurrentLogLevel() == Logger::LOG_NONE && + settings.contains("LogLevel")) { + + appLogger.setLogLevel( static_cast(settings.value("LogLevel").toInt()) ); + } + + if( cmdutility.getCurrentLogFile().isEmpty() && + settings.contains("LogFile")) { + + appLogger.setCurrentLogFile( settings.value("LogFile").toString() ); + appLogger.setCurrentErrorStream(nullptr); + } InputDaemon *joypad_worker = new InputDaemon(joysticks, &settings, false); - MainWindow w(joysticks, &cmdutility, &settings, false); - w.fillButtons(); - w.alterConfigFromSettings(); + MainWindow mainWindow(joysticks, &cmdutility, &settings, false); + mainWindow.fillButtons(); + mainWindow.alterConfigFromSettings(); if (!cmdutility.hasError() && (cmdutility.hasProfile() || cmdutility.hasProfileInOptions())) { - w.saveAppConfig(); + mainWindow.saveAppConfig(); } else if (!cmdutility.hasError() && cmdutility.isUnloadRequested()) { - w.saveAppConfig(); + mainWindow.saveAppConfig(); } - w.removeJoyTabs(); + mainWindow.removeJoyTabs(); QObject::connect(&antimicro, &QApplication::aboutToQuit, joypad_worker, &InputDaemon::quit); QTimer::singleShot(50, &antimicro, &QApplication::quit); @@ -302,8 +311,8 @@ int main(int argc, char *argv[]) settings.sync(); socket.disconnectFromServer(); - deleteInputDevices(joysticks); + delete joysticks; joysticks = nullptr; @@ -319,9 +328,7 @@ int main(int argc, char *argv[]) if (cmdutility.launchAsDaemon()) { pid_t pid, sid; - - //Fork the Parent Process - pid = fork(); + pid = fork(); // Fork the Parent Process if (pid == 0) { @@ -340,8 +347,7 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } - //We got a good pid, Close the Parent Process - else if (pid > 0) + else if (pid > 0) // We got a good pid, Close the Parent Process { appLogger.LogInfo(QObject::trUtf8("Launching daemon"), true, true); @@ -358,46 +364,42 @@ int main(int argc, char *argv[]) if (QApplication::platformName() == QStringLiteral("xcb")) { - if (cmdutility.getDisplayString().isEmpty()) - { - X11Extras::getInstance()->syncDisplay(); - } - else - { - X11Extras::setCustomDisplay(cmdutility.getDisplayString()); - X11Extras::getInstance()->syncDisplay(); - if (X11Extras::getInstance()->display() == nullptr) + if (cmdutility.getDisplayString().isEmpty()) + { + X11Extras::getInstance()->syncDisplay(); + } + else { - appLogger.LogError(QObject::trUtf8("Display string \"%1\" is not valid.") - .arg(cmdutility.getDisplayString()), true, true); - //errorstream << QObject::trUtf8("Display string \"%1\" is not valid.").arg(cmdutility.getDisplayString()) << endl; + X11Extras::setCustomDisplay(cmdutility.getDisplayString()); + X11Extras::getInstance()->syncDisplay(); - deleteInputDevices(joysticks); - delete joysticks; - joysticks = nullptr; + if (X11Extras::getInstance()->display() == nullptr) + { + appLogger.LogError(QObject::trUtf8("Display string \"%1\" is not valid.") + .arg(cmdutility.getDisplayString()), true, true); - delete localServer; - localServer = nullptr; + deleteInputDevices(joysticks); + delete joysticks; + joysticks = nullptr; - X11Extras::getInstance()->closeDisplay(); + delete localServer; + localServer = nullptr; - exit(EXIT_FAILURE); - } - } + X11Extras::getInstance()->closeDisplay(); + exit(EXIT_FAILURE); + } + } } #endif - //Change File Mask - umask(0); + umask(0); //Change File Mask + sid = setsid(); //Create a new Signature Id for our child - //Create a new Signature Id for our child - sid = setsid(); if (sid < 0) { appLogger.LogError(QObject::trUtf8("Failed to set a signature id for the daemon"), true, true); - //errorstream << QObject::trUtf8("Failed to set a signature id for the daemon") << endl; deleteInputDevices(joysticks); delete joysticks; @@ -409,7 +411,7 @@ int main(int argc, char *argv[]) #ifdef WITH_X11 if (QApplication::platformName() == QStringLiteral("xcb")) { - X11Extras::getInstance()->closeDisplay(); + X11Extras::getInstance()->closeDisplay(); } #endif @@ -431,7 +433,7 @@ int main(int argc, char *argv[]) if (QApplication::platformName() == QStringLiteral("xcb")) { - X11Extras::getInstance()->closeDisplay(); + X11Extras::getInstance()->closeDisplay(); } #endif @@ -452,29 +454,28 @@ int main(int argc, char *argv[]) if (QApplication::platformName() == QStringLiteral("xcb")) { - if (!cmdutility.getDisplayString().isEmpty()) - { - X11Extras::getInstance()->syncDisplay(cmdutility.getDisplayString()); - if (X11Extras::getInstance()->display() == nullptr) + if (!cmdutility.getDisplayString().isEmpty()) { - appLogger.LogError(QObject::trUtf8("Display string \"%1\" is not valid.") - .arg(cmdutility.getDisplayString()), true, true); + X11Extras::getInstance()->syncDisplay(cmdutility.getDisplayString()); + if (X11Extras::getInstance()->display() == nullptr) + { + appLogger.LogError(QObject::trUtf8("Display string \"%1\" is not valid.") + .arg(cmdutility.getDisplayString()), true, true); - deleteInputDevices(joysticks); - delete joysticks; - joysticks = nullptr; + deleteInputDevices(joysticks); + delete joysticks; + joysticks = nullptr; - delete localServer; - localServer = nullptr; + delete localServer; + localServer = nullptr; - X11Extras::getInstance()->closeDisplay(); + X11Extras::getInstance()->closeDisplay(); - exit(EXIT_FAILURE); + exit(EXIT_FAILURE); + } } } - } - #endif } @@ -485,8 +486,6 @@ int main(int argc, char *argv[]) antimicro.setQuitOnLastWindowClosed(false); - //QString defaultStyleName = qApp->style()->objectName(); - // If running Win version and no explicit style was // defined, use the style Fusion by default. I find the // windowsvista style a tad ugly @@ -505,13 +504,16 @@ int main(int argc, char *argv[]) // Update log info based on config values if( cmdutility.getCurrentLogLevel() == Logger::LOG_NONE && - settings->contains("LogLevel")) { - appLogger.setLogLevel( static_cast(settings->value("LogLevel").toInt()) ); + settings->contains("LogLevel")) { + + appLogger.setLogLevel( static_cast(settings->value("LogLevel").toInt()) ); } + if( cmdutility.getCurrentLogFile().isEmpty() && - settings->contains("LogFile")) { - appLogger.setCurrentLogFile( settings->value("LogFile").toString() ); - appLogger.setCurrentErrorStream(nullptr); + settings->contains("LogFile")) { + + appLogger.setCurrentLogFile( settings->value("LogFile").toString() ); + appLogger.setCurrentErrorStream(nullptr); } QString targetLang = QLocale::system().name(); @@ -521,8 +523,19 @@ int main(int argc, char *argv[]) } QTranslator qtTranslator; + #if defined(Q_OS_UNIX) - qtTranslator.load(QString("qt_").append(targetLang), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + QString transPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); + + if(QDir(transPath).entryInfoList(QDir::NoDotAndDotDot|QDir::AllEntries).count() == 0) + { + qtTranslator.load(QString("qt_").append(targetLang), "/app/share/antimicro/translations"); + } + else + { + qtTranslator.load(QString("qt_").append(targetLang), transPath); + } + #elif defined(Q_OS_WIN) #ifdef QT_DEBUG qtTranslator.load(QString("qt_").append(targetLang), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); @@ -534,8 +547,17 @@ int main(int argc, char *argv[]) antimicro.installTranslator(&qtTranslator); QTranslator myappTranslator; + #if defined(Q_OS_UNIX) - myappTranslator.load(QString("antimicro_").append(targetLang), QApplication::applicationDirPath().append("/../share/antimicro/translations")); + if(QDir("/app/share/antimicro").entryInfoList(QDir::NoDotAndDotDot|QDir::AllEntries).count() > 0) + { + myappTranslator.load(QString("antimicro_").append(targetLang), "app/share/antimicro/translations"); + } + else + { + myappTranslator.load(QString("antimicro_").append(targetLang), QApplication::applicationDirPath().append("/../share/antimicro/translations")); + } + #elif defined(Q_OS_WIN) myappTranslator.load(QString("antimicro_").append(targetLang), QApplication::applicationDirPath().append("\\share\\antimicro\\translations")); #endif @@ -582,7 +604,7 @@ int main(int argc, char *argv[]) if (QApplication::platformName() == QStringLiteral("xcb")) { - X11Extras::getInstance()->closeDisplay(); + X11Extras::getInstance()->closeDisplay(); } #endif @@ -595,10 +617,9 @@ int main(int argc, char *argv[]) InputDaemon *joypad_worker = new InputDaemon(joysticks, settings); inputEventThread = new QThread; + MainWindow *mainWindow = new MainWindow(joysticks, &cmdutility, settings); - MainWindow *w = new MainWindow(joysticks, &cmdutility, settings); - - QObject::connect(&antimicro, &QApplication::aboutToQuit, w, &MainWindow::removeJoyTabs); + QObject::connect(&antimicro, &QApplication::aboutToQuit, mainWindow, &MainWindow::removeJoyTabs); QObject::connect(&antimicro, &QApplication::aboutToQuit, joypad_worker, &InputDaemon::quit); QObject::connect(&antimicro, &QApplication::aboutToQuit, joypad_worker, &InputDaemon::deleteJoysticks, Qt::BlockingQueuedConnection); @@ -607,8 +628,8 @@ int main(int argc, char *argv[]) QObject::connect(&antimicro, &QApplication::aboutToQuit, joypad_worker, &InputDaemon::deleteLater, Qt::BlockingQueuedConnection); - w->makeJoystickTabs(); - QTimer::singleShot(0, w, &MainWindow::controllerMapOpening); + mainWindow->makeJoystickTabs(); + QTimer::singleShot(0, mainWindow, &MainWindow::controllerMapOpening); joypad_worker->startWorker(); @@ -616,10 +637,14 @@ int main(int argc, char *argv[]) PadderCommon::mouseHelperObj.moveToThread(inputEventThread); inputEventThread->start(QThread::HighPriority); + + int app_result = antimicro.exec(); - // Log any remaining messages if they exist. - appLogger.Log(); + + + + appLogger.Log(); // Log any remaining messages if they exist. inputEventThread->quit(); inputEventThread->wait(); @@ -627,7 +652,6 @@ int main(int argc, char *argv[]) delete joysticks; joysticks = nullptr; - //delete joypad_worker; // maybe hide joypad_worker = nullptr; delete localServer; @@ -640,13 +664,13 @@ int main(int argc, char *argv[]) if (QApplication::platformName() == QStringLiteral("xcb")) { - X11Extras::getInstance()->closeDisplay(); + X11Extras::getInstance()->closeDisplay(); } #endif - delete w; - w = nullptr; + delete mainWindow; + mainWindow = nullptr; return app_result; } @@ -655,6 +679,7 @@ int main(int argc, char *argv[]) QString eventGeneratorIdentifier = QString(); AntKeyMapper *keyMapper = nullptr; EventHandlerFactory *factory = EventHandlerFactory::getInstance(cmdutility.getEventGenerator()); + if (!factory) { status = false; @@ -669,6 +694,7 @@ int main(int argc, char *argv[]) #if (defined(Q_OS_UNIX) && defined(WITH_UINPUT) && defined(WITH_XTEST)) || \ defined(Q_OS_WIN) + // Use fallback event handler. if (!status && cmdutility.getEventGenerator() != EventHandlerFactory::fallBackIdentifier()) { @@ -677,7 +703,7 @@ int main(int argc, char *argv[]) appLogger.LogInfo(QObject::trUtf8("Attempting to use fallback option %1 for event generation.") .arg(eventDisplayName)); - if (keyMapper) + if (keyMapper != nullptr) { keyMapper->deleteInstance(); keyMapper = nullptr; @@ -685,6 +711,7 @@ int main(int argc, char *argv[]) factory->deleteInstance(); factory = EventHandlerFactory::getInstance(EventHandlerFactory::fallBackIdentifier()); + if (!factory) { status = false; @@ -711,7 +738,7 @@ int main(int argc, char *argv[]) delete localServer; localServer = nullptr; - if (keyMapper) + if (keyMapper != nullptr) { keyMapper->deleteInstance(); keyMapper = nullptr; @@ -721,7 +748,7 @@ int main(int argc, char *argv[]) if (QApplication::platformName() == QStringLiteral("xcb")) { - X11Extras::getInstance()->closeDisplay(); + X11Extras::getInstance()->closeDisplay(); } #endif @@ -738,24 +765,24 @@ int main(int argc, char *argv[]) InputDaemon *joypad_worker = new InputDaemon(joysticks, settings); inputEventThread = new QThread(); - MainWindow *w = new MainWindow(joysticks, &cmdutility, settings); + MainWindow *mainWindow = new MainWindow(joysticks, &cmdutility, settings); - w->setAppTranslator(&qtTranslator); - w->setTranslator(&myappTranslator); - AppLaunchHelper mainAppHelper(settings, w->getGraphicalStatus()); + mainWindow->setAppTranslator(&qtTranslator); + mainWindow->setTranslator(&myappTranslator); + AppLaunchHelper mainAppHelper(settings, mainWindow->getGraphicalStatus()); - QObject::connect(w, &MainWindow::joystickRefreshRequested, joypad_worker, &InputDaemon::refresh); - QObject::connect(joypad_worker, static_cast(&InputDaemon::joystickRefreshed), - [w](InputDevice* dev) { w->fillButtons(dev); }); + QObject::connect(mainWindow, &MainWindow::joystickRefreshRequested, joypad_worker, &InputDaemon::refresh); + QObject::connect(joypad_worker, SIGNAL(joystickRefreshed(InputDevice*)), + mainWindow, SLOT(fillButtons(InputDevice*))); QObject::connect(joypad_worker, - static_cast*)>(&InputDaemon::joysticksRefreshed), - [w](QMap* map) { w->fillButtons(map); }); + SIGNAL(joysticksRefreshed(QMap*)), + mainWindow, SLOT(fillButtons(QMap*))); QObject::connect(&antimicro, &QApplication::aboutToQuit, localServer, &LocalAntiMicroServer::close); - QObject::connect(&antimicro, &QApplication::aboutToQuit, w, &MainWindow::saveAppConfig); - QObject::connect(&antimicro, &QApplication::aboutToQuit, w, &MainWindow::removeJoyTabs); + QObject::connect(&antimicro, &QApplication::aboutToQuit, mainWindow, &MainWindow::saveAppConfig); + QObject::connect(&antimicro, &QApplication::aboutToQuit, mainWindow, &MainWindow::removeJoyTabs); QObject::connect(&antimicro, &QApplication::aboutToQuit, &mainAppHelper, &AppLaunchHelper::revertMouseThread); QObject::connect(&antimicro, &QApplication::aboutToQuit, joypad_worker, &InputDaemon::quit); QObject::connect(&antimicro, &QApplication::aboutToQuit, joypad_worker, &InputDaemon::deleteJoysticks); @@ -766,20 +793,22 @@ int main(int argc, char *argv[]) #ifdef Q_OS_WIN QObject::connect(&antimicro, &QApplication::aboutToQuit, &mainAppHelper, &AppLaunchHelper::appQuitPointerPrecision); #endif - QObject::connect(localServer, &LocalAntiMicroServer::clientdisconnect, w, &MainWindow::handleInstanceDisconnect); - QObject::connect(w, &MainWindow::mappingUpdated, + QObject::connect(localServer, &LocalAntiMicroServer::clientdisconnect, mainWindow, &MainWindow::handleInstanceDisconnect); + QObject::connect(mainWindow, &MainWindow::mappingUpdated, joypad_worker, &InputDaemon::refreshMapping); QObject::connect(joypad_worker, &InputDaemon::deviceUpdated, - w, &MainWindow::testMappingUpdateNow); + mainWindow, &MainWindow::testMappingUpdateNow); QObject::connect(joypad_worker, &InputDaemon::deviceRemoved, - w, &MainWindow::removeJoyTab); + mainWindow, &MainWindow::removeJoyTab); QObject::connect(joypad_worker, &InputDaemon::deviceAdded, - w, &MainWindow::addJoyTab); + mainWindow, &MainWindow::addJoyTab); #ifdef Q_OS_WIN + // Raise process priority. Helps reduce timer delays caused by // the running of other processes. + bool raisedPriority = WinExtras::raiseProcessPriority(); if (!raisedPriority) { @@ -788,9 +817,10 @@ int main(int argc, char *argv[]) #endif mainAppHelper.initRunMethods(); - QTimer::singleShot(0, [w]() { w->fillButtons(); }); - QTimer::singleShot(0, w, &MainWindow::alterConfigFromSettings); - QTimer::singleShot(0, w, &MainWindow::changeWindowStatus); + QTimer::singleShot(0, mainWindow, SLOT(fillButtons())); + QTimer::singleShot(0, mainWindow, SLOT(alterConfigFromSettings())); + QTimer::singleShot(0, mainWindow, SLOT(changeWindowStatus())); + mainAppHelper.changeMouseThread(inputEventThread); @@ -800,11 +830,14 @@ int main(int argc, char *argv[]) PadderCommon::mouseHelperObj.moveToThread(inputEventThread); inputEventThread->start(QThread::HighPriority); + + int app_result = antimicro.exec(); - // Log any remaining messages if they exist. - appLogger.Log(); + + + appLogger.Log(); // Log any remaining messages if they exist. appLogger.LogInfo(QObject::trUtf8("Quitting Program"), true, true); joypad_worker = nullptr; @@ -827,8 +860,7 @@ int main(int argc, char *argv[]) if (QApplication::platformName() == QStringLiteral("xcb")) { - - X11Extras::getInstance()->closeDisplay(); + X11Extras::getInstance()->closeDisplay(); } #endif @@ -836,8 +868,8 @@ int main(int argc, char *argv[]) EventHandlerFactory::getInstance()->handler()->cleanup(); EventHandlerFactory::getInstance()->deleteInstance(); - delete w; - w = nullptr; + delete mainWindow; + mainWindow = nullptr; delete settings; settings = nullptr; diff --git a/src/mainsettingsdialog.cpp b/src/mainsettingsdialog.cpp old mode 100644 new mode 100755 index 942ac5429..49ccfee18 --- a/src/mainsettingsdialog.cpp +++ b/src/mainsettingsdialog.cpp @@ -18,6 +18,7 @@ #include "mainsettingsdialog.h" #include "ui_mainsettingsdialog.h" +#include "globalvariables.h" #include "messagehandler.h" #include "addeditautoprofiledialog.h" #include "editalldefaultautoprofiledialog.h" @@ -154,6 +155,7 @@ MainSettingsDialog::MainSettingsDialog(AntiMicroSettings *settings, fillGUIDComboBox(); #endif + QString autoProfileActive = settings->value("AutoProfiles/AutoProfilesActive", "").toString(); if (autoProfileActive == "1") { @@ -284,23 +286,23 @@ MainSettingsDialog::MainSettingsDialog(AntiMicroSettings *settings, } int historySize = settings->value("Mouse/HistorySize", 0).toInt(); - if ((historySize > 0) && (historySize <= JoyButton::MAXIMUMMOUSEHISTORYSIZE)) + if ((historySize > 0) && (historySize <= GlobalVariables::JoyButton::MAXIMUMMOUSEHISTORYSIZE)) { ui->historySizeSpinBox->setValue(historySize); } double weightModifier = settings->value("Mouse/WeightModifier", 0).toDouble(); - if ((weightModifier > 0.0) && (weightModifier <= JoyButton::MAXIMUMWEIGHTMODIFIER)) + if ((weightModifier > 0.0) && (weightModifier <= GlobalVariables::JoyButton::MAXIMUMWEIGHTMODIFIER)) { ui->weightModifierDoubleSpinBox->setValue(weightModifier); } - for (int i = 1; i <= JoyButton::MAXIMUMMOUSEREFRESHRATE; i++) + for (int i = 1; i <= GlobalVariables::JoyButton::MAXIMUMMOUSEREFRESHRATE; i++) { ui->mouseRefreshRateComboBox->addItem(QString("%1 ms").arg(i), i); } - int refreshIndex = ui->mouseRefreshRateComboBox->findData(JoyButton::getMouseRefreshRate()); + int refreshIndex = ui->mouseRefreshRateComboBox->findData(GlobalVariables::JoyButton::mouseRefreshRate); if (refreshIndex >= 0) { ui->mouseRefreshRateComboBox->setCurrentIndex(refreshIndex); @@ -322,7 +324,7 @@ MainSettingsDialog::MainSettingsDialog(AntiMicroSettings *settings, ui->gamepadPollRateComboBox->addItem(QString("%1 ms").arg(i), QVariant(i)); } - int gamepadPollIndex = ui->gamepadPollRateComboBox->findData(JoyButton::getGamepadRefreshRate()); + int gamepadPollIndex = ui->gamepadPollRateComboBox->findData(GlobalVariables::JoyButton::gamepadRefreshRate); if (gamepadPollIndex >= 0) { ui->gamepadPollRateComboBox->setCurrentIndex(gamepadPollIndex); @@ -386,12 +388,14 @@ MainSettingsDialog::~MainSettingsDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); - delete ui; if (connectedDevices != nullptr) { delete connectedDevices; connectedDevices = nullptr; } + + delete ui; + } void MainSettingsDialog::fillControllerMappingsTable() @@ -745,18 +749,18 @@ void MainSettingsDialog::saveNewSettings() { if (historySize > 0) { - JoyButton::setMouseHistorySize(historySize); + JoyButton::setMouseHistorySize(historySize, GlobalVariables::JoyButton::MAXIMUMMOUSEHISTORYSIZE, GlobalVariables::JoyButton::mouseHistorySize, &GlobalVariables::JoyButton::mouseHistoryX, &GlobalVariables::JoyButton::mouseHistoryY); } - if (weightModifier) + if (weightModifier != 0.0) { - JoyButton::setWeightModifier(weightModifier); + JoyButton::setWeightModifier(weightModifier, GlobalVariables::JoyButton::MAXIMUMWEIGHTMODIFIER, GlobalVariables::JoyButton::weightModifier); } } else { - JoyButton::setMouseHistorySize(1); - JoyButton::setWeightModifier(0.0); + JoyButton::setMouseHistorySize(1, GlobalVariables::JoyButton::MAXIMUMMOUSEHISTORYSIZE, GlobalVariables::JoyButton::mouseHistorySize, &GlobalVariables::JoyButton::mouseHistoryX, &GlobalVariables::JoyButton::mouseHistoryY); + JoyButton::setWeightModifier(0.0, GlobalVariables::JoyButton::MAXIMUMWEIGHTMODIFIER, GlobalVariables::JoyButton::weightModifier); } if (historySize > 0) @@ -771,22 +775,22 @@ void MainSettingsDialog::saveNewSettings() int refreshIndex = ui->mouseRefreshRateComboBox->currentIndex(); int mouseRefreshRate = ui->mouseRefreshRateComboBox->itemData(refreshIndex).toInt(); - if (mouseRefreshRate != JoyButton::getMouseRefreshRate()) + if (mouseRefreshRate != GlobalVariables::JoyButton::mouseRefreshRate) { settings->setValue("Mouse/RefreshRate", mouseRefreshRate); - JoyButton::setMouseRefreshRate(mouseRefreshRate); + JoyButton::setMouseRefreshRate(mouseRefreshRate, GlobalVariables::JoyButton::mouseRefreshRate, GlobalVariables::JoyButton::IDLEMOUSEREFRESHRATE, JoyButton::getMouseHelper(), &GlobalVariables::JoyButton::mouseHistoryX, &GlobalVariables::JoyButton::mouseHistoryY, JoyButton::getTestOldMouseTime(), JoyButton::getStaticMouseEventTimer()); } int springIndex = ui->springScreenComboBox->currentIndex(); int springScreen = ui->springScreenComboBox->itemData(springIndex).toInt(); - JoyButton::setSpringModeScreen(springScreen); + JoyButton::setSpringModeScreen(springScreen, GlobalVariables::JoyButton::springModeScreen); settings->setValue("Mouse/SpringScreen", QString::number(springScreen)); int pollIndex = ui->gamepadPollRateComboBox->currentIndex(); - int gamepadPollRate = ui->gamepadPollRateComboBox->itemData(pollIndex).toUInt(); - if (gamepadPollRate != JoyButton::getGamepadRefreshRate()) + int gamepadPollRate = ui->gamepadPollRateComboBox->itemData(pollIndex).toInt(); + if (gamepadPollRate != GlobalVariables::JoyButton::gamepadRefreshRate) { - JoyButton::setGamepadRefreshRate(gamepadPollRate); + JoyButton::setGamepadRefreshRate(gamepadPollRate, GlobalVariables::JoyButton::gamepadRefreshRate, JoyButton::getMouseHelper()); settings->setValue("GamepadPollRate", QString::number(gamepadPollRate)); } @@ -839,53 +843,71 @@ void MainSettingsDialog::checkLocaleChange() else { QString newLocale = "en"; - if (row == 1) - { - newLocale = "br"; - } - else if (row == 2) - { - newLocale = "en"; - } - else if (row == 3) - { - newLocale = "fr"; - } - else if (row == 4) - { - newLocale = "de"; - } - else if (row == 5) - { - newLocale = "it"; - } - else if (row == 6) - { - newLocale = "ja"; - } - else if (row == 7) - { - newLocale = "ru"; - } - else if (row == 8) - { - newLocale = "sr"; - } - else if (row == 9) - { - newLocale = "zh_CN"; - } - else if (row == 10) - { - newLocale = "es"; - } - else if (row == 11) - { - newLocale = "uk"; - } - else if (row == 12) + + switch(row) { - newLocale = "pl"; + + case 1: + { + newLocale = "br"; + break; + } + case 2: + { + newLocale = "en"; + break; + } + case 3: + { + newLocale = "fr"; + break; + } + case 4: + { + newLocale = "de"; + break; + } + case 5: + { + newLocale = "it"; + break; + } + case 6: + { + newLocale = "ja"; + break; + } + case 7: + { + newLocale = "ru"; + break; + } + case 8: + { + newLocale = "sr"; + break; + } + case 9: + { + newLocale = "zh_CN"; + break; + } + case 10: + { + newLocale = "es"; + break; + } + case 11: + { + newLocale = "uk"; + break; + } + case 12: + { + newLocale = "pl"; + break; + } + } settings->setValue("Language", newLocale); @@ -1009,7 +1031,7 @@ void MainSettingsDialog::fillAutoProfilesTable(QString guid) { qInstallMessageHandler(MessageHandler::myMessageOutput); - for (int i = ui->autoProfileTableWidget->rowCount()-1; i >= 0; i--) + for (int i = ui->autoProfileTableWidget->rowCount() - 1; i >= 0; i--) { ui->autoProfileTableWidget->removeRow(i); } @@ -1035,11 +1057,13 @@ void MainSettingsDialog::fillAutoProfilesTable(QString guid) QString deviceName = info->getDeviceName(); QString guidDisplay = info->getGUID(); + if (!deviceName.isEmpty()) { guidDisplay = QString("%1 ").arg(info->getDeviceName()); guidDisplay.append(QString("(%1)").arg(info->getGUID())); } + item = new QTableWidgetItem(guidDisplay); item->setFlags(item->flags() & ~Qt::ItemIsEditable); item->setData(Qt::UserRole, info->getGUID()); @@ -1097,11 +1121,13 @@ void MainSettingsDialog::fillAutoProfilesTable(QString guid) QString deviceName = info->getDeviceName(); QString guidDisplay = info->getGUID(); + if (!deviceName.isEmpty()) { guidDisplay = QString("%1 ").arg(info->getDeviceName()); guidDisplay.append(QString("(%1)").arg(info->getGUID())); } + item = new QTableWidgetItem(guidDisplay); item->setFlags(item->flags() & ~Qt::ItemIsEditable); item->setData(Qt::UserRole, info->getGUID()); @@ -1487,10 +1513,11 @@ void MainSettingsDialog::openAddAutoProfileDialog() QList reservedGUIDs = defaultAutoProfiles.keys(); AutoProfileInfo *info = new AutoProfileInfo(this); AddEditAutoProfileDialog *dialog = new AddEditAutoProfileDialog(info, settings, connectedDevices, reservedGUIDs, false, this); - connect(dialog, &AddEditAutoProfileDialog::accepted, this, [this, dialog] { - addNewAutoProfile(dialog); - }); + // connect(dialog, &AddEditAutoProfileDialog::accepted, this, [this, dialog] { + // addNewAutoProfile(dialog); + // }); + connect(dialog, SIGNAL(accepted()), this, SLOT(addNewAutoProfile())); connect(dialog, &AddEditAutoProfileDialog::rejected, info, &AutoProfileInfo::deleteLater); dialog->show(); } @@ -1725,13 +1752,14 @@ void MainSettingsDialog::transferEditsToCurrentTableRow(AddEditAutoProfileDialog changeDeviceForProfileTable(currentIndex); } -void MainSettingsDialog::addNewAutoProfile(AddEditAutoProfileDialog *dialog) +void MainSettingsDialog::addNewAutoProfile() { qInstallMessageHandler(MessageHandler::myMessageOutput); + AddEditAutoProfileDialog *dialog = static_cast(sender()); AutoProfileInfo *info = dialog->getAutoProfile(); - bool found = false; + if (info->isCurrentDefault()) { if (defaultAutoProfiles.contains(info->getGUID())) @@ -1891,7 +1919,7 @@ void MainSettingsDialog::fillSpringScreenPresets() ui->springScreenComboBox->clear(); ui->springScreenComboBox->addItem(trUtf8("Default"), - QVariant(AntiMicroSettings::defaultSpringScreen)); + QVariant(GlobalVariables::AntimicroSettings::defaultSpringScreen)); QDesktopWidget deskWid; for (int i=0; i < deskWid.screenCount(); i++) @@ -1899,7 +1927,7 @@ void MainSettingsDialog::fillSpringScreenPresets() ui->springScreenComboBox->addItem(QString(":%1").arg(i), QVariant(i)); } - int screenIndex = ui->springScreenComboBox->findData(JoyButton::getSpringModeScreen()); + int screenIndex = ui->springScreenComboBox->findData(GlobalVariables::JoyButton::springModeScreen); if (screenIndex > -1) { ui->springScreenComboBox->setCurrentIndex(screenIndex); @@ -1921,7 +1949,7 @@ void MainSettingsDialog::refreshExtraMouseInfo() } else if (handler == "xtest") { - temp = X11Extras::getInstance()->getPointInformation(X11Extras::xtestMouseDeviceName); + temp = X11Extras::getInstance()->getPointInformation(GlobalVariables::X11Extras::xtestMouseDeviceName); } if (temp.id >= 0) @@ -2000,3 +2028,156 @@ QList* MainSettingsDialog::getConnectedDevices() const { return connectedDevices; } + +void MainSettingsDialog::on_resetBtn_clicked() +{ + QMessageBox msgBox; + msgBox.setText(trUtf8("Do you really want to reset setting?")); + msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); + + switch(msgBox.exec()) + { + case QMessageBox::Ok: + resetGeneralSett(); + resetAutoProfSett(); + resetMouseSett(); + resetAdvancedSett(); + ui->localeListWidget->setCurrentRow(0); + + break; + + case QMessageBox::Cancel: + + break; + + default: + + break; + } + + QMessageBox msgBox2; + msgBox2.setText(trUtf8("Would you like to reset mappings too?")); + msgBox2.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); + + switch(msgBox2.exec()) + { + case QMessageBox::Ok: + + ui->controllerMappingsTableWidget->setRowCount(0); + + break; + + case QMessageBox::Cancel: + + break; + + default: + + break; + } + + +} + + +void MainSettingsDialog::resetGeneralSett() +{ + ui->profileDefaultDirLineEdit->setText(PadderCommon::preferredProfileDir(settings)); + ui->numberRecentProfileSpinBox->setValue(5); + int gamepadPollIndex = ui->gamepadPollRateComboBox->findData(GlobalVariables::JoyButton::gamepadRefreshRate); + + if (gamepadPollIndex >= 0) + { + ui->gamepadPollRateComboBox->setCurrentIndex(gamepadPollIndex); + } + + ui->closeToTrayCheckBox->setChecked(false); + ui->launchAtWinStartupCheckBox->setChecked(false); + ui->traySingleProfileListCheckBox->setChecked(false); + ui->minimizeTaskbarCheckBox->setChecked(false); + ui->hideEmptyCheckBox->setChecked(false); + ui->autoLoadPreviousCheckBox->setChecked(true); + ui->launchInTrayCheckBox->setChecked(false); + ui->associateProfilesCheckBox->setChecked(true); + ui->keyRepeatEnableCheckBox->setChecked(false); + + ui->keyDelayHorizontalSlider->setValue(660); + ui->keyRateHorizontalSlider->setValue(25); +} + + +void MainSettingsDialog::resetAutoProfSett() +{ + + disconnect(ui->autoProfileTableWidget, &QTableWidget::itemChanged, this, &MainSettingsDialog::processAutoProfileActiveClick); + + ui->activeCheckBox->setChecked(false); + ui->devicesComboBox->setCurrentIndex(0); + + ui->autoProfileTableWidget->setRowCount(0); + + AutoProfileInfo *info = allDefaultProfile; + + ui->autoProfileTableWidget->insertRow(0); + QTableWidgetItem *item = new QTableWidgetItem(); + item->setCheckState(info->isActive() ? Qt::Checked : Qt::Unchecked); + ui->autoProfileTableWidget->setItem(0, 0, item); + + QString deviceName = info->getDeviceName(); + QString guidDisplay = info->getGUID(); + + if (!deviceName.isEmpty()) + { + guidDisplay = QString("%1 ").arg(info->getDeviceName()); + guidDisplay.append(QString("(%1)").arg(info->getGUID())); + } + + item = new QTableWidgetItem(guidDisplay); + item->setFlags(item->flags() & ~Qt::ItemIsEditable); + item->setData(Qt::UserRole, info->getGUID()); + item->setToolTip(info->getGUID()); + ui->autoProfileTableWidget->setItem(0, 1, item); + + item = new QTableWidgetItem("Default"); + item->setData(Qt::UserRole, "default"); + ui->autoProfileTableWidget->setItem(0, 6, item); + + item = new QTableWidgetItem("Instance"); + item->setData(Qt::UserRole, QVariant::fromValue(info)); + ui->autoProfileTableWidget->setItem(0, 7, item); + + if (ui->autoProfileTableWidget->rowCount() == 1) profileList.clear(); + + connect(ui->autoProfileTableWidget, &QTableWidget::itemChanged, this, &MainSettingsDialog::processAutoProfileActiveClick); +} + + +void MainSettingsDialog::resetMouseSett() +{ + ui->disableWindowsEnhancedPointCheckBox->setChecked(false); + ui->smoothingEnableCheckBox->setChecked(false); + ui->smoothingEnableCheckBox->setEnabled(true); + ui->historySizeSpinBox->setValue(10); + ui->historySizeSpinBox->setEnabled(false); + ui->weightModifierDoubleSpinBox->setValue(0.20); + ui->weightModifierDoubleSpinBox->setEnabled(false); + + int refreshIndex = ui->mouseRefreshRateComboBox->findData(GlobalVariables::JoyButton::mouseRefreshRate); + if (refreshIndex >= 0) + { + ui->mouseRefreshRateComboBox->setCurrentIndex(refreshIndex); + } + + int screenIndex = ui->springScreenComboBox->findData(GlobalVariables::JoyButton::springModeScreen); + if (screenIndex > -1) + { + ui->springScreenComboBox->setCurrentIndex(screenIndex); + } +} + + +void MainSettingsDialog::resetAdvancedSett() +{ + ui->logFilePathEdit->setText(""); + ui->logLevelComboBox->setCurrentIndex(0); +} diff --git a/src/mainsettingsdialog.h b/src/mainsettingsdialog.h old mode 100644 new mode 100755 index ba099d6a2..81dd5138c --- a/src/mainsettingsdialog.h +++ b/src/mainsettingsdialog.h @@ -88,13 +88,16 @@ protected slots: void changeAutoProfileButtonsState(); void transferEditsToCurrentTableRow(AddEditAutoProfileDialog *dialog); void transferAllProfileEditToCurrentTableRow(EditAllDefaultAutoProfileDialog* dialog); - void addNewAutoProfile(AddEditAutoProfileDialog *dialog); + void addNewAutoProfile(); void autoProfileButtonsActiveState(bool enabled); void changeKeyRepeatWidgetsStatus(bool enabled); void checkSmoothingWidgetStatus(bool enabled); void resetMouseAcceleration(); void selectLogFile(); +private slots: + void on_resetBtn_clicked(); + private: Ui::MainSettingsDialog *ui; @@ -109,6 +112,11 @@ protected slots: AutoProfileInfo* allDefaultProfile; QList *connectedDevices; + + void resetGeneralSett(); + void resetAutoProfSett(); + void resetMouseSett(); + void resetAdvancedSett(); }; #endif // MAINSETTINGSDIALOG_H diff --git a/src/mainsettingsdialog.ui b/src/mainsettingsdialog.ui old mode 100644 new mode 100755 index 8707a2cab..daf2affca --- a/src/mainsettingsdialog.ui +++ b/src/mainsettingsdialog.ui @@ -10,7 +10,7 @@ 0 0 706 - 582 + 627 @@ -92,7 +92,7 @@ - 3 + 0 @@ -110,7 +110,7 @@ - Profi&le Directory: + Profile Direc&tory: profileDefaultDirLineEdit @@ -1205,7 +1205,7 @@ values used by the virtual mouse. 10 9 481 - 31 + 36 @@ -1230,7 +1230,7 @@ values used by the virtual mouse. 9 69 481 - 31 + 34 @@ -1294,14 +1294,37 @@ values used by the virtual mouse. - - - Qt::Horizontal + + + 5 - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + 5 - + + 5 + + + 5 + + + + + Reset + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp old mode 100644 new mode 100755 index 8228045bd..87e2940c8 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -41,7 +41,7 @@ #include "calibration.h" #if defined(WITH_X11) || defined(Q_OS_WIN) -#include "autoprofileinfo.h" + #include "autoprofileinfo.h" #endif #ifdef Q_OS_WIN @@ -49,7 +49,7 @@ #endif #ifdef Q_OS_UNIX -#include + #include #endif #include @@ -69,11 +69,14 @@ #include #include #include +#include #ifdef Q_OS_WIN -#include + #include #endif + + MainWindow::MainWindow(QMap *joysticks, CommandLineUtility *cmdutility, AntiMicroSettings *settings, bool graphical, QWidget *parent) : @@ -85,11 +88,11 @@ MainWindow::MainWindow(QMap *joysticks, qInstallMessageHandler(MessageHandler::myMessageOutput); ui->stackedWidget->setCurrentIndex(0); - this->translator = nullptr; - this->appTranslator = nullptr; - this->cmdutility = cmdutility; - this->graphical = graphical; - this->settings = settings; + m_translator = nullptr; + m_appTranslator = nullptr; + m_cmdutility = cmdutility; + m_graphical = graphical; + m_settings = settings; ui->actionStick_Pad_Assign->setVisible(false); @@ -117,7 +120,7 @@ MainWindow::MainWindow(QMap *joysticks, showTrayIcon = !cmdutility->isTrayHidden() && graphical && !cmdutility->shouldListControllers() && !cmdutility->shouldMapController(); - this->joysticks = joysticks; + m_joysticks = joysticks; if (showTrayIcon) { @@ -178,10 +181,10 @@ MainWindow::MainWindow(QMap *joysticks, connect(ui->actionGameController_Mapping, &QAction::triggered, this, &MainWindow::openGameControllerMappingWindow); #if defined(Q_OS_UNIX) && defined(WITH_X11) - if (QApplication::platformName() == QStringLiteral("xcb")) - { - connect(appWatcher, &AutoProfileWatcher::foundApplicableProfile, this, &MainWindow::autoprofileLoad); - } + if (QApplication::platformName() == QStringLiteral("xcb")) + { + connect(appWatcher, &AutoProfileWatcher::foundApplicableProfile, this, &MainWindow::autoprofileLoad); + } #elif defined(Q_OS_WIN) connect(appWatcher, &AutoProfileWatcher::foundApplicableProfile, this, &MainWindow::autoprofileLoad); #endif @@ -221,29 +224,29 @@ void MainWindow::alterConfigFromSettings() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (cmdutility->shouldListControllers()) + if (m_cmdutility->shouldListControllers()) { - graphical = false; + m_graphical = false; } - else if (cmdutility->hasProfile()) + else if (m_cmdutility->hasProfile()) { - if (cmdutility->hasControllerNumber()) + if (m_cmdutility->hasControllerNumber()) { - loadConfigFile(cmdutility->getProfileLocation(), - cmdutility->getControllerNumber()); + loadConfigFile(m_cmdutility->getProfileLocation(), + m_cmdutility->getControllerNumber()); } - else if (cmdutility->hasControllerID()) + else if (m_cmdutility->hasControllerID()) { - loadConfigFile(cmdutility->getProfileLocation(), - cmdutility->hasControllerID()); + loadConfigFile(m_cmdutility->getProfileLocation(), + m_cmdutility->hasControllerID()); } else { - loadConfigFile(cmdutility->getProfileLocation()); + loadConfigFile(m_cmdutility->getProfileLocation()); } } - const QList tempList = cmdutility->getControllerOptionsList(); + const QList tempList = m_cmdutility->getControllerOptionsList(); //unsigned int optionListSize = tempList->size(); QListIterator optionIter(tempList); @@ -307,17 +310,17 @@ void MainWindow::controllerMapOpening() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (cmdutility->shouldMapController()) + if (m_cmdutility->shouldMapController()) { - graphical = false; + m_graphical = false; - const QList tempList = cmdutility->getControllerOptionsList(); + const QList tempList = m_cmdutility->getControllerOptionsList(); ControllerOptionsInfo temp = tempList.at(0); if (temp.hasControllerNumber()) { - int joypadIndex = cmdutility->getControllerNumber(); + int joypadIndex = m_cmdutility->getControllerNumber(); #ifndef QT_DEBUG_NO_OUTPUT qDebug() << "It was antimicro --map controllerNumber"; @@ -331,7 +334,7 @@ void MainWindow::controllerMapOpening() { - QString joypadGUID = cmdutility->getControllerID(); + QString joypadGUID = m_cmdutility->getControllerID(); #ifndef QT_DEBUG_NO_OUTPUT qDebug() << "It was antimicro --map controllerID"; @@ -359,7 +362,7 @@ void MainWindow::fillButtons() { qInstallMessageHandler(MessageHandler::myMessageOutput); - fillButtons(joysticks); + fillButtons(m_joysticks); } void MainWindow::makeJoystickTabs() @@ -372,7 +375,7 @@ void MainWindow::makeJoystickTabs() // Make temporary QMap with devices inserted using the device index as the // key rather than joystick ID. QMap temp; - QMapIterator iterTemp(*joysticks); + QMapIterator iterTemp(*m_joysticks); while (iterTemp.hasNext()) { @@ -389,13 +392,13 @@ void MainWindow::makeJoystickTabs() iter.next(); InputDevice *joystick = iter.value(); - JoyTabWidget *tabwidget = new JoyTabWidget(joystick, settings, this); + JoyTabWidget *tabwidget = new JoyTabWidget(joystick, m_settings, this); QString joytabName = joystick->getSDLName(); joytabName.append(" ").append(trUtf8("(%1)").arg(joystick->getName())); ui->tabWidget->addTab(tabwidget, joytabName); } - if (joysticks != nullptr) + if (m_joysticks != nullptr) { ui->tabWidget->setCurrentIndex(0); ui->stackedWidget->setCurrentIndex(1); @@ -438,7 +441,7 @@ void MainWindow::fillButtons(QMap *joysticks) InputDevice *joystick = iter.value(); - JoyTabWidget *tabwidget = new JoyTabWidget(joystick, settings, this); + JoyTabWidget *tabwidget = new JoyTabWidget(joystick, m_settings, this); QString joytabName = joystick->getSDLName(); joytabName.append(" ").append(trUtf8("(%1)").arg(joystick->getName())); ui->tabWidget->addTab(tabwidget, joytabName); @@ -472,6 +475,7 @@ void MainWindow::fillButtons(QMap *joysticks) ui->actionUpdate_Joysticks->setEnabled(true); ui->actionHide->setEnabled(true); ui->actionQuit->setEnabled(true); + } // Intermediate slot to be used in Form Designer @@ -496,12 +500,29 @@ void MainWindow::populateTrayIcon() trayIconMenu->clear(); profileActions.clear(); - int joystickCount = joysticks->size(); + + closeAction = new QAction(trUtf8("&Quit"), trayIconMenu); + closeAction->setIcon(QIcon::fromTheme("application-exit")); + connect(closeAction, &QAction::triggered, this, &MainWindow::quitProgram, Qt::DirectConnection); + + hideAction = new QAction(trUtf8("&Hide"), trayIconMenu); + hideAction->setIcon(QIcon::fromTheme("view-restore")); + connect(hideAction, &QAction::triggered, this, &MainWindow::hideWindow); + + restoreAction = new QAction(trUtf8("&Restore"), trayIconMenu); + restoreAction->setIcon(QIcon::fromTheme("view-fullscreen")); + connect(restoreAction, &QAction::triggered, this, &MainWindow::show); + + updateJoy = new QAction(trUtf8("&Update Joysticks"), trayIconMenu); + updateJoy->setIcon(QIcon::fromTheme("view-refresh")); + connect(updateJoy, &QAction::triggered, this, &MainWindow::startJoystickRefresh); + + int joystickCount = m_joysticks->size(); if (joystickCount > 0) { - QMapIterator iter(*joysticks); - bool useSingleList = settings->value("TrayProfileList", false).toBool(); + QMapIterator iter(*m_joysticks); + bool useSingleList = m_settings->value("TrayProfileList", false).toBool(); if (!useSingleList && (joystickCount == 1)) { useSingleList = true; @@ -544,7 +565,13 @@ void MainWindow::populateTrayIcon() newaction->setCheckable(true); newaction->setChecked(false); - if (configIter.key() == widget->getCurrentConfigIndex()) + QString identifier = current->getStringIdentifier(); + QString controlEntryLastSelected = QString("Controller%1LastSelected").arg(identifier); + + QFileInfo fileInfo(m_settings->value(controlEntryLastSelected).toString()); + + + if ((configIter.value() == fileInfo.baseName()) || (configIter.value() == widget->getCurrentConfigName())) { newaction->setChecked(true); } @@ -553,6 +580,7 @@ void MainWindow::populateTrayIcon() tempmap.insert(QString::number(i), QVariant (configIter.key())); QVariant tempvar (tempmap); newaction->setData(tempvar); + connect(newaction, &QAction::triggered, this, [this, newaction](bool checked) { profileTrayActionTriggered(newaction, checked); }); @@ -623,22 +651,6 @@ void MainWindow::populateTrayIcon() trayIconMenu->addSeparator(); } - hideAction = new QAction(trUtf8("&Hide"), trayIconMenu); - hideAction->setIcon(QIcon::fromTheme("view-restore")); - connect(hideAction, &QAction::triggered, this, &MainWindow::hideWindow); - - restoreAction = new QAction(trUtf8("&Restore"), trayIconMenu); - restoreAction->setIcon(QIcon::fromTheme("view-fullscreen")); - connect(restoreAction, &QAction::triggered, this, &MainWindow::show); - - closeAction = new QAction(trUtf8("&Quit"), trayIconMenu); - closeAction->setIcon(QIcon::fromTheme("application-exit")); - connect(closeAction, &QAction::triggered, this, &MainWindow::quitProgram); - - updateJoy = new QAction(trUtf8("&Update Joysticks"), trayIconMenu); - updateJoy->setIcon(QIcon::fromTheme("view-refresh")); - connect(updateJoy, &QAction::triggered, this, &MainWindow::startJoystickRefresh); - trayIconMenu->addAction(hideAction); trayIconMenu->addAction(restoreAction); trayIconMenu->addAction(updateJoy); @@ -654,16 +666,16 @@ void MainWindow::quitProgram() qInstallMessageHandler(MessageHandler::myMessageOutput); bool discard = true; - for (int i=0; i < ui->tabWidget->count() && discard; i++) + AutoProfileWatcher::getAutoProfileWatcherInstance()->disconnectWindowTimer(); + + for (int i = 0; (i < ui->tabWidget->count()) && discard; i++) { - JoyTabWidget *tab = qobject_cast(ui->tabWidget->widget(i)); // static_cast + JoyTabWidget *tab = qobject_cast(ui->tabWidget->widget(i)); discard = tab->discardUnsavedProfileChanges(); } - if (discard) - { - qApp->quit(); - } + if (discard) qApp->quit(); + } void MainWindow::refreshTrayIconMenu() @@ -720,13 +732,13 @@ void MainWindow::saveAppConfig() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (joysticks->size() > 0) + if (m_joysticks->size() > 0) { JoyTabWidget *temptabwidget = qobject_cast(ui->tabWidget->widget(0)); // static_cast - settings->setValue("DisplayNames", + m_settings->setValue("DisplayNames", temptabwidget->isDisplayingNames() ? "1" : "0"); - settings->beginGroup("Controllers"); + m_settings->beginGroup("Controllers"); QStringList tempIdentifierHolder = QStringList(); for (int i=0; i < ui->tabWidget->count(); i++) @@ -758,11 +770,11 @@ void MainWindow::saveAppConfig() } } - settings->endGroup(); + m_settings->endGroup(); } - settings->setValue("WindowSize", size()); - settings->setValue("WindowPosition", pos()); + m_settings->setValue("WindowSize", size()); + m_settings->setValue("WindowPosition", pos()); } void MainWindow::loadAppConfig(bool forceRefresh) @@ -960,8 +972,6 @@ void MainWindow::showEvent(QShowEvent *event) { qInstallMessageHandler(MessageHandler::myMessageOutput); - bool propogate = true; - // Check if hideEvent has been processed if (signalDisconnect && isVisible()) { @@ -989,10 +999,8 @@ void MainWindow::showEvent(QShowEvent *event) } } - if (propogate) - { - QMainWindow::showEvent(event); - } + QMainWindow::showEvent(event); + } void MainWindow::changeEvent(QEvent *event) @@ -1004,7 +1012,7 @@ void MainWindow::changeEvent(QEvent *event) QWindowStateChangeEvent *e = static_cast(event); if (e->oldState() != Qt::WindowMinimized && isMinimized()) { - bool minimizeToTaskbar = settings->value("MinimizeToTaskbar", false).toBool(); + bool minimizeToTaskbar = m_settings->value("MinimizeToTaskbar", false).toBool(); if (QSystemTrayIcon::isSystemTrayAvailable() && showTrayIcon && !minimizeToTaskbar) { this->hideWindow(); @@ -1037,7 +1045,7 @@ void MainWindow::loadConfigFile(QString fileLocation, int joystickIndex) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((joystickIndex > 0) && joysticks->contains(joystickIndex - 1)) + if ((joystickIndex > 0) && m_joysticks->contains(joystickIndex - 1)) { JoyTabWidget *widget = qobject_cast(ui->tabWidget->widget(joystickIndex-1)); // static_cast if (widget != nullptr) @@ -1103,7 +1111,7 @@ void MainWindow::handleInstanceDisconnect() { qInstallMessageHandler(MessageHandler::myMessageOutput); - settings->sync(); + m_settings->sync(); loadAppConfig(true); } @@ -1163,13 +1171,13 @@ void MainWindow::openCalibration() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (joysticks->isEmpty()) { + if (m_joysticks->isEmpty()) { QMessageBox::information(this, trUtf8("Calibration couldn't be opened"), trUtf8("You must connect at least one controller to open the window")); } else { - QPointer calibration = new Calibration(joysticks); + QPointer calibration = new Calibration(m_joysticks); calibration.data()->show(); if (calibration.isNull()) @@ -1183,7 +1191,7 @@ void MainWindow::unloadCurrentConfig(int joystickIndex) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((joystickIndex > 0) && joysticks->contains(joystickIndex - 1)) + if ((joystickIndex > 0) && m_joysticks->contains(joystickIndex - 1)) { JoyTabWidget *widget = qobject_cast (ui->tabWidget->widget(joystickIndex - 1)); // static_cast if (widget != nullptr) @@ -1273,7 +1281,7 @@ void MainWindow::changeStartSetNumber(int startSetNumber, int joystickIndex) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((joystickIndex > 0) && joysticks->contains(joystickIndex - 1)) + if ((joystickIndex > 0) && m_joysticks->contains(joystickIndex - 1)) { JoyTabWidget *widget = qobject_cast(ui->tabWidget->widget(joystickIndex - 1)); // static_cast if (widget != nullptr) @@ -1304,8 +1312,8 @@ void MainWindow::openMainSettingsDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); - QList *devices = new QList(joysticks->values()); - MainSettingsDialog *dialog = new MainSettingsDialog(settings, devices, this); + QList *devices = new QList(m_joysticks->values()); + MainSettingsDialog *dialog = new MainSettingsDialog(m_settings, devices, this); connect(dialog, &MainSettingsDialog::changeLanguage, this, &MainWindow::changeLanguage); if (appWatcher != nullptr) @@ -1348,9 +1356,9 @@ void MainWindow::changeLanguage(QString language) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((translator != nullptr) && (appTranslator != nullptr)) + if ((m_translator != nullptr) && (m_appTranslator != nullptr)) { - PadderCommon::reloadTranslations(translator, appTranslator, language); + PadderCommon::reloadTranslations(m_translator, m_appTranslator, language); } } @@ -1364,7 +1372,7 @@ void MainWindow::closeEvent(QCloseEvent *event) { qInstallMessageHandler(MessageHandler::myMessageOutput); - bool closeToTray = settings->value("CloseToTray", false).toBool(); + bool closeToTray = m_settings->value("CloseToTray", false).toBool(); if (closeToTray && QSystemTrayIcon::isSystemTrayAvailable() && showTrayIcon) { this->hideWindow(); @@ -1573,11 +1581,11 @@ void MainWindow::openGameControllerMappingWindow(bool openAsMain) InputDevice *joystick = joyTab->getJoystick(); if (joystick != nullptr) { - GameControllerMappingDialog *dialog = new GameControllerMappingDialog(joystick, settings, this); + GameControllerMappingDialog *dialog = new GameControllerMappingDialog(joystick, m_settings, this); if (openAsMain) { - dialog->setParent(0); + dialog->setParent(nullptr); dialog->setWindowFlags(Qt::Window); connect(dialog, &GameControllerMappingDialog::finished, qApp, &QApplication::quit); } @@ -1615,7 +1623,7 @@ void MainWindow::testMappingUpdateNow(int index, InputDevice *device) tab = nullptr; } - JoyTabWidget *tabwidget = new JoyTabWidget(device, settings, this); + JoyTabWidget *tabwidget = new JoyTabWidget(device, m_settings, this); QString joytabName = device->getSDLName(); joytabName.append(" ").append(trUtf8("(%1)").arg(device->getName())); ui->tabWidget->insertTab(index, tabwidget, joytabName); @@ -1689,7 +1697,7 @@ void MainWindow::addJoyTab(InputDevice *device) { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyTabWidget *tabwidget = new JoyTabWidget(device, settings, this); + JoyTabWidget *tabwidget = new JoyTabWidget(device, m_settings, this); QString joytabName = device->getSDLName(); joytabName.append(" ").append(trUtf8("(%1)").arg(device->getName())); ui->tabWidget->addTab(tabwidget, joytabName); @@ -1702,10 +1710,10 @@ void MainWindow::addJoyTab(InputDevice *device) JoyTabWidget *tab = qobject_cast(ui->tabWidget->widget(i)); // static_cast if (tab != nullptr) { - InputDevice *device = tab->getJoystick(); - QString joytabName = device->getSDLName(); - joytabName.append(" ").append(trUtf8("(%1)").arg(device->getName())); - ui->tabWidget->setTabText(i, joytabName); + InputDevice *device_in_loop = tab->getJoystick(); + QString joytabName_in_loop = device_in_loop->getSDLName(); + joytabName_in_loop.append(" ").append(trUtf8("(%1)").arg(device_in_loop->getName())); + ui->tabWidget->setTabText(i, joytabName_in_loop); } } @@ -1829,7 +1837,7 @@ void MainWindow::checkAutoProfileWatcherTimer() if (QApplication::platformName() == QStringLiteral("xcb")) { #endif - QString autoProfileActive = settings->value("AutoProfiles/AutoProfilesActive", "0").toString(); + QString autoProfileActive = m_settings->value("AutoProfiles/AutoProfilesActive", "0").toString(); if (autoProfileActive == "1") { appWatcher->startTimer(); @@ -1878,7 +1886,7 @@ void MainWindow::selectControllerJoyTab(int index) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if ((index > 0) && joysticks->contains(index - 1)) + if ((index > 0) && m_joysticks->contains(index - 1)) { JoyTabWidget *widget = qobject_cast (ui->tabWidget->widget(index - 1)); // static_cast if (widget != nullptr) @@ -1908,7 +1916,8 @@ void MainWindow::selectControllerJoyTab(QString GUID) if (!GUID.isEmpty()) { InputDevice *device = nullptr; - QMapIterator deviceIter(*joysticks); + QMapIterator deviceIter(*m_joysticks); + while (deviceIter.hasNext()) { deviceIter.next(); @@ -1943,15 +1952,16 @@ void MainWindow::changeWindowStatus() // Check flags to see if user requested for the main window and the tray icon // to not be displayed. - if (graphical) + + if (m_graphical) { - bool launchInTraySetting = settings->runtimeValue("LaunchInTray", false).toBool(); - if (!cmdutility->isHiddenRequested() && + bool launchInTraySetting = m_settings->runtimeValue("LaunchInTray", false).toBool(); + if (!m_cmdutility->isHiddenRequested() && (!launchInTraySetting || !QSystemTrayIcon::isSystemTrayAvailable())) { show(); } - else if (cmdutility->isHiddenRequested() && cmdutility->isTrayHidden()) + else if (m_cmdutility->isHiddenRequested() && m_cmdutility->isTrayHidden()) { // Window should already be hidden but make sure // to disable flashing buttons. @@ -1959,11 +1969,13 @@ void MainWindow::changeWindowStatus() setEnabled(false); // Should already be disabled. Do it again just to be sure. } - else if (cmdutility->isHiddenRequested() || launchInTraySetting) + else if (m_cmdutility->isHiddenRequested() || launchInTraySetting) { // Window should already be hidden but make sure // to disable flashing buttons. hideWindow(); + + setEnabled(true); } } } @@ -1972,35 +1984,35 @@ bool MainWindow::getGraphicalStatus() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return graphical; + return m_graphical; } void MainWindow::setTranslator(QTranslator *translator) { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->translator = translator; + m_translator = translator; } QTranslator* MainWindow::getTranslator() const { qInstallMessageHandler(MessageHandler::myMessageOutput); - return translator; + return m_translator; } void MainWindow::setAppTranslator(QTranslator *translator) { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->appTranslator = translator; + m_appTranslator = translator; } QTranslator* MainWindow::getAppTranslator() const { qInstallMessageHandler(MessageHandler::myMessageOutput); - return appTranslator; + return m_appTranslator; } void MainWindow::retranslateUi() diff --git a/src/mainwindow.h b/src/mainwindow.h old mode 100644 new mode 100755 index 15f215bfe..4b4927501 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -149,16 +149,16 @@ private slots: private: Ui::MainWindow *ui; - QMap *joysticks; + QMap *m_joysticks; QMap > profileActions; QSystemTrayIcon *trayIcon; QMenu *trayIconMenu; AboutDialog *aboutDialog; - CommandLineUtility *cmdutility; - AntiMicroSettings *settings; - QTranslator *translator; - QTranslator *appTranslator; + CommandLineUtility *m_cmdutility; + AntiMicroSettings *m_settings; + QTranslator *m_translator; + QTranslator *m_appTranslator; AutoProfileWatcher *appWatcher; QAction *hideAction; @@ -168,7 +168,7 @@ private slots: bool signalDisconnect; bool showTrayIcon; - bool graphical; + bool m_graphical; }; diff --git a/src/mainwindow.ui b/src/mainwindow.ui old mode 100644 new mode 100755 index 9721b0c74..856aa9cde --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -24,7 +24,7 @@ - :/images/antimicro.png:/images/antimicro.png + :/images/16x16/com.github.juliagoda.antimicro.png:/images/16x16/com.github.juliagoda.antimicro.png JoyButtonWidget[isflashing="true"], @@ -192,14 +192,13 @@ QPushButton#namesPushButton[isDisplayingNames="true"] { 0 0 650 - 22 + 29 &App - @@ -336,11 +335,6 @@ QPushButton#namesPushButton[isDisplayingNames="true"] { &Calibration - - - Import profile - - diff --git a/src/messagehandler.cpp b/src/messagehandler.cpp old mode 100644 new mode 100755 index 99aeacb36..88c7b4163 --- a/src/messagehandler.cpp +++ b/src/messagehandler.cpp @@ -27,10 +27,10 @@ namespace MessageHandler case QtFatalMsg: fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); abort(); + default: + break; } #endif } } - - diff --git a/src/messagehandler.h b/src/messagehandler.h old mode 100644 new mode 100755 diff --git a/src/mousedialog/mouseaxissettingsdialog.cpp b/src/mousedialog/mouseaxissettingsdialog.cpp old mode 100644 new mode 100755 index b1c61e073..22cfd8d63 --- a/src/mousedialog/mouseaxissettingsdialog.cpp +++ b/src/mousedialog/mouseaxissettingsdialog.cpp @@ -28,7 +28,6 @@ #include #include #include -#include MouseAxisSettingsDialog::MouseAxisSettingsDialog(JoyAxis *axis, QWidget *parent) : MouseSettingsDialog(parent), @@ -340,7 +339,8 @@ void MouseAxisSettingsDialog::calculateExtraAccelerationMultiplier() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (qFuzzyCompare(axis->getPAxisButton()->getExtraAccelerationMultiplier(), axis->getNAxisButton()->getExtraAccelerationMultiplier())) + if (qFuzzyCompare(axis->getPAxisButton()->getExtraAccelerationMultiplier(), + axis->getNAxisButton()->getExtraAccelerationMultiplier())) { double temp = axis->getPAxisButton()->getExtraAccelerationMultiplier(); ui->extraAccelDoubleSpinBox->setValue(temp); @@ -349,9 +349,11 @@ void MouseAxisSettingsDialog::calculateExtraAccelerationMultiplier() void MouseAxisSettingsDialog::calculateStartAccelerationMultiplier() { + qInstallMessageHandler(MessageHandler::myMessageOutput); - if (qFuzzyCompare(axis->getPAxisButton()->getStartAccelMultiplier(), axis->getNAxisButton()->getStartAccelMultiplier())) + if (qFuzzyCompare(axis->getPAxisButton()->getStartAccelMultiplier(), + axis->getNAxisButton()->getStartAccelMultiplier())) { double temp = axis->getPAxisButton()->getStartAccelMultiplier(); ui->minMultiDoubleSpinBox->setValue(temp); @@ -362,7 +364,8 @@ void MouseAxisSettingsDialog::calculateMinAccelerationThreshold() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (qFuzzyCompare(axis->getPAxisButton()->getMinAccelThreshold(), axis->getNAxisButton()->getMinAccelThreshold())) + if (qFuzzyCompare(axis->getPAxisButton()->getMinAccelThreshold(), + axis->getNAxisButton()->getMinAccelThreshold())) { double temp = axis->getPAxisButton()->getMinAccelThreshold(); ui->minThresholdDoubleSpinBox->setValue(temp); @@ -373,7 +376,8 @@ void MouseAxisSettingsDialog::calculateMaxAccelerationThreshold() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (qFuzzyCompare(axis->getPAxisButton()->getMaxAccelThreshold(), axis->getNAxisButton()->getMaxAccelThreshold())) + if (qFuzzyCompare(axis->getPAxisButton()->getMaxAccelThreshold(), + axis->getNAxisButton()->getMaxAccelThreshold())) { double temp = axis->getPAxisButton()->getMaxAccelThreshold(); ui->maxThresholdDoubleSpinBox->setValue(temp); @@ -384,7 +388,8 @@ void MouseAxisSettingsDialog::calculateAccelExtraDuration() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (qFuzzyCompare(axis->getPAxisButton()->getAccelExtraDuration(), axis->getNAxisButton()->getAccelExtraDuration())) + if (qFuzzyCompare(axis->getPAxisButton()->getAccelExtraDuration(), + axis->getNAxisButton()->getAccelExtraDuration())) { double temp = axis->getPAxisButton()->getAccelExtraDuration(); ui->accelExtraDurationDoubleSpinBox->setValue(temp); diff --git a/src/mousedialog/mouseaxissettingsdialog.h b/src/mousedialog/mouseaxissettingsdialog.h old mode 100644 new mode 100755 diff --git a/src/mousedialog/mousebuttonsettingsdialog.cpp b/src/mousedialog/mousebuttonsettingsdialog.cpp old mode 100644 new mode 100755 index 801095a91..95207c29c --- a/src/mousedialog/mousebuttonsettingsdialog.cpp +++ b/src/mousedialog/mousebuttonsettingsdialog.cpp @@ -30,7 +30,6 @@ #include #include - MouseButtonSettingsDialog::MouseButtonSettingsDialog(JoyButton *button, QWidget *parent) : MouseSettingsDialog(parent), helper(button) @@ -114,11 +113,15 @@ MouseButtonSettingsDialog::MouseButtonSettingsDialog(JoyButton *button, QWidget connect(ui->sensitivityDoubleSpinBox, static_cast(&QDoubleSpinBox::valueChanged), this, &MouseButtonSettingsDialog::updateSensitivity); - connect(ui->wheelHoriSpeedSpinBox, static_cast(&QSpinBox::valueChanged), button, &JoyButton::setWheelSpeedX); - connect(ui->wheelVertSpeedSpinBox, static_cast(&QSpinBox::valueChanged), button, &JoyButton::setWheelSpeedY); + QChar x = 'X'; + QChar y = 'Y'; - connect(ui->easingDoubleSpinBox, static_cast(&QDoubleSpinBox::valueChanged), button, &JoyButton::setEasingDuration); + connect(ui->wheelHoriSpeedSpinBox, static_cast(&QSpinBox::valueChanged), button, [button, x](int value) + { button->setWheelSpeed(value, x); }); + connect(ui->wheelVertSpeedSpinBox, static_cast(&QSpinBox::valueChanged), button, [button, y](int value) + { button->setWheelSpeed(value, y); }); + connect(ui->easingDoubleSpinBox, static_cast(&QDoubleSpinBox::valueChanged), button, &JoyButton::setEasingDuration); connect(ui->extraAccelerationGroupBox, &QGroupBox::clicked, &helper, &MouseButtonSettingsDialogHelper::updateExtraAccelerationStatus); connect(ui->extraAccelDoubleSpinBox, static_cast(&QDoubleSpinBox::valueChanged), &helper, &MouseButtonSettingsDialogHelper::updateExtraAccelerationMultiplier); connect(ui->minMultiDoubleSpinBox, static_cast(&QDoubleSpinBox::valueChanged), &helper, &MouseButtonSettingsDialogHelper::updateStartMultiPercentage); @@ -322,4 +325,3 @@ MouseButtonSettingsDialogHelper& MouseButtonSettingsDialog::getHelperLocal() { return helper; } - diff --git a/src/mousedialog/mousebuttonsettingsdialog.h b/src/mousedialog/mousebuttonsettingsdialog.h old mode 100644 new mode 100755 diff --git a/src/mousedialog/mousecontrolsticksettingsdialog.cpp b/src/mousedialog/mousecontrolsticksettingsdialog.cpp old mode 100644 new mode 100755 diff --git a/src/mousedialog/mousecontrolsticksettingsdialog.h b/src/mousedialog/mousecontrolsticksettingsdialog.h old mode 100644 new mode 100755 diff --git a/src/mousedialog/mousedpadsettingsdialog.cpp b/src/mousedialog/mousedpadsettingsdialog.cpp old mode 100644 new mode 100755 diff --git a/src/mousedialog/mousedpadsettingsdialog.h b/src/mousedialog/mousedpadsettingsdialog.h old mode 100644 new mode 100755 diff --git a/src/mousedialog/springmoderegionpreview.cpp b/src/mousedialog/springmoderegionpreview.cpp old mode 100644 new mode 100755 diff --git a/src/mousedialog/springmoderegionpreview.h b/src/mousedialog/springmoderegionpreview.h old mode 100644 new mode 100755 diff --git a/src/mousedialog/uihelpers/mouseaxissettingsdialoghelper.cpp b/src/mousedialog/uihelpers/mouseaxissettingsdialoghelper.cpp old mode 100644 new mode 100755 diff --git a/src/mousedialog/uihelpers/mouseaxissettingsdialoghelper.h b/src/mousedialog/uihelpers/mouseaxissettingsdialoghelper.h old mode 100644 new mode 100755 diff --git a/src/mousedialog/uihelpers/mousebuttonsettingsdialoghelper.cpp b/src/mousedialog/uihelpers/mousebuttonsettingsdialoghelper.cpp old mode 100644 new mode 100755 diff --git a/src/mousedialog/uihelpers/mousebuttonsettingsdialoghelper.h b/src/mousedialog/uihelpers/mousebuttonsettingsdialoghelper.h old mode 100644 new mode 100755 index ae9ce337b..441d05406 --- a/src/mousedialog/uihelpers/mousebuttonsettingsdialoghelper.h +++ b/src/mousedialog/uihelpers/mousebuttonsettingsdialoghelper.h @@ -40,7 +40,6 @@ public slots: void updateAccelExtraDuration(double value); void updateReleaseSpringRadius(int value); void updateSpringRelativeStatus(bool value); - //void updateExtraAccelerationCurve(int index); private: JoyButton *button; diff --git a/src/mousedialog/uihelpers/mousecontrolsticksettingsdialoghelper.cpp b/src/mousedialog/uihelpers/mousecontrolsticksettingsdialoghelper.cpp old mode 100644 new mode 100755 diff --git a/src/mousedialog/uihelpers/mousecontrolsticksettingsdialoghelper.h b/src/mousedialog/uihelpers/mousecontrolsticksettingsdialoghelper.h old mode 100644 new mode 100755 diff --git a/src/mousedialog/uihelpers/mousedpadsettingsdialoghelper.cpp b/src/mousedialog/uihelpers/mousedpadsettingsdialoghelper.cpp old mode 100644 new mode 100755 diff --git a/src/mousedialog/uihelpers/mousedpadsettingsdialoghelper.h b/src/mousedialog/uihelpers/mousedpadsettingsdialoghelper.h old mode 100644 new mode 100755 diff --git a/src/mousehelper.cpp b/src/mousehelper.cpp old mode 100644 new mode 100755 index 48df7e74d..afd713f74 --- a/src/mousehelper.cpp +++ b/src/mousehelper.cpp @@ -48,10 +48,7 @@ void MouseHelper::initDeskWid() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (deskWid == nullptr) - { - deskWid = new QDesktopWidget; - } + if (deskWid == nullptr) deskWid = new QDesktopWidget; } void MouseHelper::deleteDeskWid() diff --git a/src/mousehelper.h b/src/mousehelper.h old mode 100644 new mode 100755 diff --git a/src/mousesettingsdialog.cpp b/src/mousesettingsdialog.cpp old mode 100644 new mode 100755 index 5df94ed39..1de4159b9 --- a/src/mousesettingsdialog.cpp +++ b/src/mousesettingsdialog.cpp @@ -18,6 +18,7 @@ #include "mousesettingsdialog.h" #include "ui_mousesettingsdialog.h" +#include "globalvariables.h" #include "messagehandler.h" #include @@ -125,7 +126,7 @@ void MouseSettingsDialog::updateHorizontalSpeedConvertLabel(int value) int currentCurveIndex = ui->accelerationComboBox->currentIndex(); JoyButton::JoyMouseCurve tempCurve = getMouseCurveForIndex(currentCurveIndex); - int finalSpeed = JoyButton::calculateFinalMouseSpeed(tempCurve, value); + int finalSpeed = JoyButton::calculateFinalMouseSpeed(tempCurve, value, GlobalVariables::JoyAxis::JOYSPEED); label = label.append(" = ").append(QString::number(finalSpeed)).append(" pps"); ui->horizontalSpeedLabel->setText(label); @@ -139,7 +140,7 @@ void MouseSettingsDialog::updateVerticalSpeedConvertLabel(int value) int currentCurveIndex = ui->accelerationComboBox->currentIndex(); JoyButton::JoyMouseCurve tempCurve = getMouseCurveForIndex(currentCurveIndex); - int finalSpeed = JoyButton::calculateFinalMouseSpeed(tempCurve, value); + int finalSpeed = JoyButton::calculateFinalMouseSpeed(tempCurve, value, GlobalVariables::JoyAxis::JOYSPEED); label = label.append(" = ").append(QString::number(finalSpeed)).append(" pps"); ui->verticalSpeedLabel->setText(label); @@ -165,7 +166,6 @@ void MouseSettingsDialog::changeMouseSpeedBoxStatus(int index) ui->horizontalSpinBox->setEnabled(false); ui->verticalSpinBox->setEnabled(false); ui->changeMouseSpeedsTogetherCheckBox->setEnabled(false); - ui->extraAccelerationGroupBox->setChecked(false); ui->extraAccelerationGroupBox->setEnabled(false); } @@ -174,12 +174,10 @@ void MouseSettingsDialog::changeMouseSpeedBoxStatus(int index) ui->horizontalSpinBox->setEnabled(true); ui->verticalSpinBox->setEnabled(true); ui->changeMouseSpeedsTogetherCheckBox->setEnabled(true); - ui->extraAccelerationGroupBox->setEnabled(true); + if (ui->extraAccelerationGroupBox->isChecked()) - { ui->extraAccelerationGroupBox->setEnabled(true); - } } } @@ -223,37 +221,48 @@ void MouseSettingsDialog::updateAccelerationCurvePresetComboBox(JoyButton::JoyMo { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (mouseCurve == JoyButton::EnhancedPrecisionCurve) - { - ui->accelerationComboBox->setCurrentIndex(1); - } - else if (mouseCurve == JoyButton::LinearCurve) - { - ui->accelerationComboBox->setCurrentIndex(2); - } - else if (mouseCurve == JoyButton::QuadraticCurve) - { - ui->accelerationComboBox->setCurrentIndex(3); - } - else if (mouseCurve == JoyButton::CubicCurve) - { - ui->accelerationComboBox->setCurrentIndex(4); - } - else if (mouseCurve == JoyButton::QuadraticExtremeCurve) + switch(mouseCurve) { - ui->accelerationComboBox->setCurrentIndex(5); - } - else if (mouseCurve == JoyButton::PowerCurve) - { - ui->accelerationComboBox->setCurrentIndex(6); - } - else if (mouseCurve == JoyButton::EasingQuadraticCurve) - { - ui->accelerationComboBox->setCurrentIndex(7); - } - else if (mouseCurve == JoyButton::EasingCubicCurve) - { - ui->accelerationComboBox->setCurrentIndex(8); + case JoyButton::EnhancedPrecisionCurve: + { + ui->accelerationComboBox->setCurrentIndex(1); + break; + } + case JoyButton::LinearCurve: + { + ui->accelerationComboBox->setCurrentIndex(2); + break; + } + case JoyButton::QuadraticCurve: + { + ui->accelerationComboBox->setCurrentIndex(3); + break; + } + case JoyButton::CubicCurve: + { + ui->accelerationComboBox->setCurrentIndex(4); + break; + } + case JoyButton::QuadraticExtremeCurve: + { + ui->accelerationComboBox->setCurrentIndex(5); + break; + } + case JoyButton::PowerCurve: + { + ui->accelerationComboBox->setCurrentIndex(6); + break; + } + case JoyButton::EasingQuadraticCurve: + { + ui->accelerationComboBox->setCurrentIndex(7); + break; + } + case JoyButton::EasingCubicCurve: + { + ui->accelerationComboBox->setCurrentIndex(8); + break; + } } } @@ -263,37 +272,48 @@ JoyButton::JoyMouseCurve MouseSettingsDialog::getMouseCurveForIndex(int index) JoyButton::JoyMouseCurve temp = JoyButton::DEFAULTMOUSECURVE; - if (index == 1) - { - temp = JoyButton::EnhancedPrecisionCurve; - } - else if (index == 2) - { - temp = JoyButton::LinearCurve; - } - else if (index == 3) - { - temp = JoyButton::QuadraticCurve; - } - else if (index == 4) - { - temp = JoyButton::CubicCurve; - } - else if (index == 5) - { - temp = JoyButton::QuadraticExtremeCurve; - } - else if (index == 6) - { - temp = JoyButton::PowerCurve; - } - else if (index == 7) - { - temp = JoyButton::EasingQuadraticCurve; - } - else if (index == 8) + switch(index) { - temp = JoyButton::EasingCubicCurve; + case 1: + { + temp = JoyButton::EnhancedPrecisionCurve; + break; + } + case 2: + { + temp = JoyButton::LinearCurve; + break; + } + case 3: + { + temp = JoyButton::QuadraticCurve; + break; + } + case 4: + { + temp = JoyButton::CubicCurve; + break; + } + case 5: + { + temp = JoyButton::QuadraticExtremeCurve; + break; + } + case 6: + { + temp = JoyButton::PowerCurve; + break; + } + case 7: + { + temp = JoyButton::EasingQuadraticCurve; + break; + } + case 8: + { + temp = JoyButton::EasingCubicCurve; + break; + } } return temp; @@ -311,10 +331,9 @@ void MouseSettingsDialog::changeSensitivityStatusForMouseMode(int index) { int currentCurveIndex = ui->accelerationComboBox->currentIndex(); JoyButton::JoyMouseCurve temp = getMouseCurveForIndex(currentCurveIndex); + if (temp == JoyButton::PowerCurve) - { ui->sensitivityDoubleSpinBox->setEnabled(true); - } } else { @@ -400,21 +419,28 @@ JoyButton::JoyExtraAccelerationCurve MouseSettingsDialog::getExtraAccelCurveForI JoyButton::JoyExtraAccelerationCurve temp = JoyButton::LinearAccelCurve; - if (index == 1) - { - temp = JoyButton::LinearAccelCurve; - } - else if (index == 2) - { - temp = JoyButton::EaseOutSineCurve; - } - else if (index == 3) - { - temp = JoyButton::EaseOutQuadAccelCurve; - } - else if (index == 4) + switch(index) { - temp = JoyButton::EaseOutCubicAccelCurve; + case 1: + { + temp = JoyButton::LinearAccelCurve; + break; + } + case 2: + { + temp = JoyButton::EaseOutSineCurve; + break; + } + case 3: + { + temp = JoyButton::EaseOutQuadAccelCurve; + break; + } + case 4: + { + temp = JoyButton::EaseOutCubicAccelCurve; + break; + } } return temp; @@ -428,23 +454,29 @@ MouseSettingsDialog::updateExtraAccelerationCurvePresetComboBox int temp = 0; - if (curve == JoyButton::LinearAccelCurve) - { - temp = 1; - } - else if (curve == JoyButton::EaseOutSineCurve) - { - temp = 2; - } - else if (curve == JoyButton::EaseOutQuadAccelCurve) - { - temp = 3; - } - else if (curve == JoyButton::EaseOutCubicAccelCurve) + switch(curve) { - temp = 4; + case JoyButton::LinearAccelCurve: + { + temp = 1; + break; + } + case JoyButton::EaseOutSineCurve: + { + temp = 2; + break; + } + case JoyButton::EaseOutQuadAccelCurve: + { + temp = 3; + break; + } + case JoyButton::EaseOutCubicAccelCurve: + { + temp = 4; + break; + } } ui->extraAccelCurveComboBox->setCurrentIndex(temp); } - diff --git a/src/mousesettingsdialog.h b/src/mousesettingsdialog.h old mode 100644 new mode 100755 diff --git a/src/mousesettingsdialog.ui b/src/mousesettingsdialog.ui old mode 100644 new mode 100755 diff --git a/src/qkeydisplaydialog.cpp b/src/qkeydisplaydialog.cpp old mode 100644 new mode 100755 index 17eab1e20..ee53a19b5 --- a/src/qkeydisplaydialog.cpp +++ b/src/qkeydisplaydialog.cpp @@ -36,7 +36,6 @@ #include - #ifdef WITH_X11 #include "x11extras.h" #endif @@ -56,31 +55,6 @@ QKeyDisplayDialog::QKeyDisplayDialog(QWidget *parent) : BaseEventHandler *handler = EventHandlerFactory::getInstance()->handler(); ui->eventHandlerLabel->setText(handler->getName()); - -#ifdef Q_OS_UNIX - #if defined(WITH_UINPUT) - - if (QApplication::platformName() == QStringLiteral("xcb")) - { - - /*ui->formLayout->removeWidget(ui->nativeTitleLabel); - ui->formLayout->removeWidget(ui->nativeKeyLabel); - ui->nativeTitleLabel->setVisible(false); - ui->nativeKeyLabel->setVisible(false); - */ - - } - #endif - - -#else - /*ui->formLayout->removeWidget(ui->eventHandlerTitleLabel); - ui->formLayout->removeWidget(ui->eventHandlerLabel); - ui->eventHandlerTitleLabel->setVisible(false); - ui->eventHandlerLabel->setVisible(false); - */ -#endif - } QKeyDisplayDialog::~QKeyDisplayDialog() @@ -95,13 +69,13 @@ void QKeyDisplayDialog::keyPressEvent(QKeyEvent *event) switch (event->key()) { - case Qt::Key_Escape: - case Qt::Key_Enter: - case Qt::Key_Return: - break; + case Qt::Key_Escape: + case Qt::Key_Enter: + case Qt::Key_Return: + break; - default: - QDialog::keyPressEvent(event); + default: + QDialog::keyPressEvent(event); } } @@ -109,8 +83,8 @@ void QKeyDisplayDialog::keyReleaseEvent(QKeyEvent *event) { qInstallMessageHandler(MessageHandler::myMessageOutput); - int scancode = static_cast(event->nativeScanCode()); - int virtualkey = static_cast(event->nativeVirtualKey()); + int scancode = event->nativeScanCode(); + int virtualkey = event->nativeVirtualKey(); #ifdef Q_OS_WIN int finalvirtual = WinExtras::correctVirtualKey(scancode, virtualkey); @@ -120,13 +94,13 @@ void QKeyDisplayDialog::keyReleaseEvent(QKeyEvent *event) if (handler->getIdentifier() == "vmulti") { QtKeyMapperBase *nativeWinKeyMapper = AntKeyMapper::getInstance()->getNativeKeyMapper(); + if (nativeWinKeyMapper) { int tempQtKey = nativeWinKeyMapper->returnQtKey(finalvirtual); + if (tempQtKey > 0) - { tempvirtual = AntKeyMapper::getInstance()->returnVirtualKey(tempQtKey); - } } } #endif @@ -142,30 +116,25 @@ void QKeyDisplayDialog::keyReleaseEvent(QKeyEvent *event) finalvirtual = X11Extras::getInstance()->getGroup1KeySym(virtualkey); #ifdef WITH_UINPUT - int tempalias = 0; QtKeyMapperBase *nativeKeyMapper = AntKeyMapper::getInstance()->getNativeKeyMapper(); + if (nativeKeyMapper && (nativeKeyMapper->getIdentifier() == "xtest")) { - tempalias = nativeKeyMapper->returnQtKey(virtualkey); + int tempalias = nativeKeyMapper->returnQtKey(virtualkey); finalvirtual = AntKeyMapper::getInstance()->returnVirtualKey(tempalias); } #endif - - } else { finalvirtual = scancode; } - #else if (QApplication::platformName() == QStringLiteral("xcb")) { - - finalvirtual = AntKeyMapper::getInstance()->returnVirtualKey(event->key()); - + finalvirtual = AntKeyMapper::getInstance()->returnVirtualKey(event->key()); } else { diff --git a/src/qkeydisplaydialog.h b/src/qkeydisplaydialog.h old mode 100644 new mode 100755 diff --git a/src/qkeydisplaydialog.ui b/src/qkeydisplaydialog.ui old mode 100644 new mode 100755 index a5216b9ee..4f728240b --- a/src/qkeydisplaydialog.ui +++ b/src/qkeydisplaydialog.ui @@ -38,8 +38,8 @@ - <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="https://doc.qt.io/qt-4.8/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">https://doc.qt.io/qt-4.8/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> - + <html><head/><body><p>Press a key on your keyboard to see how the key is detected by this application. The window will show the system native key value, the original value given by Qt (if applicable), and the custom value used by antimicro.</p><p>The antimicro key value and the Qt key value will usually be the same. antimicro tries to use the key values defined in Qt when possible. Check the page <a href="http://doc.qt.io/qt-5/qt.html#Key-enum"><span style=" text-decoration: underline; color:#0057ae;">http://doc.qt.io/qt-5/qt.html#Key-enum</span></a> for a list of values defined by Qt. If you discover that a key is not natively supported by this program, please report the problem to antimicro's <a href="https://github.com/juliagoda/antimicro"><span style=" text-decoration: underline; color:#0057ae;">GitHub page</span></a> so that the program can be edited to support it directly. As it is, a custom prefix is added to unknown values so they can still be used; the main problem is that the profile will no longer be portable.</p></body></html> + Qt::AutoText diff --git a/src/qtkeymapperbase.cpp b/src/qtkeymapperbase.cpp old mode 100644 new mode 100755 index 5a1ac2fe1..075d7b71e --- a/src/qtkeymapperbase.cpp +++ b/src/qtkeymapperbase.cpp @@ -21,11 +21,11 @@ #include + const int QtKeyMapperBase::customQtKeyPrefix; const int QtKeyMapperBase::customKeyPrefix; const int QtKeyMapperBase::nativeKeyPrefix; - QtKeyMapperBase::QtKeyMapperBase(QObject *parent) : QObject(parent) { @@ -38,14 +38,14 @@ int QtKeyMapperBase::returnQtKey(int key, int scancode) Q_UNUSED(scancode); - return virtualKeyToQtKey.value(key); + return virtKeyToQtKeyHash.value(key); } int QtKeyMapperBase::returnVirtualKey(int qkey) { qInstallMessageHandler(MessageHandler::myMessageOutput); - return qtKeyToVirtualKey.value(qkey); + return qtKeyToVirtKeyHash.value(qkey); } bool QtKeyMapperBase::isModifier(int qkey) @@ -55,21 +55,28 @@ bool QtKeyMapperBase::isModifier(int qkey) bool modifier = false; int qtKeyValue = qkey & 0x0FFFFFFF; - if (qtKeyValue == Qt::Key_Shift) - { - modifier = true; - } - else if (qtKeyValue == Qt::Key_Control) - { - modifier = true; - } - else if (qtKeyValue == Qt::Key_Alt) - { - modifier = true; - } - else if (qtKeyValue == Qt::Key_Meta) + switch(qtKeyValue) { - modifier = true; + case Qt::Key_Shift: + { + modifier = true; + break; + } + case Qt::Key_Control: + { + modifier = true; + break; + } + case Qt::Key_Alt: + { + modifier = true; + break; + } + case Qt::Key_Meta: + { + modifier = true; + break; + } } return modifier; @@ -83,10 +90,8 @@ QtKeyMapperBase::charKeyInformation QtKeyMapperBase::getCharKeyInformation(QChar temp.virtualkey = 0; temp.modifiers = Qt::NoModifier; - if (virtualkeyToCharKeyInformation.contains(value.unicode())) - { - temp = virtualkeyToCharKeyInformation.value(value.unicode()); - } + if (virtkeyToCharKeyInfo.contains(value.unicode())) + temp = virtkeyToCharKeyInfo.value(value.unicode()); return temp; } diff --git a/src/qtkeymapperbase.h b/src/qtkeymapperbase.h old mode 100644 new mode 100755 index 31c4f2163..377ba0f82 --- a/src/qtkeymapperbase.h +++ b/src/qtkeymapperbase.h @@ -82,10 +82,10 @@ class QtKeyMapperBase : public QObject virtual void populateMappingHashes() = 0; virtual void populateCharKeyInformation() = 0; - QHash qtKeyToVirtualKey; // unsigned, unsigned - QHash virtualKeyToQtKey; // unsigned, unsigned + QHash qtKeyToVirtKeyHash; // unsigned, unsigned + QHash virtKeyToQtKeyHash; // unsigned, unsigned // Unicode representation -> VK+Modifier information - QHash virtualkeyToCharKeyInformation; // unsigned, .. + QHash virtkeyToCharKeyInfo; // unsigned, .. QString identifier; }; diff --git a/src/qtuinputkeymapper.cpp b/src/qtuinputkeymapper.cpp old mode 100644 new mode 100755 index 9ded84a4b..e8e6dc695 --- a/src/qtuinputkeymapper.cpp +++ b/src/qtuinputkeymapper.cpp @@ -1,4 +1,4 @@ -/* antimicro Gamepad to KB+M event mapper +/* antimicro Gamepad to KB+M event mapper * Copyright (C) 2015 Travis Nickles * * This program is free software: you can redistribute it and/or modify @@ -28,6 +28,7 @@ #include "messagehandler.h" + QtUInputKeyMapper::QtUInputKeyMapper(QObject *parent) : QtKeyMapperBase(parent) { @@ -39,190 +40,96 @@ QtUInputKeyMapper::QtUInputKeyMapper(QObject *parent) : void QtUInputKeyMapper::populateAlphaHashes() { // Map lowercase alpha keys - qtKeyToVirtualKey[Qt::Key_A] = KEY_A; - qtKeyToVirtualKey[Qt::Key_B] = KEY_B; - qtKeyToVirtualKey[Qt::Key_C] = KEY_C; - qtKeyToVirtualKey[Qt::Key_D] = KEY_D; - qtKeyToVirtualKey[Qt::Key_E] = KEY_E; - qtKeyToVirtualKey[Qt::Key_F] = KEY_F; - qtKeyToVirtualKey[Qt::Key_G] = KEY_G; - qtKeyToVirtualKey[Qt::Key_H] = KEY_H; - qtKeyToVirtualKey[Qt::Key_I] = KEY_I; - qtKeyToVirtualKey[Qt::Key_J] = KEY_J; - qtKeyToVirtualKey[Qt::Key_K] = KEY_K; - qtKeyToVirtualKey[Qt::Key_L] = KEY_L; - qtKeyToVirtualKey[Qt::Key_M] = KEY_M; - qtKeyToVirtualKey[Qt::Key_N] = KEY_N; - qtKeyToVirtualKey[Qt::Key_O] = KEY_O; - qtKeyToVirtualKey[Qt::Key_P] = KEY_P; - qtKeyToVirtualKey[Qt::Key_Q] = KEY_Q; - qtKeyToVirtualKey[Qt::Key_R] = KEY_R; - qtKeyToVirtualKey[Qt::Key_S] = KEY_S; - qtKeyToVirtualKey[Qt::Key_T] = KEY_T; - qtKeyToVirtualKey[Qt::Key_U] = KEY_U; - qtKeyToVirtualKey[Qt::Key_V] = KEY_V; - qtKeyToVirtualKey[Qt::Key_W] = KEY_W; - qtKeyToVirtualKey[Qt::Key_X] = KEY_X; - qtKeyToVirtualKey[Qt::Key_Y] = KEY_Y; - qtKeyToVirtualKey[Qt::Key_Z] = KEY_Z; + qtKeyToVirtKeyHash[Qt::Key_A] = KEY_A; + qtKeyToVirtKeyHash[Qt::Key_B] = KEY_B; + qtKeyToVirtKeyHash[Qt::Key_C] = KEY_C; + qtKeyToVirtKeyHash[Qt::Key_D] = KEY_D; + qtKeyToVirtKeyHash[Qt::Key_E] = KEY_E; + qtKeyToVirtKeyHash[Qt::Key_F] = KEY_F; + qtKeyToVirtKeyHash[Qt::Key_G] = KEY_G; + qtKeyToVirtKeyHash[Qt::Key_H] = KEY_H; + qtKeyToVirtKeyHash[Qt::Key_I] = KEY_I; + qtKeyToVirtKeyHash[Qt::Key_J] = KEY_J; + qtKeyToVirtKeyHash[Qt::Key_K] = KEY_K; + qtKeyToVirtKeyHash[Qt::Key_L] = KEY_L; + qtKeyToVirtKeyHash[Qt::Key_M] = KEY_M; + qtKeyToVirtKeyHash[Qt::Key_N] = KEY_N; + qtKeyToVirtKeyHash[Qt::Key_O] = KEY_O; + qtKeyToVirtKeyHash[Qt::Key_P] = KEY_P; + qtKeyToVirtKeyHash[Qt::Key_Q] = KEY_Q; + qtKeyToVirtKeyHash[Qt::Key_R] = KEY_R; + qtKeyToVirtKeyHash[Qt::Key_S] = KEY_S; + qtKeyToVirtKeyHash[Qt::Key_T] = KEY_T; + qtKeyToVirtKeyHash[Qt::Key_U] = KEY_U; + qtKeyToVirtKeyHash[Qt::Key_V] = KEY_V; + qtKeyToVirtKeyHash[Qt::Key_W] = KEY_W; + qtKeyToVirtKeyHash[Qt::Key_X] = KEY_X; + qtKeyToVirtKeyHash[Qt::Key_Y] = KEY_Y; + qtKeyToVirtKeyHash[Qt::Key_Z] = KEY_Z; } void QtUInputKeyMapper::populateFKeyHashes() { // Map F1 - F10 - for (int i=0; i <= (KEY_F10 - KEY_F1); i++) - { - qtKeyToVirtualKey[Qt::Key_F1 + i] = KEY_F1 + i; - } + for (int i = 0; i <= (KEY_F10 - KEY_F1); i++) + qtKeyToVirtKeyHash[Qt::Key_F1 + i] = KEY_F1 + i; // Map F11 and F12 - for (int i=0; i <= (KEY_F12 - KEY_F11); i++) - { - qtKeyToVirtualKey[Qt::Key_F11 + i] = KEY_F11 + i; - } + for (int i = 0; i <= (KEY_F12 - KEY_F11); i++) + qtKeyToVirtKeyHash[Qt::Key_F11 + i] = KEY_F11 + i; // Map F13 - F24 - for (int i=0; i <= (KEY_F24 - KEY_F13); i++) - { - qtKeyToVirtualKey[Qt::Key_F13 + i] = KEY_F13 + i; - } + for (int i = 0; i <= (KEY_F24 - KEY_F13); i++) + qtKeyToVirtKeyHash[Qt::Key_F13 + i] = KEY_F13 + i; } void QtUInputKeyMapper::populateNumPadHashes() { // Map Numpad 0 - qtKeyToVirtualKey[AntKey_KP_0] = KEY_KP0; + qtKeyToVirtKeyHash[AntKey_KP_0] = KEY_KP0; // Map Numpad 1 - 3 - for (int i=0; i <= (KEY_KP3 - KEY_KP1); i++) - { - qtKeyToVirtualKey[AntKey_KP_1 + i] = KEY_KP1 + i; - } + for (int i = 0; i <= (KEY_KP3 - KEY_KP1); i++) + qtKeyToVirtKeyHash[AntKey_KP_1 + i] = KEY_KP1 + i; // Map Numpad 4 - 6 - for (int i=0; i <= (KEY_KP6 - KEY_KP4); i++) - { - qtKeyToVirtualKey[AntKey_KP_4 + i] = KEY_KP4 + i; - } + for (int i = 0; i <= (KEY_KP6 - KEY_KP4); i++) + qtKeyToVirtKeyHash[AntKey_KP_4 + i] = KEY_KP4 + i; // Map Numpad 7 - 9 - for (int i=0; i <= (KEY_KP9 - KEY_KP7); i++) - { - qtKeyToVirtualKey[AntKey_KP_7 + i] = KEY_KP7 + i; - } + for (int i = 0; i <= (KEY_KP9 - KEY_KP7); i++) + qtKeyToVirtKeyHash[AntKey_KP_7 + i] = KEY_KP7 + i; } void QtUInputKeyMapper::populateSpecialCharHashes() { - qtKeyToVirtualKey[Qt::Key_QuoteLeft] = KEY_GRAVE; - qtKeyToVirtualKey[Qt::Key_Minus] = KEY_MINUS; - qtKeyToVirtualKey[Qt::Key_Equal] = KEY_EQUAL; - qtKeyToVirtualKey[Qt::Key_BracketLeft] = KEY_LEFTBRACE; - qtKeyToVirtualKey[Qt::Key_BracketRight] = KEY_RIGHTBRACE; - qtKeyToVirtualKey[Qt::Key_Semicolon] = KEY_SEMICOLON; - qtKeyToVirtualKey[Qt::Key_Apostrophe] = KEY_APOSTROPHE; - qtKeyToVirtualKey[Qt::Key_Comma] = KEY_COMMA; - qtKeyToVirtualKey[Qt::Key_Period] = KEY_DOT; - qtKeyToVirtualKey[Qt::Key_Slash] = KEY_SLASH; - qtKeyToVirtualKey[Qt::Key_Backslash] = KEY_BACKSLASH; + qtKeyToVirtKeyHash[Qt::Key_QuoteLeft] = KEY_GRAVE; + qtKeyToVirtKeyHash[Qt::Key_Minus] = KEY_MINUS; + qtKeyToVirtKeyHash[Qt::Key_Equal] = KEY_EQUAL; + qtKeyToVirtKeyHash[Qt::Key_BracketLeft] = KEY_LEFTBRACE; + qtKeyToVirtKeyHash[Qt::Key_BracketRight] = KEY_RIGHTBRACE; + qtKeyToVirtKeyHash[Qt::Key_Semicolon] = KEY_SEMICOLON; + qtKeyToVirtKeyHash[Qt::Key_Apostrophe] = KEY_APOSTROPHE; + qtKeyToVirtKeyHash[Qt::Key_Comma] = KEY_COMMA; + qtKeyToVirtKeyHash[Qt::Key_Period] = KEY_DOT; + qtKeyToVirtKeyHash[Qt::Key_Slash] = KEY_SLASH; + qtKeyToVirtKeyHash[Qt::Key_Backslash] = KEY_BACKSLASH; } void QtUInputKeyMapper::populateMappingHashes() { - if (qtKeyToVirtualKey.isEmpty()) + if (qtKeyToVirtKeyHash.isEmpty()) { - // misc keys - qtKeyToVirtualKey[Qt::Key_Escape] = KEY_ESC; - qtKeyToVirtualKey[Qt::Key_Tab] = KEY_TAB; - qtKeyToVirtualKey[Qt::Key_Backspace] = KEY_BACKSPACE; - qtKeyToVirtualKey[Qt::Key_Return] = KEY_ENTER; - qtKeyToVirtualKey[Qt::Key_Insert] = KEY_INSERT; - qtKeyToVirtualKey[Qt::Key_Delete] = KEY_DELETE; - qtKeyToVirtualKey[Qt::Key_Pause] = KEY_PAUSE; - qtKeyToVirtualKey[Qt::Key_Print] = KEY_PRINT; - qtKeyToVirtualKey[Qt::Key_Space] = KEY_SPACE; - - qtKeyToVirtualKey[Qt::Key_SysReq] = KEY_SYSRQ; - qtKeyToVirtualKey[Qt::Key_PowerOff] = KEY_POWER; - qtKeyToVirtualKey[Qt::Key_Stop] = KEY_STOP; - qtKeyToVirtualKey[Qt::Key_Refresh] = KEY_REFRESH; - qtKeyToVirtualKey[Qt::Key_Copy] = KEY_COPY; - qtKeyToVirtualKey[Qt::Key_Paste] = KEY_PASTE; - //qtKeyToVirtualKey[Qt::Key_Search] = KEY_FIND; - qtKeyToVirtualKey[Qt::Key_Cut] = KEY_CUT; - qtKeyToVirtualKey[Qt::Key_Sleep] = KEY_SLEEP; - qtKeyToVirtualKey[Qt::Key_Calculator] = KEY_CALC; - qtKeyToVirtualKey[Qt::Key_Launch0] = KEY_COMPUTER; - qtKeyToVirtualKey[Qt::Key_Launch1] = KEY_CALC; - qtKeyToVirtualKey[Qt::Key_Launch2] = KEY_PROG1; - qtKeyToVirtualKey[Qt::Key_Launch3] = KEY_PROG2; - qtKeyToVirtualKey[Qt::Key_Launch4] = KEY_PROG3; - qtKeyToVirtualKey[Qt::Key_Launch5] = KEY_PROG4; - qtKeyToVirtualKey[Qt::Key_HomePage] = KEY_HOMEPAGE; - qtKeyToVirtualKey[Qt::Key_LaunchMail] = KEY_MAIL; - qtKeyToVirtualKey[Qt::Key_Back] = KEY_BACK; - qtKeyToVirtualKey[Qt::Key_Favorites] = KEY_FAVORITES; - qtKeyToVirtualKey[Qt::Key_Forward] = KEY_FORWARD; - qtKeyToVirtualKey[Qt::Key_Suspend] = KEY_SUSPEND; - qtKeyToVirtualKey[Qt::Key_Close] = KEY_CLOSE; - //qtKeyToVirtualKey[Qt::Key_Search] = KEY_SEARCH; - qtKeyToVirtualKey[Qt::Key_Camera] = KEY_CAMERA; - qtKeyToVirtualKey[Qt::Key_MonBrightnessUp] = KEY_BRIGHTNESSUP; - qtKeyToVirtualKey[Qt::Key_MonBrightnessDown] = KEY_BRIGHTNESSDOWN; - qtKeyToVirtualKey[Qt::Key_Send] = KEY_SEND; - qtKeyToVirtualKey[Qt::Key_Reply] = KEY_REPLY; - qtKeyToVirtualKey[Qt::Key_Forward] = KEY_FORWARDMAIL; - qtKeyToVirtualKey[Qt::Key_Save] = KEY_SAVE; - qtKeyToVirtualKey[Qt::Key_Documents] = KEY_DOCUMENTS; - qtKeyToVirtualKey[Qt::Key_Battery] = KEY_BATTERY; - qtKeyToVirtualKey[Qt::Key_Bluetooth] = KEY_BLUETOOTH; - qtKeyToVirtualKey[Qt::Key_WLAN] = KEY_WLAN; - qtKeyToVirtualKey[Qt::Key_Cancel] = KEY_CANCEL; - qtKeyToVirtualKey[Qt::Key_Shop] = KEY_SHOP; - qtKeyToVirtualKey[Qt::Key_Finance] = KEY_FINANCE; - qtKeyToVirtualKey[Qt::Key_Question] = KEY_QUESTION; - qtKeyToVirtualKey[Qt::Key_BassBoost] = KEY_BASSBOOST; - - // cursor movement - qtKeyToVirtualKey[Qt::Key_Home] = KEY_HOME; - qtKeyToVirtualKey[Qt::Key_End] = KEY_END; - qtKeyToVirtualKey[Qt::Key_Left] = KEY_LEFT; - qtKeyToVirtualKey[Qt::Key_Up] = KEY_UP; - qtKeyToVirtualKey[Qt::Key_Right] = KEY_RIGHT; - qtKeyToVirtualKey[Qt::Key_Down] = KEY_DOWN; - qtKeyToVirtualKey[Qt::Key_PageUp] = KEY_PAGEUP; - qtKeyToVirtualKey[Qt::Key_PageDown] = KEY_PAGEDOWN; - - // modifiers - qtKeyToVirtualKey[Qt::Key_Shift] = KEY_LEFTSHIFT; - qtKeyToVirtualKey[Qt::Key_Control] = KEY_LEFTCTRL; - qtKeyToVirtualKey[Qt::Key_Alt] = KEY_LEFTALT; - - qtKeyToVirtualKey[Qt::Key_CapsLock] = KEY_CAPSLOCK; - qtKeyToVirtualKey[Qt::Key_NumLock] = KEY_NUMLOCK; - qtKeyToVirtualKey[Qt::Key_ScrollLock] = KEY_SCROLLLOCK; - qtKeyToVirtualKey[Qt::Key_Meta] = KEY_LEFTMETA; - qtKeyToVirtualKey[AntKey_Meta_R] = KEY_RIGHTMETA; - qtKeyToVirtualKey[Qt::Key_Menu] = KEY_COMPOSE; - qtKeyToVirtualKey[Qt::Key_Help] = KEY_HELP; - - // media keys - qtKeyToVirtualKey[Qt::Key_VolumeDown] = KEY_VOLUMEDOWN; - qtKeyToVirtualKey[Qt::Key_VolumeMute] = KEY_MUTE; - qtKeyToVirtualKey[Qt::Key_VolumeUp] = KEY_VOLUMEUP; - qtKeyToVirtualKey[Qt::Key_MediaPlay] = KEY_PLAYPAUSE; - qtKeyToVirtualKey[Qt::Key_MediaStop] = KEY_STOPCD; - qtKeyToVirtualKey[Qt::Key_MediaPrevious] = KEY_PREVIOUSSONG; - qtKeyToVirtualKey[Qt::Key_MediaNext] = KEY_NEXTSONG; - qtKeyToVirtualKey[Qt::Key_MediaRecord] = KEY_RECORD; - qtKeyToVirtualKey[Qt::Key_LaunchMedia] = KEY_MEDIA; + mapMiscKeysQtUinput(qtKeyToVirtKeyHash); + mapCursorMovesKeysQtUinput(qtKeyToVirtKeyHash); + mapModifiersKeysQtUinput(qtKeyToVirtKeyHash); + mapMediaKeysQtUinput(qtKeyToVirtKeyHash); // Map 0-9 keys - for (int i=0; i <= (KEY_9 - KEY_1); i++) - { - qtKeyToVirtualKey[Qt::Key_1 + i] = KEY_1 + i; - } - qtKeyToVirtualKey[Qt::Key_0] = KEY_0; + for (int i = 0; i <= (KEY_9 - KEY_1); i++) + qtKeyToVirtKeyHash[Qt::Key_1 + i] = KEY_1 + i; + + qtKeyToVirtKeyHash[Qt::Key_0] = KEY_0; populateSpecialCharHashes(); populateAlphaHashes(); @@ -230,140 +137,65 @@ void QtUInputKeyMapper::populateMappingHashes() populateNumPadHashes(); // Map custom defined keys - qtKeyToVirtualKey[AntKey_Shift_R] = KEY_RIGHTSHIFT; - qtKeyToVirtualKey[AntKey_Control_R] = KEY_RIGHTCTRL; - qtKeyToVirtualKey[AntKey_Alt_R] = KEY_RIGHTALT; - qtKeyToVirtualKey[AntKey_KP_Multiply] = KEY_KPASTERISK; - - // numeric and function keypad keys - qtKeyToVirtualKey[Qt::Key_Enter] = KEY_KPENTER; - qtKeyToVirtualKey[AntKey_KP_Home] = KEY_KP7; - qtKeyToVirtualKey[AntKey_KP_Left] = KEY_KP4; - qtKeyToVirtualKey[AntKey_KP_Up] = KEY_KP8; - qtKeyToVirtualKey[AntKey_KP_Right] = KEY_KP6; - qtKeyToVirtualKey[AntKey_KP_Down] = KEY_KP2; - qtKeyToVirtualKey[AntKey_KP_Prior] = KEY_KP9; - qtKeyToVirtualKey[AntKey_KP_Next] = KEY_KP3; - qtKeyToVirtualKey[AntKey_KP_End] = KEY_KP1; - - qtKeyToVirtualKey[AntKey_KP_Begin] = KEY_KP5; - qtKeyToVirtualKey[AntKey_KP_Insert] = KEY_KP0; - qtKeyToVirtualKey[AntKey_KP_Add] = KEY_KPPLUS; - qtKeyToVirtualKey[AntKey_KP_Subtract] = KEY_KPMINUS; - qtKeyToVirtualKey[AntKey_KP_Decimal] = KEY_KPDOT; - qtKeyToVirtualKey[AntKey_KP_Divide] = KEY_KPSLASH; + qtKeyToVirtKeyHash[AntKey_Shift_R] = KEY_RIGHTSHIFT; + qtKeyToVirtKeyHash[AntKey_Control_R] = KEY_RIGHTCTRL; + qtKeyToVirtKeyHash[AntKey_Alt_R] = KEY_RIGHTALT; + qtKeyToVirtKeyHash[AntKey_KP_Multiply] = KEY_KPASTERISK; + + mapKeypadKeysQtUinput(qtKeyToVirtKeyHash); // International input method support keys // Misc Functions - qtKeyToVirtualKey[Qt::Key_Mode_switch] = KEY_SWITCHVIDEOMODE; - - // Japanese keyboard support - // qtKeyToVirtualKey[Qt::Key_Kanji] = XK_Kanji; - qtKeyToVirtualKey[Qt::Key_Muhenkan] = KEY_MUHENKAN; - qtKeyToVirtualKey[Qt::Key_Henkan] = KEY_HENKAN; - qtKeyToVirtualKey[Qt::Key_Romaji] = KEY_RO; - qtKeyToVirtualKey[Qt::Key_Hiragana] = KEY_HIRAGANA; - qtKeyToVirtualKey[Qt::Key_Katakana] = KEY_KATAKANA; - qtKeyToVirtualKey[Qt::Key_Hiragana_Katakana] = KEY_KATAKANAHIRAGANA; - // qtKeyToVirtualKey[Qt::Key_Zenkaku] = XK_Zenkaku; - // qtKeyToVirtualKey[Qt::Key_Hankaku] = XK_Hankaku; - qtKeyToVirtualKey[Qt::Key_Zenkaku_Hankaku] = KEY_ZENKAKUHANKAKU; - /* qtKeyToVirtualKey[Qt::Key_Touroku] = XK_Touroku; - qtKeyToVirtualKey[Qt::Key_Massyo] = XK_Massyo; - qtKeyToVirtualKey[Qt::Key_Kana_Lock] = XK_Kana_Lock; - qtKeyToVirtualKey[Qt::Key_Kana_Shift] = XK_Kana_Shift; - qtKeyToVirtualKey[Qt::Key_Eisu_Shift] = XK_Eisu_Shift; - qtKeyToVirtualKey[Qt::Key_Eisu_toggle] = XK_Eisu_toggle; - qtKeyToVirtualKey[Qt::Key_Codeinput] = XK_Kanji_Bangou; - qtKeyToX11KeySym[Qt::Key_MultipleCandidate] = XK_Zen_Koho; - qtKeyToX11KeySym[Qt::Key_PreviousCandidate] = XK_Mae_Koho;*/ + qtKeyToVirtKeyHash[Qt::Key_Mode_switch] = KEY_SWITCHVIDEOMODE; -#ifdef XK_KOREAN - qtKeyToVirtualKey[Qt::Key_Hangul] = KEY_HANGEUL; - /* qtKeyToVirtualKey[Qt::Key_Hangul_Start] = XK_Hangul_Start; - qtKeyToVirtualKey[Qt::Key_Hangul_End] = XK_Hangul_End; - qtKeyToVirtualKey[Qt::Key_Hangul_Hanja] = KEY_HANJA; - qtKeyToVirtualKey[Qt::Key_Hangul_Jamo] = XK_Hangul_Jamo; - qtKeyToVirtualKey[Qt::Key_Hangul_Romaja] = XK_Hangul_Romaja; - //qtKeyToX11KeySym[Qt::Key_Codeinput] = XK_Hangul_Codeinput; - qtKeyToVirtualKey[Qt::Key_Hangul_Jeonja] = XK_Hangul_Jeonja; - qtKeyToVirtualKey[Qt::Key_Hangul_Banja] = XK_Hangul_Banja; - qtKeyToVirtualKey[Qt::Key_Hangul_PreHanja] = XK_Hangul_PreHanja; - qtKeyToVirtualKey[Qt::Key_Hangul_PostHanja] = XK_Hangul_PostHanja; - //qtKeyToX11KeySym[Qt::Key_SingleCandidate] = XK_Hangul_SingleCandidate; - //qtKeyToX11KeySym[Qt::Key_MultipleCandidate] = XK_Hangul_MultipleCandidate; - //qtKeyToX11KeySym[Qt::Key_PreviousCandidate] = XK_Hangul_PreviousCandidate; - qtKeyToVirtualKey[Qt::Key_Hangul_Special] = XK_Hangul_Special; - //qtKeyToX11KeySym[Qt::Key_Mode_switch] = XK_Hangul_switch;*/ + mapJapanKeysQtUinput(qtKeyToVirtKeyHash); +#ifdef XK_KOREAN + mapKoreanKeysQtUinput(qtKeyToVirtKeyHash); #endif // XK_KOREAN - - // Populate other hash. Flip key and value so mapping // goes VK -> Qt Key. - QHashIterator iter(qtKeyToVirtualKey); + QHashIterator iter(qtKeyToVirtKeyHash); while (iter.hasNext()) { iter.next(); - virtualKeyToQtKey[iter.value()] = iter.key(); + virtKeyToQtKeyHash[iter.value()] = iter.key(); } - /*int j = 0; - for (int i=KEY_ESC; i < KEY_UNKNOWN; i++) - { - if (!virtualKeyToQtKey.contains(i) && i != 84) - { - qDebug() << "KEY MISSING: " << QString::number(i); - j++; - } - } - - qDebug() << "TOTAL MISSING: " << j; - */ - // Override some entries. - virtualKeyToQtKey[KEY_KP0] = AntKey_KP_0; - virtualKeyToQtKey[KEY_KP1] = AntKey_KP_1; - virtualKeyToQtKey[KEY_KP2] = AntKey_KP_2; - virtualKeyToQtKey[KEY_KP3] = AntKey_KP_3; - virtualKeyToQtKey[KEY_KP4] = AntKey_KP_4; - virtualKeyToQtKey[KEY_KP5] = AntKey_KP_5; - virtualKeyToQtKey[KEY_KP6] = AntKey_KP_6; - virtualKeyToQtKey[KEY_KP7] = AntKey_KP_7; - virtualKeyToQtKey[KEY_KP8] = AntKey_KP_8; - virtualKeyToQtKey[KEY_KP9] = AntKey_KP_9; - virtualKeyToQtKey[KEY_CALC] = Qt::Key_Launch1; + virtKeyToQtKeyHash[KEY_KP0] = AntKey_KP_0; + virtKeyToQtKeyHash[KEY_KP1] = AntKey_KP_1; + virtKeyToQtKeyHash[KEY_KP2] = AntKey_KP_2; + virtKeyToQtKeyHash[KEY_KP3] = AntKey_KP_3; + virtKeyToQtKeyHash[KEY_KP4] = AntKey_KP_4; + virtKeyToQtKeyHash[KEY_KP5] = AntKey_KP_5; + virtKeyToQtKeyHash[KEY_KP6] = AntKey_KP_6; + virtKeyToQtKeyHash[KEY_KP7] = AntKey_KP_7; + virtKeyToQtKeyHash[KEY_KP8] = AntKey_KP_8; + virtKeyToQtKeyHash[KEY_KP9] = AntKey_KP_9; + virtKeyToQtKeyHash[KEY_CALC] = Qt::Key_Launch1; } } void QtUInputKeyMapper::populateCharKeyInformation() { - virtualkeyToCharKeyInformation.clear(); + virtkeyToCharKeyInfo.clear(); int unicodeTempValue = 0; int listIndex = 0; - - charKeyInformation temp; - temp.modifiers = Qt::NoModifier; - temp.virtualkey = 0; + charKeyInformation charKeyInfo; + charKeyInfo.modifiers = Qt::NoModifier; + charKeyInfo.virtualkey = 0; // Map 0-9 keys - for (int i=QChar('1').unicode(); i <= QChar('9').unicode(); i++) - { - temp.virtualkey = KEY_1 + i; - virtualkeyToCharKeyInformation.insert(i, temp); - } - - temp.virtualkey = KEY_0; - virtualkeyToCharKeyInformation.insert(QChar('0').unicode(), temp); - - temp.virtualkey = KEY_MINUS; - virtualkeyToCharKeyInformation.insert(QChar('-').unicode(), temp); + for (int i = QChar('1').unicode(); i <= QChar('9').unicode(); i++) + addVirtualKeyToHash(KEY_1 + i, i, charKeyInfo); - temp.virtualkey = KEY_EQUAL; - virtualkeyToCharKeyInformation.insert(QChar('=').unicode(), temp); + addVirtualKeyToHash(KEY_0, QChar('0'), charKeyInfo); + addVirtualKeyToHash(KEY_MINUS, QChar('-'), charKeyInfo); + addVirtualKeyToHash(KEY_EQUAL, QChar('='), charKeyInfo); QList tempKeys; tempKeys.append(KEY_A); @@ -395,27 +227,27 @@ void QtUInputKeyMapper::populateCharKeyInformation() unicodeTempValue = QChar('a').unicode(); QListIterator tempIter(tempKeys); + while (tempIter.hasNext()) { - temp.virtualkey = tempIter.next(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); + addVirtualKeyToHash(tempIter.next(), unicodeTempValue, charKeyInfo); unicodeTempValue++; } tempIter.toFront(); - temp.modifiers = Qt::ShiftModifier; + charKeyInfo.modifiers = Qt::ShiftModifier; unicodeTempValue = QChar('A').unicode(); + while (tempIter.hasNext()) { - temp.virtualkey = tempIter.next(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); + addVirtualKeyToHash(tempIter.next(), unicodeTempValue, charKeyInfo); unicodeTempValue++; } tempKeys.clear(); - temp.modifiers = Qt::ShiftModifier; + charKeyInfo.modifiers = Qt::ShiftModifier; tempKeys.append(QChar('!').unicode()); tempKeys.append(QChar('@').unicode()); tempKeys.append(QChar('#').unicode()); @@ -431,85 +263,192 @@ void QtUInputKeyMapper::populateCharKeyInformation() tempIter = QListIterator(tempKeys); listIndex = 0; + while (tempIter.hasNext()) { - unicodeTempValue = tempIter.next(); - temp.virtualkey = KEY_1 + listIndex; - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); + addVirtualKeyToHash(KEY_1 + listIndex, tempIter.next(), charKeyInfo); listIndex++; } tempKeys.clear(); - temp.modifiers = Qt::NoModifier; - temp.virtualkey = KEY_SPACE; - unicodeTempValue = QChar(' ').unicode(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); - - temp.virtualkey = KEY_LEFTBRACE; - unicodeTempValue = QChar('[').unicode(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); - - temp.virtualkey = KEY_RIGHTBRACE; - unicodeTempValue = QChar(']').unicode(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); - - temp.virtualkey = KEY_BACKSLASH; - unicodeTempValue = QChar('\\').unicode(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); - - temp.virtualkey = KEY_SEMICOLON; - unicodeTempValue = QChar(';').unicode(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); - - temp.virtualkey = KEY_APOSTROPHE; - unicodeTempValue = QChar('\'').unicode(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); - - temp.virtualkey = KEY_COMMA; - unicodeTempValue = QChar(',').unicode(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); - - temp.virtualkey = KEY_DOT; - unicodeTempValue = QChar('.').unicode(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); - - temp.virtualkey = KEY_SLASH; - unicodeTempValue = QChar('/').unicode(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); - - - temp.modifiers = Qt::ShiftModifier; + charKeyInfo.modifiers = Qt::NoModifier; + + addVirtualKeyToHash(KEY_SPACE, QChar(' '), charKeyInfo); + addVirtualKeyToHash(KEY_LEFTBRACE, QChar('['), charKeyInfo); + addVirtualKeyToHash(KEY_RIGHTBRACE, QChar(']'), charKeyInfo); + addVirtualKeyToHash(KEY_BACKSLASH, QChar('\\'), charKeyInfo); + addVirtualKeyToHash(KEY_SEMICOLON, QChar(';'), charKeyInfo); + addVirtualKeyToHash(KEY_APOSTROPHE, QChar('\''), charKeyInfo); + addVirtualKeyToHash(KEY_COMMA, QChar(','), charKeyInfo); + addVirtualKeyToHash(KEY_DOT, QChar('.'), charKeyInfo); + addVirtualKeyToHash(KEY_SLASH, QChar('/'), charKeyInfo); + addVirtualKeyToHash(KEY_LEFTBRACE, QChar('{'), charKeyInfo); + addVirtualKeyToHash(KEY_RIGHTBRACE, QChar('}'), charKeyInfo); + addVirtualKeyToHash(KEY_BACKSLASH, QChar('|'), charKeyInfo); + addVirtualKeyToHash(KEY_SEMICOLON, QChar(':'), charKeyInfo); + addVirtualKeyToHash(KEY_APOSTROPHE, QChar('"'), charKeyInfo); + addVirtualKeyToHash(KEY_COMMA, QChar('<'), charKeyInfo); + addVirtualKeyToHash(KEY_DOT, QChar('>'), charKeyInfo); + addVirtualKeyToHash(KEY_SLASH, QChar('?'), charKeyInfo); +} - temp.virtualkey = KEY_LEFTBRACE; - unicodeTempValue = QChar('{').unicode(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); +void QtUInputKeyMapper::addVirtualKeyToHash(int key, QChar character, charKeyInformation& charKeyInfo) +{ + charKeyInfo.virtualkey = key; + virtkeyToCharKeyInfo.insert(character.unicode(), charKeyInfo); +} - temp.virtualkey = KEY_RIGHTBRACE; - unicodeTempValue = QChar('}').unicode(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); +void QtUInputKeyMapper::mapMiscKeysQtUinput(QHash& qtKeyToVirtKeyHash) +{ + qtKeyToVirtKeyHash[Qt::Key_Escape] = KEY_ESC; + qtKeyToVirtKeyHash[Qt::Key_Tab] = KEY_TAB; + qtKeyToVirtKeyHash[Qt::Key_Backspace] = KEY_BACKSPACE; + qtKeyToVirtKeyHash[Qt::Key_Return] = KEY_ENTER; + qtKeyToVirtKeyHash[Qt::Key_Insert] = KEY_INSERT; + qtKeyToVirtKeyHash[Qt::Key_Delete] = KEY_DELETE; + qtKeyToVirtKeyHash[Qt::Key_Pause] = KEY_PAUSE; + qtKeyToVirtKeyHash[Qt::Key_Print] = KEY_PRINT; + qtKeyToVirtKeyHash[Qt::Key_Space] = KEY_SPACE; + qtKeyToVirtKeyHash[Qt::Key_SysReq] = KEY_SYSRQ; + qtKeyToVirtKeyHash[Qt::Key_PowerOff] = KEY_POWER; + qtKeyToVirtKeyHash[Qt::Key_Stop] = KEY_STOP; + qtKeyToVirtKeyHash[Qt::Key_Refresh] = KEY_REFRESH; + qtKeyToVirtKeyHash[Qt::Key_Copy] = KEY_COPY; + qtKeyToVirtKeyHash[Qt::Key_Paste] = KEY_PASTE; + //qtKeyToVirtKeyHash[Qt::Key_Search] = KEY_FIND; + qtKeyToVirtKeyHash[Qt::Key_Cut] = KEY_CUT; + qtKeyToVirtKeyHash[Qt::Key_Sleep] = KEY_SLEEP; + qtKeyToVirtKeyHash[Qt::Key_Calculator] = KEY_CALC; + qtKeyToVirtKeyHash[Qt::Key_Launch0] = KEY_COMPUTER; + qtKeyToVirtKeyHash[Qt::Key_Launch1] = KEY_CALC; + qtKeyToVirtKeyHash[Qt::Key_Launch2] = KEY_PROG1; + qtKeyToVirtKeyHash[Qt::Key_Launch3] = KEY_PROG2; + qtKeyToVirtKeyHash[Qt::Key_Launch4] = KEY_PROG3; + qtKeyToVirtKeyHash[Qt::Key_Launch5] = KEY_PROG4; + qtKeyToVirtKeyHash[Qt::Key_HomePage] = KEY_HOMEPAGE; + qtKeyToVirtKeyHash[Qt::Key_LaunchMail] = KEY_MAIL; + qtKeyToVirtKeyHash[Qt::Key_Back] = KEY_BACK; + qtKeyToVirtKeyHash[Qt::Key_Favorites] = KEY_FAVORITES; + qtKeyToVirtKeyHash[Qt::Key_Forward] = KEY_FORWARD; + qtKeyToVirtKeyHash[Qt::Key_Suspend] = KEY_SUSPEND; + qtKeyToVirtKeyHash[Qt::Key_Close] = KEY_CLOSE; + //qtKeyToVirtKeyHash[Qt::Key_Search] = KEY_SEARCH; + qtKeyToVirtKeyHash[Qt::Key_Camera] = KEY_CAMERA; + qtKeyToVirtKeyHash[Qt::Key_MonBrightnessUp] = KEY_BRIGHTNESSUP; + qtKeyToVirtKeyHash[Qt::Key_MonBrightnessDown] = KEY_BRIGHTNESSDOWN; + qtKeyToVirtKeyHash[Qt::Key_Send] = KEY_SEND; + qtKeyToVirtKeyHash[Qt::Key_Reply] = KEY_REPLY; + qtKeyToVirtKeyHash[Qt::Key_Forward] = KEY_FORWARDMAIL; + qtKeyToVirtKeyHash[Qt::Key_Save] = KEY_SAVE; + qtKeyToVirtKeyHash[Qt::Key_Documents] = KEY_DOCUMENTS; + qtKeyToVirtKeyHash[Qt::Key_Battery] = KEY_BATTERY; + qtKeyToVirtKeyHash[Qt::Key_Bluetooth] = KEY_BLUETOOTH; + qtKeyToVirtKeyHash[Qt::Key_WLAN] = KEY_WLAN; + qtKeyToVirtKeyHash[Qt::Key_Cancel] = KEY_CANCEL; + qtKeyToVirtKeyHash[Qt::Key_Shop] = KEY_SHOP; + qtKeyToVirtKeyHash[Qt::Key_Finance] = KEY_FINANCE; + qtKeyToVirtKeyHash[Qt::Key_Question] = KEY_QUESTION; + qtKeyToVirtKeyHash[Qt::Key_BassBoost] = KEY_BASSBOOST; +} - temp.virtualkey = KEY_BACKSLASH; - unicodeTempValue = QChar('|').unicode(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); +void QtUInputKeyMapper::mapCursorMovesKeysQtUinput(QHash& qtKeyToVirtKeyHash) +{ + qtKeyToVirtKeyHash[Qt::Key_Home] = KEY_HOME; + qtKeyToVirtKeyHash[Qt::Key_End] = KEY_END; + qtKeyToVirtKeyHash[Qt::Key_Left] = KEY_LEFT; + qtKeyToVirtKeyHash[Qt::Key_Up] = KEY_UP; + qtKeyToVirtKeyHash[Qt::Key_Right] = KEY_RIGHT; + qtKeyToVirtKeyHash[Qt::Key_Down] = KEY_DOWN; + qtKeyToVirtKeyHash[Qt::Key_PageUp] = KEY_PAGEUP; + qtKeyToVirtKeyHash[Qt::Key_PageDown] = KEY_PAGEDOWN; +} - temp.virtualkey = KEY_SEMICOLON; - unicodeTempValue = QChar(':').unicode(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); +void QtUInputKeyMapper::mapModifiersKeysQtUinput(QHash& qtKeyToVirtKeyHash) +{ + qtKeyToVirtKeyHash[Qt::Key_Shift] = KEY_LEFTSHIFT; + qtKeyToVirtKeyHash[Qt::Key_Control] = KEY_LEFTCTRL; + qtKeyToVirtKeyHash[Qt::Key_Alt] = KEY_LEFTALT; + qtKeyToVirtKeyHash[Qt::Key_CapsLock] = KEY_CAPSLOCK; + qtKeyToVirtKeyHash[Qt::Key_NumLock] = KEY_NUMLOCK; + qtKeyToVirtKeyHash[Qt::Key_ScrollLock] = KEY_SCROLLLOCK; + qtKeyToVirtKeyHash[Qt::Key_Meta] = KEY_LEFTMETA; + qtKeyToVirtKeyHash[AntKey_Meta_R] = KEY_RIGHTMETA; + qtKeyToVirtKeyHash[Qt::Key_Menu] = KEY_COMPOSE; + qtKeyToVirtKeyHash[Qt::Key_Help] = KEY_HELP; +} - temp.virtualkey = KEY_APOSTROPHE; - unicodeTempValue = QChar('"').unicode(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); +void QtUInputKeyMapper::mapKeypadKeysQtUinput(QHash& qtKeyToVirtKeyHash) +{ + qtKeyToVirtKeyHash[Qt::Key_Enter] = KEY_KPENTER; + qtKeyToVirtKeyHash[AntKey_KP_Home] = KEY_KP7; + qtKeyToVirtKeyHash[AntKey_KP_Left] = KEY_KP4; + qtKeyToVirtKeyHash[AntKey_KP_Up] = KEY_KP8; + qtKeyToVirtKeyHash[AntKey_KP_Right] = KEY_KP6; + qtKeyToVirtKeyHash[AntKey_KP_Down] = KEY_KP2; + qtKeyToVirtKeyHash[AntKey_KP_Prior] = KEY_KP9; + qtKeyToVirtKeyHash[AntKey_KP_Next] = KEY_KP3; + qtKeyToVirtKeyHash[AntKey_KP_End] = KEY_KP1; + qtKeyToVirtKeyHash[AntKey_KP_Begin] = KEY_KP5; + qtKeyToVirtKeyHash[AntKey_KP_Insert] = KEY_KP0; + qtKeyToVirtKeyHash[AntKey_KP_Add] = KEY_KPPLUS; + qtKeyToVirtKeyHash[AntKey_KP_Subtract] = KEY_KPMINUS; + qtKeyToVirtKeyHash[AntKey_KP_Decimal] = KEY_KPDOT; + qtKeyToVirtKeyHash[AntKey_KP_Divide] = KEY_KPSLASH; +} - temp.virtualkey = KEY_COMMA; - unicodeTempValue = QChar('<').unicode(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); +void QtUInputKeyMapper::mapJapanKeysQtUinput(QHash& qtKeyToVirtKeyHash) +{ + // qtKeyToVirtKeyHash[Qt::Key_Kanji] = XK_Kanji; + qtKeyToVirtKeyHash[Qt::Key_Muhenkan] = KEY_MUHENKAN; + qtKeyToVirtKeyHash[Qt::Key_Henkan] = KEY_HENKAN; + qtKeyToVirtKeyHash[Qt::Key_Romaji] = KEY_RO; + qtKeyToVirtKeyHash[Qt::Key_Hiragana] = KEY_HIRAGANA; + qtKeyToVirtKeyHash[Qt::Key_Katakana] = KEY_KATAKANA; + qtKeyToVirtKeyHash[Qt::Key_Hiragana_Katakana] = KEY_KATAKANAHIRAGANA; + // qtKeyToVirtKeyHash[Qt::Key_Zenkaku] = XK_Zenkaku; + // qtKeyToVirtKeyHash[Qt::Key_Hankaku] = XK_Hankaku; + qtKeyToVirtKeyHash[Qt::Key_Zenkaku_Hankaku] = KEY_ZENKAKUHANKAKU; + /* qtKeyToVirtKeyHash[Qt::Key_Touroku] = XK_Touroku; + qtKeyToVirtKeyHash[Qt::Key_Massyo] = XK_Massyo; + qtKeyToVirtKeyHash[Qt::Key_Kana_Lock] = XK_Kana_Lock; + qtKeyToVirtKeyHash[Qt::Key_Kana_Shift] = XK_Kana_Shift; + qtKeyToVirtKeyHash[Qt::Key_Eisu_Shift] = XK_Eisu_Shift; + qtKeyToVirtKeyHash[Qt::Key_Eisu_toggle] = XK_Eisu_toggle; + qtKeyToVirtKeyHash[Qt::Key_Codeinput] = XK_Kanji_Bangou; + qtKeyToX11KeySym[Qt::Key_MultipleCandidate] = XK_Zen_Koho; + qtKeyToX11KeySym[Qt::Key_PreviousCandidate] = XK_Mae_Koho;*/ +} - temp.virtualkey = KEY_DOT; - unicodeTempValue = QChar('>').unicode(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); +void QtUInputKeyMapper::mapKoreanKeysQtUinput(QHash& qtKeyToVirtKeyHash) +{ + qtKeyToVirtKeyHash[Qt::Key_Hangul] = KEY_HANGEUL; + /* qtKeyToVirtKeyHash[Qt::Key_Hangul_Start] = XK_Hangul_Start; + qtKeyToVirtKeyHash[Qt::Key_Hangul_End] = XK_Hangul_End; + qtKeyToVirtKeyHash[Qt::Key_Hangul_Hanja] = KEY_HANJA; + qtKeyToVirtKeyHash[Qt::Key_Hangul_Jamo] = XK_Hangul_Jamo; + qtKeyToVirtKeyHash[Qt::Key_Hangul_Romaja] = XK_Hangul_Romaja; + //qtKeyToX11KeySym[Qt::Key_Codeinput] = XK_Hangul_Codeinput; + qtKeyToVirtKeyHash[Qt::Key_Hangul_Jeonja] = XK_Hangul_Jeonja; + qtKeyToVirtKeyHash[Qt::Key_Hangul_Banja] = XK_Hangul_Banja; + qtKeyToVirtKeyHash[Qt::Key_Hangul_PreHanja] = XK_Hangul_PreHanja; + qtKeyToVirtKeyHash[Qt::Key_Hangul_PostHanja] = XK_Hangul_PostHanja; + //qtKeyToX11KeySym[Qt::Key_SingleCandidate] = XK_Hangul_SingleCandidate; + //qtKeyToX11KeySym[Qt::Key_MultipleCandidate] = XK_Hangul_MultipleCandidate; + //qtKeyToX11KeySym[Qt::Key_PreviousCandidate] = XK_Hangul_PreviousCandidate; + qtKeyToVirtKeyHash[Qt::Key_Hangul_Special] = XK_Hangul_Special; + //qtKeyToX11KeySym[Qt::Key_Mode_switch] = XK_Hangul_switch;*/ +} - temp.virtualkey = KEY_SLASH; - unicodeTempValue = QChar('?').unicode(); - virtualkeyToCharKeyInformation.insert(unicodeTempValue, temp); +void QtUInputKeyMapper::mapMediaKeysQtUinput(QHash& qtKeyToVirtKeyHash) +{ + qtKeyToVirtKeyHash[Qt::Key_VolumeDown] = KEY_VOLUMEDOWN; + qtKeyToVirtKeyHash[Qt::Key_VolumeMute] = KEY_MUTE; + qtKeyToVirtKeyHash[Qt::Key_VolumeUp] = KEY_VOLUMEUP; + qtKeyToVirtKeyHash[Qt::Key_MediaPlay] = KEY_PLAYPAUSE; + qtKeyToVirtKeyHash[Qt::Key_MediaStop] = KEY_STOPCD; + qtKeyToVirtKeyHash[Qt::Key_MediaPrevious] = KEY_PREVIOUSSONG; + qtKeyToVirtKeyHash[Qt::Key_MediaNext] = KEY_NEXTSONG; + qtKeyToVirtKeyHash[Qt::Key_MediaRecord] = KEY_RECORD; + qtKeyToVirtKeyHash[Qt::Key_LaunchMedia] = KEY_MEDIA; } diff --git a/src/qtuinputkeymapper.h b/src/qtuinputkeymapper.h old mode 100644 new mode 100755 index ad8f408ec..265b05aac --- a/src/qtuinputkeymapper.h +++ b/src/qtuinputkeymapper.h @@ -26,18 +26,29 @@ class QtUInputKeyMapper : public QtKeyMapperBase { Q_OBJECT + public: explicit QtUInputKeyMapper(QObject *parent = nullptr); protected: - void populateMappingHashes(); - void populateCharKeyInformation(); + void populateMappingHashes() override; + void populateCharKeyInformation() override; void populateAlphaHashes(); void populateFKeyHashes(); void populateNumPadHashes(); void populateSpecialCharHashes(); +private: + void addVirtualKeyToHash(int key, QChar character, charKeyInformation& charKeyInfo); + void mapMiscKeysQtUinput(QHash& qtKeyToVirtKeyHash); + void mapCursorMovesKeysQtUinput(QHash& qtKeyToVirtKeyHash); + void mapModifiersKeysQtUinput(QHash& qtKeyToVirtKeyHash); + void mapKeypadKeysQtUinput(QHash& qtKeyToVirtKeyHash); + void mapJapanKeysQtUinput(QHash& qtKeyToVirtKeyHash); + void mapKoreanKeysQtUinput(QHash& qtKeyToVirtKeyHash); + void mapMediaKeysQtUinput(QHash& qtKeyToVirtKeyHash); + }; #endif // QTUINPUTKEYMAPPER_H diff --git a/src/qtvmultikeymapper.cpp b/src/qtvmultikeymapper.cpp old mode 100644 new mode 100755 diff --git a/src/qtvmultikeymapper.h b/src/qtvmultikeymapper.h old mode 100644 new mode 100755 index 29bf0054f..50cfe5991 --- a/src/qtvmultikeymapper.h +++ b/src/qtvmultikeymapper.h @@ -33,8 +33,8 @@ class QtVMultiKeyMapper : public QtKeyMapperBase static const int consumerUsagePagePrefix = 0x12000; // unsigned protected: - void populateMappingHashes(); - void populateCharKeyInformation(); + void populateMappingHashes() override; + void populateCharKeyInformation() override; }; diff --git a/src/qtwinkeymapper.cpp b/src/qtwinkeymapper.cpp old mode 100644 new mode 100755 index 3ffabcdc4..f8c5576e1 --- a/src/qtwinkeymapper.cpp +++ b/src/qtwinkeymapper.cpp @@ -406,5 +406,5 @@ void QtWinKeyMapper::populateCharKeyInformation() } - //qDebug() << "TOTAL: " << total; + qDebug() << "TOTAL: " << total; } diff --git a/src/qtwinkeymapper.h b/src/qtwinkeymapper.h old mode 100644 new mode 100755 index a7baf1612..75a516b21 --- a/src/qtwinkeymapper.h +++ b/src/qtwinkeymapper.h @@ -31,11 +31,11 @@ class QtWinKeyMapper : public QtKeyMapperBase public: explicit QtWinKeyMapper(QObject *parent = nullptr); - virtual int returnQtKey(int key, int scancode=0); // unsigned (unsigned, unsigned) + virtual int returnQtKey(int key, int scancode=0) override; // unsigned (unsigned, unsigned) protected: - void populateMappingHashes(); - void populateCharKeyInformation(); + void populateMappingHashes() override; + void populateCharKeyInformation() override; }; diff --git a/src/qtx11keymapper.cpp b/src/qtx11keymapper.cpp old mode 100644 new mode 100755 index 2ffdd139f..a32fb47bf --- a/src/qtx11keymapper.cpp +++ b/src/qtx11keymapper.cpp @@ -57,259 +57,78 @@ void QtX11KeyMapper::populateMappingHashes() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (qtKeyToVirtualKey.isEmpty()) + if (qtKeyToVirtKeyHash.isEmpty()) { - // misc keys - qtKeyToVirtualKey[Qt::Key_Escape] = XK_Escape; - qtKeyToVirtualKey[Qt::Key_Tab] = XK_Tab; - qtKeyToVirtualKey[Qt::Key_Backtab] = XK_ISO_Left_Tab; - qtKeyToVirtualKey[Qt::Key_Backspace] = XK_BackSpace; - qtKeyToVirtualKey[Qt::Key_Return] = XK_Return; - qtKeyToVirtualKey[Qt::Key_Insert] = XK_Insert; - qtKeyToVirtualKey[Qt::Key_Delete] = XK_Delete; - //qtKeyToX11KeySym[Qt::Key_Delete] = XK_Clear; - qtKeyToVirtualKey[Qt::Key_Pause] = XK_Pause; - qtKeyToVirtualKey[Qt::Key_Print] = XK_Print; - - // cursor movement - qtKeyToVirtualKey[Qt::Key_Home] = XK_Home; - qtKeyToVirtualKey[Qt::Key_End] = XK_End; - qtKeyToVirtualKey[Qt::Key_Left] = XK_Left; - qtKeyToVirtualKey[Qt::Key_Up] = XK_Up; - qtKeyToVirtualKey[Qt::Key_Right] = XK_Right; - qtKeyToVirtualKey[Qt::Key_Down] = XK_Down; - qtKeyToVirtualKey[Qt::Key_PageUp] = XK_Prior; - qtKeyToVirtualKey[Qt::Key_PageDown] = XK_Next; - - // modifiers - qtKeyToVirtualKey[Qt::Key_Shift] = XK_Shift_L; - //qtKeyToX11KeySym[Qt::Key_Shift] = XK_Shift_R; - //qtKeyToX11KeySym[Qt::Key_Shift] = XK_Shift_Lock; - qtKeyToVirtualKey[Qt::Key_Control] = XK_Control_L; - //qtKeyToX11KeySym[Qt::Key_Control] = XK_Control_R; - //qtKeyToVirtualKey[Qt::Key_Meta] = XK_Meta_L; - //qtKeyToX11KeySym[Qt::Key_Meta] = XK_Meta_R; - qtKeyToVirtualKey[Qt::Key_Alt] = XK_Alt_L; - //qtKeyToX11KeySym[Qt::Key_Alt] = XK_Alt_R; - - qtKeyToVirtualKey[Qt::Key_CapsLock] = XK_Caps_Lock; - qtKeyToVirtualKey[Qt::Key_NumLock] = XK_Num_Lock; - qtKeyToVirtualKey[Qt::Key_ScrollLock] = XK_Scroll_Lock; - qtKeyToVirtualKey[Qt::Key_Meta] = XK_Super_L; - qtKeyToVirtualKey[AntKey_Meta_R] = XK_Super_R; - //qtKeyToVirtualKey[Qt::Key_Super_L] = XK_Super_L; - //qtKeyToVirtualKey[Qt::Key_Super_R] = XK_Super_R; - qtKeyToVirtualKey[Qt::Key_Menu] = XK_Menu; - qtKeyToVirtualKey[Qt::Key_Hyper_L] = XK_Hyper_L; - qtKeyToVirtualKey[Qt::Key_Hyper_R] = XK_Hyper_R; - qtKeyToVirtualKey[Qt::Key_Help] = XK_Help; - - // numeric and function keypad keys - //qtKeyToVirtualKey[Qt::Key_Space] = XK_KP_Space; - //qtKeyToX11KeySym[Qt::Key_Tab] = XK_KP_Tab; - qtKeyToVirtualKey[Qt::Key_Enter] = XK_KP_Enter; - qtKeyToVirtualKey[AntKey_KP_Home] = XK_KP_Home; - //qtKeyToX11KeySym[Qt::Key_Home] = XK_KP_Home; - qtKeyToVirtualKey[AntKey_KP_Left] = XK_KP_Left; - qtKeyToVirtualKey[AntKey_KP_Up] = XK_KP_Up; - qtKeyToVirtualKey[AntKey_KP_Right] = XK_KP_Right; - qtKeyToVirtualKey[AntKey_KP_Down] = XK_KP_Down; - qtKeyToVirtualKey[AntKey_KP_Prior] = XK_KP_Prior; - qtKeyToVirtualKey[AntKey_KP_Next] = XK_KP_Next; - qtKeyToVirtualKey[AntKey_KP_End] = XK_KP_End; - qtKeyToVirtualKey[AntKey_KP_Begin] = XK_KP_Begin; - qtKeyToVirtualKey[AntKey_KP_Insert] = XK_KP_Insert; - qtKeyToVirtualKey[AntKey_KP_Delete] = XK_KP_Delete; - //qtKeyToX11KeySym[AntKey_KP_Equal] = XK_KP_Equal; - qtKeyToVirtualKey[AntKey_KP_Add] = XK_KP_Add; - //qtKeyToX11KeySym[AntKey_KP_Separator] = XK_KP_Separator; - qtKeyToVirtualKey[AntKey_KP_Subtract] = XK_KP_Subtract; - - qtKeyToVirtualKey[AntKey_KP_Decimal] = XK_KP_Decimal; - qtKeyToVirtualKey[AntKey_KP_Divide] = XK_KP_Divide; - - // International input method support keys - - // International & multi-key character composition - qtKeyToVirtualKey[Qt::Key_AltGr] = XK_ISO_Level3_Shift; - qtKeyToVirtualKey[Qt::Key_Multi_key] = XK_Multi_key; - qtKeyToVirtualKey[Qt::Key_Codeinput] = XK_Codeinput; - qtKeyToVirtualKey[Qt::Key_SingleCandidate] = XK_SingleCandidate; - qtKeyToVirtualKey[Qt::Key_MultipleCandidate] = XK_MultipleCandidate; - qtKeyToVirtualKey[Qt::Key_PreviousCandidate] = XK_PreviousCandidate; + mapMiscKeysQtX11(qtKeyToVirtKeyHash); + mapCursorMovesKeysQtX11(qtKeyToVirtKeyHash); + mapModifiersKeysQtX11(qtKeyToVirtKeyHash); + mapAdditionalKeysQtX11(qtKeyToVirtKeyHash); + mapKeypadKeysQtX11(qtKeyToVirtKeyHash); + mapInternationKeysQtX11(qtKeyToVirtKeyHash); // Misc Functions - qtKeyToVirtualKey[Qt::Key_Mode_switch] = XK_Mode_switch; + qtKeyToVirtKeyHash[Qt::Key_Mode_switch] = XK_Mode_switch; //qtKeyToX11KeySym[Qt::Key_Mode_switch] = XK_script_switch; - // Japanese keyboard support - qtKeyToVirtualKey[Qt::Key_Kanji] = XK_Kanji; - qtKeyToVirtualKey[Qt::Key_Muhenkan] = XK_Muhenkan; - qtKeyToVirtualKey[Qt::Key_Henkan] = XK_Henkan_Mode; - //qtKeyToX11KeySym[Qt::Key_Henkan] = XK_Henkan; - qtKeyToVirtualKey[Qt::Key_Romaji] = XK_Romaji; - qtKeyToVirtualKey[Qt::Key_Hiragana] = XK_Hiragana; - qtKeyToVirtualKey[Qt::Key_Katakana] = XK_Katakana; - qtKeyToVirtualKey[Qt::Key_Hiragana_Katakana] = XK_Hiragana_Katakana; - qtKeyToVirtualKey[Qt::Key_Zenkaku] = XK_Zenkaku; - qtKeyToVirtualKey[Qt::Key_Hankaku] = XK_Hankaku; - qtKeyToVirtualKey[Qt::Key_Zenkaku_Hankaku] = XK_Zenkaku_Hankaku; - qtKeyToVirtualKey[Qt::Key_Touroku] = XK_Touroku; - qtKeyToVirtualKey[Qt::Key_Massyo] = XK_Massyo; - qtKeyToVirtualKey[Qt::Key_Kana_Lock] = XK_Kana_Lock; - qtKeyToVirtualKey[Qt::Key_Kana_Shift] = XK_Kana_Shift; - qtKeyToVirtualKey[Qt::Key_Eisu_Shift] = XK_Eisu_Shift; - qtKeyToVirtualKey[Qt::Key_Eisu_toggle] = XK_Eisu_toggle; - qtKeyToVirtualKey[Qt::Key_Codeinput] = XK_Kanji_Bangou; - //qtKeyToX11KeySym[Qt::Key_MultipleCandidate] = XK_Zen_Koho; - //qtKeyToX11KeySym[Qt::Key_PreviousCandidate] = XK_Mae_Koho; + mapJapanKeysQtX11(qtKeyToVirtKeyHash); #ifdef XK_KOREAN - qtKeyToVirtualKey[Qt::Key_Hangul] = XK_Hangul; - qtKeyToVirtualKey[Qt::Key_Hangul_Start] = XK_Hangul_Start; - qtKeyToVirtualKey[Qt::Key_Hangul_End] = XK_Hangul_End; - qtKeyToVirtualKey[Qt::Key_Hangul_Hanja] = XK_Hangul_Hanja; - qtKeyToVirtualKey[Qt::Key_Hangul_Jamo] = XK_Hangul_Jamo; - qtKeyToVirtualKey[Qt::Key_Hangul_Romaja] = XK_Hangul_Romaja; - //qtKeyToX11KeySym[Qt::Key_Codeinput] = XK_Hangul_Codeinput; - qtKeyToVirtualKey[Qt::Key_Hangul_Jeonja] = XK_Hangul_Jeonja; - qtKeyToVirtualKey[Qt::Key_Hangul_Banja] = XK_Hangul_Banja; - qtKeyToVirtualKey[Qt::Key_Hangul_PreHanja] = XK_Hangul_PreHanja; - qtKeyToVirtualKey[Qt::Key_Hangul_PostHanja] = XK_Hangul_PostHanja; - //qtKeyToX11KeySym[Qt::Key_SingleCandidate] = XK_Hangul_SingleCandidate; - //qtKeyToX11KeySym[Qt::Key_MultipleCandidate] = XK_Hangul_MultipleCandidate; - //qtKeyToX11KeySym[Qt::Key_PreviousCandidate] = XK_Hangul_PreviousCandidate; - qtKeyToVirtualKey[Qt::Key_Hangul_Special] = XK_Hangul_Special; - //qtKeyToX11KeySym[Qt::Key_Mode_switch] = XK_Hangul_switch; - + mapKoreanKeysQtX11(qtKeyToVirtKeyHash); #endif // XK_KOREAN - // dead keys - qtKeyToVirtualKey[Qt::Key_Dead_Grave] = XK_dead_grave; - qtKeyToVirtualKey[Qt::Key_Dead_Acute] = XK_dead_acute; - qtKeyToVirtualKey[Qt::Key_Dead_Circumflex] = XK_dead_circumflex; - qtKeyToVirtualKey[Qt::Key_Dead_Tilde] = XK_dead_tilde; - qtKeyToVirtualKey[Qt::Key_Dead_Macron] = XK_dead_macron; - qtKeyToVirtualKey[Qt::Key_Dead_Breve] = XK_dead_breve; - qtKeyToVirtualKey[Qt::Key_Dead_Abovedot] = XK_dead_abovedot; - qtKeyToVirtualKey[Qt::Key_Dead_Diaeresis] = XK_dead_diaeresis; - qtKeyToVirtualKey[Qt::Key_Dead_Abovering] = XK_dead_abovering; - qtKeyToVirtualKey[Qt::Key_Dead_Doubleacute] = XK_dead_doubleacute; - qtKeyToVirtualKey[Qt::Key_Dead_Caron] = XK_dead_caron; - qtKeyToVirtualKey[Qt::Key_Dead_Cedilla] = XK_dead_cedilla; - qtKeyToVirtualKey[Qt::Key_Dead_Ogonek] = XK_dead_ogonek; - qtKeyToVirtualKey[Qt::Key_Dead_Iota] = XK_dead_iota; - qtKeyToVirtualKey[Qt::Key_Dead_Voiced_Sound] = XK_dead_voiced_sound; - qtKeyToVirtualKey[Qt::Key_Dead_Semivoiced_Sound] = XK_dead_semivoiced_sound; - qtKeyToVirtualKey[Qt::Key_Dead_Belowdot] = XK_dead_belowdot; - qtKeyToVirtualKey[Qt::Key_Dead_Hook] = XK_dead_hook; - qtKeyToVirtualKey[Qt::Key_Dead_Horn] = XK_dead_horn; - - // Special multimedia keys - // currently only tested with MS internet keyboard - - // browsing keys - qtKeyToVirtualKey[Qt::Key_Back] = XF86XK_Back; - qtKeyToVirtualKey[Qt::Key_Forward] = XF86XK_Forward; - qtKeyToVirtualKey[Qt::Key_Stop] = XF86XK_Stop; - qtKeyToVirtualKey[Qt::Key_Refresh] = XF86XK_Refresh; - qtKeyToVirtualKey[Qt::Key_Favorites] = XF86XK_Favorites; - qtKeyToVirtualKey[Qt::Key_LaunchMedia] = XF86XK_AudioMedia; - qtKeyToVirtualKey[Qt::Key_OpenUrl] = XF86XK_OpenURL; - qtKeyToVirtualKey[Qt::Key_HomePage] = XF86XK_HomePage; - qtKeyToVirtualKey[Qt::Key_Search] = XF86XK_Search; - - // media keys - qtKeyToVirtualKey[Qt::Key_VolumeDown] = XF86XK_AudioLowerVolume; - qtKeyToVirtualKey[Qt::Key_VolumeMute] = XF86XK_AudioMute; - qtKeyToVirtualKey[Qt::Key_VolumeUp] = XF86XK_AudioRaiseVolume; - qtKeyToVirtualKey[Qt::Key_MediaPlay] = XF86XK_AudioPlay; - qtKeyToVirtualKey[Qt::Key_MediaStop] = XF86XK_AudioStop; - qtKeyToVirtualKey[Qt::Key_MediaPrevious] = XF86XK_AudioPrev; - qtKeyToVirtualKey[Qt::Key_MediaNext] = XF86XK_AudioNext; - qtKeyToVirtualKey[Qt::Key_MediaRecord] = XF86XK_AudioRecord; - - // launch keys - qtKeyToVirtualKey[Qt::Key_LaunchMail] = XF86XK_Mail; - qtKeyToVirtualKey[Qt::Key_Launch0] = XF86XK_MyComputer; - qtKeyToVirtualKey[Qt::Key_Launch1] = XF86XK_Calculator; - qtKeyToVirtualKey[Qt::Key_Standby] = XF86XK_Standby; - - qtKeyToVirtualKey[Qt::Key_Launch2] = XF86XK_Launch0; - qtKeyToVirtualKey[Qt::Key_Launch3] = XF86XK_Launch1; - qtKeyToVirtualKey[Qt::Key_Launch4] = XF86XK_Launch2; - qtKeyToVirtualKey[Qt::Key_Launch5] = XF86XK_Launch3; - qtKeyToVirtualKey[Qt::Key_Launch6] = XF86XK_Launch4; - qtKeyToVirtualKey[Qt::Key_Launch7] = XF86XK_Launch5; - qtKeyToVirtualKey[Qt::Key_Launch8] = XF86XK_Launch6; - qtKeyToVirtualKey[Qt::Key_Launch9] = XF86XK_Launch7; - qtKeyToVirtualKey[Qt::Key_LaunchA] = XF86XK_Launch8; - qtKeyToVirtualKey[Qt::Key_LaunchB] = XF86XK_Launch9; - qtKeyToVirtualKey[Qt::Key_LaunchC] = XF86XK_LaunchA; - qtKeyToVirtualKey[Qt::Key_LaunchD] = XF86XK_LaunchB; - qtKeyToVirtualKey[Qt::Key_LaunchE] = XF86XK_LaunchC; - qtKeyToVirtualKey[Qt::Key_LaunchF] = XF86XK_LaunchD; + mapDeadKeysQtX11(qtKeyToVirtKeyHash); + mapBrowseKeysQtX11(qtKeyToVirtKeyHash); + mapMediaKeysQtX11(qtKeyToVirtKeyHash); + mapLaunchKeysQtX11(qtKeyToVirtKeyHash); // Map initial ASCII keys - for (int i=0; i <= (XK_at - XK_space); i++) - { - qtKeyToVirtualKey[Qt::Key_Space + i] = XK_space + i; - } + for (int i = 0; i <= (XK_at - XK_space); i++) + qtKeyToVirtKeyHash[Qt::Key_Space + i] = XK_space + i; // Map lowercase alpha keys - for (int i=0; i <= (XK_z - XK_a); i++) - { - qtKeyToVirtualKey[Qt::Key_A + i] = XK_a + i; - } + for (int i = 0; i <= (XK_z - XK_a); i++) + qtKeyToVirtKeyHash[Qt::Key_A + i] = XK_a + i; // Map [ to ` ASCII keys - for (int i=0; i <= (XK_grave - XK_bracketleft); i++) - { - qtKeyToVirtualKey[Qt::Key_BracketLeft + i] = XK_bracketleft + i; - } + for (int i = 0; i <= (XK_grave - XK_bracketleft); i++) + qtKeyToVirtKeyHash[Qt::Key_BracketLeft + i] = XK_bracketleft + i; // Map { to ~ ASCII keys - for (int i=0; i <= (XK_asciitilde - XK_braceleft); i++) - { - qtKeyToVirtualKey[Qt::Key_BraceLeft + i] = XK_braceleft + i; - } + for (int i = 0; i <= (XK_asciitilde - XK_braceleft); i++) + qtKeyToVirtKeyHash[Qt::Key_BraceLeft + i] = XK_braceleft + i; // Map function keys - for (int i=0; i <= (XK_F35 - XK_F1); i++) - { - qtKeyToVirtualKey[Qt::Key_F1 + i] = XK_F1 + i; - } + for (int i = 0; i <= (XK_F35 - XK_F1); i++) + qtKeyToVirtKeyHash[Qt::Key_F1 + i] = XK_F1 + i; // Misc - //qtKeyToVirtualKey[Qt::KeyBri] + //qtKeyToVirtKeyHash[Qt::KeyBri] // Map custom defined keys - qtKeyToVirtualKey[AntKey_Shift_R] = XK_Shift_R; - qtKeyToVirtualKey[AntKey_Control_R] = XK_Control_R; + qtKeyToVirtKeyHash[AntKey_Shift_R] = XK_Shift_R; + qtKeyToVirtKeyHash[AntKey_Control_R] = XK_Control_R; //qtKeyToX11KeySym[AntKey_Shift_Lock] = XK_Shift_Lock; - //qtKeyToVirtualKey[AntKey_Meta_R] = XK_Meta_R; - qtKeyToVirtualKey[AntKey_Alt_R] = XK_Alt_R; - qtKeyToVirtualKey[AntKey_KP_Multiply] = XK_KP_Multiply; + //qtKeyToVirtKeyHash[AntKey_Meta_R] = XK_Meta_R; + qtKeyToVirtKeyHash[AntKey_Alt_R] = XK_Alt_R; + qtKeyToVirtKeyHash[AntKey_KP_Multiply] = XK_KP_Multiply; - // Map 0 to 9 - for (int i=0; i <= (XK_KP_9 - XK_KP_0); i++) - { - qtKeyToVirtualKey[AntKey_KP_0 + i] = XK_KP_0 + i; - } + // Map 0 to 9 + for (int i = 0; i <= (XK_KP_9 - XK_KP_0); i++) + qtKeyToVirtKeyHash[AntKey_KP_0 + i] = XK_KP_0 + i; + + // Map lower-case latin characters to their capital equivalents + for( int i = 0; i <= (XK_odiaeresis - XK_agrave); i++) + qtKeyToVirtKeyHash[ Qt::Key_Agrave + i ] = XK_agrave + i; - // Map lower-case latin characters to their capital equivalents - for( int i=0; i <= (XK_odiaeresis - XK_agrave); i++) { - qtKeyToVirtualKey[ Qt::Key_Agrave + i ] = XK_agrave + i; - } - for( int i=0; i <= (XK_thorn - XK_oslash); i++) { - qtKeyToVirtualKey[ Qt::Key_Ooblique + i ] = XK_oslash + i; - } + for( int i = 0; i <= (XK_thorn - XK_oslash); i++) + qtKeyToVirtKeyHash[ Qt::Key_Ooblique + i ] = XK_oslash + i; + + QHashIterator iter(qtKeyToVirtKeyHash); - QHashIterator iter(qtKeyToVirtualKey); while (iter.hasNext()) { iter.next(); - virtualKeyToQtKey[iter.value()] = iter.key(); + virtKeyToQtKeyHash[iter.value()] = iter.key(); } } } @@ -318,84 +137,270 @@ void QtX11KeyMapper::populateCharKeyInformation() { qInstallMessageHandler(MessageHandler::myMessageOutput); - virtualkeyToCharKeyInformation.clear(); + virtkeyToCharKeyInfo.clear(); Display* display = X11Extras::getInstance()->display(); - int total = 0; - for (int i=8; i <= 255; i++) + + for (int i = 8; i <= 255; i++) { - for (int j=0; j <= 3; j++) + for (int j = 0; j <= 3; j++) { Qt::KeyboardModifiers dicis; + if (j >= 2) - { dicis |= Qt::MetaModifier; - } if ((j == 1) || (j == 3)) - { dicis |= Qt::ShiftModifier; - } - int testsym = static_cast(XkbKeycodeToKeysym(display, static_cast(i), - dicis & Qt::MetaModifier ? 1 : 0, - dicis & Qt::ShiftModifier ? 1 : 0)); + int testsym = XkbKeycodeToKeysym(display, i, + (dicis & Qt::MetaModifier) ? 1 : 0, + (dicis & Qt::ShiftModifier) ? 1 : 0); + if (testsym != NoSymbol) { XKeyPressedEvent tempevent; - tempevent.keycode = static_cast(i); + tempevent.keycode = i; tempevent.type = KeyPress; tempevent.display = display; tempevent.state = 0; + if (dicis & Qt::ShiftModifier) - { tempevent.state |= ShiftMask; - } if (dicis & Qt::MetaModifier) - { tempevent.state |= Mod1Mask; - } char returnstring[256]; memset(returnstring, 0, sizeof(returnstring)); int bitestoreturn = sizeof(returnstring) - 1; int numchars = XLookupString(&tempevent, returnstring, bitestoreturn, nullptr, nullptr); + if (numchars > 0) { returnstring[numchars] = '\0'; QString tempstring = QString::fromUtf8(returnstring); + if (tempstring.length() == 1) { QChar tempchar(tempstring.at(0)); charKeyInformation testKeyInformation; testKeyInformation.modifiers = dicis; testKeyInformation.virtualkey = testsym; - if (!virtualkeyToCharKeyInformation.contains(tempchar.unicode())) + + if (!virtkeyToCharKeyInfo.contains(tempchar.unicode())) { - virtualkeyToCharKeyInformation.insert(tempchar.unicode(), testKeyInformation); - //qDebug() << "I FOUND SOMETHING: " << tempchar; + virtkeyToCharKeyInfo.insert(tempchar.unicode(), testKeyInformation); total++; } } - else - { - //qDebug() << "YOU FAIL: " << tempchar; - } } - } } } - //qDebug() << "TOTAL: " << total; - //qDebug() << ""; + qDebug() << "TOTAL: " << total; +} - QChar tempa('*'); - if (virtualkeyToCharKeyInformation.contains(tempa.unicode())) - { - //charKeyInformation projects = virtualkeyToCharKeyInformation.value(tempa.unicode()); - } +void QtX11KeyMapper::mapMiscKeysQtX11(QHash& qtKeyToVirtKeyHash) +{ + qtKeyToVirtKeyHash[Qt::Key_Escape] = XK_Escape; + qtKeyToVirtKeyHash[Qt::Key_Tab] = XK_Tab; + qtKeyToVirtKeyHash[Qt::Key_Backtab] = XK_ISO_Left_Tab; + qtKeyToVirtKeyHash[Qt::Key_Backspace] = XK_BackSpace; + qtKeyToVirtKeyHash[Qt::Key_Return] = XK_Return; + qtKeyToVirtKeyHash[Qt::Key_Insert] = XK_Insert; + qtKeyToVirtKeyHash[Qt::Key_Delete] = XK_Delete; + //qtKeyToX11KeySym[Qt::Key_Delete] = XK_Clear; + qtKeyToVirtKeyHash[Qt::Key_Pause] = XK_Pause; + qtKeyToVirtKeyHash[Qt::Key_Print] = XK_Print; +} + +void QtX11KeyMapper::mapCursorMovesKeysQtX11(QHash& qtKeyToVirtKeyHash) +{ + qtKeyToVirtKeyHash[Qt::Key_Home] = XK_Home; + qtKeyToVirtKeyHash[Qt::Key_End] = XK_End; + qtKeyToVirtKeyHash[Qt::Key_Left] = XK_Left; + qtKeyToVirtKeyHash[Qt::Key_Up] = XK_Up; + qtKeyToVirtKeyHash[Qt::Key_Right] = XK_Right; + qtKeyToVirtKeyHash[Qt::Key_Down] = XK_Down; + qtKeyToVirtKeyHash[Qt::Key_PageUp] = XK_Prior; + qtKeyToVirtKeyHash[Qt::Key_PageDown] = XK_Next; +} + +void QtX11KeyMapper::mapModifiersKeysQtX11(QHash& qtKeyToVirtKeyHash) +{ + qtKeyToVirtKeyHash[Qt::Key_Shift] = XK_Shift_L; + //qtKeyToX11KeySym[Qt::Key_Shift] = XK_Shift_R; + //qtKeyToX11KeySym[Qt::Key_Shift] = XK_Shift_Lock; + qtKeyToVirtKeyHash[Qt::Key_Control] = XK_Control_L; + //qtKeyToX11KeySym[Qt::Key_Control] = XK_Control_R; + //qtKeyToVirtKeyHash[Qt::Key_Meta] = XK_Meta_L; + //qtKeyToX11KeySym[Qt::Key_Meta] = XK_Meta_R; + qtKeyToVirtKeyHash[Qt::Key_Alt] = XK_Alt_L; + //qtKeyToX11KeySym[Qt::Key_Alt] = XK_Alt_R; +} + +void QtX11KeyMapper::mapAdditionalKeysQtX11(QHash& qtKeyToVirtKeyHash) +{ + qtKeyToVirtKeyHash[Qt::Key_CapsLock] = XK_Caps_Lock; + qtKeyToVirtKeyHash[Qt::Key_NumLock] = XK_Num_Lock; + qtKeyToVirtKeyHash[Qt::Key_ScrollLock] = XK_Scroll_Lock; + qtKeyToVirtKeyHash[Qt::Key_Meta] = XK_Super_L; + qtKeyToVirtKeyHash[AntKey_Meta_R] = XK_Super_R; + //qtKeyToVirtKeyHash[Qt::Key_Super_L] = XK_Super_L; + //qtKeyToVirtKeyHash[Qt::Key_Super_R] = XK_Super_R; + qtKeyToVirtKeyHash[Qt::Key_Menu] = XK_Menu; + qtKeyToVirtKeyHash[Qt::Key_Hyper_L] = XK_Hyper_L; + qtKeyToVirtKeyHash[Qt::Key_Hyper_R] = XK_Hyper_R; + qtKeyToVirtKeyHash[Qt::Key_Help] = XK_Help; +} + +void QtX11KeyMapper::mapKeypadKeysQtX11(QHash& qtKeyToVirtKeyHash) +{ + //qtKeyToVirtKeyHash[Qt::Key_Space] = XK_KP_Space; + //qtKeyToX11KeySym[Qt::Key_Tab] = XK_KP_Tab; + qtKeyToVirtKeyHash[Qt::Key_Enter] = XK_KP_Enter; + qtKeyToVirtKeyHash[AntKey_KP_Home] = XK_KP_Home; + //qtKeyToX11KeySym[Qt::Key_Home] = XK_KP_Home; + qtKeyToVirtKeyHash[AntKey_KP_Left] = XK_KP_Left; + qtKeyToVirtKeyHash[AntKey_KP_Up] = XK_KP_Up; + qtKeyToVirtKeyHash[AntKey_KP_Right] = XK_KP_Right; + qtKeyToVirtKeyHash[AntKey_KP_Down] = XK_KP_Down; + qtKeyToVirtKeyHash[AntKey_KP_Prior] = XK_KP_Prior; + qtKeyToVirtKeyHash[AntKey_KP_Next] = XK_KP_Next; + qtKeyToVirtKeyHash[AntKey_KP_End] = XK_KP_End; + qtKeyToVirtKeyHash[AntKey_KP_Begin] = XK_KP_Begin; + qtKeyToVirtKeyHash[AntKey_KP_Insert] = XK_KP_Insert; + qtKeyToVirtKeyHash[AntKey_KP_Delete] = XK_KP_Delete; + //qtKeyToX11KeySym[AntKey_KP_Equal] = XK_KP_Equal; + qtKeyToVirtKeyHash[AntKey_KP_Add] = XK_KP_Add; + //qtKeyToX11KeySym[AntKey_KP_Separator] = XK_KP_Separator; + qtKeyToVirtKeyHash[AntKey_KP_Subtract] = XK_KP_Subtract; + qtKeyToVirtKeyHash[AntKey_KP_Decimal] = XK_KP_Decimal; + qtKeyToVirtKeyHash[AntKey_KP_Divide] = XK_KP_Divide; +} + +void QtX11KeyMapper::mapInternationKeysQtX11(QHash& qtKeyToVirtKeyHash) +{ + qtKeyToVirtKeyHash[Qt::Key_AltGr] = XK_ISO_Level3_Shift; + qtKeyToVirtKeyHash[Qt::Key_Multi_key] = XK_Multi_key; + qtKeyToVirtKeyHash[Qt::Key_Codeinput] = XK_Codeinput; + qtKeyToVirtKeyHash[Qt::Key_SingleCandidate] = XK_SingleCandidate; + qtKeyToVirtKeyHash[Qt::Key_MultipleCandidate] = XK_MultipleCandidate; + qtKeyToVirtKeyHash[Qt::Key_PreviousCandidate] = XK_PreviousCandidate; } +void QtX11KeyMapper::mapJapanKeysQtX11(QHash& qtKeyToVirtKeyHash) +{ + qtKeyToVirtKeyHash[Qt::Key_Kanji] = XK_Kanji; + qtKeyToVirtKeyHash[Qt::Key_Muhenkan] = XK_Muhenkan; + qtKeyToVirtKeyHash[Qt::Key_Henkan] = XK_Henkan_Mode; + //qtKeyToX11KeySym[Qt::Key_Henkan] = XK_Henkan; + qtKeyToVirtKeyHash[Qt::Key_Romaji] = XK_Romaji; + qtKeyToVirtKeyHash[Qt::Key_Hiragana] = XK_Hiragana; + qtKeyToVirtKeyHash[Qt::Key_Katakana] = XK_Katakana; + qtKeyToVirtKeyHash[Qt::Key_Hiragana_Katakana] = XK_Hiragana_Katakana; + qtKeyToVirtKeyHash[Qt::Key_Zenkaku] = XK_Zenkaku; + qtKeyToVirtKeyHash[Qt::Key_Hankaku] = XK_Hankaku; + qtKeyToVirtKeyHash[Qt::Key_Zenkaku_Hankaku] = XK_Zenkaku_Hankaku; + qtKeyToVirtKeyHash[Qt::Key_Touroku] = XK_Touroku; + qtKeyToVirtKeyHash[Qt::Key_Massyo] = XK_Massyo; + qtKeyToVirtKeyHash[Qt::Key_Kana_Lock] = XK_Kana_Lock; + qtKeyToVirtKeyHash[Qt::Key_Kana_Shift] = XK_Kana_Shift; + qtKeyToVirtKeyHash[Qt::Key_Eisu_Shift] = XK_Eisu_Shift; + qtKeyToVirtKeyHash[Qt::Key_Eisu_toggle] = XK_Eisu_toggle; + qtKeyToVirtKeyHash[Qt::Key_Codeinput] = XK_Kanji_Bangou; + //qtKeyToX11KeySym[Qt::Key_MultipleCandidate] = XK_Zen_Koho; + //qtKeyToX11KeySym[Qt::Key_PreviousCandidate] = XK_Mae_Koho; +} + +void QtX11KeyMapper::mapKoreanKeysQtX11(QHash& qtKeyToVirtKeyHash) +{ + qtKeyToVirtKeyHash[Qt::Key_Hangul] = XK_Hangul; + qtKeyToVirtKeyHash[Qt::Key_Hangul_Start] = XK_Hangul_Start; + qtKeyToVirtKeyHash[Qt::Key_Hangul_End] = XK_Hangul_End; + qtKeyToVirtKeyHash[Qt::Key_Hangul_Hanja] = XK_Hangul_Hanja; + qtKeyToVirtKeyHash[Qt::Key_Hangul_Jamo] = XK_Hangul_Jamo; + qtKeyToVirtKeyHash[Qt::Key_Hangul_Romaja] = XK_Hangul_Romaja; + //qtKeyToX11KeySym[Qt::Key_Codeinput] = XK_Hangul_Codeinput; + qtKeyToVirtKeyHash[Qt::Key_Hangul_Jeonja] = XK_Hangul_Jeonja; + qtKeyToVirtKeyHash[Qt::Key_Hangul_Banja] = XK_Hangul_Banja; + qtKeyToVirtKeyHash[Qt::Key_Hangul_PreHanja] = XK_Hangul_PreHanja; + qtKeyToVirtKeyHash[Qt::Key_Hangul_PostHanja] = XK_Hangul_PostHanja; + //qtKeyToX11KeySym[Qt::Key_SingleCandidate] = XK_Hangul_SingleCandidate; + //qtKeyToX11KeySym[Qt::Key_MultipleCandidate] = XK_Hangul_MultipleCandidate; + //qtKeyToX11KeySym[Qt::Key_PreviousCandidate] = XK_Hangul_PreviousCandidate; + qtKeyToVirtKeyHash[Qt::Key_Hangul_Special] = XK_Hangul_Special; + //qtKeyToX11KeySym[Qt::Key_Mode_switch] = XK_Hangul_switch; +} + +void QtX11KeyMapper::mapDeadKeysQtX11(QHash& qtKeyToVirtKeyHash) +{ + qtKeyToVirtKeyHash[Qt::Key_Dead_Grave] = XK_dead_grave; + qtKeyToVirtKeyHash[Qt::Key_Dead_Acute] = XK_dead_acute; + qtKeyToVirtKeyHash[Qt::Key_Dead_Circumflex] = XK_dead_circumflex; + qtKeyToVirtKeyHash[Qt::Key_Dead_Tilde] = XK_dead_tilde; + qtKeyToVirtKeyHash[Qt::Key_Dead_Macron] = XK_dead_macron; + qtKeyToVirtKeyHash[Qt::Key_Dead_Breve] = XK_dead_breve; + qtKeyToVirtKeyHash[Qt::Key_Dead_Abovedot] = XK_dead_abovedot; + qtKeyToVirtKeyHash[Qt::Key_Dead_Diaeresis] = XK_dead_diaeresis; + qtKeyToVirtKeyHash[Qt::Key_Dead_Abovering] = XK_dead_abovering; + qtKeyToVirtKeyHash[Qt::Key_Dead_Doubleacute] = XK_dead_doubleacute; + qtKeyToVirtKeyHash[Qt::Key_Dead_Caron] = XK_dead_caron; + qtKeyToVirtKeyHash[Qt::Key_Dead_Cedilla] = XK_dead_cedilla; + qtKeyToVirtKeyHash[Qt::Key_Dead_Ogonek] = XK_dead_ogonek; + qtKeyToVirtKeyHash[Qt::Key_Dead_Iota] = XK_dead_iota; + qtKeyToVirtKeyHash[Qt::Key_Dead_Voiced_Sound] = XK_dead_voiced_sound; + qtKeyToVirtKeyHash[Qt::Key_Dead_Semivoiced_Sound] = XK_dead_semivoiced_sound; + qtKeyToVirtKeyHash[Qt::Key_Dead_Belowdot] = XK_dead_belowdot; + qtKeyToVirtKeyHash[Qt::Key_Dead_Hook] = XK_dead_hook; + qtKeyToVirtKeyHash[Qt::Key_Dead_Horn] = XK_dead_horn; +} +void QtX11KeyMapper::mapBrowseKeysQtX11(QHash& qtKeyToVirtKeyHash) +{ + qtKeyToVirtKeyHash[Qt::Key_Back] = XF86XK_Back; + qtKeyToVirtKeyHash[Qt::Key_Forward] = XF86XK_Forward; + qtKeyToVirtKeyHash[Qt::Key_Stop] = XF86XK_Stop; + qtKeyToVirtKeyHash[Qt::Key_Refresh] = XF86XK_Refresh; + qtKeyToVirtKeyHash[Qt::Key_Favorites] = XF86XK_Favorites; + qtKeyToVirtKeyHash[Qt::Key_LaunchMedia] = XF86XK_AudioMedia; + qtKeyToVirtKeyHash[Qt::Key_OpenUrl] = XF86XK_OpenURL; + qtKeyToVirtKeyHash[Qt::Key_HomePage] = XF86XK_HomePage; + qtKeyToVirtKeyHash[Qt::Key_Search] = XF86XK_Search; +} + +void QtX11KeyMapper::mapMediaKeysQtX11(QHash& qtKeyToVirtKeyHash) +{ + qtKeyToVirtKeyHash[Qt::Key_VolumeDown] = XF86XK_AudioLowerVolume; + qtKeyToVirtKeyHash[Qt::Key_VolumeMute] = XF86XK_AudioMute; + qtKeyToVirtKeyHash[Qt::Key_VolumeUp] = XF86XK_AudioRaiseVolume; + qtKeyToVirtKeyHash[Qt::Key_MediaPlay] = XF86XK_AudioPlay; + qtKeyToVirtKeyHash[Qt::Key_MediaStop] = XF86XK_AudioStop; + qtKeyToVirtKeyHash[Qt::Key_MediaPrevious] = XF86XK_AudioPrev; + qtKeyToVirtKeyHash[Qt::Key_MediaNext] = XF86XK_AudioNext; + qtKeyToVirtKeyHash[Qt::Key_MediaRecord] = XF86XK_AudioRecord; +} + +void QtX11KeyMapper::mapLaunchKeysQtX11(QHash& qtKeyToVirtKeyHash) +{ + qtKeyToVirtKeyHash[Qt::Key_LaunchMail] = XF86XK_Mail; + qtKeyToVirtKeyHash[Qt::Key_Launch0] = XF86XK_MyComputer; + qtKeyToVirtKeyHash[Qt::Key_Launch1] = XF86XK_Calculator; + qtKeyToVirtKeyHash[Qt::Key_Standby] = XF86XK_Standby; + qtKeyToVirtKeyHash[Qt::Key_Launch2] = XF86XK_Launch0; + qtKeyToVirtKeyHash[Qt::Key_Launch3] = XF86XK_Launch1; + qtKeyToVirtKeyHash[Qt::Key_Launch4] = XF86XK_Launch2; + qtKeyToVirtKeyHash[Qt::Key_Launch5] = XF86XK_Launch3; + qtKeyToVirtKeyHash[Qt::Key_Launch6] = XF86XK_Launch4; + qtKeyToVirtKeyHash[Qt::Key_Launch7] = XF86XK_Launch5; + qtKeyToVirtKeyHash[Qt::Key_Launch8] = XF86XK_Launch6; + qtKeyToVirtKeyHash[Qt::Key_Launch9] = XF86XK_Launch7; + qtKeyToVirtKeyHash[Qt::Key_LaunchA] = XF86XK_Launch8; + qtKeyToVirtKeyHash[Qt::Key_LaunchB] = XF86XK_Launch9; + qtKeyToVirtKeyHash[Qt::Key_LaunchC] = XF86XK_LaunchA; + qtKeyToVirtKeyHash[Qt::Key_LaunchD] = XF86XK_LaunchB; + qtKeyToVirtKeyHash[Qt::Key_LaunchE] = XF86XK_LaunchC; + qtKeyToVirtKeyHash[Qt::Key_LaunchF] = XF86XK_LaunchD; +} diff --git a/src/qtx11keymapper.h b/src/qtx11keymapper.h old mode 100644 new mode 100755 index 67a8ec5db..b7c383888 --- a/src/qtx11keymapper.h +++ b/src/qtx11keymapper.h @@ -31,8 +31,22 @@ class QtX11KeyMapper : public QtKeyMapperBase explicit QtX11KeyMapper(QObject *parent = nullptr); protected: - void populateMappingHashes(); - void populateCharKeyInformation(); + void populateMappingHashes() override; + void populateCharKeyInformation() override; + +private: + void mapMiscKeysQtX11(QHash& qtKeyToVirtKeyHash); + void mapCursorMovesKeysQtX11(QHash& qtKeyToVirtKeyHash); + void mapModifiersKeysQtX11(QHash& qtKeyToVirtKeyHash); + void mapAdditionalKeysQtX11(QHash& qtKeyToVirtKeyHash); + void mapKeypadKeysQtX11(QHash& qtKeyToVirtKeyHash); + void mapInternationKeysQtX11(QHash& qtKeyToVirtKeyHash); + void mapJapanKeysQtX11(QHash& qtKeyToVirtKeyHash); + void mapKoreanKeysQtX11(QHash& qtKeyToVirtKeyHash); + void mapDeadKeysQtX11(QHash& qtKeyToVirtKeyHash); + void mapBrowseKeysQtX11(QHash& qtKeyToVirtKeyHash); + void mapMediaKeysQtX11(QHash& qtKeyToVirtKeyHash); + void mapLaunchKeysQtX11(QHash& qtKeyToVirtKeyHash); }; diff --git a/src/quicksetdialog.cpp b/src/quicksetdialog.cpp old mode 100644 new mode 100755 index 8b76adbdf..e5dad42c5 --- a/src/quicksetdialog.cpp +++ b/src/quicksetdialog.cpp @@ -59,160 +59,13 @@ QuickSetDialog::QuickSetDialog(InputDevice *joystick, QWidget *parent) : temp = temp.arg(joystick->getSDLName()).arg(joystick->getName()); ui->joystickDialogLabel->setText(temp); - for (int i=0; i < currentset->getNumberSticks(); i++) - { - JoyControlStick *stick = currentset->getJoyStick(i); - QHash *stickButtons = stick->getButtons(); - QHashIterator iter(*stickButtons); - while (iter.hasNext()) - { - JoyControlStickButton *stickbutton = iter.next().value(); - - if (stick->getJoyMode() != JoyControlStick::EightWayMode) - { - if ((stickbutton->getJoyNumber() != static_cast(JoyControlStick::StickLeftUp)) && - (stickbutton->getJoyNumber() != static_cast(JoyControlStick::StickRightUp)) && - (stickbutton->getJoyNumber() != static_cast(JoyControlStick::StickLeftDown)) && - (stickbutton->getJoyNumber() != static_cast(JoyControlStick::StickRightDown))) - { - connect(stickbutton, &JoyControlStickButton::clicked, this, [this, stickbutton]() { - showStickButtonDialog(stickbutton); - }); - } - } - else - { - connect(stickbutton, &JoyControlStickButton::clicked, this, [this, stickbutton]() { - showStickButtonDialog(stickbutton); - }); - } - - if (!stickbutton->getIgnoreEventState()) - { - stickbutton->setIgnoreEventState(true); - } - } - } - - for (int i=0; i < currentset->getNumberAxes(); i++) - { - JoyAxis *axis = currentset->getJoyAxis(i); - - if (!axis->isPartControlStick() && axis->hasControlOfButtons()) - { - JoyAxisButton *naxisbutton = axis->getNAxisButton(); - JoyAxisButton *paxisbutton = axis->getPAxisButton(); - - connect(naxisbutton, &JoyAxisButton::clicked, this, [this, naxisbutton]() { - showAxisButtonDialog(naxisbutton); - }); - - connect(paxisbutton, &JoyAxisButton::clicked, this, [this, paxisbutton]() { - showAxisButtonDialog(paxisbutton); - }); - - if (!naxisbutton->getIgnoreEventState()) - { - naxisbutton->setIgnoreEventState(true); - } - - if (!paxisbutton->getIgnoreEventState()) - { - paxisbutton->setIgnoreEventState(true); - } - } - } - - for (int i = 0; i < currentset->getNumberHats(); i++) - { - JoyDPad *dpad = currentset->getJoyDPad(i); - QHash* dpadbuttons = dpad->getButtons(); - QHashIterator iter(*dpadbuttons); - while (iter.hasNext()) - { - JoyDPadButton *dpadbutton = iter.next().value(); - - if (dpad->getJoyMode() != JoyDPad::EightWayMode) - { - if ((dpadbutton->getJoyNumber() != JoyDPadButton::DpadLeftUp) && - (dpadbutton->getJoyNumber() != JoyDPadButton::DpadRightUp) && - (dpadbutton->getJoyNumber() != JoyDPadButton::DpadLeftDown) && - (dpadbutton->getJoyNumber() != JoyDPadButton::DpadRightDown)) - { - connect(dpadbutton, &JoyDPadButton::clicked, this, [this, dpadbutton] { - showDPadButtonDialog(dpadbutton); - }); - } - } - else - { - connect(dpadbutton, &JoyDPadButton::clicked, this, [this, dpadbutton] { - showDPadButtonDialog(dpadbutton); - }); - } + connectSticksForDialog(currentset); + connectAxesForDialog(currentset); + connectDpadForDialog(currentset); + connectVDpadForDialog(currentset); + connectBtnForDialog(currentset); - if (!dpadbutton->getIgnoreEventState()) - { - dpadbutton->setIgnoreEventState(true); - } - } - } - - for (int i=0; i < currentset->getNumberVDPads(); i++) - { - VDPad *dpad = currentset->getVDPad(i); - if (dpad != nullptr) - { - QHash* dpadbuttons = dpad->getButtons(); - QHashIterator iter(*dpadbuttons); - while (iter.hasNext()) - { - JoyDPadButton *dpadbutton = iter.next().value(); - - if (dpad->getJoyMode() != JoyDPad::EightWayMode) - { - if ((dpadbutton->getJoyNumber() != JoyDPadButton::DpadLeftUp) && - (dpadbutton->getJoyNumber() != JoyDPadButton::DpadRightUp) && - (dpadbutton->getJoyNumber() != JoyDPadButton::DpadLeftDown) && - (dpadbutton->getJoyNumber() != JoyDPadButton::DpadRightDown)) - { - connect(dpadbutton, &JoyDPadButton::clicked, this, [this, dpadbutton] { - showDPadButtonDialog(dpadbutton); - }); - } - } - else - { - connect(dpadbutton, &JoyDPadButton::clicked, this, [this, dpadbutton] { - showDPadButtonDialog(dpadbutton); - }); - } - - if (!dpadbutton->getIgnoreEventState()) - { - dpadbutton->setIgnoreEventState(true); - } - } - } - } - - for (int i = 0; i < currentset->getNumberButtons(); i++) - { - JoyButton *button = currentset->getJoyButton(i); - if ((button != nullptr) && !button->isPartVDPad()) - { - connect(button, &JoyButton::clicked, this, [this, button] { - showButtonDialog(button); - }); - - if (!button->getIgnoreEventState()) - { - button->setIgnoreEventState(true); - } - } - } - - connect(this, &QuickSetDialog::finished, this, &QuickSetDialog::restoreButtonStates); + connect(this, &QuickSetDialog::finished, this, &QuickSetDialog::restoreJoystickState); } @@ -239,7 +92,6 @@ QuickSetDialog::QuickSetDialog(InputDevice *joystick, ButtonEditDialogHelper* he lastButton = nullptr; setWindowTitle(trUtf8("Quick Set %1").arg(joystick->getName())); - setAttribute(Qt::WA_DeleteOnClose); setWindowModality(Qt::WindowModal); @@ -249,11 +101,24 @@ QuickSetDialog::QuickSetDialog(InputDevice *joystick, ButtonEditDialogHelper* he temp = temp.arg(joystick->getSDLName()).arg(joystick->getName()); ui->joystickDialogLabel->setText(temp); - for (int i=0; i < currentset->getNumberSticks(); i++) + connectSticksForDialog(currentset); + connectAxesForDialog(currentset); + connectDpadForDialog(currentset); + connectVDpadForDialog(currentset); + connectBtnForDialog(currentset); + + connect(this, &QuickSetDialog::finished, this, &QuickSetDialog::restoreJoystickState); +} + + +void QuickSetDialog::connectSticksForDialog(SetJoystick* currentset) +{ + for (int i = 0; i < currentset->getNumberSticks(); i++) { JoyControlStick *stick = currentset->getJoyStick(i); QHash *stickButtons = stick->getButtons(); QHashIterator iter(*stickButtons); + while (iter.hasNext()) { JoyControlStickButton *stickbutton = iter.next().value(); @@ -278,12 +143,14 @@ QuickSetDialog::QuickSetDialog(InputDevice *joystick, ButtonEditDialogHelper* he } if (!stickbutton->getIgnoreEventState()) - { stickbutton->setIgnoreEventState(true); - } } } +} + +void QuickSetDialog::connectAxesForDialog(SetJoystick* currentset) +{ for (int i = 0; i < currentset->getNumberAxes(); i++) { JoyAxis *axis = currentset->getJoyAxis(i); @@ -302,22 +169,23 @@ QuickSetDialog::QuickSetDialog(InputDevice *joystick, ButtonEditDialogHelper* he }); if (!naxisbutton->getIgnoreEventState()) - { naxisbutton->setIgnoreEventState(true); - } if (!paxisbutton->getIgnoreEventState()) - { paxisbutton->setIgnoreEventState(true); - } } } +} + - for (int i=0; i < currentset->getNumberHats(); i++) +void QuickSetDialog::connectDpadForDialog(SetJoystick* currentset) +{ + for (int i = 0; i < currentset->getNumberHats(); i++) { JoyDPad *dpad = currentset->getJoyDPad(i); QHash* dpadbuttons = dpad->getButtons(); QHashIterator iter(*dpadbuttons); + while (iter.hasNext()) { JoyDPadButton *dpadbutton = iter.next().value(); @@ -342,19 +210,23 @@ QuickSetDialog::QuickSetDialog(InputDevice *joystick, ButtonEditDialogHelper* he } if (!dpadbutton->getIgnoreEventState()) - { dpadbutton->setIgnoreEventState(true); - } } } +} + - for (int i=0; i < currentset->getNumberVDPads(); i++) +void QuickSetDialog::connectVDpadForDialog(SetJoystick* currentset) +{ + for (int i = 0; i < currentset->getNumberVDPads(); i++) { VDPad *dpad = currentset->getVDPad(i); + if (dpad != nullptr) { QHash* dpadbuttons = dpad->getButtons(); QHashIterator iter(*dpadbuttons); + while (iter.hasNext()) { JoyDPadButton *dpadbutton = iter.next().value(); @@ -379,16 +251,19 @@ QuickSetDialog::QuickSetDialog(InputDevice *joystick, ButtonEditDialogHelper* he } if (!dpadbutton->getIgnoreEventState()) - { dpadbutton->setIgnoreEventState(true); - } } } } +} + +void QuickSetDialog::connectBtnForDialog(SetJoystick* currentset) +{ for (int i = 0; i < currentset->getNumberButtons(); i++) { JoyButton *button = currentset->getJoyButton(i); + if ((button != nullptr) && !button->isPartVDPad()) { connect(button, &JoyButton::clicked, this, [this, button] { @@ -396,17 +271,12 @@ QuickSetDialog::QuickSetDialog(InputDevice *joystick, ButtonEditDialogHelper* he }); if (!button->getIgnoreEventState()) - { button->setIgnoreEventState(true); - } } } - - connect(this, &QuickSetDialog::finished, this, &QuickSetDialog::restoreButtonStates); - - } + QuickSetDialog::~QuickSetDialog() { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -414,56 +284,67 @@ QuickSetDialog::~QuickSetDialog() delete ui; } -void QuickSetDialog::showAxisButtonDialog(JoyAxisButton* joybtn) -{ - qInstallMessageHandler(MessageHandler::myMessageOutput); - - lastButton = joybtn; - if (helper != nullptr) { - helper = new ButtonEditDialogHelper(); - } +void QuickSetDialog::invokeMethodLastBtn(JoyButton* lastJoyBtn, Qt::ConnectionType connTypeForAlias, Qt::ConnectionType connTypeForNothing, Qt::ConnectionType connTypeForAll, bool possibleAxisAction) +{ + lastButton = lastJoyBtn; - helper->setThisButton(lastButton); + // sometimes appears situation, when we want to map an axis of stick, + // it's detected some state between pressing stick button and moving axis. + // It chooses a function for pressing a stick, but later appears a problem, + // because correct and prepared value is from the axis one, so static_cast + // for stick button is failing + // App can sometimes ask to three times for a button, but it's not going to crash this time + // if lastButton is still a null pointer, check possible value correctness coming from axis - helper->moveToThread(lastButton->thread()); + if (possibleAxisAction && (lastButton == nullptr)) + lastButton = qobject_cast(sender()); - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Thread in QuickSetDialog"; - #endif + if (helper != nullptr) helper = new ButtonEditDialogHelper(); - if (withClear) { + if (lastButton != nullptr) + { + helper->setThisButton(lastButton); + helper->moveToThread(lastButton->thread()); - QMetaObject::invokeMethod(lastButton, "clearSlotsEventReset", Q_ARG(bool, withTrue)); + #ifndef QT_DEBUG_NO_OUTPUT + qDebug() << "Thread in QuickSetDialog"; + #endif - } + if (withClear) QMetaObject::invokeMethod(lastButton, "clearSlotsEventReset", Q_ARG(bool, withTrue)); + // when alias exists but not index + if ((alias != -1) && (index == -1)) { - // when alias exists but not index - if ((alias != -1) && (index == -1)) { + QMetaObject::invokeMethod(helper, invokeString, connTypeForAlias, + Q_ARG(int, code), + Q_ARG(int, alias), + Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); - QMetaObject::invokeMethod(helper, invokeString, Qt::QueuedConnection, - Q_ARG(int, code), - Q_ARG(int, alias), - Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); + // when alias doesn't exists and index too + } else if ((alias == -1) && (index == -1)) { - // when alias doesn't exists and index too - } else if ((alias == -1) && (index == -1)) { + QMetaObject::invokeMethod(helper, invokeString, connTypeForNothing, + Q_ARG(int, code), + Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); - QMetaObject::invokeMethod(helper, invokeString, Qt::QueuedConnection, - Q_ARG(int, code), - Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); + // when all exist (code, alias, index) + } else { - // when all exist (code, alias, index) - } else { + QMetaObject::invokeMethod(helper, invokeString, connTypeForAll, + Q_ARG(int, code), + Q_ARG(int, alias), + Q_ARG(int, index), + Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); + } + } +} - QMetaObject::invokeMethod(helper, invokeString, Qt::QueuedConnection, - Q_ARG(int, code), - Q_ARG(int, alias), - Q_ARG(int, index), - Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); +void QuickSetDialog::showAxisButtonDialog(JoyAxisButton* joybtn) +{ + qInstallMessageHandler(MessageHandler::myMessageOutput); - } + invokeMethodLastBtn(joybtn, Qt::QueuedConnection, Qt::QueuedConnection, Qt::QueuedConnection); this->close(); } @@ -472,56 +353,7 @@ void QuickSetDialog::showButtonDialog(JoyButton* joybtn) { qInstallMessageHandler(MessageHandler::myMessageOutput); - lastButton = joybtn; // static_cast - - if (helper == nullptr) { - helper = new ButtonEditDialogHelper(); - } - - helper->setThisButton(lastButton); - - helper->moveToThread(lastButton->thread()); - - - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Thread in QuickSetDialog"; - #endif - - - if (withClear) { - - QMetaObject::invokeMethod(lastButton, "clearSlotsEventReset", Q_ARG(bool, withTrue)); - - } - - - - // when alias exists but not index - if ((alias != -1) && (index == -1)) { - - QMetaObject::invokeMethod(helper, invokeString, Qt::QueuedConnection, - Q_ARG(int, code), - Q_ARG(int, alias), - Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); - - // when alias doesn't exists and index too - } else if ((alias == -1) && (index == -1)) { - - QMetaObject::invokeMethod(helper, invokeString, Qt::QueuedConnection, - Q_ARG(int, code), - Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); - - // when all exist (code, alias, index) - } else { - - QMetaObject::invokeMethod(helper, invokeString, Qt::QueuedConnection, - Q_ARG(int, code), - Q_ARG(int, alias), - Q_ARG(int, index), - Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); - - } - + invokeMethodLastBtn(joybtn, Qt::QueuedConnection, Qt::QueuedConnection, Qt::QueuedConnection); this->close(); } @@ -532,65 +364,7 @@ void QuickSetDialog::showStickButtonDialog(JoyControlStickButton* joyctrlstickbt lastButton = joyctrlstickbtn; - // sometimes appears situation, when we want to map an axis of stick, - // it's detected some state between pressing stick button and moving axis. - // It chooses a function for pressing a stick, but later appears problem, - // because correct and prepared value is from the axis one, so static_cast - // for stick button is failing - // App can sometimes ask to three times for a button, but it never is going to crash now - // if lastButton is still null pointer, check, if correct value comes from axis - if (lastButton == nullptr) lastButton = qobject_cast(sender()); - - if (helper == nullptr) { - helper = new ButtonEditDialogHelper(); - } - - // however when it's still a problem - // skip it and try again soon - // should be ok then - if (lastButton != nullptr) { - - helper->setThisButton(lastButton); - - helper->moveToThread(lastButton->thread()); - - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Thread in QuickSetDialog"; - #endif - - if (withClear) { - - QMetaObject::invokeMethod(lastButton, "clearSlotsEventReset", Q_ARG(bool, withTrue)); - - } - - // when alias exists but not index - if ((alias != -1) && (index == -1)) { - - QMetaObject::invokeMethod(helper, invokeString, Qt::QueuedConnection, - Q_ARG(int, code), - Q_ARG(int, alias), - Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); - - // when alias doesn't exists and index too - } else if ((alias == -1) && (index == -1)) { - - QMetaObject::invokeMethod(helper, invokeString, Qt::QueuedConnection, - Q_ARG(int, code), - Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); - - // when all exist (code, alias, index) - } else { - - QMetaObject::invokeMethod(helper, invokeString, Qt::QueuedConnection, - Q_ARG(int, code), - Q_ARG(int, alias), - Q_ARG(int, index), - Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); - - } - - } + invokeMethodLastBtn(joyctrlstickbtn, Qt::QueuedConnection, Qt::QueuedConnection, Qt::QueuedConnection, true); this->close(); } @@ -600,151 +374,134 @@ void QuickSetDialog::showDPadButtonDialog(JoyDPadButton* joydpadbtn) { qInstallMessageHandler(MessageHandler::myMessageOutput); - lastButton = joydpadbtn; - - if (helper == nullptr) { - helper = new ButtonEditDialogHelper(); - } - - helper->setThisButton(lastButton); - - helper->moveToThread(lastButton->thread()); - - - #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << "Thread in QuickSetDialog"; - #endif - - if (withClear) { - - QMetaObject::invokeMethod(lastButton, "clearSlotsEventReset", Q_ARG(bool, withTrue)); - - } - - // when alias exists but not index - if ((alias != -1) && (index == -1)) { - - QMetaObject::invokeMethod(helper, invokeString, Qt::QueuedConnection, - Q_ARG(int, code), - Q_ARG(int, alias), - Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); - - // when alias doesn't exists and index too - } else if ((alias == -1) && (index == -1)) { - - QMetaObject::invokeMethod(helper, invokeString, Qt::QueuedConnection, - Q_ARG(int, code), - Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); - - // when all exist (code, alias, index) - } else { - - QMetaObject::invokeMethod(helper, invokeString, Qt::BlockingQueuedConnection, - Q_ARG(int, code), - Q_ARG(int, alias), - Q_ARG(int, index), - Q_ARG(JoyButtonSlot::JoySlotInputAction, mode)); - - } - + invokeMethodLastBtn(joydpadbtn, Qt::QueuedConnection, Qt::QueuedConnection, Qt::BlockingQueuedConnection); this->close(); } -void QuickSetDialog::restoreButtonStates() +void QuickSetDialog::restoreJoystickState() { qInstallMessageHandler(MessageHandler::myMessageOutput); SetJoystick *currentset = joystick->getActiveSetJoystick(); + restoreSticksStates(currentset); + restoreAxesStates(currentset); + restoreHatsStates(currentset); + restoreVDPadsStates(currentset); + restoreButtonsStates(currentset); + + currentset->release(); +} + + +void QuickSetDialog::restoreSticksStates(SetJoystick *currentset) +{ for (int i = 0; i < currentset->getNumberSticks(); i++) { JoyControlStick *stick = currentset->getJoyStick(i); QHash *stickButtons = stick->getButtons(); QHashIterator iter(*stickButtons); + while (iter.hasNext()) { JoyControlStickButton *stickbutton = iter.next().value(); + if (stickbutton->getIgnoreEventState()) - { stickbutton->setIgnoreEventState(false); - } disconnect(stickbutton, &JoyControlStickButton::clicked, this, nullptr); } } +} + - for (int i=0; i < currentset->getNumberAxes(); i++) +void QuickSetDialog::restoreAxesStates(SetJoystick *currentset) +{ + for (int i = 0; i < currentset->getNumberAxes(); i++) { JoyAxis *axis = currentset->getJoyAxis(i); if (!axis->isPartControlStick() && axis->hasControlOfButtons()) { JoyAxisButton *naxisbutton = axis->getNAxisButton(); + if (naxisbutton->getIgnoreEventState()) - { naxisbutton->setIgnoreEventState(false); - } + JoyAxisButton *paxisbutton = axis->getPAxisButton(); + if (paxisbutton->getIgnoreEventState()) - { paxisbutton->setIgnoreEventState(false); - } + disconnect(naxisbutton, &JoyAxisButton::clicked, this, nullptr); disconnect(paxisbutton, &JoyAxisButton::clicked, this, nullptr); } } +} - for (int i=0; i < currentset->getNumberHats(); i++) + +void QuickSetDialog::restoreHatsStates(SetJoystick *currentset) +{ + for (int i = 0; i < currentset->getNumberHats(); i++) { JoyDPad *dpad = currentset->getJoyDPad(i); QHash* dpadbuttons = dpad->getButtons(); QHashIterator iter(*dpadbuttons); + while (iter.hasNext()) { JoyDPadButton *dpadbutton = iter.next().value(); + if (dpadbutton->getIgnoreEventState()) - { dpadbutton->setIgnoreEventState(false); - } + disconnect(dpadbutton, &JoyDPadButton::clicked, this, nullptr); } } +} + - for (int i=0; i < currentset->getNumberVDPads(); i++) +void QuickSetDialog::restoreVDPadsStates(SetJoystick *currentset) +{ + for (int i = 0; i < currentset->getNumberVDPads(); i++) { VDPad *dpad = currentset->getVDPad(i); + if (dpad != nullptr) { QHash* dpadbuttons = dpad->getButtons(); QHashIterator iter(*dpadbuttons); + while (iter.hasNext()) { JoyDPadButton *dpadbutton = iter.next().value(); + if (dpadbutton->getIgnoreEventState()) - { dpadbutton->setIgnoreEventState(false); - } + disconnect(dpadbutton, &JoyDPadButton::clicked, this, nullptr); } } } +} + - for (int i=0; i < currentset->getNumberButtons(); i++) +void QuickSetDialog::restoreButtonsStates(SetJoystick *currentset) +{ + for (int i = 0; i < currentset->getNumberButtons(); i++) { JoyButton *button = currentset->getJoyButton(i); + if ((button != nullptr) && !button->isPartVDPad()) { if (button->getIgnoreEventState()) - { button->setIgnoreEventState(false); - } + disconnect(button, &JoyButton::clicked, this, nullptr); } } - - currentset->release(); } diff --git a/src/quicksetdialog.h b/src/quicksetdialog.h old mode 100644 new mode 100755 index a2bbdffc0..8c7c3ccff --- a/src/quicksetdialog.h +++ b/src/quicksetdialog.h @@ -26,6 +26,8 @@ class InputDevice; class QWidget; +class SetJoystick; +class JoyControlStick; class JoyButton; class JoyControlStickButton; class JoyDPadButton; @@ -58,9 +60,21 @@ private slots: void showButtonDialog(JoyButton* joybtn); void showStickButtonDialog(JoyControlStickButton* joyctrlstickbtn); void showDPadButtonDialog(JoyDPadButton* joydpadbtn); - void restoreButtonStates(); + void restoreJoystickState(); private: + void invokeMethodLastBtn(JoyButton* lastJoyBtn, Qt::ConnectionType connTypeForAlias, Qt::ConnectionType connTypeForNothing, Qt::ConnectionType connTypeForAll, bool possibleAxisAction = false); + void restoreSticksStates(SetJoystick *currentset); + void restoreAxesStates(SetJoystick *currentset); + void restoreHatsStates(SetJoystick *currentset); + void restoreVDPadsStates(SetJoystick *currentset); + void restoreButtonsStates(SetJoystick *currentset); + void connectSticksForDialog(SetJoystick* currentset); + void connectAxesForDialog(SetJoystick* currentset); + void connectDpadForDialog(SetJoystick* currentset); + void connectVDpadForDialog(SetJoystick* currentset); + void connectBtnForDialog(SetJoystick* currentset); + Ui::QuickSetDialog *ui; InputDevice *joystick; diff --git a/src/quicksetdialog.ui b/src/quicksetdialog.ui old mode 100644 new mode 100755 diff --git a/src/resources.qrc b/src/resources.qrc old mode 100644 new mode 100755 index 9b1eda65d..54d32ead9 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -1,6 +1,10 @@ - images/antimicro.png + images/16x16/com.github.juliagoda.antimicro.png + images/24x24/com.github.juliagoda.antimicro.png + images/32x32/com.github.juliagoda.antimicro.png + images/48x48/com.github.juliagoda.antimicro.png + images/64x64/com.github.juliagoda.antimicro.png images/antimicro_trayicon.png images/controllermap.png images/axis.png diff --git a/src/resources_windows.qrc b/src/resources_windows.qrc old mode 100644 new mode 100755 diff --git a/src/sdleventreader.cpp b/src/sdleventreader.cpp old mode 100644 new mode 100755 index 2b4477971..c8eb6d60f --- a/src/sdleventreader.cpp +++ b/src/sdleventreader.cpp @@ -17,11 +17,11 @@ #include "sdleventreader.h" +#include "globalvariables.h" #include "messagehandler.h" #include "inputdevice.h" #include "antimicrosettings.h" #include "common.h" - //#include "logger.h" #include @@ -43,7 +43,7 @@ SDLEventReader::SDLEventReader(QMap *joysticks, this->settings = settings; settings->getLock()->lock(); this->pollRate = settings->value("GamepadPollRate", - AntiMicroSettings::defaultSDLGamepadPollRate).toUInt(); + GlobalVariables::AntimicroSettings::defaultSDLGamepadPollRate).toUInt(); settings->getLock()->unlock(); pollRateTimer.setParent(this); @@ -72,18 +72,19 @@ void SDLEventReader::initSDL() // SDL_INIT_GAMECONTROLLER should automatically initialize SDL_INIT_JOYSTICK // but it doesn't seem to be the case with v2.0.4 SDL_Init(SDL_INIT_GAMECONTROLLER | SDL_INIT_JOYSTICK); - SDL_JoystickEventState(SDL_ENABLE); - sdlIsOpen = true; + sdlIsOpen = true; settings->getLock()->lock(); settings->beginGroup("Mappings"); QStringList mappings = settings->allKeys(); QStringListIterator iter(mappings); + while (iter.hasNext()) { QString tempstring = iter.next(); QString mappingSetting = settings->value(tempstring, QString()).toString(); + if (!mappingSetting.isEmpty()) { QByteArray temparray = mappingSetting.toUtf8(); @@ -112,9 +113,8 @@ void SDLEventReader::closeSDL() closeDevices(); // Clear any pending events - while (SDL_PollEvent(&event) > 0) - { - } + while (SDL_PollEvent(&event) > 0) {} + SDL_Quit(); sdlIsOpen = false; @@ -124,16 +124,10 @@ void SDLEventReader::closeSDL() void SDLEventReader::performWork() { - - if (sdlIsOpen) + if (sdlIsOpen && (eventStatus() > 0)) { - int status = CheckForEvents(); - - if (status) - { - pollRateTimer.stop(); - emit eventRaised(); - } + pollRateTimer.stop(); + emit eventRaised(); } } @@ -158,7 +152,6 @@ void SDLEventReader::refresh() if (sdlIsOpen) { stop(); - QTimer::singleShot(0, this, SLOT(secondaryRefresh())); } } @@ -167,10 +160,7 @@ void SDLEventReader::secondaryRefresh() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (sdlIsOpen) - { - closeSDL(); - } + if (sdlIsOpen) closeSDL(); initSDL(); } @@ -182,9 +172,7 @@ void SDLEventReader::clearEvents() if (sdlIsOpen) { SDL_Event event; - while (SDL_PollEvent(&event) > 0) - { - } + while (SDL_PollEvent(&event) > 0) {} } } @@ -195,16 +183,17 @@ bool SDLEventReader::isSDLOpen() return sdlIsOpen; } -int SDLEventReader::CheckForEvents() +int SDLEventReader::eventStatus() { int result = 0; SDL_PumpEvents(); + switch (SDL_PeepEvents(nullptr, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)) { case -1: { - Logger::LogError(QString("SDL Error: %1"). + Logger::LogError(QString("SDL Error: %1"). arg(QString(SDL_GetError())), true, true); result = 0; @@ -213,10 +202,7 @@ int SDLEventReader::CheckForEvents() } case 0: { - if (!pollRateTimer.isActive()) - { - pollRateTimer.start(); - } + if (!pollRateTimer.isActive()) pollRateTimer.start(); break; } @@ -236,16 +222,13 @@ void SDLEventReader::updatePollRate(int tempPollRate) if ((tempPollRate >= 1) && (tempPollRate <= 16)) { - bool wasActive = pollRateTimer.isActive(); + bool pollTimerWasActive = pollRateTimer.isActive(); pollRateTimer.stop(); this->pollRate = tempPollRate; pollRateTimer.setInterval(pollRate); - if (wasActive) - { - pollRateTimer.start(); - } + if (pollTimerWasActive) pollRateTimer.start(); } } @@ -271,17 +254,15 @@ void SDLEventReader::closeDevices() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (sdlIsOpen) + if (sdlIsOpen && (joysticks != nullptr)) { - if (joysticks) + QMapIterator iter(*joysticks); + + while (iter.hasNext()) { - QMapIterator iter(*joysticks); - while (iter.hasNext()) - { - iter.next(); - InputDevice *current = iter.value(); - current->closeSDLDevice(); - } + iter.next(); + InputDevice *current = iter.value(); + current->closeSDLDevice(); } } } diff --git a/src/sdleventreader.h b/src/sdleventreader.h old mode 100644 new mode 100755 index 6ea4b2e27..f8ab1651c --- a/src/sdleventreader.h +++ b/src/sdleventreader.h @@ -50,7 +50,7 @@ class SDLEventReader : public QObject void initSDL(); void closeSDL(); void clearEvents(); - int CheckForEvents(); + int eventStatus(); signals: void eventRaised(); diff --git a/src/setaxisthrottledialog.cpp b/src/setaxisthrottledialog.cpp old mode 100644 new mode 100755 index 3cab9573e..bf9ef32b2 --- a/src/setaxisthrottledialog.cpp +++ b/src/setaxisthrottledialog.cpp @@ -24,7 +24,6 @@ #include #include - SetAxisThrottleDialog::SetAxisThrottleDialog(JoyAxis *axis, QWidget *parent) : QDialog(parent), ui(new Ui::SetAxisThrottleDialog) diff --git a/src/setaxisthrottledialog.h b/src/setaxisthrottledialog.h old mode 100644 new mode 100755 diff --git a/src/setaxisthrottledialog.ui b/src/setaxisthrottledialog.ui old mode 100644 new mode 100755 diff --git a/src/setjoystick.cpp b/src/setjoystick.cpp old mode 100644 new mode 100755 index 44602e25a..76a6a8d31 --- a/src/setjoystick.cpp +++ b/src/setjoystick.cpp @@ -17,6 +17,7 @@ #include "setjoystick.h" +#include "globalvariables.h" #include "messagehandler.h" #include "inputdevice.h" #include "joycontrolstick.h" @@ -32,16 +33,13 @@ #include -const int SetJoystick::MAXNAMELENGTH = 30; -const int SetJoystick::RAISEDDEADZONE = 20000; - SetJoystick::SetJoystick(InputDevice *device, int index, QObject *parent) : QObject(parent) { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->device = device; - this->index = index; + m_device = device; + m_index = index; reset(); } @@ -51,12 +49,10 @@ SetJoystick::SetJoystick(InputDevice *device, int index, bool runreset, QObject { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->device = device; - this->index = index; - if (runreset) - { - reset(); - } + m_device = device; + m_index = index; + + if (runreset) reset(); } SetJoystick::~SetJoystick() @@ -113,10 +109,10 @@ void SetJoystick::refreshButtons() deleteButtons(); - for (int i=0; i < device->getNumberRawButtons(); i++) + for (int i=0; i < m_device->getNumberRawButtons(); i++) { - JoyButton *button = new JoyButton (i, index, this, this); - buttons.insert(i, button); + JoyButton *button = new JoyButton (i, m_index, this, this); + m_buttons.insert(i, button); enableButtonConnections(button); } } @@ -130,7 +126,7 @@ void SetJoystick::refreshAxes() InputDevice *device = getInputDevice(); for (int i=0; i < device->getNumberRawAxes(); i++) { - JoyAxis *axis = new JoyAxis(i, index, this, this); + JoyAxis *axis = new JoyAxis(i, m_index, this, this); axes.insert(i, axis); if (device->hasCalibrationThrottle(i)) @@ -149,9 +145,9 @@ void SetJoystick::refreshHats() deleteHats(); - for (int i=0; i < device->getNumberRawHats(); i++) + for (int i=0; i < m_device->getNumberRawHats(); i++) { - JoyDPad *dpad = new JoyDPad(i, index, this, this); + JoyDPad *dpad = new JoyDPad(i, m_index, this, this); hats.insert(i, dpad); enableHatConnections(dpad); } @@ -162,17 +158,19 @@ void SetJoystick::deleteButtons() qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getButtons()); + while (iter.hasNext()) { JoyButton *button = iter.next().value(); - if (button) + + if (button != nullptr) { delete button; button = nullptr; } } - buttons.clear(); + m_buttons.clear(); } @@ -181,10 +179,12 @@ void SetJoystick::deleteAxes() qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(axes); + while (iter.hasNext()) { JoyAxis *axis = iter.next().value(); - if (axis) + + if (axis != nullptr) { delete axis; axis = nullptr; @@ -199,10 +199,12 @@ void SetJoystick::deleteSticks() qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getSticks()); + while (iter.hasNext()) { JoyControlStick *stick = iter.next().value(); - if (stick) + + if (stick != nullptr) { delete stick; stick = nullptr; @@ -217,10 +219,12 @@ void SetJoystick::deleteVDpads() qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getVdpads()); + while (iter.hasNext()) { VDPad *dpad = iter.next().value(); - if (dpad) + + if (dpad != nullptr) { delete dpad; dpad = nullptr; @@ -236,10 +240,12 @@ void SetJoystick::deleteHats() qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getHats()); + while (iter.hasNext()) { JoyDPad *dpad = iter.next().value(); - if (dpad) + + if (dpad != nullptr) { delete dpad; dpad = nullptr; @@ -293,7 +299,7 @@ void SetJoystick::reset() refreshAxes(); refreshButtons(); refreshHats(); - name = QString(); + m_name = QString(); } void SetJoystick::propogateSetChange(int index) @@ -307,50 +313,40 @@ void SetJoystick::propogateSetButtonAssociation(int button, int newset, int mode { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (newset != index) - { - emit setAssignmentButtonChanged(button, index, newset, mode); - } + if (newset != m_index) + emit setAssignmentButtonChanged(button, m_index, newset, mode); } void SetJoystick::propogateSetAxisButtonAssociation(int button, int axis, int newset, int mode) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (newset != index) - { - emit setAssignmentAxisChanged(button, axis, index, newset, mode); - } + if (newset != m_index) + emit setAssignmentAxisChanged(button, axis, m_index, newset, mode); } void SetJoystick::propogateSetStickButtonAssociation(int button, int stick, int newset, int mode) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (newset != index) - { - emit setAssignmentStickChanged(button, stick, index, newset, mode); - } + if (newset != m_index) + emit setAssignmentStickChanged(button, stick, m_index, newset, mode); } void SetJoystick::propogateSetDPadButtonAssociation(int button, int dpad, int newset, int mode) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (newset != index) - { - emit setAssignmentDPadChanged(button, dpad, index, newset, mode); - } + if (newset != m_index) + emit setAssignmentDPadChanged(button, dpad, m_index, newset, mode); } void SetJoystick::propogateSetVDPadButtonAssociation(int button, int dpad, int newset, int mode) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (newset != index) - { - emit setAssignmentVDPadChanged(button, dpad, index, newset, mode); - } + if (newset != m_index) + emit setAssignmentVDPadChanged(button, dpad, m_index, newset, mode); } /** @@ -362,16 +358,17 @@ void SetJoystick::release() qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iterAxes(axes); + while (iterAxes.hasNext()) { JoyAxis *axis = iterAxes.next().value(); axis->clearPendingEvent(); axis->joyEvent(axis->getCurrentThrottledDeadValue(), true); axis->eventReset(); - } QHashIterator iterDPads(getHats()); + while (iterDPads.hasNext()) { JoyDPad *dpad = iterDPads.next().value(); @@ -381,6 +378,7 @@ void SetJoystick::release() } QHashIterator iterButtons(getButtons()); + while (iterButtons.hasNext()) { JoyButton *button = iterButtons.next().value(); @@ -396,48 +394,33 @@ void SetJoystick::readConfig(QXmlStreamReader *xml) if (xml->isStartElement() && (xml->name() == "set")) { - xml->readNextStartElement(); + while (!xml->atEnd() && (!xml->isEndElement() && (xml->name() != "set"))) { if ((xml->name() == "button") && xml->isStartElement()) { int index = xml->attributes().value("index").toString().toInt(); - JoyButton *button = getJoyButton(index-1); - if (button) - { - button->readConfig(xml); - } - else - { - xml->skipCurrentElement(); - } + JoyButton *button = getJoyButton(index - 1); + + if (button != nullptr) button->readConfig(xml); + else xml->skipCurrentElement(); } else if ((xml->name() == "axis") && xml->isStartElement()) { int index = xml->attributes().value("index").toString().toInt(); - JoyAxis *axis = getJoyAxis(index-1); - if (axis) - { - axis->readConfig(xml); - } - else - { - xml->skipCurrentElement(); - } + JoyAxis *axis = getJoyAxis(index - 1); + + if (axis != nullptr) axis->readConfig(xml); + else xml->skipCurrentElement(); } else if ((xml->name() == "dpad") && xml->isStartElement()) { int index = xml->attributes().value("index").toString().toInt(); - JoyDPad *dpad = getJoyDPad(index-1); - if (dpad) - { - dpad->readConfig(xml); - } - else - { - xml->skipCurrentElement(); - } + JoyDPad *dpad = getJoyDPad(index - 1); + + if (dpad != nullptr) dpad->readConfig(xml); + else xml->skipCurrentElement(); } else if ((xml->name() == "stick") && xml->isStartElement()) { @@ -447,14 +430,9 @@ void SetJoystick::readConfig(QXmlStreamReader *xml) { stickIndex -= 1; JoyControlStick *stick = getJoyStick(stickIndex); - if (stick) - { - stick->readConfig(xml); - } - else - { - xml->skipCurrentElement(); - } + + if (stick != nullptr) stick->readConfig(xml); + else xml->skipCurrentElement(); } else { @@ -464,28 +442,20 @@ void SetJoystick::readConfig(QXmlStreamReader *xml) else if ((xml->name() == "vdpad") && xml->isStartElement()) { int index = xml->attributes().value("index").toString().toInt(); - VDPad *vdpad = getVDPad(index-1); - if (vdpad) - { - vdpad->readConfig(xml); - } - else - { - xml->skipCurrentElement(); - } + VDPad *vdpad = getVDPad(index - 1); + + if (vdpad != nullptr) vdpad->readConfig(xml); + else xml->skipCurrentElement(); } else if ((xml->name() == "name") && xml->isStartElement()) { QString temptext = xml->readElementText(); - if (!temptext.isEmpty()) - { - setName(temptext); - } + + if (!temptext.isEmpty()) setName(temptext); } else - { - // If none of the above, skip the element - xml->skipCurrentElement(); + { + xml->skipCurrentElement(); // If none of the above, skip the element } xml->readNextStartElement(); @@ -500,48 +470,45 @@ void SetJoystick::writeConfig(QXmlStreamWriter *xml) if (!isSetEmpty()) { xml->writeStartElement("set"); + xml->writeAttribute("index", QString::number(m_index+1)); - xml->writeAttribute("index", QString::number(index+1)); + if (!m_name.isEmpty()) + xml->writeTextElement("name", m_name); - if (!name.isEmpty()) - { - xml->writeTextElement("name", name); - } - - for (int i=0; i < getNumberSticks(); i++) + for (int i = 0; i < getNumberSticks(); i++) { JoyControlStick *stick = getJoyStick(i); stick->writeConfig(xml); } - for (int i=0; i < getNumberVDPads(); i++) + for (int i = 0; i < getNumberVDPads(); i++) { VDPad *vdpad = getVDPad(i); - if (vdpad) - { - vdpad->writeConfig(xml); - } + + if (vdpad != nullptr) vdpad->writeConfig(xml); } - for (int i=0; i < getNumberAxes(); i++) + for (int i = 0; i < getNumberAxes(); i++) { JoyAxis *axis = getJoyAxis(i); + if (!axis->isPartControlStick() && axis->hasControlOfButtons()) { axis->writeConfig(xml); } } - for (int i=0; i < getNumberHats(); i++) + for (int i = 0; i < getNumberHats(); i++) { JoyDPad *dpad = getJoyDPad(i); dpad->writeConfig(xml); } - for (int i=0; i < getNumberButtons(); i++) + for (int i = 0 ; i < getNumberButtons(); i++) { JoyButton *button = getJoyButton(i); - if (button && !button->isPartVDPad()) + + if ((button != nullptr) && !button->isPartVDPad()) { button->writeConfig(xml); } @@ -557,53 +524,48 @@ bool SetJoystick::isSetEmpty() bool result = true; QHashIterator iter(getButtons()); + while (iter.hasNext() && result) { JoyButton *button = iter.next().value(); - if (!button->isDefault()) - { - result = false; - } + + if (!button->isDefault()) result = false; } QHashIterator iter2(axes); + while (iter2.hasNext() && result) { JoyAxis *axis = iter2.next().value(); - if (!axis->isDefault()) - { - result = false; - } + + if (!axis->isDefault()) result = false; } QHashIterator iter3(getHats()); + while (iter3.hasNext() && result) { JoyDPad *dpad = iter3.next().value(); - if (!dpad->isDefault()) - { - result = false; - } + + if (!dpad->isDefault()) result = false; } QHashIterator iter4(getSticks()); + while (iter4.hasNext() && result) { JoyControlStick *stick = iter4.next().value(); - if (!stick->isDefault()) - { - result = false; - } + + if (!stick->isDefault()) result = false; } QHashIterator iter5(getVdpads()); + while (iter5.hasNext() && result) { VDPad *vdpad = iter5.next().value(); - if (!vdpad->isDefault()) - { - result = false; - } + + if (!vdpad->isDefault()) result = false; } return result; @@ -614,10 +576,9 @@ void SetJoystick::propogateSetAxisThrottleSetting(int index) qInstallMessageHandler(MessageHandler::myMessageOutput); JoyAxis *axis = axes.value(index); - if (axis) - { + + if (axis != nullptr) emit setAssignmentAxisThrottleChanged(index, axis->getCurrentlyAssignedSet()); - } } void SetJoystick::addControlStick(int index, JoyControlStick *stick) @@ -628,9 +589,11 @@ void SetJoystick::addControlStick(int index, JoyControlStick *stick) connect(stick, &JoyControlStick::stickNameChanged, this, &SetJoystick::propogateSetStickNameChange); QHashIterator iter(*stick->getButtons()); + while (iter.hasNext()) { JoyControlStickButton *button = iter.next().value(); + if (button != nullptr) { connect(button, &JoyControlStickButton::setChangeActivated, this, &SetJoystick::propogateSetChange); @@ -663,10 +626,12 @@ void SetJoystick::addVDPad(int index, VDPad *vdpad) connect(vdpad, &VDPad::dpadNameChanged, this, &SetJoystick::propogateSetVDPadNameChange); QHashIterator iter(*vdpad->getButtons()); + while (iter.hasNext()) { JoyDPadButton *button = iter.next().value(); - if (button) + + if (button != nullptr) { connect(button, &JoyDPadButton::setChangeActivated, this, &SetJoystick::propogateSetChange); connect(button, &JoyDPadButton::setAssignmentChanged, this, &SetJoystick::propogateSetVDPadButtonAssociation); @@ -694,14 +659,14 @@ int SetJoystick::getIndex() const { qInstallMessageHandler(MessageHandler::myMessageOutput); - return index; + return m_index; } int SetJoystick::getRealIndex() const { qInstallMessageHandler(MessageHandler::myMessageOutput); - return index + 1; + return m_index + 1; } void SetJoystick::propogateSetButtonClick(int button) @@ -709,18 +674,16 @@ void SetJoystick::propogateSetButtonClick(int button) qInstallMessageHandler(MessageHandler::myMessageOutput); JoyButton* jButton = qobject_cast(sender()); - if (jButton != nullptr) + + if (jButton != nullptr && !jButton->getIgnoreEventState()) { - if (!jButton->getIgnoreEventState()) - { - emit setButtonClick(index, button); - lastClickedButtons.append(jButton); + emit setButtonClick(m_index, button); + lastClickedButtons.append(jButton); - #ifndef QT_DEBUG_NO_OUTPUT + #ifndef QT_DEBUG_NO_OUTPUT qDebug() << "Added button " << jButton->getPartialName(false,true) << " to list"; qDebug() << "List has " << getLastClickedButtons().count() << " buttons"; - #endif - } + #endif } } @@ -733,7 +696,6 @@ void SetJoystick::removeAllBtnFromQueue() { if (!getLastClickedButtons().isEmpty()) lastClickedButtons.clear(); - } int SetJoystick::getCountBtnInList(QString partialName) { @@ -741,7 +703,9 @@ int SetJoystick::getCountBtnInList(QString partialName) { int count = 0; foreach(const JoyButton* joyBtn, getLastClickedButtons()) { - if (joyBtn->getPartialName(false, true) == partialName) count++; + + if (joyBtn->getPartialName(false, true) == partialName) + count++; } return count; @@ -751,13 +715,12 @@ void SetJoystick::propogateSetButtonRelease(int button) { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyButton *jButton = qobject_cast(sender()); // static_cast - if (jButton) + JoyButton *jButton = qobject_cast(sender()); + + if (jButton != nullptr) { if (!jButton->getIgnoreEventState()) - { - emit setButtonRelease(index, button); - } + emit setButtonRelease(m_index, button); } } @@ -765,14 +728,14 @@ void SetJoystick::propogateSetAxisButtonClick(int button) { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyAxisButton *axisButton = qobject_cast(sender()); // static_cast - if (axisButton) + JoyAxisButton *axisButton = qobject_cast(sender()); + + if (axisButton != nullptr) { JoyAxis *axis = axisButton->getAxis(); + if (!axisButton->getIgnoreEventState()) - { - emit setAxisButtonClick(index, axis->getIndex(), button); - } + emit setAxisButtonClick(m_index, axis->getIndex(), button); } } @@ -780,14 +743,14 @@ void SetJoystick::propogateSetAxisButtonRelease(int button) { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyAxisButton *axisButton = qobject_cast(sender()); // static_cast - if (axisButton) + JoyAxisButton *axisButton = qobject_cast(sender()); + + if (axisButton != nullptr) { JoyAxis *axis = axisButton->getAxis(); + if (!axisButton->getIgnoreEventState()) - { - emit setAxisButtonRelease(index, axis->getIndex(), button); - } + emit setAxisButtonRelease(m_index, axis->getIndex(), button); } } @@ -795,14 +758,14 @@ void SetJoystick::propogateSetStickButtonClick(int button) { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyControlStickButton *stickButton = qobject_cast(sender()); // static_cast - if (stickButton) + JoyControlStickButton *stickButton = qobject_cast(sender()); + + if (stickButton != nullptr) { JoyControlStick *stick = stickButton->getStick(); + if (stick && !stickButton->getIgnoreEventState()) - { - emit setStickButtonClick(index, stick->getIndex(), button); - } + emit setStickButtonClick(m_index, stick->getIndex(), button); } } @@ -810,14 +773,14 @@ void SetJoystick::propogateSetStickButtonRelease(int button) { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyControlStickButton *stickButton = qobject_cast(sender()); // static_cast - if (stickButton) + JoyControlStickButton *stickButton = qobject_cast(sender()); + + if (stickButton != nullptr) { JoyControlStick *stick = stickButton->getStick(); + if (!stickButton->getIgnoreEventState()) - { - emit setStickButtonRelease(index, stick->getIndex(), button); - } + emit setStickButtonRelease(m_index, stick->getIndex(), button); } } @@ -825,14 +788,16 @@ void SetJoystick::propogateSetDPadButtonClick(int button) { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyDPadButton *dpadButton = qobject_cast(sender()); // static_cast + JoyDPadButton *dpadButton = qobject_cast(sender()); + if (dpadButton) { JoyDPad *dpad = dpadButton->getDPad(); + if (dpad && dpadButton->getButtonState() && !dpadButton->getIgnoreEventState()) { - emit setDPadButtonClick(index, dpad->getIndex(), button); + emit setDPadButtonClick(m_index, dpad->getIndex(), button); } } } @@ -841,14 +806,16 @@ void SetJoystick::propogateSetDPadButtonRelease(int button) { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyDPadButton *dpadButton = qobject_cast(sender()); // static_cast - if (dpadButton) + JoyDPadButton *dpadButton = qobject_cast(sender()); + + if (dpadButton != nullptr) { JoyDPad *dpad = dpadButton->getDPad(); + if (dpad && !dpadButton->getButtonState() && !dpadButton->getIgnoreEventState()) { - emit setDPadButtonRelease(index, dpad->getIndex(), button); + emit setDPadButtonRelease(m_index, dpad->getIndex(), button); } } } @@ -857,7 +824,7 @@ void SetJoystick::propogateSetButtonNameChange() { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyButton *button = qobject_cast(sender()); // static_cast + JoyButton *button = qobject_cast(sender()); disconnect(button, &JoyButton::buttonNameChanged, this, &SetJoystick::propogateSetButtonNameChange); emit setButtonNameChange(button->getJoyNumber()); connect(button, &JoyButton::buttonNameChanged, this, &SetJoystick::propogateSetButtonNameChange); @@ -867,7 +834,7 @@ void SetJoystick::propogateSetAxisButtonNameChange() { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyAxisButton *button = qobject_cast(sender()); // static_cast + JoyAxisButton *button = qobject_cast(sender()); disconnect(button, &JoyAxisButton::buttonNameChanged, this, &SetJoystick::propogateSetAxisButtonNameChange); emit setAxisButtonNameChange(button->getAxis()->getIndex(), button->getJoyNumber()); connect(button, &JoyAxisButton::buttonNameChanged, this, &SetJoystick::propogateSetAxisButtonNameChange); @@ -877,7 +844,7 @@ void SetJoystick::propogateSetStickButtonNameChange() { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyControlStickButton *button = qobject_cast(sender()); // static_cast + JoyControlStickButton *button = qobject_cast(sender()); disconnect(button, &JoyControlStickButton::buttonNameChanged, this, &SetJoystick::propogateSetStickButtonNameChange); emit setStickButtonNameChange(button->getStick()->getIndex(), button->getJoyNumber()); connect(button, &JoyControlStickButton::buttonNameChanged, this, &SetJoystick::propogateSetStickButtonNameChange); @@ -887,7 +854,7 @@ void SetJoystick::propogateSetDPadButtonNameChange() { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyDPadButton *button = qobject_cast(sender()); // static_cast + JoyDPadButton *button = qobject_cast(sender()); disconnect(button, &JoyDPadButton::buttonNameChanged, this, &SetJoystick::propogateSetDPadButtonNameChange); emit setDPadButtonNameChange(button->getDPad()->getIndex(), button->getJoyNumber()); connect(button, &JoyDPadButton::buttonNameChanged, this, &SetJoystick::propogateSetDPadButtonNameChange); @@ -897,7 +864,7 @@ void SetJoystick::propogateSetVDPadButtonNameChange() { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyDPadButton *button = qobject_cast(sender()); // static_cast + JoyDPadButton *button = qobject_cast(sender()); disconnect(button, &JoyDPadButton::buttonNameChanged, this, &SetJoystick::propogateSetVDPadButtonNameChange); emit setVDPadButtonNameChange(button->getDPad()->getIndex(), button->getJoyNumber()); connect(button, &JoyDPadButton::buttonNameChanged, this, &SetJoystick::propogateSetVDPadButtonNameChange); @@ -907,7 +874,7 @@ void SetJoystick::propogateSetAxisNameChange() { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyAxis *axis = qobject_cast(sender()); // static_cast + JoyAxis *axis = qobject_cast(sender()); disconnect(axis, &JoyAxis::axisNameChanged, this, &SetJoystick::propogateSetAxisNameChange); emit setAxisNameChange(axis->getIndex()); connect(axis, &JoyAxis::axisNameChanged, this, &SetJoystick::propogateSetAxisNameChange); @@ -917,7 +884,7 @@ void SetJoystick::propogateSetStickNameChange() { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyControlStick *stick = qobject_cast(sender()); // static_cast + JoyControlStick *stick = qobject_cast(sender()); disconnect(stick, &JoyControlStick::stickNameChanged, this, &SetJoystick::propogateSetStickNameChange); emit setStickNameChange(stick->getIndex()); connect(stick, &JoyControlStick::stickNameChanged, this, &SetJoystick::propogateSetStickNameChange); @@ -927,7 +894,7 @@ void SetJoystick::propogateSetDPadNameChange() { qInstallMessageHandler(MessageHandler::myMessageOutput); - JoyDPad *dpad = qobject_cast(sender()); // static_cast + JoyDPad *dpad = qobject_cast(sender()); disconnect(dpad, &JoyDPad::dpadNameChanged, this, &SetJoystick::propogateSetDPadButtonNameChange); emit setDPadNameChange(dpad->getIndex()); connect(dpad, &JoyDPad::dpadNameChanged, this, &SetJoystick::propogateSetDPadButtonNameChange); @@ -937,7 +904,7 @@ void SetJoystick::propogateSetVDPadNameChange() { qInstallMessageHandler(MessageHandler::myMessageOutput); - VDPad *vdpad = qobject_cast(sender()); // static_cast + VDPad *vdpad = qobject_cast(sender()); disconnect(vdpad, &VDPad::dpadNameChanged, this, &SetJoystick::propogateSetVDPadNameChange); emit setVDPadNameChange(vdpad->getIndex()); connect(vdpad, &VDPad::dpadNameChanged, this, &SetJoystick::propogateSetVDPadNameChange); @@ -948,20 +915,21 @@ void SetJoystick::setIgnoreEventState(bool ignore) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator iter(getButtons()); + while (iter.hasNext()) { JoyButton *button = iter.next().value(); - if (button) - { - button->setIgnoreEventState(ignore); - } + + if (button != nullptr) button->setIgnoreEventState(ignore); } QHashIterator iter2(axes); + while (iter2.hasNext()) { JoyAxis *axis = iter2.next().value(); - if (axis) + + if (axis != nullptr) { JoyAxisButton *naxisbutton = axis->getNAxisButton(); naxisbutton->setIgnoreEventState(ignore); @@ -972,33 +940,36 @@ void SetJoystick::setIgnoreEventState(bool ignore) } QHashIterator iter3(getHats()); + while (iter3.hasNext()) { JoyDPad *dpad = iter3.next().value(); - if (dpad) + if (dpad != nullptr) { QHash* dpadbuttons = dpad->getButtons(); QHashIterator iterdpadbuttons(*dpadbuttons); + while (iterdpadbuttons.hasNext()) { JoyDPadButton *dpadbutton = iterdpadbuttons.next().value(); - if (dpadbutton) - { - dpadbutton->setIgnoreEventState(ignore); - } + + if (dpadbutton) dpadbutton->setIgnoreEventState(ignore); } } } QHashIterator iter4(getSticks()); + while (iter4.hasNext()) { JoyControlStick *stick = iter4.next().value(); - if (stick) + + if (stick != nullptr) { QHash *stickButtons = stick->getButtons(); QHashIterator iterstickbuttons(*stickButtons); + while (iterstickbuttons.hasNext()) { JoyControlStickButton *stickbutton = iterstickbuttons.next().value(); @@ -1008,13 +979,16 @@ void SetJoystick::setIgnoreEventState(bool ignore) } QHashIterator iter5(getVdpads()); + while (iter5.hasNext()) { VDPad *vdpad = iter5.next().value(); - if (vdpad) + + if (vdpad != nullptr) { QHash* dpadbuttons = vdpad->getButtons(); QHashIterator itervdpadbuttons(*dpadbuttons); + while (itervdpadbuttons.hasNext()) { JoyDPadButton *dpadbutton = itervdpadbuttons.next().value(); @@ -1022,7 +996,6 @@ void SetJoystick::setIgnoreEventState(bool ignore) } } } - } void SetJoystick::propogateSetAxisActivated(int value) @@ -1030,7 +1003,7 @@ void SetJoystick::propogateSetAxisActivated(int value) qInstallMessageHandler(MessageHandler::myMessageOutput); JoyAxis *axis = qobject_cast(sender()); // static_cast - emit setAxisActivated(this->index, axis->getIndex(), value); + emit setAxisActivated(m_index, axis->getIndex(), value); } void SetJoystick::propogateSetAxisReleased(int value) @@ -1038,7 +1011,7 @@ void SetJoystick::propogateSetAxisReleased(int value) qInstallMessageHandler(MessageHandler::myMessageOutput); JoyAxis *axis = qobject_cast(sender()); // static_cast - emit setAxisReleased(this->index, axis->getIndex(), value); + emit setAxisReleased(m_index, axis->getIndex(), value); } void SetJoystick::enableButtonConnections(JoyButton *button) @@ -1048,9 +1021,9 @@ void SetJoystick::enableButtonConnections(JoyButton *button) connect(button, &JoyButton::setChangeActivated, this, &SetJoystick::propogateSetChange); connect(button, &JoyButton::setAssignmentChanged, this, &SetJoystick::propogateSetButtonAssociation); connect(button, &JoyButton::clicked, this, &SetJoystick::propogateSetButtonClick, Qt::QueuedConnection); - connect(button, &JoyButton::clicked, device, &InputDevice::buttonClickEvent, Qt::QueuedConnection); + connect(button, &JoyButton::clicked, m_device, &InputDevice::buttonClickEvent, Qt::QueuedConnection); connect(button, &JoyButton::released, this, &SetJoystick::propogateSetButtonRelease); - connect(button, &JoyButton::released, device, &InputDevice::buttonReleaseEvent); + connect(button, &JoyButton::released, m_device, &InputDevice::buttonReleaseEvent); connect(button, &JoyButton::buttonNameChanged, this, &SetJoystick::propogateSetButtonNameChange); } @@ -1086,6 +1059,7 @@ void SetJoystick::enableHatConnections(JoyDPad *dpad) QHash *buttons = dpad->getJoyButtons(); QHashIterator iter(*buttons); + while (iter.hasNext()) { JoyDPadButton *button = iter.next().value(); @@ -1093,9 +1067,9 @@ void SetJoystick::enableHatConnections(JoyDPad *dpad) connect(button, &JoyDPadButton::setAssignmentChanged, this, &SetJoystick::propogateSetDPadButtonAssociation); connect(button, &JoyDPadButton::clicked, this, &SetJoystick::propogateSetDPadButtonClick, Qt::QueuedConnection); - connect(button, &JoyDPadButton::clicked, device, &InputDevice::dpadButtonClickEvent, Qt::QueuedConnection); + connect(button, &JoyDPadButton::clicked, m_device, &InputDevice::dpadButtonClickEvent, Qt::QueuedConnection); connect(button, &JoyDPadButton::released, this, &SetJoystick::propogateSetDPadButtonRelease, Qt::QueuedConnection); - connect(button, &JoyDPadButton::released, device, &InputDevice::dpadButtonReleaseEvent, Qt::QueuedConnection); + connect(button, &JoyDPadButton::released, m_device, &InputDevice::dpadButtonReleaseEvent, Qt::QueuedConnection); connect(button, &JoyDPadButton::buttonNameChanged, this, &SetJoystick::propogateSetDPadButtonNameChange); } } @@ -1104,23 +1078,22 @@ InputDevice* SetJoystick::getInputDevice() const { qInstallMessageHandler(MessageHandler::myMessageOutput); - return device; + return m_device; } void SetJoystick::setName(QString name) { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (name.length() <= MAXNAMELENGTH) + if (name.length() <= GlobalVariables::SetJoystick::MAXNAMELENGTH) { - this->name = name; + m_name = name; emit propertyUpdated(); } - else if (name.length() > MAXNAMELENGTH) - { - // Truncate name to 27 characters. Add ellipsis at the end. - name.truncate(MAXNAMELENGTH-3); - this->name = QString(name).append("..."); + else + { + name.truncate(GlobalVariables::SetJoystick::MAXNAMELENGTH - 3); // Truncate name to 27 characters. Add ellipsis at the end. + m_name = QString(name).append("..."); emit propertyUpdated(); } } @@ -1129,67 +1102,63 @@ QString SetJoystick::getName() const { qInstallMessageHandler(MessageHandler::myMessageOutput); - return name; + return m_name; } void SetJoystick::copyAssignments(SetJoystick *destSet) { qInstallMessageHandler(MessageHandler::myMessageOutput); - for (int i=0; i < device->getNumberAxes(); i++) + for (int i = 0; i < m_device->getNumberAxes(); i++) { JoyAxis *sourceAxis = axes.value(i); JoyAxis *destAxis = destSet->axes.value(i); - if (sourceAxis && destAxis) - { - sourceAxis->copyAssignments(destAxis); - } + + if (sourceAxis && destAxis) sourceAxis->copyAssignments(destAxis); } QHashIterator stickIter(getSticks()); + while (stickIter.hasNext()) { stickIter.next(); int index = stickIter.key(); JoyControlStick *sourceStick = stickIter.value(); JoyControlStick *destStick = destSet->getSticks().value(index); + if (sourceStick && destStick) - { sourceStick->copyAssignments(destStick); - } } - for (int i=0; i < device->getNumberHats(); i++) + for (int i = 0; i < m_device->getNumberHats(); i++) { JoyDPad *sourceDPad = getHats().value(i); JoyDPad *destDPad = destSet->getHats().value(i); + if (sourceDPad && destDPad) - { sourceDPad->copyAssignments(destDPad); - } } QHashIterator vdpadIter(getVdpads()); + while (vdpadIter.hasNext()) { vdpadIter.next(); int index = vdpadIter.key(); VDPad *sourceVDpad = vdpadIter.value(); VDPad *destVDPad = destSet->getVdpads().value(index); + if (sourceVDpad && destVDPad) - { sourceVDpad->copyAssignments(destVDPad); - } } - for (int i=0; i < device->getNumberButtons(); i++) + for (int i = 0; i < m_device->getNumberButtons(); i++) { JoyButton *sourceButton = getButtons().value(i); JoyButton *destButton = destSet->getButtons().value(i); + if (sourceButton && destButton) - { sourceButton->copyAssignments(destButton); - } } } @@ -1198,14 +1167,9 @@ QString SetJoystick::getSetLabel() qInstallMessageHandler(MessageHandler::myMessageOutput); QString temp = QString(); - if (!name.isEmpty()) - { - temp = trUtf8("Set %1: %2").arg(index+1).arg(name); - } - else - { - temp = trUtf8("Set %1").arg(index+1); - } + + if (!m_name.isEmpty()) temp = trUtf8("Set %1: %2").arg(m_index+1).arg(m_name); + else temp = trUtf8("Set %1").arg(m_index+1); return temp; } @@ -1233,12 +1197,12 @@ void SetJoystick::raiseAxesDeadZones(int deadZone) qInstallMessageHandler(MessageHandler::myMessageOutput); int tempDeadZone = deadZone; + if ((deadZone <= 0) || (deadZone > 32767)) - { - tempDeadZone = RAISEDDEADZONE; - } + tempDeadZone = GlobalVariables::SetJoystick::RAISEDDEADZONE; QHashIterator axisIter(axes); + while (axisIter.hasNext()) { JoyAxis *temp = axisIter.next().value(); @@ -1253,6 +1217,7 @@ void SetJoystick::currentAxesDeadZones(QList *axesDeadZones) qInstallMessageHandler(MessageHandler::myMessageOutput); QHashIterator axisIter(axes); + while (axisIter.hasNext()) { JoyAxis *temp = axisIter.next().value(); @@ -1266,9 +1231,11 @@ void SetJoystick::setAxesDeadZones(QList *axesDeadZones) QListIterator iter(*axesDeadZones); int axisNum = 0; + while (iter.hasNext()) { int deadZoneValue = iter.next(); + if (axes.contains(axisNum)) { JoyAxis *temp = getJoyAxis(axisNum); @@ -1299,7 +1266,7 @@ QHash* SetJoystick::getAxes() { QHash const& SetJoystick::getButtons() const { - return buttons; + return m_buttons; } QHash const& SetJoystick::getHats() const { diff --git a/src/setjoystick.h b/src/setjoystick.h old mode 100644 new mode 100755 index 699be7e3d..2f8955401 --- a/src/setjoystick.h +++ b/src/setjoystick.h @@ -88,9 +88,6 @@ class SetJoystick : public QObject virtual void readConfig(QXmlStreamReader *xml); virtual void writeConfig(QXmlStreamWriter *xml); - static const int MAXNAMELENGTH; - static const int RAISEDDEADZONE; - protected: bool isSetEmpty(); void deleteButtons(); @@ -173,7 +170,7 @@ protected slots: void propogateSetVDPadNameChange(); private: - QHash buttons; + QHash m_buttons; QHash axes; QHash hats; QHash sticks; @@ -181,9 +178,9 @@ protected slots: QList lastClickedButtons; - int index; - InputDevice *device; - QString name; + int m_index; + InputDevice *m_device; + QString m_name; }; Q_DECLARE_METATYPE(SetJoystick*) diff --git a/src/setnamesdialog.cpp b/src/setnamesdialog.cpp old mode 100644 new mode 100755 index 87334c165..d23269837 --- a/src/setnamesdialog.cpp +++ b/src/setnamesdialog.cpp @@ -18,6 +18,7 @@ #include "setnamesdialog.h" #include "ui_setnamesdialog.h" +#include "globalvariables.h" #include "messagehandler.h" #include "inputdevice.h" @@ -34,10 +35,9 @@ SetNamesDialog::SetNamesDialog(InputDevice *device, QWidget *parent) : qInstallMessageHandler(MessageHandler::myMessageOutput); setAttribute(Qt::WA_DeleteOnClose); - this->device = device; - for (int i=0; i < InputDevice::NUMBER_JOYSETS; i++) + for (int i = 0; i < GlobalVariables::InputDevice::NUMBER_JOYSETS; i++) { QString tempSetName = device->getSetJoystick(i)->getName(); ui->setNamesTableWidget->setItem(i, 0, new QTableWidgetItem(tempSetName)); @@ -57,15 +57,14 @@ void SetNamesDialog::saveSetNameChanges() { qInstallMessageHandler(MessageHandler::myMessageOutput); - for (int i=0; i < ui->setNamesTableWidget->rowCount(); i++) + for (int i = 0; i < ui->setNamesTableWidget->rowCount(); i++) { QTableWidgetItem *setNameItem = ui->setNamesTableWidget->item(i, 0); QString setNameText = setNameItem->text(); QString oldSetNameText = device->getSetJoystick(i)->getName(); + if (setNameText != oldSetNameText) - { device->getSetJoystick(i)->setName(setNameText); - } } } diff --git a/src/setnamesdialog.h b/src/setnamesdialog.h old mode 100644 new mode 100755 diff --git a/src/setnamesdialog.ui b/src/setnamesdialog.ui old mode 100644 new mode 100755 diff --git a/src/simplekeygrabberbutton.cpp b/src/simplekeygrabberbutton.cpp old mode 100644 new mode 100755 index 2da7f83b4..db8a78d50 --- a/src/simplekeygrabberbutton.cpp +++ b/src/simplekeygrabberbutton.cpp @@ -18,6 +18,10 @@ #include "simplekeygrabberbutton.h" +#include +#include +#include + #include "messagehandler.h" #include "event.h" #include "antkeymapper.h" @@ -31,14 +35,11 @@ #include #endif -#include -#include #include #include #include - SimpleKeyGrabberButton::SimpleKeyGrabberButton(QWidget *parent) : QPushButton(parent) { @@ -55,10 +56,7 @@ void SimpleKeyGrabberButton::keyPressEvent(QKeyEvent *event) qInstallMessageHandler(MessageHandler::myMessageOutput); // Do not allow closing of dialog using Escape key - if (event->key() == Qt::Key_Escape) - { - return; - } + if (event->key() == Qt::Key_Escape) return; QPushButton::keyPressEvent(event); } @@ -70,20 +68,14 @@ bool SimpleKeyGrabberButton::eventFilter(QObject *obj, QEvent *event) Q_UNUSED(obj); int controlcode = 0; + if (grabNextAction && (event->type() == QEvent::MouseButtonRelease)) { QMouseEvent *mouseEve = static_cast(event); - if (mouseEve->button() == Qt::RightButton) - { - controlcode = 3; - } - else if (mouseEve->button() == Qt::MiddleButton) - { - controlcode = 2; - } - else { - controlcode = static_cast(mouseEve->button()); - } + + if (mouseEve->button() == Qt::RightButton) controlcode = 3; + else if (mouseEve->button() == Qt::MiddleButton) controlcode = 2; + else controlcode = mouseEve->button(); buttonslot.setSlotCode(controlcode); buttonslot.setSlotMode(JoyButtonSlot::JoyMouseButton); @@ -95,11 +87,11 @@ bool SimpleKeyGrabberButton::eventFilter(QObject *obj, QEvent *event) grabNextAction = grabbingWheel = false; emit buttonCodeChanged(controlcode); } - else if (grabNextAction && (event->type() == QEvent::KeyRelease)) + else if (grabNextAction && (event->type() == static_cast(7))) { QKeyEvent *keyEve = static_cast(event); - int tempcode = static_cast(keyEve->nativeScanCode()); - int virtualactual = static_cast(keyEve->nativeVirtualKey()); + int tempcode = keyEve->nativeScanCode(); + int virtualactual = keyEve->nativeVirtualKey(); BaseEventHandler *handler = EventHandlerFactory::getInstance()->handler(); @@ -114,10 +106,9 @@ bool SimpleKeyGrabberButton::eventFilter(QObject *obj, QEvent *event) checkalias = AntKeyMapper::getInstance()->returnQtKey(finalvirtual); QtKeyMapperBase *nativeWinKeyMapper = AntKeyMapper::getInstance()->getNativeKeyMapper(); int tempQtKey = 0; + if (nativeWinKeyMapper) - { tempQtKey = nativeWinKeyMapper->returnQtKey(finalvirtual); - } if (tempQtKey > 0) { @@ -145,29 +136,26 @@ bool SimpleKeyGrabberButton::eventFilter(QObject *obj, QEvent *event) #if defined(WITH_X11) if (QApplication::platformName() == QStringLiteral("xcb")) - { - // Obtain group 1 X11 keysym. Removes effects from modifiers. - finalvirtual = X11KeyCodeToX11KeySym(tempcode); + { + finalvirtual = X11KeyCodeToX11KeySym(tempcode); // Obtain group 1 X11 keysym. Removes effects from modifiers. - #ifdef WITH_UINPUT - if (handler->getIdentifier() == "uinput") - { - // Find Qt Key corresponding to X11 KeySym. - QtKeyMapperBase *x11KeyMapper = AntKeyMapper::getInstance()->getNativeKeyMapper(); - checkalias = x11KeyMapper->returnQtKey(finalvirtual); - // Find corresponding Linux input key for the Qt key. - finalvirtual = AntKeyMapper::getInstance()->returnVirtualKey(checkalias); - } - #endif + #ifdef WITH_UINPUT - #ifdef WITH_XTEST - if (handler->getIdentifier() == "xtest") - { - // Check for alias against group 1 keysym. - checkalias = AntKeyMapper::getInstance()->returnQtKey(finalvirtual); - } - #endif + if (handler->getIdentifier() == "uinput") + { + QtKeyMapperBase *x11KeyMapper = AntKeyMapper::getInstance()->getNativeKeyMapper(); // Find Qt Key corresponding to X11 KeySym. + checkalias = x11KeyMapper->returnQtKey(finalvirtual); + finalvirtual = AntKeyMapper::getInstance()->returnVirtualKey(checkalias); // Find corresponding Linux input key for the Qt key. + } + + #endif + #ifdef WITH_XTEST + + if (handler->getIdentifier() == "xtest") + checkalias = AntKeyMapper::getInstance()->returnQtKey(finalvirtual); // Check for alias against group 1 keysym. + + #endif } else { @@ -179,8 +167,8 @@ bool SimpleKeyGrabberButton::eventFilter(QObject *obj, QEvent *event) #else if (QApplication::platformName() == QStringLiteral("xcb")) { - finalvirtual = AntKeyMapper::getInstance()->returnVirtualKey(keyEve->key()); - checkalias = AntKeyMapper::getInstance()->returnQtKey(finalvirtual); + finalvirtual = AntKeyMapper::getInstance()->returnVirtualKey(keyEve->key()); + checkalias = AntKeyMapper::getInstance()->returnQtKey(finalvirtual); } else { @@ -207,26 +195,23 @@ bool SimpleKeyGrabberButton::eventFilter(QObject *obj, QEvent *event) valueUpdated = true; edited = true; } - else + else if ((checkalias > 0) && (finalvirtual > 0)) { - if ((checkalias > 0) && (finalvirtual > 0)) - { - buttonslot.setSlotCode(finalvirtual, checkalias); - buttonslot.setSlotMode(JoyButtonSlot::JoyKeyboard); - setText(keysymToKeyString(finalvirtual, checkalias).toUpper()); + buttonslot.setSlotCode(finalvirtual, checkalias); + buttonslot.setSlotMode(JoyButtonSlot::JoyKeyboard); + setText(keysymToKeyString(finalvirtual, checkalias).toUpper()); - edited = true; - valueUpdated = true; - } - else if (virtualactual > 0) - { - buttonslot.setSlotCode(virtualactual); - buttonslot.setSlotMode(JoyButtonSlot::JoyKeyboard); - setText(keysymToKeyString(virtualactual).toUpper()); + edited = true; + valueUpdated = true; + } + else if (virtualactual > 0) + { + buttonslot.setSlotCode(virtualactual); + buttonslot.setSlotMode(JoyButtonSlot::JoyKeyboard); + setText(keysymToKeyString(virtualactual).toUpper()); - edited = true; - valueUpdated = true; - } + edited = true; + valueUpdated = true; } grabNextAction = false; @@ -235,9 +220,7 @@ bool SimpleKeyGrabberButton::eventFilter(QObject *obj, QEvent *event) releaseKeyboard(); if (valueUpdated) - { emit buttonCodeChanged(controlcode); - } } else if (grabNextAction && (event->type() == QEvent::Wheel) && !grabbingWheel) { @@ -283,6 +266,7 @@ bool SimpleKeyGrabberButton::eventFilter(QObject *obj, QEvent *event) else if (event->type() == QEvent::MouseButtonRelease) { QMouseEvent *mouseEve = static_cast(event); + if (mouseEve->button() == Qt::LeftButton) { grabNextAction = true; @@ -293,7 +277,6 @@ bool SimpleKeyGrabberButton::eventFilter(QObject *obj, QEvent *event) } } - return false; } @@ -334,54 +317,10 @@ void SimpleKeyGrabberButton::setValue(QString value, JoyButtonSlot::JoySlotInput edited = true; break; } - case JoyButtonSlot::JoyKeyboard: - { - break; - } - case JoyButtonSlot::JoyMouseButton: - { - break; - } - case JoyButtonSlot::JoyMouseMovement: - { - break; - } - case JoyButtonSlot::JoyPause: - { - break; - } - case JoyButtonSlot::JoyHold: - { - break; - } - case JoyButtonSlot::JoyCycle: - { - break; - } - case JoyButtonSlot::JoyDistance: - { - break; - } - case JoyButtonSlot::JoyRelease: - { - break; - } - case JoyButtonSlot::JoyMouseSpeedMod: - { - break; - } - case JoyButtonSlot::JoyKeyPress: - { - break; - } - case JoyButtonSlot::JoyDelay: - { - break; - } - case JoyButtonSlot::JoySetChange: - { - break; - } + default: + { + break; + } } setText(buttonslot.getSlotString()); diff --git a/src/simplekeygrabberbutton.h b/src/simplekeygrabberbutton.h old mode 100644 new mode 100755 diff --git a/src/slotitemlistwidget.cpp b/src/slotitemlistwidget.cpp old mode 100644 new mode 100755 index f8ceaf173..4c5f0c41b --- a/src/slotitemlistwidget.cpp +++ b/src/slotitemlistwidget.cpp @@ -26,6 +26,7 @@ #include + SlotItemListWidget::SlotItemListWidget(QWidget *parent) : QListWidget(parent) { @@ -41,12 +42,11 @@ void SlotItemListWidget::keyPressEvent(QKeyEvent *event) QListWidgetItem *currentItem = this->item(this->currentRow()); SimpleKeyGrabberButton *tempbutton = nullptr; - if (currentItem) - { + + if (currentItem != nullptr) tempbutton = currentItem->data(Qt::UserRole).value(); - } - if (tempbutton && tempbutton->isGrabbing()) + if (tempbutton != nullptr && tempbutton->isGrabbing()) { switch (event->key()) { @@ -56,11 +56,11 @@ void SlotItemListWidget::keyPressEvent(QKeyEvent *event) propogate = false; break; } + + default: + break; } } - if (propogate) - { - QListWidget::keyPressEvent(event); - } + if (propogate) QListWidget::keyPressEvent(event); } diff --git a/src/slotitemlistwidget.h b/src/slotitemlistwidget.h old mode 100644 new mode 100755 diff --git a/src/springmousemoveinfo.h b/src/springmousemoveinfo.h old mode 100644 new mode 100755 index aac1fd74d..c9ed2ebea --- a/src/springmousemoveinfo.h +++ b/src/springmousemoveinfo.h @@ -19,6 +19,7 @@ #define SPRINGMOUSEMOVEINFO_H namespace PadderCommon { + typedef struct _springModeInfo { // Displacement of the X axis @@ -35,6 +36,7 @@ namespace PadderCommon { int screen; double springDeadX; double springDeadY; + } springModeInfo; } diff --git a/src/stickpushbuttongroup.cpp b/src/stickpushbuttongroup.cpp old mode 100644 new mode 100755 index 2e2b4ca2d..58e70b2a5 --- a/src/stickpushbuttongroup.cpp +++ b/src/stickpushbuttongroup.cpp @@ -31,6 +31,7 @@ #include + StickPushButtonGroup::StickPushButtonGroup(JoyControlStick *stick, bool displayNames, QWidget *parent) : QGridLayout(parent) { @@ -49,58 +50,12 @@ void StickPushButtonGroup::generateButtons() { qInstallMessageHandler(MessageHandler::myMessageOutput); - QHash *stickButtons = stick->getButtons(); - - JoyControlStickButton *button = nullptr; JoyControlStickButtonPushButton *pushbutton = nullptr; - button = stickButtons->value(JoyControlStick::StickLeftUp); - upLeftButton = new JoyControlStickButtonPushButton(button, displayNames, parentWidget()); - pushbutton = upLeftButton; - connect(pushbutton, &JoyControlStickButtonPushButton::clicked, this, [this, pushbutton] { - openStickButtonDialog(pushbutton); - }); - - button->establishPropertyUpdatedConnections(); - connect(button, &JoyControlStickButton::slotsChanged, this, &StickPushButtonGroup::propogateSlotsChanged); - - addWidget(pushbutton, 0, 0); - - button = stickButtons->value(JoyControlStick::StickUp); - upButton = new JoyControlStickButtonPushButton(button, displayNames, parentWidget()); - pushbutton = upButton; - connect(pushbutton, &JoyControlStickButtonPushButton::clicked, this, [this, pushbutton] { - openStickButtonDialog(pushbutton); - }); - - button->establishPropertyUpdatedConnections(); - connect(button, &JoyControlStickButton::slotsChanged, this, &StickPushButtonGroup::propogateSlotsChanged); - - addWidget(pushbutton, 0, 1); - - button = stickButtons->value(JoyControlStick::StickRightUp); - upRightButton = new JoyControlStickButtonPushButton(button, displayNames, parentWidget()); - pushbutton = upRightButton; - connect(pushbutton, &JoyControlStickButtonPushButton::clicked, this, [this, pushbutton] { - openStickButtonDialog(pushbutton); - }); - - button->establishPropertyUpdatedConnections(); - connect(button, &JoyControlStickButton::slotsChanged, this, &StickPushButtonGroup::propogateSlotsChanged); - - addWidget(pushbutton, 0, 2); - - button = stickButtons->value(JoyControlStick::StickLeft); - leftButton = new JoyControlStickButtonPushButton(button, displayNames, parentWidget()); - pushbutton = leftButton; - connect(pushbutton, &JoyControlStickButtonPushButton::clicked, this, [this, pushbutton] { - openStickButtonDialog(pushbutton); - }); - - button->establishPropertyUpdatedConnections(); - connect(button, &JoyControlStickButton::slotsChanged, this, &StickPushButtonGroup::propogateSlotsChanged); - - addWidget(pushbutton, 1, 0); + upLeftButton = generateBtnToGrid(pushbutton, stick, JoyControlStick::StickLeftUp, 0, 0); + upButton = generateBtnToGrid(pushbutton, stick, JoyControlStick::StickUp, 0, 1); + upRightButton = generateBtnToGrid(pushbutton, stick, JoyControlStick::StickRightUp, 0, 2); + leftButton = generateBtnToGrid(pushbutton, stick, JoyControlStick::StickLeft, 1, 0); stickWidget = new JoyControlStickPushButton(stick, displayNames, parentWidget()); stickWidget->setIcon(QIcon::fromTheme(QString::fromUtf8("games-config-options"))); @@ -108,46 +63,17 @@ void StickPushButtonGroup::generateButtons() addWidget(stickWidget, 1, 1); - button = stickButtons->value(JoyControlStick::StickRight); - rightButton = new JoyControlStickButtonPushButton(button, displayNames, parentWidget()); - pushbutton = rightButton; - connect(pushbutton, &JoyControlStickButtonPushButton::clicked, this, [this, pushbutton] { - openStickButtonDialog(pushbutton); - }); - - button->establishPropertyUpdatedConnections(); - connect(button, &JoyControlStickButton::slotsChanged, this, &StickPushButtonGroup::propogateSlotsChanged); - - addWidget(pushbutton, 1, 2); - - button = stickButtons->value(JoyControlStick::StickLeftDown); - downLeftButton = new JoyControlStickButtonPushButton(button, displayNames, parentWidget()); - pushbutton = downLeftButton; - connect(pushbutton, &JoyControlStickButtonPushButton::clicked, this, [this, pushbutton] { - openStickButtonDialog(pushbutton); - }); - - button->establishPropertyUpdatedConnections(); - - connect(button, &JoyControlStickButton::slotsChanged, this, &StickPushButtonGroup::propogateSlotsChanged); - - addWidget(pushbutton, 2, 0); - - button = stickButtons->value(JoyControlStick::StickDown); - downButton = new JoyControlStickButtonPushButton(button, displayNames, parentWidget()); - pushbutton = downButton; - connect(pushbutton, &JoyControlStickButtonPushButton::clicked, this, [this, pushbutton] { - openStickButtonDialog(pushbutton); - }); - - button->establishPropertyUpdatedConnections(); - connect(button, &JoyControlStickButton::slotsChanged, this, &StickPushButtonGroup::propogateSlotsChanged); + rightButton = generateBtnToGrid(pushbutton, stick, JoyControlStick::StickRight, 1, 2); + downLeftButton = generateBtnToGrid(pushbutton, stick, JoyControlStick::StickLeftDown, 2, 0); + downButton = generateBtnToGrid(pushbutton, stick, JoyControlStick::StickDown, 2, 1); + downRightButton = generateBtnToGrid(pushbutton, stick, JoyControlStick::StickRightDown, 2, 2); +} - addWidget(pushbutton, 2, 1); +JoyControlStickButtonPushButton* StickPushButtonGroup::generateBtnToGrid(JoyControlStickButtonPushButton *pushbutton, JoyControlStick *stick, JoyStickDirectionsType::JoyStickDirections stickValue, int gridRow, int gridCol) +{ + JoyControlStickButton* button = stick->getButtons()->value(stickValue); + pushbutton = new JoyControlStickButtonPushButton(button, displayNames, parentWidget()); - button = stickButtons->value(JoyControlStick::StickRightDown); - downRightButton = new JoyControlStickButtonPushButton(button, displayNames, parentWidget()); - pushbutton = downRightButton; connect(pushbutton, &JoyControlStickButtonPushButton::clicked, this, [this, pushbutton] { openStickButtonDialog(pushbutton); }); @@ -155,7 +81,8 @@ void StickPushButtonGroup::generateButtons() button->establishPropertyUpdatedConnections(); connect(button, &JoyControlStickButton::slotsChanged, this, &StickPushButtonGroup::propogateSlotsChanged); - addWidget(pushbutton, 2, 2); + addWidget(pushbutton, gridRow, gridCol); + return pushbutton; } void StickPushButtonGroup::changeButtonLayout() diff --git a/src/stickpushbuttongroup.h b/src/stickpushbuttongroup.h old mode 100644 new mode 100755 index 4fed9547c..c4e275fc3 --- a/src/stickpushbuttongroup.h +++ b/src/stickpushbuttongroup.h @@ -18,8 +18,11 @@ #ifndef STICKPUSHBUTTONGROUP_H #define STICKPUSHBUTTONGROUP_H +#include "joycontrolstickdirectionstype.h" + #include + class JoyControlStick; class QWidget; class JoyControlStickButtonPushButton; @@ -77,6 +80,8 @@ private slots: JoyControlStickButtonPushButton *downRightButton; JoyControlStickPushButton *stickWidget; + + JoyControlStickButtonPushButton * generateBtnToGrid(JoyControlStickButtonPushButton *pushbutton, JoyControlStick *stick, JoyStickDirectionsType::JoyStickDirections stickValue, int gridRow, int gridCol); }; #endif // STICKPUSHBUTTONGROUP_H diff --git a/src/uihelpers/advancebuttondialoghelper.cpp b/src/uihelpers/advancebuttondialoghelper.cpp old mode 100644 new mode 100755 index db599b768..23632b395 --- a/src/uihelpers/advancebuttondialoghelper.cpp +++ b/src/uihelpers/advancebuttondialoghelper.cpp @@ -22,7 +22,6 @@ #include - AdvanceButtonDialogHelper::AdvanceButtonDialogHelper(JoyButton *button, QObject *parent) : QObject(parent) diff --git a/src/uihelpers/advancebuttondialoghelper.h b/src/uihelpers/advancebuttondialoghelper.h old mode 100644 new mode 100755 diff --git a/src/uihelpers/buttoneditdialoghelper.cpp b/src/uihelpers/buttoneditdialoghelper.cpp old mode 100644 new mode 100755 index e7bdba6c8..9d5493651 --- a/src/uihelpers/buttoneditdialoghelper.cpp +++ b/src/uihelpers/buttoneditdialoghelper.cpp @@ -21,7 +21,6 @@ #include "joybutton.h" #include -#include ButtonEditDialogHelper::ButtonEditDialogHelper(JoyButton *button, QObject *parent) : @@ -38,7 +37,6 @@ ButtonEditDialogHelper::ButtonEditDialogHelper(QObject *parent) : QObject(parent) { qInstallMessageHandler(MessageHandler::myMessageOutput); - } void ButtonEditDialogHelper::setAssignedSlot(int code, @@ -48,7 +46,6 @@ void ButtonEditDialogHelper::setAssignedSlot(int code, button->clearSlotsEventReset(false); button->setAssignedSlot(code, mode); - } void ButtonEditDialogHelper::setAssignedSlot(int code, int alias, @@ -58,7 +55,6 @@ void ButtonEditDialogHelper::setAssignedSlot(int code, int alias, button->clearSlotsEventReset(false); button->setAssignedSlot(code, alias, mode); - } void ButtonEditDialogHelper::setAssignedSlot(int code, int alias, int index, @@ -68,7 +64,6 @@ void ButtonEditDialogHelper::setAssignedSlot(int code, int alias, int index, button->clearSlotsEventReset(false); button->setAssignedSlot(code, alias, index, mode); - } void ButtonEditDialogHelper::setUseTurbo(bool useTurbo) diff --git a/src/uihelpers/buttoneditdialoghelper.h b/src/uihelpers/buttoneditdialoghelper.h old mode 100644 new mode 100755 index b02a2662a..6258e4756 --- a/src/uihelpers/buttoneditdialoghelper.h +++ b/src/uihelpers/buttoneditdialoghelper.h @@ -35,10 +35,8 @@ class ButtonEditDialogHelper : public QObject explicit ButtonEditDialogHelper(QObject *parent = nullptr); void setThisButton(JoyButton *btn); - protected: JoyButton *button; - bool firstStart; public slots: void setAssignedSlot(int code, diff --git a/src/uihelpers/dpadcontextmenuhelper.cpp b/src/uihelpers/dpadcontextmenuhelper.cpp old mode 100644 new mode 100755 index eac43e6d1..e95577562 --- a/src/uihelpers/dpadcontextmenuhelper.cpp +++ b/src/uihelpers/dpadcontextmenuhelper.cpp @@ -24,7 +24,6 @@ #include #include - DPadContextMenuHelper::DPadContextMenuHelper(JoyDPad *dpad, QObject *parent) : QObject(parent) { diff --git a/src/uihelpers/dpadcontextmenuhelper.h b/src/uihelpers/dpadcontextmenuhelper.h old mode 100644 new mode 100755 index 597cc8680..83821030e --- a/src/uihelpers/dpadcontextmenuhelper.h +++ b/src/uihelpers/dpadcontextmenuhelper.h @@ -30,6 +30,7 @@ class JoyButtonSlot; class DPadContextMenuHelper : public QObject { Q_OBJECT + public: explicit DPadContextMenuHelper(JoyDPad *dpad, QObject *parent = nullptr); void setPendingSlots(QHash *tempSlots); diff --git a/src/uihelpers/dpadeditdialoghelper.cpp b/src/uihelpers/dpadeditdialoghelper.cpp old mode 100644 new mode 100755 index 18fdfa992..95b425c6e --- a/src/uihelpers/dpadeditdialoghelper.cpp +++ b/src/uihelpers/dpadeditdialoghelper.cpp @@ -23,7 +23,6 @@ #include #include - DPadEditDialogHelper::DPadEditDialogHelper(JoyDPad *dpad, QObject *parent) : QObject(parent) { diff --git a/src/uihelpers/dpadeditdialoghelper.h b/src/uihelpers/dpadeditdialoghelper.h old mode 100644 new mode 100755 diff --git a/src/uihelpers/gamecontrollermappingdialoghelper.cpp b/src/uihelpers/gamecontrollermappingdialoghelper.cpp old mode 100644 new mode 100755 index bfbbcd259..3722391d5 --- a/src/uihelpers/gamecontrollermappingdialoghelper.cpp +++ b/src/uihelpers/gamecontrollermappingdialoghelper.cpp @@ -17,12 +17,12 @@ #include "gamecontrollermappingdialoghelper.h" +#include "globalvariables.h" #include "messagehandler.h" #include "inputdevice.h" #include - GameControllerMappingDialogHelper::GameControllerMappingDialogHelper(InputDevice *device, QObject *parent) : QObject(parent) @@ -37,7 +37,7 @@ void GameControllerMappingDialogHelper::raiseDeadZones() { qInstallMessageHandler(MessageHandler::myMessageOutput); - device->setRawAxisDeadZone(InputDevice::RAISEDDEADZONE); + device->setRawAxisDeadZone(GlobalVariables::InputDevice::RAISEDDEADZONE); device->getActiveSetJoystick()->raiseAxesDeadZones(); } @@ -59,7 +59,7 @@ void GameControllerMappingDialogHelper::setupDeadZones() device->getActiveSetJoystick()->currentAxesDeadZones(&originalAxesDeadZones); device->getActiveSetJoystick()->raiseAxesDeadZones(); - device->setRawAxisDeadZone(InputDevice::RAISEDDEADZONE); + device->setRawAxisDeadZone(GlobalVariables::InputDevice::RAISEDDEADZONE); } void GameControllerMappingDialogHelper::restoreDeviceDeadZones() @@ -70,5 +70,5 @@ void GameControllerMappingDialogHelper::restoreDeviceDeadZones() device->getActiveSetJoystick()->release(); device->getActiveSetJoystick()->setAxesDeadZones(&originalAxesDeadZones); - device->setRawAxisDeadZone(InputDevice::RAISEDDEADZONE); + device->setRawAxisDeadZone(GlobalVariables::InputDevice::RAISEDDEADZONE); } diff --git a/src/uihelpers/gamecontrollermappingdialoghelper.h b/src/uihelpers/gamecontrollermappingdialoghelper.h old mode 100644 new mode 100755 diff --git a/src/uihelpers/joyaxiscontextmenuhelper.cpp b/src/uihelpers/joyaxiscontextmenuhelper.cpp old mode 100644 new mode 100755 index 9a20a3278..778f74384 --- a/src/uihelpers/joyaxiscontextmenuhelper.cpp +++ b/src/uihelpers/joyaxiscontextmenuhelper.cpp @@ -22,7 +22,6 @@ #include - JoyAxisContextMenuHelper::JoyAxisContextMenuHelper(JoyAxis *axis, QObject *parent) : QObject(parent) { diff --git a/src/uihelpers/joyaxiscontextmenuhelper.h b/src/uihelpers/joyaxiscontextmenuhelper.h old mode 100644 new mode 100755 diff --git a/src/uihelpers/joycontrolstickcontextmenuhelper.cpp b/src/uihelpers/joycontrolstickcontextmenuhelper.cpp old mode 100644 new mode 100755 index faa2a0670..521d0a440 --- a/src/uihelpers/joycontrolstickcontextmenuhelper.cpp +++ b/src/uihelpers/joycontrolstickcontextmenuhelper.cpp @@ -24,7 +24,6 @@ #include #include - JoyControlStickContextMenuHelper::JoyControlStickContextMenuHelper(JoyControlStick *stick, QObject *parent) : QObject(parent) { diff --git a/src/uihelpers/joycontrolstickcontextmenuhelper.h b/src/uihelpers/joycontrolstickcontextmenuhelper.h old mode 100644 new mode 100755 diff --git a/src/uihelpers/joycontrolstickeditdialoghelper.cpp b/src/uihelpers/joycontrolstickeditdialoghelper.cpp old mode 100644 new mode 100755 index 6686b4212..51c37ac2a --- a/src/uihelpers/joycontrolstickeditdialoghelper.cpp +++ b/src/uihelpers/joycontrolstickeditdialoghelper.cpp @@ -23,7 +23,6 @@ #include - JoyControlStickEditDialogHelper::JoyControlStickEditDialogHelper(JoyControlStick *stick, QObject *parent) : QObject(parent) { diff --git a/src/uihelpers/joycontrolstickeditdialoghelper.h b/src/uihelpers/joycontrolstickeditdialoghelper.h old mode 100644 new mode 100755 diff --git a/src/uihelpers/joytabwidgethelper.cpp b/src/uihelpers/joytabwidgethelper.cpp old mode 100644 new mode 100755 index 9f4f5e866..de819db3e --- a/src/uihelpers/joytabwidgethelper.cpp +++ b/src/uihelpers/joytabwidgethelper.cpp @@ -26,7 +26,6 @@ #include - JoyTabWidgetHelper::JoyTabWidgetHelper(InputDevice *device, QObject *parent) : QObject(parent) { @@ -44,13 +43,13 @@ JoyTabWidgetHelper::~JoyTabWidgetHelper() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (this->reader) + if (this->reader != nullptr) { delete this->reader; this->reader = nullptr; } - if (this->writer) + if (this->writer != nullptr) { delete this->writer; this->writer = nullptr; @@ -112,7 +111,7 @@ bool JoyTabWidgetHelper::readConfigFile(QString filepath) } device->resetButtonDownCount(); - if (this->reader) + if (this->reader != nullptr) { this->reader->deleteLater(); this->reader = nullptr; @@ -144,7 +143,7 @@ bool JoyTabWidgetHelper::writeConfigFile(QString filepath) bool result = false; - if (this->writer) + if (this->writer != nullptr) { this->writer->deleteLater(); this->writer = nullptr; diff --git a/src/uihelpers/joytabwidgethelper.h b/src/uihelpers/joytabwidgethelper.h old mode 100644 new mode 100755 diff --git a/src/uinputhelper.cpp b/src/uinputhelper.cpp old mode 100644 new mode 100755 index b3ee5533c..d3f69002b --- a/src/uinputhelper.cpp +++ b/src/uinputhelper.cpp @@ -22,9 +22,10 @@ #include "uinputhelper.h" #include "messagehandler.h" -UInputHelper* UInputHelper::_instance = nullptr; +UInputHelper* UInputHelper::_instance = nullptr; + UInputHelper::UInputHelper(QObject *parent) : QObject(parent) { @@ -40,248 +41,252 @@ UInputHelper::~UInputHelper() void UInputHelper::populateKnownAliases() { if (getKnownAliasesX11SymVK().isEmpty()) - { - knownAliasesX11SymVK.insert("a", KEY_A); - knownAliasesX11SymVK.insert("b", KEY_B); - knownAliasesX11SymVK.insert("c", KEY_C); - knownAliasesX11SymVK.insert("d", KEY_D); - knownAliasesX11SymVK.insert("e", KEY_E); - knownAliasesX11SymVK.insert("f", KEY_F); - knownAliasesX11SymVK.insert("g", KEY_G); - knownAliasesX11SymVK.insert("h", KEY_H); - knownAliasesX11SymVK.insert("i", KEY_I); - knownAliasesX11SymVK.insert("j", KEY_J); - knownAliasesX11SymVK.insert("k", KEY_K); - knownAliasesX11SymVK.insert("l", KEY_L); - knownAliasesX11SymVK.insert("m", KEY_M); - knownAliasesX11SymVK.insert("n", KEY_N); - knownAliasesX11SymVK.insert("o", KEY_O); - knownAliasesX11SymVK.insert("p", KEY_P); - knownAliasesX11SymVK.insert("q", KEY_Q); - knownAliasesX11SymVK.insert("r", KEY_R); - knownAliasesX11SymVK.insert("s", KEY_S); - knownAliasesX11SymVK.insert("t", KEY_T); - knownAliasesX11SymVK.insert("u", KEY_U); - knownAliasesX11SymVK.insert("v", KEY_V); - knownAliasesX11SymVK.insert("w", KEY_W); - knownAliasesX11SymVK.insert("x", KEY_X); - knownAliasesX11SymVK.insert("y", KEY_Y); - knownAliasesX11SymVK.insert("z", KEY_Z); - - knownAliasesX11SymVK.insert("Escape", KEY_ESC); - knownAliasesX11SymVK.insert("F1", KEY_F1); - knownAliasesX11SymVK.insert("F2", KEY_F2); - knownAliasesX11SymVK.insert("F3", KEY_F3); - knownAliasesX11SymVK.insert("F4", KEY_F4); - knownAliasesX11SymVK.insert("F5", KEY_F5); - knownAliasesX11SymVK.insert("F6", KEY_F6); - knownAliasesX11SymVK.insert("F7", KEY_F7); - knownAliasesX11SymVK.insert("F8", KEY_F8); - knownAliasesX11SymVK.insert("F9", KEY_F9); - knownAliasesX11SymVK.insert("F10", KEY_F10); - knownAliasesX11SymVK.insert("F11", KEY_F11); - knownAliasesX11SymVK.insert("F12", KEY_F12); - - knownAliasesX11SymVK.insert("grave", KEY_GRAVE); - knownAliasesX11SymVK.insert("1", KEY_1); - knownAliasesX11SymVK.insert("2", KEY_2); - knownAliasesX11SymVK.insert("3", KEY_3); - knownAliasesX11SymVK.insert("4", KEY_4); - knownAliasesX11SymVK.insert("5", KEY_5); - knownAliasesX11SymVK.insert("6", KEY_6); - knownAliasesX11SymVK.insert("7", KEY_7); - knownAliasesX11SymVK.insert("8", KEY_8); - knownAliasesX11SymVK.insert("9", KEY_9); - knownAliasesX11SymVK.insert("0", KEY_0); - knownAliasesX11SymVK.insert("minus", KEY_MINUS); - knownAliasesX11SymVK.insert("equal", KEY_EQUAL); - knownAliasesX11SymVK.insert("BackSpace", KEY_BACKSPACE); - knownAliasesX11SymVK.insert("Tab", KEY_TAB); - knownAliasesX11SymVK.insert("bracketleft", KEY_LEFTBRACE); - knownAliasesX11SymVK.insert("bracketright", KEY_RIGHTBRACE); - knownAliasesX11SymVK.insert("backslash", KEY_BACKSLASH); - knownAliasesX11SymVK.insert("Caps_Lock", KEY_CAPSLOCK); - knownAliasesX11SymVK.insert("semicolon", KEY_SEMICOLON); - knownAliasesX11SymVK.insert("apostrophe", KEY_APOSTROPHE); - knownAliasesX11SymVK.insert("Return", KEY_ENTER); - knownAliasesX11SymVK.insert("Shift_L", KEY_LEFTSHIFT); - knownAliasesX11SymVK.insert("comma", KEY_COMMA); - knownAliasesX11SymVK.insert("period", KEY_DOT); - knownAliasesX11SymVK.insert("slash", KEY_SLASH); - knownAliasesX11SymVK.insert("Control_L", KEY_LEFTCTRL); - knownAliasesX11SymVK.insert("Super_L", KEY_MENU); - knownAliasesX11SymVK.insert("Alt_L", KEY_LEFTALT); - knownAliasesX11SymVK.insert("space", KEY_SPACE); - knownAliasesX11SymVK.insert("Alt_R", KEY_RIGHTALT); - knownAliasesX11SymVK.insert("Menu", KEY_COMPOSE); - knownAliasesX11SymVK.insert("Control_R", KEY_RIGHTCTRL); - knownAliasesX11SymVK.insert("Shift_R", KEY_RIGHTSHIFT); - - knownAliasesX11SymVK.insert("Up", KEY_UP); - knownAliasesX11SymVK.insert("Left", KEY_LEFT); - knownAliasesX11SymVK.insert("Down", KEY_DOWN); - knownAliasesX11SymVK.insert("Right", KEY_RIGHT); - knownAliasesX11SymVK.insert("Print", KEY_PRINT); - knownAliasesX11SymVK.insert("Insert", KEY_INSERT); - knownAliasesX11SymVK.insert("Delete", KEY_DELETE); - knownAliasesX11SymVK.insert("Home", KEY_HOME); - knownAliasesX11SymVK.insert("End", KEY_END); - knownAliasesX11SymVK.insert("Prior", KEY_PAGEUP); - knownAliasesX11SymVK.insert("Next", KEY_PAGEDOWN); - - knownAliasesX11SymVK.insert("Num_Lock", KEY_NUMLOCK); - knownAliasesX11SymVK.insert("KP_Divide", KEY_KPSLASH); - knownAliasesX11SymVK.insert("KP_Multiply", KEY_KPASTERISK); - knownAliasesX11SymVK.insert("KP_Subtract", KEY_KPMINUS); - knownAliasesX11SymVK.insert("KP_Add", KEY_KPPLUS); - knownAliasesX11SymVK.insert("KP_Enter", KEY_KPENTER); - - knownAliasesX11SymVK.insert("KP_1", KEY_KP1); - knownAliasesX11SymVK.insert("KP_2", KEY_KP2); - knownAliasesX11SymVK.insert("KP_3", KEY_KP3); - knownAliasesX11SymVK.insert("KP_4", KEY_KP4); - knownAliasesX11SymVK.insert("KP_5", KEY_KP5); - knownAliasesX11SymVK.insert("KP_6", KEY_KP6); - knownAliasesX11SymVK.insert("KP_7", KEY_KP7); - knownAliasesX11SymVK.insert("KP_8", KEY_KP8); - knownAliasesX11SymVK.insert("KP_9", KEY_KP9); - knownAliasesX11SymVK.insert("KP_0", KEY_KP0); - knownAliasesX11SymVK.insert("KP_Decimal", KEY_KPDOT); - - knownAliasesX11SymVK.insert("Scroll_Lock", KEY_SCROLLLOCK); - knownAliasesX11SymVK.insert("Pause", KEY_PAUSE); - knownAliasesX11SymVK.insert("Multi_key", KEY_RIGHTALT); - } + populateX11SymVk(knownAliasesX11SymVK); if (getKnownAliasesVKStrings().isEmpty()) - { - knownAliasesVKStrings.insert(KEY_A, tr("a")); - knownAliasesVKStrings.insert(KEY_B, tr("b")); - knownAliasesVKStrings.insert(KEY_C, tr("c")); - knownAliasesVKStrings.insert(KEY_D, tr("d")); - knownAliasesVKStrings.insert(KEY_E, tr("e")); - knownAliasesVKStrings.insert(KEY_F, tr("f")); - knownAliasesVKStrings.insert(KEY_G, tr("g")); - knownAliasesVKStrings.insert(KEY_H, tr("h")); - knownAliasesVKStrings.insert(KEY_I, tr("i")); - knownAliasesVKStrings.insert(KEY_J, tr("j")); - knownAliasesVKStrings.insert(KEY_K, tr("k")); - knownAliasesVKStrings.insert(KEY_L, tr("l")); - knownAliasesVKStrings.insert(KEY_M, tr("m")); - knownAliasesVKStrings.insert(KEY_N, tr("n")); - knownAliasesVKStrings.insert(KEY_O, tr("o")); - knownAliasesVKStrings.insert(KEY_P, tr("p")); - knownAliasesVKStrings.insert(KEY_Q, tr("q")); - knownAliasesVKStrings.insert(KEY_R, tr("r")); - knownAliasesVKStrings.insert(KEY_S, tr("s")); - knownAliasesVKStrings.insert(KEY_T, tr("t")); - knownAliasesVKStrings.insert(KEY_U, tr("u")); - knownAliasesVKStrings.insert(KEY_V, tr("v")); - knownAliasesVKStrings.insert(KEY_W, tr("w")); - knownAliasesVKStrings.insert(KEY_X, tr("x")); - knownAliasesVKStrings.insert(KEY_Y, tr("y")); - knownAliasesVKStrings.insert(KEY_Z, tr("z")); - - knownAliasesVKStrings.insert(KEY_ESC, tr("Esc")); - knownAliasesVKStrings.insert(KEY_F1, tr("F1")); - knownAliasesVKStrings.insert(KEY_F2, tr("F2")); - knownAliasesVKStrings.insert(KEY_F3, tr("F3")); - knownAliasesVKStrings.insert(KEY_F4, tr("F4")); - knownAliasesVKStrings.insert(KEY_F5, tr("F5")); - knownAliasesVKStrings.insert(KEY_F6, tr("F6")); - knownAliasesVKStrings.insert(KEY_F7, tr("F7")); - knownAliasesVKStrings.insert(KEY_F8, tr("F8")); - knownAliasesVKStrings.insert(KEY_F9, tr("F9")); - knownAliasesVKStrings.insert(KEY_F10, tr("F10")); - knownAliasesVKStrings.insert(KEY_F11, tr("F11")); - knownAliasesVKStrings.insert(KEY_F12, tr("F12")); - - knownAliasesVKStrings.insert(KEY_GRAVE, tr("`")); - knownAliasesVKStrings.insert(KEY_1, tr("1")); - knownAliasesVKStrings.insert(KEY_2, tr("2")); - knownAliasesVKStrings.insert(KEY_3, tr("3")); - knownAliasesVKStrings.insert(KEY_4, tr("4")); - knownAliasesVKStrings.insert(KEY_5, tr("5")); - knownAliasesVKStrings.insert(KEY_6, tr("6")); - knownAliasesVKStrings.insert(KEY_7, tr("7")); - knownAliasesVKStrings.insert(KEY_8, tr("8")); - knownAliasesVKStrings.insert(KEY_9, tr("9")); - knownAliasesVKStrings.insert(KEY_0, tr("0")); - knownAliasesVKStrings.insert(KEY_MINUS, tr("-")); - knownAliasesVKStrings.insert(KEY_EQUAL, tr("=")); - knownAliasesVKStrings.insert(KEY_BACKSPACE, tr("BackSpace")); - knownAliasesVKStrings.insert(KEY_TAB, tr("Tab")); - knownAliasesVKStrings.insert(KEY_LEFTBRACE, tr("[")); - knownAliasesVKStrings.insert(KEY_RIGHTBRACE, tr("]")); - knownAliasesVKStrings.insert(KEY_BACKSLASH, tr("\\")); - knownAliasesVKStrings.insert(KEY_CAPSLOCK, tr("CapsLock")); - knownAliasesVKStrings.insert(KEY_SEMICOLON, tr(";")); - knownAliasesVKStrings.insert(KEY_APOSTROPHE, tr("'")); - knownAliasesVKStrings.insert(KEY_ENTER, tr("Enter")); - knownAliasesVKStrings.insert(KEY_LEFTSHIFT, tr("Shift_L")); - knownAliasesVKStrings.insert(KEY_COMMA, tr(",")); - knownAliasesVKStrings.insert(KEY_DOT, tr(".")); - knownAliasesVKStrings.insert(KEY_SLASH, tr("/")); - knownAliasesVKStrings.insert(KEY_LEFTCTRL, tr("Ctrl_L")); - knownAliasesVKStrings.insert(KEY_MENU, tr("Super_L")); - knownAliasesVKStrings.insert(KEY_LEFTALT, tr("Alt_L")); - knownAliasesVKStrings.insert(KEY_SPACE, tr("Space")); - knownAliasesVKStrings.insert(KEY_RIGHTALT, tr("Alt_R")); - knownAliasesVKStrings.insert(KEY_COMPOSE, tr("Menu")); - knownAliasesVKStrings.insert(KEY_RIGHTCTRL, tr("Ctrl_R")); - knownAliasesVKStrings.insert(KEY_RIGHTSHIFT, tr("Shift_R")); - - knownAliasesVKStrings.insert(KEY_UP, tr("Up")); - knownAliasesVKStrings.insert(KEY_LEFT, tr("Left")); - knownAliasesVKStrings.insert(KEY_DOWN, tr("Down")); - knownAliasesVKStrings.insert(KEY_RIGHT, tr("Right")); - knownAliasesVKStrings.insert(KEY_PRINT, tr("PrtSc")); - knownAliasesVKStrings.insert(KEY_INSERT, tr("Ins")); - knownAliasesVKStrings.insert(KEY_DELETE, tr("Del")); - knownAliasesVKStrings.insert(KEY_HOME, tr("Home")); - knownAliasesVKStrings.insert(KEY_END, tr("End")); - knownAliasesVKStrings.insert(KEY_PAGEUP, tr("PgUp")); - knownAliasesVKStrings.insert(KEY_PAGEDOWN, tr("PgDn")); - - knownAliasesVKStrings.insert(KEY_NUMLOCK, tr("NumLock")); - knownAliasesVKStrings.insert(KEY_KPSLASH, tr("/")); - knownAliasesVKStrings.insert(KEY_KPASTERISK, tr("*")); - knownAliasesVKStrings.insert(KEY_KPMINUS, tr("-")); - knownAliasesVKStrings.insert(KEY_KPPLUS, tr("+")); - knownAliasesVKStrings.insert(KEY_KPENTER, tr("KP_Enter")); - - knownAliasesVKStrings.insert(KEY_KP1, tr("KP_1")); - knownAliasesVKStrings.insert(KEY_KP2, tr("KP_2")); - knownAliasesVKStrings.insert(KEY_KP3, tr("KP_3")); - knownAliasesVKStrings.insert(KEY_KP4, tr("KP_4")); - knownAliasesVKStrings.insert(KEY_KP5, tr("KP_5")); - knownAliasesVKStrings.insert(KEY_KP6, tr("KP_6")); - knownAliasesVKStrings.insert(KEY_KP7, tr("KP_7")); - knownAliasesVKStrings.insert(KEY_KP8, tr("KP_8")); - knownAliasesVKStrings.insert(KEY_KP9, tr("KP_9")); - knownAliasesVKStrings.insert(KEY_KP0, tr("KP_0")); - - knownAliasesVKStrings.insert(KEY_SCROLLLOCK, tr("SCLK")); - knownAliasesVKStrings.insert(KEY_PAUSE, tr("Pause")); - knownAliasesVKStrings.insert(KEY_KPDOT, tr(".")); - knownAliasesVKStrings.insert(KEY_LEFTMETA, tr("Super_L")); - knownAliasesVKStrings.insert(KEY_RIGHTMETA, tr("Super_R")); - knownAliasesVKStrings.insert(KEY_MUTE, tr("Mute")); - knownAliasesVKStrings.insert(KEY_VOLUMEDOWN, tr("VolDn")); - knownAliasesVKStrings.insert(KEY_VOLUMEUP, tr("VolUp")); - knownAliasesVKStrings.insert(KEY_PLAYPAUSE, tr("Play")); - knownAliasesVKStrings.insert(KEY_STOPCD, tr("Stop")); - knownAliasesVKStrings.insert(KEY_PREVIOUSSONG, tr("Prev")); - knownAliasesVKStrings.insert(KEY_NEXTSONG, tr("Next")); - } + populateXVkStrings(knownAliasesVKStrings); +} + +void UInputHelper::populateX11SymVk(QHash& knownAliasesX11SymVK) +{ + knownAliasesX11SymVK.insert("a", KEY_A); + knownAliasesX11SymVK.insert("b", KEY_B); + knownAliasesX11SymVK.insert("c", KEY_C); + knownAliasesX11SymVK.insert("d", KEY_D); + knownAliasesX11SymVK.insert("e", KEY_E); + knownAliasesX11SymVK.insert("f", KEY_F); + knownAliasesX11SymVK.insert("g", KEY_G); + knownAliasesX11SymVK.insert("h", KEY_H); + knownAliasesX11SymVK.insert("i", KEY_I); + knownAliasesX11SymVK.insert("j", KEY_J); + knownAliasesX11SymVK.insert("k", KEY_K); + knownAliasesX11SymVK.insert("l", KEY_L); + knownAliasesX11SymVK.insert("m", KEY_M); + knownAliasesX11SymVK.insert("n", KEY_N); + knownAliasesX11SymVK.insert("o", KEY_O); + knownAliasesX11SymVK.insert("p", KEY_P); + knownAliasesX11SymVK.insert("q", KEY_Q); + knownAliasesX11SymVK.insert("r", KEY_R); + knownAliasesX11SymVK.insert("s", KEY_S); + knownAliasesX11SymVK.insert("t", KEY_T); + knownAliasesX11SymVK.insert("u", KEY_U); + knownAliasesX11SymVK.insert("v", KEY_V); + knownAliasesX11SymVK.insert("w", KEY_W); + knownAliasesX11SymVK.insert("x", KEY_X); + knownAliasesX11SymVK.insert("y", KEY_Y); + knownAliasesX11SymVK.insert("z", KEY_Z); + + knownAliasesX11SymVK.insert("Escape", KEY_ESC); + knownAliasesX11SymVK.insert("F1", KEY_F1); + knownAliasesX11SymVK.insert("F2", KEY_F2); + knownAliasesX11SymVK.insert("F3", KEY_F3); + knownAliasesX11SymVK.insert("F4", KEY_F4); + knownAliasesX11SymVK.insert("F5", KEY_F5); + knownAliasesX11SymVK.insert("F6", KEY_F6); + knownAliasesX11SymVK.insert("F7", KEY_F7); + knownAliasesX11SymVK.insert("F8", KEY_F8); + knownAliasesX11SymVK.insert("F9", KEY_F9); + knownAliasesX11SymVK.insert("F10", KEY_F10); + knownAliasesX11SymVK.insert("F11", KEY_F11); + knownAliasesX11SymVK.insert("F12", KEY_F12); + + knownAliasesX11SymVK.insert("grave", KEY_GRAVE); + knownAliasesX11SymVK.insert("1", KEY_1); + knownAliasesX11SymVK.insert("2", KEY_2); + knownAliasesX11SymVK.insert("3", KEY_3); + knownAliasesX11SymVK.insert("4", KEY_4); + knownAliasesX11SymVK.insert("5", KEY_5); + knownAliasesX11SymVK.insert("6", KEY_6); + knownAliasesX11SymVK.insert("7", KEY_7); + knownAliasesX11SymVK.insert("8", KEY_8); + knownAliasesX11SymVK.insert("9", KEY_9); + knownAliasesX11SymVK.insert("0", KEY_0); + knownAliasesX11SymVK.insert("minus", KEY_MINUS); + knownAliasesX11SymVK.insert("equal", KEY_EQUAL); + knownAliasesX11SymVK.insert("BackSpace", KEY_BACKSPACE); + knownAliasesX11SymVK.insert("Tab", KEY_TAB); + knownAliasesX11SymVK.insert("bracketleft", KEY_LEFTBRACE); + knownAliasesX11SymVK.insert("bracketright", KEY_RIGHTBRACE); + knownAliasesX11SymVK.insert("backslash", KEY_BACKSLASH); + knownAliasesX11SymVK.insert("Caps_Lock", KEY_CAPSLOCK); + knownAliasesX11SymVK.insert("semicolon", KEY_SEMICOLON); + knownAliasesX11SymVK.insert("apostrophe", KEY_APOSTROPHE); + knownAliasesX11SymVK.insert("Return", KEY_ENTER); + knownAliasesX11SymVK.insert("Shift_L", KEY_LEFTSHIFT); + knownAliasesX11SymVK.insert("comma", KEY_COMMA); + knownAliasesX11SymVK.insert("period", KEY_DOT); + knownAliasesX11SymVK.insert("slash", KEY_SLASH); + knownAliasesX11SymVK.insert("Control_L", KEY_LEFTCTRL); + knownAliasesX11SymVK.insert("Super_L", KEY_MENU); + knownAliasesX11SymVK.insert("Alt_L", KEY_LEFTALT); + knownAliasesX11SymVK.insert("space", KEY_SPACE); + knownAliasesX11SymVK.insert("Alt_R", KEY_RIGHTALT); + knownAliasesX11SymVK.insert("Menu", KEY_COMPOSE); + knownAliasesX11SymVK.insert("Control_R", KEY_RIGHTCTRL); + knownAliasesX11SymVK.insert("Shift_R", KEY_RIGHTSHIFT); + + knownAliasesX11SymVK.insert("Up", KEY_UP); + knownAliasesX11SymVK.insert("Left", KEY_LEFT); + knownAliasesX11SymVK.insert("Down", KEY_DOWN); + knownAliasesX11SymVK.insert("Right", KEY_RIGHT); + knownAliasesX11SymVK.insert("Print", KEY_PRINT); + knownAliasesX11SymVK.insert("Insert", KEY_INSERT); + knownAliasesX11SymVK.insert("Delete", KEY_DELETE); + knownAliasesX11SymVK.insert("Home", KEY_HOME); + knownAliasesX11SymVK.insert("End", KEY_END); + knownAliasesX11SymVK.insert("Prior", KEY_PAGEUP); + knownAliasesX11SymVK.insert("Next", KEY_PAGEDOWN); + + knownAliasesX11SymVK.insert("Num_Lock", KEY_NUMLOCK); + knownAliasesX11SymVK.insert("KP_Divide", KEY_KPSLASH); + knownAliasesX11SymVK.insert("KP_Multiply", KEY_KPASTERISK); + knownAliasesX11SymVK.insert("KP_Subtract", KEY_KPMINUS); + knownAliasesX11SymVK.insert("KP_Add", KEY_KPPLUS); + knownAliasesX11SymVK.insert("KP_Enter", KEY_KPENTER); + + knownAliasesX11SymVK.insert("KP_1", KEY_KP1); + knownAliasesX11SymVK.insert("KP_2", KEY_KP2); + knownAliasesX11SymVK.insert("KP_3", KEY_KP3); + knownAliasesX11SymVK.insert("KP_4", KEY_KP4); + knownAliasesX11SymVK.insert("KP_5", KEY_KP5); + knownAliasesX11SymVK.insert("KP_6", KEY_KP6); + knownAliasesX11SymVK.insert("KP_7", KEY_KP7); + knownAliasesX11SymVK.insert("KP_8", KEY_KP8); + knownAliasesX11SymVK.insert("KP_9", KEY_KP9); + knownAliasesX11SymVK.insert("KP_0", KEY_KP0); + knownAliasesX11SymVK.insert("KP_Decimal", KEY_KPDOT); + + knownAliasesX11SymVK.insert("Scroll_Lock", KEY_SCROLLLOCK); + knownAliasesX11SymVK.insert("Pause", KEY_PAUSE); + knownAliasesX11SymVK.insert("Multi_key", KEY_RIGHTALT); +} + +void UInputHelper::populateXVkStrings(QHash& knownAliasesVKStrings) +{ + knownAliasesVKStrings.insert(KEY_A, tr("a")); + knownAliasesVKStrings.insert(KEY_B, tr("b")); + knownAliasesVKStrings.insert(KEY_C, tr("c")); + knownAliasesVKStrings.insert(KEY_D, tr("d")); + knownAliasesVKStrings.insert(KEY_E, tr("e")); + knownAliasesVKStrings.insert(KEY_F, tr("f")); + knownAliasesVKStrings.insert(KEY_G, tr("g")); + knownAliasesVKStrings.insert(KEY_H, tr("h")); + knownAliasesVKStrings.insert(KEY_I, tr("i")); + knownAliasesVKStrings.insert(KEY_J, tr("j")); + knownAliasesVKStrings.insert(KEY_K, tr("k")); + knownAliasesVKStrings.insert(KEY_L, tr("l")); + knownAliasesVKStrings.insert(KEY_M, tr("m")); + knownAliasesVKStrings.insert(KEY_N, tr("n")); + knownAliasesVKStrings.insert(KEY_O, tr("o")); + knownAliasesVKStrings.insert(KEY_P, tr("p")); + knownAliasesVKStrings.insert(KEY_Q, tr("q")); + knownAliasesVKStrings.insert(KEY_R, tr("r")); + knownAliasesVKStrings.insert(KEY_S, tr("s")); + knownAliasesVKStrings.insert(KEY_T, tr("t")); + knownAliasesVKStrings.insert(KEY_U, tr("u")); + knownAliasesVKStrings.insert(KEY_V, tr("v")); + knownAliasesVKStrings.insert(KEY_W, tr("w")); + knownAliasesVKStrings.insert(KEY_X, tr("x")); + knownAliasesVKStrings.insert(KEY_Y, tr("y")); + knownAliasesVKStrings.insert(KEY_Z, tr("z")); + + knownAliasesVKStrings.insert(KEY_ESC, tr("Esc")); + knownAliasesVKStrings.insert(KEY_F1, tr("F1")); + knownAliasesVKStrings.insert(KEY_F2, tr("F2")); + knownAliasesVKStrings.insert(KEY_F3, tr("F3")); + knownAliasesVKStrings.insert(KEY_F4, tr("F4")); + knownAliasesVKStrings.insert(KEY_F5, tr("F5")); + knownAliasesVKStrings.insert(KEY_F6, tr("F6")); + knownAliasesVKStrings.insert(KEY_F7, tr("F7")); + knownAliasesVKStrings.insert(KEY_F8, tr("F8")); + knownAliasesVKStrings.insert(KEY_F9, tr("F9")); + knownAliasesVKStrings.insert(KEY_F10, tr("F10")); + knownAliasesVKStrings.insert(KEY_F11, tr("F11")); + knownAliasesVKStrings.insert(KEY_F12, tr("F12")); + + knownAliasesVKStrings.insert(KEY_GRAVE, tr("`")); + knownAliasesVKStrings.insert(KEY_1, tr("1")); + knownAliasesVKStrings.insert(KEY_2, tr("2")); + knownAliasesVKStrings.insert(KEY_3, tr("3")); + knownAliasesVKStrings.insert(KEY_4, tr("4")); + knownAliasesVKStrings.insert(KEY_5, tr("5")); + knownAliasesVKStrings.insert(KEY_6, tr("6")); + knownAliasesVKStrings.insert(KEY_7, tr("7")); + knownAliasesVKStrings.insert(KEY_8, tr("8")); + knownAliasesVKStrings.insert(KEY_9, tr("9")); + knownAliasesVKStrings.insert(KEY_0, tr("0")); + knownAliasesVKStrings.insert(KEY_MINUS, tr("-")); + knownAliasesVKStrings.insert(KEY_EQUAL, tr("=")); + knownAliasesVKStrings.insert(KEY_BACKSPACE, tr("BackSpace")); + knownAliasesVKStrings.insert(KEY_TAB, tr("Tab")); + knownAliasesVKStrings.insert(KEY_LEFTBRACE, tr("[")); + knownAliasesVKStrings.insert(KEY_RIGHTBRACE, tr("]")); + knownAliasesVKStrings.insert(KEY_BACKSLASH, tr("\\")); + knownAliasesVKStrings.insert(KEY_CAPSLOCK, tr("CapsLock")); + knownAliasesVKStrings.insert(KEY_SEMICOLON, tr(";")); + knownAliasesVKStrings.insert(KEY_APOSTROPHE, tr("'")); + knownAliasesVKStrings.insert(KEY_ENTER, tr("Enter")); + knownAliasesVKStrings.insert(KEY_LEFTSHIFT, tr("Shift_L")); + knownAliasesVKStrings.insert(KEY_COMMA, tr(",")); + knownAliasesVKStrings.insert(KEY_DOT, tr(".")); + knownAliasesVKStrings.insert(KEY_SLASH, tr("/")); + knownAliasesVKStrings.insert(KEY_LEFTCTRL, tr("Ctrl_L")); + knownAliasesVKStrings.insert(KEY_MENU, tr("Super_L")); + knownAliasesVKStrings.insert(KEY_LEFTALT, tr("Alt_L")); + knownAliasesVKStrings.insert(KEY_SPACE, tr("Space")); + knownAliasesVKStrings.insert(KEY_RIGHTALT, tr("Alt_R")); + knownAliasesVKStrings.insert(KEY_COMPOSE, tr("Menu")); + knownAliasesVKStrings.insert(KEY_RIGHTCTRL, tr("Ctrl_R")); + knownAliasesVKStrings.insert(KEY_RIGHTSHIFT, tr("Shift_R")); + + knownAliasesVKStrings.insert(KEY_UP, tr("Up")); + knownAliasesVKStrings.insert(KEY_LEFT, tr("Left")); + knownAliasesVKStrings.insert(KEY_DOWN, tr("Down")); + knownAliasesVKStrings.insert(KEY_RIGHT, tr("Right")); + knownAliasesVKStrings.insert(KEY_PRINT, tr("PrtSc")); + knownAliasesVKStrings.insert(KEY_INSERT, tr("Ins")); + knownAliasesVKStrings.insert(KEY_DELETE, tr("Del")); + knownAliasesVKStrings.insert(KEY_HOME, tr("Home")); + knownAliasesVKStrings.insert(KEY_END, tr("End")); + knownAliasesVKStrings.insert(KEY_PAGEUP, tr("PgUp")); + knownAliasesVKStrings.insert(KEY_PAGEDOWN, tr("PgDn")); + + knownAliasesVKStrings.insert(KEY_NUMLOCK, tr("NumLock")); + knownAliasesVKStrings.insert(KEY_KPSLASH, tr("/")); + knownAliasesVKStrings.insert(KEY_KPASTERISK, tr("*")); + knownAliasesVKStrings.insert(KEY_KPMINUS, tr("-")); + knownAliasesVKStrings.insert(KEY_KPPLUS, tr("+")); + knownAliasesVKStrings.insert(KEY_KPENTER, tr("KP_Enter")); + + knownAliasesVKStrings.insert(KEY_KP1, tr("KP_1")); + knownAliasesVKStrings.insert(KEY_KP2, tr("KP_2")); + knownAliasesVKStrings.insert(KEY_KP3, tr("KP_3")); + knownAliasesVKStrings.insert(KEY_KP4, tr("KP_4")); + knownAliasesVKStrings.insert(KEY_KP5, tr("KP_5")); + knownAliasesVKStrings.insert(KEY_KP6, tr("KP_6")); + knownAliasesVKStrings.insert(KEY_KP7, tr("KP_7")); + knownAliasesVKStrings.insert(KEY_KP8, tr("KP_8")); + knownAliasesVKStrings.insert(KEY_KP9, tr("KP_9")); + knownAliasesVKStrings.insert(KEY_KP0, tr("KP_0")); + + knownAliasesVKStrings.insert(KEY_SCROLLLOCK, tr("SCLK")); + knownAliasesVKStrings.insert(KEY_PAUSE, tr("Pause")); + knownAliasesVKStrings.insert(KEY_KPDOT, tr(".")); + knownAliasesVKStrings.insert(KEY_LEFTMETA, tr("Super_L")); + knownAliasesVKStrings.insert(KEY_RIGHTMETA, tr("Super_R")); + knownAliasesVKStrings.insert(KEY_MUTE, tr("Mute")); + knownAliasesVKStrings.insert(KEY_VOLUMEDOWN, tr("VolDn")); + knownAliasesVKStrings.insert(KEY_VOLUMEUP, tr("VolUp")); + knownAliasesVKStrings.insert(KEY_PLAYPAUSE, tr("Play")); + knownAliasesVKStrings.insert(KEY_STOPCD, tr("Stop")); + knownAliasesVKStrings.insert(KEY_PREVIOUSSONG, tr("Prev")); + knownAliasesVKStrings.insert(KEY_NEXTSONG, tr("Next")); } UInputHelper* UInputHelper::getInstance() { - if (_instance == nullptr) - { + if (!_instance) _instance = new UInputHelper(); - } return _instance; } @@ -297,15 +302,10 @@ void UInputHelper::deleteInstance() QString UInputHelper::getDisplayString(int virtualkey) { - QString temp; - if (virtualkey <= 0) - { - temp = tr("[NO KEY]"); - } - else if (getKnownAliasesVKStrings().contains(virtualkey)) - { - temp = getKnownAliasesVKStrings().value(virtualkey); - } + QString temp = QString(); + + if (virtualkey <= 0) temp = tr("[NO KEY]"); + else if (getKnownAliasesVKStrings().contains(virtualkey)) temp = getKnownAliasesVKStrings().value(virtualkey); return temp; } @@ -313,10 +313,9 @@ QString UInputHelper::getDisplayString(int virtualkey) int UInputHelper::getVirtualKey(QString codestring) { int temp = 0; + if (getKnownAliasesX11SymVK().contains(codestring)) - { temp = getKnownAliasesX11SymVK().value(codestring); - } return temp; } diff --git a/src/uinputhelper.h b/src/uinputhelper.h old mode 100644 new mode 100755 index d2a06d1ec..08537f375 --- a/src/uinputhelper.h +++ b/src/uinputhelper.h @@ -45,6 +45,10 @@ class UInputHelper : public QObject QHash knownAliasesX11SymVK; // <.., unsigned> QHash knownAliasesVKStrings; // +private: + void populateXVkStrings(QHash& knownAliasesVKStrings); + void populateX11SymVk(QHash& knownAliasesX11SymVK); + }; #endif // UINPUTHELPER_H diff --git a/src/unixcapturewindowutility.cpp b/src/unixcapturewindowutility.cpp old mode 100644 new mode 100755 index 659dfb16d..16bd35c9d --- a/src/unixcapturewindowutility.cpp +++ b/src/unixcapturewindowutility.cpp @@ -60,8 +60,8 @@ void UnixCaptureWindowUtility::attemptWindowCapture() Window target_window = None; int status = 0; Display *display = nullptr; - QString potentialXDisplayString = X11Extras::getInstance()->getXDisplayString(); + if (!potentialXDisplayString.isEmpty()) { QByteArray tempByteArray = potentialXDisplayString.toLocal8Bit(); @@ -78,6 +78,7 @@ void UnixCaptureWindowUtility::attemptWindowCapture() status = XGrabPointer(display, rootWin, False, ButtonPressMask, GrabModeSync, GrabModeAsync, None, cursor, CurrentTime); + if (status == Success) { XGrabKey(display, XKeysymToKeycode(display, static_cast(x11KeyMapper.returnVirtualKey(Qt::Key_Escape))), 0, rootWin, @@ -86,17 +87,18 @@ void UnixCaptureWindowUtility::attemptWindowCapture() XEvent event; XAllowEvents(display, SyncPointer, CurrentTime); XWindowEvent(display, rootWin, ButtonPressMask|KeyPressMask, &event); + switch (event.type) { case (ButtonPress): + target_window = event.xbutton.subwindow; + if (target_window == None) - { target_window = event.xbutton.window; - } #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << QString::number(target_window, 16); + qDebug() << QString::number(target_window, 16); #endif break; @@ -106,6 +108,9 @@ void UnixCaptureWindowUtility::attemptWindowCapture() escaped = true; break; } + + default: + break; } XUngrabKey(display, XKeysymToKeycode(display, static_cast(x11KeyMapper.returnVirtualKey(Qt::Key_Escape))), @@ -114,14 +119,8 @@ void UnixCaptureWindowUtility::attemptWindowCapture() XFlush(display); } - if (target_window != None) - { - targetWindow = static_cast(target_window); - } - else if (!escaped) - { - failed = true; - } + if (target_window != None) targetWindow = target_window; + else if (!escaped) failed = true; XCloseDisplay(display); emit captureFinished(); diff --git a/src/unixcapturewindowutility.h b/src/unixcapturewindowutility.h old mode 100644 new mode 100755 diff --git a/src/unixwindowinfodialog.cpp b/src/unixwindowinfodialog.cpp old mode 100644 new mode 100755 diff --git a/src/unixwindowinfodialog.h b/src/unixwindowinfodialog.h old mode 100644 new mode 100755 diff --git a/src/unixwindowinfodialog.ui b/src/unixwindowinfodialog.ui old mode 100644 new mode 100755 diff --git a/src/vdpad.cpp b/src/vdpad.cpp old mode 100644 new mode 100755 index bc6551c68..fdd6120d8 --- a/src/vdpad.cpp +++ b/src/vdpad.cpp @@ -17,12 +17,11 @@ #include "vdpad.h" +#include "globalvariables.h" #include "messagehandler.h" #include -const QString VDPad::xmlName = "vdpad"; - VDPad::VDPad(int index, int originset, SetJoystick *parentSet, QObject *parent) : JoyDPad(index, originset, parentSet, parent) @@ -91,7 +90,7 @@ QString VDPad::getXmlName() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return this->xmlName; + return GlobalVariables::VDPad::xmlName; } QString VDPad::getName(bool forceFullFormat, bool displayName) @@ -103,18 +102,15 @@ QString VDPad::getName(bool forceFullFormat, bool displayName) if (!getDpadName().isEmpty() && displayName) { if (forceFullFormat) - { label.append(trUtf8("VDPad")).append(" "); - } label.append(getDpadName()); } else if (!getDefaultDpadName().isEmpty()) { if (forceFullFormat) - { label.append(trUtf8("VDPad")).append(" "); - } + label.append(getDefaultDpadName()); } else @@ -134,28 +130,19 @@ void VDPad::joyEvent(bool pressed, bool ignoresets) int tempDirection = static_cast(JoyDPadButton::DpadCentered); - /* - * Check which buttons are currently active - */ + // Check which buttons are currently active + if ((upButton != nullptr) && upButton->getButtonState()) - { tempDirection |= JoyDPadButton::DpadUp; - } if (downButton && downButton->getButtonState()) - { tempDirection |= JoyDPadButton::DpadDown; - } if (leftButton && leftButton->getButtonState()) - { tempDirection |= JoyDPadButton::DpadLeft; - } if (rightButton && rightButton->getButtonState()) - { tempDirection |= JoyDPadButton::DpadRight; - } JoyDPad::joyEvent(tempDirection, ignoresets); @@ -166,41 +153,48 @@ void VDPad::addVButton(JoyDPadButton::JoyDPadDirections direction, JoyButton *bu { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (direction == JoyDPadButton::DpadUp) + switch(direction) { - if (upButton != nullptr) + case JoyDPadButton::DpadUp: { - upButton->removeVDPad(); + if (upButton != nullptr) + upButton->removeVDPad(); + + upButton = button; + upButton->setVDPad(this); + + break; } - upButton = button; - upButton->setVDPad(this); - } - else if (direction == JoyDPadButton::DpadDown) - { - if (downButton != nullptr) + case JoyDPadButton::DpadDown: { - downButton->removeVDPad(); + if (downButton != nullptr) + downButton->removeVDPad(); + + downButton = button; + downButton->setVDPad(this); + + break; } - downButton = button; - downButton->setVDPad(this); - } - else if (direction == JoyDPadButton::DpadLeft) - { - if (leftButton != nullptr) + case JoyDPadButton::DpadLeft: { - leftButton->removeVDPad(); + if (leftButton != nullptr) + leftButton->removeVDPad(); + + leftButton = button; + leftButton->setVDPad(this); + + break; } - leftButton = button; - leftButton->setVDPad(this); - } - else if (direction == JoyDPadButton::DpadRight) - { - if (rightButton != nullptr) + case JoyDPadButton::DpadRight: { - rightButton->removeVDPad(); + if (rightButton != nullptr) + rightButton->removeVDPad(); + + rightButton = button; + rightButton->setVDPad(this); + + break; } - rightButton = button; - rightButton->setVDPad(this); } } @@ -275,21 +269,29 @@ JoyButton* VDPad::getVButton(JoyDPadButton::JoyDPadDirections direction) qInstallMessageHandler(MessageHandler::myMessageOutput); JoyButton *button = nullptr; - if (direction == JoyDPadButton::DpadUp) - { - button = upButton; - } - else if (direction == JoyDPadButton::DpadDown) - { - button = downButton; - } - else if (direction == JoyDPadButton::DpadLeft) - { - button = leftButton; - } - else if (direction == JoyDPadButton::DpadRight) + + switch(direction) { - button = rightButton; + case JoyDPadButton::DpadUp: + { + button = upButton; + break; + } + case JoyDPadButton::DpadDown: + { + button = downButton; + break; + } + case JoyDPadButton::DpadLeft: + { + button = leftButton; + break; + } + case JoyDPadButton::DpadRight: + { + button = rightButton; + break; + } } return button; @@ -319,11 +321,10 @@ void VDPad::activatePendingEvent() { // Always use true. The proper direction value will be determined // in the joyEvent method. - joyEvent(true); + joyEvent(true); pendingVDPadEvent = false; } - } void VDPad::clearPendingEvent() diff --git a/src/vdpad.h b/src/vdpad.h old mode 100644 new mode 100755 index 3e38435a5..e608b9451 --- a/src/vdpad.h +++ b/src/vdpad.h @@ -37,8 +37,8 @@ class VDPad : public JoyDPad void removeVButton(JoyButton *button); JoyButton* getVButton(JoyDPadButton::JoyDPadDirections direction); bool isEmpty(); - virtual QString getName(bool forceFullFormat=false, bool displayName=false); - virtual QString getXmlName(); + virtual QString getName(bool forceFullFormat=false, bool displayName=false) override; + virtual QString getXmlName() override; void queueJoyEvent(bool ignoresets=false); bool hasPendingEvent(); @@ -50,8 +50,6 @@ class VDPad : public JoyDPad JoyButton *getRightButton() const; bool getPendingVDPadEvent() const; - static const QString xmlName; - public slots: void activatePendingEvent(); diff --git a/src/winappprofiletimerdialog.cpp b/src/winappprofiletimerdialog.cpp old mode 100644 new mode 100755 diff --git a/src/winappprofiletimerdialog.h b/src/winappprofiletimerdialog.h old mode 100644 new mode 100755 diff --git a/src/winappprofiletimerdialog.ui b/src/winappprofiletimerdialog.ui old mode 100644 new mode 100755 diff --git a/src/winextras.cpp b/src/winextras.cpp old mode 100644 new mode 100755 index 07d7c66d0..b8728831e --- a/src/winextras.cpp +++ b/src/winextras.cpp @@ -481,15 +481,7 @@ QString WinExtras::getCurrentWindowText() bool WinExtras::raiseProcessPriority() { - bool result = false; - result = SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); - /*if (!result) - { - qDebug() << "COULD NOT RAISE PROCESS PRIORITY"; - } - */ - - return result; + return SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); } QPoint WinExtras::getCursorPos() diff --git a/src/winextras.h b/src/winextras.h old mode 100644 new mode 100755 diff --git a/src/x11extras.cpp b/src/x11extras.cpp old mode 100644 new mode 100755 index 779c23316..45d344e39 --- a/src/x11extras.cpp +++ b/src/x11extras.cpp @@ -17,14 +17,12 @@ #include "common.h" +#include "globalvariables.h" #include "messagehandler.h" #include #include #include -#include -#include - #include #include @@ -34,13 +32,6 @@ #include "x11extras.h" - -const QString X11Extras::mouseDeviceName = PadderCommon::mouseDeviceName; -const QString X11Extras::keyboardDeviceName = PadderCommon::keyboardDeviceName; -const QString X11Extras::xtestMouseDeviceName = QString("Virtual core XTEST pointer"); - -QString X11Extras::_customDisplayString = QString(""); - static QThreadStorage displays; X11Extras* X11Extras::_instance = nullptr; @@ -62,18 +53,37 @@ X11Extras::~X11Extras() { qInstallMessageHandler(MessageHandler::myMessageOutput); + freeDisplay(); +} + + +template +void freeWindow(T* window) +{ + if (window != nullptr) + { + XFree(window); + window = nullptr; + } +} + + +void X11Extras::freeDisplay() +{ if (_display != nullptr) { - XCloseDisplay(display()); + XCloseDisplay(_display); _display = nullptr; } } + X11Extras *X11Extras::getInstance() { qInstallMessageHandler(MessageHandler::myMessageOutput); X11Extras *temp = nullptr; + if (!displays.hasLocalData()) { temp = new X11Extras(); @@ -99,6 +109,19 @@ void X11Extras::deleteInstance() } } +#ifdef Q_OS_UNIX +const char* X11Extras::getEnvVariable( const char* var ) const +{ + const char * val = ::getenv( var ); + if ( val == 0 ) { + return ""; + } + else { + return val; + } +} +#endif + /** * @brief Get display instance * @return Display struct @@ -114,8 +137,7 @@ bool X11Extras::hasValidDisplay() { qInstallMessageHandler(MessageHandler::myMessageOutput); - bool result = (_display != nullptr); - return result; + return (_display != nullptr); } /** @@ -125,11 +147,7 @@ void X11Extras::closeDisplay() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (_display != nullptr) - { - XCloseDisplay(display()); - _display = nullptr; - } + freeDisplay(); } /** @@ -159,7 +177,7 @@ void X11Extras::setCustomDisplay(QString displayString) { qInstallMessageHandler(MessageHandler::myMessageOutput); - _customDisplayString = displayString; + GlobalVariables::X11Extras::_customDisplayString = displayString; } /** @@ -185,10 +203,9 @@ QString X11Extras::getDisplayString(QString xcodestring) qInstallMessageHandler(MessageHandler::myMessageOutput); QString temp = QString(); + if (knownAliases.contains(xcodestring)) - { temp = knownAliases.value(xcodestring); - } return temp; } @@ -223,58 +240,7 @@ Window X11Extras::findParentClient(Window window) Window finalwindow = 0; Display *display = this->display(); - if (windowIsViewable(display, window) && - isWindowRelevant(display, window)) - { - finalwindow = window; - } - else - { - bool quitTraversal = false; - while (!quitTraversal) - { - children = nullptr; - - if (XQueryTree(display, window, &root, &parent, &children, &num_children)) - { - if (children) - { - // must be a test for NULL - XFree(children); - } - - if (parent) - { - if (windowIsViewable(display, parent) && - isWindowRelevant(display, parent)) - { - quitTraversal = true; - finalwindow = parent; - } - else if (parent == 0) - { - quitTraversal = true; - } - else if (parent == root) - { - quitTraversal = true; - } - else - { - window = parent; - } - } - else - { - quitTraversal = true; - } - } - else - { - quitTraversal = true; - } - } - } + checkPropertyOnWin(windowIsViewable(display, window) && isWindowRelevant(display, window), window, parent, finalwindow, root, children, display, num_children); return finalwindow; } @@ -295,19 +261,41 @@ int X11Extras::getApplicationPid(Window window) unsigned char *prop = nullptr; int pid = 0; Window finalwindow = 0; - + Window parent = 0; + Window root = 0; + Window *children = nullptr; + unsigned int num_children; Display *display = this->display(); atom = XInternAtom(display, "_NET_WM_PID", True); - if (windowHasProperty(display, window, atom)) + + checkPropertyOnWin(windowHasProperty(display, window, atom), window, parent, finalwindow, root, children, display, num_children); + + if (finalwindow) + { + int status = 0; + + status = XGetWindowProperty(display, finalwindow, atom, 0, 1024, false, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, &prop); + + if ((status == 0) && (prop != nullptr)) + { + pid = prop[1] << 8; + pid += prop[0]; + XFree(prop); + } + } + + return pid; +} + + +void X11Extras::checkPropertyOnWin(bool windowCorrected, Window& window, Window& parent, Window& finalwindow, Window& root, Window *children, Display *display, unsigned int& num_children) +{ + if (windowCorrected) { finalwindow = window; } else { - Window parent = 0; - Window root = 0; - Window *children; - unsigned int num_children; bool quitTraversal = false; while (!quitTraversal) @@ -316,7 +304,7 @@ int X11Extras::getApplicationPid(Window window) if (XQueryTree(display, window, &root, &parent, &children, &num_children)) { - if (children) + if (children != nullptr) { // must be a test for NULL XFree(children); @@ -324,7 +312,7 @@ int X11Extras::getApplicationPid(Window window) if (parent) { - if (windowHasProperty(display, parent, atom)) + if (windowCorrected) { quitTraversal = true; finalwindow = parent; @@ -353,21 +341,6 @@ int X11Extras::getApplicationPid(Window window) } } } - - if (finalwindow) - { - int status = 0; - - status = XGetWindowProperty(display, finalwindow, atom, 0, 1024, false, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, &prop); - if ((status == 0) && prop) - { - pid = prop[1] << 8; - pid += prop[0]; - XFree(prop); - } - } - - return pid; } /** @@ -380,27 +353,25 @@ QString X11Extras::getApplicationLocation(int pid) qInstallMessageHandler(MessageHandler::myMessageOutput); QString exepath = QString(); + if (pid > 0) { QString procString = QString("/proc/%1/exe").arg(pid); QFileInfo procFileInfo(procString); + if (procFileInfo.exists()) { char buf[1024]; QByteArray tempByteArray = procString.toLocal8Bit(); ssize_t len = readlink(tempByteArray.constData(), buf, sizeof(buf)-1); - if (len != -1) - { - buf[len] = '\0'; - } + + if (len != -1) buf[len] = '\0'; if (len > 0) { QString temp = QString::fromUtf8(buf); - if (!temp.isEmpty()) - { - exepath = temp; - } + + if (!temp.isEmpty()) exepath = temp; } } } @@ -435,7 +406,8 @@ Window X11Extras::findClientWindow(Window window) else { XQueryTree(display, window, &root, &parent, &children, &num_children); - if (children) + + if (children != nullptr) { for (unsigned int i = 0; (i < num_children) && !finalwindow; i++) { @@ -447,7 +419,7 @@ Window X11Extras::findClientWindow(Window window) } } - if (!finalwindow && children) + if (!finalwindow && (children != nullptr)) { for (unsigned int i = 0; (i < num_children) && !finalwindow; i++) { @@ -455,11 +427,7 @@ Window X11Extras::findClientWindow(Window window) } } - if (children) - { - XFree(children); - children = nullptr; - } + freeWindow(children); } return finalwindow; @@ -481,16 +449,12 @@ bool X11Extras::windowHasProperty(Display *display, Window window, Atom atom) &actual_type, &actual_format, &nitems, &bytes_after, &prop); - if ((status == Success) && prop) + if ((status == Success) && (prop != nullptr)) { result = true; } - if (prop != nullptr) - { - XFree(prop); - prop = nullptr; - } + freeWindow(prop); return result; } @@ -502,6 +466,7 @@ bool X11Extras::windowIsViewable(Display *display, Window window) bool result = false; XWindowAttributes xwa; XGetWindowAttributes(display, window, &xwa); + if ((xwa.c_class == InputOutput) && (xwa.map_state == IsViewable)) { result = true; @@ -530,9 +495,11 @@ bool X11Extras::isWindowRelevant(Display *display, Window window) temp.append(XInternAtom(display, "_NW_WM_NAME", True)); QListIterator iter(temp); + while (iter.hasNext()) { Atom current_atom = iter.next(); + if (windowHasProperty(display, window, current_atom)) { iter.toBack(); @@ -569,9 +536,11 @@ QString X11Extras::getWindowTitle(Window window) tempList.append(wm_name); tempList.append(net_wm_name); QListIterator iter(tempList); + while (iter.hasNext()) { Atom temp_atom = iter.next(); + if (windowHasProperty(display, window, temp_atom)) { iter.toBack(); @@ -583,21 +552,17 @@ QString X11Extras::getWindowTitle(Window window) &actual_type, &actual_format, &nitems, &bytes_after, &prop); - if ((status == Success) && prop) + if ((status == Success) && (prop != nullptr)) { - char *tempprop = (char*)prop; + char *tempprop = reinterpret_cast(prop); temp.append(QString::fromUtf8(tempprop)); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << temp; + qDebug() << temp; #endif } - if (prop != nullptr) - { - XFree(prop); - prop = nullptr; - } + freeWindow(prop); return temp; } @@ -621,52 +586,46 @@ QString X11Extras::getWindowClass(Window window) &actual_type, &actual_format, &nitems, &bytes_after, &prop); - if ((status == Success) && prop) + if ((status == Success) && (prop != nullptr)) { #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << nitems; + qDebug() << nitems; #endif - char *null_char = strchr((char*)prop, '\0'); - if ((((char*)prop) + nitems - 1) > null_char) + char *null_char = strchr(reinterpret_cast(prop), '\0'); + if (((reinterpret_cast(prop)) + nitems - 1) > null_char) { *(null_char) = ' '; } - char *tempprop = (char*)prop; + char *tempprop = reinterpret_cast(prop); temp.append(QString::fromUtf8(tempprop)); #ifndef QT_DEBUG_NO_OUTPUT - qDebug() << temp; - qDebug() << (char*)prop; + qDebug() << temp; + qDebug() << reinterpret_cast(prop); #endif } - if (prop != nullptr) - { - XFree(prop); - prop = nullptr; - } + freeWindow(prop); return temp; } + unsigned long X11Extras::getWindowInFocus() { qInstallMessageHandler(MessageHandler::myMessageOutput); unsigned long result = 0; - Window currentWindow = 0; int focusState = 0; - Display *display = this->display(); + XGetInputFocus(display, ¤tWindow, &focusState); if (currentWindow > 0) - { - result = static_cast(currentWindow); - } + result = static_cast(currentWindow); return result; } @@ -679,20 +638,17 @@ QString X11Extras::getXDisplayString() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return _customDisplayString; + return GlobalVariables::X11Extras::_customDisplayString; } int X11Extras::getGroup1KeySym(int virtualkey) { qInstallMessageHandler(MessageHandler::myMessageOutput); - int result = 0; Display *display = this->display(); + int temp = XKeysymToKeycode(display, virtualkey); - int temp = XKeysymToKeycode(display, static_cast(virtualkey)); - result = static_cast(XkbKeycodeToKeysym(display, static_cast(temp), 0, 0)); - - return result; + return XkbKeycodeToKeysym(display, temp, 0, 0); } void X11Extras::x11ResetMouseAccelerationChange(QString pointerName) @@ -702,8 +658,8 @@ void X11Extras::x11ResetMouseAccelerationChange(QString pointerName) int xi_opcode, event, error; xi_opcode = event = error = 0; Display *display = this->display(); - bool result = XQueryExtension(display, "XInputExtension", &xi_opcode, &event, &error); + if (!result) { Logger::LogInfo(trUtf8("xinput extension was not found. No mouse acceleration changes will occur.")); @@ -711,6 +667,7 @@ void X11Extras::x11ResetMouseAccelerationChange(QString pointerName) else { int ximajor = 2, ximinor = 0; + if (XIQueryVersion(display, &ximajor, &ximinor) != Success) { Logger::LogInfo(trUtf8("xinput version must be at least 2.0. No mouse acceleration changes will occur.")); @@ -726,16 +683,8 @@ void X11Extras::x11ResetMouseAccelerationChange(QString pointerName) int num_devices = 0; all_devices = XIQueryDevice(display, XIAllDevices, &num_devices); - for (int i=0; i < num_devices; i++) - { - current_devices = &all_devices[i]; - if ((current_devices->use == XISlavePointer) && - (QString::fromUtf8(current_devices->name) == pointerName)) - { - Logger::LogInfo(trUtf8("Virtual pointer found with id=%1.").arg(current_devices->deviceid)); - mouse_device = current_devices; - } - } + + findVirtualPtr(num_devices, current_devices, mouse_device, all_devices, pointerName); if (mouse_device != nullptr) { @@ -745,18 +694,8 @@ void X11Extras::x11ResetMouseAccelerationChange(QString pointerName) int feedback_id = -1; XFeedbackState *feedbacks = XGetFeedbackControl(display, device, &num_feedbacks); XFeedbackState *temp = feedbacks; - for (int i=0; (i < num_feedbacks) && (feedback_id == -1); i++) - { - if (temp->c_class == PtrFeedbackClass) - { - feedback_id = static_cast(temp->id); - } - if ((i + 1) < num_feedbacks) - { - temp = (XFeedbackState*) ((char*) temp + temp->length); - } - } + checkFeedback(temp, num_feedbacks, feedback_id); XFree(feedbacks); feedbacks = temp = nullptr; @@ -781,7 +720,7 @@ void X11Extras::x11ResetMouseAccelerationChange(QString pointerName) feedback.accelDenom = 1; XChangeFeedbackControl(display, device, DvAccelNum|DvAccelDenom|DvThreshold, - (XFeedbackControl*) &feedback); + reinterpret_cast(&feedback)); XSync(display, false); } @@ -789,10 +728,7 @@ void X11Extras::x11ResetMouseAccelerationChange(QString pointerName) XCloseDevice(display, device); } - if (all_devices) - { - XIFreeDeviceInfo(all_devices); - } + if (all_devices != nullptr) XIFreeDeviceInfo(all_devices); } } @@ -800,7 +736,7 @@ void X11Extras::x11ResetMouseAccelerationChange() { qInstallMessageHandler(MessageHandler::myMessageOutput); - x11ResetMouseAccelerationChange(mouseDeviceName); + x11ResetMouseAccelerationChange(GlobalVariables::X11Extras::mouseDeviceName); } struct X11Extras::ptrInformation X11Extras::getPointInformation(QString pointerName) @@ -814,9 +750,11 @@ struct X11Extras::ptrInformation X11Extras::getPointInformation(QString pointerN Display *display = this->display(); bool result = XQueryExtension(display, "XInputExtension", &xi_opcode, &event, &error); + if (result) { int ximajor = 2, ximinor = 0; + if (XIQueryVersion(display, &ximajor, &ximinor) != Success) { Logger::LogInfo(QObject::trUtf8("xinput version must be at least 2.0. No mouse acceleration changes will occur.")); @@ -832,17 +770,10 @@ struct X11Extras::ptrInformation X11Extras::getPointInformation(QString pointerN int num_devices = 0; all_devices = XIQueryDevice(display, XIAllDevices, &num_devices); - for (int i=0; i < num_devices; i++) - { - current_devices = &all_devices[i]; - if ((current_devices->use == XISlavePointer) && - (QString::fromUtf8(current_devices->name) == pointerName)) - { - mouse_device = current_devices; - } - } - if (mouse_device) + findVirtualPtr(num_devices, current_devices, mouse_device, all_devices, pointerName); + + if (mouse_device != nullptr) { XDevice *device = XOpenDevice(display, static_cast(mouse_device->deviceid)); @@ -850,18 +781,8 @@ struct X11Extras::ptrInformation X11Extras::getPointInformation(QString pointerN int feedback_id = -1; XFeedbackState *feedbacks = XGetFeedbackControl(display, device, &num_feedbacks); XFeedbackState *temp = feedbacks; - for (int i=0; (i < num_feedbacks) && (feedback_id == -1); i++) - { - if (temp->c_class == PtrFeedbackClass) - { - feedback_id = static_cast(temp->id); - } - if ((feedback_id == -1) && ((i + 1) < num_feedbacks)) - { - temp = (XFeedbackState*) ((char*) temp + temp->length); - } - } + checkFeedback(temp, num_feedbacks, feedback_id); if (feedback_id <= -1) { @@ -881,20 +802,49 @@ struct X11Extras::ptrInformation X11Extras::getPointInformation(QString pointerN XCloseDevice(display, device); } - if (all_devices) + if (all_devices != nullptr) XIFreeDeviceInfo(all_devices); + } + + return tempInfo; +} + + +void X11Extras::findVirtualPtr(int num_devices, XIDeviceInfo *current_devices, XIDeviceInfo *mouse_device, XIDeviceInfo *all_devices, QString pointerName) +{ + for (int i = 0; i < num_devices; i++) + { + current_devices = &all_devices[i]; + + if ((current_devices->use == XISlavePointer) && + (QString::fromUtf8(current_devices->name) == pointerName)) { - XIFreeDeviceInfo(all_devices); + mouse_device = current_devices; } } +} - return tempInfo; + +void X11Extras::checkFeedback(XFeedbackState *temp, int& num_feedbacks, int& feedback_id) +{ + for (int i = 0; (i < num_feedbacks) && (feedback_id == -1); i++) + { + if (temp->c_class == PtrFeedbackClass) + { + feedback_id = temp->id; + } + + if ((i + 1) < num_feedbacks) + { + temp = (XFeedbackState*) ((char*) temp + temp->length); + } + } } struct X11Extras::ptrInformation X11Extras::getPointInformation() { qInstallMessageHandler(MessageHandler::myMessageOutput); - return getPointInformation(mouseDeviceName); + return getPointInformation(GlobalVariables::X11Extras::mouseDeviceName); } QPoint X11Extras::getPos() diff --git a/src/x11extras.h b/src/x11extras.h old mode 100644 new mode 100755 index d5adaee44..8d2dc76cc --- a/src/x11extras.h +++ b/src/x11extras.h @@ -23,9 +23,12 @@ #include #include +#include +#include #include + class X11Extras : public QObject { Q_OBJECT @@ -72,16 +75,15 @@ class X11Extras : public QObject static void setCustomDisplay(QString displayString); + #ifdef Q_OS_UNIX + const char* getEnvVariable(const char* var) const; + #endif + static X11Extras* getInstance(); static void deleteInstance(); QHash const& getKnownAliases(); - static const QString mouseDeviceName; - static const QString keyboardDeviceName; - static const QString xtestMouseDeviceName; - - protected: explicit X11Extras(QObject *parent = nullptr); @@ -91,12 +93,16 @@ class X11Extras : public QObject bool isWindowRelevant(Display *display, Window window); static X11Extras *_instance; - static QString _customDisplayString; public slots: QPoint getPos(); private: + void checkPropertyOnWin(bool windowCorrected, Window& window, Window& parent, Window& finalwindow, Window& root, Window *children, Display *display, unsigned int& num_children); + void freeDisplay(); + void checkFeedback(XFeedbackState *temp, int& num_feedbacks, int& feedback_id); + void findVirtualPtr(int num_devices, XIDeviceInfo *current_devices, XIDeviceInfo *mouse_device, XIDeviceInfo *all_devices, QString pointerName); + QHash knownAliases; Display *_display; }; diff --git a/src/xmlconfigmigration.cpp b/src/xmlconfigmigration.cpp old mode 100644 new mode 100755 index 02af686f5..f2580f0b8 --- a/src/xmlconfigmigration.cpp +++ b/src/xmlconfigmigration.cpp @@ -37,6 +37,7 @@ XMLConfigMigration::XMLConfigMigration(QXmlStreamReader *reader, QObject *parent qInstallMessageHandler(MessageHandler::myMessageOutput); this->reader = reader; + if (reader->device() && reader->device()->isOpen()) { this->fileVersion = reader->attributes().value("configversion").toString().toInt(); @@ -52,11 +53,8 @@ bool XMLConfigMigration::requiresMigration() qInstallMessageHandler(MessageHandler::myMessageOutput); bool toMigrate = false; - if (fileVersion == 0) - { - toMigrate = false; - } - else if ((fileVersion >= 2) && (fileVersion <= PadderCommon::LATESTCONFIGMIGRATIONVERSION)) + + if ((fileVersion >= 2) && (fileVersion <= PadderCommon::LATESTCONFIGMIGRATIONVERSION)) { toMigrate = true; } @@ -69,17 +67,17 @@ QString XMLConfigMigration::migrate() qInstallMessageHandler(MessageHandler::myMessageOutput); QString tempXmlString = QString(); + if (requiresMigration()) { - int tempFileVersion = fileVersion; QString initialData = readConfigToString(); reader->clear(); reader->addData(initialData); - if ((tempFileVersion >= 2) && (tempFileVersion <= 5)) + if ((fileVersion >= 2) && (fileVersion <= 5)) { tempXmlString = version0006Migration(); - tempFileVersion = PadderCommon::LATESTCONFIGFILEVERSION; + fileVersion = PadderCommon::LATESTCONFIGFILEVERSION; } } @@ -93,6 +91,7 @@ QString XMLConfigMigration::readConfigToString() QString tempXmlString = QString(); QXmlStreamWriter writer(&tempXmlString); writer.setAutoFormatting(true); + while (!reader->atEnd()) { writer.writeCurrentToken(*reader); @@ -156,6 +155,7 @@ QString XMLConfigMigration::version0006Migration() slotcode = AntKeyMapper::getInstance()->returnQtKey(slotcode); #elif defined(Q_OS_UNIX) BaseEventHandler *handler = EventHandlerFactory::getInstance()->handler(); + if (handler->getIdentifier() == "xtest") { slotcode = AntKeyMapper::getInstance()->returnQtKey(X11KeyCodeToX11KeySym(slotcode)); @@ -183,12 +183,14 @@ QString XMLConfigMigration::version0006Migration() writer.writeTextElement("mode", slotmode); } + writer.writeCurrentToken(*reader); } else { writer.writeCurrentToken(*reader); } + reader->readNext(); } diff --git a/src/xmlconfigmigration.h b/src/xmlconfigmigration.h old mode 100644 new mode 100755 diff --git a/src/xmlconfigreader.cpp b/src/xmlconfigreader.cpp old mode 100644 new mode 100755 index 1dcf2f970..a0f69e91b --- a/src/xmlconfigreader.cpp +++ b/src/xmlconfigreader.cpp @@ -17,6 +17,7 @@ #include "xmlconfigreader.h" +#include "globalvariables.h" #include "messagehandler.h" #include "inputdevice.h" #include "xmlconfigmigration.h" @@ -34,7 +35,6 @@ #include - XMLConfigReader::XMLConfigReader(QObject *parent) : QObject(parent) { @@ -42,7 +42,7 @@ XMLConfigReader::XMLConfigReader(QObject *parent) : xml = new QXmlStreamReader(); configFile = nullptr; - joystick = nullptr; + m_joystick = nullptr; initDeviceTypes(); } @@ -53,9 +53,7 @@ XMLConfigReader::~XMLConfigReader() if (configFile != nullptr) { if (configFile->isOpen()) - { configFile->close(); - } delete configFile; configFile = nullptr; @@ -72,7 +70,7 @@ void XMLConfigReader::setJoystick(InputDevice *joystick) { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->joystick = joystick; + m_joystick = joystick; } void XMLConfigReader::setFileName(QString filename) @@ -80,6 +78,7 @@ void XMLConfigReader::setFileName(QString filename) qInstallMessageHandler(MessageHandler::myMessageOutput); QFile *temp = new QFile(filename); + if (temp->exists()) { configFile = temp; @@ -95,7 +94,7 @@ void XMLConfigReader::configJoystick(InputDevice *joystick) { qInstallMessageHandler(MessageHandler::myMessageOutput); - this->joystick = joystick; + m_joystick = joystick; read(); } @@ -105,7 +104,7 @@ bool XMLConfigReader::read() bool error = false; - if ((configFile != nullptr) && configFile->exists() && (joystick != nullptr)) + if ((configFile != nullptr) && configFile->exists() && (m_joystick != nullptr)) { xml->clear(); @@ -116,29 +115,27 @@ bool XMLConfigReader::read() } xml->readNextStartElement(); + if (!deviceTypes.contains(xml->name().toString())) { xml->raiseError("Root node is not a joystick or controller"); } - else if (xml->name() == Joystick::xmlName) + else if (xml->name() == GlobalVariables::Joystick::xmlName) { XMLConfigMigration migration(xml); + if (migration.requiresMigration()) { QString migrationString = migration.migrate(); + if (migrationString.length() > 0) { - // Remove QFile from reader and clear state - xml->clear(); - // Add converted XML string to reader - xml->addData(migrationString); - // Skip joystick root node - xml->readNextStartElement(); - // Close current config file - configFile->close(); - - // Write converted XML to file - configFile->open(QFile::WriteOnly | QFile::Text); + xml->clear(); // Remove QFile from reader and clear state + xml->addData(migrationString); // Add converted XML string to reader + xml->readNextStartElement(); // Skip joystick root node + configFile->close(); // Close current config file + configFile->open(QFile::WriteOnly | QFile::Text); // Write converted XML to file + if (configFile->isOpen()) { configFile->write(migrationString.toLocal8Bit()); @@ -156,7 +153,7 @@ bool XMLConfigReader::read() { if (xml->isStartElement() && deviceTypes.contains(xml->name().toString())) { - joystick->readConfig(xml); + m_joystick->readConfig(xml); } else { @@ -168,9 +165,7 @@ bool XMLConfigReader::read() } if (configFile->isOpen()) - { configFile->close(); - } if (xml->hasError() && (xml->error() != QXmlStreamReader::PrematureEndOfDocumentError)) { @@ -190,10 +185,9 @@ const QString XMLConfigReader::getErrorString() qInstallMessageHandler(MessageHandler::myMessageOutput); QString temp = QString(); + if (xml->hasError()) - { temp = xml->errorString(); - } return temp; } @@ -210,9 +204,8 @@ void XMLConfigReader::initDeviceTypes() qInstallMessageHandler(MessageHandler::myMessageOutput); deviceTypes.clear(); - deviceTypes.append(Joystick::xmlName); - deviceTypes.append(GameController::xmlName); - + deviceTypes.append(GlobalVariables::Joystick::xmlName); + deviceTypes.append(GlobalVariables::GameController::xmlName); } const QXmlStreamReader* XMLConfigReader::getXml() { @@ -232,7 +225,7 @@ const QFile* XMLConfigReader::getConfigFile() { const InputDevice* XMLConfigReader::getJoystick() { - return joystick; + return m_joystick; } QStringList const& XMLConfigReader::getDeviceTypes() { diff --git a/src/xmlconfigreader.h b/src/xmlconfigreader.h old mode 100644 new mode 100755 index 1b0469831..d3ec3ff76 --- a/src/xmlconfigreader.h +++ b/src/xmlconfigreader.h @@ -53,7 +53,7 @@ public slots: QXmlStreamReader *xml; QString fileName; QFile *configFile; - InputDevice* joystick; + InputDevice* m_joystick; QStringList deviceTypes; }; diff --git a/src/xmlconfigwriter.cpp b/src/xmlconfigwriter.cpp old mode 100644 new mode 100755 index ad60c5d97..c2a400e97 --- a/src/xmlconfigwriter.cpp +++ b/src/xmlconfigwriter.cpp @@ -27,7 +27,6 @@ #include - XMLConfigWriter::XMLConfigWriter(QObject *parent) : QObject(parent) { @@ -36,7 +35,7 @@ XMLConfigWriter::XMLConfigWriter(QObject *parent) : xml = new QXmlStreamWriter(); xml->setAutoFormatting(true); configFile = nullptr; - joystick = nullptr; + m_joystick = nullptr; writerError = false; } @@ -44,18 +43,16 @@ XMLConfigWriter::~XMLConfigWriter() { qInstallMessageHandler(MessageHandler::myMessageOutput); - if (configFile) + if (configFile != nullptr) { if (configFile->isOpen()) - { configFile->close(); - } delete configFile; configFile = nullptr; } - if (xml) + if (xml != nullptr) { delete xml; xml = nullptr; @@ -87,12 +84,9 @@ void XMLConfigWriter::write(InputDevice *joystick) } if (configFile->isOpen()) - { configFile->close(); - } } - void XMLConfigWriter::setFileName(QString filename) { qInstallMessageHandler(MessageHandler::myMessageOutput); @@ -133,5 +127,5 @@ const QFile *XMLConfigWriter::getConfigFile() { const InputDevice* XMLConfigWriter::getJoystick() { - return joystick; + return m_joystick; } diff --git a/src/xmlconfigwriter.h b/src/xmlconfigwriter.h old mode 100644 new mode 100755 index 4cd5fafa2..9f6a9c051 --- a/src/xmlconfigwriter.h +++ b/src/xmlconfigwriter.h @@ -48,7 +48,7 @@ public slots: QXmlStreamWriter *xml; QString fileName; QFile *configFile; - InputDevice* joystick; + InputDevice* m_joystick; bool writerError; QString writerErrorString; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 000000000..5ce7bb8db --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 2.8.11) +project(aboutdialogClass) + +# Tell CMake to run moc when necessary: +set(CMAKE_AUTOMOC ON) + +# As moc files are generated in the binary dir, tell CMake +# to always look for includes there: +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +find_package(Qt5Test REQUIRED) + +add_executable(aboutdialogClass testaboutdialog.cpp) +target_link_libraries(aboutdialogClass antilib Qt5::Test) + +add_test (NAME testAboutDialog COMMAND aboutdialogClass) diff --git a/tests/testaboutdialog.cpp b/tests/testaboutdialog.cpp new file mode 100644 index 000000000..9422a2d7d --- /dev/null +++ b/tests/testaboutdialog.cpp @@ -0,0 +1,71 @@ +#include "aboutdialog.h" + +#include +#include +#include +#include + +class TestAboutDialog: public QObject +{ + Q_OBJECT + +public: + TestAboutDialog(QObject* parent = 0); + +private slots: + void testVersion(); + void infoTextBrowserEmpty(); + void changelogPlainEmpty(); + void textBrowserDevsEmpty(); + void licenseInfoEmpty(); + void creditsInfoEmpty(); + +private: + AboutDialog aboutDialog; +}; + +TestAboutDialog::TestAboutDialog(QObject* parent) : + QObject(parent), + aboutDialog() +{ + QTestEventLoop::instance().enterLoop(1); +} + +void TestAboutDialog::infoTextBrowserEmpty() +{ + QTextBrowser* infoTextBrowser = aboutDialog.findChild("infoTextBrowser"); + QVERIFY2(!infoTextBrowser->toPlainText().isEmpty(), "infoTextBrowser is empty"); +} + +void TestAboutDialog::changelogPlainEmpty() +{ + QPlainTextEdit* changelogPlainTextEdit = aboutDialog.findChild("changelogPlainTextEdit"); + QVERIFY2(!changelogPlainTextEdit->toPlainText().isEmpty(), "changelogPlainTextEdit is empty"); +} + +void TestAboutDialog::textBrowserDevsEmpty() +{ + QPlainTextEdit* developersInfo = aboutDialog.findChild("plainTextEdit"); + QVERIFY2(!developersInfo->toPlainText().isEmpty(), "plainTextEdit for info about developers is empty"); +} + +void TestAboutDialog::licenseInfoEmpty() +{ + QTextBrowser* licenseInfo = aboutDialog.findChild("textBrowser_2"); + QVERIFY2(!licenseInfo->toPlainText().isEmpty(), "textBrowser_2 about license information is empty"); +} + +void TestAboutDialog::creditsInfoEmpty() +{ + QTextBrowser* creditsInfo = aboutDialog.findChild("textBrowser"); + QVERIFY2(!creditsInfo->toPlainText().isEmpty(), "textBrowser about credits is empty"); +} + +void TestAboutDialog::testVersion() +{ + QLabel* versionLabel = aboutDialog.findChild("versionLabel"); + QCOMPARE(versionLabel->text(), QString("2.24.0")); +} + +QTEST_MAIN(TestAboutDialog) +#include "testaboutdialog.moc" diff --git a/windows/AntiMicro.wxs b/windows/AntiMicro.wxs old mode 100644 new mode 100755 diff --git a/windows/AntiMicro_64.wxs b/windows/AntiMicro_64.wxs old mode 100644 new mode 100755