1
/* smplayer, GUI front-end for mplayer.
2
Copyright (C) 2006-2009 Ricardo Villalba <rvm@escomposlinux.org>
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.
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.
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
19
#include "toolbareditor.h"
21
QStringList ToolbarEditor::save(QWidget * w) {
22
qDebug("ToolbarEditor::save: '%s'", w->objectName().toUtf8().data());
24
QList<QAction *> list = w->actions();
28
for (int n = 0; n < list.count(); n++) {
29
action = static_cast<QAction*> (list[n]);
30
if (action->isSeparator()) {
34
if (!action->objectName().isEmpty()) {
35
o << action->objectName();
38
qWarning("ToolbarEditor::save: unknown action at pos %d", n);
44
void ToolbarEditor::load(QWidget *w, QStringList l, QList<QAction *> actions_list)
46
qDebug("ToolbarEditor::load: '%s'", w->objectName().toUtf8().data());
50
for (int n = 0; n < l.count(); n++) {
51
qDebug("ToolbarEditor::load: loading action %s", l[n].toUtf8().data());
53
if (l[n] == "separator") {
54
qDebug("ToolbarEditor::load: adding separator");
55
QAction * sep = new QAction(w);
56
sep->setSeparator(true);
59
action = findAction(l[n], actions_list);
63
qWarning("ToolbarEditor::load: action %s not found", l[n].toUtf8().data());
69
QAction * ToolbarEditor::findAction(QString s, QList<QAction *> actions_list) {
72
for (int n = 0; n < actions_list.count(); n++) {
73
action = static_cast<QAction*> (actions_list[n]);
74
if (action->objectName() == s) return action;