Changeset 179 for smplayer/vendor/current/src/basegui.cpp
- Timestamp:
- Aug 31, 2016, 5:19:25 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
smplayer/vendor/current/src/basegui.cpp
r175 r179 56 56 #include "timeslider.h" 57 57 #include "logwindow.h" 58 #include "infowindow.h" 58 59 #include "playlist.h" 59 60 #include "filepropertiesdialog.h" … … 90 91 #include "actionseditor.h" 91 92 93 #ifdef TV_SUPPORT 92 94 #include "tvlist.h" 95 #else 96 #include "favorites.h" 97 #endif 93 98 94 99 #include "preferencesdialog.h" 95 #ifndef NO_USE_INI_FILES96 100 #include "prefgeneral.h" 97 #endif98 101 #include "prefinterface.h" 99 102 #include "prefinput.h" … … 147 150 BaseGui::BaseGui( QWidget* parent, Qt::WindowFlags flags ) 148 151 : QMainWindow( parent, flags ) 149 #if QT_VERSION >= 0x050000152 #ifdef DETECT_MINIMIZE_WORKAROUND 150 153 , was_minimized(false) 154 #endif 155 , popup(0) 156 , clhelp_window(0) 157 , pref_dialog(0) 158 , file_dialog (0) 159 #ifdef FIND_SUBTITLES 160 , find_subs_dialog(0) 161 #endif 162 #ifdef VIDEOPREVIEW 163 , video_preview(0) 151 164 #endif 152 165 #ifdef UPDATE_CHECKER 153 166 , update_checker(0) 154 167 #endif 168 , arg_close_on_finish(-1) 169 , arg_start_in_fullscreen(-1) 155 170 #ifdef MG_DELAYED_SEEK 156 171 , delayed_seek_timer(0) 157 172 , delayed_seek_value(0) 158 173 #endif 174 , was_maximized(false) 175 #ifdef AVOID_SCREENSAVER 176 , just_stopped(false) 177 #endif 178 , ignore_show_hide_events(false) 159 179 { 160 #if defined(Q_OS_WIN) || defined(Q_OS_OS2)161 #ifdef AVOID_SCREENSAVER162 /* Disable screensaver by event */163 just_stopped = false;164 #endif165 #endif166 ignore_show_hide_events = false;167 168 arg_close_on_finish = -1;169 arg_start_in_fullscreen = -1;170 171 180 setWindowTitle( "SMPlayer" ); 172 173 // Not created objects174 popup = 0;175 pref_dialog = 0;176 file_dialog = 0;177 clhelp_window = 0;178 #ifdef FIND_SUBTITLES179 find_subs_dialog = 0;180 #endif181 #ifdef VIDEOPREVIEW182 video_preview = 0;183 #endif184 181 185 182 // Create objects: … … 208 205 qApp->setStyleSheet(""); 209 206 default_style = qApp->style()->objectName(); 207 210 208 #ifdef Q_OS_LINUX 211 209 // Some controls aren't displayed correctly with the adwaita style … … 248 246 249 247 setupNetworkProxy(); 250 initializeGui(); 248 249 /* Initialize GUI */ 250 if (pref->compact_mode) toggleCompactMode(true); 251 changeStayOnTop(pref->stay_on_top); 252 updateRecents(); 253 QTimer::singleShot(20, this, SLOT(loadActions())); 251 254 252 255 #ifdef UPDATE_CHECKER … … 265 268 if (pref->use_mpris2) new Mpris2(this, this); 266 269 #endif 267 }268 269 void BaseGui::initializeGui() {270 if (pref->compact_mode) toggleCompactMode(true);271 changeStayOnTop(pref->stay_on_top);272 273 updateRecents();274 275 // Call loadActions() outside initialization of the class.276 // Otherwise DefaultGui (and other subclasses) doesn't exist, and277 // its actions are not loaded278 QTimer::singleShot(20, this, SLOT(loadActions()));279 280 // Single instance281 /* Deleted */282 270 } 283 271 … … 363 351 364 352 delete favorites; 353 354 #ifdef TV_SUPPORT 365 355 delete tvlist; 366 356 delete radiolist; 357 #endif 367 358 368 359 //#if !DOCK_PLAYLIST … … 385 376 } 386 377 #endif 378 379 if (mplayerwindow) { 380 delete mplayerwindow; 381 } 387 382 } 388 383 … … 450 445 451 446 // TV and Radio 447 #ifdef TV_SUPPORT 452 448 tvlist = new TVList(pref->check_channels_conf_on_startup, 453 449 TVList::TV, Paths::configPath() + "/tv.m3u8", this); … … 483 479 connect(core, SIGNAL(mediaPlaying(const QString &, const QString &)), 484 480 radiolist, SLOT(getCurrentMedia(const QString &, const QString &))); 481 #endif 485 482 486 483 … … 877 874 this, SLOT(showLog()) ); 878 875 #endif 876 877 tabletModeAct = new MyAction(this, "tablet_mode"); 878 tabletModeAct->setCheckable(true); 879 connect(tabletModeAct, SIGNAL(toggled(bool)), this, SLOT(setTabletMode(bool))); 880 879 881 880 882 // Menu Help … … 1604 1606 1605 1607 #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 } 1608 bool bookmarks_enabled = true; 1609 if (!pref->remember_media_settings) bookmarks_enabled = false; 1610 else 1611 if (core->mdat.type == TYPE_STREAM && !pref->remember_stream_settings) bookmarks_enabled = false; 1612 else 1613 if (core->mdat.type != TYPE_FILE && core->mdat.type != TYPE_STREAM) bookmarks_enabled = false; 1614 1615 addBookmarkAct->setEnabled(bookmarks_enabled); 1616 editBookmarksAct->setEnabled(bookmarks_enabled); 1613 1617 #endif 1614 1618 } … … 1812 1816 // Menu Options 1813 1817 showPlaylistAct->change( Images::icon("playlist"), tr("&Playlist") ); 1814 showPropertiesAct->change( Images::icon("info"), tr(" View &infoand properties...") );1818 showPropertiesAct->change( Images::icon("info"), tr("&Information and properties...") ); 1815 1819 showPreferencesAct->change( Images::icon("prefs"), tr("P&references") ); 1816 1820 #ifdef YOUTUBE_SUPPORT … … 1820 1824 // Submenu Logs 1821 1825 #ifdef LOG_MPLAYER 1822 showLogMplayerAct->change( PLAYER_NAME);1826 showLogMplayerAct->change(tr("%1 log").arg(PLAYER_NAME)); 1823 1827 #endif 1824 1828 #ifdef LOG_SMPLAYER 1825 showLogSmplayerAct->change( "SMPlayer" ); 1826 #endif 1829 showLogSmplayerAct->change(tr("SMPlayer log")); 1830 #endif 1831 tabletModeAct->change(Images::icon("tablet_mode"), tr("T&ablet mode")); 1827 1832 1828 1833 // Menu Help … … 1833 1838 1834 1839 #if defined(YOUTUBE_SUPPORT) && defined(YT_USE_YTSIG) 1835 updateYTAct->change( Images::icon("update_youtube"), tr("Update &Youtube code") );1840 updateYTAct->change( Images::icon("update_youtube"), tr("Update the &YouTube code") ); 1836 1841 #endif 1837 1842 … … 1913 1918 subtitlesMenu->menuAction()->setText( tr("&Subtitles") ); 1914 1919 browseMenu->menuAction()->setText( tr("&Browse") ); 1920 viewMenu->menuAction()->setText( tr("Vie&w") ); 1915 1921 optionsMenu->menuAction()->setText( tr("Op&tions") ); 1916 1922 helpMenu->menuAction()->setText( tr("&Help") ); … … 1939 1945 favorites->menuAction()->setIcon( Images::icon("open_favorites") ); 1940 1946 1947 #ifdef TV_SUPPORT 1941 1948 tvlist->menuAction()->setText( tr("&TV") ); 1942 1949 tvlist->menuAction()->setIcon( Images::icon("open_tv") ); … … 1944 1951 radiolist->menuAction()->setText( tr("Radi&o") ); 1945 1952 radiolist->menuAction()->setIcon( Images::icon("open_radio") ); 1953 #endif 1946 1954 1947 1955 // Menu Play … … 2038 2046 audiotrack_menu->menuAction()->setText( tr("&Track", "audio") ); 2039 2047 audiotrack_menu->menuAction()->setIcon( Images::icon("audio_track") ); 2048 audiotrack_menu->menuAction()->setToolTip(tr("Select audio track")); 2040 2049 2041 2050 audiofilter_menu->menuAction()->setText( tr("&Filters") ); … … 2068 2077 #endif 2069 2078 subtitles_track_menu->menuAction()->setIcon( Images::icon("sub") ); 2079 subtitles_track_menu->menuAction()->setToolTip(tr("Select subtitle track")); 2070 2080 2071 2081 #ifdef MPV_SUPPORT 2072 2082 secondary_subtitles_track_menu->menuAction()->setText( tr("Secondary trac&k") ); 2073 2083 secondary_subtitles_track_menu->menuAction()->setIcon( Images::icon("secondary_sub") ); 2084 secondary_subtitles_track_menu->menuAction()->setToolTip(tr("Select secondary subtitle track")); 2074 2085 #endif 2075 2086 … … 2128 2139 2129 2140 #if defined(LOG_MPLAYER) || defined(LOG_SMPLAYER) 2130 logs_menu->menuAction()->setText( tr("&View logs") ); 2131 logs_menu->menuAction()->setIcon( Images::icon("logs") ); 2132 #endif 2141 //logs_menu->menuAction()->setText( tr("&View logs") ); 2142 //logs_menu->menuAction()->setIcon( Images::icon("logs") ); 2143 #endif 2144 2145 // Access menu 2146 access_menu->menuAction()->setText( tr("Quick access menu") ); 2147 access_menu->menuAction()->setIcon( Images::icon("quick_access_menu") ); 2133 2148 2134 2149 // To be sure that the "<empty>" string is translated … … 2289 2304 2290 2305 void BaseGui::createMplayerWindow() { 2291 mplayerwindow = new MplayerWindow( panel ); 2306 mplayerwindow = new MplayerWindow(panel); 2307 mplayerwindow->show(); 2292 2308 mplayerwindow->setObjectName("mplayerwindow"); 2293 2309 #if USE_COLORKEY … … 2403 2419 void BaseGui::createPlaylist() { 2404 2420 #if DOCK_PLAYLIST 2405 playlist = new Playlist( core,this, 0);2421 playlist = new Playlist(this, 0); 2406 2422 #else 2407 //playlist = new Playlist(core, this, "playlist"); 2408 playlist = new Playlist(core, 0); 2409 #endif 2410 2411 /* 2412 connect( playlist, SIGNAL(playlistEnded()), 2413 this, SLOT(exitFullscreenOnStop()) ); 2414 */ 2423 playlist = new Playlist(0); 2424 #endif 2425 playlist->setConfigPath(Paths::configPath()); 2426 2415 2427 connect( playlist, SIGNAL(playlistEnded()), 2416 2428 this, SLOT(playlistHasFinished()) ); … … 2419 2431 mplayerwindow, SLOT(showLogo()) ); 2420 2432 2421 /* 2422 connect( playlist, SIGNAL(visibilityChanged()), 2423 this, SLOT(playlistVisibilityChanged()) ); 2424 */ 2425 2433 connect(playlist, SIGNAL(requestToPlayFile(const QString &, int)), 2434 core, SLOT(open(const QString &, int))); 2435 2436 connect(playlist, SIGNAL(requestToAddCurrentFile()), this, SLOT(addToPlaylistCurrentFile())); 2437 2438 if (playlist->automaticallyPlayNext()) { 2439 connect( core, SIGNAL(mediaFinished()), playlist, SLOT(playNext()), Qt::QueuedConnection ); 2440 } 2441 connect( core, SIGNAL(mplayerFailed(QProcess::ProcessError)), playlist, SLOT(playerFailed(QProcess::ProcessError)) ); 2442 connect( core, SIGNAL(mplayerFinishedWithError(int)), playlist, SLOT(playerFinishedWithError(int)) ); 2443 connect(core, SIGNAL(mediaDataReceived(const MediaData &)), playlist, SLOT(getMediaInfo(const MediaData &))); 2444 2445 #ifdef PLAYLIST_DOWNLOAD 2446 playlist->setMaxItemsUrlHistory( pref->history_urls->maxItems() ); 2447 #endif 2426 2448 } 2427 2449 … … 2431 2453 panel->setMinimumSize( QSize(1,1) ); 2432 2454 panel->setFocusPolicy( Qt::StrongFocus ); 2455 panel->setObjectName("panel"); 2433 2456 2434 2457 // panel … … 2437 2460 ColorUtils::setBackgroundColor( panel, QColor(0,0,0) ); 2438 2461 */ 2462 2463 #ifndef CHANGE_WIDGET_COLOR 2464 panel->setStyleSheet("#panel { background-color: black; }"); 2465 #endif 2439 2466 } 2440 2467 … … 2461 2488 2462 2489 void BaseGui::createMenus() { 2463 // MENUS 2464 openMenu = menuBar()->addMenu("Open"); 2465 playMenu = menuBar()->addMenu("Play"); 2466 videoMenu = menuBar()->addMenu("Video"); 2467 audioMenu = menuBar()->addMenu("Audio"); 2468 subtitlesMenu = menuBar()->addMenu("Subtitles"); 2469 /* menuBar()->addMenu(favorites); */ 2470 browseMenu = menuBar()->addMenu("Browse"); 2471 optionsMenu = menuBar()->addMenu("Options"); 2472 helpMenu = menuBar()->addMenu("Help"); 2473 2474 // OPEN MENU 2475 openMenu->addAction(openFileAct); 2476 2490 // Submenus 2491 2492 // Recents submenu 2477 2493 recentfiles_menu = new QMenu(this); 2478 /* 2479 recentfiles_menu->addAction( clearRecentsAct ); 2480 recentfiles_menu->addSeparator(); 2481 */ 2482 2483 openMenu->addMenu( recentfiles_menu ); 2484 openMenu->addMenu(favorites); 2485 openMenu->addAction(openDirectoryAct); 2486 openMenu->addAction(openPlaylistAct); 2494 recentfiles_menu->menuAction()->setObjectName("recents_menu"); 2487 2495 2488 2496 // Disc submenu … … 2491 2499 disc_menu->addAction(openDVDAct); 2492 2500 disc_menu->addAction(openDVDFolderAct); 2493 #ifdef BLURAY_SUPPORT2501 #ifdef BLURAY_SUPPORT 2494 2502 disc_menu->addAction(openBluRayAct); 2495 2503 disc_menu->addAction(openBluRayFolderAct); 2496 #endif2504 #endif 2497 2505 disc_menu->addAction(openVCDAct); 2498 2506 disc_menu->addAction(openAudioCDAct); 2499 2500 openMenu->addMenu(disc_menu);2501 2502 openMenu->addAction(openURLAct);2503 /* #ifndef Q_OS_WIN */2504 openMenu->addMenu(tvlist);2505 openMenu->addMenu(radiolist);2506 /* #endif */2507 openMenu->addSeparator();2508 openMenu->addAction(exitAct);2509 2510 // PLAY MENU2511 playMenu->addAction(playAct);2512 playMenu->addAction(pauseAct);2513 /* playMenu->addAction(playOrPauseAct); */2514 playMenu->addAction(stopAct);2515 playMenu->addAction(frameStepAct);2516 playMenu->addAction(frameBackStepAct);2517 playMenu->addSeparator();2518 playMenu->addAction(rewind1Act);2519 playMenu->addAction(forward1Act);2520 playMenu->addAction(rewind2Act);2521 playMenu->addAction(forward2Act);2522 playMenu->addAction(rewind3Act);2523 playMenu->addAction(forward3Act);2524 playMenu->addSeparator();2525 2507 2526 2508 // Speed submenu … … 2541 2523 speed_menu->addAction(incSpeed1Act); 2542 2524 2543 playMenu->addMenu(speed_menu);2544 2545 2525 // A-B submenu 2546 2526 ab_menu = new QMenu(this); … … 2552 2532 ab_menu->addAction(repeatAct); 2553 2533 2554 playMenu->addSeparator(); 2555 playMenu->addMenu(ab_menu); 2556 2557 playMenu->addSeparator(); 2558 playMenu->addAction(gotoAct); 2559 playMenu->addSeparator(); 2560 playMenu->addAction(playPrevAct); 2561 playMenu->addAction(playNextAct); 2562 2563 // VIDEO MENU 2534 // Video track submenu 2564 2535 videotrack_menu = new QMenu(this); 2565 2536 videotrack_menu->menuAction()->setObjectName("videotrack_menu"); 2566 2567 videoMenu->addMenu(videotrack_menu);2568 2569 videoMenu->addAction(fullscreenAct);2570 videoMenu->addAction(compactAct);2571 2537 2572 2538 #if USE_ADAPTER … … 2574 2540 screen_menu = new QMenu(this); 2575 2541 screen_menu->menuAction()->setObjectName("screen_menu"); 2576 screen_menu->addActions( screenGroup->actions() ); 2577 videoMenu->addMenu(screen_menu); 2578 #endif 2579 2580 // Size submenu 2542 screen_menu->addActions(screenGroup->actions()); 2543 #endif 2544 2545 // Video size submenu 2581 2546 videosize_menu = new QMenu(this); 2582 2547 videosize_menu->menuAction()->setObjectName("videosize_menu"); 2583 videosize_menu->addActions( sizeGroup->actions());2548 videosize_menu->addActions(sizeGroup->actions()); 2584 2549 videosize_menu->addSeparator(); 2585 2550 videosize_menu->addAction(doubleSizeAct); 2586 videoMenu->addMenu(videosize_menu);2587 2551 2588 2552 // Zoom submenu … … 2603 2567 zoom_menu->addAction(moveDownAct); 2604 2568 2605 videoMenu->addMenu(zoom_menu);2606 2607 2569 // Aspect submenu 2608 2570 aspect_menu = new QMenu(this); 2609 2571 aspect_menu->menuAction()->setObjectName("aspect_menu"); 2610 aspect_menu->addActions( aspectGroup->actions() ); 2611 2612 videoMenu->addMenu(aspect_menu); 2572 aspect_menu->addActions(aspectGroup->actions()); 2613 2573 2614 2574 // Deinterlace submenu 2615 2575 deinterlace_menu = new QMenu(this); 2616 2576 deinterlace_menu->menuAction()->setObjectName("deinterlace_menu"); 2617 deinterlace_menu->addActions( deinterlaceGroup->actions() ); 2618 2619 videoMenu->addMenu(deinterlace_menu); 2577 deinterlace_menu->addActions(deinterlaceGroup->actions()); 2620 2578 2621 2579 // Video filter submenu … … 2642 2600 unsharp_menu->addActions(unsharpGroup->actions()); 2643 2601 videofilter_menu->addMenu(unsharp_menu); 2644 /*2645 videofilter_menu->addSeparator();2646 videofilter_menu->addActions(denoiseGroup->actions());2647 videofilter_menu->addSeparator();2648 videofilter_menu->addActions(unsharpGroup->actions());2649 */2650 videoMenu->addMenu(videofilter_menu);2651 2602 2652 2603 // Rotate submenu … … 2655 2606 rotate_menu->addActions(rotateGroup->actions()); 2656 2607 2657 videoMenu->addMenu(rotate_menu);2658 2659 videoMenu->addAction(flipAct);2660 videoMenu->addAction(mirrorAct);2661 videoMenu->addAction(stereo3dAct);2662 videoMenu->addSeparator();2663 videoMenu->addAction(videoEqualizerAct);2664 videoMenu->addAction(screenshotAct);2665 videoMenu->addAction(screenshotsAct);2666 2667 2608 // Ontop submenu 2668 2609 ontop_menu = new QMenu(this); … … 2670 2611 ontop_menu->addActions(onTopActionGroup->actions()); 2671 2612 2672 videoMenu->addMenu(ontop_menu);2673 2674 #ifdef VIDEOPREVIEW2675 videoMenu->addSeparator();2676 videoMenu->addAction(videoPreviewAct);2677 #endif2678 2679 2680 // AUDIO MENU2681 2613 2682 2614 // Audio track submenu … … 2684 2616 audiotrack_menu->menuAction()->setObjectName("audiotrack_menu"); 2685 2617 2686 audioMenu->addMenu(audiotrack_menu); 2687 2688 audioMenu->addAction(loadAudioAct); 2689 audioMenu->addAction(unloadAudioAct); 2690 2691 // Filter submenu 2618 // Audio filter submenu 2692 2619 audiofilter_menu = new QMenu(this); 2693 2620 audiofilter_menu->menuAction()->setObjectName("audiofilter_menu"); 2694 2621 audiofilter_menu->addAction(extrastereoAct); 2695 #ifdef MPLAYER_SUPPORT2622 #ifdef MPLAYER_SUPPORT 2696 2623 audiofilter_menu->addAction(karaokeAct); 2697 #endif2624 #endif 2698 2625 audiofilter_menu->addAction(volnormAct); 2699 2700 audioMenu->addMenu(audiofilter_menu);2701 2626 2702 2627 // Audio channels submenu 2703 2628 audiochannels_menu = new QMenu(this); 2704 2629 audiochannels_menu->menuAction()->setObjectName("audiochannels_menu"); 2705 audiochannels_menu->addActions( channelsGroup->actions() ); 2706 2707 audioMenu->addMenu(audiochannels_menu); 2630 audiochannels_menu->addActions(channelsGroup->actions()); 2708 2631 2709 2632 // Stereo mode submenu 2710 2633 stereomode_menu = new QMenu(this); 2711 2634 stereomode_menu->menuAction()->setObjectName("stereomode_menu"); 2712 stereomode_menu->addActions( stereoGroup->actions() ); 2713 2714 audioMenu->addMenu(stereomode_menu); 2715 audioMenu->addAction(audioEqualizerAct); 2716 audioMenu->addSeparator(); 2717 audioMenu->addAction(muteAct); 2718 audioMenu->addSeparator(); 2719 audioMenu->addAction(decVolumeAct); 2720 audioMenu->addAction(incVolumeAct); 2721 audioMenu->addSeparator(); 2722 audioMenu->addAction(decAudioDelayAct); 2723 audioMenu->addAction(incAudioDelayAct); 2724 audioMenu->addSeparator(); 2725 audioMenu->addAction(audioDelayAct); 2726 2727 2728 // SUBTITLES MENU 2729 // Track submenu 2635 stereomode_menu->addActions(stereoGroup->actions()); 2636 2637 2638 // Subtitles track submenu 2730 2639 subtitles_track_menu = new QMenu(this); 2731 2640 subtitles_track_menu->menuAction()->setObjectName("subtitlestrack_menu"); 2732 2641 2733 #ifdef MPV_SUPPORT 2642 // Subtitles secondary track submenu 2643 #ifdef MPV_SUPPORT 2734 2644 secondary_subtitles_track_menu = new QMenu(this); 2735 2645 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 2742 subtitlesMenu->addSeparator(); 2743 2744 subtitlesMenu->addAction(loadSubsAct); 2745 subtitlesMenu->addAction(unloadSubsAct); 2746 2646 #endif 2647 2648 // Subtitles fps submenu 2747 2649 subfps_menu = new QMenu(this); 2748 2650 subfps_menu->menuAction()->setObjectName("subfps_menu"); … … 2754 2656 subfps_menu->addAction( subFPS29970Act ); 2755 2657 subfps_menu->addAction( subFPS30Act ); 2756 subtitlesMenu->addMenu(subfps_menu); 2757 subtitlesMenu->addSeparator(); 2758 2658 2659 // Closed captions submenu 2759 2660 closed_captions_menu = new QMenu(this); 2760 2661 closed_captions_menu->menuAction()->setObjectName("closed_captions_menu"); … … 2764 2665 closed_captions_menu->addAction( ccChannel3Act); 2765 2666 closed_captions_menu->addAction( ccChannel4Act); 2766 subtitlesMenu->addMenu(closed_captions_menu); 2767 subtitlesMenu->addSeparator(); 2768 2769 subtitlesMenu->addAction(decSubDelayAct); 2770 subtitlesMenu->addAction(incSubDelayAct); 2771 subtitlesMenu->addSeparator(); 2772 subtitlesMenu->addAction(subDelayAct); 2773 subtitlesMenu->addSeparator(); 2774 subtitlesMenu->addAction(decSubPosAct); 2775 subtitlesMenu->addAction(incSubPosAct); 2776 subtitlesMenu->addSeparator(); 2777 subtitlesMenu->addAction(decSubScaleAct); 2778 subtitlesMenu->addAction(incSubScaleAct); 2779 subtitlesMenu->addSeparator(); 2780 subtitlesMenu->addAction(decSubStepAct); 2781 subtitlesMenu->addAction(incSubStepAct); 2782 #ifdef MPV_SUPPORT 2783 subtitlesMenu->addSeparator(); 2784 subtitlesMenu->addAction(seekPrevSubAct); 2785 subtitlesMenu->addAction(seekNextSubAct); 2786 #endif 2787 subtitlesMenu->addSeparator(); 2788 subtitlesMenu->addAction(useForcedSubsOnlyAct); 2789 subtitlesMenu->addSeparator(); 2790 subtitlesMenu->addAction(subVisibilityAct); 2791 subtitlesMenu->addSeparator(); 2792 subtitlesMenu->addAction(useCustomSubStyleAct); 2793 #ifdef FIND_SUBTITLES 2794 subtitlesMenu->addSeparator(); //turbos 2795 subtitlesMenu->addAction(showFindSubtitlesDialogAct); 2796 subtitlesMenu->addAction(openUploadSubtitlesPageAct); //turbos 2797 #endif 2798 2799 // BROWSE MENU 2667 2668 2800 2669 // Titles submenu 2801 2670 titles_menu = new QMenu(this); 2802 2671 titles_menu->menuAction()->setObjectName("titles_menu"); 2803 2672 2804 browseMenu->addMenu(titles_menu);2805 2806 2673 // Chapters submenu 2807 2674 chapters_menu = new QMenu(this); 2808 2675 chapters_menu->menuAction()->setObjectName("chapters_menu"); 2809 2676 2810 browseMenu->addMenu(chapters_menu);2811 2812 2677 // Angles submenu 2813 2678 angles_menu = new QMenu(this); 2814 2679 angles_menu->menuAction()->setObjectName("angles_menu"); 2815 2680 2816 browseMenu->addMenu(angles_menu);2817 2818 #ifdef BOOKMARKS2819 2681 // Bookmarks submenu 2682 #ifdef BOOKMARKS 2820 2683 bookmark_menu = new QMenu(this); 2821 2684 bookmark_menu->menuAction()->setObjectName("bookmarks_menu"); 2822 2823 browseMenu->addMenu(bookmark_menu); 2824 #endif 2825 2826 #if DVDNAV_SUPPORT 2827 browseMenu->addSeparator(); 2828 browseMenu->addAction(dvdnavMenuAct); 2829 browseMenu->addAction(dvdnavPrevAct); 2830 #endif 2831 2832 #if PROGRAM_SWITCH 2685 #endif 2686 2687 // Program submenu 2688 #if PROGRAM_SWITCH 2833 2689 programtrack_menu = new QMenu(this); 2834 2690 programtrack_menu->menuAction()->setObjectName("programtrack_menu"); 2835 2836 browseMenu->addSeparator();2837 browseMenu->addMenu(programtrack_menu);2838 #endif2839 2840 2841 // OPTIONS MENU2842 optionsMenu->addAction(showPropertiesAct);2843 optionsMenu->addAction(showPlaylistAct);2844 #ifdef YOUTUBE_SUPPORT2845 #if 02846 // Check if the smplayer youtube browser is installed2847 {2848 QString tube_exec = Paths::appPath() + "/smtube";2849 #if defined(Q_OS_WIN) || defined(Q_OS_OS2)2850 tube_exec += ".exe";2851 #endif2852 if (QFile::exists(tube_exec)) {2853 optionsMenu->addAction(showTubeBrowserAct);2854 qDebug("BaseGui::createMenus: %s does exist", tube_exec.toUtf8().constData());2855 } else {2856 qDebug("BaseGui::createMenus: %s does not exist", tube_exec.toUtf8().constData());2857 }2858 }2859 #else2860 optionsMenu->addAction(showTubeBrowserAct);2861 2691 #endif 2862 #endif 2692 2863 2693 2864 2694 // OSD submenu … … 2871 2701 2872 2702 2873 optionsMenu->addMenu(osd_menu);2874 2875 // Logs submenu2876 #if defined(LOG_MPLAYER) || defined(LOG_SMPLAYER)2877 logs_menu = new QMenu(this);2878 #ifdef LOG_MPLAYER2879 logs_menu->addAction(showLogMplayerAct);2880 #endif2881 #ifdef LOG_SMPLAYER2882 logs_menu->addAction(showLogSmplayerAct);2883 #endif2884 optionsMenu->addMenu(logs_menu);2885 #endif2886 2887 optionsMenu->addAction(showPreferencesAct);2888 2889 /*2890 Favorites * fav = new Favorites(Paths::configPath() + "/test.fav", this);2891 connect(fav, SIGNAL(activated(QString)), this, SLOT(open(QString)));2892 optionsMenu->addMenu( fav->menu() )->setText("Favorites");2893 */2894 2895 // HELP MENU2896 2703 // Share submenu 2897 #ifdef SHARE_MENU2704 #ifdef SHARE_MENU 2898 2705 share_menu = new QMenu(this); 2899 2706 share_menu->addAction(facebookAct); … … 2902 2709 share_menu->addAction(hotmailAct); 2903 2710 share_menu->addAction(yahooAct); 2904 2905 helpMenu->addMenu(share_menu); 2906 helpMenu->addSeparator(); 2907 #endif 2908 2909 helpMenu->addAction(showFirstStepsAct); 2910 helpMenu->addAction(showFAQAct); 2911 helpMenu->addAction(showCLOptionsAct); 2912 helpMenu->addSeparator(); 2913 helpMenu->addAction(showCheckUpdatesAct); 2914 #if defined(YOUTUBE_SUPPORT) && defined(YT_USE_YTSIG) 2915 helpMenu->addAction(updateYTAct); 2916 #endif 2917 helpMenu->addSeparator(); 2918 helpMenu->addAction(showConfigAct); 2919 helpMenu->addSeparator(); 2920 #ifdef SHARE_ACTIONS 2921 helpMenu->addAction(donateAct); 2922 helpMenu->addSeparator(); 2923 #endif 2924 helpMenu->addAction(aboutThisAct); 2711 #endif 2712 2713 // MENUS 2714 openMenu = menuBar()->addMenu("Open"); 2715 playMenu = menuBar()->addMenu("Play"); 2716 videoMenu = menuBar()->addMenu("Video"); 2717 audioMenu = menuBar()->addMenu("Audio"); 2718 subtitlesMenu = menuBar()->addMenu("Subtitles"); 2719 /* menuBar()->addMenu(favorites); */ 2720 browseMenu = menuBar()->addMenu("Browse"); 2721 viewMenu = menuBar()->addMenu("View"); 2722 optionsMenu = menuBar()->addMenu("Options"); 2723 helpMenu = menuBar()->addMenu("Help"); 2925 2724 2926 2725 // POPUP MENU … … 2937 2736 popup->addMenu( favorites ); 2938 2737 popup->addMenu( browseMenu ); 2738 popup->addMenu( viewMenu ); 2939 2739 popup->addMenu( optionsMenu ); 2740 2741 // Access menu 2742 access_menu = new QMenu(this); 2743 access_menu->menuAction()->setObjectName("quick_access_menu"); 2744 2745 //populateMainMenu(); 2940 2746 2941 2747 // let's show something, even a <empty> entry 2942 2748 initializeMenus(); 2749 } 2750 2751 void BaseGui::populateMainMenu() { 2752 qDebug("BaseGui::populateMainMenu"); 2753 2754 openMenu->clear(); 2755 playMenu->clear(); 2756 videoMenu->clear(); 2757 audioMenu->clear(); 2758 subtitlesMenu->clear(); 2759 browseMenu->clear(); 2760 viewMenu->clear(); 2761 optionsMenu->clear(); 2762 helpMenu->clear(); 2763 2764 // OPEN MENU 2765 openMenu->addAction(openFileAct); 2766 openMenu->addMenu(recentfiles_menu); 2767 openMenu->addMenu(favorites); 2768 openMenu->addAction(openDirectoryAct); 2769 openMenu->addAction(openPlaylistAct); 2770 if (!pref->tablet_mode) { 2771 openMenu->addMenu(disc_menu); 2772 } 2773 openMenu->addAction(openURLAct); 2774 #ifdef TV_SUPPORT 2775 if (!pref->tablet_mode) { 2776 openMenu->addMenu(tvlist); 2777 openMenu->addMenu(radiolist); 2778 } 2779 #endif 2780 openMenu->addSeparator(); 2781 openMenu->addAction(exitAct); 2782 2783 // PLAY MENU 2784 if (!pref->tablet_mode) { 2785 playMenu->addAction(playAct); 2786 playMenu->addAction(pauseAct); 2787 /* playMenu->addAction(playOrPauseAct); */ 2788 playMenu->addAction(stopAct); 2789 } 2790 playMenu->addAction(frameStepAct); 2791 playMenu->addAction(frameBackStepAct); 2792 playMenu->addSeparator(); 2793 if (!pref->tablet_mode) { 2794 playMenu->addAction(rewind1Act); 2795 playMenu->addAction(forward1Act); 2796 } 2797 playMenu->addAction(rewind2Act); 2798 playMenu->addAction(forward2Act); 2799 playMenu->addAction(rewind3Act); 2800 playMenu->addAction(forward3Act); 2801 playMenu->addSeparator(); 2802 playMenu->addMenu(speed_menu); 2803 playMenu->addSeparator(); 2804 if (!pref->tablet_mode) { 2805 playMenu->addMenu(ab_menu); 2806 playMenu->addSeparator(); 2807 playMenu->addAction(gotoAct); 2808 playMenu->addSeparator(); 2809 } 2810 playMenu->addAction(playPrevAct); 2811 playMenu->addAction(playNextAct); 2812 2813 // VIDEO MENU 2814 videoMenu->addMenu(videotrack_menu); 2815 videoMenu->addAction(fullscreenAct); 2816 if (!pref->tablet_mode) { 2817 videoMenu->addAction(compactAct); 2818 #if USE_ADAPTER 2819 videoMenu->addMenu(screen_menu); 2820 #endif 2821 } 2822 videoMenu->addMenu(videosize_menu); 2823 videoMenu->addMenu(zoom_menu); 2824 videoMenu->addMenu(aspect_menu); 2825 videoMenu->addMenu(deinterlace_menu); 2826 videoMenu->addMenu(videofilter_menu); 2827 videoMenu->addMenu(rotate_menu); 2828 videoMenu->addAction(flipAct); 2829 videoMenu->addAction(mirrorAct); 2830 if (!pref->tablet_mode) { 2831 videoMenu->addAction(stereo3dAct); 2832 videoMenu->addSeparator(); 2833 } 2834 videoMenu->addAction(videoEqualizerAct); 2835 videoMenu->addAction(screenshotAct); 2836 if (!pref->tablet_mode) { 2837 videoMenu->addAction(screenshotsAct); 2838 videoMenu->addMenu(ontop_menu); 2839 } 2840 #ifdef VIDEOPREVIEW 2841 videoMenu->addSeparator(); 2842 videoMenu->addAction(videoPreviewAct); 2843 #endif 2844 2845 // AUDIO MENU 2846 audioMenu->addMenu(audiotrack_menu); 2847 audioMenu->addAction(loadAudioAct); 2848 audioMenu->addAction(unloadAudioAct); 2849 audioMenu->addMenu(audiofilter_menu); 2850 if (!pref->tablet_mode) { 2851 audioMenu->addMenu(audiochannels_menu); 2852 audioMenu->addMenu(stereomode_menu); 2853 } 2854 audioMenu->addAction(audioEqualizerAct); 2855 audioMenu->addSeparator(); 2856 if (!pref->tablet_mode) { 2857 audioMenu->addAction(muteAct); 2858 audioMenu->addSeparator(); 2859 audioMenu->addAction(decVolumeAct); 2860 audioMenu->addAction(incVolumeAct); 2861 audioMenu->addSeparator(); 2862 } 2863 audioMenu->addAction(decAudioDelayAct); 2864 audioMenu->addAction(incAudioDelayAct); 2865 audioMenu->addAction(audioDelayAct); 2866 2867 2868 // SUBTITLES MENU 2869 subtitlesMenu->addMenu(subtitles_track_menu); 2870 #ifdef MPV_SUPPORT 2871 subtitlesMenu->addMenu(secondary_subtitles_track_menu); 2872 #endif 2873 subtitlesMenu->addSeparator(); 2874 subtitlesMenu->addAction(loadSubsAct); 2875 subtitlesMenu->addAction(unloadSubsAct); 2876 if (!pref->tablet_mode) { 2877 subtitlesMenu->addMenu(subfps_menu); 2878 subtitlesMenu->addSeparator(); 2879 subtitlesMenu->addMenu(closed_captions_menu); 2880 } 2881 subtitlesMenu->addSeparator(); 2882 subtitlesMenu->addAction(decSubDelayAct); 2883 subtitlesMenu->addAction(incSubDelayAct); 2884 subtitlesMenu->addAction(subDelayAct); 2885 subtitlesMenu->addSeparator(); 2886 if (!pref->tablet_mode) { 2887 subtitlesMenu->addAction(decSubPosAct); 2888 subtitlesMenu->addAction(incSubPosAct); 2889 subtitlesMenu->addSeparator(); 2890 subtitlesMenu->addAction(decSubScaleAct); 2891 subtitlesMenu->addAction(incSubScaleAct); 2892 subtitlesMenu->addSeparator(); 2893 subtitlesMenu->addAction(decSubStepAct); 2894 subtitlesMenu->addAction(incSubStepAct); 2895 #ifdef MPV_SUPPORT 2896 subtitlesMenu->addSeparator(); 2897 subtitlesMenu->addAction(seekPrevSubAct); 2898 subtitlesMenu->addAction(seekNextSubAct); 2899 #endif 2900 subtitlesMenu->addSeparator(); 2901 subtitlesMenu->addAction(useForcedSubsOnlyAct); 2902 subtitlesMenu->addSeparator(); 2903 } 2904 subtitlesMenu->addAction(subVisibilityAct); 2905 subtitlesMenu->addSeparator(); 2906 subtitlesMenu->addAction(useCustomSubStyleAct); 2907 #ifdef FIND_SUBTITLES 2908 subtitlesMenu->addSeparator(); 2909 subtitlesMenu->addAction(showFindSubtitlesDialogAct); 2910 if (!pref->tablet_mode) { 2911 subtitlesMenu->addAction(openUploadSubtitlesPageAct); 2912 } 2913 #endif 2914 2915 // BROWSE MENU 2916 if (!pref->tablet_mode) { 2917 browseMenu->addMenu(titles_menu); 2918 } 2919 browseMenu->addMenu(chapters_menu); 2920 if (!pref->tablet_mode) { 2921 browseMenu->addMenu(angles_menu); 2922 } 2923 #ifdef BOOKMARKS 2924 browseMenu->addMenu(bookmark_menu); 2925 #endif 2926 #if DVDNAV_SUPPORT 2927 if (!pref->tablet_mode) { 2928 browseMenu->addSeparator(); 2929 browseMenu->addAction(dvdnavMenuAct); 2930 browseMenu->addAction(dvdnavPrevAct); 2931 } 2932 #endif 2933 #if PROGRAM_SWITCH 2934 if (!pref->tablet_mode) { 2935 browseMenu->addSeparator(); 2936 browseMenu->addMenu(programtrack_menu); 2937 } 2938 #endif 2939 2940 // VIEW MENU 2941 viewMenu->addAction(showPropertiesAct); 2942 viewMenu->addAction(showPlaylistAct); 2943 #ifdef YOUTUBE_SUPPORT 2944 if (!pref->tablet_mode) { 2945 viewMenu->addAction(showTubeBrowserAct); 2946 } 2947 #endif 2948 viewMenu->addMenu(osd_menu); 2949 #if defined(LOG_MPLAYER) || defined(LOG_SMPLAYER) 2950 if (!pref->tablet_mode) { 2951 viewMenu->addSeparator()->setText(tr("Logs")); 2952 #ifdef LOG_MPLAYER 2953 viewMenu->addAction(showLogMplayerAct); 2954 #endif 2955 #ifdef LOG_SMPLAYER 2956 viewMenu->addAction(showLogSmplayerAct); 2957 #endif 2958 } 2959 #endif 2960 2961 // OPTIONS MENU 2962 optionsMenu->addAction(showPreferencesAct); 2963 optionsMenu->addAction(tabletModeAct); 2964 2965 // HELP MENU 2966 #ifdef SHARE_MENU 2967 if (!pref->tablet_mode) { 2968 helpMenu->addMenu(share_menu); 2969 helpMenu->addSeparator(); 2970 } 2971 #endif 2972 if (!pref->tablet_mode) { 2973 helpMenu->addAction(showFirstStepsAct); 2974 helpMenu->addAction(showFAQAct); 2975 helpMenu->addAction(showCLOptionsAct); 2976 helpMenu->addSeparator(); 2977 } 2978 helpMenu->addAction(showCheckUpdatesAct); 2979 #if defined(YOUTUBE_SUPPORT) && defined(YT_USE_YTSIG) 2980 helpMenu->addAction(updateYTAct); 2981 #endif 2982 helpMenu->addSeparator(); 2983 if (!pref->tablet_mode) { 2984 helpMenu->addAction(showConfigAct); 2985 helpMenu->addSeparator(); 2986 } 2987 #ifdef SHARE_ACTIONS 2988 helpMenu->addAction(donateAct); 2989 helpMenu->addSeparator(); 2990 #endif 2991 helpMenu->addAction(aboutThisAct); 2992 2993 // Access menu 2994 access_menu->clear(); 2995 access_menu->addAction(openFileAct); 2996 access_menu->addAction(openURLAct); 2997 access_menu->addMenu(recentfiles_menu); 2998 access_menu->addMenu(favorites); 2999 access_menu->addSeparator(); 3000 access_menu->addAction(playPrevAct); 3001 access_menu->addAction(playNextAct); 3002 access_menu->addSeparator(); 3003 access_menu->addMenu(audiotrack_menu); 3004 access_menu->addMenu(subtitles_track_menu); 3005 access_menu->addSeparator(); 3006 access_menu->addMenu(aspect_menu); 3007 access_menu->addSeparator(); 3008 access_menu->addAction(showPlaylistAct); 3009 access_menu->addAction(showPreferencesAct); 3010 access_menu->addAction(tabletModeAct); 2943 3011 } 2944 3012 … … 3067 3135 } 3068 3136 3069 #ifndef NO_USE_INI_FILES3070 3137 PrefGeneral *_general = pref_dialog->mod_general(); 3071 3138 if (_general->fileSettingsMethodChanged()) { 3072 3139 core->changeFileSettingsMethod(pref->file_settings_method); 3073 3140 } 3074 #endif3075 3141 3076 3142 PrefInterface *_interface = pref_dialog->mod_interface(); … … 3088 3154 } 3089 3155 3090 #ifdef MOUSE_GESTURES 3091 mplayerwindow->activateMouseDragTracking(true); 3092 #else 3156 #ifndef MOUSE_GESTURES 3093 3157 mplayerwindow->activateMouseDragTracking(pref->drag_function == Preferences::MoveWindow); 3094 3158 #endif … … 3137 3201 playlist->setIgnorePlayerErrors(pl->ignorePlayerErrors()); 3138 3202 3203 #ifdef PLAYLIST_DOWNLOAD 3204 playlist->setMaxItemsUrlHistory( pref->history_urls->maxItems() ); 3205 #endif 3139 3206 3140 3207 if (need_update_language) { … … 3159 3226 saveActions(); 3160 3227 3161 #ifndef NO_USE_INI_FILES3162 3228 pref->save(); 3163 #endif 3164 3229 3230 emit preferencesChanged(); 3165 3231 3166 3232 if (_interface->guiChanged()) { … … 3871 3937 seekPrevSubAct->setEnabled(e); 3872 3938 #endif 3939 3940 tabletModeAct->setChecked(pref->tablet_mode); 3941 3942 #if defined(MPV_SUPPORT) && defined(MPLAYER_SUPPORT) 3943 if (PlayerID::player(pref->mplayer_bin) == PlayerID::MPLAYER) { 3944 secondary_subtitles_track_menu->setEnabled(false); 3945 frameBackStepAct->setEnabled(false); 3946 } else { 3947 karaokeAct->setEnabled(false); 3948 } 3949 #endif 3873 3950 } 3874 3951 … … 4344 4421 void BaseGui::helpCLOptions() { 4345 4422 if (clhelp_window == 0) { 4346 clhelp_window = new LogWindow(this);4423 clhelp_window = new InfoWindow(this); 4347 4424 } 4348 4425 clhelp_window->setWindowTitle( tr("SMPlayer command line options") ); 4426 clhelp_window->setWindowIcon( Images::icon("logo") ); 4349 4427 clhelp_window->setHtml(CLHelp::help(true)); 4350 4428 clhelp_window->show(); … … 4951 5029 for (int n=0; n < l.count(); n++) { 4952 5030 if (l[n].isValid()) { 4953 qDebug( "BaseGui::dropEvent: scheme: '%s'", l[n].scheme().toUtf8().data());5031 qDebug() << "BaseGui::dropEvent: scheme:" << l[n].scheme(); 4954 5032 if (l[n].scheme() == "file") 4955 5033 s = l[n].toLocalFile(); … … 4960 5038 qDebug(" * '%s'", l[n].toLocalFile().toUtf8().data()); 4961 5039 */ 4962 qDebug( "BaseGui::dropEvent: file: '%s'", s.toUtf8().data());5040 qDebug() << "BaseGui::dropEvent: file:" << s; 4963 5041 files.append(s); 4964 5042 } … … 4966 5044 } 4967 5045 4968 4969 qDebug( "BaseGui::dropEvent: count: %d", files.count()); 5046 QStringList file_list; 5047 QStringList dir_list; 5048 QString sub_file; 5049 5050 #ifdef Q_OS_WIN 4970 5051 if (files.count() > 0) { 4971 #ifdef Q_OS_WIN4972 5052 files = Helper::resolveSymlinks(files); // Check for Windows shortcuts 4973 #endif 4974 files.sort(); 4975 4976 if (files.count() == 1) { 4977 QFileInfo fi( files[0] ); 4978 4979 Extensions e; 4980 QRegExp ext_sub(e.subtitles().forRegExp()); 4981 ext_sub.setCaseSensitivity(Qt::CaseInsensitive); 4982 if (ext_sub.indexIn(fi.suffix()) > -1) { 4983 qDebug( "BaseGui::dropEvent: loading sub: '%s'", files[0].toUtf8().data()); 4984 core->loadSub( files[0] ); 4985 } 4986 else 4987 if (fi.isDir()) { 4988 openDirectory( files[0] ); 4989 } else { 4990 //openFile( files[0] ); 4991 if (pref->auto_add_to_playlist) { 4992 if (playlist->maybeSave()) { 4993 playlist->clear(); 4994 playlist->addFile(files[0], Playlist::NoGetInfo); 4995 4996 open( files[0] ); 4997 } 4998 } else { 4999 open( files[0] ); 5000 } 5001 } 5002 } else { 5003 // More than one file 5004 qDebug("BaseGui::dropEvent: adding files to playlist"); 5005 playlist->clear(); 5006 playlist->addFiles(files); 5007 //openFile( files[0] ); 5008 playlist->startPlay(); 5009 } 5053 } 5054 #endif 5055 files.sort(); 5056 5057 Extensions ext; 5058 QRegExp ext_sub(ext.subtitles().forRegExp()); 5059 ext_sub.setCaseSensitivity(Qt::CaseInsensitive); 5060 5061 foreach (QString file, files) { 5062 QFileInfo fi(file); 5063 if (fi.isDir()) { 5064 // Folder 5065 dir_list << file; 5066 } 5067 else 5068 if (ext_sub.indexIn(fi.suffix()) > -1) { 5069 // Subtitle file 5070 if (sub_file.isEmpty()) sub_file = file; 5071 } 5072 else { 5073 // File (or something else) 5074 file_list << file; 5075 } 5076 } 5077 5078 qDebug() << "BaseGui::dropEvent: list of dirs:" << dir_list; 5079 qDebug() << "BaseGui::dropEvent: list of files:" << file_list; 5080 qDebug() << "BaseGui::dropEvent: subtitle file:" << sub_file; 5081 5082 if (!sub_file.isEmpty()) { 5083 core->loadSub(sub_file); 5084 return; 5085 } 5086 5087 if (file_list.isEmpty() && dir_list.isEmpty()) { 5088 return; 5089 } 5090 5091 if (dir_list.count() == 1 && file_list.isEmpty()) { 5092 openDirectory(dir_list[0]); 5093 return; 5094 } 5095 5096 if (pref->auto_add_to_playlist) { 5097 if (!playlist->maybeSave()) return; 5098 playlist->clear(); 5099 5100 if (!dir_list.isEmpty()) { 5101 // Add directories to the playlist 5102 foreach(QString dir, dir_list) playlist->addDirectory(dir); 5103 } 5104 5105 if (!file_list.isEmpty()) { 5106 // Add files to the playlist 5107 playlist->addFiles(file_list, Playlist::NoGetInfo); 5108 } 5109 5110 // All files are in the playlist, let's start to play 5111 playlist->startPlay(); 5112 } else { 5113 // It wasn't possible to add files to the list 5114 // Let's open the first directory or file 5115 if (!dir_list.isEmpty()) openDirectory(dir_list[0]); // Bug? This actually modifies the playlist... 5116 else 5117 if (!file_list.isEmpty()) open(file_list[0]); 5010 5118 } 5011 5119 } … … 5110 5218 } 5111 5219 5220 void BaseGui::addToPlaylistCurrentFile() { 5221 qDebug("BaseGui::addToPlaylistCurrentFile"); 5222 if (!core->mdat.filename.isEmpty()) { 5223 playlist->addItem(core->mdat.filename, "", 0); 5224 playlist->getMediaInfo(core->mdat); 5225 } 5226 } 5227 5112 5228 void BaseGui::displayState(Core::State state) { 5113 5229 qDebug() << "BaseGui::displayState:" << core->stateToString(); … … 5123 5239 if (state == Core::Stopped) setWindowCaption( "SMPlayer" ); 5124 5240 5125 #if defined(Q_OS_WIN) || defined(Q_OS_OS2)5126 5241 #ifdef AVOID_SCREENSAVER 5127 5242 /* Disable screensaver by event */ … … 5134 5249 } 5135 5250 #endif 5136 #endif5137 5251 } 5138 5252 … … 5158 5272 //qDebug( " duration: %f, current_sec: %f", core->mdat.duration, core->mset.current_sec); 5159 5273 5160 emit timeChanged( time ); 5274 emit timeChanged(sec); 5275 emit timeChanged(time); 5161 5276 } 5162 5277 … … 5165 5280 if (pref->fullscreen) return; 5166 5281 5282 if (isMaximized()) showNormal(); 5283 5167 5284 if (!pref->use_mplayer_window) { 5168 5285 pref->size_factor = factor; … … 5178 5295 qDebug("BaseGui::resizeWindow: %d, %d", w, h); 5179 5296 5180 // If fullscreen , don't resize!5181 if (pref->fullscreen ) return;5297 // If fullscreen or maximized, don't resize! 5298 if (pref->fullscreen || isMaximized()) return; 5182 5299 5183 5300 if ( (pref->resize_method==Preferences::Never) && (panel->isVisible()) ) { … … 5227 5344 qDebug("BaseGui::resizeWindow: new_width: %d new_height: %d", new_width, new_height); 5228 5345 5229 #if 0 5230 QSize desktop_size = DesktopInfo::desktop_size(this); 5346 #ifdef Q_OS_WIN 5347 QRect desktop_rect = QApplication::desktop()->availableGeometry(this); 5348 QSize desktop_size = QSize(desktop_rect.width(), desktop_rect.height()); 5231 5349 //desktop_size.setWidth(1000); desktop_size.setHeight(1000); // test 5232 5350 if (new_width > desktop_size.width()) { 5233 double aspect = (double) new_width / new_height;5351 //double aspect = (double) new_width / new_height; 5234 5352 qDebug("BaseGui::resizeWindow: width (%d) is larger than desktop width (%d)", new_width, desktop_size.width()); 5235 5353 new_width = desktop_size.width(); … … 5259 5377 // and center the window in that case 5260 5378 if ((pref->center_window_if_outside) && (!core->mdat.novideo)) { 5261 QRect screen_rect = QApplication::desktop()-> screenGeometry(this);5379 QRect screen_rect = QApplication::desktop()->availableGeometry(this); 5262 5380 QPoint right_bottom = QPoint(this->pos().x() + this->width(), this->pos().y() + this->height()); 5263 5381 qDebug("BaseGui::resizeWindow: right bottom point: %d, %d", right_bottom.x(), right_bottom.y());; … … 5267 5385 int x = screen_rect.x() + ((screen_rect.width() - width()) / 2); 5268 5386 int y = screen_rect.y() + ((screen_rect.height() - height()) / 2); 5387 //qDebug() << "BaseGui::resizeWindow: screen_rect.x:" << screen_rect.x() << "screen_rect.y:" << screen_rect.y(); 5388 //qDebug() << "BaseGui::resizeWindow: width:" << ((screen_rect.width() - width()) / 2); 5389 //qDebug() << "BaseGui::resizeWindow: height:" << ((screen_rect.height() - height()) / 2); 5390 if (x < screen_rect.x()) x = screen_rect.x(); 5391 if (y < screen_rect.y()) y = screen_rect.y(); 5392 //qDebug() << "BaseGui::resizeWindow: x:" << x << "y:" << y; 5269 5393 move(x, y); 5270 5394 } … … 5414 5538 qDebug("BaseGui::checkStayOnTop"); 5415 5539 if ((!pref->fullscreen) && (pref->stay_on_top == Preferences::WhilePlayingOnTop)) { 5416 setStayOnTop((state == Core::Playing)); 5540 if (state != Core::Buffering) { 5541 setStayOnTop((state == Core::Playing)); 5542 } 5417 5543 } 5418 5544 } … … 5465 5591 5466 5592 void BaseGui::changeStyleSheet(QString style) { 5467 qDebug( "BaseGui::changeStyleSheet: %s", style.toUtf8().constData());5593 qDebug() << "BaseGui::changeStyleSheet:" << style; 5468 5594 5469 5595 // Load default stylesheet … … 5487 5613 // Load style file 5488 5614 if (QFile::exists(qss_file)) { 5489 qDebug( "BaseGui::changeStyleSheet: '%s'", qss_file.toUtf8().data());5615 qDebug() << "BaseGui::changeStyleSheet:" << qss_file; 5490 5616 stylesheet += loadQss(qss_file); 5491 5617 } 5492 5618 } 5493 5619 5494 //qDebug("BaseGui::changeStyleSheet: styleSheet: %s", stylesheet.toUtf8().constData()); 5620 if (pref->tablet_mode) { 5621 QString tf = Images::file("tabletmode.css"); 5622 qDebug() << "BaseGui::changeStyleSheet: tablet stylesheet file:" << tf; 5623 5624 QFile file(tf); 5625 if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text)) { 5626 stylesheet += file.readAll(); 5627 } 5628 } 5629 5630 //qDebug() << "BaseGui::changeStyleSheet: styleSheet:" << stylesheet; 5495 5631 qApp->setStyleSheet(stylesheet); 5496 5632 } … … 5509 5645 if (style.isEmpty()) style = default_style; 5510 5646 qDebug() << "BaseGui::applyStyles: style:" << style; 5511 if (!style.isEmpty()) qApp->setStyle(style); 5512 #endif 5513 5514 } 5647 if (!style.isEmpty()) { 5648 qApp->setStyle(style); 5649 #ifdef Q_OS_WIN 5650 qApp->setPalette(qApp->style()->standardPalette()); 5651 #endif 5652 } 5653 #endif 5654 } 5655 5656 void BaseGui::setTabletMode(bool b) { 5657 qDebug() << "BaseGui::setTabletMode:" << b; 5658 pref->tablet_mode = b; 5659 populateMainMenu(); 5660 applyStyles(); 5661 5662 emit tabletModeChanged(b); 5663 } 5664 5515 5665 5516 5666 void BaseGui::loadActions() { … … 5549 5699 #endif 5550 5700 5551 if (pref->drag_function == Preferences::Gestures ) {5701 if (pref->drag_function == Preferences::Gestures || pref->tablet_mode) { 5552 5702 if (core->state() == Core::Stopped) return; 5553 5703 … … 5556 5706 int h_desp = qAbs(diff.x()); 5557 5707 int v_desp = qAbs(diff.y()); 5708 5709 int d = qAbs(h_desp - v_desp); 5710 5711 //qDebug() << "BaseGui::processMouseMovedDiff: h_desp:" << h_desp << "v_desp:" << v_desp << "d:" << d; 5712 if (d < 2) return; 5558 5713 5559 5714 if (h_desp > v_desp) { … … 5577 5732 } 5578 5733 #ifdef MG_DELAYED_SEEK 5734 /* 5579 5735 int time = qAbs(delayed_seek_value); 5580 5736 int minutes = time / 60; … … 5582 5738 QString s; 5583 5739 if (delayed_seek_value >= 0) s = "+"; else s = "-"; 5584 if (minutes > 0)s += QString("%1").arg(minutes, 2, 10, QChar('0')) + ":";5740 s += QString("%1").arg(minutes, 2, 10, QChar('0')) + ":"; 5585 5741 s += QString("%1").arg(seconds, 2, 10, QChar('0')); 5742 */ 5743 int time = core->mset.current_sec + delayed_seek_value; 5744 if (time < 0) time = 0; 5745 QString s; 5746 s = tr("Jump to %1").arg(Helper::formatTime(time)); 5586 5747 if (pref->fullscreen) { 5587 5748 core->displayTextOnOSD(s, 1000); … … 5590 5751 } 5591 5752 #endif 5592 } else { 5753 } 5754 else 5755 if (h_desp < v_desp) { 5593 5756 // Vertical 5594 5757 if (diff.y() > t) core->decVolume(1); … … 5599 5762 #endif 5600 5763 5601 if (pref->drag_function == Preferences::MoveWindow ) {5764 if (pref->drag_function == Preferences::MoveWindow && !pref->tablet_mode) { 5602 5765 moveWindowDiff(diff); 5603 5766 } … … 5606 5769 void BaseGui::moveWindowDiff(QPoint diff) { 5607 5770 //qDebug() << "BaseGui::moveWindowDiff:" << diff; 5771 5772 QWidget * w = this; 5773 if (mplayerwindow->parent() == 0) w = mplayerwindow; 5608 5774 5609 5775 if (pref->fullscreen || isMaximized()) { … … 5623 5789 if (count > 3) { 5624 5790 //qDebug() << "BaseGui::moveWindowDiff:" << d; 5625 QPoint new_pos = pos() + d; 5791 QPoint new_pos = w->pos() + d; 5792 /* 5626 5793 if (new_pos.y() < 0) new_pos.setY(0); 5627 5794 if (new_pos.x() < 0) new_pos.setX(0); 5795 */ 5628 5796 //qDebug() << "BaseGui::moveWindowDiff: new_pos:" << new_pos; 5629 move(new_pos);5797 w->move(new_pos); 5630 5798 count = 0; 5631 5799 d = QPoint(0,0); … … 5633 5801 #else 5634 5802 //qDebug() << "BaseGui::moveWindowDiff:" << diff; 5635 move(pos() + diff);5803 w->move(w->pos() + diff); 5636 5804 #endif 5637 5805 } … … 5648 5816 5649 5817 5650 #if QT_VERSION < 0x0500005818 #ifndef DETECT_MINIMIZE_WORKAROUND 5651 5819 void BaseGui::showEvent( QShowEvent * ) { 5652 5820 qDebug("BaseGui::showEvent"); … … 5677 5845 //qDebug("BaseGui::event: %d", e->type()); 5678 5846 5679 bool result = Q Widget::event(e);5847 bool result = QMainWindow::event(e); 5680 5848 if ((ignore_show_hide_events) || (!pref->pause_when_hidden)) return result; 5681 5849 … … 5735 5903 ErrorDialog d(this); 5736 5904 d.setWindowTitle(tr("%1 Error").arg(PLAYER_NAME)); 5737 d.setText(tr("%1 has finished unexpectedly.").arg(PLAYER_NAME) + " " + 5738 tr("Exit code: %1").arg(exit_code)); 5739 #ifdef LOG_MPLAYER 5905 QString text = tr("%1 has finished unexpectedly.").arg(PLAYER_NAME) + " " + 5906 tr("Exit code: %1").arg(exit_code); 5907 5908 #if defined(Q_OS_WIN) && defined(LOG_MPLAYER) 5909 bool ytdl_fails = false; 5910 5911 QString ytdl_bin = QFileInfo(pref->mplayer_bin).absolutePath() +"/youtube-dl.exe"; 5912 qDebug() << "BaseGui::showExitCodeFromMplayer: youtube-dl path:" << ytdl_bin; 5913 5914 #if 0 5915 // Newer versions of mpv display this message 5916 if (mplayer_log.contains("youtube-dl failed")) { 5917 int code = QProcess::execute(ytdl_bin, QStringList() << "--version"); 5918 qDebug() << "BaseGui::showExitCodeFromMplayer: youtube-dl exit code:" << code; 5919 if (code == -1) ytdl_fails = true; 5920 } 5921 else 5922 #endif 5923 if (mplayer_log.contains("youtube-dl not found, not executable, or broken")) { 5924 bool exists_ytdl = QFile::exists(ytdl_bin); 5925 qDebug() << "BaseGui::showExitCodeFromMplayer: check if" << ytdl_bin << "exists:" << exists_ytdl; 5926 if (exists_ytdl) ytdl_fails = true; 5927 } 5928 5929 if (ytdl_fails) { 5930 text += "<br><br>" + tr("The component youtube-dl failed to run.") +" "+ 5931 tr("Installing the Microsoft Visual C++ 2010 Redistributable Package (x86) may fix the problem.") + 5932 "<br><a href=\"https://www.microsoft.com/en-US/download/details.aspx?id=5555\">" + 5933 tr("Click here to get it") + "</a>."; 5934 } 5935 #endif 5936 5937 d.setText(text); 5938 5939 #ifdef LOG_MPLAYER 5740 5940 d.setLog( mplayer_log ); 5741 #endif5941 #endif 5742 5942 d.exec(); 5743 5943 } … … 5775 5975 5776 5976 if (!find_subs_dialog) { 5777 find_subs_dialog = new FindSubtitlesWindow( this, Qt::Window | Qt::WindowMinMaxButtonsHint);5977 find_subs_dialog = new FindSubtitlesWindow(0); 5778 5978 find_subs_dialog->setSettings(Global::settings); 5779 5979 find_subs_dialog->setWindowIcon(windowIcon()); … … 5868 6068 } 5869 6069 6070 #ifdef NUMPAD_WORKAROUND 6071 // Due to a bug in Qt 5 on linux, accelerators in numeric keypad don't work 6072 // This catches the key presses in the numeric keypad and calls the associated action 6073 void BaseGui::keyPressEvent(QKeyEvent *event) { 6074 if (event->modifiers().testFlag(Qt::KeypadModifier)) { 6075 qDebug() << "BaseGui::keyPressEvent: key:" << event->key() << "modifiers:" << event->modifiers(); 6076 6077 QKeySequence ks(event->key()); 6078 QList<QAction *> actions = this->actions(); 6079 foreach(QAction * action, actions) { 6080 QList<QKeySequence> shortcuts = action->shortcuts(); 6081 foreach(QKeySequence s, shortcuts) { 6082 bool match = (s == ks); 6083 if (match) { 6084 qDebug() << "BaseGui::keyPressEvent: action found:" << action->objectName() << "enabled:" << action->isEnabled(); 6085 } 6086 if (match && action->isEnabled()) { 6087 if (action->isCheckable() && action->objectName() != "play_or_pause") { 6088 action->toggle(); 6089 } else { 6090 action->trigger(); 6091 } 6092 return; 6093 } 6094 } 6095 } 6096 } 6097 6098 QMainWindow::keyPressEvent(event); 6099 } 6100 #endif 6101 5870 6102 #ifdef Q_OS_WIN 6103 6104 #ifndef SM_CONVERTIBLESLATEMODE 6105 #define SM_CONVERTIBLESLATEMODE 0x2003 6106 #endif 6107 6108 #ifndef SM_SYSTEMDOCKED 6109 #define SM_SYSTEMDOCKED 0x2004 6110 #endif 6111 6112 bool BaseGui::winEvent ( MSG * m, long * result ) { 6113 //qDebug() << "BaseGui::winEvent:" << m; 6114 if (m && m->message == WM_SETTINGCHANGE && m->lParam) { 6115 QString text = QString::fromWCharArray((TCHAR*)m->lParam); 6116 qDebug() << "BaseGui::winEvent: WM_SETTINGCHANGE:" << text; 6117 6118 #if ((QT_VERSION >= 0x040807 && QT_VERSION < 0x050000) || (QT_VERSION >= 0x050500)) 6119 if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10) { 6120 // Windows 10 check 6121 if (text == "UserInteractionMode") { 6122 QTimer::singleShot(1000, this, SLOT(checkSystemTabletMode())); 6123 } 6124 } 6125 else 6126 if (QSysInfo::windowsVersion() == QSysInfo::WV_WINDOWS8_1) { 6127 if (text == "ConvertibleSlateMode") checkSystemTabletMode(); 6128 } 6129 #endif 6130 6131 *result = 0; 6132 return true; 6133 } 5871 6134 #ifdef AVOID_SCREENSAVER 5872 /* Disable screensaver by event */ 5873 bool BaseGui::winEvent ( MSG * m, long * result ) { 5874 //qDebug("BaseGui::winEvent"); 6135 else 5875 6136 if (m->message==WM_SYSCOMMAND) { 5876 6137 if ((m->wParam & 0xFFF0)==SC_SCREENSAVE || (m->wParam & 0xFFF0)==SC_MONITORPOWER) { … … 5896 6157 } 5897 6158 } 6159 #endif 5898 6160 return false; 5899 6161 } 5900 #endif 5901 #endif 5902 5903 #if defined(Q_OS_WIN) || defined(Q_OS_OS2) 6162 6163 #if QT_VERSION >= 0x050000 6164 bool BaseGui::nativeEvent(const QByteArray &eventType, void * message, long * result) { 6165 //qDebug() << "BaseGui::nativeEvent:" << eventType; 6166 6167 if (eventType == "windows_generic_MSG") { 6168 MSG * m = static_cast<MSG *>(message); 6169 return winEvent(m, result); 6170 } 6171 6172 return false; 6173 } 6174 #endif 6175 6176 void BaseGui::checkSystemTabletMode() { 6177 #if ((QT_VERSION >= 0x040807 && QT_VERSION < 0x050000) || (QT_VERSION >= 0x050500)) 6178 if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10) { 6179 // Windows 10 code (don't know if this works on Windows 8) 6180 QSettings set("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ImmersiveShell", QSettings::NativeFormat); 6181 QVariant v = set.value("TabletMode"); 6182 if (v.isValid()) { 6183 bool system_tablet_mode = (v.toInt() == 1); 6184 qDebug() << "BaseGui::checkSystemTabletMode: system_tablet_mode:" << system_tablet_mode; 6185 systemTabletModeChanged(system_tablet_mode); 6186 } 6187 } 6188 else 6189 if (QSysInfo::windowsVersion() == QSysInfo::WV_WINDOWS8_1 || 6190 QSysInfo::windowsVersion() == QSysInfo::WV_WINDOWS8) 6191 { 6192 bool slate_mode = (GetSystemMetrics(SM_CONVERTIBLESLATEMODE) == 0); 6193 qDebug() << "BaseGui::checkSystemTabletMode: slate_mode:" << slate_mode; 6194 /* 6195 bool docked = (GetSystemMetrics(SM_SYSTEMDOCKED) != 0); 6196 qDebug() << "BaseGui::checkSystemTabletMode: docked:" << docked; 6197 */ 6198 bool system_tablet_mode = slate_mode; 6199 systemTabletModeChanged(system_tablet_mode); 6200 } 6201 #endif 6202 } 6203 6204 void BaseGui::systemTabletModeChanged(bool system_tablet_mode) { 6205 qDebug() << "BaseGui::systemTabletModeChanged:" << system_tablet_mode; 6206 6207 if (pref->tablet_mode != system_tablet_mode) { 6208 qDebug("BaseGui::systemTabletModeChanged: tablet mode should be changed"); 6209 6210 if (pref->tablet_mode_change_answer == "yes") { 6211 setTabletMode(system_tablet_mode); 6212 } 6213 else 6214 if (pref->tablet_mode_change_answer == "no") { 6215 return; 6216 } 6217 else { 6218 // Ask the user 6219 QString text; 6220 if (system_tablet_mode) 6221 text = tr("The system has switched to tablet mode. Should SMPlayer change to tablet mode as well?"); 6222 else 6223 text = tr("The system has exited tablet mode. Should SMPlayer turn off the tablet mode as well?"); 6224 6225 QMessageBox mb(QMessageBox::Question, "SMPlayer", text, QMessageBox::Yes | QMessageBox::No); 6226 #if QT_VERSION >= 0x050200 6227 QCheckBox cb(tr("Remember my decision and don't ask again")); 6228 mb.setCheckBox(&cb); 6229 #endif 6230 if (mb.exec() == QMessageBox::Yes) { 6231 setTabletMode(system_tablet_mode); 6232 } 6233 #if QT_VERSION >= 0x050200 6234 if (cb.isChecked()) { 6235 pref->tablet_mode_change_answer = (mb.result() == QMessageBox::Yes ? "yes" : "no"); 6236 } 6237 #endif 6238 } 6239 // Update action button 6240 tabletModeAct->setChecked(pref->tablet_mode); 6241 } 6242 } 6243 5904 6244 #ifdef AVOID_SCREENSAVER 5905 6245 void BaseGui::clear_just_stopped() { … … 5908 6248 } 5909 6249 #endif 5910 #endif 6250 6251 #endif // Q_OS_WIN 5911 6252 5912 6253 #include "moc_basegui.cpp"
Note:
See TracChangeset
for help on using the changeset viewer.