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

Last change on this file since 132 was 132, checked in by Silvan Scherrer, 13 years ago

SMPlayer trunk: built 0.8.0

  • Property svn:eol-style set to LF
File size: 3.4 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2012 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 SimpleHttp;
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 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
89protected:
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
100signals:
101 void subtitleDownloaded(const QString & filename);
102
103protected:
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
107protected slots:
108 void fixSubtitles(const QString & filename);
109#endif
110
111protected:
112 SimpleHttp * downloader;
113 QStandardItemModel * table;
114 QSortFilterProxyModel * proxy_model;
115 QString last_file;
116
117 QMenu * context_menu;
118 QAction * downloadAct;
119 QAction * copyLinkAct;
120
121#ifdef DOWNLOAD_SUBS
122 FileDownloader * file_downloader;
123 bool include_lang_on_filename;
124#endif
125
126 // Opensubtitles server
127 QString os_server;
128
129 // Proxy
130 bool use_proxy;
131 int proxy_type;
132 QString proxy_host;
133 int proxy_port;
134 QString proxy_username;
135 QString proxy_password;
136
137 QSettings * set;
138};
139
140#endif
141
Note: See TracBrowser for help on using the repository browser.