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