]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/toolbar.hpp
Qt: addons: fix background paint glitch with new editor
[vlc] / modules / gui / qt4 / dialogs / toolbar.hpp
1 /*****************************************************************************
2  * toolbar.hpp : ToolbarEdit dialogs
3  ****************************************************************************
4  * Copyright (C) 2008-2011 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 QVLC_TOOLBAREDIT_DIALOG_H_
25 #define QVLC_TOOLBAREDIT_DIALOG_H_ 1
26
27 #include "util/qvlcframe.hpp"                                 /* QVLCDialog */
28 #include "components/controller.hpp"                  /* AbstractController */
29
30 #include <QListWidget>
31 #include <QCheckBox>
32
33 #define PROFILE_NAME_1 "VLC 1.1.x Style"
34 #define VALUE_1 "0|64;39;64;38;65;|0-2;64;3;1;4;64;7;10;9;64-4;20;19;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;25;35-4;34;"
35 #define PROFILE_NAME_2 "VLC 0.8.x Style"
36 #define VALUE_2 "1|64;39-1;64;38;|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;"
37 #define PROFILE_NAME_3 "Minimalist Style"
38 #define VALUE_3 "0|64;65;|0-7;64;3-1;1-5;4-1;64;12-5;64-5;37-5;38-5;64-4;10-1;65;36-4;|11-5;13-5;14-5;|5-1;33;6-1;|0-5;64;3-5;1-5;4-5;64;12-5;65;34-4;35-1;"
39 #define PROFILE_NAME_4 "One-Liner Style"
40 #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;25;35-4;34;"
41 #define PROFILE_NAME_5 "Simplest Style"
42 #define VALUE_5 "0||36-4;65-4;0-7;4-5;1-5;65-4;7-5;|12-4;11;13;||36-4;65-4;0-5;4-5;1-5;65;8-5;"
43 #define PROFILE_NAME_6 "VLC 2.x.x Style"
44 #define VALUE_6 "0|64;39;64;38;65;|0-2;64;3;1;4;64;7;9;64;10;20;19;64-4;37;65;35-4;|12;11;13;14;|43;33-4;44;|0-2;64;3;1;4;64;37;64;38;64;8;65;25;35-4;34;"
45
46 class ToolbarEditDialog;
47 class DroppingController;
48 class QComboBox;
49 class QRubberBand;
50
51 class WidgetListing : public QListWidget
52 {
53     Q_OBJECT
54 public:
55     WidgetListing( intf_thread_t *, QWidget *_parent = 0 );
56 protected:
57     virtual void startDrag( Qt::DropActions /*supportedActions*/ );
58 private:
59     ToolbarEditDialog *parent;
60 };
61
62 class ToolbarEditDialog : public QVLCDialog
63 {
64     Q_OBJECT
65 public:
66     ToolbarEditDialog( QWidget *, intf_thread_t * );
67     int getOptions() { return flatBox->isChecked() * WIDGET_FLAT +
68                         bigBox->isChecked() * WIDGET_BIG +
69                         !shinyBox->isChecked() * WIDGET_SHINY; }
70     virtual ~ToolbarEditDialog();
71
72 private:
73     QCheckBox *flatBox, *bigBox, *shinyBox;
74     QComboBox *positionCombo, *profileCombo;
75
76     WidgetListing *widgetListing;
77     DroppingController *controller1, *controller2, *controllerA;
78     DroppingController *controllerFSC, *controller;
79
80 private slots:
81     void newProfile();
82     void deleteProfile();
83     void changeProfile( int );
84     void cancel();
85     void close();
86 };
87
88 class DroppingController: public AbstractController
89 {
90     Q_OBJECT
91 public:
92     DroppingController( intf_thread_t *, const QString& line, QWidget *parent = 0 );
93     QString getValue();
94     virtual ~DroppingController();
95
96     void resetLine( const QString& );
97 protected:
98     virtual void createAndAddWidget( QBoxLayout *controlLayout, int i_index,
99             buttonType_e i_type, int i_option );
100     virtual void dragEnterEvent ( QDragEnterEvent * event );
101     virtual void dragMoveEvent(QDragMoveEvent *event);
102     virtual void dropEvent ( QDropEvent * event );
103     virtual void dragLeaveEvent ( QDragLeaveEvent * event );
104
105     virtual void doAction( int );
106
107     virtual bool eventFilter( QObject *, QEvent * );
108
109 private:
110     struct doubleInt
111     {
112         int i_type;
113         int i_option;
114     };
115     QRubberBand *rubberband;
116     QList <doubleInt *> widgetList;
117
118     int i_dragIndex;
119     bool b_draging;
120
121     int getParentPosInLayout( QPoint point);
122 };
123
124 #endif