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