1 | /* smplayer, GUI front-end for mplayer.
|
---|
2 | Copyright (C) 2006-2016 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
3 |
|
---|
4 | This program is free software; you can redistribute it and/or modify
|
---|
5 | it under the terms of the GNU General Public License as published by
|
---|
6 | the Free Software Foundation; either version 2 of the License, or
|
---|
7 | (at your option) any later version.
|
---|
8 |
|
---|
9 | This program is distributed in the hope that it will be useful,
|
---|
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
12 | GNU General Public License for more details.
|
---|
13 |
|
---|
14 | You should have received a copy of the GNU General Public License
|
---|
15 | along with this program; if not, write to the Free Software
|
---|
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
17 | */
|
---|
18 |
|
---|
19 | #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 | #include <QClipboard>
|
---|
41 | #include <QMimeData>
|
---|
42 | #include <QDesktopWidget>
|
---|
43 |
|
---|
44 | #include <cmath>
|
---|
45 |
|
---|
46 | #include "mplayerwindow.h"
|
---|
47 | #include "desktopinfo.h"
|
---|
48 | #include "helper.h"
|
---|
49 | #include "paths.h"
|
---|
50 | #include "colorutils.h"
|
---|
51 | #include "global.h"
|
---|
52 | #include "translator.h"
|
---|
53 | #include "images.h"
|
---|
54 | #include "preferences.h"
|
---|
55 | #include "discname.h"
|
---|
56 | #include "timeslider.h"
|
---|
57 | #include "logwindow.h"
|
---|
58 | #include "playlist.h"
|
---|
59 | #include "filepropertiesdialog.h"
|
---|
60 | #include "eqslider.h"
|
---|
61 | #include "videoequalizer.h"
|
---|
62 | #include "audioequalizer.h"
|
---|
63 | #include "inputdvddirectory.h"
|
---|
64 | #include "inputmplayerversion.h"
|
---|
65 | #include "inputurl.h"
|
---|
66 | #include "recents.h"
|
---|
67 | #include "urlhistory.h"
|
---|
68 | #include "about.h"
|
---|
69 | #include "errordialog.h"
|
---|
70 | #include "timedialog.h"
|
---|
71 | #include "stereo3ddialog.h"
|
---|
72 |
|
---|
73 | #ifdef BOOKMARKS
|
---|
74 | #include "inputbookmark.h"
|
---|
75 | #include "bookmarkdialog.h"
|
---|
76 | #endif
|
---|
77 |
|
---|
78 | #include "clhelp.h"
|
---|
79 | #include "mplayerversion.h"
|
---|
80 |
|
---|
81 | #ifdef FIND_SUBTITLES
|
---|
82 | #include "findsubtitleswindow.h"
|
---|
83 | #endif
|
---|
84 |
|
---|
85 | #ifdef VIDEOPREVIEW
|
---|
86 | #include "videopreview.h"
|
---|
87 | #endif
|
---|
88 |
|
---|
89 | #include "config.h"
|
---|
90 | #include "actionseditor.h"
|
---|
91 |
|
---|
92 | #include "tvlist.h"
|
---|
93 |
|
---|
94 | #include "preferencesdialog.h"
|
---|
95 | #ifndef NO_USE_INI_FILES
|
---|
96 | #include "prefgeneral.h"
|
---|
97 | #endif
|
---|
98 | #include "prefinterface.h"
|
---|
99 | #include "prefinput.h"
|
---|
100 | #include "prefadvanced.h"
|
---|
101 | #include "prefplaylist.h"
|
---|
102 |
|
---|
103 | #include "myaction.h"
|
---|
104 | #include "myactiongroup.h"
|
---|
105 | #include "playlist.h"
|
---|
106 |
|
---|
107 | #include "constants.h"
|
---|
108 | #include "links.h"
|
---|
109 |
|
---|
110 | #ifdef MPRIS2
|
---|
111 | #include "mpris2/mpris2.h"
|
---|
112 | #endif
|
---|
113 |
|
---|
114 | #include "extensions.h"
|
---|
115 | #include "version.h"
|
---|
116 |
|
---|
117 | #ifdef Q_OS_WIN
|
---|
118 | #include "deviceinfo.h"
|
---|
119 | #include <QSysInfo>
|
---|
120 | #endif
|
---|
121 |
|
---|
122 | #ifdef UPDATE_CHECKER
|
---|
123 | #include "updatechecker.h"
|
---|
124 | #endif
|
---|
125 |
|
---|
126 | #ifdef YOUTUBE_SUPPORT
|
---|
127 | #ifdef YT_USE_YTSIG
|
---|
128 | #include "codedownloader.h"
|
---|
129 | #endif
|
---|
130 | #endif
|
---|
131 |
|
---|
132 | #ifdef SHARE_ACTIONS
|
---|
133 | #include "sharedialog.h"
|
---|
134 | #endif
|
---|
135 |
|
---|
136 | #ifdef SHARE_WIDGET
|
---|
137 | #include "sharewidget.h"
|
---|
138 | #endif
|
---|
139 |
|
---|
140 | #ifdef AUTO_SHUTDOWN_PC
|
---|
141 | #include "shutdowndialog.h"
|
---|
142 | #include "shutdown.h"
|
---|
143 | #endif
|
---|
144 |
|
---|
145 | using namespace Global;
|
---|
146 |
|
---|
147 | BaseGui::BaseGui( QWidget* parent, Qt::WindowFlags flags )
|
---|
148 | : QMainWindow( parent, flags )
|
---|
149 | #if QT_VERSION >= 0x050000
|
---|
150 | , was_minimized(false)
|
---|
151 | #endif
|
---|
152 | #ifdef UPDATE_CHECKER
|
---|
153 | , update_checker(0)
|
---|
154 | #endif
|
---|
155 | #ifdef MG_DELAYED_SEEK
|
---|
156 | , delayed_seek_timer(0)
|
---|
157 | , delayed_seek_value(0)
|
---|
158 | #endif
|
---|
159 | {
|
---|
160 | #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
---|
161 | #ifdef AVOID_SCREENSAVER
|
---|
162 | /* Disable screensaver by event */
|
---|
163 | just_stopped = false;
|
---|
164 | #endif
|
---|
165 | #endif
|
---|
166 | ignore_show_hide_events = false;
|
---|
167 |
|
---|
168 | arg_close_on_finish = -1;
|
---|
169 | arg_start_in_fullscreen = -1;
|
---|
170 |
|
---|
171 | setWindowTitle( "SMPlayer" );
|
---|
172 |
|
---|
173 | // Not created objects
|
---|
174 | popup = 0;
|
---|
175 | pref_dialog = 0;
|
---|
176 | file_dialog = 0;
|
---|
177 | clhelp_window = 0;
|
---|
178 | #ifdef FIND_SUBTITLES
|
---|
179 | find_subs_dialog = 0;
|
---|
180 | #endif
|
---|
181 | #ifdef VIDEOPREVIEW
|
---|
182 | video_preview = 0;
|
---|
183 | #endif
|
---|
184 |
|
---|
185 | // Create objects:
|
---|
186 | createPanel();
|
---|
187 | setCentralWidget(panel);
|
---|
188 |
|
---|
189 | createMplayerWindow();
|
---|
190 | createCore();
|
---|
191 | createPlaylist();
|
---|
192 | createVideoEqualizer();
|
---|
193 | createAudioEqualizer();
|
---|
194 |
|
---|
195 | // Mouse Wheel
|
---|
196 | /*
|
---|
197 | connect( this, SIGNAL(wheelUp()),
|
---|
198 | core, SLOT(wheelUp()) );
|
---|
199 | connect( this, SIGNAL(wheelDown()),
|
---|
200 | core, SLOT(wheelDown()) );
|
---|
201 | */
|
---|
202 | connect( mplayerwindow, SIGNAL(wheelUp()),
|
---|
203 | core, SLOT(wheelUp()) );
|
---|
204 | connect( mplayerwindow, SIGNAL(wheelDown()),
|
---|
205 | core, SLOT(wheelDown()) );
|
---|
206 |
|
---|
207 | #if STYLE_SWITCHING
|
---|
208 | qApp->setStyleSheet("");
|
---|
209 | default_style = qApp->style()->objectName();
|
---|
210 | #ifdef Q_OS_LINUX
|
---|
211 | // Some controls aren't displayed correctly with the adwaita style
|
---|
212 | // so try to prevent to use it as the default style
|
---|
213 | if (default_style.toLower() == "adwaita") default_style = "gtk+";
|
---|
214 | #endif
|
---|
215 | qDebug() << "BaseGui::BaseGui: default_style:" << default_style;
|
---|
216 | //qDebug() << "BaseGui::BaseGui: qApp->style:" << qApp->style();
|
---|
217 | #endif
|
---|
218 |
|
---|
219 | #ifdef LOG_MPLAYER
|
---|
220 | mplayer_log_window = new LogWindow(0);
|
---|
221 | #endif
|
---|
222 | #ifdef LOG_SMPLAYER
|
---|
223 | smplayer_log_window = new LogWindow(0);
|
---|
224 | #endif
|
---|
225 |
|
---|
226 | createActions();
|
---|
227 | createMenus();
|
---|
228 | #if AUTODISABLE_ACTIONS
|
---|
229 | setActionsEnabled(false);
|
---|
230 | if (playlist->count() > 0) {
|
---|
231 | playAct->setEnabled(true);
|
---|
232 | playOrPauseAct->setEnabled(true);
|
---|
233 | }
|
---|
234 | #endif
|
---|
235 |
|
---|
236 | #if !DOCK_PLAYLIST
|
---|
237 | connect(playlist, SIGNAL(visibilityChanged(bool)),
|
---|
238 | showPlaylistAct, SLOT(setChecked(bool)) );
|
---|
239 | #endif
|
---|
240 |
|
---|
241 | retranslateStrings();
|
---|
242 |
|
---|
243 | setAcceptDrops(true);
|
---|
244 |
|
---|
245 | resize(pref->default_size);
|
---|
246 |
|
---|
247 | panel->setFocus();
|
---|
248 |
|
---|
249 | setupNetworkProxy();
|
---|
250 | initializeGui();
|
---|
251 |
|
---|
252 | #ifdef UPDATE_CHECKER
|
---|
253 | update_checker = new UpdateChecker(this, &pref->update_checker_data);
|
---|
254 | #endif
|
---|
255 |
|
---|
256 | #ifdef CHECK_UPGRADED
|
---|
257 | QTimer::singleShot(2000, this, SLOT(checkIfUpgraded()));
|
---|
258 | #endif
|
---|
259 |
|
---|
260 | #if defined(SHARE_ACTIONS) && !defined(SHARE_WIDGET)
|
---|
261 | QTimer::singleShot(1000, this, SLOT(checkReminder()));
|
---|
262 | #endif
|
---|
263 |
|
---|
264 | #ifdef MPRIS2
|
---|
265 | if (pref->use_mpris2) new Mpris2(this, this);
|
---|
266 | #endif
|
---|
267 | }
|
---|
268 |
|
---|
269 | void BaseGui::initializeGui() {
|
---|
270 | if (pref->compact_mode) toggleCompactMode(true);
|
---|
271 | changeStayOnTop(pref->stay_on_top);
|
---|
272 |
|
---|
273 | updateRecents();
|
---|
274 |
|
---|
275 | // Call loadActions() outside initialization of the class.
|
---|
276 | // Otherwise DefaultGui (and other subclasses) doesn't exist, and
|
---|
277 | // its actions are not loaded
|
---|
278 | QTimer::singleShot(20, this, SLOT(loadActions()));
|
---|
279 |
|
---|
280 | // Single instance
|
---|
281 | /* Deleted */
|
---|
282 | }
|
---|
283 |
|
---|
284 | void BaseGui::setupNetworkProxy() {
|
---|
285 | qDebug("BaseGui::setupNetworkProxy");
|
---|
286 |
|
---|
287 | QNetworkProxy proxy;
|
---|
288 |
|
---|
289 | if ( (pref->use_proxy) && (!pref->proxy_host.isEmpty()) ) {
|
---|
290 | proxy.setType((QNetworkProxy::ProxyType) pref->proxy_type);
|
---|
291 | proxy.setHostName(pref->proxy_host);
|
---|
292 | proxy.setPort(pref->proxy_port);
|
---|
293 | if ( (!pref->proxy_username.isEmpty()) && (!pref->proxy_password.isEmpty()) ) {
|
---|
294 | proxy.setUser(pref->proxy_username);
|
---|
295 | proxy.setPassword(pref->proxy_password);
|
---|
296 | }
|
---|
297 | qDebug("BaseGui::setupNetworkProxy: using proxy: host: %s, port: %d, type: %d",
|
---|
298 | pref->proxy_host.toUtf8().constData(), pref->proxy_port, pref->proxy_type);
|
---|
299 | } else {
|
---|
300 | // No proxy
|
---|
301 | proxy.setType(QNetworkProxy::NoProxy);
|
---|
302 | qDebug("BaseGui::setupNetworkProxy: no proxy");
|
---|
303 | }
|
---|
304 |
|
---|
305 | QNetworkProxy::setApplicationProxy(proxy);
|
---|
306 | }
|
---|
307 |
|
---|
308 | #ifdef SINGLE_INSTANCE
|
---|
309 | void BaseGui::handleMessageFromOtherInstances(const QString& message) {
|
---|
310 | qDebug("BaseGui::handleMessageFromOtherInstances: '%s'", message.toUtf8().constData());
|
---|
311 |
|
---|
312 | int pos = message.indexOf(' ');
|
---|
313 | if (pos > -1) {
|
---|
314 | QString command = message.left(pos);
|
---|
315 | QString arg = message.mid(pos+1);
|
---|
316 | qDebug("command: '%s'", command.toUtf8().constData());
|
---|
317 | qDebug("arg: '%s'", arg.toUtf8().constData());
|
---|
318 |
|
---|
319 | if (command == "open_file") {
|
---|
320 | emit openFileRequested();
|
---|
321 | open(arg);
|
---|
322 | }
|
---|
323 | else
|
---|
324 | if (command == "open_files") {
|
---|
325 | QStringList file_list = arg.split(" <<sep>> ");
|
---|
326 | emit openFileRequested();
|
---|
327 | openFiles(file_list);
|
---|
328 | }
|
---|
329 | else
|
---|
330 | if (command == "add_to_playlist") {
|
---|
331 | QStringList file_list = arg.split(" <<sep>> ");
|
---|
332 | /* if (core->state() == Core::Stopped) { emit openFileRequested(); } */
|
---|
333 | playlist->addFiles(file_list);
|
---|
334 | }
|
---|
335 | else
|
---|
336 | if (command == "media_title") {
|
---|
337 | QStringList list = arg.split(" <<sep>> ");
|
---|
338 | core->addForcedTitle(list[0], list[1]);
|
---|
339 | }
|
---|
340 | else
|
---|
341 | if (command == "action") {
|
---|
342 | processFunction(arg);
|
---|
343 | }
|
---|
344 | else
|
---|
345 | if (command == "load_sub") {
|
---|
346 | setInitialSubtitle(arg);
|
---|
347 | if (core->state() != Core::Stopped) {
|
---|
348 | core->loadSub(arg);
|
---|
349 | }
|
---|
350 | }
|
---|
351 | }
|
---|
352 | }
|
---|
353 | #endif
|
---|
354 |
|
---|
355 | BaseGui::~BaseGui() {
|
---|
356 | delete core; // delete before mplayerwindow, otherwise, segfault...
|
---|
357 | #ifdef LOG_MPLAYER
|
---|
358 | delete mplayer_log_window;
|
---|
359 | #endif
|
---|
360 | #ifdef LOG_SMPLAYER
|
---|
361 | delete smplayer_log_window;
|
---|
362 | #endif
|
---|
363 |
|
---|
364 | delete favorites;
|
---|
365 | delete tvlist;
|
---|
366 | delete radiolist;
|
---|
367 |
|
---|
368 | //#if !DOCK_PLAYLIST
|
---|
369 | if (playlist) {
|
---|
370 | delete playlist;
|
---|
371 | playlist = 0;
|
---|
372 | }
|
---|
373 | //#endif
|
---|
374 |
|
---|
375 | #ifdef FIND_SUBTITLES
|
---|
376 | if (find_subs_dialog) {
|
---|
377 | delete find_subs_dialog;
|
---|
378 | find_subs_dialog = 0; // Necessary?
|
---|
379 | }
|
---|
380 | #endif
|
---|
381 |
|
---|
382 | #ifdef VIDEOPREVIEW
|
---|
383 | if (video_preview) {
|
---|
384 | delete video_preview;
|
---|
385 | }
|
---|
386 | #endif
|
---|
387 | }
|
---|
388 |
|
---|
389 | void BaseGui::createActions() {
|
---|
390 | // Menu File
|
---|
391 | openFileAct = new MyAction( QKeySequence("Ctrl+F"), this, "open_file" );
|
---|
392 | connect( openFileAct, SIGNAL(triggered()),
|
---|
393 | this, SLOT(openFile()) );
|
---|
394 |
|
---|
395 | openDirectoryAct = new MyAction( this, "open_directory" );
|
---|
396 | connect( openDirectoryAct, SIGNAL(triggered()),
|
---|
397 | this, SLOT(openDirectory()) );
|
---|
398 |
|
---|
399 | openPlaylistAct = new MyAction( this, "open_playlist" );
|
---|
400 | connect( openPlaylistAct, SIGNAL(triggered()),
|
---|
401 | playlist, SLOT(load()) );
|
---|
402 |
|
---|
403 | openVCDAct = new MyAction( this, "open_vcd" );
|
---|
404 | connect( openVCDAct, SIGNAL(triggered()),
|
---|
405 | this, SLOT(openVCD()) );
|
---|
406 |
|
---|
407 | openAudioCDAct = new MyAction( this, "open_audio_cd" );
|
---|
408 | connect( openAudioCDAct, SIGNAL(triggered()),
|
---|
409 | this, SLOT(openAudioCD()) );
|
---|
410 |
|
---|
411 | openDVDAct = new MyAction( this, "open_dvd" );
|
---|
412 | connect( openDVDAct, SIGNAL(triggered()),
|
---|
413 | this, SLOT(openDVD()) );
|
---|
414 |
|
---|
415 | openDVDFolderAct = new MyAction( this, "open_dvd_folder" );
|
---|
416 | connect( openDVDFolderAct, SIGNAL(triggered()),
|
---|
417 | this, SLOT(openDVDFromFolder()) );
|
---|
418 |
|
---|
419 | // Bluray section.
|
---|
420 | #ifdef BLURAY_SUPPORT
|
---|
421 | openBluRayAct = new MyAction( this, "open_bluray" );
|
---|
422 | connect( openBluRayAct, SIGNAL(triggered()),
|
---|
423 | this, SLOT(openBluRay()));
|
---|
424 |
|
---|
425 | openBluRayFolderAct = new MyAction( this, "open_bluray_folder" );
|
---|
426 | connect( openBluRayFolderAct, SIGNAL(triggered()),
|
---|
427 | this, SLOT(openBluRayFromFolder()));
|
---|
428 | #endif
|
---|
429 |
|
---|
430 | openURLAct = new MyAction( QKeySequence("Ctrl+U"), this, "open_url" );
|
---|
431 | connect( openURLAct, SIGNAL(triggered()),
|
---|
432 | this, SLOT(openURL()) );
|
---|
433 |
|
---|
434 | exitAct = new MyAction( QKeySequence("Ctrl+X"), this, "close" );
|
---|
435 | connect( exitAct, SIGNAL(triggered()), this, SLOT(closeWindow()) );
|
---|
436 |
|
---|
437 | clearRecentsAct = new MyAction( this, "clear_recents" );
|
---|
438 | connect( clearRecentsAct, SIGNAL(triggered()), this, SLOT(clearRecentsList()) );
|
---|
439 |
|
---|
440 | // Favorites
|
---|
441 | favorites = new Favorites(Paths::configPath() + "/favorites.m3u8", this);
|
---|
442 | favorites->menuAction()->setObjectName( "favorites_menu" );
|
---|
443 | addAction(favorites->editAct());
|
---|
444 | addAction(favorites->jumpAct());
|
---|
445 | addAction(favorites->nextAct());
|
---|
446 | addAction(favorites->previousAct());
|
---|
447 | connect(favorites, SIGNAL(activated(QString)), this, SLOT(openFavorite(QString)));
|
---|
448 | connect(core, SIGNAL(mediaPlaying(const QString &, const QString &)),
|
---|
449 | favorites, SLOT(getCurrentMedia(const QString &, const QString &)));
|
---|
450 |
|
---|
451 | // TV and Radio
|
---|
452 | tvlist = new TVList(pref->check_channels_conf_on_startup,
|
---|
453 | TVList::TV, Paths::configPath() + "/tv.m3u8", this);
|
---|
454 | tvlist->menuAction()->setObjectName( "tv_menu" );
|
---|
455 | addAction(tvlist->editAct());
|
---|
456 | addAction(tvlist->jumpAct());
|
---|
457 | addAction(tvlist->nextAct());
|
---|
458 | addAction(tvlist->previousAct());
|
---|
459 | tvlist->nextAct()->setShortcut( Qt::Key_H );
|
---|
460 | tvlist->previousAct()->setShortcut( Qt::Key_L );
|
---|
461 | tvlist->nextAct()->setObjectName("next_tv");
|
---|
462 | tvlist->previousAct()->setObjectName("previous_tv");
|
---|
463 | tvlist->editAct()->setObjectName("edit_tv_list");
|
---|
464 | tvlist->jumpAct()->setObjectName("jump_tv_list");
|
---|
465 | connect(tvlist, SIGNAL(activated(QString)), this, SLOT(open(QString)));
|
---|
466 | connect(core, SIGNAL(mediaPlaying(const QString &, const QString &)),
|
---|
467 | tvlist, SLOT(getCurrentMedia(const QString &, const QString &)));
|
---|
468 |
|
---|
469 | radiolist = new TVList(pref->check_channels_conf_on_startup,
|
---|
470 | TVList::Radio, Paths::configPath() + "/radio.m3u8", this);
|
---|
471 | radiolist->menuAction()->setObjectName( "radio_menu" );
|
---|
472 | addAction(radiolist->editAct());
|
---|
473 | addAction(radiolist->jumpAct());
|
---|
474 | addAction(radiolist->nextAct());
|
---|
475 | addAction(radiolist->previousAct());
|
---|
476 | radiolist->nextAct()->setShortcut( Qt::SHIFT | Qt::Key_H );
|
---|
477 | radiolist->previousAct()->setShortcut( Qt::SHIFT | Qt::Key_L );
|
---|
478 | radiolist->nextAct()->setObjectName("next_radio");
|
---|
479 | radiolist->previousAct()->setObjectName("previous_radio");
|
---|
480 | radiolist->editAct()->setObjectName("edit_radio_list");
|
---|
481 | radiolist->jumpAct()->setObjectName("jump_radio_list");
|
---|
482 | connect(radiolist, SIGNAL(activated(QString)), this, SLOT(open(QString)));
|
---|
483 | connect(core, SIGNAL(mediaPlaying(const QString &, const QString &)),
|
---|
484 | radiolist, SLOT(getCurrentMedia(const QString &, const QString &)));
|
---|
485 |
|
---|
486 |
|
---|
487 | // Menu Play
|
---|
488 | playAct = new MyAction( this, "play" );
|
---|
489 | connect( playAct, SIGNAL(triggered()),
|
---|
490 | core, SLOT(play()) );
|
---|
491 |
|
---|
492 | playOrPauseAct = new MyAction( Qt::Key_MediaPlay, this, "play_or_pause" );
|
---|
493 | playOrPauseAct->addShortcut(QKeySequence("Toggle Media Play/Pause")); // MCE remote key
|
---|
494 | connect( playOrPauseAct, SIGNAL(triggered()),
|
---|
495 | core, SLOT(play_or_pause()) );
|
---|
496 |
|
---|
497 | pauseAct = new MyAction( Qt::Key_Space, this, "pause" );
|
---|
498 | pauseAct->addShortcut(QKeySequence("Media Pause")); // MCE remote key
|
---|
499 | connect( pauseAct, SIGNAL(triggered()),
|
---|
500 | core, SLOT(pause()) );
|
---|
501 |
|
---|
502 | pauseAndStepAct = new MyAction( this, "pause_and_frame_step" );
|
---|
503 | connect( pauseAndStepAct, SIGNAL(triggered()),
|
---|
504 | core, SLOT(pause_and_frame_step()) );
|
---|
505 |
|
---|
506 | stopAct = new MyAction( Qt::Key_MediaStop, this, "stop" );
|
---|
507 | connect( stopAct, SIGNAL(triggered()),
|
---|
508 | core, SLOT(stop()) );
|
---|
509 |
|
---|
510 | frameStepAct = new MyAction( Qt::Key_Period, this, "frame_step" );
|
---|
511 | connect( frameStepAct, SIGNAL(triggered()),
|
---|
512 | core, SLOT(frameStep()) );
|
---|
513 |
|
---|
514 | frameBackStepAct = new MyAction( Qt::Key_Comma, this, "frame_back_step" );
|
---|
515 | connect( frameBackStepAct, SIGNAL(triggered()),
|
---|
516 | core, SLOT(frameBackStep()) );
|
---|
517 |
|
---|
518 | rewind1Act = new MyAction( Qt::Key_Left, this, "rewind1" );
|
---|
519 | rewind1Act->addShortcut(QKeySequence("Shift+Ctrl+B")); // MCE remote key
|
---|
520 | connect( rewind1Act, SIGNAL(triggered()),
|
---|
521 | core, SLOT(srewind()) );
|
---|
522 |
|
---|
523 | rewind2Act = new MyAction( Qt::Key_Down, this, "rewind2" );
|
---|
524 | connect( rewind2Act, SIGNAL(triggered()),
|
---|
525 | core, SLOT(rewind()) );
|
---|
526 |
|
---|
527 | rewind3Act = new MyAction( Qt::Key_PageDown, this, "rewind3" );
|
---|
528 | connect( rewind3Act, SIGNAL(triggered()),
|
---|
529 | core, SLOT(fastrewind()) );
|
---|
530 |
|
---|
531 | forward1Act = new MyAction( Qt::Key_Right, this, "forward1" );
|
---|
532 | forward1Act->addShortcut(QKeySequence("Shift+Ctrl+F")); // MCE remote key
|
---|
533 | connect( forward1Act, SIGNAL(triggered()),
|
---|
534 | core, SLOT(sforward()) );
|
---|
535 |
|
---|
536 | forward2Act = new MyAction( Qt::Key_Up, this, "forward2" );
|
---|
537 | connect( forward2Act, SIGNAL(triggered()),
|
---|
538 | core, SLOT(forward()) );
|
---|
539 |
|
---|
540 | forward3Act = new MyAction( Qt::Key_PageUp, this, "forward3" );
|
---|
541 | connect( forward3Act, SIGNAL(triggered()),
|
---|
542 | core, SLOT(fastforward()) );
|
---|
543 |
|
---|
544 | setAMarkerAct = new MyAction( this, "set_a_marker" );
|
---|
545 | connect( setAMarkerAct, SIGNAL(triggered()),
|
---|
546 | core, SLOT(setAMarker()) );
|
---|
547 |
|
---|
548 | setBMarkerAct = new MyAction( this, "set_b_marker" );
|
---|
549 | connect( setBMarkerAct, SIGNAL(triggered()),
|
---|
550 | core, SLOT(setBMarker()) );
|
---|
551 |
|
---|
552 | clearABMarkersAct = new MyAction( this, "clear_ab_markers" );
|
---|
553 | connect( clearABMarkersAct, SIGNAL(triggered()),
|
---|
554 | core, SLOT(clearABMarkers()) );
|
---|
555 |
|
---|
556 | repeatAct = new MyAction( this, "repeat" );
|
---|
557 | repeatAct->setCheckable( true );
|
---|
558 | connect( repeatAct, SIGNAL(toggled(bool)),
|
---|
559 | core, SLOT(toggleRepeat(bool)) );
|
---|
560 |
|
---|
561 | gotoAct = new MyAction( QKeySequence("Ctrl+J"), this, "jump_to" );
|
---|
562 | connect( gotoAct, SIGNAL(triggered()),
|
---|
563 | this, SLOT(showGotoDialog()) );
|
---|
564 |
|
---|
565 | // Submenu Speed
|
---|
566 | normalSpeedAct = new MyAction( Qt::Key_Backspace, this, "normal_speed" );
|
---|
567 | connect( normalSpeedAct, SIGNAL(triggered()),
|
---|
568 | core, SLOT(normalSpeed()) );
|
---|
569 |
|
---|
570 | halveSpeedAct = new MyAction( Qt::Key_BraceLeft, this, "halve_speed" );
|
---|
571 | connect( halveSpeedAct, SIGNAL(triggered()),
|
---|
572 | core, SLOT(halveSpeed()) );
|
---|
573 |
|
---|
574 | doubleSpeedAct = new MyAction( Qt::Key_BraceRight, this, "double_speed" );
|
---|
575 | connect( doubleSpeedAct, SIGNAL(triggered()),
|
---|
576 | core, SLOT(doubleSpeed()) );
|
---|
577 |
|
---|
578 | decSpeed10Act = new MyAction( Qt::Key_BracketLeft, this, "dec_speed" );
|
---|
579 | connect( decSpeed10Act, SIGNAL(triggered()),
|
---|
580 | core, SLOT(decSpeed10()) );
|
---|
581 |
|
---|
582 | incSpeed10Act = new MyAction( Qt::Key_BracketRight, this, "inc_speed" );
|
---|
583 | connect( incSpeed10Act, SIGNAL(triggered()),
|
---|
584 | core, SLOT(incSpeed10()) );
|
---|
585 |
|
---|
586 | decSpeed4Act = new MyAction( this, "dec_speed_4" );
|
---|
587 | connect( decSpeed4Act, SIGNAL(triggered()),
|
---|
588 | core, SLOT(decSpeed4()) );
|
---|
589 |
|
---|
590 | incSpeed4Act = new MyAction( this, "inc_speed_4" );
|
---|
591 | connect( incSpeed4Act, SIGNAL(triggered()),
|
---|
592 | core, SLOT(incSpeed4()) );
|
---|
593 |
|
---|
594 | decSpeed1Act = new MyAction( this, "dec_speed_1" );
|
---|
595 | connect( decSpeed1Act, SIGNAL(triggered()),
|
---|
596 | core, SLOT(decSpeed1()) );
|
---|
597 |
|
---|
598 | incSpeed1Act = new MyAction( this, "inc_speed_1" );
|
---|
599 | connect( incSpeed1Act, SIGNAL(triggered()),
|
---|
600 | core, SLOT(incSpeed1()) );
|
---|
601 |
|
---|
602 |
|
---|
603 | // Menu Video
|
---|
604 | fullscreenAct = new MyAction( Qt::Key_F, this, "fullscreen" );
|
---|
605 | fullscreenAct->addShortcut(QKeySequence("Ctrl+T")); // MCE remote key
|
---|
606 | fullscreenAct->setCheckable( true );
|
---|
607 | connect( fullscreenAct, SIGNAL(toggled(bool)),
|
---|
608 | this, SLOT(toggleFullscreen(bool)) );
|
---|
609 |
|
---|
610 | compactAct = new MyAction( QKeySequence("Ctrl+C"), this, "compact" );
|
---|
611 | compactAct->setCheckable( true );
|
---|
612 | connect( compactAct, SIGNAL(toggled(bool)),
|
---|
613 | this, SLOT(toggleCompactMode(bool)) );
|
---|
614 |
|
---|
615 | videoEqualizerAct = new MyAction( QKeySequence("Ctrl+E"), this, "video_equalizer" );
|
---|
616 | videoEqualizerAct->setCheckable( true );
|
---|
617 | connect( videoEqualizerAct, SIGNAL(toggled(bool)),
|
---|
618 | this, SLOT(showVideoEqualizer(bool)) );
|
---|
619 |
|
---|
620 | // Single screenshot
|
---|
621 | screenshotAct = new MyAction( Qt::Key_S, this, "screenshot" );
|
---|
622 | connect( screenshotAct, SIGNAL(triggered()),
|
---|
623 | core, SLOT(screenshot()) );
|
---|
624 |
|
---|
625 | // Multiple screenshots
|
---|
626 | screenshotsAct = new MyAction( QKeySequence("Shift+D"), this, "multiple_screenshots" );
|
---|
627 | connect( screenshotsAct, SIGNAL(triggered()),
|
---|
628 | core, SLOT(screenshots()) );
|
---|
629 |
|
---|
630 | #ifdef CAPTURE_STREAM
|
---|
631 | capturingAct = new MyAction( /*Qt::Key_C,*/ this, "capture_stream");
|
---|
632 | connect( capturingAct, SIGNAL(triggered()),
|
---|
633 | core, SLOT(switchCapturing()) );
|
---|
634 | #endif
|
---|
635 |
|
---|
636 | #ifdef VIDEOPREVIEW
|
---|
637 | videoPreviewAct = new MyAction( this, "video_preview" );
|
---|
638 | connect( videoPreviewAct, SIGNAL(triggered()),
|
---|
639 | this, SLOT(showVideoPreviewDialog()) );
|
---|
640 | #endif
|
---|
641 |
|
---|
642 | flipAct = new MyAction( this, "flip" );
|
---|
643 | flipAct->setCheckable( true );
|
---|
644 | connect( flipAct, SIGNAL(toggled(bool)),
|
---|
645 | core, SLOT(toggleFlip(bool)) );
|
---|
646 |
|
---|
647 | mirrorAct = new MyAction( this, "mirror" );
|
---|
648 | mirrorAct->setCheckable( true );
|
---|
649 | connect( mirrorAct, SIGNAL(toggled(bool)),
|
---|
650 | core, SLOT(toggleMirror(bool)) );
|
---|
651 |
|
---|
652 | stereo3dAct = new MyAction( this, "stereo_3d_filter" );
|
---|
653 | connect( stereo3dAct, SIGNAL(triggered()),
|
---|
654 | this, SLOT(showStereo3dDialog()) );
|
---|
655 |
|
---|
656 | // Submenu filter
|
---|
657 | postProcessingAct = new MyAction( this, "postprocessing" );
|
---|
658 | postProcessingAct->setCheckable( true );
|
---|
659 | connect( postProcessingAct, SIGNAL(toggled(bool)),
|
---|
660 | core, SLOT(togglePostprocessing(bool)) );
|
---|
661 |
|
---|
662 | phaseAct = new MyAction( this, "autodetect_phase" );
|
---|
663 | phaseAct->setCheckable( true );
|
---|
664 | connect( phaseAct, SIGNAL(toggled(bool)),
|
---|
665 | core, SLOT(toggleAutophase(bool)) );
|
---|
666 |
|
---|
667 | deblockAct = new MyAction( this, "deblock" );
|
---|
668 | deblockAct->setCheckable( true );
|
---|
669 | connect( deblockAct, SIGNAL(toggled(bool)),
|
---|
670 | core, SLOT(toggleDeblock(bool)) );
|
---|
671 |
|
---|
672 | deringAct = new MyAction( this, "dering" );
|
---|
673 | deringAct->setCheckable( true );
|
---|
674 | connect( deringAct, SIGNAL(toggled(bool)),
|
---|
675 | core, SLOT(toggleDering(bool)) );
|
---|
676 |
|
---|
677 | gradfunAct = new MyAction( this, "gradfun" );
|
---|
678 | gradfunAct->setCheckable( true );
|
---|
679 | connect( gradfunAct, SIGNAL(toggled(bool)),
|
---|
680 | core, SLOT(toggleGradfun(bool)) );
|
---|
681 |
|
---|
682 |
|
---|
683 | addNoiseAct = new MyAction( this, "add_noise" );
|
---|
684 | addNoiseAct->setCheckable( true );
|
---|
685 | connect( addNoiseAct, SIGNAL(toggled(bool)),
|
---|
686 | core, SLOT(toggleNoise(bool)) );
|
---|
687 |
|
---|
688 | addLetterboxAct = new MyAction( this, "add_letterbox" );
|
---|
689 | addLetterboxAct->setCheckable( true );
|
---|
690 | connect( addLetterboxAct, SIGNAL(toggled(bool)),
|
---|
691 | core, SLOT(changeLetterbox(bool)) );
|
---|
692 |
|
---|
693 | upscaleAct = new MyAction( this, "upscaling" );
|
---|
694 | upscaleAct->setCheckable( true );
|
---|
695 | connect( upscaleAct, SIGNAL(toggled(bool)),
|
---|
696 | core, SLOT(changeUpscale(bool)) );
|
---|
697 |
|
---|
698 |
|
---|
699 | // Menu Audio
|
---|
700 | audioEqualizerAct = new MyAction( this, "audio_equalizer" );
|
---|
701 | audioEqualizerAct->setCheckable( true );
|
---|
702 | connect( audioEqualizerAct, SIGNAL(toggled(bool)),
|
---|
703 | this, SLOT(showAudioEqualizer(bool)) );
|
---|
704 |
|
---|
705 | muteAct = new MyAction( Qt::Key_M, this, "mute" );
|
---|
706 | muteAct->addShortcut(Qt::Key_VolumeMute); // MCE remote key
|
---|
707 | muteAct->setCheckable( true );
|
---|
708 | connect( muteAct, SIGNAL(toggled(bool)),
|
---|
709 | core, SLOT(mute(bool)) );
|
---|
710 |
|
---|
711 | #if USE_MULTIPLE_SHORTCUTS
|
---|
712 | decVolumeAct = new MyAction( this, "decrease_volume" );
|
---|
713 | decVolumeAct->setShortcuts( ActionsEditor::stringToShortcuts("9,/") );
|
---|
714 | decVolumeAct->addShortcut(Qt::Key_VolumeDown); // MCE remote key
|
---|
715 | #else
|
---|
716 | decVolumeAct = new MyAction( Qt::Key_9, this, "dec_volume" );
|
---|
717 | #endif
|
---|
718 | connect( decVolumeAct, SIGNAL(triggered()),
|
---|
719 | core, SLOT(decVolume()) );
|
---|
720 |
|
---|
721 | #if USE_MULTIPLE_SHORTCUTS
|
---|
722 | incVolumeAct = new MyAction( this, "increase_volume" );
|
---|
723 | incVolumeAct->setShortcuts( ActionsEditor::stringToShortcuts("0,*") );
|
---|
724 | incVolumeAct->addShortcut(Qt::Key_VolumeUp); // MCE remote key
|
---|
725 | #else
|
---|
726 | incVolumeAct = new MyAction( Qt::Key_0, this, "inc_volume" );
|
---|
727 | #endif
|
---|
728 | connect( incVolumeAct, SIGNAL(triggered()),
|
---|
729 | core, SLOT(incVolume()) );
|
---|
730 |
|
---|
731 | decAudioDelayAct = new MyAction( Qt::Key_Minus, this, "dec_audio_delay" );
|
---|
732 | connect( decAudioDelayAct, SIGNAL(triggered()),
|
---|
733 | core, SLOT(decAudioDelay()) );
|
---|
734 |
|
---|
735 | incAudioDelayAct = new MyAction( Qt::Key_Plus, this, "inc_audio_delay" );
|
---|
736 | connect( incAudioDelayAct, SIGNAL(triggered()),
|
---|
737 | core, SLOT(incAudioDelay()) );
|
---|
738 |
|
---|
739 | audioDelayAct = new MyAction( this, "audio_delay" );
|
---|
740 | connect( audioDelayAct, SIGNAL(triggered()),
|
---|
741 | this, SLOT(showAudioDelayDialog()) );
|
---|
742 |
|
---|
743 | loadAudioAct = new MyAction( this, "load_audio_file" );
|
---|
744 | connect( loadAudioAct, SIGNAL(triggered()),
|
---|
745 | this, SLOT(loadAudioFile()) );
|
---|
746 |
|
---|
747 | unloadAudioAct = new MyAction( this, "unload_audio_file" );
|
---|
748 | connect( unloadAudioAct, SIGNAL(triggered()),
|
---|
749 | core, SLOT(unloadAudioFile()) );
|
---|
750 |
|
---|
751 |
|
---|
752 | // Submenu Filters
|
---|
753 | extrastereoAct = new MyAction( this, "extrastereo_filter" );
|
---|
754 | extrastereoAct->setCheckable( true );
|
---|
755 | connect( extrastereoAct, SIGNAL(toggled(bool)),
|
---|
756 | core, SLOT(toggleExtrastereo(bool)) );
|
---|
757 |
|
---|
758 | #ifdef MPLAYER_SUPPORT
|
---|
759 | karaokeAct = new MyAction( this, "karaoke_filter" );
|
---|
760 | karaokeAct->setCheckable( true );
|
---|
761 | connect( karaokeAct, SIGNAL(toggled(bool)),
|
---|
762 | core, SLOT(toggleKaraoke(bool)) );
|
---|
763 | #endif
|
---|
764 |
|
---|
765 | volnormAct = new MyAction( this, "volnorm_filter" );
|
---|
766 | volnormAct->setCheckable( true );
|
---|
767 | connect( volnormAct, SIGNAL(toggled(bool)),
|
---|
768 | core, SLOT(toggleVolnorm(bool)) );
|
---|
769 |
|
---|
770 |
|
---|
771 | // Menu Subtitles
|
---|
772 | loadSubsAct = new MyAction( this, "load_subs" );
|
---|
773 | connect( loadSubsAct, SIGNAL(triggered()),
|
---|
774 | this, SLOT(loadSub()) );
|
---|
775 |
|
---|
776 | unloadSubsAct = new MyAction( this, "unload_subs" );
|
---|
777 | connect( unloadSubsAct, SIGNAL(triggered()),
|
---|
778 | core, SLOT(unloadSub()) );
|
---|
779 |
|
---|
780 | decSubDelayAct = new MyAction( Qt::Key_Z, this, "dec_sub_delay" );
|
---|
781 | connect( decSubDelayAct, SIGNAL(triggered()),
|
---|
782 | core, SLOT(decSubDelay()) );
|
---|
783 |
|
---|
784 | incSubDelayAct = new MyAction( Qt::Key_X, this, "inc_sub_delay" );
|
---|
785 | connect( incSubDelayAct, SIGNAL(triggered()),
|
---|
786 | core, SLOT(incSubDelay()) );
|
---|
787 |
|
---|
788 | subDelayAct = new MyAction( this, "sub_delay" );
|
---|
789 | connect( subDelayAct, SIGNAL(triggered()),
|
---|
790 | this, SLOT(showSubDelayDialog()) );
|
---|
791 |
|
---|
792 | decSubPosAct = new MyAction( Qt::Key_R, this, "dec_sub_pos" );
|
---|
793 | connect( decSubPosAct, SIGNAL(triggered()),
|
---|
794 | core, SLOT(decSubPos()) );
|
---|
795 | incSubPosAct = new MyAction( Qt::Key_T, this, "inc_sub_pos" );
|
---|
796 | connect( incSubPosAct, SIGNAL(triggered()),
|
---|
797 | core, SLOT(incSubPos()) );
|
---|
798 |
|
---|
799 | decSubScaleAct = new MyAction( Qt::SHIFT | Qt::Key_R, this, "dec_sub_scale" );
|
---|
800 | connect( decSubScaleAct, SIGNAL(triggered()),
|
---|
801 | core, SLOT(decSubScale()) );
|
---|
802 |
|
---|
803 | incSubScaleAct = new MyAction( Qt::SHIFT | Qt::Key_T, this, "inc_sub_scale" );
|
---|
804 | connect( incSubScaleAct, SIGNAL(triggered()),
|
---|
805 | core, SLOT(incSubScale()) );
|
---|
806 |
|
---|
807 | decSubStepAct = new MyAction( Qt::Key_G, this, "dec_sub_step" );
|
---|
808 | connect( decSubStepAct, SIGNAL(triggered()),
|
---|
809 | core, SLOT(decSubStep()) );
|
---|
810 |
|
---|
811 | incSubStepAct = new MyAction( Qt::Key_Y, this, "inc_sub_step" );
|
---|
812 | connect( incSubStepAct, SIGNAL(triggered()),
|
---|
813 | core, SLOT(incSubStep()) );
|
---|
814 |
|
---|
815 | #ifdef MPV_SUPPORT
|
---|
816 | seekNextSubAct = new MyAction(Qt::CTRL | Qt::Key_Right, this, "seek_next_sub");
|
---|
817 | connect(seekNextSubAct, SIGNAL(triggered()),
|
---|
818 | core, SLOT(seekToNextSub()));
|
---|
819 |
|
---|
820 | seekPrevSubAct = new MyAction(Qt::CTRL | Qt::Key_Left, this, "seek_prev_sub");
|
---|
821 | connect(seekPrevSubAct, SIGNAL(triggered()),
|
---|
822 | core, SLOT(seekToPrevSub()));
|
---|
823 | #endif
|
---|
824 |
|
---|
825 | useCustomSubStyleAct = new MyAction(this, "use_custom_sub_style");
|
---|
826 | useCustomSubStyleAct->setCheckable(true);
|
---|
827 | connect( useCustomSubStyleAct, SIGNAL(toggled(bool)), core, SLOT(changeUseCustomSubStyle(bool)) );
|
---|
828 |
|
---|
829 | useForcedSubsOnlyAct = new MyAction(this, "use_forced_subs_only");
|
---|
830 | useForcedSubsOnlyAct->setCheckable(true);
|
---|
831 | connect( useForcedSubsOnlyAct, SIGNAL(toggled(bool)), core, SLOT(toggleForcedSubsOnly(bool)) );
|
---|
832 |
|
---|
833 | subVisibilityAct = new MyAction(Qt::Key_V, this, "subtitle_visibility");
|
---|
834 | subVisibilityAct->setCheckable(true);
|
---|
835 | connect( subVisibilityAct, SIGNAL(toggled(bool)), core, SLOT(changeSubVisibility(bool)) );
|
---|
836 |
|
---|
837 | #ifdef FIND_SUBTITLES
|
---|
838 | showFindSubtitlesDialogAct = new MyAction( this, "show_find_sub_dialog" );
|
---|
839 | connect( showFindSubtitlesDialogAct, SIGNAL(triggered()),
|
---|
840 | this, SLOT(showFindSubtitlesDialog()) );
|
---|
841 |
|
---|
842 | openUploadSubtitlesPageAct = new MyAction( this, "upload_subtitles" ); //turbos
|
---|
843 | connect( openUploadSubtitlesPageAct, SIGNAL(triggered()), //turbos
|
---|
844 | this, SLOT(openUploadSubtitlesPage()) ); //turbos
|
---|
845 | #endif
|
---|
846 |
|
---|
847 | // Menu Options
|
---|
848 | showPlaylistAct = new MyAction( QKeySequence("Ctrl+L"), this, "show_playlist" );
|
---|
849 | showPlaylistAct->setCheckable( true );
|
---|
850 | connect( showPlaylistAct, SIGNAL(toggled(bool)),
|
---|
851 | this, SLOT(showPlaylist(bool)) );
|
---|
852 |
|
---|
853 | showPropertiesAct = new MyAction( QKeySequence("Ctrl+I"), this, "show_file_properties" );
|
---|
854 | connect( showPropertiesAct, SIGNAL(triggered()),
|
---|
855 | this, SLOT(showFilePropertiesDialog()) );
|
---|
856 |
|
---|
857 | showPreferencesAct = new MyAction( QKeySequence("Ctrl+P"), this, "show_preferences" );
|
---|
858 | connect( showPreferencesAct, SIGNAL(triggered()),
|
---|
859 | this, SLOT(showPreferencesDialog()) );
|
---|
860 |
|
---|
861 | #ifdef YOUTUBE_SUPPORT
|
---|
862 | showTubeBrowserAct = new MyAction( Qt::Key_F11, this, "show_tube_browser" );
|
---|
863 | connect( showTubeBrowserAct, SIGNAL(triggered()),
|
---|
864 | this, SLOT(showTubeBrowser()) );
|
---|
865 | #endif
|
---|
866 |
|
---|
867 | // Submenu Logs
|
---|
868 | #ifdef LOG_MPLAYER
|
---|
869 | showLogMplayerAct = new MyAction( QKeySequence("Ctrl+M"), this, "show_mplayer_log" );
|
---|
870 | connect( showLogMplayerAct, SIGNAL(triggered()),
|
---|
871 | this, SLOT(showMplayerLog()) );
|
---|
872 | #endif
|
---|
873 |
|
---|
874 | #ifdef LOG_SMPLAYER
|
---|
875 | showLogSmplayerAct = new MyAction( QKeySequence("Ctrl+S"), this, "show_smplayer_log" );
|
---|
876 | connect( showLogSmplayerAct, SIGNAL(triggered()),
|
---|
877 | this, SLOT(showLog()) );
|
---|
878 | #endif
|
---|
879 |
|
---|
880 | // Menu Help
|
---|
881 | showFirstStepsAct = new MyAction( this, "first_steps" );
|
---|
882 | connect( showFirstStepsAct, SIGNAL(triggered()),
|
---|
883 | this, SLOT(helpFirstSteps()) );
|
---|
884 |
|
---|
885 | showFAQAct = new MyAction( this, "faq" );
|
---|
886 | connect( showFAQAct, SIGNAL(triggered()),
|
---|
887 | this, SLOT(helpFAQ()) );
|
---|
888 |
|
---|
889 | showCLOptionsAct = new MyAction( this, "cl_options" );
|
---|
890 | connect( showCLOptionsAct, SIGNAL(triggered()),
|
---|
891 | this, SLOT(helpCLOptions()) );
|
---|
892 |
|
---|
893 | showCheckUpdatesAct = new MyAction( this, "check_updates" );
|
---|
894 | connect( showCheckUpdatesAct, SIGNAL(triggered()),
|
---|
895 | this, SLOT(helpCheckUpdates()) );
|
---|
896 |
|
---|
897 | #if defined(YOUTUBE_SUPPORT) && defined(YT_USE_YTSIG)
|
---|
898 | updateYTAct = new MyAction( this, "update_youtube" );
|
---|
899 | connect( updateYTAct, SIGNAL(triggered()),
|
---|
900 | this, SLOT(YTUpdateScript()) );
|
---|
901 | #endif
|
---|
902 |
|
---|
903 | showConfigAct = new MyAction( this, "show_config" );
|
---|
904 | connect( showConfigAct, SIGNAL(triggered()),
|
---|
905 | this, SLOT(helpShowConfig()) );
|
---|
906 |
|
---|
907 | #ifdef SHARE_ACTIONS
|
---|
908 | donateAct = new MyAction( this, "donate" );
|
---|
909 | connect( donateAct, SIGNAL(triggered()),
|
---|
910 | this, SLOT(helpDonate()) );
|
---|
911 | #endif
|
---|
912 |
|
---|
913 | aboutThisAct = new MyAction( this, "about_smplayer" );
|
---|
914 | connect( aboutThisAct, SIGNAL(triggered()),
|
---|
915 | this, SLOT(helpAbout()) );
|
---|
916 |
|
---|
917 | #ifdef SHARE_MENU
|
---|
918 | facebookAct = new MyAction (this, "facebook");
|
---|
919 | twitterAct = new MyAction (this, "twitter");
|
---|
920 | gmailAct = new MyAction (this, "gmail");
|
---|
921 | hotmailAct = new MyAction (this, "hotmail");
|
---|
922 | yahooAct = new MyAction (this, "yahoo");
|
---|
923 |
|
---|
924 | connect( facebookAct, SIGNAL(triggered()),
|
---|
925 | this, SLOT(shareSMPlayer()) );
|
---|
926 | connect( twitterAct, SIGNAL(triggered()),
|
---|
927 | this, SLOT(shareSMPlayer()) );
|
---|
928 | connect( gmailAct, SIGNAL(triggered()),
|
---|
929 | this, SLOT(shareSMPlayer()) );
|
---|
930 | connect( hotmailAct, SIGNAL(triggered()),
|
---|
931 | this, SLOT(shareSMPlayer()) );
|
---|
932 | connect( yahooAct, SIGNAL(triggered()),
|
---|
933 | this, SLOT(shareSMPlayer()) );
|
---|
934 | #endif
|
---|
935 |
|
---|
936 | // OSD
|
---|
937 | incOSDScaleAct = new MyAction(Qt::SHIFT | Qt::Key_U, this, "inc_osd_scale");
|
---|
938 | connect(incOSDScaleAct, SIGNAL(triggered()), core, SLOT(incOSDScale()));
|
---|
939 |
|
---|
940 | decOSDScaleAct = new MyAction(Qt::SHIFT | Qt::Key_Y, this, "dec_osd_scale");
|
---|
941 | connect(decOSDScaleAct, SIGNAL(triggered()), core, SLOT(decOSDScale()));
|
---|
942 |
|
---|
943 |
|
---|
944 | // Playlist
|
---|
945 | playNextAct = new MyAction(Qt::Key_Greater, this, "play_next");
|
---|
946 | playNextAct->addShortcut(Qt::Key_MediaNext); // MCE remote key
|
---|
947 | connect( playNextAct, SIGNAL(triggered()), playlist, SLOT(playNext()) );
|
---|
948 |
|
---|
949 | playPrevAct = new MyAction(Qt::Key_Less, this, "play_prev");
|
---|
950 | playPrevAct->addShortcut(Qt::Key_MediaPrevious); // MCE remote key
|
---|
951 | connect( playPrevAct, SIGNAL(triggered()), playlist, SLOT(playPrev()) );
|
---|
952 |
|
---|
953 |
|
---|
954 | // Move video window and zoom
|
---|
955 | moveUpAct = new MyAction(Qt::ALT | Qt::Key_Up, this, "move_up");
|
---|
956 | connect( moveUpAct, SIGNAL(triggered()), mplayerwindow, SLOT(moveUp()) );
|
---|
957 |
|
---|
958 | moveDownAct = new MyAction(Qt::ALT | Qt::Key_Down, this, "move_down");
|
---|
959 | connect( moveDownAct, SIGNAL(triggered()), mplayerwindow, SLOT(moveDown()) );
|
---|
960 |
|
---|
961 | moveLeftAct = new MyAction(Qt::ALT | Qt::Key_Left, this, "move_left");
|
---|
962 | connect( moveLeftAct, SIGNAL(triggered()), mplayerwindow, SLOT(moveLeft()) );
|
---|
963 |
|
---|
964 | moveRightAct = new MyAction(Qt::ALT | Qt::Key_Right, this, "move_right");
|
---|
965 | connect( moveRightAct, SIGNAL(triggered()), mplayerwindow, SLOT(moveRight()) );
|
---|
966 |
|
---|
967 | incZoomAct = new MyAction(Qt::Key_E, this, "inc_zoom");
|
---|
968 | connect( incZoomAct, SIGNAL(triggered()), core, SLOT(incZoom()) );
|
---|
969 |
|
---|
970 | decZoomAct = new MyAction(Qt::Key_W, this, "dec_zoom");
|
---|
971 | connect( decZoomAct, SIGNAL(triggered()), core, SLOT(decZoom()) );
|
---|
972 |
|
---|
973 | resetZoomAct = new MyAction(Qt::SHIFT | Qt::Key_E, this, "reset_zoom");
|
---|
974 | connect( resetZoomAct, SIGNAL(triggered()), core, SLOT(resetZoom()) );
|
---|
975 |
|
---|
976 | autoZoomAct = new MyAction(Qt::SHIFT | Qt::Key_W, this, "auto_zoom");
|
---|
977 | connect( autoZoomAct, SIGNAL(triggered()), core, SLOT(autoZoom()) );
|
---|
978 |
|
---|
979 | autoZoom169Act = new MyAction(Qt::SHIFT | Qt::Key_A, this, "zoom_169");
|
---|
980 | connect( autoZoom169Act, SIGNAL(triggered()), core, SLOT(autoZoomFor169()) );
|
---|
981 |
|
---|
982 | autoZoom235Act = new MyAction(Qt::SHIFT | Qt::Key_S, this, "zoom_235");
|
---|
983 | connect( autoZoom235Act, SIGNAL(triggered()), core, SLOT(autoZoomFor235()) );
|
---|
984 |
|
---|
985 |
|
---|
986 | // Actions not in menus or buttons
|
---|
987 | // Volume 2
|
---|
988 | #if !USE_MULTIPLE_SHORTCUTS
|
---|
989 | decVolume2Act = new MyAction( Qt::Key_Slash, this, "dec_volume2" );
|
---|
990 | connect( decVolume2Act, SIGNAL(triggered()), core, SLOT(decVolume()) );
|
---|
991 |
|
---|
992 | incVolume2Act = new MyAction( Qt::Key_Asterisk, this, "inc_volume2" );
|
---|
993 | connect( incVolume2Act, SIGNAL(triggered()), core, SLOT(incVolume()) );
|
---|
994 | #endif
|
---|
995 | // Exit fullscreen
|
---|
996 | exitFullscreenAct = new MyAction( Qt::Key_Escape, this, "exit_fullscreen" );
|
---|
997 | connect( exitFullscreenAct, SIGNAL(triggered()), this, SLOT(exitFullscreen()) );
|
---|
998 |
|
---|
999 | nextOSDAct = new MyAction( Qt::Key_O, this, "next_osd");
|
---|
1000 | connect( nextOSDAct, SIGNAL(triggered()), core, SLOT(nextOSD()) );
|
---|
1001 |
|
---|
1002 | decContrastAct = new MyAction( Qt::Key_1, this, "dec_contrast");
|
---|
1003 | connect( decContrastAct, SIGNAL(triggered()), core, SLOT(decContrast()) );
|
---|
1004 |
|
---|
1005 | incContrastAct = new MyAction( Qt::Key_2, this, "inc_contrast");
|
---|
1006 | connect( incContrastAct, SIGNAL(triggered()), core, SLOT(incContrast()) );
|
---|
1007 |
|
---|
1008 | decBrightnessAct = new MyAction( Qt::Key_3, this, "dec_brightness");
|
---|
1009 | connect( decBrightnessAct, SIGNAL(triggered()), core, SLOT(decBrightness()) );
|
---|
1010 |
|
---|
1011 | incBrightnessAct = new MyAction( Qt::Key_4, this, "inc_brightness");
|
---|
1012 | connect( incBrightnessAct, SIGNAL(triggered()), core, SLOT(incBrightness()) );
|
---|
1013 |
|
---|
1014 | decHueAct = new MyAction(Qt::Key_5, this, "dec_hue");
|
---|
1015 | connect( decHueAct, SIGNAL(triggered()), core, SLOT(decHue()) );
|
---|
1016 |
|
---|
1017 | incHueAct = new MyAction( Qt::Key_6, this, "inc_hue");
|
---|
1018 | connect( incHueAct, SIGNAL(triggered()), core, SLOT(incHue()) );
|
---|
1019 |
|
---|
1020 | decSaturationAct = new MyAction( Qt::Key_7, this, "dec_saturation");
|
---|
1021 | connect( decSaturationAct, SIGNAL(triggered()), core, SLOT(decSaturation()) );
|
---|
1022 |
|
---|
1023 | incSaturationAct = new MyAction( Qt::Key_8, this, "inc_saturation");
|
---|
1024 | connect( incSaturationAct, SIGNAL(triggered()), core, SLOT(incSaturation()) );
|
---|
1025 |
|
---|
1026 | decGammaAct = new MyAction( this, "dec_gamma");
|
---|
1027 | connect( decGammaAct, SIGNAL(triggered()), core, SLOT(decGamma()) );
|
---|
1028 |
|
---|
1029 | incGammaAct = new MyAction( this, "inc_gamma");
|
---|
1030 | connect( incGammaAct, SIGNAL(triggered()), core, SLOT(incGamma()) );
|
---|
1031 |
|
---|
1032 | nextVideoAct = new MyAction( this, "next_video");
|
---|
1033 | connect( nextVideoAct, SIGNAL(triggered()), core, SLOT(nextVideo()) );
|
---|
1034 |
|
---|
1035 | nextAudioAct = new MyAction( Qt::Key_K, this, "next_audio");
|
---|
1036 | connect( nextAudioAct, SIGNAL(triggered()), core, SLOT(nextAudio()) );
|
---|
1037 |
|
---|
1038 | nextSubtitleAct = new MyAction( Qt::Key_J, this, "next_subtitle");
|
---|
1039 | connect( nextSubtitleAct, SIGNAL(triggered()), core, SLOT(nextSubtitle()) );
|
---|
1040 |
|
---|
1041 | nextChapterAct = new MyAction( Qt::Key_At, this, "next_chapter");
|
---|
1042 | connect( nextChapterAct, SIGNAL(triggered()), core, SLOT(nextChapter()) );
|
---|
1043 |
|
---|
1044 | prevChapterAct = new MyAction( Qt::Key_Exclam, this, "prev_chapter");
|
---|
1045 | connect( prevChapterAct, SIGNAL(triggered()), core, SLOT(prevChapter()) );
|
---|
1046 |
|
---|
1047 | doubleSizeAct = new MyAction( Qt::CTRL | Qt::Key_D, this, "toggle_double_size");
|
---|
1048 | connect( doubleSizeAct, SIGNAL(triggered()), this, SLOT(toggleDoubleSize()) );
|
---|
1049 |
|
---|
1050 | resetVideoEqualizerAct = new MyAction( this, "reset_video_equalizer");
|
---|
1051 | connect( resetVideoEqualizerAct, SIGNAL(triggered()), video_equalizer, SLOT(reset()) );
|
---|
1052 |
|
---|
1053 | resetAudioEqualizerAct = new MyAction( this, "reset_audio_equalizer");
|
---|
1054 | connect( resetAudioEqualizerAct, SIGNAL(triggered()), audio_equalizer, SLOT(reset()) );
|
---|
1055 |
|
---|
1056 | showContextMenuAct = new MyAction( this, "show_context_menu");
|
---|
1057 | connect( showContextMenuAct, SIGNAL(triggered()),
|
---|
1058 | this, SLOT(showPopupMenu()) );
|
---|
1059 |
|
---|
1060 | nextAspectAct = new MyAction( Qt::Key_A, this, "next_aspect");
|
---|
1061 | connect( nextAspectAct, SIGNAL(triggered()),
|
---|
1062 | core, SLOT(nextAspectRatio()) );
|
---|
1063 |
|
---|
1064 | nextWheelFunctionAct = new MyAction(this, "next_wheel_function");
|
---|
1065 | connect( nextWheelFunctionAct, SIGNAL(triggered()),
|
---|
1066 | core, SLOT(nextWheelFunction()) );
|
---|
1067 |
|
---|
1068 | showFilenameAct = new MyAction(Qt::SHIFT | Qt::Key_I, this, "show_filename");
|
---|
1069 | connect( showFilenameAct, SIGNAL(triggered()), core, SLOT(showFilenameOnOSD()) );
|
---|
1070 |
|
---|
1071 | showTimeAct = new MyAction(Qt::Key_I, this, "show_time");
|
---|
1072 | connect( showTimeAct, SIGNAL(triggered()), core, SLOT(showTimeOnOSD()) );
|
---|
1073 |
|
---|
1074 | toggleDeinterlaceAct = new MyAction(Qt::Key_D, this, "toggle_deinterlacing");
|
---|
1075 | connect( toggleDeinterlaceAct, SIGNAL(triggered()), core, SLOT(toggleDeinterlace()) );
|
---|
1076 |
|
---|
1077 |
|
---|
1078 | // Group actions
|
---|
1079 |
|
---|
1080 | // OSD
|
---|
1081 | osdGroup = new MyActionGroup(this);
|
---|
1082 | osdNoneAct = new MyActionGroupItem(this, osdGroup, "osd_none", Preferences::None);
|
---|
1083 | osdSeekAct = new MyActionGroupItem(this, osdGroup, "osd_seek", Preferences::Seek);
|
---|
1084 | osdTimerAct = new MyActionGroupItem(this, osdGroup, "osd_timer", Preferences::SeekTimer);
|
---|
1085 | osdTotalAct = new MyActionGroupItem(this, osdGroup, "osd_total", Preferences::SeekTimerTotal);
|
---|
1086 | connect( osdGroup, SIGNAL(activated(int)), core, SLOT(changeOSD(int)) );
|
---|
1087 |
|
---|
1088 | // Denoise
|
---|
1089 | denoiseGroup = new MyActionGroup(this);
|
---|
1090 | denoiseNoneAct = new MyActionGroupItem(this, denoiseGroup, "denoise_none", MediaSettings::NoDenoise);
|
---|
1091 | denoiseNormalAct = new MyActionGroupItem(this, denoiseGroup, "denoise_normal", MediaSettings::DenoiseNormal);
|
---|
1092 | denoiseSoftAct = new MyActionGroupItem(this, denoiseGroup, "denoise_soft", MediaSettings::DenoiseSoft);
|
---|
1093 | connect( denoiseGroup, SIGNAL(activated(int)), core, SLOT(changeDenoise(int)) );
|
---|
1094 |
|
---|
1095 | // Unsharp group
|
---|
1096 | unsharpGroup = new MyActionGroup(this);
|
---|
1097 | unsharpNoneAct = new MyActionGroupItem(this, unsharpGroup, "unsharp_off", 0);
|
---|
1098 | blurAct = new MyActionGroupItem(this, unsharpGroup, "blur", 1);
|
---|
1099 | sharpenAct = new MyActionGroupItem(this, unsharpGroup, "sharpen", 2);
|
---|
1100 | connect( unsharpGroup, SIGNAL(activated(int)), core, SLOT(changeUnsharp(int)) );
|
---|
1101 |
|
---|
1102 | // Video size
|
---|
1103 | sizeGroup = new MyActionGroup(this);
|
---|
1104 | size50 = new MyActionGroupItem(this, sizeGroup, "5&0%", "size_50", 50);
|
---|
1105 | size75 = new MyActionGroupItem(this, sizeGroup, "7&5%", "size_75", 75);
|
---|
1106 | size100 = new MyActionGroupItem(this, sizeGroup, "&100%", "size_100", 100);
|
---|
1107 | size125 = new MyActionGroupItem(this, sizeGroup, "1&25%", "size_125", 125);
|
---|
1108 | size150 = new MyActionGroupItem(this, sizeGroup, "15&0%", "size_150", 150);
|
---|
1109 | size175 = new MyActionGroupItem(this, sizeGroup, "1&75%", "size_175", 175);
|
---|
1110 | size200 = new MyActionGroupItem(this, sizeGroup, "&200%", "size_200", 200);
|
---|
1111 | size300 = new MyActionGroupItem(this, sizeGroup, "&300%", "size_300", 300);
|
---|
1112 | size400 = new MyActionGroupItem(this, sizeGroup, "&400%", "size_400", 400);
|
---|
1113 | size100->setShortcut( Qt::CTRL | Qt::Key_1 );
|
---|
1114 | size200->setShortcut( Qt::CTRL | Qt::Key_2 );
|
---|
1115 | connect( sizeGroup, SIGNAL(activated(int)), this, SLOT(changeSizeFactor(int)) );
|
---|
1116 | // Make all not checkable
|
---|
1117 | QList <QAction *> size_list = sizeGroup->actions();
|
---|
1118 | for (int n=0; n < size_list.count(); n++) {
|
---|
1119 | size_list[n]->setCheckable(false);
|
---|
1120 | }
|
---|
1121 |
|
---|
1122 | // Deinterlace
|
---|
1123 | deinterlaceGroup = new MyActionGroup(this);
|
---|
1124 | deinterlaceNoneAct = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_none", MediaSettings::NoDeinterlace);
|
---|
1125 | deinterlaceL5Act = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_l5", MediaSettings::L5);
|
---|
1126 | deinterlaceYadif0Act = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_yadif0", MediaSettings::Yadif);
|
---|
1127 | deinterlaceYadif1Act = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_yadif1", MediaSettings::Yadif_1);
|
---|
1128 | deinterlaceLBAct = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_lb", MediaSettings::LB);
|
---|
1129 | deinterlaceKernAct = new MyActionGroupItem(this, deinterlaceGroup, "deinterlace_kern", MediaSettings::Kerndeint);
|
---|
1130 | connect( deinterlaceGroup, SIGNAL(activated(int)),
|
---|
1131 | core, SLOT(changeDeinterlace(int)) );
|
---|
1132 |
|
---|
1133 | // Audio channels
|
---|
1134 | channelsGroup = new MyActionGroup(this);
|
---|
1135 | /* channelsDefaultAct = new MyActionGroupItem(this, channelsGroup, "channels_default", MediaSettings::ChDefault); */
|
---|
1136 | channelsStereoAct = new MyActionGroupItem(this, channelsGroup, "channels_stereo", MediaSettings::ChStereo);
|
---|
1137 | channelsSurroundAct = new MyActionGroupItem(this, channelsGroup, "channels_surround", MediaSettings::ChSurround);
|
---|
1138 | channelsFull51Act = new MyActionGroupItem(this, channelsGroup, "channels_ful51", MediaSettings::ChFull51);
|
---|
1139 | channelsFull61Act = new MyActionGroupItem(this, channelsGroup, "channels_ful61", MediaSettings::ChFull61);
|
---|
1140 | channelsFull71Act = new MyActionGroupItem(this, channelsGroup, "channels_ful71", MediaSettings::ChFull71);
|
---|
1141 | connect( channelsGroup, SIGNAL(activated(int)),
|
---|
1142 | core, SLOT(setAudioChannels(int)) );
|
---|
1143 |
|
---|
1144 | // Stereo mode
|
---|
1145 | stereoGroup = new MyActionGroup(this);
|
---|
1146 | stereoAct = new MyActionGroupItem(this, stereoGroup, "stereo", MediaSettings::Stereo);
|
---|
1147 | leftChannelAct = new MyActionGroupItem(this, stereoGroup, "left_channel", MediaSettings::Left);
|
---|
1148 | rightChannelAct = new MyActionGroupItem(this, stereoGroup, "right_channel", MediaSettings::Right);
|
---|
1149 | monoAct = new MyActionGroupItem(this, stereoGroup, "mono", MediaSettings::Mono);
|
---|
1150 | reverseAct = new MyActionGroupItem(this, stereoGroup, "reverse_channels", MediaSettings::Reverse);
|
---|
1151 | connect( stereoGroup, SIGNAL(activated(int)),
|
---|
1152 | core, SLOT(setStereoMode(int)) );
|
---|
1153 |
|
---|
1154 | // Video aspect
|
---|
1155 | aspectGroup = new MyActionGroup(this);
|
---|
1156 | aspectDetectAct = new MyActionGroupItem(this, aspectGroup, "aspect_detect", MediaSettings::AspectAuto);
|
---|
1157 | aspect11Act = new MyActionGroupItem(this, aspectGroup, "aspect_1:1", MediaSettings::Aspect11 );
|
---|
1158 | aspect54Act = new MyActionGroupItem(this, aspectGroup, "aspect_5:4", MediaSettings::Aspect54 );
|
---|
1159 | aspect43Act = new MyActionGroupItem(this, aspectGroup, "aspect_4:3", MediaSettings::Aspect43);
|
---|
1160 | aspect118Act = new MyActionGroupItem(this, aspectGroup, "aspect_11:8", MediaSettings::Aspect118 );
|
---|
1161 | aspect1410Act = new MyActionGroupItem(this, aspectGroup, "aspect_14:10", MediaSettings::Aspect1410 );
|
---|
1162 | aspect32Act = new MyActionGroupItem(this, aspectGroup, "aspect_3:2", MediaSettings::Aspect32);
|
---|
1163 | aspect149Act = new MyActionGroupItem(this, aspectGroup, "aspect_14:9", MediaSettings::Aspect149 );
|
---|
1164 | aspect1610Act = new MyActionGroupItem(this, aspectGroup, "aspect_16:10", MediaSettings::Aspect1610 );
|
---|
1165 | aspect169Act = new MyActionGroupItem(this, aspectGroup, "aspect_16:9", MediaSettings::Aspect169 );
|
---|
1166 | aspect235Act = new MyActionGroupItem(this, aspectGroup, "aspect_2.35:1", MediaSettings::Aspect235 );
|
---|
1167 | {
|
---|
1168 | QAction * sep = new QAction(aspectGroup);
|
---|
1169 | sep->setSeparator(true);
|
---|
1170 | }
|
---|
1171 | aspectNoneAct = new MyActionGroupItem(this, aspectGroup, "aspect_none", MediaSettings::AspectNone);
|
---|
1172 |
|
---|
1173 | connect( aspectGroup, SIGNAL(activated(int)),
|
---|
1174 | core, SLOT(changeAspectRatio(int)) );
|
---|
1175 |
|
---|
1176 | // Rotate
|
---|
1177 | rotateGroup = new MyActionGroup(this);
|
---|
1178 | rotateNoneAct = new MyActionGroupItem(this, rotateGroup, "rotate_none", MediaSettings::NoRotate);
|
---|
1179 | rotateClockwiseFlipAct = new MyActionGroupItem(this, rotateGroup, "rotate_clockwise_flip", MediaSettings::Clockwise_flip);
|
---|
1180 | rotateClockwiseAct = new MyActionGroupItem(this, rotateGroup, "rotate_clockwise", MediaSettings::Clockwise);
|
---|
1181 | rotateCounterclockwiseAct = new MyActionGroupItem(this, rotateGroup, "rotate_counterclockwise", MediaSettings::Counterclockwise);
|
---|
1182 | rotateCounterclockwiseFlipAct = new MyActionGroupItem(this, rotateGroup, "rotate_counterclockwise_flip", MediaSettings::Counterclockwise_flip);
|
---|
1183 | connect( rotateGroup, SIGNAL(activated(int)),
|
---|
1184 | core, SLOT(changeRotate(int)) );
|
---|
1185 |
|
---|
1186 | // On Top
|
---|
1187 | onTopActionGroup = new MyActionGroup(this);
|
---|
1188 | onTopAlwaysAct = new MyActionGroupItem( this,onTopActionGroup,"on_top_always",Preferences::AlwaysOnTop);
|
---|
1189 | onTopNeverAct = new MyActionGroupItem( this,onTopActionGroup,"on_top_never",Preferences::NeverOnTop);
|
---|
1190 | onTopWhilePlayingAct = new MyActionGroupItem( this,onTopActionGroup,"on_top_playing",Preferences::WhilePlayingOnTop);
|
---|
1191 | connect( onTopActionGroup , SIGNAL(activated(int)),
|
---|
1192 | this, SLOT(changeStayOnTop(int)) );
|
---|
1193 |
|
---|
1194 | toggleStayOnTopAct = new MyAction( this, "toggle_stay_on_top");
|
---|
1195 | connect( toggleStayOnTopAct, SIGNAL(triggered()), this, SLOT(toggleStayOnTop()) );
|
---|
1196 |
|
---|
1197 |
|
---|
1198 | #if USE_ADAPTER
|
---|
1199 | screenGroup = new MyActionGroup(this);
|
---|
1200 | screenDefaultAct = new MyActionGroupItem(this, screenGroup, "screen_default", -1);
|
---|
1201 | #ifdef Q_OS_WIN
|
---|
1202 | DeviceList display_devices = DeviceInfo::displayDevices();
|
---|
1203 | if (!display_devices.isEmpty()) {
|
---|
1204 | for (int n = 0; n < display_devices.count(); n++) {
|
---|
1205 | int id = display_devices[n].ID().toInt();
|
---|
1206 | QString desc = display_devices[n].desc();
|
---|
1207 | MyAction * screen_item = new MyActionGroupItem(this, screenGroup, QString("screen_%1").arg(n).toLatin1().constData(), id);
|
---|
1208 | screen_item->change( "&"+QString::number(n) + " - " + desc);
|
---|
1209 | }
|
---|
1210 | }
|
---|
1211 | else
|
---|
1212 | #endif // Q_OS_WIN
|
---|
1213 | for (int n = 1; n <= 4; n++) {
|
---|
1214 | MyAction * screen_item = new MyActionGroupItem(this, screenGroup, QString("screen_%1").arg(n).toLatin1().constData(), n);
|
---|
1215 | screen_item->change( "&"+QString::number(n) );
|
---|
1216 | }
|
---|
1217 |
|
---|
1218 | connect( screenGroup, SIGNAL(activated(int)),
|
---|
1219 | core, SLOT(changeAdapter(int)) );
|
---|
1220 | #endif
|
---|
1221 |
|
---|
1222 | #if PROGRAM_SWITCH
|
---|
1223 | // Program track
|
---|
1224 | programTrackGroup = new MyActionGroup(this);
|
---|
1225 | connect( programTrackGroup, SIGNAL(activated(int)),
|
---|
1226 | core, SLOT(changeProgram(int)) );
|
---|
1227 | #endif
|
---|
1228 |
|
---|
1229 | // Video track
|
---|
1230 | videoTrackGroup = new MyActionGroup(this);
|
---|
1231 | connect( videoTrackGroup, SIGNAL(activated(int)),
|
---|
1232 | core, SLOT(changeVideo(int)) );
|
---|
1233 |
|
---|
1234 | // Audio track
|
---|
1235 | audioTrackGroup = new MyActionGroup(this);
|
---|
1236 | connect( audioTrackGroup, SIGNAL(activated(int)),
|
---|
1237 | core, SLOT(changeAudio(int)) );
|
---|
1238 |
|
---|
1239 | // Subtitle track
|
---|
1240 | subtitleTrackGroup = new MyActionGroup(this);
|
---|
1241 | connect( subtitleTrackGroup, SIGNAL(activated(int)),
|
---|
1242 | core, SLOT(changeSubtitle(int)) );
|
---|
1243 |
|
---|
1244 | #ifdef MPV_SUPPORT
|
---|
1245 | // Secondary subtitle track
|
---|
1246 | secondarySubtitleTrackGroup = new MyActionGroup(this);
|
---|
1247 | connect( secondarySubtitleTrackGroup, SIGNAL(activated(int)),
|
---|
1248 | core, SLOT(changeSecondarySubtitle(int)) );
|
---|
1249 | #endif
|
---|
1250 |
|
---|
1251 | ccGroup = new MyActionGroup(this);
|
---|
1252 | ccNoneAct = new MyActionGroupItem(this, ccGroup, "cc_none", 0);
|
---|
1253 | ccChannel1Act = new MyActionGroupItem(this, ccGroup, "cc_ch_1", 1);
|
---|
1254 | ccChannel2Act = new MyActionGroupItem(this, ccGroup, "cc_ch_2", 2);
|
---|
1255 | ccChannel3Act = new MyActionGroupItem(this, ccGroup, "cc_ch_3", 3);
|
---|
1256 | ccChannel4Act = new MyActionGroupItem(this, ccGroup, "cc_ch_4", 4);
|
---|
1257 | connect( ccGroup, SIGNAL(activated(int)),
|
---|
1258 | core, SLOT(changeClosedCaptionChannel(int)) );
|
---|
1259 |
|
---|
1260 | subFPSGroup = new MyActionGroup(this);
|
---|
1261 | subFPSNoneAct = new MyActionGroupItem(this, subFPSGroup, "sub_fps_none", MediaSettings::SFPS_None);
|
---|
1262 | /* subFPS23Act = new MyActionGroupItem(this, subFPSGroup, "sub_fps_23", MediaSettings::SFPS_23); */
|
---|
1263 | subFPS23976Act = new MyActionGroupItem(this, subFPSGroup, "sub_fps_23976", MediaSettings::SFPS_23976);
|
---|
1264 | subFPS24Act = new MyActionGroupItem(this, subFPSGroup, "sub_fps_24", MediaSettings::SFPS_24);
|
---|
1265 | subFPS25Act = new MyActionGroupItem(this, subFPSGroup, "sub_fps_25", MediaSettings::SFPS_25);
|
---|
1266 | subFPS29970Act = new MyActionGroupItem(this, subFPSGroup, "sub_fps_29970", MediaSettings::SFPS_29970);
|
---|
1267 | subFPS30Act = new MyActionGroupItem(this, subFPSGroup, "sub_fps_30", MediaSettings::SFPS_30);
|
---|
1268 | connect( subFPSGroup, SIGNAL(activated(int)),
|
---|
1269 | core, SLOT(changeExternalSubFPS(int)) );
|
---|
1270 |
|
---|
1271 | // Titles
|
---|
1272 | titleGroup = new MyActionGroup(this);
|
---|
1273 | connect( titleGroup, SIGNAL(activated(int)),
|
---|
1274 | core, SLOT(changeTitle(int)) );
|
---|
1275 |
|
---|
1276 | // Angles
|
---|
1277 | angleGroup = new MyActionGroup(this);
|
---|
1278 | connect( angleGroup, SIGNAL(activated(int)),
|
---|
1279 | core, SLOT(changeAngle(int)) );
|
---|
1280 |
|
---|
1281 | // Chapters
|
---|
1282 | chapterGroup = new MyActionGroup(this);
|
---|
1283 | connect( chapterGroup, SIGNAL(activated(int)),
|
---|
1284 | core, SLOT(changeChapter(int)) );
|
---|
1285 |
|
---|
1286 | #ifdef BOOKMARKS
|
---|
1287 | // Bookmarks
|
---|
1288 | bookmarkGroup = new MyActionGroup(this);
|
---|
1289 | connect( bookmarkGroup, SIGNAL(activated(int)),
|
---|
1290 | core, SLOT(goToSec(int)) );
|
---|
1291 |
|
---|
1292 | addBookmarkAct = new MyAction(Qt::CTRL | Qt::Key_A, this, "add_bookmark");
|
---|
1293 | connect(addBookmarkAct, SIGNAL(triggered()), this, SLOT(showAddBookmarkDialog()));
|
---|
1294 |
|
---|
1295 | editBookmarksAct = new MyAction(this, "edit_bookmarks");
|
---|
1296 | connect(editBookmarksAct, SIGNAL(triggered()), this, SLOT(showBookmarkDialog()));
|
---|
1297 |
|
---|
1298 | prevBookmarkAct = new MyAction(Qt::CTRL | Qt::Key_B, this, "prev_bookmark");
|
---|
1299 | connect(prevBookmarkAct, SIGNAL(triggered()), core, SLOT(prevBookmark()));
|
---|
1300 |
|
---|
1301 | nextBookmarkAct = new MyAction(Qt::CTRL | Qt::Key_N, this, "next_bookmark");
|
---|
1302 | connect(nextBookmarkAct, SIGNAL(triggered()), core, SLOT(nextBookmark()));
|
---|
1303 | #endif
|
---|
1304 |
|
---|
1305 | #if DVDNAV_SUPPORT
|
---|
1306 | dvdnavUpAct = new MyAction(Qt::SHIFT | Qt::Key_Up, this, "dvdnav_up");
|
---|
1307 | connect( dvdnavUpAct, SIGNAL(triggered()), core, SLOT(dvdnavUp()) );
|
---|
1308 |
|
---|
1309 | dvdnavDownAct = new MyAction(Qt::SHIFT | Qt::Key_Down, this, "dvdnav_down");
|
---|
1310 | connect( dvdnavDownAct, SIGNAL(triggered()), core, SLOT(dvdnavDown()) );
|
---|
1311 |
|
---|
1312 | dvdnavLeftAct = new MyAction(Qt::SHIFT | Qt::Key_Left, this, "dvdnav_left");
|
---|
1313 | connect( dvdnavLeftAct, SIGNAL(triggered()), core, SLOT(dvdnavLeft()) );
|
---|
1314 |
|
---|
1315 | dvdnavRightAct = new MyAction(Qt::SHIFT | Qt::Key_Right, this, "dvdnav_right");
|
---|
1316 | connect( dvdnavRightAct, SIGNAL(triggered()), core, SLOT(dvdnavRight()) );
|
---|
1317 |
|
---|
1318 | dvdnavMenuAct = new MyAction(Qt::SHIFT | Qt::Key_Return, this, "dvdnav_menu");
|
---|
1319 | connect( dvdnavMenuAct, SIGNAL(triggered()), core, SLOT(dvdnavMenu()) );
|
---|
1320 |
|
---|
1321 | dvdnavSelectAct = new MyAction(Qt::Key_Return, this, "dvdnav_select");
|
---|
1322 | connect( dvdnavSelectAct, SIGNAL(triggered()), core, SLOT(dvdnavSelect()) );
|
---|
1323 |
|
---|
1324 | dvdnavPrevAct = new MyAction(Qt::SHIFT | Qt::Key_Escape, this, "dvdnav_prev");
|
---|
1325 | connect( dvdnavPrevAct, SIGNAL(triggered()), core, SLOT(dvdnavPrev()) );
|
---|
1326 |
|
---|
1327 | dvdnavMouseAct = new MyAction( this, "dvdnav_mouse");
|
---|
1328 | connect( dvdnavMouseAct, SIGNAL(triggered()), core, SLOT(dvdnavMouse()) );
|
---|
1329 | #endif
|
---|
1330 |
|
---|
1331 | }
|
---|
1332 |
|
---|
1333 | #if AUTODISABLE_ACTIONS
|
---|
1334 | void BaseGui::setActionsEnabled(bool b) {
|
---|
1335 | // Menu Play
|
---|
1336 | playAct->setEnabled(b);
|
---|
1337 | playOrPauseAct->setEnabled(b);
|
---|
1338 | pauseAct->setEnabled(b);
|
---|
1339 | pauseAndStepAct->setEnabled(b);
|
---|
1340 | stopAct->setEnabled(b);
|
---|
1341 | frameStepAct->setEnabled(b);
|
---|
1342 | frameBackStepAct->setEnabled(b);
|
---|
1343 | rewind1Act->setEnabled(b);
|
---|
1344 | rewind2Act->setEnabled(b);
|
---|
1345 | rewind3Act->setEnabled(b);
|
---|
1346 | forward1Act->setEnabled(b);
|
---|
1347 | forward2Act->setEnabled(b);
|
---|
1348 | forward3Act->setEnabled(b);
|
---|
1349 | //repeatAct->setEnabled(b);
|
---|
1350 | gotoAct->setEnabled(b);
|
---|
1351 |
|
---|
1352 | // Menu Speed
|
---|
1353 | normalSpeedAct->setEnabled(b);
|
---|
1354 | halveSpeedAct->setEnabled(b);
|
---|
1355 | doubleSpeedAct->setEnabled(b);
|
---|
1356 | decSpeed10Act->setEnabled(b);
|
---|
1357 | incSpeed10Act->setEnabled(b);
|
---|
1358 | decSpeed4Act->setEnabled(b);
|
---|
1359 | incSpeed4Act->setEnabled(b);
|
---|
1360 | decSpeed1Act->setEnabled(b);
|
---|
1361 | incSpeed1Act->setEnabled(b);
|
---|
1362 |
|
---|
1363 | // Menu Video
|
---|
1364 | videoEqualizerAct->setEnabled(b);
|
---|
1365 | screenshotAct->setEnabled(b);
|
---|
1366 | screenshotsAct->setEnabled(b);
|
---|
1367 | #ifdef CAPTURE_STREAM
|
---|
1368 | capturingAct->setEnabled(b);
|
---|
1369 | #endif
|
---|
1370 | flipAct->setEnabled(b);
|
---|
1371 | mirrorAct->setEnabled(b);
|
---|
1372 | stereo3dAct->setEnabled(b);
|
---|
1373 | postProcessingAct->setEnabled(b);
|
---|
1374 | phaseAct->setEnabled(b);
|
---|
1375 | deblockAct->setEnabled(b);
|
---|
1376 | deringAct->setEnabled(b);
|
---|
1377 | gradfunAct->setEnabled(b);
|
---|
1378 | addNoiseAct->setEnabled(b);
|
---|
1379 | addLetterboxAct->setEnabled(b);
|
---|
1380 | upscaleAct->setEnabled(b);
|
---|
1381 |
|
---|
1382 | // Menu Audio
|
---|
1383 | audioEqualizerAct->setEnabled(b);
|
---|
1384 | muteAct->setEnabled(b);
|
---|
1385 | decVolumeAct->setEnabled(b);
|
---|
1386 | incVolumeAct->setEnabled(b);
|
---|
1387 | decAudioDelayAct->setEnabled(b);
|
---|
1388 | incAudioDelayAct->setEnabled(b);
|
---|
1389 | audioDelayAct->setEnabled(b);
|
---|
1390 | extrastereoAct->setEnabled(b);
|
---|
1391 | #ifdef MPLAYER_SUPPORT
|
---|
1392 | karaokeAct->setEnabled(b);
|
---|
1393 | #endif
|
---|
1394 | volnormAct->setEnabled(b);
|
---|
1395 | loadAudioAct->setEnabled(b);
|
---|
1396 | //unloadAudioAct->setEnabled(b);
|
---|
1397 |
|
---|
1398 | // Menu Subtitles
|
---|
1399 | loadSubsAct->setEnabled(b);
|
---|
1400 | //unloadSubsAct->setEnabled(b);
|
---|
1401 | decSubDelayAct->setEnabled(b);
|
---|
1402 | incSubDelayAct->setEnabled(b);
|
---|
1403 | subDelayAct->setEnabled(b);
|
---|
1404 | decSubPosAct->setEnabled(b);
|
---|
1405 | incSubPosAct->setEnabled(b);
|
---|
1406 | incSubStepAct->setEnabled(b);
|
---|
1407 | decSubStepAct->setEnabled(b);
|
---|
1408 | incSubScaleAct->setEnabled(b);
|
---|
1409 | decSubScaleAct->setEnabled(b);
|
---|
1410 | #ifdef MPV_SUPPORT
|
---|
1411 | seekNextSubAct->setEnabled(b);
|
---|
1412 | seekPrevSubAct->setEnabled(b);
|
---|
1413 | #endif
|
---|
1414 |
|
---|
1415 | // Actions not in menus
|
---|
1416 | #if !USE_MULTIPLE_SHORTCUTS
|
---|
1417 | decVolume2Act->setEnabled(b);
|
---|
1418 | incVolume2Act->setEnabled(b);
|
---|
1419 | #endif
|
---|
1420 | decContrastAct->setEnabled(b);
|
---|
1421 | incContrastAct->setEnabled(b);
|
---|
1422 | decBrightnessAct->setEnabled(b);
|
---|
1423 | incBrightnessAct->setEnabled(b);
|
---|
1424 | decHueAct->setEnabled(b);
|
---|
1425 | incHueAct->setEnabled(b);
|
---|
1426 | decSaturationAct->setEnabled(b);
|
---|
1427 | incSaturationAct->setEnabled(b);
|
---|
1428 | decGammaAct->setEnabled(b);
|
---|
1429 | incGammaAct->setEnabled(b);
|
---|
1430 | nextVideoAct->setEnabled(b);
|
---|
1431 | nextAudioAct->setEnabled(b);
|
---|
1432 | nextSubtitleAct->setEnabled(b);
|
---|
1433 | nextChapterAct->setEnabled(b);
|
---|
1434 | prevChapterAct->setEnabled(b);
|
---|
1435 | doubleSizeAct->setEnabled(b);
|
---|
1436 |
|
---|
1437 | // Moving and zoom
|
---|
1438 | moveUpAct->setEnabled(b);
|
---|
1439 | moveDownAct->setEnabled(b);
|
---|
1440 | moveLeftAct->setEnabled(b);
|
---|
1441 | moveRightAct->setEnabled(b);
|
---|
1442 | incZoomAct->setEnabled(b);
|
---|
1443 | decZoomAct->setEnabled(b);
|
---|
1444 | resetZoomAct->setEnabled(b);
|
---|
1445 | autoZoomAct->setEnabled(b);
|
---|
1446 | autoZoom169Act->setEnabled(b);
|
---|
1447 | autoZoom235Act->setEnabled(b);
|
---|
1448 |
|
---|
1449 | #if DVDNAV_SUPPORT
|
---|
1450 | dvdnavUpAct->setEnabled(b);
|
---|
1451 | dvdnavDownAct->setEnabled(b);
|
---|
1452 | dvdnavLeftAct->setEnabled(b);
|
---|
1453 | dvdnavRightAct->setEnabled(b);
|
---|
1454 | dvdnavMenuAct->setEnabled(b);
|
---|
1455 | dvdnavSelectAct->setEnabled(b);
|
---|
1456 | dvdnavPrevAct->setEnabled(b);
|
---|
1457 | dvdnavMouseAct->setEnabled(b);
|
---|
1458 | #endif
|
---|
1459 |
|
---|
1460 | // Groups
|
---|
1461 | denoiseGroup->setActionsEnabled(b);
|
---|
1462 | unsharpGroup->setActionsEnabled(b);
|
---|
1463 | sizeGroup->setActionsEnabled(b);
|
---|
1464 | deinterlaceGroup->setActionsEnabled(b);
|
---|
1465 | aspectGroup->setActionsEnabled(b);
|
---|
1466 | rotateGroup->setActionsEnabled(b);
|
---|
1467 | #if USE_ADAPTER
|
---|
1468 | screenGroup->setActionsEnabled(b);
|
---|
1469 | #endif
|
---|
1470 | channelsGroup->setActionsEnabled(b);
|
---|
1471 | stereoGroup->setActionsEnabled(b);
|
---|
1472 | }
|
---|
1473 |
|
---|
1474 | void BaseGui::enableActionsOnPlaying() {
|
---|
1475 | qDebug("BaseGui::enableActionsOnPlaying");
|
---|
1476 |
|
---|
1477 | setActionsEnabled(true);
|
---|
1478 |
|
---|
1479 | playAct->setEnabled(false);
|
---|
1480 |
|
---|
1481 | // Screenshot option
|
---|
1482 | bool screenshots_enabled = ( (pref->use_screenshot) &&
|
---|
1483 | (!pref->screenshot_directory.isEmpty()) &&
|
---|
1484 | (QFileInfo(pref->screenshot_directory).isDir()) );
|
---|
1485 |
|
---|
1486 | screenshotAct->setEnabled( screenshots_enabled );
|
---|
1487 | screenshotsAct->setEnabled( screenshots_enabled );
|
---|
1488 |
|
---|
1489 | #ifdef CAPTURE_STREAM
|
---|
1490 | capturingAct->setEnabled(!pref->capture_directory.isEmpty() && QFileInfo(pref->capture_directory).isDir());
|
---|
1491 | #endif
|
---|
1492 |
|
---|
1493 | // Disable the compact action if not using video window
|
---|
1494 | compactAct->setEnabled( panel->isVisible() );
|
---|
1495 |
|
---|
1496 | // Enable or disable the audio equalizer
|
---|
1497 | audioEqualizerAct->setEnabled(pref->use_audio_equalizer);
|
---|
1498 |
|
---|
1499 | // Disable audio actions if there's not audio track
|
---|
1500 | if ((core->mdat.audios.numItems()==0) && (core->mset.external_audio.isEmpty())) {
|
---|
1501 | audioEqualizerAct->setEnabled(false);
|
---|
1502 | muteAct->setEnabled(false);
|
---|
1503 | decVolumeAct->setEnabled(false);
|
---|
1504 | incVolumeAct->setEnabled(false);
|
---|
1505 | decAudioDelayAct->setEnabled(false);
|
---|
1506 | incAudioDelayAct->setEnabled(false);
|
---|
1507 | audioDelayAct->setEnabled(false);
|
---|
1508 | extrastereoAct->setEnabled(false);
|
---|
1509 | #ifdef MPLAYER_SUPPORT
|
---|
1510 | karaokeAct->setEnabled(false);
|
---|
1511 | #endif
|
---|
1512 | volnormAct->setEnabled(false);
|
---|
1513 | channelsGroup->setActionsEnabled(false);
|
---|
1514 | stereoGroup->setActionsEnabled(false);
|
---|
1515 | }
|
---|
1516 |
|
---|
1517 | // Disable video actions if it's an audio file
|
---|
1518 | if (core->mdat.novideo) {
|
---|
1519 | videoEqualizerAct->setEnabled(false);
|
---|
1520 | screenshotAct->setEnabled(false);
|
---|
1521 | screenshotsAct->setEnabled(false);
|
---|
1522 | #ifdef CAPTURE_STREAM
|
---|
1523 | capturingAct->setEnabled(false);
|
---|
1524 | #endif
|
---|
1525 | flipAct->setEnabled(false);
|
---|
1526 | mirrorAct->setEnabled(false);
|
---|
1527 | stereo3dAct->setEnabled(false);
|
---|
1528 | postProcessingAct->setEnabled(false);
|
---|
1529 | phaseAct->setEnabled(false);
|
---|
1530 | deblockAct->setEnabled(false);
|
---|
1531 | deringAct->setEnabled(false);
|
---|
1532 | gradfunAct->setEnabled(false);
|
---|
1533 | addNoiseAct->setEnabled(false);
|
---|
1534 | addLetterboxAct->setEnabled(false);
|
---|
1535 | upscaleAct->setEnabled(false);
|
---|
1536 | doubleSizeAct->setEnabled(false);
|
---|
1537 |
|
---|
1538 | // Moving and zoom
|
---|
1539 | moveUpAct->setEnabled(false);
|
---|
1540 | moveDownAct->setEnabled(false);
|
---|
1541 | moveLeftAct->setEnabled(false);
|
---|
1542 | moveRightAct->setEnabled(false);
|
---|
1543 | incZoomAct->setEnabled(false);
|
---|
1544 | decZoomAct->setEnabled(false);
|
---|
1545 | resetZoomAct->setEnabled(false);
|
---|
1546 | autoZoomAct->setEnabled(false);
|
---|
1547 | autoZoom169Act->setEnabled(false);
|
---|
1548 | autoZoom235Act->setEnabled(false);
|
---|
1549 |
|
---|
1550 | denoiseGroup->setActionsEnabled(false);
|
---|
1551 | unsharpGroup->setActionsEnabled(false);
|
---|
1552 | sizeGroup->setActionsEnabled(false);
|
---|
1553 | deinterlaceGroup->setActionsEnabled(false);
|
---|
1554 | aspectGroup->setActionsEnabled(false);
|
---|
1555 | rotateGroup->setActionsEnabled(false);
|
---|
1556 | #if USE_ADAPTER
|
---|
1557 | screenGroup->setActionsEnabled(false);
|
---|
1558 | #endif
|
---|
1559 | }
|
---|
1560 |
|
---|
1561 | #if USE_ADAPTER
|
---|
1562 | screenGroup->setActionsEnabled(pref->vo.startsWith(OVERLAY_VO));
|
---|
1563 | #endif
|
---|
1564 |
|
---|
1565 | #ifndef Q_OS_WIN
|
---|
1566 | // Disable video filters if using vdpau
|
---|
1567 | if ((pref->vdpau.disable_video_filters) && (pref->vo.startsWith("vdpau"))) {
|
---|
1568 | screenshotAct->setEnabled(false);
|
---|
1569 | screenshotsAct->setEnabled(false);
|
---|
1570 | flipAct->setEnabled(false);
|
---|
1571 | mirrorAct->setEnabled(false);
|
---|
1572 | stereo3dAct->setEnabled(false);
|
---|
1573 | postProcessingAct->setEnabled(false);
|
---|
1574 | phaseAct->setEnabled(false);
|
---|
1575 | deblockAct->setEnabled(false);
|
---|
1576 | deringAct->setEnabled(false);
|
---|
1577 | gradfunAct->setEnabled(false);
|
---|
1578 | addNoiseAct->setEnabled(false);
|
---|
1579 | addLetterboxAct->setEnabled(false);
|
---|
1580 | upscaleAct->setEnabled(false);
|
---|
1581 |
|
---|
1582 | deinterlaceGroup->setActionsEnabled(false);
|
---|
1583 | rotateGroup->setActionsEnabled(false);
|
---|
1584 | denoiseGroup->setActionsEnabled(false);
|
---|
1585 | unsharpGroup->setActionsEnabled(false);
|
---|
1586 |
|
---|
1587 | displayMessage( tr("Video filters are disabled when using vdpau") );
|
---|
1588 | }
|
---|
1589 | #endif
|
---|
1590 |
|
---|
1591 | #if DVDNAV_SUPPORT
|
---|
1592 | if (!core->mdat.filename.startsWith("dvdnav:")) {
|
---|
1593 | dvdnavUpAct->setEnabled(false);
|
---|
1594 | dvdnavDownAct->setEnabled(false);
|
---|
1595 | dvdnavLeftAct->setEnabled(false);
|
---|
1596 | dvdnavRightAct->setEnabled(false);
|
---|
1597 | dvdnavMenuAct->setEnabled(false);
|
---|
1598 | dvdnavSelectAct->setEnabled(false);
|
---|
1599 | dvdnavPrevAct->setEnabled(false);
|
---|
1600 | dvdnavMouseAct->setEnabled(false);
|
---|
1601 | }
|
---|
1602 | #endif
|
---|
1603 |
|
---|
1604 |
|
---|
1605 | #ifdef BOOKMARKS
|
---|
1606 | if (pref->dont_remember_media_settings || core->mdat.type != TYPE_FILE) {
|
---|
1607 | addBookmarkAct->setEnabled(false);
|
---|
1608 | editBookmarksAct->setEnabled(false);
|
---|
1609 | } else {
|
---|
1610 | addBookmarkAct->setEnabled(true);
|
---|
1611 | editBookmarksAct->setEnabled(true);
|
---|
1612 | }
|
---|
1613 | #endif
|
---|
1614 | }
|
---|
1615 |
|
---|
1616 | void BaseGui::disableActionsOnStop() {
|
---|
1617 | qDebug("BaseGui::disableActionsOnStop");
|
---|
1618 |
|
---|
1619 | setActionsEnabled(false);
|
---|
1620 |
|
---|
1621 | playAct->setEnabled(true);
|
---|
1622 | playOrPauseAct->setEnabled(true);
|
---|
1623 | stopAct->setEnabled(true);
|
---|
1624 | }
|
---|
1625 | #endif // AUTODISABLE_ACTIONS
|
---|
1626 |
|
---|
1627 | void BaseGui::togglePlayAction(Core::State state) {
|
---|
1628 | qDebug("BaseGui::togglePlayAction");
|
---|
1629 |
|
---|
1630 | #if AUTODISABLE_ACTIONS
|
---|
1631 | if (state == Core::Playing)
|
---|
1632 | playAct->setEnabled(false);
|
---|
1633 | else
|
---|
1634 | playAct->setEnabled(true);
|
---|
1635 | #endif
|
---|
1636 | }
|
---|
1637 |
|
---|
1638 | void BaseGui::retranslateStrings() {
|
---|
1639 | setWindowIcon( Images::icon("logo", 64) );
|
---|
1640 |
|
---|
1641 | // ACTIONS
|
---|
1642 |
|
---|
1643 | // Menu File
|
---|
1644 | openFileAct->change( Images::icon("open"), tr("&File...") );
|
---|
1645 | openDirectoryAct->change( Images::icon("openfolder"), tr("D&irectory...") );
|
---|
1646 | openPlaylistAct->change( Images::icon("open_playlist"), tr("&Playlist...") );
|
---|
1647 | openVCDAct->change( Images::icon("vcd"), tr("V&CD") );
|
---|
1648 | openAudioCDAct->change( Images::icon("cdda"), tr("&Audio CD") );
|
---|
1649 | openDVDAct->change( Images::icon("dvd"), tr("&DVD from drive") );
|
---|
1650 | openDVDFolderAct->change( Images::icon("dvd_hd"), tr("D&VD from folder...") );
|
---|
1651 | #ifdef BLURAY_SUPPORT
|
---|
1652 | openBluRayAct->change( Images::icon("bluray"), tr("&Blu-ray from drive") );
|
---|
1653 | openBluRayFolderAct->change( Images::icon("bluray_hd"), tr("Blu-&ray from folder...") );
|
---|
1654 | #endif
|
---|
1655 | openURLAct->change( Images::icon("url"), tr("&URL...") );
|
---|
1656 | exitAct->change( Images::icon("close"), tr("C&lose") );
|
---|
1657 |
|
---|
1658 | // Favorites
|
---|
1659 | /*
|
---|
1660 | favorites->editAct()->setText( tr("&Edit...") );
|
---|
1661 | favorites->addCurrentAct()->setText( tr("&Add current media") );
|
---|
1662 | */
|
---|
1663 |
|
---|
1664 | // TV & Radio submenus
|
---|
1665 | /*
|
---|
1666 | tvlist->editAct()->setText( tr("&Edit...") );
|
---|
1667 | radiolist->editAct()->setText( tr("&Edit...") );
|
---|
1668 | tvlist->addCurrentAct()->setText( tr("&Add current media") );
|
---|
1669 | radiolist->addCurrentAct()->setText( tr("&Add current media") );
|
---|
1670 | tvlist->jumpAct()->setText( tr("&Jump...") );
|
---|
1671 | radiolist->jumpAct()->setText( tr("&Jump...") );
|
---|
1672 | tvlist->nextAct()->setText( tr("Next TV channel") );
|
---|
1673 | tvlist->previousAct()->setText( tr("Previous TV channel") );
|
---|
1674 | radiolist->nextAct()->setText( tr("Next radio channel") );
|
---|
1675 | radiolist->previousAct()->setText( tr("Previous radio channel") );
|
---|
1676 | */
|
---|
1677 |
|
---|
1678 | // Menu Play
|
---|
1679 | playAct->change( tr("P&lay") );
|
---|
1680 | playAct->setIcon( Images::icon("play") );
|
---|
1681 |
|
---|
1682 | pauseAct->change( Images::icon("pause"), tr("&Pause"));
|
---|
1683 | stopAct->change( Images::icon("stop"), tr("&Stop") );
|
---|
1684 | frameStepAct->change( Images::icon("frame_step"), tr("&Frame step") );
|
---|
1685 | frameBackStepAct->change( Images::icon("frame_back_step"), tr("Fra&me back step") );
|
---|
1686 |
|
---|
1687 | playOrPauseAct->change( tr("Play / Pause") );
|
---|
1688 | playOrPauseAct->setIcon( Images::icon("play_pause") );
|
---|
1689 |
|
---|
1690 | pauseAndStepAct->change( Images::icon("pause"), tr("Pause / Frame step") );
|
---|
1691 |
|
---|
1692 | setJumpTexts(); // Texts for rewind*Act and forward*Act
|
---|
1693 |
|
---|
1694 | // Submenu A-B
|
---|
1695 | setAMarkerAct->change( Images::icon("a_marker"), tr("Set &A marker") );
|
---|
1696 | setBMarkerAct->change( Images::icon("b_marker"), tr("Set &B marker") );
|
---|
1697 | clearABMarkersAct->change( Images::icon("clear_markers"), tr("&Clear A-B markers") );
|
---|
1698 | repeatAct->change( Images::icon("repeat"), tr("&Repeat") );
|
---|
1699 |
|
---|
1700 | gotoAct->change( Images::icon("jumpto"), tr("&Jump to...") );
|
---|
1701 |
|
---|
1702 | // Submenu speed
|
---|
1703 | normalSpeedAct->change( tr("&Normal speed") );
|
---|
1704 | halveSpeedAct->change( tr("&Half speed") );
|
---|
1705 | doubleSpeedAct->change( tr("&Double speed") );
|
---|
1706 | decSpeed10Act->change( tr("Speed &-10%") );
|
---|
1707 | incSpeed10Act->change( tr("Speed &+10%") );
|
---|
1708 | decSpeed4Act->change( tr("Speed -&4%") );
|
---|
1709 | incSpeed4Act->change( tr("&Speed +4%") );
|
---|
1710 | decSpeed1Act->change( tr("Speed -&1%") );
|
---|
1711 | incSpeed1Act->change( tr("S&peed +1%") );
|
---|
1712 |
|
---|
1713 | // Menu Video
|
---|
1714 | fullscreenAct->change( Images::icon("fullscreen"), tr("&Fullscreen") );
|
---|
1715 | compactAct->change( Images::icon("compact"), tr("&Compact mode") );
|
---|
1716 | videoEqualizerAct->change( Images::icon("equalizer"), tr("&Equalizer") );
|
---|
1717 | screenshotAct->change( Images::icon("screenshot"), tr("&Screenshot") );
|
---|
1718 | screenshotsAct->change( Images::icon("screenshots"), tr("Start/stop takin&g screenshots") );
|
---|
1719 | #ifdef CAPTURE_STREAM
|
---|
1720 | capturingAct->change(Images::icon("record"), tr("Start/stop capturing stream"));
|
---|
1721 | #endif
|
---|
1722 | #ifdef VIDEOPREVIEW
|
---|
1723 | videoPreviewAct->change( Images::icon("video_preview"), tr("Thumb&nail Generator...") );
|
---|
1724 | #endif
|
---|
1725 | flipAct->change( Images::icon("flip"), tr("Fli&p image") );
|
---|
1726 | mirrorAct->change( Images::icon("mirror"), tr("Mirr&or image") );
|
---|
1727 | stereo3dAct->change( Images::icon("stereo3d"), tr("Stereo &3D filter") );
|
---|
1728 |
|
---|
1729 | decZoomAct->change( tr("Zoom &-") );
|
---|
1730 | incZoomAct->change( tr("Zoom &+") );
|
---|
1731 | resetZoomAct->change( tr("&Reset") );
|
---|
1732 | autoZoomAct->change( tr("&Auto zoom") );
|
---|
1733 | autoZoom169Act->change( tr("Zoom for &16:9") );
|
---|
1734 | autoZoom235Act->change( tr("Zoom for &2.35:1") );
|
---|
1735 | moveLeftAct->change( tr("Move &left") );
|
---|
1736 | moveRightAct->change( tr("Move &right") );
|
---|
1737 | moveUpAct->change( tr("Move &up") );
|
---|
1738 | moveDownAct->change( tr("Move &down") );
|
---|
1739 |
|
---|
1740 | // Submenu Filters
|
---|
1741 | postProcessingAct->change( tr("&Postprocessing") );
|
---|
1742 | phaseAct->change( tr("&Autodetect phase") );
|
---|
1743 | deblockAct->change( tr("&Deblock") );
|
---|
1744 | deringAct->change( tr("De&ring") );
|
---|
1745 | gradfunAct->change( tr("Debanding (&gradfun)") );
|
---|
1746 | addNoiseAct->change( tr("Add n&oise") );
|
---|
1747 | addLetterboxAct->change( Images::icon("letterbox"), tr("Add &black borders") );
|
---|
1748 | upscaleAct->change( Images::icon("upscaling"), tr("Soft&ware scaling") );
|
---|
1749 |
|
---|
1750 | // Menu Audio
|
---|
1751 | audioEqualizerAct->change( Images::icon("audio_equalizer"), tr("E&qualizer") );
|
---|
1752 | QIcon icset( Images::icon("volume") );
|
---|
1753 | icset.addPixmap( Images::icon("mute"), QIcon::Normal, QIcon::On );
|
---|
1754 | muteAct->change( icset, tr("&Mute") );
|
---|
1755 | decVolumeAct->change( Images::icon("audio_down"), tr("Volume &-") );
|
---|
1756 | incVolumeAct->change( Images::icon("audio_up"), tr("Volume &+") );
|
---|
1757 | decAudioDelayAct->change( Images::icon("delay_down"), tr("&Delay -") );
|
---|
1758 | incAudioDelayAct->change( Images::icon("delay_up"), tr("D&elay +") );
|
---|
1759 | audioDelayAct->change( Images::icon("audio_delay"), tr("Set dela&y...") );
|
---|
1760 | loadAudioAct->change( Images::icon("open"), tr("&Load external file...") );
|
---|
1761 | unloadAudioAct->change( Images::icon("unload"), tr("U&nload") );
|
---|
1762 |
|
---|
1763 | // Submenu Filters
|
---|
1764 | extrastereoAct->change( tr("&Extrastereo") );
|
---|
1765 | #ifdef MPLAYER_SUPPORT
|
---|
1766 | karaokeAct->change( tr("&Karaoke") );
|
---|
1767 | #endif
|
---|
1768 | volnormAct->change( tr("Volume &normalization") );
|
---|
1769 |
|
---|
1770 | // Menu Subtitles
|
---|
1771 | loadSubsAct->change( Images::icon("open"), tr("&Load...") );
|
---|
1772 | unloadSubsAct->change( Images::icon("unload"), tr("U&nload") );
|
---|
1773 | decSubDelayAct->change( Images::icon("delay_down"), tr("Delay &-") );
|
---|
1774 | incSubDelayAct->change( Images::icon("delay_up"), tr("Delay &+") );
|
---|
1775 | subDelayAct->change( Images::icon("sub_delay"), tr("Se&t delay...") );
|
---|
1776 | decSubPosAct->change( Images::icon("sub_up"), tr("&Up") );
|
---|
1777 | incSubPosAct->change( Images::icon("sub_down"), tr("&Down") );
|
---|
1778 | decSubScaleAct->change( Images::icon("dec_sub_scale"), tr("S&ize -") );
|
---|
1779 | incSubScaleAct->change( Images::icon("inc_sub_scale"), tr("Si&ze +") );
|
---|
1780 | decSubStepAct->change( Images::icon("dec_sub_step"),
|
---|
1781 | tr("&Previous line in subtitles") );
|
---|
1782 | incSubStepAct->change( Images::icon("inc_sub_step"),
|
---|
1783 | tr("N&ext line in subtitles") );
|
---|
1784 | #ifdef MPV_SUPPORT
|
---|
1785 | seekNextSubAct->change(Images::icon("seek_next_sub"), tr("Seek to next subtitle"));
|
---|
1786 | seekPrevSubAct->change(Images::icon("seek_prev_sub"), tr("Seek to previous subtitle"));
|
---|
1787 | #endif
|
---|
1788 | useCustomSubStyleAct->change( Images::icon("use_custom_sub_style"), tr("Use custo&m style") );
|
---|
1789 | useForcedSubsOnlyAct->change( Images::icon("forced_subs"), tr("&Forced subtitles only") );
|
---|
1790 |
|
---|
1791 | subVisibilityAct->change( Images::icon("sub_visibility"), tr("Subtitle &visibility") );
|
---|
1792 |
|
---|
1793 | #ifdef FIND_SUBTITLES
|
---|
1794 | showFindSubtitlesDialogAct->change( Images::icon("download_subs"), tr("Find subtitles at &OpenSubtitles.org...") );
|
---|
1795 | openUploadSubtitlesPageAct->change( Images::icon("upload_subs"), tr("Upload su&btitles to OpenSubtitles.org...") );
|
---|
1796 | #endif
|
---|
1797 |
|
---|
1798 | ccNoneAct->change( tr("&Off", "closed captions menu") );
|
---|
1799 | ccChannel1Act->change( "&1" );
|
---|
1800 | ccChannel2Act->change( "&2" );
|
---|
1801 | ccChannel3Act->change( "&3" );
|
---|
1802 | ccChannel4Act->change( "&4" );
|
---|
1803 |
|
---|
1804 | subFPSNoneAct->change( tr("&Default", "subfps menu") );
|
---|
1805 | /* subFPS23Act->change( "2&3" ); */
|
---|
1806 | subFPS23976Act->change( "23.9&76" );
|
---|
1807 | subFPS24Act->change( "2&4" );
|
---|
1808 | subFPS25Act->change( "2&5" );
|
---|
1809 | subFPS29970Act->change( "29.&970" );
|
---|
1810 | subFPS30Act->change( "3&0" );
|
---|
1811 |
|
---|
1812 | // Menu Options
|
---|
1813 | showPlaylistAct->change( Images::icon("playlist"), tr("&Playlist") );
|
---|
1814 | showPropertiesAct->change( Images::icon("info"), tr("View &info and properties...") );
|
---|
1815 | showPreferencesAct->change( Images::icon("prefs"), tr("P&references") );
|
---|
1816 | #ifdef YOUTUBE_SUPPORT
|
---|
1817 | showTubeBrowserAct->change( Images::icon("tubebrowser"), tr("&YouTube%1 browser").arg(QChar(0x2122)) );
|
---|
1818 | #endif
|
---|
1819 |
|
---|
1820 | // Submenu Logs
|
---|
1821 | #ifdef LOG_MPLAYER
|
---|
1822 | showLogMplayerAct->change(PLAYER_NAME);
|
---|
1823 | #endif
|
---|
1824 | #ifdef LOG_SMPLAYER
|
---|
1825 | showLogSmplayerAct->change( "SMPlayer" );
|
---|
1826 | #endif
|
---|
1827 |
|
---|
1828 | // Menu Help
|
---|
1829 | showFirstStepsAct->change( Images::icon("guide"), tr("First Steps &Guide") );
|
---|
1830 | showFAQAct->change( Images::icon("faq"), tr("&FAQ") );
|
---|
1831 | showCLOptionsAct->change( Images::icon("cl_help"), tr("&Command line options") );
|
---|
1832 | showCheckUpdatesAct->change( Images::icon("check_updates"), tr("Check for &updates") );
|
---|
1833 |
|
---|
1834 | #if defined(YOUTUBE_SUPPORT) && defined(YT_USE_YTSIG)
|
---|
1835 | updateYTAct->change( Images::icon("update_youtube"), tr("Update &Youtube code") );
|
---|
1836 | #endif
|
---|
1837 |
|
---|
1838 | showConfigAct->change( Images::icon("show_config"), tr("&Open configuration folder") );
|
---|
1839 | #ifdef SHARE_ACTIONS
|
---|
1840 | donateAct->change( Images::icon("donate"), tr("&Donate / Share with your friends") );
|
---|
1841 | #endif
|
---|
1842 | aboutThisAct->change( Images::icon("logo"), tr("About &SMPlayer") );
|
---|
1843 |
|
---|
1844 | #ifdef SHARE_MENU
|
---|
1845 | facebookAct->change("&Facebook");
|
---|
1846 | twitterAct->change("&Twitter");
|
---|
1847 | gmailAct->change("&Gmail");
|
---|
1848 | hotmailAct->change("&Hotmail");
|
---|
1849 | yahooAct->change("&Yahoo!");
|
---|
1850 | #endif
|
---|
1851 |
|
---|
1852 | // OSD
|
---|
1853 | incOSDScaleAct->change(tr("Size &+"));
|
---|
1854 | decOSDScaleAct->change(tr("Size &-"));
|
---|
1855 |
|
---|
1856 | // Playlist
|
---|
1857 | playNextAct->change( tr("&Next") );
|
---|
1858 | playPrevAct->change( tr("Pre&vious") );
|
---|
1859 |
|
---|
1860 | playNextAct->setIcon( Images::icon("next") );
|
---|
1861 | playPrevAct->setIcon( Images::icon("previous") );
|
---|
1862 |
|
---|
1863 |
|
---|
1864 | // Actions not in menus or buttons
|
---|
1865 | // Volume 2
|
---|
1866 | #if !USE_MULTIPLE_SHORTCUTS
|
---|
1867 | decVolume2Act->change( tr("Dec volume (2)") );
|
---|
1868 | incVolume2Act->change( tr("Inc volume (2)") );
|
---|
1869 | #endif
|
---|
1870 | // Exit fullscreen
|
---|
1871 | exitFullscreenAct->change( tr("Exit fullscreen") );
|
---|
1872 |
|
---|
1873 | nextOSDAct->change( tr("OSD - Next level") );
|
---|
1874 | decContrastAct->change( tr("Dec contrast") );
|
---|
1875 | incContrastAct->change( tr("Inc contrast") );
|
---|
1876 | decBrightnessAct->change( tr("Dec brightness") );
|
---|
1877 | incBrightnessAct->change( tr("Inc brightness") );
|
---|
1878 | decHueAct->change( tr("Dec hue") );
|
---|
1879 | incHueAct->change( tr("Inc hue") );
|
---|
1880 | decSaturationAct->change( tr("Dec saturation") );
|
---|
1881 | incSaturationAct->change( tr("Inc saturation") );
|
---|
1882 | decGammaAct->change( tr("Dec gamma") );
|
---|
1883 | incGammaAct->change( tr("Inc gamma") );
|
---|
1884 | nextVideoAct->change( tr("Next video") );
|
---|
1885 | nextAudioAct->change( tr("Next audio") );
|
---|
1886 | nextSubtitleAct->change( tr("Next subtitle") );
|
---|
1887 | nextChapterAct->change( tr("Next chapter") );
|
---|
1888 | prevChapterAct->change( tr("Previous chapter") );
|
---|
1889 | doubleSizeAct->change( tr("&Toggle double size") );
|
---|
1890 | resetVideoEqualizerAct->change( tr("Reset video equalizer") );
|
---|
1891 | resetAudioEqualizerAct->change( tr("Reset audio equalizer") );
|
---|
1892 | showContextMenuAct->change( tr("Show context menu") );
|
---|
1893 | nextAspectAct->change( Images::icon("next_aspect"), tr("Next aspect ratio") );
|
---|
1894 | nextWheelFunctionAct->change( Images::icon("next_wheel_function"), tr("Next wheel function") );
|
---|
1895 |
|
---|
1896 | showFilenameAct->change( tr("Show filename on OSD") );
|
---|
1897 | showTimeAct->change( tr("Show playback time on OSD") );
|
---|
1898 | toggleDeinterlaceAct->change( tr("Toggle deinterlacing") );
|
---|
1899 |
|
---|
1900 |
|
---|
1901 | // Action groups
|
---|
1902 | osdNoneAct->change( tr("Subtitles onl&y") );
|
---|
1903 | osdSeekAct->change( tr("Volume + &Seek") );
|
---|
1904 | osdTimerAct->change( tr("Volume + Seek + &Timer") );
|
---|
1905 | osdTotalAct->change( tr("Volume + Seek + Timer + T&otal time") );
|
---|
1906 |
|
---|
1907 |
|
---|
1908 | // MENUS
|
---|
1909 | openMenu->menuAction()->setText( tr("&Open") );
|
---|
1910 | playMenu->menuAction()->setText( tr("&Play") );
|
---|
1911 | videoMenu->menuAction()->setText( tr("&Video") );
|
---|
1912 | audioMenu->menuAction()->setText( tr("&Audio") );
|
---|
1913 | subtitlesMenu->menuAction()->setText( tr("&Subtitles") );
|
---|
1914 | browseMenu->menuAction()->setText( tr("&Browse") );
|
---|
1915 | optionsMenu->menuAction()->setText( tr("Op&tions") );
|
---|
1916 | helpMenu->menuAction()->setText( tr("&Help") );
|
---|
1917 |
|
---|
1918 | /*
|
---|
1919 | openMenuAct->setIcon( Images::icon("open_menu") );
|
---|
1920 | playMenuAct->setIcon( Images::icon("play_menu") );
|
---|
1921 | videoMenuAct->setIcon( Images::icon("video_menu") );
|
---|
1922 | audioMenuAct->setIcon( Images::icon("audio_menu") );
|
---|
1923 | subtitlesMenuAct->setIcon( Images::icon("subtitles_menu") );
|
---|
1924 | browseMenuAct->setIcon( Images::icon("browse_menu") );
|
---|
1925 | optionsMenuAct->setIcon( Images::icon("options_menu") );
|
---|
1926 | helpMenuAct->setIcon( Images::icon("help_menu") );
|
---|
1927 | */
|
---|
1928 |
|
---|
1929 | // Menu Open
|
---|
1930 | recentfiles_menu->menuAction()->setText( tr("&Recent files") );
|
---|
1931 | recentfiles_menu->menuAction()->setIcon( Images::icon("recents") );
|
---|
1932 | clearRecentsAct->change( Images::icon("delete"), tr("&Clear") );
|
---|
1933 |
|
---|
1934 | disc_menu->menuAction()->setText( tr("&Disc") );
|
---|
1935 | disc_menu->menuAction()->setIcon( Images::icon("open_disc") );
|
---|
1936 |
|
---|
1937 | /* favorites->menuAction()->setText( tr("&Favorites") ); */
|
---|
1938 | favorites->menuAction()->setText( tr("F&avorites") );
|
---|
1939 | favorites->menuAction()->setIcon( Images::icon("open_favorites") );
|
---|
1940 |
|
---|
1941 | tvlist->menuAction()->setText( tr("&TV") );
|
---|
1942 | tvlist->menuAction()->setIcon( Images::icon("open_tv") );
|
---|
1943 |
|
---|
1944 | radiolist->menuAction()->setText( tr("Radi&o") );
|
---|
1945 | radiolist->menuAction()->setIcon( Images::icon("open_radio") );
|
---|
1946 |
|
---|
1947 | // Menu Play
|
---|
1948 | speed_menu->menuAction()->setText( tr("Sp&eed") );
|
---|
1949 | speed_menu->menuAction()->setIcon( Images::icon("speed") );
|
---|
1950 |
|
---|
1951 | ab_menu->menuAction()->setText( tr("&A-B section") );
|
---|
1952 | ab_menu->menuAction()->setIcon( Images::icon("ab_menu") );
|
---|
1953 |
|
---|
1954 | // Menu Video
|
---|
1955 | videotrack_menu->menuAction()->setText( tr("&Track", "video") );
|
---|
1956 | videotrack_menu->menuAction()->setIcon( Images::icon("video_track") );
|
---|
1957 |
|
---|
1958 | videosize_menu->menuAction()->setText( tr("Si&ze") );
|
---|
1959 | videosize_menu->menuAction()->setIcon( Images::icon("video_size") );
|
---|
1960 |
|
---|
1961 | /*
|
---|
1962 | panscan_menu->menuAction()->setText( tr("&Pan && scan") );
|
---|
1963 | panscan_menu->menuAction()->setIcon( Images::icon("panscan") );
|
---|
1964 | */
|
---|
1965 | zoom_menu->menuAction()->setText( tr("Zoo&m") );
|
---|
1966 | zoom_menu->menuAction()->setIcon( Images::icon("zoom") );
|
---|
1967 |
|
---|
1968 | aspect_menu->menuAction()->setText( tr("&Aspect ratio") );
|
---|
1969 | aspect_menu->menuAction()->setIcon( Images::icon("aspect") );
|
---|
1970 |
|
---|
1971 | deinterlace_menu->menuAction()->setText( tr("&Deinterlace") );
|
---|
1972 | deinterlace_menu->menuAction()->setIcon( Images::icon("deinterlace") );
|
---|
1973 |
|
---|
1974 | videofilter_menu->menuAction()->setText( tr("F&ilters") );
|
---|
1975 | videofilter_menu->menuAction()->setIcon( Images::icon("video_filters") );
|
---|
1976 |
|
---|
1977 | rotate_menu->menuAction()->setText( tr("&Rotate") );
|
---|
1978 | rotate_menu->menuAction()->setIcon( Images::icon("rotate") );
|
---|
1979 |
|
---|
1980 | ontop_menu->menuAction()->setText( tr("S&tay on top") );
|
---|
1981 | ontop_menu->menuAction()->setIcon( Images::icon("ontop") );
|
---|
1982 |
|
---|
1983 | #if USE_ADAPTER
|
---|
1984 | screen_menu->menuAction()->setText( tr("Scree&n") );
|
---|
1985 | screen_menu->menuAction()->setIcon( Images::icon("screen") );
|
---|
1986 | #endif
|
---|
1987 |
|
---|
1988 | denoise_menu->menuAction()->setText( tr("De&noise") );
|
---|
1989 | denoise_menu->menuAction()->setIcon( Images::icon("denoise") );
|
---|
1990 |
|
---|
1991 | unsharp_menu->menuAction()->setText( tr("Blur/S&harp") );
|
---|
1992 | unsharp_menu->menuAction()->setIcon( Images::icon("unsharp") );
|
---|
1993 |
|
---|
1994 | aspectDetectAct->change( tr("&Auto") );
|
---|
1995 | aspect11Act->change( "1&:1" );
|
---|
1996 | aspect32Act->change( "&3:2" );
|
---|
1997 | aspect43Act->change( "&4:3" );
|
---|
1998 | aspect118Act->change( "11:&8" );
|
---|
1999 | aspect54Act->change( "&5:4" );
|
---|
2000 | aspect149Act->change( "&14:9" );
|
---|
2001 | aspect1410Act->change( "1&4:10" );
|
---|
2002 | aspect169Act->change( "16:&9" );
|
---|
2003 | aspect1610Act->change( "1&6:10" );
|
---|
2004 | aspect235Act->change( "&2.35:1" );
|
---|
2005 | aspectNoneAct->change( tr("&Disabled") );
|
---|
2006 |
|
---|
2007 | deinterlaceNoneAct->change( tr("&None") );
|
---|
2008 | deinterlaceL5Act->change( tr("&Lowpass5") );
|
---|
2009 | deinterlaceYadif0Act->change( tr("&Yadif (normal)") );
|
---|
2010 | deinterlaceYadif1Act->change( tr("Y&adif (double framerate)") );
|
---|
2011 | deinterlaceLBAct->change( tr("Linear &Blend") );
|
---|
2012 | deinterlaceKernAct->change( tr("&Kerndeint") );
|
---|
2013 |
|
---|
2014 | denoiseNoneAct->change( tr("&Off", "denoise menu") );
|
---|
2015 | denoiseNormalAct->change( tr("&Normal","denoise menu") );
|
---|
2016 | denoiseSoftAct->change( tr("&Soft", "denoise menu") );
|
---|
2017 |
|
---|
2018 | unsharpNoneAct->change( tr("&None", "unsharp menu") );
|
---|
2019 | blurAct->change( tr("&Blur", "unsharp menu") );
|
---|
2020 | sharpenAct->change( tr("&Sharpen", "unsharp menu") );
|
---|
2021 |
|
---|
2022 | rotateNoneAct->change( tr("&Off") );
|
---|
2023 | rotateClockwiseFlipAct->change( tr("&Rotate by 90 degrees clockwise and flip") );
|
---|
2024 | rotateClockwiseAct->change( tr("Rotate by 90 degrees &clockwise") );
|
---|
2025 | rotateCounterclockwiseAct->change( tr("Rotate by 90 degrees counterclock&wise") );
|
---|
2026 | rotateCounterclockwiseFlipAct->change( tr("Rotate by 90 degrees counterclockwise and &flip") );
|
---|
2027 |
|
---|
2028 | onTopAlwaysAct->change( tr("&Always") );
|
---|
2029 | onTopNeverAct->change( tr("&Never") );
|
---|
2030 | onTopWhilePlayingAct->change( tr("While &playing") );
|
---|
2031 | toggleStayOnTopAct->change( tr("Toggle stay on top") );
|
---|
2032 |
|
---|
2033 | #if USE_ADAPTER
|
---|
2034 | screenDefaultAct->change( tr("&Default") );
|
---|
2035 | #endif
|
---|
2036 |
|
---|
2037 | // Menu Audio
|
---|
2038 | audiotrack_menu->menuAction()->setText( tr("&Track", "audio") );
|
---|
2039 | audiotrack_menu->menuAction()->setIcon( Images::icon("audio_track") );
|
---|
2040 |
|
---|
2041 | audiofilter_menu->menuAction()->setText( tr("&Filters") );
|
---|
2042 | audiofilter_menu->menuAction()->setIcon( Images::icon("audio_filters") );
|
---|
2043 |
|
---|
2044 | audiochannels_menu->menuAction()->setText( tr("&Channels") );
|
---|
2045 | audiochannels_menu->menuAction()->setIcon( Images::icon("audio_channels") );
|
---|
2046 |
|
---|
2047 | stereomode_menu->menuAction()->setText( tr("&Stereo mode") );
|
---|
2048 | stereomode_menu->menuAction()->setIcon( Images::icon("stereo_mode") );
|
---|
2049 |
|
---|
2050 | /* channelsDefaultAct->change( tr("&Default") ); */
|
---|
2051 | channelsStereoAct->change( tr("&Stereo") );
|
---|
2052 | channelsSurroundAct->change( tr("&4.0 Surround") );
|
---|
2053 | channelsFull51Act->change( tr("&5.1 Surround") );
|
---|
2054 | channelsFull61Act->change( tr("&6.1 Surround") );
|
---|
2055 | channelsFull71Act->change( tr("&7.1 Surround") );
|
---|
2056 |
|
---|
2057 | stereoAct->change( tr("&Stereo") );
|
---|
2058 | leftChannelAct->change( tr("&Left channel") );
|
---|
2059 | rightChannelAct->change( tr("&Right channel") );
|
---|
2060 | monoAct->change( tr("&Mono") );
|
---|
2061 | reverseAct->change( tr("Re&verse") );
|
---|
2062 |
|
---|
2063 | // Menu Subtitle
|
---|
2064 | #ifdef MPV_SUPPORT
|
---|
2065 | subtitles_track_menu->menuAction()->setText( tr("Prim&ary track") );
|
---|
2066 | #else
|
---|
2067 | subtitles_track_menu->menuAction()->setText( tr("&Select") );
|
---|
2068 | #endif
|
---|
2069 | subtitles_track_menu->menuAction()->setIcon( Images::icon("sub") );
|
---|
2070 |
|
---|
2071 | #ifdef MPV_SUPPORT
|
---|
2072 | secondary_subtitles_track_menu->menuAction()->setText( tr("Secondary trac&k") );
|
---|
2073 | secondary_subtitles_track_menu->menuAction()->setIcon( Images::icon("secondary_sub") );
|
---|
2074 | #endif
|
---|
2075 |
|
---|
2076 | closed_captions_menu->menuAction()->setText( tr("&Closed captions") );
|
---|
2077 | closed_captions_menu->menuAction()->setIcon( Images::icon("closed_caption") );
|
---|
2078 |
|
---|
2079 | subfps_menu->menuAction()->setText( tr("F&rames per second") );
|
---|
2080 | subfps_menu->menuAction()->setIcon( Images::icon("subfps") );
|
---|
2081 |
|
---|
2082 | // Menu Browse
|
---|
2083 | titles_menu->menuAction()->setText( tr("&Title") );
|
---|
2084 | titles_menu->menuAction()->setIcon( Images::icon("title") );
|
---|
2085 |
|
---|
2086 | chapters_menu->menuAction()->setText( tr("&Chapter") );
|
---|
2087 | chapters_menu->menuAction()->setIcon( Images::icon("chapter") );
|
---|
2088 |
|
---|
2089 | angles_menu->menuAction()->setText( tr("&Angle") );
|
---|
2090 | angles_menu->menuAction()->setIcon( Images::icon("angle") );
|
---|
2091 |
|
---|
2092 | #ifdef BOOKMARKS
|
---|
2093 | bookmark_menu->menuAction()->setText( tr("&Bookmarks") );
|
---|
2094 | bookmark_menu->menuAction()->setIcon( Images::icon("bookmarks") );
|
---|
2095 | #endif
|
---|
2096 |
|
---|
2097 | #if PROGRAM_SWITCH
|
---|
2098 | programtrack_menu->menuAction()->setText( tr("P&rogram", "program") );
|
---|
2099 | programtrack_menu->menuAction()->setIcon( Images::icon("program_track") );
|
---|
2100 | #endif
|
---|
2101 |
|
---|
2102 | #ifdef BOOKMARKS
|
---|
2103 | addBookmarkAct->change(Images::icon("add_bookmark"), tr("&Add new bookmark"));
|
---|
2104 | editBookmarksAct->change(Images::icon("edit_bookmarks"), tr("&Edit bookmarks"));
|
---|
2105 | prevBookmarkAct->change(Images::icon("prev_bookmark"), tr("Previous bookmark"));
|
---|
2106 | nextBookmarkAct->change(Images::icon("next_bookmark"), tr("Next bookmark"));
|
---|
2107 | #endif
|
---|
2108 |
|
---|
2109 | #if DVDNAV_SUPPORT
|
---|
2110 | dvdnavUpAct->change(Images::icon("dvdnav_up"), tr("DVD menu, move up"));
|
---|
2111 | dvdnavDownAct->change(Images::icon("dvdnav_down"), tr("DVD menu, move down"));
|
---|
2112 | dvdnavLeftAct->change(Images::icon("dvdnav_left"), tr("DVD menu, move left"));
|
---|
2113 | dvdnavRightAct->change(Images::icon("dvdnav_right"), tr("DVD menu, move right"));
|
---|
2114 | dvdnavMenuAct->change(Images::icon("dvdnav_menu"), tr("DVD &menu"));
|
---|
2115 | dvdnavSelectAct->change(Images::icon("dvdnav_select"), tr("DVD menu, select option"));
|
---|
2116 | dvdnavPrevAct->change(Images::icon("dvdnav_prev"), tr("DVD &previous menu"));
|
---|
2117 | dvdnavMouseAct->change(Images::icon("dvdnav_mouse"), tr("DVD menu, mouse click"));
|
---|
2118 | #endif
|
---|
2119 |
|
---|
2120 | // Menu Options
|
---|
2121 | osd_menu->menuAction()->setText( tr("&OSD") );
|
---|
2122 | osd_menu->menuAction()->setIcon( Images::icon("osd") );
|
---|
2123 |
|
---|
2124 | #ifdef SHARE_MENU
|
---|
2125 | share_menu->menuAction()->setText( tr("S&hare SMPlayer with your friends") );
|
---|
2126 | share_menu->menuAction()->setIcon( Images::icon("share") );
|
---|
2127 | #endif
|
---|
2128 |
|
---|
2129 | #if defined(LOG_MPLAYER) || defined(LOG_SMPLAYER)
|
---|
2130 | logs_menu->menuAction()->setText( tr("&View logs") );
|
---|
2131 | logs_menu->menuAction()->setIcon( Images::icon("logs") );
|
---|
2132 | #endif
|
---|
2133 |
|
---|
2134 | // To be sure that the "<empty>" string is translated
|
---|
2135 | initializeMenus();
|
---|
2136 |
|
---|
2137 | // Other things
|
---|
2138 | #ifdef LOG_MPLAYER
|
---|
2139 | mplayer_log_window->setWindowTitle( tr("%1 log").arg(PLAYER_NAME) );
|
---|
2140 | #endif
|
---|
2141 | #ifdef LOG_SMPLAYER
|
---|
2142 | smplayer_log_window->setWindowTitle( tr("SMPlayer log") );
|
---|
2143 | #endif
|
---|
2144 |
|
---|
2145 | updateRecents();
|
---|
2146 | updateWidgets();
|
---|
2147 |
|
---|
2148 | // Update actions view in preferences
|
---|
2149 | // It has to be done, here. The actions are translated after the
|
---|
2150 | // preferences dialog.
|
---|
2151 | if (pref_dialog) pref_dialog->mod_input()->actions_editor->updateView();
|
---|
2152 | }
|
---|
2153 |
|
---|
2154 | void BaseGui::setJumpTexts() {
|
---|
2155 | rewind1Act->change( tr("-%1").arg(Helper::timeForJumps(pref->seeking1)) );
|
---|
2156 | rewind2Act->change( tr("-%1").arg(Helper::timeForJumps(pref->seeking2)) );
|
---|
2157 | rewind3Act->change( tr("-%1").arg(Helper::timeForJumps(pref->seeking3)) );
|
---|
2158 |
|
---|
2159 | forward1Act->change( tr("+%1").arg(Helper::timeForJumps(pref->seeking1)) );
|
---|
2160 | forward2Act->change( tr("+%1").arg(Helper::timeForJumps(pref->seeking2)) );
|
---|
2161 | forward3Act->change( tr("+%1").arg(Helper::timeForJumps(pref->seeking3)) );
|
---|
2162 |
|
---|
2163 | rewind1Act->setIcon( Images::icon("rewind10s") );
|
---|
2164 | rewind2Act->setIcon( Images::icon("rewind1m") );
|
---|
2165 | rewind3Act->setIcon( Images::icon("rewind10m") );
|
---|
2166 |
|
---|
2167 | forward1Act->setIcon( Images::icon("forward10s") );
|
---|
2168 | forward2Act->setIcon( Images::icon("forward1m") );
|
---|
2169 | forward3Act->setIcon( Images::icon("forward10m") );
|
---|
2170 | }
|
---|
2171 |
|
---|
2172 | void BaseGui::setWindowCaption(const QString & title) {
|
---|
2173 | setWindowTitle(title);
|
---|
2174 | }
|
---|
2175 |
|
---|
2176 | void BaseGui::createCore() {
|
---|
2177 | core = new Core( mplayerwindow, this );
|
---|
2178 |
|
---|
2179 | connect( core, SIGNAL(menusNeedInitialize()),
|
---|
2180 | this, SLOT(initializeMenus()) );
|
---|
2181 | connect( core, SIGNAL(widgetsNeedUpdate()),
|
---|
2182 | this, SLOT(updateWidgets()) );
|
---|
2183 | connect( core, SIGNAL(videoEqualizerNeedsUpdate()),
|
---|
2184 | this, SLOT(updateVideoEqualizer()) );
|
---|
2185 |
|
---|
2186 | connect( core, SIGNAL(audioEqualizerNeedsUpdate()),
|
---|
2187 | this, SLOT(updateAudioEqualizer()) );
|
---|
2188 |
|
---|
2189 | connect( core, SIGNAL(showFrame(int)),
|
---|
2190 | this, SIGNAL(frameChanged(int)) );
|
---|
2191 |
|
---|
2192 | connect( core, SIGNAL(ABMarkersChanged(int,int)),
|
---|
2193 | this, SIGNAL(ABMarkersChanged(int,int)) );
|
---|
2194 |
|
---|
2195 | connect( core, SIGNAL(showTime(double)),
|
---|
2196 | this, SLOT(gotCurrentTime(double)) );
|
---|
2197 |
|
---|
2198 | connect( core, SIGNAL(needResize(int, int)),
|
---|
2199 | this, SLOT(resizeWindow(int,int)) );
|
---|
2200 |
|
---|
2201 | connect( core, SIGNAL(needResize(int, int)),
|
---|
2202 | this, SLOT(centerWindow()) );
|
---|
2203 |
|
---|
2204 | connect( core, SIGNAL(showMessage(QString,int)),
|
---|
2205 | this, SLOT(displayMessage(QString,int)) );
|
---|
2206 | connect( core, SIGNAL(showMessage(QString)),
|
---|
2207 | this, SLOT(displayMessage(QString)) );
|
---|
2208 |
|
---|
2209 | connect( core, SIGNAL(stateChanged(Core::State)),
|
---|
2210 | this, SLOT(displayState(Core::State)) );
|
---|
2211 | connect( core, SIGNAL(stateChanged(Core::State)),
|
---|
2212 | this, SLOT(checkStayOnTop(Core::State)), Qt::QueuedConnection );
|
---|
2213 |
|
---|
2214 | connect( core, SIGNAL(mediaStartPlay()),
|
---|
2215 | this, SLOT(enterFullscreenOnPlay()), Qt::QueuedConnection );
|
---|
2216 | connect( core, SIGNAL(mediaStoppedByUser()),
|
---|
2217 | this, SLOT(exitFullscreenOnStop()) );
|
---|
2218 |
|
---|
2219 | connect( core, SIGNAL(mediaStoppedByUser()),
|
---|
2220 | mplayerwindow, SLOT(showLogo()) );
|
---|
2221 |
|
---|
2222 | connect( core, SIGNAL(mediaLoaded()),
|
---|
2223 | this, SLOT(enableActionsOnPlaying()) );
|
---|
2224 |
|
---|
2225 | connect( core, SIGNAL(noFileToPlay()), this, SLOT(gotNoFileToPlay()) );
|
---|
2226 |
|
---|
2227 | #if NOTIFY_AUDIO_CHANGES
|
---|
2228 | connect( core, SIGNAL(audioTracksChanged()),
|
---|
2229 | this, SLOT(enableActionsOnPlaying()) );
|
---|
2230 | #endif
|
---|
2231 | connect( core, SIGNAL(mediaFinished()),
|
---|
2232 | this, SLOT(disableActionsOnStop()) );
|
---|
2233 | connect( core, SIGNAL(mediaStoppedByUser()),
|
---|
2234 | this, SLOT(disableActionsOnStop()) );
|
---|
2235 |
|
---|
2236 | connect( core, SIGNAL(stateChanged(Core::State)),
|
---|
2237 | this, SLOT(togglePlayAction(Core::State)) );
|
---|
2238 |
|
---|
2239 | connect( core, SIGNAL(mediaStartPlay()),
|
---|
2240 | this, SLOT(newMediaLoaded()), Qt::QueuedConnection );
|
---|
2241 | connect( core, SIGNAL(mediaInfoChanged()),
|
---|
2242 | this, SLOT(updateMediaInfo()) );
|
---|
2243 |
|
---|
2244 | connect( core, SIGNAL(mediaStartPlay()),
|
---|
2245 | this, SLOT(checkPendingActionsToRun()), Qt::QueuedConnection );
|
---|
2246 | #if REPORT_OLD_MPLAYER
|
---|
2247 | connect( core, SIGNAL(mediaStartPlay()),
|
---|
2248 | this, SLOT(checkMplayerVersion()), Qt::QueuedConnection );
|
---|
2249 | #endif
|
---|
2250 | connect( core, SIGNAL(failedToParseMplayerVersion(QString)),
|
---|
2251 | this, SLOT(askForMplayerVersion(QString)) );
|
---|
2252 |
|
---|
2253 | connect( core, SIGNAL(mplayerFailed(QProcess::ProcessError)),
|
---|
2254 | this, SLOT(showErrorFromMplayer(QProcess::ProcessError)) );
|
---|
2255 |
|
---|
2256 | connect( core, SIGNAL(mplayerFinishedWithError(int)),
|
---|
2257 | this, SLOT(showExitCodeFromMplayer(int)) );
|
---|
2258 |
|
---|
2259 | // Hide mplayer window
|
---|
2260 | #if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
|
---|
2261 | if (pref->hide_video_window_on_audio_files) {
|
---|
2262 | connect( core, SIGNAL(noVideo()), this, SLOT(hidePanel()) );
|
---|
2263 | } else {
|
---|
2264 | connect( core, SIGNAL(noVideo()), mplayerwindow, SLOT(showLogo()) );
|
---|
2265 | }
|
---|
2266 | #else
|
---|
2267 | connect( core, SIGNAL(noVideo()), this, SLOT(hidePanel()) );
|
---|
2268 | #endif
|
---|
2269 |
|
---|
2270 | // Log mplayer output
|
---|
2271 | #ifdef LOG_MPLAYER
|
---|
2272 | connect( core, SIGNAL(aboutToStartPlaying()),
|
---|
2273 | this, SLOT(clearMplayerLog()) );
|
---|
2274 | connect( core, SIGNAL(logLineAvailable(QString)),
|
---|
2275 | this, SLOT(recordMplayerLog(QString)) );
|
---|
2276 |
|
---|
2277 | connect( core, SIGNAL(mediaLoaded()),
|
---|
2278 | this, SLOT(autosaveMplayerLog()) );
|
---|
2279 | #endif
|
---|
2280 |
|
---|
2281 | #ifdef YOUTUBE_SUPPORT
|
---|
2282 | connect(core, SIGNAL(signatureNotFound(const QString &)),
|
---|
2283 | this, SLOT(YTNoSignature(const QString &)));
|
---|
2284 | connect(core, SIGNAL(noSslSupport()),
|
---|
2285 | this, SLOT(YTNoSslSupport()));
|
---|
2286 | #endif
|
---|
2287 | connect(core, SIGNAL(receivedForbidden()), this, SLOT(gotForbidden()));
|
---|
2288 | }
|
---|
2289 |
|
---|
2290 | void BaseGui::createMplayerWindow() {
|
---|
2291 | mplayerwindow = new MplayerWindow( panel );
|
---|
2292 | mplayerwindow->setObjectName("mplayerwindow");
|
---|
2293 | #if USE_COLORKEY
|
---|
2294 | mplayerwindow->setColorKey( pref->color_key );
|
---|
2295 | #endif
|
---|
2296 | mplayerwindow->allowVideoMovement( pref->allow_video_movement );
|
---|
2297 | mplayerwindow->delayLeftClick(pref->delay_left_click);
|
---|
2298 |
|
---|
2299 | #if LOGO_ANIMATION
|
---|
2300 | mplayerwindow->setAnimatedLogo( pref->animated_logo);
|
---|
2301 | #endif
|
---|
2302 |
|
---|
2303 | #ifdef SHARE_WIDGET
|
---|
2304 | sharewidget = new ShareWidget(Global::settings, mplayerwindow);
|
---|
2305 | mplayerwindow->setCornerWidget(sharewidget);
|
---|
2306 | #ifdef SHARE_ACTIONS
|
---|
2307 | connect(sharewidget, SIGNAL(supportClicked()), this, SLOT(helpDonate()));
|
---|
2308 | #endif
|
---|
2309 | #endif
|
---|
2310 |
|
---|
2311 | QVBoxLayout * layout = new QVBoxLayout;
|
---|
2312 | layout->setSpacing(0);
|
---|
2313 | layout->setMargin(0);
|
---|
2314 | layout->addWidget(mplayerwindow);
|
---|
2315 | panel->setLayout(layout);
|
---|
2316 |
|
---|
2317 | // mplayerwindow
|
---|
2318 | /*
|
---|
2319 | connect( mplayerwindow, SIGNAL(rightButtonReleased(QPoint)),
|
---|
2320 | this, SLOT(showPopupMenu(QPoint)) );
|
---|
2321 | */
|
---|
2322 |
|
---|
2323 | // mplayerwindow mouse events
|
---|
2324 | connect( mplayerwindow, SIGNAL(doubleClicked()),
|
---|
2325 | this, SLOT(doubleClickFunction()) );
|
---|
2326 | connect( mplayerwindow, SIGNAL(leftClicked()),
|
---|
2327 | this, SLOT(leftClickFunction()) );
|
---|
2328 | connect( mplayerwindow, SIGNAL(rightClicked()),
|
---|
2329 | this, SLOT(rightClickFunction()) );
|
---|
2330 | connect( mplayerwindow, SIGNAL(middleClicked()),
|
---|
2331 | this, SLOT(middleClickFunction()) );
|
---|
2332 | connect( mplayerwindow, SIGNAL(xbutton1Clicked()),
|
---|
2333 | this, SLOT(xbutton1ClickFunction()) );
|
---|
2334 | connect( mplayerwindow, SIGNAL(xbutton2Clicked()),
|
---|
2335 | this, SLOT(xbutton2ClickFunction()) );
|
---|
2336 |
|
---|
2337 | connect( mplayerwindow, SIGNAL(mouseMovedDiff(QPoint)),
|
---|
2338 | this, SLOT(processMouseMovedDiff(QPoint)), Qt::QueuedConnection );
|
---|
2339 | #ifdef MOUSE_GESTURES
|
---|
2340 | mplayerwindow->activateMouseDragTracking(true);
|
---|
2341 | #else
|
---|
2342 | mplayerwindow->activateMouseDragTracking(pref->drag_function == Preferences::MoveWindow);
|
---|
2343 | #endif
|
---|
2344 | }
|
---|
2345 |
|
---|
2346 | void BaseGui::createVideoEqualizer() {
|
---|
2347 | // Equalizer
|
---|
2348 | video_equalizer = new VideoEqualizer(this);
|
---|
2349 | connect( video_equalizer, SIGNAL(contrastChanged(int)),
|
---|
2350 | core, SLOT(setContrast(int)) );
|
---|
2351 | connect( video_equalizer, SIGNAL(brightnessChanged(int)),
|
---|
2352 | core, SLOT(setBrightness(int)) );
|
---|
2353 | connect( video_equalizer, SIGNAL(hueChanged(int)),
|
---|
2354 | core, SLOT(setHue(int)) );
|
---|
2355 | connect( video_equalizer, SIGNAL(saturationChanged(int)),
|
---|
2356 | core, SLOT(setSaturation(int)) );
|
---|
2357 | connect( video_equalizer, SIGNAL(gammaChanged(int)),
|
---|
2358 | core, SLOT(setGamma(int)) );
|
---|
2359 |
|
---|
2360 | connect( video_equalizer, SIGNAL(visibilityChanged()),
|
---|
2361 | this, SLOT(updateWidgets()) );
|
---|
2362 | connect( video_equalizer, SIGNAL(requestToChangeDefaultValues()),
|
---|
2363 | this, SLOT(setDefaultValuesFromVideoEqualizer()) );
|
---|
2364 | connect( video_equalizer, SIGNAL(bySoftwareChanged(bool)),
|
---|
2365 | this, SLOT(changeVideoEqualizerBySoftware(bool)) );
|
---|
2366 | }
|
---|
2367 |
|
---|
2368 | void BaseGui::createAudioEqualizer() {
|
---|
2369 | // Audio Equalizer
|
---|
2370 | audio_equalizer = new AudioEqualizer(this);
|
---|
2371 |
|
---|
2372 | connect( audio_equalizer->eq[0], SIGNAL(valueChanged(int)),
|
---|
2373 | core, SLOT(setAudioEq0(int)) );
|
---|
2374 | connect( audio_equalizer->eq[1], SIGNAL(valueChanged(int)),
|
---|
2375 | core, SLOT(setAudioEq1(int)) );
|
---|
2376 | connect( audio_equalizer->eq[2], SIGNAL(valueChanged(int)),
|
---|
2377 | core, SLOT(setAudioEq2(int)) );
|
---|
2378 | connect( audio_equalizer->eq[3], SIGNAL(valueChanged(int)),
|
---|
2379 | core, SLOT(setAudioEq3(int)) );
|
---|
2380 | connect( audio_equalizer->eq[4], SIGNAL(valueChanged(int)),
|
---|
2381 | core, SLOT(setAudioEq4(int)) );
|
---|
2382 | connect( audio_equalizer->eq[5], SIGNAL(valueChanged(int)),
|
---|
2383 | core, SLOT(setAudioEq5(int)) );
|
---|
2384 | connect( audio_equalizer->eq[6], SIGNAL(valueChanged(int)),
|
---|
2385 | core, SLOT(setAudioEq6(int)) );
|
---|
2386 | connect( audio_equalizer->eq[7], SIGNAL(valueChanged(int)),
|
---|
2387 | core, SLOT(setAudioEq7(int)) );
|
---|
2388 | connect( audio_equalizer->eq[8], SIGNAL(valueChanged(int)),
|
---|
2389 | core, SLOT(setAudioEq8(int)) );
|
---|
2390 | connect( audio_equalizer->eq[9], SIGNAL(valueChanged(int)),
|
---|
2391 | core, SLOT(setAudioEq9(int)) );
|
---|
2392 |
|
---|
2393 | connect( audio_equalizer, SIGNAL(applyClicked(AudioEqualizerList)),
|
---|
2394 | core, SLOT(setAudioAudioEqualizerRestart(AudioEqualizerList)) );
|
---|
2395 |
|
---|
2396 | connect( audio_equalizer, SIGNAL(valuesChanged(AudioEqualizerList)),
|
---|
2397 | core, SLOT(setAudioEqualizer(AudioEqualizerList)) );
|
---|
2398 |
|
---|
2399 | connect( audio_equalizer, SIGNAL(visibilityChanged()),
|
---|
2400 | this, SLOT(updateWidgets()) );
|
---|
2401 | }
|
---|
2402 |
|
---|
2403 | void BaseGui::createPlaylist() {
|
---|
2404 | #if DOCK_PLAYLIST
|
---|
2405 | playlist = new Playlist(core, this, 0);
|
---|
2406 | #else
|
---|
2407 | //playlist = new Playlist(core, this, "playlist");
|
---|
2408 | playlist = new Playlist(core, 0);
|
---|
2409 | #endif
|
---|
2410 |
|
---|
2411 | /*
|
---|
2412 | connect( playlist, SIGNAL(playlistEnded()),
|
---|
2413 | this, SLOT(exitFullscreenOnStop()) );
|
---|
2414 | */
|
---|
2415 | connect( playlist, SIGNAL(playlistEnded()),
|
---|
2416 | this, SLOT(playlistHasFinished()) );
|
---|
2417 |
|
---|
2418 | connect( playlist, SIGNAL(playlistEnded()),
|
---|
2419 | mplayerwindow, SLOT(showLogo()) );
|
---|
2420 |
|
---|
2421 | /*
|
---|
2422 | connect( playlist, SIGNAL(visibilityChanged()),
|
---|
2423 | this, SLOT(playlistVisibilityChanged()) );
|
---|
2424 | */
|
---|
2425 |
|
---|
2426 | }
|
---|
2427 |
|
---|
2428 | void BaseGui::createPanel() {
|
---|
2429 | panel = new QWidget( this );
|
---|
2430 | panel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
---|
2431 | panel->setMinimumSize( QSize(1,1) );
|
---|
2432 | panel->setFocusPolicy( Qt::StrongFocus );
|
---|
2433 |
|
---|
2434 | // panel
|
---|
2435 | /*
|
---|
2436 | panel->setAutoFillBackground(true);
|
---|
2437 | ColorUtils::setBackgroundColor( panel, QColor(0,0,0) );
|
---|
2438 | */
|
---|
2439 | }
|
---|
2440 |
|
---|
2441 | void BaseGui::createPreferencesDialog() {
|
---|
2442 | QApplication::setOverrideCursor(Qt::WaitCursor);
|
---|
2443 | pref_dialog = new PreferencesDialog(this);
|
---|
2444 | pref_dialog->setModal(false);
|
---|
2445 | /* pref_dialog->mod_input()->setActionsList( actions_list ); */
|
---|
2446 | connect( pref_dialog, SIGNAL(applied()),
|
---|
2447 | this, SLOT(applyNewPreferences()) );
|
---|
2448 | QApplication::restoreOverrideCursor();
|
---|
2449 | }
|
---|
2450 |
|
---|
2451 | void BaseGui::createFilePropertiesDialog() {
|
---|
2452 | qDebug("BaseGui::createFilePropertiesDialog");
|
---|
2453 | QApplication::setOverrideCursor(Qt::WaitCursor);
|
---|
2454 | file_dialog = new FilePropertiesDialog(this);
|
---|
2455 | file_dialog->setModal(false);
|
---|
2456 | connect( file_dialog, SIGNAL(applied()),
|
---|
2457 | this, SLOT(applyFileProperties()) );
|
---|
2458 | QApplication::restoreOverrideCursor();
|
---|
2459 | }
|
---|
2460 |
|
---|
2461 |
|
---|
2462 | void BaseGui::createMenus() {
|
---|
2463 | // MENUS
|
---|
2464 | openMenu = menuBar()->addMenu("Open");
|
---|
2465 | playMenu = menuBar()->addMenu("Play");
|
---|
2466 | videoMenu = menuBar()->addMenu("Video");
|
---|
2467 | audioMenu = menuBar()->addMenu("Audio");
|
---|
2468 | subtitlesMenu = menuBar()->addMenu("Subtitles");
|
---|
2469 | /* menuBar()->addMenu(favorites); */
|
---|
2470 | browseMenu = menuBar()->addMenu("Browse");
|
---|
2471 | optionsMenu = menuBar()->addMenu("Options");
|
---|
2472 | helpMenu = menuBar()->addMenu("Help");
|
---|
2473 |
|
---|
2474 | // OPEN MENU
|
---|
2475 | openMenu->addAction(openFileAct);
|
---|
2476 |
|
---|
2477 | recentfiles_menu = new QMenu(this);
|
---|
2478 | /*
|
---|
2479 | recentfiles_menu->addAction( clearRecentsAct );
|
---|
2480 | recentfiles_menu->addSeparator();
|
---|
2481 | */
|
---|
2482 |
|
---|
2483 | openMenu->addMenu( recentfiles_menu );
|
---|
2484 | openMenu->addMenu(favorites);
|
---|
2485 | openMenu->addAction(openDirectoryAct);
|
---|
2486 | openMenu->addAction(openPlaylistAct);
|
---|
2487 |
|
---|
2488 | // Disc submenu
|
---|
2489 | disc_menu = new QMenu(this);
|
---|
2490 | disc_menu->menuAction()->setObjectName("disc_menu");
|
---|
2491 | disc_menu->addAction(openDVDAct);
|
---|
2492 | disc_menu->addAction(openDVDFolderAct);
|
---|
2493 | #ifdef BLURAY_SUPPORT
|
---|
2494 | disc_menu->addAction(openBluRayAct);
|
---|
2495 | disc_menu->addAction(openBluRayFolderAct);
|
---|
2496 | #endif
|
---|
2497 | disc_menu->addAction(openVCDAct);
|
---|
2498 | disc_menu->addAction(openAudioCDAct);
|
---|
2499 |
|
---|
2500 | openMenu->addMenu(disc_menu);
|
---|
2501 |
|
---|
2502 | openMenu->addAction(openURLAct);
|
---|
2503 | /* #ifndef Q_OS_WIN */
|
---|
2504 | openMenu->addMenu(tvlist);
|
---|
2505 | openMenu->addMenu(radiolist);
|
---|
2506 | /* #endif */
|
---|
2507 | openMenu->addSeparator();
|
---|
2508 | openMenu->addAction(exitAct);
|
---|
2509 |
|
---|
2510 | // PLAY MENU
|
---|
2511 | playMenu->addAction(playAct);
|
---|
2512 | playMenu->addAction(pauseAct);
|
---|
2513 | /* playMenu->addAction(playOrPauseAct); */
|
---|
2514 | playMenu->addAction(stopAct);
|
---|
2515 | playMenu->addAction(frameStepAct);
|
---|
2516 | playMenu->addAction(frameBackStepAct);
|
---|
2517 | playMenu->addSeparator();
|
---|
2518 | playMenu->addAction(rewind1Act);
|
---|
2519 | playMenu->addAction(forward1Act);
|
---|
2520 | playMenu->addAction(rewind2Act);
|
---|
2521 | playMenu->addAction(forward2Act);
|
---|
2522 | playMenu->addAction(rewind3Act);
|
---|
2523 | playMenu->addAction(forward3Act);
|
---|
2524 | playMenu->addSeparator();
|
---|
2525 |
|
---|
2526 | // Speed submenu
|
---|
2527 | speed_menu = new QMenu(this);
|
---|
2528 | speed_menu->menuAction()->setObjectName("speed_menu");
|
---|
2529 | speed_menu->addAction(normalSpeedAct);
|
---|
2530 | speed_menu->addSeparator();
|
---|
2531 | speed_menu->addAction(halveSpeedAct);
|
---|
2532 | speed_menu->addAction(doubleSpeedAct);
|
---|
2533 | speed_menu->addSeparator();
|
---|
2534 | speed_menu->addAction(decSpeed10Act);
|
---|
2535 | speed_menu->addAction(incSpeed10Act);
|
---|
2536 | speed_menu->addSeparator();
|
---|
2537 | speed_menu->addAction(decSpeed4Act);
|
---|
2538 | speed_menu->addAction(incSpeed4Act);
|
---|
2539 | speed_menu->addSeparator();
|
---|
2540 | speed_menu->addAction(decSpeed1Act);
|
---|
2541 | speed_menu->addAction(incSpeed1Act);
|
---|
2542 |
|
---|
2543 | playMenu->addMenu(speed_menu);
|
---|
2544 |
|
---|
2545 | // A-B submenu
|
---|
2546 | ab_menu = new QMenu(this);
|
---|
2547 | ab_menu->menuAction()->setObjectName("ab_menu");
|
---|
2548 | ab_menu->addAction(setAMarkerAct);
|
---|
2549 | ab_menu->addAction(setBMarkerAct);
|
---|
2550 | ab_menu->addAction(clearABMarkersAct);
|
---|
2551 | ab_menu->addSeparator();
|
---|
2552 | ab_menu->addAction(repeatAct);
|
---|
2553 |
|
---|
2554 | playMenu->addSeparator();
|
---|
2555 | playMenu->addMenu(ab_menu);
|
---|
2556 |
|
---|
2557 | playMenu->addSeparator();
|
---|
2558 | playMenu->addAction(gotoAct);
|
---|
2559 | playMenu->addSeparator();
|
---|
2560 | playMenu->addAction(playPrevAct);
|
---|
2561 | playMenu->addAction(playNextAct);
|
---|
2562 |
|
---|
2563 | // VIDEO MENU
|
---|
2564 | videotrack_menu = new QMenu(this);
|
---|
2565 | videotrack_menu->menuAction()->setObjectName("videotrack_menu");
|
---|
2566 |
|
---|
2567 | videoMenu->addMenu(videotrack_menu);
|
---|
2568 |
|
---|
2569 | videoMenu->addAction(fullscreenAct);
|
---|
2570 | videoMenu->addAction(compactAct);
|
---|
2571 |
|
---|
2572 | #if USE_ADAPTER
|
---|
2573 | // Screen submenu
|
---|
2574 | screen_menu = new QMenu(this);
|
---|
2575 | screen_menu->menuAction()->setObjectName("screen_menu");
|
---|
2576 | screen_menu->addActions( screenGroup->actions() );
|
---|
2577 | videoMenu->addMenu(screen_menu);
|
---|
2578 | #endif
|
---|
2579 |
|
---|
2580 | // Size submenu
|
---|
2581 | videosize_menu = new QMenu(this);
|
---|
2582 | videosize_menu->menuAction()->setObjectName("videosize_menu");
|
---|
2583 | videosize_menu->addActions( sizeGroup->actions() );
|
---|
2584 | videosize_menu->addSeparator();
|
---|
2585 | videosize_menu->addAction(doubleSizeAct);
|
---|
2586 | videoMenu->addMenu(videosize_menu);
|
---|
2587 |
|
---|
2588 | // Zoom submenu
|
---|
2589 | zoom_menu = new QMenu(this);
|
---|
2590 | zoom_menu->menuAction()->setObjectName("zoom_menu");
|
---|
2591 | zoom_menu->addAction(resetZoomAct);
|
---|
2592 | zoom_menu->addSeparator();
|
---|
2593 | zoom_menu->addAction(autoZoomAct);
|
---|
2594 | zoom_menu->addAction(autoZoom169Act);
|
---|
2595 | zoom_menu->addAction(autoZoom235Act);
|
---|
2596 | zoom_menu->addSeparator();
|
---|
2597 | zoom_menu->addAction(decZoomAct);
|
---|
2598 | zoom_menu->addAction(incZoomAct);
|
---|
2599 | zoom_menu->addSeparator();
|
---|
2600 | zoom_menu->addAction(moveLeftAct);
|
---|
2601 | zoom_menu->addAction(moveRightAct);
|
---|
2602 | zoom_menu->addAction(moveUpAct);
|
---|
2603 | zoom_menu->addAction(moveDownAct);
|
---|
2604 |
|
---|
2605 | videoMenu->addMenu(zoom_menu);
|
---|
2606 |
|
---|
2607 | // Aspect submenu
|
---|
2608 | aspect_menu = new QMenu(this);
|
---|
2609 | aspect_menu->menuAction()->setObjectName("aspect_menu");
|
---|
2610 | aspect_menu->addActions( aspectGroup->actions() );
|
---|
2611 |
|
---|
2612 | videoMenu->addMenu(aspect_menu);
|
---|
2613 |
|
---|
2614 | // Deinterlace submenu
|
---|
2615 | deinterlace_menu = new QMenu(this);
|
---|
2616 | deinterlace_menu->menuAction()->setObjectName("deinterlace_menu");
|
---|
2617 | deinterlace_menu->addActions( deinterlaceGroup->actions() );
|
---|
2618 |
|
---|
2619 | videoMenu->addMenu(deinterlace_menu);
|
---|
2620 |
|
---|
2621 | // Video filter submenu
|
---|
2622 | videofilter_menu = new QMenu(this);
|
---|
2623 | videofilter_menu->menuAction()->setObjectName("videofilter_menu");
|
---|
2624 | videofilter_menu->addAction(postProcessingAct);
|
---|
2625 | videofilter_menu->addAction(deblockAct);
|
---|
2626 | videofilter_menu->addAction(deringAct);
|
---|
2627 | videofilter_menu->addAction(gradfunAct);
|
---|
2628 | videofilter_menu->addAction(addNoiseAct);
|
---|
2629 | videofilter_menu->addAction(addLetterboxAct);
|
---|
2630 | videofilter_menu->addAction(upscaleAct);
|
---|
2631 | videofilter_menu->addAction(phaseAct);
|
---|
2632 |
|
---|
2633 | // Denoise submenu
|
---|
2634 | denoise_menu = new QMenu(this);
|
---|
2635 | denoise_menu->menuAction()->setObjectName("denoise_menu");
|
---|
2636 | denoise_menu->addActions(denoiseGroup->actions());
|
---|
2637 | videofilter_menu->addMenu(denoise_menu);
|
---|
2638 |
|
---|
2639 | // Unsharp submenu
|
---|
2640 | unsharp_menu = new QMenu(this);
|
---|
2641 | unsharp_menu->menuAction()->setObjectName("unsharp_menu");
|
---|
2642 | unsharp_menu->addActions(unsharpGroup->actions());
|
---|
2643 | videofilter_menu->addMenu(unsharp_menu);
|
---|
2644 | /*
|
---|
2645 | videofilter_menu->addSeparator();
|
---|
2646 | videofilter_menu->addActions(denoiseGroup->actions());
|
---|
2647 | videofilter_menu->addSeparator();
|
---|
2648 | videofilter_menu->addActions(unsharpGroup->actions());
|
---|
2649 | */
|
---|
2650 | videoMenu->addMenu(videofilter_menu);
|
---|
2651 |
|
---|
2652 | // Rotate submenu
|
---|
2653 | rotate_menu = new QMenu(this);
|
---|
2654 | rotate_menu->menuAction()->setObjectName("rotate_menu");
|
---|
2655 | rotate_menu->addActions(rotateGroup->actions());
|
---|
2656 |
|
---|
2657 | videoMenu->addMenu(rotate_menu);
|
---|
2658 |
|
---|
2659 | videoMenu->addAction(flipAct);
|
---|
2660 | videoMenu->addAction(mirrorAct);
|
---|
2661 | videoMenu->addAction(stereo3dAct);
|
---|
2662 | videoMenu->addSeparator();
|
---|
2663 | videoMenu->addAction(videoEqualizerAct);
|
---|
2664 | videoMenu->addAction(screenshotAct);
|
---|
2665 | videoMenu->addAction(screenshotsAct);
|
---|
2666 |
|
---|
2667 | // Ontop submenu
|
---|
2668 | ontop_menu = new QMenu(this);
|
---|
2669 | ontop_menu->menuAction()->setObjectName("ontop_menu");
|
---|
2670 | ontop_menu->addActions(onTopActionGroup->actions());
|
---|
2671 |
|
---|
2672 | videoMenu->addMenu(ontop_menu);
|
---|
2673 |
|
---|
2674 | #ifdef VIDEOPREVIEW
|
---|
2675 | videoMenu->addSeparator();
|
---|
2676 | videoMenu->addAction(videoPreviewAct);
|
---|
2677 | #endif
|
---|
2678 |
|
---|
2679 |
|
---|
2680 | // AUDIO MENU
|
---|
2681 |
|
---|
2682 | // Audio track submenu
|
---|
2683 | audiotrack_menu = new QMenu(this);
|
---|
2684 | audiotrack_menu->menuAction()->setObjectName("audiotrack_menu");
|
---|
2685 |
|
---|
2686 | audioMenu->addMenu(audiotrack_menu);
|
---|
2687 |
|
---|
2688 | audioMenu->addAction(loadAudioAct);
|
---|
2689 | audioMenu->addAction(unloadAudioAct);
|
---|
2690 |
|
---|
2691 | // Filter submenu
|
---|
2692 | audiofilter_menu = new QMenu(this);
|
---|
2693 | audiofilter_menu->menuAction()->setObjectName("audiofilter_menu");
|
---|
2694 | audiofilter_menu->addAction(extrastereoAct);
|
---|
2695 | #ifdef MPLAYER_SUPPORT
|
---|
2696 | audiofilter_menu->addAction(karaokeAct);
|
---|
2697 | #endif
|
---|
2698 | audiofilter_menu->addAction(volnormAct);
|
---|
2699 |
|
---|
2700 | audioMenu->addMenu(audiofilter_menu);
|
---|
2701 |
|
---|
2702 | // Audio channels submenu
|
---|
2703 | audiochannels_menu = new QMenu(this);
|
---|
2704 | audiochannels_menu->menuAction()->setObjectName("audiochannels_menu");
|
---|
2705 | audiochannels_menu->addActions( channelsGroup->actions() );
|
---|
2706 |
|
---|
2707 | audioMenu->addMenu(audiochannels_menu);
|
---|
2708 |
|
---|
2709 | // Stereo mode submenu
|
---|
2710 | stereomode_menu = new QMenu(this);
|
---|
2711 | stereomode_menu->menuAction()->setObjectName("stereomode_menu");
|
---|
2712 | stereomode_menu->addActions( stereoGroup->actions() );
|
---|
2713 |
|
---|
2714 | audioMenu->addMenu(stereomode_menu);
|
---|
2715 | audioMenu->addAction(audioEqualizerAct);
|
---|
2716 | audioMenu->addSeparator();
|
---|
2717 | audioMenu->addAction(muteAct);
|
---|
2718 | audioMenu->addSeparator();
|
---|
2719 | audioMenu->addAction(decVolumeAct);
|
---|
2720 | audioMenu->addAction(incVolumeAct);
|
---|
2721 | audioMenu->addSeparator();
|
---|
2722 | audioMenu->addAction(decAudioDelayAct);
|
---|
2723 | audioMenu->addAction(incAudioDelayAct);
|
---|
2724 | audioMenu->addSeparator();
|
---|
2725 | audioMenu->addAction(audioDelayAct);
|
---|
2726 |
|
---|
2727 |
|
---|
2728 | // SUBTITLES MENU
|
---|
2729 | // Track submenu
|
---|
2730 | subtitles_track_menu = new QMenu(this);
|
---|
2731 | subtitles_track_menu->menuAction()->setObjectName("subtitlestrack_menu");
|
---|
2732 |
|
---|
2733 | #ifdef MPV_SUPPORT
|
---|
2734 | secondary_subtitles_track_menu = new QMenu(this);
|
---|
2735 | secondary_subtitles_track_menu->menuAction()->setObjectName("secondary_subtitles_track_menu");
|
---|
2736 | #endif
|
---|
2737 |
|
---|
2738 | subtitlesMenu->addMenu(subtitles_track_menu);
|
---|
2739 | #ifdef MPV_SUPPORT
|
---|
2740 | subtitlesMenu->addMenu(secondary_subtitles_track_menu);
|
---|
2741 | #endif
|
---|
2742 | subtitlesMenu->addSeparator();
|
---|
2743 |
|
---|
2744 | subtitlesMenu->addAction(loadSubsAct);
|
---|
2745 | subtitlesMenu->addAction(unloadSubsAct);
|
---|
2746 |
|
---|
2747 | subfps_menu = new QMenu(this);
|
---|
2748 | subfps_menu->menuAction()->setObjectName("subfps_menu");
|
---|
2749 | subfps_menu->addAction( subFPSNoneAct );
|
---|
2750 | /* subfps_menu->addAction( subFPS23Act ); */
|
---|
2751 | subfps_menu->addAction( subFPS23976Act );
|
---|
2752 | subfps_menu->addAction( subFPS24Act );
|
---|
2753 | subfps_menu->addAction( subFPS25Act );
|
---|
2754 | subfps_menu->addAction( subFPS29970Act );
|
---|
2755 | subfps_menu->addAction( subFPS30Act );
|
---|
2756 | subtitlesMenu->addMenu(subfps_menu);
|
---|
2757 | subtitlesMenu->addSeparator();
|
---|
2758 |
|
---|
2759 | closed_captions_menu = new QMenu(this);
|
---|
2760 | closed_captions_menu->menuAction()->setObjectName("closed_captions_menu");
|
---|
2761 | closed_captions_menu->addAction( ccNoneAct);
|
---|
2762 | closed_captions_menu->addAction( ccChannel1Act);
|
---|
2763 | closed_captions_menu->addAction( ccChannel2Act);
|
---|
2764 | closed_captions_menu->addAction( ccChannel3Act);
|
---|
2765 | closed_captions_menu->addAction( ccChannel4Act);
|
---|
2766 | subtitlesMenu->addMenu(closed_captions_menu);
|
---|
2767 | subtitlesMenu->addSeparator();
|
---|
2768 |
|
---|
2769 | subtitlesMenu->addAction(decSubDelayAct);
|
---|
2770 | subtitlesMenu->addAction(incSubDelayAct);
|
---|
2771 | subtitlesMenu->addSeparator();
|
---|
2772 | subtitlesMenu->addAction(subDelayAct);
|
---|
2773 | subtitlesMenu->addSeparator();
|
---|
2774 | subtitlesMenu->addAction(decSubPosAct);
|
---|
2775 | subtitlesMenu->addAction(incSubPosAct);
|
---|
2776 | subtitlesMenu->addSeparator();
|
---|
2777 | subtitlesMenu->addAction(decSubScaleAct);
|
---|
2778 | subtitlesMenu->addAction(incSubScaleAct);
|
---|
2779 | subtitlesMenu->addSeparator();
|
---|
2780 | subtitlesMenu->addAction(decSubStepAct);
|
---|
2781 | subtitlesMenu->addAction(incSubStepAct);
|
---|
2782 | #ifdef MPV_SUPPORT
|
---|
2783 | subtitlesMenu->addSeparator();
|
---|
2784 | subtitlesMenu->addAction(seekPrevSubAct);
|
---|
2785 | subtitlesMenu->addAction(seekNextSubAct);
|
---|
2786 | #endif
|
---|
2787 | subtitlesMenu->addSeparator();
|
---|
2788 | subtitlesMenu->addAction(useForcedSubsOnlyAct);
|
---|
2789 | subtitlesMenu->addSeparator();
|
---|
2790 | subtitlesMenu->addAction(subVisibilityAct);
|
---|
2791 | subtitlesMenu->addSeparator();
|
---|
2792 | subtitlesMenu->addAction(useCustomSubStyleAct);
|
---|
2793 | #ifdef FIND_SUBTITLES
|
---|
2794 | subtitlesMenu->addSeparator(); //turbos
|
---|
2795 | subtitlesMenu->addAction(showFindSubtitlesDialogAct);
|
---|
2796 | subtitlesMenu->addAction(openUploadSubtitlesPageAct); //turbos
|
---|
2797 | #endif
|
---|
2798 |
|
---|
2799 | // BROWSE MENU
|
---|
2800 | // Titles submenu
|
---|
2801 | titles_menu = new QMenu(this);
|
---|
2802 | titles_menu->menuAction()->setObjectName("titles_menu");
|
---|
2803 |
|
---|
2804 | browseMenu->addMenu(titles_menu);
|
---|
2805 |
|
---|
2806 | // Chapters submenu
|
---|
2807 | chapters_menu = new QMenu(this);
|
---|
2808 | chapters_menu->menuAction()->setObjectName("chapters_menu");
|
---|
2809 |
|
---|
2810 | browseMenu->addMenu(chapters_menu);
|
---|
2811 |
|
---|
2812 | // Angles submenu
|
---|
2813 | angles_menu = new QMenu(this);
|
---|
2814 | angles_menu->menuAction()->setObjectName("angles_menu");
|
---|
2815 |
|
---|
2816 | browseMenu->addMenu(angles_menu);
|
---|
2817 |
|
---|
2818 | #ifdef BOOKMARKS
|
---|
2819 | // Bookmarks submenu
|
---|
2820 | bookmark_menu = new QMenu(this);
|
---|
2821 | bookmark_menu->menuAction()->setObjectName("bookmarks_menu");
|
---|
2822 |
|
---|
2823 | browseMenu->addMenu(bookmark_menu);
|
---|
2824 | #endif
|
---|
2825 |
|
---|
2826 | #if DVDNAV_SUPPORT
|
---|
2827 | browseMenu->addSeparator();
|
---|
2828 | browseMenu->addAction(dvdnavMenuAct);
|
---|
2829 | browseMenu->addAction(dvdnavPrevAct);
|
---|
2830 | #endif
|
---|
2831 |
|
---|
2832 | #if PROGRAM_SWITCH
|
---|
2833 | programtrack_menu = new QMenu(this);
|
---|
2834 | programtrack_menu->menuAction()->setObjectName("programtrack_menu");
|
---|
2835 |
|
---|
2836 | browseMenu->addSeparator();
|
---|
2837 | browseMenu->addMenu(programtrack_menu);
|
---|
2838 | #endif
|
---|
2839 |
|
---|
2840 |
|
---|
2841 | // OPTIONS MENU
|
---|
2842 | optionsMenu->addAction(showPropertiesAct);
|
---|
2843 | optionsMenu->addAction(showPlaylistAct);
|
---|
2844 | #ifdef YOUTUBE_SUPPORT
|
---|
2845 | #if 0
|
---|
2846 | // Check if the smplayer youtube browser is installed
|
---|
2847 | {
|
---|
2848 | QString tube_exec = Paths::appPath() + "/smtube";
|
---|
2849 | #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
---|
2850 | tube_exec += ".exe";
|
---|
2851 | #endif
|
---|
2852 | if (QFile::exists(tube_exec)) {
|
---|
2853 | optionsMenu->addAction(showTubeBrowserAct);
|
---|
2854 | qDebug("BaseGui::createMenus: %s does exist", tube_exec.toUtf8().constData());
|
---|
2855 | } else {
|
---|
2856 | qDebug("BaseGui::createMenus: %s does not exist", tube_exec.toUtf8().constData());
|
---|
2857 | }
|
---|
2858 | }
|
---|
2859 | #else
|
---|
2860 | optionsMenu->addAction(showTubeBrowserAct);
|
---|
2861 | #endif
|
---|
2862 | #endif
|
---|
2863 |
|
---|
2864 | // OSD submenu
|
---|
2865 | osd_menu = new QMenu(this);
|
---|
2866 | osd_menu->menuAction()->setObjectName("osd_menu");
|
---|
2867 | osd_menu->addActions(osdGroup->actions());
|
---|
2868 | osd_menu->addSeparator();
|
---|
2869 | osd_menu->addAction(decOSDScaleAct);
|
---|
2870 | osd_menu->addAction(incOSDScaleAct);
|
---|
2871 |
|
---|
2872 |
|
---|
2873 | optionsMenu->addMenu(osd_menu);
|
---|
2874 |
|
---|
2875 | // Logs submenu
|
---|
2876 | #if defined(LOG_MPLAYER) || defined(LOG_SMPLAYER)
|
---|
2877 | logs_menu = new QMenu(this);
|
---|
2878 | #ifdef LOG_MPLAYER
|
---|
2879 | logs_menu->addAction(showLogMplayerAct);
|
---|
2880 | #endif
|
---|
2881 | #ifdef LOG_SMPLAYER
|
---|
2882 | logs_menu->addAction(showLogSmplayerAct);
|
---|
2883 | #endif
|
---|
2884 | optionsMenu->addMenu(logs_menu);
|
---|
2885 | #endif
|
---|
2886 |
|
---|
2887 | optionsMenu->addAction(showPreferencesAct);
|
---|
2888 |
|
---|
2889 | /*
|
---|
2890 | Favorites * fav = new Favorites(Paths::configPath() + "/test.fav", this);
|
---|
2891 | connect(fav, SIGNAL(activated(QString)), this, SLOT(open(QString)));
|
---|
2892 | optionsMenu->addMenu( fav->menu() )->setText("Favorites");
|
---|
2893 | */
|
---|
2894 |
|
---|
2895 | // HELP MENU
|
---|
2896 | // Share submenu
|
---|
2897 | #ifdef SHARE_MENU
|
---|
2898 | share_menu = new QMenu(this);
|
---|
2899 | share_menu->addAction(facebookAct);
|
---|
2900 | share_menu->addAction(twitterAct);
|
---|
2901 | share_menu->addAction(gmailAct);
|
---|
2902 | share_menu->addAction(hotmailAct);
|
---|
2903 | share_menu->addAction(yahooAct);
|
---|
2904 |
|
---|
2905 | helpMenu->addMenu(share_menu);
|
---|
2906 | helpMenu->addSeparator();
|
---|
2907 | #endif
|
---|
2908 |
|
---|
2909 | helpMenu->addAction(showFirstStepsAct);
|
---|
2910 | helpMenu->addAction(showFAQAct);
|
---|
2911 | helpMenu->addAction(showCLOptionsAct);
|
---|
2912 | helpMenu->addSeparator();
|
---|
2913 | helpMenu->addAction(showCheckUpdatesAct);
|
---|
2914 | #if defined(YOUTUBE_SUPPORT) && defined(YT_USE_YTSIG)
|
---|
2915 | helpMenu->addAction(updateYTAct);
|
---|
2916 | #endif
|
---|
2917 | helpMenu->addSeparator();
|
---|
2918 | helpMenu->addAction(showConfigAct);
|
---|
2919 | helpMenu->addSeparator();
|
---|
2920 | #ifdef SHARE_ACTIONS
|
---|
2921 | helpMenu->addAction(donateAct);
|
---|
2922 | helpMenu->addSeparator();
|
---|
2923 | #endif
|
---|
2924 | helpMenu->addAction(aboutThisAct);
|
---|
2925 |
|
---|
2926 | // POPUP MENU
|
---|
2927 | if (!popup)
|
---|
2928 | popup = new QMenu(this);
|
---|
2929 | else
|
---|
2930 | popup->clear();
|
---|
2931 |
|
---|
2932 | popup->addMenu( openMenu );
|
---|
2933 | popup->addMenu( playMenu );
|
---|
2934 | popup->addMenu( videoMenu );
|
---|
2935 | popup->addMenu( audioMenu );
|
---|
2936 | popup->addMenu( subtitlesMenu );
|
---|
2937 | popup->addMenu( favorites );
|
---|
2938 | popup->addMenu( browseMenu );
|
---|
2939 | popup->addMenu( optionsMenu );
|
---|
2940 |
|
---|
2941 | // let's show something, even a <empty> entry
|
---|
2942 | initializeMenus();
|
---|
2943 | }
|
---|
2944 |
|
---|
2945 | /*
|
---|
2946 | void BaseGui::closeEvent( QCloseEvent * e ) {
|
---|
2947 | qDebug("BaseGui::closeEvent");
|
---|
2948 |
|
---|
2949 | qDebug("mplayer_log_window: %d x %d", mplayer_log_window->width(), mplayer_log_window->height() );
|
---|
2950 | qDebug("smplayer_log_window: %d x %d", smplayer_log_window->width(), smplayer_log_window->height() );
|
---|
2951 |
|
---|
2952 | mplayer_log_window->close();
|
---|
2953 | smplayer_log_window->close();
|
---|
2954 | playlist->close();
|
---|
2955 | equalizer->close();
|
---|
2956 |
|
---|
2957 | core->stop();
|
---|
2958 | e->accept();
|
---|
2959 | }
|
---|
2960 | */
|
---|
2961 |
|
---|
2962 |
|
---|
2963 | void BaseGui::closeWindow() {
|
---|
2964 | qDebug("BaseGui::closeWindow");
|
---|
2965 |
|
---|
2966 | if (core->state() != Core::Stopped) {
|
---|
2967 | core->stop();
|
---|
2968 | }
|
---|
2969 |
|
---|
2970 | //qApp->quit();
|
---|
2971 | emit quitSolicited();
|
---|
2972 | }
|
---|
2973 |
|
---|
2974 | void BaseGui::showPlaylist() {
|
---|
2975 | showPlaylist( !playlist->isVisible() );
|
---|
2976 | }
|
---|
2977 |
|
---|
2978 | void BaseGui::showPlaylist(bool b) {
|
---|
2979 | if ( !b ) {
|
---|
2980 | playlist->hide();
|
---|
2981 | } else {
|
---|
2982 | exitFullscreenIfNeeded();
|
---|
2983 | playlist->show();
|
---|
2984 | }
|
---|
2985 | //updateWidgets();
|
---|
2986 | }
|
---|
2987 |
|
---|
2988 | void BaseGui::showVideoEqualizer() {
|
---|
2989 | showVideoEqualizer( !video_equalizer->isVisible() );
|
---|
2990 | }
|
---|
2991 |
|
---|
2992 | void BaseGui::showVideoEqualizer(bool b) {
|
---|
2993 | if (!b) {
|
---|
2994 | video_equalizer->hide();
|
---|
2995 | } else {
|
---|
2996 | // Exit fullscreen, otherwise dialog is not visible
|
---|
2997 | exitFullscreenIfNeeded();
|
---|
2998 | video_equalizer->show();
|
---|
2999 | }
|
---|
3000 | updateWidgets();
|
---|
3001 | }
|
---|
3002 |
|
---|
3003 | void BaseGui::showAudioEqualizer() {
|
---|
3004 | showAudioEqualizer( !audio_equalizer->isVisible() );
|
---|
3005 | }
|
---|
3006 |
|
---|
3007 | void BaseGui::showAudioEqualizer(bool b) {
|
---|
3008 | if (!b) {
|
---|
3009 | audio_equalizer->hide();
|
---|
3010 | } else {
|
---|
3011 | // Exit fullscreen, otherwise dialog is not visible
|
---|
3012 | exitFullscreenIfNeeded();
|
---|
3013 | audio_equalizer->show();
|
---|
3014 | }
|
---|
3015 | updateWidgets();
|
---|
3016 | }
|
---|
3017 |
|
---|
3018 | void BaseGui::showPreferencesDialog() {
|
---|
3019 | qDebug("BaseGui::showPreferencesDialog");
|
---|
3020 |
|
---|
3021 | exitFullscreenIfNeeded();
|
---|
3022 |
|
---|
3023 | if (!pref_dialog) {
|
---|
3024 | createPreferencesDialog();
|
---|
3025 | }
|
---|
3026 |
|
---|
3027 | pref_dialog->setData(pref);
|
---|
3028 |
|
---|
3029 | pref_dialog->mod_input()->actions_editor->clear();
|
---|
3030 | pref_dialog->mod_input()->actions_editor->addActions(this);
|
---|
3031 | #if !DOCK_PLAYLIST
|
---|
3032 | pref_dialog->mod_input()->actions_editor->addActions(playlist);
|
---|
3033 | #endif
|
---|
3034 |
|
---|
3035 | // Set playlist preferences
|
---|
3036 | PrefPlaylist * pl = pref_dialog->mod_playlist();
|
---|
3037 | pl->setDirectoryRecursion(playlist->directoryRecursion());
|
---|
3038 | pl->setAutoGetInfo(playlist->autoGetInfo());
|
---|
3039 | pl->setSavePlaylistOnExit(playlist->savePlaylistOnExit());
|
---|
3040 | pl->setPlayFilesFromStart(playlist->playFilesFromStart());
|
---|
3041 | pl->setIgnorePlayerErrors(playlist->ignorePlayerErrors());
|
---|
3042 |
|
---|
3043 | pref_dialog->show();
|
---|
3044 | }
|
---|
3045 |
|
---|
3046 | // The user has pressed OK in preferences dialog
|
---|
3047 | void BaseGui::applyNewPreferences() {
|
---|
3048 | qDebug("BaseGui::applyNewPreferences");
|
---|
3049 |
|
---|
3050 | bool need_update_language = false;
|
---|
3051 |
|
---|
3052 | PlayerID::Player old_player_type = PlayerID::player(pref->mplayer_bin);
|
---|
3053 |
|
---|
3054 | pref_dialog->getData(pref);
|
---|
3055 |
|
---|
3056 | // Setup proxy
|
---|
3057 | setupNetworkProxy();
|
---|
3058 |
|
---|
3059 | // Change application font
|
---|
3060 | if (!pref->default_font.isEmpty()) {
|
---|
3061 | QFont f;
|
---|
3062 | f.fromString( pref->default_font );
|
---|
3063 | if (QApplication::font() != f) {
|
---|
3064 | qDebug("BaseGui::applyNewPreferences: setting new font: %s", pref->default_font.toLatin1().constData());
|
---|
3065 | QApplication::setFont(f);
|
---|
3066 | }
|
---|
3067 | }
|
---|
3068 |
|
---|
3069 | #ifndef NO_USE_INI_FILES
|
---|
3070 | PrefGeneral *_general = pref_dialog->mod_general();
|
---|
3071 | if (_general->fileSettingsMethodChanged()) {
|
---|
3072 | core->changeFileSettingsMethod(pref->file_settings_method);
|
---|
3073 | }
|
---|
3074 | #endif
|
---|
3075 |
|
---|
3076 | PrefInterface *_interface = pref_dialog->mod_interface();
|
---|
3077 | if (_interface->recentsChanged()) {
|
---|
3078 | updateRecents();
|
---|
3079 | }
|
---|
3080 | if (_interface->languageChanged()) need_update_language = true;
|
---|
3081 |
|
---|
3082 | if (_interface->iconsetChanged()) {
|
---|
3083 | need_update_language = true;
|
---|
3084 | // Stylesheet
|
---|
3085 | #if ALLOW_CHANGE_STYLESHEET
|
---|
3086 | if (!_interface->guiChanged()) applyStyles();
|
---|
3087 | #endif
|
---|
3088 | }
|
---|
3089 |
|
---|
3090 | #ifdef MOUSE_GESTURES
|
---|
3091 | mplayerwindow->activateMouseDragTracking(true);
|
---|
3092 | #else
|
---|
3093 | mplayerwindow->activateMouseDragTracking(pref->drag_function == Preferences::MoveWindow);
|
---|
3094 | #endif
|
---|
3095 | mplayerwindow->delayLeftClick(pref->delay_left_click);
|
---|
3096 |
|
---|
3097 | #if ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
|
---|
3098 | if (pref->hide_video_window_on_audio_files) {
|
---|
3099 | connect( core, SIGNAL(noVideo()), this, SLOT(hidePanel()) );
|
---|
3100 | disconnect( core, SIGNAL(noVideo()), mplayerwindow, SLOT(hideLogo()) );
|
---|
3101 | } else {
|
---|
3102 | disconnect( core, SIGNAL(noVideo()), this, SLOT(hidePanel()) );
|
---|
3103 | connect( core, SIGNAL(noVideo()), mplayerwindow, SLOT(showLogo()) );
|
---|
3104 | if (!panel->isVisible()) {
|
---|
3105 | resize( width(), height() + 200);
|
---|
3106 | panel->show();
|
---|
3107 | }
|
---|
3108 | }
|
---|
3109 | #endif
|
---|
3110 |
|
---|
3111 | PrefAdvanced *advanced = pref_dialog->mod_advanced();
|
---|
3112 | #if REPAINT_BACKGROUND_OPTION
|
---|
3113 | if (advanced->repaintVideoBackgroundChanged()) {
|
---|
3114 | mplayerwindow->videoLayer()->setRepaintBackground(pref->repaint_video_background);
|
---|
3115 | }
|
---|
3116 | #endif
|
---|
3117 | #if USE_COLORKEY
|
---|
3118 | if (advanced->colorkeyChanged()) {
|
---|
3119 | mplayerwindow->setColorKey( pref->color_key );
|
---|
3120 | }
|
---|
3121 | #endif
|
---|
3122 | if (advanced->monitorAspectChanged()) {
|
---|
3123 | mplayerwindow->setMonitorAspect( pref->monitor_aspect_double() );
|
---|
3124 | }
|
---|
3125 | #if ALLOW_DEMUXER_CODEC_CHANGE
|
---|
3126 | if (advanced->lavfDemuxerChanged()) {
|
---|
3127 | core->mset.forced_demuxer = pref->use_lavf_demuxer ? "lavf" : "";
|
---|
3128 | }
|
---|
3129 | #endif
|
---|
3130 |
|
---|
3131 | // Update playlist preferences
|
---|
3132 | PrefPlaylist * pl = pref_dialog->mod_playlist();
|
---|
3133 | playlist->setDirectoryRecursion(pl->directoryRecursion());
|
---|
3134 | playlist->setAutoGetInfo(pl->autoGetInfo());
|
---|
3135 | playlist->setSavePlaylistOnExit(pl->savePlaylistOnExit());
|
---|
3136 | playlist->setPlayFilesFromStart(pl->playFilesFromStart());
|
---|
3137 | playlist->setIgnorePlayerErrors(pl->ignorePlayerErrors());
|
---|
3138 |
|
---|
3139 |
|
---|
3140 | if (need_update_language) {
|
---|
3141 | translator->load(pref->language);
|
---|
3142 | }
|
---|
3143 |
|
---|
3144 | setJumpTexts(); // Update texts in menus
|
---|
3145 | updateWidgets(); // Update the screenshot action
|
---|
3146 |
|
---|
3147 | #if STYLE_SWITCHING
|
---|
3148 | if (_interface->styleChanged()) {
|
---|
3149 | applyStyles();
|
---|
3150 | }
|
---|
3151 | #endif
|
---|
3152 |
|
---|
3153 | // Restart the video if needed
|
---|
3154 | if (pref_dialog->requiresRestart())
|
---|
3155 | core->restart();
|
---|
3156 |
|
---|
3157 | // Update actions
|
---|
3158 | pref_dialog->mod_input()->actions_editor->applyChanges();
|
---|
3159 | saveActions();
|
---|
3160 |
|
---|
3161 | #ifndef NO_USE_INI_FILES
|
---|
3162 | pref->save();
|
---|
3163 | #endif
|
---|
3164 |
|
---|
3165 |
|
---|
3166 | if (_interface->guiChanged()) {
|
---|
3167 | #ifdef GUI_CHANGE_ON_RUNTIME
|
---|
3168 | core->stop();
|
---|
3169 | emit guiChanged(pref->gui);
|
---|
3170 | #else
|
---|
3171 | QMessageBox::information(this, tr("Information"),
|
---|
3172 | tr("You need to restart SMPlayer to use the new GUI.") );
|
---|
3173 | #endif
|
---|
3174 | }
|
---|
3175 |
|
---|
3176 | if (old_player_type != PlayerID::player(pref->mplayer_bin)) {
|
---|
3177 | qDebug("BaseGui::applyNewPreferences: player changed!");
|
---|
3178 | // Hack, simulate a change of GUI to restart the interface
|
---|
3179 | // FIXME: try to create a new Core::proc in the future
|
---|
3180 | #ifdef GUI_CHANGE_ON_RUNTIME
|
---|
3181 | core->stop();
|
---|
3182 | emit guiChanged(pref->gui);
|
---|
3183 | #endif
|
---|
3184 | }
|
---|
3185 | }
|
---|
3186 |
|
---|
3187 |
|
---|
3188 | void BaseGui::showFilePropertiesDialog() {
|
---|
3189 | qDebug("BaseGui::showFilePropertiesDialog");
|
---|
3190 |
|
---|
3191 | exitFullscreenIfNeeded();
|
---|
3192 |
|
---|
3193 | if (!file_dialog) {
|
---|
3194 | createFilePropertiesDialog();
|
---|
3195 | }
|
---|
3196 |
|
---|
3197 | setDataToFileProperties();
|
---|
3198 |
|
---|
3199 | file_dialog->show();
|
---|
3200 | }
|
---|
3201 |
|
---|
3202 | void BaseGui::setDataToFileProperties() {
|
---|
3203 | #if ALLOW_DEMUXER_CODEC_CHANGE
|
---|
3204 | InfoReader *i = InfoReader::obj();
|
---|
3205 | i->getInfo();
|
---|
3206 | file_dialog->setCodecs( i->vcList(), i->acList(), i->demuxerList() );
|
---|
3207 |
|
---|
3208 | // Save a copy of the original values
|
---|
3209 | if (core->mset.original_demuxer.isEmpty())
|
---|
3210 | core->mset.original_demuxer = core->mdat.demuxer;
|
---|
3211 |
|
---|
3212 | if (core->mset.original_video_codec.isEmpty())
|
---|
3213 | core->mset.original_video_codec = core->mdat.video_codec;
|
---|
3214 |
|
---|
3215 | if (core->mset.original_audio_codec.isEmpty())
|
---|
3216 | core->mset.original_audio_codec = core->mdat.audio_codec;
|
---|
3217 |
|
---|
3218 | QString demuxer = core->mset.forced_demuxer;
|
---|
3219 | if (demuxer.isEmpty()) demuxer = core->mdat.demuxer;
|
---|
3220 |
|
---|
3221 | QString ac = core->mset.forced_audio_codec;
|
---|
3222 | if (ac.isEmpty()) ac = core->mdat.audio_codec;
|
---|
3223 |
|
---|
3224 | QString vc = core->mset.forced_video_codec;
|
---|
3225 | if (vc.isEmpty()) vc = core->mdat.video_codec;
|
---|
3226 |
|
---|
3227 | file_dialog->setDemuxer(demuxer, core->mset.original_demuxer);
|
---|
3228 | file_dialog->setAudioCodec(ac, core->mset.original_audio_codec);
|
---|
3229 | file_dialog->setVideoCodec(vc, core->mset.original_video_codec);
|
---|
3230 | #endif
|
---|
3231 |
|
---|
3232 | file_dialog->setMplayerAdditionalArguments( core->mset.mplayer_additional_options );
|
---|
3233 | file_dialog->setMplayerAdditionalVideoFilters( core->mset.mplayer_additional_video_filters );
|
---|
3234 | file_dialog->setMplayerAdditionalAudioFilters( core->mset.mplayer_additional_audio_filters );
|
---|
3235 |
|
---|
3236 | file_dialog->setMediaData( core->mdat );
|
---|
3237 | }
|
---|
3238 |
|
---|
3239 | void BaseGui::applyFileProperties() {
|
---|
3240 | qDebug("BaseGui::applyFileProperties");
|
---|
3241 |
|
---|
3242 | bool need_restart = false;
|
---|
3243 |
|
---|
3244 | #undef TEST_AND_SET
|
---|
3245 | #define TEST_AND_SET( Pref, Dialog ) \
|
---|
3246 | if ( Pref != Dialog ) { Pref = Dialog; need_restart = true; }
|
---|
3247 |
|
---|
3248 | #if ALLOW_DEMUXER_CODEC_CHANGE
|
---|
3249 | bool demuxer_changed = false;
|
---|
3250 |
|
---|
3251 | QString prev_demuxer = core->mset.forced_demuxer;
|
---|
3252 |
|
---|
3253 | QString demuxer = file_dialog->demuxer();
|
---|
3254 | if (demuxer == core->mset.original_demuxer) demuxer="";
|
---|
3255 | TEST_AND_SET(core->mset.forced_demuxer, demuxer);
|
---|
3256 |
|
---|
3257 | if (prev_demuxer != core->mset.forced_demuxer) {
|
---|
3258 | // Demuxer changed
|
---|
3259 | demuxer_changed = true;
|
---|
3260 | core->mset.current_audio_id = MediaSettings::NoneSelected;
|
---|
3261 | core->mset.current_sub_id = MediaSettings::NoneSelected;
|
---|
3262 | }
|
---|
3263 |
|
---|
3264 | QString ac = file_dialog->audioCodec();
|
---|
3265 | if (ac == core->mset.original_audio_codec) ac="";
|
---|
3266 | TEST_AND_SET(core->mset.forced_audio_codec, ac);
|
---|
3267 |
|
---|
3268 | QString vc = file_dialog->videoCodec();
|
---|
3269 | if (vc == core->mset.original_video_codec) vc="";
|
---|
3270 | TEST_AND_SET(core->mset.forced_video_codec, vc);
|
---|
3271 | #endif
|
---|
3272 |
|
---|
3273 | TEST_AND_SET(core->mset.mplayer_additional_options, file_dialog->mplayerAdditionalArguments());
|
---|
3274 | TEST_AND_SET(core->mset.mplayer_additional_video_filters, file_dialog->mplayerAdditionalVideoFilters());
|
---|
3275 | TEST_AND_SET(core->mset.mplayer_additional_audio_filters, file_dialog->mplayerAdditionalAudioFilters());
|
---|
3276 |
|
---|
3277 | #if ALLOW_DEMUXER_CODEC_CHANGE
|
---|
3278 | // Restart the video to apply
|
---|
3279 | if (need_restart) {
|
---|
3280 | if (demuxer_changed) {
|
---|
3281 | core->reload();
|
---|
3282 | } else {
|
---|
3283 | core->restart();
|
---|
3284 | }
|
---|
3285 | }
|
---|
3286 | #endif
|
---|
3287 | }
|
---|
3288 |
|
---|
3289 |
|
---|
3290 | void BaseGui::updateMediaInfo() {
|
---|
3291 | qDebug("BaseGui::updateMediaInfo");
|
---|
3292 |
|
---|
3293 | if (file_dialog) {
|
---|
3294 | if (file_dialog->isVisible()) setDataToFileProperties();
|
---|
3295 | }
|
---|
3296 |
|
---|
3297 | setWindowCaption( core->mdat.displayName(pref->show_tag_in_window_title) + " - SMPlayer" );
|
---|
3298 |
|
---|
3299 | emit videoInfoChanged(core->mdat.video_width, core->mdat.video_height, core->mdat.video_fps.toDouble());
|
---|
3300 | }
|
---|
3301 |
|
---|
3302 | void BaseGui::newMediaLoaded() {
|
---|
3303 | qDebug("BaseGui::newMediaLoaded");
|
---|
3304 |
|
---|
3305 | QString stream_title = core->mdat.stream_title;
|
---|
3306 | qDebug("BaseGui::newMediaLoaded: mdat.stream_title: %s", stream_title.toUtf8().constData());
|
---|
3307 |
|
---|
3308 | if (!stream_title.isEmpty()) {
|
---|
3309 | pref->history_recents->addItem( core->mdat.filename, stream_title );
|
---|
3310 | //pref->history_recents->list();
|
---|
3311 | } else {
|
---|
3312 | pref->history_recents->addItem( core->mdat.filename );
|
---|
3313 | }
|
---|
3314 | updateRecents();
|
---|
3315 |
|
---|
3316 | // If a VCD, Audio CD or DVD, add items to playlist
|
---|
3317 | bool is_disc = ( (core->mdat.type == TYPE_VCD) || (core->mdat.type == TYPE_DVD) || (core->mdat.type == TYPE_AUDIO_CD) );
|
---|
3318 | #if DVDNAV_SUPPORT
|
---|
3319 | // Don't add the list of titles if using dvdnav
|
---|
3320 | if ((core->mdat.type == TYPE_DVD) && (core->mdat.filename.startsWith("dvdnav:"))) is_disc = false;
|
---|
3321 | #endif
|
---|
3322 | if (pref->auto_add_to_playlist && is_disc)
|
---|
3323 | {
|
---|
3324 | int first_title = 1;
|
---|
3325 | if (core->mdat.type == TYPE_VCD) first_title = pref->vcd_initial_title;
|
---|
3326 |
|
---|
3327 | QString type = "dvd"; // FIXME: support dvdnav
|
---|
3328 | if (core->mdat.type == TYPE_VCD) type="vcd";
|
---|
3329 | else
|
---|
3330 | if (core->mdat.type == TYPE_AUDIO_CD) type="cdda";
|
---|
3331 |
|
---|
3332 | if (core->mset.current_title_id == first_title) {
|
---|
3333 | playlist->clear();
|
---|
3334 | QStringList l;
|
---|
3335 | QString s;
|
---|
3336 | QString folder;
|
---|
3337 | if (core->mdat.type == TYPE_DVD) {
|
---|
3338 | DiscData disc_data = DiscName::split(core->mdat.filename);
|
---|
3339 | folder = disc_data.device;
|
---|
3340 | }
|
---|
3341 | for (int n=0; n < core->mdat.titles.numItems(); n++) {
|
---|
3342 | s = type + "://" + QString::number(core->mdat.titles.itemAt(n).ID());
|
---|
3343 | if ( !folder.isEmpty() ) {
|
---|
3344 | s += "/" + folder; // FIXME: dvd names are not created as they should
|
---|
3345 | }
|
---|
3346 | l.append(s);
|
---|
3347 | }
|
---|
3348 | playlist->addFiles(l);
|
---|
3349 | //playlist->setModified(false); // Not a real playlist
|
---|
3350 | }
|
---|
3351 | } /*else {
|
---|
3352 | playlist->clear();
|
---|
3353 | playlist->addCurrentFile();
|
---|
3354 | }*/
|
---|
3355 |
|
---|
3356 | // Automatically add files to playlist
|
---|
3357 | if ((core->mdat.type == TYPE_FILE) && (pref->auto_add_to_playlist)) {
|
---|
3358 | //qDebug("BaseGui::newMediaLoaded: playlist count: %d", playlist->count());
|
---|
3359 | QStringList files_to_add;
|
---|
3360 | if (playlist->count() == 1) {
|
---|
3361 | files_to_add = Helper::filesForPlaylist(core->mdat.filename, pref->media_to_add_to_playlist);
|
---|
3362 | }
|
---|
3363 | if (!files_to_add.empty()) playlist->addFiles(files_to_add);
|
---|
3364 | }
|
---|
3365 | }
|
---|
3366 |
|
---|
3367 | void BaseGui::gotNoFileToPlay() {
|
---|
3368 | //qDebug("BaseGui::gotNoFileToPlay");
|
---|
3369 | playlist->resumePlay();
|
---|
3370 | }
|
---|
3371 |
|
---|
3372 | #ifdef LOG_MPLAYER
|
---|
3373 | void BaseGui::clearMplayerLog() {
|
---|
3374 | mplayer_log.clear();
|
---|
3375 | if (mplayer_log_window->isVisible()) mplayer_log_window->clear();
|
---|
3376 | }
|
---|
3377 |
|
---|
3378 | void BaseGui::recordMplayerLog(QString line) {
|
---|
3379 | if (pref->log_mplayer) {
|
---|
3380 | if ( (line.indexOf("A:")==-1) && (line.indexOf("V:")==-1) ) {
|
---|
3381 | line.append("\n");
|
---|
3382 | mplayer_log.append(line);
|
---|
3383 | if (mplayer_log_window->isVisible()) mplayer_log_window->appendText(line);
|
---|
3384 | }
|
---|
3385 | }
|
---|
3386 | }
|
---|
3387 |
|
---|
3388 | /*!
|
---|
3389 | Save the mplayer log to a file, so it can be used by external
|
---|
3390 | applications.
|
---|
3391 | */
|
---|
3392 | void BaseGui::autosaveMplayerLog() {
|
---|
3393 | qDebug("BaseGui::autosaveMplayerLog");
|
---|
3394 |
|
---|
3395 | if (pref->autosave_mplayer_log) {
|
---|
3396 | if (!pref->mplayer_log_saveto.isEmpty()) {
|
---|
3397 | QFile file( pref->mplayer_log_saveto );
|
---|
3398 | if ( file.open( QIODevice::WriteOnly ) ) {
|
---|
3399 | QTextStream strm( &file );
|
---|
3400 | strm << mplayer_log;
|
---|
3401 | file.close();
|
---|
3402 | }
|
---|
3403 | }
|
---|
3404 | }
|
---|
3405 | }
|
---|
3406 |
|
---|
3407 | void BaseGui::showMplayerLog() {
|
---|
3408 | qDebug("BaseGui::showMplayerLog");
|
---|
3409 |
|
---|
3410 | exitFullscreenIfNeeded();
|
---|
3411 |
|
---|
3412 | mplayer_log_window->setText( mplayer_log );
|
---|
3413 | mplayer_log_window->show();
|
---|
3414 | }
|
---|
3415 | #endif
|
---|
3416 |
|
---|
3417 | #ifdef LOG_SMPLAYER
|
---|
3418 | void BaseGui::recordSmplayerLog(QString line) {
|
---|
3419 | if (pref->log_smplayer) {
|
---|
3420 | line.append("\n");
|
---|
3421 | smplayer_log.append(line);
|
---|
3422 | if (smplayer_log_window->isVisible()) smplayer_log_window->appendText(line);
|
---|
3423 | }
|
---|
3424 | }
|
---|
3425 |
|
---|
3426 | void BaseGui::showLog() {
|
---|
3427 | qDebug("BaseGui::showLog");
|
---|
3428 |
|
---|
3429 | exitFullscreenIfNeeded();
|
---|
3430 |
|
---|
3431 | smplayer_log_window->setText( smplayer_log );
|
---|
3432 | smplayer_log_window->show();
|
---|
3433 | }
|
---|
3434 | #endif
|
---|
3435 |
|
---|
3436 |
|
---|
3437 | void BaseGui::initializeMenus() {
|
---|
3438 | qDebug("BaseGui::initializeMenus");
|
---|
3439 |
|
---|
3440 | #define EMPTY 1
|
---|
3441 |
|
---|
3442 | int n;
|
---|
3443 |
|
---|
3444 | // Subtitles
|
---|
3445 | subtitleTrackGroup->clear(true);
|
---|
3446 | QAction * subNoneAct = subtitleTrackGroup->addAction( tr("&None") );
|
---|
3447 | subNoneAct->setData(MediaSettings::SubNone);
|
---|
3448 | subNoneAct->setCheckable(true);
|
---|
3449 | for (n=0; n < core->mdat.subs.numItems(); n++) {
|
---|
3450 | QAction *a = new QAction(subtitleTrackGroup);
|
---|
3451 | a->setCheckable(true);
|
---|
3452 | a->setText(core->mdat.subs.itemAt(n).displayName());
|
---|
3453 | a->setData(n);
|
---|
3454 | }
|
---|
3455 | subtitles_track_menu->addActions( subtitleTrackGroup->actions() );
|
---|
3456 |
|
---|
3457 | #ifdef MPV_SUPPORT
|
---|
3458 | // Secondary Subtitles
|
---|
3459 | secondarySubtitleTrackGroup->clear(true);
|
---|
3460 | QAction * subSecNoneAct = secondarySubtitleTrackGroup->addAction( tr("&None") );
|
---|
3461 | subSecNoneAct->setData(MediaSettings::SubNone);
|
---|
3462 | subSecNoneAct->setCheckable(true);
|
---|
3463 | for (n=0; n < core->mdat.subs.numItems(); n++) {
|
---|
3464 | QAction *a = new QAction(secondarySubtitleTrackGroup);
|
---|
3465 | a->setCheckable(true);
|
---|
3466 | a->setText(core->mdat.subs.itemAt(n).displayName());
|
---|
3467 | a->setData(n);
|
---|
3468 | }
|
---|
3469 | secondary_subtitles_track_menu->addActions( secondarySubtitleTrackGroup->actions() );
|
---|
3470 | #endif
|
---|
3471 |
|
---|
3472 | // Audio
|
---|
3473 | audioTrackGroup->clear(true);
|
---|
3474 | // If using an external audio file, show the file in the menu, but disabled.
|
---|
3475 | if (!core->mset.external_audio.isEmpty()) {
|
---|
3476 | QAction * a = audioTrackGroup->addAction( QFileInfo(core->mset.external_audio).fileName() );
|
---|
3477 | a->setEnabled(false);
|
---|
3478 | a->setCheckable(true);
|
---|
3479 | a->setChecked(true);
|
---|
3480 | }
|
---|
3481 | else
|
---|
3482 | if (core->mdat.audios.numItems()==0) {
|
---|
3483 | QAction * a = audioTrackGroup->addAction( tr("<empty>") );
|
---|
3484 | a->setEnabled(false);
|
---|
3485 | } else {
|
---|
3486 | for (n=0; n < core->mdat.audios.numItems(); n++) {
|
---|
3487 | QAction *a = new QAction(audioTrackGroup);
|
---|
3488 | a->setCheckable(true);
|
---|
3489 | a->setText(core->mdat.audios.itemAt(n).displayName());
|
---|
3490 | a->setData(core->mdat.audios.itemAt(n).ID());
|
---|
3491 | }
|
---|
3492 | }
|
---|
3493 | audiotrack_menu->addActions( audioTrackGroup->actions() );
|
---|
3494 |
|
---|
3495 | #if PROGRAM_SWITCH
|
---|
3496 | // Program
|
---|
3497 | programTrackGroup->clear(true);
|
---|
3498 | if (core->mdat.programs.numItems()==0) {
|
---|
3499 | QAction * a = programTrackGroup->addAction( tr("<empty>") );
|
---|
3500 | a->setEnabled(false);
|
---|
3501 | } else {
|
---|
3502 | for (n=0; n < core->mdat.programs.numItems(); n++) {
|
---|
3503 | QAction *a = new QAction(programTrackGroup);
|
---|
3504 | a->setCheckable(true);
|
---|
3505 | a->setText(core->mdat.programs.itemAt(n).displayName());
|
---|
3506 | a->setData(core->mdat.programs.itemAt(n).ID());
|
---|
3507 | }
|
---|
3508 | }
|
---|
3509 | programtrack_menu->addActions( programTrackGroup->actions() );
|
---|
3510 | #endif
|
---|
3511 |
|
---|
3512 | // Video
|
---|
3513 | videoTrackGroup->clear(true);
|
---|
3514 | if (core->mdat.videos.numItems()==0) {
|
---|
3515 | QAction * a = videoTrackGroup->addAction( tr("<empty>") );
|
---|
3516 | a->setEnabled(false);
|
---|
3517 | } else {
|
---|
3518 | for (n=0; n < core->mdat.videos.numItems(); n++) {
|
---|
3519 | QAction *a = new QAction(videoTrackGroup);
|
---|
3520 | a->setCheckable(true);
|
---|
3521 | a->setText(core->mdat.videos.itemAt(n).displayName());
|
---|
3522 | a->setData(core->mdat.videos.itemAt(n).ID());
|
---|
3523 | }
|
---|
3524 | }
|
---|
3525 | videotrack_menu->addActions( videoTrackGroup->actions() );
|
---|
3526 |
|
---|
3527 | // Titles
|
---|
3528 | titleGroup->clear(true);
|
---|
3529 | if (core->mdat.titles.numItems()==0) {
|
---|
3530 | QAction * a = titleGroup->addAction( tr("<empty>") );
|
---|
3531 | a->setEnabled(false);
|
---|
3532 | } else {
|
---|
3533 | for (n=0; n < core->mdat.titles.numItems(); n++) {
|
---|
3534 | QAction *a = new QAction(titleGroup);
|
---|
3535 | a->setCheckable(true);
|
---|
3536 | a->setText(core->mdat.titles.itemAt(n).displayName());
|
---|
3537 | a->setData(core->mdat.titles.itemAt(n).ID());
|
---|
3538 | }
|
---|
3539 | }
|
---|
3540 | titles_menu->addActions( titleGroup->actions() );
|
---|
3541 |
|
---|
3542 | // Chapters
|
---|
3543 | chapterGroup->clear(true);
|
---|
3544 | //qDebug("BaseGui::initializeMenus: mdat.chapters.numItems: %d", core->mdat.chapters.numItems());
|
---|
3545 | if (core->mdat.chapters.numItems() > 0) {
|
---|
3546 | for (n=0; n < core->mdat.chapters.numItems(); n++) {
|
---|
3547 | QAction *a = new QAction(chapterGroup);
|
---|
3548 | //a->setCheckable(true);
|
---|
3549 | //qDebug("BaseGui::initializeMenus: chapter %d name: %s", n, core->mdat.chapters.itemAt(n).name().toUtf8().constData());
|
---|
3550 | a->setText(core->mdat.chapters.itemAt(n).name());
|
---|
3551 | a->setData(core->mdat.chapters.itemAt(n).ID());
|
---|
3552 | }
|
---|
3553 | }
|
---|
3554 | else
|
---|
3555 | if (core->mdat.n_chapters > 0) {
|
---|
3556 | for (n=0; n < core->mdat.n_chapters; n++) {
|
---|
3557 | QAction *a = new QAction(chapterGroup);
|
---|
3558 | //a->setCheckable(true);
|
---|
3559 | a->setText( QString::number(n+1) );
|
---|
3560 | a->setData( n + Core::firstChapter() );
|
---|
3561 | }
|
---|
3562 | }
|
---|
3563 | else {
|
---|
3564 | QAction * a = chapterGroup->addAction( tr("<empty>") );
|
---|
3565 | a->setEnabled(false);
|
---|
3566 | }
|
---|
3567 | chapters_menu->addActions( chapterGroup->actions() );
|
---|
3568 |
|
---|
3569 | // Angles
|
---|
3570 | angleGroup->clear(true);
|
---|
3571 | int n_angles = 0;
|
---|
3572 | if (core->mset.current_angle_id > 0) {
|
---|
3573 | int i = core->mdat.titles.find(core->mset.current_angle_id);
|
---|
3574 | if (i > -1) n_angles = core->mdat.titles.itemAt(i).angles();
|
---|
3575 | }
|
---|
3576 | if (n_angles > 0) {
|
---|
3577 | for (n=1; n <= n_angles; n++) {
|
---|
3578 | QAction *a = new QAction(angleGroup);
|
---|
3579 | a->setCheckable(true);
|
---|
3580 | a->setText( QString::number(n) );
|
---|
3581 | a->setData( n );
|
---|
3582 | }
|
---|
3583 | } else {
|
---|
3584 | QAction * a = angleGroup->addAction( tr("<empty>") );
|
---|
3585 | a->setEnabled(false);
|
---|
3586 | }
|
---|
3587 | angles_menu->addActions( angleGroup->actions() );
|
---|
3588 |
|
---|
3589 | #ifdef BOOKMARKS
|
---|
3590 | updateBookmarks();
|
---|
3591 | #endif
|
---|
3592 | }
|
---|
3593 |
|
---|
3594 | #ifdef BOOKMARKS
|
---|
3595 | void BaseGui::updateBookmarks() {
|
---|
3596 | qDebug("BaseGui::updateBookmarks");
|
---|
3597 |
|
---|
3598 | // Bookmarks
|
---|
3599 | bookmarkGroup->clear(true);
|
---|
3600 | int n_bookmarks = core->mset.bookmarks.size();
|
---|
3601 | if (n_bookmarks > 0) {
|
---|
3602 | QMap<int, QString>::const_iterator i = core->mset.bookmarks.constBegin();
|
---|
3603 | while (i != core->mset.bookmarks.constEnd()) {
|
---|
3604 | QString name = i.value();
|
---|
3605 | int time = i.key();
|
---|
3606 | QAction *a = new QAction(bookmarkGroup);
|
---|
3607 | QString text;
|
---|
3608 | if (name.isEmpty()) {
|
---|
3609 | text = Helper::formatTime(time);
|
---|
3610 | } else {
|
---|
3611 | text = QString("%1 (%2)").arg(name).arg(Helper::formatTime(time));
|
---|
3612 | }
|
---|
3613 | a->setCheckable(false);
|
---|
3614 | a->setText(text);
|
---|
3615 | a->setData(time);
|
---|
3616 | i++;
|
---|
3617 | }
|
---|
3618 | }
|
---|
3619 | bookmark_menu->clear();
|
---|
3620 | bookmark_menu->addAction(addBookmarkAct);
|
---|
3621 | bookmark_menu->addAction(editBookmarksAct);
|
---|
3622 | bookmark_menu->addSeparator();
|
---|
3623 | bookmark_menu->addActions(bookmarkGroup->actions());
|
---|
3624 | }
|
---|
3625 | #endif
|
---|
3626 |
|
---|
3627 | void BaseGui::updateRecents() {
|
---|
3628 | qDebug("BaseGui::updateRecents");
|
---|
3629 |
|
---|
3630 | recentfiles_menu->clear();
|
---|
3631 |
|
---|
3632 | int current_items = 0;
|
---|
3633 |
|
---|
3634 | if (pref->history_recents->count() > 0) {
|
---|
3635 | for (int n=0; n < pref->history_recents->count(); n++) {
|
---|
3636 | QString i = QString::number( n+1 );
|
---|
3637 | QString fullname = pref->history_recents->item(n);
|
---|
3638 | QString filename = fullname;
|
---|
3639 | QFileInfo fi(fullname);
|
---|
3640 | //if (fi.exists()) filename = fi.fileName(); // Can be slow
|
---|
3641 |
|
---|
3642 | // Let's see if it looks like a file (no dvd://1 or something)
|
---|
3643 | if (fullname.indexOf(QRegExp("^.*://.*")) == -1) filename = fi.fileName();
|
---|
3644 |
|
---|
3645 | if (filename.size() > 85) {
|
---|
3646 | filename = filename.left(80) + "...";
|
---|
3647 | }
|
---|
3648 |
|
---|
3649 | QString show_name = filename;
|
---|
3650 | QString title = pref->history_recents->title(n);
|
---|
3651 | if (!title.isEmpty()) show_name = title;
|
---|
3652 |
|
---|
3653 | QAction * a = recentfiles_menu->addAction( QString("%1. " + show_name ).arg( i.insert( i.size()-1, '&' ), 3, ' ' ));
|
---|
3654 | a->setStatusTip(fullname);
|
---|
3655 | a->setData(n);
|
---|
3656 | connect(a, SIGNAL(triggered()), this, SLOT(openRecent()));
|
---|
3657 | current_items++;
|
---|
3658 | }
|
---|
3659 | } else {
|
---|
3660 | QAction * a = recentfiles_menu->addAction( tr("<empty>") );
|
---|
3661 | a->setEnabled(false);
|
---|
3662 | }
|
---|
3663 |
|
---|
3664 | recentfiles_menu->menuAction()->setVisible( current_items > 0 );
|
---|
3665 | if (current_items > 0) {
|
---|
3666 | recentfiles_menu->addSeparator();
|
---|
3667 | recentfiles_menu->addAction( clearRecentsAct );
|
---|
3668 | }
|
---|
3669 | }
|
---|
3670 |
|
---|
3671 | void BaseGui::clearRecentsList() {
|
---|
3672 | int ret = QMessageBox::question(this, tr("Confirm deletion - SMPlayer"),
|
---|
3673 | tr("Delete the list of recent files?"),
|
---|
3674 | QMessageBox::Cancel, QMessageBox::Ok);
|
---|
3675 |
|
---|
3676 | if (ret == QMessageBox::Ok) {
|
---|
3677 | // Delete items in menu
|
---|
3678 | pref->history_recents->clear();
|
---|
3679 | updateRecents();
|
---|
3680 | }
|
---|
3681 | }
|
---|
3682 |
|
---|
3683 | void BaseGui::updateWidgets() {
|
---|
3684 | qDebug("BaseGui::updateWidgets");
|
---|
3685 |
|
---|
3686 | // Subtitles menu
|
---|
3687 | subtitleTrackGroup->setChecked( core->mset.current_sub_id );
|
---|
3688 |
|
---|
3689 | #ifdef MPV_SUPPORT
|
---|
3690 | // Secondary subtitles menu
|
---|
3691 | secondarySubtitleTrackGroup->setChecked( core->mset.current_secondary_sub_id );
|
---|
3692 | #endif
|
---|
3693 |
|
---|
3694 | // Disable the unload subs action if there's no external subtitles
|
---|
3695 | unloadSubsAct->setEnabled( !core->mset.external_subtitles.isEmpty() );
|
---|
3696 |
|
---|
3697 | subFPSGroup->setEnabled( !core->mset.external_subtitles.isEmpty() );
|
---|
3698 |
|
---|
3699 | // Closed caption menu
|
---|
3700 | ccGroup->setChecked( core->mset.closed_caption_channel );
|
---|
3701 |
|
---|
3702 | // Subfps menu
|
---|
3703 | subFPSGroup->setChecked( core->mset.external_subtitles_fps );
|
---|
3704 |
|
---|
3705 | // Audio menu
|
---|
3706 | audioTrackGroup->setChecked( core->mset.current_audio_id );
|
---|
3707 | channelsGroup->setChecked( core->mset.audio_use_channels );
|
---|
3708 | stereoGroup->setChecked( core->mset.stereo_mode );
|
---|
3709 | // Disable the unload audio file action if there's no external audio file
|
---|
3710 | unloadAudioAct->setEnabled( !core->mset.external_audio.isEmpty() );
|
---|
3711 |
|
---|
3712 | #if PROGRAM_SWITCH
|
---|
3713 | // Program menu
|
---|
3714 | programTrackGroup->setChecked( core->mset.current_program_id );
|
---|
3715 | #endif
|
---|
3716 |
|
---|
3717 | // Video menu
|
---|
3718 | videoTrackGroup->setChecked( core->mset.current_video_id );
|
---|
3719 |
|
---|
3720 | // Aspect ratio
|
---|
3721 | aspectGroup->setChecked( core->mset.aspect_ratio_id );
|
---|
3722 |
|
---|
3723 | // Rotate
|
---|
3724 | rotateGroup->setChecked( core->mset.rotate );
|
---|
3725 |
|
---|
3726 | #if USE_ADAPTER
|
---|
3727 | screenGroup->setChecked( pref->adapter );
|
---|
3728 | #endif
|
---|
3729 |
|
---|
3730 | // OSD
|
---|
3731 | osdGroup->setChecked( pref->osd );
|
---|
3732 |
|
---|
3733 | // Titles
|
---|
3734 | titleGroup->setChecked( core->mset.current_title_id );
|
---|
3735 |
|
---|
3736 | // Angles
|
---|
3737 | angleGroup->setChecked( core->mset.current_angle_id );
|
---|
3738 |
|
---|
3739 | // Deinterlace menu
|
---|
3740 | deinterlaceGroup->setChecked( core->mset.current_deinterlacer );
|
---|
3741 |
|
---|
3742 | // Video size menu
|
---|
3743 | sizeGroup->setChecked( pref->size_factor );
|
---|
3744 |
|
---|
3745 | // Auto phase
|
---|
3746 | phaseAct->setChecked( core->mset.phase_filter );
|
---|
3747 |
|
---|
3748 | // Deblock
|
---|
3749 | deblockAct->setChecked( core->mset.deblock_filter );
|
---|
3750 |
|
---|
3751 | // Dering
|
---|
3752 | deringAct->setChecked( core->mset.dering_filter );
|
---|
3753 |
|
---|
3754 | // Gradfun
|
---|
3755 | gradfunAct->setChecked( core->mset.gradfun_filter );
|
---|
3756 |
|
---|
3757 | // Add noise
|
---|
3758 | addNoiseAct->setChecked( core->mset.noise_filter );
|
---|
3759 |
|
---|
3760 | // Letterbox
|
---|
3761 | addLetterboxAct->setChecked( core->mset.add_letterbox );
|
---|
3762 |
|
---|
3763 | // Upscaling
|
---|
3764 | upscaleAct->setChecked( core->mset.upscaling_filter );
|
---|
3765 |
|
---|
3766 |
|
---|
3767 | // Postprocessing
|
---|
3768 | postProcessingAct->setChecked( core->mset.postprocessing_filter );
|
---|
3769 |
|
---|
3770 | // Denoise submenu
|
---|
3771 | denoiseGroup->setChecked( core->mset.current_denoiser );
|
---|
3772 |
|
---|
3773 | // Unsharp submenu
|
---|
3774 | unsharpGroup->setChecked( core->mset.current_unsharp );
|
---|
3775 |
|
---|
3776 | /*
|
---|
3777 | // Fullscreen button
|
---|
3778 | fullscreenbutton->setOn(pref->fullscreen);
|
---|
3779 |
|
---|
3780 | // Mute button
|
---|
3781 | mutebutton->setOn(core->mset.mute);
|
---|
3782 | if (core->mset.mute)
|
---|
3783 | mutebutton->setPixmap( Images::icon("mute_small") );
|
---|
3784 | else
|
---|
3785 | mutebutton->setPixmap( Images::icon("volume_small") );
|
---|
3786 |
|
---|
3787 | // Volume slider
|
---|
3788 | volumeslider->setValue( core->mset.volume );
|
---|
3789 | */
|
---|
3790 |
|
---|
3791 | // Mute menu option
|
---|
3792 | muteAct->setChecked( (pref->global_volume ? pref->mute : core->mset.mute) );
|
---|
3793 |
|
---|
3794 | #ifdef MPLAYER_SUPPORT
|
---|
3795 | // Karaoke menu option
|
---|
3796 | karaokeAct->setChecked( core->mset.karaoke_filter );
|
---|
3797 | #endif
|
---|
3798 |
|
---|
3799 | // Extrastereo menu option
|
---|
3800 | extrastereoAct->setChecked( core->mset.extrastereo_filter );
|
---|
3801 |
|
---|
3802 | // Volnorm menu option
|
---|
3803 | volnormAct->setChecked( core->mset.volnorm_filter );
|
---|
3804 |
|
---|
3805 | // Repeat menu option
|
---|
3806 | repeatAct->setChecked( core->mset.loop );
|
---|
3807 |
|
---|
3808 | // Fullscreen action
|
---|
3809 | fullscreenAct->setChecked( pref->fullscreen );
|
---|
3810 |
|
---|
3811 | // Time slider
|
---|
3812 | if (core->state()==Core::Stopped) {
|
---|
3813 | //FIXME
|
---|
3814 | //timeslider->setValue( (int) core->mset.current_sec );
|
---|
3815 | }
|
---|
3816 |
|
---|
3817 | // Video equalizer
|
---|
3818 | videoEqualizerAct->setChecked( video_equalizer->isVisible() );
|
---|
3819 | video_equalizer->setBySoftware( pref->use_soft_video_eq );
|
---|
3820 |
|
---|
3821 | // Audio equalizer
|
---|
3822 | audioEqualizerAct->setChecked( audio_equalizer->isVisible() );
|
---|
3823 |
|
---|
3824 | // Playlist
|
---|
3825 | #if !DOCK_PLAYLIST
|
---|
3826 | //showPlaylistAct->setChecked( playlist->isVisible() );
|
---|
3827 | #endif
|
---|
3828 |
|
---|
3829 | #if DOCK_PLAYLIST
|
---|
3830 | showPlaylistAct->setChecked( playlist->isVisible() );
|
---|
3831 | #endif
|
---|
3832 |
|
---|
3833 | // Compact mode
|
---|
3834 | compactAct->setChecked( pref->compact_mode );
|
---|
3835 |
|
---|
3836 | // Stay on top
|
---|
3837 | onTopActionGroup->setChecked( (int) pref->stay_on_top );
|
---|
3838 |
|
---|
3839 | // Flip
|
---|
3840 | flipAct->setChecked( core->mset.flip );
|
---|
3841 |
|
---|
3842 | // Mirror
|
---|
3843 | mirrorAct->setChecked( core->mset.mirror );
|
---|
3844 |
|
---|
3845 | // Use custom style
|
---|
3846 | useCustomSubStyleAct->setChecked( pref->enable_ass_styles );
|
---|
3847 |
|
---|
3848 | // Forced subs
|
---|
3849 | useForcedSubsOnlyAct->setChecked( pref->use_forced_subs_only );
|
---|
3850 |
|
---|
3851 | // Subtitle visibility
|
---|
3852 | subVisibilityAct->setChecked(pref->sub_visibility);
|
---|
3853 |
|
---|
3854 | // Enable or disable subtitle options
|
---|
3855 | bool e = ((core->mset.current_sub_id != MediaSettings::SubNone) &&
|
---|
3856 | (core->mset.current_sub_id != MediaSettings::NoneSelected));
|
---|
3857 |
|
---|
3858 | if (core->mset.closed_caption_channel !=0 ) e = true; // Enable if using closed captions
|
---|
3859 |
|
---|
3860 | decSubDelayAct->setEnabled(e);
|
---|
3861 | incSubDelayAct->setEnabled(e);
|
---|
3862 | subDelayAct->setEnabled(e);
|
---|
3863 | decSubPosAct->setEnabled(e);
|
---|
3864 | incSubPosAct->setEnabled(e);
|
---|
3865 | decSubScaleAct->setEnabled(e);
|
---|
3866 | incSubScaleAct->setEnabled(e);
|
---|
3867 | decSubStepAct->setEnabled(e);
|
---|
3868 | incSubStepAct->setEnabled(e);
|
---|
3869 | #ifdef MPV_SUPPORT
|
---|
3870 | seekNextSubAct->setEnabled(e);
|
---|
3871 | seekPrevSubAct->setEnabled(e);
|
---|
3872 | #endif
|
---|
3873 | }
|
---|
3874 |
|
---|
3875 | void BaseGui::updateVideoEqualizer() {
|
---|
3876 | // Equalizer
|
---|
3877 | video_equalizer->setContrast( core->mset.contrast );
|
---|
3878 | video_equalizer->setBrightness( core->mset.brightness );
|
---|
3879 | video_equalizer->setHue( core->mset.hue );
|
---|
3880 | video_equalizer->setSaturation( core->mset.saturation );
|
---|
3881 | video_equalizer->setGamma( core->mset.gamma );
|
---|
3882 | }
|
---|
3883 |
|
---|
3884 | void BaseGui::updateAudioEqualizer() {
|
---|
3885 | // Audio Equalizer
|
---|
3886 | AudioEqualizerList l = pref->global_audio_equalizer ? pref->audio_equalizer : core->mset.audio_equalizer;
|
---|
3887 | audio_equalizer->setEqualizer(l);
|
---|
3888 | }
|
---|
3889 |
|
---|
3890 | void BaseGui::setDefaultValuesFromVideoEqualizer() {
|
---|
3891 | qDebug("BaseGui::setDefaultValuesFromVideoEqualizer");
|
---|
3892 |
|
---|
3893 | pref->initial_contrast = video_equalizer->contrast();
|
---|
3894 | pref->initial_brightness = video_equalizer->brightness();
|
---|
3895 | pref->initial_hue = video_equalizer->hue();
|
---|
3896 | pref->initial_saturation = video_equalizer->saturation();
|
---|
3897 | pref->initial_gamma = video_equalizer->gamma();
|
---|
3898 |
|
---|
3899 | QMessageBox::information(this, tr("Information"),
|
---|
3900 | tr("The current values have been stored to be "
|
---|
3901 | "used as default.") );
|
---|
3902 | }
|
---|
3903 |
|
---|
3904 | void BaseGui::changeVideoEqualizerBySoftware(bool b) {
|
---|
3905 | qDebug("BaseGui::changeVideoEqualizerBySoftware: %d", b);
|
---|
3906 |
|
---|
3907 | if (b != pref->use_soft_video_eq) {
|
---|
3908 | pref->use_soft_video_eq = b;
|
---|
3909 | core->restart();
|
---|
3910 | }
|
---|
3911 | }
|
---|
3912 |
|
---|
3913 | /*
|
---|
3914 | void BaseGui::playlistVisibilityChanged() {
|
---|
3915 | #if !DOCK_PLAYLIST
|
---|
3916 | bool visible = playlist->isVisible();
|
---|
3917 |
|
---|
3918 | showPlaylistAct->setChecked( visible );
|
---|
3919 | #endif
|
---|
3920 | }
|
---|
3921 | */
|
---|
3922 |
|
---|
3923 | /*
|
---|
3924 | void BaseGui::openRecent(int item) {
|
---|
3925 | qDebug("BaseGui::openRecent: %d", item);
|
---|
3926 | if ((item > -1) && (item < RECENTS_CLEAR)) { // 1000 = Clear item
|
---|
3927 | open( recents->item(item) );
|
---|
3928 | }
|
---|
3929 | }
|
---|
3930 | */
|
---|
3931 |
|
---|
3932 | void BaseGui::openRecent() {
|
---|
3933 | QAction *a = qobject_cast<QAction *> (sender());
|
---|
3934 | if (a) {
|
---|
3935 | int item = a->data().toInt();
|
---|
3936 | qDebug("BaseGui::openRecent: %d", item);
|
---|
3937 | QString file = pref->history_recents->item(item);
|
---|
3938 |
|
---|
3939 | if (pref->auto_add_to_playlist) {
|
---|
3940 | if (playlist->maybeSave()) {
|
---|
3941 | playlist->clear();
|
---|
3942 | playlist->addFile(file, Playlist::NoGetInfo);
|
---|
3943 |
|
---|
3944 | open( file );
|
---|
3945 | }
|
---|
3946 | } else {
|
---|
3947 | open( file );
|
---|
3948 | }
|
---|
3949 |
|
---|
3950 | }
|
---|
3951 | }
|
---|
3952 |
|
---|
3953 | void BaseGui::open(QString file) {
|
---|
3954 | qDebug("BaseGui::open: '%s'", file.toUtf8().data());
|
---|
3955 |
|
---|
3956 | // If file is a playlist, open that playlist
|
---|
3957 | QString extension = QFileInfo(file).suffix().toLower();
|
---|
3958 | if ( ((extension=="m3u") || (extension=="m3u8")) && (QFile::exists(file)) ) {
|
---|
3959 | playlist->load_m3u(file);
|
---|
3960 | }
|
---|
3961 | else
|
---|
3962 | if (extension=="pls") {
|
---|
3963 | playlist->load_pls(file);
|
---|
3964 | }
|
---|
3965 | else
|
---|
3966 | if (extension=="xspf") {
|
---|
3967 | playlist->loadXSPF(file);
|
---|
3968 | }
|
---|
3969 | else
|
---|
3970 | if (QFileInfo(file).isDir()) {
|
---|
3971 | openDirectory(file);
|
---|
3972 | }
|
---|
3973 | else {
|
---|
3974 | // Let the core to open it, autodetecting the file type
|
---|
3975 | //if (playlist->maybeSave()) {
|
---|
3976 | // playlist->clear();
|
---|
3977 | // playlist->addFile(file);
|
---|
3978 |
|
---|
3979 | core->open(file);
|
---|
3980 | //}
|
---|
3981 | }
|
---|
3982 |
|
---|
3983 | if (QFile::exists(file)) pref->latest_dir = QFileInfo(file).absolutePath();
|
---|
3984 | }
|
---|
3985 |
|
---|
3986 | void BaseGui::openFiles(QStringList files) {
|
---|
3987 | qDebug("BaseGui::openFiles");
|
---|
3988 | if (files.empty()) return;
|
---|
3989 |
|
---|
3990 | #ifdef Q_OS_WIN
|
---|
3991 | files = Helper::resolveSymlinks(files); // Check for Windows shortcuts
|
---|
3992 | #endif
|
---|
3993 |
|
---|
3994 | if (files.count()==1) {
|
---|
3995 | if (pref->auto_add_to_playlist) {
|
---|
3996 | if (playlist->maybeSave()) {
|
---|
3997 | playlist->clear();
|
---|
3998 | playlist->addFile(files[0], Playlist::NoGetInfo);
|
---|
3999 |
|
---|
4000 | open(files[0]);
|
---|
4001 | }
|
---|
4002 | } else {
|
---|
4003 | open(files[0]);
|
---|
4004 | }
|
---|
4005 | } else {
|
---|
4006 | if (playlist->maybeSave()) {
|
---|
4007 | playlist->clear();
|
---|
4008 | playlist->addFiles(files);
|
---|
4009 | open(files[0]);
|
---|
4010 | }
|
---|
4011 | }
|
---|
4012 | }
|
---|
4013 |
|
---|
4014 | void BaseGui::openFavorite(QString file) {
|
---|
4015 | qDebug("BaseGui::openFavorite");
|
---|
4016 |
|
---|
4017 | openFiles(QStringList() << file);
|
---|
4018 | }
|
---|
4019 |
|
---|
4020 | void BaseGui::openURL() {
|
---|
4021 | qDebug("BaseGui::openURL");
|
---|
4022 |
|
---|
4023 | exitFullscreenIfNeeded();
|
---|
4024 |
|
---|
4025 | /*
|
---|
4026 | bool ok;
|
---|
4027 | QString s = QInputDialog::getText(this,
|
---|
4028 | tr("SMPlayer - Enter URL"), tr("URL:"), QLineEdit::Normal,
|
---|
4029 | pref->last_url, &ok );
|
---|
4030 |
|
---|
4031 | if ( ok && !s.isEmpty() ) {
|
---|
4032 |
|
---|
4033 | //playlist->clear();
|
---|
4034 | //playlistdock->hide();
|
---|
4035 |
|
---|
4036 | openURL(s);
|
---|
4037 | } else {
|
---|
4038 | // user entered nothing or pressed Cancel
|
---|
4039 | }
|
---|
4040 | */
|
---|
4041 |
|
---|
4042 | InputURL d(this);
|
---|
4043 |
|
---|
4044 | // Get url from clipboard
|
---|
4045 | QString clipboard_text = QApplication::clipboard()->text();
|
---|
4046 | if ((!clipboard_text.isEmpty()) && (clipboard_text.contains("://")) /*&& (QUrl(clipboard_text).isValid())*/) {
|
---|
4047 | d.setURL(clipboard_text);
|
---|
4048 | }
|
---|
4049 |
|
---|
4050 | for (int n=0; n < pref->history_urls->count(); n++) {
|
---|
4051 | d.setURL( pref->history_urls->url(n) );
|
---|
4052 | }
|
---|
4053 |
|
---|
4054 | if (d.exec() == QDialog::Accepted ) {
|
---|
4055 | QString url = d.url();
|
---|
4056 | if (!url.isEmpty()) {
|
---|
4057 | pref->history_urls->addUrl(url);
|
---|
4058 | openURL(url);
|
---|
4059 | }
|
---|
4060 | }
|
---|
4061 | }
|
---|
4062 |
|
---|
4063 | void BaseGui::openURL(QString url) {
|
---|
4064 | if (!url.isEmpty()) {
|
---|
4065 | //pref->history_urls->addUrl(url);
|
---|
4066 |
|
---|
4067 | if (pref->auto_add_to_playlist) {
|
---|
4068 | if (playlist->maybeSave()) {
|
---|
4069 | core->openStream(url);
|
---|
4070 |
|
---|
4071 | playlist->clear();
|
---|
4072 | playlist->addFile(url, Playlist::NoGetInfo);
|
---|
4073 | }
|
---|
4074 | } else {
|
---|
4075 | core->openStream(url);
|
---|
4076 | }
|
---|
4077 | }
|
---|
4078 | }
|
---|
4079 |
|
---|
4080 |
|
---|
4081 | void BaseGui::openFile() {
|
---|
4082 | qDebug("BaseGui::fileOpen");
|
---|
4083 |
|
---|
4084 | exitFullscreenIfNeeded();
|
---|
4085 |
|
---|
4086 | Extensions e;
|
---|
4087 | QString s = MyFileDialog::getOpenFileName(
|
---|
4088 | this, tr("Choose a file"), pref->latest_dir,
|
---|
4089 | tr("Multimedia") + e.allPlayable().forFilter()+";;" +
|
---|
4090 | tr("Video") + e.video().forFilter()+";;" +
|
---|
4091 | tr("Audio") + e.audio().forFilter()+";;" +
|
---|
4092 | tr("Playlists") + e.playlist().forFilter()+";;" +
|
---|
4093 | tr("All files") +" (*.*)" );
|
---|
4094 |
|
---|
4095 | if ( !s.isEmpty() ) {
|
---|
4096 | openFile(s);
|
---|
4097 | }
|
---|
4098 | }
|
---|
4099 |
|
---|
4100 | void BaseGui::openFile(QString file) {
|
---|
4101 | qDebug("BaseGui::openFile: '%s'", file.toUtf8().data());
|
---|
4102 |
|
---|
4103 | if ( !file.isEmpty() ) {
|
---|
4104 |
|
---|
4105 | //playlist->clear();
|
---|
4106 | //playlistdock->hide();
|
---|
4107 |
|
---|
4108 | // If file is a playlist, open that playlist
|
---|
4109 | QString extension = QFileInfo(file).suffix().toLower();
|
---|
4110 | if ( (extension=="m3u") || (extension=="m3u8") ) {
|
---|
4111 | playlist->load_m3u(file);
|
---|
4112 | }
|
---|
4113 | else
|
---|
4114 | if (extension=="pls") {
|
---|
4115 | playlist->load_pls(file);
|
---|
4116 | }
|
---|
4117 | else
|
---|
4118 | if (extension=="xspf") {
|
---|
4119 | playlist->loadXSPF(file);
|
---|
4120 | }
|
---|
4121 | else
|
---|
4122 | if (extension=="iso") {
|
---|
4123 | if (playlist->maybeSave()) {
|
---|
4124 | core->open(file);
|
---|
4125 | }
|
---|
4126 | }
|
---|
4127 | else {
|
---|
4128 | if (pref->auto_add_to_playlist) {
|
---|
4129 | if (playlist->maybeSave()) {
|
---|
4130 | core->openFile(file);
|
---|
4131 |
|
---|
4132 | playlist->clear();
|
---|
4133 | playlist->addFile(file, Playlist::NoGetInfo);
|
---|
4134 | }
|
---|
4135 | } else {
|
---|
4136 | core->openFile(file);
|
---|
4137 | }
|
---|
4138 | }
|
---|
4139 | if (QFile::exists(file)) pref->latest_dir = QFileInfo(file).absolutePath();
|
---|
4140 | }
|
---|
4141 | }
|
---|
4142 |
|
---|
4143 | void BaseGui::configureDiscDevices() {
|
---|
4144 | QMessageBox::information( this, tr("SMPlayer - Information"),
|
---|
4145 | tr("The CDROM / DVD drives are not configured yet.\n"
|
---|
4146 | "The configuration dialog will be shown now, "
|
---|
4147 | "so you can do it."), QMessageBox::Ok);
|
---|
4148 |
|
---|
4149 | showPreferencesDialog();
|
---|
4150 | pref_dialog->showSection( PreferencesDialog::Drives );
|
---|
4151 | }
|
---|
4152 |
|
---|
4153 | void BaseGui::openVCD() {
|
---|
4154 | qDebug("BaseGui::openVCD");
|
---|
4155 |
|
---|
4156 | if ( (pref->dvd_device.isEmpty()) ||
|
---|
4157 | (pref->cdrom_device.isEmpty()) )
|
---|
4158 | {
|
---|
4159 | configureDiscDevices();
|
---|
4160 | } else {
|
---|
4161 | if (playlist->maybeSave()) {
|
---|
4162 | core->openVCD( pref->vcd_initial_title );
|
---|
4163 | }
|
---|
4164 | }
|
---|
4165 | }
|
---|
4166 |
|
---|
4167 | void BaseGui::openAudioCD() {
|
---|
4168 | qDebug("BaseGui::openAudioCD");
|
---|
4169 |
|
---|
4170 | if ( (pref->dvd_device.isEmpty()) ||
|
---|
4171 | (pref->cdrom_device.isEmpty()) )
|
---|
4172 | {
|
---|
4173 | configureDiscDevices();
|
---|
4174 | } else {
|
---|
4175 | if (playlist->maybeSave()) {
|
---|
4176 | core->openAudioCD();
|
---|
4177 | }
|
---|
4178 | }
|
---|
4179 | }
|
---|
4180 |
|
---|
4181 | void BaseGui::openDVD() {
|
---|
4182 | qDebug("BaseGui::openDVD");
|
---|
4183 |
|
---|
4184 | if ( (pref->dvd_device.isEmpty()) ||
|
---|
4185 | (pref->cdrom_device.isEmpty()) )
|
---|
4186 | {
|
---|
4187 | configureDiscDevices();
|
---|
4188 | } else {
|
---|
4189 | if (playlist->maybeSave()) {
|
---|
4190 | #if DVDNAV_SUPPORT
|
---|
4191 | int first_title = 0;
|
---|
4192 | if (!pref->use_dvdnav) first_title = core->firstDVDTitle();
|
---|
4193 | core->openDVD( DiscName::joinDVD(first_title, pref->dvd_device, pref->use_dvdnav) );
|
---|
4194 | #else
|
---|
4195 | core->openDVD( DiscName::joinDVD(core->firstDVDTitle(), pref->dvd_device, false) );
|
---|
4196 | #endif
|
---|
4197 | }
|
---|
4198 | }
|
---|
4199 | }
|
---|
4200 |
|
---|
4201 | void BaseGui::openDVDFromFolder() {
|
---|
4202 | qDebug("BaseGui::openDVDFromFolder");
|
---|
4203 |
|
---|
4204 | if (playlist->maybeSave()) {
|
---|
4205 | InputDVDDirectory *d = new InputDVDDirectory(this);
|
---|
4206 | d->setFolder( pref->last_dvd_directory );
|
---|
4207 |
|
---|
4208 | if (d->exec() == QDialog::Accepted) {
|
---|
4209 | qDebug("BaseGui::openDVDFromFolder: accepted");
|
---|
4210 | openDVDFromFolder( d->folder() );
|
---|
4211 | }
|
---|
4212 |
|
---|
4213 | delete d;
|
---|
4214 | }
|
---|
4215 | }
|
---|
4216 |
|
---|
4217 | void BaseGui::openDVDFromFolder(QString directory) {
|
---|
4218 | pref->last_dvd_directory = directory;
|
---|
4219 | #if DVDNAV_SUPPORT
|
---|
4220 | int first_title = 0;
|
---|
4221 | if (!pref->use_dvdnav) first_title = core->firstDVDTitle();
|
---|
4222 | core->openDVD( DiscName::joinDVD(first_title, directory, pref->use_dvdnav) );
|
---|
4223 | #else
|
---|
4224 | core->openDVD( DiscName::joinDVD(core->firstDVDTitle(), directory, false) );
|
---|
4225 | #endif
|
---|
4226 | }
|
---|
4227 |
|
---|
4228 | #ifdef BLURAY_SUPPORT
|
---|
4229 | /**
|
---|
4230 | * Minimal BaseGui abstraction for calling openBluRay. It's called from
|
---|
4231 | * OpenBluRayFromFolder()
|
---|
4232 | */
|
---|
4233 | void BaseGui::openBluRayFromFolder(QString directory) {
|
---|
4234 | pref->last_dvd_directory = directory;
|
---|
4235 | core->openBluRay( DiscName::join(DiscName::BLURAY, core->firstBlurayTitle(), directory) );
|
---|
4236 | }
|
---|
4237 |
|
---|
4238 | /**
|
---|
4239 | * Attempts to open a bluray from pref->bluray_device. If not set, calls configureDiscDevices.
|
---|
4240 | * If successful, calls Core::OpenBluRay(QString)
|
---|
4241 | */
|
---|
4242 | void BaseGui::openBluRay() {
|
---|
4243 | qDebug("BaseGui::openBluRay");
|
---|
4244 |
|
---|
4245 | if ( (pref->dvd_device.isEmpty()) ||
|
---|
4246 | (pref->cdrom_device.isEmpty()) || pref->bluray_device.isEmpty())
|
---|
4247 | {
|
---|
4248 | configureDiscDevices();
|
---|
4249 | } else {
|
---|
4250 | core->openBluRay( DiscName::join(DiscName::BLURAY, core->firstBlurayTitle(), pref->bluray_device) );
|
---|
4251 | }
|
---|
4252 | }
|
---|
4253 |
|
---|
4254 | void BaseGui::openBluRayFromFolder() {
|
---|
4255 | qDebug("BaseGui::openBluRayFromFolder");
|
---|
4256 |
|
---|
4257 | if (playlist->maybeSave()) {
|
---|
4258 | QString dir = QFileDialog::getExistingDirectory(this, tr("Select the Blu-ray folder"),
|
---|
4259 | pref->last_dvd_directory, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
---|
4260 | if (!dir.isEmpty()) {
|
---|
4261 | openBluRayFromFolder(dir);
|
---|
4262 | }
|
---|
4263 | }
|
---|
4264 | }
|
---|
4265 | #endif
|
---|
4266 |
|
---|
4267 | void BaseGui::openDirectory() {
|
---|
4268 | qDebug("BaseGui::openDirectory");
|
---|
4269 |
|
---|
4270 | QString s = MyFileDialog::getExistingDirectory(
|
---|
4271 | this, tr("Choose a directory"),
|
---|
4272 | pref->latest_dir );
|
---|
4273 |
|
---|
4274 | if (!s.isEmpty()) {
|
---|
4275 | openDirectory(s);
|
---|
4276 | }
|
---|
4277 | }
|
---|
4278 |
|
---|
4279 | void BaseGui::openDirectory(QString directory) {
|
---|
4280 | qDebug("BaseGui::openDirectory: '%s'", directory.toUtf8().data());
|
---|
4281 |
|
---|
4282 | if (Helper::directoryContainsDVD(directory)) {
|
---|
4283 | core->open(directory);
|
---|
4284 | }
|
---|
4285 | else {
|
---|
4286 | QFileInfo fi(directory);
|
---|
4287 | if ( (fi.exists()) && (fi.isDir()) ) {
|
---|
4288 | playlist->clear();
|
---|
4289 | //playlist->addDirectory(directory);
|
---|
4290 | playlist->addDirectory( fi.absoluteFilePath() );
|
---|
4291 | playlist->startPlay();
|
---|
4292 | } else {
|
---|
4293 | qDebug("BaseGui::openDirectory: directory is not valid");
|
---|
4294 | }
|
---|
4295 | }
|
---|
4296 | }
|
---|
4297 |
|
---|
4298 | void BaseGui::loadSub() {
|
---|
4299 | qDebug("BaseGui::loadSub");
|
---|
4300 |
|
---|
4301 | exitFullscreenIfNeeded();
|
---|
4302 |
|
---|
4303 | Extensions e;
|
---|
4304 | QString s = MyFileDialog::getOpenFileName(
|
---|
4305 | this, tr("Choose a file"),
|
---|
4306 | pref->latest_dir,
|
---|
4307 | tr("Subtitles") + e.subtitles().forFilter()+ ";;" +
|
---|
4308 | tr("All files") +" (*.*)" );
|
---|
4309 |
|
---|
4310 | if (!s.isEmpty()) core->loadSub(s);
|
---|
4311 | }
|
---|
4312 |
|
---|
4313 | void BaseGui::setInitialSubtitle(const QString & subtitle_file) {
|
---|
4314 | qDebug("BaseGui::setInitialSubtitle: '%s'", subtitle_file.toUtf8().constData());
|
---|
4315 |
|
---|
4316 | core->setInitialSubtitle(subtitle_file);
|
---|
4317 | }
|
---|
4318 |
|
---|
4319 | void BaseGui::loadAudioFile() {
|
---|
4320 | qDebug("BaseGui::loadAudioFile");
|
---|
4321 |
|
---|
4322 | exitFullscreenIfNeeded();
|
---|
4323 |
|
---|
4324 | Extensions e;
|
---|
4325 | QString s = MyFileDialog::getOpenFileName(
|
---|
4326 | this, tr("Choose a file"),
|
---|
4327 | pref->latest_dir,
|
---|
4328 | tr("Audio") + e.audio().forFilter()+";;" +
|
---|
4329 | tr("All files") +" (*.*)" );
|
---|
4330 |
|
---|
4331 | if (!s.isEmpty()) core->loadAudioFile(s);
|
---|
4332 | }
|
---|
4333 |
|
---|
4334 | void BaseGui::helpFirstSteps() {
|
---|
4335 | QDesktopServices::openUrl(QString(URL_FIRST_STEPS "?version=%1").arg(Version::printable()));
|
---|
4336 | }
|
---|
4337 |
|
---|
4338 | void BaseGui::helpFAQ() {
|
---|
4339 | QString url = URL_FAQ;
|
---|
4340 | /* if (!pref->language.isEmpty()) url += QString("?tr_lang=%1").arg(pref->language); */
|
---|
4341 | QDesktopServices::openUrl( QUrl(url) );
|
---|
4342 | }
|
---|
4343 |
|
---|
4344 | void BaseGui::helpCLOptions() {
|
---|
4345 | if (clhelp_window == 0) {
|
---|
4346 | clhelp_window = new LogWindow(this);
|
---|
4347 | }
|
---|
4348 | clhelp_window->setWindowTitle( tr("SMPlayer command line options") );
|
---|
4349 | clhelp_window->setHtml(CLHelp::help(true));
|
---|
4350 | clhelp_window->show();
|
---|
4351 | }
|
---|
4352 |
|
---|
4353 | void BaseGui::helpCheckUpdates() {
|
---|
4354 | #ifdef UPDATE_CHECKER
|
---|
4355 | update_checker->check();
|
---|
4356 | #else
|
---|
4357 | QString url = QString(URL_CHANGES "?version=%1").arg(Version::with_revision());
|
---|
4358 | QDesktopServices::openUrl( QUrl(url) );
|
---|
4359 | #endif
|
---|
4360 | }
|
---|
4361 |
|
---|
4362 | void BaseGui::helpShowConfig() {
|
---|
4363 | QDesktopServices::openUrl(QUrl::fromLocalFile(Paths::configPath()));
|
---|
4364 | }
|
---|
4365 |
|
---|
4366 | #ifdef SHARE_ACTIONS
|
---|
4367 | void BaseGui::helpDonate() {
|
---|
4368 | ShareDialog d(this);
|
---|
4369 | d.showRemindCheck(false);
|
---|
4370 |
|
---|
4371 | #ifdef SHARE_WIDGET
|
---|
4372 | d.setActions(sharewidget->actions());
|
---|
4373 | #endif
|
---|
4374 |
|
---|
4375 | d.exec();
|
---|
4376 | int action = d.actions();
|
---|
4377 | qDebug("BaseGui::helpDonate: action: %d", action);
|
---|
4378 |
|
---|
4379 | if (action > 0) {
|
---|
4380 | #ifdef SHARE_WIDGET
|
---|
4381 | sharewidget->setActions(action);
|
---|
4382 | #else
|
---|
4383 | QSettings * set = Global::settings;
|
---|
4384 | set->beginGroup("reminder");
|
---|
4385 | set->setValue("action", action);
|
---|
4386 | set->endGroup();
|
---|
4387 | #endif
|
---|
4388 | }
|
---|
4389 | }
|
---|
4390 | #endif
|
---|
4391 |
|
---|
4392 | void BaseGui::helpAbout() {
|
---|
4393 | About d(this);
|
---|
4394 | d.exec();
|
---|
4395 | }
|
---|
4396 |
|
---|
4397 | #ifdef SHARE_MENU
|
---|
4398 | void BaseGui::shareSMPlayer() {
|
---|
4399 | QString text = QString("SMPlayer - Free Media Player with built-in codecs that can play and download Youtube videos").replace(" ","+");
|
---|
4400 | QString url = URL_HOMEPAGE;
|
---|
4401 |
|
---|
4402 | if (sender() == twitterAct) {
|
---|
4403 | QDesktopServices::openUrl(QUrl("http://twitter.com/intent/tweet?text=" + text + "&url=" + url + "/&via=smplayer_dev"));
|
---|
4404 | }
|
---|
4405 | else
|
---|
4406 | if (sender() == gmailAct) {
|
---|
4407 | QDesktopServices::openUrl(QUrl("https://mail.google.com/mail/?view=cm&fs=1&to&su=" + text + "&body=" + url + "&ui=2&tf=1&shva=1"));
|
---|
4408 | }
|
---|
4409 | else
|
---|
4410 | if (sender() == yahooAct) {
|
---|
4411 | QDesktopServices::openUrl(QUrl("http://compose.mail.yahoo.com/?To=&Subject=" + text + "&body=" + url));
|
---|
4412 | }
|
---|
4413 | else
|
---|
4414 | if (sender() == hotmailAct) {
|
---|
4415 | QDesktopServices::openUrl(QUrl("http://www.hotmail.msn.com/secure/start?action=compose&to=&subject=" + text + "&body=" + url));
|
---|
4416 | }
|
---|
4417 | else
|
---|
4418 | if (sender() == facebookAct) {
|
---|
4419 | QDesktopServices::openUrl(QUrl("http://www.facebook.com/sharer.php?u=" + url + "&t=" + text));
|
---|
4420 |
|
---|
4421 | #ifdef SHARE_ACTIONS
|
---|
4422 | QSettings * set = Global::settings;
|
---|
4423 | set->beginGroup("reminder");
|
---|
4424 | set->setValue("action", 2);
|
---|
4425 | set->endGroup();
|
---|
4426 | #endif
|
---|
4427 | }
|
---|
4428 | }
|
---|
4429 | #endif
|
---|
4430 |
|
---|
4431 | void BaseGui::showGotoDialog() {
|
---|
4432 | TimeDialog d(this);
|
---|
4433 | d.setLabel(tr("&Jump to:"));
|
---|
4434 | d.setWindowTitle(tr("SMPlayer - Seek"));
|
---|
4435 | d.setMaximumTime( (int) core->mdat.duration);
|
---|
4436 | d.setTime( (int) core->mset.current_sec);
|
---|
4437 | if (d.exec() == QDialog::Accepted) {
|
---|
4438 | core->goToSec( d.time() );
|
---|
4439 | }
|
---|
4440 | }
|
---|
4441 |
|
---|
4442 | void BaseGui::showAudioDelayDialog() {
|
---|
4443 | bool ok;
|
---|
4444 | #if QT_VERSION >= 0x050000
|
---|
4445 | int delay = QInputDialog::getInt(this, tr("SMPlayer - Audio delay"),
|
---|
4446 | tr("Audio delay (in milliseconds):"), core->mset.audio_delay,
|
---|
4447 | -3600000, 3600000, 1, &ok);
|
---|
4448 | #else
|
---|
4449 | int delay = QInputDialog::getInteger(this, tr("SMPlayer - Audio delay"),
|
---|
4450 | tr("Audio delay (in milliseconds):"), core->mset.audio_delay,
|
---|
4451 | -3600000, 3600000, 1, &ok);
|
---|
4452 | #endif
|
---|
4453 | if (ok) {
|
---|
4454 | core->setAudioDelay(delay);
|
---|
4455 | }
|
---|
4456 | }
|
---|
4457 |
|
---|
4458 | void BaseGui::showSubDelayDialog() {
|
---|
4459 | bool ok;
|
---|
4460 | #if QT_VERSION >= 0x050000
|
---|
4461 | int delay = QInputDialog::getInt(this, tr("SMPlayer - Subtitle delay"),
|
---|
4462 | tr("Subtitle delay (in milliseconds):"), core->mset.sub_delay,
|
---|
4463 | -3600000, 3600000, 1, &ok);
|
---|
4464 | #else
|
---|
4465 | int delay = QInputDialog::getInteger(this, tr("SMPlayer - Subtitle delay"),
|
---|
4466 | tr("Subtitle delay (in milliseconds):"), core->mset.sub_delay,
|
---|
4467 | -3600000, 3600000, 1, &ok);
|
---|
4468 | #endif
|
---|
4469 | if (ok) {
|
---|
4470 | core->setSubDelay(delay);
|
---|
4471 | }
|
---|
4472 | }
|
---|
4473 |
|
---|
4474 | void BaseGui::showStereo3dDialog() {
|
---|
4475 | Stereo3dDialog d(this);
|
---|
4476 | d.setInputFormat(core->mset.stereo3d_in);
|
---|
4477 | d.setOutputFormat(core->mset.stereo3d_out);
|
---|
4478 |
|
---|
4479 | if (d.exec() == QDialog::Accepted) {
|
---|
4480 | core->changeStereo3d(d.inputFormat(), d.outputFormat());
|
---|
4481 | }
|
---|
4482 | }
|
---|
4483 |
|
---|
4484 | #ifdef BOOKMARKS
|
---|
4485 | void BaseGui::showAddBookmarkDialog() {
|
---|
4486 | InputBookmark d(this);
|
---|
4487 | d.setTime( (int) core->mset.current_sec);
|
---|
4488 | if (d.exec() == QDialog::Accepted) {
|
---|
4489 | core->mset.bookmarks.insert(d.time(), d.name());
|
---|
4490 | updateBookmarks();
|
---|
4491 | }
|
---|
4492 | }
|
---|
4493 |
|
---|
4494 | void BaseGui::showBookmarkDialog() {
|
---|
4495 | qDebug("BaseGui::showBookmarkDialog");
|
---|
4496 | BookmarkDialog d(this);
|
---|
4497 | d.setBookmarks(core->mset.bookmarks);
|
---|
4498 | if (d.exec() == QDialog::Accepted) {
|
---|
4499 | core->mset.bookmarks = d.bookmarks();
|
---|
4500 | updateBookmarks();
|
---|
4501 | }
|
---|
4502 | }
|
---|
4503 | #endif
|
---|
4504 |
|
---|
4505 | void BaseGui::exitFullscreen() {
|
---|
4506 | if (pref->fullscreen) {
|
---|
4507 | toggleFullscreen(false);
|
---|
4508 | }
|
---|
4509 | }
|
---|
4510 |
|
---|
4511 | void BaseGui::toggleFullscreen() {
|
---|
4512 | qDebug("BaseGui::toggleFullscreen");
|
---|
4513 |
|
---|
4514 | toggleFullscreen(!pref->fullscreen);
|
---|
4515 | }
|
---|
4516 |
|
---|
4517 | void BaseGui::toggleFullscreen(bool b) {
|
---|
4518 | qDebug("BaseGui::toggleFullscreen: %d", b);
|
---|
4519 |
|
---|
4520 | if (b==pref->fullscreen) {
|
---|
4521 | // Nothing to do
|
---|
4522 | qDebug("BaseGui::toggleFullscreen: nothing to do, returning");
|
---|
4523 | return;
|
---|
4524 | }
|
---|
4525 |
|
---|
4526 | pref->fullscreen = b;
|
---|
4527 |
|
---|
4528 | // If using mplayer window
|
---|
4529 | if (pref->use_mplayer_window) {
|
---|
4530 | core->changeFullscreenMode(b);
|
---|
4531 | updateWidgets();
|
---|
4532 | return;
|
---|
4533 | }
|
---|
4534 |
|
---|
4535 | if (!panel->isVisible()) return; // mplayer window is not used.
|
---|
4536 |
|
---|
4537 | if (pref->fullscreen) {
|
---|
4538 | compactAct->setEnabled(false);
|
---|
4539 |
|
---|
4540 | if (pref->restore_pos_after_fullscreen) {
|
---|
4541 | win_pos = pos();
|
---|
4542 | win_size = size();
|
---|
4543 | }
|
---|
4544 |
|
---|
4545 | was_maximized = isMaximized();
|
---|
4546 | qDebug("BaseGui::toggleFullscreen: was_maximized: %d", was_maximized);
|
---|
4547 |
|
---|
4548 | aboutToEnterFullscreen();
|
---|
4549 |
|
---|
4550 | #ifdef Q_OS_WIN
|
---|
4551 | // Hack to avoid the windows taskbar to be visible on Windows XP
|
---|
4552 | if (QSysInfo::WindowsVersion < QSysInfo::WV_VISTA) {
|
---|
4553 | if (!pref->pause_when_hidden) hide();
|
---|
4554 | }
|
---|
4555 | #endif
|
---|
4556 |
|
---|
4557 | showFullScreen();
|
---|
4558 |
|
---|
4559 | } else {
|
---|
4560 | showNormal();
|
---|
4561 |
|
---|
4562 | if (was_maximized) showMaximized(); // It has to be called after showNormal()
|
---|
4563 |
|
---|
4564 | aboutToExitFullscreen();
|
---|
4565 |
|
---|
4566 | if (pref->restore_pos_after_fullscreen) {
|
---|
4567 | move( win_pos );
|
---|
4568 | resize( win_size );
|
---|
4569 | }
|
---|
4570 |
|
---|
4571 | compactAct->setEnabled(true);
|
---|
4572 | }
|
---|
4573 |
|
---|
4574 | updateWidgets();
|
---|
4575 |
|
---|
4576 | if ((pref->add_blackborders_on_fullscreen) &&
|
---|
4577 | (!core->mset.add_letterbox))
|
---|
4578 | {
|
---|
4579 | core->changeLetterboxOnFullscreen(b);
|
---|
4580 | /* core->restart(); */
|
---|
4581 | }
|
---|
4582 |
|
---|
4583 | setFocus(); // Fixes bug #2493415
|
---|
4584 | }
|
---|
4585 |
|
---|
4586 |
|
---|
4587 | void BaseGui::aboutToEnterFullscreen() {
|
---|
4588 | if (pref->stay_on_top == Preferences::WhilePlayingOnTop && core->state() == Core::Playing) {
|
---|
4589 | setStayOnTop(false);
|
---|
4590 | }
|
---|
4591 |
|
---|
4592 | if (!pref->compact_mode) {
|
---|
4593 | menuBar()->hide();
|
---|
4594 | statusBar()->hide();
|
---|
4595 | }
|
---|
4596 | }
|
---|
4597 |
|
---|
4598 | void BaseGui::aboutToExitFullscreen() {
|
---|
4599 | if (!pref->compact_mode) {
|
---|
4600 | menuBar()->show();
|
---|
4601 | statusBar()->show();
|
---|
4602 | }
|
---|
4603 |
|
---|
4604 | if (pref->stay_on_top == Preferences::WhilePlayingOnTop) {
|
---|
4605 | #if QT_VERSION < 0x050000
|
---|
4606 | qApp->processEvents();
|
---|
4607 | #endif
|
---|
4608 | setStayOnTop(core->state() == Core::Playing);
|
---|
4609 | }
|
---|
4610 | }
|
---|
4611 |
|
---|
4612 |
|
---|
4613 | void BaseGui::leftClickFunction() {
|
---|
4614 | qDebug("BaseGui::leftClickFunction");
|
---|
4615 |
|
---|
4616 | if (!pref->mouse_left_click_function.isEmpty()) {
|
---|
4617 | processFunction(pref->mouse_left_click_function);
|
---|
4618 | }
|
---|
4619 | }
|
---|
4620 |
|
---|
4621 | void BaseGui::rightClickFunction() {
|
---|
4622 | qDebug("BaseGui::rightClickFunction");
|
---|
4623 |
|
---|
4624 | if (!pref->mouse_right_click_function.isEmpty()) {
|
---|
4625 | processFunction(pref->mouse_right_click_function);
|
---|
4626 | }
|
---|
4627 | }
|
---|
4628 |
|
---|
4629 | void BaseGui::doubleClickFunction() {
|
---|
4630 | qDebug("BaseGui::doubleClickFunction");
|
---|
4631 |
|
---|
4632 | if (!pref->mouse_double_click_function.isEmpty()) {
|
---|
4633 | processFunction(pref->mouse_double_click_function);
|
---|
4634 | }
|
---|
4635 | }
|
---|
4636 |
|
---|
4637 | void BaseGui::middleClickFunction() {
|
---|
4638 | qDebug("BaseGui::middleClickFunction");
|
---|
4639 |
|
---|
4640 | if (!pref->mouse_middle_click_function.isEmpty()) {
|
---|
4641 | processFunction(pref->mouse_middle_click_function);
|
---|
4642 | }
|
---|
4643 | }
|
---|
4644 |
|
---|
4645 | void BaseGui::xbutton1ClickFunction() {
|
---|
4646 | qDebug("BaseGui::xbutton1ClickFunction");
|
---|
4647 |
|
---|
4648 | if (!pref->mouse_xbutton1_click_function.isEmpty()) {
|
---|
4649 | processFunction(pref->mouse_xbutton1_click_function);
|
---|
4650 | }
|
---|
4651 | }
|
---|
4652 |
|
---|
4653 | void BaseGui::xbutton2ClickFunction() {
|
---|
4654 | qDebug("BaseGui::xbutton2ClickFunction");
|
---|
4655 |
|
---|
4656 | if (!pref->mouse_xbutton2_click_function.isEmpty()) {
|
---|
4657 | processFunction(pref->mouse_xbutton2_click_function);
|
---|
4658 | }
|
---|
4659 | }
|
---|
4660 |
|
---|
4661 | void BaseGui::processFunction(QString function) {
|
---|
4662 | qDebug("BaseGui::processFunction: '%s'", function.toUtf8().data());
|
---|
4663 |
|
---|
4664 | //parse args for checkable actions
|
---|
4665 | QRegExp func_rx("(.*) (true|false)");
|
---|
4666 | bool value = false;
|
---|
4667 | bool checkableFunction = false;
|
---|
4668 |
|
---|
4669 | if(func_rx.indexIn(function) > -1){
|
---|
4670 | function = func_rx.cap(1);
|
---|
4671 | value = (func_rx.cap(2) == "true");
|
---|
4672 | checkableFunction = true;
|
---|
4673 | } //end if
|
---|
4674 |
|
---|
4675 | QAction * action = ActionsEditor::findAction(this, function);
|
---|
4676 | if (!action) action = ActionsEditor::findAction(playlist, function);
|
---|
4677 |
|
---|
4678 | if (action) {
|
---|
4679 | qDebug("BaseGui::processFunction: action found");
|
---|
4680 |
|
---|
4681 | if (!action->isEnabled()) {
|
---|
4682 | qDebug("BaseGui::processFunction: action is disabled, doing nothing");
|
---|
4683 | return;
|
---|
4684 | }
|
---|
4685 |
|
---|
4686 | if (action->isCheckable()){
|
---|
4687 | if(checkableFunction)
|
---|
4688 | action->setChecked(value);
|
---|
4689 | else
|
---|
4690 | //action->toggle();
|
---|
4691 | action->trigger();
|
---|
4692 | }else{
|
---|
4693 | action->trigger();
|
---|
4694 | }
|
---|
4695 | }
|
---|
4696 | }
|
---|
4697 |
|
---|
4698 | void BaseGui::runActions(QString actions) {
|
---|
4699 | qDebug("BaseGui::runActions");
|
---|
4700 |
|
---|
4701 | actions = actions.simplified(); // Remove white space
|
---|
4702 |
|
---|
4703 | QAction * action;
|
---|
4704 | QStringList actionsList = actions.split(" ");
|
---|
4705 |
|
---|
4706 | for (int n = 0; n < actionsList.count(); n++) {
|
---|
4707 | QString actionStr = actionsList[n];
|
---|
4708 | QString par = ""; //the parameter which the action takes
|
---|
4709 |
|
---|
4710 | //set par if the next word is a boolean value
|
---|
4711 | if ( (n+1) < actionsList.count() ) {
|
---|
4712 | if ( (actionsList[n+1].toLower() == "true") || (actionsList[n+1].toLower() == "false") ) {
|
---|
4713 | par = actionsList[n+1].toLower();
|
---|
4714 | n++;
|
---|
4715 | } //end if
|
---|
4716 | } //end if
|
---|
4717 |
|
---|
4718 | action = ActionsEditor::findAction(this, actionStr);
|
---|
4719 | if (!action) action = ActionsEditor::findAction(playlist, actionStr);
|
---|
4720 |
|
---|
4721 | if (action) {
|
---|
4722 | qDebug("BaseGui::runActions: running action: '%s' (par: '%s')",
|
---|
4723 | actionStr.toUtf8().data(), par.toUtf8().data() );
|
---|
4724 |
|
---|
4725 | if (action->isCheckable()) {
|
---|
4726 | if (par.isEmpty()) {
|
---|
4727 | //action->toggle();
|
---|
4728 | action->trigger();
|
---|
4729 | } else {
|
---|
4730 | action->setChecked( (par == "true") );
|
---|
4731 | } //end if
|
---|
4732 | } else {
|
---|
4733 | action->trigger();
|
---|
4734 | } //end if
|
---|
4735 | } else {
|
---|
4736 | qWarning("BaseGui::runActions: action: '%s' not found",actionStr.toUtf8().data());
|
---|
4737 | } //end if
|
---|
4738 | } //end for
|
---|
4739 | }
|
---|
4740 |
|
---|
4741 | void BaseGui::checkPendingActionsToRun() {
|
---|
4742 | qDebug("BaseGui::checkPendingActionsToRun");
|
---|
4743 |
|
---|
4744 | QString actions;
|
---|
4745 | if (!pending_actions_to_run.isEmpty()) {
|
---|
4746 | actions = pending_actions_to_run;
|
---|
4747 | pending_actions_to_run.clear();
|
---|
4748 | if (!pref->actions_to_run.isEmpty()) {
|
---|
4749 | actions = pref->actions_to_run +" "+ actions;
|
---|
4750 | }
|
---|
4751 | } else {
|
---|
4752 | actions = pref->actions_to_run;
|
---|
4753 | }
|
---|
4754 |
|
---|
4755 | if (!actions.isEmpty()) {
|
---|
4756 | qDebug("BaseGui::checkPendingActionsToRun: actions: '%s'", actions.toUtf8().constData());
|
---|
4757 | runActions(actions);
|
---|
4758 | }
|
---|
4759 | }
|
---|
4760 |
|
---|
4761 | #if REPORT_OLD_MPLAYER
|
---|
4762 | void BaseGui::checkMplayerVersion() {
|
---|
4763 | qDebug("BaseGui::checkMplayerVersion");
|
---|
4764 |
|
---|
4765 | // Qt 4.3.5 is crazy, I can't popup a messagebox here, it calls
|
---|
4766 | // this function once and again when the messagebox is shown
|
---|
4767 |
|
---|
4768 | if ( (pref->mplayer_detected_version > 0) && (!MplayerVersion::isMplayerAtLeast(25158)) ) {
|
---|
4769 | QTimer::singleShot(1000, this, SLOT(displayWarningAboutOldMplayer()));
|
---|
4770 | }
|
---|
4771 | }
|
---|
4772 |
|
---|
4773 | void BaseGui::displayWarningAboutOldMplayer() {
|
---|
4774 | qDebug("BaseGui::displayWarningAboutOldMplayer");
|
---|
4775 |
|
---|
4776 | if (!pref->reported_mplayer_is_old) {
|
---|
4777 | QMessageBox::warning(this, tr("Warning - Using old MPlayer"),
|
---|
4778 | tr("The version of MPlayer (%1) installed on your system "
|
---|
4779 | "is obsolete. SMPlayer can't work well with it: some "
|
---|
4780 | "options won't work, subtitle selection may fail...")
|
---|
4781 | .arg(MplayerVersion::toString(pref->mplayer_detected_version)) +
|
---|
4782 | "<br><br>" +
|
---|
4783 | tr("Please, update your MPlayer.") +
|
---|
4784 | "<br><br>" +
|
---|
4785 | tr("(This warning won't be displayed anymore)") );
|
---|
4786 |
|
---|
4787 | pref->reported_mplayer_is_old = true;
|
---|
4788 | }
|
---|
4789 | //else
|
---|
4790 | //statusBar()->showMessage( tr("Using an old MPlayer, please update it"), 10000 );
|
---|
4791 | }
|
---|
4792 | #endif
|
---|
4793 |
|
---|
4794 | #ifdef CHECK_UPGRADED
|
---|
4795 | void BaseGui::checkIfUpgraded() {
|
---|
4796 | qDebug("BaseGui::checkIfUpgraded");
|
---|
4797 |
|
---|
4798 | if ( (pref->check_if_upgraded) && (pref->smplayer_stable_version != Version::stable()) ) {
|
---|
4799 | // Running a new version
|
---|
4800 | qDebug("BaseGui::checkIfUpgraded: running a new version: %s", Version::stable().toUtf8().constData());
|
---|
4801 | QString os = "other";
|
---|
4802 | #ifdef Q_OS_WIN
|
---|
4803 | os = "win";
|
---|
4804 | #endif
|
---|
4805 | #ifdef Q_OS_LINUX
|
---|
4806 | os = "linux";
|
---|
4807 | #endif
|
---|
4808 | QDesktopServices::openUrl(QString(URL_THANK_YOU "?version=%1&so=%2").arg(Version::printable()).arg(os));
|
---|
4809 | }
|
---|
4810 | pref->smplayer_stable_version = Version::stable();
|
---|
4811 | }
|
---|
4812 | #endif
|
---|
4813 |
|
---|
4814 | #if defined(SHARE_ACTIONS) && !defined(SHARE_WIDGET)
|
---|
4815 | void BaseGui::checkReminder() {
|
---|
4816 | qDebug("BaseGui::checkReminder");
|
---|
4817 |
|
---|
4818 | if (core->state() == Core::Playing) return;
|
---|
4819 |
|
---|
4820 | QSettings * set = Global::settings;
|
---|
4821 | set->beginGroup("reminder");
|
---|
4822 | int count = set->value("count", 0).toInt();
|
---|
4823 | count++;
|
---|
4824 | set->setValue("count", count);
|
---|
4825 | int action = set->value("action", 0).toInt();
|
---|
4826 | bool dont_show = set->value("dont_show_anymore", false).toBool();
|
---|
4827 | set->endGroup();
|
---|
4828 |
|
---|
4829 | #if 1
|
---|
4830 | if (dont_show) return;
|
---|
4831 |
|
---|
4832 | if (action != 0) return;
|
---|
4833 | if ((count != 25) && (count != 45)) return;
|
---|
4834 | #endif
|
---|
4835 |
|
---|
4836 | ShareDialog d(this);
|
---|
4837 | //d.showRemindCheck(false);
|
---|
4838 | d.exec();
|
---|
4839 | action = d.actions();
|
---|
4840 | qDebug("BaseGui::checkReminder: action: %d", action);
|
---|
4841 |
|
---|
4842 | if (!d.isRemindChecked()) {
|
---|
4843 | set->beginGroup("reminder");
|
---|
4844 | set->setValue("dont_show_anymore", true);
|
---|
4845 | set->endGroup();
|
---|
4846 | }
|
---|
4847 |
|
---|
4848 | if (action > 0) {
|
---|
4849 | set->beginGroup("reminder");
|
---|
4850 | set->setValue("action", action);
|
---|
4851 | set->endGroup();
|
---|
4852 | }
|
---|
4853 |
|
---|
4854 | //qDebug() << "size:" << d.size();
|
---|
4855 | }
|
---|
4856 | #endif
|
---|
4857 |
|
---|
4858 | #ifdef YOUTUBE_SUPPORT
|
---|
4859 | void BaseGui::YTNoSslSupport() {
|
---|
4860 | qDebug("BaseGui::YTNoSslSupport");
|
---|
4861 | QMessageBox::warning(this, tr("Connection failed"),
|
---|
4862 | tr("The video you requested needs to open a HTTPS connection.") +"<br>"+
|
---|
4863 | tr("Unfortunately the OpenSSL component, required for it, is not available in your system.") +"<br>"+
|
---|
4864 | tr("Please, visit %1 to know how to fix this problem.")
|
---|
4865 | .arg("<a href=\"" URL_OPENSSL_INFO "\">" + tr("this link") + "</a>") );
|
---|
4866 | }
|
---|
4867 |
|
---|
4868 | void BaseGui::YTNoSignature(const QString & title) {
|
---|
4869 | qDebug("BaseGui::YTNoSignature: %s", title.toUtf8().constData());
|
---|
4870 |
|
---|
4871 | QString t = title;
|
---|
4872 |
|
---|
4873 | QString info_text;
|
---|
4874 | if (title.isEmpty()) {
|
---|
4875 | info_text = tr("Unfortunately due to changes in the Youtube page, this video can't be played.");
|
---|
4876 | } else {
|
---|
4877 | t.replace(" - YouTube", "");
|
---|
4878 | info_text = tr("Unfortunately due to changes in the Youtube page, the video '%1' can't be played.").arg(t);
|
---|
4879 | }
|
---|
4880 |
|
---|
4881 | #ifdef YT_USE_YTSIG
|
---|
4882 | int ret = QMessageBox::question(this, tr("Problems with Youtube"),
|
---|
4883 | info_text + "<br><br>" +
|
---|
4884 | tr("Do you want to update the Youtube code? This may fix the problem."),
|
---|
4885 | QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
---|
4886 | if (ret == QMessageBox::Yes) {
|
---|
4887 | YTUpdateScript();
|
---|
4888 | }
|
---|
4889 | #else
|
---|
4890 | QMessageBox::warning(this, tr("Problems with Youtube"),
|
---|
4891 | info_text + "<br><br>" +
|
---|
4892 | tr("Maybe updating SMPlayer could fix the problem."));
|
---|
4893 | #endif
|
---|
4894 | }
|
---|
4895 |
|
---|
4896 | #ifdef YT_USE_YTSIG
|
---|
4897 | void BaseGui::YTUpdateScript() {
|
---|
4898 | static CodeDownloader * downloader = 0;
|
---|
4899 | if (!downloader) downloader = new CodeDownloader(this);
|
---|
4900 | downloader->saveAs(Paths::configPath() + "/yt.js");
|
---|
4901 | downloader->show();
|
---|
4902 | downloader->download(QUrl(URL_YT_CODE));
|
---|
4903 | }
|
---|
4904 | #endif // YT_USE_YTSIG
|
---|
4905 | #endif //YOUTUBE_SUPPORT
|
---|
4906 |
|
---|
4907 | void BaseGui::gotForbidden() {
|
---|
4908 | qDebug("BaseGui::gotForbidden");
|
---|
4909 |
|
---|
4910 | if (!pref->report_mplayer_crashes) {
|
---|
4911 | qDebug("BaseGui::gotForbidden: not displaying error dialog");
|
---|
4912 | return;
|
---|
4913 | }
|
---|
4914 |
|
---|
4915 | static bool busy = false;
|
---|
4916 |
|
---|
4917 | if (busy) return;
|
---|
4918 |
|
---|
4919 | busy = true;
|
---|
4920 | #ifdef YOUTUBE_SUPPORT
|
---|
4921 | if (core->mdat.filename.contains("youtube.com")) {
|
---|
4922 | YTNoSignature("");
|
---|
4923 | } else
|
---|
4924 | #endif
|
---|
4925 | {
|
---|
4926 | QMessageBox::warning(this, tr("Error detected"),
|
---|
4927 | tr("Unfortunately this video can't be played.") +"<br>"+
|
---|
4928 | tr("The server returned '%1'").arg("403: Forbidden"));
|
---|
4929 | }
|
---|
4930 | busy = false;
|
---|
4931 | }
|
---|
4932 |
|
---|
4933 | void BaseGui::dragEnterEvent( QDragEnterEvent *e ) {
|
---|
4934 | qDebug("BaseGui::dragEnterEvent");
|
---|
4935 |
|
---|
4936 | if (e->mimeData()->hasUrls()) {
|
---|
4937 | e->acceptProposedAction();
|
---|
4938 | }
|
---|
4939 | }
|
---|
4940 |
|
---|
4941 |
|
---|
4942 |
|
---|
4943 | void BaseGui::dropEvent( QDropEvent *e ) {
|
---|
4944 | qDebug("BaseGui::dropEvent");
|
---|
4945 |
|
---|
4946 | QStringList files;
|
---|
4947 |
|
---|
4948 | if (e->mimeData()->hasUrls()) {
|
---|
4949 | QList <QUrl> l = e->mimeData()->urls();
|
---|
4950 | QString s;
|
---|
4951 | for (int n=0; n < l.count(); n++) {
|
---|
4952 | if (l[n].isValid()) {
|
---|
4953 | qDebug("BaseGui::dropEvent: scheme: '%s'", l[n].scheme().toUtf8().data());
|
---|
4954 | if (l[n].scheme() == "file")
|
---|
4955 | s = l[n].toLocalFile();
|
---|
4956 | else
|
---|
4957 | s = l[n].toString();
|
---|
4958 | /*
|
---|
4959 | qDebug(" * '%s'", l[n].toString().toUtf8().data());
|
---|
4960 | qDebug(" * '%s'", l[n].toLocalFile().toUtf8().data());
|
---|
4961 | */
|
---|
4962 | qDebug("BaseGui::dropEvent: file: '%s'", s.toUtf8().data());
|
---|
4963 | files.append(s);
|
---|
4964 | }
|
---|
4965 | }
|
---|
4966 | }
|
---|
4967 |
|
---|
4968 |
|
---|
4969 | qDebug( "BaseGui::dropEvent: count: %d", files.count());
|
---|
4970 | if (files.count() > 0) {
|
---|
4971 | #ifdef Q_OS_WIN
|
---|
4972 | files = Helper::resolveSymlinks(files); // Check for Windows shortcuts
|
---|
4973 | #endif
|
---|
4974 | files.sort();
|
---|
4975 |
|
---|
4976 | if (files.count() == 1) {
|
---|
4977 | QFileInfo fi( files[0] );
|
---|
4978 |
|
---|
4979 | Extensions e;
|
---|
4980 | QRegExp ext_sub(e.subtitles().forRegExp());
|
---|
4981 | ext_sub.setCaseSensitivity(Qt::CaseInsensitive);
|
---|
4982 | if (ext_sub.indexIn(fi.suffix()) > -1) {
|
---|
4983 | qDebug( "BaseGui::dropEvent: loading sub: '%s'", files[0].toUtf8().data());
|
---|
4984 | core->loadSub( files[0] );
|
---|
4985 | }
|
---|
4986 | else
|
---|
4987 | if (fi.isDir()) {
|
---|
4988 | openDirectory( files[0] );
|
---|
4989 | } else {
|
---|
4990 | //openFile( files[0] );
|
---|
4991 | if (pref->auto_add_to_playlist) {
|
---|
4992 | if (playlist->maybeSave()) {
|
---|
4993 | playlist->clear();
|
---|
4994 | playlist->addFile(files[0], Playlist::NoGetInfo);
|
---|
4995 |
|
---|
4996 | open( files[0] );
|
---|
4997 | }
|
---|
4998 | } else {
|
---|
4999 | open( files[0] );
|
---|
5000 | }
|
---|
5001 | }
|
---|
5002 | } else {
|
---|
5003 | // More than one file
|
---|
5004 | qDebug("BaseGui::dropEvent: adding files to playlist");
|
---|
5005 | playlist->clear();
|
---|
5006 | playlist->addFiles(files);
|
---|
5007 | //openFile( files[0] );
|
---|
5008 | playlist->startPlay();
|
---|
5009 | }
|
---|
5010 | }
|
---|
5011 | }
|
---|
5012 |
|
---|
5013 | void BaseGui::showPopupMenu() {
|
---|
5014 | showPopupMenu(QCursor::pos());
|
---|
5015 | }
|
---|
5016 |
|
---|
5017 | void BaseGui::showPopupMenu( QPoint p ) {
|
---|
5018 | //qDebug("BaseGui::showPopupMenu: %d, %d", p.x(), p.y());
|
---|
5019 | popup->move( p );
|
---|
5020 | popup->show();
|
---|
5021 | }
|
---|
5022 |
|
---|
5023 | /*
|
---|
5024 | void BaseGui::mouseReleaseEvent( QMouseEvent * e ) {
|
---|
5025 | qDebug("BaseGui::mouseReleaseEvent");
|
---|
5026 |
|
---|
5027 | if (e->button() == Qt::LeftButton) {
|
---|
5028 | e->accept();
|
---|
5029 | emit leftClicked();
|
---|
5030 | }
|
---|
5031 | else
|
---|
5032 | if (e->button() == Qt::MidButton) {
|
---|
5033 | e->accept();
|
---|
5034 | emit middleClicked();
|
---|
5035 | }
|
---|
5036 | //
|
---|
5037 | //else
|
---|
5038 | //if (e->button() == Qt::RightButton) {
|
---|
5039 | // showPopupMenu( e->globalPos() );
|
---|
5040 | //}
|
---|
5041 | //
|
---|
5042 | else
|
---|
5043 | e->ignore();
|
---|
5044 | }
|
---|
5045 |
|
---|
5046 | void BaseGui::mouseDoubleClickEvent( QMouseEvent * e ) {
|
---|
5047 | e->accept();
|
---|
5048 | emit doubleClicked();
|
---|
5049 | }
|
---|
5050 | */
|
---|
5051 |
|
---|
5052 | /*
|
---|
5053 | void BaseGui::wheelEvent( QWheelEvent * e ) {
|
---|
5054 | qDebug("BaseGui::wheelEvent: delta: %d", e->delta());
|
---|
5055 | e->accept();
|
---|
5056 |
|
---|
5057 | if (e->orientation() == Qt::Vertical) {
|
---|
5058 | if (e->delta() >= 0)
|
---|
5059 | emit wheelUp();
|
---|
5060 | else
|
---|
5061 | emit wheelDown();
|
---|
5062 | } else {
|
---|
5063 | qDebug("BaseGui::wheelEvent: horizontal event received, doing nothing");
|
---|
5064 | }
|
---|
5065 | }
|
---|
5066 | */
|
---|
5067 |
|
---|
5068 | // Called when a video has started to play
|
---|
5069 | void BaseGui::enterFullscreenOnPlay() {
|
---|
5070 | qDebug("BaseGui::enterFullscreenOnPlay: arg_start_in_fullscreen: %d, pref->start_in_fullscreen: %d", arg_start_in_fullscreen, pref->start_in_fullscreen);
|
---|
5071 |
|
---|
5072 | if (arg_start_in_fullscreen != 0) {
|
---|
5073 | if ( (arg_start_in_fullscreen == 1) || (pref->start_in_fullscreen) ) {
|
---|
5074 | if (!pref->fullscreen) toggleFullscreen(true);
|
---|
5075 | }
|
---|
5076 | }
|
---|
5077 | }
|
---|
5078 |
|
---|
5079 | // Called when the playlist has stopped
|
---|
5080 | void BaseGui::exitFullscreenOnStop() {
|
---|
5081 | if (pref->fullscreen) {
|
---|
5082 | toggleFullscreen(false);
|
---|
5083 | }
|
---|
5084 | }
|
---|
5085 |
|
---|
5086 | void BaseGui::playlistHasFinished() {
|
---|
5087 | qDebug("BaseGui::playlistHasFinished");
|
---|
5088 | core->stop();
|
---|
5089 |
|
---|
5090 | exitFullscreenOnStop();
|
---|
5091 |
|
---|
5092 | qDebug("BaseGui::playlistHasFinished: arg_close_on_finish: %d, pref->close_on_finish: %d", arg_close_on_finish, pref->close_on_finish);
|
---|
5093 |
|
---|
5094 | if (arg_close_on_finish != 0) {
|
---|
5095 | if ((arg_close_on_finish == 1) || (pref->close_on_finish)) {
|
---|
5096 | #ifdef AUTO_SHUTDOWN_PC
|
---|
5097 | if (pref->auto_shutdown_pc) {
|
---|
5098 | ShutdownDialog d(this);
|
---|
5099 | if (d.exec() == QDialog::Accepted) {
|
---|
5100 | qDebug("BaseGui::playlistHasFinished: the PC will shut down");
|
---|
5101 | Shutdown::shutdown();
|
---|
5102 | } else {
|
---|
5103 | qDebug("BaseGui::playlistHasFinished: shutdown aborted");
|
---|
5104 | }
|
---|
5105 | }
|
---|
5106 | #endif
|
---|
5107 | exitAct->trigger();
|
---|
5108 | }
|
---|
5109 | }
|
---|
5110 | }
|
---|
5111 |
|
---|
5112 | void BaseGui::displayState(Core::State state) {
|
---|
5113 | qDebug() << "BaseGui::displayState:" << core->stateToString();
|
---|
5114 |
|
---|
5115 | switch (state) {
|
---|
5116 | //case Core::Playing: statusBar()->showMessage( tr("Playing %1").arg(core->mdat.filename), 2000); break;
|
---|
5117 | case Core::Playing: statusBar()->showMessage(""); break;
|
---|
5118 | case Core::Paused: statusBar()->showMessage( tr("Pause") ); break;
|
---|
5119 | case Core::Stopped: statusBar()->showMessage( tr("Stop") , 2000); break;
|
---|
5120 | case Core::Buffering: /* statusBar()->showMessage(tr("Buffering...")); */ break;
|
---|
5121 | }
|
---|
5122 |
|
---|
5123 | if (state == Core::Stopped) setWindowCaption( "SMPlayer" );
|
---|
5124 |
|
---|
5125 | #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
---|
5126 | #ifdef AVOID_SCREENSAVER
|
---|
5127 | /* Disable screensaver by event */
|
---|
5128 | just_stopped = false;
|
---|
5129 |
|
---|
5130 | if (state == Core::Stopped) {
|
---|
5131 | just_stopped = true;
|
---|
5132 | int time = 1000 * 60; // 1 minute
|
---|
5133 | QTimer::singleShot( time, this, SLOT(clear_just_stopped()) );
|
---|
5134 | }
|
---|
5135 | #endif
|
---|
5136 | #endif
|
---|
5137 | }
|
---|
5138 |
|
---|
5139 | void BaseGui::displayMessage(QString message, int time) {
|
---|
5140 | statusBar()->showMessage(message, time);
|
---|
5141 | }
|
---|
5142 |
|
---|
5143 | void BaseGui::displayMessage(QString message) {
|
---|
5144 | displayMessage(message, 2000);
|
---|
5145 | }
|
---|
5146 |
|
---|
5147 | void BaseGui::gotCurrentTime(double sec) {
|
---|
5148 | //qDebug( "DefaultGui::displayTime: %f", sec);
|
---|
5149 |
|
---|
5150 | static int last_second = 0;
|
---|
5151 |
|
---|
5152 | if (floor(sec)==last_second) return; // Update only once per second
|
---|
5153 | last_second = (int) floor(sec);
|
---|
5154 |
|
---|
5155 | QString time = Helper::formatTime( (int) sec ) + " / " +
|
---|
5156 | Helper::formatTime( (int) core->mdat.duration );
|
---|
5157 |
|
---|
5158 | //qDebug( " duration: %f, current_sec: %f", core->mdat.duration, core->mset.current_sec);
|
---|
5159 |
|
---|
5160 | emit timeChanged( time );
|
---|
5161 | }
|
---|
5162 |
|
---|
5163 | void BaseGui::changeSizeFactor(int factor) {
|
---|
5164 | // If fullscreen, don't resize!
|
---|
5165 | if (pref->fullscreen) return;
|
---|
5166 |
|
---|
5167 | if (!pref->use_mplayer_window) {
|
---|
5168 | pref->size_factor = factor;
|
---|
5169 | resizeMainWindow(core->mset.win_width, core->mset.win_height);
|
---|
5170 | }
|
---|
5171 | }
|
---|
5172 |
|
---|
5173 | void BaseGui::toggleDoubleSize() {
|
---|
5174 | if (pref->size_factor != 100) changeSizeFactor(100); else changeSizeFactor(200);
|
---|
5175 | }
|
---|
5176 |
|
---|
5177 | void BaseGui::resizeWindow(int w, int h) {
|
---|
5178 | qDebug("BaseGui::resizeWindow: %d, %d", w, h);
|
---|
5179 |
|
---|
5180 | // If fullscreen, don't resize!
|
---|
5181 | if (pref->fullscreen) return;
|
---|
5182 |
|
---|
5183 | if ( (pref->resize_method==Preferences::Never) && (panel->isVisible()) ) {
|
---|
5184 | return;
|
---|
5185 | }
|
---|
5186 |
|
---|
5187 | if (!panel->isVisible()) {
|
---|
5188 | panel->show();
|
---|
5189 |
|
---|
5190 | // Enable compact mode
|
---|
5191 | //compactAct->setEnabled(true);
|
---|
5192 | }
|
---|
5193 |
|
---|
5194 | resizeMainWindow(w, h);
|
---|
5195 | }
|
---|
5196 |
|
---|
5197 | void BaseGui::resizeMainWindow(int w, int h) {
|
---|
5198 | if (pref->size_factor != 100) {
|
---|
5199 | w = w * pref->size_factor / 100;
|
---|
5200 | h = h * pref->size_factor / 100;
|
---|
5201 | }
|
---|
5202 |
|
---|
5203 | qDebug("BaseGui::resizeWindow: size to scale: %d, %d", w, h);
|
---|
5204 |
|
---|
5205 | QSize video_size(w,h);
|
---|
5206 |
|
---|
5207 | if (video_size == panel->size()) {
|
---|
5208 | qDebug("BaseGui::resizeWindow: the panel size is already the required size. Doing nothing.");
|
---|
5209 | return;
|
---|
5210 | }
|
---|
5211 |
|
---|
5212 | int diff_width = this->width() - panel->width();
|
---|
5213 | int diff_height = this->height() - panel->height();
|
---|
5214 |
|
---|
5215 | int new_width = w + diff_width;
|
---|
5216 | int new_height = h + diff_height;
|
---|
5217 |
|
---|
5218 | #if USE_MINIMUMSIZE
|
---|
5219 | int minimum_width = minimumSizeHint().width();
|
---|
5220 | if (pref->gui_minimum_width != 0) minimum_width = pref->gui_minimum_width;
|
---|
5221 | if (new_width < minimum_width) {
|
---|
5222 | qDebug("BaseGui::resizeWindow: width is too small, setting width to %d", minimum_width);
|
---|
5223 | new_width = minimum_width;
|
---|
5224 | }
|
---|
5225 | #endif
|
---|
5226 |
|
---|
5227 | qDebug("BaseGui::resizeWindow: new_width: %d new_height: %d", new_width, new_height);
|
---|
5228 |
|
---|
5229 | #if 0
|
---|
5230 | QSize desktop_size = DesktopInfo::desktop_size(this);
|
---|
5231 | //desktop_size.setWidth(1000); desktop_size.setHeight(1000); // test
|
---|
5232 | if (new_width > desktop_size.width()) {
|
---|
5233 | double aspect = (double) new_width / new_height;
|
---|
5234 | qDebug("BaseGui::resizeWindow: width (%d) is larger than desktop width (%d)", new_width, desktop_size.width());
|
---|
5235 | new_width = desktop_size.width();
|
---|
5236 | /*
|
---|
5237 | new_height = new_width / aspect;
|
---|
5238 | qDebug() << "BaseGui::resizeWindow: aspect:" << aspect;
|
---|
5239 | qDebug("BaseGui::resizeWindow: height: %d", new_height);
|
---|
5240 | */
|
---|
5241 | }
|
---|
5242 | if (new_height > desktop_size.height()) {
|
---|
5243 | qDebug("BaseGui::resizeWindow: height (%d) is larger than desktop height (%d)", new_height, desktop_size.height());
|
---|
5244 | new_height = desktop_size.height();
|
---|
5245 | }
|
---|
5246 | #endif
|
---|
5247 |
|
---|
5248 | resize(new_width, new_height);
|
---|
5249 |
|
---|
5250 | qDebug("BaseGui::resizeWindow: done: window size: %d, %d", this->width(), this->height());
|
---|
5251 | qDebug("BaseGui::resizeWindow: done: panel->size: %d, %d",
|
---|
5252 | panel->size().width(),
|
---|
5253 | panel->size().height() );
|
---|
5254 | qDebug("BaseGui::resizeWindow: done: mplayerwindow->size: %d, %d",
|
---|
5255 | mplayerwindow->size().width(),
|
---|
5256 | mplayerwindow->size().height() );
|
---|
5257 |
|
---|
5258 | // Check if a part of the window is outside of the desktop
|
---|
5259 | // and center the window in that case
|
---|
5260 | if ((pref->center_window_if_outside) && (!core->mdat.novideo)) {
|
---|
5261 | QRect screen_rect = QApplication::desktop()->screenGeometry(this);
|
---|
5262 | QPoint right_bottom = QPoint(this->pos().x() + this->width(), this->pos().y() + this->height());
|
---|
5263 | qDebug("BaseGui::resizeWindow: right bottom point: %d, %d", right_bottom.x(), right_bottom.y());;
|
---|
5264 | if (!screen_rect.contains(right_bottom) || !screen_rect.contains(this->pos())) {
|
---|
5265 | qDebug("BaseGui::resizeWindow: the window is outside of the desktop, it will be moved");
|
---|
5266 | //move(screen_rect.x(), screen_rect.y());
|
---|
5267 | int x = screen_rect.x() + ((screen_rect.width() - width()) / 2);
|
---|
5268 | int y = screen_rect.y() + ((screen_rect.height() - height()) / 2);
|
---|
5269 | move(x, y);
|
---|
5270 | }
|
---|
5271 | }
|
---|
5272 |
|
---|
5273 | }
|
---|
5274 |
|
---|
5275 | void BaseGui::hidePanel() {
|
---|
5276 | qDebug("BaseGui::hidePanel");
|
---|
5277 |
|
---|
5278 | if (panel->isVisible()) {
|
---|
5279 | // Exit from fullscreen mode
|
---|
5280 | if (pref->fullscreen) { toggleFullscreen(false); update(); }
|
---|
5281 |
|
---|
5282 | // Exit from compact mode first
|
---|
5283 | if (pref->compact_mode) toggleCompactMode(false);
|
---|
5284 |
|
---|
5285 | //resizeWindow( size().width(), 0 );
|
---|
5286 | int width = size().width();
|
---|
5287 | if (width > pref->default_size.width()) width = pref->default_size.width();
|
---|
5288 | resize( width, size().height() - panel->size().height() );
|
---|
5289 | panel->hide();
|
---|
5290 |
|
---|
5291 | // Disable compact mode
|
---|
5292 | //compactAct->setEnabled(false);
|
---|
5293 | }
|
---|
5294 | }
|
---|
5295 |
|
---|
5296 | void BaseGui::centerWindow() {
|
---|
5297 | qDebug("BaseGui::centerWindow");
|
---|
5298 | if (pref->center_window && !pref->fullscreen && isVisible()) {
|
---|
5299 | QRect r = QApplication::desktop()->screenGeometry(this);
|
---|
5300 | // r.setX(500); r.setY(150); // Test
|
---|
5301 | qDebug() << "BaseGui::centerWindow: desktop rect:" << r;
|
---|
5302 | int x = r.x() + ((r.width() - width()) / 2);
|
---|
5303 | int y = r.y() + ((r.height() - height()) / 2);
|
---|
5304 | move(x, y);
|
---|
5305 | }
|
---|
5306 | }
|
---|
5307 |
|
---|
5308 | void BaseGui::displayGotoTime(int t) {
|
---|
5309 | #ifdef SEEKBAR_RESOLUTION
|
---|
5310 | int jump_time = (int)core->mdat.duration * t / SEEKBAR_RESOLUTION;
|
---|
5311 | #else
|
---|
5312 | int jump_time = (int)core->mdat.duration * t / 100;
|
---|
5313 | #endif
|
---|
5314 | QString s = tr("Jump to %1").arg( Helper::formatTime(jump_time) );
|
---|
5315 | statusBar()->showMessage( s, 1000 );
|
---|
5316 |
|
---|
5317 | if (pref->fullscreen) {
|
---|
5318 | core->displayTextOnOSD( s );
|
---|
5319 | }
|
---|
5320 | }
|
---|
5321 |
|
---|
5322 | void BaseGui::goToPosOnDragging(int t) {
|
---|
5323 | if (pref->update_while_seeking) {
|
---|
5324 | #if ENABLE_DELAYED_DRAGGING
|
---|
5325 | #ifdef SEEKBAR_RESOLUTION
|
---|
5326 | core->goToPosition(t);
|
---|
5327 | #else
|
---|
5328 | core->goToPos(t);
|
---|
5329 | #endif
|
---|
5330 | #else
|
---|
5331 | if ( ( t % 4 ) == 0 ) {
|
---|
5332 | qDebug("BaseGui::goToPosOnDragging: %d", t);
|
---|
5333 | #ifdef SEEKBAR_RESOLUTION
|
---|
5334 | core->goToPosition(t);
|
---|
5335 | #else
|
---|
5336 | core->goToPos(t);
|
---|
5337 | #endif
|
---|
5338 | }
|
---|
5339 | #endif
|
---|
5340 | }
|
---|
5341 | }
|
---|
5342 |
|
---|
5343 | void BaseGui::toggleCompactMode() {
|
---|
5344 | toggleCompactMode( !pref->compact_mode );
|
---|
5345 | }
|
---|
5346 |
|
---|
5347 | void BaseGui::toggleCompactMode(bool b) {
|
---|
5348 | qDebug("BaseGui::toggleCompactMode: %d", b);
|
---|
5349 |
|
---|
5350 | if (b)
|
---|
5351 | aboutToEnterCompactMode();
|
---|
5352 | else
|
---|
5353 | aboutToExitCompactMode();
|
---|
5354 |
|
---|
5355 | pref->compact_mode = b;
|
---|
5356 | updateWidgets();
|
---|
5357 | }
|
---|
5358 |
|
---|
5359 | void BaseGui::aboutToEnterCompactMode() {
|
---|
5360 | menuBar()->hide();
|
---|
5361 | statusBar()->hide();
|
---|
5362 | }
|
---|
5363 |
|
---|
5364 | void BaseGui::aboutToExitCompactMode() {
|
---|
5365 | menuBar()->show();
|
---|
5366 | statusBar()->show();
|
---|
5367 | }
|
---|
5368 |
|
---|
5369 | void BaseGui::setStayOnTop(bool b) {
|
---|
5370 | qDebug("BaseGui::setStayOnTop: %d", b);
|
---|
5371 |
|
---|
5372 | if ( (b && (windowFlags() & Qt::WindowStaysOnTopHint)) ||
|
---|
5373 | (!b && (!(windowFlags() & Qt::WindowStaysOnTopHint))) )
|
---|
5374 | {
|
---|
5375 | // identical do nothing
|
---|
5376 | qDebug("BaseGui::setStayOnTop: nothing to do");
|
---|
5377 | return;
|
---|
5378 | }
|
---|
5379 |
|
---|
5380 | ignore_show_hide_events = true;
|
---|
5381 |
|
---|
5382 | bool visible = isVisible();
|
---|
5383 |
|
---|
5384 | QPoint old_pos = pos();
|
---|
5385 |
|
---|
5386 | if (b) {
|
---|
5387 | setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
|
---|
5388 | }
|
---|
5389 | else {
|
---|
5390 | setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint);
|
---|
5391 | }
|
---|
5392 |
|
---|
5393 | move(old_pos);
|
---|
5394 |
|
---|
5395 | if (visible) {
|
---|
5396 | show();
|
---|
5397 | }
|
---|
5398 |
|
---|
5399 | ignore_show_hide_events = false;
|
---|
5400 | }
|
---|
5401 |
|
---|
5402 | void BaseGui::changeStayOnTop(int stay_on_top) {
|
---|
5403 | switch (stay_on_top) {
|
---|
5404 | case Preferences::AlwaysOnTop : setStayOnTop(true); break;
|
---|
5405 | case Preferences::NeverOnTop : setStayOnTop(false); break;
|
---|
5406 | case Preferences::WhilePlayingOnTop : setStayOnTop((core->state() == Core::Playing)); break;
|
---|
5407 | }
|
---|
5408 |
|
---|
5409 | pref->stay_on_top = (Preferences::OnTop) stay_on_top;
|
---|
5410 | updateWidgets();
|
---|
5411 | }
|
---|
5412 |
|
---|
5413 | void BaseGui::checkStayOnTop(Core::State state) {
|
---|
5414 | qDebug("BaseGui::checkStayOnTop");
|
---|
5415 | if ((!pref->fullscreen) && (pref->stay_on_top == Preferences::WhilePlayingOnTop)) {
|
---|
5416 | setStayOnTop((state == Core::Playing));
|
---|
5417 | }
|
---|
5418 | }
|
---|
5419 |
|
---|
5420 | void BaseGui::toggleStayOnTop() {
|
---|
5421 | if (pref->stay_on_top == Preferences::AlwaysOnTop)
|
---|
5422 | changeStayOnTop(Preferences::NeverOnTop);
|
---|
5423 | else
|
---|
5424 | if (pref->stay_on_top == Preferences::NeverOnTop)
|
---|
5425 | changeStayOnTop(Preferences::AlwaysOnTop);
|
---|
5426 | }
|
---|
5427 |
|
---|
5428 | // Called when a new window (equalizer, preferences..) is opened.
|
---|
5429 | void BaseGui::exitFullscreenIfNeeded() {
|
---|
5430 | /*
|
---|
5431 | if (pref->fullscreen) {
|
---|
5432 | toggleFullscreen(false);
|
---|
5433 | }
|
---|
5434 | */
|
---|
5435 | }
|
---|
5436 |
|
---|
5437 | #if ALLOW_CHANGE_STYLESHEET
|
---|
5438 | QString BaseGui::loadQss(QString filename) {
|
---|
5439 | qDebug("BaseGui::loadQss: %s", filename.toUtf8().constData());
|
---|
5440 |
|
---|
5441 | QFile file( filename );
|
---|
5442 | file.open(QFile::ReadOnly);
|
---|
5443 | QString stylesheet = QLatin1String(file.readAll());
|
---|
5444 |
|
---|
5445 | #ifdef USE_RESOURCES
|
---|
5446 | Images::setTheme(pref->iconset);
|
---|
5447 | QString path;
|
---|
5448 | if (Images::has_rcc) {
|
---|
5449 | path = ":/" + pref->iconset;
|
---|
5450 | } else {
|
---|
5451 | QDir current = QDir::current();
|
---|
5452 | QString td = Images::themesDirectory();
|
---|
5453 | path = current.relativeFilePath(td);
|
---|
5454 | }
|
---|
5455 | #else
|
---|
5456 | QDir current = QDir::current();
|
---|
5457 | QString td = Images::themesDirectory();
|
---|
5458 | QString path = current.relativeFilePath(td);
|
---|
5459 | #endif
|
---|
5460 | stylesheet.replace(QRegExp("url\\s*\\(\\s*([^\\);]+)\\s*\\)", Qt::CaseSensitive, QRegExp::RegExp2),
|
---|
5461 | QString("url(%1\\1)").arg(path + "/"));
|
---|
5462 | //qDebug("BaseGui::loadQss: styleSheet: %s", stylesheet.toUtf8().constData());
|
---|
5463 | return stylesheet;
|
---|
5464 | }
|
---|
5465 |
|
---|
5466 | void BaseGui::changeStyleSheet(QString style) {
|
---|
5467 | qDebug("BaseGui::changeStyleSheet: %s", style.toUtf8().constData());
|
---|
5468 |
|
---|
5469 | // Load default stylesheet
|
---|
5470 | QString stylesheet = loadQss(":/default-theme/style.qss");
|
---|
5471 |
|
---|
5472 | if (!style.isEmpty()) {
|
---|
5473 | // Check main.css
|
---|
5474 | QString qss_file = Paths::configPath() + "/themes/" + pref->iconset + "/main.css";
|
---|
5475 | if (!QFile::exists(qss_file)) {
|
---|
5476 | qss_file = Paths::themesPath() +"/"+ pref->iconset + "/main.css";
|
---|
5477 | }
|
---|
5478 |
|
---|
5479 | // Check style.qss
|
---|
5480 | if (!QFile::exists(qss_file)) {
|
---|
5481 | qss_file = Paths::configPath() + "/themes/" + pref->iconset + "/style.qss";
|
---|
5482 | if (!QFile::exists(qss_file)) {
|
---|
5483 | qss_file = Paths::themesPath() +"/"+ pref->iconset + "/style.qss";
|
---|
5484 | }
|
---|
5485 | }
|
---|
5486 |
|
---|
5487 | // Load style file
|
---|
5488 | if (QFile::exists(qss_file)) {
|
---|
5489 | qDebug("BaseGui::changeStyleSheet: '%s'", qss_file.toUtf8().data());
|
---|
5490 | stylesheet += loadQss(qss_file);
|
---|
5491 | }
|
---|
5492 | }
|
---|
5493 |
|
---|
5494 | //qDebug("BaseGui::changeStyleSheet: styleSheet: %s", stylesheet.toUtf8().constData());
|
---|
5495 | qApp->setStyleSheet(stylesheet);
|
---|
5496 | }
|
---|
5497 | #endif
|
---|
5498 |
|
---|
5499 | void BaseGui::applyStyles() {
|
---|
5500 | qDebug("BaseGui::applyStyles");
|
---|
5501 |
|
---|
5502 | #if ALLOW_CHANGE_STYLESHEET
|
---|
5503 | qDebug() << "BaseGui::applyStyles: stylesheet:" << pref->iconset;
|
---|
5504 | changeStyleSheet(pref->iconset);
|
---|
5505 | #endif
|
---|
5506 |
|
---|
5507 | #if STYLE_SWITCHING
|
---|
5508 | QString style = pref->style;
|
---|
5509 | if (style.isEmpty()) style = default_style;
|
---|
5510 | qDebug() << "BaseGui::applyStyles: style:" << style;
|
---|
5511 | if (!style.isEmpty()) qApp->setStyle(style);
|
---|
5512 | #endif
|
---|
5513 |
|
---|
5514 | }
|
---|
5515 |
|
---|
5516 | void BaseGui::loadActions() {
|
---|
5517 | qDebug("BaseGui::loadActions");
|
---|
5518 | ActionsEditor::loadFromConfig(this, settings);
|
---|
5519 | #if !DOCK_PLAYLIST
|
---|
5520 | ActionsEditor::loadFromConfig(playlist, settings);
|
---|
5521 | #endif
|
---|
5522 |
|
---|
5523 | actions_list = ActionsEditor::actionsNames(this);
|
---|
5524 | #if !DOCK_PLAYLIST
|
---|
5525 | actions_list += ActionsEditor::actionsNames(playlist);
|
---|
5526 | #endif
|
---|
5527 | }
|
---|
5528 |
|
---|
5529 | void BaseGui::saveActions() {
|
---|
5530 | qDebug("BaseGui::saveActions");
|
---|
5531 |
|
---|
5532 | ActionsEditor::saveToConfig(this, settings);
|
---|
5533 | #if !DOCK_PLAYLIST
|
---|
5534 | ActionsEditor::saveToConfig(playlist, settings);
|
---|
5535 | #endif
|
---|
5536 | }
|
---|
5537 |
|
---|
5538 | void BaseGui::processMouseMovedDiff(QPoint diff) {
|
---|
5539 | //qDebug() << "BaseGui::processMouseMovedDiff" << diff;
|
---|
5540 |
|
---|
5541 | #ifdef MOUSE_GESTURES
|
---|
5542 | #ifdef MG_DELAYED_SEEK
|
---|
5543 | if (delayed_seek_timer == 0) {
|
---|
5544 | delayed_seek_timer = new QTimer(this);
|
---|
5545 | delayed_seek_timer->setSingleShot(true);
|
---|
5546 | delayed_seek_timer->setInterval(250);
|
---|
5547 | connect(delayed_seek_timer, SIGNAL(timeout()), this, SLOT(delayedSeek()));
|
---|
5548 | }
|
---|
5549 | #endif
|
---|
5550 |
|
---|
5551 | if (pref->drag_function == Preferences::Gestures) {
|
---|
5552 | if (core->state() == Core::Stopped) return;
|
---|
5553 |
|
---|
5554 | int t = 1;
|
---|
5555 |
|
---|
5556 | int h_desp = qAbs(diff.x());
|
---|
5557 | int v_desp = qAbs(diff.y());
|
---|
5558 |
|
---|
5559 | if (h_desp > v_desp) {
|
---|
5560 | // Horizontal
|
---|
5561 | if (diff.x() > t) {
|
---|
5562 | #ifdef MG_DELAYED_SEEK
|
---|
5563 | delayed_seek_value += h_desp;
|
---|
5564 | delayed_seek_timer->start();
|
---|
5565 | #else
|
---|
5566 | core->sforward();
|
---|
5567 | #endif
|
---|
5568 | }
|
---|
5569 | else
|
---|
5570 | if (diff.x() < -t) {
|
---|
5571 | #ifdef MG_DELAYED_SEEK
|
---|
5572 | delayed_seek_value -= h_desp;
|
---|
5573 | delayed_seek_timer->start();
|
---|
5574 | #else
|
---|
5575 | core->srewind();
|
---|
5576 | #endif
|
---|
5577 | }
|
---|
5578 | #ifdef MG_DELAYED_SEEK
|
---|
5579 | int time = qAbs(delayed_seek_value);
|
---|
5580 | int minutes = time / 60;
|
---|
5581 | int seconds = time - (minutes * 60);
|
---|
5582 | QString s;
|
---|
5583 | if (delayed_seek_value >= 0) s = "+"; else s = "-";
|
---|
5584 | if (minutes > 0) s += QString("%1").arg(minutes, 2, 10, QChar('0')) + ":";
|
---|
5585 | s += QString("%1").arg(seconds, 2, 10, QChar('0'));
|
---|
5586 | if (pref->fullscreen) {
|
---|
5587 | core->displayTextOnOSD(s, 1000);
|
---|
5588 | } else {
|
---|
5589 | displayMessage(s, 1000);
|
---|
5590 | }
|
---|
5591 | #endif
|
---|
5592 | } else {
|
---|
5593 | // Vertical
|
---|
5594 | if (diff.y() > t) core->decVolume(1);
|
---|
5595 | else
|
---|
5596 | if (diff.y() < -t) core->incVolume(1);
|
---|
5597 | }
|
---|
5598 | }
|
---|
5599 | #endif
|
---|
5600 |
|
---|
5601 | if (pref->drag_function == Preferences::MoveWindow) {
|
---|
5602 | moveWindowDiff(diff);
|
---|
5603 | }
|
---|
5604 | }
|
---|
5605 |
|
---|
5606 | void BaseGui::moveWindowDiff(QPoint diff) {
|
---|
5607 | //qDebug() << "BaseGui::moveWindowDiff:" << diff;
|
---|
5608 |
|
---|
5609 | if (pref->fullscreen || isMaximized()) {
|
---|
5610 | return;
|
---|
5611 | }
|
---|
5612 |
|
---|
5613 | #if QT_VERSION >= 0x050000
|
---|
5614 | // Move the window with some delay.
|
---|
5615 | // Seems to work better with Qt 5
|
---|
5616 |
|
---|
5617 | static QPoint d;
|
---|
5618 | static int count = 0;
|
---|
5619 |
|
---|
5620 | d += diff;
|
---|
5621 | count++;
|
---|
5622 |
|
---|
5623 | if (count > 3) {
|
---|
5624 | //qDebug() << "BaseGui::moveWindowDiff:" << d;
|
---|
5625 | QPoint new_pos = pos() + d;
|
---|
5626 | if (new_pos.y() < 0) new_pos.setY(0);
|
---|
5627 | if (new_pos.x() < 0) new_pos.setX(0);
|
---|
5628 | //qDebug() << "BaseGui::moveWindowDiff: new_pos:" << new_pos;
|
---|
5629 | move(new_pos);
|
---|
5630 | count = 0;
|
---|
5631 | d = QPoint(0,0);
|
---|
5632 | }
|
---|
5633 | #else
|
---|
5634 | //qDebug() << "BaseGui::moveWindowDiff:" << diff;
|
---|
5635 | move(pos() + diff);
|
---|
5636 | #endif
|
---|
5637 | }
|
---|
5638 |
|
---|
5639 | #ifdef MG_DELAYED_SEEK
|
---|
5640 | void BaseGui::delayedSeek() {
|
---|
5641 | qDebug() << "BaseGui::delayedSeek:" << delayed_seek_value;
|
---|
5642 | if (delayed_seek_value != 0) {
|
---|
5643 | core->seek(delayed_seek_value);
|
---|
5644 | delayed_seek_value = 0;
|
---|
5645 | }
|
---|
5646 | }
|
---|
5647 | #endif
|
---|
5648 |
|
---|
5649 |
|
---|
5650 | #if QT_VERSION < 0x050000
|
---|
5651 | void BaseGui::showEvent( QShowEvent * ) {
|
---|
5652 | qDebug("BaseGui::showEvent");
|
---|
5653 |
|
---|
5654 | if (ignore_show_hide_events) return;
|
---|
5655 |
|
---|
5656 | //qDebug("BaseGui::showEvent: pref->pause_when_hidden: %d", pref->pause_when_hidden);
|
---|
5657 | if ((pref->pause_when_hidden) && (core->state() == Core::Paused)) {
|
---|
5658 | qDebug("BaseGui::showEvent: unpausing");
|
---|
5659 | core->pause(); // Unpauses
|
---|
5660 | }
|
---|
5661 | }
|
---|
5662 |
|
---|
5663 | void BaseGui::hideEvent( QHideEvent * ) {
|
---|
5664 | qDebug("BaseGui::hideEvent");
|
---|
5665 |
|
---|
5666 | if (ignore_show_hide_events) return;
|
---|
5667 |
|
---|
5668 | //qDebug("BaseGui::hideEvent: pref->pause_when_hidden: %d", pref->pause_when_hidden);
|
---|
5669 | if ((pref->pause_when_hidden) && (core->state() == Core::Playing)) {
|
---|
5670 | qDebug("BaseGui::hideEvent: pausing");
|
---|
5671 | core->pause();
|
---|
5672 | }
|
---|
5673 | }
|
---|
5674 | #else
|
---|
5675 | // Qt 5 doesn't call showEvent / hideEvent when the window is minimized or unminimized
|
---|
5676 | bool BaseGui::event(QEvent * e) {
|
---|
5677 | //qDebug("BaseGui::event: %d", e->type());
|
---|
5678 |
|
---|
5679 | bool result = QWidget::event(e);
|
---|
5680 | if ((ignore_show_hide_events) || (!pref->pause_when_hidden)) return result;
|
---|
5681 |
|
---|
5682 | if (e->type() == QEvent::WindowStateChange) {
|
---|
5683 | qDebug("BaseGui::event: WindowStateChange");
|
---|
5684 |
|
---|
5685 | if (isMinimized()) {
|
---|
5686 | was_minimized = true;
|
---|
5687 | if (core->state() == Core::Playing) {
|
---|
5688 | qDebug("BaseGui::event: pausing");
|
---|
5689 | core->pause();
|
---|
5690 | }
|
---|
5691 | }
|
---|
5692 | }
|
---|
5693 |
|
---|
5694 | if ((e->type() == QEvent::ActivationChange) && (isActiveWindow())) {
|
---|
5695 | qDebug("BaseGui::event: ActivationChange: %d", was_minimized);
|
---|
5696 |
|
---|
5697 | if ((!isMinimized()) && (was_minimized)) {
|
---|
5698 | was_minimized = false;
|
---|
5699 | if (core->state() == Core::Paused) {
|
---|
5700 | qDebug("BaseGui::showEvent: unpausing");
|
---|
5701 | core->pause(); // Unpauses
|
---|
5702 | }
|
---|
5703 | }
|
---|
5704 | }
|
---|
5705 |
|
---|
5706 | return result;
|
---|
5707 | }
|
---|
5708 | #endif
|
---|
5709 |
|
---|
5710 | void BaseGui::askForMplayerVersion(QString line) {
|
---|
5711 | qDebug("BaseGui::askForMplayerVersion: %s", line.toUtf8().data());
|
---|
5712 |
|
---|
5713 | if (pref->mplayer_user_supplied_version <= 0) {
|
---|
5714 | InputMplayerVersion d(this);
|
---|
5715 | d.setVersion( pref->mplayer_user_supplied_version );
|
---|
5716 | d.setVersionFromOutput(line);
|
---|
5717 | if (d.exec() == QDialog::Accepted) {
|
---|
5718 | pref->mplayer_user_supplied_version = d.version();
|
---|
5719 | qDebug("BaseGui::askForMplayerVersion: user supplied version: %d", pref->mplayer_user_supplied_version);
|
---|
5720 | }
|
---|
5721 | } else {
|
---|
5722 | qDebug("BaseGui::askForMplayerVersion: already have a version supplied by user, so no asking");
|
---|
5723 | }
|
---|
5724 | }
|
---|
5725 |
|
---|
5726 | void BaseGui::showExitCodeFromMplayer(int exit_code) {
|
---|
5727 | qDebug("BaseGui::showExitCodeFromMplayer: %d", exit_code);
|
---|
5728 |
|
---|
5729 | if (!pref->report_mplayer_crashes) {
|
---|
5730 | qDebug("BaseGui::showExitCodeFromMplayer: not displaying error dialog");
|
---|
5731 | return;
|
---|
5732 | }
|
---|
5733 |
|
---|
5734 | if (exit_code != 255 ) {
|
---|
5735 | ErrorDialog d(this);
|
---|
5736 | d.setWindowTitle(tr("%1 Error").arg(PLAYER_NAME));
|
---|
5737 | d.setText(tr("%1 has finished unexpectedly.").arg(PLAYER_NAME) + " " +
|
---|
5738 | tr("Exit code: %1").arg(exit_code));
|
---|
5739 | #ifdef LOG_MPLAYER
|
---|
5740 | d.setLog( mplayer_log );
|
---|
5741 | #endif
|
---|
5742 | d.exec();
|
---|
5743 | }
|
---|
5744 | }
|
---|
5745 |
|
---|
5746 | void BaseGui::showErrorFromMplayer(QProcess::ProcessError e) {
|
---|
5747 | qDebug("BaseGui::showErrorFromMplayer");
|
---|
5748 |
|
---|
5749 | if (!pref->report_mplayer_crashes) {
|
---|
5750 | qDebug("BaseGui::showErrorFromMplayer: not displaying error dialog");
|
---|
5751 | return;
|
---|
5752 | }
|
---|
5753 |
|
---|
5754 | if ((e == QProcess::FailedToStart) || (e == QProcess::Crashed)) {
|
---|
5755 | ErrorDialog d(this);
|
---|
5756 | d.setWindowTitle(tr("%1 Error").arg(PLAYER_NAME));
|
---|
5757 | if (e == QProcess::FailedToStart) {
|
---|
5758 | d.setText(tr("%1 failed to start.").arg(PLAYER_NAME) + " " +
|
---|
5759 | tr("Please check the %1 path in preferences.").arg(PLAYER_NAME));
|
---|
5760 | } else {
|
---|
5761 | d.setText(tr("%1 has crashed.").arg(PLAYER_NAME) + " " +
|
---|
5762 | tr("See the log for more info."));
|
---|
5763 | }
|
---|
5764 | #ifdef LOG_MPLAYER
|
---|
5765 | d.setLog( mplayer_log );
|
---|
5766 | #endif
|
---|
5767 | d.exec();
|
---|
5768 | }
|
---|
5769 | }
|
---|
5770 |
|
---|
5771 |
|
---|
5772 | #ifdef FIND_SUBTITLES
|
---|
5773 | void BaseGui::showFindSubtitlesDialog() {
|
---|
5774 | qDebug("BaseGui::showFindSubtitlesDialog");
|
---|
5775 |
|
---|
5776 | if (!find_subs_dialog) {
|
---|
5777 | find_subs_dialog = new FindSubtitlesWindow(this, Qt::Window | Qt::WindowMinMaxButtonsHint);
|
---|
5778 | find_subs_dialog->setSettings(Global::settings);
|
---|
5779 | find_subs_dialog->setWindowIcon(windowIcon());
|
---|
5780 | #if DOWNLOAD_SUBS
|
---|
5781 | connect(find_subs_dialog, SIGNAL(subtitleDownloaded(const QString &)),
|
---|
5782 | core, SLOT(loadSub(const QString &)));
|
---|
5783 | #endif
|
---|
5784 | }
|
---|
5785 |
|
---|
5786 | find_subs_dialog->show();
|
---|
5787 | find_subs_dialog->setMovie(core->mdat.filename);
|
---|
5788 | }
|
---|
5789 |
|
---|
5790 | void BaseGui::openUploadSubtitlesPage() {
|
---|
5791 | QDesktopServices::openUrl( QUrl("http://www.opensubtitles.org/upload") );
|
---|
5792 | }
|
---|
5793 | #endif
|
---|
5794 |
|
---|
5795 | #ifdef VIDEOPREVIEW
|
---|
5796 | void BaseGui::showVideoPreviewDialog() {
|
---|
5797 | qDebug("BaseGui::showVideoPreviewDialog");
|
---|
5798 |
|
---|
5799 | if (video_preview == 0) {
|
---|
5800 | video_preview = new VideoPreview( pref->mplayer_bin, this );
|
---|
5801 | video_preview->setSettings(Global::settings);
|
---|
5802 | }
|
---|
5803 |
|
---|
5804 | if (!core->mdat.filename.isEmpty()) {
|
---|
5805 | video_preview->setVideoFile(core->mdat.filename);
|
---|
5806 |
|
---|
5807 | // DVD
|
---|
5808 | if (core->mdat.type==TYPE_DVD) {
|
---|
5809 | QString file = core->mdat.filename;
|
---|
5810 | DiscData disc_data = DiscName::split(file);
|
---|
5811 | QString dvd_folder = disc_data.device;
|
---|
5812 | if (dvd_folder.isEmpty()) dvd_folder = pref->dvd_device;
|
---|
5813 | int dvd_title = disc_data.title;
|
---|
5814 | file = disc_data.protocol + "://" + QString::number(dvd_title);
|
---|
5815 |
|
---|
5816 | video_preview->setVideoFile(file);
|
---|
5817 | video_preview->setDVDDevice(dvd_folder);
|
---|
5818 | } else {
|
---|
5819 | video_preview->setDVDDevice("");
|
---|
5820 | }
|
---|
5821 | }
|
---|
5822 |
|
---|
5823 | video_preview->setMplayerPath(pref->mplayer_bin);
|
---|
5824 |
|
---|
5825 | if ( (video_preview->showConfigDialog(this)) && (video_preview->createThumbnails()) ) {
|
---|
5826 | video_preview->show();
|
---|
5827 | video_preview->adjustWindowSize();
|
---|
5828 | }
|
---|
5829 | }
|
---|
5830 | #endif
|
---|
5831 |
|
---|
5832 | #ifdef YOUTUBE_SUPPORT
|
---|
5833 | void BaseGui::showTubeBrowser() {
|
---|
5834 | qDebug("BaseGui::showTubeBrowser");
|
---|
5835 | #ifdef Q_OS_WIN
|
---|
5836 | QString exec = Paths::appPath() + "/smtube.exe";
|
---|
5837 | #else
|
---|
5838 | QString exec = Helper::findExecutable("smtube");
|
---|
5839 | #endif
|
---|
5840 |
|
---|
5841 | if (exec.isEmpty() || !QFile::exists(exec)) {
|
---|
5842 | QMessageBox::warning(this, "SMPlayer",
|
---|
5843 | tr("The YouTube Browser is not installed.") +"<br>"+
|
---|
5844 | tr("Visit %1 to get it.").arg("<a href=http://www.smtube.org>http://www.smtube.org</a>"));
|
---|
5845 | return;
|
---|
5846 | }
|
---|
5847 |
|
---|
5848 | QStringList args;
|
---|
5849 | if (!pref->language.isEmpty()) args << "-lang" << pref->language;
|
---|
5850 | qDebug() << "BaseGui::showTubeBrowser: exec:" << exec << "args:" << args;
|
---|
5851 |
|
---|
5852 | if (!QProcess::startDetached(exec, args)) {
|
---|
5853 | QMessageBox::warning(this, "SMPlayer",
|
---|
5854 | tr("The YouTube Browser failed to run.") +"<br>"+
|
---|
5855 | tr("Be sure it's installed correctly.") +"<br>"+
|
---|
5856 | tr("Visit %1 to get it.").arg("<a href=http://www.smtube.org>http://www.smtube.org</a>"));
|
---|
5857 | }
|
---|
5858 | }
|
---|
5859 | #endif
|
---|
5860 |
|
---|
5861 | // Language change stuff
|
---|
5862 | void BaseGui::changeEvent(QEvent *e) {
|
---|
5863 | if (e->type() == QEvent::LanguageChange) {
|
---|
5864 | retranslateStrings();
|
---|
5865 | } else {
|
---|
5866 | QMainWindow::changeEvent(e);
|
---|
5867 | }
|
---|
5868 | }
|
---|
5869 |
|
---|
5870 | #ifdef Q_OS_WIN
|
---|
5871 | #ifdef AVOID_SCREENSAVER
|
---|
5872 | /* Disable screensaver by event */
|
---|
5873 | bool BaseGui::winEvent ( MSG * m, long * result ) {
|
---|
5874 | //qDebug("BaseGui::winEvent");
|
---|
5875 | if (m->message==WM_SYSCOMMAND) {
|
---|
5876 | if ((m->wParam & 0xFFF0)==SC_SCREENSAVE || (m->wParam & 0xFFF0)==SC_MONITORPOWER) {
|
---|
5877 | qDebug("BaseGui::winEvent: received SC_SCREENSAVE or SC_MONITORPOWER");
|
---|
5878 | qDebug("BaseGui::winEvent: avoid_screensaver: %d", pref->avoid_screensaver);
|
---|
5879 | qDebug("BaseGui::winEvent: playing: %d", core->state()==Core::Playing);
|
---|
5880 | qDebug("BaseGui::winEvent: video: %d", !core->mdat.novideo);
|
---|
5881 |
|
---|
5882 | if ((pref->avoid_screensaver) && (core->state()==Core::Playing) && (!core->mdat.novideo)) {
|
---|
5883 | qDebug("BaseGui::winEvent: not allowing screensaver");
|
---|
5884 | (*result) = 0;
|
---|
5885 | return true;
|
---|
5886 | } else {
|
---|
5887 | if ((pref->avoid_screensaver) && (just_stopped)) {
|
---|
5888 | qDebug("BaseGui::winEvent: file just stopped, so not allowing screensaver for a while");
|
---|
5889 | (*result) = 0;
|
---|
5890 | return true;
|
---|
5891 | } else {
|
---|
5892 | qDebug("BaseGui::winEvent: allowing screensaver");
|
---|
5893 | return false;
|
---|
5894 | }
|
---|
5895 | }
|
---|
5896 | }
|
---|
5897 | }
|
---|
5898 | return false;
|
---|
5899 | }
|
---|
5900 | #endif
|
---|
5901 | #endif
|
---|
5902 |
|
---|
5903 | #if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
---|
5904 | #ifdef AVOID_SCREENSAVER
|
---|
5905 | void BaseGui::clear_just_stopped() {
|
---|
5906 | qDebug("BaseGui::clear_just_stopped");
|
---|
5907 | just_stopped = false;
|
---|
5908 | }
|
---|
5909 | #endif
|
---|
5910 | #endif
|
---|
5911 |
|
---|
5912 | #include "moc_basegui.cpp"
|
---|