source: smplayer/trunk/src/basegui.cpp@ 121

Last change on this file since 121 was 119, checked in by Silvan Scherrer, 14 years ago

SMPlayer: latest svn update

  • Property svn:eol-style set to LF
File size: 142.7 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2011 Ricardo Villalba <rvm@escomposlinux.org>
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#include "basegui.h"
20
21#include "filedialog.h"
22#include <QMessageBox>
23#include <QLabel>
24#include <QMenu>
25#include <QFileInfo>
26#include <QApplication>
27#include <QMenuBar>
28#include <QHBoxLayout>
29#include <QCursor>
30#include <QTimer>
31#include <QStyle>
32#include <QRegExp>
33#include <QStatusBar>
34#include <QActionGroup>
35#include <QUrl>
36#include <QDragEnterEvent>
37#include <QDropEvent>
38#include <QDesktopServices>
39#include <QInputDialog>
40
41#include <cmath>
42
43#include "mplayerwindow.h"
44#include "desktopinfo.h"
45#include "helper.h"
46#include "paths.h"
47#include "colorutils.h"
48#include "global.h"
49#include "translator.h"
50#include "images.h"
51#include "preferences.h"
52#include "discname.h"
53#include "timeslider.h"
54#include "logwindow.h"
55#include "playlist.h"
56#include "filepropertiesdialog.h"
57#include "eqslider.h"
58#include "videoequalizer.h"
59#include "audioequalizer.h"
60#include "inputdvddirectory.h"
61#include "inputmplayerversion.h"
62#include "inputurl.h"
63#include "recents.h"
64#include "urlhistory.h"
65#include "about.h"
66#include "errordialog.h"
67#include "timedialog.h"
68#include "clhelp.h"
69#include "findsubtitleswindow.h"
70#include "videopreview.h"
71#include "mplayerversion.h"
72
73#include "config.h"
74#include "actionseditor.h"
75
76#include "myserver.h"
77
78#include "tvlist.h"
79
80#include "preferencesdialog.h"
81#ifndef NO_USE_INI_FILES
82#include "prefgeneral.h"
83#endif
84#include "prefinterface.h"
85#include "prefinput.h"
86#include "prefadvanced.h"
87#include "prefplaylist.h"
88
89#include "myaction.h"
90#include "myactiongroup.h"
91#include "playlist.h"
92
93#include "constants.h"
94
95#include "extensions.h"
96
97#ifdef Q_OS_WIN
98#include "deviceinfo.h"
99#include <QSysInfo>
100#endif
101
102using namespace Global;
103
104BaseGui::BaseGui( QWidget* parent, Qt::WindowFlags flags )
105 : QMainWindow( parent, flags ),
106 near_top(false),
107 near_bottom(false)
108{
109#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
110 /* Disable screensaver by event */
111 just_stopped = false;
112#endif
113 ignore_show_hide_events = false;
114
115 arg_close_on_finish = -1;
116 arg_start_in_fullscreen = -1;
117
118 setWindowTitle( "SMPlayer" );
119
120 // Not created objects
121 server = 0;
122 popup = 0;
123 pref_dialog = 0;
124 file_dialog = 0;
125 clhelp_window = 0;
126 find_subs_dialog = 0;
127 video_preview = 0;
128
129 // Create objects:
130 createPanel();
131 setCentralWidget(panel);
132
133 createMplayerWindow();
134 createCore();
135 createPlaylist();
136 createVideoEqualizer();
137 createAudioEqualizer();
138
139 // Mouse Wheel
140 connect( this, SIGNAL(wheelUp()),
141 core, SLOT(wheelUp()) );
142 connect( this, SIGNAL(wheelDown()),
143 core, SLOT(wheelDown()) );
144 connect( mplayerwindow, SIGNAL(wheelUp()),
145 core, SLOT(wheelUp()) );
146 connect( mplayerwindow, SIGNAL(wheelDown()),
147 core, SLOT(wheelDown()) );
148
149 // Set style before changing color of widgets:
150 // Set style
151#if STYLE_SWITCHING
152 qDebug( "Style name: '%s'", qApp->style()->objectName().toUtf8().data() );
153 qDebug( "Style class name: '%s'", qApp->style()->metaObject()->className() );
154
155 default_style = qApp->style()->objectName();
156 if (!pref->style.isEmpty()) {
157 qApp->setStyle( pref->style );
158 }
159#endif
160
161 mplayer_log_window = new LogWindow(0);
162 smplayer_log_window = new LogWindow(0);
163
164 createActions();
165 createMenus();
166#if AUTODISABLE_ACTIONS
167 setActionsEnabled(false);
168#endif
169
170#if !DOCK_PLAYLIST
171 connect(playlist, SIGNAL(visibilityChanged(bool)),
172 showPlaylistAct, SLOT(setChecked(bool)) );
173#endif
174
175 retranslateStrings();
176
177 setAcceptDrops(true);
178
179 resize(pref->default_size);
180
181 panel->setFocus();
182
183 initializeGui();
184}
185
186void BaseGui::initializeGui() {
187 if (pref->compact_mode) toggleCompactMode(TRUE);
188 changeStayOnTop(pref->stay_on_top);
189
190#if ALLOW_CHANGE_STYLESHEET
191 changeStyleSheet(pref->iconset);
192#endif
193
194 updateRecents();
195
196 // Call loadActions() outside initialization of the class.
197 // Otherwise DefaultGui (and other subclasses) doesn't exist, and
198 // its actions are not loaded
199 QTimer::singleShot(20, this, SLOT(loadActions()));
200
201 // Single instance
202 server = new MyServer(this);
203 connect(server, SIGNAL(receivedOpen(QString)),
204 this, SLOT(remoteOpen(QString)));
205 connect(server, SIGNAL(receivedOpenFiles(QStringList)),
206 this, SLOT(remoteOpenFiles(QStringList)));
207 connect(server, SIGNAL(receivedAddFiles(QStringList)),
208 this, SLOT(remoteAddFiles(QStringList)));
209 connect(server, SIGNAL(receivedFunction(QString)),
210 this, SLOT(processFunction(QString)));
211 connect(server, SIGNAL(receivedLoadSubtitle(QString)),
212 this, SLOT(remoteLoadSubtitle(QString)));
213 connect(server, SIGNAL(receivedPlayItem(int)),
214 this, SLOT(remotePlayItem(int)));
215 connect(server, SIGNAL(receivedRemoveItem(int)),
216 this, SLOT(remoteRemoveItem(int)));
217 connect(server, SIGNAL(receivedViewPlaylist(QString*)),
218 this, SLOT(remoteViewPlaylist(QString*)));
219 connect(server, SIGNAL(receivedViewStatus(QString*)),
220 this, SLOT(remoteViewStatus(QString*)));
221 connect(server, SIGNAL(receivedViewClipInfo(QString*)),
222 this, SLOT(remoteViewClipInfo(QString*)));
223 connect(server, SIGNAL(receivedSeek(double)),
224 this, SLOT(remoteSeek(double)));
225 connect(server, SIGNAL(receivedGetChecked(QString,QString*)),
226 this, SLOT(remoteGetChecked(QString,QString*)));
227 connect(server, SIGNAL(receivedMoveItem(int,int)),
228 this, SLOT(remoteMoveItem(int,int)));
229 connect(server, SIGNAL(receivedGetVolume(int*)),
230 this, SLOT(remoteGetVolume(int*)));
231 connect(server, SIGNAL(receivedSetVolume(int)),
232 core, SLOT(setVolume(int)));
233
234 if (pref->use_single_instance) {
235 int port = 0;
236 if (!pref->use_autoport) port = pref->connection_port;
237 if (server->listen(port)) {
238 pref->autoport = server->serverPort();
239 pref->save();
240 qDebug("BaseGui::initializeGui: server running on port %d", pref->autoport);
241 } else {
242 qWarning("BaseGui::initializeGui: server couldn't be started");
243 }
244 }
245}
246
247void BaseGui::remotePlayItem(int index){
248 qDebug("BaseGui::remotePlay: '%s'", QString::number((index)).toUtf8().data());
249 if (isMinimized()) showNormal();
250 if (!isVisible()) show();
251 raise();
252 activateWindow();
253 playlist->playItem(index);
254}
255
256void BaseGui::remoteRemoveItem(int index){
257 qDebug("BaseGui::remoteRemove: '%s'", QString::number((index)).toUtf8().data());
258 if (isMinimized()) showNormal();
259 if (!isVisible()) show();
260 raise();
261 activateWindow();
262
263 if(index == -1)
264 playlist->removeAll();
265 else
266 playlist->remove(index);
267}
268
269void BaseGui::remoteMoveItem(int index, int shift){
270 qDebug("BaseGui::remoteRemove: '%s'", QString::number((index)).toUtf8().data());
271 if (isMinimized()) showNormal();
272 if (!isVisible()) show();
273 raise();
274 activateWindow();
275
276 int step = shift / abs(shift);
277 for(int i = index; i != (index + shift); i += step){
278 if(step == -1 && index == 0) break;
279 if(step == +1 && index == (playlist->count() - 1)) break;
280
281 if(step == -1) playlist->moveItemUp(index);
282 if(step == +1) playlist->moveItemDown(index);
283 } //end for
284}
285
286void BaseGui::remoteOpen(QString file) {
287 qDebug("BaseGui::remoteOpen: '%s'", file.toUtf8().data());
288 if (isMinimized()) showNormal();
289 if (!isVisible()) show();
290 raise();
291 activateWindow();
292 open(file);
293}
294
295void BaseGui::remoteOpenFiles(QStringList files) {
296 qDebug("BaseGui::remoteOpenFiles");
297 if (isMinimized()) showNormal();
298 if (!isVisible()) show();
299 raise();
300 activateWindow();
301 openFiles(files);
302}
303
304void BaseGui::remoteAddFiles(QStringList files) {
305 qDebug("BaseGui::remoteAddFiles");
306 if (isMinimized()) showNormal();
307 if (!isVisible()) show();
308 raise();
309 activateWindow();
310
311 playlist->addFiles(files);
312 //open(files[0]);
313}
314
315void BaseGui::remoteLoadSubtitle(QString file) {
316 qDebug("BaseGui::remoteLoadSubtitle: '%s'", file.toUtf8().data());
317
318 setInitialSubtitle(file);
319
320 if (core->state() != Core::Stopped) {
321 core->loadSub(file);
322 }
323}
324
325void BaseGui::remoteViewPlaylist(QString * output){
326 qDebug("BaseGui::remoteViewPlaylist");
327 *output += playlist->print("\t");
328}
329
330void BaseGui::remoteViewStatus(QString * output){
331 qDebug("BaseGui::remoteViewStatus");
332 *output = core->stateToString();
333}
334
335void BaseGui::remoteViewClipInfo(QString * output){
336 qDebug("BaseGui::remoteViewClipInfo");
337
338 *output += QString("%1\t%2\r\n").arg("Filename", core->mdat.filename);
339 *output += QString("%1\t%2\r\n").arg("Position", QString::number(core->mset.current_sec));
340 *output += QString("%1\t%2\r\n").arg("Duration", QString::number(core->mdat.duration));
341
342 *output += QString("%1\t%2\r\n").arg("Title", core->mdat.clip_name);
343 *output += QString("%1\t%2\r\n").arg("Artist", core->mdat.clip_artist);
344 *output += QString("%1\t%2\r\n").arg("Author", core->mdat.clip_author);
345 *output += QString("%1\t%2\r\n").arg("Album", core->mdat.clip_album);
346 *output += QString("%1\t%2\r\n").arg("Genre", core->mdat.clip_genre);
347 *output += QString("%1\t%2\r\n").arg("Date", core->mdat.clip_date);
348 *output += QString("%1\t%2\r\n").arg("Track", core->mdat.clip_track);
349 *output += QString("%1\t%2\r\n").arg("Copyright", core->mdat.clip_copyright);
350 *output += QString("%1\t%2\r\n").arg("Comment", core->mdat.clip_comment);
351 *output += QString("%1\t%2\r\n").arg("Software", core->mdat.clip_software);
352}
353
354void BaseGui::remoteSeek(double sec){
355 qDebug("BaseGui::remoteSeek");
356 core->goToSec(sec);
357}
358
359void BaseGui::remoteGetChecked(QString function, QString* output){
360 qDebug("BaseGui::remoteGet");
361
362 QAction* action = ActionsEditor::findAction(this, function);
363 if(! action) action = ActionsEditor::findAction(playlist, function);
364 if(! action) return;
365
366 bool value = (action->isCheckable() ? action->isChecked() : action->isEnabled());
367 *output = (value ? "true" : "false");
368}
369
370void BaseGui::remoteGetVolume(int *vol){
371 *vol = (pref->global_volume ? pref->volume : core->mset.volume);
372}
373
374BaseGui::~BaseGui() {
375 delete core; // delete before mplayerwindow, otherwise, segfault...
376 delete mplayer_log_window;
377 delete smplayer_log_window;
378
379 delete tvlist;
380 delete radiolist;
381
382//#if !DOCK_PLAYLIST
383 if (playlist) {
384 delete playlist;
385 playlist = 0;
386 }
387//#endif
388
389 if (find_subs_dialog) {
390 delete find_subs_dialog;
391 find_subs_dialog = 0; // Necessary?
392 }
393
394 if (video_preview) {
395 delete video_preview;
396 }
397}
398
399void BaseGui::createActions() {
400 // Menu File
401 openFileAct = new MyAction( QKeySequence("Ctrl+F"), this, "open_file" );
402 connect( openFileAct, SIGNAL(triggered()),
403 this, SLOT(openFile()) );
404
405 openDirectoryAct = new MyAction( this, "open_directory" );
406 connect( openDirectoryAct, SIGNAL(triggered()),
407 this, SLOT(openDirectory()) );
408
409 openPlaylistAct = new MyAction( this, "open_playlist" );
410 connect( openPlaylistAct, SIGNAL(triggered()),
411 playlist, SLOT(load()) );
412
413 openVCDAct = new MyAction( this, "open_vcd" );
414 connect( openVCDAct, SIGNAL(triggered()),
415 this, SLOT(openVCD()) );
416
417 openAudioCDAct = new MyAction( this, "open_audio_cd" );
418 connect( openAudioCDAct, SIGNAL(triggered()),
419 this, SLOT(openAudioCD()) );
420
421#ifdef Q_OS_WIN
422 // VCD's and Audio CD's seem they don't work on windows
423 //openVCDAct->setEnabled(pref->enable_vcd_on_windows);
424 openAudioCDAct->setEnabled(pref->enable_audiocd_on_windows);
425#endif
426
427 openDVDAct = new MyAction( this, "open_dvd" );
428 connect( openDVDAct, SIGNAL(triggered()),
429 this, SLOT(openDVD()) );
430
431 openDVDFolderAct = new MyAction( this, "open_dvd_folder" );
432 connect( openDVDFolderAct, SIGNAL(triggered()),
433 this, SLOT(openDVDFromFolder()) );
434
435 openURLAct = new MyAction( QKeySequence("Ctrl+U"), this, "open_url" );
436 connect( openURLAct, SIGNAL(triggered()),
437 this, SLOT(openURL()) );
438
439 exitAct = new MyAction( QKeySequence("Ctrl+X"), this, "close" );
440 connect( exitAct, SIGNAL(triggered()), this, SLOT(closeWindow()) );
441
442 clearRecentsAct = new MyAction( this, "clear_recents" );
443 connect( clearRecentsAct, SIGNAL(triggered()), this, SLOT(clearRecentsList()) );
444
445 // TV and Radio
446 tvlist = new TVList(pref->check_channels_conf_on_startup,
447 TVList::TV, Paths::configPath() + "/tv.m3u8", this);
448 tvlist->menu()->menuAction()->setObjectName( "tv_menu" );
449 addAction(tvlist->editAct());
450 addAction(tvlist->jumpAct());
451 addAction(tvlist->nextAct());
452 addAction(tvlist->previousAct());
453 tvlist->nextAct()->setShortcut( Qt::Key_H );
454 tvlist->previousAct()->setShortcut( Qt::Key_L );
455 tvlist->nextAct()->setObjectName("next_tv");
456 tvlist->previousAct()->setObjectName("previous_tv");
457 tvlist->editAct()->setObjectName("edit_tv_list");
458 tvlist->jumpAct()->setObjectName("jump_tv_list");
459 connect(tvlist, SIGNAL(activated(QString)), this, SLOT(open(QString)));
460
461 radiolist = new TVList(pref->check_channels_conf_on_startup,
462 TVList::Radio, Paths::configPath() + "/radio.m3u8", this);
463 radiolist->menu()->menuAction()->setObjectName( "radio_menu" );
464 addAction(radiolist->editAct());
465 addAction(radiolist->jumpAct());
466 addAction(radiolist->nextAct());
467 addAction(radiolist->previousAct());
468 radiolist->nextAct()->setShortcut( Qt::SHIFT | Qt::Key_H );
469 radiolist->previousAct()->setShortcut( Qt::SHIFT | Qt::Key_L );
470 radiolist->nextAct()->setObjectName("next_radio");
471 radiolist->previousAct()->setObjectName("previous_radio");
472 radiolist->editAct()->setObjectName("edit_radio_list");
473 radiolist->jumpAct()->setObjectName("jump_radio_list");
474 connect(radiolist, SIGNAL(activated(QString)), this, SLOT(open(QString)));
475
476
477 // Menu Play
478 playAct = new MyAction( this, "play" );
479 connect( playAct, SIGNAL(triggered()),
480 core, SLOT(play()) );
481
482 playOrPauseAct = new MyAction( Qt::Key_MediaPlay, this, "play_or_pause" );
483 connect( playOrPauseAct, SIGNAL(triggered()),
484 core, SLOT(play_or_pause()) );
485
486 pauseAct = new MyAction( Qt::Key_Space, this, "pause" );
487 connect( pauseAct, SIGNAL(triggered()),
488 core, SLOT(pause()) );
489
490 pauseAndStepAct = new MyAction( this, "pause_and_frame_step" );
491 connect( pauseAndStepAct, SIGNAL(triggered()),
492 core, SLOT(pause_and_frame_step()) );
493
494 stopAct = new MyAction( Qt::Key_MediaStop, this, "stop" );
495 connect( stopAct, SIGNAL(triggered()),
496 core, SLOT(stop()) );
497
498 frameStepAct = new MyAction( Qt::Key_Period, this, "frame_step" );
499 connect( frameStepAct, SIGNAL(triggered()),
500 core, SLOT(frameStep()) );
501
502 rewind1Act = new MyAction( Qt::Key_Left, this, "rewind1" );
503 connect( rewind1Act, SIGNAL(triggered()),
504 core, SLOT(srewind()) );
505
506 rewind2Act = new MyAction( Qt::Key_Down, this, "rewind2" );
507 connect( rewind2Act, SIGNAL(triggered()),
508 core, SLOT(rewind()) );
509
510 rewind3Act = new MyAction( Qt::Key_PageDown, this, "rewind3" );
511 connect( rewind3Act, SIGNAL(triggered()),
512 core, SLOT(fastrewind()) );
513
514 forward1Act = new MyAction( Qt::Key_Right, this, "forward1" );
515 connect( forward1Act, SIGNAL(triggered()),
516 core, SLOT(sforward()) );
517
518 forward2Act = new MyAction( Qt::Key_Up, this, "forward2" );
519 connect( forward2Act, SIGNAL(triggered()),
520 core, SLOT(forward()) );
521
522 forward3Act = new MyAction( Qt::Key_PageUp, this, "forward3" );
523 connect( forward3Act, SIGNAL(triggered()),
524 core, SLOT(fastforward()) );
525
526 setAMarkerAct = new MyAction( this, "set_a_marker" );
527 connect( setAMarkerAct, SIGNAL(triggered()),
528 core, SLOT(setAMarker()) );
529
530 setBMarkerAct = new MyAction( this, "set_b_marker" );
531 connect( setBMarkerAct, SIGNAL(triggered()),
532 core, SLOT(setBMarker()) );
533
534 clearABMarkersAct = new MyAction( this, "clear_ab_markers" );
535 connect( clearABMarkersAct, SIGNAL(triggered()),
536 core, SLOT(clearABMarkers()) );
537
538 repeatAct = new MyAction( this, "repeat" );
539 repeatAct->setCheckable( true );
540 connect( repeatAct, SIGNAL(toggled(bool)),
541 core, SLOT(toggleRepeat(bool)) );
542
543 gotoAct = new MyAction( QKeySequence("Ctrl+J"), this, "jump_to" );
544 connect( gotoAct, SIGNAL(triggered()),
545 this, SLOT(showGotoDialog()) );
546
547 // Submenu Speed
548 normalSpeedAct = new MyAction( Qt::Key_Backspace, this, "normal_speed" );
549 connect( normalSpeedAct, SIGNAL(triggered()),
550 core, SLOT(normalSpeed()) );
551
552 halveSpeedAct = new MyAction( Qt::Key_BraceLeft, this, "halve_speed" );
553 connect( halveSpeedAct, SIGNAL(triggered()),
554 core, SLOT(halveSpeed()) );
555
556 doubleSpeedAct = new MyAction( Qt::Key_BraceRight, this, "double_speed" );
557 connect( doubleSpeedAct, SIGNAL(triggered()),
558 core, SLOT(doubleSpeed()) );
559
560 decSpeed10Act = new MyAction( Qt::Key_BracketLeft, this, "dec_speed" );
561 connect( decSpeed10Act, SIGNAL(triggered()),
562 core, SLOT(decSpeed10()) );
563
564 incSpeed10Act = new MyAction( Qt::Key_BracketRight, this, "inc_speed" );
565 connect( incSpeed10Act, SIGNAL(triggered()),
566 core, SLOT(incSpeed10()) );
567
568 decSpeed4Act = new MyAction( this, "dec_speed_4" );
569 connect( decSpeed4Act, SIGNAL(triggered()),
570 core, SLOT(decSpeed4()) );
571
572 incSpeed4Act = new MyAction( this, "inc_speed_4" );
573 connect( incSpeed4Act, SIGNAL(triggered()),
574 core, SLOT(incSpeed4()) );
575
576 decSpeed1Act = new MyAction( this, "dec_speed_1" );
577 connect( decSpeed1Act, SIGNAL(triggered()),
578 core, SLOT(decSpeed1()) );
579
580 incSpeed1Act = new MyAction( this, "inc_speed_1" );
581 connect( incSpeed1Act, SIGNAL(triggered()),
582 core, SLOT(incSpeed1()) );
583
584
585 // Menu Video
586 fullscreenAct = new MyAction( Qt::Key_F, this, "fullscreen" );
587 fullscreenAct->setCheckable( true );
588 connect( fullscreenAct, SIGNAL(toggled(bool)),
589 this, SLOT(toggleFullscreen(bool)) );
590
591 compactAct = new MyAction( QKeySequence("Ctrl+C"), this, "compact" );
592 compactAct->setCheckable( true );
593 connect( compactAct, SIGNAL(toggled(bool)),
594 this, SLOT(toggleCompactMode(bool)) );
595
596 videoEqualizerAct = new MyAction( QKeySequence("Ctrl+E"), this, "video_equalizer" );
597 videoEqualizerAct->setCheckable( true );
598 connect( videoEqualizerAct, SIGNAL(toggled(bool)),
599 this, SLOT(showVideoEqualizer(bool)) );
600
601 // Single screenshot
602 screenshotAct = new MyAction( Qt::Key_S, this, "screenshot" );
603 connect( screenshotAct, SIGNAL(triggered()),
604 core, SLOT(screenshot()) );
605
606 // Multiple screenshots
607 screenshotsAct = new MyAction( QKeySequence("Shift+D"), this, "multiple_screenshots" );
608 connect( screenshotsAct, SIGNAL(triggered()),
609 core, SLOT(screenshots()) );
610
611 videoPreviewAct = new MyAction( this, "video_preview" );
612 connect( videoPreviewAct, SIGNAL(triggered()),
613 this, SLOT(showVideoPreviewDialog()) );
614
615 flipAct = new MyAction( this, "flip" );
616 flipAct->setCheckable( true );
617 connect( flipAct, SIGNAL(toggled(bool)),
618 core, SLOT(toggleFlip(bool)) );
619
620 mirrorAct = new MyAction( this, "mirror" );
621 mirrorAct->setCheckable( true );
622 connect( mirrorAct, SIGNAL(toggled(bool)),
623 core, SLOT(toggleMirror(bool)) );
624
625
626 // Submenu filter
627 postProcessingAct = new MyAction( this, "postprocessing" );
628 postProcessingAct->setCheckable( true );
629 connect( postProcessingAct, SIGNAL(toggled(bool)),
630 core, SLOT(togglePostprocessing(bool)) );
631
632 phaseAct = new MyAction( this, "autodetect_phase" );
633 phaseAct->setCheckable( true );
634 connect( phaseAct, SIGNAL(toggled(bool)),
635 core, SLOT(toggleAutophase(bool)) );
636
637 deblockAct = new MyAction( this, "deblock" );
638 deblockAct->setCheckable( true );
639 connect( deblockAct, SIGNAL(toggled(bool)),
640 core, SLOT(toggleDeblock(bool)) );
641
642 deringAct = new MyAction( this, "dering" );
643 deringAct->setCheckable( true );
644 connect( deringAct, SIGNAL(toggled(bool)),
645 core, SLOT(toggleDering(bool)) );
646
647 addNoiseAct = new MyAction( this, "add_noise" );
648 addNoiseAct->setCheckable( true );
649 connect( addNoiseAct, SIGNAL(toggled(bool)),
650 core, SLOT(toggleNoise(bool)) );
651
652 addLetterboxAct = new MyAction( this, "add_letterbox" );
653 addLetterboxAct->setCheckable( true );
654 connect( addLetterboxAct, SIGNAL(toggled(bool)),
655 core, SLOT(changeLetterbox(bool)) );
656
657 upscaleAct = new MyAction( this, "upscaling" );
658 upscaleAct->setCheckable( true );
659 connect( upscaleAct, SIGNAL(toggled(bool)),
660 core, SLOT(changeUpscale(bool)) );
661
662
663 // Menu Audio
664 audioEqualizerAct = new MyAction( this, "audio_equalizer" );
665 audioEqualizerAct->setCheckable( true );
666 connect( audioEqualizerAct, SIGNAL(toggled(bool)),
667 this, SLOT(showAudioEqualizer(bool)) );
668
669 muteAct = new MyAction( Qt::Key_M, this, "mute" );
670 muteAct->setCheckable( true );
671 connect( muteAct, SIGNAL(toggled(bool)),
672 core, SLOT(mute(bool)) );
673
674#if USE_MULTIPLE_SHORTCUTS
675 decVolumeAct = new MyAction( this, "decrease_volume" );
676 decVolumeAct->setShortcuts( ActionsEditor::stringToShortcuts("9,/") );
677#else
678 decVolumeAct = new MyAction( Qt::Key_9, this, "dec_volume" );
679#endif
680 connect( decVolumeAct, SIGNAL(triggered()),
681 core, SLOT(decVolume()) );
682
683#if USE_MULTIPLE_SHORTCUTS
684 incVolumeAct = new MyAction( this, "increase_volume" );
685 incVolumeAct->setShortcuts( ActionsEditor::stringToShortcuts("0,*") );
686#else
687 incVolumeAct = new MyAction( Qt::Key_0, this, "inc_volume" );
688#endif
689 connect( incVolumeAct, SIGNAL(triggered()),
690 core, SLOT(incVolume()) );
691
692 decAudioDelayAct = new MyAction( Qt::Key_Minus, this, "dec_audio_delay" );
693 connect( decAudioDelayAct, SIGNAL(triggered()),
694 core, SLOT(decAudioDelay()) );
695
696 incAudioDelayAct = new MyAction( Qt::Key_Plus, this, "inc_audio_delay" );
697 connect( incAudioDelayAct, SIGNAL(triggered()),
698 core, SLOT(incAudioDelay()) );
699
700 audioDelayAct = new MyAction( this, "audio_delay" );
701 connect( audioDelayAct, SIGNAL(triggered()),
702 this, SLOT(showAudioDelayDialog()) );
703
704 loadAudioAct = new MyAction( this, "load_audio_file" );
705 connect( loadAudioAct, SIGNAL(triggered()),
706 this, SLOT(loadAudioFile()) );
707
708 unloadAudioAct = new MyAction( this, "unload_audio_file" );
709 connect( unloadAudioAct, SIGNAL(triggered()),
710 core, SLOT(unloadAudioFile()) );
711
712
713 // Submenu Filters
714 extrastereoAct = new MyAction( this, "extrastereo_filter" );
715 extrastereoAct->setCheckable( true );
716 connect( extrastereoAct, SIGNAL(toggled(bool)),
717 core, SLOT(toggleExtrastereo(bool)) );
718
719 karaokeAct = new MyAction( this, "karaoke_filter" );
720 karaokeAct->setCheckable( true );
721 connect( karaokeAct, SIGNAL(toggled(bool)),
722 core, SLOT(toggleKaraoke(bool)) );
723
724 volnormAct = new MyAction( this, "volnorm_filter" );
725 volnormAct->setCheckable( true );
726 connect( volnormAct, SIGNAL(toggled(bool)),
727 core, SLOT(toggleVolnorm(bool)) );
728
729
730 // Menu Subtitles
731 loadSubsAct = new MyAction( this, "load_subs" );
732 connect( loadSubsAct, SIGNAL(triggered()),
733 this, SLOT(loadSub()) );
734
735 unloadSubsAct = new MyAction( this, "unload_subs" );
736 connect( unloadSubsAct, SIGNAL(triggered()),
737 core, SLOT(unloadSub()) );
738
739 decSubDelayAct = new MyAction( Qt::Key_Z, this, "dec_sub_delay" );
740 connect( decSubDelayAct, SIGNAL(triggered()),
741 core, SLOT(decSubDelay()) );
742
743 incSubDelayAct = new MyAction( Qt::Key_X, this, "inc_sub_delay" );
744 connect( incSubDelayAct, SIGNAL(triggered()),
745 core, SLOT(incSubDelay()) );
746
747 subDelayAct = new MyAction( this, "sub_delay" );
748 connect( subDelayAct, SIGNAL(triggered()),
749 this, SLOT(showSubDelayDialog()) );
750
751 decSubPosAct = new MyAction( Qt::Key_R, this, "dec_sub_pos" );
752 connect( decSubPosAct, SIGNAL(triggered()),
753 core, SLOT(decSubPos()) );
754 incSubPosAct = new MyAction( Qt::Key_T, this, "inc_sub_pos" );
755 connect( incSubPosAct, SIGNAL(triggered()),
756 core, SLOT(incSubPos()) );
757
758 decSubScaleAct = new MyAction( Qt::SHIFT | Qt::Key_R, this, "dec_sub_scale" );
759 connect( decSubScaleAct, SIGNAL(triggered()),
760 core, SLOT(decSubScale()) );
761
762 incSubScaleAct = new MyAction( Qt::SHIFT | Qt::Key_T, this, "inc_sub_scale" );
763 connect( incSubScaleAct, SIGNAL(triggered()),
764 core, SLOT(incSubScale()) );
765
766 decSubStepAct = new MyAction( Qt::Key_G, this, "dec_sub_step" );
767 connect( decSubStepAct, SIGNAL(triggered()),
768 core, SLOT(decSubStep()) );
769
770 incSubStepAct = new MyAction( Qt::Key_Y, this, "inc_sub_step" );
771 connect( incSubStepAct, SIGNAL(triggered()),
772 core, SLOT(incSubStep()) );
773
774 useAssAct = new MyAction(this, "use_ass_lib");
775 useAssAct->setCheckable(true);
776 connect( useAssAct, SIGNAL(toggled(bool)), core, SLOT(changeUseAss(bool)) );
777
778 useForcedSubsOnlyAct = new MyAction(this, "use_forced_subs_only");
779 useForcedSubsOnlyAct->setCheckable(true);
780 connect( useForcedSubsOnlyAct, SIGNAL(toggled(bool)), core, SLOT(toggleForcedSubsOnly(bool)) );
781
782 subVisibilityAct = new MyAction(Qt::Key_V, this, "subtitle_visibility");
783 subVisibilityAct->setCheckable(true);
784 connect( subVisibilityAct, SIGNAL(toggled(bool)), core, SLOT(changeSubVisibility(bool)) );
785
786 showFindSubtitlesDialogAct = new MyAction( this, "show_find_sub_dialog" );
787 connect( showFindSubtitlesDialogAct, SIGNAL(triggered()),
788 this, SLOT(showFindSubtitlesDialog()) );
789
790 openUploadSubtitlesPageAct = new MyAction( this, "upload_subtitles" ); //turbos
791 connect( openUploadSubtitlesPageAct, SIGNAL(triggered()), //turbos
792 this, SLOT(openUploadSubtitlesPage()) ); //turbos
793
794
795 // Menu Options
796 showPlaylistAct = new MyAction( QKeySequence("Ctrl+L"), this, "show_playlist" );
797 showPlaylistAct->setCheckable( true );
798 connect( showPlaylistAct, SIGNAL(toggled(bool)),
799 this, SLOT(showPlaylist(bool)) );
800
801 showPropertiesAct = new MyAction( QKeySequence("Ctrl+I"), this, "show_file_properties" );
802 connect( showPropertiesAct, SIGNAL(triggered()),
803 this, SLOT(showFilePropertiesDialog()) );
804
805 showPreferencesAct = new MyAction( QKeySequence("Ctrl+P"), this, "show_preferences" );
806 connect( showPreferencesAct, SIGNAL(triggered()),
807 this, SLOT(showPreferencesDialog()) );
808
809 // Submenu Logs
810 showLogMplayerAct = new MyAction( QKeySequence("Ctrl+M"), this, "show_mplayer_log" );
811 connect( showLogMplayerAct, SIGNAL(triggered()),
812 this, SLOT(showMplayerLog()) );
813
814 showLogSmplayerAct = new MyAction( QKeySequence("Ctrl+S"), this, "show_smplayer_log" );
815 connect( showLogSmplayerAct, SIGNAL(triggered()),
816 this, SLOT(showLog()) );
817
818 // Menu Help
819 showFAQAct = new MyAction( this, "faq" );
820 connect( showFAQAct, SIGNAL(triggered()),
821 this, SLOT(helpFAQ()) );
822
823 showCLOptionsAct = new MyAction( this, "cl_options" );
824 connect( showCLOptionsAct, SIGNAL(triggered()),
825 this, SLOT(helpCLOptions()) );
826
827 showTipsAct = new MyAction( this, "tips" );
828 connect( showTipsAct, SIGNAL(triggered()),
829 this, SLOT(helpTips()) );
830
831 donateAct = new MyAction( this, "donate" );
832 connect( donateAct, SIGNAL(triggered()),
833 this, SLOT(helpDonate()) );
834
835 aboutQtAct = new MyAction( this, "about_qt" );
836 connect( aboutQtAct, SIGNAL(triggered()),
837 this, SLOT(helpAboutQt()) );
838
839 aboutThisAct = new MyAction( this, "about_smplayer" );
840 connect( aboutThisAct, SIGNAL(triggered()),
841 this, SLOT(helpAbout()) );
842
843 // Playlist
844 playNextAct = new MyAction(Qt::Key_Greater, this, "play_next");
845 connect( playNextAct, SIGNAL(triggered()), playlist, SLOT(playNext()) );
846
847 playPrevAct = new MyAction(Qt::Key_Less, this, "play_prev");
848 connect( playPrevAct, SIGNAL(triggered()), playlist, SLOT(playPrev()) );
849
850
851 // Move video window and zoom
852 moveUpAct = new MyAction(Qt::ALT | Qt::Key_Up, this, "move_up");
853 connect( moveUpAct, SIGNAL(triggered()), mplayerwindow, SLOT(moveUp()) );
854
855 moveDownAct = new MyAction(Qt::ALT | Qt::Key_Down, this, "move_down");
856 connect( moveDownAct, SIGNAL(triggered()), mplayerwindow, SLOT(moveDown()) );
857
858 moveLeftAct = new MyAction(Qt::ALT | Qt::Key_Left, this, "move_left");
859 connect( moveLeftAct, SIGNAL(triggered()), mplayerwindow, SLOT(moveLeft()) );
860
861 moveRightAct = new MyAction(Qt::ALT | Qt::Key_Right, this, "move_right");
862 connect( moveRightAct, SIGNAL(triggered()), mplayerwindow, SLOT(moveRight()) );
863
864 incZoomAct = new MyAction(Qt::Key_E, this, "inc_zoom");
865 connect( incZoomAct, SIGNAL(triggered()), core, SLOT(incZoom()) );
866
867 decZoomAct = new MyAction(Qt::Key_W, this, "dec_zoom");
868 connect( decZoomAct, SIGNAL(triggered()), core, SLOT(decZoom()) );
869
870 resetZoomAct = new MyAction(Qt::SHIFT | Qt::Key_E, this, "reset_zoom");
871 connect( resetZoomAct, SIGNAL(triggered()), core, SLOT(resetZoom()) );
872
873 autoZoomAct = new MyAction(Qt::SHIFT | Qt::Key_W, this, "auto_zoom");
874 connect( autoZoomAct, SIGNAL(triggered()), core, SLOT(autoZoom()) );
875
876 autoZoom169Act = new MyAction(Qt::SHIFT | Qt::Key_A, this, "zoom_169");
877 connect( autoZoom169Act, SIGNAL(triggered()), core, SLOT(autoZoomFor169()) );
878
879 autoZoom235Act = new MyAction(Qt::SHIFT | Qt::Key_S, this, "zoom_235");
880 connect( autoZoom235Act, SIGNAL(triggered()), core, SLOT(autoZoomFor235()) );
881
882#if USE_MPLAYER_PANSCAN
883 incPanscanAct = new MyAction(Qt::SHIFT | Qt::Key_M, this, "inc_panscan");
884 connect( incPanscanAct, SIGNAL(triggered()), core, SLOT(incPanscan()) );
885
886 decPanscanAct = new MyAction(Qt::SHIFT | Qt::Key_N, this, "dec_panscan");
887 connect( decPanscanAct, SIGNAL(triggered()), core, SLOT(decPanscan()) );
888#endif
889
890
891 // Actions not in menus or buttons
892 // Volume 2
893#if !USE_MULTIPLE_SHORTCUTS
894 decVolume2Act = new MyAction( Qt::Key_Slash, this, "dec_volume2" );
895 connect( decVolume2Act, SIGNAL(triggered()), core, SLOT(decVolume()) );
896
897 incVolume2Act = new MyAction( Qt::Key_Asterisk, this, "inc_volume2" );
898 connect( incVolume2Act, SIGNAL(triggered()), core, SLOT(incVolume()) );
899#endif
900 // Exit fullscreen
901 exitFullscreenAct = new MyAction( Qt::Key_Escape, this, "exit_fullscreen" );
902 connect( exitFullscreenAct, SIGNAL(triggered()), this, SLOT(exitFullscreen()) );
903
904 nextOSDAct = new MyAction( Qt::Key_O, this, "next_osd");
905 connect( nextOSDAct, SIGNAL(triggered()), core, SLOT(nextOSD()) );
906
907 decContrastAct = new MyAction( Qt::Key_1, this, "dec_contrast");
908 connect( decContrastAct, SIGNAL(triggered()), core, SLOT(decContrast()) );
909
910 incContrastAct = new MyAction( Qt::Key_2, this, "inc_contrast");
911 connect( incContrastAct, SIGNAL(triggered()), core, SLOT(incContrast()) );
912
913 decBrightnessAct = new MyAction( Qt::Key_3, this, "dec_brightness");
914 connect( decBrightnessAct, SIGNAL(triggered()), core, SLOT(decBrightness()) );
915
916 incBrightnessAct = new MyAction( Qt::Key_4, this, "inc_brightness");
917 connect( incBrightnessAct, SIGNAL(triggered()), core, SLOT(incBrightness()) );
918
919 decHueAct = new MyAction(Qt::Key_5, this, "dec_hue");
920 connect( decHueAct, SIGNAL(triggered()), core, SLOT(decHue()) );
921
922 incHueAct = new MyAction( Qt::Key_6, this, "inc_hue");
923 connect( incHueAct, SIGNAL(triggered()), core, SLOT(incHue()) );
924
925 decSaturationAct = new MyAction( Qt::Key_7, this, "dec_saturation");
926 connect( decSaturationAct, SIGNAL(triggered()), core, SLOT(decSaturation()) );
927
928 incSaturationAct = new MyAction( Qt::Key_8, this, "inc_saturation");
929 connect( incSaturationAct, SIGNAL(triggered()), core, SLOT(incSaturation()) );
930
931 decGammaAct = new MyAction( this, "dec_gamma");
932 connect( decGammaAct, SIGNAL(triggered()), core, SLOT(decGamma()) );
933
934 incGammaAct = new MyAction( this, "inc_gamma");
935 connect( incGammaAct, SIGNAL(triggered()), core, SLOT(incGamma()) );
936
937 nextVideoAct = new MyAction( this, "next_video");
938 connect( nextVideoAct, SIGNAL(triggered()), core, SLOT(nextVideo()) );
939
940 nextAudioAct = new MyAction( Qt::Key_K, this, "next_audio");
941 connect( nextAudioAct, SIGNAL(triggered()), core, SLOT(nextAudio()) );
942
943 nextSubtitleAct = new MyAction( Qt::Key_J, this, "next_subtitle");
944 connect( nextSubtitleAct, SIGNAL(triggered()), core, SLOT(nextSubtitle()) );
945
946 nextChapterAct = new MyAction( Qt::Key_At, this, "next_chapter");
947 connect( nextChapterAct, SIGNAL(triggered()), core, SLOT(nextChapter()) );
948
949 prevChapterAct = new MyAction( Qt::Key_Exclam, this, "prev_chapter");
950 connect( prevChapterAct, SIGNAL(triggered()), core, SLOT(prevChapter()) );
951
952 doubleSizeAct = new MyAction( Qt::CTRL | Qt::Key_D, this, "toggle_double_size");
953 connect( doubleSizeAct, SIGNAL(triggered()), core, SLOT(toggleDoubleSize()) );
954
955 resetVideoEqualizerAct = new MyAction( this, "reset_video_equalizer");
956 connect( resetVideoEqualizerAct, SIGNAL(triggered()), video_equalizer, SLOT(reset()) );
957
958 resetAudioEqualizerAct = new MyAction( this, "reset_audio_equalizer");
959 connect( resetAudioEqualizerAct, SIGNAL(triggered()), audio_equalizer, SLOT(reset()) );
960
961 showContextMenuAct = new MyAction( this, "show_context_menu");
962 connect( showContextMenuAct, SIGNAL(triggered()),
963 this, SLOT(showPopupMenu()) );
964
965 nextAspectAct = new MyAction( Qt::Key_A, this, "next_aspect");
966 connect( nextAspectAct, SIGNAL(triggered()),
967 core, SLOT(nextAspectRatio()) );
968
969 nextWheelFunctionAct = new MyAction(this, "next_wheel_function");
970 connect( nextWheelFunctionAct, SIGNAL(triggered()),
971 core, SLOT(nextWheelFunction()) );
972
973 showFilenameAct = new MyAction(Qt::SHIFT | Qt::Key_I, this, "show_filename");
974 connect( showFilenameAct, SIGNAL(triggered()), core, SLOT(showFilenameOnOSD()) );
975
976 toggleDeinterlaceAct = new MyAction(Qt::Key_D, this, "toggle_deinterlacing");
977 connect( toggleDeinterlaceAct, SIGNAL(triggered()), core, SLOT(toggleDeinterlace()) );
978
979
980 // Group actions
981
982 // OSD
983 osdGroup = new MyActionGroup(this);
984 osdNoneAct = new MyActionGroupItem(this, osdGroup, "osd_none", Preferences::None);
985 osdSeekAct = new MyActionGroupItem(this, osdGroup, "osd_seek", Preferences::Seek);
986 osdTimerAct = new MyActionGroupItem(this, osdGroup, "osd_timer", Preferences::SeekTimer);
987 osdTotalAct = new MyActionGroupItem(this, osdGroup, "osd_total", Preferences::SeekTimerTotal);
988 connect( osdGroup, SIGNAL(activated(int)), core, SLOT(changeOSD(int)) );
989
990 // Denoise
991 denoiseGroup = new MyActionGroup(this);
992 denoiseNoneAct = new MyActionGroupItem(this, denoiseGroup, "denoise_none", MediaSettings::NoDenoise);
993 denoiseNormalAct = new MyActionGroupItem(this, denoiseGroup, "denoise_normal", MediaSettings::DenoiseNormal);
994 denoiseSoftAct = new MyActionGroupItem(this, denoiseGroup, "denoise_soft", MediaSettings::DenoiseSoft);
995 connect( denoiseGroup, SIGNAL(activated(int)), core, SLOT(changeDenoise(int)) );
996
997 // Video size
998 sizeGroup = new MyActionGroup(this);
999 size50 = new MyActionGroupItem(this, sizeGroup, "5&0%", "size_50", 50);
1000 size75 = new MyActionGroupItem(this, sizeGroup, "7&5%", "size_75", 75);
1001 size100 = new MyActionGroupItem(this, sizeGroup, "&100%", "size_100", 100);
1002 size125 = new MyActionGroupItem(this, sizeGroup, "1&25%", "size_125", 125);
1003 size150 = new MyActionGroupItem(this, sizeGroup, "15&0%", "size_150", 150);
1004 size175 = new MyActionGroupItem(this, sizeGroup, "1&75%", "size_175", 175);
1005 size200 = new MyActionGroupItem(this, sizeGroup, "&200%", "size_200", 200);
1006 size300 = new MyActionGroupItem(this, sizeGroup, "&300%", "size_300", 300);
1007 size400 = new MyActionGroupItem(this, sizeGroup, "&400%", "size_400", 400);
1008 size100->setShortcut( Qt::CTRL | Qt::Key_1 );
1009 size200->setShortcut( Qt::CTRL | Qt::Key_2 );
1010 connect( sizeGroup, SIGNAL(activated(int)), core, SLOT(changeSize(int)) );
1011 // Make all not checkable
1012 QList <QAction *> size_list = sizeGroup->actions();
1013 for (int n=0; n < size_list.count(); n++) {
1014 size_list[n]->setCheckable(false);
1015 }
1016
1017 // Deinterlace
1018 deinterlaceGroup = new MyActionGroup(this);
1019 deinterlaceNoneAct = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_none", MediaSettings::NoDeinterlace);
1020 deinterlaceL5Act = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_l5", MediaSettings::L5);
1021 deinterlaceYadif0Act = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_yadif0", MediaSettings::Yadif);
1022 deinterlaceYadif1Act = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_yadif1", MediaSettings::Yadif_1);
1023 deinterlaceLBAct = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_lb", MediaSettings::LB);
1024 deinterlaceKernAct = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_kern", MediaSettings::Kerndeint);
1025 connect( deinterlaceGroup, SIGNAL(activated(int)),
1026 core, SLOT(changeDeinterlace(int)) );
1027
1028 // Audio channels
1029 channelsGroup = new MyActionGroup(this);
1030 /* channelsDefaultAct = new MyActionGroupItem(this, channelsGroup, "channels_default", MediaSettings::ChDefault); */
1031 channelsStereoAct = new MyActionGroupItem(this, channelsGroup, "channels_stereo", MediaSettings::ChStereo);
1032 channelsSurroundAct = new MyActionGroupItem(this, channelsGroup, "channels_surround", MediaSettings::ChSurround);
1033 channelsFull51Act = new MyActionGroupItem(this, channelsGroup, "channels_ful51", MediaSettings::ChFull51);
1034 connect( channelsGroup, SIGNAL(activated(int)),
1035 core, SLOT(setAudioChannels(int)) );
1036
1037 // Stereo mode
1038 stereoGroup = new MyActionGroup(this);
1039 stereoAct = new MyActionGroupItem(this, stereoGroup, "stereo", MediaSettings::Stereo);
1040 leftChannelAct = new MyActionGroupItem(this, stereoGroup, "left_channel", MediaSettings::Left);
1041 rightChannelAct = new MyActionGroupItem(this, stereoGroup, "right_channel", MediaSettings::Right);
1042 connect( stereoGroup, SIGNAL(activated(int)),
1043 core, SLOT(setStereoMode(int)) );
1044
1045 // Video aspect
1046 aspectGroup = new MyActionGroup(this);
1047 aspectDetectAct = new MyActionGroupItem(this, aspectGroup, "aspect_detect", MediaSettings::AspectAuto);
1048 aspect11Act = new MyActionGroupItem(this, aspectGroup, "aspect_1:1", MediaSettings::Aspect11 );
1049 aspect32Act = new MyActionGroupItem(this, aspectGroup, "aspect_3:2", MediaSettings::Aspect32);
1050 aspect43Act = new MyActionGroupItem(this, aspectGroup, "aspect_4:3", MediaSettings::Aspect43);
1051 aspect54Act = new MyActionGroupItem(this, aspectGroup, "aspect_5:4", MediaSettings::Aspect54 );
1052 aspect149Act = new MyActionGroupItem(this, aspectGroup, "aspect_14:9", MediaSettings::Aspect149 );
1053 aspect1410Act = new MyActionGroupItem(this, aspectGroup, "aspect_14:10", MediaSettings::Aspect1410 );
1054 aspect169Act = new MyActionGroupItem(this, aspectGroup, "aspect_16:9", MediaSettings::Aspect169 );
1055 aspect1610Act = new MyActionGroupItem(this, aspectGroup, "aspect_16:10", MediaSettings::Aspect1610 );
1056 aspect235Act = new MyActionGroupItem(this, aspectGroup, "aspect_2.35:1", MediaSettings::Aspect235 );
1057 {
1058 QAction * sep = new QAction(aspectGroup);
1059 sep->setSeparator(true);
1060 }
1061 aspectNoneAct = new MyActionGroupItem(this, aspectGroup, "aspect_none", MediaSettings::AspectNone);
1062
1063 connect( aspectGroup, SIGNAL(activated(int)),
1064 core, SLOT(changeAspectRatio(int)) );
1065
1066 // Rotate
1067 rotateGroup = new MyActionGroup(this);
1068 rotateNoneAct = new MyActionGroupItem(this, rotateGroup, "rotate_none", MediaSettings::NoRotate);
1069 rotateClockwiseFlipAct = new MyActionGroupItem(this, rotateGroup, "rotate_clockwise_flip", MediaSettings::Clockwise_flip);
1070 rotateClockwiseAct = new MyActionGroupItem(this, rotateGroup, "rotate_clockwise", MediaSettings::Clockwise);
1071 rotateCounterclockwiseAct = new MyActionGroupItem(this, rotateGroup, "rotate_counterclockwise", MediaSettings::Counterclockwise);
1072 rotateCounterclockwiseFlipAct = new MyActionGroupItem(this, rotateGroup, "rotate_counterclockwise_flip", MediaSettings::Counterclockwise_flip);
1073 connect( rotateGroup, SIGNAL(activated(int)),
1074 core, SLOT(changeRotate(int)) );
1075
1076 // On Top
1077 onTopActionGroup = new MyActionGroup(this);
1078 onTopAlwaysAct = new MyActionGroupItem( this,onTopActionGroup,"on_top_always",Preferences::AlwaysOnTop);
1079 onTopNeverAct = new MyActionGroupItem( this,onTopActionGroup,"on_top_never",Preferences::NeverOnTop);
1080 onTopWhilePlayingAct = new MyActionGroupItem( this,onTopActionGroup,"on_top_playing",Preferences::WhilePlayingOnTop);
1081 connect( onTopActionGroup , SIGNAL(activated(int)),
1082 this, SLOT(changeStayOnTop(int)) );
1083
1084 toggleStayOnTopAct = new MyAction( this, "toggle_stay_on_top");
1085 connect( toggleStayOnTopAct, SIGNAL(triggered()), this, SLOT(toggleStayOnTop()) );
1086
1087
1088#if USE_ADAPTER
1089 screenGroup = new MyActionGroup(this);
1090 screenDefaultAct = new MyActionGroupItem(this, screenGroup, "screen_default", -1);
1091#ifdef Q_OS_WIN
1092 DeviceList display_devices = DeviceInfo::displayDevices();
1093 if (!display_devices.isEmpty()) {
1094 for (int n = 0; n < display_devices.count(); n++) {
1095 int id = display_devices[n].ID().toInt();
1096 QString desc = display_devices[n].desc();
1097 MyAction * screen_item = new MyActionGroupItem(this, screenGroup, QString("screen_%1").arg(n).toAscii().constData(), id);
1098 screen_item->change( "&"+QString::number(n) + " - " + desc);
1099 }
1100 }
1101 else
1102#endif // Q_OS_WIN
1103 for (int n = 1; n <= 4; n++) {
1104 MyAction * screen_item = new MyActionGroupItem(this, screenGroup, QString("screen_%1").arg(n).toAscii().constData(), n);
1105 screen_item->change( "&"+QString::number(n) );
1106 }
1107
1108 connect( screenGroup, SIGNAL(activated(int)),
1109 core, SLOT(changeAdapter(int)) );
1110#endif
1111
1112#if PROGRAM_SWITCH
1113 // Program track
1114 programTrackGroup = new MyActionGroup(this);
1115 connect( programTrackGroup, SIGNAL(activated(int)),
1116 core, SLOT(changeProgram(int)) );
1117#endif
1118
1119 // Video track
1120 videoTrackGroup = new MyActionGroup(this);
1121 connect( videoTrackGroup, SIGNAL(activated(int)),
1122 core, SLOT(changeVideo(int)) );
1123
1124 // Audio track
1125 audioTrackGroup = new MyActionGroup(this);
1126 connect( audioTrackGroup, SIGNAL(activated(int)),
1127 core, SLOT(changeAudio(int)) );
1128
1129 // Subtitle track
1130 subtitleTrackGroup = new MyActionGroup(this);
1131 connect( subtitleTrackGroup, SIGNAL(activated(int)),
1132 core, SLOT(changeSubtitle(int)) );
1133
1134 ccGroup = new MyActionGroup(this);
1135 ccNoneAct = new MyActionGroupItem(this, ccGroup, "cc_none", 0);
1136 ccChannel1Act = new MyActionGroupItem(this, ccGroup, "cc_ch_1", 1);
1137 ccChannel2Act = new MyActionGroupItem(this, ccGroup, "cc_ch_2", 2);
1138 ccChannel3Act = new MyActionGroupItem(this, ccGroup, "cc_ch_3", 3);
1139 ccChannel4Act = new MyActionGroupItem(this, ccGroup, "cc_ch_4", 4);
1140 connect( ccGroup, SIGNAL(activated(int)),
1141 core, SLOT(changeClosedCaptionChannel(int)) );
1142
1143 // Titles
1144 titleGroup = new MyActionGroup(this);
1145 connect( titleGroup, SIGNAL(activated(int)),
1146 core, SLOT(changeTitle(int)) );
1147
1148 // Angles
1149 angleGroup = new MyActionGroup(this);
1150 connect( angleGroup, SIGNAL(activated(int)),
1151 core, SLOT(changeAngle(int)) );
1152
1153 // Chapters
1154 chapterGroup = new MyActionGroup(this);
1155 connect( chapterGroup, SIGNAL(activated(int)),
1156 core, SLOT(changeChapter(int)) );
1157
1158#if DVDNAV_SUPPORT
1159 dvdnavUpAct = new MyAction(Qt::SHIFT | Qt::Key_Up, this, "dvdnav_up");
1160 connect( dvdnavUpAct, SIGNAL(triggered()), core, SLOT(dvdnavUp()) );
1161
1162 dvdnavDownAct = new MyAction(Qt::SHIFT | Qt::Key_Down, this, "dvdnav_down");
1163 connect( dvdnavDownAct, SIGNAL(triggered()), core, SLOT(dvdnavDown()) );
1164
1165 dvdnavLeftAct = new MyAction(Qt::SHIFT | Qt::Key_Left, this, "dvdnav_left");
1166 connect( dvdnavLeftAct, SIGNAL(triggered()), core, SLOT(dvdnavLeft()) );
1167
1168 dvdnavRightAct = new MyAction(Qt::SHIFT | Qt::Key_Right, this, "dvdnav_right");
1169 connect( dvdnavRightAct, SIGNAL(triggered()), core, SLOT(dvdnavRight()) );
1170
1171 dvdnavMenuAct = new MyAction(Qt::SHIFT | Qt::Key_Return, this, "dvdnav_menu");
1172 connect( dvdnavMenuAct, SIGNAL(triggered()), core, SLOT(dvdnavMenu()) );
1173
1174 dvdnavSelectAct = new MyAction(Qt::Key_Return, this, "dvdnav_select");
1175 connect( dvdnavSelectAct, SIGNAL(triggered()), core, SLOT(dvdnavSelect()) );
1176
1177 dvdnavPrevAct = new MyAction(Qt::SHIFT | Qt::Key_Escape, this, "dvdnav_prev");
1178 connect( dvdnavPrevAct, SIGNAL(triggered()), core, SLOT(dvdnavPrev()) );
1179
1180 dvdnavMouseAct = new MyAction( this, "dvdnav_mouse");
1181 connect( dvdnavMouseAct, SIGNAL(triggered()), core, SLOT(dvdnavMouse()) );
1182#endif
1183
1184}
1185
1186#if AUTODISABLE_ACTIONS
1187void BaseGui::setActionsEnabled(bool b) {
1188 // Menu Play
1189 playAct->setEnabled(b);
1190 playOrPauseAct->setEnabled(b);
1191 pauseAct->setEnabled(b);
1192 pauseAndStepAct->setEnabled(b);
1193 stopAct->setEnabled(b);
1194 frameStepAct->setEnabled(b);
1195 rewind1Act->setEnabled(b);
1196 rewind2Act->setEnabled(b);
1197 rewind3Act->setEnabled(b);
1198 forward1Act->setEnabled(b);
1199 forward2Act->setEnabled(b);
1200 forward3Act->setEnabled(b);
1201 //repeatAct->setEnabled(b);
1202 gotoAct->setEnabled(b);
1203
1204 // Menu Speed
1205 normalSpeedAct->setEnabled(b);
1206 halveSpeedAct->setEnabled(b);
1207 doubleSpeedAct->setEnabled(b);
1208 decSpeed10Act->setEnabled(b);
1209 incSpeed10Act->setEnabled(b);
1210 decSpeed4Act->setEnabled(b);
1211 incSpeed4Act->setEnabled(b);
1212 decSpeed1Act->setEnabled(b);
1213 incSpeed1Act->setEnabled(b);
1214
1215 // Menu Video
1216 videoEqualizerAct->setEnabled(b);
1217 screenshotAct->setEnabled(b);
1218 screenshotsAct->setEnabled(b);
1219 flipAct->setEnabled(b);
1220 mirrorAct->setEnabled(b);
1221 postProcessingAct->setEnabled(b);
1222 phaseAct->setEnabled(b);
1223 deblockAct->setEnabled(b);
1224 deringAct->setEnabled(b);
1225 addNoiseAct->setEnabled(b);
1226 addLetterboxAct->setEnabled(b);
1227 upscaleAct->setEnabled(b);
1228
1229 // Menu Audio
1230 audioEqualizerAct->setEnabled(b);
1231 muteAct->setEnabled(b);
1232 decVolumeAct->setEnabled(b);
1233 incVolumeAct->setEnabled(b);
1234 decAudioDelayAct->setEnabled(b);
1235 incAudioDelayAct->setEnabled(b);
1236 audioDelayAct->setEnabled(b);
1237 extrastereoAct->setEnabled(b);
1238 karaokeAct->setEnabled(b);
1239 volnormAct->setEnabled(b);
1240 loadAudioAct->setEnabled(b);
1241 //unloadAudioAct->setEnabled(b);
1242
1243 // Menu Subtitles
1244 loadSubsAct->setEnabled(b);
1245 //unloadSubsAct->setEnabled(b);
1246 decSubDelayAct->setEnabled(b);
1247 incSubDelayAct->setEnabled(b);
1248 subDelayAct->setEnabled(b);
1249 decSubPosAct->setEnabled(b);
1250 incSubPosAct->setEnabled(b);
1251 incSubStepAct->setEnabled(b);
1252 decSubStepAct->setEnabled(b);
1253 incSubScaleAct->setEnabled(b);
1254 decSubScaleAct->setEnabled(b);
1255
1256 // Actions not in menus
1257#if !USE_MULTIPLE_SHORTCUTS
1258 decVolume2Act->setEnabled(b);
1259 incVolume2Act->setEnabled(b);
1260#endif
1261 decContrastAct->setEnabled(b);
1262 incContrastAct->setEnabled(b);
1263 decBrightnessAct->setEnabled(b);
1264 incBrightnessAct->setEnabled(b);
1265 decHueAct->setEnabled(b);
1266 incHueAct->setEnabled(b);
1267 decSaturationAct->setEnabled(b);
1268 incSaturationAct->setEnabled(b);
1269 decGammaAct->setEnabled(b);
1270 incGammaAct->setEnabled(b);
1271 nextVideoAct->setEnabled(b);
1272 nextAudioAct->setEnabled(b);
1273 nextSubtitleAct->setEnabled(b);
1274 nextChapterAct->setEnabled(b);
1275 prevChapterAct->setEnabled(b);
1276 doubleSizeAct->setEnabled(b);
1277
1278 // Moving and zoom
1279 moveUpAct->setEnabled(b);
1280 moveDownAct->setEnabled(b);
1281 moveLeftAct->setEnabled(b);
1282 moveRightAct->setEnabled(b);
1283 incZoomAct->setEnabled(b);
1284 decZoomAct->setEnabled(b);
1285 resetZoomAct->setEnabled(b);
1286 autoZoomAct->setEnabled(b);
1287 autoZoom169Act->setEnabled(b);
1288 autoZoom235Act->setEnabled(b);
1289
1290#if DVDNAV_SUPPORT
1291 dvdnavUpAct->setEnabled(b);
1292 dvdnavDownAct->setEnabled(b);
1293 dvdnavLeftAct->setEnabled(b);
1294 dvdnavRightAct->setEnabled(b);
1295 dvdnavMenuAct->setEnabled(b);
1296 dvdnavSelectAct->setEnabled(b);
1297 dvdnavPrevAct->setEnabled(b);
1298 dvdnavMouseAct->setEnabled(b);
1299#endif
1300
1301 // Groups
1302 denoiseGroup->setActionsEnabled(b);
1303 sizeGroup->setActionsEnabled(b);
1304 deinterlaceGroup->setActionsEnabled(b);
1305 aspectGroup->setActionsEnabled(b);
1306 rotateGroup->setActionsEnabled(b);
1307#if USE_ADAPTER
1308 screenGroup->setActionsEnabled(b);
1309#endif
1310 channelsGroup->setActionsEnabled(b);
1311 stereoGroup->setActionsEnabled(b);
1312}
1313
1314void BaseGui::enableActionsOnPlaying() {
1315 qDebug("BaseGui::enableActionsOnPlaying");
1316
1317 setActionsEnabled(true);
1318
1319 playAct->setEnabled(false);
1320
1321 // Screenshot option
1322 bool screenshots_enabled = ( (pref->use_screenshot) &&
1323 (!pref->screenshot_directory.isEmpty()) &&
1324 (QFileInfo(pref->screenshot_directory).isDir()) );
1325
1326 screenshotAct->setEnabled( screenshots_enabled );
1327 screenshotsAct->setEnabled( screenshots_enabled );
1328
1329 // Disable the compact action if not using video window
1330 compactAct->setEnabled( panel->isVisible() );
1331
1332 // Enable or disable the audio equalizer
1333 audioEqualizerAct->setEnabled(pref->use_audio_equalizer);
1334
1335 // Disable audio actions if there's not audio track
1336 if ((core->mdat.audios.numItems()==0) && (core->mset.external_audio.isEmpty())) {
1337 audioEqualizerAct->setEnabled(false);
1338 muteAct->setEnabled(false);
1339 decVolumeAct->setEnabled(false);
1340 incVolumeAct->setEnabled(false);
1341 decAudioDelayAct->setEnabled(false);
1342 incAudioDelayAct->setEnabled(false);
1343 audioDelayAct->setEnabled(false);
1344 extrastereoAct->setEnabled(false);
1345 karaokeAct->setEnabled(false);
1346 volnormAct->setEnabled(false);
1347 channelsGroup->setActionsEnabled(false);
1348 stereoGroup->setActionsEnabled(false);
1349 }
1350
1351 // Disable video actions if it's an audio file
1352 if (core->mdat.novideo) {
1353 videoEqualizerAct->setEnabled(false);
1354 screenshotAct->setEnabled(false);
1355 screenshotsAct->setEnabled(false);
1356 flipAct->setEnabled(false);
1357 mirrorAct->setEnabled(false);
1358 postProcessingAct->setEnabled(false);
1359 phaseAct->setEnabled(false);
1360 deblockAct->setEnabled(false);
1361 deringAct->setEnabled(false);
1362 addNoiseAct->setEnabled(false);
1363 addLetterboxAct->setEnabled(false);
1364 upscaleAct->setEnabled(false);
1365 doubleSizeAct->setEnabled(false);
1366
1367 // Moving and zoom
1368 moveUpAct->setEnabled(false);
1369 moveDownAct->setEnabled(false);
1370 moveLeftAct->setEnabled(false);
1371 moveRightAct->setEnabled(false);
1372 incZoomAct->setEnabled(false);
1373 decZoomAct->setEnabled(false);
1374 resetZoomAct->setEnabled(false);
1375 autoZoomAct->setEnabled(false);
1376 autoZoom169Act->setEnabled(false);
1377 autoZoom235Act->setEnabled(false);
1378
1379 denoiseGroup->setActionsEnabled(false);
1380 sizeGroup->setActionsEnabled(false);
1381 deinterlaceGroup->setActionsEnabled(false);
1382 aspectGroup->setActionsEnabled(false);
1383 rotateGroup->setActionsEnabled(false);
1384#if USE_ADAPTER
1385 screenGroup->setActionsEnabled(false);
1386#endif
1387 }
1388
1389#if USE_ADAPTER
1390 screenGroup->setActionsEnabled(pref->vo.startsWith(OVERLAY_VO));
1391#endif
1392
1393#ifndef Q_OS_WIN
1394 // Disable video filters if using vdpau
1395 if ((pref->vdpau.disable_video_filters) && (pref->vo.startsWith("vdpau"))) {
1396 screenshotAct->setEnabled(false);
1397 screenshotsAct->setEnabled(false);
1398 flipAct->setEnabled(false);
1399 mirrorAct->setEnabled(false);
1400 postProcessingAct->setEnabled(false);
1401 phaseAct->setEnabled(false);
1402 deblockAct->setEnabled(false);
1403 deringAct->setEnabled(false);
1404 addNoiseAct->setEnabled(false);
1405 addLetterboxAct->setEnabled(false);
1406 upscaleAct->setEnabled(false);
1407
1408 deinterlaceGroup->setActionsEnabled(false);
1409 rotateGroup->setActionsEnabled(false);
1410 denoiseGroup->setActionsEnabled(false);
1411
1412 displayMessage( tr("Video filters are disabled when using vdpau") );
1413 }
1414#endif
1415
1416#if DVDNAV_SUPPORT
1417 if (!core->mdat.filename.startsWith("dvdnav:")) {
1418 dvdnavUpAct->setEnabled(false);
1419 dvdnavDownAct->setEnabled(false);
1420 dvdnavLeftAct->setEnabled(false);
1421 dvdnavRightAct->setEnabled(false);
1422 dvdnavMenuAct->setEnabled(false);
1423 dvdnavSelectAct->setEnabled(false);
1424 dvdnavPrevAct->setEnabled(false);
1425 dvdnavMouseAct->setEnabled(false);
1426 }
1427#endif
1428}
1429
1430void BaseGui::disableActionsOnStop() {
1431 qDebug("BaseGui::disableActionsOnStop");
1432
1433 setActionsEnabled(false);
1434
1435 playAct->setEnabled(true);
1436 playOrPauseAct->setEnabled(true);
1437 stopAct->setEnabled(true);
1438}
1439
1440void BaseGui::togglePlayAction(Core::State state) {
1441 qDebug("BaseGui::togglePlayAction");
1442 if (state == Core::Playing)
1443 playAct->setEnabled(false);
1444 else
1445 playAct->setEnabled(true);
1446}
1447#endif // AUTODISABLE_ACTIONS
1448
1449void BaseGui::retranslateStrings() {
1450 setWindowIcon( Images::icon("logo", 64) );
1451
1452 // ACTIONS
1453
1454 // Menu File
1455 openFileAct->change( Images::icon("open"), tr("&File...") );
1456 openDirectoryAct->change( Images::icon("openfolder"), tr("D&irectory...") );
1457 openPlaylistAct->change( Images::icon("open_playlist"), tr("&Playlist...") );
1458 openVCDAct->change( Images::icon("vcd"), tr("V&CD") );
1459 openAudioCDAct->change( Images::icon("cdda"), tr("&Audio CD") );
1460 openDVDAct->change( Images::icon("dvd"), tr("&DVD from drive") );
1461 openDVDFolderAct->change( Images::icon("dvd_hd"), tr("D&VD from folder...") );
1462 openURLAct->change( Images::icon("url"), tr("&URL...") );
1463 exitAct->change( Images::icon("close"), tr("C&lose") );
1464
1465 // TV & Radio submenus
1466 tvlist->editAct()->setText( tr("&Edit...") );
1467 radiolist->editAct()->setText( tr("&Edit...") );
1468 tvlist->jumpAct()->setText( tr("&Jump...") );
1469 radiolist->jumpAct()->setText( tr("&Jump...") );
1470 tvlist->nextAct()->setText( tr("Next TV channel") );
1471 tvlist->previousAct()->setText( tr("Previous TV channel") );
1472 radiolist->nextAct()->setText( tr("Next radio channel") );
1473 radiolist->previousAct()->setText( tr("Previous radio channel") );
1474
1475
1476 // Menu Play
1477 playAct->change( tr("P&lay") );
1478 if (qApp->isLeftToRight())
1479 playAct->setIcon( Images::icon("play") );
1480 else
1481 playAct->setIcon( Images::flippedIcon("play") );
1482
1483 pauseAct->change( Images::icon("pause"), tr("&Pause"));
1484 stopAct->change( Images::icon("stop"), tr("&Stop") );
1485 frameStepAct->change( Images::icon("frame_step"), tr("&Frame step") );
1486
1487 playOrPauseAct->change( tr("Play / Pause") );
1488 if (qApp->isLeftToRight())
1489 playOrPauseAct->setIcon( Images::icon("play_pause") );
1490 else
1491 playOrPauseAct->setIcon( Images::flippedIcon("play_pause") );
1492
1493 pauseAndStepAct->change( Images::icon("pause"), tr("Pause / Frame step") );
1494
1495 setJumpTexts(); // Texts for rewind*Act and forward*Act
1496
1497 // Submenu A-B
1498 setAMarkerAct->change( Images::icon("a_marker"), tr("Set &A marker") );
1499 setBMarkerAct->change( Images::icon("b_marker"), tr("Set &B marker") );
1500 clearABMarkersAct->change( Images::icon("clear_markers"), tr("&Clear A-B markers") );
1501 repeatAct->change( Images::icon("repeat"), tr("&Repeat") );
1502
1503 gotoAct->change( Images::icon("jumpto"), tr("&Jump to...") );
1504
1505 // Submenu speed
1506 normalSpeedAct->change( tr("&Normal speed") );
1507 halveSpeedAct->change( tr("&Halve speed") );
1508 doubleSpeedAct->change( tr("&Double speed") );
1509 decSpeed10Act->change( tr("Speed &-10%") );
1510 incSpeed10Act->change( tr("Speed &+10%") );
1511 decSpeed4Act->change( tr("Speed -&4%") );
1512 incSpeed4Act->change( tr("&Speed +4%") );
1513 decSpeed1Act->change( tr("Speed -&1%") );
1514 incSpeed1Act->change( tr("S&peed +1%") );
1515
1516 // Menu Video
1517 fullscreenAct->change( Images::icon("fullscreen"), tr("&Fullscreen") );
1518 compactAct->change( Images::icon("compact"), tr("&Compact mode") );
1519 videoEqualizerAct->change( Images::icon("equalizer"), tr("&Equalizer") );
1520 screenshotAct->change( Images::icon("screenshot"), tr("&Screenshot") );
1521 screenshotsAct->change( Images::icon("screenshots"), tr("Start/stop takin&g screenshots") );
1522 videoPreviewAct->change( Images::icon("video_preview"), tr("Pre&view...") );
1523 flipAct->change( Images::icon("flip"), tr("Fli&p image") );
1524 mirrorAct->change( Images::icon("mirror"), tr("Mirr&or image") );
1525
1526 decZoomAct->change( tr("Zoom &-") );
1527 incZoomAct->change( tr("Zoom &+") );
1528 resetZoomAct->change( tr("&Reset") );
1529 autoZoomAct->change( tr("&Auto zoom") );
1530 autoZoom169Act->change( tr("Zoom for &16:9") );
1531 autoZoom235Act->change( tr("Zoom for &2.35:1") );
1532 moveLeftAct->change( tr("Move &left") );
1533 moveRightAct->change( tr("Move &right") );
1534 moveUpAct->change( tr("Move &up") );
1535 moveDownAct->change( tr("Move &down") );
1536
1537#if USE_MPLAYER_PANSCAN
1538 decPanscanAct->change( "Panscan -" );
1539 incPanscanAct->change( "Panscan +" );
1540#endif
1541
1542 // Submenu Filters
1543 postProcessingAct->change( tr("&Postprocessing") );
1544 phaseAct->change( tr("&Autodetect phase") );
1545 deblockAct->change( tr("&Deblock") );
1546 deringAct->change( tr("De&ring") );
1547 addNoiseAct->change( tr("Add n&oise") );
1548 addLetterboxAct->change( Images::icon("letterbox"), tr("Add &black borders") );
1549 upscaleAct->change( Images::icon("upscaling"), tr("Soft&ware scaling") );
1550
1551 // Menu Audio
1552 audioEqualizerAct->change( Images::icon("audio_equalizer"), tr("E&qualizer") );
1553 QIcon icset( Images::icon("volume") );
1554 icset.addPixmap( Images::icon("mute"), QIcon::Normal, QIcon::On );
1555 muteAct->change( icset, tr("&Mute") );
1556 decVolumeAct->change( Images::icon("audio_down"), tr("Volume &-") );
1557 incVolumeAct->change( Images::icon("audio_up"), tr("Volume &+") );
1558 decAudioDelayAct->change( Images::icon("delay_down"), tr("&Delay -") );
1559 incAudioDelayAct->change( Images::icon("delay_up"), tr("D&elay +") );
1560 audioDelayAct->change( Images::icon("audio_delay"), tr("Set dela&y...") );
1561 loadAudioAct->change( Images::icon("open"), tr("&Load external file...") );
1562 unloadAudioAct->change( Images::icon("unload"), tr("U&nload") );
1563
1564 // Submenu Filters
1565 extrastereoAct->change( tr("&Extrastereo") );
1566 karaokeAct->change( tr("&Karaoke") );
1567 volnormAct->change( tr("Volume &normalization") );
1568
1569 // Menu Subtitles
1570 loadSubsAct->change( Images::icon("open"), tr("&Load...") );
1571 unloadSubsAct->change( Images::icon("unload"), tr("U&nload") );
1572 decSubDelayAct->change( Images::icon("delay_down"), tr("Delay &-") );
1573 incSubDelayAct->change( Images::icon("delay_up"), tr("Delay &+") );
1574 subDelayAct->change( Images::icon("sub_delay"), tr("Se&t delay...") );
1575 decSubPosAct->change( Images::icon("sub_up"), tr("&Up") );
1576 incSubPosAct->change( Images::icon("sub_down"), tr("&Down") );
1577 decSubScaleAct->change( Images::icon("dec_sub_scale"), tr("S&ize -") );
1578 incSubScaleAct->change( Images::icon("inc_sub_scale"), tr("Si&ze +") );
1579 decSubStepAct->change( Images::icon("dec_sub_step"),
1580 tr("&Previous line in subtitles") );
1581 incSubStepAct->change( Images::icon("inc_sub_step"),
1582 tr("N&ext line in subtitles") );
1583 useAssAct->change( Images::icon("use_ass_lib"), tr("Use SSA/&ASS library") );
1584 useForcedSubsOnlyAct->change( Images::icon("forced_subs"), tr("&Forced subtitles only") );
1585
1586 subVisibilityAct->change( Images::icon("sub_visibility"), tr("Subtitle &visibility") );
1587
1588 showFindSubtitlesDialogAct->change( Images::icon("download_subs"), tr("Find subtitles on &OpenSubtitles.org...") );
1589 openUploadSubtitlesPageAct->change( Images::icon("upload_subs"), tr("Upload su&btitles to OpenSubtitles.org...") );
1590
1591 ccNoneAct->change( tr("&Off") );
1592 ccChannel1Act->change( "&1" );
1593 ccChannel2Act->change( "&2" );
1594 ccChannel3Act->change( "&3" );
1595 ccChannel4Act->change( "&4" );
1596
1597 // Menu Options
1598 showPlaylistAct->change( Images::icon("playlist"), tr("&Playlist") );
1599 showPropertiesAct->change( Images::icon("info"), tr("View &info and properties...") );
1600 showPreferencesAct->change( Images::icon("prefs"), tr("P&references") );
1601
1602 // Submenu Logs
1603 showLogMplayerAct->change( "MPlayer" );
1604 showLogSmplayerAct->change( "SMPlayer" );
1605
1606 // Menu Help
1607 showFAQAct->change( Images::icon("faq"), tr("&FAQ") );
1608 showCLOptionsAct->change( Images::icon("cl_help"), tr("&Command line options") );
1609 showTipsAct->change( Images::icon("tips"), tr("&Tips") );
1610 donateAct->change( Images::icon("donate"), tr("&Donate") );
1611 aboutQtAct->change( QPixmap(":/icons-png/qt.png"), tr("About &Qt") );
1612 aboutThisAct->change( Images::icon("logo_small"), tr("About &SMPlayer") );
1613
1614 // Playlist
1615 playNextAct->change( tr("&Next") );
1616 playPrevAct->change( tr("Pre&vious") );
1617
1618 if (qApp->isLeftToRight()) {
1619 playNextAct->setIcon( Images::icon("next") );
1620 playPrevAct->setIcon( Images::icon("previous") );
1621 } else {
1622 playNextAct->setIcon( Images::flippedIcon("next") );
1623 playPrevAct->setIcon( Images::flippedIcon("previous") );
1624 }
1625
1626
1627 // Actions not in menus or buttons
1628 // Volume 2
1629#if !USE_MULTIPLE_SHORTCUTS
1630 decVolume2Act->change( tr("Dec volume (2)") );
1631 incVolume2Act->change( tr("Inc volume (2)") );
1632#endif
1633 // Exit fullscreen
1634 exitFullscreenAct->change( tr("Exit fullscreen") );
1635
1636 nextOSDAct->change( tr("OSD - Next level") );
1637 decContrastAct->change( tr("Dec contrast") );
1638 incContrastAct->change( tr("Inc contrast") );
1639 decBrightnessAct->change( tr("Dec brightness") );
1640 incBrightnessAct->change( tr("Inc brightness") );
1641 decHueAct->change( tr("Dec hue") );
1642 incHueAct->change( tr("Inc hue") );
1643 decSaturationAct->change( tr("Dec saturation") );
1644 incSaturationAct->change( tr("Inc saturation") );
1645 decGammaAct->change( tr("Dec gamma") );
1646 incGammaAct->change( tr("Inc gamma") );
1647 nextVideoAct->change( tr("Next video") );
1648 nextAudioAct->change( tr("Next audio") );
1649 nextSubtitleAct->change( tr("Next subtitle") );
1650 nextChapterAct->change( tr("Next chapter") );
1651 prevChapterAct->change( tr("Previous chapter") );
1652 doubleSizeAct->change( tr("&Toggle double size") );
1653 resetVideoEqualizerAct->change( tr("Reset video equalizer") );
1654 resetAudioEqualizerAct->change( tr("Reset audio equalizer") );
1655 showContextMenuAct->change( tr("Show context menu") );
1656 nextAspectAct->change( Images::icon("next_aspect"), tr("Next aspect ratio") );
1657 nextWheelFunctionAct->change( Images::icon("next_wheel_function"), tr("Next wheel function") );
1658
1659 showFilenameAct->change( tr("Show filename on OSD") );
1660 toggleDeinterlaceAct->change( tr("Toggle deinterlacing") );
1661
1662
1663 // Action groups
1664 osdNoneAct->change( tr("Subtitles onl&y") );
1665 osdSeekAct->change( tr("Volume + &Seek") );
1666 osdTimerAct->change( tr("Volume + Seek + &Timer") );
1667 osdTotalAct->change( tr("Volume + Seek + Timer + T&otal time") );
1668
1669
1670 // MENUS
1671 openMenu->menuAction()->setText( tr("&Open") );
1672 playMenu->menuAction()->setText( tr("&Play") );
1673 videoMenu->menuAction()->setText( tr("&Video") );
1674 audioMenu->menuAction()->setText( tr("&Audio") );
1675 subtitlesMenu->menuAction()->setText( tr("&Subtitles") );
1676 browseMenu->menuAction()->setText( tr("&Browse") );
1677 optionsMenu->menuAction()->setText( tr("Op&tions") );
1678 helpMenu->menuAction()->setText( tr("&Help") );
1679
1680 /*
1681 openMenuAct->setIcon( Images::icon("open_menu") );
1682 playMenuAct->setIcon( Images::icon("play_menu") );
1683 videoMenuAct->setIcon( Images::icon("video_menu") );
1684 audioMenuAct->setIcon( Images::icon("audio_menu") );
1685 subtitlesMenuAct->setIcon( Images::icon("subtitles_menu") );
1686 browseMenuAct->setIcon( Images::icon("browse_menu") );
1687 optionsMenuAct->setIcon( Images::icon("options_menu") );
1688 helpMenuAct->setIcon( Images::icon("help_menu") );
1689 */
1690
1691 // Menu Open
1692 recentfiles_menu->menuAction()->setText( tr("&Recent files") );
1693 recentfiles_menu->menuAction()->setIcon( Images::icon("recents") );
1694 clearRecentsAct->change( Images::icon("delete"), tr("&Clear") );
1695
1696 tvlist->menu()->menuAction()->setText( tr("&TV") );
1697 tvlist->menu()->menuAction()->setIcon( Images::icon("open_tv") );
1698
1699 radiolist->menu()->menuAction()->setText( tr("Radi&o") );
1700 radiolist->menu()->menuAction()->setIcon( Images::icon("open_radio") );
1701
1702 // Menu Play
1703 speed_menu->menuAction()->setText( tr("Sp&eed") );
1704 speed_menu->menuAction()->setIcon( Images::icon("speed") );
1705
1706 ab_menu->menuAction()->setText( tr("&A-B section") );
1707 ab_menu->menuAction()->setIcon( Images::icon("ab_menu") );
1708
1709 // Menu Video
1710 videotrack_menu->menuAction()->setText( tr("&Track", "video") );
1711 videotrack_menu->menuAction()->setIcon( Images::icon("video_track") );
1712
1713 videosize_menu->menuAction()->setText( tr("Si&ze") );
1714 videosize_menu->menuAction()->setIcon( Images::icon("video_size") );
1715
1716 /*
1717 panscan_menu->menuAction()->setText( tr("&Pan && scan") );
1718 panscan_menu->menuAction()->setIcon( Images::icon("panscan") );
1719 */
1720 zoom_menu->menuAction()->setText( tr("Zoo&m") );
1721 zoom_menu->menuAction()->setIcon( Images::icon("zoom") );
1722
1723 aspect_menu->menuAction()->setText( tr("&Aspect ratio") );
1724 aspect_menu->menuAction()->setIcon( Images::icon("aspect") );
1725
1726 deinterlace_menu->menuAction()->setText( tr("&Deinterlace") );
1727 deinterlace_menu->menuAction()->setIcon( Images::icon("deinterlace") );
1728
1729 videofilter_menu->menuAction()->setText( tr("F&ilters") );
1730 videofilter_menu->menuAction()->setIcon( Images::icon("video_filters") );
1731
1732 rotate_menu->menuAction()->setText( tr("&Rotate") );
1733 rotate_menu->menuAction()->setIcon( Images::icon("rotate") );
1734
1735 ontop_menu->menuAction()->setText( tr("S&tay on top") );
1736 ontop_menu->menuAction()->setIcon( Images::icon("ontop") );
1737
1738#if USE_ADAPTER
1739 screen_menu->menuAction()->setText( tr("Scree&n") );
1740 screen_menu->menuAction()->setIcon( Images::icon("screen") );
1741#endif
1742
1743 /*
1744 denoise_menu->menuAction()->setText( tr("De&noise") );
1745 denoise_menu->menuAction()->setIcon( Images::icon("denoise") );
1746 */
1747
1748 aspectDetectAct->change( tr("&Auto") );
1749 aspect11Act->change( "1&:1" );
1750 aspect32Act->change( "&3:2" );
1751 aspect43Act->change( "&4:3" );
1752 aspect54Act->change( "&5:4" );
1753 aspect149Act->change( "&14:9" );
1754 aspect1410Act->change( "1&4:10" );
1755 aspect169Act->change( "16:&9" );
1756 aspect1610Act->change( "1&6:10" );
1757 aspect235Act->change( "&2.35:1" );
1758 aspectNoneAct->change( tr("&Disabled") );
1759
1760 deinterlaceNoneAct->change( tr("&None") );
1761 deinterlaceL5Act->change( tr("&Lowpass5") );
1762 deinterlaceYadif0Act->change( tr("&Yadif (normal)") );
1763 deinterlaceYadif1Act->change( tr("Y&adif (double framerate)") );
1764 deinterlaceLBAct->change( tr("Linear &Blend") );
1765 deinterlaceKernAct->change( tr("&Kerndeint") );
1766
1767 denoiseNoneAct->change( tr("Denoise o&ff") );
1768 denoiseNormalAct->change( tr("Denoise nor&mal") );
1769 denoiseSoftAct->change( tr("Denoise &soft") );
1770
1771 rotateNoneAct->change( tr("&Off") );
1772 rotateClockwiseFlipAct->change( tr("&Rotate by 90 degrees clockwise and flip") );
1773 rotateClockwiseAct->change( tr("Rotate by 90 degrees &clockwise") );
1774 rotateCounterclockwiseAct->change( tr("Rotate by 90 degrees counterclock&wise") );
1775 rotateCounterclockwiseFlipAct->change( tr("Rotate by 90 degrees counterclockwise and &flip") );
1776
1777 onTopAlwaysAct->change( tr("&Always") );
1778 onTopNeverAct->change( tr("&Never") );
1779 onTopWhilePlayingAct->change( tr("While &playing") );
1780 toggleStayOnTopAct->change( tr("Toggle stay on top") );
1781
1782#if USE_ADAPTER
1783 screenDefaultAct->change( tr("&Default") );
1784#endif
1785
1786 // Menu Audio
1787 audiotrack_menu->menuAction()->setText( tr("&Track", "audio") );
1788 audiotrack_menu->menuAction()->setIcon( Images::icon("audio_track") );
1789
1790 audiofilter_menu->menuAction()->setText( tr("&Filters") );
1791 audiofilter_menu->menuAction()->setIcon( Images::icon("audio_filters") );
1792
1793 audiochannels_menu->menuAction()->setText( tr("&Channels") );
1794 audiochannels_menu->menuAction()->setIcon( Images::icon("audio_channels") );
1795
1796 stereomode_menu->menuAction()->setText( tr("&Stereo mode") );
1797 stereomode_menu->menuAction()->setIcon( Images::icon("stereo_mode") );
1798
1799 /* channelsDefaultAct->change( tr("&Default") ); */
1800 channelsStereoAct->change( tr("&Stereo") );
1801 channelsSurroundAct->change( tr("&4.0 Surround") );
1802 channelsFull51Act->change( tr("&5.1 Surround") );
1803
1804 stereoAct->change( tr("&Stereo") );
1805 leftChannelAct->change( tr("&Left channel") );
1806 rightChannelAct->change( tr("&Right channel") );
1807
1808 // Menu Subtitle
1809 subtitlestrack_menu->menuAction()->setText( tr("&Select") );
1810 subtitlestrack_menu->menuAction()->setIcon( Images::icon("sub") );
1811
1812 closed_captions_menu->menuAction()->setText( tr("&Closed captions") );
1813 closed_captions_menu->menuAction()->setIcon( Images::icon("closed_caption") );
1814
1815 // Menu Browse
1816 titles_menu->menuAction()->setText( tr("&Title") );
1817 titles_menu->menuAction()->setIcon( Images::icon("title") );
1818
1819 chapters_menu->menuAction()->setText( tr("&Chapter") );
1820 chapters_menu->menuAction()->setIcon( Images::icon("chapter") );
1821
1822 angles_menu->menuAction()->setText( tr("&Angle") );
1823 angles_menu->menuAction()->setIcon( Images::icon("angle") );
1824
1825#if PROGRAM_SWITCH
1826 programtrack_menu->menuAction()->setText( tr("P&rogram", "program") );
1827 programtrack_menu->menuAction()->setIcon( Images::icon("program_track") );
1828#endif
1829
1830
1831#if DVDNAV_SUPPORT
1832 dvdnavUpAct->change(Images::icon("dvdnav_up"), tr("DVD menu, move up"));
1833 dvdnavDownAct->change(Images::icon("dvdnav_down"), tr("DVD menu, move down"));
1834 dvdnavLeftAct->change(Images::icon("dvdnav_left"), tr("DVD menu, move left"));
1835 dvdnavRightAct->change(Images::icon("dvdnav_right"), tr("DVD menu, move right"));
1836 dvdnavMenuAct->change(Images::icon("dvdnav_menu"), tr("DVD &menu"));
1837 dvdnavSelectAct->change(Images::icon("dvdnav_select"), tr("DVD menu, select option"));
1838 dvdnavPrevAct->change(Images::icon("dvdnav_prev"), tr("DVD &previous menu"));
1839 dvdnavMouseAct->change(Images::icon("dvdnav_mouse"), tr("DVD menu, mouse click"));
1840#endif
1841
1842 // Menu Options
1843 osd_menu->menuAction()->setText( tr("&OSD") );
1844 osd_menu->menuAction()->setIcon( Images::icon("osd") );
1845
1846 logs_menu->menuAction()->setText( tr("&View logs") );
1847 logs_menu->menuAction()->setIcon( Images::icon("logs") );
1848
1849
1850 // To be sure that the "<empty>" string is translated
1851 initializeMenus();
1852
1853 // Other things
1854 mplayer_log_window->setWindowTitle( tr("SMPlayer - mplayer log") );
1855 smplayer_log_window->setWindowTitle( tr("SMPlayer - smplayer log") );
1856
1857 updateRecents();
1858 updateWidgets();
1859
1860 // Update actions view in preferences
1861 // It has to be done, here. The actions are translated after the
1862 // preferences dialog.
1863 if (pref_dialog) pref_dialog->mod_input()->actions_editor->updateView();
1864}
1865
1866void BaseGui::setJumpTexts() {
1867 rewind1Act->change( tr("-%1").arg(Helper::timeForJumps(pref->seeking1)) );
1868 rewind2Act->change( tr("-%1").arg(Helper::timeForJumps(pref->seeking2)) );
1869 rewind3Act->change( tr("-%1").arg(Helper::timeForJumps(pref->seeking3)) );
1870
1871 forward1Act->change( tr("+%1").arg(Helper::timeForJumps(pref->seeking1)) );
1872 forward2Act->change( tr("+%1").arg(Helper::timeForJumps(pref->seeking2)) );
1873 forward3Act->change( tr("+%1").arg(Helper::timeForJumps(pref->seeking3)) );
1874
1875 if (qApp->isLeftToRight()) {
1876 rewind1Act->setIcon( Images::icon("rewind10s") );
1877 rewind2Act->setIcon( Images::icon("rewind1m") );
1878 rewind3Act->setIcon( Images::icon("rewind10m") );
1879
1880 forward1Act->setIcon( Images::icon("forward10s") );
1881 forward2Act->setIcon( Images::icon("forward1m") );
1882 forward3Act->setIcon( Images::icon("forward10m") );
1883 } else {
1884 rewind1Act->setIcon( Images::flippedIcon("rewind10s") );
1885 rewind2Act->setIcon( Images::flippedIcon("rewind1m") );
1886 rewind3Act->setIcon( Images::flippedIcon("rewind10m") );
1887
1888 forward1Act->setIcon( Images::flippedIcon("forward10s") );
1889 forward2Act->setIcon( Images::flippedIcon("forward1m") );
1890 forward3Act->setIcon( Images::flippedIcon("forward10m") );
1891 }
1892}
1893
1894void BaseGui::setWindowCaption(const QString & title) {
1895 setWindowTitle(title);
1896}
1897
1898void BaseGui::createCore() {
1899 core = new Core( mplayerwindow, this );
1900
1901 connect( core, SIGNAL(menusNeedInitialize()),
1902 this, SLOT(initializeMenus()) );
1903 connect( core, SIGNAL(widgetsNeedUpdate()),
1904 this, SLOT(updateWidgets()) );
1905 connect( core, SIGNAL(videoEqualizerNeedsUpdate()),
1906 this, SLOT(updateVideoEqualizer()) );
1907
1908 connect( core, SIGNAL(audioEqualizerNeedsUpdate()),
1909 this, SLOT(updateAudioEqualizer()) );
1910
1911 connect( core, SIGNAL(showFrame(int)),
1912 this, SIGNAL(frameChanged(int)) );
1913
1914 connect( core, SIGNAL(ABMarkersChanged(int,int)),
1915 this, SIGNAL(ABMarkersChanged(int,int)) );
1916
1917 connect( core, SIGNAL(showTime(double)),
1918 this, SLOT(gotCurrentTime(double)) );
1919
1920 connect( core, SIGNAL(needResize(int, int)),
1921 this, SLOT(resizeWindow(int,int)) );
1922 connect( core, SIGNAL(showMessage(QString)),
1923 this, SLOT(displayMessage(QString)) );
1924 connect( core, SIGNAL(stateChanged(Core::State)),
1925 this, SLOT(displayState(Core::State)) );
1926 connect( core, SIGNAL(stateChanged(Core::State)),
1927 this, SLOT(checkStayOnTop(Core::State)), Qt::QueuedConnection );
1928
1929 connect( core, SIGNAL(mediaStartPlay()),
1930 this, SLOT(enterFullscreenOnPlay()) );
1931 connect( core, SIGNAL(mediaStoppedByUser()),
1932 this, SLOT(exitFullscreenOnStop()) );
1933
1934 connect( core, SIGNAL(mediaLoaded()),
1935 this, SLOT(enableActionsOnPlaying()) );
1936#if NOTIFY_AUDIO_CHANGES
1937 connect( core, SIGNAL(audioTracksChanged()),
1938 this, SLOT(enableActionsOnPlaying()) );
1939#endif
1940 connect( core, SIGNAL(mediaFinished()),
1941 this, SLOT(disableActionsOnStop()) );
1942 connect( core, SIGNAL(mediaStoppedByUser()),
1943 this, SLOT(disableActionsOnStop()) );
1944
1945 connect( core, SIGNAL(stateChanged(Core::State)),
1946 this, SLOT(togglePlayAction(Core::State)) );
1947
1948 connect( core, SIGNAL(mediaStartPlay()),
1949 this, SLOT(newMediaLoaded()), Qt::QueuedConnection );
1950 connect( core, SIGNAL(mediaInfoChanged()),
1951 this, SLOT(updateMediaInfo()) );
1952
1953 connect( core, SIGNAL(mediaStartPlay()),
1954 this, SLOT(checkPendingActionsToRun()), Qt::QueuedConnection );
1955#if REPORT_OLD_MPLAYER
1956 connect( core, SIGNAL(mediaStartPlay()),
1957 this, SLOT(checkMplayerVersion()), Qt::QueuedConnection );
1958#endif
1959 connect( core, SIGNAL(failedToParseMplayerVersion(QString)),
1960 this, SLOT(askForMplayerVersion(QString)) );
1961
1962 connect( core, SIGNAL(mplayerFailed(QProcess::ProcessError)),
1963 this, SLOT(showErrorFromMplayer(QProcess::ProcessError)) );
1964
1965 connect( core, SIGNAL(mplayerFinishedWithError(int)),
1966 this, SLOT(showExitCodeFromMplayer(int)) );
1967
1968 // Hide mplayer window
1969 connect( core, SIGNAL(noVideo()),
1970 this, SLOT(hidePanel()) );
1971
1972 // Log mplayer output
1973 connect( core, SIGNAL(aboutToStartPlaying()),
1974 this, SLOT(clearMplayerLog()) );
1975 connect( core, SIGNAL(logLineAvailable(QString)),
1976 this, SLOT(recordMplayerLog(QString)) );
1977
1978 connect( core, SIGNAL(mediaLoaded()),
1979 this, SLOT(autosaveMplayerLog()) );
1980}
1981
1982void BaseGui::createMplayerWindow() {
1983 mplayerwindow = new MplayerWindow( panel );
1984 mplayerwindow->setObjectName("mplayerwindow");
1985#if USE_COLORKEY
1986 mplayerwindow->setColorKey( pref->color_key );
1987#endif
1988 mplayerwindow->allowVideoMovement( pref->allow_video_movement );
1989
1990 QHBoxLayout * layout = new QHBoxLayout;
1991 layout->setSpacing(0);
1992 layout->setMargin(0);
1993 layout->addWidget(mplayerwindow);
1994 panel->setLayout(layout);
1995
1996 // mplayerwindow
1997 /*
1998 connect( mplayerwindow, SIGNAL(rightButtonReleased(QPoint)),
1999 this, SLOT(showPopupMenu(QPoint)) );
2000 */
2001
2002 // mplayerwindow mouse events
2003 connect( mplayerwindow, SIGNAL(doubleClicked()),
2004 this, SLOT(doubleClickFunction()) );
2005 connect( mplayerwindow, SIGNAL(leftClicked()),
2006 this, SLOT(leftClickFunction()) );
2007 connect( mplayerwindow, SIGNAL(rightClicked()),
2008 this, SLOT(rightClickFunction()) );
2009 connect( mplayerwindow, SIGNAL(middleClicked()),
2010 this, SLOT(middleClickFunction()) );
2011 connect( mplayerwindow, SIGNAL(xbutton1Clicked()),
2012 this, SLOT(xbutton1ClickFunction()) );
2013 connect( mplayerwindow, SIGNAL(xbutton2Clicked()),
2014 this, SLOT(xbutton2ClickFunction()) );
2015 connect( mplayerwindow, SIGNAL(mouseMoved(QPoint)),
2016 this, SLOT(checkMousePos(QPoint)) );
2017}
2018
2019void BaseGui::createVideoEqualizer() {
2020 // Equalizer
2021 video_equalizer = new VideoEqualizer(this);
2022
2023 connect( video_equalizer->contrast, SIGNAL(valueChanged(int)),
2024 core, SLOT(setContrast(int)) );
2025 connect( video_equalizer->brightness, SIGNAL(valueChanged(int)),
2026 core, SLOT(setBrightness(int)) );
2027 connect( video_equalizer->hue, SIGNAL(valueChanged(int)),
2028 core, SLOT(setHue(int)) );
2029 connect( video_equalizer->saturation, SIGNAL(valueChanged(int)),
2030 core, SLOT(setSaturation(int)) );
2031 connect( video_equalizer->gamma, SIGNAL(valueChanged(int)),
2032 core, SLOT(setGamma(int)) );
2033 connect( video_equalizer, SIGNAL(visibilityChanged()),
2034 this, SLOT(updateWidgets()) );
2035}
2036
2037void BaseGui::createAudioEqualizer() {
2038 // Audio Equalizer
2039 audio_equalizer = new AudioEqualizer(this);
2040
2041 connect( audio_equalizer->eq[0], SIGNAL(valueChanged(int)),
2042 core, SLOT(setAudioEq0(int)) );
2043 connect( audio_equalizer->eq[1], SIGNAL(valueChanged(int)),
2044 core, SLOT(setAudioEq1(int)) );
2045 connect( audio_equalizer->eq[2], SIGNAL(valueChanged(int)),
2046 core, SLOT(setAudioEq2(int)) );
2047 connect( audio_equalizer->eq[3], SIGNAL(valueChanged(int)),
2048 core, SLOT(setAudioEq3(int)) );
2049 connect( audio_equalizer->eq[4], SIGNAL(valueChanged(int)),
2050 core, SLOT(setAudioEq4(int)) );
2051 connect( audio_equalizer->eq[5], SIGNAL(valueChanged(int)),
2052 core, SLOT(setAudioEq5(int)) );
2053 connect( audio_equalizer->eq[6], SIGNAL(valueChanged(int)),
2054 core, SLOT(setAudioEq6(int)) );
2055 connect( audio_equalizer->eq[7], SIGNAL(valueChanged(int)),
2056 core, SLOT(setAudioEq7(int)) );
2057 connect( audio_equalizer->eq[8], SIGNAL(valueChanged(int)),
2058 core, SLOT(setAudioEq8(int)) );
2059 connect( audio_equalizer->eq[9], SIGNAL(valueChanged(int)),
2060 core, SLOT(setAudioEq9(int)) );
2061
2062 connect( audio_equalizer, SIGNAL(applyClicked(AudioEqualizerList)),
2063 core, SLOT(setAudioAudioEqualizerRestart(AudioEqualizerList)) );
2064
2065 connect( audio_equalizer, SIGNAL(visibilityChanged()),
2066 this, SLOT(updateWidgets()) );
2067}
2068
2069void BaseGui::createPlaylist() {
2070#if DOCK_PLAYLIST
2071 playlist = new Playlist(core, this, 0);
2072#else
2073 //playlist = new Playlist(core, this, "playlist");
2074 playlist = new Playlist(core, 0);
2075#endif
2076
2077 /*
2078 connect( playlist, SIGNAL(playlistEnded()),
2079 this, SLOT(exitFullscreenOnStop()) );
2080 */
2081 connect( playlist, SIGNAL(playlistEnded()),
2082 this, SLOT(playlistHasFinished()) );
2083 /*
2084 connect( playlist, SIGNAL(visibilityChanged()),
2085 this, SLOT(playlistVisibilityChanged()) );
2086 */
2087
2088}
2089
2090void BaseGui::createPanel() {
2091 panel = new QWidget( this );
2092 panel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
2093 panel->setMinimumSize( QSize(1,1) );
2094 panel->setFocusPolicy( Qt::StrongFocus );
2095
2096 // panel
2097 panel->setAutoFillBackground(TRUE);
2098 ColorUtils::setBackgroundColor( panel, QColor(0,0,0) );
2099}
2100
2101void BaseGui::createPreferencesDialog() {
2102 pref_dialog = new PreferencesDialog(this);
2103 pref_dialog->setModal(false);
2104 /* pref_dialog->mod_input()->setActionsList( actions_list ); */
2105 connect( pref_dialog, SIGNAL(applied()),
2106 this, SLOT(applyNewPreferences()) );
2107}
2108
2109void BaseGui::createFilePropertiesDialog() {
2110 file_dialog = new FilePropertiesDialog(this);
2111 file_dialog->setModal(false);
2112 connect( file_dialog, SIGNAL(applied()),
2113 this, SLOT(applyFileProperties()) );
2114}
2115
2116
2117void BaseGui::createMenus() {
2118 // MENUS
2119 openMenu = menuBar()->addMenu("Open");
2120 playMenu = menuBar()->addMenu("Play");
2121 videoMenu = menuBar()->addMenu("Video");
2122 audioMenu = menuBar()->addMenu("Audio");
2123 subtitlesMenu = menuBar()->addMenu("Subtitles");
2124 browseMenu = menuBar()->addMenu("Browwse");
2125 optionsMenu = menuBar()->addMenu("Options");
2126 helpMenu = menuBar()->addMenu("Help");
2127
2128 // OPEN MENU
2129 openMenu->addAction(openFileAct);
2130
2131 recentfiles_menu = new QMenu(this);
2132 recentfiles_menu->addAction( clearRecentsAct );
2133 recentfiles_menu->addSeparator();
2134
2135 openMenu->addMenu( recentfiles_menu );
2136
2137 openMenu->addAction(openDirectoryAct);
2138 openMenu->addAction(openPlaylistAct);
2139 openMenu->addAction(openDVDAct);
2140 openMenu->addAction(openDVDFolderAct);
2141 openMenu->addAction(openVCDAct);
2142 openMenu->addAction(openAudioCDAct);
2143 openMenu->addAction(openURLAct);
2144 openMenu->addMenu(tvlist->menu());
2145 openMenu->addMenu(radiolist->menu());
2146
2147 openMenu->addSeparator();
2148 openMenu->addAction(exitAct);
2149
2150 // PLAY MENU
2151 playMenu->addAction(playAct);
2152 playMenu->addAction(pauseAct);
2153 /* playMenu->addAction(playOrPauseAct); */
2154 playMenu->addAction(stopAct);
2155 playMenu->addAction(frameStepAct);
2156 playMenu->addSeparator();
2157 playMenu->addAction(rewind1Act);
2158 playMenu->addAction(forward1Act);
2159 playMenu->addAction(rewind2Act);
2160 playMenu->addAction(forward2Act);
2161 playMenu->addAction(rewind3Act);
2162 playMenu->addAction(forward3Act);
2163 playMenu->addSeparator();
2164
2165 // Speed submenu
2166 speed_menu = new QMenu(this);
2167 speed_menu->menuAction()->setObjectName("speed_menu");
2168 speed_menu->addAction(normalSpeedAct);
2169 speed_menu->addSeparator();
2170 speed_menu->addAction(halveSpeedAct);
2171 speed_menu->addAction(doubleSpeedAct);
2172 speed_menu->addSeparator();
2173 speed_menu->addAction(decSpeed10Act);
2174 speed_menu->addAction(incSpeed10Act);
2175 speed_menu->addSeparator();
2176 speed_menu->addAction(decSpeed4Act);
2177 speed_menu->addAction(incSpeed4Act);
2178 speed_menu->addSeparator();
2179 speed_menu->addAction(decSpeed1Act);
2180 speed_menu->addAction(incSpeed1Act);
2181
2182 playMenu->addMenu(speed_menu);
2183
2184 // A-B submenu
2185 ab_menu = new QMenu(this);
2186 ab_menu->menuAction()->setObjectName("ab_menu");
2187 ab_menu->addAction(setAMarkerAct);
2188 ab_menu->addAction(setBMarkerAct);
2189 ab_menu->addAction(clearABMarkersAct);
2190 ab_menu->addSeparator();
2191 ab_menu->addAction(repeatAct);
2192
2193 playMenu->addSeparator();
2194 playMenu->addMenu(ab_menu);
2195
2196 playMenu->addSeparator();
2197 playMenu->addAction(gotoAct);
2198 playMenu->addSeparator();
2199 playMenu->addAction(playPrevAct);
2200 playMenu->addAction(playNextAct);
2201
2202 // VIDEO MENU
2203 videotrack_menu = new QMenu(this);
2204 videotrack_menu->menuAction()->setObjectName("videotrack_menu");
2205
2206 videoMenu->addMenu(videotrack_menu);
2207
2208 videoMenu->addAction(fullscreenAct);
2209 videoMenu->addAction(compactAct);
2210
2211#if USE_ADAPTER
2212 // Screen submenu
2213 screen_menu = new QMenu(this);
2214 screen_menu->menuAction()->setObjectName("screen_menu");
2215 screen_menu->addActions( screenGroup->actions() );
2216 videoMenu->addMenu(screen_menu);
2217#endif
2218
2219 // Size submenu
2220 videosize_menu = new QMenu(this);
2221 videosize_menu->menuAction()->setObjectName("videosize_menu");
2222 videosize_menu->addActions( sizeGroup->actions() );
2223 videosize_menu->addSeparator();
2224 videosize_menu->addAction(doubleSizeAct);
2225 videoMenu->addMenu(videosize_menu);
2226
2227 // Zoom submenu
2228 zoom_menu = new QMenu(this);
2229 zoom_menu->menuAction()->setObjectName("zoom_menu");
2230 zoom_menu->addAction(resetZoomAct);
2231 zoom_menu->addSeparator();
2232 zoom_menu->addAction(autoZoomAct);
2233 zoom_menu->addAction(autoZoom169Act);
2234 zoom_menu->addAction(autoZoom235Act);
2235 zoom_menu->addSeparator();
2236 zoom_menu->addAction(decZoomAct);
2237 zoom_menu->addAction(incZoomAct);
2238 zoom_menu->addSeparator();
2239 zoom_menu->addAction(moveLeftAct);
2240 zoom_menu->addAction(moveRightAct);
2241 zoom_menu->addAction(moveUpAct);
2242 zoom_menu->addAction(moveDownAct);
2243
2244 videoMenu->addMenu(zoom_menu);
2245
2246 // Aspect submenu
2247 aspect_menu = new QMenu(this);
2248 aspect_menu->menuAction()->setObjectName("aspect_menu");
2249 aspect_menu->addActions( aspectGroup->actions() );
2250
2251 videoMenu->addMenu(aspect_menu);
2252
2253 // Deinterlace submenu
2254 deinterlace_menu = new QMenu(this);
2255 deinterlace_menu->menuAction()->setObjectName("deinterlace_menu");
2256 deinterlace_menu->addActions( deinterlaceGroup->actions() );
2257
2258 videoMenu->addMenu(deinterlace_menu);
2259
2260 // Video filter submenu
2261 videofilter_menu = new QMenu(this);
2262 videofilter_menu->menuAction()->setObjectName("videofilter_menu");
2263 videofilter_menu->addAction(postProcessingAct);
2264 videofilter_menu->addAction(phaseAct);
2265 videofilter_menu->addAction(deblockAct);
2266 videofilter_menu->addAction(deringAct);
2267 videofilter_menu->addAction(addNoiseAct);
2268 videofilter_menu->addAction(addLetterboxAct);
2269 videofilter_menu->addAction(upscaleAct);
2270 videofilter_menu->addSeparator();
2271 videofilter_menu->addActions(denoiseGroup->actions());
2272
2273 videoMenu->addMenu(videofilter_menu);
2274
2275 // Denoise submenu
2276 /*
2277 denoise_menu = new QMenu(this);
2278 denoise_menu->addActions(denoiseGroup->actions());
2279 videoMenu->addMenu(denoise_menu);
2280 */
2281
2282 // Rotate submenu
2283 rotate_menu = new QMenu(this);
2284 rotate_menu->menuAction()->setObjectName("rotate_menu");
2285 rotate_menu->addActions(rotateGroup->actions());
2286
2287 videoMenu->addMenu(rotate_menu);
2288
2289 videoMenu->addAction(flipAct);
2290 videoMenu->addAction(mirrorAct);
2291 videoMenu->addSeparator();
2292 videoMenu->addAction(videoEqualizerAct);
2293 videoMenu->addAction(screenshotAct);
2294 videoMenu->addAction(screenshotsAct);
2295
2296 // Ontop submenu
2297 ontop_menu = new QMenu(this);
2298 ontop_menu->menuAction()->setObjectName("ontop_menu");
2299 ontop_menu->addActions(onTopActionGroup->actions());
2300
2301 videoMenu->addMenu(ontop_menu);
2302
2303 videoMenu->addSeparator();
2304 videoMenu->addAction(videoPreviewAct);
2305
2306
2307 // AUDIO MENU
2308
2309 // Audio track submenu
2310 audiotrack_menu = new QMenu(this);
2311 audiotrack_menu->menuAction()->setObjectName("audiotrack_menu");
2312
2313 audioMenu->addMenu(audiotrack_menu);
2314
2315 audioMenu->addAction(loadAudioAct);
2316 audioMenu->addAction(unloadAudioAct);
2317
2318 // Filter submenu
2319 audiofilter_menu = new QMenu(this);
2320 audiofilter_menu->menuAction()->setObjectName("audiofilter_menu");
2321 audiofilter_menu->addAction(extrastereoAct);
2322 audiofilter_menu->addAction(karaokeAct);
2323 audiofilter_menu->addAction(volnormAct);
2324
2325 audioMenu->addMenu(audiofilter_menu);
2326
2327 // Audio channels submenu
2328 audiochannels_menu = new QMenu(this);
2329 audiochannels_menu->menuAction()->setObjectName("audiochannels_menu");
2330 audiochannels_menu->addActions( channelsGroup->actions() );
2331
2332 audioMenu->addMenu(audiochannels_menu);
2333
2334 // Stereo mode submenu
2335 stereomode_menu = new QMenu(this);
2336 stereomode_menu->menuAction()->setObjectName("stereomode_menu");
2337 stereomode_menu->addActions( stereoGroup->actions() );
2338
2339 audioMenu->addMenu(stereomode_menu);
2340 audioMenu->addAction(audioEqualizerAct);
2341 audioMenu->addSeparator();
2342 audioMenu->addAction(muteAct);
2343 audioMenu->addSeparator();
2344 audioMenu->addAction(decVolumeAct);
2345 audioMenu->addAction(incVolumeAct);
2346 audioMenu->addSeparator();
2347 audioMenu->addAction(decAudioDelayAct);
2348 audioMenu->addAction(incAudioDelayAct);
2349 audioMenu->addSeparator();
2350 audioMenu->addAction(audioDelayAct);
2351
2352
2353 // SUBTITLES MENU
2354 // Track submenu
2355 subtitlestrack_menu = new QMenu(this);
2356 subtitlestrack_menu->menuAction()->setObjectName("subtitlestrack_menu");
2357
2358 subtitlesMenu->addMenu(subtitlestrack_menu);
2359
2360 subtitlesMenu->addAction(loadSubsAct);
2361 subtitlesMenu->addAction(unloadSubsAct);
2362 subtitlesMenu->addSeparator();
2363
2364 closed_captions_menu = new QMenu(this);
2365 closed_captions_menu->menuAction()->setObjectName("closed_captions_menu");
2366 closed_captions_menu->addAction( ccNoneAct);
2367 closed_captions_menu->addAction( ccChannel1Act);
2368 closed_captions_menu->addAction( ccChannel2Act);
2369 closed_captions_menu->addAction( ccChannel3Act);
2370 closed_captions_menu->addAction( ccChannel4Act);
2371 subtitlesMenu->addMenu(closed_captions_menu);
2372 subtitlesMenu->addSeparator();
2373
2374 subtitlesMenu->addAction(decSubDelayAct);
2375 subtitlesMenu->addAction(incSubDelayAct);
2376 subtitlesMenu->addSeparator();
2377 subtitlesMenu->addAction(subDelayAct);
2378 subtitlesMenu->addSeparator();
2379 subtitlesMenu->addAction(decSubPosAct);
2380 subtitlesMenu->addAction(incSubPosAct);
2381 subtitlesMenu->addSeparator();
2382 subtitlesMenu->addAction(decSubScaleAct);
2383 subtitlesMenu->addAction(incSubScaleAct);
2384 subtitlesMenu->addSeparator();
2385 subtitlesMenu->addAction(decSubStepAct);
2386 subtitlesMenu->addAction(incSubStepAct);
2387 subtitlesMenu->addSeparator();
2388 subtitlesMenu->addAction(useForcedSubsOnlyAct);
2389 subtitlesMenu->addSeparator();
2390 subtitlesMenu->addAction(subVisibilityAct);
2391 subtitlesMenu->addSeparator();
2392 subtitlesMenu->addAction(useAssAct);
2393 subtitlesMenu->addSeparator(); //turbos
2394 subtitlesMenu->addAction(showFindSubtitlesDialogAct);
2395 subtitlesMenu->addAction(openUploadSubtitlesPageAct); //turbos
2396
2397 // BROWSE MENU
2398 // Titles submenu
2399 titles_menu = new QMenu(this);
2400 titles_menu->menuAction()->setObjectName("titles_menu");
2401
2402 browseMenu->addMenu(titles_menu);
2403
2404 // Chapters submenu
2405 chapters_menu = new QMenu(this);
2406 chapters_menu->menuAction()->setObjectName("chapters_menu");
2407
2408 browseMenu->addMenu(chapters_menu);
2409
2410 // Angles submenu
2411 angles_menu = new QMenu(this);
2412 angles_menu->menuAction()->setObjectName("angles_menu");
2413
2414 browseMenu->addMenu(angles_menu);
2415
2416#if DVDNAV_SUPPORT
2417 browseMenu->addSeparator();
2418 browseMenu->addAction(dvdnavMenuAct);
2419 browseMenu->addAction(dvdnavPrevAct);
2420#endif
2421
2422#if PROGRAM_SWITCH
2423 programtrack_menu = new QMenu(this);
2424 programtrack_menu->menuAction()->setObjectName("programtrack_menu");
2425
2426 browseMenu->addSeparator();
2427 browseMenu->addMenu(programtrack_menu);
2428#endif
2429
2430
2431 // OPTIONS MENU
2432 optionsMenu->addAction(showPropertiesAct);
2433 optionsMenu->addAction(showPlaylistAct);
2434
2435 // OSD submenu
2436 osd_menu = new QMenu(this);
2437 osd_menu->menuAction()->setObjectName("osd_menu");
2438 osd_menu->addActions(osdGroup->actions());
2439
2440 optionsMenu->addMenu(osd_menu);
2441
2442 // Logs submenu
2443 logs_menu = new QMenu(this);
2444 logs_menu->addAction(showLogMplayerAct);
2445 logs_menu->addAction(showLogSmplayerAct);
2446
2447 optionsMenu->addMenu(logs_menu);
2448
2449 optionsMenu->addAction(showPreferencesAct);
2450
2451 /*
2452 Favorites * fav = new Favorites(Paths::configPath() + "/test.fav", this);
2453 connect(fav, SIGNAL(activated(QString)), this, SLOT(open(QString)));
2454 optionsMenu->addMenu( fav->menu() )->setText("Favorites");
2455 */
2456
2457 // HELP MENU
2458 helpMenu->addAction(showFAQAct);
2459 helpMenu->addAction(showCLOptionsAct);
2460 helpMenu->addAction(showTipsAct);
2461 helpMenu->addAction(donateAct);
2462 helpMenu->addSeparator();
2463 helpMenu->addAction(aboutQtAct);
2464 helpMenu->addAction(aboutThisAct);
2465
2466 // POPUP MENU
2467 if (!popup)
2468 popup = new QMenu(this);
2469 else
2470 popup->clear();
2471
2472 popup->addMenu( openMenu );
2473 popup->addMenu( playMenu );
2474 popup->addMenu( videoMenu );
2475 popup->addMenu( audioMenu );
2476 popup->addMenu( subtitlesMenu );
2477 popup->addMenu( browseMenu );
2478 popup->addMenu( optionsMenu );
2479
2480 // let's show something, even a <empty> entry
2481 initializeMenus();
2482}
2483
2484/*
2485void BaseGui::closeEvent( QCloseEvent * e ) {
2486 qDebug("BaseGui::closeEvent");
2487
2488 qDebug("mplayer_log_window: %d x %d", mplayer_log_window->width(), mplayer_log_window->height() );
2489 qDebug("smplayer_log_window: %d x %d", smplayer_log_window->width(), smplayer_log_window->height() );
2490
2491 mplayer_log_window->close();
2492 smplayer_log_window->close();
2493 playlist->close();
2494 equalizer->close();
2495
2496 core->stop();
2497 e->accept();
2498}
2499*/
2500
2501
2502void BaseGui::closeWindow() {
2503 qDebug("BaseGui::closeWindow");
2504
2505 if (core->state() != Core::Stopped) {
2506 core->stop();
2507 }
2508
2509 //qApp->quit();
2510 emit quitSolicited();
2511}
2512
2513void BaseGui::showPlaylist() {
2514 showPlaylist( !playlist->isVisible() );
2515}
2516
2517void BaseGui::showPlaylist(bool b) {
2518 if ( !b ) {
2519 playlist->hide();
2520 } else {
2521 exitFullscreenIfNeeded();
2522 playlist->show();
2523 }
2524 //updateWidgets();
2525}
2526
2527void BaseGui::showVideoEqualizer() {
2528 showVideoEqualizer( !video_equalizer->isVisible() );
2529}
2530
2531void BaseGui::showVideoEqualizer(bool b) {
2532 if (!b) {
2533 video_equalizer->hide();
2534 } else {
2535 // Exit fullscreen, otherwise dialog is not visible
2536 exitFullscreenIfNeeded();
2537 video_equalizer->show();
2538 }
2539 updateWidgets();
2540}
2541
2542void BaseGui::showAudioEqualizer() {
2543 showAudioEqualizer( !audio_equalizer->isVisible() );
2544}
2545
2546void BaseGui::showAudioEqualizer(bool b) {
2547 if (!b) {
2548 audio_equalizer->hide();
2549 } else {
2550 // Exit fullscreen, otherwise dialog is not visible
2551 exitFullscreenIfNeeded();
2552 audio_equalizer->show();
2553 }
2554 updateWidgets();
2555}
2556
2557void BaseGui::showPreferencesDialog() {
2558 qDebug("BaseGui::showPreferencesDialog");
2559
2560 exitFullscreenIfNeeded();
2561
2562 if (!pref_dialog) {
2563 createPreferencesDialog();
2564 }
2565
2566 pref_dialog->setData(pref);
2567
2568 pref_dialog->mod_input()->actions_editor->clear();
2569 pref_dialog->mod_input()->actions_editor->addActions(this);
2570#if !DOCK_PLAYLIST
2571 pref_dialog->mod_input()->actions_editor->addActions(playlist);
2572#endif
2573
2574 // Set playlist preferences
2575 PrefPlaylist * pl = pref_dialog->mod_playlist();
2576 pl->setDirectoryRecursion(playlist->directoryRecursion());
2577 pl->setAutoGetInfo(playlist->autoGetInfo());
2578 pl->setSavePlaylistOnExit(playlist->savePlaylistOnExit());
2579 pl->setPlayFilesFromStart(playlist->playFilesFromStart());
2580
2581 pref_dialog->show();
2582}
2583
2584// The user has pressed OK in preferences dialog
2585void BaseGui::applyNewPreferences() {
2586 qDebug("BaseGui::applyNewPreferences");
2587
2588 bool need_update_language = false;
2589
2590 pref_dialog->getData(pref);
2591
2592 if (!pref->default_font.isEmpty()) {
2593 QFont f;
2594 f.fromString( pref->default_font );
2595 qApp->setFont(f);
2596 }
2597
2598#ifndef NO_USE_INI_FILES
2599 PrefGeneral *_general = pref_dialog->mod_general();
2600 if (_general->fileSettingsMethodChanged()) {
2601 core->changeFileSettingsMethod(pref->file_settings_method);
2602 }
2603#endif
2604
2605 PrefInterface *_interface = pref_dialog->mod_interface();
2606 if (_interface->recentsChanged()) {
2607 updateRecents();
2608 }
2609 if (_interface->languageChanged()) need_update_language = true;
2610
2611 if (_interface->iconsetChanged()) {
2612 need_update_language = true;
2613 // Stylesheet
2614#if ALLOW_CHANGE_STYLESHEET
2615 changeStyleSheet(pref->iconset);
2616#endif
2617 }
2618
2619 if (!pref->use_single_instance && server->isListening()) {
2620 server->close();
2621 qDebug("BaseGui::applyNewPreferences: server closed");
2622 }
2623 else
2624 {
2625 bool server_requires_restart = _interface->serverPortChanged();
2626 if (pref->use_single_instance && !server->isListening())
2627 server_requires_restart=true;
2628
2629 if (server_requires_restart) {
2630 server->close();
2631 int port = 0;
2632 if (!pref->use_autoport) port = pref->connection_port;
2633 if (server->listen(port)) {
2634 pref->autoport = server->serverPort();
2635 qDebug("BaseGui::applyNewPreferences: server running on port %d", pref->autoport);
2636 } else {
2637 qWarning("BaseGui::applyNewPreferences: server couldn't be started");
2638 }
2639 }
2640 }
2641
2642 PrefAdvanced *advanced = pref_dialog->mod_advanced();
2643#if REPAINT_BACKGROUND_OPTION
2644 if (advanced->repaintVideoBackgroundChanged()) {
2645 mplayerwindow->videoLayer()->setRepaintBackground(pref->repaint_video_background);
2646 }
2647#endif
2648#if USE_COLORKEY
2649 if (advanced->colorkeyChanged()) {
2650 mplayerwindow->setColorKey( pref->color_key );
2651 }
2652#endif
2653 if (advanced->monitorAspectChanged()) {
2654 mplayerwindow->setMonitorAspect( pref->monitor_aspect_double() );
2655 }
2656
2657 // Update playlist preferences
2658 PrefPlaylist * pl = pref_dialog->mod_playlist();
2659 playlist->setDirectoryRecursion(pl->directoryRecursion());
2660 playlist->setAutoGetInfo(pl->autoGetInfo());
2661 playlist->setSavePlaylistOnExit(pl->savePlaylistOnExit());
2662 playlist->setPlayFilesFromStart(pl->playFilesFromStart());
2663
2664
2665 if (need_update_language) {
2666 translator->load(pref->language);
2667 }
2668
2669 setJumpTexts(); // Update texts in menus
2670 updateWidgets(); // Update the screenshot action
2671
2672#if STYLE_SWITCHING
2673 if (_interface->styleChanged()) {
2674 qDebug( "selected style: '%s'", pref->style.toUtf8().data() );
2675 if ( !pref->style.isEmpty()) {
2676 qApp->setStyle( pref->style );
2677 } else {
2678 qDebug("setting default style: '%s'", default_style.toUtf8().data() );
2679 qApp->setStyle( default_style );
2680 }
2681 }
2682#endif
2683
2684 // Restart the video if needed
2685 if (pref_dialog->requiresRestart())
2686 core->restart();
2687
2688 // Update actions
2689 pref_dialog->mod_input()->actions_editor->applyChanges();
2690 saveActions();
2691
2692#ifndef NO_USE_INI_FILES
2693 pref->save();
2694#endif
2695}
2696
2697
2698void BaseGui::showFilePropertiesDialog() {
2699 qDebug("BaseGui::showFilePropertiesDialog");
2700
2701 exitFullscreenIfNeeded();
2702
2703 if (!file_dialog) {
2704 createFilePropertiesDialog();
2705 }
2706
2707 setDataToFileProperties();
2708
2709 file_dialog->show();
2710}
2711
2712void BaseGui::setDataToFileProperties() {
2713 // Save a copy of the original values
2714 if (core->mset.original_demuxer.isEmpty())
2715 core->mset.original_demuxer = core->mdat.demuxer;
2716
2717 if (core->mset.original_video_codec.isEmpty())
2718 core->mset.original_video_codec = core->mdat.video_codec;
2719
2720 if (core->mset.original_audio_codec.isEmpty())
2721 core->mset.original_audio_codec = core->mdat.audio_codec;
2722
2723 QString demuxer = core->mset.forced_demuxer;
2724 if (demuxer.isEmpty()) demuxer = core->mdat.demuxer;
2725
2726 QString ac = core->mset.forced_audio_codec;
2727 if (ac.isEmpty()) ac = core->mdat.audio_codec;
2728
2729 QString vc = core->mset.forced_video_codec;
2730 if (vc.isEmpty()) vc = core->mdat.video_codec;
2731
2732 file_dialog->setDemuxer(demuxer, core->mset.original_demuxer);
2733 file_dialog->setAudioCodec(ac, core->mset.original_audio_codec);
2734 file_dialog->setVideoCodec(vc, core->mset.original_video_codec);
2735
2736 file_dialog->setMplayerAdditionalArguments( core->mset.mplayer_additional_options );
2737 file_dialog->setMplayerAdditionalVideoFilters( core->mset.mplayer_additional_video_filters );
2738 file_dialog->setMplayerAdditionalAudioFilters( core->mset.mplayer_additional_audio_filters );
2739
2740 file_dialog->setMediaData( core->mdat );
2741}
2742
2743void BaseGui::applyFileProperties() {
2744 qDebug("BaseGui::applyFileProperties");
2745
2746 bool need_restart = false;
2747 bool demuxer_changed = false;
2748
2749#undef TEST_AND_SET
2750#define TEST_AND_SET( Pref, Dialog ) \
2751 if ( Pref != Dialog ) { Pref = Dialog; need_restart = TRUE; }
2752
2753 QString prev_demuxer = core->mset.forced_demuxer;
2754
2755 QString demuxer = file_dialog->demuxer();
2756 if (demuxer == core->mset.original_demuxer) demuxer="";
2757 TEST_AND_SET(core->mset.forced_demuxer, demuxer);
2758
2759 if (prev_demuxer != core->mset.forced_demuxer) {
2760 // Demuxer changed
2761 demuxer_changed = true;
2762 core->mset.current_audio_id = MediaSettings::NoneSelected;
2763 core->mset.current_sub_id = MediaSettings::NoneSelected;
2764 }
2765
2766 QString ac = file_dialog->audioCodec();
2767 if (ac == core->mset.original_audio_codec) ac="";
2768 TEST_AND_SET(core->mset.forced_audio_codec, ac);
2769
2770 QString vc = file_dialog->videoCodec();
2771 if (vc == core->mset.original_video_codec) vc="";
2772 TEST_AND_SET(core->mset.forced_video_codec, vc);
2773
2774 TEST_AND_SET(core->mset.mplayer_additional_options, file_dialog->mplayerAdditionalArguments());
2775 TEST_AND_SET(core->mset.mplayer_additional_video_filters, file_dialog->mplayerAdditionalVideoFilters());
2776 TEST_AND_SET(core->mset.mplayer_additional_audio_filters, file_dialog->mplayerAdditionalAudioFilters());
2777
2778 // Restart the video to apply
2779 if (need_restart) {
2780 if (demuxer_changed) {
2781 core->reload();
2782 } else {
2783 core->restart();
2784 }
2785 }
2786}
2787
2788
2789void BaseGui::updateMediaInfo() {
2790 qDebug("BaseGui::updateMediaInfo");
2791
2792 if (file_dialog) {
2793 if (file_dialog->isVisible()) setDataToFileProperties();
2794 }
2795
2796 setWindowCaption( core->mdat.displayName(pref->show_tag_in_window_title) + " - SMPlayer" );
2797
2798 emit videoInfoChanged(core->mdat.video_width, core->mdat.video_height, core->mdat.video_fps.toDouble());
2799}
2800
2801void BaseGui::newMediaLoaded() {
2802 qDebug("BaseGui::newMediaLoaded");
2803
2804 pref->history_recents->addItem( core->mdat.filename );
2805 updateRecents();
2806
2807 // If a VCD, Audio CD or DVD, add items to playlist
2808 bool is_disc = ( (core->mdat.type == TYPE_VCD) || (core->mdat.type == TYPE_DVD) || (core->mdat.type == TYPE_AUDIO_CD) );
2809#if DVDNAV_SUPPORT
2810 // Don't add the list of titles if using dvdnav
2811 if ((core->mdat.type == TYPE_DVD) && (core->mdat.filename.startsWith("dvdnav:"))) is_disc = false;
2812#endif
2813 if (pref->auto_add_to_playlist && is_disc)
2814 {
2815 int first_title = 1;
2816 if (core->mdat.type == TYPE_VCD) first_title = pref->vcd_initial_title;
2817
2818 QString type = "dvd"; // FIXME: support dvdnav
2819 if (core->mdat.type == TYPE_VCD) type="vcd";
2820 else
2821 if (core->mdat.type == TYPE_AUDIO_CD) type="cdda";
2822
2823 if (core->mset.current_title_id == first_title) {
2824 playlist->clear();
2825 QStringList l;
2826 QString s;
2827 QString folder;
2828 if (core->mdat.type == TYPE_DVD) {
2829 DiscData disc_data = DiscName::split(core->mdat.filename);
2830 folder = disc_data.device;
2831 }
2832 for (int n=0; n < core->mdat.titles.numItems(); n++) {
2833 s = type + "://" + QString::number(core->mdat.titles.itemAt(n).ID());
2834 if ( !folder.isEmpty() ) {
2835 s += "/" + folder; // FIXME: dvd names are not created as they should
2836 }
2837 l.append(s);
2838 }
2839 playlist->addFiles(l);
2840 //playlist->setModified(false); // Not a real playlist
2841 }
2842 } /*else {
2843 playlist->clear();
2844 playlist->addCurrentFile();
2845 }*/
2846
2847 if ((core->mdat.type == TYPE_FILE) && (pref->auto_add_to_playlist) && (pref->add_to_playlist_consecutive_files)) {
2848 // Look for consecutive files
2849 QStringList files_to_add = Helper::searchForConsecutiveFiles(core->mdat.filename);
2850 if (!files_to_add.empty()) playlist->addFiles(files_to_add);
2851 }
2852}
2853
2854void BaseGui::clearMplayerLog() {
2855 mplayer_log.clear();
2856 if (mplayer_log_window->isVisible()) mplayer_log_window->clear();
2857}
2858
2859void BaseGui::recordMplayerLog(QString line) {
2860 if (pref->log_mplayer) {
2861 if ( (line.indexOf("A:")==-1) && (line.indexOf("V:")==-1) ) {
2862 line.append("\n");
2863 mplayer_log.append(line);
2864 if (mplayer_log_window->isVisible()) mplayer_log_window->appendText(line);
2865 }
2866 }
2867}
2868
2869void BaseGui::recordSmplayerLog(QString line) {
2870 if (pref->log_smplayer) {
2871 line.append("\n");
2872 smplayer_log.append(line);
2873 if (smplayer_log_window->isVisible()) smplayer_log_window->appendText(line);
2874 }
2875}
2876
2877/*!
2878 Save the mplayer log to a file, so it can be used by external
2879 applications.
2880*/
2881void BaseGui::autosaveMplayerLog() {
2882 qDebug("BaseGui::autosaveMplayerLog");
2883
2884 if (pref->autosave_mplayer_log) {
2885 if (!pref->mplayer_log_saveto.isEmpty()) {
2886 QFile file( pref->mplayer_log_saveto );
2887 if ( file.open( QIODevice::WriteOnly ) ) {
2888 QTextStream strm( &file );
2889 strm << mplayer_log;
2890 file.close();
2891 }
2892 }
2893 }
2894}
2895
2896void BaseGui::showMplayerLog() {
2897 qDebug("BaseGui::showMplayerLog");
2898
2899 exitFullscreenIfNeeded();
2900
2901 mplayer_log_window->setText( mplayer_log );
2902 mplayer_log_window->show();
2903}
2904
2905void BaseGui::showLog() {
2906 qDebug("BaseGui::showLog");
2907
2908 exitFullscreenIfNeeded();
2909
2910 smplayer_log_window->setText( smplayer_log );
2911 smplayer_log_window->show();
2912}
2913
2914
2915void BaseGui::initializeMenus() {
2916 qDebug("BaseGui::initializeMenus");
2917
2918#define EMPTY 1
2919
2920 int n;
2921
2922 // Subtitles
2923 subtitleTrackGroup->clear(true);
2924 QAction * subNoneAct = subtitleTrackGroup->addAction( tr("&None") );
2925 subNoneAct->setData(MediaSettings::SubNone);
2926 subNoneAct->setCheckable(true);
2927 for (n=0; n < core->mdat.subs.numItems(); n++) {
2928 QAction *a = new QAction(subtitleTrackGroup);
2929 a->setCheckable(true);
2930 a->setText(core->mdat.subs.itemAt(n).displayName());
2931 a->setData(n);
2932 }
2933 subtitlestrack_menu->addActions( subtitleTrackGroup->actions() );
2934
2935 // Audio
2936 audioTrackGroup->clear(true);
2937 if (core->mdat.audios.numItems()==0) {
2938 QAction * a = audioTrackGroup->addAction( tr("<empty>") );
2939 a->setEnabled(false);
2940 } else {
2941 for (n=0; n < core->mdat.audios.numItems(); n++) {
2942 QAction *a = new QAction(audioTrackGroup);
2943 a->setCheckable(true);
2944 a->setText(core->mdat.audios.itemAt(n).displayName());
2945 a->setData(core->mdat.audios.itemAt(n).ID());
2946 }
2947 }
2948 audiotrack_menu->addActions( audioTrackGroup->actions() );
2949
2950#if PROGRAM_SWITCH
2951 // Program
2952 programTrackGroup->clear(true);
2953 if (core->mdat.programs.numItems()==0) {
2954 QAction * a = programTrackGroup->addAction( tr("<empty>") );
2955 a->setEnabled(false);
2956 } else {
2957 for (n=0; n < core->mdat.programs.numItems(); n++) {
2958 QAction *a = new QAction(programTrackGroup);
2959 a->setCheckable(true);
2960 a->setText(core->mdat.programs.itemAt(n).displayName());
2961 a->setData(core->mdat.programs.itemAt(n).ID());
2962 }
2963 }
2964 programtrack_menu->addActions( programTrackGroup->actions() );
2965#endif
2966
2967 // Video
2968 videoTrackGroup->clear(true);
2969 if (core->mdat.videos.numItems()==0) {
2970 QAction * a = videoTrackGroup->addAction( tr("<empty>") );
2971 a->setEnabled(false);
2972 } else {
2973 for (n=0; n < core->mdat.videos.numItems(); n++) {
2974 QAction *a = new QAction(videoTrackGroup);
2975 a->setCheckable(true);
2976 a->setText(core->mdat.videos.itemAt(n).displayName());
2977 a->setData(core->mdat.videos.itemAt(n).ID());
2978 }
2979 }
2980 videotrack_menu->addActions( videoTrackGroup->actions() );
2981
2982 // Titles
2983 titleGroup->clear(true);
2984 if (core->mdat.titles.numItems()==0) {
2985 QAction * a = titleGroup->addAction( tr("<empty>") );
2986 a->setEnabled(false);
2987 } else {
2988 for (n=0; n < core->mdat.titles.numItems(); n++) {
2989 QAction *a = new QAction(titleGroup);
2990 a->setCheckable(true);
2991 a->setText(core->mdat.titles.itemAt(n).displayName());
2992 a->setData(core->mdat.titles.itemAt(n).ID());
2993 }
2994 }
2995 titles_menu->addActions( titleGroup->actions() );
2996
2997#if GENERIC_CHAPTER_SUPPORT
2998 chapterGroup->clear(true);
2999 if (core->mdat.chapters > 0) {
3000 for (n=0; n < core->mdat.chapters; n++) {
3001 QAction *a = new QAction(chapterGroup);
3002 a->setCheckable(true);
3003 a->setText( QString::number(n+1) );
3004 a->setData( n + Core::firstChapter() );
3005 }
3006 } else {
3007 QAction * a = chapterGroup->addAction( tr("<empty>") );
3008 a->setEnabled(false);
3009 }
3010 chapters_menu->addActions( chapterGroup->actions() );
3011#else
3012 // DVD Chapters
3013 chapterGroup->clear(true);
3014 if ( (core->mdat.type == TYPE_DVD) && (core->mset.current_title_id > 0) ) {
3015 for (n=0; n < core->mdat.titles.item(core->mset.current_title_id).chapters(); n++) {
3016 QAction *a = new QAction(chapterGroup);
3017 a->setCheckable(true);
3018 a->setText( QString::number(n+1) );
3019 a->setData( n + Core::dvdFirstChapter() );
3020 }
3021 } else {
3022 // *** Matroshka chapters ***
3023 if (core->mdat.mkv_chapters > 0) {
3024 for (n=0; n < core->mdat.mkv_chapters; n++) {
3025 QAction *a = new QAction(chapterGroup);
3026 a->setCheckable(true);
3027 a->setText( QString::number(n+1) );
3028 a->setData( n + Core::firstChapter() );
3029 }
3030 } else {
3031 QAction * a = chapterGroup->addAction( tr("<empty>") );
3032 a->setEnabled(false);
3033 }
3034 }
3035 chapters_menu->addActions( chapterGroup->actions() );
3036#endif
3037
3038 // Angles
3039 angleGroup->clear(true);
3040 int n_angles = 0;
3041 if (core->mset.current_angle_id > 0) {
3042 int i = core->mdat.titles.find(core->mset.current_angle_id);
3043 if (i > -1) n_angles = core->mdat.titles.itemAt(i).angles();
3044 }
3045 if (n_angles > 0) {
3046 for (n=1; n <= n_angles; n++) {
3047 QAction *a = new QAction(angleGroup);
3048 a->setCheckable(true);
3049 a->setText( QString::number(n) );
3050 a->setData( n );
3051 }
3052 } else {
3053 QAction * a = angleGroup->addAction( tr("<empty>") );
3054 a->setEnabled(false);
3055 }
3056 angles_menu->addActions( angleGroup->actions() );
3057}
3058
3059void BaseGui::updateRecents() {
3060 qDebug("BaseGui::updateRecents");
3061
3062 // Not clear the first 2 items
3063 while (recentfiles_menu->actions().count() > 2) {
3064 QAction * a = recentfiles_menu->actions()[2];
3065 recentfiles_menu->removeAction( a );
3066 a->deleteLater();
3067 }
3068
3069 int current_items = 0;
3070
3071 if (pref->history_recents->count() > 0) {
3072 for (int n=0; n < pref->history_recents->count(); n++) {
3073 QString i = QString::number( n+1 );
3074 QString fullname = pref->history_recents->item(n);
3075 QString filename = fullname;
3076 QFileInfo fi(fullname);
3077 //if (fi.exists()) filename = fi.fileName(); // Can be slow
3078
3079 // Let's see if it looks like a file (no dvd://1 or something)
3080 if (fullname.indexOf(QRegExp("^.*://.*")) == -1) filename = fi.fileName();
3081
3082 QAction * a = recentfiles_menu->addAction( QString("%1. " + filename ).arg( i.insert( i.size()-1, '&' ), 3, ' ' ));
3083 a->setStatusTip(fullname);
3084 a->setData(n);
3085 connect(a, SIGNAL(triggered()), this, SLOT(openRecent()));
3086 current_items++;
3087 }
3088 } else {
3089 QAction * a = recentfiles_menu->addAction( tr("<empty>") );
3090 a->setEnabled(false);
3091 }
3092
3093 recentfiles_menu->menuAction()->setVisible( current_items > 0 );
3094}
3095
3096void BaseGui::clearRecentsList() {
3097 // Delete items in menu
3098 pref->history_recents->clear();
3099 updateRecents();
3100}
3101
3102void BaseGui::updateWidgets() {
3103 qDebug("BaseGui::updateWidgets");
3104
3105 // Subtitles menu
3106 subtitleTrackGroup->setChecked( core->mset.current_sub_id );
3107
3108 // Disable the unload subs action if there's no external subtitles
3109 unloadSubsAct->setEnabled( !core->mset.external_subtitles.isEmpty() );
3110
3111 // Closed caption menu
3112 ccGroup->setChecked( core->mset.closed_caption_channel );
3113
3114 // Audio menu
3115 audioTrackGroup->setChecked( core->mset.current_audio_id );
3116 channelsGroup->setChecked( core->mset.audio_use_channels );
3117 stereoGroup->setChecked( core->mset.stereo_mode );
3118 // Disable the unload audio file action if there's no external audio file
3119 unloadAudioAct->setEnabled( !core->mset.external_audio.isEmpty() );
3120
3121#if PROGRAM_SWITCH
3122 // Program menu
3123 programTrackGroup->setChecked( core->mset.current_program_id );
3124#endif
3125
3126 // Video menu
3127 videoTrackGroup->setChecked( core->mset.current_video_id );
3128
3129 // Aspect ratio
3130 aspectGroup->setChecked( core->mset.aspect_ratio_id );
3131
3132 // Rotate
3133 rotateGroup->setChecked( core->mset.rotate );
3134
3135#if USE_ADAPTER
3136 screenGroup->setChecked( pref->adapter );
3137#endif
3138
3139 // OSD
3140 osdGroup->setChecked( pref->osd );
3141
3142 // Titles
3143 titleGroup->setChecked( core->mset.current_title_id );
3144
3145 // Chapters
3146 chapterGroup->setChecked( core->mset.current_chapter_id );
3147
3148 // Angles
3149 angleGroup->setChecked( core->mset.current_angle_id );
3150
3151 // Deinterlace menu
3152 deinterlaceGroup->setChecked( core->mset.current_deinterlacer );
3153
3154 // Video size menu
3155 sizeGroup->setChecked( pref->size_factor );
3156
3157 // Auto phase
3158 phaseAct->setChecked( core->mset.phase_filter );
3159
3160 // Deblock
3161 deblockAct->setChecked( core->mset.deblock_filter );
3162
3163 // Dering
3164 deringAct->setChecked( core->mset.dering_filter );
3165
3166 // Add noise
3167 addNoiseAct->setChecked( core->mset.noise_filter );
3168
3169 // Letterbox
3170 addLetterboxAct->setChecked( core->mset.add_letterbox );
3171
3172 // Upscaling
3173 upscaleAct->setChecked( core->mset.upscaling_filter );
3174
3175
3176 // Postprocessing
3177 postProcessingAct->setChecked( core->mset.postprocessing_filter );
3178
3179 // Denoise submenu
3180 denoiseGroup->setChecked( core->mset.current_denoiser );
3181
3182 /*
3183 // Fullscreen button
3184 fullscreenbutton->setOn(pref->fullscreen);
3185
3186 // Mute button
3187 mutebutton->setOn(core->mset.mute);
3188 if (core->mset.mute)
3189 mutebutton->setPixmap( Images::icon("mute_small") );
3190 else
3191 mutebutton->setPixmap( Images::icon("volume_small") );
3192
3193 // Volume slider
3194 volumeslider->setValue( core->mset.volume );
3195 */
3196
3197 // Mute menu option
3198 muteAct->setChecked( (pref->global_volume ? pref->mute : core->mset.mute) );
3199
3200 // Karaoke menu option
3201 karaokeAct->setChecked( core->mset.karaoke_filter );
3202
3203 // Extrastereo menu option
3204 extrastereoAct->setChecked( core->mset.extrastereo_filter );
3205
3206 // Volnorm menu option
3207 volnormAct->setChecked( core->mset.volnorm_filter );
3208
3209 // Repeat menu option
3210 repeatAct->setChecked( core->mset.loop );
3211
3212 // Fullscreen action
3213 fullscreenAct->setChecked( pref->fullscreen );
3214
3215 // Time slider
3216 if (core->state()==Core::Stopped) {
3217 //FIXME
3218 //timeslider->setValue( (int) core->mset.current_sec );
3219 }
3220
3221 // Video equalizer
3222 videoEqualizerAct->setChecked( video_equalizer->isVisible() );
3223
3224 // Audio equalizer
3225 audioEqualizerAct->setChecked( audio_equalizer->isVisible() );
3226
3227 // Playlist
3228#if !DOCK_PLAYLIST
3229 //showPlaylistAct->setChecked( playlist->isVisible() );
3230#endif
3231
3232#if DOCK_PLAYLIST
3233 showPlaylistAct->setChecked( playlist->isVisible() );
3234#endif
3235
3236 // Compact mode
3237 compactAct->setChecked( pref->compact_mode );
3238
3239 // Stay on top
3240 onTopActionGroup->setChecked( (int) pref->stay_on_top );
3241
3242 // Flip
3243 flipAct->setChecked( core->mset.flip );
3244
3245 // Mirror
3246 mirrorAct->setChecked( core->mset.mirror );
3247
3248 // Use ass lib
3249 useAssAct->setChecked( pref->use_ass_subtitles );
3250
3251 // Forced subs
3252 useForcedSubsOnlyAct->setChecked( pref->use_forced_subs_only );
3253
3254 // Subtitle visibility
3255 subVisibilityAct->setChecked(pref->sub_visibility);
3256
3257 // Enable or disable subtitle options
3258 bool e = ((core->mset.current_sub_id != MediaSettings::SubNone) &&
3259 (core->mset.current_sub_id != MediaSettings::NoneSelected));
3260
3261 if (core->mset.closed_caption_channel !=0 ) e = true; // Enable if using closed captions
3262
3263 decSubDelayAct->setEnabled(e);
3264 incSubDelayAct->setEnabled(e);
3265 subDelayAct->setEnabled(e);
3266 decSubPosAct->setEnabled(e);
3267 incSubPosAct->setEnabled(e);
3268 decSubScaleAct->setEnabled(e);
3269 incSubScaleAct->setEnabled(e);
3270 decSubStepAct->setEnabled(e);
3271 incSubStepAct->setEnabled(e);
3272}
3273
3274void BaseGui::updateVideoEqualizer() {
3275 // Equalizer
3276 video_equalizer->contrast->setValue( core->mset.contrast );
3277 video_equalizer->brightness->setValue( core->mset.brightness );
3278 video_equalizer->hue->setValue( core->mset.hue );
3279 video_equalizer->saturation->setValue( core->mset.saturation );
3280 video_equalizer->gamma->setValue( core->mset.gamma );
3281}
3282
3283void BaseGui::updateAudioEqualizer() {
3284 // Audio Equalizer
3285 for (int n = 0; n < 10; n++) {
3286 audio_equalizer->eq[n]->setValue( core->mset.audio_equalizer[n].toInt() );
3287 }
3288}
3289
3290/*
3291void BaseGui::playlistVisibilityChanged() {
3292#if !DOCK_PLAYLIST
3293 bool visible = playlist->isVisible();
3294
3295 showPlaylistAct->setChecked( visible );
3296#endif
3297}
3298*/
3299
3300/*
3301void BaseGui::openRecent(int item) {
3302 qDebug("BaseGui::openRecent: %d", item);
3303 if ((item > -1) && (item < RECENTS_CLEAR)) { // 1000 = Clear item
3304 open( recents->item(item) );
3305 }
3306}
3307*/
3308
3309void BaseGui::openRecent() {
3310 QAction *a = qobject_cast<QAction *> (sender());
3311 if (a) {
3312 int item = a->data().toInt();
3313 qDebug("BaseGui::openRecent: %d", item);
3314 QString file = pref->history_recents->item(item);
3315
3316 if (pref->auto_add_to_playlist) {
3317 if (playlist->maybeSave()) {
3318 playlist->clear();
3319 playlist->addFile(file, Playlist::NoGetInfo);
3320
3321 open( file );
3322 }
3323 } else {
3324 open( file );
3325 }
3326
3327 }
3328}
3329
3330void BaseGui::open(QString file) {
3331 qDebug("BaseGui::open: '%s'", file.toUtf8().data());
3332
3333 // If file is a playlist, open that playlist
3334 QString extension = QFileInfo(file).suffix().toLower();
3335 if ( (extension=="m3u") || (extension=="m3u8") ) {
3336 playlist->load_m3u(file);
3337 }
3338 else
3339 if (extension=="pls") {
3340 playlist->load_pls(file);
3341 }
3342 else
3343 if (QFileInfo(file).isDir()) {
3344 openDirectory(file);
3345 }
3346 else {
3347 // Let the core to open it, autodetecting the file type
3348 //if (playlist->maybeSave()) {
3349 // playlist->clear();
3350 // playlist->addFile(file);
3351
3352 core->open(file);
3353 //}
3354 }
3355
3356 if (QFile::exists(file)) pref->latest_dir = QFileInfo(file).absolutePath();
3357}
3358
3359void BaseGui::openFiles(QStringList files) {
3360 qDebug("BaseGui::openFiles");
3361 if (files.empty()) return;
3362
3363 if (files.count()==1) {
3364 if (pref->auto_add_to_playlist) {
3365 if (playlist->maybeSave()) {
3366 playlist->clear();
3367 playlist->addFile(files[0], Playlist::NoGetInfo);
3368
3369 open(files[0]);
3370 }
3371 } else {
3372 open(files[0]);
3373 }
3374 } else {
3375 if (playlist->maybeSave()) {
3376 playlist->clear();
3377 playlist->addFiles(files);
3378 open(files[0]);
3379 }
3380 }
3381}
3382
3383void BaseGui::openURL() {
3384 qDebug("BaseGui::openURL");
3385
3386 exitFullscreenIfNeeded();
3387
3388 /*
3389 bool ok;
3390 QString s = QInputDialog::getText(this,
3391 tr("SMPlayer - Enter URL"), tr("URL:"), QLineEdit::Normal,
3392 pref->last_url, &ok );
3393
3394 if ( ok && !s.isEmpty() ) {
3395
3396 //playlist->clear();
3397 //playlistdock->hide();
3398
3399 openURL(s);
3400 } else {
3401 // user entered nothing or pressed Cancel
3402 }
3403 */
3404
3405 InputURL d(this);
3406
3407 for (int n=0; n < pref->history_urls->count(); n++) {
3408 d.setURL( pref->history_urls->url(n), pref->history_urls->isPlaylist(n) );
3409 }
3410
3411 if (d.exec() == QDialog::Accepted ) {
3412 QString url = d.url();
3413 bool is_playlist = d.isPlaylist();
3414 if (!url.isEmpty()) {
3415 pref->history_urls->addUrl(url, is_playlist);
3416 if (is_playlist) url = url + IS_PLAYLIST_TAG;
3417 openURL(url);
3418 }
3419 }
3420}
3421
3422void BaseGui::openURL(QString url) {
3423 if (!url.isEmpty()) {
3424 //pref->history_urls->addUrl(url);
3425
3426 if (pref->auto_add_to_playlist) {
3427 if (playlist->maybeSave()) {
3428 core->openStream(url);
3429
3430 playlist->clear();
3431 playlist->addFile(url, Playlist::NoGetInfo);
3432 }
3433 } else {
3434 core->openStream(url);
3435 }
3436 }
3437}
3438
3439
3440void BaseGui::openFile() {
3441 qDebug("BaseGui::fileOpen");
3442
3443 exitFullscreenIfNeeded();
3444
3445 Extensions e;
3446 QString s = MyFileDialog::getOpenFileName(
3447 this, tr("Choose a file"), pref->latest_dir,
3448 tr("Multimedia") + e.allPlayable().forFilter()+";;" +
3449 tr("Video") + e.video().forFilter()+";;" +
3450 tr("Audio") + e.audio().forFilter()+";;" +
3451 tr("Playlists") + e.playlist().forFilter()+";;" +
3452 tr("All files") +" (*.*)" );
3453
3454 if ( !s.isEmpty() ) {
3455 openFile(s);
3456 }
3457}
3458
3459void BaseGui::openFile(QString file) {
3460 qDebug("BaseGui::openFile: '%s'", file.toUtf8().data());
3461
3462 if ( !file.isEmpty() ) {
3463
3464 //playlist->clear();
3465 //playlistdock->hide();
3466
3467 // If file is a playlist, open that playlist
3468 QString extension = QFileInfo(file).suffix().toLower();
3469 if ( (extension=="m3u") || (extension=="m3u8") ) {
3470 playlist->load_m3u(file);
3471 }
3472 else
3473 if (extension=="pls") {
3474 playlist->load_pls(file);
3475 }
3476 else
3477 if (extension=="iso") {
3478 if (playlist->maybeSave()) {
3479 core->open(file);
3480 }
3481 }
3482 else {
3483 if (pref->auto_add_to_playlist) {
3484 if (playlist->maybeSave()) {
3485 core->openFile(file);
3486
3487 playlist->clear();
3488 playlist->addFile(file, Playlist::NoGetInfo);
3489 }
3490 } else {
3491 core->openFile(file);
3492 }
3493 }
3494 if (QFile::exists(file)) pref->latest_dir = QFileInfo(file).absolutePath();
3495 }
3496}
3497
3498void BaseGui::configureDiscDevices() {
3499 QMessageBox::information( this, tr("SMPlayer - Information"),
3500 tr("The CDROM / DVD drives are not configured yet.\n"
3501 "The configuration dialog will be shown now, "
3502 "so you can do it."), QMessageBox::Ok);
3503
3504 showPreferencesDialog();
3505 pref_dialog->showSection( PreferencesDialog::Drives );
3506}
3507
3508void BaseGui::openVCD() {
3509 qDebug("BaseGui::openVCD");
3510
3511 if ( (pref->dvd_device.isEmpty()) ||
3512 (pref->cdrom_device.isEmpty()) )
3513 {
3514 configureDiscDevices();
3515 } else {
3516 if (playlist->maybeSave()) {
3517 core->openVCD( pref->vcd_initial_title );
3518 }
3519 }
3520}
3521
3522void BaseGui::openAudioCD() {
3523 qDebug("BaseGui::openAudioCD");
3524
3525 if ( (pref->dvd_device.isEmpty()) ||
3526 (pref->cdrom_device.isEmpty()) )
3527 {
3528 configureDiscDevices();
3529 } else {
3530 if (playlist->maybeSave()) {
3531 core->openAudioCD();
3532 }
3533 }
3534}
3535
3536void BaseGui::openDVD() {
3537 qDebug("BaseGui::openDVD");
3538
3539 if ( (pref->dvd_device.isEmpty()) ||
3540 (pref->cdrom_device.isEmpty()) )
3541 {
3542 configureDiscDevices();
3543 } else {
3544 if (playlist->maybeSave()) {
3545#if DVDNAV_SUPPORT
3546 core->openDVD( DiscName::joinDVD(pref->use_dvdnav ? 0: 1, pref->dvd_device, pref->use_dvdnav) );
3547#else
3548 core->openDVD( DiscName::joinDVD(1, pref->dvd_device, false) );
3549#endif
3550 }
3551 }
3552}
3553
3554void BaseGui::openDVDFromFolder() {
3555 qDebug("BaseGui::openDVDFromFolder");
3556
3557 if (playlist->maybeSave()) {
3558 InputDVDDirectory *d = new InputDVDDirectory(this);
3559 d->setFolder( pref->last_dvd_directory );
3560
3561 if (d->exec() == QDialog::Accepted) {
3562 qDebug("BaseGui::openDVDFromFolder: accepted");
3563 openDVDFromFolder( d->folder() );
3564 }
3565
3566 delete d;
3567 }
3568}
3569
3570void BaseGui::openDVDFromFolder(QString directory) {
3571 pref->last_dvd_directory = directory;
3572#if DVDNAV_SUPPORT
3573 core->openDVD( DiscName::joinDVD(pref->use_dvdnav ? 0: 1, directory, pref->use_dvdnav) );
3574#else
3575 core->openDVD( DiscName::joinDVD(1, directory, false) );
3576#endif
3577}
3578
3579void BaseGui::openDirectory() {
3580 qDebug("BaseGui::openDirectory");
3581
3582 QString s = MyFileDialog::getExistingDirectory(
3583 this, tr("Choose a directory"),
3584 pref->latest_dir );
3585
3586 if (!s.isEmpty()) {
3587 openDirectory(s);
3588 }
3589}
3590
3591void BaseGui::openDirectory(QString directory) {
3592 qDebug("BaseGui::openDirectory: '%s'", directory.toUtf8().data());
3593
3594 if (Helper::directoryContainsDVD(directory)) {
3595 core->open(directory);
3596 }
3597 else {
3598 QFileInfo fi(directory);
3599 if ( (fi.exists()) && (fi.isDir()) ) {
3600 playlist->clear();
3601 //playlist->addDirectory(directory);
3602 playlist->addDirectory( fi.absoluteFilePath() );
3603 playlist->startPlay();
3604 } else {
3605 qDebug("BaseGui::openDirectory: directory is not valid");
3606 }
3607 }
3608}
3609
3610void BaseGui::loadSub() {
3611 qDebug("BaseGui::loadSub");
3612
3613 exitFullscreenIfNeeded();
3614
3615 Extensions e;
3616 QString s = MyFileDialog::getOpenFileName(
3617 this, tr("Choose a file"),
3618 pref->latest_dir,
3619 tr("Subtitles") + e.subtitles().forFilter()+ ";;" +
3620 tr("All files") +" (*.*)" );
3621
3622 if (!s.isEmpty()) core->loadSub(s);
3623}
3624
3625void BaseGui::setInitialSubtitle(const QString & subtitle_file) {
3626 qDebug("BaseGui::setInitialSubtitle: '%s'", subtitle_file.toUtf8().constData());
3627
3628 core->setInitialSubtitle(subtitle_file);
3629}
3630
3631void BaseGui::loadAudioFile() {
3632 qDebug("BaseGui::loadAudioFile");
3633
3634 exitFullscreenIfNeeded();
3635
3636 Extensions e;
3637 QString s = MyFileDialog::getOpenFileName(
3638 this, tr("Choose a file"),
3639 pref->latest_dir,
3640 tr("Audio") + e.audio().forFilter()+";;" +
3641 tr("All files") +" (*.*)" );
3642
3643 if (!s.isEmpty()) core->loadAudioFile(s);
3644}
3645
3646void BaseGui::helpFAQ() {
3647 QUrl url = QUrl::fromLocalFile(Paths::doc("faq.html", pref->language));
3648 qDebug("BaseGui::helpFAQ: file to open %s", url.toString().toUtf8().data());
3649 QDesktopServices::openUrl( url );
3650}
3651
3652void BaseGui::helpCLOptions() {
3653 if (clhelp_window == 0) {
3654 clhelp_window = new LogWindow(this);
3655 }
3656 clhelp_window->setWindowTitle( tr("SMPlayer command line options") );
3657 clhelp_window->setHtml(CLHelp::help(true));
3658 clhelp_window->show();
3659}
3660
3661void BaseGui::helpTips() {
3662 QDesktopServices::openUrl( QUrl("http://smplayer.sf.net/forum/viewforum.php?f=12") );
3663}
3664
3665void BaseGui::helpDonate() {
3666 QMessageBox d(QMessageBox::NoIcon, tr("Donate"),
3667 tr("If you like SMPlayer, a really good way to support it is by sending a donation, even the smallest one is highly appreciated.") + "<br>" +
3668 tr("You can send your donation using %1.").arg("<a href=\"https://sourceforge.net/donate/index.php?group_id=185512\">"+tr("this form")),
3669 QMessageBox::Ok, this);
3670 d.setIconPixmap( Images::icon("logo", 64) );
3671 d.exec();
3672}
3673
3674void BaseGui::helpAbout() {
3675 About d(this);
3676 d.exec();
3677}
3678
3679void BaseGui::helpAboutQt() {
3680 QMessageBox::aboutQt(this, tr("About Qt") );
3681}
3682
3683void BaseGui::showGotoDialog() {
3684 TimeDialog d(this);
3685 d.setLabel(tr("&Jump to:"));
3686 d.setWindowTitle(tr("SMPlayer - Seek"));
3687 d.setMaximumTime( (int) core->mdat.duration);
3688 d.setTime( (int) core->mset.current_sec);
3689 if (d.exec() == QDialog::Accepted) {
3690 core->goToSec( d.time() );
3691 }
3692}
3693
3694void BaseGui::showAudioDelayDialog() {
3695 bool ok;
3696 int delay = QInputDialog::getInteger(this, tr("SMPlayer - Audio delay"),
3697 tr("Audio delay (in milliseconds):"), core->mset.audio_delay,
3698 -3600000, 3600000, 1, &ok);
3699 if (ok) {
3700 core->setAudioDelay(delay);
3701 }
3702}
3703
3704void BaseGui::showSubDelayDialog() {
3705 bool ok;
3706 int delay = QInputDialog::getInteger(this, tr("SMPlayer - Subtitle delay"),
3707 tr("Subtitle delay (in milliseconds):"), core->mset.sub_delay,
3708 -3600000, 3600000, 1, &ok);
3709 if (ok) {
3710 core->setSubDelay(delay);
3711 }
3712}
3713
3714void BaseGui::exitFullscreen() {
3715 if (pref->fullscreen) {
3716 toggleFullscreen(false);
3717 }
3718}
3719
3720void BaseGui::toggleFullscreen() {
3721 qDebug("BaseGui::toggleFullscreen");
3722
3723 toggleFullscreen(!pref->fullscreen);
3724}
3725
3726void BaseGui::toggleFullscreen(bool b) {
3727 qDebug("BaseGui::toggleFullscreen: %d", b);
3728
3729 if (b==pref->fullscreen) {
3730 // Nothing to do
3731 qDebug("BaseGui::toggleFullscreen: nothing to do, returning");
3732 return;
3733 }
3734
3735 pref->fullscreen = b;
3736
3737 // If using mplayer window
3738 if (pref->use_mplayer_window) {
3739 core->tellmp("vo_fullscreen " + QString::number(b) );
3740 updateWidgets();
3741 return;
3742 }
3743
3744 if (!panel->isVisible()) return; // mplayer window is not used.
3745
3746 if (pref->fullscreen) {
3747 compactAct->setEnabled(false);
3748
3749 if (pref->restore_pos_after_fullscreen) {
3750 win_pos = pos();
3751 win_size = size();
3752 }
3753
3754 was_maximized = isMaximized();
3755 qDebug("BaseGui::toggleFullscreen: was_maximized: %d", was_maximized);
3756
3757 aboutToEnterFullscreen();
3758
3759 #ifdef Q_OS_WIN
3760 // Hack to avoid the windows taskbar to be visible on Windows XP
3761 if (QSysInfo::WindowsVersion < QSysInfo::WV_VISTA) {
3762 if (!pref->pause_when_hidden) hide();
3763 }
3764 #endif
3765
3766 showFullScreen();
3767
3768 } else {
3769 showNormal();
3770
3771 if (was_maximized) showMaximized(); // It has to be called after showNormal()
3772
3773 aboutToExitFullscreen();
3774
3775 if (pref->restore_pos_after_fullscreen) {
3776 move( win_pos );
3777 resize( win_size );
3778 }
3779
3780 compactAct->setEnabled(true);
3781 }
3782
3783 updateWidgets();
3784
3785 if ((pref->add_blackborders_on_fullscreen) &&
3786 (!core->mset.add_letterbox))
3787 {
3788 core->restart();
3789 }
3790
3791 setFocus(); // Fixes bug #2493415
3792}
3793
3794
3795void BaseGui::aboutToEnterFullscreen() {
3796 if (!pref->compact_mode) {
3797 menuBar()->hide();
3798 statusBar()->hide();
3799 }
3800}
3801
3802void BaseGui::aboutToExitFullscreen() {
3803 if (!pref->compact_mode) {
3804 menuBar()->show();
3805 statusBar()->show();
3806 }
3807}
3808
3809
3810void BaseGui::leftClickFunction() {
3811 qDebug("BaseGui::leftClickFunction");
3812
3813 if (!pref->mouse_left_click_function.isEmpty()) {
3814 processFunction(pref->mouse_left_click_function);
3815 }
3816}
3817
3818void BaseGui::rightClickFunction() {
3819 qDebug("BaseGui::rightClickFunction");
3820
3821 if (!pref->mouse_right_click_function.isEmpty()) {
3822 processFunction(pref->mouse_right_click_function);
3823 }
3824}
3825
3826void BaseGui::doubleClickFunction() {
3827 qDebug("BaseGui::doubleClickFunction");
3828
3829 if (!pref->mouse_double_click_function.isEmpty()) {
3830 processFunction(pref->mouse_double_click_function);
3831 }
3832}
3833
3834void BaseGui::middleClickFunction() {
3835 qDebug("BaseGui::middleClickFunction");
3836
3837 if (!pref->mouse_middle_click_function.isEmpty()) {
3838 processFunction(pref->mouse_middle_click_function);
3839 }
3840}
3841
3842void BaseGui::xbutton1ClickFunction() {
3843 qDebug("BaseGui::xbutton1ClickFunction");
3844
3845 if (!pref->mouse_xbutton1_click_function.isEmpty()) {
3846 processFunction(pref->mouse_xbutton1_click_function);
3847 }
3848}
3849
3850void BaseGui::xbutton2ClickFunction() {
3851 qDebug("BaseGui::xbutton2ClickFunction");
3852
3853 if (!pref->mouse_xbutton2_click_function.isEmpty()) {
3854 processFunction(pref->mouse_xbutton2_click_function);
3855 }
3856}
3857
3858void BaseGui::processFunction(QString function) {
3859 qDebug("BaseGui::processFunction: '%s'", function.toUtf8().data());
3860
3861 //parse args for checkable actions
3862 QRegExp func_rx("(.*) (true|false)");
3863 bool value = false;
3864 bool checkableFunction = false;
3865
3866 if(func_rx.indexIn(function) > -1){
3867 function = func_rx.cap(1);
3868 value = (func_rx.cap(2) == "true");
3869 checkableFunction = true;
3870 } //end if
3871
3872 QAction * action = ActionsEditor::findAction(this, function);
3873 if (!action) action = ActionsEditor::findAction(playlist, function);
3874
3875 if (action) {
3876 qDebug("BaseGui::processFunction: action found");
3877
3878 if (!action->isEnabled()) {
3879 qDebug("BaseGui::processFunction: action is disabled, doing nothing");
3880 return;
3881 }
3882
3883 if (action->isCheckable()){
3884 if(checkableFunction)
3885 action->setChecked(value);
3886 else
3887 //action->toggle();
3888 action->trigger();
3889 }else{
3890 action->trigger();
3891 }
3892 }
3893}
3894
3895void BaseGui::runActions(QString actions) {
3896 qDebug("BaseGui::runActions");
3897
3898 actions = actions.simplified(); // Remove white space
3899
3900 QAction * action;
3901 QStringList actionsList = actions.split(" ");
3902
3903 for (int n = 0; n < actionsList.count(); n++) {
3904 QString actionStr = actionsList[n];
3905 QString par = ""; //the parameter which the action takes
3906
3907 //set par if the next word is a boolean value
3908 if ( (n+1) < actionsList.count() ) {
3909 if ( (actionsList[n+1].toLower() == "true") || (actionsList[n+1].toLower() == "false") ) {
3910 par = actionsList[n+1].toLower();
3911 n++;
3912 } //end if
3913 } //end if
3914
3915 action = ActionsEditor::findAction(this, actionStr);
3916 if (!action) action = ActionsEditor::findAction(playlist, actionStr);
3917
3918 if (action) {
3919 qDebug("BaseGui::runActions: running action: '%s' (par: '%s')",
3920 actionStr.toUtf8().data(), par.toUtf8().data() );
3921
3922 if (action->isCheckable()) {
3923 if (par.isEmpty()) {
3924 //action->toggle();
3925 action->trigger();
3926 } else {
3927 action->setChecked( (par == "true") );
3928 } //end if
3929 } else {
3930 action->trigger();
3931 } //end if
3932 } else {
3933 qWarning("BaseGui::runActions: action: '%s' not found",actionStr.toUtf8().data());
3934 } //end if
3935 } //end for
3936}
3937
3938void BaseGui::checkPendingActionsToRun() {
3939 qDebug("BaseGui::checkPendingActionsToRun");
3940
3941 QString actions;
3942 if (!pending_actions_to_run.isEmpty()) {
3943 actions = pending_actions_to_run;
3944 pending_actions_to_run.clear();
3945 if (!pref->actions_to_run.isEmpty()) {
3946 actions = pref->actions_to_run +" "+ actions;
3947 }
3948 } else {
3949 actions = pref->actions_to_run;
3950 }
3951
3952 if (!actions.isEmpty()) {
3953 qDebug("BaseGui::checkPendingActionsToRun: actions: '%s'", actions.toUtf8().constData());
3954 runActions(actions);
3955 }
3956}
3957
3958#if REPORT_OLD_MPLAYER
3959void BaseGui::checkMplayerVersion() {
3960 qDebug("BaseGui::checkMplayerVersion");
3961
3962 // Qt 4.3.5 is crazy, I can't popup a messagebox here, it calls
3963 // this function once and again when the messagebox is shown
3964
3965 if ( (pref->mplayer_detected_version > 0) && (!MplayerVersion::isMplayerAtLeast(25158)) ) {
3966 QTimer::singleShot(1000, this, SLOT(displayWarningAboutOldMplayer()));
3967 }
3968}
3969
3970void BaseGui::displayWarningAboutOldMplayer() {
3971 qDebug("BaseGui::displayWarningAboutOldMplayer");
3972
3973 if (!pref->reported_mplayer_is_old) {
3974 QMessageBox::warning(this, tr("Warning - Using old MPlayer"),
3975 tr("The version of MPlayer (%1) installed on your system "
3976 "is obsolete. SMPlayer can't work well with it: some "
3977 "options won't work, subtitle selection may fail...")
3978 .arg(MplayerVersion::toString(pref->mplayer_detected_version)) +
3979 "<br><br>" +
3980 tr("Please, update your MPlayer.") +
3981 "<br><br>" +
3982 tr("(This warning won't be displayed anymore)") );
3983
3984 pref->reported_mplayer_is_old = true;
3985 }
3986 //else
3987 //statusBar()->showMessage( tr("Using an old MPlayer, please update it"), 10000 );
3988}
3989#endif
3990
3991void BaseGui::dragEnterEvent( QDragEnterEvent *e ) {
3992 qDebug("BaseGui::dragEnterEvent");
3993
3994 if (e->mimeData()->hasUrls()) {
3995 e->acceptProposedAction();
3996 }
3997}
3998
3999
4000
4001void BaseGui::dropEvent( QDropEvent *e ) {
4002 qDebug("BaseGui::dropEvent");
4003
4004 QStringList files;
4005
4006 if (e->mimeData()->hasUrls()) {
4007 QList <QUrl> l = e->mimeData()->urls();
4008 QString s;
4009 for (int n=0; n < l.count(); n++) {
4010 if (l[n].isValid()) {
4011 qDebug("BaseGui::dropEvent: scheme: '%s'", l[n].scheme().toUtf8().data());
4012 if (l[n].scheme() == "file")
4013 s = l[n].toLocalFile();
4014 else
4015 s = l[n].toString();
4016 /*
4017 qDebug(" * '%s'", l[n].toString().toUtf8().data());
4018 qDebug(" * '%s'", l[n].toLocalFile().toUtf8().data());
4019 */
4020 qDebug("BaseGui::dropEvent: file: '%s'", s.toUtf8().data());
4021 files.append(s);
4022 }
4023 }
4024 }
4025
4026
4027 qDebug( "BaseGui::dropEvent: count: %d", files.count());
4028 if (files.count() > 0) {
4029 if (files.count() == 1) {
4030 QFileInfo fi( files[0] );
4031
4032 Extensions e;
4033 QRegExp ext_sub(e.subtitles().forRegExp());
4034 ext_sub.setCaseSensitivity(Qt::CaseInsensitive);
4035 if (ext_sub.indexIn(fi.suffix()) > -1) {
4036 qDebug( "BaseGui::dropEvent: loading sub: '%s'", files[0].toUtf8().data());
4037 core->loadSub( files[0] );
4038 }
4039 else
4040 if (fi.isDir()) {
4041 openDirectory( files[0] );
4042 } else {
4043 //openFile( files[0] );
4044 if (pref->auto_add_to_playlist) {
4045 if (playlist->maybeSave()) {
4046 playlist->clear();
4047 playlist->addFile(files[0], Playlist::NoGetInfo);
4048
4049 open( files[0] );
4050 }
4051 } else {
4052 open( files[0] );
4053 }
4054 }
4055 } else {
4056 // More than one file
4057 qDebug("BaseGui::dropEvent: adding files to playlist");
4058 playlist->clear();
4059 playlist->addFiles(files);
4060 //openFile( files[0] );
4061 playlist->startPlay();
4062 }
4063 }
4064}
4065
4066void BaseGui::showPopupMenu() {
4067 showPopupMenu(QCursor::pos());
4068}
4069
4070void BaseGui::showPopupMenu( QPoint p ) {
4071 //qDebug("BaseGui::showPopupMenu: %d, %d", p.x(), p.y());
4072 popup->move( p );
4073 popup->show();
4074}
4075
4076/*
4077void BaseGui::mouseReleaseEvent( QMouseEvent * e ) {
4078 qDebug("BaseGui::mouseReleaseEvent");
4079
4080 if (e->button() == Qt::LeftButton) {
4081 e->accept();
4082 emit leftClicked();
4083 }
4084 else
4085 if (e->button() == Qt::MidButton) {
4086 e->accept();
4087 emit middleClicked();
4088 }
4089 //
4090 //else
4091 //if (e->button() == Qt::RightButton) {
4092 // showPopupMenu( e->globalPos() );
4093 //}
4094 //
4095 else
4096 e->ignore();
4097}
4098
4099void BaseGui::mouseDoubleClickEvent( QMouseEvent * e ) {
4100 e->accept();
4101 emit doubleClicked();
4102}
4103*/
4104
4105void BaseGui::wheelEvent( QWheelEvent * e ) {
4106 qDebug("BaseGui::wheelEvent: delta: %d", e->delta());
4107 e->accept();
4108
4109 if (e->orientation() == Qt::Vertical) {
4110 if (e->delta() >= 0)
4111 emit wheelUp();
4112 else
4113 emit wheelDown();
4114 } else {
4115 qDebug("BaseGui::wheelEvent: horizontal event received, doing nothing");
4116 }
4117}
4118
4119
4120// Called when a video has started to play
4121void BaseGui::enterFullscreenOnPlay() {
4122 qDebug("BaseGui::enterFullscreenOnPlay: arg_start_in_fullscreen: %d, pref->start_in_fullscreen: %d", arg_start_in_fullscreen, pref->start_in_fullscreen);
4123
4124 if (arg_start_in_fullscreen != 0) {
4125 if ( (arg_start_in_fullscreen == 1) || (pref->start_in_fullscreen) ) {
4126 if (!pref->fullscreen) toggleFullscreen(TRUE);
4127 }
4128 }
4129}
4130
4131// Called when the playlist has stopped
4132void BaseGui::exitFullscreenOnStop() {
4133 if (pref->fullscreen) {
4134 toggleFullscreen(FALSE);
4135 }
4136}
4137
4138void BaseGui::playlistHasFinished() {
4139 qDebug("BaseGui::playlistHasFinished");
4140 exitFullscreenOnStop();
4141
4142 qDebug("BaseGui::playlistHasFinished: arg_close_on_finish: %d, pref->close_on_finish: %d", arg_close_on_finish, pref->close_on_finish);
4143
4144 if (arg_close_on_finish != 0) {
4145 if ((arg_close_on_finish == 1) || (pref->close_on_finish)) exitAct->trigger();
4146 }
4147}
4148
4149void BaseGui::displayState(Core::State state) {
4150 qDebug("BaseGui::displayState: %s", core->stateToString().toUtf8().data());
4151 switch (state) {
4152 case Core::Playing: statusBar()->showMessage( tr("Playing %1").arg(core->mdat.filename), 2000); break;
4153 case Core::Paused: statusBar()->showMessage( tr("Pause") ); break;
4154 case Core::Stopped: statusBar()->showMessage( tr("Stop") , 2000); break;
4155 }
4156 if (state == Core::Stopped) setWindowCaption( "SMPlayer" );
4157
4158#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
4159 /* Disable screensaver by event */
4160 just_stopped = false;
4161
4162 if (state == Core::Stopped) {
4163 just_stopped = true;
4164 int time = 1000 * 60; // 1 minute
4165 QTimer::singleShot( time, this, SLOT(clear_just_stopped()) );
4166 }
4167#endif
4168}
4169
4170void BaseGui::displayMessage(QString message) {
4171 statusBar()->showMessage(message, 2000);
4172}
4173
4174void BaseGui::gotCurrentTime(double sec) {
4175 //qDebug( "DefaultGui::displayTime: %f", sec);
4176
4177 static int last_second = 0;
4178
4179 if (floor(sec)==last_second) return; // Update only once per second
4180 last_second = (int) floor(sec);
4181
4182 QString time = Helper::formatTime( (int) sec ) + " / " +
4183 Helper::formatTime( (int) core->mdat.duration );
4184
4185 //qDebug( " duration: %f, current_sec: %f", core->mdat.duration, core->mset.current_sec);
4186
4187 emit timeChanged( time );
4188}
4189
4190void BaseGui::resizeWindow(int w, int h) {
4191 qDebug("BaseGui::resizeWindow: %d, %d", w, h);
4192
4193 // If fullscreen, don't resize!
4194 if (pref->fullscreen) return;
4195
4196 if ( (pref->resize_method==Preferences::Never) && (panel->isVisible()) ) {
4197 return;
4198 }
4199
4200 if (!panel->isVisible()) {
4201 panel->show();
4202
4203 // Enable compact mode
4204 //compactAct->setEnabled(true);
4205 }
4206
4207 if (pref->size_factor != 100) {
4208 w = w * pref->size_factor / 100;
4209 h = h * pref->size_factor / 100;
4210 }
4211
4212 qDebug("BaseGui::resizeWindow: size to scale: %d, %d", w, h);
4213
4214 QSize video_size(w,h);
4215
4216 if (video_size == panel->size()) {
4217 qDebug("BaseGui::resizeWindow: the panel size is already the required size. Doing nothing.");
4218 return;
4219 }
4220
4221 int diff_width = this->width() - panel->width();
4222 int diff_height = this->height() - panel->height();
4223
4224 int new_width = w + diff_width;
4225 int new_height = h + diff_height;
4226
4227#if USE_MINIMUMSIZE
4228 int minimum_width = minimumSizeHint().width();
4229 if (pref->gui_minimum_width != 0) minimum_width = pref->gui_minimum_width;
4230 if (new_width < minimum_width) {
4231 qDebug("BaseGui::resizeWindow: width is too small, setting width to %d", minimum_width);
4232 new_width = minimum_width;
4233 }
4234#endif
4235
4236 resize(new_width, new_height);
4237
4238 qDebug("BaseGui::resizeWindow: done: window size: %d, %d", this->width(), this->height());
4239 qDebug("BaseGui::resizeWindow: done: panel->size: %d, %d",
4240 panel->size().width(),
4241 panel->size().height() );
4242 qDebug("BaseGui::resizeWindow: done: mplayerwindow->size: %d, %d",
4243 mplayerwindow->size().width(),
4244 mplayerwindow->size().height() );
4245}
4246
4247void BaseGui::hidePanel() {
4248 qDebug("BaseGui::hidePanel");
4249
4250#if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
4251 if (!pref->hide_video_window_on_audio_files) {
4252 mplayerwindow->showLogo(true);
4253 }
4254 else
4255#endif
4256
4257 if (panel->isVisible()) {
4258 // Exit from fullscreen mode
4259 if (pref->fullscreen) { toggleFullscreen(false); update(); }
4260
4261 // Exit from compact mode first
4262 if (pref->compact_mode) toggleCompactMode(false);
4263
4264 //resizeWindow( size().width(), 0 );
4265 int width = size().width();
4266 if (width > pref->default_size.width()) width = pref->default_size.width();
4267 resize( width, size().height() - panel->size().height() );
4268 panel->hide();
4269
4270 // Disable compact mode
4271 //compactAct->setEnabled(false);
4272 }
4273}
4274
4275void BaseGui::displayGotoTime(int t) {
4276#ifdef SEEKBAR_RESOLUTION
4277 int jump_time = (int)core->mdat.duration * t / SEEKBAR_RESOLUTION;
4278#else
4279 int jump_time = (int)core->mdat.duration * t / 100;
4280#endif
4281 QString s = tr("Jump to %1").arg( Helper::formatTime(jump_time) );
4282 statusBar()->showMessage( s, 1000 );
4283
4284 if (pref->fullscreen) {
4285 core->displayTextOnOSD( s );
4286 }
4287}
4288
4289void BaseGui::goToPosOnDragging(int t) {
4290 if (pref->update_while_seeking) {
4291#if ENABLE_DELAYED_DRAGGING
4292 #ifdef SEEKBAR_RESOLUTION
4293 core->goToPosition(t);
4294 #else
4295 core->goToPos(t);
4296 #endif
4297#else
4298 if ( ( t % 4 ) == 0 ) {
4299 qDebug("BaseGui::goToPosOnDragging: %d", t);
4300 #ifdef SEEKBAR_RESOLUTION
4301 core->goToPosition(t);
4302 #else
4303 core->goToPos(t);
4304 #endif
4305 }
4306#endif
4307 }
4308}
4309
4310void BaseGui::toggleCompactMode() {
4311 toggleCompactMode( !pref->compact_mode );
4312}
4313
4314void BaseGui::toggleCompactMode(bool b) {
4315 qDebug("BaseGui::toggleCompactMode: %d", b);
4316
4317 if (b)
4318 aboutToEnterCompactMode();
4319 else
4320 aboutToExitCompactMode();
4321
4322 pref->compact_mode = b;
4323 updateWidgets();
4324}
4325
4326void BaseGui::aboutToEnterCompactMode() {
4327 menuBar()->hide();
4328 statusBar()->hide();
4329}
4330
4331void BaseGui::aboutToExitCompactMode() {
4332 menuBar()->show();
4333 statusBar()->show();
4334}
4335
4336void BaseGui::setStayOnTop(bool b) {
4337 qDebug("BaseGui::setStayOnTop: %d", b);
4338
4339 if ( (b && (windowFlags() & Qt::WindowStaysOnTopHint)) ||
4340 (!b && (!(windowFlags() & Qt::WindowStaysOnTopHint))) )
4341 {
4342 // identical do nothing
4343 qDebug("BaseGui::setStayOnTop: nothing to do");
4344 return;
4345 }
4346
4347 ignore_show_hide_events = true;
4348
4349 bool visible = isVisible();
4350
4351 QPoint old_pos = pos();
4352
4353 if (b) {
4354 setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
4355 }
4356 else {
4357 setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint);
4358 }
4359
4360 move(old_pos);
4361
4362 if (visible) {
4363 show();
4364 }
4365
4366 ignore_show_hide_events = false;
4367}
4368
4369void BaseGui::changeStayOnTop(int stay_on_top) {
4370 switch (stay_on_top) {
4371 case Preferences::AlwaysOnTop : setStayOnTop(true); break;
4372 case Preferences::NeverOnTop : setStayOnTop(false); break;
4373 case Preferences::WhilePlayingOnTop : setStayOnTop((core->state() == Core::Playing)); break;
4374 }
4375
4376 pref->stay_on_top = (Preferences::OnTop) stay_on_top;
4377 updateWidgets();
4378}
4379
4380void BaseGui::checkStayOnTop(Core::State state) {
4381 qDebug("BaseGui::checkStayOnTop");
4382 if ((!pref->fullscreen) && (pref->stay_on_top == Preferences::WhilePlayingOnTop)) {
4383 setStayOnTop((state == Core::Playing));
4384 }
4385}
4386
4387void BaseGui::toggleStayOnTop() {
4388 if (pref->stay_on_top == Preferences::AlwaysOnTop)
4389 changeStayOnTop(Preferences::NeverOnTop);
4390 else
4391 if (pref->stay_on_top == Preferences::NeverOnTop)
4392 changeStayOnTop(Preferences::AlwaysOnTop);
4393}
4394
4395// Called when a new window (equalizer, preferences..) is opened.
4396void BaseGui::exitFullscreenIfNeeded() {
4397 /*
4398 if (pref->fullscreen) {
4399 toggleFullscreen(FALSE);
4400 }
4401 */
4402}
4403
4404void BaseGui::checkMousePos(QPoint p) {
4405 //qDebug("BaseGui::checkMousePos: %d, %d", p.x(), p.y());
4406
4407 bool compact = (pref->floating_display_in_compact_mode && pref->compact_mode);
4408
4409 if (!pref->fullscreen && !compact) return;
4410
4411 #define MARGIN 70
4412
4413 int margin = MARGIN + pref->floating_control_margin;
4414
4415 if (p.y() > mplayerwindow->height() - margin) {
4416 //qDebug("BaseGui::checkMousePos: %d, %d", p.x(), p.y());
4417 if (!near_bottom) {
4418 emit cursorNearBottom(p);
4419 near_bottom = true;
4420 }
4421 } else {
4422 if (near_bottom) {
4423 emit cursorFarEdges();
4424 near_bottom = false;
4425 }
4426 }
4427
4428 if (p.y() < margin) {
4429 //qDebug("BaseGui::checkMousePos: %d, %d", p.x(), p.y());
4430 if (!near_top) {
4431 emit cursorNearTop(p);
4432 near_top = true;
4433 }
4434 } else {
4435 if (near_top) {
4436 emit cursorFarEdges();
4437 near_top = false;
4438 }
4439 }
4440}
4441
4442#if ALLOW_CHANGE_STYLESHEET
4443void BaseGui::loadQss(QString filename) {
4444 QFile file( filename );
4445 file.open(QFile::ReadOnly);
4446 QString styleSheet = QLatin1String(file.readAll());
4447
4448 qApp->setStyleSheet(styleSheet);
4449}
4450
4451void BaseGui::changeStyleSheet(QString style) {
4452 if (style.isEmpty()) {
4453 qApp->setStyleSheet("");
4454 }
4455 else {
4456 QString qss_file = Paths::configPath() + "/themes/" + pref->iconset +"/style.qss";
4457 //qDebug("BaseGui::changeStyleSheet: '%s'", qss_file.toUtf8().data());
4458 if (!QFile::exists(qss_file)) {
4459 qss_file = Paths::themesPath() +"/"+ pref->iconset +"/style.qss";
4460 }
4461 if (QFile::exists(qss_file)) {
4462 qDebug("BaseGui::changeStyleSheet: '%s'", qss_file.toUtf8().data());
4463 loadQss(qss_file);
4464 } else {
4465 qApp->setStyleSheet("");
4466 }
4467 }
4468}
4469#endif
4470
4471void BaseGui::loadActions() {
4472 qDebug("BaseGui::loadActions");
4473 ActionsEditor::loadFromConfig(this, settings);
4474#if !DOCK_PLAYLIST
4475 ActionsEditor::loadFromConfig(playlist, settings);
4476#endif
4477
4478 actions_list = ActionsEditor::actionsNames(this);
4479#if !DOCK_PLAYLIST
4480 actions_list += ActionsEditor::actionsNames(playlist);
4481#endif
4482
4483 //if (server)
4484 server->setActionsList( actions_list );
4485}
4486
4487void BaseGui::saveActions() {
4488 qDebug("BaseGui::saveActions");
4489
4490 ActionsEditor::saveToConfig(this, settings);
4491#if !DOCK_PLAYLIST
4492 ActionsEditor::saveToConfig(playlist, settings);
4493#endif
4494}
4495
4496
4497void BaseGui::showEvent( QShowEvent * ) {
4498 qDebug("BaseGui::showEvent");
4499
4500 if (ignore_show_hide_events) return;
4501
4502 //qDebug("BaseGui::showEvent: pref->pause_when_hidden: %d", pref->pause_when_hidden);
4503 if ((pref->pause_when_hidden) && (core->state() == Core::Paused)) {
4504 qDebug("BaseGui::showEvent: unpausing");
4505 core->pause(); // Unpauses
4506 }
4507}
4508
4509void BaseGui::hideEvent( QHideEvent * ) {
4510 qDebug("BaseGui::hideEvent");
4511
4512 if (ignore_show_hide_events) return;
4513
4514 //qDebug("BaseGui::hideEvent: pref->pause_when_hidden: %d", pref->pause_when_hidden);
4515 if ((pref->pause_when_hidden) && (core->state() == Core::Playing)) {
4516 qDebug("BaseGui::hideEvent: pausing");
4517 core->pause();
4518 }
4519}
4520
4521void BaseGui::askForMplayerVersion(QString line) {
4522 qDebug("BaseGui::askForMplayerVersion: %s", line.toUtf8().data());
4523
4524 if (pref->mplayer_user_supplied_version <= 0) {
4525 InputMplayerVersion d(this);
4526 d.setVersion( pref->mplayer_user_supplied_version );
4527 d.setVersionFromOutput(line);
4528 if (d.exec() == QDialog::Accepted) {
4529 pref->mplayer_user_supplied_version = d.version();
4530 qDebug("BaseGui::askForMplayerVersion: user supplied version: %d", pref->mplayer_user_supplied_version);
4531 }
4532 } else {
4533 qDebug("BaseGui::askForMplayerVersion: already have a version supplied by user, so no asking");
4534 }
4535}
4536
4537void BaseGui::showExitCodeFromMplayer(int exit_code) {
4538 qDebug("BaseGui::showExitCodeFromMplayer: %d", exit_code);
4539
4540 if (!pref->report_mplayer_crashes) {
4541 qDebug("BaseGui::showExitCodeFromMplayer: not displaying error dialog");
4542 return;
4543 }
4544
4545 if (exit_code != 255 ) {
4546 ErrorDialog d(this);
4547 d.setText(tr("MPlayer has finished unexpectedly.") + " " +
4548 tr("Exit code: %1").arg(exit_code));
4549 d.setLog( mplayer_log );
4550 d.exec();
4551 }
4552}
4553
4554void BaseGui::showErrorFromMplayer(QProcess::ProcessError e) {
4555 qDebug("BaseGui::showErrorFromMplayer");
4556
4557 if (!pref->report_mplayer_crashes) {
4558 qDebug("showErrorFromMplayer: not displaying error dialog");
4559 return;
4560 }
4561
4562 if ((e == QProcess::FailedToStart) || (e == QProcess::Crashed)) {
4563 ErrorDialog d(this);
4564 if (e == QProcess::FailedToStart) {
4565 d.setText(tr("MPlayer failed to start.") + " " +
4566 tr("Please check the MPlayer path in preferences."));
4567 } else {
4568 d.setText(tr("MPlayer has crashed.") + " " +
4569 tr("See the log for more info."));
4570 }
4571 d.setLog( mplayer_log );
4572 d.exec();
4573 }
4574}
4575
4576
4577void BaseGui::showFindSubtitlesDialog() {
4578 qDebug("BaseGui::showFindSubtitlesDialog");
4579
4580 if (!find_subs_dialog) {
4581 find_subs_dialog = new FindSubtitlesWindow(this, Qt::Window | Qt::WindowMinMaxButtonsHint);
4582 find_subs_dialog->setSettings(Global::settings);
4583 find_subs_dialog->setWindowIcon(windowIcon());
4584#if DOWNLOAD_SUBS
4585 connect(find_subs_dialog, SIGNAL(subtitleDownloaded(const QString &)),
4586 core, SLOT(loadSub(const QString &)));
4587#endif
4588 }
4589
4590 find_subs_dialog->show();
4591 find_subs_dialog->setMovie(core->mdat.filename);
4592}
4593
4594void BaseGui::openUploadSubtitlesPage() {
4595 //QDesktopServices::openUrl( QUrl("http://ds6.ovh.org/hashsubtitles/upload.php") );
4596 //QDesktopServices::openUrl( QUrl("http://www.opensubtitles.com/upload") );
4597 QDesktopServices::openUrl( QUrl("http://www.opensubtitles.org/uploadjava") );
4598}
4599
4600void BaseGui::showVideoPreviewDialog() {
4601 qDebug("BaseGui::showVideoPreviewDialog");
4602
4603 if (video_preview == 0) {
4604 video_preview = new VideoPreview( pref->mplayer_bin, this );
4605 video_preview->setSettings(Global::settings);
4606 }
4607
4608 if (!core->mdat.filename.isEmpty()) {
4609 video_preview->setVideoFile(core->mdat.filename);
4610
4611 // DVD
4612 if (core->mdat.type==TYPE_DVD) {
4613 QString file = core->mdat.filename;
4614 DiscData disc_data = DiscName::split(file);
4615 QString dvd_folder = disc_data.device;
4616 if (dvd_folder.isEmpty()) dvd_folder = pref->dvd_device;
4617 int dvd_title = disc_data.title;
4618 file = disc_data.protocol + "://" + QString::number(dvd_title);
4619
4620 video_preview->setVideoFile(file);
4621 video_preview->setDVDDevice(dvd_folder);
4622 } else {
4623 video_preview->setDVDDevice("");
4624 }
4625 }
4626
4627 video_preview->setMplayerPath(pref->mplayer_bin);
4628
4629 if ( (video_preview->showConfigDialog(this)) && (video_preview->createThumbnails()) ) {
4630 video_preview->show();
4631 video_preview->adjustWindowSize();
4632 }
4633}
4634
4635// Language change stuff
4636void BaseGui::changeEvent(QEvent *e) {
4637 if (e->type() == QEvent::LanguageChange) {
4638 retranslateStrings();
4639 } else {
4640 QMainWindow::changeEvent(e);
4641 }
4642}
4643
4644#ifdef Q_OS_WIN
4645/* Disable screensaver by event */
4646bool BaseGui::winEvent ( MSG * m, long * result ) {
4647 //qDebug("BaseGui::winEvent");
4648 if (m->message==WM_SYSCOMMAND) {
4649 if ((m->wParam & 0xFFF0)==SC_SCREENSAVE || (m->wParam & 0xFFF0)==SC_MONITORPOWER) {
4650 qDebug("BaseGui::winEvent: received SC_SCREENSAVE or SC_MONITORPOWER");
4651 qDebug("BaseGui::winEvent: avoid_screensaver: %d", pref->avoid_screensaver);
4652 qDebug("BaseGui::winEvent: playing: %d", core->state()==Core::Playing);
4653 qDebug("BaseGui::winEvent: video: %d", !core->mdat.novideo);
4654
4655 if ((pref->avoid_screensaver) && (core->state()==Core::Playing) && (!core->mdat.novideo)) {
4656 qDebug("BaseGui::winEvent: not allowing screensaver");
4657 (*result) = 0;
4658 return true;
4659 } else {
4660 if ((pref->avoid_screensaver) && (just_stopped)) {
4661 qDebug("BaseGui::winEvent: file just stopped, so not allowing screensaver for a while");
4662 (*result) = 0;
4663 return true;
4664 } else {
4665 qDebug("BaseGui::winEvent: allowing screensaver");
4666 return false;
4667 }
4668 }
4669 }
4670 }
4671 return false;
4672}
4673#endif
4674
4675#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
4676void BaseGui::clear_just_stopped() {
4677 qDebug("BaseGui::clear_just_stopped");
4678 just_stopped = false;
4679}
4680#endif
4681
4682#include "moc_basegui.cpp"
Note: See TracBrowser for help on using the repository browser.