source: smplayer/trunk/src/favorites.h@ 124

Last change on this file since 124 was 124, checked in by Silvan Scherrer, 13 years ago

SMPlayer: 0.7.1 trunk update

  • Property svn:eol-style set to LF
File size: 3.3 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2012 Ricardo Villalba <rvm@users.sourceforge.net>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17*/
18
19#ifndef _FAVORITES_H_
20#define _FAVORITES_H_
21
22#include <QMenu>
23#include <QString>
24#include <QList>
25
26class QAction;
27class QWidget;
28
29class Favorite
30{
31public:
32 Favorite() { is_subentry = false; }
33 Favorite(QString name, QString file, QString icon = QString::null, bool subentry = false)
34 {
35 _name = name; _file = file; _icon = icon; is_subentry = subentry;
36 };
37 virtual ~Favorite() {};
38
39 void setName(QString name) { _name = name; };
40 void setFile(QString file) { _file = file; };
41 void setIcon(QString file) { _icon = file; };
42 void setSubentry(bool b) { is_subentry = b; }
43
44 QString name() { return _name; };
45 QString file() { return _file; }
46 QString icon() { return _icon; };
47 bool isSubentry() { return is_subentry; };
48
49protected:
50 QString _name, _file, _icon;
51 bool is_subentry; // Not a favorite file, but a new favorite list
52};
53
54typedef QList<Favorite> FavoriteList;
55
56class Favorites : public QMenu
57{
58 Q_OBJECT
59public:
60 Favorites(QString filename, QWidget * parent = 0);
61 ~Favorites();
62
63 QAction * editAct() { return edit_act; };
64 QAction * jumpAct() { return jump_act; };
65 QAction * nextAct() { return next_act; };
66 QAction * previousAct() { return previous_act; };
67 QAction * addCurrentAct() { return add_current_act; };
68
69public slots:
70 void next();
71 void previous();
72
73 void getCurrentMedia(const QString & filename, const QString & title);
74
75signals:
76 void activated(QString filemane);
77 //! Signal to resend the data to child
78 void sendCurrentMedia(const QString & filename, const QString & title);
79
80protected:
81 virtual void save();
82 virtual void load();
83 virtual void updateMenu();
84 virtual void populateMenu();
85 virtual Favorites * createNewObject(QString filename, QWidget * parent);
86 void delete_children();
87
88 int findFile(QString filename);
89
90 // Mark current action in the menu
91 void markCurrent();
92
93protected slots:
94 void triggered_slot(QAction * action);
95 virtual void edit();
96 virtual void jump();
97 virtual void addCurrentPlaying(); // Adds to menu current (or last played) file
98
99protected:
100 virtual void retranslateStrings();
101 virtual void changeEvent(QEvent * event);
102
103protected:
104 FavoriteList f_list;
105 QString _filename;
106 QAction * edit_act;
107 QAction * jump_act;
108 QAction * next_act;
109 QAction * previous_act;
110 QAction * add_current_act;
111
112 QWidget * parent_widget;
113
114 // Current (or last) file clicked
115 QString current_file;
116
117 // Last item selected in the jump dialog
118 int last_item;
119
120 QString received_file_playing;
121 QString received_title;
122
123 QList<Favorites*> child;
124};
125
126#endif
127
Note: See TracBrowser for help on using the repository browser.