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