Debian Codegraph @

src/context/applets/info/plugin/InfoEngine.h

raw
1 /****************************************************************************************
2 * Copyright (c) 2007 Nikolaj Hald Nielsen <[email protected]> *
3 * Copyright (c) 2007 Leo Franchi <[email protected]> *
4 * *
5 * This program is free software; you can redistribute it and/or modify it under *
6 * the terms of the GNU General Public License as published by the Free Software *
7 * Foundation; either version 2 of the License, or (at your option) any later *
8 * version. *
9 * *
10 * This program is distributed in the hope that it will be useful, but WITHOUT ANY *
11 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
12 * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License along with *
15 * this program. If not, see <http://www.gnu.org/licenses/>. *
16 ****************************************************************************************/
17
18 #ifndef AMAROK_INFO_ENGINE
19 #define AMAROK_INFO_ENGINE
20
21 #include "browsers/InfoObserver.h"
22
23 #include <QObject>
24 #include <QVariantMap>
25
26 /**
27 This class provides context information related to the currently active service
28
29 There is no data source: if you connect to the engine, you immediately
30 start getting updates when there is data.
31
32 The key of the data is "service".
33 The data is a QMap with the keys
34 * service_name - the name of the currently running service
35
36
37 */
38
39 class InfoEngine : public QObject,
40 public InfoObserver
41 {
42 Q_OBJECT
43 Q_PROPERTY(QString serviceName READ serviceName NOTIFY serviceChanged)
44 Q_PROPERTY(QString mainInfo READ mainInfo NOTIFY serviceChanged)
45
46 public:
47
48 explicit InfoEngine( QObject* parent = nullptr );
49 ~InfoEngine();
50
51 QString serviceName() const { return m_storedInfo.value("service_name").toString(); }
52 QString mainInfo() const;
53
54 void infoChanged( QVariantMap infoMap );
55
56 Q_SIGNALS:
57 void serviceChanged();
58
59 private:
60 QVariantMap m_storedInfo;
61 static QString s_standardContent;
62 };
63
64 #endif