]> git.sesse.net Git - vlc/commitdiff
New recently played menu.
authorLudovic Fauvet <etix@l0cal.com>
Sun, 19 Oct 2008 15:37:53 +0000 (17:37 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Sun, 19 Oct 2008 23:55:25 +0000 (01:55 +0200)
* Configuration aware to enable/disable (default enabled)
 * Filters available to ignore some patterns (using QRegExp)

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
14 files changed:
extras/buildsystem/cmake/CMakeLists/qt4_CMakeLists.txt
modules/gui/qt4/Modules.am
modules/gui/qt4/components/simple_preferences.cpp
modules/gui/qt4/dialogs/open.cpp
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/dialogs_provider.hpp
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.hpp
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.hpp
modules/gui/qt4/qt4.cpp
modules/gui/qt4/recents.cpp [new file with mode: 0644]
modules/gui/qt4/recents.hpp [new file with mode: 0644]
modules/gui/qt4/ui/sprefs_interface.ui

index dc9566f8ab7d1e849c41e77ce1ccaa9b7e6d875e..7ba4019a4b5cd87db76e670e445a0ee69628d7ff 100644 (file)
@@ -1,4 +1,4 @@
-set(qt4_SOURCES qt4.cpp menus.cpp main_interface.cpp dialogs_provider.cpp input_manager.cpp dialogs/playlist.cpp dialogs/bookmarks.cpp dialogs/preferences.cpp dialogs/mediainfo.cpp dialogs/extended.cpp dialogs/messages.cpp dialogs/errors.cpp dialogs/interaction.cpp dialogs/sout.cpp dialogs/help.cpp dialogs/gototime.cpp dialogs/open.cpp dialogs/vlm.cpp dialogs/podcast_configuration.cpp components/extended_panels.cpp components/info_panels.cpp components/preferences_widgets.cpp components/complete_preferences.cpp components/simple_preferences.cpp components/open_panels.cpp components/interface_widgets.cpp components/playlist/playlist_model.cpp components/playlist/playlist_item.cpp components/playlist/standardpanel.cpp components/playlist/playlist.cpp components/playlist/selector.cpp util/input_slider.cpp util/customwidgets.cpp util/registry.cpp )
+set(qt4_SOURCES qt4.cpp menus.cpp main_interface.cpp dialogs_provider.cpp input_manager.cpp recents.cpp dialogs/playlist.cpp dialogs/bookmarks.cpp dialogs/preferences.cpp dialogs/mediainfo.cpp dialogs/extended.cpp dialogs/messages.cpp dialogs/errors.cpp dialogs/interaction.cpp dialogs/sout.cpp dialogs/help.cpp dialogs/gototime.cpp dialogs/open.cpp dialogs/vlm.cpp dialogs/podcast_configuration.cpp components/extended_panels.cpp components/info_panels.cpp components/preferences_widgets.cpp components/complete_preferences.cpp components/simple_preferences.cpp components/open_panels.cpp components/interface_widgets.cpp components/playlist/playlist_model.cpp components/playlist/playlist_item.cpp components/playlist/standardpanel.cpp components/playlist/playlist.cpp components/playlist/selector.cpp util/input_slider.cpp util/customwidgets.cpp util/registry.cpp )
 set(qt4_UIS ui/equalizer.ui ui/v4l2.ui ui/video_effects.ui ui/open_file.ui ui/open_disk.ui 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 ui/sprefs_subtitles.ui ui/sprefs_video.ui ui/streampanel.ui ui/sout.ui ui/vlm.ui ) 
 set(qt4_HEADERS
     components/complete_preferences.hpp
@@ -32,6 +32,7 @@ set(qt4_HEADERS
     main_interface.hpp
     menus.hpp
     qt4.hpp
+    recents.hpp
     util/customwidgets.hpp
     util/input_slider.hpp
     util/qvlcframe.hpp
index a715e40e6b1c680e3fb63df73aa4061d911d7cc7..1f43ac20bf9862f19532fe7972bdc136852356cb 100644 (file)
@@ -17,6 +17,7 @@ nodist_SOURCES_qt4 = \
                menus.moc.cpp \
                dialogs_provider.moc.cpp \
                input_manager.moc.cpp \
+               recents.moc.cpp \
                dialogs/playlist.moc.cpp \
                dialogs/bookmarks.moc.cpp \
                dialogs/mediainfo.moc.cpp \
@@ -171,6 +172,7 @@ SOURCES_qt4 =       qt4.cpp \
                main_interface.cpp \
                dialogs_provider.cpp \
                input_manager.cpp \
+               recents.cpp \
                dialogs/playlist.cpp \
                dialogs/bookmarks.cpp \
                dialogs/preferences.cpp \
@@ -208,6 +210,7 @@ noinst_HEADERS = \
        main_interface.hpp \
        dialogs_provider.hpp \
        input_manager.hpp \
+       recents.hpp \
        dialogs/playlist.hpp \
        dialogs/bookmarks.hpp \
        dialogs/mediainfo.hpp \
index ca1c776d51ba3102b2563b56089f45106a0d0e54..d14342edaf938a2aff13e76dad8fc3cd0d5f6c99 100644 (file)
@@ -38,6 +38,7 @@
 #include <QToolButton>
 #include <QButtonGroup>
 #include <QVBoxLayout>
+#include <QSettings>
 
 #include <QtAlgorithms>
 
@@ -511,6 +512,14 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
 #else
             ui.OneInterfaceBox->hide();
 #endif
+            /* RECENTLY PLAYED options */
+            CONNECT( ui.saveRecentlyPlayed, toggled( bool ),
+                     ui.recentlyPlayedFilters, setEnabled( bool ) );
+            ui.recentlyPlayedFilters->setEnabled( false );
+            CONFIG_GENERIC( "qt-recentplay", Bool, NULL, saveRecentlyPlayed );
+            CONFIG_GENERIC( "qt-recentplay-filter", String, NULL,
+                    recentlyPlayedFilters );
+
         END_SPREFS_CAT;
 
         START_SPREFS_CAT( Subtitles, qtr("Subtitles & On Screen Display Settings") );
index 9e803ef43fddfd85b3b378db5af30802c6bfa329..dbbbfde4e85d46d4d00399acab7ede7d327a3b49 100644 (file)
@@ -28,6 +28,8 @@
 
 #include "dialogs/open.hpp"
 
+#include "recents.hpp"
+
 #include <QTabWidget>
 #include <QGridLayout>
 #include <QRegExp>
@@ -337,6 +339,9 @@ void OpenDialog::finish( bool b_enqueue = false )
                 PLAYLIST_APPEND | ( b_start ? PLAYLIST_GO : PLAYLIST_PREPARSE ),
                 PLAYLIST_END, b_pl ? true : false, pl_Unlocked );
             vlc_gc_decref( p_input );
+
+            /* Do not add the current MRL if playlist_AddInput fail */
+            RecentsMRL::getInstance( p_intf )->addRecent( tempMRL[i] );
         }
     }
     else
index 27dcf6e63baca7af3cd2965f2f4554e1fc334ba4..53970ecf119de31146d5e2b4eeedb9e6faf5c1ac 100644 (file)
@@ -37,6 +37,7 @@
 #include "menus.hpp"
 #include <vlc_intf_strings.h>
 #include "input_manager.hpp"
+#include "recents.hpp"
 
 /* The dialogs */
 #include "dialogs/playlist.hpp"
@@ -389,6 +390,8 @@ void DialogsProvider::addFromSimple( bool pl, bool go)
                          : ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
                       PLAYLIST_END,
                       pl ? true : false, false );
+        RecentsMRL::getInstance( p_intf )->addRecent(
+                toNativeSeparators( file ) );
         i++;
     }
 }
@@ -420,17 +423,17 @@ static void openDirectory( intf_thread_t *p_intf, bool pl, bool go )
 
     if (!dir.isEmpty() )
     {
+        QString mrl = dir.endsWith( "VIDEO_TS", Qt::CaseInsensitive )
+            ? "dvd://" : "directory://" + toNativeSeparators( dir );
         msg_Dbg( p_intf, "Directory opening: %s", qtu( dir ) );
-        input_item_t *p_input = input_item_NewExt( THEPL, qtu(
-                dir.endsWith( "VIDEO_TS", Qt::CaseInsensitive ) ? "dvd://"
-                                                                :"directory://"
-                                          + toNativeSeparators(dir) ),
+        input_item_t *p_input = input_item_NewExt( THEPL, qtu( mrl ),
                               NULL, 0, NULL, -1 );
 
         /* FIXME: playlist_AddInput() can fail */
         playlist_AddInput( THEPL, p_input,
                        go ? ( PLAYLIST_APPEND | PLAYLIST_GO ) : PLAYLIST_APPEND,
                        PLAYLIST_END, pl, pl_Unlocked );
+        RecentsMRL::getInstance( p_intf )->addRecent( mrl );
         if( !go )
             input_Read( THEPL, p_input, true );
         vlc_gc_decref( p_input );
@@ -529,6 +532,7 @@ void DialogsProvider::streamingDialog( QWidget *parent, QString mrl,
         playlist_AddExt( THEPL, qtu( mrl ), "Streaming",
                          PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END,
                         -1, &psz_option, 1, true, pl_Unlocked );
+        RecentsMRL::getInstance( p_intf )->addRecent( mrl );
     }
 }
 
@@ -641,3 +645,17 @@ void DialogsProvider::loadSubtitlesFile()
                       qtu( qsFile ) );
     }
 }
+
+/**
+ * Play the MRL contained in the Recently played menu.
+ **/
+void DialogsProvider::playMRL( const QString &mrl )
+{
+    input_item_t *p_input = input_item_New( p_intf, 
+            qtu( mrl ), NULL );
+    playlist_AddInput( THEPL, p_input, PLAYLIST_GO,
+            PLAYLIST_END, true, pl_Unlocked );
+    vlc_gc_decref( p_input );
+
+    RecentsMRL::getInstance( p_intf )->addRecent( mrl );
+}
index 5a1b6c0f1b78331b92d53258bfbe6873428cc8c0..ff96d5ca3bf960950692071997c18232a783698c 100644 (file)
@@ -133,6 +133,7 @@ public slots:
     void menuAction( QObject *);
     void menuUpdateAction( QObject * );
     void SDMenuAction( QString );
+    void playMRL( const QString & );
 
     void playlistDialog();
     void bookmarksDialog();
index 3ac08fcabbe6e8ae131d989f1690473e099ca577..dd29bc6bdc6c6881a38d30e5363247f5923a6af6 100644 (file)
@@ -39,6 +39,7 @@
 #include "dialogs/extended.hpp"
 #include "dialogs/playlist.hpp"
 #include "menus.hpp"
+#include "recents.hpp"
 
 #include <QMenuBar>
 #include <QCloseEvent>
@@ -132,9 +133,12 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
      * Menu Bar and Status Bar
      **************************/
     QVLCMenu::createMenuBar( this, p_intf, visualSelectorEnabled );
+    
     /* StatusBar Creation */
     createStatusBar();
 
+    /* Recents menu updates */
+    CONNECT( RecentsMRL::getInstance( p_intf ), updated(), this, updateRecentsMenu() ); 
 
     /********************
      * Input Manager    *
@@ -1046,6 +1050,7 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play )
                           PLAYLIST_APPEND | (first ? PLAYLIST_GO: 0),
                           PLAYLIST_END, true, false );
             first = false;
+            RecentsMRL::getInstance( p_intf )->addRecent( s );
         }
      }
      event->acceptProposedAction();
@@ -1178,3 +1183,12 @@ static int IntfShowCB( vlc_object_t *p_this, const char *psz_variable,
     /* Show event */
      return VLC_SUCCESS;
 }
+
+/*****************************************************************************
+ * updateRecentsMenu: event called by RecentsMRL
+ *****************************************************************************/
+
+void MainInterface::updateRecentsMenu()
+{
+    QVLCMenu::updateRecents( p_intf );
+}
index 25b84e25b88be8e8d0e39eabdaea86ae93fde7cc..d1c05003e2b5f6383c062d303c13da7ef6028054 100644 (file)
@@ -175,6 +175,7 @@ private slots:
     void updateSystrayTooltipName( QString );
     void updateSystrayTooltipStatus( int );
     void showSpeedMenu( QPoint );
+    void updateRecentsMenu();
 signals:
     void askReleaseVideo( void * );
     void askVideoToResize( unsigned int, unsigned int );
index a2fc50dda21b72fa1be3ee1a8b4f60941a4a1df5..f89d7e082b5aa9d28b2c471628e0baad2081a448 100644 (file)
@@ -39,6 +39,7 @@
 #include "menus.hpp"
 #include "dialogs_provider.hpp"
 #include "input_manager.hpp"
+#include "recents.hpp"
 
 #include <QMenu>
 #include <QMenuBar>
@@ -46,6 +47,7 @@
 #include <QActionGroup>
 #include <QSignalMapper>
 #include <QSystemTrayIcon>
+#include <QList>
 
 /*
   This file defines the main menus and the pop-up menu (right-click menu)
@@ -76,6 +78,8 @@ static QActionGroup *currentGroup;
  * that doesn't update the QAction checked state when QMenu is hidden */
 QAction *QVLCMenu::minimalViewAction = NULL;
 
+QMenu *QVLCMenu::recentsMenu = NULL;
+
 // Add static entries to menus
 void addDPStaticEntry( QMenu *menu,
                        const QString text,
@@ -273,7 +277,7 @@ void QVLCMenu::createMenuBar( MainInterface *mi,
        gives the QProcess::destroyed timeout issue on Cleanlooks style with
        setDesktopAware set to false */
     QMenuBar *bar = mi->menuBar();
-    BAR_ADD( FileMenu(), qtr( "&Media" ) );
+    BAR_ADD( FileMenu( p_intf ), qtr( "&Media" ) );
 
     BAR_DADD( AudioMenu( p_intf, NULL ), qtr( "&Audio" ), 1 );
     BAR_DADD( VideoMenu( p_intf, NULL ), qtr( "&Video" ), 2 );
@@ -292,7 +296,7 @@ void QVLCMenu::createMenuBar( MainInterface *mi,
  * Media ( File ) Menu
  * Opening, streaming and quit
  **/
-QMenu *QVLCMenu::FileMenu()
+QMenu *QVLCMenu::FileMenu( intf_thread_t *p_intf )
 {
     QMenu *menu = new QMenu();
 
@@ -313,6 +317,9 @@ QMenu *QVLCMenu::FileMenu()
     addDPStaticEntry( menu, qtr( "Open &Capture Device..." ), "",
         ":/capture-card", SLOT( openCaptureDialog() ),
         "Ctrl+C" );
+    recentsMenu = new QMenu( qtr( "Recently played" ), menu );
+    updateRecents( p_intf );
+    menu->addMenu( recentsMenu );
     menu->addSeparator();
 
     addDPStaticEntry( menu, qtr( "Conve&rt / Save..." ), "", "",
@@ -1290,3 +1297,37 @@ void QVLCMenu::DoAction( intf_thread_t *p_intf, QObject *data )
     var_Set( p_object, itemData->psz_var, itemData->val );
 }
 
+void QVLCMenu::updateRecents( intf_thread_t *p_intf )
+{
+    if (recentsMenu)
+    {
+        QAction* action;
+        RecentsMRL* rmrl = RecentsMRL::getInstance( p_intf );
+        QList<QString> l = rmrl->recents();
+
+        recentsMenu->clear();
+        if( !l.size() )
+        {
+            action = recentsMenu->addAction( " - Empty - " );
+            action->setEnabled( false );
+        }
+        else
+        {
+            for( int i = 0; i < l.size(); ++i )
+            {
+                action = recentsMenu->addAction( l.at( i ),
+                        rmrl->signalMapper,
+                        SLOT( map() ) );
+                rmrl->signalMapper->setMapping( action, l.at( i ) );
+            }
+
+            CONNECT( rmrl->signalMapper,
+                     mapped(const QString & ),
+                     DialogsProvider::getInstance( p_intf ),
+                     playMRL( const QString & ) );
+
+            recentsMenu->addSeparator();
+            recentsMenu->addAction( "Clear", rmrl, SLOT( clear() ) );
+        }
+    }
+}
index 177397cb1165ca37b0dab8dc70a31da204e782e6..e9f907640c7030fa8194db493a9b77aac1e3134f 100644 (file)
@@ -76,7 +76,7 @@ public:
     static void createMenuBar( MainInterface *mi, intf_thread_t *, bool );
 
     /* Menus */
-    static QMenu *FileMenu();
+    static QMenu *FileMenu( intf_thread_t * );
     static QMenu *SDMenu( intf_thread_t * );
     static QMenu *PlaylistMenu( intf_thread_t *, MainInterface * );
     static QMenu *ToolsMenu( intf_thread_t *, QMenu *, MainInterface *,
@@ -115,6 +115,9 @@ private:
     static void UpdateItem( intf_thread_t *, QMenu *, const char *,
                             vlc_object_t *, bool );
     static int CreateChoicesMenu( QMenu *,const char *, vlc_object_t *, bool );
+    static QMenu *recentsMenu;
+public slots:
+    static void updateRecents( intf_thread_t * ); 
 };
 
 class MenuFunc : public QObject
index 2340a0d01105067cc8ad9c64806df9b657356de8..fb4fb49fa50c40c7ec8f8c22e04f240db55035d5 100755 (executable)
@@ -39,6 +39,7 @@
 #include "input_manager.hpp"
 #include "main_interface.hpp"
 #include "dialogs/help.hpp" /* update */
+#include "recents.hpp"
 
 #ifdef HAVE_X11_XLIB_H
 #include <X11/Xlib.h>
@@ -123,6 +124,9 @@ static void ShowDialog   ( intf_thread_t *, int, int, intf_dialog_args_t * );
 
 #define PRIVACY_TEXT N_( "Ask for network policy at start" )
 
+#define RECENTPLAY_TEXT N_( "Save the recently played items in the menu" )
+#define RECENTPLAY_FILTER_TEXT N_( "List of words separated by | to filter" )
+
 #define SLIDERCOL_TEXT N_( "Define the colors of the volume slider " )
 #define SLIDERCOL_LONGTEXT N_( "Define the colors of the volume slider\n" \
                        "By specifying the 12 numbers separated by a ';'\n" \
@@ -209,6 +213,10 @@ vlc_module_begin();
 
         add_bool( "qt-privacy-ask", true, NULL, PRIVACY_TEXT, PRIVACY_TEXT,
                 false );
+        add_bool( "qt-recentplay", true, NULL, RECENTPLAY_TEXT,
+                RECENTPLAY_TEXT, false );
+        add_string( "qt-recentplay-filter", NULL, NULL,
+                RECENTPLAY_FILTER_TEXT, RECENTPLAY_FILTER_TEXT, false );
             change_internal();
 
         set_callbacks( OpenDialogs, Close );
@@ -483,6 +491,9 @@ static void *Init( vlc_object_t *obj )
      */
     DialogsProvider::killInstance();
 
+    /* Delete the recentsMRL object before the configuration */
+    RecentsMRL::killInstance();
+
     /* Delete the configuration. Application has to be deleted after that. */
     delete p_intf->p_sys->mainSettings;
 
diff --git a/modules/gui/qt4/recents.cpp b/modules/gui/qt4/recents.cpp
new file mode 100644 (file)
index 0000000..473a081
--- /dev/null
@@ -0,0 +1,115 @@
+/*****************************************************************************
+ * recents.cpp : Recents MRL (menu)
+ *****************************************************************************
+ * Copyright © 2006-2008 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Ludovic Fauvet <etix@l0cal.com>
+ *
+ * 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 "recents.hpp"
+
+#include <QList>
+#include <QString>
+#include <QAction>
+#include <QSettings>
+#include <QRegExp>
+#include <QSignalMapper>
+
+RecentsMRL* RecentsMRL::instance = NULL;
+
+RecentsMRL::RecentsMRL( intf_thread_t *_p_intf ) : p_intf( _p_intf )
+{
+    stack = new QList<QString>;
+    signalMapper = new QSignalMapper(this);
+    
+    isActive = config_GetInt( p_intf, "qt-recentplay" );
+    filter = new QRegExp(
+            qfu( config_GetPsz( p_intf, "qt-recentplay-filter" ) ),
+            Qt::CaseInsensitive );
+
+    load();
+    if ( !isActive ) clear();
+}
+
+RecentsMRL::~RecentsMRL()
+{
+    delete stack;
+    delete signalMapper;
+}
+
+void RecentsMRL::addRecent( const QString &mrl )
+{
+    if ( !isActive || filter->indexIn( mrl ) >= 0 )
+        return;
+    
+    if( stack->contains( mrl ) )
+    {
+        stack->removeOne( mrl );
+        stack->prepend( mrl );
+    }
+    else
+    {
+        stack->prepend( mrl );
+        if( stack->size() > RECENTS_LIST_SIZE )
+            stack->takeLast();
+    }
+    emit updated();
+    save();
+}
+
+void RecentsMRL::clear()
+{
+    if ( stack->isEmpty() )
+        return;
+    stack->clear();
+    emit updated();
+    save();
+}
+
+QList<QString> RecentsMRL::recents()
+{
+    return QList<QString>(*stack);
+}
+
+void RecentsMRL::load()
+{
+    QStringList list;
+    
+    getSettings()->beginGroup( "RecentsMRL" );
+    list = getSettings()->value( "list" ).toStringList();
+    getSettings()->endGroup();
+
+    for( int i = 0; i < list.size(); ++i )
+    {
+        if (filter->indexIn( list.at(i) ) == -1)
+            stack->append( list.at(i) );
+    }
+}
+
+void RecentsMRL::save()
+{
+    QStringList list;
+
+    for( int i = 0; i < stack->size(); ++i )
+        list << stack->at(i);
+
+    getSettings()->beginGroup( "RecentsMRL" );
+    getSettings()->setValue( "list", list );
+    getSettings()->endGroup();
+}
diff --git a/modules/gui/qt4/recents.hpp b/modules/gui/qt4/recents.hpp
new file mode 100644 (file)
index 0000000..29c65d9
--- /dev/null
@@ -0,0 +1,76 @@
+/*****************************************************************************
+ * recents.cpp : Recents MRL (menu)
+ *****************************************************************************
+ * Copyright © 2006-2008 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Ludovic Fauvet <etix@l0cal.com>
+ *
+ * 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 _RECENTS_H_
+#define _RECENTS_H_
+
+#include "qt4.hpp"
+
+#include <QObject>
+#include <QList>
+#include <QString>
+#include <QRegExp>
+#include <QSignalMapper>
+
+#define RECENTS_LIST_SIZE 8
+
+class RecentsMRL : public QObject
+{
+    Q_OBJECT
+
+signals:
+    void updated();
+
+public:
+    static RecentsMRL* getInstance( intf_thread_t* p_intf )
+    {
+        if(!instance)
+            instance = new RecentsMRL( p_intf );
+        return instance;
+    }
+    static void killInstance()
+    {
+        if( instance ) delete instance;
+        instance = NULL;
+    }
+    virtual ~RecentsMRL();
+
+    void addRecent( const QString & );
+    QList<QString> recents(); 
+    QSignalMapper *signalMapper;
+
+private:
+    RecentsMRL( intf_thread_t* _p_intf );
+    void load();
+    void save();
+    static RecentsMRL *instance;
+    intf_thread_t* p_intf;
+    QList<QString> *stack;
+    bool isActive;
+    QRegExp *filter;
+
+public slots:
+    void clear();
+};
+
+#endif
index 3f92d5627a1d9b87ce5528045a0d552864a957f8..8ae62557d800c2ed7dfc672fabba4385108171b7 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>629</width>
-    <height>576</height>
+    <width>654</width>
+    <height>578</height>
    </rect>
   </property>
   <property name="sizePolicy" >
         </property>
        </widget>
       </item>
-      <item row="0" column="1" colspan="2" >
-       <widget class="QComboBox" name="artFetcher" />
-      </item>
       <item row="1" column="0" >
        <widget class="QCheckBox" name="updatesBox" >
         <property name="text" >
         </property>
        </widget>
       </item>
+      <item row="2" column="0" >
+       <widget class="QCheckBox" name="saveRecentlyPlayed" >
+        <property name="text" >
+         <string>_("Save recently played items")</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1" colspan="2" >
+       <widget class="QComboBox" name="artFetcher" />
+      </item>
+      <item row="2" column="1" colspan="2" >
+       <layout class="QHBoxLayout" name="horizontalLayout" >
+        <item>
+         <widget class="QLabel" name="label_2" >
+          <property name="text" >
+           <string>_("Filter")</string>
+          </property>
+          <property name="alignment" >
+           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLineEdit" name="recentlyPlayedFilters" >
+          <property name="sizePolicy" >
+           <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="toolTip" >
+           <string>_("Separate words by | (without space)")</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
      </layout>
     </widget>
    </item>