1 /*****************************************************************************
2 * podcast_configuration.cpp: Podcast configuration dialog
3 ****************************************************************************
4 * Copyright (C) 2007 the VideoLAN team
7 * Authors: Antoine Cellerier <dionoea at videolan dot org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #include "podcast_configuration.hpp"
26 PodcastConfigurationDialog::PodcastConfigurationDialog( intf_thread_t *_p_intf )
30 CONNECT( ui.podcastAdd, clicked(), this, add() );
31 CONNECT( ui.podcastDelete, clicked(), this, remove() );
33 char *psz_urls = config_GetPsz( p_intf, "podcast-urls" );
36 char *psz_url = psz_urls;
39 char *psz_tok = strchr( psz_url, '|' );
40 if( psz_tok ) *psz_tok = '\0';
41 ui.podcastList->addItem( psz_url );
42 if( psz_tok ) psz_url = psz_tok+1;
49 void PodcastConfigurationDialog::accept()
52 for( int i = 0; i < ui.podcastList->count(); i++ )
54 urls += ui.podcastList->item(i)->text();
55 if( i != ui.podcastList->count()-1 ) urls += "|";
57 const char *psz_urls = qtu( urls );
58 config_PutPsz( p_intf, "podcast-urls", psz_urls );
59 if( playlist_IsServicesDiscoveryLoaded( THEPL, "podcast" ) )
61 msg_Info( p_intf, "You will need to reload the podcast module for changes to be used (FIXME)" );
66 void PodcastConfigurationDialog::add()
68 if( ui.podcastURL->text() != QString( "" ) )
70 ui.podcastList->addItem( ui.podcastURL->text() );
71 ui.podcastURL->clear();
75 void PodcastConfigurationDialog::remove()
77 delete ui.podcastList->currentItem();