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

Last change on this file since 94 was 93, checked in by Silvan Scherrer, 15 years ago

smplayer: 0.6.9

File size: 2.6 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2010 Ricardo Villalba <rvm@escomposlinux.org>
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 <QObject>
23#include <QString>
24#include <QList>
25
26class QMenu;
27class QAction;
28class QWidget;
29
30class Favorite
31{
32public:
33 Favorite() {}
34 Favorite(QString name, QString file, QString icon = QString::null) { _name = name; _file = file; _icon = icon; };
35 virtual ~Favorite() {};
36
37 void setName(QString name) { _name = name; };
38 void setFile(QString file) { _file = file; };
39 void setIcon(QString file) { _icon = file; };
40
41 QString name() { return _name; };
42 QString file() { return _file; }
43 QString icon() { return _icon; };
44
45protected:
46 QString _name, _file, _icon;
47};
48
49typedef QList<Favorite> FavoriteList;
50
51class Favorites : public QObject
52{
53 Q_OBJECT
54public:
55 Favorites(QString filename, QWidget * parent = 0);
56 ~Favorites();
57
58 QMenu * menu();
59 QAction * editAct() { return edit_act; };
60 QAction * jumpAct() { return jump_act; };
61 QAction * nextAct() { return next_act; };
62 QAction * previousAct() { return previous_act; };
63
64public slots:
65 void next();
66 void previous();
67
68signals:
69 void activated(QString filemane);
70
71protected:
72 void save();
73 void load();
74 void createMenu();
75 void updateMenu();
76 void populateMenu();
77
78 int findFile(QString filename);
79
80 // Mark current action in the menu
81 void markCurrent();
82
83protected slots:
84 void triggered_slot(QAction * action);
85 virtual void edit();
86 virtual void jump();
87
88protected:
89 FavoriteList f_list;
90 QString _filename;
91 QMenu * _menu;
92 QAction * edit_act;
93 QAction * jump_act;
94 QAction * next_act;
95 QAction * previous_act;
96
97 QWidget * parent_widget;
98
99 // Current (or last) file clicked
100 QString current_file;
101
102 // Last item selected in the jump dialog
103 int last_item;
104};
105
106#endif
107
Note: See TracBrowser for help on using the repository browser.