Qt4 - VLM improvements in the layout and in the function used.
authorJean-Baptiste Kempf <jb@videolan.org>
Thu, 11 Oct 2007 19:26:21 +0000 (19:26 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 11 Oct 2007 19:26:21 +0000 (19:26 +0000)
modules/gui/qt4/dialogs/vlm.cpp
modules/gui/qt4/dialogs/vlm.hpp
modules/gui/qt4/ui/vlm.ui

index 1e130d4..a3848a0 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * sout.cpp : Stream output dialog ( old-style )
+ * sout.cpp : stream output dialog ( old-style )
  ****************************************************************************
  * Copyright ( C ) 2006 the VideoLAN team
  * $Id: sout.cpp 21875 2007-09-08 16:01:33Z jb $
@@ -20,7 +20,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * Foundation, Inc., 51 Franklin street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #include "dialogs/vlm.hpp"
 #include <QGroupBox>
 #include <QPushButton>
 #include <QHBoxLayout>
+#include <QTimeEdit>
+#include <QDateEdit>
+#include <QSpinBox>
 
 VLMDialog *VLMDialog::instance = NULL;
 
 
-VLMDialog::VLMDialog( intf_thread_t *_p_intf) : QVLCFrame( _p_intf )
+VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
 {
-    setWindowTitle( qtr( "VLM front-end" ) );
-
-    // UI stuff 
+    // UI stuff
     ui.setupUi( this );
-    mediatype = new QComboBox(ui.groupBox);
-    layout = new QVBoxLayout(ui.groupBox);
-    layout->addWidget(mediatype);
 
-#define ADDMEDIATYPES(type) mediatype->addItem(type);
+    /* Layout in the main groupBox */
+    layout = new QVBoxLayout( ui.groupBox );
+
+    mediatype = new QComboBox( ui.groupBox );
+    layout->addWidget( mediatype );
 
-    ADDMEDIATYPES("Broadcast");
-    ADDMEDIATYPES("Video On Demand (VOD)");
-    ADDMEDIATYPES("Schedule");
+#define ADDMEDIATYPES( type ) mediatype->addItem( qtr( type ) );
+
+    ADDMEDIATYPES( "Broadcast" );
+    ADDMEDIATYPES( "Video On Demand ( VOD )" );
+    ADDMEDIATYPES( "Schedule" );
 
     makeBcastPage();
     makeVODPage();
     makeSchedulePage();
 
-    slayout = new QStackedWidget(ui.groupBox);
-    slayout->addWidget(pBcast);
-    slayout->addWidget(pVod);
-    slayout->addWidget(pSchedule);
+    /* 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 );
 
-    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,SIGNAL(currentIndexChanged(int)),slayout,SLOT(setCurrentIndex(int)));
+    connect( mediatype, SIGNAL( currentIndexChanged( int ) ), slayout, SLOT( setCurrentIndex( int ) ) );
 
 }
 
 VLMDialog::~VLMDialog(){}
 
-void VLMDialog::close()
-{
-    close();
-}
-
 void VLMDialog::makeBcastPage()
 {
-       pBcast = new QWidget(ui.groupBox);
-       bcastlayout = new QGridLayout(pBcast);
-       bcastname = new QLabel(tr("Name :"),pBcast);
-       bcastnameledit = new QLineEdit(pBcast);
-       bcastenable = new QCheckBox(tr("Enable"),pBcast);
-       bcastinput = new QLabel(tr("Input :"),pBcast);
-       bcastinputledit = new QLineEdit(pBcast);
-       bcastinputtbutton = new QToolButton(pBcast);
-       bcastoutput = new QLabel(tr("Output :"),pBcast);
-       bcastoutputledit = new QLineEdit(pBcast);
-       bcastoutputtbutton = new QToolButton(pBcast);
-       bcastcontrol = new QGroupBox(tr("Controls"),pBcast);
-       bcastgbox = new QHBoxLayout(bcastcontrol);
-       bcastplay = new QPushButton(tr("Play"),bcastcontrol);
-       bcastpause = new QPushButton(tr("Pause"),bcastcontrol);
-       bcaststop = new QPushButton(tr("Stop"),bcastcontrol);
-       bcastadd = new QPushButton(tr("Add"),pBcast);
-       bcastremove = new QPushButton(tr("Remove"),pBcast);
-
-// Adding all widgets in the QGridLayout 
-       bcastgbox->addWidget(bcastplay);
-       bcastgbox->addWidget(bcastpause);
-       bcastgbox->addWidget(bcaststop);
-       bcastlayout->addWidget(bcastname,0,0);
-       bcastlayout->addWidget(bcastnameledit,0,1);
-       bcastlayout->addWidget(bcastenable,0,2);
-       bcastlayout->addWidget(bcastinput,1,0);
-       bcastlayout->addWidget(bcastinputledit,1,1);
-       bcastlayout->addWidget(bcastinputtbutton,1,2);
-       bcastlayout->addWidget(bcastoutput,2,0);
-       bcastlayout->addWidget(bcastoutputledit,2,1);
-       bcastlayout->addWidget(bcastoutputtbutton,2,2);
-       bcastlayout->addWidget(bcastcontrol,3,0,1,3);
-       bcastlayout->addWidget(bcastadd,4,1);
-       bcastlayout->addWidget(bcastremove,4,2);
+    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( bcastpause );
+    bcastgbox->addWidget( bcaststop );
+    bcastlayout->addWidget( bcastname,0,0 );
+    bcastlayout->addWidget( bcastnameledit,0,1 );
+    bcastlayout->addWidget( bcastenable,0,2 );
+    bcastlayout->addWidget( bcastinput,1,0 );
+    bcastlayout->addWidget( bcastinputledit,1,1 );
+    bcastlayout->addWidget( bcastinputtbutton,1,2 );
+    bcastlayout->addWidget( bcastoutput,2,0 );
+    bcastlayout->addWidget( bcastoutputledit,2,1 );
+    bcastlayout->addWidget( bcastoutputtbutton,2,2 );
+    bcastlayout->addWidget( bcastcontrol,3,0,1,3 );
+    bcastlayout->addWidget( bcastadd,4,1 );
+    bcastlayout->addWidget( bcastremove,4,2 );
 }
 
 void VLMDialog::makeVODPage()
 {
-       pVod = new QWidget(ui.groupBox);
-       vodlayout = new QGridLayout(pVod);
-       vodname = new QLabel(tr("Name :"),pVod);
-       vodnameledit = new QLineEdit(pVod);
-       vodenable = new QCheckBox(tr("Enable"),pVod);
-       vodinput = new QLabel(tr("Input :"),pVod);
-       vodinputledit = new QLineEdit(pVod);
-       vodinputtbutton = new QToolButton(pVod);
-       vodoutput = new QLabel(tr("Output :"),pVod);
-       vodoutputledit = new QLineEdit(pVod);
-       vodoutputtbutton = new QToolButton(pVod);
-       vodadd = new QPushButton(tr("Add"),pVod);
-       vodremove = new QPushButton(tr("Remove"),pVod);
-       
-// Adding all widgets in the QGridLayout 
-       vodlayout->addWidget(vodname,0,0);
-       vodlayout->addWidget(vodnameledit,0,1);
-       vodlayout->addWidget(vodenable,0,2);
-       vodlayout->addWidget(vodinput,1,0);
-       vodlayout->addWidget(vodinputledit,1,1);
-       vodlayout->addWidget(vodinputtbutton,1,2);
-       vodlayout->addWidget(vodoutput,2,0);
-       vodlayout->addWidget(vodoutputledit,2,1);
-       vodlayout->addWidget(vodoutputtbutton,2,2);
-       vodlayout->addWidget(vodadd,3,1);
-       vodlayout->addWidget(vodremove,3,2);
+    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( vodnameledit,0,1 );
+    vodlayout->addWidget( vodenable,0,2 );
+    vodlayout->addWidget( vodinput,1,0 );
+    vodlayout->addWidget( vodinputledit,1,1 );
+    vodlayout->addWidget( vodinputtbutton,1,2 );
+    vodlayout->addWidget( vodoutput,2,0 );
+    vodlayout->addWidget( vodoutputledit,2,1 );
+    vodlayout->addWidget( vodoutputtbutton,2,2 );
+    vodlayout->addWidget( vodadd,3,1 );
+    vodlayout->addWidget( vodremove,3,2 );
 }
 
 void VLMDialog::makeSchedulePage()
 {
-       pSchedule = new QWidget(ui.groupBox);
-       schelayout = new QGridLayout(pSchedule);
-       schename = new QLabel(tr("Name :"),pSchedule);
-       schenameledit = new QLineEdit(pSchedule);
-       scheenable = new QCheckBox(tr("Enable"),pSchedule);
-       scheinput = new QLabel(tr("Input :"),pSchedule);
-       scheinputledit = new QLineEdit(pSchedule);
-       scheinputtbutton = new QToolButton(pSchedule);
-       scheoutput = new QLabel(tr("Output :"),pSchedule);
-       scheoutputledit = new QLineEdit(pSchedule);
-       scheoutputtbutton = new QToolButton(pSchedule);
-       schecontrol = new QGroupBox(tr("Time Control"),pSchedule);
-       scheadd = new QPushButton(tr("Add"),pSchedule);
-       scheremove = new QPushButton(tr("Remove"),pSchedule);
-
-       //scheadd->setMaximumWidth(30);
-       
-// Adding all widgets in the QGridLayout 
-       schelayout->addWidget(schename,0,0);
-       schelayout->addWidget(schenameledit,0,1);
-       schelayout->addWidget(scheenable,0,2);
-       schelayout->addWidget(scheinput,1,0);
-       schelayout->addWidget(scheinputledit,1,1);
-       schelayout->addWidget(scheinputtbutton,1,2);
-       schelayout->addWidget(scheoutput,2,0);
-       schelayout->addWidget(scheoutputledit,2,1);
-       schelayout->addWidget(scheoutputtbutton,2,2);
-       schelayout->addWidget(schecontrol,3,0,1,3);
-       schelayout->addWidget(scheadd,4,1);
-       schelayout->addWidget(scheremove,4,2);
+    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( time,0,1 );
+    schetimelayout->addWidget( schedatelabel,1,0 );
+    schetimelayout->addWidget( date,1,1 );
+    schetimelayout->addWidget( schetimerepeat,2,0 );
+    schetimelayout->addWidget( scherepeatnumber,2,1 );
+    schelayout->addWidget( schename,0,0 );
+    schelayout->addWidget( schenameledit,0,1 );
+    schelayout->addWidget( scheenable,0,2 );
+    schelayout->addWidget( scheinput,1,0 );
+    schelayout->addWidget( scheinputledit,1,1 );
+    schelayout->addWidget( scheinputtbutton,1,2 );
+    schelayout->addWidget( scheoutput,2,0 );
+    schelayout->addWidget( scheoutputledit,2,1 );
+    schelayout->addWidget( scheoutputtbutton,2,2 );
+    schelayout->addWidget( schecontrol,3,0,1,3 );
+    schelayout->addWidget( scheadd,4,1 );
+    schelayout->addWidget( scheremove,4,2 );
 }
+
index 70134d5..736975b 100644 (file)
@@ -42,6 +42,9 @@ class QToolButton;
 class QGroupBox;
 class QPushButton;
 class QHBoxLayout;
+class QDateEdit;
+class QTimeEdit;
+class QSpinBox;
 
 class VLMDialog : public QVLCFrame
 {
@@ -66,10 +69,10 @@ private:
 
     QComboBox *mediatype;
     QVBoxLayout *layout;
-    QHBoxLayout *bcastgbox;
+    QHBoxLayout *bcastgbox;
     QStackedWidget *slayout;
     QWidget *pBcast, *pVod, *pSchedule;
-    QGridLayout *bcastlayout, *vodlayout, *schelayout;
+    QGridLayout *bcastlayout, *vodlayout, *schelayout, *schetimelayout;
     QLabel *bcastname, *vodname, *schename,*bcastinput, *vodinput, *scheinput;
     QLabel *bcastoutput, *vodoutput, *scheoutput;
     QCheckBox *bcastenable, *vodenable, *scheenable;
@@ -80,6 +83,10 @@ private:
     QGroupBox *bcastcontrol, *schecontrol;
     QPushButton *bcastplay, *bcastpause, *bcaststop;
     QPushButton *bcastadd, *vodadd, *scheadd, *bcastremove, *vodremove, *scheremove;
+    QTimeEdit *time;
+    QDateEdit *date;
+    QLabel *schetimelabel, *schedatelabel, *schetimerepeat;
+    QSpinBox *scherepeatnumber;
 
 private slots:
     void close();
index dbf80c1..98419b9 100644 (file)
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>632</width>
-    <height>602</height>
+    <width>640</width>
+    <height>640</height>
    </rect>
   </property>
   <property name="sizePolicy" >
-   <sizepolicy>
-    <hsizetype>5</hsizetype>
-    <vsizetype>5</vsizetype>
+   <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
     <horstretch>0</horstretch>
     <verstretch>0</verstretch>
    </sizepolicy>
   </property>
   <property name="windowTitle" >
-   <string>Form</string>
+   <string>_("VLM configurator")</string>
   </property>
-  <widget class="QGroupBox" name="groupBox" >
-   <property name="geometry" >
-    <rect>
-     <x>10</x>
-     <y>10</y>
-     <width>611</width>
-     <height>351</height>
-    </rect>
-   </property>
-   <property name="title" >
-    <string>Media configuration</string>
-   </property>
-  </widget>
-  <widget class="QTableWidget" name="mediasDB" >
-   <property name="windowModality" >
-    <enum>Qt::NonModal</enum>
-   </property>
-   <property name="enabled" >
-    <bool>true</bool>
-   </property>
-   <property name="geometry" >
-    <rect>
-     <x>10</x>
-     <y>370</y>
-     <width>611</width>
-     <height>221</height>
-    </rect>
-   </property>
-   <property name="sizePolicy" >
-    <sizepolicy>
-     <hsizetype>0</hsizetype>
-     <vsizetype>7</vsizetype>
-     <horstretch>0</horstretch>
-     <verstretch>0</verstretch>
-    </sizepolicy>
-   </property>
-   <property name="sizeIncrement" >
-    <size>
-     <width>0</width>
-     <height>0</height>
-    </size>
-   </property>
-   <property name="baseSize" >
-    <size>
-     <width>0</width>
-     <height>0</height>
-    </size>
-   </property>
-   <property name="autoFillBackground" >
-    <bool>false</bool>
-   </property>
-   <property name="horizontalScrollBarPolicy" >
-    <enum>Qt::ScrollBarAlwaysOff</enum>
-   </property>
-   <property name="selectionMode" >
-    <enum>QAbstractItemView::MultiSelection</enum>
-   </property>
-   <property name="showGrid" >
-    <bool>true</bool>
-   </property>
-   <property name="sortingEnabled" >
-    <bool>true</bool>
-   </property>
-   <row/>
-   <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>
+  <layout class="QGridLayout" >
+   <item row="0" column="0" >
+    <widget class="QGroupBox" name="groupBox" >
+     <property name="minimumSize" >
+      <size>
+       <width>0</width>
+       <height>300</height>
+      </size>
+     </property>
+     <property name="title" >
+      <string>Media configuration</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0" >
+    <widget class="QTableWidget" name="mediasDB" >
+     <property name="windowModality" >
+      <enum>Qt::NonModal</enum>
+     </property>
+     <property name="enabled" >
+      <bool>true</bool>
+     </property>
+     <property name="sizePolicy" >
+      <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize" >
+      <size>
+       <width>0</width>
+       <height>220</height>
+      </size>
+     </property>
+     <property name="sizeIncrement" >
+      <size>
+       <width>0</width>
+       <height>0</height>
+      </size>
+     </property>
+     <property name="baseSize" >
+      <size>
+       <width>0</width>
+       <height>0</height>
+      </size>
+     </property>
+     <property name="autoFillBackground" >
+      <bool>false</bool>
+     </property>
+     <property name="horizontalScrollBarPolicy" >
+      <enum>Qt::ScrollBarAlwaysOff</enum>
+     </property>
+     <property name="selectionMode" >
+      <enum>QAbstractItemView::MultiSelection</enum>
+     </property>
+     <property name="showGrid" >
+      <bool>true</bool>
+     </property>
+     <property name="sortingEnabled" >
+      <bool>true</bool>
+     </property>
+     <row/>
+     <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>
+   </item>
+   <item row="2" column="0" >
+    <widget class="QDialogButtonBox" name="buttonBox" >
+     <property name="standardButtons" >
+      <set>QDialogButtonBox::NoButton</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
  </widget>
  <resources/>
  <connections/>