File indexing completed on 2024-04-14 05:38:08

0001 /***************************************************************************
0002  *   Copyright (C) 2010 by Daniel Nicoletti <dantti12@gmail.com>           *
0003  *   Copyright (C) 2012-2013 by Matthias Klumpp <matthias@tenstral.net>    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or         *
0006  *   modify it under the terms of the GNU General Public License as        *
0007  *   published by the Free Software Foundation; either version 2 of        *
0008  *   the License or (at your option) version 3 or any later version        *
0009  *   accepted by the membership of KDE e.V. (or its successor approved     *
0010  *   by the membership of KDE e.V.), which shall act as a proxy            *
0011  *   defined in Section 14 of version 3 of the license.                    *
0012  *                                                                         *
0013  *   This program is distributed in the hope that it will be useful,       *
0014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0016  *   GNU General Public License for more details.                          *
0017  *                                                                         *
0018  *   You should have received a copy of the GNU General Public License     *
0019  *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
0020  ***************************************************************************/
0021 
0022 #ifndef APPSTREAM_H
0023 #define APPSTREAM_H
0024 
0025 #include "CategoryMatcher.h"
0026 
0027 #include <AppStreamQt5/component.h>
0028 
0029 #include <QObject>
0030 #include <QHash>
0031 
0032 namespace AppStream {
0033 class Pool;
0034 }
0035 
0036 struct _AsScreenshotService;
0037 typedef struct _AsScreenshotService AsScreenshotService;
0038 
0039 class Q_DECL_EXPORT AppStreamHelper : public QObject {
0040     public:
0041         static AppStreamHelper* instance();
0042         virtual ~AppStreamHelper();
0043         bool open();
0044 
0045         QList<AppStream::Component> applications(const QString &pkgName) const;
0046         QString genericIcon(const QString &pkgName) const;
0047         QStringList findPkgNames(const CategoryMatcher &parser) const;
0048         QUrl thumbnail(const QString &pkgName) const;
0049         QUrl screenshot(const QString &pkgName) const;
0050 
0051     private:
0052         explicit AppStreamHelper(QObject *parent = 0);
0053         AppStream::Pool *m_pool;
0054 
0055         QHash<QString, AppStream::Component> m_appInfo;
0056         static AppStreamHelper         *m_instance;
0057 };
0058 
0059 #endif // APPSTREAM_H