1e130d4aa97b076273e1d36ab8e902a5e45f5db5
[vlc.git] / 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
45 VLMDialog *VLMDialog::instance = NULL;
46
47
48 VLMDialog::VLMDialog( intf_thread_t *_p_intf) : QVLCFrame( _p_intf )
49 {
50     setWindowTitle( qtr( "VLM front-end" ) );
51
52     // UI stuff 
53     ui.setupUi( this );
54     mediatype = new QComboBox(ui.groupBox);
55     layout = new QVBoxLayout(ui.groupBox);
56     layout->addWidget(mediatype);
57
58 #define ADDMEDIATYPES(type) mediatype->addItem(type);
59
60     ADDMEDIATYPES("Broadcast");
61     ADDMEDIATYPES("Video On Demand (VOD)");
62     ADDMEDIATYPES("Schedule");
63
64     makeBcastPage();
65     makeVODPage();
66     makeSchedulePage();
67
68     slayout = new QStackedWidget(ui.groupBox);
69     slayout->addWidget(pBcast);
70     slayout->addWidget(pVod);
71     slayout->addWidget(pSchedule);
72
73     layout->addWidget(slayout);
74
75     connect(mediatype,SIGNAL(currentIndexChanged(int)),slayout,SLOT(setCurrentIndex(int)));
76
77 }
78
79 VLMDialog::~VLMDialog(){}
80
81 void VLMDialog::close()
82 {
83     close();
84 }
85
86 void VLMDialog::makeBcastPage()
87 {
88         pBcast = new QWidget(ui.groupBox);
89         bcastlayout = new QGridLayout(pBcast);
90         bcastname = new QLabel(tr("Name :"),pBcast);
91         bcastnameledit = new QLineEdit(pBcast);
92         bcastenable = new QCheckBox(tr("Enable"),pBcast);
93         bcastinput = new QLabel(tr("Input :"),pBcast);
94         bcastinputledit = new QLineEdit(pBcast);
95         bcastinputtbutton = new QToolButton(pBcast);
96         bcastoutput = new QLabel(tr("Output :"),pBcast);
97         bcastoutputledit = new QLineEdit(pBcast);
98         bcastoutputtbutton = new QToolButton(pBcast);
99         bcastcontrol = new QGroupBox(tr("Controls"),pBcast);
100         bcastgbox = new QHBoxLayout(bcastcontrol);
101         bcastplay = new QPushButton(tr("Play"),bcastcontrol);
102         bcastpause = new QPushButton(tr("Pause"),bcastcontrol);
103         bcaststop = new QPushButton(tr("Stop"),bcastcontrol);
104         bcastadd = new QPushButton(tr("Add"),pBcast);
105         bcastremove = new QPushButton(tr("Remove"),pBcast);
106
107 // Adding all widgets in the QGridLayout 
108         bcastgbox->addWidget(bcastplay);
109         bcastgbox->addWidget(bcastpause);
110         bcastgbox->addWidget(bcaststop);
111         bcastlayout->addWidget(bcastname,0,0);
112         bcastlayout->addWidget(bcastnameledit,0,1);
113         bcastlayout->addWidget(bcastenable,0,2);
114         bcastlayout->addWidget(bcastinput,1,0);
115         bcastlayout->addWidget(bcastinputledit,1,1);
116         bcastlayout->addWidget(bcastinputtbutton,1,2);
117         bcastlayout->addWidget(bcastoutput,2,0);
118         bcastlayout->addWidget(bcastoutputledit,2,1);
119         bcastlayout->addWidget(bcastoutputtbutton,2,2);
120         bcastlayout->addWidget(bcastcontrol,3,0,1,3);
121         bcastlayout->addWidget(bcastadd,4,1);
122         bcastlayout->addWidget(bcastremove,4,2);
123 }
124
125 void VLMDialog::makeVODPage()
126 {
127         pVod = new QWidget(ui.groupBox);
128         vodlayout = new QGridLayout(pVod);
129         vodname = new QLabel(tr("Name :"),pVod);
130         vodnameledit = new QLineEdit(pVod);
131         vodenable = new QCheckBox(tr("Enable"),pVod);
132         vodinput = new QLabel(tr("Input :"),pVod);
133         vodinputledit = new QLineEdit(pVod);
134         vodinputtbutton = new QToolButton(pVod);
135         vodoutput = new QLabel(tr("Output :"),pVod);
136         vodoutputledit = new QLineEdit(pVod);
137         vodoutputtbutton = new QToolButton(pVod);
138         vodadd = new QPushButton(tr("Add"),pVod);
139         vodremove = new QPushButton(tr("Remove"),pVod);
140         
141 // Adding all widgets in the QGridLayout 
142         vodlayout->addWidget(vodname,0,0);
143         vodlayout->addWidget(vodnameledit,0,1);
144         vodlayout->addWidget(vodenable,0,2);
145         vodlayout->addWidget(vodinput,1,0);
146         vodlayout->addWidget(vodinputledit,1,1);
147         vodlayout->addWidget(vodinputtbutton,1,2);
148         vodlayout->addWidget(vodoutput,2,0);
149         vodlayout->addWidget(vodoutputledit,2,1);
150         vodlayout->addWidget(vodoutputtbutton,2,2);
151         vodlayout->addWidget(vodadd,3,1);
152         vodlayout->addWidget(vodremove,3,2);
153 }
154
155 void VLMDialog::makeSchedulePage()
156 {
157         pSchedule = new QWidget(ui.groupBox);
158         schelayout = new QGridLayout(pSchedule);
159         schename = new QLabel(tr("Name :"),pSchedule);
160         schenameledit = new QLineEdit(pSchedule);
161         scheenable = new QCheckBox(tr("Enable"),pSchedule);
162         scheinput = new QLabel(tr("Input :"),pSchedule);
163         scheinputledit = new QLineEdit(pSchedule);
164         scheinputtbutton = new QToolButton(pSchedule);
165         scheoutput = new QLabel(tr("Output :"),pSchedule);
166         scheoutputledit = new QLineEdit(pSchedule);
167         scheoutputtbutton = new QToolButton(pSchedule);
168         schecontrol = new QGroupBox(tr("Time Control"),pSchedule);
169         scheadd = new QPushButton(tr("Add"),pSchedule);
170         scheremove = new QPushButton(tr("Remove"),pSchedule);
171
172         //scheadd->setMaximumWidth(30);
173         
174 // Adding all widgets in the QGridLayout 
175         schelayout->addWidget(schename,0,0);
176         schelayout->addWidget(schenameledit,0,1);
177         schelayout->addWidget(scheenable,0,2);
178         schelayout->addWidget(scheinput,1,0);
179         schelayout->addWidget(scheinputledit,1,1);
180         schelayout->addWidget(scheinputtbutton,1,2);
181         schelayout->addWidget(scheoutput,2,0);
182         schelayout->addWidget(scheoutputledit,2,1);
183         schelayout->addWidget(scheoutputtbutton,2,2);
184         schelayout->addWidget(schecontrol,3,0,1,3);
185         schelayout->addWidget(scheadd,4,1);
186         schelayout->addWidget(scheremove,4,2);
187 }
188