Commit 12cbd4c8 authored by Clément Stenac's avatar Clément Stenac

* include/vlc_playlist.h

  src/playlist/playlist.c:
     * Implemented a boolean b_enabled to disable a playlist item
     * Implemented the idea of group (p_item->i_group), that allows
       to enable/disable and to sort some series of items
     * Implemented an unused (at the moment), psz_author field
     * Started to implement a new playlist format to store all of these

* modules/gui/wxwindows/interface.cpp:
     Added a hiddeable panel to put some important options.
     (Menu Preferences->Extra GUI)
     At the moment, we put the adjust filter and aspect ratio, and must
     decide what options we want here

* modules/gui/wxwindows/playlist.cpp
  modules/gui/wxwindows/iteminfo.cpp:
     Added "Enable/disable group button", options to enable/disable selection
     Added an item info dialog box

* modules/misc/sap.c :
     Added a sap-group-id option: the SAP playlist items are in a separate group
     (defaults to 42)

* modules/visualization/visual/effects.c:
     Minor coding style fixes

Todo:
-----

* Advanced sort (alphabetical and/or by group)
* Ability to load 0_6 playlists
* Really use the libid3tag
parent de2868c4
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlc_playlist.h : Playlist functions * vlc_playlist.h : Playlist functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
* $Id: vlc_playlist.h,v 1.13 2003/09/08 12:02:16 zorglub Exp $ * $Id: vlc_playlist.h,v 1.14 2003/10/06 16:23:30 zorglub Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -48,10 +48,15 @@ struct playlist_item_t ...@@ -48,10 +48,15 @@ struct playlist_item_t
* ppsz_options array */ * ppsz_options array */
int i_type; /**< unused yet */ int i_type; /**< unused yet */
int i_status; /**< unused yet */ int i_status; /**< unused yet */
vlc_bool_t b_autodeletion; /**< Indicates wether this item is to vlc_bool_t b_autodeletion; /**< Indicates whther this item is to
* be deleted after playback. True mean * be deleted after playback. True mean
* that this item is to be deleted * that this item is to be deleted
* after playback, false otherwise */ * after playback, false otherwise */
vlc_bool_t b_enabled; /**< Indicates whether this item is to be
* played or skipped */
int i_group; /**< unused yet */
char * psz_author; /**< Author */
}; };
/** /**
...@@ -73,7 +78,7 @@ struct playlist_t ...@@ -73,7 +78,7 @@ struct playlist_t
int i_index; /**< current index into the playlist */ int i_index; /**< current index into the playlist */
playlist_status_t i_status; /**< current status of playlist */ playlist_status_t i_status; /**< current status of playlist */
int i_size; /**< total size of the list */ int i_size; /**< total size of the list */
int i_enabled; /**< How many items are enabled ? */
playlist_item_t ** pp_items; /**< array of pointers to the playlist_item_t ** pp_items; /**< array of pointers to the
* playlist items */ * playlist items */
...@@ -85,6 +90,9 @@ struct playlist_t ...@@ -85,6 +90,9 @@ struct playlist_t
#define SORT_NORMAL 0 #define SORT_NORMAL 0
#define SORT_REVERSE 1 #define SORT_REVERSE 1
#define PLAYLIST_TYPE_MANUAL 0
#define PLAYLIST_TYPE_SAP 1
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
...@@ -105,6 +113,10 @@ VLC_EXPORT( int, playlist_Add, ( playlist_t *, const char *, const char **, ...@@ -105,6 +113,10 @@ VLC_EXPORT( int, playlist_Add, ( playlist_t *, const char *, const char **,
VLC_EXPORT( int, playlist_AddExt, ( playlist_t *, const char *, const char *, mtime_t, const char **, int, int, int ) ); VLC_EXPORT( int, playlist_AddExt, ( playlist_t *, const char *, const char *, mtime_t, const char **, int, int, int ) );
VLC_EXPORT( int, playlist_AddItem, ( playlist_t *, playlist_item_t *, int, int ) ); VLC_EXPORT( int, playlist_AddItem, ( playlist_t *, playlist_item_t *, int, int ) );
VLC_EXPORT( int, playlist_Delete, ( playlist_t *, int ) ); VLC_EXPORT( int, playlist_Delete, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_Disable, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_Enable, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_DisableGroup, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_EnableGroup, ( playlist_t *, int ) );
VLC_EXPORT( int, playlist_Sort, ( playlist_t *, int) ); VLC_EXPORT( int, playlist_Sort, ( playlist_t *, int) );
VLC_EXPORT( int, playlist_Move, ( playlist_t *, int, int ) ); VLC_EXPORT( int, playlist_Move, ( playlist_t *, int, int ) );
VLC_EXPORT( int, playlist_LoadFile, ( playlist_t *, const char * ) ); VLC_EXPORT( int, playlist_LoadFile, ( playlist_t *, const char * ) );
......
...@@ -7,6 +7,7 @@ SOURCES_wxwindows = \ ...@@ -7,6 +7,7 @@ SOURCES_wxwindows = \
streamout.cpp \ streamout.cpp \
messages.cpp \ messages.cpp \
playlist.cpp \ playlist.cpp \
iteminfo.cpp \
menus.cpp \ menus.cpp \
preferences.cpp \ preferences.cpp \
timer.cpp \ timer.cpp \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* interface.cpp : wxWindows plugin for vlc * interface.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: interface.cpp,v 1.60 2003/09/07 22:53:09 fenrir Exp $ * $Id: interface.cpp,v 1.61 2003/10/06 16:23:30 zorglub Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -125,6 +125,7 @@ enum ...@@ -125,6 +125,7 @@ enum
FileInfo_Event, FileInfo_Event,
Prefs_Event, Prefs_Event,
Extra_Event,
SliderScroll_Event, SliderScroll_Event,
StopStream_Event, StopStream_Event,
...@@ -134,6 +135,13 @@ enum ...@@ -134,6 +135,13 @@ enum
SlowStream_Event, SlowStream_Event,
FastStream_Event, FastStream_Event,
Adjust_Event,
Hue_Event,
Contrast_Event,
Brightness_Event,
Saturation_Event,
Ratio_Event,
/* it is important for the id corresponding to the "About" command to have /* it is important for the id corresponding to the "About" command to have
* this standard value as otherwise it won't be handled properly under Mac * this standard value as otherwise it won't be handled properly under Mac
* (where it is special and put into the "Apple" menu) */ * (where it is special and put into the "Apple" menu) */
...@@ -152,6 +160,11 @@ BEGIN_EVENT_TABLE(Interface, wxFrame) ...@@ -152,6 +160,11 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
EVT_MENU_OPEN(Interface::OnMenuOpen) EVT_MENU_OPEN(Interface::OnMenuOpen)
EVT_MENU( Extra_Event, Interface::OnExtra)
EVT_CHECKBOX( Adjust_Event, Interface::OnEnableAdjust)
EVT_COMBOBOX( Ratio_Event, Interface::OnRatio)
#if defined( __WXMSW__ ) || defined( __WXMAC__ ) #if defined( __WXMSW__ ) || defined( __WXMAC__ )
EVT_CONTEXT_MENU(Interface::OnContextMenu2) EVT_CONTEXT_MENU(Interface::OnContextMenu2)
#endif #endif
...@@ -173,6 +186,11 @@ BEGIN_EVENT_TABLE(Interface, wxFrame) ...@@ -173,6 +186,11 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
/* Slider events */ /* Slider events */
EVT_COMMAND_SCROLL(SliderScroll_Event, Interface::OnSliderUpdate) EVT_COMMAND_SCROLL(SliderScroll_Event, Interface::OnSliderUpdate)
EVT_COMMAND_SCROLL(Hue_Event, Interface::OnHueUpdate)
EVT_COMMAND_SCROLL(Contrast_Event, Interface::OnContrastUpdate)
EVT_COMMAND_SCROLL(Brightness_Event, Interface::OnBrightnessUpdate)
EVT_COMMAND_SCROLL(Saturation_Event, Interface::OnSaturationUpdate)
END_EVENT_TABLE() END_EVENT_TABLE()
/***************************************************************************** /*****************************************************************************
...@@ -185,12 +203,14 @@ Interface::Interface( intf_thread_t *_p_intf ): ...@@ -185,12 +203,14 @@ Interface::Interface( intf_thread_t *_p_intf ):
/* Initializations */ /* Initializations */
p_intf = _p_intf; p_intf = _p_intf;
i_old_playing_status = PAUSE_S; i_old_playing_status = PAUSE_S;
b_extra = VLC_FALSE;
/* Give our interface a nice little icon */ /* Give our interface a nice little icon */
SetIcon( wxIcon( vlc_xpm ) ); SetIcon( wxIcon( vlc_xpm ) );
/* Create a sizer for the main frame */ /* Create a sizer for the main frame */
frame_sizer = new wxBoxSizer( wxHORIZONTAL ); //frame_sizer= new wxFlexGridSizer( 1, 0, 0);
frame_sizer = new wxBoxSizer( wxVERTICAL );
SetSizer( frame_sizer ); SetSizer( frame_sizer );
/* Create a dummy widget that can get the keyboard focus */ /* Create a dummy widget that can get the keyboard focus */
...@@ -207,9 +227,14 @@ Interface::Interface( intf_thread_t *_p_intf ): ...@@ -207,9 +227,14 @@ Interface::Interface( intf_thread_t *_p_intf ):
/* Creation of the slider sub-window */ /* Creation of the slider sub-window */
CreateOurSlider(); CreateOurSlider();
frame_sizer->Add( slider_frame, 1, wxGROW, 0 ); frame_sizer->Add( slider_frame, 0, wxEXPAND , 0 );
frame_sizer->Hide( slider_frame ); frame_sizer->Hide( slider_frame );
/* Create the extra panel */
CreateOurExtraPanel();
frame_sizer->Add( extra_frame, 0, wxEXPAND , 0 );
frame_sizer->Hide( extra_frame );
/* Creation of the status bar /* Creation of the status bar
* Helptext for menu items and toolbar tools will automatically get * Helptext for menu items and toolbar tools will automatically get
* displayed here. */ * displayed here. */
...@@ -260,6 +285,7 @@ void Interface::CreateOurMenuBar() ...@@ -260,6 +285,7 @@ void Interface::CreateOurMenuBar()
#define HELP_FILEINFO N_("Show information about the file being played") #define HELP_FILEINFO N_("Show information about the file being played")
#define HELP_PREFS N_("Go to the preferences menu") #define HELP_PREFS N_("Go to the preferences menu")
#define EXTRA_PREFS N_("Open the extended GUI")
#define HELP_ABOUT N_("About this program") #define HELP_ABOUT N_("About this program")
...@@ -297,6 +323,9 @@ void Interface::CreateOurMenuBar() ...@@ -297,6 +323,9 @@ void Interface::CreateOurMenuBar()
wxMenu *settings_menu = new wxMenu; wxMenu *settings_menu = new wxMenu;
settings_menu->Append( Prefs_Event, wxU(_("&Preferences...")), settings_menu->Append( Prefs_Event, wxU(_("&Preferences...")),
wxU(_(HELP_PREFS)) ); wxU(_(HELP_PREFS)) );
settings_menu->Append( Extra_Event, wxU(_("&Extra GUI") ),
wxU(_(EXTRA_PREFS)) );
/* Create the "Audio" menu */ /* Create the "Audio" menu */
p_audio_menu = new wxMenu; p_audio_menu = new wxMenu;
...@@ -388,6 +417,7 @@ void Interface::CreateOurToolBar() ...@@ -388,6 +417,7 @@ void Interface::CreateOurToolBar()
* toolbar and set this as the minimum for the main frame size. */ * toolbar and set this as the minimum for the main frame size. */
wxBoxSizer *toolbar_sizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *toolbar_sizer = new wxBoxSizer( wxHORIZONTAL );
toolbar_sizer->Add( toolbar, 0, 0, 0 ); toolbar_sizer->Add( toolbar, 0, 0, 0 );
toolbar_sizer->Layout(); toolbar_sizer->Layout();
#ifndef WIN32 #ifndef WIN32
...@@ -438,6 +468,142 @@ void Interface::CreateOurSlider() ...@@ -438,6 +468,142 @@ void Interface::CreateOurSlider()
slider_frame->Hide(); slider_frame->Hide();
} }
void Interface::CreateOurExtraPanel()
{
char *psz_filters;
extra_frame = new wxPanel( this, -1, wxDefaultPosition, wxDefaultSize );
extra_frame->SetAutoLayout( TRUE );
wxBoxSizer *extra_sizer = new wxBoxSizer( wxHORIZONTAL );
/* Create static box to surround the adjust controls */
adjust_box = new wxStaticBox( extra_frame, -1,
wxT(_("Image adjust")) );
/* Create the size for the frame */
wxStaticBoxSizer *adjust_sizer =
new wxStaticBoxSizer( adjust_box, wxVERTICAL );
adjust_sizer->SetMinSize( -1, 50 );
/* Create every controls */
/* Create the adjust button */
wxCheckBox * adjust_check = new wxCheckBox( extra_frame, Adjust_Event,
wxU(_("Enable")));
wxBoxSizer *hue_sizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticText *hue_text = new wxStaticText( extra_frame, -1,
wxU(_("Hue")) );
hue_slider = new wxSlider ( extra_frame, Hue_Event, 0, 0,
360, wxDefaultPosition, wxDefaultSize );
hue_sizer->Add(hue_text,1, 0 ,0);
hue_sizer->Add(hue_slider,1, 0 ,0);
hue_sizer->Layout();
wxBoxSizer *contrast_sizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticText *contrast_text = new wxStaticText( extra_frame, -1,
wxU(_("Contrast")) );
contrast_slider = new wxSlider ( extra_frame, Contrast_Event, 0, 0,
200, wxDefaultPosition, wxDefaultSize);
contrast_sizer->Add(contrast_text,1, 0 ,0);
contrast_sizer->Add(contrast_slider,1, 0 ,0);
contrast_sizer->Layout();
wxBoxSizer *brightness_sizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticText *brightness_text = new wxStaticText( extra_frame, -1,
wxU(_("Brightness")) );
brightness_slider = new wxSlider ( extra_frame, Brightness_Event, 0, 0,
200, wxDefaultPosition, wxDefaultSize) ;
brightness_sizer->Add(brightness_text,1,0,0);
brightness_sizer->Add(brightness_slider,1,0,0);
brightness_sizer->Layout();
wxBoxSizer *saturation_sizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticText *saturation_text = new wxStaticText( extra_frame, -1,
wxU(_("Saturation")) );
saturation_slider = new wxSlider ( extra_frame, Saturation_Event, 0, 0,
300, wxDefaultPosition, wxDefaultSize );
saturation_sizer->Add(saturation_text,1,0,0);
saturation_sizer->Add(saturation_slider,1,0,0);
saturation_sizer->Layout();
adjust_sizer->Add(adjust_check, 1, wxEXPAND, 0);
adjust_sizer->Add(hue_sizer, 1, wxEXPAND, 0);
adjust_sizer->Add(contrast_sizer, 1, wxEXPAND, 0);
adjust_sizer->Add(brightness_sizer, 1, wxEXPAND, 0);
adjust_sizer->Add(saturation_sizer, 1, wxEXPAND, 0);
extra_sizer->Add(adjust_sizer,1,wxBOTTOM,5);
/* Create static box to surround the other controls */
other_box = new wxStaticBox( extra_frame, -1,
wxT(_("Video Options")) );
/* Create the sizer for the frame */
wxStaticBoxSizer *other_sizer =
new wxStaticBoxSizer( other_box, wxVERTICAL );
other_sizer->SetMinSize( -1, 50 );
static const wxString ratio_array[] =
{
wxT("4:3"),
wxT("16:9"),
};
wxBoxSizer *ratio_sizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticText *ratio_text = new wxStaticText( extra_frame, -1,
wxU(_("Ratio")) );
ratio_combo = new wxComboBox( extra_frame, Ratio_Event, wxT(""),
wxDefaultPosition, wxSize(120,-1),
WXSIZEOF(ratio_array), ratio_array,
0 );
ratio_sizer->Add( ratio_text, 0, wxALL, 2 );
ratio_sizer->Add( ratio_combo, 0, wxALL, 2 );
ratio_sizer->Layout();
other_sizer->Add(ratio_sizer,0,wxALL,0 );
extra_sizer->Add(other_sizer,0,wxBOTTOM,5);
extra_frame->SetSizer( extra_sizer );
/* Layout the whole panel */
extra_sizer->Layout();
extra_sizer->SetSizeHints(extra_frame);
/* Write down initial values */
psz_filters = config_GetPsz( p_intf, "filter" );
if(psz_filters == NULL) psz_filters=strdup("");
if( strstr(psz_filters,"adjust") )
{
adjust_check->SetValue( 1 );
saturation_slider->Enable();
contrast_slider->Enable();
brightness_slider->Enable();
hue_slider->Enable();
}
else
{
adjust_check->SetValue( 0 );
saturation_slider->Disable();
contrast_slider->Disable();
brightness_slider->Disable();
hue_slider->Disable();
}
extra_frame->Hide();
free(psz_filters);
}
void Interface::UpdateAcceleratorTable() void Interface::UpdateAcceleratorTable()
{ {
/* Set some hotkeys */ /* Set some hotkeys */
...@@ -475,6 +641,8 @@ void Interface::UpdateAcceleratorTable() ...@@ -475,6 +641,8 @@ void Interface::UpdateAcceleratorTable()
} }
/***************************************************************************** /*****************************************************************************
* Event Handlers. * Event Handlers.
*****************************************************************************/ *****************************************************************************/
...@@ -659,6 +827,108 @@ void Interface::OnShowDialog( wxCommandEvent& event ) ...@@ -659,6 +827,108 @@ void Interface::OnShowDialog( wxCommandEvent& event )
} }
} }
void Interface::OnExtra(wxCommandEvent& event)
{
if( b_extra == VLC_FALSE)
{
extra_frame->Show();
frame_sizer->Show( extra_frame );
b_extra = VLC_TRUE;
}
else
{
extra_frame->Hide();
frame_sizer->Hide( extra_frame );
b_extra = VLC_FALSE;
}
frame_sizer->Layout();
frame_sizer->Fit(this);
}
void Interface::OnEnableAdjust(wxCommandEvent& event)
{
char *psz_filters=config_GetPsz( p_intf, "filter");
char *psz_new = NULL;
if( event.IsChecked() )
{
if(psz_filters == NULL)
{
psz_new = strdup( "adjust" );
}
else
{
psz_new= (char *) malloc(strlen(psz_filters) + 8 );
sprintf( psz_new, "%s:adjust", psz_filters);
}
config_PutPsz( p_intf, "filter", psz_new );
brightness_slider->Enable();
saturation_slider->Enable();
contrast_slider->Enable();
hue_slider->Enable();
}
else
{
if( psz_filters != NULL )
{
char *psz_current;
unsigned int i=0;
for( i = 0; i< strlen(psz_filters ); i++)
{
if ( !strncasecmp( &psz_filters[i],"adjust",6 ))
{
if(i > 0)
if( psz_filters[i-1] == ':' ) i--;
psz_current = strchr( &psz_filters[i+1] , ':' );
if( !psz_current )
psz_filters[i] = '\0';
else
{
memmove( &psz_filters[i] , psz_current,
&psz_filters[strlen(psz_filters)]-psz_current
+1);
}
}
}
config_PutPsz( p_intf, "filter", psz_filters);
}
brightness_slider->Disable();
saturation_slider->Disable();
contrast_slider->Disable();
hue_slider->Disable();
}
if(psz_filters) free(psz_filters);
if(psz_new) free(psz_new);
}
void Interface::OnHueUpdate( wxScrollEvent& event)
{
config_PutInt( p_intf , "hue" , event.GetPosition() );
}
void Interface::OnSaturationUpdate( wxScrollEvent& event)
{
config_PutFloat( p_intf , "saturation" , (float)event.GetPosition()/300 );
}
void Interface::OnBrightnessUpdate( wxScrollEvent& event)
{
config_PutFloat( p_intf , "brightness", (float)event.GetPosition()/200 );
}
void Interface::OnContrastUpdate(wxScrollEvent& event)
{
config_PutFloat( p_intf , "contrast" , (float)event.GetPosition()/200 );
}
void Interface::OnRatio( wxCommandEvent& event )
{
config_PutPsz( p_intf, "aspect-ratio", ratio_combo->GetValue() );
}
void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) ) void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
{ {
wxCommandEvent dummy; wxCommandEvent dummy;
...@@ -667,7 +937,7 @@ void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) ) ...@@ -667,7 +937,7 @@ void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_playlist == NULL ) return; if( p_playlist == NULL ) return;
if( p_playlist->i_size ) if( p_playlist->i_size && p_playlist->i_enabled )
{ {
vlc_value_t state; vlc_value_t state;
......
/*****************************************************************************
* iteminfo.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: iteminfo.cpp,v 1.1 2003/10/06 16:23:30 zorglub Exp $
*
* Authors: Clment Stenac <zorglub@videolan.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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <errno.h> /* ENOMEM */
#include <string.h> /* strerror() */
#include <stdio.h>
#include <vlc/vlc.h>
#ifdef WIN32 /* mingw32 hack */
#undef Yield
#undef CreateDialog
#endif
/* Let vlc take care of the i18n stuff */
#define WXINTL_NO_GETTEXT_MACRO
#include <wx/wxprec.h>
#include <wx/wx.h>
#include <wx/notebook.h>
#include <wx/textctrl.h>
#include <wx/combobox.h>
#include <wx/spinctrl.h>
#include <wx/statline.h>
#include <vlc/intf.h>
#include "wxwindows.h"
#ifndef wxRB_SINGLE
# define wxRB_SINGLE 0
#endif
/*****************************************************************************
* Event Table.
*****************************************************************************/
/* IDs for the controls and the menu commands */
enum
{
Uri_Event,
Name_Event,
Author_Event,
Enabled_Event,
};
BEGIN_EVENT_TABLE(ItemInfoDialog, wxDialog)
/* Button events */
EVT_BUTTON(wxID_OK, ItemInfoDialog::OnOk)
EVT_BUTTON(wxID_CANCEL, ItemInfoDialog::OnCancel)
/* Events generated by the panels */
END_EVENT_TABLE()
/*****************************************************************************
* Constructor.
*****************************************************************************/
ItemInfoDialog::ItemInfoDialog( intf_thread_t *_p_intf,
playlist_item_t *_p_item,
wxWindow* _p_parent ):
wxDialog( _p_parent, -1, wxU(_("Playlist Item options")),
wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE )
{
/* Initializations */
p_intf = _p_intf;
p_parent = _p_parent;
p_item = _p_item;
SetIcon( *p_intf->p_sys->p_icon );
/* Create a panel to put everything in */
wxPanel *panel = new wxPanel( this, -1 );
panel->SetAutoLayout( TRUE );
/* Create the standard info panel */
wxPanel *info_panel = InfoPanel( panel );
/* Create the group panel */
wxPanel *group_panel = GroupPanel( panel );
/* Separation */
wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK );
/* Create the buttons */
wxButton *ok_button = new wxButton( panel, wxID_OK, wxU(_("OK")) );
ok_button->SetDefault();
wxButton *cancel_button = new wxButton( panel, wxID_CANCEL,
wxU(_("Cancel")) );
/* Place everything in sizers */
wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
button_sizer->Add( ok_button, 0, wxALL, 5 );
button_sizer->Add( cancel_button, 0, wxALL, 5 );
button_sizer->Layout();
wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
panel_sizer->Add( info_panel, 0, wxEXPAND | wxALL, 5 );
panel_sizer->Add( group_panel, 0, wxEXPAND | wxALL, 5 );
panel_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 );
panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT | wxALIGN_BOTTOM |
wxALL, 5 );
panel_sizer->Layout();
panel->SetSizerAndFit( panel_sizer );
main_sizer->Add( panel, 1, wxGROW, 0 );
main_sizer->Layout();
SetSizerAndFit( main_sizer );
}
ItemInfoDialog::~ItemInfoDialog()
{
}
/*****************************************************************************
* Private methods.
*****************************************************************************/
wxPanel *ItemInfoDialog::InfoPanel( wxWindow* parent )
{
wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
wxDefaultSize );
wxStaticBox *panel_box = new wxStaticBox( panel, -1,
wxU(_("Item informations")) );
wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
wxVERTICAL );
info_subpanel = new wxPanel( panel, -1 );
wxFlexGridSizer *subpanel_sizer =
new wxFlexGridSizer( 3, 1 , 0 , 0 );
/* URI Textbox */
wxStaticText *uri_label =
new wxStaticText(info_subpanel, -1, wxU(_("URI")) );
uri_text = new wxTextCtrl( info_subpanel, Uri_Event,
wxT(p_item->psz_uri),
wxDefaultPosition, wxSize( 300, -1 ),
wxTE_PROCESS_ENTER);
subpanel_sizer->Add( uri_label, 0, wxALIGN_LEFT |
wxALIGN_CENTER_VERTICAL );
subpanel_sizer->Add( uri_text, 0, wxALIGN_RIGHT |
wxALIGN_CENTER_VERTICAL );
/* Name Textbox */
wxStaticText *name_label =
new wxStaticText(info_subpanel, -1, wxU(_("Name")) );
name_text =
new wxTextCtrl( info_subpanel, Uri_Event,
wxT(p_item->psz_name),
wxDefaultPosition, wxSize( 300, -1 ),
wxTE_PROCESS_ENTER);
subpanel_sizer->Add( name_label, 0, wxALIGN_LEFT |
wxALIGN_CENTER_VERTICAL );
subpanel_sizer->Add( name_text, 0, wxALIGN_RIGHT |
wxALIGN_CENTER_VERTICAL );
/* Author Textbox */
wxStaticText *author_label =
new wxStaticText(info_subpanel, -1, wxU(_("Author")) );
author_text =
new wxTextCtrl( info_subpanel, Uri_Event,
wxT(p_item->psz_author),
wxDefaultPosition, wxSize( 300, -1 ),
wxTE_PROCESS_ENTER);
subpanel_sizer->Add( author_label, 0, wxALIGN_LEFT |
wxALIGN_CENTER_VERTICAL );
subpanel_sizer->Add( author_text, 0, wxALIGN_RIGHT |
wxALIGN_CENTER_VERTICAL );
info_subpanel->SetSizerAndFit( subpanel_sizer );
/* Stuff everything into the main panel */
panel_sizer->Add( info_subpanel, 1,
wxEXPAND | wxALIGN_LEFT |
wxALIGN_CENTER_VERTICAL | wxALL, 5 );
panel->SetSizerAndFit( panel_sizer );
return panel;
}
wxPanel *ItemInfoDialog::GroupPanel( wxWindow* parent )
{
wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
wxDefaultSize );
wxStaticBox *panel_box = new wxStaticBox( panel, -1,
wxU(_("Group Info")) );
wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
wxVERTICAL);
wxBoxSizer *subpanel_sizer;
group_subpanel = new wxPanel( panel, -1 );
subpanel_sizer = new wxBoxSizer( wxVERTICAL) ;
enabled_checkbox = new wxCheckBox( group_subpanel,
-1,
wxU(_("Item enabled")) );
enabled_checkbox->SetValue( p_item->b_enabled);
wxStaticText *group_label = new wxStaticText( group_subpanel,
-1, wxU(_("Group")) );
group_spin = new wxSpinCtrl( group_subpanel,
-1 );
group_spin->SetValue( p_item->i_group > 0 ? p_item->i_group : 0);
subpanel_sizer->Add( enabled_checkbox, 0, wxALIGN_RIGHT|
wxALIGN_CENTER_VERTICAL );
subpanel_sizer->Add( group_label, 0, wxALIGN_LEFT |
wxALIGN_CENTER_VERTICAL );
subpanel_sizer->Add( group_spin, 0, wxALIGN_RIGHT );
group_subpanel->SetSizerAndFit( subpanel_sizer );
/* Stuff everything into the main panel */
panel_sizer->Add( group_subpanel, 0,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
panel->SetSizerAndFit( panel_sizer );
/* Update panel */
return panel;
}
/*****************************************************************************
* Events methods.
*****************************************************************************/
void ItemInfoDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
{
p_item->psz_name = strdup( name_text->GetLineText(0) );
p_item->psz_uri = strdup( uri_text->GetLineText(0) );
p_item->psz_author = strdup( author_text->GetLineText(0) );
vlc_bool_t b_old_enabled = p_item->b_enabled;
playlist_t * p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist != NULL )
{
if( b_old_enabled == VLC_FALSE && enabled_checkbox->IsChecked() )
p_playlist->i_enabled ++;
else if( b_old_enabled == VLC_TRUE && !enabled_checkbox->IsChecked() )
p_playlist->i_enabled --;
vlc_object_release( p_playlist );
}
p_item->b_enabled = enabled_checkbox->IsChecked() ? VLC_TRUE : VLC_FALSE ;
p_item->i_group = group_spin->GetValue();
EndModal( wxID_OK );
}
void ItemInfoDialog::OnCancel( wxCommandEvent& WXUNUSED(event) )
{
EndModal( wxID_CANCEL );
}
/******************************************************************************
* Info panel event methods.
******************************************************************************/
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.cpp : wxWindows plugin for vlc * playlist.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: playlist.cpp,v 1.21 2003/09/22 14:40:10 zorglub Exp $ * $Id: playlist.cpp,v 1.22 2003/10/06 16:23:30 zorglub Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* *
...@@ -55,6 +55,9 @@ enum ...@@ -55,6 +55,9 @@ enum
Open_Event, Open_Event,
Save_Event, Save_Event,
EnableSelection_Event,
DisableSelection_Event,
InvertSelection_Event, InvertSelection_Event,
DeleteSelection_Event, DeleteSelection_Event,
Random_Event, Random_Event,
...@@ -62,6 +65,10 @@ enum ...@@ -62,6 +65,10 @@ enum
Repeat_Event, Repeat_Event,
SelectAll_Event, SelectAll_Event,
En_Dis_Event,
Infos_Event,
SearchText_Event, SearchText_Event,
Search_Event, Search_Event,
...@@ -78,9 +85,12 @@ BEGIN_EVENT_TABLE(Playlist, wxFrame) ...@@ -78,9 +85,12 @@ BEGIN_EVENT_TABLE(Playlist, wxFrame)
EVT_MENU(Close_Event, Playlist::OnClose) EVT_MENU(Close_Event, Playlist::OnClose)
EVT_MENU(Open_Event, Playlist::OnOpen) EVT_MENU(Open_Event, Playlist::OnOpen)
EVT_MENU(Save_Event, Playlist::OnSave) EVT_MENU(Save_Event, Playlist::OnSave)
EVT_MENU(EnableSelection_Event, Playlist::OnEnableSelection)
EVT_MENU(DisableSelection_Event, Playlist::OnDisableSelection)
EVT_MENU(InvertSelection_Event, Playlist::OnInvertSelection) EVT_MENU(InvertSelection_Event, Playlist::OnInvertSelection)
EVT_MENU(DeleteSelection_Event, Playlist::OnDeleteSelection) EVT_MENU(DeleteSelection_Event, Playlist::OnDeleteSelection)
EVT_MENU(SelectAll_Event, Playlist::OnSelectAll) EVT_MENU(SelectAll_Event, Playlist::OnSelectAll)
EVT_MENU(Infos_Event, Playlist::OnInfos)
EVT_CHECKBOX(Random_Event, Playlist::OnRandom) EVT_CHECKBOX(Random_Event, Playlist::OnRandom)
EVT_CHECKBOX(Repeat_Event, Playlist::OnRepeat) EVT_CHECKBOX(Repeat_Event, Playlist::OnRepeat)
EVT_CHECKBOX(Loop_Event, Playlist::OnLoop) EVT_CHECKBOX(Loop_Event, Playlist::OnLoop)
...@@ -91,7 +101,9 @@ BEGIN_EVENT_TABLE(Playlist, wxFrame) ...@@ -91,7 +101,9 @@ BEGIN_EVENT_TABLE(Playlist, wxFrame)
/* Button events */ /* Button events */
EVT_BUTTON( Search_Event, Playlist::OnSearch) EVT_BUTTON( Search_Event, Playlist::OnSearch)
EVT_BUTTON( En_Dis_Event, Playlist::OnEnDis)
EVT_BUTTON( Save_Event, Playlist::OnSave) EVT_BUTTON( Save_Event, Playlist::OnSave)
EVT_BUTTON( Infos_Event, Playlist::OnInfos)
EVT_TEXT(SearchText_Event, Playlist::OnSearchTextChange) EVT_TEXT(SearchText_Event, Playlist::OnSearchTextChange)
...@@ -108,6 +120,7 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ): ...@@ -108,6 +120,7 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
wxDefaultSize, wxDEFAULT_FRAME_STYLE ) wxDefaultSize, wxDEFAULT_FRAME_STYLE )
{ {
/* Initializations */ /* Initializations */
iteminfo_dialog = NULL;
p_intf = _p_intf; p_intf = _p_intf;
vlc_value_t val; vlc_value_t val;
i_update_counter = 0; i_update_counter = 0;
...@@ -135,6 +148,9 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ): ...@@ -135,6 +148,9 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
/* Create our "Selection" menu */ /* Create our "Selection" menu */
wxMenu *selection_menu = new wxMenu; wxMenu *selection_menu = new wxMenu;
selection_menu->Append( EnableSelection_Event, wxU(_("&Enable")) );
selection_menu->Append( DisableSelection_Event, wxU(_("&Disable")) );
selection_menu->AppendSeparator();
selection_menu->Append( InvertSelection_Event, wxU(_("&Invert")) ); selection_menu->Append( InvertSelection_Event, wxU(_("&Invert")) );
selection_menu->Append( DeleteSelection_Event, wxU(_("&Delete")) ); selection_menu->Append( DeleteSelection_Event, wxU(_("&Delete")) );
selection_menu->Append( SelectAll_Event, wxU(_("&Select All")) ); selection_menu->Append( SelectAll_Event, wxU(_("&Select All")) );
...@@ -202,26 +218,36 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ): ...@@ -202,26 +218,36 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
search_button = search_button =
new wxButton( playlist_panel, Search_Event, wxU(_("Search")) ); new wxButton( playlist_panel, Search_Event, wxU(_("Search")) );
wxButton *en_dis_button =
new wxButton( playlist_panel, En_Dis_Event, wxU(_("Enable/Disable Group") ) );
wxButton *iteminfo_button =
new wxButton( playlist_panel, Infos_Event, wxU(_("Item Infos") ) );
/* Place everything in sizers */ /* Place everything in sizers */
wxBoxSizer *button_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
button_sizer->Add( random_checkbox, 0, button_sizer->Add( en_dis_button, 0, wxALIGN_CENTER|wxRIGHT, 5);
button_sizer->Add( iteminfo_button, 0, wxALIGN_CENTER|wxLEFT , 5);
button_sizer->Layout();
wxBoxSizer *checkbox_sizer = new wxBoxSizer( wxHORIZONTAL );
checkbox_sizer->Add( random_checkbox, 0,
wxEXPAND|wxALIGN_RIGHT, 5); wxEXPAND|wxALIGN_RIGHT, 5);
button_sizer->Add( loop_checkbox, 0, checkbox_sizer->Add( loop_checkbox, 0,
wxEXPAND|wxALIGN_RIGHT, 5); wxEXPAND|wxALIGN_RIGHT, 5);
button_sizer->Add( repeat_checkbox, 0, checkbox_sizer->Add( repeat_checkbox, 0,
wxEXPAND|wxALIGN_RIGHT, 5); wxEXPAND|wxALIGN_RIGHT, 5);
button_sizer->Layout(); checkbox_sizer->Layout();
wxBoxSizer *search_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *search_sizer = new wxBoxSizer( wxHORIZONTAL );
search_sizer->Add( search_text, 0, wxALL|wxALIGN_CENTER, 5); search_sizer->Add( search_text, 0, wxALL|wxALIGN_CENTER, 5);
search_sizer->Add( search_button, 0, wxALL|wxALIGN_CENTER, 5); search_sizer->Add( search_button, 0, wxALL|wxALIGN_CENTER, 5);
search_sizer->Layout(); search_sizer->Layout();
wxBoxSizer *bottom_sizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *bottom_sizer = new wxBoxSizer( wxVERTICAL );
bottom_sizer->Add( search_sizer , 0, wxALL|wxALIGN_CENTER, 5 ); bottom_sizer->Add( checkbox_sizer, 0, wxALL|wxALIGN_CENTER, 5 );
bottom_sizer->Add( button_sizer , 0, wxALL|wxALIGN_CENTER, 5 ); bottom_sizer->Add( button_sizer , 0, wxALL|wxALIGN_CENTER, 5 );
bottom_sizer->Layout(); bottom_sizer->Layout();
...@@ -231,6 +257,7 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ): ...@@ -231,6 +257,7 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
panel_sizer->Add( listview, 1, wxEXPAND | wxALL, 5 ); panel_sizer->Add( listview, 1, wxEXPAND | wxALL, 5 );
panel_sizer->Add( search_sizer, 0, wxALIGN_CENTRE );
panel_sizer->Add( bottom_sizer, 0 , wxALIGN_CENTRE); panel_sizer->Add( bottom_sizer, 0 , wxALIGN_CENTRE);
panel_sizer->Layout(); panel_sizer->Layout();
...@@ -270,6 +297,8 @@ Playlist::~Playlist() ...@@ -270,6 +297,8 @@ Playlist::~Playlist()
return; return;
} }
delete iteminfo_dialog;
var_DelCallback( p_playlist, "intf-change", PlaylistChanged, this ); var_DelCallback( p_playlist, "intf-change", PlaylistChanged, this );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
} }
...@@ -293,6 +322,13 @@ void Playlist::Rebuild() ...@@ -293,6 +322,13 @@ void Playlist::Rebuild()
{ {
wxString filename = wxU(p_playlist->pp_items[i]->psz_name); wxString filename = wxU(p_playlist->pp_items[i]->psz_name);
listview->InsertItem( i, filename ); listview->InsertItem( i, filename );
if( p_playlist->pp_items[i]->b_enabled == VLC_FALSE )
{
wxListItem listitem;
listitem.m_itemId = i;
listitem.SetTextColour( *wxLIGHT_GREY);
listview->SetItem(listitem);
}
/* FIXME: we should try to find the actual duration... */ /* FIXME: we should try to find the actual duration... */
/* While we don't use it, hide it, it's ugly */ /* While we don't use it, hide it, it's ugly */
#if 0 #if 0
...@@ -307,7 +343,6 @@ void Playlist::Rebuild() ...@@ -307,7 +343,6 @@ void Playlist::Rebuild()
listitem.SetTextColour( *wxRED ); listitem.SetTextColour( *wxRED );
listview->SetItem( listitem ); listview->SetItem( listitem );
// listview->Select( p_playlist->i_index, TRUE );
listview->Focus( p_playlist->i_index ); listview->Focus( p_playlist->i_index );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
...@@ -515,8 +550,8 @@ void Playlist::OnSearch( wxCommandEvent& WXUNUSED(event) ) ...@@ -515,8 +550,8 @@ void Playlist::OnSearch( wxCommandEvent& WXUNUSED(event) )
} }
} }
for ( i_current = i_first + 1; i_current <= listview->GetItemCount() for ( i_current = i_first + 1; i_current <= listview->GetItemCount() ;
; i_current++ ) i_current++ )
{ {
wxListItem listitem; wxListItem listitem;
listitem.SetId( i_current ); listitem.SetId( i_current );
...@@ -562,11 +597,52 @@ void Playlist::OnDeleteSelection( wxCommandEvent& WXUNUSED(event) ) ...@@ -562,11 +597,52 @@ void Playlist::OnDeleteSelection( wxCommandEvent& WXUNUSED(event) )
Rebuild(); Rebuild();
} }
void Playlist::OnEnableSelection( wxCommandEvent& WXUNUSED(event) )
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
for( long item = listview->GetItemCount() - 1; item >= 0; item-- )
{
if( listview->IsSelected( item ) )
{
playlist_Enable( p_playlist, item );
}
}
vlc_object_release( p_playlist);
Rebuild();
}
void Playlist::OnDisableSelection( wxCommandEvent& WXUNUSED(event) )
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
for( long item = listview->GetItemCount() - 1; item >= 0; item-- )
{
if( listview->IsSelected( item ) )
{
playlist_Disable( p_playlist, item );
}
}
vlc_object_release( p_playlist);
Rebuild();
}
void Playlist::OnRandom( wxCommandEvent& event ) void Playlist::OnRandom( wxCommandEvent& event )
{ {
vlc_value_t val; vlc_value_t val;
val.b_bool = event.IsChecked(); val.b_bool = event.IsChecked();
// ? VLC_TRUE : VLC_FALSE ;
playlist_t *p_playlist = playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -581,7 +657,6 @@ void Playlist::OnLoop ( wxCommandEvent& event ) ...@@ -581,7 +657,6 @@ void Playlist::OnLoop ( wxCommandEvent& event )
{ {
vlc_value_t val; vlc_value_t val;
val.b_bool = event.IsChecked(); val.b_bool = event.IsChecked();
// ? VLC_TRUE : VLC_FALSE ;
playlist_t *p_playlist = playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -597,7 +672,6 @@ void Playlist::OnRepeat ( wxCommandEvent& event ) ...@@ -597,7 +672,6 @@ void Playlist::OnRepeat ( wxCommandEvent& event )
{ {
vlc_value_t val; vlc_value_t val;
val.b_bool = event.IsChecked(); val.b_bool = event.IsChecked();
// ? VLC_TRUE : VLC_FALSE ;
playlist_t *p_playlist = playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -626,7 +700,6 @@ void Playlist::OnActivateItem( wxListEvent& event ) ...@@ -626,7 +700,6 @@ void Playlist::OnActivateItem( wxListEvent& event )
{ {
return; return;
} }
playlist_Goto( p_playlist, event.GetIndex() ); playlist_Goto( p_playlist, event.GetIndex() );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
...@@ -642,6 +715,65 @@ void Playlist::OnKeyDown( wxListEvent& event ) ...@@ -642,6 +715,65 @@ void Playlist::OnKeyDown( wxListEvent& event )
} }
} }
void Playlist::OnInfos( wxCommandEvent& WXUNUSED(event) )
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
if( iteminfo_dialog == NULL )
{
/* We use the first selected item, so find it */
long i_item = -1;
i_item = listview->GetNextItem(i_item,
wxLIST_NEXT_ALL,
wxLIST_STATE_SELECTED);
if( i_item >= 0 && i_item < p_playlist->i_size )
{
iteminfo_dialog = new ItemInfoDialog(
p_intf, p_playlist->pp_items[i_item], this );
if( iteminfo_dialog->ShowModal() == wxID_OK )
Rebuild();
delete iteminfo_dialog;
iteminfo_dialog = NULL;
}
}
vlc_object_release( p_playlist );
}
void Playlist::OnEnDis( wxCommandEvent& WXUNUSED(event) )
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
long i_item = -1;
i_item = listview->GetNextItem(i_item,
wxLIST_NEXT_ALL,
wxLIST_STATE_SELECTED);
if( i_item >= 0 && i_item < p_playlist->i_size )
{
if( p_playlist->pp_items[i_item]->b_enabled == VLC_TRUE)
playlist_DisableGroup( p_playlist ,
p_playlist->pp_items[i_item]->i_group );
else
playlist_EnableGroup( p_playlist ,
p_playlist->pp_items[i_item]->i_group );
Rebuild();
}
vlc_object_release( p_playlist );
}
/***************************************************************************** /*****************************************************************************
* PlaylistChanged: callback triggered by the intf-change playlist variable * PlaylistChanged: callback triggered by the intf-change playlist variable
* We don't rebuild the playlist directly here because we don't want the * We don't rebuild the playlist directly here because we don't want the
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxwindows.h: private wxWindows interface description * wxwindows.h: private wxWindows interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: wxwindows.h,v 1.62 2003/09/22 14:40:10 zorglub Exp $ * $Id: wxwindows.h,v 1.63 2003/10/06 16:23:30 zorglub Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -141,19 +141,33 @@ public: ...@@ -141,19 +141,33 @@ public:
virtual ~Interface(); virtual ~Interface();
void TogglePlayButton( int i_playing_status ); void TogglePlayButton( int i_playing_status );
// wxFlexGridSizer *frame_sizer;
wxBoxSizer *frame_sizer; wxBoxSizer *frame_sizer;
wxStatusBar *statusbar; wxStatusBar *statusbar;
wxSlider *slider; wxSlider *slider;
wxWindow *slider_frame; wxWindow *slider_frame;
wxWindow *extra_frame;
wxStaticBox *slider_box; wxStaticBox *slider_box;
vlc_bool_t b_extra;
wxStaticBox *adjust_box;
wxSlider *brightness_slider;
wxSlider *contrast_slider;
wxSlider *saturation_slider;
wxSlider *hue_slider;
wxStaticBox *other_box;
wxComboBox *ratio_combo;
wxGauge *volctrl; wxGauge *volctrl;
private: private:
void UpdateAcceleratorTable(); void UpdateAcceleratorTable();
void CreateOurMenuBar(); void CreateOurMenuBar();
void CreateOurToolBar(); void CreateOurToolBar();
void CreateOurExtraPanel();
void CreateOurSlider(); void CreateOurSlider();
void Open( int i_access_method ); void Open( int i_access_method );
...@@ -167,6 +181,7 @@ private: ...@@ -167,6 +181,7 @@ private:
void OnOpenNet( wxCommandEvent& event ); void OnOpenNet( wxCommandEvent& event );
void OnOpenSat( wxCommandEvent& event ); void OnOpenSat( wxCommandEvent& event );
void OnOpenV4L( wxCommandEvent& event ); void OnOpenV4L( wxCommandEvent& event );
void OnExtra( wxCommandEvent& event );
void OnShowDialog( wxCommandEvent& event ); void OnShowDialog( wxCommandEvent& event );
void OnPlayStream( wxCommandEvent& event ); void OnPlayStream( wxCommandEvent& event );
void OnStopStream( wxCommandEvent& event ); void OnStopStream( wxCommandEvent& event );
...@@ -176,6 +191,14 @@ private: ...@@ -176,6 +191,14 @@ private:
void OnSlowStream( wxCommandEvent& event ); void OnSlowStream( wxCommandEvent& event );
void OnFastStream( wxCommandEvent& event ); void OnFastStream( wxCommandEvent& event );
void OnEnableAdjust( wxCommandEvent& event );
void OnHueUpdate( wxScrollEvent& event );
void OnContrastUpdate( wxScrollEvent& event );
void OnBrightnessUpdate( wxScrollEvent& event );
void OnSaturationUpdate( wxScrollEvent& event );
void OnRatio( wxCommandEvent& event );
void OnMenuOpen( wxMenuEvent& event ); void OnMenuOpen( wxMenuEvent& event );
#if defined( __WXMSW__ ) || defined( __WXMAC__ ) #if defined( __WXMSW__ ) || defined( __WXMAC__ )
...@@ -638,6 +661,7 @@ private: ...@@ -638,6 +661,7 @@ private:
}; };
/* Playlist */ /* Playlist */
class ItemInfoDialog;
class Playlist: public wxFrame class Playlist: public wxFrame
{ {
public: public:
...@@ -661,9 +685,13 @@ private: ...@@ -661,9 +685,13 @@ private:
void OnRSort( wxCommandEvent& event ); void OnRSort( wxCommandEvent& event );
void OnClose( wxCommandEvent& event ); void OnClose( wxCommandEvent& event );
void OnSearch( wxCommandEvent& event ); void OnSearch( wxCommandEvent& event );
void OnEnDis( wxCommandEvent& event );
void OnInfos( wxCommandEvent& event );
void OnSearchTextChange( wxCommandEvent& event ); void OnSearchTextChange( wxCommandEvent& event );
void OnOpen( wxCommandEvent& event ); void OnOpen( wxCommandEvent& event );
void OnSave( wxCommandEvent& event ); void OnSave( wxCommandEvent& event );
void OnEnableSelection( wxCommandEvent& event );
void OnDisableSelection( wxCommandEvent& event );
void OnInvertSelection( wxCommandEvent& event ); void OnInvertSelection( wxCommandEvent& event );
void OnDeleteSelection( wxCommandEvent& event ); void OnDeleteSelection( wxCommandEvent& event );
void OnSelectAll( wxCommandEvent& event ); void OnSelectAll( wxCommandEvent& event );
...@@ -678,11 +706,56 @@ private: ...@@ -678,11 +706,56 @@ private:
wxButton *search_button; wxButton *search_button;
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
ItemInfoDialog *iteminfo_dialog;
intf_thread_t *p_intf; intf_thread_t *p_intf;
wxListView *listview; wxListView *listview;
int i_update_counter; int i_update_counter;
}; };
/* ItemInfo Dialog */
class ItemInfoDialog: public wxDialog
{
public:
/* Constructor */
ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
wxWindow *p_parent );
virtual ~ItemInfoDialog();
wxArrayString GetOptions();
private:
wxPanel *InfoPanel( wxWindow* parent );
wxPanel *GroupPanel( wxWindow* parent );
/* Event handlers (these functions should _not_ be virtual) */
void OnOk( wxCommandEvent& event );
void OnCancel( wxCommandEvent& event );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
playlist_item_t *p_item;
wxWindow *p_parent;
/* Controls for the iteminfo dialog box */
wxPanel *info_subpanel;
wxPanel *info_panel;
wxPanel *group_subpanel;
wxPanel *group_panel;
wxTextCtrl *uri_text;
wxTextCtrl *name_text;
wxTextCtrl *author_text;
wxCheckBox *enabled_checkbox;
wxSpinCtrl *group_spin;
};
/* File Info */ /* File Info */
class FileInfo: public wxFrame class FileInfo: public wxFrame
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* sap.c : SAP interface module * sap.c : SAP interface module
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: sap.c,v 1.23 2003/09/15 08:33:29 zorglub Exp $ * $Id: sap.c,v 1.24 2003/10/06 16:23:30 zorglub Exp $
* *
* Authors: Arnaud Schauly <gitan@via.ecp.fr> * Authors: Arnaud Schauly <gitan@via.ecp.fr>
* Clment Stenac <zorglub@via.ecp.fr> * Clment Stenac <zorglub@via.ecp.fr>
...@@ -160,6 +160,9 @@ struct attr_descr_t ...@@ -160,6 +160,9 @@ struct attr_descr_t
#define SAP_IPV6_LONGTEXT N_("Set this if you want SAP to listen for IPv6 announces") #define SAP_IPV6_LONGTEXT N_("Set this if you want SAP to listen for IPv6 announces")
#define SAP_SCOPE_TEXT N_("IPv6 SAP scope") #define SAP_SCOPE_TEXT N_("IPv6 SAP scope")
#define SAP_SCOPE_LONGTEXT N_("Sets the scope for IPv6 announces (default is 8)") #define SAP_SCOPE_LONGTEXT N_("Sets the scope for IPv6 announces (default is 8)")
#define SAP_GROUP_ID_TEXT N_("SAP Playlist group ID")
#define SAP_GROUP_ID_LONGTEXT N_("Sets the default group ID in which" \
"SAP items are put" )
vlc_module_begin(); vlc_module_begin();
add_category_hint( N_("SAP"), NULL, VLC_TRUE ); add_category_hint( N_("SAP"), NULL, VLC_TRUE );
...@@ -175,6 +178,9 @@ vlc_module_begin(); ...@@ -175,6 +178,9 @@ vlc_module_begin();
add_string( "sap-ipv6-scope", "8" , NULL, add_string( "sap-ipv6-scope", "8" , NULL,
SAP_SCOPE_TEXT, SAP_SCOPE_LONGTEXT, VLC_TRUE); SAP_SCOPE_TEXT, SAP_SCOPE_LONGTEXT, VLC_TRUE);
add_integer( "sap-group-id", 42, NULL,
SAP_GROUP_ID_TEXT, SAP_GROUP_ID_LONGTEXT, VLC_TRUE);
set_description( _("SAP interface") ); set_description( _("SAP interface") );
set_capability( "interface", 0 ); set_capability( "interface", 0 );
set_callbacks( Activate, NULL); set_callbacks( Activate, NULL);
...@@ -463,6 +469,9 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd ) ...@@ -463,6 +469,9 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd )
if( p_item ) if( p_item )
{ {
p_item->i_group = config_GetInt( p_intf, "sap-group-id" );
p_item->b_enabled = VLC_TRUE;
p_item->psz_author = NULL;
p_playlist = vlc_object_find( p_intf, p_playlist = vlc_object_find( p_intf,
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* effects.c : Effects for the visualization system * effects.c : Effects for the visualization system
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: effects.c,v 1.7 2003/09/20 00:37:53 fenrir Exp $ * $Id: effects.c,v 1.8 2003/10/06 16:23:30 zorglub Exp $
* *
* Authors: Clment Stenac <zorglub@via.ecp.fr> * Authors: Clment Stenac <zorglub@via.ecp.fr>
* *
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.c : Playlist management functions * playlist.c : Playlist management functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: playlist.c,v 1.56 2003/09/24 10:21:32 zorglub Exp $ * $Id: playlist.c,v 1.57 2003/10/06 16:23:30 zorglub Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "vlc_playlist.h" #include "vlc_playlist.h"
#define PLAYLIST_FILE_HEADER_0_5 "# vlc playlist file version 0.5" #define PLAYLIST_FILE_HEADER_0_5 "# vlc playlist file version 0.5"
#define PLAYLIST_FILE_HEADER_0_6 "# vlc playlist file version 0.6"
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
...@@ -160,10 +161,13 @@ int playlist_AddExt( playlist_t *p_playlist, const char * psz_uri, ...@@ -160,10 +161,13 @@ int playlist_AddExt( playlist_t *p_playlist, const char * psz_uri,
p_item->psz_name = strdup( psz_name ); p_item->psz_name = strdup( psz_name );
p_item->psz_uri = strdup( psz_uri ); p_item->psz_uri = strdup( psz_uri );
p_item->psz_author = strdup( "" );
p_item->i_duration = i_duration; p_item->i_duration = i_duration;
p_item->i_type = 0; p_item->i_type = 0;
p_item->i_status = 0; p_item->i_status = 0;
p_item->b_autodeletion = VLC_FALSE; p_item->b_autodeletion = VLC_FALSE;
p_item->b_enabled = VLC_TRUE;
p_item->i_group = PLAYLIST_TYPE_MANUAL;
p_item->ppsz_options = NULL; p_item->ppsz_options = NULL;
p_item->i_options = i_options; p_item->i_options = i_options;
...@@ -271,6 +275,7 @@ int playlist_AddItem( playlist_t *p_playlist, playlist_item_t * p_item, ...@@ -271,6 +275,7 @@ int playlist_AddItem( playlist_t *p_playlist, playlist_item_t * p_item,
p_playlist->i_size, p_playlist->i_size,
i_pos, i_pos,
p_item ); p_item );
p_playlist->i_enabled ++;
if( p_playlist->i_index >= i_pos ) if( p_playlist->i_index >= i_pos )
{ {
...@@ -358,6 +363,8 @@ int playlist_Delete( playlist_t * p_playlist, int i_pos ) ...@@ -358,6 +363,8 @@ int playlist_Delete( playlist_t * p_playlist, int i_pos )
REMOVE_ELEM( p_playlist->pp_items, REMOVE_ELEM( p_playlist->pp_items,
p_playlist->i_size, p_playlist->i_size,
i_pos ); i_pos );
if( p_playlist->i_enabled > 0 )
p_playlist->i_enabled--;
} }
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
...@@ -368,6 +375,136 @@ int playlist_Delete( playlist_t * p_playlist, int i_pos ) ...@@ -368,6 +375,136 @@ int playlist_Delete( playlist_t * p_playlist, int i_pos )
return 0; return 0;
} }
/**
* Disables a playlist item
*
* \param p_playlist the playlist to disable from.
* \param i_pos the position of the item to disable
* \return returns 0
*/
int playlist_Disable( playlist_t * p_playlist, int i_pos )
{
vlc_value_t val;
vlc_mutex_lock( &p_playlist->object_lock );
if( i_pos >= 0 && i_pos < p_playlist->i_size )
{
msg_Dbg( p_playlist, "disabling playlist item %s ",
p_playlist->pp_items[i_pos]->psz_name );
if( p_playlist->pp_items[i_pos]->b_enabled == VLC_TRUE )
p_playlist->i_enabled--;
p_playlist->pp_items[i_pos]->b_enabled = VLC_FALSE;
}
vlc_mutex_unlock( &p_playlist->object_lock );
val.b_bool = VLC_TRUE;
var_Set( p_playlist, "intf-change", val );
return 0;
}
/**
* Enables a playlist item
*
* \param p_playlist the playlist to enable from.
* \param i_pos the position of the item to enable
* \return returns 0
*/
int playlist_Enable( playlist_t * p_playlist, int i_pos )
{
vlc_value_t val;
vlc_mutex_lock( &p_playlist->object_lock );
if( i_pos >= 0 && i_pos < p_playlist->i_size )
{
msg_Dbg( p_playlist, "enabling playlist item %s ",
p_playlist->pp_items[i_pos]->psz_name );
if( p_playlist->pp_items[i_pos]->b_enabled == VLC_FALSE )
p_playlist->i_enabled++;
p_playlist->pp_items[i_pos]->b_enabled = VLC_TRUE;
}
vlc_mutex_unlock( &p_playlist->object_lock );
val.b_bool = VLC_TRUE;
var_Set( p_playlist, "intf-change", val );
return 0;
}
/**
* Disables a playlist group
*
* \param p_playlist the playlist to disable from.
* \param i_pos the id of the group to disable
* \return returns 0
*/
int playlist_DisableGroup( playlist_t * p_playlist, int i_group)
{
vlc_value_t val;
vlc_mutex_lock( &p_playlist->object_lock );
int i;
msg_Dbg(p_playlist,"Disabling group %i",i_group);
for( i = 0 ; i< p_playlist->i_size; i++ )
{
if( p_playlist->pp_items[i]->i_group == i_group )
{
msg_Dbg( p_playlist, "disabling playlist item %s ",
p_playlist->pp_items[i]->psz_name );
if( p_playlist->pp_items[i]->b_enabled == VLC_TRUE )
p_playlist->i_enabled--;
p_playlist->pp_items[i]->b_enabled = VLC_FALSE;
}
}
vlc_mutex_unlock( &p_playlist->object_lock );
val.b_bool = VLC_TRUE;
var_Set( p_playlist, "intf-change", val );
return 0;
}
/**
* Enables a playlist group
*
* \param p_playlist the playlist to enable from.
* \param i_pos the id of the group to enable
* \return returns 0
*/
int playlist_EnableGroup( playlist_t * p_playlist, int i_group)
{
vlc_value_t val;
vlc_mutex_lock( &p_playlist->object_lock );
int i;
for( i = 0 ; i< p_playlist->i_size; i++ )
{
if( p_playlist->pp_items[i]->i_group == i_group )
{
msg_Dbg( p_playlist, "enabling playlist item %s ",
p_playlist->pp_items[i]->psz_name );
if( p_playlist->pp_items[i]->b_enabled == VLC_FALSE )
p_playlist->i_enabled++;
p_playlist->pp_items[i]->b_enabled = VLC_TRUE;
}
}
vlc_mutex_unlock( &p_playlist->object_lock );
val.b_bool = VLC_TRUE;
var_Set( p_playlist, "intf-change", val );
return 0;
}
/** /**
* Sort the playlist * Sort the playlist
...@@ -396,6 +533,12 @@ int playlist_Sort( playlist_t * p_playlist , int i_type ) ...@@ -396,6 +533,12 @@ int playlist_Sort( playlist_t * p_playlist , int i_type )
i_small = i; i_small = i;
} }
} }
/* Keep the correct current index */
if( i_small == p_playlist->i_index )
p_playlist->i_index = i_position;
else if( i_position == p_playlist->i_index )
p_playlist->i_index = i_small;
p_temp = p_playlist->pp_items[i_position]; p_temp = p_playlist->pp_items[i_position];
p_playlist->pp_items[i_position] = p_playlist->pp_items[i_small]; p_playlist->pp_items[i_position] = p_playlist->pp_items[i_small];
p_playlist->pp_items[i_small] = p_temp; p_playlist->pp_items[i_small] = p_temp;
...@@ -501,7 +644,7 @@ int playlist_Move( playlist_t * p_playlist, int i_pos, int i_newpos) ...@@ -501,7 +644,7 @@ int playlist_Move( playlist_t * p_playlist, int i_pos, int i_newpos)
case PLAYLIST_PLAY: case PLAYLIST_PLAY:
p_playlist->i_status = PLAYLIST_RUNNING; p_playlist->i_status = PLAYLIST_RUNNING;
if( !p_playlist->p_input ) if( !p_playlist->p_input && p_playlist->i_enabled != 0 )
{ {
PlayItem( p_playlist ); PlayItem( p_playlist );
} }
...@@ -523,6 +666,10 @@ int playlist_Move( playlist_t * p_playlist, int i_pos, int i_newpos) ...@@ -523,6 +666,10 @@ int playlist_Move( playlist_t * p_playlist, int i_pos, int i_newpos)
case PLAYLIST_SKIP: case PLAYLIST_SKIP:
p_playlist->i_status = PLAYLIST_STOPPED; p_playlist->i_status = PLAYLIST_STOPPED;
if( p_playlist->i_enabled == 0)
{
break;
}
SkipItem( p_playlist, i_arg ); SkipItem( p_playlist, i_arg );
if( p_playlist->p_input ) if( p_playlist->p_input )
{ {
...@@ -532,7 +679,8 @@ int playlist_Move( playlist_t * p_playlist, int i_pos, int i_newpos) ...@@ -532,7 +679,8 @@ int playlist_Move( playlist_t * p_playlist, int i_pos, int i_newpos)
break; break;
case PLAYLIST_GOTO: case PLAYLIST_GOTO:
if( i_arg >= 0 && i_arg < p_playlist->i_size ) if( i_arg >= 0 && i_arg < p_playlist->i_size &&
p_playlist->i_enabled != 0 )
{ {
p_playlist->i_index = i_arg; p_playlist->i_index = i_arg;
if( p_playlist->p_input ) if( p_playlist->p_input )
...@@ -784,6 +932,7 @@ static void SkipItem( playlist_t *p_playlist, int i_arg ) ...@@ -784,6 +932,7 @@ static void SkipItem( playlist_t *p_playlist, int i_arg )
vlc_bool_t b_random, b_repeat, b_loop; vlc_bool_t b_random, b_repeat, b_loop;
vlc_value_t val; vlc_value_t val;
msg_Dbg(p_playlist,"%i",p_playlist->i_enabled);
/* If the playlist is empty, there is no current item */ /* If the playlist is empty, there is no current item */
if( p_playlist->i_size == 0 ) if( p_playlist->i_size == 0 )
{ {
...@@ -839,6 +988,12 @@ static void SkipItem( playlist_t *p_playlist, int i_arg ) ...@@ -839,6 +988,12 @@ static void SkipItem( playlist_t *p_playlist, int i_arg )
p_playlist->i_index = p_playlist->i_size - 1; p_playlist->i_index = p_playlist->i_size - 1;
} }
/* Check that the item is enabled */
if( p_playlist->pp_items[p_playlist->i_index]->b_enabled == VLC_FALSE &&
p_playlist->i_enabled != 0)
{
SkipItem( p_playlist , 1 );
}
val.b_bool = VLC_TRUE; val.b_bool = VLC_TRUE;
var_Set( p_playlist, "intf-change", val ); var_Set( p_playlist, "intf-change", val );
} }
...@@ -853,7 +1008,7 @@ static void PlayItem( playlist_t *p_playlist ) ...@@ -853,7 +1008,7 @@ static void PlayItem( playlist_t *p_playlist )
{ {
if( p_playlist->i_index == -1 ) if( p_playlist->i_index == -1 )
{ {
if( p_playlist->i_size == 0 ) if( p_playlist->i_size == 0 || p_playlist->i_enabled == 0)
{ {
return; return;
} }
...@@ -861,6 +1016,11 @@ static void PlayItem( playlist_t *p_playlist ) ...@@ -861,6 +1016,11 @@ static void PlayItem( playlist_t *p_playlist )
SkipItem( p_playlist, 1 ); SkipItem( p_playlist, 1 );
} }
if( p_playlist->i_enabled == 0)
{
return;
}
msg_Dbg( p_playlist, "creating new input thread" ); msg_Dbg( p_playlist, "creating new input thread" );
p_playlist->p_input = input_CreateThread( p_playlist, p_playlist->p_input = input_CreateThread( p_playlist,
p_playlist->pp_items[p_playlist->i_index] ); p_playlist->pp_items[p_playlist->i_index] );
...@@ -884,6 +1044,7 @@ int playlist_LoadFile( playlist_t * p_playlist, const char *psz_filename ) ...@@ -884,6 +1044,7 @@ int playlist_LoadFile( playlist_t * p_playlist, const char *psz_filename )
FILE *file; FILE *file;
char line[1024]; char line[1024];
int i_current_status; int i_current_status;
int i_format;
int i; int i;
msg_Dbg( p_playlist, "opening playlist file %s", psz_filename ); msg_Dbg( p_playlist, "opening playlist file %s", psz_filename );
...@@ -911,7 +1072,15 @@ int playlist_LoadFile( playlist_t * p_playlist, const char *psz_filename ) ...@@ -911,7 +1072,15 @@ int playlist_LoadFile( playlist_t * p_playlist, const char *psz_filename )
if( line[strlen(line)-1] == '\r' ) line[strlen(line)-1] = (char)0; if( line[strlen(line)-1] == '\r' ) line[strlen(line)-1] = (char)0;
} }
/* check the file format is valid */ /* check the file format is valid */
if ( strcmp ( line , PLAYLIST_FILE_HEADER_0_5 ) ) if ( !strcmp ( line , PLAYLIST_FILE_HEADER_0_5 ) )
{
i_format = 5;
}
else if( !strcmp ( line , PLAYLIST_FILE_HEADER_0_6 ) )
{
i_format = 6;
}
else
{ {
msg_Err( p_playlist, "playlist file %s format is unsupported" msg_Err( p_playlist, "playlist file %s format is unsupported"
, psz_filename ); , psz_filename );
...@@ -946,10 +1115,16 @@ int playlist_LoadFile( playlist_t * p_playlist, const char *psz_filename ) ...@@ -946,10 +1115,16 @@ int playlist_LoadFile( playlist_t * p_playlist, const char *psz_filename )
line[strlen(line)-1] = (char)0; line[strlen(line)-1] = (char)0;
if( line[strlen(line)-1] == '\r' ) line[strlen(line)-1] = (char)0; if( line[strlen(line)-1] == '\r' ) line[strlen(line)-1] = (char)0;
} }
if( i_format == 5 )
{
playlist_Add ( p_playlist , (char *)&line , playlist_Add ( p_playlist , (char *)&line ,
0, 0, PLAYLIST_APPEND , PLAYLIST_END ); 0, 0, PLAYLIST_APPEND , PLAYLIST_END );
} }
else
{
msg_Warn( p_playlist, "Not supported yet");
}
}
/* start playing */ /* start playing */
if ( i_current_status != PLAYLIST_STOPPED ) if ( i_current_status != PLAYLIST_STOPPED )
...@@ -981,6 +1156,7 @@ int playlist_SaveFile( playlist_t * p_playlist, const char * psz_filename ) ...@@ -981,6 +1156,7 @@ int playlist_SaveFile( playlist_t * p_playlist, const char * psz_filename )
, psz_filename ); , psz_filename );
return -1; return -1;
} }
/* Save is done in 0_5 mode at the moment*/
fprintf( file , PLAYLIST_FILE_HEADER_0_5 "\n" ); fprintf( file , PLAYLIST_FILE_HEADER_0_5 "\n" );
...@@ -989,7 +1165,24 @@ int playlist_SaveFile( playlist_t * p_playlist, const char * psz_filename ) ...@@ -989,7 +1165,24 @@ int playlist_SaveFile( playlist_t * p_playlist, const char * psz_filename )
fprintf( file , p_playlist->pp_items[i]->psz_uri ); fprintf( file , p_playlist->pp_items[i]->psz_uri );
fprintf( file , "\n" ); fprintf( file , "\n" );
} }
#if 0
fprintf( file, PLAYLIST_FILE_HEADER_0_6 "\n" );
for ( i=0 ; i< p_playlist->i_size ; i++ )
{
fprintf( file, p_playlist->pp_items[i]->psz_uri );
fprintf( file, "||" );
fprintf( file, p_playlist->pp_items[i]->psz_name );
fprintf( file, "||" );
fprintf( file, "%i",p_playlist->pp_items[i]->b_enabled = VLC_TRUE ?
1:0 );
fprintf( file, "||" );
fprintf( file, "%i", p_playlist->pp_items[i]->i_group );
fprintf( file, "||" );
fprintf( file, p_playlist->pp_items[i]->psz_author );
fprintf( file , "\n" );
}
#endif
fclose( file ); fclose( file );
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
......
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