~ubuntu-branches/ubuntu/maverick/smplayer/maverick

« back to all changes in this revision

Viewing changes to src/prefsubtitles.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Maia Kozheva
  • Date: 2009-03-31 23:05:43 UTC
  • mfrom: (1.1.9 upstream) (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090331230543-1ned1omblgt4qiak
Tags: 0.6.7-1
* New upstream release. (Closes: #523791)
  - Reworked subtitle font preferences. (Closes: #503295)
  - No longer installs qt_fr.qm. (Closes: #486314)
* debian/control:
  - Bumped Standards-Version to 3.8.1.
  - Changed maintainer name (still the same person and GPG key).
  - Changed section to video.
  - Build-depend on zlib1g-dev for findsubtitles.
  - Require Qt >= 4.3 per readme.
  - Added ${misc:Depends}.
  - Make smplayer-translations depend on smplayer and smplayer recommend
    smplayer-translations, not the other way round. (Closes: #489375)
* debian/copyright:
  - Significantly expanded per-file with new upstream authors.
* debian/rules:
  - Make make use correct uic in install.
  - Clean svn_revision.
  - Removed get-orig-source - not needed with uscan --repack.
* debian/patches/01_gl_translation.patch:
  - Added patch to fix lrelease error on smplayer_gl.ts.
* Added debian/README.source for simple-patchsys.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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>
3
3
 
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
25
25
#include "filedialog.h"
26
26
#include "languages.h"
27
27
 
28
 
#include <QColorDialog>
 
28
#include <QInputDialog>
29
29
 
30
30
PrefSubtitles::PrefSubtitles(QWidget * parent, Qt::WindowFlags f)
31
31
        : PrefWidget(parent, f )
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);
 
155
 
 
156
        setForceAssStyles(pref->force_ass_styles);
 
157
        setCustomizedAssStyle(pref->user_forced_ass_style);
154
158
}
155
159
 
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());
191
196
 
192
197
        pref->ass_styles.exportStyles( Paths::subtitleStyleFile() );
 
198
 
 
199
        TEST_AND_SET(pref->force_ass_styles, forceAssStyles());
 
200
        TEST_AND_SET(pref->user_forced_ass_style, customizedAssStyle());
193
201
}
194
202
 
195
203
void PrefSubtitles::checkBorderStyleCombo( int index ) {
328
336
        return ass_line_spacing_spin->value();
329
337
}
330
338
 
 
339
void PrefSubtitles::setForceAssStyles(bool b) {
 
340
        force_ass_styles->setChecked(b);
 
341
}
 
342
 
 
343
bool PrefSubtitles::forceAssStyles() {
 
344
        return force_ass_styles->isChecked();
 
345
}
 
346
 
331
347
void PrefSubtitles::on_ass_subs_button_toggled(bool b) {
332
348
        if (b) 
333
349
                stackedWidget->setCurrentIndex(1);
335
351
                stackedWidget->setCurrentIndex(0);
336
352
}
337
353
 
 
354
void PrefSubtitles::on_ass_customize_button_clicked() {
 
355
        bool ok;
 
356
 
 
357
        QString edit = forced_ass_style;
 
358
 
 
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();
 
376
 
 
377
        if (edit.isEmpty()) {
 
378
                edit = ass_styles.toString();
 
379
        }
 
380
 
 
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."), 
 
384
                                      QLineEdit::Normal, 
 
385
                                      edit, &ok );
 
386
        if (ok) {
 
387
                if (s == ass_styles.toString()) s.clear(); // Clear string if it wasn't changed by the user
 
388
                setCustomizedAssStyle(s);
 
389
        }
 
390
}
 
391
 
338
392
void PrefSubtitles::setFreetypeSupport(bool b) {
339
393
        freetype_check->setChecked(b);
340
394
}
445
499
                tr("This specifies the spacing that will be used to separate "
446
500
           "multiple lines. It can have negative values.") );
447
501
 
 
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...).") );
 
505
       
448
506
        setWhatsThis(style_font_combo, tr("Font"), 
449
507
                tr("Select the font for the subtitles.") );
450
508
 
463
521
        setWhatsThis(style_border_color_button, tr("Border color"), 
464
522
        tr("Select the color for the border of the subtitles.") );
465
523
 
 
524
        setWhatsThis(style_shadow_color_button, tr("Shadow color"), 
 
525
        tr("This color will be used for the shadow of the subtitles.") );
 
526
 
466
527
        setWhatsThis(style_marginl_spin, tr("Left margin"), 
467
528
        tr("Specifies the left margin in pixels.") );
468
529
 
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.") );
 
555
 
 
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.") );
494
559
}
495
560
 
496
561
#include "moc_prefsubtitles.cpp"