Revert previous commit, was incorrect
[amarok.git] / src / app.h
blob48696e0356d32ed739b60212bc84f6b183c9a09b
1 /***************************************************************************
2 app.h - description
3 -------------------
4 begin : Mit Okt 23 14:35:18 CEST 2002
5 copyright : (C) 2002 by Mark Kretschmann
6 email : markey@web.de
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef AMAROK_APP_H
19 #define AMAROK_APP_H
21 #include "config-amarok.h"
23 #include "amarok_export.h"
24 #include "engineobserver.h" //baseclass
25 #include <KUniqueApplication> //baseclass
26 #include <KUrl>
28 #include <QByteArray>
30 namespace Amarok {
31 class TrayIcon;
35 namespace KIO { class Job; }
37 class KJob;
38 class MetaBundle;
39 class MainWindow;
40 class MediaDeviceManager;
41 class KSplashScreen;
43 class AMAROK_EXPORT App : public KUniqueApplication, public EngineObserver
45 Q_OBJECT
46 public:
47 App();
48 ~App();
50 static App *instance() { return static_cast<App*>( kapp ); }
52 static void handleCliArgs();
53 static void initCliArgs( int argc, char *argv[] );
55 static int mainThreadId;
57 inline MainWindow *mainWindow() const { return m_mainWindow; }
59 // FRIENDS ------
60 friend class MainWindow; //requires access to applySettings()
62 signals:
63 void useScores( bool use );
64 void useRatings( bool use );
65 void moodbarPrefs( bool show, bool moodier, int alter, bool withMusic );
66 void prepareToQuit();
67 protected: /* for OSD, tray, and dcop */
68 void engineStateChanged( Engine::State state, Engine::State oldState = Engine::Empty );
69 void engineNewMetaData( const MetaBundle &bundle, bool trackChanged );
70 void engineTrackPositionChanged( long position, bool /*userSeek*/ );
71 void engineVolumeChanged( int );
73 private slots:
74 void setRating1() { setRating( 1 ); }
75 void setRating2() { setRating( 2 ); }
76 void setRating3() { setRating( 3 ); }
77 void setRating4() { setRating( 4 ); }
78 void setRating5() { setRating( 5 ); }
79 void continueInit();
81 public slots:
82 void applySettings( bool firstTime = false );
83 void slotConfigAmarok( const QByteArray& page = QByteArray() );
84 void slotConfigShortcuts();
85 void slotConfigToolBars();
86 void slotConfigEqualizer();
87 void setUseScores( bool use );
88 void setUseRatings( bool use );
89 void setMoodbarPrefs( bool show, bool moodier, int alter, bool withMusic );
90 KIO::Job *trashFiles( const KUrl::List &files );
91 void quit();
93 private slots:
94 void slotTrashResult( KJob *job );
96 private:
97 void initGlobalShortcuts();
99 void setRating( int n );
101 // ATTRIBUTES ------
102 MainWindow *m_mainWindow;
103 #ifndef Q_WS_MAC
104 Amarok::TrayIcon *m_tray;
105 #endif
106 MediaDeviceManager *m_mediaDeviceManager;
107 KSplashScreen *m_splash;
110 #define pApp static_cast<App*>(kapp)
113 #endif // AMAROK_APP_H