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 |
|
---|
20 | #include "prefsubtitles.h"
|
---|
21 | #include "images.h"
|
---|
22 | #include "preferences.h"
|
---|
23 | #include "paths.h"
|
---|
24 | #include "assstyles.h"
|
---|
25 | #include "filedialog.h"
|
---|
26 | #include "languages.h"
|
---|
27 |
|
---|
28 | #include <QInputDialog>
|
---|
29 |
|
---|
30 | PrefSubtitles::PrefSubtitles(QWidget * parent, Qt::WindowFlags f)
|
---|
31 | : PrefWidget(parent, f )
|
---|
32 | {
|
---|
33 | setupUi(this);
|
---|
34 |
|
---|
35 | ttf_font_edit->setDialogType(FileChooser::GetFileName);
|
---|
36 | #ifdef Q_OS_WIN
|
---|
37 | ttf_font_edit->setOptions(QFileDialog::DontUseNativeDialog);
|
---|
38 | #endif
|
---|
39 |
|
---|
40 | connect( style_border_style_combo, SIGNAL(currentIndexChanged(int)),
|
---|
41 | this, SLOT(checkBorderStyleCombo(int)) );
|
---|
42 |
|
---|
43 | #ifndef Q_OS_WIN
|
---|
44 | windowsfontdir_check->hide();
|
---|
45 | #endif
|
---|
46 |
|
---|
47 | retranslateStrings();
|
---|
48 | }
|
---|
49 |
|
---|
50 | PrefSubtitles::~PrefSubtitles()
|
---|
51 | {
|
---|
52 | }
|
---|
53 |
|
---|
54 | QString PrefSubtitles::sectionName() {
|
---|
55 | return tr("Subtitles");
|
---|
56 | }
|
---|
57 |
|
---|
58 | QPixmap PrefSubtitles::sectionIcon() {
|
---|
59 | return Images::icon("pref_subtitles", 22);
|
---|
60 | }
|
---|
61 |
|
---|
62 |
|
---|
63 | void PrefSubtitles::retranslateStrings() {
|
---|
64 | int font_autoscale_item = font_autoscale_combo->currentIndex();
|
---|
65 | int font_autoload_item = font_autoload_combo->currentIndex();
|
---|
66 |
|
---|
67 | retranslateUi(this);
|
---|
68 |
|
---|
69 | font_autoscale_combo->setCurrentIndex(font_autoscale_item);
|
---|
70 | font_autoload_combo->setCurrentIndex(font_autoload_item);
|
---|
71 |
|
---|
72 | // Encodings combo
|
---|
73 | //int font_encoding_item = font_encoding_combo->currentIndex();
|
---|
74 | QString current_encoding = fontEncoding();
|
---|
75 | QString current_enca_lang = encaLang();
|
---|
76 | font_encoding_combo->clear();
|
---|
77 | enca_lang_combo->clear();
|
---|
78 |
|
---|
79 | QMap<QString,QString> l = Languages::encodings();
|
---|
80 | QMapIterator<QString, QString> i(l);
|
---|
81 | while (i.hasNext()) {
|
---|
82 | i.next();
|
---|
83 | font_encoding_combo->addItem( i.value() + " (" + i.key() + ")", i.key() );
|
---|
84 | }
|
---|
85 | l = Languages::list(); i = l;
|
---|
86 | while (i.hasNext()) {
|
---|
87 | i.next();
|
---|
88 | enca_lang_combo->addItem( i.value() + " (" + i.key() + ")", i.key() );
|
---|
89 | }
|
---|
90 | font_encoding_combo->model()->sort(0);
|
---|
91 | enca_lang_combo->model()->sort(0);
|
---|
92 | //font_encoding_combo->setCurrentIndex(font_encoding_item);
|
---|
93 | setFontEncoding(current_encoding);
|
---|
94 | setEncaLang(current_enca_lang);
|
---|
95 |
|
---|
96 | sub_pos_label->setNum( sub_pos_slider->value() );
|
---|
97 |
|
---|
98 | ttf_font_edit->setCaption(tr("Choose a ttf file"));
|
---|
99 | ttf_font_edit->setFilter(tr("Truetype Fonts") + " (*.ttf)");
|
---|
100 |
|
---|
101 | // Ass styles
|
---|
102 | int alignment_item = style_alignment_combo->currentIndex();
|
---|
103 | style_alignment_combo->clear();
|
---|
104 | style_alignment_combo->addItem(tr("Left", "horizontal alignment"), 1);
|
---|
105 | style_alignment_combo->addItem(tr("Centered", "horizontal alignment"), 2);
|
---|
106 | style_alignment_combo->addItem(tr("Right", "horizontal alignment"), 3);
|
---|
107 | style_alignment_combo->setCurrentIndex(alignment_item);
|
---|
108 |
|
---|
109 | int valignment_item = style_valignment_combo->currentIndex();
|
---|
110 | style_valignment_combo->clear();
|
---|
111 | style_valignment_combo->addItem(tr("Bottom", "vertical alignment"));
|
---|
112 | style_valignment_combo->addItem(tr("Middle", "vertical alignment"));
|
---|
113 | style_valignment_combo->addItem(tr("Top", "vertical alignment"));
|
---|
114 | style_valignment_combo->setCurrentIndex(valignment_item);
|
---|
115 |
|
---|
116 | int borderstyle_item = style_border_style_combo->currentIndex();
|
---|
117 | style_border_style_combo->clear();
|
---|
118 | style_border_style_combo->addItem(tr("Outline", "border style"), 1);
|
---|
119 | style_border_style_combo->addItem(tr("Opaque box", "border style"), 3);
|
---|
120 | style_border_style_combo->setCurrentIndex(borderstyle_item);
|
---|
121 |
|
---|
122 | createHelp();
|
---|
123 | }
|
---|
124 |
|
---|
125 | void PrefSubtitles::setData(Preferences * pref) {
|
---|
126 | setFontName( pref->font_name );
|
---|
127 | setFontFile( pref->font_file );
|
---|
128 | setUseFontconfig( pref->use_fontconfig );
|
---|
129 | setFontAutoscale( pref->font_autoscale );
|
---|
130 | setFontTextscale( pref->initial_sub_scale );
|
---|
131 | setAssFontScale( pref->initial_sub_scale_ass );
|
---|
132 | setAutoloadSub( pref->autoload_sub );
|
---|
133 | setFontFuzziness( pref->subfuzziness );
|
---|
134 | setFontEncoding( pref->subcp );
|
---|
135 | setUseEnca( pref->use_enca );
|
---|
136 | setEncaLang( pref->enca_lang );
|
---|
137 | setUseFontASS( pref->use_ass_subtitles );
|
---|
138 | setAssLineSpacing( pref->ass_line_spacing );
|
---|
139 | setSubPos( pref->initial_sub_pos );
|
---|
140 | setSubtitlesOnScreenshots( pref->subtitles_on_screenshots );
|
---|
141 | setFreetypeSupport( pref->freetype_support );
|
---|
142 |
|
---|
143 | // Load ass styles
|
---|
144 | style_font_combo->setCurrentText(pref->ass_styles.fontname);
|
---|
145 | style_size_spin->setValue(pref->ass_styles.fontsize);
|
---|
146 | style_text_color_button->setColor(pref->ass_styles.primarycolor);
|
---|
147 | style_border_color_button->setColor(pref->ass_styles.outlinecolor);
|
---|
148 | style_shadow_color_button->setColor(pref->ass_styles.backcolor);
|
---|
149 | style_bold_check->setChecked(pref->ass_styles.bold);
|
---|
150 | style_italic_check->setChecked(pref->ass_styles.italic);
|
---|
151 | style_alignment_combo->setCurrentIndex(style_alignment_combo->findData(pref->ass_styles.halignment));
|
---|
152 | style_valignment_combo->setCurrentIndex(pref->ass_styles.valignment);
|
---|
153 | style_border_style_combo->setCurrentIndex(style_border_style_combo->findData(pref->ass_styles.borderstyle));
|
---|
154 | style_outline_spin->setValue(pref->ass_styles.outline);
|
---|
155 | style_shadow_spin->setValue(pref->ass_styles.shadow);
|
---|
156 | style_marginl_spin->setValue(pref->ass_styles.marginl);
|
---|
157 | style_marginr_spin->setValue(pref->ass_styles.marginr);
|
---|
158 | style_marginv_spin->setValue(pref->ass_styles.marginv);
|
---|
159 |
|
---|
160 | setForceAssStyles(pref->force_ass_styles);
|
---|
161 | setCustomizedAssStyle(pref->user_forced_ass_style);
|
---|
162 |
|
---|
163 | #ifdef Q_OS_WIN
|
---|
164 | windowsfontdir_check->setChecked(pref->use_windowsfontdir);
|
---|
165 | if (!windowsfontdir_check->isChecked()) on_windowsfontdir_check_toggled(false);
|
---|
166 | #endif
|
---|
167 | }
|
---|
168 |
|
---|
169 | void PrefSubtitles::getData(Preferences * pref) {
|
---|
170 | requires_restart = false;
|
---|
171 |
|
---|
172 | TEST_AND_SET(pref->font_name, fontName());
|
---|
173 | TEST_AND_SET(pref->font_file, fontFile());
|
---|
174 | TEST_AND_SET(pref->use_fontconfig, useFontconfig());
|
---|
175 | TEST_AND_SET(pref->font_autoscale, fontAutoscale());
|
---|
176 | pref->initial_sub_scale = fontTextscale();
|
---|
177 | pref->initial_sub_scale_ass = assFontScale();
|
---|
178 | TEST_AND_SET(pref->autoload_sub, autoloadSub());
|
---|
179 | TEST_AND_SET(pref->subfuzziness, fontFuzziness());
|
---|
180 | TEST_AND_SET(pref->subcp, fontEncoding());
|
---|
181 | TEST_AND_SET(pref->use_enca, useEnca());
|
---|
182 | TEST_AND_SET(pref->enca_lang, encaLang());
|
---|
183 | TEST_AND_SET(pref->use_ass_subtitles, useFontASS());
|
---|
184 | TEST_AND_SET(pref->ass_line_spacing, assLineSpacing());
|
---|
185 | pref->initial_sub_pos = subPos();
|
---|
186 | TEST_AND_SET(pref->subtitles_on_screenshots, subtitlesOnScreenshots());
|
---|
187 | TEST_AND_SET(pref->freetype_support, freetypeSupport());
|
---|
188 |
|
---|
189 | // Save ass styles
|
---|
190 | TEST_AND_SET(pref->ass_styles.fontname, style_font_combo->currentText());
|
---|
191 | TEST_AND_SET(pref->ass_styles.fontsize, style_size_spin->value());
|
---|
192 | TEST_AND_SET(pref->ass_styles.primarycolor, style_text_color_button->color().rgb());
|
---|
193 | TEST_AND_SET(pref->ass_styles.outlinecolor, style_border_color_button->color().rgb());
|
---|
194 | TEST_AND_SET(pref->ass_styles.backcolor, style_shadow_color_button->color().rgb());
|
---|
195 | TEST_AND_SET(pref->ass_styles.bold, style_bold_check->isChecked());
|
---|
196 | TEST_AND_SET(pref->ass_styles.italic, style_italic_check->isChecked());
|
---|
197 | TEST_AND_SET(pref->ass_styles.halignment, style_alignment_combo->itemData(style_alignment_combo->currentIndex()).toInt());
|
---|
198 | TEST_AND_SET(pref->ass_styles.valignment, style_valignment_combo->currentIndex());
|
---|
199 | TEST_AND_SET(pref->ass_styles.borderstyle, style_border_style_combo->itemData(style_border_style_combo->currentIndex()).toInt());
|
---|
200 | TEST_AND_SET(pref->ass_styles.outline, style_outline_spin->value());
|
---|
201 | TEST_AND_SET(pref->ass_styles.shadow, style_shadow_spin->value());
|
---|
202 | TEST_AND_SET(pref->ass_styles.marginl, style_marginl_spin->value());
|
---|
203 | TEST_AND_SET(pref->ass_styles.marginr, style_marginr_spin->value());
|
---|
204 | TEST_AND_SET(pref->ass_styles.marginv, style_marginv_spin->value());
|
---|
205 |
|
---|
206 | pref->ass_styles.exportStyles( Paths::subtitleStyleFile() );
|
---|
207 |
|
---|
208 | TEST_AND_SET(pref->force_ass_styles, forceAssStyles());
|
---|
209 | TEST_AND_SET(pref->user_forced_ass_style, customizedAssStyle());
|
---|
210 |
|
---|
211 | #ifdef Q_OS_WIN
|
---|
212 | pref->use_windowsfontdir = windowsfontdir_check->isChecked();
|
---|
213 | #endif
|
---|
214 | }
|
---|
215 |
|
---|
216 | void PrefSubtitles::checkBorderStyleCombo( int index ) {
|
---|
217 | bool b = (index == 0);
|
---|
218 | style_outline_spin->setEnabled(b);
|
---|
219 | style_shadow_spin->setEnabled(b);
|
---|
220 | style_outline_label->setEnabled(b);
|
---|
221 | style_shadow_label->setEnabled(b);
|
---|
222 | }
|
---|
223 |
|
---|
224 |
|
---|
225 | void PrefSubtitles::setFontName(QString font_name) {
|
---|
226 | fontCombo->setCurrentText(font_name);
|
---|
227 | }
|
---|
228 |
|
---|
229 | QString PrefSubtitles::fontName() {
|
---|
230 | return fontCombo->currentText();
|
---|
231 | }
|
---|
232 |
|
---|
233 | void PrefSubtitles::setFontFile(QString font_file) {
|
---|
234 | ttf_font_edit->setText( font_file );
|
---|
235 | }
|
---|
236 |
|
---|
237 | QString PrefSubtitles::fontFile() {
|
---|
238 | return ttf_font_edit->text();
|
---|
239 | }
|
---|
240 |
|
---|
241 |
|
---|
242 | void PrefSubtitles::setUseFontconfig(bool b) {
|
---|
243 | system_font_button->setChecked(b);
|
---|
244 | ttf_font_button->setChecked(!b);
|
---|
245 | }
|
---|
246 |
|
---|
247 | bool PrefSubtitles::useFontconfig() {
|
---|
248 | return system_font_button->isChecked();
|
---|
249 | }
|
---|
250 |
|
---|
251 | void PrefSubtitles::setFontAutoscale(int n) {
|
---|
252 | font_autoscale_combo->setCurrentIndex(n);
|
---|
253 | }
|
---|
254 |
|
---|
255 | int PrefSubtitles::fontAutoscale() {
|
---|
256 | return font_autoscale_combo->currentIndex();
|
---|
257 | }
|
---|
258 |
|
---|
259 | void PrefSubtitles::setFontTextscale(double n) {
|
---|
260 | font_text_scale_spin->setValue(n);
|
---|
261 | }
|
---|
262 |
|
---|
263 | double PrefSubtitles::fontTextscale() {
|
---|
264 | return font_text_scale_spin->value();
|
---|
265 | }
|
---|
266 |
|
---|
267 | void PrefSubtitles::setAssFontScale(double n) {
|
---|
268 | ass_font_scale_spin->setValue(n);
|
---|
269 | }
|
---|
270 |
|
---|
271 | double PrefSubtitles::assFontScale() {
|
---|
272 | return ass_font_scale_spin->value();
|
---|
273 | }
|
---|
274 |
|
---|
275 | void PrefSubtitles::setAutoloadSub(bool v) {
|
---|
276 | font_autoload_check->setChecked(v);
|
---|
277 | }
|
---|
278 |
|
---|
279 | bool PrefSubtitles::autoloadSub() {
|
---|
280 | return font_autoload_check->isChecked();
|
---|
281 | }
|
---|
282 |
|
---|
283 | void PrefSubtitles::setFontEncoding(QString s) {
|
---|
284 | int i = font_encoding_combo->findData(s);
|
---|
285 | font_encoding_combo->setCurrentIndex(i);
|
---|
286 | }
|
---|
287 |
|
---|
288 | QString PrefSubtitles::fontEncoding() {
|
---|
289 | int index = font_encoding_combo->currentIndex();
|
---|
290 | return font_encoding_combo->itemData(index).toString();
|
---|
291 | }
|
---|
292 |
|
---|
293 | void PrefSubtitles::setEncaLang(QString s) {
|
---|
294 | int i = enca_lang_combo->findData(s);
|
---|
295 | enca_lang_combo->setCurrentIndex(i);
|
---|
296 | }
|
---|
297 |
|
---|
298 | QString PrefSubtitles::encaLang() {
|
---|
299 | int index = enca_lang_combo->currentIndex();
|
---|
300 | return enca_lang_combo->itemData(index).toString();
|
---|
301 | }
|
---|
302 |
|
---|
303 | void PrefSubtitles::setUseEnca(bool b) {
|
---|
304 | use_enca_check->setChecked(b);
|
---|
305 | }
|
---|
306 |
|
---|
307 | bool PrefSubtitles::useEnca() {
|
---|
308 | return use_enca_check->isChecked();
|
---|
309 | }
|
---|
310 |
|
---|
311 | void PrefSubtitles::setSubPos(int pos) {
|
---|
312 | sub_pos_slider->setValue(pos);
|
---|
313 | }
|
---|
314 |
|
---|
315 | int PrefSubtitles::subPos() {
|
---|
316 | return sub_pos_slider->value();
|
---|
317 | }
|
---|
318 |
|
---|
319 | void PrefSubtitles::setUseFontASS(bool v) {
|
---|
320 | ass_subs_button->setChecked(v);
|
---|
321 | normal_subs_button->setChecked(!v);
|
---|
322 | }
|
---|
323 |
|
---|
324 | bool PrefSubtitles::useFontASS() {
|
---|
325 | return ass_subs_button->isChecked();
|
---|
326 | }
|
---|
327 |
|
---|
328 | void PrefSubtitles::setFontFuzziness(int n) {
|
---|
329 | font_autoload_combo->setCurrentIndex(n);
|
---|
330 | }
|
---|
331 |
|
---|
332 | int PrefSubtitles::fontFuzziness() {
|
---|
333 | return font_autoload_combo->currentIndex();
|
---|
334 | }
|
---|
335 |
|
---|
336 | void PrefSubtitles::setSubtitlesOnScreenshots(bool b) {
|
---|
337 | subtitles_on_screeshots_check->setChecked(b);
|
---|
338 | }
|
---|
339 |
|
---|
340 | bool PrefSubtitles::subtitlesOnScreenshots() {
|
---|
341 | return subtitles_on_screeshots_check->isChecked();
|
---|
342 | }
|
---|
343 |
|
---|
344 | void PrefSubtitles::setAssLineSpacing(int spacing) {
|
---|
345 | ass_line_spacing_spin->setValue(spacing);
|
---|
346 | }
|
---|
347 |
|
---|
348 | int PrefSubtitles::assLineSpacing() {
|
---|
349 | return ass_line_spacing_spin->value();
|
---|
350 | }
|
---|
351 |
|
---|
352 | void PrefSubtitles::setForceAssStyles(bool b) {
|
---|
353 | force_ass_styles->setChecked(b);
|
---|
354 | }
|
---|
355 |
|
---|
356 | bool PrefSubtitles::forceAssStyles() {
|
---|
357 | return force_ass_styles->isChecked();
|
---|
358 | }
|
---|
359 |
|
---|
360 | void PrefSubtitles::on_ass_subs_button_toggled(bool b) {
|
---|
361 | if (b)
|
---|
362 | stackedWidget->setCurrentIndex(1);
|
---|
363 | else
|
---|
364 | stackedWidget->setCurrentIndex(0);
|
---|
365 | }
|
---|
366 |
|
---|
367 | void PrefSubtitles::on_ass_customize_button_clicked() {
|
---|
368 | bool ok;
|
---|
369 |
|
---|
370 | QString edit = forced_ass_style;
|
---|
371 |
|
---|
372 | // A copy with the current values in the dialog
|
---|
373 | AssStyles ass_styles;
|
---|
374 | ass_styles.fontname = style_font_combo->currentText();
|
---|
375 | ass_styles.fontsize = style_size_spin->value();
|
---|
376 | ass_styles.primarycolor = style_text_color_button->color().rgb();
|
---|
377 | ass_styles.outlinecolor = style_border_color_button->color().rgb();
|
---|
378 | ass_styles.backcolor = style_shadow_color_button->color().rgb();
|
---|
379 | ass_styles.bold = style_bold_check->isChecked();
|
---|
380 | ass_styles.italic = style_italic_check->isChecked();
|
---|
381 | ass_styles.halignment = style_alignment_combo->itemData(style_alignment_combo->currentIndex()).toInt();
|
---|
382 | ass_styles.valignment = style_valignment_combo->currentIndex();
|
---|
383 | ass_styles.borderstyle = style_border_style_combo->itemData(style_border_style_combo->currentIndex()).toInt();
|
---|
384 | ass_styles.outline = style_outline_spin->value();
|
---|
385 | ass_styles.shadow = style_shadow_spin->value();
|
---|
386 | ass_styles.marginl = style_marginl_spin->value();
|
---|
387 | ass_styles.marginr = style_marginr_spin->value();
|
---|
388 | ass_styles.marginv = style_marginv_spin->value();
|
---|
389 |
|
---|
390 | if (edit.isEmpty()) {
|
---|
391 | edit = ass_styles.toString();
|
---|
392 | }
|
---|
393 |
|
---|
394 | QString s = QInputDialog::getText(this, tr("Customize SSA/ASS style"),
|
---|
395 | tr("Here you can enter your customized SSA/ASS style.") +"<br>"+
|
---|
396 | tr("Clear the edit line to disable the customized style."),
|
---|
397 | QLineEdit::Normal,
|
---|
398 | edit, &ok );
|
---|
399 | if (ok) {
|
---|
400 | if (s == ass_styles.toString()) s.clear(); // Clear string if it wasn't changed by the user
|
---|
401 | setCustomizedAssStyle(s);
|
---|
402 | }
|
---|
403 | }
|
---|
404 |
|
---|
405 | void PrefSubtitles::setFreetypeSupport(bool b) {
|
---|
406 | freetype_check->setChecked(b);
|
---|
407 | }
|
---|
408 |
|
---|
409 | bool PrefSubtitles::freetypeSupport() {
|
---|
410 | return freetype_check->isChecked();
|
---|
411 | }
|
---|
412 |
|
---|
413 | void PrefSubtitles::on_freetype_check_toggled(bool b) {
|
---|
414 | qDebug("PrefSubtitles:on_freetype_check_toggled: %d", b);
|
---|
415 | if (!b) {
|
---|
416 | ass_subs_button->setChecked(false);
|
---|
417 | normal_subs_button->setChecked(true);
|
---|
418 | }
|
---|
419 | }
|
---|
420 |
|
---|
421 | void PrefSubtitles::on_windowsfontdir_check_toggled(bool b) {
|
---|
422 | qDebug("PrefSubtitles::on_windowsfontdir_check_toggled: %d", b);
|
---|
423 |
|
---|
424 | #ifdef Q_OS_WIN
|
---|
425 | if (b) {
|
---|
426 | style_font_combo->setFontsFromDir(QString::null);
|
---|
427 | fontCombo->setFontsFromDir(QString::null);
|
---|
428 | } else {
|
---|
429 | QString fontdir = Paths::fontPath();
|
---|
430 | //QString fontdir = "/tmp/fonts/";
|
---|
431 | style_font_combo->setFontsFromDir(fontdir);
|
---|
432 |
|
---|
433 | // Calling setFontsFromDir resets the fonts in other comboboxes!
|
---|
434 | // So the font list is copied from the previous combobox
|
---|
435 | QString current_text = fontCombo->currentText();
|
---|
436 | fontCombo->clear();
|
---|
437 | for (int n=0; n < style_font_combo->count(); n++) {
|
---|
438 | fontCombo->addItem( style_font_combo->itemText(n) );
|
---|
439 | }
|
---|
440 | fontCombo->setCurrentText(current_text);
|
---|
441 | }
|
---|
442 | #endif
|
---|
443 | }
|
---|
444 |
|
---|
445 | void PrefSubtitles::createHelp() {
|
---|
446 | clearHelp();
|
---|
447 |
|
---|
448 | addSectionTitle(tr("Subtitles"));
|
---|
449 |
|
---|
450 | setWhatsThis(font_autoload_combo, tr("Autoload"),
|
---|
451 | tr("Select the subtitle autoload method.") );
|
---|
452 |
|
---|
453 | setWhatsThis(font_autoload_check, tr("Select first available subtitle"),
|
---|
454 | tr("If there are one or more subtitle tracks available, one of them "
|
---|
455 | "will be automatically selected, usually the first one, although if "
|
---|
456 | "one of them matches the user's preferred language that one will "
|
---|
457 | "be used instead.") );
|
---|
458 |
|
---|
459 | setWhatsThis(font_encoding_combo, tr("Default subtitle encoding"),
|
---|
460 | tr("Select the encoding which will be used for subtitle files "
|
---|
461 | "by default.") );
|
---|
462 |
|
---|
463 | setWhatsThis(use_enca_check, tr("Try to autodetect for this language"),
|
---|
464 | tr("When this option is on, the encoding of the subtitles will be "
|
---|
465 | "tried to be autodetected for the given language. "
|
---|
466 | "It will fall back to the default encoding if the autodetection "
|
---|
467 | "fails. This option requires a MPlayer compiled with ENCA "
|
---|
468 | "support.") );
|
---|
469 |
|
---|
470 | setWhatsThis(enca_lang_combo, tr("Subtitle language"),
|
---|
471 | tr("Select the language for which you want the encoding to be guessed "
|
---|
472 | "automatically.") );
|
---|
473 |
|
---|
474 | setWhatsThis(subtitles_on_screeshots_check,
|
---|
475 | tr("Include subtitles on screenshots"),
|
---|
476 | tr("If this option is checked, the subtitles will appear in the "
|
---|
477 | "screenshots. <b>Note:</b> it may cause some troubles sometimes." ) );
|
---|
478 |
|
---|
479 | setWhatsThis(freetype_check, tr("Freetype support"),
|
---|
480 | tr("You should normally not disable this option. Do it only if your "
|
---|
481 | "MPlayer is compiled without freetype support. "
|
---|
482 | "<b>Disabling this option could make that subtitles won't work "
|
---|
483 | "at all!</b>") );
|
---|
484 |
|
---|
485 | #ifdef Q_OS_WIN
|
---|
486 | setWhatsThis(windowsfontdir_check, tr("Enable Windows fonts"),
|
---|
487 | tr("If this option is enabled the Windows system fonts will be "
|
---|
488 | "available for subtitles. There's an inconvenience: a font cache have "
|
---|
489 | "to be created which can take some time.") +"<br>"+
|
---|
490 | tr("If this option is not checked then only a few fonts bundled with SMPlayer "
|
---|
491 | "can be used, but this is faster.") );
|
---|
492 | #endif
|
---|
493 |
|
---|
494 | addSectionTitle(tr("Font"));
|
---|
495 |
|
---|
496 | setWhatsThis(normal_subs_button, tr("Enable normal subtitles"),
|
---|
497 | tr("Click this button to select the normal/traditional subtitles. "
|
---|
498 | "This kind of subtitles can only display white subtitles."));
|
---|
499 |
|
---|
500 | setWhatsThis(ass_subs_button, tr("Enable SSA/ASS subtitles"),
|
---|
501 | tr("Click this button to enable the new SSA/ASS library. "
|
---|
502 | "This allows to display subtitles with multiple colors, fonts..."));
|
---|
503 |
|
---|
504 | addSectionTitle(tr("Normal subtitles"));
|
---|
505 |
|
---|
506 | setWhatsThis(ttf_font_edit, tr("TTF font"),
|
---|
507 | tr("Here you can select a ttf font to be used for the subtitles. "
|
---|
508 | "Usually you'll find a lot of ttf fonts in %1")
|
---|
509 | #ifdef Q_OS_WIN
|
---|
510 | .arg("<i>C:\\Windows\\Fonts\\</i>")
|
---|
511 | #else
|
---|
512 | #ifdef Q_OS_OS2
|
---|
513 | .arg("<i>C:\\PSFONTS</i>")
|
---|
514 | #else
|
---|
515 | .arg("<i>/usr/X11R6/lib/X11/fonts/truetype/</i>")
|
---|
516 | #endif
|
---|
517 | #endif
|
---|
518 | );
|
---|
519 |
|
---|
520 | setWhatsThis(fontCombo, tr("System font"),
|
---|
521 | tr("Here you can select a system font to be used for the subtitles "
|
---|
522 | "and OSD.") );
|
---|
523 |
|
---|
524 | setWhatsThis(font_autoscale_combo, tr("Autoscale"),
|
---|
525 | tr("Select the subtitle autoscaling method.") );
|
---|
526 |
|
---|
527 | QString scale_note = tr("This option does NOT change the size of the "
|
---|
528 | "subtitles in the current video. To do so, use the options "
|
---|
529 | "<i>Size+</i> and <i>Size-</i> in the subtitles menu.");
|
---|
530 |
|
---|
531 | setWhatsThis(font_text_scale_spin, tr("Default scale"),
|
---|
532 | tr("This option specifies the default font scale for normal "
|
---|
533 | "subtitles which will be used for new opened files.") +"<br>"+
|
---|
534 | scale_note);
|
---|
535 |
|
---|
536 | setWhatsThis(sub_pos_slider, tr("Subtitle position"),
|
---|
537 | tr("This option specifies the position of the subtitles over the "
|
---|
538 | "video window. <i>100</i> means the bottom, while <i>0</i> means "
|
---|
539 | "the top." ) );
|
---|
540 |
|
---|
541 | addSectionTitle(tr("SSA/ASS subtitles"));
|
---|
542 |
|
---|
543 | setWhatsThis(ass_font_scale_spin, tr("Default scale"),
|
---|
544 | tr("This option specifies the default font scale for SSA/ASS "
|
---|
545 | "subtitles which will be used for new opened files.") +"<br>"+
|
---|
546 | scale_note);
|
---|
547 |
|
---|
548 | setWhatsThis(ass_line_spacing_spin, tr("Line spacing"),
|
---|
549 | tr("This specifies the spacing that will be used to separate "
|
---|
550 | "multiple lines. It can have negative values.") );
|
---|
551 |
|
---|
552 | setWhatsThis(styles_container, tr("SSA/ASS style"),
|
---|
553 | tr("The following options allows you to define the style to "
|
---|
554 | "be used for non-styled subtitles (srt, sub...).") );
|
---|
555 |
|
---|
556 | setWhatsThis(style_font_combo, tr("Font"),
|
---|
557 | tr("Select the font for the subtitles.") );
|
---|
558 |
|
---|
559 | setWhatsThis(style_size_spin, tr("Size"),
|
---|
560 | tr("The size in pixels.") );
|
---|
561 |
|
---|
562 | setWhatsThis(style_bold_check, tr("Bold"),
|
---|
563 | tr("If checked, the text will be displayed in <b>bold</b>.") );
|
---|
564 |
|
---|
565 | setWhatsThis(style_italic_check, tr("Italic"),
|
---|
566 | tr("If checked, the text will be displayed in <i>italic</i>.") );
|
---|
567 |
|
---|
568 | setWhatsThis(style_text_color_button, tr("Text color"),
|
---|
569 | tr("Select the color for the text of the subtitles.") );
|
---|
570 |
|
---|
571 | setWhatsThis(style_border_color_button, tr("Border color"),
|
---|
572 | tr("Select the color for the border of the subtitles.") );
|
---|
573 |
|
---|
574 | setWhatsThis(style_shadow_color_button, tr("Shadow color"),
|
---|
575 | tr("This color will be used for the shadow of the subtitles.") );
|
---|
576 |
|
---|
577 | setWhatsThis(style_marginl_spin, tr("Left margin"),
|
---|
578 | tr("Specifies the left margin in pixels.") );
|
---|
579 |
|
---|
580 | setWhatsThis(style_marginr_spin, tr("Right margin"),
|
---|
581 | tr("Specifies the right margin in pixels.") );
|
---|
582 |
|
---|
583 | setWhatsThis(style_marginv_spin, tr("Vertical margin"),
|
---|
584 | tr("Specifies the vertical margin in pixels.") );
|
---|
585 |
|
---|
586 | setWhatsThis(style_alignment_combo, tr("Horizontal alignment"),
|
---|
587 | tr("Specifies the horizontal alignment. Possible values are "
|
---|
588 | "left, centered and right.") );
|
---|
589 |
|
---|
590 | setWhatsThis(style_valignment_combo, tr("Vertical alignment"),
|
---|
591 | tr("Specifies the vertical alignment. Possible values: "
|
---|
592 | "bottom, middle and top.") );
|
---|
593 |
|
---|
594 | setWhatsThis(style_border_style_combo, tr("Border style"),
|
---|
595 | tr("Specifies the border style. Possible values: outline "
|
---|
596 | "and opaque box.") );
|
---|
597 |
|
---|
598 | setWhatsThis(style_outline_spin, tr("Outline"),
|
---|
599 | tr("If border style is set to <i>outline</i>, this option specifies "
|
---|
600 | "the width of the outline around the text in pixels.") );
|
---|
601 |
|
---|
602 | setWhatsThis(style_shadow_spin, tr("Shadow"),
|
---|
603 | tr("If border style is set to <i>outline</i>, this option specifies "
|
---|
604 | "the depth of the drop shadow behind the text in pixels.") );
|
---|
605 |
|
---|
606 | setWhatsThis(force_ass_styles, tr("Apply style to ass files too"),
|
---|
607 | tr("If this option is checked, the style defined above will be "
|
---|
608 | "applied to ass subtitles too.") );
|
---|
609 | }
|
---|
610 |
|
---|
611 | #include "moc_prefsubtitles.cpp"
|
---|