[vlc-commits] qt: remove legacy "recently played" model

Pierre Lamot git at videolan.org
Thu Oct 29 09:08:29 CET 2020


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Wed Oct 14 15:16:45 2020 +0200| [dcf865237f1ed006cb7c15824a80e5f4dcd1d1be] | committer: Pierre Lamot

qt: remove legacy "recently played" model

  Recent medias are now stored in the medialibrary.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dcf865237f1ed006cb7c15824a80e5f4dcd1d1be
---

 modules/gui/qt/Makefile.am                       |   5 -
 modules/gui/qt/dialogs/dialogs_provider.cpp      |  22 +--
 modules/gui/qt/dialogs/open/open.cpp             |  19 +-
 modules/gui/qt/dialogs/toolbar/toolbareditor.cpp |   2 -
 modules/gui/qt/maininterface/main_interface.cpp  |  14 +-
 modules/gui/qt/maininterface/mainui.cpp          |   2 -
 modules/gui/qt/medialibrary/medialib.cpp         |  13 --
 modules/gui/qt/medialibrary/medialib.hpp         |   2 -
 modules/gui/qt/menus/menus.cpp                   |  59 -------
 modules/gui/qt/menus/menus.hpp                   |   6 -
 modules/gui/qt/menus/qml/GlobalShortcuts.qml     |  11 --
 modules/gui/qt/player/player_controller.cpp      |   3 -
 modules/gui/qt/qt.cpp                            |   4 -
 modules/gui/qt/util/recent_media_model.cpp       |  97 -----------
 modules/gui/qt/util/recent_media_model.hpp       |  69 --------
 modules/gui/qt/util/recents.cpp                  | 211 -----------------------
 modules/gui/qt/util/recents.hpp                  |  86 ---------
 po/POTFILES.in                                   |   2 -
 18 files changed, 25 insertions(+), 602 deletions(-)

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index dbe2dc3b83..216aac80c0 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -204,9 +204,6 @@ libqt_plugin_la_SOURCES = \
 	gui/qt/util/qmleventfilter.hpp \
 	gui/qt/util/qt_dirs.cpp gui/qt/util/qt_dirs.hpp \
 	gui/qt/util/qvlcapp.hpp \
-	gui/qt/util/recent_media_model.cpp  \
-	gui/qt/util/recent_media_model.hpp \
-	gui/qt/util/recents.cpp gui/qt/util/recents.hpp \
 	gui/qt/util/registry.cpp gui/qt/util/registry.hpp \
 	gui/qt/util/renderer_manager.cpp gui/qt/util/renderer_manager.hpp \
 	gui/qt/util/selectable_list_model.cpp \
@@ -343,8 +340,6 @@ nodist_libqt_plugin_la_SOURCES = \
 	gui/qt/util/qml_main_context.moc.cpp \
 	gui/qt/util/qmleventfilter.moc.cpp \
 	gui/qt/util/qvlcapp.moc.cpp \
-	gui/qt/util/recent_media_model.moc.cpp \
-	gui/qt/util/recents.moc.cpp \
 	gui/qt/util/renderer_manager.moc.cpp \
 	gui/qt/util/selectable_list_model.moc.cpp \
 	gui/qt/util/sortfilterproxymodel.moc.cpp \
diff --git a/modules/gui/qt/dialogs/dialogs_provider.cpp b/modules/gui/qt/dialogs/dialogs_provider.cpp
index 37975707d1..e71dd88f58 100644
--- a/modules/gui/qt/dialogs/dialogs_provider.cpp
+++ b/modules/gui/qt/dialogs/dialogs_provider.cpp
@@ -32,7 +32,6 @@
 #include "player/player_controller.hpp" /* Load Subtitles */
 #include "playlist/playlist_controller.hpp"
 #include "menus/menus.hpp"
-#include "util/recents.hpp"
 #include "util/qt_dirs.hpp"
 #include "widgets/native/customwidgets.hpp" /* VLCKeyToString() */
 #include "maininterface/main_interface.hpp"
@@ -98,7 +97,6 @@ DialogsProvider::~DialogsProvider()
     delete miscPopupMenu;
 
     /* free parentless menus  */
-    VLCMenuBar::freeRecentsMenu();
     VLCMenuBar::freeRendererMenu();
 }
 
@@ -504,13 +502,12 @@ void DialogsProvider::simpleOpenDialog(bool start)
 {
     QStringList urls = DialogsProvider::showSimpleOpen();
 
-    bool first = start;
     urls.sort();
-    foreach( const QString &url, urls )
-    {
-        Open::openMRL( p_intf, url, first );
-        first = false;
-    }
+    QVector<vlc::playlist::Media> medias;
+    for( const QString& mrl : urls)
+        medias.push_back( vlc::playlist::Media{mrl, nullptr, nullptr} );
+    if (!medias.empty())
+        THEMPL->append(medias, start);
 }
 
 /* Url & Clipboard */
@@ -536,8 +533,8 @@ void DialogsProvider::openUrlDialog()
         url = qfu(uri);
         free( uri );
     }
-
-    Open::openMRL( p_intf, qtu(url), !oud.shouldEnqueue() );
+    QVector<vlc::playlist::Media> medias = { {url, nullptr, nullptr} };
+    THEMPL->append(medias, !oud.shouldEnqueue());
 }
 
 /* Directory */
@@ -550,7 +547,10 @@ static void openDirectory( intf_thread_t *p_intf, bool go )
 {
     QString uri = DialogsProvider::getDirectoryDialog( p_intf );
     if( !uri.isEmpty() )
-        Open::openMRL( p_intf, uri, go );
+    {
+        QVector<vlc::playlist::Media> medias = { {uri, nullptr, nullptr} };
+        THEMPL->append(medias, go);
+    }
 }
 
 QString DialogsProvider::getDirectoryDialog( intf_thread_t *p_intf )
diff --git a/modules/gui/qt/dialogs/open/open.cpp b/modules/gui/qt/dialogs/open/open.cpp
index 0080e892b6..6537621b63 100644
--- a/modules/gui/qt/dialogs/open/open.cpp
+++ b/modules/gui/qt/dialogs/open/open.cpp
@@ -26,8 +26,8 @@
 
 #include "dialogs/open/open.hpp"
 #include "dialogs/dialogs_provider.hpp"
-#include "util/recents.hpp"
 #include "util/qt_dirs.hpp"
+#include "playlist/playlist_controller.hpp"
 
 #include <QTabWidget>
 #include <QRegExp>
@@ -371,16 +371,13 @@ void OpenDialog::enqueue( bool b_enqueue )
     itemsMRL.sort();
 
     /* Go through the item list */
-    for( int i = 0; i < itemsMRL.count(); i++ )
-    {
-        bool b_start = !i && !b_enqueue;
-
-        /* Take options from the UI, not from what we stored */
-        QStringList optionsList = getOptions().split( " :" );
-
-        /* Switch between enqueuing and starting the item */
-        Open::openMRLwithOptions( p_intf, itemsMRL[i], &optionsList, b_start );
-    }
+    QVector<vlc::playlist::Media> medias;
+    /* Take options from the UI, not from what we stored */
+    QStringList optionsList = getOptions().split( " :" );
+    for( const QString& mrl : itemsMRL)
+        medias.push_back( vlc::playlist::Media{mrl, nullptr, &optionsList} );
+    if (!medias.empty())
+        THEMPL->append(medias, !b_enqueue);
 }
 
 void OpenDialog::transcode()
diff --git a/modules/gui/qt/dialogs/toolbar/toolbareditor.cpp b/modules/gui/qt/dialogs/toolbar/toolbareditor.cpp
index c0927f8058..39195f989d 100644
--- a/modules/gui/qt/dialogs/toolbar/toolbareditor.cpp
+++ b/modules/gui/qt/dialogs/toolbar/toolbareditor.cpp
@@ -22,7 +22,6 @@
 
 #include "toolbareditor.hpp"
 #include "util/i18n.hpp"
-#include "util/recent_media_model.hpp"
 #include "util/systempalette.hpp"
 #include "util/qml_main_context.hpp"
 #include "player/playercontrolbarmodel.hpp"
@@ -103,7 +102,6 @@ ToolbarEditorDialog::ToolbarEditorDialog( QWidget *_w, intf_thread_t *_p_intf)
     rootCtx->setContextProperty( "topWindow", mainInterface->windowHandle());
     rootCtx->setContextProperty( "systemPalette", new SystemPalette(engine));
     rootCtx->setContextProperty( "medialib", nullptr );
-    rootCtx->setContextProperty( "recentsMedias",  new VLCRecentMediaModel( p_intf, engine ));
     rootCtx->setContextProperty( "toolbareditor",  this);
 
     editorView->setSource( QUrl ( QStringLiteral("qrc:/dialogs/ToolbarEditor.qml") ) );
diff --git a/modules/gui/qt/maininterface/main_interface.cpp b/modules/gui/qt/maininterface/main_interface.cpp
index f2a0a8cf1a..1216e28902 100644
--- a/modules/gui/qt/maininterface/main_interface.cpp
+++ b/modules/gui/qt/maininterface/main_interface.cpp
@@ -35,7 +35,6 @@
 #include "widgets/native/customwidgets.hpp"               // qtEventToVLCKey, QVLCStackedWidget
 #include "util/qt_dirs.hpp"                     // toNativeSeparators
 #include "util/imagehelper.hpp"
-#include "util/recents.hpp"
 #include "util/color_scheme_model.hpp"
 
 #include "widgets/native/interface_widgets.hpp"     // bgWidget, videoWidget
@@ -599,8 +598,8 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play )
         }
     }
 
-    bool first = b_play;
-    foreach( const QUrl &url, mimeData->urls() )
+    QVector<vlc::playlist::Media> medias;
+    for( const QUrl &url: mimeData->urls() )
     {
         if( url.isValid() )
         {
@@ -623,10 +622,7 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play )
             }
 #endif
             if( mrl.length() > 0 )
-            {
-                Open::openMRL( p_intf, mrl, first );
-                first = false;
-            }
+                medias.push_back( vlc::playlist::Media{ mrl, nullptr, nullptr });
         }
     }
 
@@ -637,8 +633,10 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play )
         QUrl(mimeData->text()).isValid() )
     {
         QString mrl = toURI( mimeData->text() );
-        Open::openMRL( p_intf, mrl, first );
+        medias.push_back( vlc::playlist::Media{ mrl, nullptr, nullptr });
     }
+    if (!medias.empty())
+        THEMPL->append(medias, b_play);
     event->accept();
 }
 void MainInterface::dragEnterEvent(QDragEnterEvent *event)
diff --git a/modules/gui/qt/maininterface/mainui.cpp b/modules/gui/qt/maininterface/mainui.cpp
index e1f0a3af15..a9b911ed5d 100644
--- a/modules/gui/qt/maininterface/mainui.cpp
+++ b/modules/gui/qt/maininterface/mainui.cpp
@@ -23,7 +23,6 @@
 #include "util/qmleventfilter.hpp"
 #include "util/i18n.hpp"
 #include "util/systempalette.hpp"
-#include "util/recent_media_model.hpp"
 #include "util/sortfilterproxymodel.hpp"
 #include "util/navigation_history.hpp"
 
@@ -97,7 +96,6 @@ bool MainUI::setup(QQmlEngine* engine)
     rootCtx->setContextProperty( "mainInterface", m_mainInterface);
     rootCtx->setContextProperty( "topWindow", m_interfaceWindow);
     rootCtx->setContextProperty( "dialogProvider", DialogsProvider::getInstance());
-    rootCtx->setContextProperty( "recentsMedias",  new VLCRecentMediaModel( m_intf, this ));
     rootCtx->setContextProperty( "systemPalette", new SystemPalette(this));
 
     if (m_mainInterface->hasMediaLibrary())
diff --git a/modules/gui/qt/medialibrary/medialib.cpp b/modules/gui/qt/medialibrary/medialib.cpp
index d05828889f..c0b06339a9 100644
--- a/modules/gui/qt/medialibrary/medialib.cpp
+++ b/modules/gui/qt/medialibrary/medialib.cpp
@@ -18,7 +18,6 @@
 
 #include "medialib.hpp"
 #include "mlhelper.hpp"
-#include "util/recents.hpp"
 
 #include <vlc_playlist.h>
 #include <vlc_input_item.h>
@@ -38,18 +37,6 @@ MediaLib::MediaLib(intf_thread_t *_intf, QObject *_parent)
                                                       this ) );
 }
 
-void MediaLib::openMRLFromMedia(const vlc_ml_media_t& media, bool start )
-{
-    if (!media.p_files)
-        return;
-    for ( const vlc_ml_file_t& mediafile: ml_range_iterate<vlc_ml_file_t>(media.p_files) )
-    {
-        if (mediafile.psz_mrl)
-            Open::openMRL(m_intf, mediafile.psz_mrl, start);
-        start = false;
-    }
-}
-
 void MediaLib::addToPlaylist(const QString& mrl, const QStringList* options)
 {
     vlc::playlist::Media media{ mrl, mrl, options };
diff --git a/modules/gui/qt/medialibrary/medialib.hpp b/modules/gui/qt/medialibrary/medialib.hpp
index bd824092cd..d7646ea999 100644
--- a/modules/gui/qt/medialibrary/medialib.hpp
+++ b/modules/gui/qt/medialibrary/medialib.hpp
@@ -79,8 +79,6 @@ private:
     static void onMediaLibraryEvent( void* data, const vlc_ml_event_t* event );
 
 private:
-    void openMRLFromMedia(const vlc_ml_media_t& media, bool start );
-
     intf_thread_t* m_intf;
 
     bool m_idle = false;
diff --git a/modules/gui/qt/menus/menus.cpp b/modules/gui/qt/menus/menus.cpp
index fdf3c8a6fc..d8f77d7486 100644
--- a/modules/gui/qt/menus/menus.cpp
+++ b/modules/gui/qt/menus/menus.cpp
@@ -41,7 +41,6 @@
 #include "dialogs/dialogs_provider.hpp"                   /* Dialogs display */
 #include "player/player_controller.hpp"                      /* Input Management */
 #include "playlist/playlist_controller.hpp"
-#include "util/recents.hpp"                            /* Recent Items */
 #include "dialogs/extensions/extensions_manager.hpp"                 /* Extensions menu */
 #include "dialogs/extended/extended_panels.hpp"
 #include "util/varchoicemodel.hpp"
@@ -67,7 +66,6 @@ using namespace vlc::playlist;
 
   */
 
-QMenu *VLCMenuBar::recentsMenu = NULL;
 RendererMenu *VLCMenuBar::rendererMenu = NULL;
 
 /**
@@ -222,14 +220,6 @@ QMenu *VLCMenuBar::FileMenu( intf_thread_t *p_intf, QMenu *menu, MainInterface *
     addDPStaticEntry( menu, qtr( "Open &Location from clipboard" ),
                       NULL, &DialogsProvider::openUrlDialog, "Ctrl+V" );
 
-    if( !recentsMenu && var_InheritBool( p_intf, "qt-recentplay" ) )
-        recentsMenu = new QMenu( qtr( "Open &Recent Media" ) );
-
-    if( recentsMenu )
-    {
-        updateRecents( p_intf );
-        menu->addMenu( recentsMenu );
-    }
     menu->addSeparator();
 
     addDPStaticEntry( menu, qtr( I_PL_SAVE ), "", &DialogsProvider::savePlayingToPlaylist,
@@ -998,52 +988,3 @@ void VLCMenuBar::updateAudioDevice( intf_thread_t * p_intf, QMenu *current )
     free( names );
     free( selected );
 }
-
-void VLCMenuBar::updateRecents( intf_thread_t *p_intf )
-{
-    if( recentsMenu )
-    {
-        QAction* action;
-        RecentsMRL* rmrl = RecentsMRL::getInstance( p_intf );
-        QStringList l = rmrl->recentList();
-
-        recentsMenu->clear();
-
-        if( !l.count() )
-        {
-            recentsMenu->setEnabled( false );
-        }
-        else
-        {
-            for( int i = 0; i < __MIN( l.count(), 10) ; ++i )
-            {
-                QString mrl = l.at( i );
-                char *psz = vlc_uri_decode_duplicate( qtu( mrl ) );
-                QString text = qfu( psz );
-
-                text.replace("&", "&&");
-#ifdef _WIN32
-# define FILE_SCHEME "file:///"
-#else
-# define FILE_SCHEME "file://"
-#endif
-                if ( text.startsWith( FILE_SCHEME ) )
-                    text.remove( 0, strlen( FILE_SCHEME ) );
-#undef FILE_SCHEME
-
-                free( psz );
-                action = recentsMenu->addAction(
-                        QString( i < 9 ? "&%1: ": "%1: " ).arg( i + 1 ) +
-                            QApplication::fontMetrics().elidedText( text,
-                                                          Qt::ElideLeft, 400 ),
-                        rmrl->signalMapper, SLOT( map() ),
-                        i < 9 ? QString( "Ctrl+%1" ).arg( i + 1 ) : "" );
-                rmrl->signalMapper->setMapping( action, l.at( i ) );
-            }
-
-            recentsMenu->addSeparator();
-            recentsMenu->addAction( qtr("&Clear"), rmrl, &RecentsMRL::clear );
-            recentsMenu->setEnabled( true );
-        }
-    }
-}
diff --git a/modules/gui/qt/menus/menus.hpp b/modules/gui/qt/menus/menus.hpp
index d434f54788..d18ccebaf8 100644
--- a/modules/gui/qt/menus/menus.hpp
+++ b/modules/gui/qt/menus/menus.hpp
@@ -57,7 +57,6 @@ public:
 
     /* destructor for parentless Menus (kept in static variables) */
     static void freeRendererMenu(){ delete rendererMenu; rendererMenu = NULL; }
-    static void freeRecentsMenu(){ delete recentsMenu; recentsMenu = NULL; }
 
 protected:
     /* All main Menus */
@@ -107,14 +106,9 @@ protected:
     static void PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf, bool b = true );
 
     /* recentMRL menu */
-    static QMenu *recentsMenu;
-
     static RendererMenu *rendererMenu;
 
     static void updateAudioDevice(intf_thread_t *, QMenu* );
-
-public slots:
-    static void updateRecents( intf_thread_t * );
 };
 
 #endif
diff --git a/modules/gui/qt/menus/qml/GlobalShortcuts.qml b/modules/gui/qt/menus/qml/GlobalShortcuts.qml
index ca98e4024a..fc1f9f5519 100644
--- a/modules/gui/qt/menus/qml/GlobalShortcuts.qml
+++ b/modules/gui/qt/menus/qml/GlobalShortcuts.qml
@@ -44,16 +44,5 @@ Item {
     Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+L"; onActivated: mainInterface.playlistVisible = !mainInterface.playlistVisible; }
     Shortcut{ context: Qt.ApplicationShortcut; sequence:"F11"; onActivated: mainInterface.toggleInterfaceFullScreen(); }
 
-    Repeater {
-        model: recentsMedias
-
-        Item {
-            Shortcut {
-                sequence: "Ctrl+" + (index + 1)
-                onActivated:  mainPlaylistController.append([mrl], true)
-                context: Qt.ApplicationShortcut
-            }
-        }
-    }
 
 }
diff --git a/modules/gui/qt/player/player_controller.cpp b/modules/gui/qt/player/player_controller.cpp
index 3f62071525..597ff1cdf3 100644
--- a/modules/gui/qt/player/player_controller.cpp
+++ b/modules/gui/qt/player/player_controller.cpp
@@ -22,7 +22,6 @@
 
 #include "player_controller.hpp"
 #include "player_controller_p.hpp"
-#include "util/recents.hpp"
 
 #include <vlc_actions.h>           /* ACTION_ID */
 #include <vlc_url.h>            /* vlc_uri_decode */
@@ -267,8 +266,6 @@ static  void on_player_current_media_changed(vlc_player_t *, input_item_t *new_m
         that->UpdateArt( newMediaPtr.get() );
         that->UpdateMeta( newMediaPtr.get() );
 
-        RecentsMRL::getInstance( that->p_intf )->addRecent( newMediaPtr.get()->psz_uri );
-
         {
             vlc_player_locker lock{ that->m_player };
             that->m_currentItem = std::move(newMediaPtr);
diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp
index 917ee77037..d61add4f0e 100644
--- a/modules/gui/qt/qt.cpp
+++ b/modules/gui/qt/qt.cpp
@@ -58,7 +58,6 @@ extern "C" char **environ;
 #include "dialogs/extensions/extensions_manager.hpp" /* Extensions manager */
 #include "dialogs/plugins/addons_manager.hpp" /* Addons manager */
 #include "dialogs/help/help.hpp"     /* Launch Update */
-#include "util/recents.hpp"          /* Recents Item destruction */
 #include "util/qvlcapp.hpp"     /* QVLCApplication definition */
 #include "maininterface/compositor.hpp"
 
@@ -802,9 +801,6 @@ static void *ThreadCleanup( intf_thread_t *p_intf, bool error )
      */
     DialogsProvider::killInstance();
 
-    /* Delete the recentsMRL object before the configuration */
-    RecentsMRL::killInstance();
-
     /* Save the path or delete if recent play are disabled */
     if( var_InheritBool( p_intf, "qt-recentplay" ) )
         getSettings()->setValue( "filedialog-path", p_sys->filepath );
diff --git a/modules/gui/qt/util/recent_media_model.cpp b/modules/gui/qt/util/recent_media_model.cpp
deleted file mode 100644
index 447409ce20..0000000000
--- a/modules/gui/qt/util/recent_media_model.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2019 VLC authors and VideoLAN
- *
- * 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 "recent_media_model.hpp"
-#include <cassert>
-
-namespace {
-    enum Roles
-    {
-        MRLRole = Qt::UserRole
-    };
-}
-
-VLCRecentMediaModel::VLCRecentMediaModel(intf_thread_t *p_intf,QObject *parent)
-    : QAbstractListModel(parent)
-{
-    assert(p_intf);
-    rmrl = RecentsMRL::getInstance(p_intf);
-
-    connect(rmrl, SIGNAL(saved()), this, SLOT(update()));
-    connect(this, SIGNAL(limitChanged()), this, SLOT(update()));
-
-    update();
-}
-
-int VLCRecentMediaModel::rowCount(QModelIndex const & ) const
-{
-    return items.count();
-}
-
-QVariant VLCRecentMediaModel::data(QModelIndex const &index, const int role) const
-{
-    if (!index.isValid())
-        return {};
-    switch (role)
-    {
-        case MRLRole :
-            return QVariant::fromValue(items[index.row()]);
-        default :
-            return {};
-    }
-}
-
-QHash<int, QByteArray> VLCRecentMediaModel::roleNames() const
-{
-    QHash<int, QByteArray> roleNames;
-    roleNames.insert(MRLRole, "mrl");
-    return roleNames;
-}
-
-void VLCRecentMediaModel::clear()
-{
-    if (!items.isEmpty())
-    {
-        rmrl->clear();
-        update();
-    }
-}
-
-void VLCRecentMediaModel::update()
-{
-    beginResetModel();
-    items = rmrl->recentList().mid(0,i_limit);
-    endResetModel();
-}
-
-QStringList VLCRecentMediaModel::getItems()
-{
-    return items;
-}
-
-int VLCRecentMediaModel::getLimit() const
-{
-    return i_limit; 
-}
-
-void VLCRecentMediaModel::setLimit(int l)
-{
-    i_limit = l;
-    update();
-    emit limitChanged();
-}
diff --git a/modules/gui/qt/util/recent_media_model.hpp b/modules/gui/qt/util/recent_media_model.hpp
deleted file mode 100644
index b45799e2aa..0000000000
--- a/modules/gui/qt/util/recent_media_model.hpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2019 VLC authors and VideoLAN
- *
- * 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 VLC_RECENT_MEDIA_MODEL_HPP
-#define VLC_RECENT_MEDIA_MODEL_HPP
-
-#ifdef HAVE_CONFIG_H
-
-# include "config.h"
-
-#endif
-
-#include "qt.hpp"
-#include <QAbstractListModel>
-
-#include <QObject>
-#include <QStringList>
-#include "util/recents.hpp"
-
-class VLCRecentMediaModel : public QAbstractListModel
-{
-    Q_OBJECT
-    Q_PROPERTY(int limit READ getLimit WRITE setLimit NOTIFY limitChanged)
-
-public:
-    VLCRecentMediaModel(intf_thread_t *p_intf,QObject * parent = nullptr);
-
-    Q_INVOKABLE void clear();
-
-    Q_INVOKABLE int rowCount(QModelIndex const &parent = {}) const  override;
-
-    QVariant data(QModelIndex const &index, const int role = Qt::DisplayRole) const  override;
-
-    QHash<int, QByteArray> roleNames() const override;
-
-    QStringList items;
-
-    void setLimit(int l);
-    int getLimit() const;
-
-private:
-    RecentsMRL *rmrl;
-    int i_limit = 10;
-
-signals:
-    void limitChanged();
-
-public slots:
-    void update();
-    QStringList getItems();
-
-};
-
-#endif // VLC_RECENT_MEDIA_MODEL_HPP
diff --git a/modules/gui/qt/util/recents.cpp b/modules/gui/qt/util/recents.cpp
deleted file mode 100644
index 9ea0c68ab5..0000000000
--- a/modules/gui/qt/util/recents.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-/*****************************************************************************
- * recents.cpp : Recents MRL (menu)
- *****************************************************************************
- * Copyright © 2008-2014 VideoLAN and VLC authors
- *
- * Authors: Ludovic Fauvet <etix at l0cal.com>
- *          Jean-baptiste Kempf <jb at 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#include "qt.hpp"
-#include "util/recents.hpp"
-#include "dialogs/dialogs_provider.hpp"
-#include "menus/menus.hpp"
-#include "util/qt_dirs.hpp"
-#include <vlc_cxx_helpers.hpp>
-#include "playlist/playlist_controller.hpp"
-
-#include <QStringList>
-#include <QRegExp>
-#include <QSignalMapper>
-
-#ifdef _WIN32
-    #include <shlobj.h>
-    /* typedef enum  {
-        SHARD_PIDL              = 0x00000001,
-        SHARD_PATHA             = 0x00000002,
-        SHARD_PATHW             = 0x00000003,
-        SHARD_APPIDINFO         = 0x00000004,
-        SHARD_APPIDINFOIDLIST   = 0x00000005,
-        SHARD_LINK              = 0x00000006,
-        SHARD_APPIDINFOLINK     = 0x00000007,
-        SHARD_SHELLITEM         = 0x00000008
-    } SHARD; */
-    #define SHARD_PATHW 0x00000003
-
-    #include <vlc_charset.h>
-#endif
-
-#include <vlc_input_item.h>
-
-RecentsMRL::RecentsMRL( intf_thread_t *_p_intf ) : p_intf( _p_intf )
-{
-    recents = QStringList();
-    times = QStringList();
-
-    signalMapper = new QSignalMapper( this );
-    CONNECT( signalMapper,
-            mapped(const QString & ),
-            this,
-            playMRL( const QString & ) );
-
-    /* Load the filter psz */
-    char* psz_tmp = var_InheritString( p_intf, "qt-recentplay-filter" );
-    if( psz_tmp && *psz_tmp )
-        filter = new QRegExp( psz_tmp, Qt::CaseInsensitive );
-    else
-        filter = NULL;
-    free( psz_tmp );
-
-    load();
-    isActive = var_InheritBool( p_intf, "qt-recentplay" );
-    if( !isActive ) clear();
-}
-
-RecentsMRL::~RecentsMRL()
-{
-    save();
-    delete filter;
-}
-
-void RecentsMRL::addRecent( const QString &mrl )
-{
-    if ( !isActive || ( filter && filter->indexIn( mrl ) >= 0 ) )
-        return;
-
-#ifdef _WIN32
-    /* Add to the Windows 7 default list in taskbar */
-    char* path = vlc_uri2path( qtu( mrl ) );
-    if( path )
-    {
-        wchar_t *wmrl = ToWide( path );
-        if (wmrl != NULL)
-        {
-            SHAddToRecentDocs( SHARD_PATHW, wmrl );
-            free( wmrl );
-        }
-        free( path );
-    }
-#endif
-
-    int i_index = recents.indexOf( mrl );
-    if( 0 <= i_index )
-    {
-        /* move to the front */
-        recents.move( i_index, 0 );
-        times.move( i_index, 0 );
-    }
-    else
-    {
-        recents.prepend( mrl );
-        times.prepend( "-1" );
-        if( recents.count() > RECENTS_LIST_SIZE ) {
-            recents.takeLast();
-            times.takeLast();
-        }
-    }
-    VLCMenuBar::updateRecents( p_intf );
-    save();
-}
-
-void RecentsMRL::clear()
-{
-    if ( recents.isEmpty() )
-        return;
-
-    recents.clear();
-    times.clear();
-    if( isActive ) VLCMenuBar::updateRecents( p_intf );
-    save();
-}
-
-QStringList RecentsMRL::recentList()
-{
-    return recents;
-}
-
-void RecentsMRL::load()
-{
-    /* Load from the settings */
-    QStringList list = getSettings()->value( "RecentsMRL/list" ).toStringList();
-    QStringList list2 = getSettings()->value( "RecentsMRL/times" ).toStringList();
-
-    /* And filter the regexp on the list */
-    for( int i = 0; i < list.count(); ++i )
-    {
-        if ( !filter || filter->indexIn( list.at(i) ) == -1 ) {
-            recents.append( list.at(i) );
-            times.append( list2.value(i, "-1" ) );
-        }
-    }
-}
-
-void RecentsMRL::save()
-{
-    getSettings()->setValue( "RecentsMRL/list", recents );
-    getSettings()->setValue( "RecentsMRL/times", times );
-    emit saved();
-}
-
-void RecentsMRL::playMRL( const QString &mrl )
-{
-    Open::openMRL( p_intf, mrl );
-}
-
-vlc_tick_t RecentsMRL::time( const QString &mrl )
-{
-    if( !isActive )
-        return -1;
-
-    int i_index = recents.indexOf( mrl );
-    if( i_index != -1 )
-        return VLC_TICK_FROM_MS(times.value(i_index, "-1").toInt());
-    else
-        return -1;
-}
-
-void RecentsMRL::setTime( const QString &mrl, const vlc_tick_t time )
-{
-    int i_index = recents.indexOf( mrl );
-    if( i_index != -1 )
-        times[i_index] = QString::number( MS_FROM_VLC_TICK( time ) );
-}
-
-int Open::openMRL( intf_thread_t *p_intf,
-                    const QString &mrl,
-                    bool b_start )
-{
-    return openMRLwithOptions( p_intf, mrl, NULL, b_start );
-}
-
-int Open::openMRLwithOptions( intf_thread_t* p_intf,
-                     const QString &mrl,
-                     QStringList *options,
-                     bool b_start,
-                     const char *title)
-{
-    QVector<vlc::playlist::Media> medias {
-        {mrl, qfu(title), options}
-    };
-
-    THEMPL->append(medias, b_start);
-    /* Add to recent items, only if played */
-    if( b_start )
-        RecentsMRL::getInstance( p_intf )->addRecent( mrl );
-
-    return VLC_SUCCESS;
-}
diff --git a/modules/gui/qt/util/recents.hpp b/modules/gui/qt/util/recents.hpp
deleted file mode 100644
index bb2286ca2c..0000000000
--- a/modules/gui/qt/util/recents.hpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*****************************************************************************
- * recents.hpp : Recents MRL (menu)
- *****************************************************************************
- * Copyright © 2008-2014 VideoLAN and VLC authors
- *
- * Authors: Ludovic Fauvet <etix at l0cal.com>
- *          Jean-baptiste Kempf <jb at 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef QVLC_RECENTS_H_
-#define QVLC_RECENTS_H_
-
-#include "qt.hpp"
-#include "util/singleton.hpp"
-
-#include <QObject>
-#include <QStringList>
-class QRegExp;
-class QSignalMapper;
-
-#define RECENTS_LIST_SIZE 30
-
-class Open
-{
-public:
-    static int openMRL( intf_thread_t*,
-                        const QString &,
-                        bool b_start = true);
-
-    static int openMRLwithOptions( intf_thread_t*,
-                                   const QString &,
-                                   QStringList *options,
-                                   bool b_start = true,
-                                   const char* title = NULL);
-};
-
-class RecentsMRL : public QObject, public Singleton<RecentsMRL>
-{
-    Q_OBJECT
-    friend class Singleton<RecentsMRL>;
-
-public:
-    
-    void addRecent( const QString & );
-    QSignalMapper *signalMapper;
-
-    vlc_tick_t time( const QString &mrl );
-    void setTime( const QString &mrl, const vlc_tick_t time );
-    virtual ~RecentsMRL();
-
-private:
-    RecentsMRL( intf_thread_t* _p_intf );
-
-    intf_thread_t *p_intf;
-
-    QStringList   recents;
-    QStringList   times;
-    QRegExp       *filter;
-    bool          isActive;
-
-    void load();
-    void save();
-     
-signals:
-       void saved();
-public slots:
-    QStringList recentList();
-    void clear();
-    void playMRL( const QString & );
-};
-
-#endif
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ddd566816a..ebae138a68 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -774,8 +774,6 @@ modules/gui/qt/menus/menus.cpp
 modules/gui/qt/menus/menus.hpp
 modules/gui/qt/qt.cpp
 modules/gui/qt/qt.hpp
-modules/gui/qt/util/recents.cpp
-modules/gui/qt/util/recents.hpp
 modules/gui/qt/widgets/native/animators.cpp
 modules/gui/qt/widgets/native/animators.hpp
 modules/gui/qt/widgets/native/customwidgets.cpp



More information about the vlc-commits mailing list