]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/toolbar.hpp
Qt: toolbar-profile, provide 4 profiles, one being close to 0.8.6 interface, the...
[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 #define PROFILE_NAME_1 "Modern Style"
35 #define VALUE_1 "0|64;39;64;38;65;|0-2;64;3;1;4;64;7;10;9;64-4;37;65;35-4;|12;11;13;14;|5-1;33;6-1;|0-2;64;3;1;4;64;37;64;38;64;8;65;35-4;34;"
36 #define PROFILE_NAME_2 "Classic Style"
37 #define VALUE_2 "1|64;39-1;64;38;13-1;|2-1;32-4;0-5;1-5;32-5;3-5;5-5;6-5;4-5;32-5;10-1;64-1;35-1;65;|12-1;11-1;13-1;14-1;|33;37-4;|0-5;1-5;32-1;1-5;5-1;6-1;4-5;32-1;12-5;11-1;65;34-4;35-1;"
38 #define PROFILE_NAME_3 "Minimalist Style"
39 #define VALUE_3 "0|64;65;|0-7;64;3-1;1-5;4-1;64;12-5;64-5;37-4;38;64-4;10-1;65;36-4;|11;13;13;|5-1;33;6-1;|0-5;64;3-5;1-5;4-5;64;12-5;65;34-4;35-1;"
40 #define PROFILE_NAME_4 "One-Liner Style"
41 #define VALUE_4 "0|64;38;65;|0-4;64;3;1;4;64;7;10;9;64-4;39;64-4;37;65;36-4;|12;11;14;13;|5-1;33;6-1;|0-2;64;3;1;4;64;37;64;38;64;8;65;35-4;34;"
42
43 class ToolbarEditDialog;
44 class DroppingController;
45 class QCheckBox;
46 class QComboBox;
47
48 class WidgetListing : public QListWidget
49 {
50     Q_OBJECT;
51 public:
52     WidgetListing( intf_thread_t *, QWidget *_parent = 0 );
53 protected:
54     virtual void startDrag( Qt::DropActions /*supportedActions*/ );
55 private:
56     ToolbarEditDialog *parent;
57 };
58
59 class ToolbarEditDialog : public QVLCFrame
60 {
61     Q_OBJECT;
62 public:
63     static ToolbarEditDialog * getInstance( intf_thread_t *p_intf )
64     {
65         if( !instance)
66             instance = new ToolbarEditDialog( p_intf );
67         return instance;
68     }
69     static void killInstance()
70     { if( instance ) delete instance; instance = NULL;}
71     virtual ~ToolbarEditDialog();
72     int getOptions() { return flatBox->isChecked() * WIDGET_FLAT +
73                         bigBox->isChecked() * WIDGET_BIG +
74                         !shinyBox->isChecked() * WIDGET_SHINY; }
75 private:
76     ToolbarEditDialog( intf_thread_t * );
77     static ToolbarEditDialog *instance;
78
79     QCheckBox *flatBox, *bigBox, *shinyBox;
80     QComboBox *positionCombo, *profileCombo;
81
82     WidgetListing *widgetListing;
83     DroppingController *controller1, *controller2, *controllerA;
84     DroppingController *controllerFSC, *controller;
85
86 private slots:
87     void newProfile();
88     void deleteProfile();
89     void changeProfile( int );
90     void cancel();
91     void close();
92 };
93
94 class DroppingController: public AbstractController
95 {
96     Q_OBJECT;
97 public:
98     DroppingController( intf_thread_t *, QString line, QWidget *parent = 0 );
99     QString getValue();
100     virtual ~DroppingController();
101
102     void resetLine( QString );
103 protected:
104     virtual void createAndAddWidget( QBoxLayout *controlLayout, int i_index,
105             buttonType_e i_type, int i_option );
106     virtual void dragEnterEvent ( QDragEnterEvent * event );
107     virtual void dragMoveEvent(QDragMoveEvent *event);
108     virtual void dropEvent ( QDropEvent * event );
109     virtual void dragLeaveEvent ( QDragLeaveEvent * event );
110
111     virtual void doAction( int );
112
113     bool eventFilter( QObject *, QEvent * );
114 private:
115     struct doubleInt
116     {
117         int i_type;
118         int i_option;
119     };
120     QRubberBand *rubberband;
121     QList <doubleInt *> widgetList;
122
123     int getParentPosInLayout( QPoint point);
124
125     bool b_draging;
126
127 };
128
129 #endif
130