8346
|
1 |
/*
|
|
2 |
* Hedgewars, a free turn based strategy game
|
9080
|
3 |
* Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
|
8346
|
4 |
*
|
|
5 |
* This program 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; version 2 of the License
|
|
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, write to the Free Software
|
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
17 |
*/
|
|
18 |
|
|
19 |
#ifndef _KEY_BINDER_H
|
|
20 |
#define _KEY_BINDER_H
|
|
21 |
|
|
22 |
#include <QWidget>
|
|
23 |
#include <QHash>
|
|
24 |
|
|
25 |
#include "binds.h"
|
|
26 |
|
|
27 |
class QListWidget;
|
|
28 |
class QTableWidgetItem;
|
|
29 |
class QTableWidget;
|
|
30 |
class QBoxLayout;
|
|
31 |
class QComboBox;
|
|
32 |
|
|
33 |
// USAGE NOTE: Every time the widget comes into view, you must call resetInterface()
|
|
34 |
|
|
35 |
class KeyBinder : public QWidget
|
|
36 |
{
|
|
37 |
Q_OBJECT
|
|
38 |
|
|
39 |
public:
|
|
40 |
KeyBinder(QWidget * parent = NULL, const QString & helpText = QString(), const QString & defaultText = QString(), const QString & resetButtonText = QString());
|
|
41 |
~KeyBinder();
|
|
42 |
|
|
43 |
void setBindIndex(int keyIndex, int bindIndex);
|
|
44 |
int bindIndex(int keyIndex);
|
|
45 |
void resetInterface();
|
|
46 |
|
|
47 |
private:
|
|
48 |
QHash<QObject *, QTableWidgetItem *> * bindComboBoxCellMappings;
|
|
49 |
QHash<QTableWidgetItem *, QComboBox *> * bindCellComboBoxMappings;
|
|
50 |
QTableWidget * selectedBindTable;
|
|
51 |
QListWidget * catList;
|
|
52 |
QBoxLayout *bindingsPages;
|
|
53 |
QComboBox * CBBind[BINDS_NUMBER];
|
|
54 |
QString defaultText;
|
|
55 |
bool enableSignal;
|
|
56 |
|
|
57 |
signals:
|
|
58 |
void bindUpdate(int bindID);
|
|
59 |
void resetAllBinds();
|
|
60 |
|
|
61 |
private slots:
|
|
62 |
void changeBindingsPage(int page);
|
|
63 |
void bindChanged(const QString &);
|
|
64 |
void bindCellClicked(QTableWidgetItem * item);
|
|
65 |
void bindSelectionChanged();
|
|
66 |
};
|
|
67 |
|
|
68 |
#endif // _KEY_BINDER_H
|