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 $
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>
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.
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.
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 *****************************************************************************/
26 #include "dialogs/vlm.hpp"
27 #include <vlc_streaming.h>
30 #include <QFileDialog>
32 #include <QVBoxLayout>
33 #include <QStackedWidget>
36 #include <QGridLayout>
39 #include <QToolButton>
41 #include <QPushButton>
42 #include <QHBoxLayout>
46 #include <QHeaderView>
48 VLMDialog *VLMDialog::instance = NULL;
51 VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
56 #define ADDMEDIATYPES( str, type ) ui.mediaType->addItem( qtr( str ), QVariant( type ) );
57 ADDMEDIATYPES( "Broadcast", QVLM_Broadcast );
58 ADDMEDIATYPES( "Video On Demand ( VOD )", QVLM_VOD );
59 ADDMEDIATYPES( "Schedule", QVLM_Schedule );
62 /* ui.mediasDB->horizontalHeader()->setResizeMode( 0, QHeaderView::ResizeToContents );
63 ui.mediasDB->horizontalHeader()->resizeSection( 1, 160 );
64 ui.mediasDB->horizontalHeader()->resizeSection( 2, 120 );
65 ui.mediasDB->horizontalHeader()->resizeSection( 3, 120 );
66 ui.mediasDB->horizontalHeader()->setStretchLastSection ( true );*/
68 QGridLayout *bcastlayout = new QGridLayout( ui.pBcast );
69 QLabel *bcastname = new QLabel( qtr( "Name:" ) );
70 bcastnameledit = new QLineEdit;
71 bcastenable = new QCheckBox( qtr( "Enable" ) );
72 bcastenable->setCheckState( Qt::Checked );
73 QLabel *bcastinput = new QLabel( qtr( "Input:" ) );
74 bcastinputledit = new QLineEdit;
75 bcastinputtbutton = new QToolButton;
76 QLabel *bcastoutput = new QLabel( qtr( "Output:" ) );
77 bcastoutputledit = new QLineEdit;
78 bcastoutputtbutton = new QToolButton;
79 QGroupBox *bcastcontrol = new QGroupBox( qtr( "Controls" ) );
80 QHBoxLayout *bcastgbox = new QHBoxLayout( bcastcontrol );
81 bcastplay = new QPushButton( qtr( "Play" ) );
82 bcastpause = new QPushButton( qtr( "Pause" ) );
83 bcaststop = new QPushButton( qtr( "Stop" ) );
85 bcastgbox->addWidget( bcastplay );
86 bcastgbox->addWidget( bcastpause );
87 bcastgbox->addWidget( bcaststop );
89 bcastlayout->addWidget( bcastname, 0, 0 );
90 bcastlayout->addWidget( bcastnameledit, 0, 1 );
91 bcastlayout->addWidget( bcastenable, 0, 2 );
92 bcastlayout->addWidget( bcastinput, 1, 0 );
93 bcastlayout->addWidget( bcastinputledit, 1, 1 );
94 bcastlayout->addWidget( bcastinputtbutton, 1, 2 );
95 bcastlayout->addWidget( bcastoutput, 2, 0 );
96 bcastlayout->addWidget( bcastoutputledit, 2, 1 );
97 bcastlayout->addWidget( bcastoutputtbutton, 2, 2 );
98 bcastlayout->addWidget( bcastcontrol, 3, 0, 1, 3 );
99 QSpacerItem *spacerItem = new QSpacerItem(10, 5,
100 QSizePolicy::Expanding, QSizePolicy::MinimumExpanding );
101 bcastlayout->addItem(spacerItem, 4, 0, 1, 1);
104 QGridLayout *vodlayout = new QGridLayout( ui.pVod );
105 QLabel *vodname = new QLabel( qtr( "Name :" ) );
106 vodnameledit = new QLineEdit;
107 vodenable = new QCheckBox( qtr( "Enable" ) );
108 QLabel *vodinput = new QLabel( qtr( "Input :" ) );
109 vodinputledit = new QLineEdit;
110 vodinputtbutton = new QToolButton;
111 QLabel *vodoutput = new QLabel( qtr( "Output :" ) );
112 vodoutputledit = new QLineEdit;
113 vodoutputtbutton = new QToolButton;
115 vodlayout->addWidget( vodname, 0, 0 );
116 vodlayout->addWidget( vodnameledit, 0, 1 );
117 vodlayout->addWidget( vodenable, 0, 2 );
118 vodlayout->addWidget( vodinput, 1, 0 );
119 vodlayout->addWidget( vodinputledit, 1, 1 );
120 vodlayout->addWidget( vodinputtbutton, 1, 2 );
121 vodlayout->addWidget( vodoutput, 2, 0 );
122 vodlayout->addWidget( vodoutputledit, 2, 1 );
123 vodlayout->addWidget( vodoutputtbutton, 2, 2 );
124 QSpacerItem *spacerVod = new QSpacerItem(10, 5,
125 QSizePolicy::Expanding, QSizePolicy::MinimumExpanding );
126 vodlayout->addItem( spacerVod, 4, 0, 1, 1);
129 QGridLayout *schelayout = new QGridLayout( ui.pSched );
130 QLabel *schename = new QLabel( qtr( "Name:" ) );
131 schenameledit = new QLineEdit;
132 scheenable = new QCheckBox( qtr( "Enable" ) );
133 QLabel *scheinput = new QLabel( qtr( "Input:" ) );
134 scheinputledit = new QLineEdit;
135 scheinputtbutton = new QToolButton;
136 QLabel *scheoutput = new QLabel( qtr( "Output:" ) );
137 scheoutputledit = new QLineEdit;
138 scheoutputtbutton = new QToolButton;
140 QGroupBox *schecontrol = new QGroupBox( qtr( "Time Control" ), ui.pSched );
141 QGridLayout *schetimelayout = new QGridLayout( schecontrol );
142 QLabel *schetimelabel = new QLabel( qtr( "Hours/Minutes/Seconds:" ) );
143 QLabel *schedatelabel = new QLabel( qtr( "Day Month Year:" ) );
144 QLabel *schetimerepeat = new QLabel( qtr( "Repeat:" ) );
145 time = new QTimeEdit( QTime::currentTime() );
146 time->setAlignment( Qt::AlignRight );
147 date = new QDateEdit( QDate::currentDate() );
148 date->setAlignment( Qt::AlignRight );
150 date->setDisplayFormat( "dd MM yyyy" );
152 date->setDisplayFormat( "dd MMMM yyyy" );
154 scherepeatnumber = new QSpinBox;
155 scherepeatnumber->setAlignment( Qt::AlignRight );
156 schecontrol->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
158 schetimelayout->addWidget( schetimelabel, 0, 0 );
159 schetimelayout->addWidget( time, 0, 1 );
160 schetimelayout->addWidget( schedatelabel, 1, 0 );
161 schetimelayout->addWidget( date, 1, 1 );
162 schetimelayout->addWidget( schetimerepeat, 2, 0 );
163 schetimelayout->addWidget( scherepeatnumber, 2, 1 );
164 schelayout->addWidget( schename, 0, 0 );
165 schelayout->addWidget( schenameledit, 0, 1 );
166 schelayout->addWidget( scheenable, 0, 2 );
167 schelayout->addWidget( scheinput, 1, 0 );
168 schelayout->addWidget( scheinputledit, 1, 1 );
169 schelayout->addWidget( scheinputtbutton, 1, 2 );
170 schelayout->addWidget( scheoutput, 2, 0 );
171 schelayout->addWidget( scheoutputledit, 2, 1 );
172 schelayout->addWidget( scheoutputtbutton, 2, 2 );
173 schelayout->addWidget( schecontrol, 3, 0, 1, 3 );
175 QPushButton *closeButton = new QPushButton( qtr( "Close" ) );
176 QPushButton *cancelButton = new QPushButton( qtr( "Cancel" ) );
177 ui.buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
178 ui.buttonBox->addButton( cancelButton, QDialogButtonBox::RejectRole );
180 ui.mediaStacked->setCurrentIndex( QVLM_Broadcast );
181 CONNECT( ui.mediaType, currentIndexChanged( int ),
182 ui.mediaStacked, setCurrentIndex( int ) );
184 BUTTONACT( closeButton, finish() );
185 BUTTONACT( cancelButton, cancel() );
187 BUTTONACT( ui.addButton, addVLMItem() );
188 BUTTONACT( ui.clearButton, clearVLMItem() );
191 VLMDialog::~VLMDialog(){}
193 void VLMDialog::cancel()
199 void VLMDialog::finish()
201 // for( int i = 0; i < ui.mediasDB->topLevelItemCount(); i++ );
205 void VLMDialog::addVLMItem()
207 // int row = ui.mediasDB->rowCount() -1 ;
208 int type = ui.mediaType->itemData( ui.mediaType->currentIndex() ).toInt();
216 name = bcastnameledit->text();
220 name = vodnameledit->text();
224 name = schenameledit->text();
230 QGroupBox *groupItem = new QGroupBox( name );
232 /*QTableWidgetItem *newItem = new QTableWidgetItem( str );
233 ui.mediasDB->setItem( row, 0, newItem );
234 QTableWidgetItem *newItem2 = new QTableWidgetItem( name );
235 ui.mediasDB->setItem( row, 1, newItem2 );*/
239 void VLMDialog::removeVLMItem()
245 void VLMDialog::clearVLMItem()