]> git.sesse.net Git - vlc/blob - modules/gui/qt4/recents.hpp
Qt: add a minimize button to MediaInfo dialog
[vlc] / modules / gui / qt4 / recents.hpp
1 /*****************************************************************************
2  * recents.hpp : Recents MRL (menu)
3  *****************************************************************************
4  * Copyright © 2008-2014 VideoLAN and VLC authors
5  * $Id$
6  *
7  * Authors: Ludovic Fauvet <etix@l0cal.com>
8  *          Jean-baptiste Kempf <jb@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * ( at your option ) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifndef QVLC_RECENTS_H_
26 #define QVLC_RECENTS_H_
27
28 #include "qt4.hpp"
29 #include "util/singleton.hpp"
30
31 #include <QObject>
32 #include <QStringList>
33 class QRegExp;
34 class QSignalMapper;
35
36 #define RECENTS_LIST_SIZE 30
37
38 class Open
39 {
40 public:
41     static int openMRL( intf_thread_t*,
42                         const QString &,
43                         bool b_start = true,
44                         bool b_playlist = true);
45
46     static int openMRLwithOptions( intf_thread_t*,
47                                    const QString &,
48                                    QStringList *options,
49                                    bool b_start = true,
50                                    bool b_playlist = true,
51                                    const char* title = NULL);
52 };
53
54 class RecentsMRL : public QObject, public Singleton<RecentsMRL>
55 {
56     Q_OBJECT
57     friend class Singleton<RecentsMRL>;
58
59 public:
60     void addRecent( const QString & );
61     QStringList recentList();
62     playlist_item_t *toPlaylist(int length);
63     QSignalMapper *signalMapper;
64
65     int time( const QString &mrl );
66     void setTime( const QString &mrl, const int64_t time );
67
68 private:
69     RecentsMRL( intf_thread_t* _p_intf );
70     virtual ~RecentsMRL();
71
72     intf_thread_t *p_intf;
73
74     QStringList   recents;
75     QStringList   times;
76     QRegExp       *filter;
77     bool          isActive;
78
79     void load();
80     void save();
81
82 public slots:
83     void clear();
84     void playMRL( const QString & );
85 };
86
87 #endif