1 | /* smplayer, GUI front-end for mplayer.
|
---|
2 | Copyright (C) 2006-2014 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
3 |
|
---|
4 | This program is free software; you can redistribute it and/or modify
|
---|
5 | it under the terms of the GNU General Public License as published by
|
---|
6 | the Free Software Foundation; either version 2 of the License, or
|
---|
7 | (at your option) any later version.
|
---|
8 |
|
---|
9 | This program is distributed in the hope that it will be useful,
|
---|
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
12 | GNU General Public License for more details.
|
---|
13 |
|
---|
14 | You should have received a copy of the GNU General Public License
|
---|
15 | along with this program; if not, write to the Free Software
|
---|
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef OSCLIENT_H
|
---|
20 | #define OSCLIENT_H
|
---|
21 |
|
---|
22 | #include "maiaXmlRpcClient.h"
|
---|
23 |
|
---|
24 | #define OS_SEARCH_WORKAROUND
|
---|
25 |
|
---|
26 | class OSSubtitle {
|
---|
27 | public:
|
---|
28 | QString movie, releasename, link, iso639, language, date;
|
---|
29 | QString format, comments, detail, rating, files, user;
|
---|
30 | };
|
---|
31 |
|
---|
32 | class OSClient : public QObject {
|
---|
33 | Q_OBJECT
|
---|
34 |
|
---|
35 | public:
|
---|
36 | OSClient(QObject* parent = 0);
|
---|
37 | void setProxy(const QNetworkProxy & proxy);
|
---|
38 |
|
---|
39 | public slots:
|
---|
40 | void setServer(const QString & server);
|
---|
41 | void search(const QString & hash, qint64 file_size);
|
---|
42 | QList<OSSubtitle> subtitleList() { return s_list; };
|
---|
43 |
|
---|
44 | private slots:
|
---|
45 | void login();
|
---|
46 | void doSearch();
|
---|
47 | #ifdef OS_SEARCH_WORKAROUND
|
---|
48 | void doSearch(int nqueries);
|
---|
49 | #endif
|
---|
50 |
|
---|
51 | void gotFault(int, const QString &);
|
---|
52 |
|
---|
53 | void responseLogin(QVariant &);
|
---|
54 | void responseSearch(QVariant &);
|
---|
55 |
|
---|
56 | signals:
|
---|
57 | void loggedIn();
|
---|
58 | void loginFailed();
|
---|
59 | void searchFinished();
|
---|
60 | void searchFailed();
|
---|
61 | void errorFound(int, const QString &);
|
---|
62 |
|
---|
63 | private:
|
---|
64 | MaiaXmlRpcClient *rpc;
|
---|
65 | QString token;
|
---|
66 | bool logged_in;
|
---|
67 | QString search_hash;
|
---|
68 | qint64 search_size;
|
---|
69 | #ifdef OS_SEARCH_WORKAROUND
|
---|
70 | int best_search_count;
|
---|
71 | #endif
|
---|
72 | QList <OSSubtitle> s_list;
|
---|
73 | };
|
---|
74 |
|
---|
75 | #endif
|
---|