| 1 |
/*************************************************************************** |
| 2 |
* Copyright (C) 2004 by Max Howell <max.howell@methylblue.com> * |
| 3 |
* Copyright (C) 2008 by Mark Kretschmann <kretschmann@kde.org> * |
| 4 |
* * |
| 5 |
* This program is free software; you can redistribute it and/or modify * |
| 6 |
* it under the terms of the GNU General Public License as published by * |
| 7 |
* the Free Software Foundation; either version 2 of the License, or * |
| 8 |
* (at your option) any later version. * |
| 9 |
* * |
| 10 |
***************************************************************************/ |
| 11 |
|
| 12 |
#ifndef AMAROK_ACTIONCLASSES_H |
| 13 |
#define AMAROK_ACTIONCLASSES_H |
| 14 |
|
| 15 |
#include "EngineObserver.h" |
| 16 |
#include "widgets/SliderWidget.h" |
| 17 |
|
| 18 |
#include <KAction> |
| 19 |
#include <KMenu> |
| 20 |
#include <KToggleAction> |
| 21 |
#include <KSelectAction> |
| 22 |
|
| 23 |
#include <QPointer> |
| 24 |
|
| 25 |
class KActionCollection; |
| 26 |
class KHelpMenu; |
| 27 |
|
| 28 |
|
| 29 |
namespace Amarok |
| 30 |
{ |
| 31 |
class Menu : public KMenu |
| 32 |
{ |
| 33 |
Q_OBJECT |
| 34 |
public: |
| 35 |
Menu( QWidget* parent ); |
| 36 |
static Menu *instance(); |
| 37 |
static KMenu *helpMenu( QWidget *parent = 0 ); |
| 38 |
|
| 39 |
private: |
| 40 |
static Menu *s_instance; |
| 41 |
static KHelpMenu *s_helpMenu; |
| 42 |
}; |
| 43 |
|
| 44 |
class MenuAction : public KAction |
| 45 |
{ |
| 46 |
public: |
| 47 |
MenuAction( KActionCollection*, QObject* ); |
| 48 |
}; |
| 49 |
|
| 50 |
class PlayPauseAction : public KToggleAction, public EngineObserver |
| 51 |
{ |
| 52 |
public: |
| 53 |
PlayPauseAction( KActionCollection*, QObject* ); |
| 54 |
virtual void engineStateChanged( Phonon::State, Phonon::State = Phonon::StoppedState ); |
| 55 |
}; |
| 56 |
|
| 57 |
class ToggleAction : public KToggleAction |
| 58 |
{ |
| 59 |
public: |
| 60 |
ToggleAction( const QString &text, void ( *f ) ( bool ), KActionCollection* const ac, const char *name, QObject *parent ); |
| 61 |
|
| 62 |
virtual void setChecked( bool b ); |
| 63 |
|
| 64 |
virtual void setEnabled( bool b ); |
| 65 |
|
| 66 |
private: |
| 67 |
void ( *m_function ) ( bool ); |
| 68 |
}; |
| 69 |
|
| 70 |
class SelectAction : public KSelectAction |
| 71 |
{ |
| 72 |
Q_OBJECT |
| 73 |
|
| 74 |
public: |
| 75 |
SelectAction( const QString &text, void ( *f ) ( int ), KActionCollection* const ac, const char *name, QObject *parent ); |
| 76 |
|
| 77 |
virtual void setCurrentItem( int n ); |
| 78 |
virtual void setEnabled( bool b ); |
| 79 |
virtual void setIcons( QStringList icons ); |
| 80 |
virtual QString currentText() const; |
| 81 |
QStringList icons() const; |
| 82 |
QString currentIcon() const; |
| 83 |
|
| 84 |
protected slots: |
| 85 |
virtual void actionTriggered( QAction *a ); |
| 86 |
|
| 87 |
private: |
| 88 |
void ( *m_function ) ( int ); |
| 89 |
QStringList m_icons; |
| 90 |
}; |
| 91 |
|
| 92 |
class RandomAction : public SelectAction |
| 93 |
{ |
| 94 |
public: |
| 95 |
RandomAction( KActionCollection *ac, QObject* ); |
| 96 |
virtual void setCurrentItem( int n ); |
| 97 |
}; |
| 98 |
|
| 99 |
class FavorAction : public SelectAction |
| 100 |
{ |
| 101 |
public: |
| 102 |
FavorAction( KActionCollection *ac, QObject* ); |
| 103 |
}; |
| 104 |
|
| 105 |
class RepeatAction : public SelectAction |
| 106 |
{ |
| 107 |
public: |
| 108 |
RepeatAction( KActionCollection *ac, QObject* ); |
| 109 |
}; |
| 110 |
|
| 111 |
class ReplayGainModeAction : public SelectAction |
| 112 |
{ |
| 113 |
public: |
| 114 |
ReplayGainModeAction( KActionCollection *ac, QObject* ); |
| 115 |
}; |
| 116 |
|
| 117 |
class BurnMenu : public KMenu |
| 118 |
{ |
| 119 |
Q_OBJECT |
| 120 |
|
| 121 |
public: |
| 122 |
BurnMenu( QWidget* parent ); |
| 123 |
static KMenu *instance(); |
| 124 |
|
| 125 |
private slots: |
| 126 |
void slotBurnCurrentPlaylist(); |
| 127 |
void slotBurnSelectedTracks(); |
| 128 |
|
| 129 |
private: |
| 130 |
static BurnMenu* s_instance; |
| 131 |
}; |
| 132 |
|
| 133 |
|
| 134 |
class BurnMenuAction : public KAction |
| 135 |
{ |
| 136 |
public: |
| 137 |
BurnMenuAction( KActionCollection*, QObject* ); |
| 138 |
virtual QWidget* createWidget( QWidget* ); |
| 139 |
}; |
| 140 |
|
| 141 |
class StopAction : public KAction, public EngineObserver |
| 142 |
{ |
| 143 |
public: |
| 144 |
StopAction( KActionCollection*, QObject* ); |
| 145 |
virtual void engineStateChanged( Phonon::State, Phonon::State = Phonon::StoppedState ); |
| 146 |
}; |
| 147 |
|
| 148 |
} /* namespace Amarok */ |
| 149 |
|
| 150 |
|
| 151 |
#endif /* AMAROK_ACTIONCLASSES_H */ |