├── .github └── workflows │ └── main.yml ├── .gitignore ├── AntiMicro Future Developments.mm ├── BuildOptions.md ├── CMakeLists.txt ├── Changelog ├── ProfileTips.md ├── README.md ├── Resources.txt ├── cmake └── FindSDL2.cmake ├── cmake_uninstall.cmake.in ├── gpl.txt ├── other ├── 40-uinput.rules ├── CMakeLists.txt ├── antimicro.1 ├── antimicro.desktop ├── antimicro.xml ├── appdata │ ├── CMakeLists.txt │ ├── PO_files │ │ └── en.po │ ├── antimicro.appdata.xml.in │ ├── appdata.its │ └── screenshots │ │ ├── controller_configure01.png │ │ ├── controller_configure02.png │ │ └── controller_mapping01.png └── scripts │ └── build-sdl-lib.bat ├── share ├── antimicro │ ├── blank.txt │ └── translations │ │ ├── CMakeLists.txt │ │ ├── antimicro.ts │ │ ├── antimicro_br.ts │ │ ├── antimicro_de.ts │ │ ├── antimicro_en.ts │ │ ├── antimicro_es.ts │ │ ├── antimicro_fr.ts │ │ ├── antimicro_it.ts │ │ ├── antimicro_ja.ts │ │ ├── antimicro_ru.ts │ │ ├── antimicro_sr.ts │ │ ├── antimicro_uk.ts │ │ └── antimicro_zh_CN.ts └── blank.txt ├── src ├── aboutdialog.cpp ├── aboutdialog.h ├── aboutdialog.ui ├── addeditautoprofiledialog.cpp ├── addeditautoprofiledialog.h ├── addeditautoprofiledialog.ui ├── advancebuttondialog.cpp ├── advancebuttondialog.h ├── advancebuttondialog.ui ├── advancestickassignmentdialog.cpp ├── advancestickassignmentdialog.h ├── advancestickassignmentdialog.ui ├── antimicro.exe.manifest ├── antimicro.exe.uiaccess.manifest ├── antimicro.rc ├── antimicrosettings.cpp ├── antimicrosettings.h ├── antkeymapper.cpp ├── antkeymapper.h ├── applaunchhelper.cpp ├── applaunchhelper.h ├── autoprofileinfo.cpp ├── autoprofileinfo.h ├── autoprofilewatcher.cpp ├── autoprofilewatcher.h ├── axiseditdialog.cpp ├── axiseditdialog.h ├── axiseditdialog.ui ├── axisvaluebox.cpp ├── axisvaluebox.h ├── buttoneditdialog.cpp ├── buttoneditdialog.h ├── buttoneditdialog.ui ├── capturedwindowinfodialog.cpp ├── capturedwindowinfodialog.h ├── capturedwindowinfodialog.ui ├── commandlineutility.cpp ├── commandlineutility.h ├── common.cpp ├── common.h ├── config.h.in ├── dpadcontextmenu.cpp ├── dpadcontextmenu.h ├── dpadeditdialog.cpp ├── dpadeditdialog.h ├── dpadeditdialog.ui ├── dpadpushbutton.cpp ├── dpadpushbutton.h ├── dpadpushbuttongroup.cpp ├── dpadpushbuttongroup.h ├── editalldefaultautoprofiledialog.cpp ├── editalldefaultautoprofiledialog.h ├── editalldefaultautoprofiledialog.ui ├── event.cpp ├── event.h ├── eventhandlerfactory.cpp ├── eventhandlerfactory.h ├── eventhandlers │ ├── baseeventhandler.cpp │ ├── baseeventhandler.h │ ├── uinputeventhandler.cpp │ ├── uinputeventhandler.h │ ├── winsendinputeventhandler.cpp │ ├── winsendinputeventhandler.h │ ├── winvmultieventhandler.cpp │ ├── winvmultieventhandler.h │ ├── xtesteventhandler.cpp │ └── xtesteventhandler.h ├── extraprofilesettingsdialog.cpp ├── extraprofilesettingsdialog.h ├── extraprofilesettingsdialog.ui ├── flashbuttonwidget.cpp ├── flashbuttonwidget.h ├── gamecontroller │ ├── gamecontroller.cpp │ ├── gamecontroller.h │ ├── gamecontrollerdpad.cpp │ ├── gamecontrollerdpad.h │ ├── gamecontrollerset.cpp │ ├── gamecontrollerset.h │ ├── gamecontrollertrigger.cpp │ ├── gamecontrollertrigger.h │ ├── gamecontrollertriggerbutton.cpp │ └── gamecontrollertriggerbutton.h ├── gamecontrollerexample.cpp ├── gamecontrollerexample.h ├── gamecontrollermappingdialog.cpp ├── gamecontrollermappingdialog.h ├── gamecontrollermappingdialog.ui ├── icons │ ├── 16x16 │ │ └── actions │ │ │ ├── application-exit.png │ │ │ ├── archive-insert.png │ │ │ ├── dialog-cancel.png │ │ │ ├── dialog-close.png │ │ │ ├── dialog-ok.png │ │ │ ├── dialog-warning.png │ │ │ ├── document-close.png │ │ │ ├── document-open-folder.png │ │ │ ├── document-open.png │ │ │ ├── document-revert-small.png │ │ │ ├── document-revert.png │ │ │ ├── document-save-as.png │ │ │ ├── document-save.png │ │ │ ├── edit-clear-list.png │ │ │ ├── edit-clear.png │ │ │ ├── edit-delete.png │ │ │ ├── edit-select.png │ │ │ ├── edit-table-delete-row.png │ │ │ ├── edit-table-insert-row-below.png │ │ │ ├── games-config-custom.png │ │ │ ├── games-config-options.png │ │ │ ├── help-about.png │ │ │ ├── text-field.png │ │ │ ├── view-fullscreen.png │ │ │ ├── view-refresh.png │ │ │ └── view-restore.png │ ├── README.txt │ ├── index.theme │ ├── lgpl-2.1.txt │ └── lgpl-3.0.txt ├── images │ ├── antimicro.ico │ ├── antimicro.png │ ├── antimicro_trayicon.png │ ├── axis.png │ ├── button.png │ ├── controllermap.png │ └── profile.jpg ├── inputdaemon.cpp ├── inputdaemon.h ├── inputdevice.cpp ├── inputdevice.h ├── inputdevicebitarraystatus.cpp ├── inputdevicebitarraystatus.h ├── joyaxis.cpp ├── joyaxis.h ├── joyaxiscontextmenu.cpp ├── joyaxiscontextmenu.h ├── joyaxiswidget.cpp ├── joyaxiswidget.h ├── joybutton.cpp ├── joybutton.h ├── joybuttoncontextmenu.cpp ├── joybuttoncontextmenu.h ├── joybuttonmousehelper.cpp ├── joybuttonmousehelper.h ├── joybuttonslot.cpp ├── joybuttonslot.h ├── joybuttonstatusbox.cpp ├── joybuttonstatusbox.h ├── joybuttontypes │ ├── joyaxisbutton.cpp │ ├── joyaxisbutton.h │ ├── joycontrolstickbutton.cpp │ ├── joycontrolstickbutton.h │ ├── joycontrolstickmodifierbutton.cpp │ ├── joycontrolstickmodifierbutton.h │ ├── joydpadbutton.cpp │ ├── joydpadbutton.h │ ├── joygradientbutton.cpp │ └── joygradientbutton.h ├── joybuttonwidget.cpp ├── joybuttonwidget.h ├── joycontrolstick.cpp ├── joycontrolstick.h ├── joycontrolstickbuttonpushbutton.cpp ├── joycontrolstickbuttonpushbutton.h ├── joycontrolstickcontextmenu.cpp ├── joycontrolstickcontextmenu.h ├── joycontrolstickdirectionstype.h ├── joycontrolstickeditdialog.cpp ├── joycontrolstickeditdialog.h ├── joycontrolstickeditdialog.ui ├── joycontrolstickpushbutton.cpp ├── joycontrolstickpushbutton.h ├── joycontrolstickstatusbox.cpp ├── joycontrolstickstatusbox.h ├── joydpad.cpp ├── joydpad.h ├── joydpadbuttonwidget.cpp ├── joydpadbuttonwidget.h ├── joykeyrepeathelper.cpp ├── joykeyrepeathelper.h ├── joystick.cpp ├── joystick.h ├── joystickstatuswindow.cpp ├── joystickstatuswindow.h ├── joystickstatuswindow.ui ├── joytabwidget.cpp ├── joytabwidget.h ├── joytabwidgetcontainer.cpp ├── joytabwidgetcontainer.h ├── keyboard │ ├── virtualkeyboardmousewidget.cpp │ ├── virtualkeyboardmousewidget.h │ ├── virtualkeypushbutton.cpp │ ├── virtualkeypushbutton.h │ ├── virtualmousepushbutton.cpp │ └── virtualmousepushbutton.h ├── localantimicroserver.cpp ├── localantimicroserver.h ├── logger.cpp ├── logger.h ├── main.cpp ├── mainsettingsdialog.cpp ├── mainsettingsdialog.h ├── mainsettingsdialog.ui ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── mousedialog │ ├── mouseaxissettingsdialog.cpp │ ├── mouseaxissettingsdialog.h │ ├── mousebuttonsettingsdialog.cpp │ ├── mousebuttonsettingsdialog.h │ ├── mousecontrolsticksettingsdialog.cpp │ ├── mousecontrolsticksettingsdialog.h │ ├── mousedpadsettingsdialog.cpp │ ├── mousedpadsettingsdialog.h │ ├── springmoderegionpreview.cpp │ ├── springmoderegionpreview.h │ └── uihelpers │ │ ├── mouseaxissettingsdialoghelper.cpp │ │ ├── mouseaxissettingsdialoghelper.h │ │ ├── mousebuttonsettingsdialoghelper.cpp │ │ ├── mousebuttonsettingsdialoghelper.h │ │ ├── mousecontrolsticksettingsdialoghelper.cpp │ │ ├── mousecontrolsticksettingsdialoghelper.h │ │ ├── mousedpadsettingsdialoghelper.cpp │ │ └── mousedpadsettingsdialoghelper.h ├── mousehelper.cpp ├── mousehelper.h ├── mousesettingsdialog.cpp ├── mousesettingsdialog.h ├── mousesettingsdialog.ui ├── qkeydisplaydialog.cpp ├── qkeydisplaydialog.h ├── qkeydisplaydialog.ui ├── qtkeymapperbase.cpp ├── qtkeymapperbase.h ├── qtuinputkeymapper.cpp ├── qtuinputkeymapper.h ├── qtvmultikeymapper.cpp ├── qtvmultikeymapper.h ├── qtwinkeymapper.cpp ├── qtwinkeymapper.h ├── qtx11keymapper.cpp ├── qtx11keymapper.h ├── quicksetdialog.cpp ├── quicksetdialog.h ├── quicksetdialog.ui ├── resources.qrc ├── resources_windows.qrc ├── sdleventreader.cpp ├── sdleventreader.h ├── setaxisthrottledialog.cpp ├── setaxisthrottledialog.h ├── setaxisthrottledialog.ui ├── setjoystick.cpp ├── setjoystick.h ├── setnamesdialog.cpp ├── setnamesdialog.h ├── setnamesdialog.ui ├── simplekeygrabberbutton.cpp ├── simplekeygrabberbutton.h ├── slotitemlistwidget.cpp ├── slotitemlistwidget.h ├── springmousemoveinfo.h ├── stickpushbuttongroup.cpp ├── stickpushbuttongroup.h ├── uihelpers │ ├── advancebuttondialoghelper.cpp │ ├── advancebuttondialoghelper.h │ ├── buttoneditdialoghelper.cpp │ ├── buttoneditdialoghelper.h │ ├── dpadcontextmenuhelper.cpp │ ├── dpadcontextmenuhelper.h │ ├── dpadeditdialoghelper.cpp │ ├── dpadeditdialoghelper.h │ ├── gamecontrollermappingdialoghelper.cpp │ ├── gamecontrollermappingdialoghelper.h │ ├── joyaxiscontextmenuhelper.cpp │ ├── joyaxiscontextmenuhelper.h │ ├── joycontrolstickcontextmenuhelper.cpp │ ├── joycontrolstickcontextmenuhelper.h │ ├── joycontrolstickeditdialoghelper.cpp │ ├── joycontrolstickeditdialoghelper.h │ ├── joytabwidgethelper.cpp │ └── joytabwidgethelper.h ├── uinputhelper.cpp ├── uinputhelper.h ├── unixcapturewindowutility.cpp ├── unixcapturewindowutility.h ├── unixwindowinfodialog.cpp ├── unixwindowinfodialog.h ├── unixwindowinfodialog.ui ├── vdpad.cpp ├── vdpad.h ├── winappprofiletimerdialog.cpp ├── winappprofiletimerdialog.h ├── winappprofiletimerdialog.ui ├── winextras.cpp ├── winextras.h ├── x11extras.cpp ├── x11extras.h ├── xmlconfigmigration.cpp ├── xmlconfigmigration.h ├── xmlconfigreader.cpp ├── xmlconfigreader.h ├── xmlconfigwriter.cpp └── xmlconfigwriter.h └── windows ├── AntiMicro.wxs └── AntiMicro_64.wxs /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | .*.swp 3 | .directory 4 | *.qm 5 | *.diff 6 | *.mo 7 | Makefile 8 | antimicro 9 | !share/antimicro 10 | antimicro.pro.user 11 | antimicro.pro.user.* 12 | moc_* 13 | qrc_resources.cpp 14 | ui_*.h 15 | *.*~ 16 | SDL2-2.0.3/ 17 | SDL2-2.0.4/ 18 | vmulti/ 19 | windows/*.msi 20 | windows/*.wix* 21 | build/ 22 | Build/ 23 | CMakeLists.txt.user* 24 | other/antimicro.1.gz 25 | other/license-template.txt 26 | doc/ 27 | src/Changelog 28 | -------------------------------------------------------------------------------- /BuildOptions.md: -------------------------------------------------------------------------------- 1 | # Build Options for CMake 2 | 3 | There are a few application specific options that can be used when running 4 | cmake to build antimicro. The following file will attempt to list some of those 5 | options and describe their use in the project. 6 | 7 | ## Universal Options 8 | 9 | -DUPDATE_TRANSLATIONS 10 | 11 | Default: OFF. Set updateqm target to call lupdate in order to update 12 | translation files from source. 13 | 14 | -DUSE_SDL_2 15 | 16 | Default: ON. Compile the program with SDL 2 instead of SDL 1.2. 17 | 18 | ## Linux Options 19 | 20 | -DAPPDATA 21 | 22 | Default: OFF. Build the project with AppData support. 23 | 24 | -DWITH_UINPUT 25 | 26 | Default: OFF. Compile the program with uinput support. 27 | 28 | -DWITH_X11 29 | 30 | Default: ON. Compile the program with X11 support. 31 | 32 | -DWITH_XTEST 33 | 34 | Default: ON. Compile the program with XTest support. 35 | 36 | 37 | ## Windows Options 38 | 39 | -DPORTABLE_PACKAGE 40 | 41 | Default: OFF. Compile the program with extra changes used for containing the 42 | final program to a single directory. 43 | 44 | -DWITH_VMULTI 45 | 46 | Default: OFF. Compile the program with support for the vmulti driver. 47 | 48 | -DPERFORM_SIGNING 49 | 50 | Default: OFF. This option is only included for testing. It should not be used 51 | currently. 52 | 53 | -------------------------------------------------------------------------------- /Resources.txt: -------------------------------------------------------------------------------- 1 | Generate GUIDs for use in .wxs files 2 | 3 | http://www.guidgen.com/ 4 | 5 | Site used to check out the behavior of different easing curves 6 | 7 | http://easings.net/ 8 | 9 | Repository of code examples for many different easing curves 10 | 11 | https://github.com/jesusgollonet/ofpennereasing 12 | 13 | Site used to generate acceleration curve images 14 | 15 | http://rechneronline.de/function-graphs/ 16 | -------------------------------------------------------------------------------- /cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 3 | endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | 5 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 6 | string(REGEX REPLACE "\n" ";" files "${files}") 7 | foreach(file ${files}) 8 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}") 9 | if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 10 | exec_program( 11 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 12 | OUTPUT_VARIABLE rm_out 13 | RETURN_VALUE rm_retval 14 | ) 15 | if(NOT "${rm_retval}" STREQUAL 0) 16 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") 17 | endif(NOT "${rm_retval}" STREQUAL 0) 18 | else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 19 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.") 20 | endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 21 | endforeach(file) 22 | -------------------------------------------------------------------------------- /other/40-uinput.rules: -------------------------------------------------------------------------------- 1 | SUBSYSTEM=="misc", KERNEL=="uinput", MODE="0660", GROUP="uinput" 2 | -------------------------------------------------------------------------------- /other/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(appdata) 2 | 3 | add_custom_target(manpage) 4 | add_custom_command(TARGET manpage PRE_BUILD 5 | COMMAND gzip -c "${PROJECT_SOURCE_DIR}/other/antimicro.1" > "antimicro.1.gz" VERBATIM 6 | ) 7 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/antimicro.1.gz" DESTINATION "share/man/man1") 8 | -------------------------------------------------------------------------------- /other/antimicro.1: -------------------------------------------------------------------------------- 1 | .\" Manpage for antimicro. 2 | .\" Contact jeff@jsbackus to correct errors or typos. 3 | .TH ANTIMICRO "1" "05 November 2016" "antimicro 2.23" "User Commands" 4 | .SH NAME 5 | antimicro \- map keyboard keys and mouse controls to a gamepad 6 | .SH SYNOPSIS 7 | .B antimicro 8 | [\fIOPTION\fR] [\fIPROFILE\fR] 9 | .SH DESCRIPTION 10 | .PP 11 | 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. However, you can use this program to control any desktop application with a gamepad. 12 | .TP 13 | \fB\-\-tray\fR 14 | launch program in system tray only 15 | .TP 16 | \fB\-\-no\-tray\fR 17 | launch program with the tray menu disabled 18 | .TP 19 | \fB\-h\fR, \fB\-\-help\fR 20 | display this help and exit 21 | .TP 22 | \fB\-v\fR, \fB\-\-version\fR 23 | output version information and exit 24 | .TP 25 | \fB\-\-profile\fR \fI\fR 26 | use specified profile as default for selected controllers. Defaults to all controllers. 27 | .TP 28 | \fB\-\-profile\-controller\fR \fI\fR 29 | apply configuration file to a specific controller. can be an controller index, name, or GUID. 30 | .TP 31 | \fB\-\-hidden\fR 32 | launch program without the main window 33 | .TP 34 | \fB\-\-unload\fR \fI[]\fR 35 | unload currently enabled profile(s). Value can be a controller index, name, or GUID. 36 | .TP 37 | \fB\-\-startSet\fR \fI\fR \fI[]\fR 38 | start joysticks on a specific set. Value can be a controller index, name, or GUID. 39 | .TP 40 | \fB\-\-next\fR 41 | Advance profile loading set options. 42 | .TP 43 | \fB\-d\fR, \fB\-\-daemon\fR 44 | launch program as a daemon. 45 | .TP 46 | \fB\-\-log\-level\fR \fI{debug,info}\fR 47 | Enable logging. 48 | .TP 49 | \fB\-l\fR, \fB\-\-list\fR 50 | Print information about joysticks detected by SDL. 51 | .TP 52 | \fB\-\-map\fR \fI\fR 53 | Open game controller mapping window of selected controller. Value can be a controller index or GUID. 54 | .TP 55 | \fB\-\-eventgen\fR \fI{xtest,uinput}\fR 56 | Choose between using XTest support and uinput support for event generation. Default: xtest. 57 | 58 | .SH BUGS 59 | No known bugs. 60 | .SH AUTHOR 61 | Jeff Backus (jeff@jsbackus.com) 62 | Travis Nickles (nickles.travis@gmail.com) 63 | 64 | .SH "REPORTING BUGS" 65 | Report dir bugs to antimicro home page: https://github.com/AntiMicro/antimicro 66 | -------------------------------------------------------------------------------- /other/antimicro.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=AntiMicro 3 | Comment=Use a gamepad to control a variety of programs 4 | Name[sr]=Анти-микро 5 | Comment[sr]=Користите џојстик или играћу тастатуру за управљање различитим програмима 6 | Name[fr]=AntiMicro 7 | Comment[fr]=Utilisez une manette de jeu pour commander un logiciel 8 | Name[de]=AntiMicro 9 | Comment[de]=Nutze ein Gamepad, um Programme/Spiele zu steuern 10 | Comment[uk]=Використовуйте ігровий маніпулятор для керування програмами 11 | Exec=antimicro %f 12 | Icon=antimicro 13 | StartupNotify=true 14 | Terminal=false 15 | Type=Application 16 | Categories=Qt;Utility; 17 | MimeType=application/x-amgp; 18 | Keywords=game;controller;keyboard;joystick;mouse; 19 | -------------------------------------------------------------------------------- /other/antimicro.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | AntiMicro Profile 5 | AntiMicro профіль 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /other/appdata/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make appdata optional when installing an application. 2 | if(APPDATA) 3 | add_custom_target(appdata) 4 | 5 | file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/PO_files/") 6 | 7 | add_custom_command(TARGET appdata PRE_BUILD 8 | # Add an entry per language 9 | COMMAND msgfmt "${PROJECT_SOURCE_DIR}/other/appdata/PO_files/en.po" -o "${CMAKE_CURRENT_BINARY_DIR}/PO_files/en.mo" 10 | 11 | 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" 12 | ) 13 | 14 | # Only install an appdata file if the user requested to have one built. 15 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/antimicro.appdata.xml" DESTINATION "share/appdata") 16 | endif(APPDATA) 17 | -------------------------------------------------------------------------------- /other/appdata/antimicro.appdata.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | antimicro.desktop 5 | CC0-1.0 6 | GPL-3.0+ 7 | AntiMicro 8 | Graphical program used to map keyboard buttons and mouse controls to a gamepad 9 | 10 |

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

15 |

16 | AntiMicro was inspired by QJoyPad but has additional features. 17 |

18 |
19 | 20 | 21 | https://raw.githubusercontent.com/AntiMicro/antimicro/appdata/other/appdata/screenshots/controller_configure01.png 22 | Profile Configuration Dialog 23 | 24 | 25 | https://raw.githubusercontent.com/AntiMicro/antimicro/appdata/other/appdata/screenshots/controller_configure02.png 26 | Key Assignment Dialog 27 | 28 | 29 | https://raw.githubusercontent.com/AntiMicro/antimicro/appdata/other/appdata/screenshots/controller_mapping01.png 30 | Controller Mapping Dialog 31 | 32 | 33 | https://github.com/AntiMicro/antimicro 34 | jeff.backus_at_gmail.com 35 | 36 | ModernToolkit 37 | 38 | 39 | game 40 | controller 41 | joystick 42 | keyboard 43 | mouse 44 | 45 |
46 | -------------------------------------------------------------------------------- /other/appdata/appdata.its: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /other/appdata/screenshots/controller_configure01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/other/appdata/screenshots/controller_configure01.png -------------------------------------------------------------------------------- /other/appdata/screenshots/controller_configure02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/other/appdata/screenshots/controller_configure02.png -------------------------------------------------------------------------------- /other/appdata/screenshots/controller_mapping01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/other/appdata/screenshots/controller_mapping01.png -------------------------------------------------------------------------------- /other/scripts/build-sdl-lib.bat: -------------------------------------------------------------------------------- 1 | REM Build script used to compile SDL2. It is mainly a reference for which 2 | REM options need to be used in order to compile. 3 | 4 | REM Move to directory that contains the SDL source directory. 5 | REM Just use a static location for now. 6 | cd "C:\Users\Travis\Downloads\SDL2-Source" 7 | 8 | REM Make build directory and change cwd to build 9 | mkdir build 10 | cd build 11 | 12 | REM Generate Makefile with specific options 13 | cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="%TEMP%\SDL2" -DSDL_STATIC=OFF -DVIDEO_OPENGLES=OFF -DRENDER_D3D=OFF ..\SDL2-2.0.4 14 | 15 | REM Compile 16 | mingw32-make 17 | mingw32-make install 18 | 19 | REM Get out of build directory 20 | cd .. 21 | 22 | -------------------------------------------------------------------------------- /share/antimicro/blank.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/share/antimicro/blank.txt -------------------------------------------------------------------------------- /share/antimicro/translations/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This will ensure that the *.qm files will be stored 2 | # in the right place within the build directory. 3 | file(GLOB antimicro_TRANSLATIONS antimicro_*.ts) 4 | list(APPEND antimicro_TRANSLATIONS antimicro.ts) 5 | file(GLOB_RECURSE antimicro_BASE_SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp) 6 | file(GLOB_RECURSE antimicro_BASE_FORMS ${PROJECT_SOURCE_DIR}/src/*.ui) 7 | 8 | if(USE_QT5) 9 | if(UPDATE_TRANSLATIONS) 10 | # if(TRANS_KEEP_OBSOLETE) 11 | QT5_CREATE_TRANSLATION(antimicro_QMFILES ${antimicro_BASE_SOURCES} 12 | ${antimicro_BASE_FORMS} ${antimicro_TRANSLATIONS}) 13 | # else() 14 | # QT5_CREATE_TRANSLATION(antimicro_QMFILES ${antimicro_BASE_SOURCES} 15 | # ${antimicro_BASE_FORMS} ${antimicro_TRANSLATIONS} 16 | # OPTIONS "-no-obsolete") 17 | # endif(TRANS_KEEP_OBSOLETE) 18 | else() 19 | QT5_ADD_TRANSLATION(antimicro_QMFILES ${antimicro_TRANSLATIONS}) 20 | endif(UPDATE_TRANSLATIONS) 21 | else() 22 | if(UPDATE_TRANSLATIONS) 23 | # if(TRANS_KEEP_OBSOLETE) 24 | QT4_CREATE_TRANSLATION(antimicro_QMFILES ${antimicro_BASE_SOURCES} 25 | ${antimicro_BASE_FORMS} ${antimicro_TRANSLATIONS}) 26 | # else() 27 | # QT4_CREATE_TRANSLATION(antimicro_QMFILES ${antimicro_BASE_SOURCES} 28 | # ${antimicro_BASE_FORMS} ${antimicro_TRANSLATIONS} 29 | # OPTIONS "-no-obsolete") 30 | # endif(TRANS_KEEP_OBSOLETE) 31 | else() 32 | QT4_ADD_TRANSLATION(antimicro_QMFILES ${antimicro_TRANSLATIONS}) 33 | endif(UPDATE_TRANSLATIONS) 34 | endif(USE_QT5) 35 | 36 | add_custom_target(updateqm DEPENDS ${antimicro_QMFILES}) 37 | install(FILES ${antimicro_QMFILES} DESTINATION "share/antimicro/translations") 38 | 39 | set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM true) 40 | -------------------------------------------------------------------------------- /share/blank.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/share/blank.txt -------------------------------------------------------------------------------- /src/aboutdialog.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef ABOUTDIALOG_H 19 | #define ABOUTDIALOG_H 20 | 21 | #include 22 | 23 | namespace Ui { 24 | class AboutDialog; 25 | } 26 | 27 | class AboutDialog : public QDialog 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | explicit AboutDialog(QWidget *parent = 0); 33 | ~AboutDialog(); 34 | 35 | private: 36 | Ui::AboutDialog *ui; 37 | 38 | protected: 39 | void fillInfoTextBrowser(); 40 | virtual void changeEvent(QEvent *event); 41 | void retranslateUi(); 42 | }; 43 | 44 | #endif // ABOUTDIALOG_H 45 | -------------------------------------------------------------------------------- /src/antimicro.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | antimicro 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/antimicro.exe.uiaccess.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | antimicro 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/antimicro.rc: -------------------------------------------------------------------------------- 1 | #include "winuser.h" 2 | 3 | IDI_ICON1 ICON DISCARDABLE "images/antimicro.ico" 4 | #ifndef PERFORM_SIGNING 5 | CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "antimicro.exe.manifest" 6 | #else 7 | CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "antimicro.exe.uiaccess.manifest" 8 | #endif 9 | -------------------------------------------------------------------------------- /src/antimicrosettings.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef ANTIMICROSETTINGS_H 19 | #define ANTIMICROSETTINGS_H 20 | 21 | #include 22 | #include 23 | 24 | #include "commandlineutility.h" 25 | 26 | class AntiMicroSettings : public QSettings 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit AntiMicroSettings(const QString &fileName, Format format, QObject *parent = 0); 31 | 32 | QVariant runtimeValue(const QString &key, const QVariant &defaultValue = QVariant()) const; 33 | void importFromCommandLine(CommandLineUtility &cmdutility); 34 | QMutex* getLock(); 35 | 36 | static const bool defaultDisabledWinEnhanced; 37 | static const bool defaultAssociateProfiles; 38 | static const int defaultSpringScreen; 39 | static const unsigned int defaultSDLGamepadPollRate; 40 | 41 | protected: 42 | QSettings cmdSettings; 43 | QMutex lock; 44 | 45 | signals: 46 | 47 | public slots: 48 | 49 | }; 50 | 51 | #endif // ANTIMICROSETTINGS_H 52 | -------------------------------------------------------------------------------- /src/antkeymapper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef ANTKEYMAPPER_H 19 | #define ANTKEYMAPPER_H 20 | 21 | #include 22 | 23 | #ifdef Q_OS_WIN 24 | #include "qtwinkeymapper.h" 25 | 26 | #ifdef WITH_VMULTI 27 | #include "qtvmultikeymapper.h" 28 | #endif 29 | #else 30 | 31 | #if defined(WITH_XTEST) 32 | #include "qtx11keymapper.h" 33 | #endif 34 | 35 | #if defined(WITH_UINPUT) 36 | #include "qtuinputkeymapper.h" 37 | #endif 38 | #endif 39 | 40 | class AntKeyMapper : public QObject 41 | { 42 | Q_OBJECT 43 | public: 44 | static AntKeyMapper* getInstance(QString handler = ""); 45 | void deleteInstance(); 46 | 47 | unsigned int returnVirtualKey(unsigned int qkey); 48 | unsigned int returnQtKey(unsigned int key, unsigned int scancode=0); 49 | bool isModifierKey(unsigned int qkey); 50 | QtKeyMapperBase* getNativeKeyMapper(); 51 | QtKeyMapperBase* getKeyMapper(); 52 | bool hasNativeKeyMapper(); 53 | 54 | protected: 55 | explicit AntKeyMapper(QString handler = "", QObject *parent = 0); 56 | 57 | static AntKeyMapper *_instance; 58 | QtKeyMapperBase *internalMapper; 59 | QtKeyMapperBase *nativeKeyMapper; 60 | 61 | #ifdef Q_OS_WIN 62 | QtWinKeyMapper winMapper; 63 | 64 | #ifdef WITH_VMULTI 65 | QtVMultiKeyMapper vmultiMapper; 66 | #endif 67 | 68 | #else 69 | #if defined(WITH_XTEST) 70 | QtX11KeyMapper x11Mapper; 71 | #endif 72 | 73 | #if defined(WITH_UINPUT) 74 | QtUInputKeyMapper uinputMapper; 75 | #endif 76 | 77 | #endif 78 | 79 | signals: 80 | 81 | public slots: 82 | 83 | }; 84 | 85 | #endif // ANTKEYMAPPER_H 86 | -------------------------------------------------------------------------------- /src/applaunchhelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef APPLAUNCHHELPER_H 19 | #define APPLAUNCHHELPER_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #include "inputdevice.h" 26 | #include "joybutton.h" 27 | #include "antimicrosettings.h" 28 | 29 | class AppLaunchHelper : public QObject 30 | { 31 | Q_OBJECT 32 | public: 33 | explicit AppLaunchHelper(AntiMicroSettings *settings, bool graphical=false, 34 | QObject *parent=0); 35 | 36 | void printControllerList(QMap *joysticks); 37 | 38 | protected: 39 | void enablePossibleMouseSmoothing(); 40 | void establishMouseTimerConnections(); 41 | void changeMouseRefreshRate(); 42 | void changeSpringModeScreen(); 43 | void changeGamepadPollRate(); 44 | #ifdef Q_OS_WIN 45 | void checkPointerPrecision(); 46 | #endif 47 | 48 | AntiMicroSettings *settings; 49 | bool graphical; 50 | 51 | signals: 52 | 53 | public slots: 54 | #ifdef Q_OS_WIN 55 | void appQuitPointerPrecision(); 56 | #endif 57 | 58 | void initRunMethods(); 59 | void revertMouseThread(); 60 | void changeMouseThread(QThread *thread); 61 | }; 62 | 63 | #endif // APPLAUNCHHELPER_H 64 | -------------------------------------------------------------------------------- /src/autoprofileinfo.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef AUTOPROFILEINFO_H 19 | #define AUTOPROFILEINFO_H 20 | 21 | #include 22 | #include 23 | 24 | class AutoProfileInfo : public QObject 25 | { 26 | Q_OBJECT 27 | public: 28 | explicit AutoProfileInfo(QString guid, QString profileLocation, 29 | bool active, QObject *parent = 0); 30 | explicit AutoProfileInfo(QString guid, QString profileLocation, 31 | QString exe, bool active, QObject *parent = 0); 32 | explicit AutoProfileInfo(QObject *parent=0); 33 | ~AutoProfileInfo(); 34 | 35 | void setGUID(QString guid); 36 | QString getGUID(); 37 | 38 | void setProfileLocation(QString profileLocation); 39 | QString getProfileLocation(); 40 | 41 | void setExe(QString exe); 42 | QString getExe(); 43 | 44 | void setWindowClass(QString windowClass); 45 | QString getWindowClass(); 46 | 47 | void setWindowName(QString winName); 48 | QString getWindowName(); 49 | 50 | void setActive(bool active); 51 | bool isActive(); 52 | 53 | void setDeviceName(QString name); 54 | QString getDeviceName(); 55 | 56 | void setDefaultState(bool value); 57 | bool isCurrentDefault(); 58 | 59 | protected: 60 | QString guid; 61 | QString profileLocation; 62 | QString exe; 63 | QString deviceName; 64 | QString windowClass; 65 | QString windowName; 66 | bool active; 67 | bool defaultState; 68 | 69 | signals: 70 | 71 | public slots: 72 | 73 | }; 74 | 75 | Q_DECLARE_METATYPE(AutoProfileInfo*) 76 | 77 | #endif // AUTOPROFILEINFO_H 78 | -------------------------------------------------------------------------------- /src/axisvaluebox.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef AXISVALUEBOX_H 19 | #define AXISVALUEBOX_H 20 | 21 | #include 22 | 23 | class AxisValueBox : public QWidget 24 | { 25 | Q_OBJECT 26 | public: 27 | explicit AxisValueBox(QWidget *parent = 0); 28 | 29 | int getDeadZone(); 30 | int getMaxZone(); 31 | int getJoyValue(); 32 | int getThrottle(); 33 | 34 | protected: 35 | virtual void resizeEvent(QResizeEvent *event); 36 | virtual void paintEvent(QPaintEvent *event); 37 | 38 | int deadZone; 39 | int maxZone; 40 | int joyValue; 41 | int throttle; 42 | int boxwidth; 43 | int boxheight; 44 | int lboxstart; 45 | int lboxend; 46 | int rboxstart; 47 | int rboxend; 48 | int singlewidth; 49 | int singleend; 50 | 51 | signals: 52 | 53 | public slots: 54 | void setThrottle(int throttle); 55 | void setValue(int value); 56 | void setDeadZone(int deadZone); 57 | void setMaxZone(int maxZone); 58 | 59 | }; 60 | 61 | #endif // AXISVALUEBOX_H 62 | -------------------------------------------------------------------------------- /src/capturedwindowinfodialog.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef UNIXWINDOWINFODIALOG_H 19 | #define UNIXWINDOWINFODIALOG_H 20 | 21 | #include 22 | #include 23 | 24 | namespace Ui { 25 | class CapturedWindowInfoDialog; 26 | } 27 | 28 | class CapturedWindowInfoDialog : public QDialog 29 | { 30 | Q_OBJECT 31 | 32 | public: 33 | 34 | #ifdef Q_OS_WIN 35 | explicit CapturedWindowInfoDialog(QWidget *parent = 0); 36 | #else 37 | explicit CapturedWindowInfoDialog(unsigned long window, QWidget *parent = 0); 38 | #endif 39 | 40 | ~CapturedWindowInfoDialog(); 41 | 42 | enum { 43 | WindowNone = 0, 44 | WindowClass = (1 << 0), 45 | WindowName = (1 << 1), 46 | WindowPath = (1 << 2), 47 | }; 48 | typedef unsigned int CapturedWindowOption; 49 | 50 | QString getWindowClass(); 51 | QString getWindowName(); 52 | QString getWindowPath(); 53 | bool useFullWindowPath(); 54 | CapturedWindowOption getSelectedOptions(); 55 | 56 | private: 57 | Ui::CapturedWindowInfoDialog *ui; 58 | 59 | protected: 60 | CapturedWindowOption selectedMatch; 61 | 62 | QString winClass; 63 | QString winName; 64 | QString winPath; 65 | bool fullWinPath; 66 | 67 | private slots: 68 | void populateOption(); 69 | }; 70 | 71 | #endif // UNIXWINDOWINFODIALOG_H 72 | -------------------------------------------------------------------------------- /src/config.h.in: -------------------------------------------------------------------------------- 1 | #ifndef CONFIG_H 2 | #define CONFIG_H 3 | 4 | #define PROJECT_MAJOR_VERSION @ANTIMICRO_MAJOR_VERSION@ 5 | #define PROJECT_MINOR_VERSION @ANTIMICRO_MINOR_VERSION@ 6 | #define PROJECT_PATCH_VERSION @ANTIMICRO_PATCH_VERSION@ 7 | 8 | #endif // CONFIG_H 9 | -------------------------------------------------------------------------------- /src/dpadcontextmenu.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DPADCONTEXTMENU_H 19 | #define DPADCONTEXTMENU_H 20 | 21 | #include 22 | 23 | #include "joydpad.h" 24 | 25 | #include "uihelpers/dpadcontextmenuhelper.h" 26 | 27 | class DPadContextMenu : public QMenu 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit DPadContextMenu(JoyDPad *dpad, QWidget *parent = 0); 32 | void buildMenu(); 33 | 34 | protected: 35 | int getPresetIndex(); 36 | 37 | JoyDPad *dpad; 38 | DPadContextMenuHelper helper; 39 | 40 | signals: 41 | 42 | public slots: 43 | 44 | private slots: 45 | void setDPadPreset(); 46 | void setDPadMode(); 47 | void openMouseSettingsDialog(); 48 | }; 49 | 50 | #endif // DPADCONTEXTMENU_H 51 | -------------------------------------------------------------------------------- /src/dpadeditdialog.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DPADEDITDIALOG_H 19 | #define DPADEDITDIALOG_H 20 | 21 | #include 22 | 23 | #include "joydpad.h" 24 | #include "uihelpers/dpadeditdialoghelper.h" 25 | 26 | namespace Ui { 27 | class DPadEditDialog; 28 | } 29 | 30 | class DPadEditDialog : public QDialog 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit DPadEditDialog(JoyDPad *dpad, QWidget *parent = 0); 36 | ~DPadEditDialog(); 37 | 38 | protected: 39 | void selectCurrentPreset(); 40 | 41 | JoyDPad *dpad; 42 | DPadEditDialogHelper helper; 43 | 44 | private: 45 | Ui::DPadEditDialog *ui; 46 | 47 | private slots: 48 | void implementPresets(int index); 49 | void implementModes(int index); 50 | void openMouseSettingsDialog(); 51 | void enableMouseSettingButton(); 52 | void updateWindowTitleDPadName(); 53 | void updateDPadDelaySpinBox(int value); 54 | void updateDPadDelaySlider(double value); 55 | }; 56 | 57 | #endif // DPADEDITDIALOG_H 58 | -------------------------------------------------------------------------------- /src/dpadpushbutton.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DPADPUSHBUTTON_H 19 | #define DPADPUSHBUTTON_H 20 | 21 | #include 22 | 23 | #include "flashbuttonwidget.h" 24 | #include "joydpad.h" 25 | 26 | class DPadPushButton : public FlashButtonWidget 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | explicit DPadPushButton(JoyDPad *dpad, bool displayNames, QWidget *parent = 0); 32 | 33 | JoyDPad* getDPad(); 34 | void tryFlash(); 35 | 36 | protected: 37 | QString generateLabel(); 38 | 39 | JoyDPad *dpad; 40 | 41 | signals: 42 | 43 | public slots: 44 | void disableFlashes(); 45 | void enableFlashes(); 46 | 47 | private slots: 48 | void showContextMenu(const QPoint &point); 49 | }; 50 | 51 | #endif // DPADPUSHBUTTON_H 52 | -------------------------------------------------------------------------------- /src/dpadpushbuttongroup.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DPADPUSHBUTTONGROUP_H 19 | #define DPADPUSHBUTTONGROUP_H 20 | 21 | #include 22 | 23 | #include "joydpad.h" 24 | #include "joydpadbuttonwidget.h" 25 | #include "dpadpushbutton.h" 26 | 27 | class DPadPushButtonGroup : public QGridLayout 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit DPadPushButtonGroup(JoyDPad *dpad, bool displayNames = false, QWidget *parent = 0); 32 | 33 | JoyDPad *getDPad(); 34 | 35 | protected: 36 | void generateButtons(); 37 | 38 | JoyDPad *dpad; 39 | bool displayNames; 40 | 41 | JoyDPadButtonWidget *upButton; 42 | JoyDPadButtonWidget *downButton; 43 | JoyDPadButtonWidget *leftButton; 44 | JoyDPadButtonWidget *rightButton; 45 | 46 | JoyDPadButtonWidget *upLeftButton; 47 | JoyDPadButtonWidget *upRightButton; 48 | JoyDPadButtonWidget *downLeftButton; 49 | JoyDPadButtonWidget *downRightButton; 50 | 51 | DPadPushButton *dpadWidget; 52 | 53 | signals: 54 | void buttonSlotChanged(); 55 | 56 | public slots: 57 | void changeButtonLayout(); 58 | void toggleNameDisplay(); 59 | 60 | private slots: 61 | void propogateSlotsChanged(); 62 | void openDPadButtonDialog(); 63 | void showDPadDialog(); 64 | }; 65 | 66 | #endif // DPADPUSHBUTTONGROUP_H 67 | -------------------------------------------------------------------------------- /src/editalldefaultautoprofiledialog.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef EDITALLDEFAULTAUTOPROFILEDIALOG_H 19 | #define EDITALLDEFAULTAUTOPROFILEDIALOG_H 20 | 21 | #include 22 | 23 | #include "autoprofileinfo.h" 24 | #include "antimicrosettings.h" 25 | 26 | namespace Ui { 27 | class EditAllDefaultAutoProfileDialog; 28 | } 29 | 30 | class EditAllDefaultAutoProfileDialog : public QDialog 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit EditAllDefaultAutoProfileDialog(AutoProfileInfo *info, AntiMicroSettings *settings, 36 | QWidget *parent = 0); 37 | ~EditAllDefaultAutoProfileDialog(); 38 | 39 | AutoProfileInfo* getAutoProfile(); 40 | 41 | protected: 42 | virtual void accept(); 43 | 44 | AutoProfileInfo *info; 45 | AntiMicroSettings *settings; 46 | 47 | private: 48 | Ui::EditAllDefaultAutoProfileDialog *ui; 49 | 50 | private slots: 51 | void openProfileBrowseDialog(); 52 | void saveAutoProfileInformation(); 53 | }; 54 | 55 | #endif // EDITALLDEFAULTAUTOPROFILEDIALOG_H 56 | -------------------------------------------------------------------------------- /src/event.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef EVENT_H 19 | #define EVENT_H 20 | 21 | #include 22 | 23 | #include "joybuttonslot.h" 24 | //#include "mousehelper.h" 25 | #include "springmousemoveinfo.h" 26 | #include "common.h" 27 | 28 | void sendevent (JoyButtonSlot *slot, bool pressed=true); 29 | void sendevent(int code1, int code2); 30 | void sendSpringEventRefactor(PadderCommon::springModeInfo *fullSpring, 31 | PadderCommon::springModeInfo *relativeSpring=0, 32 | int* const mousePosX=0, int* const mousePos=0); 33 | 34 | void sendSpringEvent(PadderCommon::springModeInfo *fullSpring, 35 | PadderCommon::springModeInfo *relativeSpring=0, 36 | int* const mousePosX=0, int* const mousePos=0); 37 | 38 | int X11KeySymToKeycode(QString key); 39 | QString keycodeToKeyString(int keycode, unsigned int alias=0); 40 | unsigned int X11KeyCodeToX11KeySym(unsigned int keycode); 41 | QString keysymToKeyString(int keysym, unsigned int alias=0); 42 | 43 | #endif // EVENT_H 44 | -------------------------------------------------------------------------------- /src/eventhandlers/baseeventhandler.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef BASEEVENTHANDLER_H 19 | #define BASEEVENTHANDLER_H 20 | 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | 27 | class BaseEventHandler : public QObject 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit BaseEventHandler(QObject *parent = 0); 32 | 33 | virtual bool init() = 0; 34 | virtual bool cleanup() = 0; 35 | 36 | virtual void sendKeyboardEvent(JoyButtonSlot *slot, bool pressed) = 0; 37 | virtual void sendMouseButtonEvent(JoyButtonSlot *slot, bool pressed) = 0; 38 | virtual void sendMouseEvent(int xDis, int yDis) = 0; 39 | virtual void sendMouseAbsEvent(int xDis, int yDis, int screen); 40 | 41 | virtual void sendMouseSpringEvent(unsigned int xDis, unsigned int yDis, 42 | unsigned int width, unsigned int height); 43 | virtual void sendMouseSpringEvent(int xDis, int yDis); 44 | 45 | virtual void sendTextEntryEvent(QString maintext); 46 | 47 | virtual QString getName() = 0; 48 | virtual QString getIdentifier() = 0; 49 | virtual void printPostMessages(); 50 | QString getErrorString(); 51 | 52 | 53 | protected: 54 | QString lastErrorString; 55 | 56 | signals: 57 | 58 | public slots: 59 | 60 | }; 61 | 62 | #endif // BASEEVENTHANDLER_H 63 | -------------------------------------------------------------------------------- /src/eventhandlers/winsendinputeventhandler.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef WINSENDINPUTEVENTHANDLER_H 19 | #define WINSENDINPUTEVENTHANDLER_H 20 | 21 | #include 22 | 23 | #include "baseeventhandler.h" 24 | 25 | #include 26 | 27 | 28 | class WinSendInputEventHandler : public BaseEventHandler 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit WinSendInputEventHandler(QObject *parent = 0); 33 | 34 | virtual bool init(); 35 | virtual bool cleanup(); 36 | virtual void sendKeyboardEvent(JoyButtonSlot *slot, bool pressed); 37 | virtual void sendMouseButtonEvent(JoyButtonSlot *slot, bool pressed); 38 | virtual void sendMouseEvent(int xDis, int yDis); 39 | virtual void sendMouseSpringEvent(unsigned int xDis, unsigned int yDis, 40 | unsigned int width, unsigned int height); 41 | virtual void sendTextEntryEvent(QString maintext); 42 | 43 | virtual QString getName(); 44 | virtual QString getIdentifier(); 45 | 46 | signals: 47 | 48 | public slots: 49 | 50 | }; 51 | 52 | #endif // WINSENDINPUTEVENTHANDLER_H 53 | -------------------------------------------------------------------------------- /src/eventhandlers/xtesteventhandler.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef XTESTEVENTHANDLER_H 19 | #define XTESTEVENTHANDLER_H 20 | 21 | #include "baseeventhandler.h" 22 | 23 | #include 24 | 25 | class XTestEventHandler : public BaseEventHandler 26 | { 27 | Q_OBJECT 28 | public: 29 | explicit XTestEventHandler(QObject *parent = 0); 30 | 31 | virtual bool init(); 32 | virtual bool cleanup(); 33 | virtual void sendKeyboardEvent(JoyButtonSlot *slot, bool pressed); 34 | virtual void sendMouseButtonEvent(JoyButtonSlot *slot, bool pressed); 35 | virtual void sendMouseEvent(int xDis, int yDis); 36 | virtual void sendMouseAbsEvent(int xDis, int yDis, int screen); 37 | 38 | virtual QString getName(); 39 | virtual QString getIdentifier(); 40 | 41 | virtual void sendTextEntryEvent(QString maintext); 42 | 43 | signals: 44 | 45 | public slots: 46 | 47 | }; 48 | 49 | #endif // XTESTEVENTHANDLER_H 50 | -------------------------------------------------------------------------------- /src/extraprofilesettingsdialog.cpp: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | //#include 19 | 20 | #include "extraprofilesettingsdialog.h" 21 | #include "ui_extraprofilesettingsdialog.h" 22 | 23 | ExtraProfileSettingsDialog::ExtraProfileSettingsDialog(InputDevice *device, QWidget *parent) : 24 | QDialog(parent), 25 | ui(new Ui::ExtraProfileSettingsDialog) 26 | { 27 | ui->setupUi(this); 28 | setAttribute(Qt::WA_DeleteOnClose); 29 | 30 | this->device = device; 31 | 32 | ui->pressValueLabel->setText(QString::number(0.10, 'g', 3).append("").append(tr("s"))); 33 | if (device->getDeviceKeyPressTime() > 0) 34 | { 35 | int temppress = device->getDeviceKeyPressTime(); 36 | ui->keyPressHorizontalSlider->setValue(device->getDeviceKeyPressTime() / 10); 37 | ui->pressValueLabel->setText(QString::number(temppress / 1000.0, 'g', 3).append("").append(tr("s"))); 38 | } 39 | 40 | if (!device->getProfileName().isEmpty()) 41 | { 42 | ui->profileNameLineEdit->setText(device->getProfileName()); 43 | } 44 | 45 | connect(ui->keyPressHorizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(changeDeviceKeyPress(int))); 46 | connect(ui->profileNameLineEdit, SIGNAL(textChanged(QString)), device, SLOT(setProfileName(QString))); 47 | } 48 | 49 | ExtraProfileSettingsDialog::~ExtraProfileSettingsDialog() 50 | { 51 | delete ui; 52 | } 53 | 54 | void ExtraProfileSettingsDialog::changeDeviceKeyPress(int value) 55 | { 56 | int temppress = value * 10; 57 | device->setDeviceKeyPressTime(temppress); 58 | ui->pressValueLabel->setText(QString::number(temppress / 1000.0, 'g', 3).append("").append(tr("s"))); 59 | } 60 | -------------------------------------------------------------------------------- /src/extraprofilesettingsdialog.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef KEYDELAYDIALOG_H 19 | #define KEYDELAYDIALOG_H 20 | 21 | #include 22 | 23 | #include "inputdevice.h" 24 | 25 | namespace Ui { 26 | class ExtraProfileSettingsDialog; 27 | } 28 | 29 | class ExtraProfileSettingsDialog : public QDialog 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | explicit ExtraProfileSettingsDialog(InputDevice *device, QWidget *parent = 0); 35 | ~ExtraProfileSettingsDialog(); 36 | 37 | protected: 38 | InputDevice *device; 39 | 40 | private: 41 | Ui::ExtraProfileSettingsDialog *ui; 42 | 43 | private slots: 44 | void changeDeviceKeyPress(int value); 45 | }; 46 | 47 | #endif // KEYDELAYDIALOG_H 48 | -------------------------------------------------------------------------------- /src/flashbuttonwidget.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef FLASHBUTTONWIDGET_H 19 | #define FLASHBUTTONWIDGET_H 20 | 21 | #include 22 | #include 23 | 24 | class FlashButtonWidget : public QPushButton 25 | { 26 | Q_OBJECT 27 | Q_PROPERTY(bool isflashing READ isButtonFlashing) 28 | 29 | public: 30 | explicit FlashButtonWidget(QWidget *parent = 0); 31 | explicit FlashButtonWidget(bool displayNames, QWidget *parent = 0); 32 | 33 | bool isButtonFlashing(); 34 | void setDisplayNames(bool display); 35 | bool isDisplayingNames(); 36 | 37 | protected: 38 | virtual void paintEvent(QPaintEvent *event); 39 | virtual QString generateLabel() = 0; 40 | virtual void retranslateUi(); 41 | 42 | bool isflashing; 43 | bool displayNames; 44 | bool leftAlignText; 45 | 46 | signals: 47 | void flashed(bool flashing); 48 | 49 | public slots: 50 | void refreshLabel(); 51 | void toggleNameDisplay(); 52 | virtual void disableFlashes() = 0; 53 | virtual void enableFlashes() = 0; 54 | 55 | protected slots: 56 | void flash(); 57 | void unflash(); 58 | }; 59 | 60 | #endif // FLASHBUTTONWIDGET_H 61 | -------------------------------------------------------------------------------- /src/gamecontroller/gamecontrollerdpad.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef GAMECONTROLLERDPAD_H 19 | #define GAMECONTROLLERDPAD_H 20 | 21 | #include 22 | 23 | #include "vdpad.h" 24 | 25 | class GameControllerDPad : public VDPad 26 | { 27 | Q_OBJECT 28 | public: 29 | explicit GameControllerDPad(JoyButton *upButton, JoyButton *downButton, JoyButton *leftButton, JoyButton *rightButton, 30 | int index, int originset, SetJoystick *parentSet, QObject *parent = 0); 31 | 32 | virtual QString getName(bool forceFullFormat, bool displayName); 33 | virtual QString getXmlName(); 34 | 35 | void readJoystickConfig(QXmlStreamReader *xml); 36 | 37 | static const QString xmlName; 38 | 39 | signals: 40 | 41 | public slots: 42 | 43 | }; 44 | 45 | #endif // GAMECONTROLLERDPAD_H 46 | -------------------------------------------------------------------------------- /src/gamecontroller/gamecontrollerset.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef GAMECONTROLLERSET_H 19 | #define GAMECONTROLLERSET_H 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include 27 | 28 | #include 29 | #include "gamecontrollerdpad.h" 30 | #include "gamecontrollertrigger.h" 31 | 32 | class GameControllerSet : public SetJoystick 33 | { 34 | Q_OBJECT 35 | public: 36 | explicit GameControllerSet(InputDevice *device, int index, QObject *parent = 0); 37 | 38 | virtual void refreshAxes(); 39 | 40 | virtual void readConfig(QXmlStreamReader *xml); 41 | virtual void readJoystickConfig(QXmlStreamReader *xml, 42 | QHash &buttons, 43 | QHash &axes, 44 | QList &hatButtons); 45 | 46 | protected: 47 | void populateSticksDPad(); 48 | 49 | signals: 50 | 51 | public slots: 52 | virtual void reset(); 53 | }; 54 | 55 | #endif // GAMECONTROLLERSET_H 56 | -------------------------------------------------------------------------------- /src/gamecontroller/gamecontrollertrigger.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef GAMECONTROLLERTRIGGER_H 19 | #define GAMECONTROLLERTRIGGER_H 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include 27 | 28 | #include "gamecontrollertriggerbutton.h" 29 | #include 30 | 31 | class GameControllerTrigger : public JoyAxis 32 | { 33 | Q_OBJECT 34 | public: 35 | explicit GameControllerTrigger(int index, int originset, SetJoystick *parentSet, QObject *parent = 0); 36 | 37 | virtual QString getXmlName(); 38 | virtual QString getPartialName(bool forceFullFormat, bool displayNames); 39 | 40 | virtual int getDefaultDeadZone(); 41 | virtual int getDefaultMaxZone(); 42 | virtual ThrottleTypes getDefaultThrottle(); 43 | 44 | void readJoystickConfig(QXmlStreamReader *xml); 45 | 46 | virtual void writeConfig(QXmlStreamWriter *xml); 47 | 48 | static const int AXISDEADZONE; 49 | static const int AXISMAXZONE; 50 | static const ThrottleTypes DEFAULTTHROTTLE; 51 | 52 | static const QString xmlName; 53 | 54 | protected: 55 | void correctJoystickThrottle(); 56 | 57 | signals: 58 | 59 | public slots: 60 | 61 | }; 62 | 63 | #endif // GAMECONTROLLERTRIGGER_H 64 | -------------------------------------------------------------------------------- /src/gamecontroller/gamecontrollertriggerbutton.cpp: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | 21 | #include "gamecontrollertriggerbutton.h" 22 | 23 | const QString GameControllerTriggerButton::xmlName = "triggerbutton"; 24 | 25 | GameControllerTriggerButton::GameControllerTriggerButton(JoyAxis *axis, int index, int originset, SetJoystick *parentSet, QObject *parent) : 26 | JoyAxisButton(axis, index, originset, parentSet, parent) 27 | { 28 | } 29 | 30 | QString GameControllerTriggerButton::getXmlName() 31 | { 32 | return this->xmlName; 33 | } 34 | 35 | void GameControllerTriggerButton::readJoystickConfig(QXmlStreamReader *xml) 36 | { 37 | if (xml->isStartElement() && xml->name() == JoyAxisButton::xmlName) 38 | { 39 | disconnect(this, SIGNAL(slotsChanged()), parentSet->getInputDevice(), SLOT(profileEdited())); 40 | 41 | xml->readNextStartElement(); 42 | while (!xml->atEnd() && (!xml->isEndElement() && xml->name() != JoyAxisButton::xmlName)) 43 | { 44 | bool found = readButtonConfig(xml); 45 | if (!found) 46 | { 47 | xml->skipCurrentElement(); 48 | } 49 | 50 | xml->readNextStartElement(); 51 | } 52 | 53 | connect(this, SIGNAL(slotsChanged()), parentSet->getInputDevice(), SLOT(profileEdited())); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/gamecontroller/gamecontrollertriggerbutton.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef GAMECONTROLLERBUTTON_H 19 | #define GAMECONTROLLERBUTTON_H 20 | 21 | #include 22 | #include 23 | 24 | #include 25 | 26 | class GameControllerTriggerButton : public JoyAxisButton 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit GameControllerTriggerButton(JoyAxis *axis, int index, int originset, SetJoystick *parentSet, QObject *parent = 0); 31 | 32 | virtual QString getXmlName(); 33 | void readJoystickConfig(QXmlStreamReader *xml); 34 | 35 | static const QString xmlName; 36 | 37 | signals: 38 | 39 | public slots: 40 | 41 | }; 42 | 43 | #endif // GAMECONTROLLERBUTTON_H 44 | -------------------------------------------------------------------------------- /src/gamecontrollerexample.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef GAMECONTROLLEREXAMPLE_H 19 | #define GAMECONTROLLEREXAMPLE_H 20 | 21 | #include 22 | #include 23 | 24 | class GameControllerExample : public QWidget 25 | { 26 | Q_OBJECT 27 | public: 28 | explicit GameControllerExample(QWidget *parent = 0); 29 | 30 | enum ButtonType { 31 | Button, AxisX, AxisY, 32 | }; 33 | 34 | static const unsigned int MAXBUTTONINDEX = 20; 35 | 36 | protected: 37 | virtual void paintEvent(QPaintEvent *event); 38 | 39 | QImage controllerimage; 40 | QImage buttonimage; 41 | QImage axisimage; 42 | QImage rotatedaxisimage; 43 | int currentIndex; 44 | 45 | signals: 46 | void indexUpdated(int index); 47 | 48 | public slots: 49 | void setActiveButton(int button); 50 | }; 51 | 52 | #endif // GAMECONTROLLEREXAMPLE_H 53 | -------------------------------------------------------------------------------- /src/icons/16x16/actions/application-exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/application-exit.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/archive-insert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/archive-insert.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/dialog-cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/dialog-cancel.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/dialog-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/dialog-close.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/dialog-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/dialog-ok.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/dialog-warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/dialog-warning.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/document-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/document-close.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/document-open-folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/document-open-folder.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/document-open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/document-open.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/document-revert-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/document-revert-small.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/document-revert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/document-revert.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/document-save-as.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/document-save-as.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/document-save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/document-save.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/edit-clear-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/edit-clear-list.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/edit-clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/edit-clear.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/edit-delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/edit-delete.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/edit-select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/edit-select.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/edit-table-delete-row.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/edit-table-delete-row.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/edit-table-insert-row-below.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/edit-table-insert-row-below.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/games-config-custom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/games-config-custom.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/games-config-options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/games-config-options.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/help-about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/help-about.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/text-field.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/text-field.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/view-fullscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/view-fullscreen.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/view-refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/view-refresh.png -------------------------------------------------------------------------------- /src/icons/16x16/actions/view-restore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/icons/16x16/actions/view-restore.png -------------------------------------------------------------------------------- /src/icons/README.txt: -------------------------------------------------------------------------------- 1 | The icons bundled with this application are using icons bundled primarily 2 | with the Mist icon theme. These icons are licensed under the 3 | LGPL version 2.1. The assests for the Mist icon theme, bundled in with 4 | the full gnome-themes package, can be found 5 | at http://ftp.gnome.org/pub/GNOME/sources/gnome-themes/. 6 | The full text of the LGPL version 2.1 license can be read in the 7 | included lgpl-2.1.txt file. 8 | 9 | Any icons not bundled with Mist are from the Oxygen icon theme. Those icons 10 | are licensed under the LGPL version 3. The full text of the LGPL version 3 11 | license can be read in the included lgpl-3.0.txt file. The full Oxygen icon 12 | theme can be downloaded from 13 | http://download.kde.org/stable/4.10.2/src/oxygen-icons-4.10.2.tar.xz. 14 | Additionally, you can got the Oxygen theme website located at 15 | http://www.oxygen-icons.org/. -------------------------------------------------------------------------------- /src/icons/index.theme: -------------------------------------------------------------------------------- 1 | [Icon Theme] 2 | Directories=16x16/actions 3 | 4 | [16x16/actions] 5 | Size=16 6 | Context=Actions 7 | Type=Fixed 8 | -------------------------------------------------------------------------------- /src/images/antimicro.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/images/antimicro.ico -------------------------------------------------------------------------------- /src/images/antimicro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/images/antimicro.png -------------------------------------------------------------------------------- /src/images/antimicro_trayicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/images/antimicro_trayicon.png -------------------------------------------------------------------------------- /src/images/axis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/images/axis.png -------------------------------------------------------------------------------- /src/images/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/images/button.png -------------------------------------------------------------------------------- /src/images/controllermap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/images/controllermap.png -------------------------------------------------------------------------------- /src/images/profile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiMicro/antimicro/346ed1524b7fedf6f0a65be3644818bd83fe1848/src/images/profile.jpg -------------------------------------------------------------------------------- /src/inputdevicebitarraystatus.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef INPUTDEVICESTATUSEVENT_H 19 | #define INPUTDEVICESTATUSEVENT_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #include "inputdevice.h" 26 | 27 | class InputDeviceBitArrayStatus : public QObject 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit InputDeviceBitArrayStatus(InputDevice *device, bool readCurrent = true, QObject *parent = 0); 32 | 33 | void changeAxesStatus(int axisIndex, bool value); 34 | void changeButtonStatus(int buttonIndex, bool value); 35 | void changeHatStatus(int hatIndex, bool value); 36 | 37 | QBitArray generateFinalBitArray(); 38 | void clearStatusValues(); 39 | 40 | protected: 41 | QList axesStatus; 42 | QList hatButtonStatus; 43 | QBitArray buttonStatus; 44 | 45 | signals: 46 | 47 | public slots: 48 | 49 | }; 50 | 51 | #endif // INPUTDEVICESTATUSEVENT_H 52 | -------------------------------------------------------------------------------- /src/joyaxiscontextmenu.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYAXISCONTEXTMENU_H 19 | #define JOYAXISCONTEXTMENU_H 20 | 21 | #include 22 | 23 | #include "joyaxis.h" 24 | #include "uihelpers/joyaxiscontextmenuhelper.h" 25 | 26 | class JoyAxisContextMenu : public QMenu 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit JoyAxisContextMenu(JoyAxis *axis, QWidget *parent = 0); 31 | void buildMenu(); 32 | void buildAxisMenu(); 33 | void buildTriggerMenu(); 34 | 35 | protected: 36 | int getPresetIndex(); 37 | int getTriggerPresetIndex(); 38 | 39 | JoyAxis *axis; 40 | JoyAxisContextMenuHelper helper; 41 | 42 | signals: 43 | 44 | public slots: 45 | 46 | private slots: 47 | void setAxisPreset(); 48 | void setTriggerPreset(); 49 | void openMouseSettingsDialog(); 50 | }; 51 | 52 | #endif // JOYAXISCONTEXTMENU_H 53 | -------------------------------------------------------------------------------- /src/joyaxiswidget.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYAXISWIDGET_H 19 | #define JOYAXISWIDGET_H 20 | 21 | #include 22 | 23 | #include "flashbuttonwidget.h" 24 | #include "joyaxis.h" 25 | 26 | class JoyAxisWidget : public FlashButtonWidget 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | explicit JoyAxisWidget(JoyAxis *axis, bool displayNames, QWidget *parent=0); 32 | 33 | JoyAxis* getAxis(); 34 | void tryFlash(); 35 | 36 | protected: 37 | virtual QString generateLabel(); 38 | 39 | JoyAxis *axis; 40 | 41 | signals: 42 | 43 | public slots: 44 | void disableFlashes(); 45 | void enableFlashes(); 46 | 47 | private slots: 48 | void showContextMenu(const QPoint &point); 49 | }; 50 | 51 | #endif // JOYAXISWIDGET_H 52 | -------------------------------------------------------------------------------- /src/joybuttoncontextmenu.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYBUTTONCONTEXTMENU_H 19 | #define JOYBUTTONCONTEXTMENU_H 20 | 21 | #include 22 | #include "joybutton.h" 23 | 24 | class JoyButtonContextMenu : public QMenu 25 | { 26 | Q_OBJECT 27 | public: 28 | explicit JoyButtonContextMenu(JoyButton *button, QWidget *parent = 0); 29 | void buildMenu(); 30 | 31 | protected: 32 | JoyButton *button; 33 | 34 | signals: 35 | 36 | private slots: 37 | void switchToggle(); 38 | void switchTurbo(); 39 | void switchSetMode(); 40 | void disableSetMode(); 41 | void clearButton(); 42 | }; 43 | 44 | #endif // JOYBUTTONCONTEXTMENU_H 45 | -------------------------------------------------------------------------------- /src/joybuttonmousehelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYBUTTONMOUSEHELPER_H 19 | #define JOYBUTTONMOUSEHELPER_H 20 | 21 | #include 22 | #include 23 | 24 | class JoyButtonMouseHelper : public QObject 25 | { 26 | Q_OBJECT 27 | public: 28 | explicit JoyButtonMouseHelper(QObject *parent = 0); 29 | void resetButtonMouseDistances(); 30 | void setFirstSpringStatus(bool status); 31 | bool getFirstSpringStatus(); 32 | void carryGamePollRateUpdate(unsigned int pollRate); 33 | void carryMouseRefreshRateUpdate(unsigned int refreshRate); 34 | 35 | protected: 36 | bool firstSpringEvent; 37 | 38 | signals: 39 | void mouseCursorMoved(int mouseX, int mouseY, int elapsed); 40 | void mouseSpringMoved(int mouseX, int mouseY); 41 | void gamepadRefreshRateUpdated(unsigned int pollRate); 42 | void mouseRefreshRateUpdated(unsigned int refreshRate); 43 | 44 | public slots: 45 | void moveMouseCursor(); 46 | void moveSpringMouse(); 47 | void mouseEvent(); 48 | void changeThread(QThread *thread); 49 | }; 50 | 51 | #endif // JOYBUTTONMOUSEHELPER_H 52 | -------------------------------------------------------------------------------- /src/joybuttonstatusbox.cpp: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | 20 | #include "joybuttonstatusbox.h" 21 | 22 | JoyButtonStatusBox::JoyButtonStatusBox(JoyButton *button, QWidget *parent) : 23 | QPushButton(parent) 24 | { 25 | this->button = button; 26 | isflashing = false; 27 | 28 | setText(QString::number(button->getRealJoyNumber())); 29 | 30 | connect(button, SIGNAL(clicked(int)), this, SLOT(flash())); 31 | connect(button, SIGNAL(released(int)), this, SLOT(unflash())); 32 | } 33 | 34 | JoyButton* JoyButtonStatusBox::getJoyButton() 35 | { 36 | return button; 37 | } 38 | 39 | bool JoyButtonStatusBox::isButtonFlashing() 40 | { 41 | return isflashing; 42 | } 43 | 44 | void JoyButtonStatusBox::flash() 45 | { 46 | isflashing = true; 47 | 48 | this->style()->unpolish(this); 49 | this->style()->polish(this); 50 | 51 | emit flashed(isflashing); 52 | } 53 | 54 | void JoyButtonStatusBox::unflash() 55 | { 56 | isflashing = false; 57 | 58 | this->style()->unpolish(this); 59 | this->style()->polish(this); 60 | 61 | emit flashed(isflashing); 62 | } 63 | -------------------------------------------------------------------------------- /src/joybuttonstatusbox.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYBUTTONSTATUSBOX_H 19 | #define JOYBUTTONSTATUSBOX_H 20 | 21 | #include 22 | 23 | #include "joybutton.h" 24 | 25 | class JoyButtonStatusBox : public QPushButton 26 | { 27 | Q_OBJECT 28 | Q_PROPERTY(bool isflashing READ isButtonFlashing) 29 | 30 | public: 31 | explicit JoyButtonStatusBox(JoyButton *button, QWidget *parent = 0); 32 | JoyButton* getJoyButton(); 33 | bool isButtonFlashing(); 34 | 35 | protected: 36 | JoyButton *button; 37 | bool isflashing; 38 | 39 | signals: 40 | void flashed(bool flashing); 41 | 42 | private slots: 43 | void flash(); 44 | void unflash(); 45 | }; 46 | 47 | #endif // JOYBUTTONSTATUSBOX_H 48 | -------------------------------------------------------------------------------- /src/joybuttontypes/joyaxisbutton.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYAXISBUTTON_H 19 | #define JOYAXISBUTTON_H 20 | 21 | #include 22 | 23 | #include "joybuttontypes/joygradientbutton.h" 24 | 25 | class JoyAxis; 26 | 27 | class JoyAxisButton : public JoyGradientButton 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit JoyAxisButton(JoyAxis *axis, int index, int originset, SetJoystick *parentSet, QObject *parent=0); 32 | 33 | virtual QString getPartialName(bool forceFullFormat=false, bool displayNames=false); 34 | virtual QString getXmlName(); 35 | virtual double getDistanceFromDeadZone(); 36 | 37 | virtual double getMouseDistanceFromDeadZone(); 38 | virtual double getLastMouseDistanceFromDeadZone(); 39 | 40 | virtual void setChangeSetCondition(SetChangeCondition condition, bool passive=false, 41 | bool updateActiveString=true); 42 | JoyAxis* getAxis(); 43 | virtual void setVDPad(VDPad *vdpad); 44 | virtual void setTurboMode(TurboMode mode); 45 | virtual bool isPartRealAxis(); 46 | 47 | virtual double getAccelerationDistance(); 48 | virtual double getLastAccelerationDistance(); 49 | 50 | static const QString xmlName; 51 | 52 | protected: 53 | JoyAxis *axis; 54 | 55 | signals: 56 | void setAssignmentChanged(int current_button, int axis_index, int associated_set, int mode); 57 | 58 | }; 59 | 60 | #endif // JOYAXISBUTTON_H 61 | -------------------------------------------------------------------------------- /src/joybuttontypes/joycontrolstickmodifierbutton.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYCONTROLSTICKMODIFIERBUTTON_H 19 | #define JOYCONTROLSTICKMODIFIERBUTTON_H 20 | 21 | #include "joybuttontypes/joygradientbutton.h" 22 | 23 | class JoyControlStick; 24 | 25 | class JoyControlStickModifierButton : public JoyGradientButton 26 | { 27 | Q_OBJECT 28 | public: 29 | explicit JoyControlStickModifierButton(JoyControlStick *stick, int originset, SetJoystick *parentSet, QObject *parent = 0); 30 | 31 | //virtual int getRealJoyNumber(); 32 | virtual QString getPartialName(bool forceFullFormat=false, bool displayNames=false); 33 | virtual QString getXmlName(); 34 | virtual double getDistanceFromDeadZone(); 35 | virtual double getMouseDistanceFromDeadZone(); 36 | virtual double getLastMouseDistanceFromDeadZone(); 37 | 38 | virtual void setChangeSetCondition(SetChangeCondition condition, bool passive=false); 39 | JoyControlStick *getStick(); 40 | virtual void setTurboMode(TurboMode mode); 41 | virtual bool isPartRealAxis(); 42 | virtual bool isModifierButton(); 43 | 44 | virtual double getAccelerationDistance(); 45 | virtual double getLastAccelerationDistance(); 46 | 47 | static const QString xmlName; 48 | 49 | protected: 50 | JoyControlStick *stick; 51 | 52 | }; 53 | 54 | #endif // JOYCONTROLSTICKMODIFIERBUTTON_H 55 | -------------------------------------------------------------------------------- /src/joybuttontypes/joydpadbutton.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYDPADBUTTON_H 19 | #define JOYDPADBUTTON_H 20 | 21 | #include "joybutton.h" 22 | 23 | class JoyDPad; 24 | 25 | class JoyDPadButton : public JoyButton 26 | { 27 | Q_OBJECT 28 | public: 29 | JoyDPadButton(int direction, int originset, JoyDPad* dpad, SetJoystick *parentSet, QObject *parent=0); 30 | 31 | QString getDirectionName(); 32 | int getDirection(); 33 | virtual int getRealJoyNumber(); 34 | virtual QString getPartialName(bool forceFullFormat=false, bool displayNames=false); 35 | virtual QString getXmlName(); 36 | JoyDPad *getDPad(); 37 | 38 | virtual void setChangeSetCondition(SetChangeCondition condition, bool passive=false); 39 | 40 | enum JoyDPadDirections { 41 | DpadCentered = 0, DpadUp = 1, DpadRight = 2, 42 | DpadDown = 4, DpadLeft = 8, DpadRightUp = 3, 43 | DpadRightDown = 6, DpadLeftUp = 9, DpadLeftDown = 12 44 | }; 45 | static const QString xmlName; 46 | 47 | protected: 48 | int direction; 49 | JoyDPad *dpad; 50 | 51 | signals: 52 | void setAssignmentChanged(int current_button, int dpad_index, int associated_set, int mode); 53 | 54 | public slots: 55 | virtual void reset(); 56 | virtual void reset(int index); 57 | }; 58 | 59 | #endif // JOYDPADBUTTON_H 60 | -------------------------------------------------------------------------------- /src/joybuttontypes/joygradientbutton.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYGRADIENTBUTTON_H 19 | #define JOYGRADIENTBUTTON_H 20 | 21 | #include "joybutton.h" 22 | 23 | class JoyGradientButton : public JoyButton 24 | { 25 | Q_OBJECT 26 | public: 27 | explicit JoyGradientButton(int index, int originset, SetJoystick *parentSet, QObject *parent=0); 28 | 29 | signals: 30 | 31 | protected slots: 32 | virtual void turboEvent(); 33 | virtual void wheelEventVertical(); 34 | virtual void wheelEventHorizontal(); 35 | }; 36 | 37 | #endif // JOYGRADIENTBUTTON_H 38 | -------------------------------------------------------------------------------- /src/joybuttonwidget.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYBUTTONWIDGET_H 19 | #define JOYBUTTONWIDGET_H 20 | 21 | #include 22 | 23 | #include "flashbuttonwidget.h" 24 | #include "joybutton.h" 25 | 26 | class JoyButtonWidget : public FlashButtonWidget 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | explicit JoyButtonWidget(JoyButton* button, bool displayNames, QWidget *parent=0); 32 | 33 | JoyButton* getJoyButton(); 34 | void tryFlash(); 35 | 36 | protected: 37 | virtual QString generateLabel(); 38 | 39 | JoyButton* button; 40 | 41 | signals: 42 | 43 | public slots: 44 | void disableFlashes(); 45 | void enableFlashes(); 46 | 47 | private slots: 48 | void showContextMenu(const QPoint &point); 49 | }; 50 | 51 | #endif // JOYBUTTONWIDGET_H 52 | -------------------------------------------------------------------------------- /src/joycontrolstickbuttonpushbutton.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYCONTROLSTICKBUTTONPUSHBUTTON_H 19 | #define JOYCONTROLSTICKBUTTONPUSHBUTTON_H 20 | 21 | #include 22 | 23 | #include "flashbuttonwidget.h" 24 | #include "joybuttontypes/joycontrolstickbutton.h" 25 | 26 | class JoyControlStickButtonPushButton : public FlashButtonWidget 27 | { 28 | Q_OBJECT 29 | Q_PROPERTY(bool isflashing READ isButtonFlashing) 30 | 31 | public: 32 | explicit JoyControlStickButtonPushButton(JoyControlStickButton *button, bool displayNames, QWidget *parent = 0); 33 | 34 | JoyControlStickButton* getButton(); 35 | void setButton(JoyControlStickButton *button); 36 | void tryFlash(); 37 | 38 | protected: 39 | virtual QString generateLabel(); 40 | 41 | JoyControlStickButton *button; 42 | 43 | signals: 44 | 45 | public slots: 46 | void disableFlashes(); 47 | void enableFlashes(); 48 | 49 | private slots: 50 | void showContextMenu(const QPoint &point); 51 | }; 52 | 53 | #endif // JOYCONTROLSTICKBUTTONPUSHBUTTON_H 54 | -------------------------------------------------------------------------------- /src/joycontrolstickcontextmenu.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYCONTROLSTICKCONTEXTMENU_H 19 | #define JOYCONTROLSTICKCONTEXTMENU_H 20 | 21 | #include 22 | 23 | #include "joycontrolstick.h" 24 | #include "uihelpers/joycontrolstickcontextmenuhelper.h" 25 | 26 | class JoyControlStickContextMenu : public QMenu 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit JoyControlStickContextMenu(JoyControlStick *stick, QWidget *parent = 0); 31 | void buildMenu(); 32 | 33 | protected: 34 | int getPresetIndex(); 35 | 36 | JoyControlStick *stick; 37 | JoyControlStickContextMenuHelper helper; 38 | 39 | signals: 40 | 41 | public slots: 42 | 43 | private slots: 44 | void setStickPreset(); 45 | void setStickMode(); 46 | void openMouseSettingsDialog(); 47 | }; 48 | 49 | #endif // JOYCONTROLSTICKCONTEXTMENU_H 50 | -------------------------------------------------------------------------------- /src/joycontrolstickdirectionstype.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYCONTROLSTICKDIRECTIONSTYPE_H 19 | #define JOYCONTROLSTICKDIRECTIONSTYPE_H 20 | 21 | class JoyStickDirectionsType { 22 | public: 23 | enum JoyStickDirections { 24 | StickCentered = 0, StickUp = 1, StickRight = 3, 25 | StickDown = 5, StickLeft = 7, StickRightUp = 2, 26 | StickRightDown = 4, StickLeftUp = 8, StickLeftDown = 6 27 | }; 28 | }; 29 | 30 | #endif // JOYCONTROLSTICKDIRECTIONSTYPE_H 31 | -------------------------------------------------------------------------------- /src/joycontrolstickeditdialog.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYCONTROLSTICKEDITDIALOG_H 19 | #define JOYCONTROLSTICKEDITDIALOG_H 20 | 21 | #include 22 | 23 | #include "joycontrolstick.h" 24 | #include "uihelpers/joycontrolstickeditdialoghelper.h" 25 | 26 | namespace Ui { 27 | class JoyControlStickEditDialog; 28 | } 29 | 30 | class JoyControlStickEditDialog : public QDialog 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit JoyControlStickEditDialog(JoyControlStick *stick, QWidget *parent = 0); 36 | ~JoyControlStickEditDialog(); 37 | 38 | protected: 39 | void selectCurrentPreset(); 40 | 41 | JoyControlStick *stick; 42 | JoyControlStickEditDialogHelper helper; 43 | 44 | private: 45 | Ui::JoyControlStickEditDialog *ui; 46 | 47 | private slots: 48 | void implementPresets(int index); 49 | void implementModes(int index); 50 | 51 | void refreshStickStats(int x, int y); 52 | void updateMouseMode(int index); 53 | 54 | void checkMaxZone(int value); 55 | void openMouseSettingsDialog(); 56 | void enableMouseSettingButton(); 57 | void updateWindowTitleStickName(); 58 | void changeCircleAdjust(int value); 59 | void updateStickDelaySpinBox(int value); 60 | void updateStickDelaySlider(double value); 61 | void openModifierEditDialog(); 62 | void changeModifierSummary(); 63 | }; 64 | 65 | #endif // JOYCONTROLSTICKEDITDIALOG_H 66 | -------------------------------------------------------------------------------- /src/joycontrolstickpushbutton.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYCONTROLSTICKPUSHBUTTON_H 19 | #define JOYCONTROLSTICKPUSHBUTTON_H 20 | 21 | #include 22 | 23 | #include "flashbuttonwidget.h" 24 | #include "joycontrolstick.h" 25 | 26 | class JoyControlStickPushButton : public FlashButtonWidget 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | explicit JoyControlStickPushButton(JoyControlStick *stick, bool displayNames, QWidget *parent = 0); 32 | 33 | JoyControlStick* getStick(); 34 | void tryFlash(); 35 | 36 | protected: 37 | virtual QString generateLabel(); 38 | 39 | JoyControlStick *stick; 40 | 41 | signals: 42 | 43 | public slots: 44 | void disableFlashes(); 45 | void enableFlashes(); 46 | 47 | private slots: 48 | void showContextMenu(const QPoint &point); 49 | }; 50 | 51 | #endif // JOYCONTROLSTICKPUSHBUTTON_H 52 | -------------------------------------------------------------------------------- /src/joycontrolstickstatusbox.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYCONTROLSTICKSTATUSBOX_H 19 | #define JOYCONTROLSTICKSTATUSBOX_H 20 | 21 | #include 22 | #include 23 | 24 | #include "joycontrolstick.h" 25 | #include "joyaxis.h" 26 | 27 | class JoyControlStickStatusBox : public QWidget 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit JoyControlStickStatusBox(QWidget *parent = 0); 32 | explicit JoyControlStickStatusBox(JoyControlStick *stick, QWidget *parent = 0); 33 | 34 | void setStick(JoyControlStick *stick); 35 | 36 | JoyControlStick* getStick(); 37 | 38 | virtual int heightForWidth(int width) const; 39 | QSize sizeHint() const; 40 | 41 | protected: 42 | virtual void paintEvent(QPaintEvent *event); 43 | void drawEightWayBox(); 44 | void drawFourWayCardinalBox(); 45 | void drawFourWayDiagonalBox(); 46 | 47 | JoyControlStick *stick; 48 | 49 | signals: 50 | 51 | public slots: 52 | 53 | }; 54 | 55 | #endif // JOYCONTROLSTICKSTATUSBOX_H 56 | -------------------------------------------------------------------------------- /src/joydpadbuttonwidget.cpp: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "joydpadbuttonwidget.h" 19 | 20 | JoyDPadButtonWidget::JoyDPadButtonWidget(JoyButton *button, bool displayNames, QWidget *parent) : 21 | JoyButtonWidget(button, displayNames, parent) 22 | { 23 | // Ensure that JoyDPadButtonWidget::generateLabel is called. 24 | refreshLabel(); 25 | } 26 | 27 | /** 28 | * @brief Generate the string that will be displayed on the button 29 | * @return Display string 30 | */ 31 | QString JoyDPadButtonWidget::generateLabel() 32 | { 33 | QString temp; 34 | if (!button->getActionName().isEmpty() && displayNames) 35 | { 36 | temp = button->getActionName(); 37 | } 38 | else 39 | { 40 | temp = button->getCalculatedActiveZoneSummary(); 41 | } 42 | temp.replace("&", "&&"); 43 | return temp; 44 | } 45 | -------------------------------------------------------------------------------- /src/joydpadbuttonwidget.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYDPADBUTTONWIDGET_H 19 | #define JOYDPADBUTTONWIDGET_H 20 | 21 | #include "joybuttonwidget.h" 22 | 23 | class JoyDPadButtonWidget : public JoyButtonWidget 24 | { 25 | Q_OBJECT 26 | public: 27 | explicit JoyDPadButtonWidget(JoyButton* button, bool displayNames, QWidget *parent = 0); 28 | 29 | protected: 30 | virtual QString generateLabel(); 31 | 32 | signals: 33 | 34 | public slots: 35 | }; 36 | 37 | #endif // JOYDPADBUTTONWIDGET_H 38 | -------------------------------------------------------------------------------- /src/joykeyrepeathelper.cpp: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "joykeyrepeathelper.h" 19 | #include "event.h" 20 | 21 | JoyKeyRepeatHelper::JoyKeyRepeatHelper(QObject *parent) : 22 | QObject(parent) 23 | { 24 | lastActiveKey = 0; 25 | keyRepeatTimer.setParent(this); 26 | connect(&keyRepeatTimer, SIGNAL(timeout()), this, SLOT(repeatKeysEvent())); 27 | } 28 | 29 | QTimer* JoyKeyRepeatHelper::getRepeatTimer() 30 | { 31 | return &keyRepeatTimer; 32 | } 33 | 34 | void JoyKeyRepeatHelper::repeatKeysEvent() 35 | { 36 | if (lastActiveKey) 37 | { 38 | JoyButtonSlot *slot = lastActiveKey; 39 | 40 | // Send another key press to fake a key repeat 41 | sendevent(slot); 42 | 43 | keyRepeatTimer.start(keyRepeatRate); 44 | } 45 | else 46 | { 47 | keyRepeatTimer.stop(); 48 | } 49 | } 50 | 51 | void JoyKeyRepeatHelper::setLastActiveKey(JoyButtonSlot *slot) 52 | { 53 | lastActiveKey = slot; 54 | } 55 | 56 | JoyButtonSlot* JoyKeyRepeatHelper::getLastActiveKey() 57 | { 58 | return lastActiveKey; 59 | } 60 | 61 | /*void JoyKeyRepeatHelper::setKeyRepeatDelay(unsigned int repeatDelay) 62 | { 63 | if (repeatDelay > 0) 64 | { 65 | keyRepeatDelay = repeatDelay; 66 | } 67 | } 68 | 69 | unsigned int JoyKeyRepeatHelper::getKeyRepeatDelay() 70 | { 71 | return keyRepeatDelay; 72 | } 73 | */ 74 | 75 | void JoyKeyRepeatHelper::setKeyRepeatRate(unsigned int repeatRate) 76 | { 77 | if (repeatRate > 0) 78 | { 79 | keyRepeatRate = repeatRate; 80 | } 81 | } 82 | 83 | unsigned int JoyKeyRepeatHelper::getKeyRepeatRate() 84 | { 85 | return keyRepeatRate; 86 | } 87 | -------------------------------------------------------------------------------- /src/joykeyrepeathelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYKEYREPEATHELPER_H 19 | #define JOYKEYREPEATHELPER_H 20 | 21 | #include 22 | #include 23 | 24 | #include "joybuttonslot.h" 25 | 26 | class JoyKeyRepeatHelper : public QObject 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit JoyKeyRepeatHelper(QObject *parent = 0); 31 | QTimer* getRepeatTimer(); 32 | 33 | void setLastActiveKey(JoyButtonSlot *slot); 34 | JoyButtonSlot* getLastActiveKey(); 35 | 36 | //void setKeyRepeatDelay(unsigned int repeatDelay); 37 | //unsigned int getKeyRepeatDelay(); 38 | 39 | void setKeyRepeatRate(unsigned int repeatRate); 40 | unsigned int getKeyRepeatRate(); 41 | 42 | protected: 43 | QTimer keyRepeatTimer; 44 | JoyButtonSlot *lastActiveKey; 45 | unsigned int keyRepeatDelay; 46 | unsigned int keyRepeatRate; 47 | 48 | signals: 49 | 50 | private slots: 51 | void repeatKeysEvent(); 52 | }; 53 | 54 | #endif // JOYKEYREPEATHELPER_H 55 | -------------------------------------------------------------------------------- /src/joystick.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYSTICK_H 19 | #define JOYSTICK_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #include "inputdevice.h" 26 | 27 | class Joystick : public InputDevice 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit Joystick(SDL_Joystick *joyhandle, int deviceIndex, AntiMicroSettings *settings, QObject *parent=0); 32 | 33 | virtual QString getName(); 34 | virtual QString getSDLName(); 35 | virtual QString getGUIDString(); // GUID available on SDL 2. 36 | virtual QString getXmlName(); 37 | virtual void closeSDLDevice(); 38 | #ifdef USE_SDL_2 39 | virtual SDL_JoystickID getSDLJoystickID(); 40 | #endif 41 | 42 | virtual int getNumberRawButtons(); 43 | virtual int getNumberRawAxes(); 44 | virtual int getNumberRawHats(); 45 | 46 | static const QString xmlName; 47 | 48 | protected: 49 | SDL_Joystick *joyhandle; 50 | 51 | signals: 52 | 53 | public slots: 54 | 55 | }; 56 | 57 | Q_DECLARE_METATYPE(Joystick*) 58 | 59 | #endif // JOYSTICK_H 60 | -------------------------------------------------------------------------------- /src/joystickstatuswindow.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYSTICKSTATUSWINDOW_H 19 | #define JOYSTICKSTATUSWINDOW_H 20 | 21 | #include 22 | 23 | #include "inputdevice.h" 24 | 25 | namespace Ui { 26 | class JoystickStatusWindow; 27 | } 28 | 29 | class JoystickStatusWindow : public QDialog 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | explicit JoystickStatusWindow(InputDevice *joystick, QWidget *parent = 0); 35 | ~JoystickStatusWindow(); 36 | 37 | protected: 38 | InputDevice *joystick; 39 | 40 | private: 41 | Ui::JoystickStatusWindow *ui; 42 | 43 | private slots: 44 | void restoreButtonStates(int code); 45 | void obliterate(); 46 | }; 47 | 48 | #endif // JOYSTICKSTATUSWINDOW_H 49 | -------------------------------------------------------------------------------- /src/joytabwidgetcontainer.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYTABWIDGETCONTAINER_H 19 | #define JOYTABWIDGETCONTAINER_H 20 | 21 | #include 22 | 23 | #include "joystick.h" 24 | #include "joytabwidget.h" 25 | 26 | class JoyTabWidgetContainer : public QTabWidget 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit JoyTabWidgetContainer(QWidget *parent = 0); 31 | 32 | int addTab(QWidget *widget, const QString &string); 33 | int addTab(JoyTabWidget *widget, const QString &string); 34 | 35 | protected: 36 | 37 | signals: 38 | 39 | public slots: 40 | void disableFlashes(InputDevice *joystick); 41 | void enableFlashes(InputDevice *joystick); 42 | 43 | private slots: 44 | void flash(); 45 | void unflash(); 46 | void unflashAll(); 47 | void unflashTab(JoyTabWidget *tabWidget); 48 | }; 49 | 50 | #endif // JOYTABWIDGETCONTAINER_H 51 | -------------------------------------------------------------------------------- /src/keyboard/virtualkeypushbutton.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef VIRTUALKEYPUSHBUTTON_H 19 | #define VIRTUALKEYPUSHBUTTON_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | 27 | class VirtualKeyPushButton : public QPushButton 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit VirtualKeyPushButton(JoyButton *button, QString xcodestring, QWidget *parent = 0); 32 | int calculateFontSize(); 33 | 34 | protected: 35 | int keycode; 36 | unsigned int qkeyalias; 37 | QString xcodestring; 38 | QString displayString; 39 | bool currentlyActive; 40 | bool onCurrentButton; 41 | JoyButton *button; 42 | static QHash knownAliases; 43 | 44 | QString setDisplayString(QString xcodestring); 45 | void populateKnownAliases(); 46 | 47 | signals: 48 | void keycodeObtained(int code, unsigned int alias); 49 | 50 | public slots: 51 | 52 | private slots: 53 | void processSingleSelection(); 54 | }; 55 | 56 | #endif // VIRTUALKEYPUSHBUTTON_H 57 | -------------------------------------------------------------------------------- /src/keyboard/virtualmousepushbutton.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef VIRTUALMOUSEPUSHBUTTON_H 19 | #define VIRTUALMOUSEPUSHBUTTON_H 20 | 21 | #include 22 | #include 23 | 24 | #include 25 | 26 | class VirtualMousePushButton : public QPushButton 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit VirtualMousePushButton(QString displayText, int code, JoyButtonSlot::JoySlotInputAction mode, QWidget *parent = 0); 31 | 32 | unsigned int getMouseCode(); 33 | JoyButtonSlot::JoySlotInputAction getMouseMode(); 34 | 35 | 36 | protected: 37 | unsigned int code; 38 | JoyButtonSlot::JoySlotInputAction mode; 39 | 40 | signals: 41 | void mouseSlotCreated(JoyButtonSlot *tempslot); 42 | 43 | public slots: 44 | 45 | private slots: 46 | void createTempSlot(); 47 | }; 48 | 49 | #endif // VIRTUALMOUSEPUSHBUTTON_H 50 | -------------------------------------------------------------------------------- /src/localantimicroserver.cpp: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | 21 | #include "localantimicroserver.h" 22 | #include "common.h" 23 | 24 | LocalAntiMicroServer::LocalAntiMicroServer(QObject *parent) : 25 | QObject(parent) 26 | { 27 | localServer = new QLocalServer(this); 28 | } 29 | 30 | void LocalAntiMicroServer::startLocalServer() 31 | { 32 | QLocalServer::removeServer(PadderCommon::localSocketKey); 33 | localServer->setMaxPendingConnections(1); 34 | if (!localServer->listen(PadderCommon::localSocketKey)) 35 | { 36 | QTextStream errorstream(stderr); 37 | QString message("Could not start signal server. Profiles cannot be reloaded\n"); 38 | message.append("from command-line"); 39 | errorstream << tr(message.toStdString().c_str()) << endl; 40 | } 41 | else 42 | { 43 | connect(localServer, SIGNAL(newConnection()), this, SLOT(handleOutsideConnection())); 44 | } 45 | } 46 | 47 | void LocalAntiMicroServer::handleOutsideConnection() 48 | { 49 | QLocalSocket *socket = localServer->nextPendingConnection(); 50 | if (socket) 51 | { 52 | connect(socket, SIGNAL(disconnected()), this, SLOT(handleSocketDisconnect())); 53 | connect(socket, SIGNAL(disconnected()), socket, SLOT(deleteLater())); 54 | } 55 | } 56 | 57 | void LocalAntiMicroServer::handleSocketDisconnect() 58 | { 59 | emit clientdisconnect(); 60 | } 61 | 62 | void LocalAntiMicroServer::close() 63 | { 64 | localServer->close(); 65 | } 66 | -------------------------------------------------------------------------------- /src/localantimicroserver.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef LOCALANTIMICROSERVER_H 19 | #define LOCALANTIMICROSERVER_H 20 | 21 | #include 22 | #include 23 | 24 | class LocalAntiMicroServer : public QObject 25 | { 26 | Q_OBJECT 27 | public: 28 | explicit LocalAntiMicroServer(QObject *parent = 0); 29 | 30 | protected: 31 | QLocalServer *localServer; 32 | 33 | signals: 34 | void clientdisconnect(); 35 | 36 | public slots: 37 | void startLocalServer(); 38 | void handleOutsideConnection(); 39 | void handleSocketDisconnect(); 40 | void close(); 41 | }; 42 | 43 | #endif // LOCALANTIMICROSERVER_H 44 | -------------------------------------------------------------------------------- /src/mousedialog/mousebuttonsettingsdialog.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef MOUSEBUTTONSETTINGSDIALOG_H 19 | #define MOUSEBUTTONSETTINGSDIALOG_H 20 | 21 | #include "mousesettingsdialog.h" 22 | #include "springmoderegionpreview.h" 23 | 24 | #include 25 | #include "uihelpers/mousebuttonsettingsdialoghelper.h" 26 | 27 | class MouseButtonSettingsDialog : public MouseSettingsDialog 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit MouseButtonSettingsDialog(JoyButton *button, QWidget *parent = 0); 32 | 33 | protected: 34 | void selectCurrentMouseModePreset(); 35 | void calculateSpringPreset(); 36 | void calculateMouseSpeedPreset(); 37 | void updateWindowTitleButtonName(); 38 | void calculateExtraAccelerationCurve(); 39 | 40 | JoyButton *button; 41 | SpringModeRegionPreview *springPreviewWidget; 42 | MouseButtonSettingsDialogHelper helper; 43 | 44 | signals: 45 | 46 | public slots: 47 | void changeMouseMode(int index); 48 | void changeMouseCurve(int index); 49 | void updateConfigHorizontalSpeed(int value); 50 | void updateConfigVerticalSpeed(int value); 51 | void updateSpringWidth(int value); 52 | void updateSpringHeight(int value); 53 | void updateSensitivity(double value); 54 | void updateAccelerationCurvePresetComboBox(); 55 | //void updateSpringRelativeStatus(bool value); 56 | 57 | private slots: 58 | void updateExtraAccelerationCurve(int index); 59 | }; 60 | 61 | #endif // MOUSEBUTTONSETTINGSDIALOG_H 62 | -------------------------------------------------------------------------------- /src/mousedialog/springmoderegionpreview.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef SPRINGMODEREGIONPREVIEW_H 19 | #define SPRINGMODEREGIONPREVIEW_H 20 | 21 | #include 22 | 23 | class SpringModeRegionPreview : public QWidget 24 | { 25 | Q_OBJECT 26 | public: 27 | explicit SpringModeRegionPreview(int width = 0, int height = 0, QWidget *parent = 0); 28 | 29 | protected: 30 | void paintEvent(QPaintEvent *event); 31 | 32 | int adjustSpringSizeWidth(int width); 33 | int adjustSpringSizeHeight(int height); 34 | 35 | signals: 36 | 37 | public slots: 38 | void setSpringWidth(int width); 39 | void setSpringHeight(int height); 40 | void setSpringSize(int width, int height); 41 | }; 42 | 43 | #endif // SPRINGMODEREGIONPREVIEW_H 44 | -------------------------------------------------------------------------------- /src/mousedialog/uihelpers/mouseaxissettingsdialoghelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef MOUSEAXISSETTINGSDIALOGHELPER_H 19 | #define MOUSEAXISSETTINGSDIALOGHELPER_H 20 | 21 | #include 22 | 23 | #include "joyaxis.h" 24 | 25 | class MouseAxisSettingsDialogHelper : public QObject 26 | { 27 | Q_OBJECT 28 | public: 29 | explicit MouseAxisSettingsDialogHelper(JoyAxis *axis, QObject *parent = 0); 30 | 31 | protected: 32 | JoyAxis *axis; 33 | 34 | signals: 35 | 36 | public slots: 37 | void updateExtraAccelerationStatus(bool checked); 38 | void updateExtraAccelerationMultiplier(double value); 39 | 40 | void updateStartMultiPercentage(double value); 41 | void updateMinAccelThreshold(double value); 42 | void updateMaxAccelThreshold(double value); 43 | void updateAccelExtraDuration(double value); 44 | void updateReleaseSpringRadius(int value); 45 | }; 46 | 47 | #endif // MOUSEAXISSETTINGSDIALOGHELPER_H 48 | -------------------------------------------------------------------------------- /src/mousedialog/uihelpers/mousebuttonsettingsdialoghelper.cpp: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "mousebuttonsettingsdialoghelper.h" 19 | 20 | MouseButtonSettingsDialogHelper::MouseButtonSettingsDialogHelper(JoyButton *button, QObject *parent) : 21 | QObject(parent) 22 | { 23 | Q_ASSERT(button); 24 | 25 | this->button = button; 26 | } 27 | 28 | void MouseButtonSettingsDialogHelper::updateExtraAccelerationStatus(bool checked) 29 | { 30 | button->setExtraAccelerationStatus(checked); 31 | } 32 | 33 | void MouseButtonSettingsDialogHelper::updateExtraAccelerationMultiplier(double value) 34 | { 35 | button->setExtraAccelerationMultiplier(value); 36 | } 37 | 38 | void MouseButtonSettingsDialogHelper::updateStartMultiPercentage(double value) 39 | { 40 | button->setStartAccelMultiplier(value); 41 | } 42 | 43 | void MouseButtonSettingsDialogHelper::updateMinAccelThreshold(double value) 44 | { 45 | button->setMinAccelThreshold(value); 46 | } 47 | 48 | void MouseButtonSettingsDialogHelper::updateMaxAccelThreshold(double value) 49 | { 50 | button->setMaxAccelThreshold(value); 51 | } 52 | 53 | void MouseButtonSettingsDialogHelper::updateAccelExtraDuration(double value) 54 | { 55 | button->setAccelExtraDuration(value); 56 | } 57 | 58 | void MouseButtonSettingsDialogHelper::updateReleaseSpringRadius(int value) 59 | { 60 | button->setSpringDeadCircleMultiplier(value); 61 | } 62 | 63 | void MouseButtonSettingsDialogHelper::updateSpringRelativeStatus(bool value) 64 | { 65 | button->setSpringRelativeStatus(value); 66 | } 67 | -------------------------------------------------------------------------------- /src/mousedialog/uihelpers/mousebuttonsettingsdialoghelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef MOUSEBUTTONSETTINGSDIALOGHELPER_H 19 | #define MOUSEBUTTONSETTINGSDIALOGHELPER_H 20 | 21 | #include 22 | 23 | #include "joybutton.h" 24 | #include "joybuttonslot.h" 25 | 26 | class MouseButtonSettingsDialogHelper : public QObject 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit MouseButtonSettingsDialogHelper(JoyButton *button, QObject *parent = 0); 31 | 32 | protected: 33 | JoyButton *button; 34 | 35 | signals: 36 | 37 | public slots: 38 | void updateExtraAccelerationStatus(bool checked); 39 | void updateExtraAccelerationMultiplier(double value); 40 | 41 | void updateStartMultiPercentage(double value); 42 | void updateMinAccelThreshold(double value); 43 | void updateMaxAccelThreshold(double value); 44 | void updateAccelExtraDuration(double value); 45 | void updateReleaseSpringRadius(int value); 46 | void updateSpringRelativeStatus(bool value); 47 | //void updateExtraAccelerationCurve(int index); 48 | }; 49 | 50 | #endif // MOUSEBUTTONSETTINGSDIALOGHELPER_H 51 | -------------------------------------------------------------------------------- /src/mousedialog/uihelpers/mousecontrolsticksettingsdialoghelper.cpp: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "mousecontrolsticksettingsdialoghelper.h" 19 | 20 | MouseControlStickSettingsDialogHelper::MouseControlStickSettingsDialogHelper(JoyControlStick *stick, 21 | QObject *parent) : 22 | QObject(parent) 23 | { 24 | Q_ASSERT(stick); 25 | 26 | this->stick = stick; 27 | } 28 | 29 | void MouseControlStickSettingsDialogHelper::updateExtraAccelerationStatus(bool checked) 30 | { 31 | stick->setButtonsExtraAccelerationStatus(checked); 32 | } 33 | 34 | void MouseControlStickSettingsDialogHelper::updateExtraAccelerationMultiplier(double value) 35 | { 36 | stick->setButtonsExtraAccelerationMultiplier(value); 37 | } 38 | 39 | void MouseControlStickSettingsDialogHelper::updateStartMultiPercentage(double value) 40 | { 41 | stick->setButtonsStartAccelerationMultiplier(value); 42 | } 43 | 44 | void MouseControlStickSettingsDialogHelper::updateMinAccelThreshold(double value) 45 | { 46 | stick->setButtonsMinAccelerationThreshold(value); 47 | } 48 | 49 | void MouseControlStickSettingsDialogHelper::updateMaxAccelThreshold(double value) 50 | { 51 | stick->setButtonsMaxAccelerationThreshold(value); 52 | } 53 | 54 | void MouseControlStickSettingsDialogHelper::updateAccelExtraDuration(double value) 55 | { 56 | stick->setButtonsAccelerationExtraDuration(value); 57 | } 58 | 59 | void MouseControlStickSettingsDialogHelper::updateReleaseSpringRadius(int value) 60 | { 61 | stick->setButtonsSpringDeadCircleMultiplier(value); 62 | } 63 | -------------------------------------------------------------------------------- /src/mousedialog/uihelpers/mousecontrolsticksettingsdialoghelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef MOUSECONTROLSTICKSETTINGSDIALOGHELPER_H 19 | #define MOUSECONTROLSTICKSETTINGSDIALOGHELPER_H 20 | 21 | #include 22 | 23 | #include "joycontrolstick.h" 24 | 25 | class MouseControlStickSettingsDialogHelper : public QObject 26 | { 27 | Q_OBJECT 28 | public: 29 | explicit MouseControlStickSettingsDialogHelper(JoyControlStick *stick, QObject *parent = 0); 30 | 31 | protected: 32 | JoyControlStick *stick; 33 | 34 | signals: 35 | 36 | public slots: 37 | void updateExtraAccelerationStatus(bool checked); 38 | void updateExtraAccelerationMultiplier(double value); 39 | 40 | void updateStartMultiPercentage(double value); 41 | void updateMinAccelThreshold(double value); 42 | void updateMaxAccelThreshold(double value); 43 | void updateAccelExtraDuration(double value); 44 | void updateReleaseSpringRadius(int value); 45 | }; 46 | 47 | #endif // MOUSECONTROLSTICKSETTINGSDIALOGHELPER_H 48 | -------------------------------------------------------------------------------- /src/mousedialog/uihelpers/mousedpadsettingsdialoghelper.cpp: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "mousedpadsettingsdialoghelper.h" 19 | 20 | MouseDpadSettingsDialogHelper::MouseDpadSettingsDialogHelper(JoyDPad *dpad, QObject *parent) : 21 | QObject(parent) 22 | { 23 | Q_ASSERT(dpad); 24 | 25 | this->dpad = dpad; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/mousedialog/uihelpers/mousedpadsettingsdialoghelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef MOUSEDPADSETTINGSDIALOGHELPER_H 19 | #define MOUSEDPADSETTINGSDIALOGHELPER_H 20 | 21 | #include 22 | 23 | #include "joydpad.h" 24 | #include "joydpadbuttonwidget.h" 25 | 26 | class MouseDpadSettingsDialogHelper : public QObject 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit MouseDpadSettingsDialogHelper(JoyDPad *dpad, QObject *parent = 0); 31 | 32 | protected: 33 | JoyDPad *dpad; 34 | 35 | signals: 36 | 37 | public slots: 38 | }; 39 | 40 | #endif // MOUSEDPADSETTINGSDIALOGHELPER_H 41 | -------------------------------------------------------------------------------- /src/mousehelper.cpp: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "mousehelper.h" 19 | 20 | MouseHelper::MouseHelper(QObject *parent) : 21 | QObject(parent) 22 | { 23 | springMouseMoving = false; 24 | previousCursorLocation[0] = 0; 25 | previousCursorLocation[1] = 0; 26 | pivotPoint[0] = -1; 27 | pivotPoint[1] = -1; 28 | mouseTimer.setParent(this); 29 | mouseTimer.setSingleShot(true); 30 | QObject::connect(&mouseTimer, SIGNAL(timeout()), this, SLOT(resetSpringMouseMoving())); 31 | } 32 | 33 | void MouseHelper::resetSpringMouseMoving() 34 | { 35 | springMouseMoving = false; 36 | } 37 | 38 | void MouseHelper::initDeskWid() 39 | { 40 | if (!deskWid) 41 | { 42 | deskWid = new QDesktopWidget; 43 | } 44 | } 45 | 46 | void MouseHelper::deleteDeskWid() 47 | { 48 | if (deskWid) 49 | { 50 | delete deskWid; 51 | deskWid = 0; 52 | } 53 | } 54 | 55 | QDesktopWidget* MouseHelper::getDesktopWidget() 56 | { 57 | return deskWid; 58 | } 59 | -------------------------------------------------------------------------------- /src/mousehelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef MOUSEHELPER_H 19 | #define MOUSEHELPER_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | class MouseHelper : public QObject 26 | { 27 | Q_OBJECT 28 | public: 29 | explicit MouseHelper(QObject *parent = 0); 30 | QDesktopWidget* getDesktopWidget(); 31 | 32 | bool springMouseMoving; 33 | int previousCursorLocation[2]; 34 | int pivotPoint[2]; 35 | QTimer mouseTimer; 36 | QDesktopWidget *deskWid; 37 | 38 | signals: 39 | 40 | public slots: 41 | void deleteDeskWid(); 42 | void initDeskWid(); 43 | 44 | private slots: 45 | void resetSpringMouseMoving(); 46 | }; 47 | 48 | #endif // MOUSEHELPER_H 49 | -------------------------------------------------------------------------------- /src/qkeydisplaydialog.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef QKEYDISPLAYDIALOG_H 19 | #define QKEYDISPLAYDIALOG_H 20 | 21 | #include 22 | #include 23 | 24 | namespace Ui { 25 | class QKeyDisplayDialog; 26 | } 27 | 28 | class QKeyDisplayDialog : public QDialog 29 | { 30 | Q_OBJECT 31 | 32 | public: 33 | explicit QKeyDisplayDialog(QWidget *parent = 0); 34 | ~QKeyDisplayDialog(); 35 | 36 | protected: 37 | virtual void keyPressEvent(QKeyEvent *event); 38 | virtual void keyReleaseEvent(QKeyEvent *event); 39 | 40 | private: 41 | Ui::QKeyDisplayDialog *ui; 42 | }; 43 | 44 | #endif // QKEYDISPLAYDIALOG_H 45 | -------------------------------------------------------------------------------- /src/qtuinputkeymapper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef QTUINPUTKEYMAPPER_H 19 | #define QTUINPUTKEYMAPPER_H 20 | 21 | #include 22 | #include 23 | 24 | #include "qtkeymapperbase.h" 25 | 26 | class QtUInputKeyMapper : public QtKeyMapperBase 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit QtUInputKeyMapper(QObject *parent = 0); 31 | 32 | protected: 33 | void populateMappingHashes(); 34 | void populateCharKeyInformation(); 35 | 36 | void populateAlphaHashes(); 37 | void populateFKeyHashes(); 38 | void populateNumPadHashes(); 39 | void populateSpecialCharHashes(); 40 | 41 | signals: 42 | 43 | public slots: 44 | 45 | }; 46 | 47 | #endif // QTUINPUTKEYMAPPER_H 48 | -------------------------------------------------------------------------------- /src/qtvmultikeymapper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef QTVMULTIKEYMAPPER_H 19 | #define QTVMULTIKEYMAPPER_H 20 | 21 | #include 22 | #include 23 | 24 | #include "qtkeymapperbase.h" 25 | #include "qtwinkeymapper.h" 26 | 27 | class QtVMultiKeyMapper : public QtKeyMapperBase 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit QtVMultiKeyMapper(QObject *parent = 0); 32 | 33 | static const unsigned int consumerUsagePagePrefix = 0x12000; 34 | 35 | protected: 36 | void populateMappingHashes(); 37 | void populateCharKeyInformation(); 38 | 39 | //static QtWinKeyMapper nativeKeyMapper; 40 | 41 | signals: 42 | 43 | public slots: 44 | }; 45 | 46 | #endif // QTVMULTIKEYMAPPER_H 47 | -------------------------------------------------------------------------------- /src/qtwinkeymapper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef QTWINKEYMAPPER_H 19 | #define QTWINKEYMAPPER_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #include "qtkeymapperbase.h" 26 | 27 | class QtWinKeyMapper : public QtKeyMapperBase 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit QtWinKeyMapper(QObject *parent = 0); 32 | 33 | virtual unsigned int returnQtKey(unsigned int key, unsigned int scancode=0); 34 | 35 | protected: 36 | void populateMappingHashes(); 37 | void populateCharKeyInformation(); 38 | 39 | signals: 40 | 41 | public slots: 42 | 43 | }; 44 | 45 | #endif // QTWINKEYMAPPER_H 46 | -------------------------------------------------------------------------------- /src/qtx11keymapper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef QTX11KEYMAPPER_H 19 | #define QTX11KEYMAPPER_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #include "qtkeymapperbase.h" 26 | 27 | class QtX11KeyMapper : public QtKeyMapperBase 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit QtX11KeyMapper(QObject *parent = 0); 32 | 33 | protected: 34 | void populateMappingHashes(); 35 | void populateCharKeyInformation(); 36 | 37 | signals: 38 | 39 | public slots: 40 | 41 | }; 42 | 43 | #endif // QTX11KEYMAPPER_H 44 | -------------------------------------------------------------------------------- /src/quicksetdialog.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef QUICKSETDIALOG_H 19 | #define QUICKSETDIALOG_H 20 | 21 | #include 22 | 23 | #include "inputdevice.h" 24 | 25 | namespace Ui { 26 | class QuickSetDialog; 27 | } 28 | 29 | class QuickSetDialog : public QDialog 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | explicit QuickSetDialog(InputDevice *joystick, QWidget *parent = 0); 35 | ~QuickSetDialog(); 36 | 37 | protected: 38 | InputDevice *joystick; 39 | QDialog *currentButtonDialog; 40 | 41 | private: 42 | Ui::QuickSetDialog *ui; 43 | 44 | signals: 45 | void buttonDialogClosed(); 46 | 47 | private slots: 48 | void showAxisButtonDialog(); 49 | void showButtonDialog(); 50 | void showStickButtonDialog(); 51 | void showDPadButtonDialog(); 52 | 53 | void nullifyDialogPointer(); 54 | void restoreButtonStates(); 55 | }; 56 | 57 | #endif // QUICKSETDIALOG_H 58 | -------------------------------------------------------------------------------- /src/quicksetdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | QuickSetDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Quick Set 15 | 16 | 17 | true 18 | 19 | 20 | 21 | 22 | 23 | <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> 24 | 25 | 26 | Qt::AlignCenter 27 | 28 | 29 | false 30 | 31 | 32 | 33 | 34 | 35 | 36 | Qt::Horizontal 37 | 38 | 39 | QDialogButtonBox::Close 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | buttonBox 49 | accepted() 50 | QuickSetDialog 51 | accept() 52 | 53 | 54 | 248 55 | 254 56 | 57 | 58 | 157 59 | 274 60 | 61 | 62 | 63 | 64 | buttonBox 65 | rejected() 66 | QuickSetDialog 67 | reject() 68 | 69 | 70 | 316 71 | 260 72 | 73 | 74 | 286 75 | 274 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /src/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | images/antimicro.png 4 | images/antimicro_trayicon.png 5 | images/controllermap.png 6 | images/axis.png 7 | images/button.png 8 | Changelog 9 | icons/16x16/actions/document-save.png 10 | icons/16x16/actions/document-open-folder.png 11 | icons/16x16/actions/dialog-warning.png 12 | 13 | -------------------------------------------------------------------------------- /src/resources_windows.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icons/16x16/actions/application-exit.png 4 | icons/16x16/actions/archive-insert.png 5 | icons/16x16/actions/dialog-cancel.png 6 | icons/16x16/actions/dialog-close.png 7 | icons/16x16/actions/dialog-ok.png 8 | icons/16x16/actions/document-close.png 9 | icons/16x16/actions/document-open-folder.png 10 | icons/16x16/actions/document-open.png 11 | icons/16x16/actions/document-revert-small.png 12 | icons/16x16/actions/document-revert.png 13 | icons/16x16/actions/document-save-as.png 14 | icons/16x16/actions/document-save.png 15 | icons/16x16/actions/edit-clear-list.png 16 | icons/16x16/actions/edit-clear.png 17 | icons/16x16/actions/edit-delete.png 18 | icons/16x16/actions/edit-select.png 19 | icons/16x16/actions/games-config-custom.png 20 | icons/16x16/actions/games-config-options.png 21 | icons/16x16/actions/text-field.png 22 | icons/16x16/actions/view-refresh.png 23 | icons/16x16/actions/view-restore.png 24 | icons/index.theme 25 | icons/16x16/actions/edit-table-delete-row.png 26 | icons/16x16/actions/edit-table-insert-row-below.png 27 | icons/16x16/actions/help-about.png 28 | icons/16x16/actions/view-fullscreen.png 29 | icons/16x16/actions/dialog-warning.png 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/sdleventreader.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef SDLEVENTREADER_H 19 | #define SDLEVENTREADER_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #ifdef USE_SDL_2 26 | #include 27 | #else 28 | #include 29 | #endif 30 | 31 | #include "joystick.h" 32 | #include "inputdevice.h" 33 | #include "antimicrosettings.h" 34 | 35 | class SDLEventReader : public QObject 36 | { 37 | Q_OBJECT 38 | public: 39 | explicit SDLEventReader(QMap *joysticks, 40 | AntiMicroSettings *settings, 41 | QObject *parent = 0); 42 | ~SDLEventReader(); 43 | 44 | bool isSDLOpen(); 45 | 46 | protected: 47 | void initSDL(); 48 | void closeSDL(); 49 | void clearEvents(); 50 | int CheckForEvents(); 51 | 52 | QMap *joysticks; 53 | bool sdlIsOpen; 54 | AntiMicroSettings *settings; 55 | unsigned int pollRate; 56 | QTimer pollRateTimer; 57 | 58 | signals: 59 | void eventRaised(); 60 | void finished(); 61 | void sdlStarted(); 62 | void sdlClosed(); 63 | 64 | public slots: 65 | void performWork(); 66 | void stop(); 67 | void refresh(); 68 | void updatePollRate(unsigned int tempPollRate); 69 | void resetJoystickMap(); 70 | void quit(); 71 | void closeDevices(); 72 | void haltServices(); 73 | 74 | private slots: 75 | void secondaryRefresh(); 76 | 77 | }; 78 | 79 | #endif // SDLEVENTREADER_H 80 | -------------------------------------------------------------------------------- /src/setaxisthrottledialog.cpp: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | //#include 19 | 20 | #include "setaxisthrottledialog.h" 21 | #include "ui_setaxisthrottledialog.h" 22 | 23 | SetAxisThrottleDialog::SetAxisThrottleDialog(JoyAxis *axis, QWidget *parent) : 24 | QDialog(parent), 25 | ui(new Ui::SetAxisThrottleDialog) 26 | { 27 | ui->setupUi(this); 28 | 29 | this->axis = axis; 30 | 31 | QString currentText = ui->label->text(); 32 | currentText = currentText.arg(QString::number(axis->getRealJoyIndex())); 33 | ui->label->setText(currentText); 34 | 35 | connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(propogateThrottleChange())); 36 | connect(this, SIGNAL(initiateSetAxisThrottleChange()), axis, SLOT(propogateThrottleChange())); 37 | } 38 | 39 | SetAxisThrottleDialog::~SetAxisThrottleDialog() 40 | { 41 | delete ui; 42 | } 43 | 44 | void SetAxisThrottleDialog::propogateThrottleChange() 45 | { 46 | emit initiateSetAxisThrottleChange(); 47 | } 48 | -------------------------------------------------------------------------------- /src/setaxisthrottledialog.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef SETAXISTHROTTLEDIALOG_H 19 | #define SETAXISTHROTTLEDIALOG_H 20 | 21 | #include 22 | 23 | #include "joyaxis.h" 24 | 25 | namespace Ui { 26 | class SetAxisThrottleDialog; 27 | } 28 | 29 | class SetAxisThrottleDialog : public QDialog 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | explicit SetAxisThrottleDialog(JoyAxis *axis, QWidget *parent = 0); 35 | ~SetAxisThrottleDialog(); 36 | 37 | private: 38 | Ui::SetAxisThrottleDialog *ui; 39 | 40 | protected: 41 | JoyAxis *axis; 42 | 43 | signals: 44 | void initiateSetAxisThrottleChange(); 45 | 46 | private slots: 47 | void propogateThrottleChange(); 48 | 49 | }; 50 | 51 | #endif // SETAXISTHROTTLEDIALOG_H 52 | -------------------------------------------------------------------------------- /src/setaxisthrottledialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SetAxisThrottleDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 207 11 | 12 | 13 | 14 | Throttle Change 15 | 16 | 17 | 18 | 19 | 20 | The throttle setting for Axis %1 has been changed. 21 | 22 | Would you like to distribute this throttle change to all sets? 23 | 24 | 25 | Qt::AlignCenter 26 | 27 | 28 | 29 | 30 | 31 | 32 | Qt::Horizontal 33 | 34 | 35 | QDialogButtonBox::No|QDialogButtonBox::Yes 36 | 37 | 38 | false 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | buttonBox 48 | accepted() 49 | SetAxisThrottleDialog 50 | accept() 51 | 52 | 53 | 248 54 | 254 55 | 56 | 57 | 157 58 | 274 59 | 60 | 61 | 62 | 63 | buttonBox 64 | rejected() 65 | SetAxisThrottleDialog 66 | reject() 67 | 68 | 69 | 316 70 | 260 71 | 72 | 73 | 286 74 | 274 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /src/setnamesdialog.cpp: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | 20 | #include "setnamesdialog.h" 21 | #include "ui_setnamesdialog.h" 22 | 23 | 24 | SetNamesDialog::SetNamesDialog(InputDevice *device, QWidget *parent) : 25 | QDialog(parent), 26 | ui(new Ui::SetNamesDialog) 27 | { 28 | ui->setupUi(this); 29 | setAttribute(Qt::WA_DeleteOnClose); 30 | 31 | this->device = device; 32 | 33 | for (int i=0; i < InputDevice::NUMBER_JOYSETS; i++) 34 | { 35 | QString tempSetName = device->getSetJoystick(i)->getName(); 36 | ui->setNamesTableWidget->setItem(i, 0, new QTableWidgetItem(tempSetName)); 37 | } 38 | 39 | connect(this, SIGNAL(accepted()), this, SLOT(saveSetNameChanges())); 40 | } 41 | 42 | SetNamesDialog::~SetNamesDialog() 43 | { 44 | delete ui; 45 | } 46 | 47 | void SetNamesDialog::saveSetNameChanges() 48 | { 49 | for (int i=0; i < ui->setNamesTableWidget->rowCount(); i++) 50 | { 51 | QTableWidgetItem *setNameItem = ui->setNamesTableWidget->item(i, 0); 52 | QString setNameText = setNameItem->text(); 53 | QString oldSetNameText = device->getSetJoystick(i)->getName(); 54 | if (setNameText != oldSetNameText) 55 | { 56 | device->getSetJoystick(i)->setName(setNameText); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/setnamesdialog.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef SETNAMESDIALOG_H 19 | #define SETNAMESDIALOG_H 20 | 21 | #include 22 | 23 | #include "inputdevice.h" 24 | 25 | namespace Ui { 26 | class SetNamesDialog; 27 | } 28 | 29 | class SetNamesDialog : public QDialog 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | explicit SetNamesDialog(InputDevice *device, QWidget *parent = 0); 35 | ~SetNamesDialog(); 36 | 37 | protected: 38 | InputDevice *device; 39 | 40 | private: 41 | Ui::SetNamesDialog *ui; 42 | 43 | private slots: 44 | void saveSetNameChanges(); 45 | }; 46 | 47 | #endif // SETNAMESDIALOG_H 48 | -------------------------------------------------------------------------------- /src/simplekeygrabberbutton.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef SIMPLEKEYGRABBERBUTTON_H 19 | #define SIMPLEKEYGRABBERBUTTON_H 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include "joybuttonslot.h" 27 | 28 | class SimpleKeyGrabberButton : public QPushButton 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit SimpleKeyGrabberButton(QWidget *parent = 0); 33 | 34 | void setValue(int value, unsigned int alias, JoyButtonSlot::JoySlotInputAction mode=JoyButtonSlot::JoyKeyboard); 35 | void setValue(int value, JoyButtonSlot::JoySlotInputAction mode=JoyButtonSlot::JoyKeyboard); 36 | void setValue(QString value, JoyButtonSlot::JoySlotInputAction mode=JoyButtonSlot::JoyLoadProfile); 37 | JoyButtonSlot* getValue(); 38 | bool isEdited(); 39 | bool isGrabbing(); 40 | 41 | protected: 42 | virtual void keyPressEvent(QKeyEvent *event); 43 | virtual bool eventFilter(QObject *obj, QEvent *event); 44 | 45 | bool grabNextAction; 46 | bool grabbingWheel; 47 | bool edited; 48 | JoyButtonSlot buttonslot; 49 | 50 | signals: 51 | void buttonCodeChanged(int value); 52 | 53 | public slots: 54 | void refreshButtonLabel(); 55 | 56 | protected slots: 57 | 58 | }; 59 | 60 | Q_DECLARE_METATYPE(SimpleKeyGrabberButton*) 61 | 62 | #endif // SIMPLEKEYGRABBERBUTTON_H 63 | -------------------------------------------------------------------------------- /src/slotitemlistwidget.cpp: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | 20 | #include "slotitemlistwidget.h" 21 | #include "simplekeygrabberbutton.h" 22 | 23 | SlotItemListWidget::SlotItemListWidget(QWidget *parent) : 24 | QListWidget(parent) 25 | { 26 | } 27 | 28 | void SlotItemListWidget::keyPressEvent(QKeyEvent *event) 29 | { 30 | bool propogate = true; 31 | 32 | QListWidgetItem *currentItem = this->item(this->currentRow()); 33 | SimpleKeyGrabberButton *tempbutton = 0; 34 | if (currentItem) 35 | { 36 | tempbutton = currentItem->data(Qt::UserRole).value(); 37 | } 38 | 39 | if (tempbutton && tempbutton->isGrabbing()) 40 | { 41 | switch (event->key()) 42 | { 43 | case Qt::Key_Home: 44 | case Qt::Key_End: 45 | { 46 | propogate = false; 47 | break; 48 | } 49 | } 50 | } 51 | 52 | if (propogate) 53 | { 54 | QListWidget::keyPressEvent(event); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/slotitemlistwidget.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef SLOTITEMLISTWIDGET_H 19 | #define SLOTITEMLISTWIDGET_H 20 | 21 | #include 22 | #include 23 | 24 | class SlotItemListWidget : public QListWidget 25 | { 26 | Q_OBJECT 27 | public: 28 | explicit SlotItemListWidget(QWidget *parent = 0); 29 | 30 | protected: 31 | virtual void keyPressEvent(QKeyEvent *event); 32 | 33 | signals: 34 | 35 | public slots: 36 | 37 | }; 38 | 39 | #endif // SLOTITEMLISTWIDGET_H 40 | -------------------------------------------------------------------------------- /src/springmousemoveinfo.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef SPRINGMOUSEMOVEINFO_H 19 | #define SPRINGMOUSEMOVEINFO_H 20 | 21 | namespace PadderCommon { 22 | typedef struct _springModeInfo 23 | { 24 | // Displacement of the X axis 25 | double displacementX; 26 | // Displacement of the Y axis 27 | double displacementY; 28 | 29 | // Width and height of the spring mode box 30 | unsigned int width; 31 | unsigned int height; 32 | // Should the cursor not move around the center 33 | // of the screen. 34 | bool relative; 35 | int screen; 36 | double springDeadX; 37 | double springDeadY; 38 | } springModeInfo; 39 | } 40 | 41 | #endif // SPRINGMOUSEMOVEINFO_H 42 | -------------------------------------------------------------------------------- /src/stickpushbuttongroup.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef STICKPUSHBUTTONGROUP_H 19 | #define STICKPUSHBUTTONGROUP_H 20 | 21 | #include 22 | 23 | #include "joycontrolstick.h" 24 | #include "joycontrolstickpushbutton.h" 25 | #include "joycontrolstickbuttonpushbutton.h" 26 | 27 | class StickPushButtonGroup : public QGridLayout 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit StickPushButtonGroup(JoyControlStick *stick, bool displayNames = false, QWidget *parent = 0); 32 | JoyControlStick *getStick(); 33 | 34 | protected: 35 | void generateButtons(); 36 | 37 | JoyControlStick *stick; 38 | bool displayNames; 39 | 40 | JoyControlStickButtonPushButton *upButton; 41 | JoyControlStickButtonPushButton *downButton; 42 | JoyControlStickButtonPushButton *leftButton; 43 | JoyControlStickButtonPushButton *rightButton; 44 | 45 | JoyControlStickButtonPushButton *upLeftButton; 46 | JoyControlStickButtonPushButton *upRightButton; 47 | JoyControlStickButtonPushButton *downLeftButton; 48 | JoyControlStickButtonPushButton *downRightButton; 49 | 50 | JoyControlStickPushButton *stickWidget; 51 | 52 | signals: 53 | void buttonSlotChanged(); 54 | 55 | public slots: 56 | void changeButtonLayout(); 57 | void toggleNameDisplay(); 58 | 59 | private slots: 60 | void propogateSlotsChanged(); 61 | void openStickButtonDialog(); 62 | void showStickDialog(); 63 | }; 64 | 65 | #endif // STICKPUSHBUTTONGROUP_H 66 | -------------------------------------------------------------------------------- /src/uihelpers/advancebuttondialoghelper.cpp: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "advancebuttondialoghelper.h" 19 | 20 | AdvanceButtonDialogHelper::AdvanceButtonDialogHelper(JoyButton *button, 21 | QObject *parent) : 22 | QObject(parent) 23 | { 24 | Q_ASSERT(button); 25 | 26 | this->button = button; 27 | } 28 | 29 | void AdvanceButtonDialogHelper::insertAssignedSlot(int code, unsigned int alias, int index, 30 | JoyButtonSlot::JoySlotInputAction mode) 31 | { 32 | button->eventReset(); 33 | button->insertAssignedSlot(code, alias, index, mode); 34 | } 35 | 36 | void AdvanceButtonDialogHelper::setAssignedSlot(JoyButtonSlot *otherSlot, int index) 37 | { 38 | button->eventReset(); 39 | button->setAssignedSlot(otherSlot, index); 40 | } 41 | 42 | void AdvanceButtonDialogHelper::setAssignedSlot(int code, unsigned int alias, int index, 43 | JoyButtonSlot::JoySlotInputAction mode) 44 | { 45 | button->eventReset(); 46 | button->setAssignedSlot(code, alias, index, mode); 47 | } 48 | 49 | void AdvanceButtonDialogHelper::removeAssignedSlot(int index) 50 | { 51 | button->eventReset(); 52 | button->removeAssignedSlot(index); 53 | } 54 | -------------------------------------------------------------------------------- /src/uihelpers/advancebuttondialoghelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef ADVANCEBUTTONDIALOGHELPER_H 19 | #define ADVANCEBUTTONDIALOGHELPER_H 20 | 21 | #include 22 | 23 | #include "joybutton.h" 24 | #include "joybuttonslot.h" 25 | 26 | class AdvanceButtonDialogHelper : public QObject 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit AdvanceButtonDialogHelper(JoyButton *button, 31 | QObject *parent = 0); 32 | 33 | protected: 34 | JoyButton *button; 35 | 36 | signals: 37 | 38 | public slots: 39 | void setAssignedSlot(JoyButtonSlot *otherSlot, int index); 40 | void setAssignedSlot(int code, unsigned int alias, int index, 41 | JoyButtonSlot::JoySlotInputAction mode=JoyButtonSlot::JoyKeyboard); 42 | void insertAssignedSlot(int code, unsigned int alias, int index, 43 | JoyButtonSlot::JoySlotInputAction mode=JoyButtonSlot::JoyKeyboard); 44 | void removeAssignedSlot(int index); 45 | }; 46 | 47 | #endif // ADVANCEBUTTONDIALOGHELPER_H 48 | -------------------------------------------------------------------------------- /src/uihelpers/buttoneditdialoghelper.cpp: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "buttoneditdialoghelper.h" 19 | 20 | ButtonEditDialogHelper::ButtonEditDialogHelper(JoyButton *button, QObject *parent) : 21 | QObject(parent) 22 | { 23 | Q_ASSERT(button); 24 | 25 | this->button = button; 26 | } 27 | 28 | void ButtonEditDialogHelper::setAssignedSlot(int code, unsigned int alias, 29 | JoyButtonSlot::JoySlotInputAction mode) 30 | { 31 | button->clearSlotsEventReset(false); 32 | button->setAssignedSlot(code, alias, mode); 33 | } 34 | 35 | void ButtonEditDialogHelper::setUseTurbo(bool useTurbo) 36 | { 37 | button->setUseTurbo(useTurbo); 38 | } 39 | -------------------------------------------------------------------------------- /src/uihelpers/buttoneditdialoghelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef BUTTONEDITDIALOGHELPER_H 19 | #define BUTTONEDITDIALOGHELPER_H 20 | 21 | #include 22 | 23 | #include "joybutton.h" 24 | #include "joybuttonslot.h" 25 | 26 | class ButtonEditDialogHelper : public QObject 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit ButtonEditDialogHelper(JoyButton *button, QObject *parent = 0); 31 | 32 | protected: 33 | JoyButton *button; 34 | 35 | signals: 36 | 37 | public slots: 38 | void setAssignedSlot(int code, unsigned int alias, 39 | JoyButtonSlot::JoySlotInputAction mode=JoyButtonSlot::JoyKeyboard); 40 | void setUseTurbo(bool useTurbo); 41 | }; 42 | 43 | #endif // BUTTONEDITDIALOGHELPER_H 44 | -------------------------------------------------------------------------------- /src/uihelpers/dpadcontextmenuhelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DPADCONTEXTMENUHELPER_H 19 | #define DPADCONTEXTMENUHELPER_H 20 | 21 | #include 22 | #include 23 | 24 | #include "joydpad.h" 25 | #include "joybuttonslot.h" 26 | 27 | class DPadContextMenuHelper : public QObject 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit DPadContextMenuHelper(JoyDPad *dpad, QObject *parent = 0); 32 | void setPendingSlots(QHash *tempSlots); 33 | void clearPendingSlots(); 34 | 35 | protected: 36 | JoyDPad *dpad; 37 | QHash pendingSlots; 38 | 39 | signals: 40 | 41 | public slots: 42 | void setFromPendingSlots(); 43 | void clearButtonsSlotsEventReset(); 44 | }; 45 | 46 | #endif // DPADCONTEXTMENUHELPER_H 47 | -------------------------------------------------------------------------------- /src/uihelpers/dpadeditdialoghelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DPADEDITDIALOGHELPER_H 19 | #define DPADEDITDIALOGHELPER_H 20 | 21 | #include 22 | #include 23 | 24 | #include "joydpad.h" 25 | #include "joybuttonslot.h" 26 | 27 | class DPadEditDialogHelper : public QObject 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit DPadEditDialogHelper(JoyDPad *dpad, QObject *parent = 0); 32 | void setPendingSlots(QHash *tempSlots); 33 | void clearPendingSlots(); 34 | 35 | protected: 36 | JoyDPad *dpad; 37 | QHash pendingSlots; 38 | 39 | signals: 40 | 41 | public slots: 42 | void setFromPendingSlots(); 43 | void clearButtonsSlotsEventReset(); 44 | void updateJoyDPadDelay(int value); 45 | }; 46 | 47 | #endif // DPADEDITDIALOGHELPER_H 48 | -------------------------------------------------------------------------------- /src/uihelpers/gamecontrollermappingdialoghelper.cpp: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "gamecontrollermappingdialoghelper.h" 19 | 20 | GameControllerMappingDialogHelper::GameControllerMappingDialogHelper(InputDevice *device, 21 | QObject *parent) : 22 | QObject(parent) 23 | { 24 | this->device = device; 25 | } 26 | 27 | 28 | void GameControllerMappingDialogHelper::raiseDeadZones() 29 | { 30 | device->setRawAxisDeadZone(InputDevice::RAISEDDEADZONE); 31 | device->getActiveSetJoystick()->raiseAxesDeadZones(); 32 | } 33 | 34 | void GameControllerMappingDialogHelper::raiseDeadZones(int deadZone) 35 | { 36 | device->getActiveSetJoystick()->raiseAxesDeadZones(deadZone); 37 | device->setRawAxisDeadZone(deadZone); 38 | } 39 | 40 | void GameControllerMappingDialogHelper::setupDeadZones() 41 | { 42 | device->getActiveSetJoystick()->setIgnoreEventState(true); 43 | device->getActiveSetJoystick()->release(); 44 | 45 | device->getActiveSetJoystick()->currentAxesDeadZones(&originalAxesDeadZones); 46 | device->getActiveSetJoystick()->raiseAxesDeadZones(); 47 | 48 | device->setRawAxisDeadZone(InputDevice::RAISEDDEADZONE); 49 | } 50 | 51 | void GameControllerMappingDialogHelper::restoreDeviceDeadZones() 52 | { 53 | device->getActiveSetJoystick()->setIgnoreEventState(false); 54 | device->getActiveSetJoystick()->release(); 55 | device->getActiveSetJoystick()->setAxesDeadZones(&originalAxesDeadZones); 56 | 57 | device->setRawAxisDeadZone(InputDevice::RAISEDDEADZONE); 58 | } 59 | -------------------------------------------------------------------------------- /src/uihelpers/gamecontrollermappingdialoghelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef GAMECONTROLLERMAPPINGDIALOGHELPER_H 19 | #define GAMECONTROLLERMAPPINGDIALOGHELPER_H 20 | 21 | #include 22 | #include 23 | 24 | #include "inputdevice.h" 25 | 26 | class GameControllerMappingDialogHelper : public QObject 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit GameControllerMappingDialogHelper(InputDevice *device, QObject *parent = 0); 31 | 32 | protected: 33 | InputDevice *device; 34 | QList originalAxesDeadZones; 35 | 36 | signals: 37 | 38 | public slots: 39 | void raiseDeadZones(); 40 | void raiseDeadZones(int deadZone); 41 | void setupDeadZones(); 42 | void restoreDeviceDeadZones(); 43 | }; 44 | 45 | #endif // GAMECONTROLLERMAPPINGDIALOGHELPER_H 46 | -------------------------------------------------------------------------------- /src/uihelpers/joyaxiscontextmenuhelper.cpp: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "joyaxiscontextmenuhelper.h" 19 | 20 | JoyAxisContextMenuHelper::JoyAxisContextMenuHelper(JoyAxis *axis, QObject *parent) : 21 | QObject(parent) 22 | { 23 | Q_ASSERT(axis); 24 | 25 | this->axis = axis; 26 | } 27 | 28 | void JoyAxisContextMenuHelper::setNAssignedSlot(int code, unsigned int alias, 29 | JoyButtonSlot::JoySlotInputAction mode) 30 | { 31 | JoyButton *button = axis->getNAxisButton(); 32 | button->clearSlotsEventReset(false); 33 | button->setAssignedSlot(code, alias, mode); 34 | } 35 | 36 | void JoyAxisContextMenuHelper::setPAssignedSlot(int code, unsigned int alias, 37 | JoyButtonSlot::JoySlotInputAction mode) 38 | { 39 | JoyButton *button = axis->getPAxisButton(); 40 | button->clearSlotsEventReset(false); 41 | button->setAssignedSlot(code, alias, mode); 42 | } 43 | 44 | void JoyAxisContextMenuHelper::clearAndResetAxisButtons() 45 | { 46 | JoyAxisButton *nbutton = axis->getNAxisButton(); 47 | JoyAxisButton *pbutton = axis->getPAxisButton(); 48 | nbutton->clearSlotsEventReset(); 49 | pbutton->clearSlotsEventReset(); 50 | } 51 | -------------------------------------------------------------------------------- /src/uihelpers/joyaxiscontextmenuhelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYAXISCONTEXTMENUHELPER_H 19 | #define JOYAXISCONTEXTMENUHELPER_H 20 | 21 | #include 22 | 23 | #include "joyaxis.h" 24 | #include "joybuttonslot.h" 25 | 26 | class JoyAxisContextMenuHelper : public QObject 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit JoyAxisContextMenuHelper(JoyAxis *axis, QObject *parent = 0); 31 | 32 | protected: 33 | JoyAxis *axis; 34 | 35 | signals: 36 | 37 | public slots: 38 | void setNAssignedSlot(int code, unsigned int alias, 39 | JoyButtonSlot::JoySlotInputAction mode=JoyButtonSlot::JoyKeyboard); 40 | void setPAssignedSlot(int code, unsigned int alias, 41 | JoyButtonSlot::JoySlotInputAction mode=JoyButtonSlot::JoyKeyboard); 42 | void clearAndResetAxisButtons(); 43 | }; 44 | 45 | #endif // JOYAXISCONTEXTMENUHELPER_H 46 | -------------------------------------------------------------------------------- /src/uihelpers/joycontrolstickcontextmenuhelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYCONTROLSTICKCONTEXTMENUHELPER_H 19 | #define JOYCONTROLSTICKCONTEXTMENUHELPER_H 20 | 21 | #include 22 | #include 23 | 24 | #include "joycontrolstick.h" 25 | 26 | class JoyControlStickContextMenuHelper : public QObject 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit JoyControlStickContextMenuHelper(JoyControlStick *stick, QObject *parent = 0); 31 | void setPendingSlots(QHash *tempSlots); 32 | void clearPendingSlots(); 33 | 34 | protected: 35 | JoyControlStick *stick; 36 | QHash pendingSlots; 37 | 38 | signals: 39 | 40 | public slots: 41 | void setFromPendingSlots(); 42 | void clearButtonsSlotsEventReset(); 43 | }; 44 | 45 | #endif // JOYCONTROLSTICKCONTEXTMENUHELPER_H 46 | -------------------------------------------------------------------------------- /src/uihelpers/joycontrolstickeditdialoghelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYCONTROLSTICKEDITDIALOGHELPER_H 19 | #define JOYCONTROLSTICKEDITDIALOGHELPER_H 20 | 21 | #include 22 | #include 23 | 24 | #include "joycontrolstick.h" 25 | 26 | class JoyControlStickEditDialogHelper : public QObject 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit JoyControlStickEditDialogHelper(JoyControlStick *stick, QObject *parent = 0); 31 | void setPendingSlots(QHash *tempSlots); 32 | void clearPendingSlots(); 33 | 34 | protected: 35 | JoyControlStick *stick; 36 | QHash pendingSlots; 37 | 38 | signals: 39 | 40 | public slots: 41 | void setFromPendingSlots(); 42 | void clearButtonsSlotsEventReset(); 43 | void updateControlStickDelay(int value); 44 | }; 45 | 46 | #endif // JOYCONTROLSTICKEDITDIALOGHELPER_H 47 | -------------------------------------------------------------------------------- /src/uihelpers/joytabwidgethelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef JOYTABWIDGETHELPER_H 19 | #define JOYTABWIDGETHELPER_H 20 | 21 | #include 22 | 23 | #include "inputdevice.h" 24 | #include "joybutton.h" 25 | #include "joybuttonslot.h" 26 | #include "xmlconfigreader.h" 27 | #include "xmlconfigwriter.h" 28 | 29 | class JoyTabWidgetHelper : public QObject 30 | { 31 | Q_OBJECT 32 | public: 33 | explicit JoyTabWidgetHelper(InputDevice *device, QObject *parent = 0); 34 | ~JoyTabWidgetHelper(); 35 | 36 | bool hasReader(); 37 | XMLConfigReader* getReader(); 38 | 39 | bool hasWriter(); 40 | XMLConfigWriter* getWriter(); 41 | 42 | bool hasError(); 43 | QString getErrorString(); 44 | 45 | protected: 46 | InputDevice *device; 47 | XMLConfigReader *reader; 48 | XMLConfigWriter *writer; 49 | bool errorOccurred; 50 | QString lastErrorString; 51 | 52 | signals: 53 | 54 | public slots: 55 | bool readConfigFile(QString filepath); 56 | bool readConfigFileWithRevert(QString filepath); 57 | bool writeConfigFile(QString filepath); 58 | void reInitDevice(); 59 | void reInitDeviceWithRevert(); 60 | }; 61 | 62 | #endif // JOYTABWIDGETHELPER_H 63 | -------------------------------------------------------------------------------- /src/uinputhelper.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef UINPUTHELPER_H 19 | #define UINPUTHELPER_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | class UInputHelper : public QObject 26 | { 27 | Q_OBJECT 28 | public: 29 | static UInputHelper* getInstance(); 30 | void deleteInstance(); 31 | 32 | QString getDisplayString(unsigned int virtualkey); 33 | unsigned int getVirtualKey(QString codestring); 34 | 35 | protected: 36 | explicit UInputHelper(QObject *parent = 0); 37 | ~UInputHelper(); 38 | 39 | void populateKnownAliases(); 40 | 41 | static UInputHelper *_instance; 42 | QHash knownAliasesX11SymVK; 43 | QHash knownAliasesVKStrings; 44 | 45 | signals: 46 | 47 | public slots: 48 | 49 | }; 50 | 51 | #endif // UINPUTHELPER_H 52 | -------------------------------------------------------------------------------- /src/unixcapturewindowutility.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef UNIXCAPTUREWINDOWUTILITY_H 19 | #define UNIXCAPTUREWINDOWUTILITY_H 20 | 21 | #include 22 | 23 | class UnixCaptureWindowUtility : public QObject 24 | { 25 | Q_OBJECT 26 | public: 27 | explicit UnixCaptureWindowUtility(QObject *parent = 0); 28 | QString getTargetPath(); 29 | bool hasFailed(); 30 | unsigned long getTargetWindow(); 31 | 32 | protected: 33 | QString targetPath; 34 | bool failed; 35 | unsigned long targetWindow; 36 | 37 | signals: 38 | void captureFinished(); 39 | 40 | public slots: 41 | void attemptWindowCapture(); 42 | }; 43 | 44 | #endif // UNIXCAPTUREWINDOWUTILITY_H 45 | -------------------------------------------------------------------------------- /src/unixwindowinfodialog.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef UNIXWINDOWINFODIALOG_H 19 | #define UNIXWINDOWINFODIALOG_H 20 | 21 | #include 22 | #include 23 | 24 | namespace Ui { 25 | class UnixWindowInfoDialog; 26 | } 27 | 28 | class UnixWindowInfoDialog : public QDialog 29 | { 30 | Q_OBJECT 31 | 32 | public: 33 | explicit UnixWindowInfoDialog(unsigned long window, QWidget *parent = 0); 34 | ~UnixWindowInfoDialog(); 35 | 36 | enum { 37 | WindowClass = (1 << 0), 38 | WindowName = (1 << 1), 39 | WindowPath = (1 << 2) 40 | }; 41 | typedef unsigned int DialogWindowOption; 42 | 43 | QString getWindowClass(); 44 | QString getWindowName(); 45 | QString getWindowPath(); 46 | DialogWindowOption getSelectedOptions(); 47 | 48 | private: 49 | Ui::UnixWindowInfoDialog *ui; 50 | 51 | protected: 52 | DialogWindowOption selectedMatch; 53 | 54 | QString winClass; 55 | QString winName; 56 | QString winPath; 57 | 58 | private slots: 59 | void populateOption(); 60 | }; 61 | 62 | #endif // UNIXWINDOWINFODIALOG_H 63 | -------------------------------------------------------------------------------- /src/vdpad.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef VDPAD_H 19 | #define VDPAD_H 20 | 21 | #include "joydpad.h" 22 | #include "joybutton.h" 23 | 24 | class VDPad : public JoyDPad 25 | { 26 | Q_OBJECT 27 | public: 28 | explicit VDPad(int index, int originset, SetJoystick *parentSet, QObject *parent = 0); 29 | explicit VDPad(JoyButton *upButton, JoyButton *downButton, JoyButton *leftButton, JoyButton *rightButton, 30 | int index, int originset, SetJoystick *parentSet, QObject *parent = 0); 31 | ~VDPad(); 32 | 33 | void joyEvent(bool pressed, bool ignoresets=false); 34 | void addVButton(JoyDPadButton::JoyDPadDirections direction, JoyButton *button); 35 | void removeVButton(JoyDPadButton::JoyDPadDirections direction); 36 | void removeVButton(JoyButton *button); 37 | JoyButton* getVButton(JoyDPadButton::JoyDPadDirections direction); 38 | bool isEmpty(); 39 | virtual QString getName(bool forceFullFormat=false, bool displayName=false); 40 | virtual QString getXmlName(); 41 | 42 | void queueJoyEvent(bool ignoresets=false); 43 | bool hasPendingEvent(); 44 | void clearPendingEvent(); 45 | 46 | static const QString xmlName; 47 | 48 | protected: 49 | JoyButton *upButton; 50 | JoyButton *downButton; 51 | JoyButton *leftButton; 52 | JoyButton *rightButton; 53 | bool pendingVDPadEvent; 54 | 55 | signals: 56 | 57 | public slots: 58 | void activatePendingEvent(); 59 | }; 60 | 61 | #endif // VDPAD_H 62 | -------------------------------------------------------------------------------- /src/winappprofiletimerdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "winappprofiletimerdialog.h" 2 | #include "ui_winappprofiletimerdialog.h" 3 | 4 | WinAppProfileTimerDialog::WinAppProfileTimerDialog(QWidget *parent) : 5 | QDialog(parent), 6 | ui(new Ui::WinAppProfileTimerDialog) 7 | { 8 | ui->setupUi(this); 9 | setAttribute(Qt::WA_DeleteOnClose); 10 | 11 | connect(&appTimer, SIGNAL(timeout()), this, SLOT(accept())); 12 | connect(ui->capturePushButton, SIGNAL(clicked()), this, SLOT(startTimer())); 13 | connect(ui->cancelPushButton, SIGNAL(clicked()), this, SLOT(close())); 14 | } 15 | 16 | WinAppProfileTimerDialog::~WinAppProfileTimerDialog() 17 | { 18 | delete ui; 19 | } 20 | 21 | void WinAppProfileTimerDialog::startTimer() 22 | { 23 | appTimer.start(ui->intervalSpinBox->value() * 1000); 24 | this->setEnabled(false); 25 | } 26 | -------------------------------------------------------------------------------- /src/winappprofiletimerdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef WINAPPPROFILETIMERDIALOG_H 2 | #define WINAPPPROFILETIMERDIALOG_H 3 | 4 | #include 5 | #include 6 | 7 | namespace Ui { 8 | class WinAppProfileTimerDialog; 9 | } 10 | 11 | class WinAppProfileTimerDialog : public QDialog 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit WinAppProfileTimerDialog(QWidget *parent = 0); 17 | ~WinAppProfileTimerDialog(); 18 | 19 | protected: 20 | QTimer appTimer; 21 | 22 | //slots: 23 | // void 24 | 25 | private: 26 | Ui::WinAppProfileTimerDialog *ui; 27 | 28 | private slots: 29 | void startTimer(); 30 | }; 31 | 32 | #endif // WINAPPPROFILETIMERDIALOG_H 33 | -------------------------------------------------------------------------------- /src/winextras.h: -------------------------------------------------------------------------------- 1 | #ifndef WINEXTRAS_H 2 | #define WINEXTRAS_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class WinExtras : public QObject 10 | { 11 | Q_OBJECT 12 | public: 13 | static QString getDisplayString(unsigned int virtualkey); 14 | static unsigned int getVirtualKey(QString codestring); 15 | static unsigned int correctVirtualKey(unsigned int scancode, 16 | unsigned int virtualkey); 17 | static unsigned int scancodeFromVirtualKey(unsigned int virtualkey, unsigned int alias=0); 18 | 19 | static const unsigned int EXTENDED_FLAG; 20 | static QString getForegroundWindowExePath(); 21 | static bool containsFileAssociationinRegistry(); 22 | static void writeFileAssocationToRegistry(); 23 | static void removeFileAssociationFromRegistry(); 24 | static bool IsRunningAsAdmin(); 25 | static bool elevateAntiMicro(); 26 | static void disablePointerPrecision(); 27 | static void enablePointerPrecision(); 28 | static bool isUsingEnhancedPointerPrecision(); 29 | static void grabCurrentPointerPrecision(); 30 | static QString getCurrentWindowText(); 31 | static bool raiseProcessPriority(); 32 | static QPoint getCursorPos(); 33 | 34 | protected: 35 | explicit WinExtras(QObject *parent = 0); 36 | void populateKnownAliases(); 37 | 38 | static WinExtras _instance; 39 | QHash knownAliasesX11SymVK; 40 | QHash knownAliasesVKStrings; 41 | static int originalMouseAccel; 42 | 43 | signals: 44 | 45 | public slots: 46 | 47 | }; 48 | 49 | #endif // WINEXTRAS_H 50 | -------------------------------------------------------------------------------- /src/xmlconfigmigration.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef XMLCONFIGMIGRATION_H 19 | #define XMLCONFIGMIGRATION_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #include "common.h" 26 | 27 | class XMLConfigMigration : public QObject 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit XMLConfigMigration(QXmlStreamReader *reader, QObject *parent = 0); 32 | 33 | bool requiresMigration(); 34 | QString migrate(); 35 | 36 | protected: 37 | QXmlStreamReader *reader; 38 | int fileVersion; 39 | 40 | private: 41 | QString readConfigToString(); 42 | QString version0006Migration(); 43 | 44 | signals: 45 | 46 | public slots: 47 | 48 | }; 49 | 50 | #endif // XMLCONFIGMIGRATION_H 51 | -------------------------------------------------------------------------------- /src/xmlconfigreader.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef XMLCONFIGREADER_H 19 | #define XMLCONFIGREADER_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #include "inputdevice.h" 26 | #include "joystick.h" 27 | 28 | #ifdef USE_SDL_2 29 | #include "gamecontroller/gamecontroller.h" 30 | #endif 31 | 32 | #include "common.h" 33 | 34 | class XMLConfigReader : public QObject 35 | { 36 | Q_OBJECT 37 | public: 38 | explicit XMLConfigReader(QObject *parent = 0); 39 | ~XMLConfigReader(); 40 | void setJoystick(InputDevice *joystick); 41 | void setFileName(QString filename); 42 | QString getErrorString(); 43 | bool hasError(); 44 | bool read(); 45 | 46 | protected: 47 | void initDeviceTypes(); 48 | 49 | QXmlStreamReader *xml; 50 | QString fileName; 51 | QFile *configFile; 52 | InputDevice* joystick; 53 | QStringList deviceTypes; 54 | 55 | signals: 56 | 57 | public slots: 58 | void configJoystick(InputDevice *joystick); 59 | 60 | }; 61 | 62 | #endif // XMLCONFIGREADER_H 63 | -------------------------------------------------------------------------------- /src/xmlconfigwriter.h: -------------------------------------------------------------------------------- 1 | /* antimicro Gamepad to KB+M event mapper 2 | * Copyright (C) 2015 Travis Nickles 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef XMLCONFIGWRITER_H 19 | #define XMLCONFIGWRITER_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #include "inputdevice.h" 26 | #include "common.h" 27 | 28 | class XMLConfigWriter : public QObject 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit XMLConfigWriter(QObject *parent = 0); 33 | ~XMLConfigWriter(); 34 | void setFileName(QString filename); 35 | bool hasError(); 36 | QString getErrorString(); 37 | 38 | protected: 39 | QXmlStreamWriter *xml; 40 | QString fileName; 41 | QFile *configFile; 42 | InputDevice* joystick; 43 | bool writerError; 44 | QString writerErrorString; 45 | 46 | signals: 47 | 48 | public slots: 49 | void write(InputDevice* joystick); 50 | 51 | }; 52 | 53 | #endif // XMLCONFIGWRITER_H 54 | --------------------------------------------------------------------------------