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