source: smplayer/trunk/src/findsubtitles/findsubtitleswindow.h

Last change on this file was 188, checked in by Silvan Scherrer, 8 years ago

SMPlayer: update trunk to version 17.1.0

  • Property svn:eol-style set to LF
File size: 3.6 KB
Line 
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
28class OSClient;
29class QStandardItemModel;
30class QSortFilterProxyModel;
31class QModelIndex;
32class QMenu;
33class QAction;
34class QSettings;
35
36#ifdef DOWNLOAD_SUBS
37class FileDownloader;
38class QBuffer;
39class QuaZip;
40#endif
41
42class FindSubtitlesWindow : public QWidget, public Ui::FindSubtitlesWindow
43{
44 Q_OBJECT
45
46public:
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
58public 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
68protected 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
95protected:
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
108signals:
109 void subtitleDownloaded(const QString & filename);
110
111protected:
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
119protected slots:
120 void fixSubtitles(const QString & filename);
121#endif
122
123protected:
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
Note: See TracBrowser for help on using the repository browser.