source: smplayer/trunk/src/actionseditor.h@ 124

Last change on this file since 124 was 124, checked in by Silvan Scherrer, 13 years ago

SMPlayer: 0.7.1 trunk update

  • Property svn:eol-style set to LF
File size: 2.7 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2012 Ricardo Villalba <rvm@users.sourceforge.net>
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 2 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, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17*/
18
19/* This is based on qq14-actioneditor-code.zip from Qt */
20
21#ifndef _ACTIONSEDITOR_H_
22#define _ACTIONSEDITOR_H_
23
24#include <QWidget>
25#include <QList>
26#include <QStringList>
27#include "guiconfig.h"
28
29class QTableWidget;
30class QTableWidgetItem;
31class QAction;
32class QSettings;
33class QPushButton;
34
35class ActionsEditor : public QWidget
36{
37 Q_OBJECT
38
39public:
40 ActionsEditor( QWidget * parent = 0, Qt::WindowFlags f = 0 );
41 ~ActionsEditor();
42
43 // Clear the actionlist
44 void clear();
45
46 // There are no actions yet?
47 bool isEmpty();
48
49 void addActions(QWidget * widget);
50
51 // Static functions
52 static QAction * findAction(QObject *o, const QString & name);
53 static QStringList actionsNames(QObject *o);
54
55 static void saveToConfig(QObject *o, QSettings *set);
56 static void loadFromConfig(QObject *o, QSettings *set);
57
58#if USE_MULTIPLE_SHORTCUTS
59 static QString shortcutsToString(QList <QKeySequence> shortcuts_list);
60 static QList <QKeySequence> stringToShortcuts(QString shortcuts);
61#endif
62
63public slots:
64 void applyChanges();
65 void saveActionsTable();
66 bool saveActionsTable(const QString & filename);
67 void loadActionsTable();
68 bool loadActionsTable(const QString & filename);
69
70 void updateView();
71
72protected:
73 virtual void retranslateStrings();
74 virtual void changeEvent ( QEvent * event ) ;
75
76 // Find in table, not in actionslist
77 int findActionName(const QString & name);
78 int findActionAccel(const QString & accel, int ignoreRow = -1);
79 bool hasConflicts();
80
81protected slots:
82#if !USE_SHORTCUTGETTER
83 void recordAction(QTableWidgetItem*);
84 void validateAction(QTableWidgetItem*);
85#else
86 void editShortcut();
87#endif
88
89private:
90 QTableWidget *actionsTable;
91 QList<QAction*> actionsList;
92 QPushButton *saveButton;
93 QPushButton *loadButton;
94 QString latest_dir;
95
96#if USE_SHORTCUTGETTER
97 QPushButton *editButton;
98#else
99 QString oldAccelText;
100 bool dont_validate;
101#endif
102};
103
104#endif
Note: See TracBrowser for help on using the repository browser.