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