Changeset 175 for smplayer/vendor/current/src/basegui.cpp
- Timestamp:
- May 3, 2016, 2:14:41 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
smplayer/vendor/current/src/basegui.cpp
r168 r175 1 1 /* smplayer, GUI front-end for mplayer. 2 Copyright (C) 2006-201 4Ricardo Villalba <rvm@users.sourceforge.net>2 Copyright (C) 2006-2016 Ricardo Villalba <rvm@users.sourceforge.net> 3 3 4 4 This program is free software; you can redistribute it and/or modify … … 40 40 #include <QClipboard> 41 41 #include <QMimeData> 42 #include <QDesktopWidget> 42 43 43 44 #include <cmath> … … 68 69 #include "errordialog.h" 69 70 #include "timedialog.h" 71 #include "stereo3ddialog.h" 72 73 #ifdef BOOKMARKS 74 #include "inputbookmark.h" 75 #include "bookmarkdialog.h" 76 #endif 77 70 78 #include "clhelp.h" 71 79 #include "mplayerversion.h" … … 98 106 99 107 #include "constants.h" 108 #include "links.h" 109 110 #ifdef MPRIS2 111 #include "mpris2/mpris2.h" 112 #endif 100 113 101 114 #include "extensions.h" … … 107 120 #endif 108 121 122 #ifdef UPDATE_CHECKER 109 123 #include "updatechecker.h" 110 111 #ifdef YT_USE_SCRIPT 112 #include "codedownloader.h" 113 #endif 114 115 #ifdef REMINDER_ACTIONS 124 #endif 125 126 #ifdef YOUTUBE_SUPPORT 127 #ifdef YT_USE_YTSIG 128 #include "codedownloader.h" 129 #endif 130 #endif 131 132 #ifdef SHARE_ACTIONS 116 133 #include "sharedialog.h" 134 #endif 135 136 #ifdef SHARE_WIDGET 137 #include "sharewidget.h" 117 138 #endif 118 139 … … 126 147 BaseGui::BaseGui( QWidget* parent, Qt::WindowFlags flags ) 127 148 : QMainWindow( parent, flags ) 149 #if QT_VERSION >= 0x050000 150 , was_minimized(false) 151 #endif 152 #ifdef UPDATE_CHECKER 153 , update_checker(0) 154 #endif 155 #ifdef MG_DELAYED_SEEK 156 , delayed_seek_timer(0) 157 , delayed_seek_value(0) 158 #endif 128 159 { 129 160 #if defined(Q_OS_WIN) || defined(Q_OS_OS2) … … 174 205 core, SLOT(wheelDown()) ); 175 206 176 // Set style before changing color of widgets:177 // Set style178 207 #if STYLE_SWITCHING 179 qDebug( "Style name: '%s'", qApp->style()->objectName().toUtf8().data() ); 180 qDebug( "Style class name: '%s'", qApp->style()->metaObject()->className() ); 181 208 qApp->setStyleSheet(""); 182 209 default_style = qApp->style()->objectName(); 183 if (!pref->style.isEmpty()) { 184 qApp->setStyle( pref->style ); 185 } 210 #ifdef Q_OS_LINUX 211 // Some controls aren't displayed correctly with the adwaita style 212 // so try to prevent to use it as the default style 213 if (default_style.toLower() == "adwaita") default_style = "gtk+"; 214 #endif 215 qDebug() << "BaseGui::BaseGui: default_style:" << default_style; 216 //qDebug() << "BaseGui::BaseGui: qApp->style:" << qApp->style(); 186 217 #endif 187 218 … … 216 247 panel->setFocus(); 217 248 249 setupNetworkProxy(); 218 250 initializeGui(); 219 251 220 252 #ifdef UPDATE_CHECKER 221 253 update_checker = new UpdateChecker(this, &pref->update_checker_data); 222 connect(update_checker, SIGNAL(newVersionFound(QString)),223 this, SLOT(reportNewVersionAvailable(QString)));224 254 #endif 225 255 … … 228 258 #endif 229 259 230 #if def REMINDER_ACTIONS260 #if defined(SHARE_ACTIONS) && !defined(SHARE_WIDGET) 231 261 QTimer::singleShot(1000, this, SLOT(checkReminder())); 262 #endif 263 264 #ifdef MPRIS2 265 if (pref->use_mpris2) new Mpris2(this, this); 232 266 #endif 233 267 } … … 236 270 if (pref->compact_mode) toggleCompactMode(true); 237 271 changeStayOnTop(pref->stay_on_top); 238 239 #if ALLOW_CHANGE_STYLESHEET240 changeStyleSheet(pref->iconset);241 #endif242 272 243 273 updateRecents(); … … 250 280 // Single instance 251 281 /* Deleted */ 282 } 283 284 void BaseGui::setupNetworkProxy() { 285 qDebug("BaseGui::setupNetworkProxy"); 286 287 QNetworkProxy proxy; 288 289 if ( (pref->use_proxy) && (!pref->proxy_host.isEmpty()) ) { 290 proxy.setType((QNetworkProxy::ProxyType) pref->proxy_type); 291 proxy.setHostName(pref->proxy_host); 292 proxy.setPort(pref->proxy_port); 293 if ( (!pref->proxy_username.isEmpty()) && (!pref->proxy_password.isEmpty()) ) { 294 proxy.setUser(pref->proxy_username); 295 proxy.setPassword(pref->proxy_password); 296 } 297 qDebug("BaseGui::setupNetworkProxy: using proxy: host: %s, port: %d, type: %d", 298 pref->proxy_host.toUtf8().constData(), pref->proxy_port, pref->proxy_type); 299 } else { 300 // No proxy 301 proxy.setType(QNetworkProxy::NoProxy); 302 qDebug("BaseGui::setupNetworkProxy: no proxy"); 303 } 304 305 QNetworkProxy::setApplicationProxy(proxy); 252 306 } 253 307 … … 278 332 /* if (core->state() == Core::Stopped) { emit openFileRequested(); } */ 279 333 playlist->addFiles(file_list); 334 } 335 else 336 if (command == "media_title") { 337 QStringList list = arg.split(" <<sep>> "); 338 core->addForcedTitle(list[0], list[1]); 280 339 } 281 340 else … … 453 512 core, SLOT(frameStep()) ); 454 513 514 frameBackStepAct = new MyAction( Qt::Key_Comma, this, "frame_back_step" ); 515 connect( frameBackStepAct, SIGNAL(triggered()), 516 core, SLOT(frameBackStep()) ); 517 455 518 rewind1Act = new MyAction( Qt::Key_Left, this, "rewind1" ); 456 519 rewind1Act->addShortcut(QKeySequence("Shift+Ctrl+B")); // MCE remote key … … 565 628 core, SLOT(screenshots()) ); 566 629 630 #ifdef CAPTURE_STREAM 631 capturingAct = new MyAction( /*Qt::Key_C,*/ this, "capture_stream"); 632 connect( capturingAct, SIGNAL(triggered()), 633 core, SLOT(switchCapturing()) ); 634 #endif 635 567 636 #ifdef VIDEOPREVIEW 568 637 videoPreviewAct = new MyAction( this, "video_preview" ); … … 581 650 core, SLOT(toggleMirror(bool)) ); 582 651 652 stereo3dAct = new MyAction( this, "stereo_3d_filter" ); 653 connect( stereo3dAct, SIGNAL(triggered()), 654 this, SLOT(showStereo3dDialog()) ); 583 655 584 656 // Submenu filter … … 684 756 core, SLOT(toggleExtrastereo(bool)) ); 685 757 758 #ifdef MPLAYER_SUPPORT 686 759 karaokeAct = new MyAction( this, "karaoke_filter" ); 687 760 karaokeAct->setCheckable( true ); 688 761 connect( karaokeAct, SIGNAL(toggled(bool)), 689 762 core, SLOT(toggleKaraoke(bool)) ); 763 #endif 690 764 691 765 volnormAct = new MyAction( this, "volnorm_filter" ); … … 730 804 connect( incSubScaleAct, SIGNAL(triggered()), 731 805 core, SLOT(incSubScale()) ); 732 806 733 807 decSubStepAct = new MyAction( Qt::Key_G, this, "dec_sub_step" ); 734 808 connect( decSubStepAct, SIGNAL(triggered()), … … 739 813 core, SLOT(incSubStep()) ); 740 814 741 useAssAct = new MyAction(this, "use_ass_lib"); 742 useAssAct->setCheckable(true); 743 connect( useAssAct, SIGNAL(toggled(bool)), core, SLOT(changeUseAss(bool)) ); 815 #ifdef MPV_SUPPORT 816 seekNextSubAct = new MyAction(Qt::CTRL | Qt::Key_Right, this, "seek_next_sub"); 817 connect(seekNextSubAct, SIGNAL(triggered()), 818 core, SLOT(seekToNextSub())); 819 820 seekPrevSubAct = new MyAction(Qt::CTRL | Qt::Key_Left, this, "seek_prev_sub"); 821 connect(seekPrevSubAct, SIGNAL(triggered()), 822 core, SLOT(seekToPrevSub())); 823 #endif 824 825 useCustomSubStyleAct = new MyAction(this, "use_custom_sub_style"); 826 useCustomSubStyleAct->setCheckable(true); 827 connect( useCustomSubStyleAct, SIGNAL(toggled(bool)), core, SLOT(changeUseCustomSubStyle(bool)) ); 744 828 745 829 useForcedSubsOnlyAct = new MyAction(this, "use_forced_subs_only"); … … 811 895 this, SLOT(helpCheckUpdates()) ); 812 896 813 #if defined(YOUTUBE_SUPPORT) && defined(YT_USE_ SCRIPT)897 #if defined(YOUTUBE_SUPPORT) && defined(YT_USE_YTSIG) 814 898 updateYTAct = new MyAction( this, "update_youtube" ); 815 899 connect( updateYTAct, SIGNAL(triggered()), … … 821 905 this, SLOT(helpShowConfig()) ); 822 906 823 #ifdef REMINDER_ACTIONS907 #ifdef SHARE_ACTIONS 824 908 donateAct = new MyAction( this, "donate" ); 825 909 connect( donateAct, SIGNAL(triggered()), … … 850 934 #endif 851 935 936 // OSD 937 incOSDScaleAct = new MyAction(Qt::SHIFT | Qt::Key_U, this, "inc_osd_scale"); 938 connect(incOSDScaleAct, SIGNAL(triggered()), core, SLOT(incOSDScale())); 939 940 decOSDScaleAct = new MyAction(Qt::SHIFT | Qt::Key_Y, this, "dec_osd_scale"); 941 connect(decOSDScaleAct, SIGNAL(triggered()), core, SLOT(decOSDScale())); 942 943 852 944 // Playlist 853 945 playNextAct = new MyAction(Qt::Key_Greater, this, "play_next"); … … 890 982 autoZoom235Act = new MyAction(Qt::SHIFT | Qt::Key_S, this, "zoom_235"); 891 983 connect( autoZoom235Act, SIGNAL(triggered()), core, SLOT(autoZoomFor235()) ); 892 893 #if USE_MPLAYER_PANSCAN894 incPanscanAct = new MyAction(Qt::SHIFT | Qt::Key_M, this, "inc_panscan");895 connect( incPanscanAct, SIGNAL(triggered()), core, SLOT(incPanscan()) );896 897 decPanscanAct = new MyAction(Qt::SHIFT | Qt::Key_N, this, "dec_panscan");898 connect( decPanscanAct, SIGNAL(triggered()), core, SLOT(decPanscan()) );899 #endif900 984 901 985 … … 984 1068 showFilenameAct = new MyAction(Qt::SHIFT | Qt::Key_I, this, "show_filename"); 985 1069 connect( showFilenameAct, SIGNAL(triggered()), core, SLOT(showFilenameOnOSD()) ); 1070 1071 showTimeAct = new MyAction(Qt::Key_I, this, "show_time"); 1072 connect( showTimeAct, SIGNAL(triggered()), core, SLOT(showTimeOnOSD()) ); 986 1073 987 1074 toggleDeinterlaceAct = new MyAction(Qt::Key_D, this, "toggle_deinterlacing"); … … 1152 1239 // Subtitle track 1153 1240 subtitleTrackGroup = new MyActionGroup(this); 1154 1241 connect( subtitleTrackGroup, SIGNAL(activated(int)), 1155 1242 core, SLOT(changeSubtitle(int)) ); 1243 1244 #ifdef MPV_SUPPORT 1245 // Secondary subtitle track 1246 secondarySubtitleTrackGroup = new MyActionGroup(this); 1247 connect( secondarySubtitleTrackGroup, SIGNAL(activated(int)), 1248 core, SLOT(changeSecondarySubtitle(int)) ); 1249 #endif 1156 1250 1157 1251 ccGroup = new MyActionGroup(this); … … 1190 1284 core, SLOT(changeChapter(int)) ); 1191 1285 1286 #ifdef BOOKMARKS 1287 // Bookmarks 1288 bookmarkGroup = new MyActionGroup(this); 1289 connect( bookmarkGroup, SIGNAL(activated(int)), 1290 core, SLOT(goToSec(int)) ); 1291 1292 addBookmarkAct = new MyAction(Qt::CTRL | Qt::Key_A, this, "add_bookmark"); 1293 connect(addBookmarkAct, SIGNAL(triggered()), this, SLOT(showAddBookmarkDialog())); 1294 1295 editBookmarksAct = new MyAction(this, "edit_bookmarks"); 1296 connect(editBookmarksAct, SIGNAL(triggered()), this, SLOT(showBookmarkDialog())); 1297 1298 prevBookmarkAct = new MyAction(Qt::CTRL | Qt::Key_B, this, "prev_bookmark"); 1299 connect(prevBookmarkAct, SIGNAL(triggered()), core, SLOT(prevBookmark())); 1300 1301 nextBookmarkAct = new MyAction(Qt::CTRL | Qt::Key_N, this, "next_bookmark"); 1302 connect(nextBookmarkAct, SIGNAL(triggered()), core, SLOT(nextBookmark())); 1303 #endif 1304 1192 1305 #if DVDNAV_SUPPORT 1193 1306 dvdnavUpAct = new MyAction(Qt::SHIFT | Qt::Key_Up, this, "dvdnav_up"); … … 1227 1340 stopAct->setEnabled(b); 1228 1341 frameStepAct->setEnabled(b); 1342 frameBackStepAct->setEnabled(b); 1229 1343 rewind1Act->setEnabled(b); 1230 1344 rewind2Act->setEnabled(b); … … 1251 1365 screenshotAct->setEnabled(b); 1252 1366 screenshotsAct->setEnabled(b); 1367 #ifdef CAPTURE_STREAM 1368 capturingAct->setEnabled(b); 1369 #endif 1253 1370 flipAct->setEnabled(b); 1254 1371 mirrorAct->setEnabled(b); 1372 stereo3dAct->setEnabled(b); 1255 1373 postProcessingAct->setEnabled(b); 1256 1374 phaseAct->setEnabled(b); … … 1271 1389 audioDelayAct->setEnabled(b); 1272 1390 extrastereoAct->setEnabled(b); 1391 #ifdef MPLAYER_SUPPORT 1273 1392 karaokeAct->setEnabled(b); 1393 #endif 1274 1394 volnormAct->setEnabled(b); 1275 1395 loadAudioAct->setEnabled(b); … … 1288 1408 incSubScaleAct->setEnabled(b); 1289 1409 decSubScaleAct->setEnabled(b); 1410 #ifdef MPV_SUPPORT 1411 seekNextSubAct->setEnabled(b); 1412 seekPrevSubAct->setEnabled(b); 1413 #endif 1290 1414 1291 1415 // Actions not in menus … … 1363 1487 screenshotsAct->setEnabled( screenshots_enabled ); 1364 1488 1489 #ifdef CAPTURE_STREAM 1490 capturingAct->setEnabled(!pref->capture_directory.isEmpty() && QFileInfo(pref->capture_directory).isDir()); 1491 #endif 1492 1365 1493 // Disable the compact action if not using video window 1366 1494 compactAct->setEnabled( panel->isVisible() ); … … 1379 1507 audioDelayAct->setEnabled(false); 1380 1508 extrastereoAct->setEnabled(false); 1509 #ifdef MPLAYER_SUPPORT 1381 1510 karaokeAct->setEnabled(false); 1511 #endif 1382 1512 volnormAct->setEnabled(false); 1383 1513 channelsGroup->setActionsEnabled(false); … … 1390 1520 screenshotAct->setEnabled(false); 1391 1521 screenshotsAct->setEnabled(false); 1522 #ifdef CAPTURE_STREAM 1523 capturingAct->setEnabled(false); 1524 #endif 1392 1525 flipAct->setEnabled(false); 1393 1526 mirrorAct->setEnabled(false); 1527 stereo3dAct->setEnabled(false); 1394 1528 postProcessingAct->setEnabled(false); 1395 1529 phaseAct->setEnabled(false); … … 1436 1570 flipAct->setEnabled(false); 1437 1571 mirrorAct->setEnabled(false); 1572 stereo3dAct->setEnabled(false); 1438 1573 postProcessingAct->setEnabled(false); 1439 1574 phaseAct->setEnabled(false); … … 1466 1601 } 1467 1602 #endif 1603 1604 1605 #ifdef BOOKMARKS 1606 if (pref->dont_remember_media_settings || core->mdat.type != TYPE_FILE) { 1607 addBookmarkAct->setEnabled(false); 1608 editBookmarksAct->setEnabled(false); 1609 } else { 1610 addBookmarkAct->setEnabled(true); 1611 editBookmarksAct->setEnabled(true); 1612 } 1613 #endif 1468 1614 } 1469 1615 … … 1477 1623 stopAct->setEnabled(true); 1478 1624 } 1625 #endif // AUTODISABLE_ACTIONS 1479 1626 1480 1627 void BaseGui::togglePlayAction(Core::State state) { 1481 1628 qDebug("BaseGui::togglePlayAction"); 1629 1630 #if AUTODISABLE_ACTIONS 1482 1631 if (state == Core::Playing) 1483 1632 playAct->setEnabled(false); 1484 1633 else 1485 1634 playAct->setEnabled(true); 1486 } 1487 #endif // AUTODISABLE_ACTIONS 1635 #endif 1636 } 1488 1637 1489 1638 void BaseGui::retranslateStrings() { … … 1534 1683 stopAct->change( Images::icon("stop"), tr("&Stop") ); 1535 1684 frameStepAct->change( Images::icon("frame_step"), tr("&Frame step") ); 1685 frameBackStepAct->change( Images::icon("frame_back_step"), tr("Fra&me back step") ); 1536 1686 1537 1687 playOrPauseAct->change( tr("Play / Pause") ); … … 1567 1717 screenshotAct->change( Images::icon("screenshot"), tr("&Screenshot") ); 1568 1718 screenshotsAct->change( Images::icon("screenshots"), tr("Start/stop takin&g screenshots") ); 1719 #ifdef CAPTURE_STREAM 1720 capturingAct->change(Images::icon("record"), tr("Start/stop capturing stream")); 1721 #endif 1569 1722 #ifdef VIDEOPREVIEW 1570 1723 videoPreviewAct->change( Images::icon("video_preview"), tr("Thumb&nail Generator...") ); … … 1572 1725 flipAct->change( Images::icon("flip"), tr("Fli&p image") ); 1573 1726 mirrorAct->change( Images::icon("mirror"), tr("Mirr&or image") ); 1727 stereo3dAct->change( Images::icon("stereo3d"), tr("Stereo &3D filter") ); 1574 1728 1575 1729 decZoomAct->change( tr("Zoom &-") ); … … 1583 1737 moveUpAct->change( tr("Move &up") ); 1584 1738 moveDownAct->change( tr("Move &down") ); 1585 1586 #if USE_MPLAYER_PANSCAN1587 decPanscanAct->change( "Panscan -" );1588 incPanscanAct->change( "Panscan +" );1589 #endif1590 1739 1591 1740 // Submenu Filters … … 1614 1763 // Submenu Filters 1615 1764 extrastereoAct->change( tr("&Extrastereo") ); 1765 #ifdef MPLAYER_SUPPORT 1616 1766 karaokeAct->change( tr("&Karaoke") ); 1767 #endif 1617 1768 volnormAct->change( tr("Volume &normalization") ); 1618 1769 … … 1631 1782 incSubStepAct->change( Images::icon("inc_sub_step"), 1632 1783 tr("N&ext line in subtitles") ); 1633 useAssAct->change( Images::icon("use_ass_lib"), tr("Use SSA/&ASS library") ); 1784 #ifdef MPV_SUPPORT 1785 seekNextSubAct->change(Images::icon("seek_next_sub"), tr("Seek to next subtitle")); 1786 seekPrevSubAct->change(Images::icon("seek_prev_sub"), tr("Seek to previous subtitle")); 1787 #endif 1788 useCustomSubStyleAct->change( Images::icon("use_custom_sub_style"), tr("Use custo&m style") ); 1634 1789 useForcedSubsOnlyAct->change( Images::icon("forced_subs"), tr("&Forced subtitles only") ); 1635 1790 … … 1665 1820 // Submenu Logs 1666 1821 #ifdef LOG_MPLAYER 1667 showLogMplayerAct->change( "MPlayer");1822 showLogMplayerAct->change(PLAYER_NAME); 1668 1823 #endif 1669 1824 #ifdef LOG_SMPLAYER … … 1677 1832 showCheckUpdatesAct->change( Images::icon("check_updates"), tr("Check for &updates") ); 1678 1833 1679 #if defined(YOUTUBE_SUPPORT) && defined(YT_USE_ SCRIPT)1834 #if defined(YOUTUBE_SUPPORT) && defined(YT_USE_YTSIG) 1680 1835 updateYTAct->change( Images::icon("update_youtube"), tr("Update &Youtube code") ); 1681 1836 #endif 1682 1837 1683 1838 showConfigAct->change( Images::icon("show_config"), tr("&Open configuration folder") ); 1684 #ifdef REMINDER_ACTIONS1839 #ifdef SHARE_ACTIONS 1685 1840 donateAct->change( Images::icon("donate"), tr("&Donate / Share with your friends") ); 1686 1841 #endif … … 1694 1849 yahooAct->change("&Yahoo!"); 1695 1850 #endif 1851 1852 // OSD 1853 incOSDScaleAct->change(tr("Size &+")); 1854 decOSDScaleAct->change(tr("Size &-")); 1696 1855 1697 1856 // Playlist … … 1736 1895 1737 1896 showFilenameAct->change( tr("Show filename on OSD") ); 1897 showTimeAct->change( tr("Show playback time on OSD") ); 1738 1898 toggleDeinterlaceAct->change( tr("Toggle deinterlacing") ); 1739 1899 … … 1902 2062 1903 2063 // Menu Subtitle 1904 subtitlestrack_menu->menuAction()->setText( tr("&Select") ); 1905 subtitlestrack_menu->menuAction()->setIcon( Images::icon("sub") ); 2064 #ifdef MPV_SUPPORT 2065 subtitles_track_menu->menuAction()->setText( tr("Prim&ary track") ); 2066 #else 2067 subtitles_track_menu->menuAction()->setText( tr("&Select") ); 2068 #endif 2069 subtitles_track_menu->menuAction()->setIcon( Images::icon("sub") ); 2070 2071 #ifdef MPV_SUPPORT 2072 secondary_subtitles_track_menu->menuAction()->setText( tr("Secondary trac&k") ); 2073 secondary_subtitles_track_menu->menuAction()->setIcon( Images::icon("secondary_sub") ); 2074 #endif 1906 2075 1907 2076 closed_captions_menu->menuAction()->setText( tr("&Closed captions") ); … … 1921 2090 angles_menu->menuAction()->setIcon( Images::icon("angle") ); 1922 2091 2092 #ifdef BOOKMARKS 2093 bookmark_menu->menuAction()->setText( tr("&Bookmarks") ); 2094 bookmark_menu->menuAction()->setIcon( Images::icon("bookmarks") ); 2095 #endif 2096 1923 2097 #if PROGRAM_SWITCH 1924 2098 programtrack_menu->menuAction()->setText( tr("P&rogram", "program") ); … … 1926 2100 #endif 1927 2101 2102 #ifdef BOOKMARKS 2103 addBookmarkAct->change(Images::icon("add_bookmark"), tr("&Add new bookmark")); 2104 editBookmarksAct->change(Images::icon("edit_bookmarks"), tr("&Edit bookmarks")); 2105 prevBookmarkAct->change(Images::icon("prev_bookmark"), tr("Previous bookmark")); 2106 nextBookmarkAct->change(Images::icon("next_bookmark"), tr("Next bookmark")); 2107 #endif 1928 2108 1929 2109 #if DVDNAV_SUPPORT … … 1957 2137 // Other things 1958 2138 #ifdef LOG_MPLAYER 1959 mplayer_log_window->setWindowTitle( tr(" SMPlayer - MPlayer log") );2139 mplayer_log_window->setWindowTitle( tr("%1 log").arg(PLAYER_NAME) ); 1960 2140 #endif 1961 2141 #ifdef LOG_SMPLAYER 1962 smplayer_log_window->setWindowTitle( tr("SMPlayer - SMPlayerlog") );2142 smplayer_log_window->setWindowTitle( tr("SMPlayer log") ); 1963 2143 #endif 1964 2144 … … 2019 2199 this, SLOT(resizeWindow(int,int)) ); 2020 2200 2201 connect( core, SIGNAL(needResize(int, int)), 2202 this, SLOT(centerWindow()) ); 2203 2021 2204 connect( core, SIGNAL(showMessage(QString,int)), 2022 2205 this, SLOT(displayMessage(QString,int)) ); … … 2099 2282 connect(core, SIGNAL(signatureNotFound(const QString &)), 2100 2283 this, SLOT(YTNoSignature(const QString &))); 2284 connect(core, SIGNAL(noSslSupport()), 2285 this, SLOT(YTNoSslSupport())); 2101 2286 #endif 2102 2287 connect(core, SIGNAL(receivedForbidden()), this, SLOT(gotForbidden())); … … 2114 2299 #if LOGO_ANIMATION 2115 2300 mplayerwindow->setAnimatedLogo( pref->animated_logo); 2301 #endif 2302 2303 #ifdef SHARE_WIDGET 2304 sharewidget = new ShareWidget(Global::settings, mplayerwindow); 2305 mplayerwindow->setCornerWidget(sharewidget); 2306 #ifdef SHARE_ACTIONS 2307 connect(sharewidget, SIGNAL(supportClicked()), this, SLOT(helpDonate())); 2308 #endif 2116 2309 #endif 2117 2310 … … 2143 2336 2144 2337 connect( mplayerwindow, SIGNAL(mouseMovedDiff(QPoint)), 2145 this, SLOT(moveWindowDiff(QPoint)), Qt::QueuedConnection ); 2146 mplayerwindow->activateMouseDragTracking(pref->move_when_dragging); 2338 this, SLOT(processMouseMovedDiff(QPoint)), Qt::QueuedConnection ); 2339 #ifdef MOUSE_GESTURES 2340 mplayerwindow->activateMouseDragTracking(true); 2341 #else 2342 mplayerwindow->activateMouseDragTracking(pref->drag_function == Preferences::MoveWindow); 2343 #endif 2147 2344 } 2148 2345 … … 2197 2394 core, SLOT(setAudioAudioEqualizerRestart(AudioEqualizerList)) ); 2198 2395 2396 connect( audio_equalizer, SIGNAL(valuesChanged(AudioEqualizerList)), 2397 core, SLOT(setAudioEqualizer(AudioEqualizerList)) ); 2398 2199 2399 connect( audio_equalizer, SIGNAL(visibilityChanged()), 2200 2400 this, SLOT(updateWidgets()) ); … … 2250 2450 2251 2451 void BaseGui::createFilePropertiesDialog() { 2452 qDebug("BaseGui::createFilePropertiesDialog"); 2252 2453 QApplication::setOverrideCursor(Qt::WaitCursor); 2253 2454 file_dialog = new FilePropertiesDialog(this); … … 2275 2476 2276 2477 recentfiles_menu = new QMenu(this); 2478 /* 2277 2479 recentfiles_menu->addAction( clearRecentsAct ); 2278 2480 recentfiles_menu->addSeparator(); 2481 */ 2279 2482 2280 2483 openMenu->addMenu( recentfiles_menu ); … … 2311 2514 playMenu->addAction(stopAct); 2312 2515 playMenu->addAction(frameStepAct); 2516 playMenu->addAction(frameBackStepAct); 2313 2517 playMenu->addSeparator(); 2314 2518 playMenu->addAction(rewind1Act); … … 2455 2659 videoMenu->addAction(flipAct); 2456 2660 videoMenu->addAction(mirrorAct); 2661 videoMenu->addAction(stereo3dAct); 2457 2662 videoMenu->addSeparator(); 2458 2663 videoMenu->addAction(videoEqualizerAct); … … 2488 2693 audiofilter_menu->menuAction()->setObjectName("audiofilter_menu"); 2489 2694 audiofilter_menu->addAction(extrastereoAct); 2695 #ifdef MPLAYER_SUPPORT 2490 2696 audiofilter_menu->addAction(karaokeAct); 2697 #endif 2491 2698 audiofilter_menu->addAction(volnormAct); 2492 2699 … … 2521 2728 // SUBTITLES MENU 2522 2729 // Track submenu 2523 subtitlestrack_menu = new QMenu(this); 2524 subtitlestrack_menu->menuAction()->setObjectName("subtitlestrack_menu"); 2525 2526 subtitlesMenu->addMenu(subtitlestrack_menu); 2730 subtitles_track_menu = new QMenu(this); 2731 subtitles_track_menu->menuAction()->setObjectName("subtitlestrack_menu"); 2732 2733 #ifdef MPV_SUPPORT 2734 secondary_subtitles_track_menu = new QMenu(this); 2735 secondary_subtitles_track_menu->menuAction()->setObjectName("secondary_subtitles_track_menu"); 2736 #endif 2737 2738 subtitlesMenu->addMenu(subtitles_track_menu); 2739 #ifdef MPV_SUPPORT 2740 subtitlesMenu->addMenu(secondary_subtitles_track_menu); 2741 #endif 2527 2742 subtitlesMenu->addSeparator(); 2528 2743 … … 2565 2780 subtitlesMenu->addAction(decSubStepAct); 2566 2781 subtitlesMenu->addAction(incSubStepAct); 2782 #ifdef MPV_SUPPORT 2783 subtitlesMenu->addSeparator(); 2784 subtitlesMenu->addAction(seekPrevSubAct); 2785 subtitlesMenu->addAction(seekNextSubAct); 2786 #endif 2567 2787 subtitlesMenu->addSeparator(); 2568 2788 subtitlesMenu->addAction(useForcedSubsOnlyAct); … … 2570 2790 subtitlesMenu->addAction(subVisibilityAct); 2571 2791 subtitlesMenu->addSeparator(); 2572 subtitlesMenu->addAction(use AssAct);2792 subtitlesMenu->addAction(useCustomSubStyleAct); 2573 2793 #ifdef FIND_SUBTITLES 2574 2794 subtitlesMenu->addSeparator(); //turbos … … 2595 2815 2596 2816 browseMenu->addMenu(angles_menu); 2817 2818 #ifdef BOOKMARKS 2819 // Bookmarks submenu 2820 bookmark_menu = new QMenu(this); 2821 bookmark_menu->menuAction()->setObjectName("bookmarks_menu"); 2822 2823 browseMenu->addMenu(bookmark_menu); 2824 #endif 2597 2825 2598 2826 #if DVDNAV_SUPPORT … … 2638 2866 osd_menu->menuAction()->setObjectName("osd_menu"); 2639 2867 osd_menu->addActions(osdGroup->actions()); 2868 osd_menu->addSeparator(); 2869 osd_menu->addAction(decOSDScaleAct); 2870 osd_menu->addAction(incOSDScaleAct); 2871 2640 2872 2641 2873 optionsMenu->addMenu(osd_menu); … … 2680 2912 helpMenu->addSeparator(); 2681 2913 helpMenu->addAction(showCheckUpdatesAct); 2682 #if defined(YOUTUBE_SUPPORT) && defined(YT_USE_ SCRIPT)2914 #if defined(YOUTUBE_SUPPORT) && defined(YT_USE_YTSIG) 2683 2915 helpMenu->addAction(updateYTAct); 2684 2916 #endif … … 2686 2918 helpMenu->addAction(showConfigAct); 2687 2919 helpMenu->addSeparator(); 2688 #ifdef REMINDER_ACTIONS2920 #ifdef SHARE_ACTIONS 2689 2921 helpMenu->addAction(donateAct); 2690 2922 helpMenu->addSeparator(); … … 2807 3039 pl->setSavePlaylistOnExit(playlist->savePlaylistOnExit()); 2808 3040 pl->setPlayFilesFromStart(playlist->playFilesFromStart()); 3041 pl->setIgnorePlayerErrors(playlist->ignorePlayerErrors()); 2809 3042 2810 3043 pref_dialog->show(); … … 2817 3050 bool need_update_language = false; 2818 3051 3052 PlayerID::Player old_player_type = PlayerID::player(pref->mplayer_bin); 3053 2819 3054 pref_dialog->getData(pref); 3055 3056 // Setup proxy 3057 setupNetworkProxy(); 2820 3058 2821 3059 // Change application font … … 2845 3083 need_update_language = true; 2846 3084 // Stylesheet 2847 #if ALLOW_CHANGE_STYLESHEET 2848 changeStyleSheet(pref->iconset); 2849 #endif 2850 } 2851 2852 mplayerwindow->activateMouseDragTracking(pref->move_when_dragging); 3085 #if ALLOW_CHANGE_STYLESHEET 3086 if (!_interface->guiChanged()) applyStyles(); 3087 #endif 3088 } 3089 3090 #ifdef MOUSE_GESTURES 3091 mplayerwindow->activateMouseDragTracking(true); 3092 #else 3093 mplayerwindow->activateMouseDragTracking(pref->drag_function == Preferences::MoveWindow); 3094 #endif 2853 3095 mplayerwindow->delayLeftClick(pref->delay_left_click); 2854 3096 … … 2881 3123 mplayerwindow->setMonitorAspect( pref->monitor_aspect_double() ); 2882 3124 } 3125 #if ALLOW_DEMUXER_CODEC_CHANGE 2883 3126 if (advanced->lavfDemuxerChanged()) { 2884 3127 core->mset.forced_demuxer = pref->use_lavf_demuxer ? "lavf" : ""; 2885 3128 } 3129 #endif 2886 3130 2887 3131 // Update playlist preferences … … 2891 3135 playlist->setSavePlaylistOnExit(pl->savePlaylistOnExit()); 2892 3136 playlist->setPlayFilesFromStart(pl->playFilesFromStart()); 3137 playlist->setIgnorePlayerErrors(pl->ignorePlayerErrors()); 2893 3138 2894 3139 … … 2902 3147 #if STYLE_SWITCHING 2903 3148 if (_interface->styleChanged()) { 2904 qDebug( "selected style: '%s'", pref->style.toUtf8().data() ); 2905 if ( !pref->style.isEmpty()) { 2906 qApp->setStyle( pref->style ); 2907 } else { 2908 qDebug("setting default style: '%s'", default_style.toUtf8().data() ); 2909 qApp->setStyle( default_style ); 2910 } 3149 applyStyles(); 2911 3150 } 2912 3151 #endif … … 2934 3173 #endif 2935 3174 } 3175 3176 if (old_player_type != PlayerID::player(pref->mplayer_bin)) { 3177 qDebug("BaseGui::applyNewPreferences: player changed!"); 3178 // Hack, simulate a change of GUI to restart the interface 3179 // FIXME: try to create a new Core::proc in the future 3180 #ifdef GUI_CHANGE_ON_RUNTIME 3181 core->stop(); 3182 emit guiChanged(pref->gui); 3183 #endif 3184 } 2936 3185 } 2937 3186 … … 2952 3201 2953 3202 void BaseGui::setDataToFileProperties() { 3203 #if ALLOW_DEMUXER_CODEC_CHANGE 3204 InfoReader *i = InfoReader::obj(); 3205 i->getInfo(); 3206 file_dialog->setCodecs( i->vcList(), i->acList(), i->demuxerList() ); 3207 2954 3208 // Save a copy of the original values 2955 3209 if (core->mset.original_demuxer.isEmpty()) … … 2974 3228 file_dialog->setAudioCodec(ac, core->mset.original_audio_codec); 2975 3229 file_dialog->setVideoCodec(vc, core->mset.original_video_codec); 3230 #endif 2976 3231 2977 3232 file_dialog->setMplayerAdditionalArguments( core->mset.mplayer_additional_options ); … … 2986 3241 2987 3242 bool need_restart = false; 2988 bool demuxer_changed = false;2989 3243 2990 3244 #undef TEST_AND_SET 2991 3245 #define TEST_AND_SET( Pref, Dialog ) \ 2992 3246 if ( Pref != Dialog ) { Pref = Dialog; need_restart = true; } 3247 3248 #if ALLOW_DEMUXER_CODEC_CHANGE 3249 bool demuxer_changed = false; 2993 3250 2994 3251 QString prev_demuxer = core->mset.forced_demuxer; … … 3012 3269 if (vc == core->mset.original_video_codec) vc=""; 3013 3270 TEST_AND_SET(core->mset.forced_video_codec, vc); 3271 #endif 3014 3272 3015 3273 TEST_AND_SET(core->mset.mplayer_additional_options, file_dialog->mplayerAdditionalArguments()); … … 3017 3275 TEST_AND_SET(core->mset.mplayer_additional_audio_filters, file_dialog->mplayerAdditionalAudioFilters()); 3018 3276 3277 #if ALLOW_DEMUXER_CODEC_CHANGE 3019 3278 // Restart the video to apply 3020 3279 if (need_restart) { … … 3025 3284 } 3026 3285 } 3286 #endif 3027 3287 } 3028 3288 3029 3289 3030 3290 void BaseGui::updateMediaInfo() { 3031 3291 qDebug("BaseGui::updateMediaInfo"); 3032 3292 3033 3293 if (file_dialog) { … … 3146 3406 3147 3407 void BaseGui::showMplayerLog() { 3148 3408 qDebug("BaseGui::showMplayerLog"); 3149 3409 3150 3410 exitFullscreenIfNeeded(); 3151 3411 3152 3412 mplayer_log_window->setText( mplayer_log ); 3153 3413 mplayer_log_window->show(); 3154 3414 } … … 3193 3453 a->setData(n); 3194 3454 } 3195 subtitlestrack_menu->addActions( subtitleTrackGroup->actions() ); 3455 subtitles_track_menu->addActions( subtitleTrackGroup->actions() ); 3456 3457 #ifdef MPV_SUPPORT 3458 // Secondary Subtitles 3459 secondarySubtitleTrackGroup->clear(true); 3460 QAction * subSecNoneAct = secondarySubtitleTrackGroup->addAction( tr("&None") ); 3461 subSecNoneAct->setData(MediaSettings::SubNone); 3462 subSecNoneAct->setCheckable(true); 3463 for (n=0; n < core->mdat.subs.numItems(); n++) { 3464 QAction *a = new QAction(secondarySubtitleTrackGroup); 3465 a->setCheckable(true); 3466 a->setText(core->mdat.subs.itemAt(n).displayName()); 3467 a->setData(n); 3468 } 3469 secondary_subtitles_track_menu->addActions( secondarySubtitleTrackGroup->actions() ); 3470 #endif 3196 3471 3197 3472 // Audio … … 3267 3542 // Chapters 3268 3543 chapterGroup->clear(true); 3544 //qDebug("BaseGui::initializeMenus: mdat.chapters.numItems: %d", core->mdat.chapters.numItems()); 3269 3545 if (core->mdat.chapters.numItems() > 0) { 3270 3546 for (n=0; n < core->mdat.chapters.numItems(); n++) { 3271 3547 QAction *a = new QAction(chapterGroup); 3272 3548 //a->setCheckable(true); 3549 //qDebug("BaseGui::initializeMenus: chapter %d name: %s", n, core->mdat.chapters.itemAt(n).name().toUtf8().constData()); 3273 3550 a->setText(core->mdat.chapters.itemAt(n).name()); 3274 3551 a->setData(core->mdat.chapters.itemAt(n).ID()); … … 3309 3586 } 3310 3587 angles_menu->addActions( angleGroup->actions() ); 3311 } 3588 3589 #ifdef BOOKMARKS 3590 updateBookmarks(); 3591 #endif 3592 } 3593 3594 #ifdef BOOKMARKS 3595 void BaseGui::updateBookmarks() { 3596 qDebug("BaseGui::updateBookmarks"); 3597 3598 // Bookmarks 3599 bookmarkGroup->clear(true); 3600 int n_bookmarks = core->mset.bookmarks.size(); 3601 if (n_bookmarks > 0) { 3602 QMap<int, QString>::const_iterator i = core->mset.bookmarks.constBegin(); 3603 while (i != core->mset.bookmarks.constEnd()) { 3604 QString name = i.value(); 3605 int time = i.key(); 3606 QAction *a = new QAction(bookmarkGroup); 3607 QString text; 3608 if (name.isEmpty()) { 3609 text = Helper::formatTime(time); 3610 } else { 3611 text = QString("%1 (%2)").arg(name).arg(Helper::formatTime(time)); 3612 } 3613 a->setCheckable(false); 3614 a->setText(text); 3615 a->setData(time); 3616 i++; 3617 } 3618 } 3619 bookmark_menu->clear(); 3620 bookmark_menu->addAction(addBookmarkAct); 3621 bookmark_menu->addAction(editBookmarksAct); 3622 bookmark_menu->addSeparator(); 3623 bookmark_menu->addActions(bookmarkGroup->actions()); 3624 } 3625 #endif 3312 3626 3313 3627 void BaseGui::updateRecents() { 3314 3628 qDebug("BaseGui::updateRecents"); 3315 3629 3316 // Not clear the first 2 items 3317 while (recentfiles_menu->actions().count() > 2) { 3318 QAction * a = recentfiles_menu->actions()[2]; 3319 recentfiles_menu->removeAction( a ); 3320 a->deleteLater(); 3321 } 3630 recentfiles_menu->clear(); 3322 3631 3323 3632 int current_items = 0; … … 3354 3663 3355 3664 recentfiles_menu->menuAction()->setVisible( current_items > 0 ); 3665 if (current_items > 0) { 3666 recentfiles_menu->addSeparator(); 3667 recentfiles_menu->addAction( clearRecentsAct ); 3668 } 3356 3669 } 3357 3670 … … 3373 3686 // Subtitles menu 3374 3687 subtitleTrackGroup->setChecked( core->mset.current_sub_id ); 3688 3689 #ifdef MPV_SUPPORT 3690 // Secondary subtitles menu 3691 secondarySubtitleTrackGroup->setChecked( core->mset.current_secondary_sub_id ); 3692 #endif 3375 3693 3376 3694 // Disable the unload subs action if there's no external subtitles … … 3416 3734 titleGroup->setChecked( core->mset.current_title_id ); 3417 3735 3418 // Chapters3419 chapterGroup->setChecked( core->mset.current_chapter_id );3420 3421 3736 // Angles 3422 3737 angleGroup->setChecked( core->mset.current_angle_id ); … … 3477 3792 muteAct->setChecked( (pref->global_volume ? pref->mute : core->mset.mute) ); 3478 3793 3794 #ifdef MPLAYER_SUPPORT 3479 3795 // Karaoke menu option 3480 3796 karaokeAct->setChecked( core->mset.karaoke_filter ); 3797 #endif 3481 3798 3482 3799 // Extrastereo menu option … … 3526 3843 mirrorAct->setChecked( core->mset.mirror ); 3527 3844 3528 // Use ass lib3529 use AssAct->setChecked( pref->use_ass_subtitles );3845 // Use custom style 3846 useCustomSubStyleAct->setChecked( pref->enable_ass_styles ); 3530 3847 3531 3848 // Forced subs … … 3550 3867 decSubStepAct->setEnabled(e); 3551 3868 incSubStepAct->setEnabled(e); 3869 #ifdef MPV_SUPPORT 3870 seekNextSubAct->setEnabled(e); 3871 seekPrevSubAct->setEnabled(e); 3872 #endif 3552 3873 } 3553 3874 … … 3642 3963 playlist->load_pls(file); 3643 3964 } 3644 else 3965 else 3966 if (extension=="xspf") { 3967 playlist->loadXSPF(file); 3968 } 3969 else 3645 3970 if (QFileInfo(file).isDir()) { 3646 3971 openDirectory(file); … … 3791 4116 } 3792 4117 else 4118 if (extension=="xspf") { 4119 playlist->loadXSPF(file); 4120 } 4121 else 3793 4122 if (extension=="iso") { 3794 4123 if (playlist->maybeSave()) { … … 3860 4189 if (playlist->maybeSave()) { 3861 4190 #if DVDNAV_SUPPORT 3862 core->openDVD( DiscName::joinDVD(pref->use_dvdnav ? 0: 1, pref->dvd_device, pref->use_dvdnav) ); 4191 int first_title = 0; 4192 if (!pref->use_dvdnav) first_title = core->firstDVDTitle(); 4193 core->openDVD( DiscName::joinDVD(first_title, pref->dvd_device, pref->use_dvdnav) ); 3863 4194 #else 3864 core->openDVD( DiscName::joinDVD( 1, pref->dvd_device, false) );4195 core->openDVD( DiscName::joinDVD(core->firstDVDTitle(), pref->dvd_device, false) ); 3865 4196 #endif 3866 4197 } … … 3887 4218 pref->last_dvd_directory = directory; 3888 4219 #if DVDNAV_SUPPORT 3889 core->openDVD( DiscName::joinDVD(pref->use_dvdnav ? 0: 1, directory, pref->use_dvdnav) ); 4220 int first_title = 0; 4221 if (!pref->use_dvdnav) first_title = core->firstDVDTitle(); 4222 core->openDVD( DiscName::joinDVD(first_title, directory, pref->use_dvdnav) ); 3890 4223 #else 3891 core->openDVD( DiscName::joinDVD( 1, directory, false) );4224 core->openDVD( DiscName::joinDVD(core->firstDVDTitle(), directory, false) ); 3892 4225 #endif 3893 4226 } … … 3900 4233 void BaseGui::openBluRayFromFolder(QString directory) { 3901 4234 pref->last_dvd_directory = directory; 3902 core->openBluRay( DiscName::join(DiscName::BLURAY, 1, directory) );4235 core->openBluRay( DiscName::join(DiscName::BLURAY, core->firstBlurayTitle(), directory) ); 3903 4236 } 3904 4237 … … 3915 4248 configureDiscDevices(); 3916 4249 } else { 3917 core->openBluRay( DiscName::join(DiscName::BLURAY, 1, pref->bluray_device) );4250 core->openBluRay( DiscName::join(DiscName::BLURAY, core->firstBlurayTitle(), pref->bluray_device) ); 3918 4251 } 3919 4252 } … … 4000 4333 4001 4334 void BaseGui::helpFirstSteps() { 4002 QDesktopServices::openUrl(QString( "http://smplayer.sourceforge.net/first-steps.php?version=%1").arg(Version::printable()));4335 QDesktopServices::openUrl(QString(URL_FIRST_STEPS "?version=%1").arg(Version::printable())); 4003 4336 } 4004 4337 4005 4338 void BaseGui::helpFAQ() { 4006 QString url = "http://smplayer.sourceforge.net/faq.php";4339 QString url = URL_FAQ; 4007 4340 /* if (!pref->language.isEmpty()) url += QString("?tr_lang=%1").arg(pref->language); */ 4008 4341 QDesktopServices::openUrl( QUrl(url) ); … … 4019 4352 4020 4353 void BaseGui::helpCheckUpdates() { 4021 QString url = "http://smplayer.sourceforge.net/changes.php"; 4022 /* if (!pref->language.isEmpty()) url += QString("?tr_lang=%1").arg(pref->language); */ 4354 #ifdef UPDATE_CHECKER 4355 update_checker->check(); 4356 #else 4357 QString url = QString(URL_CHANGES "?version=%1").arg(Version::with_revision()); 4023 4358 QDesktopServices::openUrl( QUrl(url) ); 4359 #endif 4024 4360 } 4025 4361 … … 4028 4364 } 4029 4365 4030 #ifdef REMINDER_ACTIONS4366 #ifdef SHARE_ACTIONS 4031 4367 void BaseGui::helpDonate() { 4032 4368 ShareDialog d(this); 4033 4369 d.showRemindCheck(false); 4370 4371 #ifdef SHARE_WIDGET 4372 d.setActions(sharewidget->actions()); 4373 #endif 4374 4034 4375 d.exec(); 4035 4376 int action = d.actions(); … … 4037 4378 4038 4379 if (action > 0) { 4380 #ifdef SHARE_WIDGET 4381 sharewidget->setActions(action); 4382 #else 4039 4383 QSettings * set = Global::settings; 4040 4384 set->beginGroup("reminder"); 4041 4385 set->setValue("action", action); 4042 4386 set->endGroup(); 4387 #endif 4043 4388 } 4044 4389 } … … 4053 4398 void BaseGui::shareSMPlayer() { 4054 4399 QString text = QString("SMPlayer - Free Media Player with built-in codecs that can play and download Youtube videos").replace(" ","+"); 4055 QString url = "http://smplayer.sourceforge.net";4400 QString url = URL_HOMEPAGE; 4056 4401 4057 4402 if (sender() == twitterAct) { … … 4074 4419 QDesktopServices::openUrl(QUrl("http://www.facebook.com/sharer.php?u=" + url + "&t=" + text)); 4075 4420 4076 #ifdef REMINDER_ACTIONS4421 #ifdef SHARE_ACTIONS 4077 4422 QSettings * set = Global::settings; 4078 4423 set->beginGroup("reminder"); … … 4127 4472 } 4128 4473 4474 void BaseGui::showStereo3dDialog() { 4475 Stereo3dDialog d(this); 4476 d.setInputFormat(core->mset.stereo3d_in); 4477 d.setOutputFormat(core->mset.stereo3d_out); 4478 4479 if (d.exec() == QDialog::Accepted) { 4480 core->changeStereo3d(d.inputFormat(), d.outputFormat()); 4481 } 4482 } 4483 4484 #ifdef BOOKMARKS 4485 void BaseGui::showAddBookmarkDialog() { 4486 InputBookmark d(this); 4487 d.setTime( (int) core->mset.current_sec); 4488 if (d.exec() == QDialog::Accepted) { 4489 core->mset.bookmarks.insert(d.time(), d.name()); 4490 updateBookmarks(); 4491 } 4492 } 4493 4494 void BaseGui::showBookmarkDialog() { 4495 qDebug("BaseGui::showBookmarkDialog"); 4496 BookmarkDialog d(this); 4497 d.setBookmarks(core->mset.bookmarks); 4498 if (d.exec() == QDialog::Accepted) { 4499 core->mset.bookmarks = d.bookmarks(); 4500 updateBookmarks(); 4501 } 4502 } 4503 #endif 4504 4129 4505 void BaseGui::exitFullscreen() { 4130 4506 if (pref->fullscreen) { … … 4152 4528 // If using mplayer window 4153 4529 if (pref->use_mplayer_window) { 4154 core-> tellmp("vo_fullscreen " + QString::number(b));4530 core->changeFullscreenMode(b); 4155 4531 updateWidgets(); 4156 4532 return; … … 4201 4577 (!core->mset.add_letterbox)) 4202 4578 { 4203 core->restart(); 4579 core->changeLetterboxOnFullscreen(b); 4580 /* core->restart(); */ 4204 4581 } 4205 4582 … … 4209 4586 4210 4587 void BaseGui::aboutToEnterFullscreen() { 4588 if (pref->stay_on_top == Preferences::WhilePlayingOnTop && core->state() == Core::Playing) { 4589 setStayOnTop(false); 4590 } 4591 4211 4592 if (!pref->compact_mode) { 4212 4593 menuBar()->hide(); … … 4219 4600 menuBar()->show(); 4220 4601 statusBar()->show(); 4602 } 4603 4604 if (pref->stay_on_top == Preferences::WhilePlayingOnTop) { 4605 #if QT_VERSION < 0x050000 4606 qApp->processEvents(); 4607 #endif 4608 setStayOnTop(core->state() == Core::Playing); 4221 4609 } 4222 4610 } … … 4404 4792 #endif 4405 4793 4406 #ifdef UPDATE_CHECKER4407 void BaseGui::reportNewVersionAvailable(QString new_version) {4408 QMessageBox::StandardButton button = QMessageBox::information(this, tr("New version available"),4409 tr("A new version of SMPlayer is available.") + "<br><br>" +4410 tr("Installed version: %1").arg(Version::with_revision()) + "<br>" +4411 tr("Available version: %1").arg(new_version) + "<br><br>" +4412 tr("Would you like to know more about this new version?"),4413 QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);4414 4415 if (button == QMessageBox::Yes) {4416 QDesktopServices::openUrl(QUrl("http://smplayer.sourceforge.net/changes.php"));4417 }4418 4419 update_checker->saveVersion(new_version);4420 }4421 #endif4422 4423 4794 #ifdef CHECK_UPGRADED 4424 4795 void BaseGui::checkIfUpgraded() { … … 4435 4806 os = "linux"; 4436 4807 #endif 4437 QDesktopServices::openUrl(QString( "http://smplayer.sourceforge.net/thank-you.php?version=%1&so=%2").arg(Version::printable()).arg(os));4808 QDesktopServices::openUrl(QString(URL_THANK_YOU "?version=%1&so=%2").arg(Version::printable()).arg(os)); 4438 4809 } 4439 4810 pref->smplayer_stable_version = Version::stable(); … … 4441 4812 #endif 4442 4813 4443 #if def REMINDER_ACTIONS4814 #if defined(SHARE_ACTIONS) && !defined(SHARE_WIDGET) 4444 4815 void BaseGui::checkReminder() { 4445 4816 qDebug("BaseGui::checkReminder"); … … 4486 4857 4487 4858 #ifdef YOUTUBE_SUPPORT 4859 void BaseGui::YTNoSslSupport() { 4860 qDebug("BaseGui::YTNoSslSupport"); 4861 QMessageBox::warning(this, tr("Connection failed"), 4862 tr("The video you requested needs to open a HTTPS connection.") +"<br>"+ 4863 tr("Unfortunately the OpenSSL component, required for it, is not available in your system.") +"<br>"+ 4864 tr("Please, visit %1 to know how to fix this problem.") 4865 .arg("<a href=\"" URL_OPENSSL_INFO "\">" + tr("this link") + "</a>") ); 4866 } 4867 4488 4868 void BaseGui::YTNoSignature(const QString & title) { 4489 4869 qDebug("BaseGui::YTNoSignature: %s", title.toUtf8().constData()); … … 4499 4879 } 4500 4880 4501 #ifdef YT_USE_ SCRIPT4881 #ifdef YT_USE_YTSIG 4502 4882 int ret = QMessageBox::question(this, tr("Problems with Youtube"), 4503 4883 info_text + "<br><br>" + … … 4514 4894 } 4515 4895 4516 #ifdef YT_USE_ SCRIPT4896 #ifdef YT_USE_YTSIG 4517 4897 void BaseGui::YTUpdateScript() { 4518 4898 static CodeDownloader * downloader = 0; … … 4520 4900 downloader->saveAs(Paths::configPath() + "/yt.js"); 4521 4901 downloader->show(); 4522 downloader->download(QUrl( "http://updates.smplayer.info/yt.js"));4523 } 4524 #endif // YT_USE_ SCRIPT4902 downloader->download(QUrl(URL_YT_CODE)); 4903 } 4904 #endif // YT_USE_YTSIG 4525 4905 #endif //YOUTUBE_SUPPORT 4526 4906 4527 4907 void BaseGui::gotForbidden() { 4528 4908 qDebug("BaseGui::gotForbidden"); 4909 4910 if (!pref->report_mplayer_crashes) { 4911 qDebug("BaseGui::gotForbidden: not displaying error dialog"); 4912 return; 4913 } 4914 4529 4915 static bool busy = false; 4530 4916 … … 4725 5111 4726 5112 void BaseGui::displayState(Core::State state) { 4727 qDebug("BaseGui::displayState: %s", core->stateToString().toUtf8().data()); 5113 qDebug() << "BaseGui::displayState:" << core->stateToString(); 5114 4728 5115 switch (state) { 4729 case Core::Playing: statusBar()->showMessage( tr("Playing %1").arg(core->mdat.filename), 2000); break; 5116 //case Core::Playing: statusBar()->showMessage( tr("Playing %1").arg(core->mdat.filename), 2000); break; 5117 case Core::Playing: statusBar()->showMessage(""); break; 4730 5118 case Core::Paused: statusBar()->showMessage( tr("Pause") ); break; 4731 5119 case Core::Stopped: statusBar()->showMessage( tr("Stop") , 2000); break; 4732 } 5120 case Core::Buffering: /* statusBar()->showMessage(tr("Buffering...")); */ break; 5121 } 5122 4733 5123 if (state == Core::Stopped) setWindowCaption( "SMPlayer" ); 4734 5124 … … 4835 5225 #endif 4836 5226 5227 qDebug("BaseGui::resizeWindow: new_width: %d new_height: %d", new_width, new_height); 5228 5229 #if 0 5230 QSize desktop_size = DesktopInfo::desktop_size(this); 5231 //desktop_size.setWidth(1000); desktop_size.setHeight(1000); // test 5232 if (new_width > desktop_size.width()) { 5233 double aspect = (double) new_width / new_height; 5234 qDebug("BaseGui::resizeWindow: width (%d) is larger than desktop width (%d)", new_width, desktop_size.width()); 5235 new_width = desktop_size.width(); 5236 /* 5237 new_height = new_width / aspect; 5238 qDebug() << "BaseGui::resizeWindow: aspect:" << aspect; 5239 qDebug("BaseGui::resizeWindow: height: %d", new_height); 5240 */ 5241 } 5242 if (new_height > desktop_size.height()) { 5243 qDebug("BaseGui::resizeWindow: height (%d) is larger than desktop height (%d)", new_height, desktop_size.height()); 5244 new_height = desktop_size.height(); 5245 } 5246 #endif 5247 4837 5248 resize(new_width, new_height); 4838 5249 … … 4842 5253 panel->size().height() ); 4843 5254 qDebug("BaseGui::resizeWindow: done: mplayerwindow->size: %d, %d", 4844 mplayerwindow->size().width(), 5255 mplayerwindow->size().width(), 4845 5256 mplayerwindow->size().height() ); 5257 5258 // Check if a part of the window is outside of the desktop 5259 // and center the window in that case 5260 if ((pref->center_window_if_outside) && (!core->mdat.novideo)) { 5261 QRect screen_rect = QApplication::desktop()->screenGeometry(this); 5262 QPoint right_bottom = QPoint(this->pos().x() + this->width(), this->pos().y() + this->height()); 5263 qDebug("BaseGui::resizeWindow: right bottom point: %d, %d", right_bottom.x(), right_bottom.y());; 5264 if (!screen_rect.contains(right_bottom) || !screen_rect.contains(this->pos())) { 5265 qDebug("BaseGui::resizeWindow: the window is outside of the desktop, it will be moved"); 5266 //move(screen_rect.x(), screen_rect.y()); 5267 int x = screen_rect.x() + ((screen_rect.width() - width()) / 2); 5268 int y = screen_rect.y() + ((screen_rect.height() - height()) / 2); 5269 move(x, y); 5270 } 5271 } 5272 4846 5273 } 4847 5274 … … 4851 5278 if (panel->isVisible()) { 4852 5279 // Exit from fullscreen mode 4853 5280 if (pref->fullscreen) { toggleFullscreen(false); update(); } 4854 5281 4855 5282 // Exit from compact mode first … … 4864 5291 // Disable compact mode 4865 5292 //compactAct->setEnabled(false); 5293 } 5294 } 5295 5296 void BaseGui::centerWindow() { 5297 qDebug("BaseGui::centerWindow"); 5298 if (pref->center_window && !pref->fullscreen && isVisible()) { 5299 QRect r = QApplication::desktop()->screenGeometry(this); 5300 // r.setX(500); r.setY(150); // Test 5301 qDebug() << "BaseGui::centerWindow: desktop rect:" << r; 5302 int x = r.x() + ((r.width() - width()) / 2); 5303 int y = r.y() + ((r.height() - height()) / 2); 5304 move(x, y); 4866 5305 } 4867 5306 } … … 4974 5413 void BaseGui::checkStayOnTop(Core::State state) { 4975 5414 qDebug("BaseGui::checkStayOnTop"); 4976 5415 if ((!pref->fullscreen) && (pref->stay_on_top == Preferences::WhilePlayingOnTop)) { 4977 5416 setStayOnTop((state == Core::Playing)); 4978 5417 } … … 4997 5436 4998 5437 #if ALLOW_CHANGE_STYLESHEET 4999 void BaseGui::loadQss(QString filename) { 5438 QString BaseGui::loadQss(QString filename) { 5439 qDebug("BaseGui::loadQss: %s", filename.toUtf8().constData()); 5440 5000 5441 QFile file( filename ); 5001 5442 file.open(QFile::ReadOnly); 5002 QString style Sheet = QLatin1String(file.readAll());5443 QString stylesheet = QLatin1String(file.readAll()); 5003 5444 5004 5445 #ifdef USE_RESOURCES 5005 5446 Images::setTheme(pref->iconset); 5006 QString path = ":/" + pref->iconset; 5447 QString path; 5448 if (Images::has_rcc) { 5449 path = ":/" + pref->iconset; 5450 } else { 5451 QDir current = QDir::current(); 5452 QString td = Images::themesDirectory(); 5453 path = current.relativeFilePath(td); 5454 } 5007 5455 #else 5008 5456 QDir current = QDir::current(); … … 5010 5458 QString path = current.relativeFilePath(td); 5011 5459 #endif 5012 style Sheet.replace(QRegExp("url\\s*\\(\\s*([^\\);]+)\\s*\\)", Qt::CaseSensitive, QRegExp::RegExp2),5460 stylesheet.replace(QRegExp("url\\s*\\(\\s*([^\\);]+)\\s*\\)", Qt::CaseSensitive, QRegExp::RegExp2), 5013 5461 QString("url(%1\\1)").arg(path + "/")); 5014 //qDebug("BaseGui::loadQss: sty eSheet: %s", styleSheet.toUtf8().constData());5015 qApp->setStyleSheet(styleSheet);5462 //qDebug("BaseGui::loadQss: styleSheet: %s", stylesheet.toUtf8().constData()); 5463 return stylesheet; 5016 5464 } 5017 5465 5018 5466 void BaseGui::changeStyleSheet(QString style) { 5019 if (style.isEmpty()) { 5020 qApp->setStyleSheet(""); 5021 } 5022 else { 5023 QString qss_file = Paths::configPath() + "/themes/" + pref->iconset +"/style.qss"; 5024 //qDebug("BaseGui::changeStyleSheet: '%s'", qss_file.toUtf8().data()); 5467 qDebug("BaseGui::changeStyleSheet: %s", style.toUtf8().constData()); 5468 5469 // Load default stylesheet 5470 QString stylesheet = loadQss(":/default-theme/style.qss"); 5471 5472 if (!style.isEmpty()) { 5473 // Check main.css 5474 QString qss_file = Paths::configPath() + "/themes/" + pref->iconset + "/main.css"; 5025 5475 if (!QFile::exists(qss_file)) { 5026 qss_file = Paths::themesPath() +"/"+ pref->iconset +"/style.qss"; 5027 } 5476 qss_file = Paths::themesPath() +"/"+ pref->iconset + "/main.css"; 5477 } 5478 5479 // Check style.qss 5480 if (!QFile::exists(qss_file)) { 5481 qss_file = Paths::configPath() + "/themes/" + pref->iconset + "/style.qss"; 5482 if (!QFile::exists(qss_file)) { 5483 qss_file = Paths::themesPath() +"/"+ pref->iconset + "/style.qss"; 5484 } 5485 } 5486 5487 // Load style file 5028 5488 if (QFile::exists(qss_file)) { 5029 5489 qDebug("BaseGui::changeStyleSheet: '%s'", qss_file.toUtf8().data()); 5030 loadQss(qss_file); 5031 } else { 5032 qApp->setStyleSheet(""); 5033 } 5034 } 5035 } 5036 #endif 5490 stylesheet += loadQss(qss_file); 5491 } 5492 } 5493 5494 //qDebug("BaseGui::changeStyleSheet: styleSheet: %s", stylesheet.toUtf8().constData()); 5495 qApp->setStyleSheet(stylesheet); 5496 } 5497 #endif 5498 5499 void BaseGui::applyStyles() { 5500 qDebug("BaseGui::applyStyles"); 5501 5502 #if ALLOW_CHANGE_STYLESHEET 5503 qDebug() << "BaseGui::applyStyles: stylesheet:" << pref->iconset; 5504 changeStyleSheet(pref->iconset); 5505 #endif 5506 5507 #if STYLE_SWITCHING 5508 QString style = pref->style; 5509 if (style.isEmpty()) style = default_style; 5510 qDebug() << "BaseGui::applyStyles: style:" << style; 5511 if (!style.isEmpty()) qApp->setStyle(style); 5512 #endif 5513 5514 } 5037 5515 5038 5516 void BaseGui::loadActions() { … … 5058 5536 } 5059 5537 5538 void BaseGui::processMouseMovedDiff(QPoint diff) { 5539 //qDebug() << "BaseGui::processMouseMovedDiff" << diff; 5540 5541 #ifdef MOUSE_GESTURES 5542 #ifdef MG_DELAYED_SEEK 5543 if (delayed_seek_timer == 0) { 5544 delayed_seek_timer = new QTimer(this); 5545 delayed_seek_timer->setSingleShot(true); 5546 delayed_seek_timer->setInterval(250); 5547 connect(delayed_seek_timer, SIGNAL(timeout()), this, SLOT(delayedSeek())); 5548 } 5549 #endif 5550 5551 if (pref->drag_function == Preferences::Gestures) { 5552 if (core->state() == Core::Stopped) return; 5553 5554 int t = 1; 5555 5556 int h_desp = qAbs(diff.x()); 5557 int v_desp = qAbs(diff.y()); 5558 5559 if (h_desp > v_desp) { 5560 // Horizontal 5561 if (diff.x() > t) { 5562 #ifdef MG_DELAYED_SEEK 5563 delayed_seek_value += h_desp; 5564 delayed_seek_timer->start(); 5565 #else 5566 core->sforward(); 5567 #endif 5568 } 5569 else 5570 if (diff.x() < -t) { 5571 #ifdef MG_DELAYED_SEEK 5572 delayed_seek_value -= h_desp; 5573 delayed_seek_timer->start(); 5574 #else 5575 core->srewind(); 5576 #endif 5577 } 5578 #ifdef MG_DELAYED_SEEK 5579 int time = qAbs(delayed_seek_value); 5580 int minutes = time / 60; 5581 int seconds = time - (minutes * 60); 5582 QString s; 5583 if (delayed_seek_value >= 0) s = "+"; else s = "-"; 5584 if (minutes > 0) s += QString("%1").arg(minutes, 2, 10, QChar('0')) + ":"; 5585 s += QString("%1").arg(seconds, 2, 10, QChar('0')); 5586 if (pref->fullscreen) { 5587 core->displayTextOnOSD(s, 1000); 5588 } else { 5589 displayMessage(s, 1000); 5590 } 5591 #endif 5592 } else { 5593 // Vertical 5594 if (diff.y() > t) core->decVolume(1); 5595 else 5596 if (diff.y() < -t) core->incVolume(1); 5597 } 5598 } 5599 #endif 5600 5601 if (pref->drag_function == Preferences::MoveWindow) { 5602 moveWindowDiff(diff); 5603 } 5604 } 5605 5060 5606 void BaseGui::moveWindowDiff(QPoint diff) { 5607 //qDebug() << "BaseGui::moveWindowDiff:" << diff; 5608 5061 5609 if (pref->fullscreen || isMaximized()) { 5062 5610 return; … … 5089 5637 } 5090 5638 5639 #ifdef MG_DELAYED_SEEK 5640 void BaseGui::delayedSeek() { 5641 qDebug() << "BaseGui::delayedSeek:" << delayed_seek_value; 5642 if (delayed_seek_value != 0) { 5643 core->seek(delayed_seek_value); 5644 delayed_seek_value = 0; 5645 } 5646 } 5647 #endif 5648 5649 5650 #if QT_VERSION < 0x050000 5091 5651 void BaseGui::showEvent( QShowEvent * ) { 5092 5652 qDebug("BaseGui::showEvent"); … … 5112 5672 } 5113 5673 } 5674 #else 5675 // Qt 5 doesn't call showEvent / hideEvent when the window is minimized or unminimized 5676 bool BaseGui::event(QEvent * e) { 5677 //qDebug("BaseGui::event: %d", e->type()); 5678 5679 bool result = QWidget::event(e); 5680 if ((ignore_show_hide_events) || (!pref->pause_when_hidden)) return result; 5681 5682 if (e->type() == QEvent::WindowStateChange) { 5683 qDebug("BaseGui::event: WindowStateChange"); 5684 5685 if (isMinimized()) { 5686 was_minimized = true; 5687 if (core->state() == Core::Playing) { 5688 qDebug("BaseGui::event: pausing"); 5689 core->pause(); 5690 } 5691 } 5692 } 5693 5694 if ((e->type() == QEvent::ActivationChange) && (isActiveWindow())) { 5695 qDebug("BaseGui::event: ActivationChange: %d", was_minimized); 5696 5697 if ((!isMinimized()) && (was_minimized)) { 5698 was_minimized = false; 5699 if (core->state() == Core::Paused) { 5700 qDebug("BaseGui::showEvent: unpausing"); 5701 core->pause(); // Unpauses 5702 } 5703 } 5704 } 5705 5706 return result; 5707 } 5708 #endif 5114 5709 5115 5710 void BaseGui::askForMplayerVersion(QString line) { … … 5139 5734 if (exit_code != 255 ) { 5140 5735 ErrorDialog d(this); 5141 d.setText(tr("MPlayer has finished unexpectedly.") + " " + 5736 d.setWindowTitle(tr("%1 Error").arg(PLAYER_NAME)); 5737 d.setText(tr("%1 has finished unexpectedly.").arg(PLAYER_NAME) + " " + 5142 5738 tr("Exit code: %1").arg(exit_code)); 5143 5739 #ifdef LOG_MPLAYER … … 5152 5748 5153 5749 if (!pref->report_mplayer_crashes) { 5154 qDebug(" showErrorFromMplayer: not displaying error dialog");5750 qDebug("BaseGui::showErrorFromMplayer: not displaying error dialog"); 5155 5751 return; 5156 5752 } … … 5158 5754 if ((e == QProcess::FailedToStart) || (e == QProcess::Crashed)) { 5159 5755 ErrorDialog d(this); 5756 d.setWindowTitle(tr("%1 Error").arg(PLAYER_NAME)); 5160 5757 if (e == QProcess::FailedToStart) { 5161 d.setText(tr(" MPlayer failed to start.") + " " +5162 tr("Please check the MPlayer path in preferences."));5758 d.setText(tr("%1 failed to start.").arg(PLAYER_NAME) + " " + 5759 tr("Please check the %1 path in preferences.").arg(PLAYER_NAME)); 5163 5760 } else { 5164 d.setText(tr(" MPlayer has crashed.") + " " +5761 d.setText(tr("%1 has crashed.").arg(PLAYER_NAME) + " " + 5165 5762 tr("See the log for more info.")); 5166 5763 } … … 5236 5833 void BaseGui::showTubeBrowser() { 5237 5834 qDebug("BaseGui::showTubeBrowser"); 5238 QString exec = Paths::appPath() + "/smtube"; 5239 qDebug("BaseGui::showTubeBrowser: '%s'", exec.toUtf8().constData()); 5240 if (!QProcess::startDetached(exec, QStringList())) { 5835 #ifdef Q_OS_WIN 5836 QString exec = Paths::appPath() + "/smtube.exe"; 5837 #else 5838 QString exec = Helper::findExecutable("smtube"); 5839 #endif 5840 5841 if (exec.isEmpty() || !QFile::exists(exec)) { 5241 5842 QMessageBox::warning(this, "SMPlayer", 5242 tr("The YouTube Browser couldn't be launched.") +"<br>"+ 5243 tr("Be sure %1 is installed.").arg("SMTube")); 5843 tr("The YouTube Browser is not installed.") +"<br>"+ 5844 tr("Visit %1 to get it.").arg("<a href=http://www.smtube.org>http://www.smtube.org</a>")); 5845 return; 5846 } 5847 5848 QStringList args; 5849 if (!pref->language.isEmpty()) args << "-lang" << pref->language; 5850 qDebug() << "BaseGui::showTubeBrowser: exec:" << exec << "args:" << args; 5851 5852 if (!QProcess::startDetached(exec, args)) { 5853 QMessageBox::warning(this, "SMPlayer", 5854 tr("The YouTube Browser failed to run.") +"<br>"+ 5855 tr("Be sure it's installed correctly.") +"<br>"+ 5856 tr("Visit %1 to get it.").arg("<a href=http://www.smtube.org>http://www.smtube.org</a>")); 5244 5857 } 5245 5858 }
Note:
See TracChangeset
for help on using the changeset viewer.