Changeset 176 for smplayer/trunk/src/basegui.cpp
- Timestamp:
- May 3, 2016, 5:25:45 PM (10 years ago)
- Location:
- smplayer/trunk
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/basegui.cpp (modified) (128 diffs)
Legend:
- Unmodified
- Added
- Removed
-
smplayer/trunk
- Property svn:mergeinfo changed
/smplayer/vendor/current merged: 175
- Property svn:mergeinfo changed
-
smplayer/trunk/src/basegui.cpp
r170 r176 1 1 /* smplayer, GUI front-end for mplayer. 2 Copyright (C) 2006-201 4Ricardo Villalba <[email protected]>2 Copyright (C) 2006-201 Ricardo Villalba <[email protected]> 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 42 43 43 44 #include <cmath> … … 68 69 #include "errordialog.h" 69 70 #include "timedialog.h" 71 72 73 74 75 76 77 70 78 #include "clhelp.h" 71 79 #include "mplayerversion.h" … … 98 106 99 107 #include "constants.h" 108 109 110 111 112 100 113 101 114 #include "extensions.h" … … 107 120 #endif 108 121 122 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 135 136 137 117 138 #endif 118 139 … … 126 147 BaseGui::BaseGui( QWidget* parent, Qt::WindowFlags flags ) 127 148 : QMainWindow( parent, flags ) 149 150 151 152 153 154 155 156 157 158 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 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 231 261 QTimer::singleShot(1000, this, SLOT(checkReminder())); 262 263 264 265 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 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 252 306 } 253 307 … … 278 332 /* if (core->state() == Core::Stopped) { emit openFileRequested(); } */ 279 333 playlist->addFiles(file_list); 334 335 336 337 338 280 339 } 281 340 else … … 453 512 core, SLOT(frameStep()) ); 454 513 514 515 516 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 631 632 633 634 635 567 636 #ifdef VIDEOPREVIEW 568 637 videoPreviewAct = new MyAction( this, "video_preview" ); … … 581 650 core, SLOT(toggleMirror(bool)) ); 582 651 652 653 654 583 655 584 656 // Submenu filter … … 684 756 core, SLOT(toggleExtrastereo(bool)) ); 685 757 758 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 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_) 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 _ACTIONS 824 908 donateAct = new MyAction( this, "donate" ); 825 909 connect( donateAct, SIGNAL(triggered()), … … 850 934 #endif 851 935 936 937 938 939 940 941 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 1072 986 1073 987 1074 toggleDeinterlaceAct = new MyAction(Qt::Key_D, this, "toggle_deinterlacing"); … … 1152 1239 // Subtitle track 1153 1240 subtitleTrackGroup = new MyActionGroup(this); 1154 connect( subtitleTrackGroup, SIGNAL(activated(int)),1241 connect( subtitleTrackGroup, SIGNAL(activated(int)), 1155 1242 core, SLOT(changeSubtitle(int)) ); 1243 1244 1245 1246 1247 1248 1249 1156 1250 1157 1251 ccGroup = new MyActionGroup(this); … … 1190 1284 core, SLOT(changeChapter(int)) ); 1191 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 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 1229 1343 rewind1Act->setEnabled(b); 1230 1344 rewind2Act->setEnabled(b); … … 1251 1365 screenshotAct->setEnabled(b); 1252 1366 screenshotsAct->setEnabled(b); 1367 1368 1369 1253 1370 flipAct->setEnabled(b); 1254 1371 mirrorAct->setEnabled(b); 1372 1255 1373 postProcessingAct->setEnabled(b); 1256 1374 phaseAct->setEnabled(b); … … 1271 1389 audioDelayAct->setEnabled(b); 1272 1390 extrastereoAct->setEnabled(b); 1391 1273 1392 karaokeAct->setEnabled(b); 1393 1274 1394 volnormAct->setEnabled(b); 1275 1395 loadAudioAct->setEnabled(b); … … 1288 1408 incSubScaleAct->setEnabled(b); 1289 1409 decSubScaleAct->setEnabled(b); 1410 1411 1412 1413 1290 1414 1291 1415 // Actions not in menus … … 1363 1487 screenshotsAct->setEnabled( screenshots_enabled ); 1364 1488 1489 1490 1491 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 1381 1510 karaokeAct->setEnabled(false); 1511 1382 1512 volnormAct->setEnabled(false); 1383 1513 channelsGroup->setActionsEnabled(false); … … 1390 1520 screenshotAct->setEnabled(false); 1391 1521 screenshotsAct->setEnabled(false); 1522 1523 1524 1392 1525 flipAct->setEnabled(false); 1393 1526 mirrorAct->setEnabled(false); 1527 1394 1528 postProcessingAct->setEnabled(false); 1395 1529 phaseAct->setEnabled(false); … … 1436 1570 flipAct->setEnabled(false); 1437 1571 mirrorAct->setEnabled(false); 1572 1438 1573 postProcessingAct->setEnabled(false); 1439 1574 phaseAct->setEnabled(false); … … 1466 1601 } 1467 1602 #endif 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1468 1614 } 1469 1615 … … 1477 1623 stopAct->setEnabled(true); 1478 1624 } 1625 1479 1626 1480 1627 void BaseGui::togglePlayAction(Core::State state) { 1481 1628 qDebug("BaseGui::togglePlayAction"); 1629 1630 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 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 1720 1721 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 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 1616 1766 karaokeAct->change( tr("&Karaoke") ); 1767 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(); 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_) 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 _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 1853 1854 1696 1855 1697 1856 // Playlist … … 1736 1895 1737 1896 showFilenameAct->change( tr("Show filename on OSD") ); 1897 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 2093 2094 2095 2096 1923 2097 #if PROGRAM_SWITCH 1924 2098 programtrack_menu->menuAction()->setText( tr("P&rogram", "program") ); … … 1926 2100 #endif 1927 2101 2102 2103 2104 2105 2106 2107 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(") ); 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 2202 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 2285 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 2302 2303 2304 2305 2306 2307 2308 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 2397 2398 2199 2399 connect( audio_equalizer, SIGNAL(visibilityChanged()), 2200 2400 this, SLOT(updateWidgets()) ); … … 2250 2450 2251 2451 void BaseGui::createFilePropertiesDialog() { 2452 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 2313 2517 playMenu->addSeparator(); 2314 2518 playMenu->addAction(rewind1Act); … … 2455 2659 videoMenu->addAction(flipAct); 2456 2660 videoMenu->addAction(mirrorAct); 2661 2457 2662 videoMenu->addSeparator(); 2458 2663 videoMenu->addAction(videoEqualizerAct); … … 2488 2693 audiofilter_menu->menuAction()->setObjectName("audiofilter_menu"); 2489 2694 audiofilter_menu->addAction(extrastereoAct); 2695 2490 2696 audiofilter_menu->addAction(karaokeAct); 2697 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 2783 2784 2785 2786 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(useAct); 2573 2793 #ifdef FIND_SUBTITLES 2574 2794 subtitlesMenu->addSeparator(); //turbos … … 2595 2815 2596 2816 browseMenu->addMenu(angles_menu); 2817 2818 2819 2820 2821 2822 2823 2824 2597 2825 2598 2826 #if DVDNAV_SUPPORT … … 2638 2866 osd_menu->menuAction()->setObjectName("osd_menu"); 2639 2867 osd_menu->addActions(osdGroup->actions()); 2868 2869 2870 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_) 2683 2915 helpMenu->addAction(updateYTAct); 2684 2916 #endif … … 2686 2918 helpMenu->addAction(showConfigAct); 2687 2919 helpMenu->addSeparator(); 2688 #ifdef REMINDER_ACTIONS2920 #ifdef _ACTIONS 2689 2921 helpMenu->addAction(donateAct); 2690 2922 helpMenu->addSeparator(); … … 2807 3039 pl->setSavePlaylistOnExit(playlist->savePlaylistOnExit()); 2808 3040 pl->setPlayFilesFromStart(playlist->playFilesFromStart()); 3041 2809 3042 2810 3043 pref_dialog->show(); … … 2817 3050 bool need_update_language = false; 2818 3051 3052 3053 2819 3054 pref_dialog->getData(pref); 3055 3056 3057 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 2883 3126 if (advanced->lavfDemuxerChanged()) { 2884 3127 core->mset.forced_demuxer = pref->use_lavf_demuxer ? "lavf" : ""; 2885 3128 } 3129 2886 3130 2887 3131 // Update playlist preferences … … 2891 3135 playlist->setSavePlaylistOnExit(pl->savePlaylistOnExit()); 2892 3136 playlist->setPlayFilesFromStart(pl->playFilesFromStart()); 3137 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 3177 3178 3179 3180 3181 3182 3183 3184 2936 3185 } 2937 3186 … … 2952 3201 2953 3202 void BaseGui::setDataToFileProperties() { 3203 3204 3205 3206 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 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 3249 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 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 3019 3278 // Restart the video to apply 3020 3279 if (need_restart) { … … 3025 3284 } 3026 3285 } 3286 3027 3287 } 3028 3288 3029 3289 3030 3290 void BaseGui::updateMediaInfo() { 3031 qDebug("BaseGui::updateMediaInfo");3291 qDebug("BaseGui::updateMediaInfo"); 3032 3292 3033 3293 if (file_dialog) { … … 3146 3406 3147 3407 void BaseGui::showMplayerLog() { 3148 qDebug("BaseGui::showMplayerLog");3408 qDebug("BaseGui::showMplayerLog"); 3149 3409 3150 3410 exitFullscreenIfNeeded(); 3151 3411 3152 mplayer_log_window->setText( mplayer_log );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 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 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 3666 3667 3668 3356 3669 } 3357 3670 … … 3373 3686 // Subtitles menu 3374 3687 subtitleTrackGroup->setChecked( core->mset.current_sub_id ); 3688 3689 3690 3691 3692 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 3479 3795 // Karaoke menu option 3480 3796 karaokeAct->setChecked( core->mset.karaoke_filter ); 3797 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 3846 useles ); 3530 3847 3531 3848 // Forced subs … … 3550 3867 decSubStepAct->setEnabled(e); 3551 3868 incSubStepAct->setEnabled(e); 3869 3870 3871 3872 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 4119 4120 4121 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(, 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(, 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, , 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, , 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(?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 = ; 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 4024 4360 } 4025 4361 … … 4028 4364 } 4029 4365 4030 #ifdef REMINDER_ACTIONS4366 #ifdef _ACTIONS 4031 4367 void BaseGui::helpDonate() { 4032 4368 ShareDialog d(this); 4033 4369 d.showRemindCheck(false); 4370 4371 4372 4373 4374 4034 4375 d.exec(); 4035 4376 int action = d.actions(); … … 4037 4378 4038 4379 if (action > 0) { 4380 4381 4382 4039 4383 QSettings * set = Global::settings; 4040 4384 set->beginGroup("reminder"); 4041 4385 set->setValue("action", action); 4042 4386 set->endGroup(); 4387 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 = ; 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 _ACTIONS 4077 4422 QSettings * set = Global::settings; 4078 4423 set->beginGroup("reminder"); … … 4127 4472 } 4128 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 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->); 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 4589 4590 4591 4211 4592 if (!pref->compact_mode) { 4212 4593 menuBar()->hide(); … … 4219 4600 menuBar()->show(); 4220 4601 statusBar()->show(); 4602 4603 4604 4605 4606 4607 4608 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(?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 4444 4815 void BaseGui::checkReminder() { 4445 4816 qDebug("BaseGui::checkReminder"); … … 4486 4857 4487 4858 #ifdef YOUTUBE_SUPPORT 4859 4860 4861 4862 4863 4864 4865 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_ 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_ 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()); 4903 } 4904 #endif // YT_USE_ 4525 4905 #endif //YOUTUBE_SUPPORT 4526 4906 4527 4907 void BaseGui::gotForbidden() { 4528 4908 qDebug("BaseGui::gotForbidden"); 4909 4910 4911 4912 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 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 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 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 4846 5273 } 4847 5274 … … 4851 5278 if (panel->isVisible()) { 4852 5279 // Exit from fullscreen mode 4853 if (pref->fullscreen) { toggleFullscreen(false); update(); }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 5297 5298 5299 5300 5301 5302 5303 5304 4866 5305 } 4867 5306 } … … 4974 5413 void BaseGui::checkStayOnTop(Core::State state) { 4975 5414 qDebug("BaseGui::checkStayOnTop"); 4976 if ((!pref->fullscreen) && (pref->stay_on_top == Preferences::WhilePlayingOnTop)) {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 styleheet = 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 styleheet.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: styheet.toUtf8().constData()); 5463 ; 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 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5060 5606 void BaseGui::moveWindowDiff(QPoint diff) { 5607 5608 5061 5609 if (pref->fullscreen || isMaximized()) { 5062 5610 return; … … 5089 5637 } 5090 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5091 5651 void BaseGui::showEvent( QShowEvent * ) { 5092 5652 qDebug("BaseGui::showEvent"); … … 5112 5672 } 5113 5673 } 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 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("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 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(") + " " + 5759 tr("Please check the )); 5163 5760 } else { 5164 d.setText(tr(" MPlayer has crashed.") + " " +5761 d.setText(tr(") + " " + 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.
