1 /****************************************************************************************
2  * Copyright (c) 2004 Max Howell <max.howell@methylblue.com>                            *
3  * Copyright (c) 2008 Mark Kretschmann <kretschmann@kde.org>                            *
4  * Copyright (c) 2009 Artur Szymiec <artur.szymiec@gmail.com>                           *
5  *                                                                                      *
6  * This program is free software; you can redistribute it and/or modify it under        *
7  * the terms of the GNU General Public License as published by the Free Software        *
8  * Foundation; either version 2 of the License, or (at your option) any later           *
9  * version.                                                                             *
10  *                                                                                      *
11  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
13  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
14  *                                                                                      *
15  * You should have received a copy of the GNU General Public License along with         *
16  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
17  ****************************************************************************************/
18 
19 #ifndef AMAROK_ACTIONCLASSES_H
20 #define AMAROK_ACTIONCLASSES_H
21 
22 #include <QAction>
23 #include <QMenu>
24 
25 #include <KSelectAction>
26 #include <KToggleAction>
27 
28 #include <phonon/Global>
29 
30 class KActionCollection;
31 class KHelpMenu;
32 
33 
34 namespace Amarok
35 {
36     class Menu : public QMenu
37     {
38         Q_OBJECT
39         public:
40             explicit Menu( QWidget* parent );
41             static Menu *instance();
42             static QMenu *helpMenu( QWidget *parent = nullptr );
43 
44         private:
45             static Menu       *s_instance;
46             static KHelpMenu  *s_helpMenu;
47     };
48 
49     class MenuAction : public QAction
50     {
51         public:
52             MenuAction( KActionCollection*, QObject* );
53 
54             /**
55              * Indicate whether the user may configure the action's shortcut.
56              */
57             void setShortcutConfigurable(bool configurable);
58     };
59 
60     class PlayPauseAction : public KToggleAction
61     {
62         Q_OBJECT
63 
64         public:
65             explicit PlayPauseAction( KActionCollection*, QObject* );
66 
67         private Q_SLOTS:
68             void stopped();
69             void paused();
70             void playing();
71     };
72 
73     class ToggleAction : public KToggleAction
74     {
75         public:
76             ToggleAction( const QString &text, void ( *f ) ( bool ), KActionCollection* const ac, const char *name, QObject *parent );
77             virtual void setChecked( bool b );
78             virtual void setEnabled( bool b );
79 
80         private:
81             void ( *m_function ) ( bool );
82     };
83 
84     class SelectAction : public KSelectAction
85     {
86         Q_OBJECT
87 
88         public:
89             SelectAction( const QString &text, void ( *f ) ( int ), KActionCollection* const ac, const char *name, QObject *parent );
90 
91             virtual void setCurrentItem( int n );
92             virtual void setEnabled( bool b );
93             virtual void setIcons( QStringList icons );
94             virtual QString currentText() const;
95             QStringList icons() const;
96             QString currentIcon() const;
97 
98         protected Q_SLOTS:
99             void actionTriggered( QAction *a ) override;
100 
101         private:
102             void ( *m_function ) ( int );
103             QStringList m_icons;
104     };
105 
106     class RandomAction : public SelectAction
107     {
108         public:
109             RandomAction( KActionCollection *ac, QObject* );
110             void setCurrentItem( int n ) override;
111     };
112 
113     class FavorAction : public SelectAction
114     {
115         public:
116             FavorAction( KActionCollection *ac, QObject* );
117     };
118 
119     class RepeatAction : public SelectAction
120     {
121         public:
122             RepeatAction( KActionCollection *ac, QObject* );
123     };
124 
125     class ReplayGainModeAction : public SelectAction
126     {
127         public:
128             ReplayGainModeAction( KActionCollection *ac, QObject* );
129     };
130 
131     class BurnMenu : public QMenu
132     {
133         Q_OBJECT
134 
135         public:
136             explicit BurnMenu( QWidget* parent );
137             static QMenu *instance();
138 
139         private Q_SLOTS:
140             void slotBurnCurrentPlaylist();
141             void slotBurnSelectedTracks();
142 
143         private:
144             static BurnMenu* s_instance;
145     };
146 
147 
148     class BurnMenuAction : public QAction
149     {
150         public:
151             BurnMenuAction( KActionCollection*, QObject* );
152             virtual QWidget* createWidget( QWidget* );
153     };
154 
155     class StopAction : public QAction
156     {
157         Q_OBJECT
158         public:
159             StopAction( KActionCollection*, QObject* );
160 
161         private Q_SLOTS:
162             void stopped();
163             void playing();
164             void stop();
165     };
166 
167     class StopPlayingAfterCurrentTrackAction : public QAction
168     {
169         Q_OBJECT
170         public:
171             StopPlayingAfterCurrentTrackAction( KActionCollection*, QObject* );
172 
173         private Q_SLOTS:
174             void stopPlayingAfterCurrentTrack();
175     };
176 } /* namespace Amarok */
177 
178 
179 #endif /* AMAROK_ACTIONCLASSES_H */
180 
181