]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/toolbar.hpp
[Qt] Save the values saved during Toolbar edition.
[vlc] / modules / gui / qt4 / dialogs / toolbar.hpp
1 /*****************************************************************************
2  * ToolbarEdit.hpp : ToolbarEdit dialogs
3  ****************************************************************************
4  * Copyright (C) 2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Jean-Baptiste Kempf <jb (at) videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifndef _TOOLBAREDIT_DIALOG_H_
25 #define _TOOLBAREDIT_DIALOG_H_
26
27 #include "util/qvlcframe.hpp"
28 #include "components/controller.hpp"
29
30 #include <QRubberBand>
31 #include <QListWidget>
32
33 class ToolbarEditDialog;
34 class DroppingController;
35
36 class WidgetListing : public QListWidget
37 {
38     Q_OBJECT;
39 public:
40     WidgetListing( intf_thread_t *, QWidget *_parent = 0 );
41 protected:
42     virtual void startDrag( Qt::DropActions /*supportedActions*/ );
43 private:
44     ToolbarEditDialog *parent;
45 };
46
47 class ToolbarEditDialog : public QVLCFrame
48 {
49     Q_OBJECT;
50 public:
51     static ToolbarEditDialog * getInstance( intf_thread_t *p_intf )
52     {
53         if( !instance)
54             instance = new ToolbarEditDialog( p_intf );
55         return instance;
56     }
57     virtual ~ToolbarEditDialog();
58     int getOptions() { return flatBox->isChecked() * WIDGET_FLAT +
59                         bigBox->isChecked() * WIDGET_BIG +
60                         shinyBox->isChecked() * WIDGET_SHINY; }
61 private:
62     ToolbarEditDialog( intf_thread_t * );
63     static ToolbarEditDialog *instance;
64
65     QCheckBox *flatBox, *bigBox, *shinyBox;
66
67     WidgetListing *widgetListing;
68     DroppingController *controller1, *controller2, *controllerA;
69     DroppingController *controllerFSC, *controller;
70
71 private slots:
72     void cancel();
73     void close();
74 };
75
76 class DroppingController: public AbstractController
77 {
78     Q_OBJECT;
79 public:
80     DroppingController( intf_thread_t *, QString line, QWidget *parent = 0 );
81     QString getValue();
82
83 protected:
84     virtual void createAndAddWidget( QBoxLayout *controlLayout, int i_index,
85             buttonType_e i_type, int i_option );
86     virtual void dragEnterEvent ( QDragEnterEvent * event );
87     virtual void dragMoveEvent(QDragMoveEvent *event);
88     virtual void dropEvent ( QDropEvent * event );
89     virtual void dragLeaveEvent ( QDragLeaveEvent * event );
90
91     virtual void doAction( int );
92 private:
93     struct doubleInt
94     {
95         int i_type;
96         int i_option;
97     };
98     QRubberBand *rubberband;
99     QList <doubleInt *> widgetList;
100
101     int getParentPosInLayout( QPoint point);
102
103 };
104
105 #endif
106