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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
/***************************************************************************
kplayernodeaction.h
-------------------
begin : Wed Apr 05 2006
copyright : (C) 2006-2007 by kiriuja
email : http://kplayer.sourceforge.net/email.html
***************************************************************************/
/***************************************************************************
* 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 3 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef KPLAYERNODEACTION_H
#define KPLAYERNODEACTION_H
#include <tdeactionclasses.h>
#include "kplayeractionlist.h"
class KPlayerNode;
class KPlayerContainerNode;
class KPlayerDeviceNode;
class KPlayerDiskNode;
class KPlayerNodeList;
/**Node action list.
*@author kiriuja
*/
class KPlayerNodeActionList : public KPlayerActionList
{
Q_OBJECT
public:
/** Constructor. */
KPlayerNodeActionList (const TQString& text, const TQString& status,
const TQString& whatsthis, TQObject* parent, const char* name);
/** Destructor. */
virtual ~KPlayerNodeActionList();
/** Initializes the node and actions. */
void initialize (const KURL& url);
/** Populates the node. */
virtual void populateNode (void);
/** Vacates the node. */
virtual void vacateNode (void);
/** Returns the node. */
KPlayerContainerNode* node (void) const
{ return m_node; }
/** Returns the maximum list size. */
int maximumSize (void) const
{ return m_size; }
/** Sets the maximum list size. */
void setMaximumSize (int size)
{ m_size = size; }
/** Returns whether the given node can be included on the list. */
virtual bool canInclude (KPlayerNode* node) const;
/** Frees up resources. */
void terminate (void);
protected slots:
/** Adds the given nodes to the list. */
void added (KPlayerContainerNode* parent, const KPlayerNodeList& nodes, KPlayerNode* after = 0);
/** Removes the given nodes from the list. */
void removed (KPlayerContainerNode* parent, const KPlayerNodeList& nodes);
/** Updates the given node attributes. */
void updated (KPlayerContainerNode* parent, KPlayerNode* node);
/** Emits the activated signal with the selected node. */
void actionActivated (void);
protected:
/** Updates the node list. */
void updateActions (void);
/** Creates an action for the given node. */
virtual TDEAction* createAction (KPlayerNode* node);
/** Container node. */
KPlayerContainerNode* m_node;
/** Maximum list size. */
int m_size;
signals:
/** Emitted when the node is selected. */
void activated (KPlayerNode*);
};
/**Container action list.
*@author kiriuja
*/
class KPlayerContainerActionList : public KPlayerNodeActionList
{
Q_OBJECT
public:
/** Constructor. */
KPlayerContainerActionList (const TQString& text, const TQString& status,
const TQString& whatsthis, TQObject* parent, const char* name);
/** Destructor. */
virtual ~KPlayerContainerActionList();
/** Populates the node. */
virtual void populateNode (void);
/** Vacates the node. */
virtual void vacateNode (void);
/** Returns whether the given node can be included on the list. */
virtual bool canInclude (KPlayerNode* node) const;
};
/**Devices action list.
*@author kiriuja
*/
class KPlayerDevicesActionList : public KPlayerContainerActionList
{
Q_OBJECT
public:
/** Constructor. */
KPlayerDevicesActionList (const TQString& text, const TQString& status,
const TQString& whatsthis, TQObject* parent, const char* name);
/** Destructor. */
virtual ~KPlayerDevicesActionList();
protected:
/** Creates an action for the given node. */
virtual TDEAction* createAction (KPlayerNode* node);
};
/**Device action menu class.
*@author kiriuja
*/
class KPlayerDeviceActionMenu : public TDEActionMenu
{
Q_OBJECT
public:
/** Constructor. */
KPlayerDeviceActionMenu (KPlayerDeviceNode* node);
/** Destructor. */
virtual ~KPlayerDeviceActionMenu();
/** Updates device actions. */
virtual void setup (void);
/** Returns the node. */
KPlayerDeviceNode* device (void) const
{ return (KPlayerDeviceNode*) parent(); }
protected slots:
/** Plays the selected item. */
void play (void);
/** Adds the given nodes to the list. */
void added (KPlayerContainerNode*, const KPlayerNodeList& nodes, KPlayerNode* after);
/** Removes the given nodes from the list. */
void removed (KPlayerContainerNode*, const KPlayerNodeList& nodes);
/** Updates the given node attributes. */
void updated (KPlayerContainerNode* parent, KPlayerNode* node);
protected:
/** Updates the device action list. */
virtual void updateActions (void);
/** Device actions. */
TQPtrList<TDEAction> m_actions;
/** Indicates whether the device node was populated. */
bool m_populated;
signals:
/** Emitted when the node is selected. */
void activated (KPlayerNode*);
};
/**Disk action menu class.
*@author kiriuja
*/
class KPlayerDiskActionMenu : public KPlayerDeviceActionMenu
{
Q_OBJECT
public:
/** Constructor. */
KPlayerDiskActionMenu (KPlayerDeviceNode* node);
/** Destructor. */
virtual ~KPlayerDiskActionMenu();
/** Updates device actions. */
virtual void setup (void);
/** Returns the node. */
KPlayerDiskNode* device (void) const
{ return (KPlayerDiskNode*) parent(); }
/** Sets the action text. */
virtual void setText (const TQString& text);
protected slots:
/** Loads the disk. */
void loadDisk (void);
/** Plays the disk. */
void playDisk (void);
protected:
/** Updates the device action list. */
virtual void updateActions (void);
/** Load disk action. */
TDEAction* m_load_action;
/** Play disk action. */
TDEAction* m_play_action;
/** Indicates disk being loaded for playing. */
bool m_play_disk;
};
#endif
|