]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/toolbar.hpp
Qt: save and honour the above-video parameter to allow old-fashion GUI.
[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 #include <QCheckBox>
33
34 class ToolbarEditDialog;
35 class DroppingController;
36 class QCheckBox;
37 class QComboBox;
38
39 class WidgetListing : public QListWidget
40 {
41     Q_OBJECT;
42 public:
43     WidgetListing( intf_thread_t *, QWidget *_parent = 0 );
44 protected:
45     virtual void startDrag( Qt::DropActions /*supportedActions*/ );
46 private:
47     ToolbarEditDialog *parent;
48 };
49
50 class ToolbarEditDialog : public QVLCFrame
51 {
52     Q_OBJECT;
53 public:
54     static ToolbarEditDialog * getInstance( intf_thread_t *p_intf )
55     {
56         if( !instance)
57             instance = new ToolbarEditDialog( p_intf );
58         return instance;
59     }
60     virtual ~ToolbarEditDialog();
61     int getOptions() { return flatBox->isChecked() * WIDGET_FLAT +
62                         bigBox->isChecked() * WIDGET_BIG +
63                         shinyBox->isChecked() * WIDGET_SHINY; }
64 private:
65     ToolbarEditDialog( intf_thread_t * );
66     static ToolbarEditDialog *instance;
67
68     QCheckBox *flatBox, *bigBox, *shinyBox;
69     QComboBox *positionCombo;
70
71     WidgetListing *widgetListing;
72     DroppingController *controller1, *controller2, *controllerA;
73     DroppingController *controllerFSC, *controller;
74
75 private slots:
76     void cancel();
77     void close();
78 };
79
80 class DroppingController: public AbstractController
81 {
82     Q_OBJECT;
83 public:
84     DroppingController( intf_thread_t *, QString line, QWidget *parent = 0 );
85     QString getValue();
86     virtual ~DroppingController();
87
88 protected:
89     virtual void createAndAddWidget( QBoxLayout *controlLayout, int i_index,
90             buttonType_e i_type, int i_option );
91     virtual void dragEnterEvent ( QDragEnterEvent * event );
92     virtual void dragMoveEvent(QDragMoveEvent *event);
93     virtual void dropEvent ( QDropEvent * event );
94     virtual void dragLeaveEvent ( QDragLeaveEvent * event );
95
96     virtual void doAction( int );
97
98     bool eventFilter( QObject *, QEvent * );
99 private:
100     struct doubleInt
101     {
102         int i_type;
103         int i_option;
104     };
105     QRubberBand *rubberband;
106     QList <doubleInt *> widgetList;
107
108     int getParentPosInLayout( QPoint point);
109
110     bool b_draging;
111
112 };
113
114 #endif
115