Commit e4bbf1c4 authored by dionoea's avatar dionoea

Add a podcast configuration dialog to the Qt4 interface/dialogs provider.

parent fe92f9c9
......@@ -30,6 +30,7 @@ nodist_SOURCES_qt4 = \
dialogs/help.moc.cpp \
dialogs/gototime.moc.cpp \
dialogs/open.moc.cpp \
dialogs/podcast_configuration.moc.cpp \
components/extended_panels.moc.cpp \
components/infopanels.moc.cpp \
components/preferences_widgets.moc.cpp \
......@@ -50,6 +51,7 @@ nodist_SOURCES_qt4 = \
ui/open_net.h \
ui/open_capture.h \
ui/open.h \
ui/podcast_configuration.h \
ui/sprefs_audio.h \
ui/sprefs_input.h \
ui/sprefs_interface.h \
......@@ -110,6 +112,7 @@ SOURCES_qt4 = qt4.cpp \
dialogs/help.cpp \
dialogs/gototime.cpp \
dialogs/open.cpp \
dialogs/podcast_configuration.cpp \
components/extended_panels.cpp \
components/infopanels.cpp \
components/preferences_widgets.cpp \
......@@ -141,6 +144,7 @@ noinst_HEADERS = \
dialogs/help.hpp \
dialogs/gototime.hpp \
dialogs/open.hpp \
dialogs/podcast_configuration.hpp \
components/extended_panels.hpp \
components/infopanels.hpp \
components/preferences_widgets.hpp \
......@@ -165,6 +169,7 @@ EXTRA_DIST += \
ui/open_net.ui \
ui/open_capture.ui \
ui/open.ui \
ui/podcast_configuration.ui \
ui/sprefs_audio.ui \
ui/sprefs_input.ui \
ui/sprefs_interface.ui \
......
/*****************************************************************************
* podcast_configuration.cpp: Podcast configuration dialog
****************************************************************************
* Copyright (C) 2007 the VideoLAN team
* $Id$
*
* Authors: Antoine Cellerier <dionoea at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "podcast_configuration.hpp"
PodcastConfigurationDialog::PodcastConfigurationDialog( intf_thread_t *_p_intf )
:p_intf( _p_intf )
{
ui.setupUi( this );
CONNECT( ui.podcastAdd, clicked(), this, add() );
CONNECT( ui.podcastDelete, clicked(), this, remove() );
char *psz_urls = config_GetPsz( p_intf, "podcast-urls" );
if( psz_urls )
{
char *psz_url = psz_urls;
while( 1 )
{
char *psz_tok = strchr( psz_url, '|' );
if( psz_tok ) *psz_tok = '\0';
ui.podcastList->addItem( psz_url );
if( psz_tok ) psz_url = psz_tok+1;
else break;
}
free( psz_urls );
}
}
void PodcastConfigurationDialog::accept()
{
QString urls = "";
for( int i = 0; i < ui.podcastList->count(); i++ )
{
urls += ui.podcastList->item(i)->text();
if( i != ui.podcastList->count()-1 ) urls += "|";
}
const char *psz_urls = qtu( urls );
config_PutPsz( p_intf, "podcast-urls", psz_urls );
if( playlist_IsServicesDiscoveryLoaded( THEPL, "podcast" ) )
{
msg_Info( p_intf, "You will need to reload the podcast module for changes to be used (FIXME)" );
}
QDialog::accept();
}
void PodcastConfigurationDialog::add()
{
if( ui.podcastURL->text() != QString( "" ) )
{
ui.podcastList->addItem( ui.podcastURL->text() );
ui.podcastURL->clear();
}
}
void PodcastConfigurationDialog::remove()
{
delete ui.podcastList->currentItem();
}
/*****************************************************************************
* podcast_configuration.hpp: Podcast configuration dialog
****************************************************************************
* Copyright (C) 2007 the VideoLAN team
* $Id$
*
* Authors: Antoine Cellerier <dionoea at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef _PODCAST_CONFIGURATION_DIALOG_H_
#define _PODCAST_CONFIGURATION_DIALOG_H_
#include "qt4.hpp"
#include "ui/podcast_configuration.h"
class PodcastConfigurationDialog : public QDialog
{
Q_OBJECT;
public:
PodcastConfigurationDialog( intf_thread_t *p_intf );
private:
Ui::PodcastConfiguration ui;
intf_thread_t *p_intf;
private slots:
void accept();
void add();
void remove();
};
#endif
......@@ -43,6 +43,7 @@
#include "dialogs/open.hpp"
#include "dialogs/help.hpp"
#include "dialogs/gototime.hpp"
#include "dialogs/podcast_configuration.hpp"
DialogsProvider* DialogsProvider::instance = NULL;
......@@ -502,6 +503,12 @@ void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg )
}
}
void DialogsProvider::podcastConfigureDialog()
{
PodcastConfigurationDialog c( p_intf );
c.exec();
}
void DialogsProvider::switchToSkins()
{
var_SetString( p_intf, "intf-switch", "skins2" );
......
......@@ -166,6 +166,8 @@ public slots:
void openPlaylist();
void savePlaylist();
void podcastConfigureDialog();
void switchToSkins();
void quit();
};
......
......@@ -434,6 +434,14 @@ QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf )
THEDP->SDMapper->setMapping( a, i>=0? p_parser->pp_shortcuts[i] :
module_GetObjName( p_parser ) );
menu->addAction( a );
if( !strcmp( p_parser->psz_object_name, "podcast" ) )
{
QAction *b = new QAction( qfu( "Configure podcasts..." ), menu );
//b->setEnabled( a->isChecked() );
menu->addAction( b );
CONNECT( b, triggered(), THEDP, podcastConfigureDialog() );
}
}
vlc_list_release( p_list );
return menu;
......
<ui version="4.0" >
<class>PodcastConfiguration</class>
<widget class="QDialog" name="PodcastConfiguration" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>547</width>
<height>330</height>
</rect>
</property>
<property name="windowTitle" >
<string>Dialog</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" colspan="2" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>_("Podcast URLs list")</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4" >
<widget class="QListWidget" name="podcastList" >
<property name="dragEnabled" >
<bool>true</bool>
</property>
<property name="dragDropMode" >
<enum>QAbstractItemView::InternalMove</enum>
</property>
<property name="alternatingRowColors" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label2" >
<property name="text" >
<string>_("URL")</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLineEdit" name="podcastURL" />
</item>
<item row="2" column="2" >
<widget class="QPushButton" name="podcastAdd" >
<property name="text" >
<string>_("Add")</string>
</property>
<property name="icon" >
<iconset resource="../res.qrc" >:/pixmaps/play.png</iconset>
</property>
</widget>
</item>
<item row="2" column="3" >
<widget class="QPushButton" name="podcastDelete" >
<property name="text" >
<string>_("Delete")</string>
</property>
<property name="icon" >
<iconset resource="../res.qrc" >:/pixmaps/vlc_quit_16px.png</iconset>
</property>
</widget>
</item>
<item row="3" column="2" colspan="2" >
<widget class="QDialogButtonBox" name="okCancel" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../res.qrc" />
</resources>
<connections>
<connection>
<sender>okCancel</sender>
<signal>accepted()</signal>
<receiver>PodcastConfiguration</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>445</x>
<y>304</y>
</hint>
<hint type="destinationlabel" >
<x>273</x>
<y>164</y>
</hint>
</hints>
</connection>
<connection>
<sender>okCancel</sender>
<signal>rejected()</signal>
<receiver>PodcastConfiguration</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>445</x>
<y>304</y>
</hint>
<hint type="destinationlabel" >
<x>273</x>
<y>164</y>
</hint>
</hints>
</connection>
</connections>
</ui>
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