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()
{
openDialog( 0 );
}
void DialogsProvider::PLAppendDialog()
{
}
void DialogsProvider::MLAppendDialog()
{
}
void DialogsProvider::openDialog( int i_dialog )
{
}
......@@ -171,7 +177,7 @@ void DialogsProvider::menuUpdateAction( QObject *data )
f->doFunc( p_intf );
}
void DialogsProvider::simpleAppendDialog()
void DialogsProvider::simplePLAppendDialog()
{
QStringList files = showSimpleOpen();
QString file;
......@@ -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()
{
QStringList files = showSimpleOpen();
......
......@@ -70,9 +70,12 @@ public slots:
void streaminfoDialog();
void prefsDialog();
void messagesDialog();
void simpleAppendDialog();
void simplePLAppendDialog();
void simpleMLAppendDialog();
void simpleOpenDialog();
void openDialog();
void PLAppendDialog();
void MLAppendDialog();
void openDialog( int );
void popupMenu( int );
void doInteraction( intf_dialog_args_t * );
......
......@@ -156,6 +156,11 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf ) : QObject(NULL),
im, SLOT( setInput( input_thread_t * ) ) );
}
MainInputManager::~MainInputManager()
{
if( p_input ) vlc_object_release( p_input );
}
void MainInputManager::updateInput()
{
vlc_mutex_lock( &p_intf->change_lock );
......
......@@ -62,7 +62,11 @@ public:
instance = new MainInputManager( _p_intf );
return instance;
}
static void killInstance()
{
if( instance ) delete instance;
}
virtual ~MainInputManager();
input_thread_t *getInput() { return p_input; };
InputManager *getIM() { return im; };
......
......@@ -132,9 +132,25 @@ void QVLCMenu::createPlMenuBar( QMenuBar *bar, intf_thread_t *p_intf )
{
QMenu *manageMenu = new QMenu();
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->addMenu( SDMenu( p_intf ) );
bar->addMenu( manageMenu );
......
......@@ -480,9 +480,9 @@ void PLModel::ProcessItemAppend( playlist_add_t *p_add )
if( b_need_update ) return;
PLItem *nodeItem = FindById( rootItem, p_add->i_node );
PL_LOCK;
if( !nodeItem ) goto end;
PL_LOCK;
p_item = playlist_ItemGetById( p_playlist, p_add->i_item );
if( !p_item || p_item->i_flags & PLAYLIST_DBL_FLAG ) goto end;
if( i_depth == 1 && p_item->p_parent &&
......
......@@ -23,6 +23,7 @@
#include <QApplication>
#include "qt4.hpp"
#include "dialogs_provider.hpp"
#include "input_manager.hpp"
#include "main_interface.hpp"
/*****************************************************************************
......@@ -141,6 +142,7 @@ static void Init( intf_thread_t *p_intf )
app->setQuitOnLastWindowClosed( false );
app->exec();
MainInputManager::killInstance();
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