1 | /* smplayer, GUI front-end for mplayer.
|
---|
2 | Copyright (C) 2006-2017 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 FINDSUBTITLESWINDOW_H
|
---|
20 | #define FINDSUBTITLESWINDOW_H
|
---|
21 |
|
---|
22 | #include "ui_findsubtitleswindow.h"
|
---|
23 |
|
---|
24 | #ifdef FS_USE_PROXY
|
---|
25 | #include <QNetworkProxy>
|
---|
26 | #endif
|
---|
27 |
|
---|
28 | class OSClient;
|
---|
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 |
|
---|
42 | class FindSubtitlesWindow : public QWidget, public Ui::FindSubtitlesWindow
|
---|
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);
|
---|
74 | void showLoginFailed();
|
---|
75 | void showSearchFailed();
|
---|
76 | void showErrorOS(int, const QString &);
|
---|
77 | void updateDataReadProgress(int done, int total);
|
---|
78 | void downloadFinished();
|
---|
79 |
|
---|
80 | void updateRefreshButton();
|
---|
81 |
|
---|
82 | void parseInfo();
|
---|
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 |
|
---|
99 | #ifdef FS_USE_PROXY
|
---|
100 | void setProxy(QNetworkProxy proxy);
|
---|
101 | void setupProxy();
|
---|
102 | #endif
|
---|
103 |
|
---|
104 | void saveSettings();
|
---|
105 | void loadSettings();
|
---|
106 |
|
---|
107 | #ifdef DOWNLOAD_SUBS
|
---|
108 | signals:
|
---|
109 | void subtitleDownloaded(const QString & filename);
|
---|
110 |
|
---|
111 | protected:
|
---|
112 | #ifdef USE_QUAZIP
|
---|
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);
|
---|
115 | #else
|
---|
116 | QByteArray gUncompress(const QByteArray &data);
|
---|
117 | #endif
|
---|
118 |
|
---|
119 | protected slots:
|
---|
120 | void fixSubtitles(const QString & filename);
|
---|
121 | #endif
|
---|
122 |
|
---|
123 | protected:
|
---|
124 | OSClient * osclient;
|
---|
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 |
|
---|
138 | // Opensubtitles server
|
---|
139 | QString os_server;
|
---|
140 |
|
---|
141 | #ifdef FS_USE_PROXY
|
---|
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;
|
---|
149 | #endif
|
---|
150 |
|
---|
151 | QSettings * set;
|
---|
152 | };
|
---|
153 |
|
---|
154 | #endif
|
---|
155 |
|
---|