Commit 6ed021d3 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Fix VLM-object not being checked. Add a type to be sure of the edition to do.

parent 7a35ff7e
...@@ -170,7 +170,7 @@ void VLMDialog::addVLMItem() ...@@ -170,7 +170,7 @@ void VLMDialog::addVLMItem()
QString typeShortName; QString typeShortName;
QString inputText = ui.inputLedit->text(); QString inputText = ui.inputLedit->text();
QString outputText = ui.outputLedit->text(); QString outputText = ui.outputLedit->text();
bool b_checked; bool b_checked = ui.enableCheck->isChecked();
VLMAWidget * vlmAwidget; VLMAWidget * vlmAwidget;
...@@ -178,15 +178,18 @@ void VLMDialog::addVLMItem() ...@@ -178,15 +178,18 @@ void VLMDialog::addVLMItem()
{ {
case QVLM_Broadcast: case QVLM_Broadcast:
typeShortName = "Bcast"; typeShortName = "Bcast";
vlmAwidget = new VLMBroadcast( name, inputText, outputText, b_checked, this ); vlmAwidget = new VLMBroadcast( name, inputText, outputText,
b_checked, this );
break; break;
case QVLM_VOD: case QVLM_VOD:
typeShortName = "VOD"; typeShortName = "VOD";
vlmAwidget = new VLMVod( name, inputText, outputText, b_checked, this ); vlmAwidget = new VLMVod( name, inputText, outputText,
b_checked, this );
break; break;
case QVLM_Schedule: case QVLM_Schedule:
typeShortName = "Sched"; typeShortName = "Sched";
vlmAwidget = new VLMSchedule( name, inputText, outputText, b_checked, this ); vlmAwidget = new VLMSchedule( name, inputText, outputText,
b_checked, this );
break; break;
default: default:
msg_Warn( p_intf, "Something bad happened" ); msg_Warn( p_intf, "Something bad happened" );
...@@ -214,6 +217,8 @@ void VLMDialog::clearWidgets() ...@@ -214,6 +217,8 @@ void VLMDialog::clearWidgets()
date->setDate( QDate::currentDate() ); date->setDate( QDate::currentDate() );
ui.enableCheck->setChecked( true ); ui.enableCheck->setChecked( true );
ui.nameLedit->setReadOnly( false ); ui.nameLedit->setReadOnly( false );
ui.saveButton->hide();
ui.addButton->show();
} }
void VLMDialog::saveModifications() void VLMDialog::saveModifications()
...@@ -226,8 +231,6 @@ void VLMDialog::saveModifications() ...@@ -226,8 +231,6 @@ void VLMDialog::saveModifications()
vlmObj->setChecked( ui.enableCheck->isChecked() ); vlmObj->setChecked( ui.enableCheck->isChecked() );
vlmObj->b_enabled = ui.enableCheck->isChecked(); vlmObj->b_enabled = ui.enableCheck->isChecked();
} }
ui.saveButton->hide();
ui.addButton->show();
clearWidgets(); clearWidgets();
} }
...@@ -250,6 +253,7 @@ void VLMDialog::startModifyVLMItem( VLMAWidget *vlmObj ) ...@@ -250,6 +253,7 @@ void VLMDialog::startModifyVLMItem( VLMAWidget *vlmObj )
currentIndex = vlmItems.indexOf( vlmObj ); currentIndex = vlmItems.indexOf( vlmObj );
if( currentIndex < 0 ) return; if( currentIndex < 0 ) return;
msg_Dbg( p_intf, "Type: %i", vlmObj->type );
ui.vlmListItem->setCurrentRow( currentIndex ); ui.vlmListItem->setCurrentRow( currentIndex );
ui.nameLedit->setText( vlmObj->name ); ui.nameLedit->setText( vlmObj->name );
ui.inputLedit->setText( vlmObj->input ); ui.inputLedit->setText( vlmObj->input );
...@@ -270,7 +274,8 @@ VLMAWidget::VLMAWidget( QString _name, ...@@ -270,7 +274,8 @@ VLMAWidget::VLMAWidget( QString _name,
QString _input, QString _input,
QString _output, QString _output,
bool _enabled, bool _enabled,
VLMDialog *_parent ) VLMDialog *_parent,
int _type )
: QGroupBox( _name, _parent ) : QGroupBox( _name, _parent )
{ {
parent = _parent; parent = _parent;
...@@ -278,6 +283,9 @@ VLMAWidget::VLMAWidget( QString _name, ...@@ -278,6 +283,9 @@ VLMAWidget::VLMAWidget( QString _name,
input = _input; input = _input;
output = _output; output = _output;
b_enabled = _enabled; b_enabled = _enabled;
type = _type;
setCheckable( true );
setChecked( b_enabled ); setChecked( b_enabled );
objLayout = new QGridLayout( this ); objLayout = new QGridLayout( this );
...@@ -315,9 +323,10 @@ void VLMAWidget::del() ...@@ -315,9 +323,10 @@ void VLMAWidget::del()
VLMBroadcast::VLMBroadcast( QString _name, QString _input, QString _output, VLMBroadcast::VLMBroadcast( QString _name, QString _input, QString _output,
bool _enabled, VLMDialog *_parent) bool _enabled, VLMDialog *_parent)
: VLMAWidget( _name, _input, _output, : VLMAWidget( _name, _input, _output,
_enabled, _parent) _enabled, _parent, QVLM_Broadcast )
{ {
nameLabel->setText( "Broadcast: " + name ); nameLabel->setText( "Broadcast: " + name );
type = QVLM_Broadcast;
QToolButton *playButton = new QToolButton; QToolButton *playButton = new QToolButton;
playButton->setIcon( QIcon( QPixmap( ":/pixmaps/play_16px.png" ) ) ); playButton->setIcon( QIcon( QPixmap( ":/pixmaps/play_16px.png" ) ) );
objLayout->addWidget( playButton, 1, 0 ); objLayout->addWidget( playButton, 1, 0 );
...@@ -359,14 +368,14 @@ void VLMAWidget::enterEvent( QEvent *event ) ...@@ -359,14 +368,14 @@ void VLMAWidget::enterEvent( QEvent *event )
VLMSchedule::VLMSchedule( QString name, QString input, QString output, VLMSchedule::VLMSchedule( QString name, QString input, QString output,
bool enabled, VLMDialog *parent) : VLMAWidget( name, input, bool enabled, VLMDialog *parent) : VLMAWidget( name, input,
output, enabled, parent) output, enabled, parent, QVLM_Schedule )
{ {
nameLabel->setText( "Schedule: " + name ); nameLabel->setText( "Schedule: " + name );
} }
VLMVod::VLMVod( QString name, QString input, QString output, VLMVod::VLMVod( QString name, QString input, QString output,
bool enabled, VLMDialog *parent) : VLMAWidget( name, input, bool enabled, VLMDialog *parent) : VLMAWidget( name, input,
output, enabled, parent) output, enabled, parent, QVLM_VOD )
{ {
nameLabel->setText( "VOD:" + name ); nameLabel->setText( "VOD:" + name );
} }
...@@ -94,13 +94,14 @@ class VLMAWidget : public QGroupBox ...@@ -94,13 +94,14 @@ class VLMAWidget : public QGroupBox
Q_OBJECT Q_OBJECT
friend class VLMDialog; friend class VLMDialog;
public: public:
VLMAWidget( QString name, QString input, QString output, bool _enable, VLMDialog *parent ); VLMAWidget( QString name, QString input, QString output, bool _enable, VLMDialog *parent, int _type = QVLM_Broadcast );
protected: protected:
QLabel *nameLabel; QLabel *nameLabel;
QString name; QString name;
QString input; QString input;
QString output; QString output;
bool b_enabled; bool b_enabled;
int type;
VLMDialog *parent; VLMDialog *parent;
virtual void enterEvent( QEvent * ); virtual void enterEvent( QEvent * );
QGridLayout *objLayout; QGridLayout *objLayout;
...@@ -116,7 +117,6 @@ public: ...@@ -116,7 +117,6 @@ public:
VLMBroadcast( QString name, QString input, QString output, bool _enable, VLMDialog *parent ); VLMBroadcast( QString name, QString input, QString output, bool _enable, VLMDialog *parent );
private: private:
bool b_looped; bool b_looped;
private slots: private slots:
void stop(); void stop();
void togglePlayPause(); void togglePlayPause();
...@@ -135,6 +135,8 @@ class VLMSchedule : public VLMAWidget ...@@ -135,6 +135,8 @@ class VLMSchedule : public VLMAWidget
{ {
public: public:
VLMSchedule( QString name, QString input, QString output, bool _enable, VLMDialog *parent ); VLMSchedule( QString name, QString input, QString output, bool _enable, VLMDialog *parent );
private:
}; };
#endif #endif
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