Commit 83e5a17f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

qt: add load/save config to VLMWrapper

parent 0d5f8eb8
......@@ -273,10 +273,7 @@ bool VLMDialog::exportVLMConf()
if( !saveVLMConfFileName.isEmpty() )
{
vlm_message_t *message;
QString command = "save \"" + saveVLMConfFileName + "\"";
vlm_ExecuteCommand( p_vlm , qtu( command ) , &message );
vlm_MessageDelete( message );
VLMWrapper::SaveConfig( saveVLMConfFileName );
return true;
}
......@@ -347,18 +344,13 @@ bool VLMDialog::importVLMConf()
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 )
if( VLMWrapper::LoadConfig( openVLMConfFileName ) )
{
mediasPopulator();
}
else
{
msg_Warn( p_intf, "Failed to import vlm configuration file : %s", qtu( command ) );
msg_Warn( p_intf, "Failed to import vlm configuration file : %s", qtu( openVLMConfFileName ) );
return false;
}
return true;
......@@ -894,6 +886,26 @@ void VLMWrapper::EditSchedule( const QString& name, const QString& input,
}
}
void VLMWrapper::SaveConfig( const QString& filename )
{
/* FIXME: escaping */
QString command = "save \"" + filename + "\"";
vlm_message_t *message;
vlm_ExecuteCommand( p_vlm , qtu( command ), &message );
vlm_MessageDelete( message );
}
bool VLMWrapper::LoadConfig( const QString& filename )
{
/* FIXME: escaping */
QString command = "load \"" + filename + "\"";
vlm_message_t *message;
int status = vlm_ExecuteCommand( p_vlm, qtu( command ) , &message );
vlm_MessageDelete( message );
return status == 0;
}
void VLMDialog::toggleVisible()
{
qDeleteAll( vlmItems );
......
......@@ -140,6 +140,9 @@ public:
static void ControlBroadcast( const QString&, int, unsigned int seek = 0 );
static void EnableItem( const QString&, bool );
static void SaveConfig( const QString& );
static bool LoadConfig( const QString& );
/* We don't have yet the accessors in the core, so the following is commented */
//unsigned int NbMedia() { if( p_vlm ) return p_vlm->i_media; return 0; }
/* vlm_media_t *GetMedia( int i )
......
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