]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/sout.hpp
220333650ae062e7fe493bed2785764b1557cc9f
[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 class QPushButton;
37 class QToolButton;
38 class QCheckBox;
39 class QGridLayout;
40 class QTextEdit;
41
42 class SoutMrl
43 {
44 public:
45     SoutMrl( const QString& head = "")
46     {
47         mrl = head;
48         b_first = true;
49         b_has_bracket = false;
50     }
51
52     QString getMrl()
53     {
54         return mrl;
55     }
56
57     void begin( const QString& module )
58     {
59         if( !b_first )
60             mrl += ":";
61         b_first = false;
62
63         mrl += module;
64         b_has_bracket = false;
65     }
66     void end()
67     {
68         if( b_has_bracket )
69             mrl += "}";
70     }
71     void option( const QString& option, const QString& value = "" )
72     {
73         if( !b_has_bracket )
74             mrl += "{";
75         else
76             mrl += ",";
77         b_has_bracket = true;
78
79         mrl += option;
80
81         if( !value.isEmpty() )
82         {
83             char *psz = config_StringEscape( qtu(value) );
84             if( psz )
85             {
86                 mrl += "=" + qfu( psz );
87                 free( psz );
88             }
89         }
90     }
91     void option( const QString& name, const int i_value, const int i_precision = 10 )
92     {
93         option( name, QString::number( i_value, i_precision ) );
94     }
95     void option( const QString& name, const double f_value )
96     {
97         option( name, QString::number( f_value ) );
98     }
99
100     void option( const QString& name, const QString& base, const int i_value, const int i_precision = 10 )
101     {
102         option( name, base + ":" + QString::number( i_value, i_precision ) );
103     }
104
105 private:
106     QString mrl;
107     bool b_has_bracket;
108     bool b_first;
109 };
110
111
112 class SoutDialog : public QVLCDialog
113 {
114     Q_OBJECT;
115 public:
116     SoutDialog( QWidget* parent, intf_thread_t *, const QString& mrl = "");
117     virtual ~SoutDialog(){}
118
119     QString getMrl(){ return mrl; }
120
121 private:
122     Ui::Sout ui;
123
124     QString mrl;
125     QPushButton *okButton;
126     QToolButton *closeTabButton;
127
128 public slots:
129     void updateMRL();
130
131 private slots:
132     void ok();
133     void cancel();
134     void next();
135     void prev();
136     void closeTab();
137     void tabChanged( int );
138     void addDest();
139 };
140
141 #endif