Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
recents.cpp
Package: vlc-1.0.5.zip [view]
Upload User: kjfoods
Upload Date: 2020-07-06
Package Size: 29949k
Code Size: 3k
Category:
midi program
Development Platform:
Unix_Linux
- /*****************************************************************************
- * recents.cpp : Recents MRL (menu)
- *****************************************************************************
- * Copyright © 2006-2008 the VideoLAN team
- * $Id: 83317afd9532bbc4f86e293bce4454fe6deed013 $
- *
- * 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 "dialogs_provider.hpp"
- #include "menus.hpp"
- #include <QList>
- #include <QString>
- #include <QAction>
- #include <QSettings>
- #include <QRegExp>
- #include <QSignalMapper>
- #ifdef WIN32
- #include <shlobj.h>
- #endif
- RecentsMRL* RecentsMRL::instance = NULL;
- RecentsMRL::RecentsMRL( intf_thread_t *_p_intf ) : p_intf( _p_intf )
- {
- stack = new QList<QString>;
- signalMapper = new QSignalMapper(this);
- CONNECT( signalMapper,
- mapped(const QString & ),
- DialogsProvider::getInstance( p_intf ),
- playMRL( const QString & ) );
- isActive = config_GetInt( p_intf, "qt-recentplay" );
- char* psz_tmp = config_GetPsz( p_intf, "qt-recentplay-filter" );
- if( psz_tmp && *psz_tmp )
- filter = new QRegExp( psz_tmp, Qt::CaseInsensitive );
- else
- filter = NULL;
- free( psz_tmp );
- load();
- if( !isActive ) clear();
- }
- RecentsMRL::~RecentsMRL()
- {
- delete filter;
- delete stack;
- }
- void RecentsMRL::addRecent( const QString &mrl )
- {
- 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 */
- SHAddToRecentDocs( 0x00000002 , qtu( mrl ) );
- #endif
- int i_index = stack->indexOf( mrl );
- if( 0 <= i_index )
- {
- /* move to the front */
- stack->move( i_index, 0 );
- }
- else
- {
- stack->prepend( mrl );
- if( stack->size() > RECENTS_LIST_SIZE )
- stack->takeLast();
- }
- QVLCMenu::updateRecents( p_intf );
- save();
- }
- void RecentsMRL::clear()
- {
- if ( stack->isEmpty() )
- return;
- stack->clear();
- if( isActive ) QVLCMenu::updateRecents( p_intf );
- save();
- }
- QList<QString> RecentsMRL::recents()
- {
- return QList<QString>(*stack);
- }
- void RecentsMRL::load()
- {
- QStringList list = getSettings()->value( "RecentsMRL/list" ).toStringList();
- for( int i = 0; i < list.size(); ++i )
- {
- if ( !filter || 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()->setValue( "RecentsMRL/list", list );
- }