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

Last change on this file since 170 was 165, checked in by Silvan Scherrer, 11 years ago

SMPlayer: update trunk to latest 0.8.7

  • Property svn:eol-style set to LF
File size: 3.5 KB
Line 
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
25class OSClient;
26class QStandardItemModel;
27class QSortFilterProxyModel;
28class QModelIndex;
29class QMenu;
30class QAction;
31class QSettings;
32
33#ifdef DOWNLOAD_SUBS
34class FileDownloader;
35class QBuffer;
36class QuaZip;
37#endif
38
39class FindSubtitlesWindow : public QDialog, public Ui::FindSubtitlesWindow
40{
41 Q_OBJECT
42
43public:
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
55public 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
65protected 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
92protected:
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
103signals:
104 void subtitleDownloaded(const QString & filename);
105
106protected:
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
114protected slots:
115 void fixSubtitles(const QString & filename);
116#endif
117
118protected:
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
Note: See TracBrowser for help on using the repository browser.