-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
main_interface.hpp
menus.hpp
qt4.hpp
+ recents.hpp
util/customwidgets.hpp
util/input_slider.hpp
util/qvlcframe.hpp
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 \
main_interface.cpp \
dialogs_provider.cpp \
input_manager.cpp \
+ recents.cpp \
dialogs/playlist.cpp \
dialogs/bookmarks.cpp \
dialogs/preferences.cpp \
main_interface.hpp \
dialogs_provider.hpp \
input_manager.hpp \
+ recents.hpp \
dialogs/playlist.hpp \
dialogs/bookmarks.hpp \
dialogs/mediainfo.hpp \
#include <QToolButton>
#include <QButtonGroup>
#include <QVBoxLayout>
+#include <QSettings>
#include <QtAlgorithms>
#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") );
#include "dialogs/open.hpp"
+#include "recents.hpp"
+
#include <QTabWidget>
#include <QGridLayout>
#include <QRegExp>
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
#include "menus.hpp"
#include <vlc_intf_strings.h>
#include "input_manager.hpp"
+#include "recents.hpp"
/* The dialogs */
#include "dialogs/playlist.hpp"
: ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
PLAYLIST_END,
pl ? true : false, false );
+ RecentsMRL::getInstance( p_intf )->addRecent(
+ toNativeSeparators( file ) );
i++;
}
}
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 );
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 );
}
}
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 );
+}
void menuAction( QObject *);
void menuUpdateAction( QObject * );
void SDMenuAction( QString );
+ void playMRL( const QString & );
void playlistDialog();
void bookmarksDialog();
#include "dialogs/extended.hpp"
#include "dialogs/playlist.hpp"
#include "menus.hpp"
+#include "recents.hpp"
#include <QMenuBar>
#include <QCloseEvent>
* 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 *
PLAYLIST_APPEND | (first ? PLAYLIST_GO: 0),
PLAYLIST_END, true, false );
first = false;
+ RecentsMRL::getInstance( p_intf )->addRecent( s );
}
}
event->acceptProposedAction();
/* Show event */
return VLC_SUCCESS;
}
+
+/*****************************************************************************
+ * updateRecentsMenu: event called by RecentsMRL
+ *****************************************************************************/
+
+void MainInterface::updateRecentsMenu()
+{
+ QVLCMenu::updateRecents( p_intf );
+}
void updateSystrayTooltipName( QString );
void updateSystrayTooltipStatus( int );
void showSpeedMenu( QPoint );
+ void updateRecentsMenu();
signals:
void askReleaseVideo( void * );
void askVideoToResize( unsigned int, unsigned int );
#include "menus.hpp"
#include "dialogs_provider.hpp"
#include "input_manager.hpp"
+#include "recents.hpp"
#include <QMenu>
#include <QMenuBar>
#include <QActionGroup>
#include <QSignalMapper>
#include <QSystemTrayIcon>
+#include <QList>
/*
This file defines the main menus and the pop-up menu (right-click menu)
* 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,
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 );
* Media ( File ) Menu
* Opening, streaming and quit
**/
-QMenu *QVLCMenu::FileMenu()
+QMenu *QVLCMenu::FileMenu( intf_thread_t *p_intf )
{
QMenu *menu = new QMenu();
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..." ), "", "",
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() ) );
+ }
+ }
+}
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 *,
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
#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>
#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" \
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 );
*/
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;
--- /dev/null
+/*****************************************************************************
+ * 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();
+}
--- /dev/null
+/*****************************************************************************
+ * 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
<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>