~ubuntu-branches/debian/squeeze/smplayer/squeeze

« back to all changes in this revision

Viewing changes to src/preferencesdialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Breuil Cyril
  • Date: 2007-06-24 16:35:29 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070624163529-hhckbmd24uicada7
Tags: 0.5.20-0ubuntu1
* New upstream release
* Change Maintainer Email

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
#define PAGE_GUI 4
55
55
#define PAGE_DRIVES 5
56
56
#define PAGE_MOUSE 6
57
 
#define PAGE_LOGS 7
58
57
 
59
58
PreferencesDialog::PreferencesDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
60
59
        : PreferencesDialogBase(parent, name, modal, fl)
65
64
    sections->insertItem( "Subtitles", Subtitles );
66
65
    sections->insertItem( "Advanced", Advanced );
67
66
    sections->insertItem( "Interface", Gui );
68
 
    sections->insertItem( "Mouse and keyboard", Mouse );
69
 
        sections->insertItem( "Logs", Logs );
 
67
    sections->insertItem( "Keyboard and mouse", Mouse );
70
68
 
71
69
        connect( sections, SIGNAL(highlighted(int)), 
72
70
             this, SLOT(changeSection(int)) );
173
171
        style_combo->hide();
174
172
#endif
175
173
 
 
174
        /*
176
175
        autoq_slider->setTickmarks( QSlider::Below );
177
176
        autoq_slider->setTickInterval( 1 );
178
177
        autoq_slider->setLineStep( 1 );
179
178
        autoq_slider->setPageStep( 1 );
 
179
        */
180
180
 
181
181
        encodings = new Encodings(this, "encodings" );
182
182
        font_encoding_combo->insertStringList( encodings->list() );
201
201
                        iconset_combo->insertItem( iconsets[n] );
202
202
        }
203
203
 
 
204
        // MPlayer language combos.
 
205
    endoffile_combo->insertItem( "Exiting... \\(End of file\\)" );
 
206
    endoffile_combo->insertItem( "Saliendo... \\(Fin de archivo\\.\\)" );
 
207
    endoffile_combo->insertItem( "Beenden... \\(Dateiende erreicht\\)" );
 
208
    endoffile_combo->insertItem( "Sortie... \\(Fin du fichier\\)" );
 
209
    endoffile_combo->insertItem( "In uscita... \\(Fine del file\\)" );
 
210
 
 
211
    novideo_combo->insertItem( "Video: no video" );
 
212
        novideo_combo->insertItem( QString::fromLatin1("V�deo: no hay video") );
 
213
    novideo_combo->insertItem( "Video: kein Video" );
 
214
    novideo_combo->insertItem( QString::fromLatin1("Vid�o : pas de vid�o") );
 
215
    novideo_combo->insertItem( "Video: nessun video" );
 
216
 
204
217
        languageChange();
205
218
}
206
219
 
207
220
PreferencesDialog::~PreferencesDialog() {
208
221
}
209
222
 
 
223
void PreferencesDialog::setActionsList(QStringList l) {
 
224
        left_click_combo->insertStringList( l );
 
225
        double_click_combo->insertStringList( l );
 
226
}
 
227
 
210
228
void PreferencesDialog::createLanguageCombo() {
211
229
        QMap <QString,QString> m;
212
230
        m["bg"] = tr("Bulgarian");
213
231
        m["cs"] = tr("Czech");
214
232
        m["de"] = tr("German");
 
233
        m["el"] = tr("Greek");
215
234
        m["en_US"] = tr("English");
216
235
        m["es"] = tr("Spanish");
 
236
        m["fi"] = tr("Finnish");
217
237
        m["fr"] = tr("French");
218
238
        m["hu"] = tr("Hungarian");
219
239
        m["it"] = tr("Italian");
221
241
        m["ka"] = tr("Georgian");
222
242
        m["nl"] = tr("Dutch");
223
243
        m["pl"] = tr("Polish");
224
 
        m["pt_BR"] = tr("Brazilian Portuguese");
 
244
        m["pt_BR"] = tr("Portuguese - Brazil");
 
245
        m["pt_PT"] = tr("Portuguese - Portugal");
 
246
        m["ro_RO"] = tr("Romanian");
225
247
        m["ru_RU"] = tr("Russian");
226
248
        m["sk"] = tr("Slovak");
 
249
        m["sr"] = tr("Serbian");
 
250
        m["sv"] = tr("Swedish");
 
251
        m["tr"] = tr("Turkish");
227
252
        m["uk_UA"] = tr("Ukrainian");
228
253
        m["zh_CN"] = tr("Simplified-Chinese");
 
254
        m["zh_TW"] = tr("Traditional Chinese");
229
255
 
230
256
        // Language combo
231
257
        QDir translation_dir = Helper::translationPath();
262
288
        mainwindow_resize_combo->setCurrentItem(mainwindow_resize);
263
289
        wheel_function_combo->setCurrentItem(wheel_function);
264
290
        initial_volume_label->setNum( initial_volume_slider->value() );
 
291
        sub_pos_label->setNum( sub_pos_slider->value() );
265
292
 
266
293
        int current_item = sections->currentItem();
267
294
 
278
305
    sections->changeItem( Images::icon("pref_gui"),
279
306
                          tr( "Interface" ), Gui );
280
307
    sections->changeItem( Images::icon("input_devices"),
281
 
                          tr( "Mouse and keyboard" ), Mouse );
282
 
        sections->changeItem( Images::icon("logs"),
283
 
                          tr( "Logs" ), Logs );
 
308
                          tr( "Keyboard and mouse" ), Mouse );
284
309
 
285
310
        sections->setCurrentItem(current_item);
286
311
 
341
366
        adjustSize();
342
367
        setFixedSize( sizeHint() );
343
368
        */
 
369
        adjustSize();
344
370
}
345
371
 
346
372
void PreferencesDialog::setDrivers(InfoList vo_list, 
402
428
                case Mouse:
403
429
                        pages->raiseWidget( PAGE_MOUSE );
404
430
                        break;
405
 
                case Logs:
406
 
                        pages->raiseWidget( PAGE_LOGS );
407
 
                        break;
408
431
                default:
409
432
                        pages->raiseWidget( PAGE_GENERAL );
410
433
        }
455
478
 
456
479
void PreferencesDialog::setSoftVol(bool b) {
457
480
        softvol_check->setChecked(b);
 
481
        amplification_label->setEnabled(b);
 
482
        softvol_max_spin->setEnabled(b);
458
483
}
459
484
 
460
485
bool PreferencesDialog::softVol() {
461
486
        return softvol_check->isChecked();
462
487
}
463
488
 
 
489
void PreferencesDialog::setAc3DTSPassthrough(bool b) {
 
490
        hwac3_check->setChecked(b);
 
491
}
 
492
 
 
493
bool PreferencesDialog::Ac3DTSPassthrough() {
 
494
        return hwac3_check->isChecked();
 
495
}
 
496
 
 
497
void PreferencesDialog::setVolNorm(bool b) {
 
498
        volnorm_check->setChecked(b);
 
499
}
 
500
 
 
501
bool PreferencesDialog::volNorm() {
 
502
        return volnorm_check->isChecked();
 
503
}
 
504
 
 
505
void PreferencesDialog::setPostprocessing(bool b) {
 
506
        postprocessing_check->setChecked(b);
 
507
}
 
508
 
 
509
bool PreferencesDialog::postprocessing() {
 
510
        return postprocessing_check->isChecked();
 
511
}
 
512
 
 
513
 
 
514
void PreferencesDialog::setAmplification(int n) {
 
515
        softvol_max_spin->setValue(n);
 
516
}
 
517
 
 
518
int PreferencesDialog::amplification() {
 
519
        return softvol_max_spin->value();
 
520
}
 
521
 
 
522
 
464
523
void PreferencesDialog::setRememberSettings(bool b) {
465
524
        remember_all_check->setChecked(b);
466
525
        rememberAllButtonToggled(b);
546
605
        return mainwindow_resize_combo->currentItem();
547
606
}
548
607
 
549
 
/*
550
 
void PreferencesDialog::setWheelSeek(int secs) {
551
 
        wheel_seek_spin->setValue(secs);
552
 
}
553
 
 
554
 
int PreferencesDialog::wheelSeek() {
555
 
        return wheel_seek_spin->value();
556
 
}
557
 
*/
558
 
 
559
608
void PreferencesDialog::setMonitorAspect(QString asp) {
560
609
        if (asp.isEmpty())
561
610
                monitoraspect_combo->setCurrentText("Auto");
674
723
        }
675
724
}
676
725
 
677
 
void PreferencesDialog::setWheelChangesVolume(bool b) {
678
 
        if (b) 
679
 
                wheel_function_combo->setCurrentItem(1);
680
 
        else
681
 
                wheel_function_combo->setCurrentItem(0);
 
726
void PreferencesDialog::setWheelFunction(int function) {
 
727
        wheel_function_combo->setCurrentItem(function);
682
728
}
683
729
 
684
 
bool PreferencesDialog::wheelChangesVolume() {
685
 
        return (wheel_function_combo->currentItem()==1);
 
730
int PreferencesDialog::wheelFunction() {
 
731
        return wheel_function_combo->currentItem();
686
732
}
687
733
 
688
734
 
846
892
        return res;
847
893
}
848
894
 
 
895
void PreferencesDialog::setSubPos(int pos) {
 
896
        sub_pos_slider->setValue(pos);
 
897
}
 
898
 
 
899
int PreferencesDialog::subPos() {
 
900
        return sub_pos_slider->value();
 
901
}
 
902
 
849
903
void PreferencesDialog::setUseFontASS(bool v) {
850
904
        font_ass_check->setChecked(v);
851
905
        assButtonToggled(v);
882
936
        return ass_border_color;
883
937
}
884
938
 
 
939
void PreferencesDialog::setAssStyles(QString styles) {
 
940
        ass_styles_edit->setText(styles);
 
941
}
 
942
 
 
943
QString PreferencesDialog::assStyles() {
 
944
        return ass_styles_edit->text();
 
945
}
 
946
 
885
947
void PreferencesDialog::setFontFuzziness(int n) {
886
948
        font_autoload_combo->setCurrentItem(n);
887
949
}
890
952
        return font_autoload_combo->currentItem();
891
953
}
892
954
 
 
955
void PreferencesDialog::setUseSubfont(bool b) {
 
956
        subfont_check->setChecked(b);
 
957
}
 
958
 
 
959
bool PreferencesDialog::useSubfont() {
 
960
        return subfont_check->isChecked();
 
961
}
 
962
 
 
963
 
893
964
// Subtitles Page stuff
894
965
void PreferencesDialog::systemFontRadioButtonSelected() {
895
966
        qDebug("PreferencesDialog::systemFontRadioButtonSelected");
917
988
        asscolor_button->setEnabled(b);
918
989
        assbordercolor_label->setEnabled(b);
919
990
        assbordercolor_button->setEnabled(b);
 
991
        ass_styles_label->setEnabled(b);
 
992
        ass_styles_edit->setEnabled(b);
 
993
        styles_desc_label->setEnabled(b);
 
994
        ass_styles_line->setEnabled(b);
920
995
}
921
996
 
922
997
void PreferencesDialog::selectSystemFont() {
989
1064
        return mplayer_use_window_check->isChecked();
990
1065
}
991
1066
 
 
1067
 
 
1068
void PreferencesDialog::setCacheEnabled(bool b) {
 
1069
        use_cache_check->setChecked(b);
 
1070
 
 
1071
        cache_spin->setEnabled(b);
 
1072
        cache_size_label->setEnabled(b);
 
1073
        cache_kb_label->setEnabled(b);
 
1074
}
 
1075
 
 
1076
bool PreferencesDialog::cacheEnabled() {
 
1077
        return use_cache_check->isChecked();
 
1078
}
 
1079
 
992
1080
void PreferencesDialog::setCache(int n) {
993
1081
        cache_spin->setValue(n);
994
1082
}
1021
1109
        return mplayer_afilters_edit->text();
1022
1110
}
1023
1111
 
 
1112
void PreferencesDialog::setColorKey(unsigned int c) {
 
1113
        QString color = QString::number(c, 16);
 
1114
        while (color.length() < 6) color = "0"+color;
 
1115
        colorkey_view->setText( "#" + color );
 
1116
}
 
1117
 
 
1118
unsigned int PreferencesDialog::colorKey() {
 
1119
        QString c = colorkey_view->text();
 
1120
        if (c.startsWith("#")) c = c.mid(1);
 
1121
 
 
1122
        bool ok;
 
1123
        unsigned int color = c.toUInt(&ok, 16);
 
1124
 
 
1125
        if (!ok) 
 
1126
                qWarning("PreferencesDialog::colorKey: cannot convert color to uint");
 
1127
 
 
1128
        qDebug("PreferencesDialog::colorKey: color: %s", QString::number(color,16).utf8().data() );
 
1129
 
 
1130
        return color;
 
1131
}
 
1132
 
 
1133
void PreferencesDialog::selectColorkey() {
 
1134
        //bool ok;
 
1135
        //int color = colorkey_view->text().toUInt(&ok, 16);
 
1136
        QColor color( colorkey_view->text() );
 
1137
        QColor c = QColorDialog::getColor ( color, this );
 
1138
        if (c.isValid()) {
 
1139
                //colorkey_view->setText( QString::number( c.rgb(), 16 ) );
 
1140
                colorkey_view->setText( c.name() );
 
1141
        }
 
1142
}
 
1143
 
1024
1144
// Performance Page
1025
1145
void PreferencesDialog::setPriority(int n) {
1026
1146
        priority_combo->setCurrentItem(n);
1048
1168
 
1049
1169
 
1050
1170
void PreferencesDialog::setAutoq(int n) {
1051
 
        autoq_slider->setValue(n);
 
1171
        autoq_spin->setValue(n);
1052
1172
}
1053
1173
 
1054
1174
int PreferencesDialog::autoq() {
1055
 
        return autoq_slider->value();
 
1175
        return autoq_spin->value();
1056
1176
}
1057
1177
 
1058
1178
void PreferencesDialog::setAutoSyncFactor(int factor) {
1120
1240
}
1121
1241
 
1122
1242
 
 
1243
// MPlayer language page
 
1244
void PreferencesDialog::setEndOfFileText(QString t) {
 
1245
        endoffile_combo->setCurrentText(t);
 
1246
}
 
1247
 
 
1248
QString PreferencesDialog::endOfFileText() {
 
1249
        return endoffile_combo->currentText();
 
1250
}
 
1251
 
 
1252
void PreferencesDialog::setNoVideoText(QString t) {
 
1253
        novideo_combo->setCurrentText(t);
 
1254
}
 
1255
 
 
1256
QString PreferencesDialog::noVideoText() {
 
1257
        return novideo_combo->currentText();
 
1258
}
 
1259
 
 
1260
 
1123
1261
void PreferencesDialog::createHelpMessages() {
1124
1262
        // General tab
1125
1263
        QWhatsThis::add(mplayerbin_edit,
1189
1327
           "will select the subtitle stream if it matches with <i>es</i>, "
1190
1328
           "<i>esp</i> or <i>spa</i>.") );
1191
1329
 
 
1330
        // Subtitles tab
 
1331
        QWhatsThis::add(sub_pos_slider,
 
1332
                tr("This option specifies the position of the subtitles over the "
 
1333
           "video window. <i>100</i> means the bottom, while <i>0</i> means "
 
1334
           "the top." ) );
 
1335
 
 
1336
        QWhatsThis::add(ass_styles_edit,
 
1337
                tr("Here you can override styles for SSA/ASS subtitles. "
 
1338
           "It can be also used for fine-tuning the rendering of srt and sub "
 
1339
           "subtitles by the SSA/ASS library.<br>"
 
1340
           "Example: <b>Bold=1,Outline=2,Shadow=2</b>"));
 
1341
 
1192
1342
        // Performance tab
1193
1343
        QWhatsThis::add(priority_combo,
1194
1344
                tr("Set process priority for mplayer according to the predefined "
1214
1364
                tr("Gradually adjusts the A/V sync based on audio delay "
1215
1365
           "measurements.") );
1216
1366
 
1217
 
        QWhatsThis::add(autoq_slider,
 
1367
        QWhatsThis::add(autoq_spin,
1218
1368
                tr("Dynamically changes the level of postprocessing depending on the "
1219
1369
           "available spare CPU time. The number you specify will be the "
1220
1370
           "maximum level used. Usually you can use some big number.") );