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 _FINDSUBTITLESWINDOW_H_
|
---|
20 | #define _FINDSUBTITLESWINDOW_H_
|
---|
21 |
|
---|
22 | #include "ui_findsubtitleswindow.h"
|
---|
23 | #include <QNetworkProxy>
|
---|
24 |
|
---|
25 | class OSClient;
|
---|
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 showLoginFailed();
|
---|
72 | void showSearchFailed();
|
---|
73 | void showErrorOS(int, const QString &);
|
---|
74 | void updateDataReadProgress(int done, int total);
|
---|
75 | void downloadFinished();
|
---|
76 |
|
---|
77 | void updateRefreshButton();
|
---|
78 |
|
---|
79 | void parseInfo();
|
---|
80 |
|
---|
81 | void itemActivated(const QModelIndex & index );
|
---|
82 | void currentItemChanged(const QModelIndex & current, const QModelIndex & previous);
|
---|
83 |
|
---|
84 | void showContextMenu(const QPoint & pos);
|
---|
85 |
|
---|
86 | #ifdef DOWNLOAD_SUBS
|
---|
87 | void archiveDownloaded(const QByteArray & buffer);
|
---|
88 | #endif
|
---|
89 |
|
---|
90 | void on_configure_button_clicked();
|
---|
91 |
|
---|
92 | protected:
|
---|
93 | virtual void retranslateStrings();
|
---|
94 | virtual void changeEvent(QEvent * event);
|
---|
95 |
|
---|
96 | void setProxy(QNetworkProxy proxy);
|
---|
97 | void setupProxy();
|
---|
98 |
|
---|
99 | void saveSettings();
|
---|
100 | void loadSettings();
|
---|
101 |
|
---|
102 | #ifdef DOWNLOAD_SUBS
|
---|
103 | signals:
|
---|
104 | void subtitleDownloaded(const QString & filename);
|
---|
105 |
|
---|
106 | protected:
|
---|
107 | #ifdef USE_QUAZIP
|
---|
108 | bool uncompressZip(const QString & filename, const QString & output_path, const QString & preferred_output_name);
|
---|
109 | bool extractFile(QuaZip & zip, const QString & filename, const QString & output_name);
|
---|
110 | #else
|
---|
111 | QByteArray gUncompress(const QByteArray &data);
|
---|
112 | #endif
|
---|
113 |
|
---|
114 | protected slots:
|
---|
115 | void fixSubtitles(const QString & filename);
|
---|
116 | #endif
|
---|
117 |
|
---|
118 | protected:
|
---|
119 | OSClient * osclient;
|
---|
120 | QStandardItemModel * table;
|
---|
121 | QSortFilterProxyModel * proxy_model;
|
---|
122 | QString last_file;
|
---|
123 |
|
---|
124 | QMenu * context_menu;
|
---|
125 | QAction * downloadAct;
|
---|
126 | QAction * copyLinkAct;
|
---|
127 |
|
---|
128 | #ifdef DOWNLOAD_SUBS
|
---|
129 | FileDownloader * file_downloader;
|
---|
130 | bool include_lang_on_filename;
|
---|
131 | #endif
|
---|
132 |
|
---|
133 | // Opensubtitles server
|
---|
134 | QString os_server;
|
---|
135 |
|
---|
136 | // Proxy
|
---|
137 | bool use_proxy;
|
---|
138 | int proxy_type;
|
---|
139 | QString proxy_host;
|
---|
140 | int proxy_port;
|
---|
141 | QString proxy_username;
|
---|
142 | QString proxy_password;
|
---|
143 |
|
---|
144 | QSettings * set;
|
---|
145 | };
|
---|
146 |
|
---|
147 | #endif
|
---|
148 |
|
---|