[140] | 1 | /* smplayer, GUI front-end for mplayer.
|
---|
[188] | 2 | Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
[140] | 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 | class OSSubtitle {
|
---|
| 25 | public:
|
---|
| 26 | QString movie, releasename, link, iso639, language, date;
|
---|
| 27 | QString format, comments, detail, rating, files, user;
|
---|
| 28 | };
|
---|
| 29 |
|
---|
| 30 | class OSClient : public QObject {
|
---|
| 31 | Q_OBJECT
|
---|
| 32 |
|
---|
| 33 | public:
|
---|
| 34 | OSClient(QObject* parent = 0);
|
---|
[176] | 35 |
|
---|
| 36 | QList<OSSubtitle> subtitleList() { return s_list; };
|
---|
| 37 |
|
---|
| 38 | #ifdef FS_USE_PROXY
|
---|
[140] | 39 | void setProxy(const QNetworkProxy & proxy);
|
---|
[176] | 40 | #endif
|
---|
[140] | 41 |
|
---|
[176] | 42 | #ifdef OS_SEARCH_WORKAROUND
|
---|
| 43 | void setRetries(int n) { search_retries = n; };
|
---|
| 44 | int retries() { return search_retries; };
|
---|
| 45 | #endif
|
---|
| 46 |
|
---|
[140] | 47 | public slots:
|
---|
| 48 | void setServer(const QString & server);
|
---|
| 49 | void search(const QString & hash, qint64 file_size);
|
---|
| 50 |
|
---|
| 51 | private slots:
|
---|
| 52 | void login();
|
---|
| 53 | void doSearch();
|
---|
[170] | 54 | #ifdef OS_SEARCH_WORKAROUND
|
---|
| 55 | void doSearch(int nqueries);
|
---|
| 56 | #endif
|
---|
[140] | 57 |
|
---|
| 58 | void gotFault(int, const QString &);
|
---|
| 59 |
|
---|
| 60 | void responseLogin(QVariant &);
|
---|
| 61 | void responseSearch(QVariant &);
|
---|
| 62 |
|
---|
| 63 | signals:
|
---|
| 64 | void loggedIn();
|
---|
| 65 | void loginFailed();
|
---|
| 66 | void searchFinished();
|
---|
| 67 | void searchFailed();
|
---|
| 68 | void errorFound(int, const QString &);
|
---|
| 69 |
|
---|
| 70 | private:
|
---|
| 71 | MaiaXmlRpcClient *rpc;
|
---|
| 72 | QString token;
|
---|
| 73 | bool logged_in;
|
---|
| 74 | QString search_hash;
|
---|
| 75 | qint64 search_size;
|
---|
[170] | 76 | #ifdef OS_SEARCH_WORKAROUND
|
---|
| 77 | int best_search_count;
|
---|
[176] | 78 | int search_retries;
|
---|
[170] | 79 | #endif
|
---|
[140] | 80 | QList <OSSubtitle> s_list;
|
---|
| 81 | };
|
---|
| 82 |
|
---|
| 83 | #endif
|
---|