Commit fded9ae5 authored by Clément Stenac's avatar Clément Stenac

Fix a refcount issue

Start using media library
parent 948676af
...@@ -101,6 +101,12 @@ void DialogsProvider::openDialog() ...@@ -101,6 +101,12 @@ void DialogsProvider::openDialog()
{ {
openDialog( 0 ); openDialog( 0 );
} }
void DialogsProvider::PLAppendDialog()
{
}
void DialogsProvider::MLAppendDialog()
{
}
void DialogsProvider::openDialog( int i_dialog ) void DialogsProvider::openDialog( int i_dialog )
{ {
} }
...@@ -129,7 +135,7 @@ void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg ) ...@@ -129,7 +135,7 @@ void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg )
break; break;
case INTERACT_DESTROY: case INTERACT_DESTROY:
qdialog = (InteractionDialog*)(p_dialog->p_private); qdialog = (InteractionDialog*)(p_dialog->p_private);
delete qdialog; delete qdialog;
p_dialog->i_status = DESTROYED_DIALOG; p_dialog->i_status = DESTROYED_DIALOG;
break; break;
} }
...@@ -171,7 +177,7 @@ void DialogsProvider::menuUpdateAction( QObject *data ) ...@@ -171,7 +177,7 @@ void DialogsProvider::menuUpdateAction( QObject *data )
f->doFunc( p_intf ); f->doFunc( p_intf );
} }
void DialogsProvider::simpleAppendDialog() void DialogsProvider::simplePLAppendDialog()
{ {
QStringList files = showSimpleOpen(); QStringList files = showSimpleOpen();
QString file; QString file;
...@@ -183,6 +189,18 @@ void DialogsProvider::simpleAppendDialog() ...@@ -183,6 +189,18 @@ void DialogsProvider::simpleAppendDialog()
} }
} }
void DialogsProvider::simpleMLAppendDialog()
{
QStringList files = showSimpleOpen();
QString file;
foreach( file, files )
{
const char * psz_utf8 = file.toUtf8().data();
playlist_MLAdd( THEPL, psz_utf8, psz_utf8,
PLAYLIST_APPEND | PLAYLIST_PREPARSE, PLAYLIST_END );
}
}
void DialogsProvider::simpleOpenDialog() void DialogsProvider::simpleOpenDialog()
{ {
QStringList files = showSimpleOpen(); QStringList files = showSimpleOpen();
......
...@@ -70,9 +70,12 @@ public slots: ...@@ -70,9 +70,12 @@ public slots:
void streaminfoDialog(); void streaminfoDialog();
void prefsDialog(); void prefsDialog();
void messagesDialog(); void messagesDialog();
void simpleAppendDialog(); void simplePLAppendDialog();
void simpleMLAppendDialog();
void simpleOpenDialog(); void simpleOpenDialog();
void openDialog(); void openDialog();
void PLAppendDialog();
void MLAppendDialog();
void openDialog( int ); void openDialog( int );
void popupMenu( int ); void popupMenu( int );
void doInteraction( intf_dialog_args_t * ); void doInteraction( intf_dialog_args_t * );
......
...@@ -156,6 +156,11 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf ) : QObject(NULL), ...@@ -156,6 +156,11 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf ) : QObject(NULL),
im, SLOT( setInput( input_thread_t * ) ) ); im, SLOT( setInput( input_thread_t * ) ) );
} }
MainInputManager::~MainInputManager()
{
if( p_input ) vlc_object_release( p_input );
}
void MainInputManager::updateInput() void MainInputManager::updateInput()
{ {
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
......
...@@ -62,7 +62,11 @@ public: ...@@ -62,7 +62,11 @@ public:
instance = new MainInputManager( _p_intf ); instance = new MainInputManager( _p_intf );
return instance; return instance;
} }
static void killInstance()
{
if( instance ) delete instance;
}
virtual ~MainInputManager();
input_thread_t *getInput() { return p_input; }; input_thread_t *getInput() { return p_input; };
InputManager *getIM() { return im; }; InputManager *getIM() { return im; };
......
...@@ -132,9 +132,25 @@ void QVLCMenu::createPlMenuBar( QMenuBar *bar, intf_thread_t *p_intf ) ...@@ -132,9 +132,25 @@ void QVLCMenu::createPlMenuBar( QMenuBar *bar, intf_thread_t *p_intf )
{ {
QMenu *manageMenu = new QMenu(); QMenu *manageMenu = new QMenu();
manageMenu->setTitle( qtr("Operations") ); manageMenu->setTitle( qtr("Operations") );
manageMenu->addAction( "Quick &Add File...", THEDP,
SLOT( simpleAppendDialog() ) ); QMenu *subPlaylist = new QMenu();
subPlaylist->setTitle( qtr("Add to current playlist") );
subPlaylist->addAction( "&File...", THEDP,
SLOT( simplePLAppendDialog() ) );
subPlaylist->addAction( "&Advanced add...", THEDP,
SLOT( PLAppendDialog() ) );
manageMenu->addMenu( subPlaylist );
manageMenu->addSeparator();
QMenu *subML = new QMenu();
subML->setTitle( qtr("Add to Media library") );
subML->addAction( "&File...", THEDP,
SLOT( simpleMLAppendDialog() ) );
subML->addAction( "&Advanced add...", THEDP,
SLOT( MLAppendDialog() ) );
manageMenu->addMenu( subML );
manageMenu->addSeparator(); manageMenu->addSeparator();
// manageMenu->addMenu( SDMenu( p_intf ) ); // manageMenu->addMenu( SDMenu( p_intf ) );
bar->addMenu( manageMenu ); bar->addMenu( manageMenu );
......
...@@ -480,9 +480,9 @@ void PLModel::ProcessItemAppend( playlist_add_t *p_add ) ...@@ -480,9 +480,9 @@ void PLModel::ProcessItemAppend( playlist_add_t *p_add )
if( b_need_update ) return; if( b_need_update ) return;
PLItem *nodeItem = FindById( rootItem, p_add->i_node ); PLItem *nodeItem = FindById( rootItem, p_add->i_node );
PL_LOCK;
if( !nodeItem ) goto end; if( !nodeItem ) goto end;
PL_LOCK;
p_item = playlist_ItemGetById( p_playlist, p_add->i_item ); p_item = playlist_ItemGetById( p_playlist, p_add->i_item );
if( !p_item || p_item->i_flags & PLAYLIST_DBL_FLAG ) goto end; if( !p_item || p_item->i_flags & PLAYLIST_DBL_FLAG ) goto end;
if( i_depth == 1 && p_item->p_parent && if( i_depth == 1 && p_item->p_parent &&
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <QApplication> #include <QApplication>
#include "qt4.hpp" #include "qt4.hpp"
#include "dialogs_provider.hpp" #include "dialogs_provider.hpp"
#include "input_manager.hpp"
#include "main_interface.hpp" #include "main_interface.hpp"
/***************************************************************************** /*****************************************************************************
...@@ -141,6 +142,7 @@ static void Init( intf_thread_t *p_intf ) ...@@ -141,6 +142,7 @@ static void Init( intf_thread_t *p_intf )
app->setQuitOnLastWindowClosed( false ); app->setQuitOnLastWindowClosed( false );
app->exec(); app->exec();
MainInputManager::killInstance();
delete p_intf->p_sys->p_mi; delete p_intf->p_sys->p_mi;
} }
......
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