]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/vlm.cpp
Qt4 - Coding style fixes by Rémi Duraffort.
[vlc] / modules / gui / qt4 / dialogs / vlm.cpp
1 /*****************************************************************************
2  * sout.cpp : stream output dialog ( old-style )
3  ****************************************************************************
4  * Copyright ( C ) 2006 the VideoLAN team
5  * $Id: sout.cpp 21875 2007-09-08 16:01:33Z jb $
6  *
7  * Authors: Clément Stenac <zorglub@videolan.org>
8  *          Jean-Baptiste Kempf <jb@videolan.org>
9  *          Jean-François Massol <jf.massol -at- gmail.com>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * ( at your option ) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin street, Fifth Floor, Boston MA 02110-1301, USA.
24  *****************************************************************************/
25
26 #include "dialogs/vlm.hpp"
27 #include <vlc_streaming.h>
28
29 #include <iostream>
30 #include <QString>
31 #include <QFileDialog>
32 #include <QComboBox>
33 #include <QVBoxLayout>
34 #include <QStackedWidget>
35 #include <QLabel>
36 #include <QWidget>
37 #include <QGridLayout>
38 #include <QLineEdit>
39 #include <QCheckBox>
40 #include <QToolButton>
41 #include <QGroupBox>
42 #include <QPushButton>
43 #include <QHBoxLayout>
44 #include <QTimeEdit>
45 #include <QDateEdit>
46 #include <QSpinBox>
47
48 VLMDialog *VLMDialog::instance = NULL;
49
50
51 VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
52 {
53     // UI stuff
54     ui.setupUi( this );
55
56     /* Layout in the main groupBox */
57     layout = new QVBoxLayout( ui.groupBox );
58
59     mediatype = new QComboBox( ui.groupBox );
60     layout->addWidget( mediatype );
61
62 #define ADDMEDIATYPES( type ) mediatype->addItem( qtr( type ) );
63
64     ADDMEDIATYPES( "Broadcast" );
65     ADDMEDIATYPES( "Video On Demand ( VOD )" );
66     ADDMEDIATYPES( "Schedule" );
67
68     makeBcastPage();
69     makeVODPage();
70     makeSchedulePage();
71
72     /* Create a Stacked Widget to old the different phases */
73     slayout = new QStackedWidget( ui.groupBox );
74     slayout->addWidget( pBcast );
75     slayout->addWidget( pVod );
76     slayout->addWidget( pSchedule );
77
78     layout->addWidget( slayout );
79
80     QPushButton *closeButton = new QPushButton( qtr( "Close" ) );
81     QPushButton *cancelButton = new QPushButton( qtr( "Cancel" ) );
82     ui.buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
83     ui.buttonBox->addButton( cancelButton, QDialogButtonBox::RejectRole );
84
85     CONNECT( mediatype, currentIndexChanged( int ), slayout,
86             setCurrentIndex( int ) );
87     CONNECT( closeButton, clicked(), this, hide() );
88
89 }
90
91 VLMDialog::~VLMDialog(){}
92
93 void VLMDialog::makeBcastPage()
94 {
95     pBcast = new QWidget( ui.groupBox );
96     bcastlayout = new QGridLayout( pBcast );
97     bcastname = new QLabel( qtr( "Name :" ), pBcast );
98     bcastnameledit = new QLineEdit( pBcast );
99     bcastenable = new QCheckBox( qtr( "Enable" ), pBcast );
100     bcastinput = new QLabel( qtr( "Input :" ), pBcast );
101     bcastinputledit = new QLineEdit( pBcast );
102     bcastinputtbutton = new QToolButton( pBcast );
103     bcastoutput = new QLabel( qtr( "Output :" ), pBcast );
104     bcastoutputledit = new QLineEdit( pBcast );
105     bcastoutputtbutton = new QToolButton( pBcast );
106     bcastcontrol = new QGroupBox( qtr( "Controls" ), pBcast );
107     bcastgbox = new QHBoxLayout( bcastcontrol );
108     bcastplay = new QPushButton( qtr( "Play" ), bcastcontrol );
109     bcastpause = new QPushButton( qtr( "Pause" ), bcastcontrol );
110     bcaststop = new QPushButton( qtr( "Stop" ), bcastcontrol );
111     bcastadd = new QPushButton( qtr( "Add" ), pBcast );
112     bcastremove = new QPushButton( qtr( "Remove" ), pBcast );
113
114 // Adding all widgets in the QGridLayout
115     bcastgbox->addWidget( bcastplay );
116     bcastgbox->addWidget( bcastpause );
117     bcastgbox->addWidget( bcaststop );
118     bcastlayout->addWidget( bcastname, 0, 0 );
119     bcastlayout->addWidget( bcastnameledit, 0, 1 );
120     bcastlayout->addWidget( bcastenable, 0, 2 );
121     bcastlayout->addWidget( bcastinput, 1, 0 );
122     bcastlayout->addWidget( bcastinputledit, 1, 1 );
123     bcastlayout->addWidget( bcastinputtbutton, 1, 2 );
124     bcastlayout->addWidget( bcastoutput, 2, 0 );
125     bcastlayout->addWidget( bcastoutputledit, 2, 1 );
126     bcastlayout->addWidget( bcastoutputtbutton, 2, 2 );
127     bcastlayout->addWidget( bcastcontrol, 3, 0, 1, 3 );
128     bcastlayout->addWidget( bcastadd, 4, 1 );
129     bcastlayout->addWidget( bcastremove, 4, 2 );
130 }
131
132 void VLMDialog::makeVODPage()
133 {
134     pVod = new QWidget( ui.groupBox );
135     vodlayout = new QGridLayout( pVod );
136     vodname = new QLabel( qtr( "Name :" ), pVod );
137     vodnameledit = new QLineEdit( pVod );
138     vodenable = new QCheckBox( qtr( "Enable" ), pVod );
139     vodinput = new QLabel( qtr( "Input :" ), pVod );
140     vodinputledit = new QLineEdit( pVod );
141     vodinputtbutton = new QToolButton( pVod );
142     vodoutput = new QLabel( qtr( "Output :" ), pVod );
143     vodoutputledit = new QLineEdit( pVod );
144     vodoutputtbutton = new QToolButton( pVod );
145     vodadd = new QPushButton( qtr( "Add" ), pVod );
146     vodremove = new QPushButton( qtr( "Remove" ), pVod );
147
148 // Adding all widgets in the QGridLayout
149     vodlayout->addWidget( vodname, 0, 0 );
150     vodlayout->addWidget( vodnameledit, 0, 1 );
151     vodlayout->addWidget( vodenable, 0, 2 );
152     vodlayout->addWidget( vodinput, 1, 0 );
153     vodlayout->addWidget( vodinputledit, 1, 1 );
154     vodlayout->addWidget( vodinputtbutton, 1, 2 );
155     vodlayout->addWidget( vodoutput, 2, 0 );
156     vodlayout->addWidget( vodoutputledit, 2, 1 );
157     vodlayout->addWidget( vodoutputtbutton, 2, 2 );
158     vodlayout->addWidget( vodadd, 3, 1 );
159     vodlayout->addWidget( vodremove, 3, 2 );
160 }
161
162 void VLMDialog::makeSchedulePage()
163 {
164     pSchedule = new QWidget( ui.groupBox );
165     schelayout = new QGridLayout( pSchedule );
166     schename = new QLabel( qtr( "Name :" ), pSchedule );
167     schenameledit = new QLineEdit( pSchedule );
168     scheenable = new QCheckBox( qtr( "Enable" ), pSchedule );
169     scheinput = new QLabel( qtr( "Input :" ), pSchedule );
170     scheinputledit = new QLineEdit( pSchedule );
171     scheinputtbutton = new QToolButton( pSchedule );
172     scheoutput = new QLabel( qtr( "Output :" ), pSchedule );
173     scheoutputledit = new QLineEdit( pSchedule );
174     scheoutputtbutton = new QToolButton( pSchedule );
175     schecontrol = new QGroupBox( qtr( "Time Control" ), pSchedule );
176     scheadd = new QPushButton( qtr( "Add" ), pSchedule );
177     scheremove = new QPushButton( qtr( "Remove" ), pSchedule );
178     schetimelayout = new QGridLayout( schecontrol );
179     schetimelabel = new QLabel( qtr( "Hours/Minutes/Seconds :" ), schecontrol );
180     schedatelabel = new QLabel( qtr( "Day/Month/Year :" ), schecontrol );
181     schetimerepeat = new QLabel( qtr( "Repeat :" ), schecontrol );
182     time = new QTimeEdit( schecontrol );
183     date = new QDateEdit( schecontrol );
184     scherepeatnumber = new QSpinBox( schecontrol );
185
186     //scheadd->setMaximumWidth( 30 );
187
188 // Adding all widgets in the QGridLayout
189     schetimelayout->addWidget( schetimelabel, 0, 0 );
190     schetimelayout->addWidget( time, 0, 1 );
191     schetimelayout->addWidget( schedatelabel, 1, 0 );
192     schetimelayout->addWidget( date, 1, 1 );
193     schetimelayout->addWidget( schetimerepeat, 2, 0 );
194     schetimelayout->addWidget( scherepeatnumber, 2, 1 );
195     schelayout->addWidget( schename, 0, 0 );
196     schelayout->addWidget( schenameledit, 0, 1 );
197     schelayout->addWidget( scheenable, 0, 2 );
198     schelayout->addWidget( scheinput, 1, 0 );
199     schelayout->addWidget( scheinputledit, 1, 1 );
200     schelayout->addWidget( scheinputtbutton, 1, 2 );
201     schelayout->addWidget( scheoutput, 2, 0 );
202     schelayout->addWidget( scheoutputledit, 2, 1 );
203     schelayout->addWidget( scheoutputtbutton, 2, 2 );
204     schelayout->addWidget( schecontrol, 3, 0, 1, 3 );
205     schelayout->addWidget( scheadd, 4, 1 );
206     schelayout->addWidget( scheremove, 4, 2 );
207 }
208