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