summaryrefslogtreecommitdiff
path: root/src/frontend/settingsdialogs/cacceleratorsettings.h
blob: 4af867b332226d44899d251e141b6c327b6ee6cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2009 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/

#ifndef CACCELERATORSETTINGS_H
#define CACCELERATORSETTINGS_H

#include "btshortcutseditor.h"

#include "util/cpointers.h"
//#include "backend/config/cbtconfig.h"
#include "frontend/bookshelfmanager/btconfigdialog.h"

#include <QWidget>
#include <QPointer>

class QComboBox;
class QStackedWidget;
class BtActionCollection;
class BtShortcutsEditor;

/**
	@author The BibleTime team <info@bibletime.info>
*/
class CAcceleratorSettingsPage : public BtConfigPage, CPointers
{
	Q_OBJECT

public:
    CAcceleratorSettingsPage(QWidget *parent);
    ~CAcceleratorSettingsPage();
	void save();
	QString iconName();
	QString label();
	QString header();

protected slots:

	void slotKeyChooserTypeChanged(const QString& title);

	// complete the keyChangeRequest
	void completeKeyChangeRequest(BtShortcutsEditor* shortcutsEditor, const QString& keys);

private:
	struct WindowType {
		QPointer<BtShortcutsEditor> keyChooser;
		BtActionCollection* actionCollection;
		QString title;

		WindowType() {
			keyChooser = 0;
			actionCollection = 0;
		};
		WindowType(const QString& newTitle) {
			title = newTitle;
			keyChooser = 0;
			actionCollection = 0;
		}
	};

	void clearConflictsWithKeys(const QString& keys, const QList<BtShortcutsEditor*> list);
	QString findConflictsWithKeys(const QString& keys, const QList<BtShortcutsEditor*> list);
	QList<BtShortcutsEditor*> getShortcutsEditorListForGroup(BtShortcutsEditor* currentEditor);
	QString getTitleForEditor(BtShortcutsEditor* editor);

	WindowType m_application;
	WindowType m_general;
	WindowType m_bible;
	WindowType m_commentary;
	WindowType m_lexicon;
	WindowType m_book;

	QComboBox* m_typeChooser;
	QStackedWidget* m_keyChooserStack;

};

#endif