File indexing completed on 2025-01-05 04:25:41
0001 /**************************************************************************************** 0002 * Copyright (c) 2007 Nikolaj Hald Nielsen <nhn@kde.org> * 0003 * Copyright (c) 2007 Leo Franchi <lfranchi@gmail.com> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify it under * 0006 * the terms of the GNU General Public License as published by the Free Software * 0007 * Foundation; either version 2 of the License, or (at your option) any later * 0008 * version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0011 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0012 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License along with * 0015 * this program. If not, see <http://www.gnu.org/licenses/>. * 0016 ****************************************************************************************/ 0017 0018 #ifndef AMAROK_INFO_ENGINE 0019 #define AMAROK_INFO_ENGINE 0020 0021 #include "browsers/InfoObserver.h" 0022 0023 #include <QObject> 0024 #include <QVariantMap> 0025 0026 /** 0027 This class provides context information related to the currently active service 0028 0029 There is no data source: if you connect to the engine, you immediately 0030 start getting updates when there is data. 0031 0032 The key of the data is "service". 0033 The data is a QMap with the keys 0034 * service_name - the name of the currently running service 0035 0036 0037 */ 0038 0039 class InfoEngine : public QObject, 0040 public InfoObserver 0041 { 0042 Q_OBJECT 0043 Q_PROPERTY(QString serviceName READ serviceName NOTIFY serviceChanged) 0044 Q_PROPERTY(QString mainInfo READ mainInfo NOTIFY serviceChanged) 0045 0046 public: 0047 0048 explicit InfoEngine( QObject* parent = nullptr ); 0049 ~InfoEngine(); 0050 0051 QString serviceName() const { return m_storedInfo.value("service_name").toString(); } 0052 QString mainInfo() const; 0053 0054 void infoChanged( QVariantMap infoMap ); 0055 0056 Q_SIGNALS: 0057 void serviceChanged(); 0058 0059 private: 0060 QVariantMap m_storedInfo; 0061 static QString s_standardContent; 0062 }; 0063 0064 #endif