]> git.sesse.net Git - kdenlive/blob - src/utils/abstractservice.h
Initial support for project metadata (that can be embedded in rendered files)
[kdenlive] / src / utils / abstractservice.h
1 /***************************************************************************
2  *   Copyright (C) 2011 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
19  ***************************************************************************/
20
21
22 #ifndef ABSTRACTSERVICE_H
23 #define ABSTRACTSERVICE_H
24
25
26 #include <QListWidget>
27
28 const int imageRole = Qt::UserRole;
29 const int urlRole = Qt::UserRole + 1;
30 const int downloadRole = Qt::UserRole + 2;
31 const int durationRole = Qt::UserRole + 3;
32 const int previewRole = Qt::UserRole + 4;
33 const int authorRole = Qt::UserRole + 5;
34 const int authorUrl = Qt::UserRole + 6;
35 const int infoUrl = Qt::UserRole + 7;
36 const int infoData = Qt::UserRole + 8;
37 const int idRole = Qt::UserRole + 9;
38 const int licenseRole = Qt::UserRole + 10;
39 const int descriptionRole = Qt::UserRole + 11;
40
41 enum SERVICETYPE { NOSERVICE = 0, FREESOUND = 1, OPENCLIPART = 2 };
42
43 struct OnlineItemInfo {
44     QString imagePreview;
45     QString itemPreview;
46     QString itemName;
47     QString itemDownload;
48     QString itemId;
49     QString infoUrl;
50     QString license;
51     QString author;
52     QString authorUrl;
53     QString description;
54 };
55
56
57 class AbstractService : public QObject
58 {
59     Q_OBJECT
60
61 public:
62     AbstractService(QListWidget *listWidget, QObject * parent = 0);
63     ~AbstractService();
64     /** @brief Get file extension for currently selected item. */
65     virtual QString getExtension(QListWidgetItem *item);
66     /** @brief Get recommanded download file name. */
67     virtual QString getDefaultDownloadName(QListWidgetItem *item);
68         /** @brief Does this service provide a preview (for example preview a sound. */
69     bool hasPreview;
70     /** @brief Does this service provide meta info about the item. */
71     bool hasMetadata;
72     /** @brief The type for this service. */
73     SERVICETYPE serviceType;
74
75 public slots:
76     virtual void slotStartSearch(const QString searchText, int page = 0);
77     virtual OnlineItemInfo displayItemDetails(QListWidgetItem *item);
78     virtual bool startItemPreview(QListWidgetItem *item);
79     virtual void stopItemPreview(QListWidgetItem *item);
80
81 protected:
82     QListWidget *m_listWidget;
83     
84 signals:
85     void searchInfo(const QString &);
86     void maxPages(int);
87     void gotMetaInfo(QMap <QString, QString> info);
88 };
89
90
91 #endif
92