1
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
3
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
4
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
5
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
7
* Tomahawk is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
12
* Tomahawk is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
24
#define APP TomahawkApp::instance()
26
#include "mac/TomahawkApp_Mac.h" // for PlatforInterface
28
#include "utils/TomahawkUtils.h"
29
#include "thirdparty/kdsingleapplicationguard/kdsingleapplicationguard.h"
31
#include "HeadlessCheck.h"
34
#include "QxtHttpServerConnector"
35
#include "QxtHttpSessionManager"
41
#include <QPersistentModelIndex>
48
class TomahawkSettings;
53
class ShortcutHandler;
65
#ifdef LIBLASTFM_FOUND
66
#include <lastfm/NetworkAccessManager.h>
67
#include "Scrobbler.h"
70
#ifndef TOMAHAWK_HEADLESS
75
// this also acts as a a container for important top-level objects
76
// that other parts of the app need to find
77
// (eg, library, pipeline, friends list)
78
class TomahawkApp : public TOMAHAWK_APPLICATION, public Tomahawk::PlatformInterface
83
TomahawkApp( int& argc, char *argv[] );
84
virtual ~TomahawkApp();
87
static TomahawkApp* instance();
89
#ifndef ENABLE_HEADLESS
90
AudioControls* audioControls();
91
TomahawkWindow* mainWindow() const;
95
virtual bool loadUrl( const QString& url );
97
bool isTomahawkLoaded() const;
99
// reimplemented from QApplication/QCoreApplication
100
virtual bool notify( QObject* receiver, QEvent* e );
103
void tomahawkLoaded();
106
virtual void activate();
107
void instanceStarted( KDSingleApplicationGuard::Instance );
114
void spotifyApiCheckFinished();
115
void accountManagerReady();
118
void registerMetaTypes();
122
// Start-up order: database, collection, pipeline, servent, http
124
void initLocalCollection();
127
QWeakPointer<Database> m_database;
128
QWeakPointer<ScanManager> m_scanManager;
129
QWeakPointer<AudioEngine> m_audioEngine;
130
QWeakPointer<Servent> m_servent;
131
QWeakPointer<Tomahawk::InfoSystem::InfoSystem> m_infoSystem;
132
QWeakPointer<Tomahawk::ShortcutHandler> m_shortcutHandler;
133
QWeakPointer< Tomahawk::Accounts::AccountManager > m_accountManager;
134
bool m_scrubFriendlyName;
136
#ifdef LIBLASTFM_FOUND
137
Scrobbler* m_scrobbler;
140
#ifndef TOMAHAWK_HEADLESS
141
TomahawkWindow* m_mainwindow;
144
bool m_headless, m_loaded;
146
QWeakPointer< QxtHttpServerConnector > m_connector;
147
QWeakPointer< QxtHttpSessionManager > m_session;
150
Q_DECLARE_METATYPE( PairList )
152
#endif // TOMAHAWKAPP_H