~ubuntu-branches/ubuntu/trusty/tomahawk/trusty-proposed

« back to all changes in this revision

Viewing changes to src/TomahawkApp.h

  • Committer: Package Import Robot
  • Author(s): Harald Sitter
  • Date: 2013-03-07 21:50:13 UTC
  • Revision ID: package-import@ubuntu.com-20130307215013-6gdjkdds7i9uenvs
Tags: upstream-0.6.0+dfsg
ImportĀ upstreamĀ versionĀ 0.6.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 
2
 *
 
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>
 
6
 *
 
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.
 
11
 *
 
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.
 
16
 *
 
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/>.
 
19
 */
 
20
 
 
21
#ifndef TOMAHAWKAPP_H
 
22
#define TOMAHAWKAPP_H
 
23
 
 
24
#define APP TomahawkApp::instance()
 
25
 
 
26
#include "mac/TomahawkApp_Mac.h" // for PlatforInterface
 
27
#include "Typedefs.h"
 
28
#include "utils/TomahawkUtils.h"
 
29
#include "thirdparty/kdsingleapplicationguard/kdsingleapplicationguard.h"
 
30
 
 
31
#include "HeadlessCheck.h"
 
32
#include "config.h"
 
33
 
 
34
#include "QxtHttpServerConnector"
 
35
#include "QxtHttpSessionManager"
 
36
 
 
37
#include <QRegExp>
 
38
#include <QFile>
 
39
#include <QSettings>
 
40
#include <QDir>
 
41
#include <QPersistentModelIndex>
 
42
 
 
43
class AudioEngine;
 
44
class Database;
 
45
class ScanManager;
 
46
class Servent;
 
47
class SipHandler;
 
48
class TomahawkSettings;
 
49
class AudioControls;
 
50
 
 
51
namespace Tomahawk
 
52
{
 
53
    class ShortcutHandler;
 
54
    namespace InfoSystem
 
55
    {
 
56
        class InfoSystem;
 
57
    }
 
58
 
 
59
    namespace Accounts
 
60
    {
 
61
        class AccountManager;
 
62
    }
 
63
}
 
64
 
 
65
#ifdef LIBLASTFM_FOUND
 
66
#include <lastfm/NetworkAccessManager.h>
 
67
#include "Scrobbler.h"
 
68
#endif
 
69
 
 
70
#ifndef TOMAHAWK_HEADLESS
 
71
class TomahawkWindow;
 
72
#endif
 
73
 
 
74
 
 
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
 
79
{
 
80
Q_OBJECT
 
81
 
 
82
public:
 
83
    TomahawkApp( int& argc, char *argv[] );
 
84
    virtual ~TomahawkApp();
 
85
 
 
86
    void init();
 
87
    static TomahawkApp* instance();
 
88
 
 
89
#ifndef ENABLE_HEADLESS
 
90
    AudioControls* audioControls();
 
91
    TomahawkWindow* mainWindow() const;
 
92
#endif
 
93
 
 
94
    // PlatformInterface
 
95
    virtual bool loadUrl( const QString& url );
 
96
 
 
97
    bool isTomahawkLoaded() const;
 
98
 
 
99
    // reimplemented from QApplication/QCoreApplication
 
100
    virtual bool notify( QObject* receiver, QEvent* e );
 
101
 
 
102
signals:
 
103
    void tomahawkLoaded();
 
104
 
 
105
public slots:
 
106
    virtual void activate();
 
107
    void instanceStarted( KDSingleApplicationGuard::Instance );
 
108
 
 
109
private slots:
 
110
    void initServent();
 
111
    void initSIP();
 
112
    void initHTTP();
 
113
 
 
114
    void spotifyApiCheckFinished();
 
115
    void accountManagerReady();
 
116
 
 
117
private:
 
118
    void registerMetaTypes();
 
119
 
 
120
    void printHelp();
 
121
 
 
122
    // Start-up order: database, collection, pipeline, servent, http
 
123
    void initDatabase();
 
124
    void initLocalCollection();
 
125
    void initPipeline();
 
126
 
 
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;
 
135
 
 
136
#ifdef LIBLASTFM_FOUND
 
137
    Scrobbler* m_scrobbler;
 
138
#endif
 
139
 
 
140
#ifndef TOMAHAWK_HEADLESS
 
141
    TomahawkWindow* m_mainwindow;
 
142
#endif
 
143
 
 
144
    bool m_headless, m_loaded;
 
145
 
 
146
    QWeakPointer< QxtHttpServerConnector > m_connector;
 
147
    QWeakPointer< QxtHttpSessionManager > m_session;
 
148
};
 
149
 
 
150
Q_DECLARE_METATYPE( PairList )
 
151
 
 
152
#endif // TOMAHAWKAPP_H