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