+ clearWidgets();
+}
+
+/* TODO : VOD are not exported to the file */
+bool VLMDialog::exportVLMConf()
+{
+ QString saveVLMConfFileName = QFileDialog::getSaveFileName( this,
+ qtr( "Save VLM configuration as..." ),
+ QVLCUserDir( VLC_DOCUMENTS_DIR ),
+ qtr( "VLM conf (*.vlm);;All (*)" ) );
+
+ if( !saveVLMConfFileName.isEmpty() )
+ {
+ vlm_message_t *message;
+ QString command = "save \"" + saveVLMConfFileName + "\"";
+ vlm_ExecuteCommand( p_vlm , qtu( command ) , &message );
+ vlm_MessageDelete( message );
+ return true;
+ }
+
+ return false;
+}
+
+void VLMDialog::mediasPopulator()
+{
+ if( p_vlm )
+ {
+ int i_nMedias;
+ QString typeShortName;
+ int vlmItemCount;
+ vlm_media_t ***ppp_dsc = (vlm_media_t ***)malloc( sizeof( vlm_media_t ) );
+
+ /* Get medias information and numbers */
+ vlm_Control( p_vlm, VLM_GET_MEDIAS, ppp_dsc, &i_nMedias );
+
+ /* Loop on all of them */
+ for( int i = 0; i < i_nMedias; i++ )
+ {
+ VLMAWidget * vlmAwidget;
+ vlmItemCount = vlmItems.size();
+
+ QString mediaName = qfu( (*ppp_dsc)[i]->psz_name );
+ /* It may have several inputs, we take the first one by default
+ - an evolution will be to manage these inputs in the gui */
+ QString inputText = qfu( (*ppp_dsc)[i]->ppsz_input[0] );
+
+ QString outputText = qfu( (*ppp_dsc)[i]->psz_output );
+
+ /* Schedule media is a quite especial, maybe there is another way to grab information */
+ if( (*ppp_dsc)[i]->b_vod )
+ {
+ typeShortName = "VOD";
+ QString mux = qfu( (*ppp_dsc)[i]->vod.psz_mux );
+ vlmAwidget = new VLMVod( mediaName, inputText, inputOptions,
+ outputText, (*ppp_dsc)[i]->b_enabled,
+ mux, this );
+ }
+ else
+ {
+ typeShortName = "Bcast";
+ vlmAwidget = new VLMBroadcast( mediaName, inputText, inputOptions,
+ outputText, (*ppp_dsc)[i]->b_enabled,
+ (*ppp_dsc)[i]->broadcast.b_loop, this );
+ }
+ /* Add an Item of the Side List */
+ ui.vlmListItem->addItem( typeShortName + " : " + mediaName );
+ ui.vlmListItem->setCurrentRow( vlmItemCount - 1 );
+
+ /* Add a new VLMAWidget on the main List */
+ vlmItemLayout->insertWidget( vlmItemCount, vlmAwidget );
+ vlmItems.append( vlmAwidget );
+ clearWidgets();
+ }
+ free( ppp_dsc );
+ }
+}
+
+bool VLMDialog::importVLMConf()
+{
+ QString openVLMConfFileName = toNativeSeparators(
+ QFileDialog::getOpenFileName(
+ this, qtr( "Open VLM configuration..." ),
+ QVLCUserDir( VLC_DOCUMENTS_DIR ),
+ qtr( "VLM conf (*.vlm);;All (*)" ) ) );
+
+ if( !openVLMConfFileName.isEmpty() )
+ {
+ vlm_message_t *message;
+ int status;
+ QString command = "load \"" + openVLMConfFileName + "\"";
+ status = vlm_ExecuteCommand( p_vlm, qtu( command ) , &message );
+ vlm_MessageDelete( message );
+ if( status == 0 )
+ {
+ mediasPopulator();
+ }
+ else
+ {
+ msg_Warn( p_intf, "Failed to import vlm configuration file : %s", qtu( command ) );
+ return false;
+ }
+ return true;
+ }
+ return false;