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 "core/engine/EngineObserver.h"
23
24
#include <KAction>
25
#include <KMenu>
26
#include <KToggleAction>
27
#include <KSelectAction>
28
29
#include <QPointer>
30
31
class KActionCollection;
32
class KHelpMenu;
33
34
35
namespace Amarok
36
{
37
    class Menu : public KMenu
38
    {
39
        Q_OBJECT
40
        public:
41
            Menu( QWidget* parent );
42
            static Menu *instance();
43
            static KMenu *helpMenu( QWidget *parent = 0 );
44
45
        private:
46
            static Menu       *s_instance;
47
            static KHelpMenu  *s_helpMenu;
48
    };
49
50
    class MenuAction : public KAction
51
    {
52
        public:
53
            MenuAction( KActionCollection*, QObject* );
54
    };
55
56
    class PlayPauseAction : public KToggleAction, public Engine::EngineObserver
57
    {
58
        public:
59
            PlayPauseAction( KActionCollection*, QObject* );
60
            virtual void engineStateChanged( Phonon::State, Phonon::State = Phonon::StoppedState );
61
    };
62
63
    class ToggleAction : public KToggleAction
64
    {
65
        public:
66
            ToggleAction( const QString &text, void ( *f ) ( bool ), KActionCollection* const ac, const char *name, QObject *parent );
67
            virtual void setChecked( bool b );
68
            virtual void setEnabled( bool b );
69
70
        private:
71
            void ( *m_function ) ( bool );
72
    };
73
74
    class SelectAction : public KSelectAction
75
    {
76
        Q_OBJECT
77
78
        public:
79
            SelectAction( const QString &text, void ( *f ) ( int ), KActionCollection* const ac, const char *name, QObject *parent );
80
81
            virtual void setCurrentItem( int n );
82
            virtual void setEnabled( bool b );
83
            virtual void setIcons( QStringList icons );
84
            virtual QString currentText() const;
85
            QStringList icons() const;
86
            QString currentIcon() const;
87
88
        protected slots:
89
            virtual void actionTriggered( QAction *a );
90
91
        private:
92
            void ( *m_function ) ( int );
93
            QStringList m_icons;
94
    };
95
96
    class RandomAction : public SelectAction
97
    {
98
        public:
99
            RandomAction( KActionCollection *ac, QObject* );
100
            virtual void setCurrentItem( int n );
101
    };
102
103
    class FavorAction : public SelectAction
104
    {
105
        public:
106
            FavorAction( KActionCollection *ac, QObject* );
107
    };
108
109
    class RepeatAction : public SelectAction
110
    {
111
        public:
112
            RepeatAction( KActionCollection *ac, QObject* );
113
    };
114
115
    class ReplayGainModeAction : public SelectAction
116
    {
117
        public:
118
            ReplayGainModeAction( KActionCollection *ac, QObject* );
119
    };
120
121
    class EqualizerAction : public SelectAction
122
    {
123
        Q_OBJECT
124
125
        public:
126
            EqualizerAction( KActionCollection *ac, QObject* );
127
128
        public slots:
129
            void updateContent();
130
            void newList();
131
132
        private slots:
133
            void actTrigg( int index );
134
135
        private:
136
            QStringList eqGlobalList();
137
            QList<int> eqCfgGetPresetVal( int mPresetNo );
138
    };
139
140
    class BurnMenu : public KMenu
141
    {
142
        Q_OBJECT
143
144
        public:
145
            BurnMenu( QWidget* parent );
146
            static KMenu *instance();
147
148
        private slots:
149
            void slotBurnCurrentPlaylist();
150
            void slotBurnSelectedTracks();
151
152
        private:
153
            static BurnMenu* s_instance;
154
    };
155
156
157
    class BurnMenuAction : public KAction
158
    {
159
        public:
160
            BurnMenuAction( KActionCollection*, QObject* );
161
            virtual QWidget* createWidget( QWidget* );
162
    };
163
164
    class StopAction : public KAction, public Engine::EngineObserver
165
    {
166
        Q_OBJECT
167
        public:
168
            StopAction( KActionCollection*, QObject* );
169
            virtual void engineStateChanged( Phonon::State, Phonon::State = Phonon::StoppedState );
170
        private slots:
171
            void stop();
172
    };
173
174
    class StopPlayingAfterCurrentTrackAction : public KAction, public Engine::EngineObserver
175
    {
176
        Q_OBJECT
177
        public:
178
            StopPlayingAfterCurrentTrackAction( KActionCollection*, QObject* );
179
            virtual void engineStateChanged( Phonon::State, Phonon::State = Phonon::StoppedState );
180
        private Q_SLOTS:
181
            void stopPlayingAfterCurrentTrack();
182
    };
183
} /* namespace Amarok */
184
185
186
#endif /* AMAROK_ACTIONCLASSES_H */