Commit 17413bf6 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - VLM improvements... Classing for the three kind of objects, more...

Qt4 - VLM improvements... Classing for the three kind of objects, more property editing and less segfaults (though there is one I have nooo clue ).
parent cf9db1b8
......@@ -38,8 +38,7 @@
#include <QGroupBox>
#include <QPushButton>
#include <QHBoxLayout>
#include <QTimeEdit>
#include <QDateEdit>
#include <QDateTimeEdit>
#include <QSpinBox>
#include <QHeaderView>
#include <QScrollArea>
......@@ -68,23 +67,36 @@ VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
schetimelayout->addWidget( schedatelabel, 1, 0 );
QLabel *scherepeatLabel = new QLabel( qtr( "Repeat:" ) );
schetimelayout->addWidget( scherepeatLabel, 2, 0 );
QLabel *scherepeatTimeLabel = new QLabel( qtr( "Repeat delay:" ) );
schetimelayout->addWidget( scherepeatTimeLabel, 3, 0 );
time = new QTimeEdit( QTime::currentTime() );
time = new QDateTimeEdit( QTime::currentTime() );
time->setAlignment( Qt::AlignRight );
schetimelayout->addWidget( time, 0, 1 );
schetimelayout->addWidget( time, 0, 1, 1, 3 );
date = new QDateEdit( QDate::currentDate() );
date = new QDateTimeEdit( QDate::currentDate() );
date->setAlignment( Qt::AlignRight );
date->setCalendarPopup( true );
#ifdef WIN32
date->setDisplayFormat( "dd MM yyyy" );
#else
date->setDisplayFormat( "dd MMMM yyyy" );
#endif
schetimelayout->addWidget( date, 1, 1 );
schetimelayout->addWidget( date, 1, 1, 1, 3 );
scherepeatnumber = new QSpinBox;
scherepeatnumber->setAlignment( Qt::AlignRight );
schetimelayout->addWidget( scherepeatnumber, 2, 1 );
schetimelayout->addWidget( scherepeatnumber, 2, 1, 1, 3 );
repeatDays = new QSpinBox;
repeatDays->setAlignment( Qt::AlignRight );
schetimelayout->addWidget( repeatDays, 3, 1, 1, 1 );
repeatDays->setSuffix( qtr(" days") );
repeatTime = new QDateTimeEdit;
repeatTime->setAlignment( Qt::AlignRight );
schetimelayout->addWidget( repeatTime, 3, 2, 1, 2 );
repeatTime->setDisplayFormat( "hh:mm:ss" );
/* scrollArea */
ui.vlmItemScroll->setFrameStyle( QFrame::NoFrame );
......@@ -94,13 +106,14 @@ VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
vlmItemWidget->setLayout( vlmItemLayout );
ui.vlmItemScroll->setWidget( vlmItemWidget );
QSpacerItem *spacer = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding);
QSpacerItem *spacer =
new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding);
vlmItemLayout->addItem( spacer );
QPushButton *closeButton = new QPushButton( qtr( "Close" ) );
ui.buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
ui.schedBox->hide();
showScheduleWidget( QVLM_Broadcast );
/* Connect the comboBox to show the right Widgets */
CONNECT( ui.mediaType, currentIndexChanged( int ),
......@@ -121,6 +134,8 @@ VLMDialog::~VLMDialog(){}
void VLMDialog::showScheduleWidget( int i )
{
ui.schedBox->setVisible( ( i == QVLM_Schedule ) );
ui.loopBCast->setVisible( ( i == QVLM_Broadcast ) );
ui.vodBox->setVisible( ( i == QVLM_VOD ) );
}
void VLMDialog::selectVLMItem( int i )
......@@ -151,18 +166,27 @@ void VLMDialog::addVLMItem()
}
int type = ui.mediaType->itemData( ui.mediaType->currentIndex() ).toInt();
QString typeShortName;
QString inputText = ui.inputLedit->text();
QString outputText = ui.outputLedit->text();
bool b_checked;
VLMAWidget * vlmAwidget;
switch( type )
{
case QVLM_Broadcast:
typeShortName = "Bcast";
vlmAwidget = new VLMBroadcast( name, inputText, outputText, b_checked, this );
break;
case QVLM_VOD:
typeShortName = "VOD";
vlmAwidget = new VLMVod( name, inputText, outputText, b_checked, this );
break;
case QVLM_Schedule:
typeShortName = "Sched";
vlmAwidget = new VLMSchedule( name, inputText, outputText, b_checked, this );
break;
default:
msg_Warn( p_intf, "Something bad happened" );
......@@ -173,15 +197,10 @@ void VLMDialog::addVLMItem()
ui.vlmListItem->addItem( typeShortName + " : " + name );
ui.vlmListItem->setCurrentRow( vlmItemCount - 1 );
/* Add a new VLMObject on the main List */
VLMObject *vlmObject = new VLMObject( type, name,
ui.inputLedit->text(),
ui.outputLedit->text(),
ui.enableCheck->isChecked(),
this );
/* Add a new VLMAWidget on the main List */
vlmItemLayout->insertWidget( vlmItemCount, vlmObject );
vlmItems.append( vlmObject );
vlmItemLayout->insertWidget( vlmItemCount, vlmAwidget );
vlmItems.append( vlmAwidget );
/* HERE BE DRAGONS VLM REQUEST */
}
......@@ -199,7 +218,7 @@ void VLMDialog::clearWidgets()
void VLMDialog::saveModifications()
{
VLMObject *vlmObj = vlmItems.at( currentIndex );
VLMAWidget *vlmObj = vlmItems.at( currentIndex );
if( vlmObj )
{
vlmObj->input = ui.inputLedit->text();
......@@ -213,11 +232,12 @@ void VLMDialog::saveModifications()
}
/* Object Modification */
void VLMDialog::removeVLMItem( VLMObject *vlmObj )
void VLMDialog::removeVLMItem( VLMAWidget *vlmObj )
{
int index = vlmItems.indexOf( vlmObj );
if( index < 0 ) return;
//FIXME, this is going to segfault if the focus in on the ListWidget
delete ui.vlmListItem->takeItem( index );
vlmItems.removeAt( index );
delete vlmObj;
......@@ -225,7 +245,7 @@ void VLMDialog::removeVLMItem( VLMObject *vlmObj )
/* HERE BE DRAGONS VLM REQUEST */
}
void VLMDialog::startModifyVLMItem( VLMObject *vlmObj )
void VLMDialog::startModifyVLMItem( VLMAWidget *vlmObj )
{
currentIndex = vlmItems.indexOf( vlmObj );
if( currentIndex < 0 ) return;
......@@ -243,10 +263,10 @@ void VLMDialog::startModifyVLMItem( VLMObject *vlmObj )
/*********************************
* VLMObject
* VLMAWidget
********************************/
VLMObject::VLMObject( int type,
QString _name,
VLMAWidget::VLMAWidget( QString _name,
QString _input,
QString _output,
bool _enabled,
......@@ -260,26 +280,14 @@ VLMObject::VLMObject( int type,
b_enabled = _enabled;
setChecked( b_enabled );
QGridLayout *objLayout = new QGridLayout( this );
objLayout = new QGridLayout( this );
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum );
QLabel *label = new QLabel( psz_type[type] + ( ": " + name ) );
objLayout->addWidget( label, 0, 0, 1, 4 );
QToolButton *playButton = new QToolButton;
playButton->setIcon( QIcon( QPixmap( ":/pixmaps/play_16px.png" ) ) );
objLayout->addWidget( playButton, 1, 0 );
QToolButton *stopButton = new QToolButton;
stopButton->setIcon( QIcon( QPixmap( ":/pixmaps/stop_16px.png" ) ) );
objLayout->addWidget( stopButton, 1, 1 );
QToolButton *loopButton = new QToolButton;
loopButton->setIcon( QIcon( QPixmap( ":/pixmaps/playlist_repeat_off.png" ) ) );
objLayout->addWidget( loopButton, 1, 2 );
nameLabel = new QLabel;
objLayout->addWidget( nameLabel, 0, 0, 1, 4 );
QLabel *time = new QLabel( "--:--/--:--" );
objLayout->addWidget( time, 1, 3, 1, 2 );
/*QLabel *time = new QLabel( "--:--/--:--" );
objLayout->addWidget( time, 1, 3, 1, 2 );*/
QToolButton *modifyButton = new QToolButton;
modifyButton->setIcon( QIcon( QPixmap( ":/pixmaps/menus_settings_16px.png" ) ) );
......@@ -289,39 +297,76 @@ VLMObject::VLMObject( int type,
deleteButton->setIcon( QIcon( QPixmap( ":/pixmaps/menus_quit_16px.png" ) ) );
objLayout->addWidget( deleteButton, 0, 6 );
BUTTONACT( playButton, togglePlayPause() );
BUTTONACT( stopButton, stop() );
BUTTONACT( modifyButton, modify() );
BUTTONACT( deleteButton, del() );
BUTTONACT( loopButton, toggleLoop() );
}
void VLMObject::modify()
void VLMAWidget::modify()
{
parent->startModifyVLMItem( this );
}
void VLMObject::del()
void VLMAWidget::del()
{
parent->removeVLMItem( this );
}
void VLMObject::togglePlayPause()
VLMBroadcast::VLMBroadcast( QString _name, QString _input, QString _output,
bool _enabled, VLMDialog *_parent)
: VLMAWidget( _name, _input, _output,
_enabled, _parent)
{
nameLabel->setText( "Broadcast: " + name );
QToolButton *playButton = new QToolButton;
playButton->setIcon( QIcon( QPixmap( ":/pixmaps/play_16px.png" ) ) );
objLayout->addWidget( playButton, 1, 0 );
QToolButton *stopButton = new QToolButton;
stopButton->setIcon( QIcon( QPixmap( ":/pixmaps/stop_16px.png" ) ) );
objLayout->addWidget( stopButton, 1, 1 );
QToolButton *loopButton = new QToolButton;
loopButton->setIcon( QIcon( QPixmap( ":/pixmaps/playlist_repeat_off.png" ) ) );
objLayout->addWidget( loopButton, 1, 2 );
BUTTONACT( playButton, togglePlayPause() );
BUTTONACT( stopButton, stop() );
BUTTONACT( loopButton, toggleLoop() );
}
void VLMObject::toggleLoop()
void VLMBroadcast::togglePlayPause()
{
}
void VLMObject::stop()
void VLMBroadcast::toggleLoop()
{
}
void VLMObject::enterEvent( QEvent *event )
void VLMBroadcast::stop()
{
}
void VLMAWidget::enterEvent( QEvent *event )
{
printf( "test" );
}
VLMSchedule::VLMSchedule( QString name, QString input, QString output,
bool enabled, VLMDialog *parent) : VLMAWidget( name, input,
output, enabled, parent)
{
nameLabel->setText( "Schedule: " + name );
}
VLMVod::VLMVod( QString name, QString input, QString output,
bool enabled, VLMDialog *parent) : VLMAWidget( name, input,
output, enabled, parent)
{
nameLabel->setText( "VOD:" + name );
}
......@@ -47,10 +47,9 @@ class QToolButton;
class QGroupBox;
class QPushButton;
class QHBoxLayout;
class QDateEdit;
class QTimeEdit;
class QDateTimeEdit;
class QSpinBox;
class VLMObject;
class VLMAWidget;
class VLMDialog : public QVLCFrame
{
......@@ -69,20 +68,19 @@ private:
static VLMDialog *instance;
Ui::Vlm ui;
QList<VLMObject *> vlmItems;
QList<VLMAWidget *> vlmItems;
int currentIndex;
QVBoxLayout *vlmItemLayout;
QWidget *vlmItemWidget;
QComboBox *mediatype;
QTimeEdit *time;
QDateEdit *date;
QSpinBox *scherepeatnumber;
QDateTimeEdit *time, *date, *repeatTime;
QSpinBox *scherepeatnumber, *repeatDays;
bool isNameGenuine( QString );
public slots:
void removeVLMItem( VLMObject * );
void startModifyVLMItem( VLMObject * );
void removeVLMItem( VLMAWidget * );
void startModifyVLMItem( VLMAWidget * );
private slots:
void addVLMItem();
void clearWidgets();
......@@ -91,27 +89,52 @@ private slots:
void selectVLMItem( int );
};
class VLMObject : public QGroupBox
class VLMAWidget : public QGroupBox
{
Q_OBJECT
friend class VLMDialog;
public:
VLMObject( int type, QString name, QString input, QString output, bool _enable, VLMDialog *parent );
private:
VLMAWidget( QString name, QString input, QString output, bool _enable, VLMDialog *parent );
protected:
QLabel *nameLabel;
QString name;
QString input;
QString output;
bool b_looped;
bool b_enabled;
VLMDialog *parent;
protected:
virtual void enterEvent( QEvent * );
QGridLayout *objLayout;
private slots:
virtual void modify();
virtual void del();
};
class VLMBroadcast : public VLMAWidget
{
Q_OBJECT
public:
VLMBroadcast( QString name, QString input, QString output, bool _enable, VLMDialog *parent );
private:
bool b_looped;
private slots:
void modify();
void stop();
void del();
void togglePlayPause();
void toggleLoop();
};
class VLMVod : public VLMAWidget
{
public:
VLMVod( QString name, QString input, QString output, bool _enable, VLMDialog *parent );
private:
QString mux;
};
class VLMSchedule : public VLMAWidget
{
public:
VLMSchedule( QString name, QString input, QString output, bool _enable, VLMDialog *parent );
};
#endif
......@@ -9,7 +9,7 @@
<x>0</x>
<y>0</y>
<width>738</width>
<height>598</height>
<height>693</height>
</rect>
</property>
<property name="sizePolicy" >
......@@ -112,6 +112,52 @@
</property>
</widget>
</item>
<item row="6" column="0" colspan="3" >
<widget class="QGroupBox" name="vodBox" >
<property name="title" >
<string>_("Mux Control")</string>
</property>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>Muxer:</string>
</property>
<property name="margin" >
<number>3</number>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="muxLedit" >
<property name="inputMask" >
<string>AAAA; </string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>411</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="7" column="0" colspan="2" >
<widget class="QCheckBox" name="loopBCast" >
<property name="text" >
<string>_("Loop")</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......
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