File indexing completed on 2024-04-21 04:47:48
0001 /**************************************************************************************** 0002 * Copyright (c) 2004 Max Howell <max.howell@methylblue.com> * 0003 * Copyright (c) 2008 Mark Kretschmann <kretschmann@kde.org> * 0004 * Copyright (c) 2009 Artur Szymiec <artur.szymiec@gmail.com> * 0005 * * 0006 * This program is free software; you can redistribute it and/or modify it under * 0007 * the terms of the GNU General Public License as published by the Free Software * 0008 * Foundation; either version 2 of the License, or (at your option) any later * 0009 * version. * 0010 * * 0011 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0012 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0013 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License along with * 0016 * this program. If not, see <http://www.gnu.org/licenses/>. * 0017 ****************************************************************************************/ 0018 0019 #ifndef AMAROK_ACTIONCLASSES_H 0020 #define AMAROK_ACTIONCLASSES_H 0021 0022 #include <QAction> 0023 #include <QMenu> 0024 0025 #include <KSelectAction> 0026 #include <KToggleAction> 0027 0028 #include <phonon/Global> 0029 0030 class KActionCollection; 0031 class KHelpMenu; 0032 0033 0034 namespace Amarok 0035 { 0036 class Menu : public QMenu 0037 { 0038 Q_OBJECT 0039 public: 0040 explicit Menu( QWidget* parent ); 0041 static Menu *instance(); 0042 static QMenu *helpMenu( QWidget *parent = nullptr ); 0043 0044 private: 0045 static Menu *s_instance; 0046 static KHelpMenu *s_helpMenu; 0047 }; 0048 0049 class MenuAction : public QAction 0050 { 0051 public: 0052 MenuAction( KActionCollection*, QObject* ); 0053 0054 /** 0055 * Indicate whether the user may configure the action's shortcut. 0056 */ 0057 void setShortcutConfigurable(bool configurable); 0058 }; 0059 0060 class PlayPauseAction : public KToggleAction 0061 { 0062 Q_OBJECT 0063 0064 public: 0065 explicit PlayPauseAction( KActionCollection*, QObject* ); 0066 0067 private Q_SLOTS: 0068 void stopped(); 0069 void paused(); 0070 void playing(); 0071 }; 0072 0073 class ToggleAction : public KToggleAction 0074 { 0075 public: 0076 ToggleAction( const QString &text, void ( *f ) ( bool ), KActionCollection* const ac, const char *name, QObject *parent ); 0077 virtual void setChecked( bool b ); 0078 virtual void setEnabled( bool b ); 0079 0080 private: 0081 void ( *m_function ) ( bool ); 0082 }; 0083 0084 class SelectAction : public KSelectAction 0085 { 0086 Q_OBJECT 0087 0088 public: 0089 SelectAction( const QString &text, void ( *f ) ( int ), KActionCollection* const ac, const char *name, QObject *parent ); 0090 0091 virtual void setCurrentItem( int n ); 0092 virtual void setEnabled( bool b ); 0093 virtual void setIcons( QStringList icons ); 0094 virtual QString currentText() const; 0095 QStringList icons() const; 0096 QString currentIcon() const; 0097 0098 protected Q_SLOTS: 0099 void actionTriggered( QAction *a ) override; 0100 0101 private: 0102 void ( *m_function ) ( int ); 0103 QStringList m_icons; 0104 }; 0105 0106 class RandomAction : public SelectAction 0107 { 0108 public: 0109 RandomAction( KActionCollection *ac, QObject* ); 0110 void setCurrentItem( int n ) override; 0111 }; 0112 0113 class FavorAction : public SelectAction 0114 { 0115 public: 0116 FavorAction( KActionCollection *ac, QObject* ); 0117 }; 0118 0119 class RepeatAction : public SelectAction 0120 { 0121 public: 0122 RepeatAction( KActionCollection *ac, QObject* ); 0123 }; 0124 0125 class ReplayGainModeAction : public SelectAction 0126 { 0127 public: 0128 ReplayGainModeAction( KActionCollection *ac, QObject* ); 0129 }; 0130 0131 class BurnMenu : public QMenu 0132 { 0133 Q_OBJECT 0134 0135 public: 0136 explicit BurnMenu( QWidget* parent ); 0137 static QMenu *instance(); 0138 0139 private Q_SLOTS: 0140 void slotBurnCurrentPlaylist(); 0141 void slotBurnSelectedTracks(); 0142 0143 private: 0144 static BurnMenu* s_instance; 0145 }; 0146 0147 0148 class BurnMenuAction : public QAction 0149 { 0150 public: 0151 BurnMenuAction( KActionCollection*, QObject* ); 0152 virtual QWidget* createWidget( QWidget* ); 0153 }; 0154 0155 class StopAction : public QAction 0156 { 0157 Q_OBJECT 0158 public: 0159 StopAction( KActionCollection*, QObject* ); 0160 0161 private Q_SLOTS: 0162 void stopped(); 0163 void playing(); 0164 void stop(); 0165 }; 0166 0167 class StopPlayingAfterCurrentTrackAction : public QAction 0168 { 0169 Q_OBJECT 0170 public: 0171 StopPlayingAfterCurrentTrackAction( KActionCollection*, QObject* ); 0172 0173 private Q_SLOTS: 0174 void stopPlayingAfterCurrentTrack(); 0175 }; 0176 } /* namespace Amarok */ 0177 0178 0179 #endif /* AMAROK_ACTIONCLASSES_H */ 0180