| 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 |
***************************************************************************/ |
| 8 |
|
| 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 |
***************************************************************************/ |
| 17 |
|
| 18 |
#ifndef AMAROK_APP_H |
| 19 |
#define AMAROK_APP_H |
| 20 |
|
| 21 |
#include <config-amarok.h> |
| 22 |
|
| 23 |
#include "amarok_export.h" |
| 24 |
|
| 25 |
#include <KUniqueApplication> //baseclass |
| 26 |
#include <KUrl> |
| 27 |
|
| 28 |
#include <QHash> |
| 29 |
#include <QPointer> |
| 30 |
#include <QString> |
| 31 |
|
| 32 |
namespace Amarok { |
| 33 |
class TrayIcon; |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
namespace KIO { class Job; } |
| 38 |
|
| 39 |
class KJob; |
| 40 |
class MainWindow; |
| 41 |
class MediaDeviceManager; |
| 42 |
class KSplashScreen; |
| 43 |
|
| 44 |
class AMAROK_EXPORT App : public KUniqueApplication |
| 45 |
{ |
| 46 |
Q_OBJECT |
| 47 |
|
| 48 |
public: |
| 49 |
App(); |
| 50 |
~App(); |
| 51 |
|
| 52 |
static App *instance() { return static_cast<App*>( kapp ); } |
| 53 |
|
| 54 |
void setUniqueInstance( bool isUnique ) { m_isUniqueInstance = isUnique; } |
| 55 |
bool isNonUniqueInstance() const { return m_isUniqueInstance; } |
| 56 |
|
| 57 |
Amarok::TrayIcon* trayIcon() { return m_tray; } |
| 58 |
static void handleCliArgs(); |
| 59 |
static void initCliArgs( int argc, char *argv[] ); |
| 60 |
static void initCliArgs(); |
| 61 |
|
| 62 |
static int mainThreadId; |
| 63 |
|
| 64 |
virtual int newInstance(); |
| 65 |
|
| 66 |
inline MainWindow *mainWindow() const { return m_mainWindow; } |
| 67 |
|
| 68 |
// FRIENDS ------ |
| 69 |
friend class MainWindow; //requires access to applySettings() |
| 70 |
|
| 71 |
signals: |
| 72 |
void prepareToQuit(); |
| 73 |
|
| 74 |
private slots: |
| 75 |
void continueInit(); |
| 76 |
|
| 77 |
public slots: |
| 78 |
void applySettings( bool firstTime = false ); |
| 79 |
void slotConfigAmarok( const QString& page = QString() ); |
| 80 |
void slotConfigShortcuts(); |
| 81 |
void slotConfigEqualizer(); |
| 82 |
KIO::Job *trashFiles( const KUrl::List &files ); |
| 83 |
void quit(); |
| 84 |
|
| 85 |
protected: |
| 86 |
bool event( QEvent *event ); |
| 87 |
|
| 88 |
private slots: |
| 89 |
void slotTrashResult( KJob *job ); |
| 90 |
|
| 91 |
private: |
| 92 |
// ATTRIBUTES ------ |
| 93 |
bool m_isUniqueInstance; |
| 94 |
MainWindow *m_mainWindow; |
| 95 |
Amarok::TrayIcon *m_tray; |
| 96 |
MediaDeviceManager *m_mediaDeviceManager; |
| 97 |
KSplashScreen *m_splash; |
| 98 |
}; |
| 99 |
|
| 100 |
#define pApp static_cast<App*>(kapp) |
| 101 |
|
| 102 |
|
| 103 |
#endif // AMAROK_APP_H |