summaryrefslogtreecommitdiffstats
path: root/kplayer/kplayeractionlist.h
blob: e443d5231a9b9f288a3cb021476274b0b7a3449a (plain)
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
/***************************************************************************
                          kplayeractionlist.h
                          -------------------
    begin                : Thu Apr 13 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 KPLAYERACTIONLIST_H
#define KPLAYERACTIONLIST_H

#include <tqobject.h>
#include <tqptrlist.h>

class TDEAction;

/**Action list.
  *@author kiriuja
  */
class KPlayerActionList : public TQObject
{
  Q_OBJECT

public:
  /** Constructor. */
  KPlayerActionList (const TQString& text, const TQString& status,
    const TQString& whatsthis, TQObject* parent, const char* name);
  /** Destructor. */
  virtual ~KPlayerActionList();

  /** Returns the list of actions. */
  const TQPtrList<TDEAction>& actions (void) const
    { return m_actions; }
  /** Returns the number of actions on the list. */
  int count (void) const
    { return actions().count(); }
  /** Returns whether the list is empty. */
  bool isEmpty (void) const
    { return actions().isEmpty(); }

signals:
  /** Emitted when the action list is going to be updated. */
  void updating (KPlayerActionList* list);
  /** Emitted when the action list has been updated. */
  void updated (KPlayerActionList* list);
  /** Emitted when an item is selected from the list. Provides the item number. */
  void activated (int index);

protected slots:
  /** Emits the activated signal with the selected item number. */
  void actionActivated (void);

protected:
  /** Plugs the action list and emits the updated signal. */
  void plug (void);
  /** Unplugs the action list. */
  void unplug (void);
  /** Updates the action text, status, and whats this. */
  virtual void updateAction (TDEAction* action);
  /** Selects the item with the given index by emitting the activated signal. */
  virtual void actionActivated (TDEAction* action, int index);

  /** Action text template. */
  TQString m_text;
  /** Action status text template. */
  TQString m_status;
  /** Action whats this text template. */
  TQString m_whatsthis;
  /** Action list. */
  TQPtrList<TDEAction> m_actions;
};

/**Simple action list.
  *@author kiriuja
  */
class KPlayerSimpleActionList : public KPlayerActionList
{
  Q_OBJECT

public:
  /** Constructor. */
  KPlayerSimpleActionList (const TQStringList& names, const TQString& text, const TQString& status,
    const TQString& whatsthis, TQObject* parent, const char* name);
  /** Destructor. */
  virtual ~KPlayerSimpleActionList();

  /** Updates the action list. */
  void update (void);

protected:
  /** Updates the action text, status, and whats this. */
  virtual void updateAction (TDEAction* action);

  /** Action names. */
  const TQStringList& m_names;
};

/**Toggle action list.
  *@author kiriuja
  */
class KPlayerToggleActionList : public KPlayerSimpleActionList
{
  Q_OBJECT

public:
  /** Constructor. */
  KPlayerToggleActionList (const TQStringList& names, const TQMap<TQString, bool>& states,
    const TQString& ontext, const TQString& offtext, const TQString& onstatus, const TQString& offstatus,
    const TQString& onwhatsthis, const TQString& offwhatsthis, TQObject* parent, const char* name);
  /** Destructor. */
  virtual ~KPlayerToggleActionList();

protected:
  /** Updates the action text, status, and whats this. */
  virtual void updateAction (TDEAction* action);
  /** Selects the item with the given index by emitting the activated signal. */
  virtual void actionActivated (TDEAction* action, int index);

  /** Action states. */
  const TQMap<TQString, bool>& m_states;
  /** Action on text template. */
  TQString m_on_text;
  /** Action on status text template. */
  TQString m_on_status;
  /** Action on whats this text template. */
  TQString m_on_whatsthis;
};

/**Track action list.
  *@author kiriuja
  */
class KPlayerTrackActionList : public KPlayerActionList
{
  Q_OBJECT

public:
  /** Constructor. */
  KPlayerTrackActionList (const TQString& text, const TQString& status,
    const TQString& whatsthis, TQObject* parent, const char* name);
  /** Destructor. */
  virtual ~KPlayerTrackActionList();

  /** Updates the track action list. */
  void update (const TQMap<int, TQString>& ids, int id);

protected:
  /** Adds actions for the given IDs to the list. */
  void addActions (const TQMap<int, TQString>& ids, int id);

  /** Selects the track with the given index by emitting the activated signal. */
  virtual void actionActivated (TDEAction* action, int index);
};

/**Subtitle track action list.
  *@author kiriuja
  */
class KPlayerSubtitleTrackActionList : public KPlayerTrackActionList
{
  Q_OBJECT

public:
  /** Constructor. */
  KPlayerSubtitleTrackActionList (const TQString& text, const TQString& status,
    const TQString& whatsthis, TQObject* parent, const char* name);
  /** Destructor. */
  virtual ~KPlayerSubtitleTrackActionList();

  /** Updates the track action list. */
  void update (bool show, const TQMap<int, TQString>& sids, int sid, const TQMap<int, TQString>& vsids,
    int vsid, TQStringList files, const TQString& vobsub, const TQString& current);

protected:
  /** Selects the track with the given index by emitting the activated signal. */
  virtual void actionActivated (TDEAction* action, int index);
};

#endif