source: smplayer/trunk/src/prefinterface.cpp

Last change on this file was 188, checked in by Silvan Scherrer, 8 years ago

SMPlayer: update trunk to version 17.1.0

  • Property svn:eol-style set to LF
File size: 24.7 KB
RevLine 
[112]1/* smplayer, GUI front-end for mplayer.
[188]2 Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
[112]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 "prefinterface.h"
21#include "images.h"
22#include "preferences.h"
23#include "paths.h"
24#include "languages.h"
25#include "recents.h"
[139]26#include "urlhistory.h"
[165]27#include "autohidewidget.h"
[112]28
29#include <QDir>
30#include <QStyleFactory>
31#include <QFontDialog>
32
[181]33#ifdef HDPI_SUPPORT
34#include "hdpisupport.h"
35
36#if QT_VERSION >= 0x050600
37#define HDPI_USE_SCALE_FACTOR
38#endif
39#endif
40
[124]41#define SINGLE_INSTANCE_TAB 2
[181]42#define HDPI_TAB 5
[124]43
[112]44PrefInterface::PrefInterface(QWidget * parent, Qt::WindowFlags f)
45 : PrefWidget(parent, f )
46{
47 setupUi(this);
48 /* volume_icon->hide(); */
49
50 // Style combo
51#if !STYLE_SWITCHING
[181]52 style_label->hide();
53 style_combo->hide();
[112]54#else
55 style_combo->addItem( "<default>" );
56 style_combo->addItems( QStyleFactory::keys() );
57#endif
58
59 // Icon set combo
60 iconset_combo->addItem( "Default" );
61
[139]62#ifdef SKINS
63 n_skins = 0;
64#endif
65
[112]66 // User
67 QDir icon_dir = Paths::configPath() + "/themes";
68 qDebug("icon_dir: %s", icon_dir.absolutePath().toUtf8().data());
69 QStringList iconsets = icon_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
70 for (int n=0; n < iconsets.count(); n++) {
[139]71 #ifdef SKINS
[176]72 QString css_file = Paths::configPath() + "/themes/" + iconsets[n] + "/main.css";
[139]73 bool is_skin = QFile::exists(css_file);
74 //qDebug("***** %s %d", css_file.toUtf8().constData(), is_skin);
75 if (is_skin) {
76 skin_combo->addItem( iconsets[n] );
77 n_skins++;
78 }
79 else
80 #endif
[112]81 iconset_combo->addItem( iconsets[n] );
82 }
83 // Global
84 icon_dir = Paths::themesPath();
85 qDebug("icon_dir: %s", icon_dir.absolutePath().toUtf8().data());
86 iconsets = icon_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
87 for (int n=0; n < iconsets.count(); n++) {
[139]88 #ifdef SKINS
[176]89 QString css_file = Paths::themesPath() + "/" + iconsets[n] + "/main.css";
[139]90 bool is_skin = QFile::exists(css_file);
91 //qDebug("***** %s %d", css_file.toUtf8().constData(), is_skin);
[170]92 if ((is_skin) && (skin_combo->findText( iconsets[n] ) == -1)) {
[139]93 skin_combo->addItem( iconsets[n] );
94 n_skins++;
95 }
96 else
97 #endif
[112]98 if (iconset_combo->findText( iconsets[n] ) == -1) {
99 iconset_combo->addItem( iconsets[n] );
100 }
101 }
[139]102 #ifdef SKINS
103 if (skin_combo->itemText(0) == "Black") {
104 skin_combo->removeItem(0);
105 skin_combo->addItem("Black");
106 }
107 #endif
[112]108
[128]109#ifdef SINGLE_INSTANCE
[112]110 connect(single_instance_check, SIGNAL(toggled(bool)),
111 this, SLOT(changeInstanceImages()));
[128]112#else
113 tabWidget->setTabEnabled(SINGLE_INSTANCE_TAB, false);
114#endif
[112]115
[139]116#ifdef SKINS
117 connect(gui_combo, SIGNAL(currentIndexChanged(int)),
118 this, SLOT(GUIChanged(int)));
119#endif
120
[176]121 connect(mainwindow_resize_combo, SIGNAL(currentIndexChanged(int)),
122 this, SLOT(resizeMethodChanged(int)));
123
[139]124#ifndef SEEKBAR_RESOLUTION
125 seeking_method_group->hide();
126#endif
127
128#ifndef SKINS
129 skin_combo->hide();
130 skin_label->hide();
131 skin_sp->hide();
132#endif
133
[181]134#ifdef HDPI_SUPPORT
135 scale_group->setEnabled(false);
136 connect(hdpi_scale_slider, SIGNAL(valueChanged(int)), this, SLOT(updateHDPIScaleNumber(int)));
137 #ifndef HDPI_STORE_DATA
138 tabWidget->setTabEnabled(HDPI_TAB, false);
139 #endif
140#else
141 tabWidget->setTabEnabled(HDPI_TAB, false);
142#endif
143
[112]144 retranslateStrings();
145}
146
147PrefInterface::~PrefInterface()
148{
149}
150
151QString PrefInterface::sectionName() {
152 return tr("Interface");
153}
154
155QPixmap PrefInterface::sectionIcon() {
[181]156 return Images::icon("pref_gui");
[112]157}
158
159void PrefInterface::createLanguageCombo() {
160 QMap <QString,QString> m = Languages::translations();
161
162 // Language combo
163 QDir translation_dir = Paths::translationPath();
164 QStringList languages = translation_dir.entryList( QStringList() << "*.qm");
165 QRegExp rx_lang("smplayer_(.*)\\.qm");
166 language_combo->clear();
[181]167 language_combo->addItem("<" + tr("System language") + ">");
[112]168 for (int n=0; n < languages.count(); n++) {
169 if (rx_lang.indexIn(languages[n]) > -1) {
170 QString l = rx_lang.cap(1);
171 QString text = l;
172 if (m.contains(l)) text = m[l] + " ("+l+")";
173 language_combo->addItem( text, l );
174 }
175 }
176}
177
178void PrefInterface::retranslateStrings() {
179 int mainwindow_resize = mainwindow_resize_combo->currentIndex();
180 int timeslider_pos = timeslider_behaviour_combo->currentIndex();
181
182 retranslateUi(this);
183
184 mainwindow_resize_combo->setCurrentIndex(mainwindow_resize);
185 timeslider_behaviour_combo->setCurrentIndex(timeslider_pos);
186
187 // Icons
[176]188 /* resize_window_icon->setPixmap( Images::icon("resize_window") ); */
[112]189 /* volume_icon->setPixmap( Images::icon("speaker") ); */
190
[128]191#ifdef SINGLE_INSTANCE
[112]192 changeInstanceImages();
[128]193#endif
[112]194
195 // Seek widgets
196 seek1->setLabel( tr("&Short jump") );
197 seek2->setLabel( tr("&Medium jump") );
198 seek3->setLabel( tr("&Long jump") );
199 seek4->setLabel( tr("Mouse &wheel jump") );
200
201 if (qApp->isLeftToRight()) {
[176]202 seek1->setIcon( Images::icon("forward10s", 32) );
203 seek2->setIcon( Images::icon("forward1m", 32) );
204 seek3->setIcon( Images::icon("forward10m", 32) );
[112]205 } else {
[176]206 seek1->setIcon( Images::flippedIcon("forward10s", 32) );
207 seek2->setIcon( Images::flippedIcon("forward1m", 32) );
208 seek3->setIcon( Images::flippedIcon("forward10m", 32) );
[112]209 }
[176]210 seek4->setIcon( Images::icon("mouse",32) );
[112]211
212 // Language combo
213 int language_item = language_combo->currentIndex();
214 createLanguageCombo();
215 language_combo->setCurrentIndex( language_item );
216
217 // Iconset combo
218 iconset_combo->setItemText( 0, tr("Default") );
219
220#if STYLE_SWITCHING
221 style_combo->setItemText( 0, tr("Default") );
222#endif
223
224 int gui_index = gui_combo->currentIndex();
225 gui_combo->clear();
[176]226#ifdef DEFAULTGUI
[165]227 gui_combo->addItem( tr("Basic GUI"), "DefaultGUI");
[176]228#endif
229#ifdef MINIGUI
[112]230 gui_combo->addItem( tr("Mini GUI"), "MiniGUI");
[176]231#endif
[165]232#ifdef MPCGUI
[112]233 gui_combo->addItem( tr("Mpc GUI"), "MpcGUI");
[165]234#endif
[139]235#ifdef SKINS
236 gui_combo->addItem( tr("Skinnable GUI"), "SkinGUI");
237 if (n_skins == 0) {
238 QModelIndex index = gui_combo->model()->index(gui_combo->count()-1,0);
239 gui_combo->model()->setData(index, QVariant(0), Qt::UserRole -1);
240 }
241#endif
[112]242 gui_combo->setCurrentIndex(gui_index);
243
244 floating_width_label->setNum(floating_width_slider->value());
245 floating_margin_label->setNum(floating_margin_slider->value());
246
[181]247#ifdef HDPI_SUPPORT
248 #ifdef HDPI_USE_SCALE_FACTOR
249 hdpi_scale_label->setText(tr("Scale fact&or:"));
250 hdpi_scale_num_label->setNum((double) hdpi_scale_slider->value() / 10);
251 #else
252 hdpi_scale_label->setText(tr("Pixel rati&o:"));
253 hdpi_scale_num_label->setNum(hdpi_scale_slider->value());
254 #endif
255#endif
256
[112]257 createHelp();
258}
259
260void PrefInterface::setData(Preferences * pref) {
261 setLanguage( pref->language );
262 setIconSet( pref->iconset );
263
264 setResizeMethod( pref->resize_method );
265 setSaveSize( pref->save_window_size_on_exit );
[142]266
[176]267 center_window_check->setChecked(pref->center_window);
268 center_if_outside_check->setChecked(pref->center_window_if_outside);
[142]269
[128]270#ifdef SINGLE_INSTANCE
[112]271 setUseSingleInstance(pref->use_single_instance);
[128]272#endif
[112]273 setSeeking1(pref->seeking1);
274 setSeeking2(pref->seeking2);
275 setSeeking3(pref->seeking3);
276 setSeeking4(pref->seeking4);
277
278 setUpdateWhileDragging(pref->update_while_seeking);
[139]279#ifdef SEEKBAR_RESOLUTION
[119]280 setRelativeSeeking(pref->relative_seeking);
[139]281#endif
[124]282 setPreciseSeeking(pref->precise_seeking);
[112]283
[142]284 reset_stop_check->setChecked(pref->reset_stop);
285
[112]286 setDefaultFont(pref->default_font);
287
[124]288 setHideVideoOnAudioFiles(pref->hide_video_window_on_audio_files);
289
[112]290#if STYLE_SWITCHING
291 setStyle( pref->style );
292#endif
293
294 setGUI(pref->gui);
295
296 setFloatingAnimated(pref->floating_control_animated);
297 setFloatingWidth(pref->floating_control_width);
298 setFloatingMargin(pref->floating_control_margin);
299 setDisplayFloatingInCompactMode(pref->floating_display_in_compact_mode);
[165]300 floating_move_bottom_check->setChecked(pref->floating_activation_area == AutohideWidget::Bottom);
301 floating_hide_delay_spin->setValue(pref->floating_hide_delay);
[139]302
303 setRecentsMaxItems(pref->history_recents->maxItems());
304 setURLMaxItems(pref->history_urls->maxItems());
305 setRememberDirs(pref->save_dirs);
[181]306
307#ifdef HDPI_SUPPORT
308 loadHDPIData();
309#endif
[112]310}
311
312void PrefInterface::getData(Preferences * pref) {
313 requires_restart = false;
314 language_changed = false;
315 iconset_changed = false;
[128]316 gui_changed = false;
317 style_changed = false;
[188]318 font_changed = false;
[112]319 recents_changed = false;
320
321 if (pref->language != language()) {
322 pref->language = language();
323 language_changed = true;
324 qDebug("PrefInterface::getData: chosen language: '%s'", pref->language.toUtf8().data());
325 }
326
327 if (pref->iconset != iconSet()) {
328 pref->iconset = iconSet();
329 iconset_changed = true;
330 }
331
[128]332 if (pref->gui != GUI()) {
333 pref->gui = GUI();
334 gui_changed = true;
335 }
336
[112]337 pref->resize_method = resizeMethod();
338 pref->save_window_size_on_exit = saveSize();
339
[176]340 pref->center_window = center_window_check->isChecked();
341 pref->center_window_if_outside = center_if_outside_check->isChecked();
[142]342
[128]343#ifdef SINGLE_INSTANCE
[112]344 pref->use_single_instance = useSingleInstance();
[128]345#endif
[112]346
347 pref->seeking1 = seeking1();
348 pref->seeking2 = seeking2();
349 pref->seeking3 = seeking3();
350 pref->seeking4 = seeking4();
351
352 pref->update_while_seeking = updateWhileDragging();
[139]353#ifdef SEEKBAR_RESOLUTION
[119]354 pref->relative_seeking= relativeSeeking();
[139]355#endif
[124]356 pref->precise_seeking = preciseSeeking();
[112]357
[142]358 pref->reset_stop = reset_stop_check->isChecked();
359
[188]360 if (pref->default_font != defaultFont()) {
361 pref->default_font = defaultFont();
362 font_changed = true;
363 }
[112]364
[124]365 pref->hide_video_window_on_audio_files = hideVideoOnAudioFiles();
366
[112]367#if STYLE_SWITCHING
[188]368 if ( pref->style != style() ) {
369 pref->style = style();
[112]370 style_changed = true;
371 }
372#endif
373
374 pref->floating_control_animated = floatingAnimated();
375 pref->floating_control_width = floatingWidth();
376 pref->floating_control_margin = floatingMargin();
377 pref->floating_display_in_compact_mode = displayFloatingInCompactMode();
[165]378 pref->floating_activation_area = floating_move_bottom_check->isChecked() ? AutohideWidget::Bottom : AutohideWidget::Anywhere;
379 pref->floating_hide_delay = floating_hide_delay_spin->value();
[139]380
381 if (pref->history_recents->maxItems() != recentsMaxItems()) {
382 pref->history_recents->setMaxItems( recentsMaxItems() );
383 recents_changed = true;
384 }
385
386 if (pref->history_urls->maxItems() != urlMaxItems()) {
387 pref->history_urls->setMaxItems( urlMaxItems() );
388 url_max_changed = true;
389 }
390
391 pref->save_dirs = rememberDirs();
[181]392
393#ifdef HDPI_SUPPORT
394 saveHDPIData();
395#endif
[112]396}
397
398void PrefInterface::setLanguage(QString lang) {
399 if (lang.isEmpty()) {
400 language_combo->setCurrentIndex(0);
401 }
402 else {
403 int pos = language_combo->findData(lang);
404 if (pos != -1)
405 language_combo->setCurrentIndex( pos );
406 else
407 language_combo->setCurrentText(lang);
408 }
409}
410
411QString PrefInterface::language() {
412 if (language_combo->currentIndex()==0)
413 return "";
414 else
415 return language_combo->itemData( language_combo->currentIndex() ).toString();
416}
417
418void PrefInterface::setIconSet(QString set) {
[139]419 /*
[112]420 if (set.isEmpty())
421 iconset_combo->setCurrentIndex(0);
422 else
423 iconset_combo->setCurrentText(set);
[139]424 */
425 iconset_combo->setCurrentIndex(0);
426 for (int n=0; n < iconset_combo->count(); n++) {
427 if (iconset_combo->itemText(n) == set) {
428 iconset_combo->setCurrentIndex(n);
429 break;
430 }
431 }
432#ifdef SKINS
433 skin_combo->setCurrentIndex(0);
434 for (int n=0; n < skin_combo->count(); n++) {
435 if (skin_combo->itemText(n) == set) {
436 skin_combo->setCurrentIndex(n);
437 break;
438 }
439 }
440#endif
[112]441}
442
443QString PrefInterface::iconSet() {
[139]444#ifdef SKINS
445 QString GUI = gui_combo->itemData(gui_combo->currentIndex()).toString();
446 if (GUI == "SkinGUI") {
447 return skin_combo->currentText();
448 }
449 else
450#endif
[112]451 if (iconset_combo->currentIndex()==0)
452 return "";
453 else
454 return iconset_combo->currentText();
455}
456
457void PrefInterface::setResizeMethod(int v) {
458 mainwindow_resize_combo->setCurrentIndex(v);
459}
460
461int PrefInterface::resizeMethod() {
462 return mainwindow_resize_combo->currentIndex();
463}
464
465void PrefInterface::setSaveSize(bool b) {
466 save_size_check->setChecked(b);
467}
468
469bool PrefInterface::saveSize() {
470 return save_size_check->isChecked();
471}
472
473
474void PrefInterface::setStyle(QString style) {
[181]475 if (style.isEmpty()) {
[112]476 style_combo->setCurrentIndex(0);
[181]477 } else {
478 int i = style_combo->findText(style, Qt::MatchFixedString);
479 if (i < 0) i = 0;
480 style_combo->setCurrentIndex(i);
481 }
[112]482}
483
484QString PrefInterface::style() {
[181]485 if (style_combo->currentIndex() == 0)
[112]486 return "";
[181]487 else
[112]488 return style_combo->currentText();
489}
490
491void PrefInterface::setGUI(QString gui_name) {
[139]492#ifdef SKINS
493 if ((n_skins == 0) && (gui_name == "SkinGUI")) gui_name = "DefaultGUI";
494#endif
[112]495 int i = gui_combo->findData(gui_name);
496 if (i < 0) i=0;
497 gui_combo->setCurrentIndex(i);
498}
499
500QString PrefInterface::GUI() {
501 return gui_combo->itemData(gui_combo->currentIndex()).toString();
502}
503
[139]504#ifdef SKINS
505void PrefInterface::GUIChanged(int index) {
506 if (gui_combo->itemData(index).toString() == "SkinGUI") {
507 iconset_combo->hide();
508 iconset_label->hide();
509 iconset_sp->hide();
510 skin_combo->show();
511 skin_label->show();
512 skin_sp->show();
513 } else {
514 iconset_combo->show();
515 iconset_label->show();
516 iconset_sp->show();
517 skin_combo->hide();
518 skin_label->hide();
519 skin_sp->hide();
520 }
521}
522#endif
523
[176]524void PrefInterface::resizeMethodChanged(int index) {
525 center_if_outside_check->setEnabled(index != 0);
526}
527
[128]528#ifdef SINGLE_INSTANCE
[112]529void PrefInterface::setUseSingleInstance(bool b) {
530 single_instance_check->setChecked(b);
531 //singleInstanceButtonToggled(b);
532}
533
534bool PrefInterface::useSingleInstance() {
535 return single_instance_check->isChecked();
536}
[128]537#endif
[112]538
539void PrefInterface::setSeeking1(int n) {
540 seek1->setTime(n);
541}
542
543int PrefInterface::seeking1() {
544 return seek1->time();
545}
546
547void PrefInterface::setSeeking2(int n) {
548 seek2->setTime(n);
549}
550
551int PrefInterface::seeking2() {
552 return seek2->time();
553}
554
555void PrefInterface::setSeeking3(int n) {
556 seek3->setTime(n);
557}
558
559int PrefInterface::seeking3() {
560 return seek3->time();
561}
562
563void PrefInterface::setSeeking4(int n) {
564 seek4->setTime(n);
565}
566
567int PrefInterface::seeking4() {
568 return seek4->time();
569}
570
571void PrefInterface::setUpdateWhileDragging(bool b) {
572 if (b)
573 timeslider_behaviour_combo->setCurrentIndex(0);
574 else
575 timeslider_behaviour_combo->setCurrentIndex(1);
576}
577
578bool PrefInterface::updateWhileDragging() {
579 return (timeslider_behaviour_combo->currentIndex() == 0);
580}
581
[139]582#ifdef SEEKBAR_RESOLUTION
[119]583void PrefInterface::setRelativeSeeking(bool b) {
584 relative_seeking_button->setChecked(b);
585 absolute_seeking_button->setChecked(!b);
586}
587
588bool PrefInterface::relativeSeeking() {
589 return relative_seeking_button->isChecked();
590}
[139]591#endif
[119]592
[124]593void PrefInterface::setPreciseSeeking(bool b) {
594 precise_seeking_check->setChecked(b);
595}
596
597bool PrefInterface::preciseSeeking() {
598 return precise_seeking_check->isChecked();
599}
600
[112]601void PrefInterface::setDefaultFont(QString font_desc) {
602 default_font_edit->setText(font_desc);
603}
604
605QString PrefInterface::defaultFont() {
606 return default_font_edit->text();
607}
608
609void PrefInterface::on_changeFontButton_clicked() {
610 QFont f = qApp->font();
611
612 if (!default_font_edit->text().isEmpty()) {
613 f.fromString(default_font_edit->text());
614 }
615
616 bool ok;
617 f = QFontDialog::getFont( &ok, f, this);
618
619 if (ok) {
620 default_font_edit->setText( f.toString() );
621 }
622}
623
[128]624#ifdef SINGLE_INSTANCE
[112]625void PrefInterface::changeInstanceImages() {
626 if (single_instance_check->isChecked())
627 instances_icon->setPixmap( Images::icon("instance1") );
628 else
629 instances_icon->setPixmap( Images::icon("instance2") );
630}
[128]631#endif
[112]632
[124]633void PrefInterface::setHideVideoOnAudioFiles(bool b) {
634 hide_video_window_on_audio_check->setChecked(b);
635}
636
637bool PrefInterface::hideVideoOnAudioFiles() {
638 return hide_video_window_on_audio_check->isChecked();
639}
640
[112]641// Floating tab
642void PrefInterface::setFloatingAnimated(bool b) {
643 floating_animated_check->setChecked(b);
644}
645
646bool PrefInterface::floatingAnimated() {
647 return floating_animated_check->isChecked();
648}
649
650void PrefInterface::setFloatingWidth(int percentage) {
651 floating_width_slider->setValue(percentage);
652}
653
654int PrefInterface::floatingWidth() {
655 return floating_width_slider->value();
656}
657
658void PrefInterface::setFloatingMargin(int pixels) {
659 floating_margin_slider->setValue(pixels);
660}
661
662int PrefInterface::floatingMargin() {
663 return floating_margin_slider->value();
664}
665
666void PrefInterface::setDisplayFloatingInCompactMode(bool b) {
667 floating_compact_check->setChecked(b);
668}
669
670bool PrefInterface::displayFloatingInCompactMode() {
671 return floating_compact_check->isChecked();
672}
673
[139]674void PrefInterface::setRecentsMaxItems(int n) {
675 recents_max_items_spin->setValue(n);
676}
677
678int PrefInterface::recentsMaxItems() {
679 return recents_max_items_spin->value();
680}
681
682void PrefInterface::setURLMaxItems(int n) {
683 url_max_items_spin->setValue(n);
684}
685
686int PrefInterface::urlMaxItems() {
687 return url_max_items_spin->value();
688}
689
690void PrefInterface::setRememberDirs(bool b) {
691 save_dirs_check->setChecked(b);
692}
693
694bool PrefInterface::rememberDirs() {
695 return save_dirs_check->isChecked();
696}
697
[181]698#ifdef HDPI_SUPPORT
699void PrefInterface::loadHDPIData() {
700 HDPISupport * hdpi = HDPISupport::instance();
701 enable_hdpi_check->setChecked(hdpi->isHDPIEnabled());
702 auto_scale_check->setChecked(hdpi->autoScale());
703
704 #ifdef HDPI_USE_SCALE_FACTOR
705 hdpi_scale_slider->setMinimum(5);
706 hdpi_scale_slider->setMaximum(4*10);
707 hdpi_scale_slider->setValue(hdpi->scaleFactor() * 10);
708 #else
709 hdpi_scale_slider->setMinimum(0);
710 hdpi_scale_slider->setMaximum(4);
711 hdpi_scale_slider->setValue(hdpi->pixelRatio());
712 #endif
713}
714
715void PrefInterface::updateHDPIScaleNumber(int v) {
716 #ifdef HDPI_USE_SCALE_FACTOR
717 hdpi_scale_num_label->setNum((double) v / 10);
718 #else
719 hdpi_scale_num_label->setNum(v);
720 #endif
721}
722
723void PrefInterface::saveHDPIData() {
724 HDPISupport * hdpi = HDPISupport::instance();
725 hdpi->setHDPIEnabled(enable_hdpi_check->isChecked());
726 hdpi->setAutoScale(auto_scale_check->isChecked());
727 #ifdef HDPI_USE_SCALE_FACTOR
728 hdpi->setScaleFactor((double) hdpi_scale_slider->value() / 10);
729 #else
730 hdpi->setPixelRatio(hdpi_scale_slider->value());
731 #endif
732 #ifdef HDPI_STORE_DATA
733 hdpi->save();
734 #endif
735}
736#endif
737
[112]738void PrefInterface::createHelp() {
739 clearHelp();
740
741 addSectionTitle(tr("Interface"));
742
743 setWhatsThis(mainwindow_resize_combo, tr("Autoresize"),
744 tr("The main window can be resized automatically. Select the option "
745 "you prefer.") );
746
[176]747 setWhatsThis(center_if_outside_check, tr("Prevent window to get outside of screen"),
748 tr("If after an autoresize the main window gets outside of the screen this option "
749 "will center the window to prevent it.") );
750
751 setWhatsThis(center_window_check, tr("Center window"),
752 tr("When this option is enabled, the main window will be centered on the desktop.") );
753
[112]754 setWhatsThis(save_size_check, tr("Remember position and size"),
755 tr("If you check this option, the position and size of the main "
756 "window will be saved and restored when you run SMPlayer again.") );
757
[124]758 setWhatsThis(hide_video_window_on_audio_check, tr("Hide video window when playing audio files"),
759 tr("If this option is enabled the video window will be hidden when playing audio files.") );
760
[112]761 setWhatsThis(language_combo, tr("Language"),
762 tr("Here you can change the language of the application.") );
763
764 setWhatsThis(gui_combo, tr("GUI"),
[165]765 tr("Select the graphic interface you prefer for the application.") +"<br>"+
766 tr("The <b>Basic GUI</b> provides the traditional interface, with the "
767 "toolbar and control bar.") +" "+
768 tr("The <b>Mini GUI</b> provides a more simple interface, without toolbar and a control bar with few "
[176]769 "buttons.")
[165]770#ifdef MPCGUI
771 +" "+
772 tr("The <b>Mpc GUI</b> looks like the interface in Media Player Classic.")
773#endif
[176]774#ifdef SKINS
775 +" "+
776 tr("The <b>Skinnable GUI</b> provides an interface where several skins are available.")
777#endif
778
[165]779 );
[112]780
[139]781 setWhatsThis(iconset_combo, tr("Icon set"),
782 tr("Select the icon set you prefer for the application.") );
783
784#ifdef SKINS
785 setWhatsThis(skin_combo, tr("Skin"),
786 tr("Select the skin you prefer for the application. Only available with the skinnable GUI.") );
787#endif
788
789 setWhatsThis(style_combo, tr("Style"),
790 tr("Select the style you prefer for the application.") );
791
792
[112]793 setWhatsThis(changeFontButton, tr("Default font"),
794 tr("You can change here the application's font.") );
795
796 addSectionTitle(tr("Seeking"));
797
798 setWhatsThis(seek1, tr("Short jump"),
799 tr("Select the time that should be go forward or backward when you "
800 "choose the %1 action.").arg(tr("short jump")) );
801
802 setWhatsThis(seek2, tr("Medium jump"),
803 tr("Select the time that should be go forward or backward when you "
804 "choose the %1 action.").arg(tr("medium jump")) );
805
806 setWhatsThis(seek3, tr("Long jump"),
807 tr("Select the time that should be go forward or backward when you "
808 "choose the %1 action.").arg(tr("long jump")) );
809
810 setWhatsThis(seek4, tr("Mouse wheel jump"),
811 tr("Select the time that should be go forward or backward when you "
812 "move the mouse wheel.") );
813
814 setWhatsThis(timeslider_behaviour_combo, tr("Behaviour of time slider"),
815 tr("Select what to do when dragging the time slider.") );
816
[139]817#ifdef SEEKBAR_RESOLUTION
[119]818 setWhatsThis(seeking_method_group, tr("Seeking method"),
819 tr("Sets the method to be used when seeking with the slider. "
820 "Absolute seeking may be a little bit more accurate, while "
821 "relative seeking may work better with files with a wrong length.") );
[139]822#endif
[119]823
[124]824 setWhatsThis(precise_seeking_check, tr("Precise seeking"),
825 tr("If this option is enabled, seeks are more accurate but they "
826 "can be a little bit slower. May not work with some video formats.") +"<br>"+
827 tr("Note: this option only works with MPlayer2") );
828
[142]829 setWhatsThis(reset_stop_check, tr("Pressing the stop button once resets the time position"),
830 tr("By default when the stop button is pressed the time position is remembered "
831 "so if you press play button the media will resume at the same point. You need "
832 "to press the stop button twice to reset the time position, but if this "
[176]833 "option is checked the time position will be set to 0 with only one "
[142]834 "press of the stop button.") );
835
[128]836#ifdef SINGLE_INSTANCE
[112]837 addSectionTitle(tr("Instances"));
838
839 setWhatsThis(single_instance_check,
840 tr("Use only one running instance of SMPlayer"),
841 tr("Check this option if you want to use an already running instance "
842 "of SMPlayer when opening other files.") );
[128]843#endif
[112]844
845 addSectionTitle(tr("Floating control"));
846
847 setWhatsThis(floating_animated_check, tr("Animated"),
848 tr("If this option is enabled, the floating control will appear "
849 "with an animation.") );
850
851 setWhatsThis(floating_width_slider, tr("Width"),
852 tr("Specifies the width of the control (as a percentage).") );
853
854 setWhatsThis(floating_margin_slider, tr("Margin"),
855 tr("This option sets the number of pixels that the floating control "
856 "will be away from the bottom of the screen. Useful when the "
857 "screen is a TV, as the overscan might prevent the control to be "
858 "visible.") );
859
[165]860 setWhatsThis(floating_move_bottom_check, tr("Show only when moving the mouse to the bottom of the screen"),
861 tr("If this option is checked, the floating control will only be displayed when the mouse is moved "
862 "to the bottom of the screen. Otherwise the control will appear whenever the mouse is moved, no matter "
863 "its position.") );
864
[112]865 setWhatsThis(floating_compact_check, tr("Display in compact mode too"),
866 tr("If this option is enabled, the floating control will appear "
[165]867 "in compact mode too.") +" " +
868 tr("This option only works with the basic GUI.") +" "+
869 tr("<b>Warning:</b> the floating control has not been "
[112]870 "designed for compact mode and it might not work properly.") );
871
[165]872 setWhatsThis(floating_hide_delay_spin, tr("Time to hide the control"),
873 tr("Sets the time (in milliseconds) to hide the control after the mouse went away from the control."));
[139]874
875 addSectionTitle(tr("Privacy"));
876
877 setWhatsThis(recents_max_items_spin, tr("Recent files"),
878 tr("Select the maximum number of items that will be shown in the "
879 "<b>Open->Recent files</b> submenu. If you set it to 0 that "
880 "menu won't be shown at all.") );
881
882 setWhatsThis(url_max_items_spin, tr("Max. URLs"),
883 tr("Select the maximum number of items that the <b>Open->URL</b> "
884 "dialog will remember. Set it to 0 if you don't want any URL "
885 "to be stored.") );
886
887 setWhatsThis(save_dirs_check, tr("Remember last directory"),
888 tr("If this option is checked, SMPlayer will remember the last folder you use to open a file.") );
[112]889}
890
891#include "moc_prefinterface.cpp"
Note: See TracBrowser for help on using the repository browser.