1 /* Copyright 2013 Theo Berkau <cwx@cyberwarriorx.com>
2
3 This file is part of Yabause.
4
5 Yabause is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 Yabause is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Yabause; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 #include "UIMouseSetting.h"
20 #include "UIPortManager.h"
21 #include "../Settings.h"
22
23 #include <QKeyEvent>
24 #include <QTimer>
25 #include <QStylePainter>
26 #include <QStyleOptionToolButton>
27
UIMouseSetting(PerInterface_struct * core,uint port,uint pad,uint perType,QWidget * parent)28 UIMouseSetting::UIMouseSetting( PerInterface_struct* core, uint port, uint pad, uint perType, QWidget* parent )
29 : UIControllerSetting( core, port, pad, perType, parent )
30 {
31 setupUi( this );
32 setInfos(lInfos);
33
34 mButtons[ tbStart ] = PERMOUSE_START;
35 mButtons[ tbA ] = PERMOUSE_MIDDLE;
36 mButtons[ tbB ] = PERMOUSE_LEFT;
37 mButtons[ tbC ] = PERMOUSE_RIGHT;
38 mButtons[ tbAxis ] = PERMOUSE_AXIS;
39
40 mNames[ PERMOUSE_START ] = "Start";
41 mNames[ PERMOUSE_MIDDLE ] = "Middle";
42 mNames[ PERMOUSE_LEFT ] = "Left";
43 mNames[ PERMOUSE_RIGHT ] = "Right";
44 mNames[ PERMOUSE_AXIS ] = "Axis";
45
46 mScanMasks[ PERMOUSE_START ] = PERSF_KEY | PERSF_BUTTON | PERSF_HAT;
47 mScanMasks[ PERMOUSE_MIDDLE ] = PERSF_KEY | PERSF_BUTTON | PERSF_HAT;
48 mScanMasks[ PERMOUSE_LEFT ] = PERSF_KEY | PERSF_BUTTON | PERSF_HAT;
49 mScanMasks[ PERMOUSE_RIGHT ] = PERSF_KEY | PERSF_BUTTON | PERSF_HAT;
50 mScanMasks[ PERMOUSE_AXIS ] = PERSF_MOUSEMOVE;
51
52 loadPadSettings();
53
54 foreach ( QToolButton* tb, findChildren<QToolButton*>() )
55 {
56 tb->installEventFilter( this );
57 connect( tb, SIGNAL( clicked() ), this, SLOT( tbButton_clicked() ) );
58 }
59
60 connect( mTimer, SIGNAL( timeout() ), this, SLOT( timer_timeout() ) );
61
62 QtYabause::retranslateWidget( this );
63 }
64
~UIMouseSetting()65 UIMouseSetting::~UIMouseSetting()
66 {
67 }
68