[114] | 1 | /* smplayer, GUI front-end for mplayer.
|
---|
[188] | 2 | Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
[114] | 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 |
|
---|
[176] | 19 | #ifndef FINDSUBTITLESWINDOW_H
|
---|
| 20 | #define FINDSUBTITLESWINDOW_H
|
---|
[114] | 21 |
|
---|
| 22 | #include "ui_findsubtitleswindow.h"
|
---|
[176] | 23 |
|
---|
| 24 | #ifdef FS_USE_PROXY
|
---|
[114] | 25 | #include <QNetworkProxy>
|
---|
[176] | 26 | #endif
|
---|
[114] | 27 |
|
---|
[142] | 28 | class OSClient;
|
---|
[114] | 29 | class QStandardItemModel;
|
---|
| 30 | class QSortFilterProxyModel;
|
---|
| 31 | class QModelIndex;
|
---|
| 32 | class QMenu;
|
---|
| 33 | class QAction;
|
---|
| 34 | class QSettings;
|
---|
| 35 |
|
---|
| 36 | #ifdef DOWNLOAD_SUBS
|
---|
| 37 | class FileDownloader;
|
---|
| 38 | class QBuffer;
|
---|
| 39 | class QuaZip;
|
---|
| 40 | #endif
|
---|
| 41 |
|
---|
[181] | 42 | class FindSubtitlesWindow : public QWidget, public Ui::FindSubtitlesWindow
|
---|
[114] | 43 | {
|
---|
| 44 | Q_OBJECT
|
---|
| 45 |
|
---|
| 46 | public:
|
---|
| 47 | FindSubtitlesWindow( QWidget * parent = 0, Qt::WindowFlags f = 0 );
|
---|
| 48 | ~FindSubtitlesWindow();
|
---|
| 49 |
|
---|
| 50 | QString language();
|
---|
| 51 | #ifdef DOWNLOAD_SUBS
|
---|
| 52 | bool includeLangOnFilename() { return include_lang_on_filename; };
|
---|
| 53 | #endif
|
---|
| 54 |
|
---|
| 55 | void setSettings(QSettings * settings);
|
---|
| 56 | QSettings * settings() { return set; };
|
---|
| 57 |
|
---|
| 58 | public slots:
|
---|
| 59 | void setMovie(QString filename);
|
---|
| 60 | void setLanguage(const QString & lang);
|
---|
| 61 | void refresh();
|
---|
| 62 | void download();
|
---|
| 63 | void copyLink();
|
---|
| 64 | #ifdef DOWNLOAD_SUBS
|
---|
| 65 | void setIncludeLangOnFilename(bool b) { include_lang_on_filename = b; };
|
---|
| 66 | #endif
|
---|
| 67 |
|
---|
| 68 | protected slots:
|
---|
| 69 | void applyFilter(const QString & filter);
|
---|
| 70 | void applyCurrentFilter();
|
---|
| 71 |
|
---|
| 72 | void showError(QString error);
|
---|
| 73 | void connecting(QString host);
|
---|
[142] | 74 | void showLoginFailed();
|
---|
| 75 | void showSearchFailed();
|
---|
[156] | 76 | void showErrorOS(int, const QString &);
|
---|
[114] | 77 | void updateDataReadProgress(int done, int total);
|
---|
| 78 | void downloadFinished();
|
---|
| 79 |
|
---|
| 80 | void updateRefreshButton();
|
---|
| 81 |
|
---|
[142] | 82 | void parseInfo();
|
---|
[114] | 83 |
|
---|
| 84 | void itemActivated(const QModelIndex & index );
|
---|
| 85 | void currentItemChanged(const QModelIndex & current, const QModelIndex & previous);
|
---|
| 86 |
|
---|
| 87 | void showContextMenu(const QPoint & pos);
|
---|
| 88 |
|
---|
| 89 | #ifdef DOWNLOAD_SUBS
|
---|
| 90 | void archiveDownloaded(const QByteArray & buffer);
|
---|
| 91 | #endif
|
---|
| 92 |
|
---|
| 93 | void on_configure_button_clicked();
|
---|
| 94 |
|
---|
| 95 | protected:
|
---|
| 96 | virtual void retranslateStrings();
|
---|
| 97 | virtual void changeEvent(QEvent * event);
|
---|
| 98 |
|
---|
[176] | 99 | #ifdef FS_USE_PROXY
|
---|
[114] | 100 | void setProxy(QNetworkProxy proxy);
|
---|
| 101 | void setupProxy();
|
---|
[176] | 102 | #endif
|
---|
[114] | 103 |
|
---|
| 104 | void saveSettings();
|
---|
| 105 | void loadSettings();
|
---|
| 106 |
|
---|
| 107 | #ifdef DOWNLOAD_SUBS
|
---|
| 108 | signals:
|
---|
| 109 | void subtitleDownloaded(const QString & filename);
|
---|
| 110 |
|
---|
| 111 | protected:
|
---|
[156] | 112 | #ifdef USE_QUAZIP
|
---|
[114] | 113 | bool uncompressZip(const QString & filename, const QString & output_path, const QString & preferred_output_name);
|
---|
| 114 | bool extractFile(QuaZip & zip, const QString & filename, const QString & output_name);
|
---|
[156] | 115 | #else
|
---|
| 116 | QByteArray gUncompress(const QByteArray &data);
|
---|
| 117 | #endif
|
---|
[132] | 118 |
|
---|
| 119 | protected slots:
|
---|
| 120 | void fixSubtitles(const QString & filename);
|
---|
[114] | 121 | #endif
|
---|
| 122 |
|
---|
| 123 | protected:
|
---|
[142] | 124 | OSClient * osclient;
|
---|
[114] | 125 | QStandardItemModel * table;
|
---|
| 126 | QSortFilterProxyModel * proxy_model;
|
---|
| 127 | QString last_file;
|
---|
| 128 |
|
---|
| 129 | QMenu * context_menu;
|
---|
| 130 | QAction * downloadAct;
|
---|
| 131 | QAction * copyLinkAct;
|
---|
| 132 |
|
---|
| 133 | #ifdef DOWNLOAD_SUBS
|
---|
| 134 | FileDownloader * file_downloader;
|
---|
| 135 | bool include_lang_on_filename;
|
---|
| 136 | #endif
|
---|
| 137 |
|
---|
[124] | 138 | // Opensubtitles server
|
---|
| 139 | QString os_server;
|
---|
| 140 |
|
---|
[176] | 141 | #ifdef FS_USE_PROXY
|
---|
[114] | 142 | // Proxy
|
---|
| 143 | bool use_proxy;
|
---|
| 144 | int proxy_type;
|
---|
| 145 | QString proxy_host;
|
---|
| 146 | int proxy_port;
|
---|
| 147 | QString proxy_username;
|
---|
| 148 | QString proxy_password;
|
---|
[176] | 149 | #endif
|
---|
[114] | 150 |
|
---|
| 151 | QSettings * set;
|
---|
| 152 | };
|
---|
| 153 |
|
---|
| 154 | #endif
|
---|
| 155 |
|
---|