* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+#include "qt4.hpp"
#include "recents.hpp"
#include "dialogs_provider.hpp"
#include "menus.hpp"
+#include "util/qt_dirs.hpp"
#include <QStringList>
#include <QRegExp>
signalMapper = new QSignalMapper( this );
CONNECT( signalMapper,
mapped(const QString & ),
- DialogsProvider::getInstance( p_intf ),
+ this,
playMRL( const QString & ) );
/* Load the filter psz */
RecentsMRL::~RecentsMRL()
{
+ save();
delete filter;
delete stack;
}
if ( !isActive || ( filter && filter->indexIn( mrl ) >= 0 ) )
return;
- msg_Dbg( p_intf, "Adding a new MRL to recent ones: %s", qtu( mrl ) );
-
#ifdef _WIN32
/* Add to the Windows 7 default list in taskbar */
char* path = make_path( qtu( mrl ) );
return p_node_recent;
}
+
+void RecentsMRL::playMRL( const QString &mrl )
+{
+ Open::openMRL( p_intf, mrl );
+}
+
+int Open::openMRL( intf_thread_t *p_intf,
+ const QString &mrl,
+ bool b_start,
+ bool b_playlist)
+{
+ return openMRLwithOptions( p_intf, mrl, NULL, b_start, b_playlist );
+}
+
+int Open::openMRLwithOptions( intf_thread_t* p_intf,
+ const QString &mrl,
+ QStringList *options,
+ bool b_start,
+ bool b_playlist,
+ const char *title)
+{
+ /* Options */
+ const char **ppsz_options = NULL;
+ int i_options = 0;
+
+ if( options != NULL && options->count() > 0 )
+ {
+ ppsz_options = (const char **)malloc( options->count() );
+ if( ppsz_options ) {
+ for( int j = 0; j < options->count(); j++ ) {
+ QString option = colon_unescape( options->at(j) );
+ if( !option.isEmpty() ) {
+ ppsz_options[j] = qtu(option);
+ i_options++;
+ }
+ }
+ }
+ }
+
+ /* Add to playlist */
+ int i_ret = playlist_AddExt( THEPL,
+ qtu(mrl), title,
+ PLAYLIST_APPEND | (b_start ? PLAYLIST_GO : PLAYLIST_PREPARSE),
+ PLAYLIST_END,
+ -1,
+ i_options, ppsz_options, VLC_INPUT_OPTION_TRUSTED,
+ b_playlist,
+ pl_Unlocked );
+
+ /* Add to recent items, only if played */
+ if( i_ret == VLC_SUCCESS && b_start && b_playlist )
+ RecentsMRL::getInstance( p_intf )->addRecent( mrl );
+
+ return i_ret;
+}
+
+