[112] | 1 | /* smplayer, GUI front-end for mplayer.
|
---|
[188] | 2 | Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
[112] | 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 |
|
---|
[176] | 19 | #ifndef TOOLBAR_EDITOR_H
|
---|
| 20 | #define TOOLBAR_EDITOR_H
|
---|
[112] | 21 |
|
---|
| 22 | #include <QStringList>
|
---|
| 23 | #include <QWidget>
|
---|
| 24 | #include <QList>
|
---|
| 25 | #include <QAction>
|
---|
[128] | 26 | #include "ui_toolbareditor.h"
|
---|
[112] | 27 |
|
---|
[128] | 28 | class QListWidget;
|
---|
| 29 |
|
---|
| 30 | class ToolbarEditor : public QDialog, public Ui::ToolbarEditor
|
---|
[112] | 31 | {
|
---|
[128] | 32 | Q_OBJECT
|
---|
| 33 |
|
---|
[112] | 34 | public:
|
---|
| 35 |
|
---|
[128] | 36 | ToolbarEditor( QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
---|
| 37 | ~ToolbarEditor();
|
---|
| 38 |
|
---|
| 39 | void setAllActions(QList<QAction *> actions_list);
|
---|
| 40 | void setActiveActions(QList<QAction *> actions_list);
|
---|
| 41 |
|
---|
| 42 | QStringList activeActionsToStringList();
|
---|
| 43 |
|
---|
| 44 | void setDefaultActions(QStringList action_names) { default_actions = action_names; }
|
---|
| 45 | QStringList defaultActions() { return default_actions; }
|
---|
| 46 |
|
---|
[176] | 47 | void setIconSize(int size);
|
---|
| 48 | int iconSize();
|
---|
| 49 |
|
---|
[112] | 50 | //! Save the widget's list of actions into a QStringList
|
---|
| 51 | static QStringList save(QWidget *w);
|
---|
| 52 |
|
---|
[128] | 53 | //! Add to the widget the actions specified in l. actions_list is
|
---|
[112] | 54 | //! the list of all available actions
|
---|
| 55 | static void load(QWidget *w, QStringList l, QList<QAction *> actions_list);
|
---|
| 56 |
|
---|
[128] | 57 | protected slots:
|
---|
| 58 | void on_up_button_clicked();
|
---|
| 59 | void on_down_button_clicked();
|
---|
| 60 | void on_right_button_clicked();
|
---|
| 61 | void on_left_button_clicked();
|
---|
| 62 | void on_separator_button_clicked();
|
---|
| 63 | void restoreDefaults();
|
---|
| 64 | void checkRowsAllList(int currentRow);
|
---|
| 65 | void checkRowsActiveList(int currentRow);
|
---|
| 66 |
|
---|
[112] | 67 | protected:
|
---|
| 68 | static QAction * findAction(QString s, QList<QAction *> actions_list);
|
---|
[128] | 69 |
|
---|
| 70 | static void populateList(QListWidget * w, QList<QAction *> actions_list, bool add_separators = false);
|
---|
| 71 | static int findItem(const QString & action_name, QListWidget * w);
|
---|
| 72 |
|
---|
| 73 | static QString fixname(const QString & name, const QString & action_name);
|
---|
| 74 |
|
---|
| 75 | QList<QAction *> all_actions_copy;
|
---|
| 76 | QStringList default_actions;
|
---|
[112] | 77 | };
|
---|
| 78 |
|
---|
| 79 | #endif
|
---|
| 80 |
|
---|