]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/sout.hpp
Qt, sout: fix compilation on older moc version
[vlc] / modules / gui / qt4 / dialogs / sout.hpp
1 /*****************************************************************************
2  * sout.hpp : Stream output dialog ( old-style, ala WX )
3  ****************************************************************************
4  * Copyright ( C ) 2006 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@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_SOUT_DIALOG_H_
25 #define QVLC_SOUT_DIALOG_H_ 1
26
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30
31 #include <vlc_common.h> /* Gettext functions */
32
33 #include "ui/sout.h"
34 #include "util/qvlcframe.hpp"
35
36 #include <QWizard>
37
38 class QPushButton;
39 class QToolButton;
40 class QCheckBox;
41 class QGridLayout;
42 class QTextEdit;
43
44 class SoutMrl
45 {
46 public:
47     SoutMrl( const QString& head = "")
48     {
49         mrl = head;
50         b_first = true;
51         b_has_bracket = false;
52     }
53
54     QString getMrl()
55     {
56         return mrl;
57     }
58
59     void begin( const QString& module )
60     {
61         if( !b_first )
62             mrl += ":";
63         b_first = false;
64
65         mrl += module;
66         b_has_bracket = false;
67     }
68     void end()
69     {
70         if( b_has_bracket )
71             mrl += "}";
72     }
73     void option( const QString& option, const QString& value = "" )
74     {
75         if( !b_has_bracket )
76             mrl += "{";
77         else
78             mrl += ",";
79         b_has_bracket = true;
80
81         mrl += option;
82
83         if( !value.isEmpty() )
84         {
85             char *psz = config_StringEscape( qtu(value) );
86             if( psz )
87             {
88                 mrl += "=" + qfu( psz );
89                 free( psz );
90             }
91         }
92     }
93     void option( const QString& name, const int i_value, const int i_precision = 10 )
94     {
95         option( name, QString::number( i_value, i_precision ) );
96     }
97     void option( const QString& name, const double f_value )
98     {
99         option( name, QString::number( f_value ) );
100     }
101
102     void option( const QString& name, const QString& base, const int i_value, const int i_precision = 10 )
103     {
104         option( name, base + ":" + QString::number( i_value, i_precision ) );
105     }
106
107 private:
108     QString mrl;
109     bool b_has_bracket;
110     bool b_first;
111 };
112
113
114 class SoutDialog : public QWizard
115 {
116     Q_OBJECT
117 public:
118     SoutDialog( QWidget* parent, intf_thread_t *, const QString& mrl = "");
119     virtual ~SoutDialog(){}
120
121     QString getMrl(){ return mrl; }
122
123 private:
124     Ui::Sout ui;
125
126     QString mrl;
127     QPushButton *okButton;
128     QToolButton *closeTabButton;
129
130     intf_thread_t* p_intf;
131
132 public slots:
133     void updateMRL();
134
135 private slots:
136     void ok();
137     void cancel();
138     void closeTab();
139     void tabChanged( int );
140     void addDest();
141 };
142
143 #endif