Commit ab7704a5 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - VLM dialog rework.

parent 34b5e985
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "dialogs/vlm.hpp" #include "dialogs/vlm.hpp"
#include <vlc_streaming.h> #include <vlc_streaming.h>
#include <iostream>
#include <QString> #include <QString>
#include <QFileDialog> #include <QFileDialog>
#include <QComboBox> #include <QComboBox>
...@@ -44,6 +43,7 @@ ...@@ -44,6 +43,7 @@
#include <QTimeEdit> #include <QTimeEdit>
#include <QDateEdit> #include <QDateEdit>
#include <QSpinBox> #include <QSpinBox>
#include <QHeaderView>
VLMDialog *VLMDialog::instance = NULL; VLMDialog *VLMDialog::instance = NULL;
...@@ -53,68 +53,39 @@ VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) ...@@ -53,68 +53,39 @@ VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
// UI stuff // UI stuff
ui.setupUi( this ); ui.setupUi( this );
/* Layout in the main groupBox */ #define ADDMEDIATYPES( str, type ) ui.mediaType->addItem( qtr( str ), QVariant( type ) );
layout = new QVBoxLayout( ui.groupBox ); ADDMEDIATYPES( "Broadcast", QVLM_Broadcast );
ADDMEDIATYPES( "Video On Demand ( VOD )", QVLM_VOD );
ADDMEDIATYPES( "Schedule", QVLM_Schedule );
#undef ADDMEDIATYPES
/* ui.mediasDB->horizontalHeader()->setResizeMode( 0, QHeaderView::ResizeToContents );
ui.mediasDB->horizontalHeader()->resizeSection( 1, 160 );
ui.mediasDB->horizontalHeader()->resizeSection( 2, 120 );
ui.mediasDB->horizontalHeader()->resizeSection( 3, 120 );
ui.mediasDB->horizontalHeader()->setStretchLastSection ( true );*/
QGridLayout *bcastlayout = new QGridLayout( ui.pBcast );
QLabel *bcastname = new QLabel( qtr( "Name:" ) );
bcastnameledit = new QLineEdit;
bcastenable = new QCheckBox( qtr( "Enable" ) );
bcastenable->setCheckState( Qt::Checked );
QLabel *bcastinput = new QLabel( qtr( "Input:" ) );
bcastinputledit = new QLineEdit;
bcastinputtbutton = new QToolButton;
QLabel *bcastoutput = new QLabel( qtr( "Output:" ) );
bcastoutputledit = new QLineEdit;
bcastoutputtbutton = new QToolButton;
QGroupBox *bcastcontrol = new QGroupBox( qtr( "Controls" ) );
QHBoxLayout *bcastgbox = new QHBoxLayout( bcastcontrol );
bcastplay = new QPushButton( qtr( "Play" ) );
bcastpause = new QPushButton( qtr( "Pause" ) );
bcaststop = new QPushButton( qtr( "Stop" ) );
mediatype = new QComboBox( ui.groupBox );
layout->addWidget( mediatype );
#define ADDMEDIATYPES( type ) mediatype->addItem( qtr( type ) );
ADDMEDIATYPES( "Broadcast" );
ADDMEDIATYPES( "Video On Demand ( VOD )" );
ADDMEDIATYPES( "Schedule" );
makeBcastPage();
makeVODPage();
makeSchedulePage();
/* Create a Stacked Widget to old the different phases */
slayout = new QStackedWidget( ui.groupBox );
slayout->addWidget( pBcast );
slayout->addWidget( pVod );
slayout->addWidget( pSchedule );
layout->addWidget( slayout );
QPushButton *closeButton = new QPushButton( qtr( "Close" ) );
QPushButton *cancelButton = new QPushButton( qtr( "Cancel" ) );
ui.buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
ui.buttonBox->addButton( cancelButton, QDialogButtonBox::RejectRole );
CONNECT( mediatype, currentIndexChanged( int ), slayout,
setCurrentIndex( int ) );
CONNECT( closeButton, clicked(), this, hide() );
}
VLMDialog::~VLMDialog(){}
void VLMDialog::makeBcastPage()
{
pBcast = new QWidget( ui.groupBox );
bcastlayout = new QGridLayout( pBcast );
bcastname = new QLabel( qtr( "Name :" ), pBcast );
bcastnameledit = new QLineEdit( pBcast );
bcastenable = new QCheckBox( qtr( "Enable" ), pBcast );
bcastinput = new QLabel( qtr( "Input :" ), pBcast );
bcastinputledit = new QLineEdit( pBcast );
bcastinputtbutton = new QToolButton( pBcast );
bcastoutput = new QLabel( qtr( "Output :" ), pBcast );
bcastoutputledit = new QLineEdit( pBcast );
bcastoutputtbutton = new QToolButton( pBcast );
bcastcontrol = new QGroupBox( qtr( "Controls" ), pBcast );
bcastgbox = new QHBoxLayout( bcastcontrol );
bcastplay = new QPushButton( qtr( "Play" ), bcastcontrol );
bcastpause = new QPushButton( qtr( "Pause" ), bcastcontrol );
bcaststop = new QPushButton( qtr( "Stop" ), bcastcontrol );
bcastadd = new QPushButton( qtr( "Add" ), pBcast );
bcastremove = new QPushButton( qtr( "Remove" ), pBcast );
// Adding all widgets in the QGridLayout
bcastgbox->addWidget( bcastplay ); bcastgbox->addWidget( bcastplay );
bcastgbox->addWidget( bcastpause ); bcastgbox->addWidget( bcastpause );
bcastgbox->addWidget( bcaststop ); bcastgbox->addWidget( bcaststop );
bcastlayout->addWidget( bcastname, 0, 0 ); bcastlayout->addWidget( bcastname, 0, 0 );
bcastlayout->addWidget( bcastnameledit, 0, 1 ); bcastlayout->addWidget( bcastnameledit, 0, 1 );
bcastlayout->addWidget( bcastenable, 0, 2 ); bcastlayout->addWidget( bcastenable, 0, 2 );
...@@ -125,27 +96,22 @@ void VLMDialog::makeBcastPage() ...@@ -125,27 +96,22 @@ void VLMDialog::makeBcastPage()
bcastlayout->addWidget( bcastoutputledit, 2, 1 ); bcastlayout->addWidget( bcastoutputledit, 2, 1 );
bcastlayout->addWidget( bcastoutputtbutton, 2, 2 ); bcastlayout->addWidget( bcastoutputtbutton, 2, 2 );
bcastlayout->addWidget( bcastcontrol, 3, 0, 1, 3 ); bcastlayout->addWidget( bcastcontrol, 3, 0, 1, 3 );
bcastlayout->addWidget( bcastadd, 4, 1 ); QSpacerItem *spacerItem = new QSpacerItem(10, 5,
bcastlayout->addWidget( bcastremove, 4, 2 ); QSizePolicy::Expanding, QSizePolicy::MinimumExpanding );
} bcastlayout->addItem(spacerItem, 4, 0, 1, 1);
QGridLayout *vodlayout = new QGridLayout( ui.pVod );
QLabel *vodname = new QLabel( qtr( "Name :" ) );
vodnameledit = new QLineEdit;
vodenable = new QCheckBox( qtr( "Enable" ) );
QLabel *vodinput = new QLabel( qtr( "Input :" ) );
vodinputledit = new QLineEdit;
vodinputtbutton = new QToolButton;
QLabel *vodoutput = new QLabel( qtr( "Output :" ) );
vodoutputledit = new QLineEdit;
vodoutputtbutton = new QToolButton;
void VLMDialog::makeVODPage()
{
pVod = new QWidget( ui.groupBox );
vodlayout = new QGridLayout( pVod );
vodname = new QLabel( qtr( "Name :" ), pVod );
vodnameledit = new QLineEdit( pVod );
vodenable = new QCheckBox( qtr( "Enable" ), pVod );
vodinput = new QLabel( qtr( "Input :" ), pVod );
vodinputledit = new QLineEdit( pVod );
vodinputtbutton = new QToolButton( pVod );
vodoutput = new QLabel( qtr( "Output :" ), pVod );
vodoutputledit = new QLineEdit( pVod );
vodoutputtbutton = new QToolButton( pVod );
vodadd = new QPushButton( qtr( "Add" ), pVod );
vodremove = new QPushButton( qtr( "Remove" ), pVod );
// Adding all widgets in the QGridLayout
vodlayout->addWidget( vodname, 0, 0 ); vodlayout->addWidget( vodname, 0, 0 );
vodlayout->addWidget( vodnameledit, 0, 1 ); vodlayout->addWidget( vodnameledit, 0, 1 );
vodlayout->addWidget( vodenable, 0, 2 ); vodlayout->addWidget( vodenable, 0, 2 );
...@@ -155,37 +121,40 @@ void VLMDialog::makeVODPage() ...@@ -155,37 +121,40 @@ void VLMDialog::makeVODPage()
vodlayout->addWidget( vodoutput, 2, 0 ); vodlayout->addWidget( vodoutput, 2, 0 );
vodlayout->addWidget( vodoutputledit, 2, 1 ); vodlayout->addWidget( vodoutputledit, 2, 1 );
vodlayout->addWidget( vodoutputtbutton, 2, 2 ); vodlayout->addWidget( vodoutputtbutton, 2, 2 );
vodlayout->addWidget( vodadd, 3, 1 ); QSpacerItem *spacerVod = new QSpacerItem(10, 5,
vodlayout->addWidget( vodremove, 3, 2 ); QSizePolicy::Expanding, QSizePolicy::MinimumExpanding );
} vodlayout->addItem( spacerVod, 4, 0, 1, 1);
QGridLayout *schelayout = new QGridLayout( ui.pSched );
QLabel *schename = new QLabel( qtr( "Name:" ) );
schenameledit = new QLineEdit;
scheenable = new QCheckBox( qtr( "Enable" ) );
QLabel *scheinput = new QLabel( qtr( "Input:" ) );
scheinputledit = new QLineEdit;
scheinputtbutton = new QToolButton;
QLabel *scheoutput = new QLabel( qtr( "Output:" ) );
scheoutputledit = new QLineEdit;
scheoutputtbutton = new QToolButton;
QGroupBox *schecontrol = new QGroupBox( qtr( "Time Control" ), ui.pSched );
QGridLayout *schetimelayout = new QGridLayout( schecontrol );
QLabel *schetimelabel = new QLabel( qtr( "Hours/Minutes/Seconds:" ) );
QLabel *schedatelabel = new QLabel( qtr( "Day Month Year:" ) );
QLabel *schetimerepeat = new QLabel( qtr( "Repeat:" ) );
time = new QTimeEdit( QTime::currentTime() );
time->setAlignment( Qt::AlignRight );
date = new QDateEdit( QDate::currentDate() );
date->setAlignment( Qt::AlignRight );
#ifdef WIN32
date->setDisplayFormat( "dd MM yyyy" );
#else
date->setDisplayFormat( "dd MMMM yyyy" );
#endif
scherepeatnumber = new QSpinBox;
scherepeatnumber->setAlignment( Qt::AlignRight );
schecontrol->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
void VLMDialog::makeSchedulePage()
{
pSchedule = new QWidget( ui.groupBox );
schelayout = new QGridLayout( pSchedule );
schename = new QLabel( qtr( "Name :" ), pSchedule );
schenameledit = new QLineEdit( pSchedule );
scheenable = new QCheckBox( qtr( "Enable" ), pSchedule );
scheinput = new QLabel( qtr( "Input :" ), pSchedule );
scheinputledit = new QLineEdit( pSchedule );
scheinputtbutton = new QToolButton( pSchedule );
scheoutput = new QLabel( qtr( "Output :" ), pSchedule );
scheoutputledit = new QLineEdit( pSchedule );
scheoutputtbutton = new QToolButton( pSchedule );
schecontrol = new QGroupBox( qtr( "Time Control" ), pSchedule );
scheadd = new QPushButton( qtr( "Add" ), pSchedule );
scheremove = new QPushButton( qtr( "Remove" ), pSchedule );
schetimelayout = new QGridLayout( schecontrol );
schetimelabel = new QLabel( qtr( "Hours/Minutes/Seconds :" ), schecontrol );
schedatelabel = new QLabel( qtr( "Day/Month/Year :" ), schecontrol );
schetimerepeat = new QLabel( qtr( "Repeat :" ), schecontrol );
time = new QTimeEdit( schecontrol );
date = new QDateEdit( schecontrol );
scherepeatnumber = new QSpinBox( schecontrol );
//scheadd->setMaximumWidth( 30 );
// Adding all widgets in the QGridLayout
schetimelayout->addWidget( schetimelabel, 0, 0 ); schetimelayout->addWidget( schetimelabel, 0, 0 );
schetimelayout->addWidget( time, 0, 1 ); schetimelayout->addWidget( time, 0, 1 );
schetimelayout->addWidget( schedatelabel, 1, 0 ); schetimelayout->addWidget( schedatelabel, 1, 0 );
...@@ -202,7 +171,78 @@ void VLMDialog::makeSchedulePage() ...@@ -202,7 +171,78 @@ void VLMDialog::makeSchedulePage()
schelayout->addWidget( scheoutputledit, 2, 1 ); schelayout->addWidget( scheoutputledit, 2, 1 );
schelayout->addWidget( scheoutputtbutton, 2, 2 ); schelayout->addWidget( scheoutputtbutton, 2, 2 );
schelayout->addWidget( schecontrol, 3, 0, 1, 3 ); schelayout->addWidget( schecontrol, 3, 0, 1, 3 );
schelayout->addWidget( scheadd, 4, 1 );
schelayout->addWidget( scheremove, 4, 2 ); QPushButton *closeButton = new QPushButton( qtr( "Close" ) );
QPushButton *cancelButton = new QPushButton( qtr( "Cancel" ) );
ui.buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
ui.buttonBox->addButton( cancelButton, QDialogButtonBox::RejectRole );
ui.mediaStacked->setCurrentIndex( QVLM_Broadcast );
CONNECT( ui.mediaType, currentIndexChanged( int ),
ui.mediaStacked, setCurrentIndex( int ) );
BUTTONACT( closeButton, finish() );
BUTTONACT( cancelButton, cancel() );
BUTTONACT( ui.addButton, addVLMItem() );
BUTTONACT( ui.clearButton, clearVLMItem() );
}
VLMDialog::~VLMDialog(){}
void VLMDialog::cancel()
{
hide();
}
void VLMDialog::finish()
{
// for( int i = 0; i < ui.mediasDB->topLevelItemCount(); i++ );
hide();
}
void VLMDialog::addVLMItem()
{
// int row = ui.mediasDB->rowCount() -1 ;
int type = ui.mediaType->itemData( ui.mediaType->currentIndex() ).toInt();
QString str;
QString name;
switch( type )
{
case QVLM_Broadcast:
str = "broadcast";
name = bcastnameledit->text();
break;
case QVLM_VOD:
str = "vod";
name = vodnameledit->text();
break;
case QVLM_Schedule:
str = "schedule";
name = schenameledit->text();
break;
default:
break;
}
QGroupBox *groupItem = new QGroupBox( name );
/*QTableWidgetItem *newItem = new QTableWidgetItem( str );
ui.mediasDB->setItem( row, 0, newItem );
QTableWidgetItem *newItem2 = new QTableWidgetItem( name );
ui.mediasDB->setItem( row, 1, newItem2 );*/
} }
void VLMDialog::removeVLMItem()
{
}
void VLMDialog::clearVLMItem()
{
}
...@@ -30,11 +30,16 @@ ...@@ -30,11 +30,16 @@
#include "ui/vlm.h" #include "ui/vlm.h"
#include "util/qvlcframe.hpp" #include "util/qvlcframe.hpp"
enum{
QVLM_Broadcast,
QVLM_VOD,
QVLM_Schedule
};
class QComboBox; class QComboBox;
class QVBoxLayout; class QVBoxLayout;
class QStackedWidget; class QStackedWidget;
class QLabel; class QLabel;
class QWidget;
class QGridLayout; class QGridLayout;
class QLineEdit; class QLineEdit;
class QCheckBox; class QCheckBox;
...@@ -62,31 +67,28 @@ private: ...@@ -62,31 +67,28 @@ private:
VLMDialog( intf_thread_t * ); VLMDialog( intf_thread_t * );
static VLMDialog *instance; static VLMDialog *instance;
Ui::Vlm ui; Ui::Vlm ui;
void makeBcastPage(); QGridLayout *vlmItemLayout;
void makeVODPage();
void makeSchedulePage();
QComboBox *mediatype; QComboBox *mediatype;
QVBoxLayout *layout;
QHBoxLayout *bcastgbox, ;
QStackedWidget *slayout;
QWidget *pBcast, *pVod, *pSchedule;
QGridLayout *bcastlayout, *vodlayout, *schelayout, *schetimelayout;
QLabel *bcastname, *vodname, *schename,*bcastinput, *vodinput, *scheinput;
QLabel *bcastoutput, *vodoutput, *scheoutput;
QCheckBox *bcastenable, *vodenable, *scheenable; QCheckBox *bcastenable, *vodenable, *scheenable;
QLineEdit *bcastnameledit, *vodnameledit, *schenameledit, *bcastinputledit, *vodinputledit, *scheinputledit; QLineEdit *bcastnameledit, *vodnameledit, *schenameledit, *bcastinputledit, *vodinputledit, *scheinputledit;
QLineEdit *bcastoutputledit, *vodoutputledit, *scheoutputledit; QLineEdit *bcastoutputledit, *vodoutputledit, *scheoutputledit;
QTimeEdit *time;
QDateEdit *date;
QSpinBox *scherepeatnumber;
QToolButton *bcastinputtbutton, *vodinputtbutton, *scheinputtbutton; QToolButton *bcastinputtbutton, *vodinputtbutton, *scheinputtbutton;
QToolButton *bcastoutputtbutton, *vodoutputtbutton, *scheoutputtbutton; QToolButton *bcastoutputtbutton, *vodoutputtbutton, *scheoutputtbutton;
QGroupBox *bcastcontrol, *schecontrol;
QPushButton *bcastplay, *bcastpause, *bcaststop; QPushButton *bcastplay, *bcastpause, *bcaststop;
QPushButton *bcastadd, *vodadd, *scheadd, *bcastremove, *vodremove, *scheremove; QPushButton *bcastadd, *vodadd, *scheadd, *bcastremove, *vodremove, *scheremove;
QTimeEdit *time;
QDateEdit *date; private slots:
QLabel *schetimelabel, *schedatelabel, *schetimerepeat; void finish();
QSpinBox *scherepeatnumber; void cancel();
void addVLMItem();
void removeVLMItem();
void clearVLMItem();
}; };
#endif #endif
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>640</width> <width>588</width>
<height>640</height> <height>393</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy" >
...@@ -22,95 +22,90 @@ ...@@ -22,95 +22,90 @@
<string>_("VLM configurator")</string> <string>_("VLM configurator")</string>
</property> </property>
<layout class="QGridLayout" > <layout class="QGridLayout" >
<item row="0" column="0" > <item rowspan="3" row="0" column="0" >
<widget class="QGroupBox" name="groupBox" > <widget class="QGroupBox" name="mediaConfBox" >
<property name="minimumSize" > <property name="sizePolicy" >
<size> <sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
<width>0</width> <horstretch>0</horstretch>
<height>300</height> <verstretch>0</verstretch>
</size> </sizepolicy>
</property> </property>
<property name="title" > <property name="title" >
<string>Media configuration</string> <string>_("Media Creation")</string>
</property> </property>
<layout class="QVBoxLayout" >
<item>
<widget class="QComboBox" name="mediaType" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="mediaStacked" >
<property name="currentIndex" >
<number>2</number>
</property>
<widget class="QWidget" name="pBcast" />
<widget class="QWidget" name="pVod" />
<widget class="QWidget" name="pSched" />
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
<item row="1" column="0" > <item row="0" column="1" >
<widget class="QTableWidget" name="mediasDB" > <widget class="QPushButton" name="addButton" >
<property name="windowModality" > <property name="text" >
<enum>Qt::NonModal</enum> <string>_("Add")</string>
</property>
<property name="enabled" >
<bool>true</bool>
</property> </property>
<property name="sizePolicy" > </widget>
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" > </item>
<horstretch>0</horstretch> <item row="1" column="1" >
<verstretch>0</verstretch> <widget class="QPushButton" name="clearButton" >
</sizepolicy> <property name="text" >
</property> <string>_("Clear")</string>
<property name="minimumSize" >
<size>
<width>0</width>
<height>220</height>
</size>
</property> </property>
<property name="sizeIncrement" > </widget>
<size> </item>
<width>0</width> <item row="2" column="1" >
<height>0</height> <spacer>
</size> <property name="orientation" >
<enum>Qt::Vertical</enum>
</property> </property>
<property name="baseSize" > <property name="sizeHint" >
<size> <size>
<width>0</width> <width>80</width>
<height>0</height> <height>20</height>
</size> </size>
</property> </property>
<property name="autoFillBackground" > </spacer>
<bool>false</bool> </item>
</property> <item row="3" column="0" colspan="2" >
<property name="horizontalScrollBarPolicy" > <widget class="QGroupBox" name="mediaBox" >
<enum>Qt::ScrollBarAlwaysOff</enum> <property name="sizePolicy" >
</property> <sizepolicy vsizetype="MinimumExpanding" hsizetype="Preferred" >
<property name="selectionMode" > <horstretch>0</horstretch>
<enum>QAbstractItemView::MultiSelection</enum> <verstretch>1</verstretch>
</property> </sizepolicy>
<property name="showGrid" >
<bool>true</bool>
</property> </property>
<property name="sortingEnabled" > <property name="title" >
<bool>true</bool> <string>_("Media Configuration")</string>
</property> </property>
<row/> <layout class="QHBoxLayout" />
<column>
<property name="text" >
<string>Type</string>
</property>
</column>
<column>
<property name="text" >
<string>Media Name</string>
</property>
</column>
<column>
<property name="text" >
<string>Input</string>
</property>
</column>
<column>
<property name="text" >
<string>Output</string>
</property>
</column>
<column>
<property name="text" >
<string>State</string>
</property>
</column>
</widget> </widget>
</item> </item>
<item row="2" column="0" > <item row="4" column="0" colspan="2" >
<widget class="QDialogButtonBox" name="buttonBox" > <widget class="QDialogButtonBox" name="buttonBox" >
<property name="standardButtons" > <property name="standardButtons" >
<set>QDialogButtonBox::NoButton</set> <set>QDialogButtonBox::NoButton</set>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment