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