Changeset 118 for smplayer/vendor/current/src/basegui.cpp
- Timestamp:
- Dec 22, 2011, 6:27:52 PM (14 years ago)
- File:
-
- 1 edited
-
smplayer/vendor/current/src/basegui.cpp (modified) (37 diffs)
Legend:
- Unmodified
- Added
- Removed
-
smplayer/vendor/current/src/basegui.cpp
r90 r118 1 1 /* smplayer, GUI front-end for mplayer. 2 Copyright (C) 2006-201 0Ricardo 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 … … 85 85 #include "prefinput.h" 86 86 #include "prefadvanced.h" 87 87 88 88 89 #include "myaction.h" 89 90 #include "myactiongroup.h" 91 90 92 91 93 #include "constants.h" … … 95 97 #ifdef Q_OS_WIN 96 98 #include "deviceinfo.h" 99 97 100 #endif 98 101 … … 104 107 near_bottom(false) 105 108 { 106 #if def Q_OS_WIN109 #if 107 110 /* Disable screensaver by event */ 108 111 just_stopped = false; … … 208 211 connect(server, SIGNAL(receivedLoadSubtitle(QString)), 209 212 this, SLOT(remoteLoadSubtitle(QString))); 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 210 233 211 234 if (pref->use_single_instance) { … … 222 245 } 223 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 224 286 void BaseGui::remoteOpen(QString file) { 225 287 qDebug("BaseGui::remoteOpen: '%s'", file.toUtf8().data()); … … 259 321 core->loadSub(file); 260 322 } 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 261 372 } 262 373 … … 512 623 core, SLOT(toggleMirror(bool)) ); 513 624 514 motionVectorsAct = new MyAction( this, "motion_vectors" );515 motionVectorsAct->setCheckable( true );516 connect( motionVectorsAct, SIGNAL(toggled(bool)),517 core, SLOT(visualizeMotionVectors(bool)) );518 519 625 520 626 // Submenu filter … … 670 776 connect( useAssAct, SIGNAL(toggled(bool)), core, SLOT(changeUseAss(bool)) ); 671 777 672 useClosedCaptionAct = new MyAction(this, "use_closed_caption");673 useClosedCaptionAct->setCheckable(true);674 connect( useClosedCaptionAct, SIGNAL(toggled(bool)), core, SLOT(toggleClosedCaption(bool)) );675 676 778 useForcedSubsOnlyAct = new MyAction(this, "use_forced_subs_only"); 677 779 useForcedSubsOnlyAct->setCheckable(true); … … 726 828 connect( showTipsAct, SIGNAL(triggered()), 727 829 this, SLOT(helpTips()) ); 830 831 832 833 728 834 729 835 aboutQtAct = new MyAction( this, "about_qt" ); … … 1026 1132 core, SLOT(changeSubtitle(int)) ); 1027 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1028 1143 // Titles 1029 1144 titleGroup = new MyActionGroup(this); … … 1278 1393 #ifndef Q_OS_WIN 1279 1394 // Disable video filters if using vdpau 1280 if ((pref-> disable_video_filters_with_vdpau) && (pref->vo.startsWith("vdpau"))) {1395 if ((pref->) && (pref->vo.startsWith("vdpau"))) { 1281 1396 screenshotAct->setEnabled(false); 1282 1397 screenshotsAct->setEnabled(false); … … 1408 1523 flipAct->change( Images::icon("flip"), tr("Fli&p image") ); 1409 1524 mirrorAct->change( Images::icon("mirror"), tr("Mirr&or image") ); 1410 motionVectorsAct->change( Images::icon("motion_vectors"),1411 tr("Visualize &motion vectors") );1412 1525 1413 1526 decZoomAct->change( tr("Zoom &-") ); … … 1469 1582 tr("N&ext line in subtitles") ); 1470 1583 useAssAct->change( Images::icon("use_ass_lib"), tr("Use SSA/&ASS library") ); 1471 useClosedCaptionAct->change( Images::icon("closed_caption"), tr("Enable &closed caption") );1472 1584 useForcedSubsOnlyAct->change( Images::icon("forced_subs"), tr("&Forced subtitles only") ); 1473 1585 … … 1476 1588 showFindSubtitlesDialogAct->change( Images::icon("download_subs"), tr("Find subtitles on &OpenSubtitles.org...") ); 1477 1589 openUploadSubtitlesPageAct->change( Images::icon("upload_subs"), tr("Upload su&btitles to OpenSubtitles.org...") ); 1590 1591 1592 1593 1594 1595 1478 1596 1479 1597 // Menu Options … … 1490 1608 showCLOptionsAct->change( Images::icon("cl_help"), tr("&Command line options") ); 1491 1609 showTipsAct->change( Images::icon("tips"), tr("&Tips") ); 1610 1492 1611 aboutQtAct->change( QPixmap(":/icons-png/qt.png"), tr("About &Qt") ); 1493 1612 aboutThisAct->change( Images::icon("logo_small"), tr("About &SMPlayer") ); … … 1691 1810 subtitlestrack_menu->menuAction()->setIcon( Images::icon("sub") ); 1692 1811 1812 1813 1814 1693 1815 // Menu Browse 1694 1816 titles_menu->menuAction()->setText( tr("&Title") ); … … 2181 2303 videoMenu->addSeparator(); 2182 2304 videoMenu->addAction(videoPreviewAct); 2183 videoMenu->addSeparator();2184 videoMenu->addAction(motionVectorsAct);2185 2305 2186 2306 … … 2241 2361 subtitlesMenu->addAction(unloadSubsAct); 2242 2362 subtitlesMenu->addSeparator(); 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2243 2374 subtitlesMenu->addAction(decSubDelayAct); 2244 2375 subtitlesMenu->addAction(incSubDelayAct); … … 2255 2386 subtitlesMenu->addAction(incSubStepAct); 2256 2387 subtitlesMenu->addSeparator(); 2257 subtitlesMenu->addAction(useClosedCaptionAct);2258 2388 subtitlesMenu->addAction(useForcedSubsOnlyAct); 2259 2389 subtitlesMenu->addSeparator(); … … 2329 2459 helpMenu->addAction(showCLOptionsAct); 2330 2460 helpMenu->addAction(showTipsAct); 2461 2331 2462 helpMenu->addSeparator(); 2332 2463 helpMenu->addAction(aboutQtAct); … … 2440 2571 pref_dialog->mod_input()->actions_editor->addActions(playlist); 2441 2572 #endif 2573 2574 2575 2576 2577 2578 2579 2580 2442 2581 pref_dialog->show(); 2443 2582 } … … 2516 2655 } 2517 2656 2657 2658 2659 2660 2661 2662 2663 2664 2518 2665 if (need_update_language) { 2519 2666 translator->load(pref->language); … … 2647 2794 } 2648 2795 2649 setWindowCaption( core->mdat.displayName( ) + " - SMPlayer" );2796 setWindowCaption( core->mdat.displayName() + " - SMPlayer" ); 2650 2797 2651 2798 emit videoInfoChanged(core->mdat.video_width, core->mdat.video_height, core->mdat.video_fps.toDouble()); … … 2961 3108 // Disable the unload subs action if there's no external subtitles 2962 3109 unloadSubsAct->setEnabled( !core->mset.external_subtitles.isEmpty() ); 3110 3111 3112 2963 3113 2964 3114 // Audio menu … … 3084 3234 #endif 3085 3235 3086 // Motion vectors3087 motionVectorsAct->setChecked( pref->show_motion_vectors );3088 3089 3236 // Compact mode 3090 3237 compactAct->setChecked( pref->compact_mode ); … … 3102 3249 useAssAct->setChecked( pref->use_ass_subtitles ); 3103 3250 3104 // Closed caption and forces subs 3105 useClosedCaptionAct->setChecked( pref->use_closed_caption_subs ); 3251 // Forced subs 3106 3252 useForcedSubsOnlyAct->setChecked( pref->use_forced_subs_only ); 3107 3253 … … 3113 3259 (core->mset.current_sub_id != MediaSettings::NoneSelected)); 3114 3260 3115 if ( pref->use_closed_caption_subs) e = true; // Enable if using closed captions3261 if () e = true; // Enable if using closed captions 3116 3262 3117 3263 decSubDelayAct->setEnabled(e); … … 3514 3660 3515 3661 void BaseGui::helpTips() { 3516 QDesktopServices::openUrl( QUrl("http://smplayer.berlios.de/forum/viewforum.php?f=12") ); 3662 QDesktopServices::openUrl( QUrl("http://smplayer.sf.net/forum/viewforum.php?f=12") ); 3663 } 3664 3665 void BaseGui::helpDonate() { 3666 QMessageBox d(QMessageBox::NoIcon, tr("Donate"), 3667 tr("If you like SMPlayer, a really good way to support it is by sending a donation, even the smallest one is highly appreciated.") + "<br>" + 3668 tr("You can send your donation using %1.").arg("<a href=\"https://sourceforge.net/donate/index.php?group_id=185512\">"+tr("this form")), 3669 QMessageBox::Ok, this); 3670 d.setIconPixmap( Images::icon("logo", 64) ); 3671 d.exec(); 3517 3672 } 3518 3673 … … 3603 3758 3604 3759 #ifdef Q_OS_WIN 3605 // Avoid the video to pause 3606 if (!pref->pause_when_hidden) hide(); 3760 // Hack to avoid the windows taskbar to be visible on Windows XP 3761 if (QSysInfo::WindowsVersion < QSysInfo::WV_VISTA) { 3762 if (!pref->pause_when_hidden) hide(); 3763 } 3607 3764 #endif 3608 3765 … … 3610 3767 3611 3768 } else { 3612 #ifdef Q_OS_WIN3613 // Avoid the video to pause3614 if (!pref->pause_when_hidden) hide();3615 #endif3616 3617 3769 showNormal(); 3618 3770 … … 3707 3859 qDebug("BaseGui::processFunction: '%s'", function.toUtf8().data()); 3708 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3709 3872 QAction * action = ActionsEditor::findAction(this, function); 3710 3873 if (!action) action = ActionsEditor::findAction(playlist, function); … … 3712 3875 if (action) { 3713 3876 qDebug("BaseGui::processFunction: action found"); 3714 if (action->isCheckable()) 3715 //action->toggle(); 3877 3878 if (!action->isEnabled()) { 3879 qDebug("BaseGui::processFunction: action is disabled, doing nothing"); 3880 return; 3881 } 3882 3883 if (action->isCheckable()){ 3884 if(checkableFunction) 3885 action->setChecked(value); 3886 else 3887 //action->toggle(); 3888 action->trigger(); 3889 }else{ 3716 3890 action->trigger(); 3717 else 3718 action->trigger(); 3891 } 3719 3892 } 3720 3893 } … … 3726 3899 3727 3900 QAction * action; 3728 QStringList l = actions.split(" "); 3729 3730 for (int n = 0; n < l.count(); n++) { 3731 QString a = l[n]; 3732 QString par = ""; 3733 3734 if ( (n+1) < l.count() ) { 3735 if ( (l[n+1].toLower() == "true") || (l[n+1].toLower() == "false") ) { 3736 par = l[n+1].toLower(); 3901 QStringList actionsList = actions.split(" "); 3902 3903 for (int n = 0; n < actionsList.count(); n++) { 3904 QString actionStr = actionsList[n]; 3905 QString par = ""; //the parameter which the action takes 3906 3907 //set par if the next word is a boolean value 3908 if ( (n+1) < actionsList.count() ) { 3909 if ( (actionsList[n+1].toLower() == "true") || (actionsList[n+1].toLower() == "false") ) { 3910 par = actionsList[n+1].toLower(); 3737 3911 n++; 3738 } 3739 } 3740 3741 action = ActionsEditor::findAction(this, a );3742 if (!action) action = ActionsEditor::findAction(playlist, a );3912 } 3913 } 3914 3915 action = ActionsEditor::findAction(this, a); 3916 if (!action) action = ActionsEditor::findAction(playlist, a); 3743 3917 3744 3918 if (action) { 3745 3919 qDebug("BaseGui::runActions: running action: '%s' (par: '%s')", 3746 a.toUtf8().data(), par.toUtf8().data() );3920 .toUtf8().data(), par.toUtf8().data() ); 3747 3921 3748 3922 if (action->isCheckable()) { … … 3752 3926 } else { 3753 3927 action->setChecked( (par == "true") ); 3754 } 3755 } 3756 else { 3928 } //end if 3929 } else { 3757 3930 action->trigger(); 3758 } 3931 } 3759 3932 } else { 3760 qWarning("BaseGui::runActions: action: '%s' not found",a .toUtf8().data());3761 } 3762 } 3933 qWarning("BaseGui::runActions: action: '%s' not found",a.toUtf8().data()); 3934 } 3935 } 3763 3936 } 3764 3937 … … 3983 4156 if (state == Core::Stopped) setWindowCaption( "SMPlayer" ); 3984 4157 3985 #if def Q_OS_WIN4158 #if 3986 4159 /* Disable screensaver by event */ 3987 4160 just_stopped = false; … … 4498 4671 return false; 4499 4672 } 4500 4673 #endif 4674 4675 #if defined(Q_OS_WIN) || defined(Q_OS_OS2) 4501 4676 void BaseGui::clear_just_stopped() { 4502 4677 qDebug("BaseGui::clear_just_stopped");
Note:
See TracChangeset
for help on using the changeset viewer.
