1
1
/* smplayer, GUI front-end for mplayer.
2
Copyright (C) 2006-2008 Ricardo Villalba <rvm@escomposlinux.org>
2
Copyright (C) 2006-2009 Ricardo Villalba <rvm@escomposlinux.org>
4
4
This program is free software; you can redistribute it and/or modify
5
5
it under the terms of the GNU General Public License as published by
140
140
style_font_combo->setCurrentText(pref->ass_styles.fontname);
141
141
style_size_spin->setValue(pref->ass_styles.fontsize);
142
142
style_text_color_button->setColor(pref->ass_styles.primarycolor);
143
style_border_color_button->setColor(pref->ass_styles.backcolor);
143
style_border_color_button->setColor(pref->ass_styles.outlinecolor);
144
style_shadow_color_button->setColor(pref->ass_styles.backcolor);
144
145
style_bold_check->setChecked(pref->ass_styles.bold);
145
146
style_italic_check->setChecked(pref->ass_styles.italic);
146
147
style_alignment_combo->setCurrentIndex(style_alignment_combo->findData(pref->ass_styles.halignment));
151
152
style_marginl_spin->setValue(pref->ass_styles.marginl);
152
153
style_marginr_spin->setValue(pref->ass_styles.marginr);
153
154
style_marginv_spin->setValue(pref->ass_styles.marginv);
156
setForceAssStyles(pref->force_ass_styles);
157
setCustomizedAssStyle(pref->user_forced_ass_style);
156
160
void PrefSubtitles::getData(Preferences * pref) {
177
181
TEST_AND_SET(pref->ass_styles.fontname, style_font_combo->currentText());
178
182
TEST_AND_SET(pref->ass_styles.fontsize, style_size_spin->value());
179
183
TEST_AND_SET(pref->ass_styles.primarycolor, style_text_color_button->color().rgb());
180
TEST_AND_SET(pref->ass_styles.backcolor, style_border_color_button->color().rgb());
184
TEST_AND_SET(pref->ass_styles.outlinecolor, style_border_color_button->color().rgb());
185
TEST_AND_SET(pref->ass_styles.backcolor, style_shadow_color_button->color().rgb());
181
186
TEST_AND_SET(pref->ass_styles.bold, style_bold_check->isChecked());
182
187
TEST_AND_SET(pref->ass_styles.italic, style_italic_check->isChecked());
183
188
TEST_AND_SET(pref->ass_styles.halignment, style_alignment_combo->itemData(style_alignment_combo->currentIndex()).toInt());
190
195
TEST_AND_SET(pref->ass_styles.marginv, style_marginv_spin->value());
192
197
pref->ass_styles.exportStyles( Paths::subtitleStyleFile() );
199
TEST_AND_SET(pref->force_ass_styles, forceAssStyles());
200
TEST_AND_SET(pref->user_forced_ass_style, customizedAssStyle());
195
203
void PrefSubtitles::checkBorderStyleCombo( int index ) {
328
336
return ass_line_spacing_spin->value();
339
void PrefSubtitles::setForceAssStyles(bool b) {
340
force_ass_styles->setChecked(b);
343
bool PrefSubtitles::forceAssStyles() {
344
return force_ass_styles->isChecked();
331
347
void PrefSubtitles::on_ass_subs_button_toggled(bool b) {
333
349
stackedWidget->setCurrentIndex(1);
335
351
stackedWidget->setCurrentIndex(0);
354
void PrefSubtitles::on_ass_customize_button_clicked() {
357
QString edit = forced_ass_style;
359
// A copy with the current values in the dialog
360
AssStyles ass_styles;
361
ass_styles.fontname = style_font_combo->currentText();
362
ass_styles.fontsize = style_size_spin->value();
363
ass_styles.primarycolor = style_text_color_button->color().rgb();
364
ass_styles.outlinecolor = style_border_color_button->color().rgb();
365
ass_styles.backcolor = style_shadow_color_button->color().rgb();
366
ass_styles.bold = style_bold_check->isChecked();
367
ass_styles.italic = style_italic_check->isChecked();
368
ass_styles.halignment = style_alignment_combo->itemData(style_alignment_combo->currentIndex()).toInt();
369
ass_styles.valignment = style_valignment_combo->currentIndex();
370
ass_styles.borderstyle = style_border_style_combo->itemData(style_border_style_combo->currentIndex()).toInt();
371
ass_styles.outline = style_outline_spin->value();
372
ass_styles.shadow = style_shadow_spin->value();
373
ass_styles.marginl = style_marginl_spin->value();
374
ass_styles.marginr = style_marginr_spin->value();
375
ass_styles.marginv = style_marginv_spin->value();
377
if (edit.isEmpty()) {
378
edit = ass_styles.toString();
381
QString s = QInputDialog::getText(this, tr("Customize SSA/ASS style"),
382
tr("Here you can enter your customized SSA/ASS style.") +"<br>"+
383
tr("Clear the edit line to disable the customized style."),
387
if (s == ass_styles.toString()) s.clear(); // Clear string if it wasn't changed by the user
388
setCustomizedAssStyle(s);
338
392
void PrefSubtitles::setFreetypeSupport(bool b) {
339
393
freetype_check->setChecked(b);
445
499
tr("This specifies the spacing that will be used to separate "
446
500
"multiple lines. It can have negative values.") );
502
setWhatsThis(styles_container, tr("SSA/ASS style"),
503
tr("The following options allows you to define the style to "
504
"be used for non-styled subtitles (srt, sub...).") );
448
506
setWhatsThis(style_font_combo, tr("Font"),
449
507
tr("Select the font for the subtitles.") );
463
521
setWhatsThis(style_border_color_button, tr("Border color"),
464
522
tr("Select the color for the border of the subtitles.") );
524
setWhatsThis(style_shadow_color_button, tr("Shadow color"),
525
tr("This color will be used for the shadow of the subtitles.") );
466
527
setWhatsThis(style_marginl_spin, tr("Left margin"),
467
528
tr("Specifies the left margin in pixels.") );
491
552
setWhatsThis(style_shadow_spin, tr("Shadow"),
492
553
tr("If border style is set to <i>outline</i>, this option specifies "
493
554
"the depth of the drop shadow behind the text in pixels.") );
556
setWhatsThis(force_ass_styles, tr("Apply style to ass files too"),
557
tr("If this option is checked, the style defined above will be "
558
"applied to ass subtitles too.") );
496
561
#include "moc_prefsubtitles.cpp"