Ticket #1702: alternate-player.patch
File alternate-player.patch, 11.6 KB (added by , 18 years ago) |
---|
-
mythvideo/mythvideo/videodlg.h
26 26 27 27 virtual ~VideoDialog(); 28 28 29 virtual void playVideo(Metadata *someItem );29 virtual void playVideo(Metadata *someItem, bool wantsAltPlayer); 30 30 31 QString getHandler(Metadata *someItem );32 QString getCommand(Metadata *someItem );31 QString getHandler(Metadata *someItem, bool wantsAltPlayer); 32 QString getCommand(Metadata *someItem, bool wantsAltPlayer); 33 33 bool checkParentPassword(); 34 34 GenericTree *getVideoTreeRoot(void); 35 35 … … 46 46 void exitWin(); 47 47 virtual void slotParentalLevelChanged() {cerr << "VideoDialog::parseContainer" << endl;} 48 48 virtual void slotWatchVideo(); 49 virtual void slotAltWatchVideo(); 49 50 50 51 protected: 51 52 virtual void updateBackground(void); … … 63 64 int currentParentalLevel; 64 65 bool isFileBrowser; 65 66 bool isFlatList; 67 bool hasAltPlayer; 66 68 Metadata* curitem; 67 69 MythPopupBox* popup; 68 70 bool expectingPopup; -
mythvideo/mythvideo/globalsettings.cpp
205 205 return gc; 206 206 }; 207 207 208 static HostLineEdit *VideoAlternatePlayer() 209 { 210 HostLineEdit *gc = new HostLineEdit("VideoAlternatePlayer"); 211 gc->setLabel(QObject::tr("Alternate Player")); 212 gc->setValue(""); 213 gc->setHelpText(QObject::tr("If, for some reason, the default player " 214 "doesn't play a video, you can play it in the alternate " 215 "player by hitting the INFO button and selecting 'Watch " 216 "In Alternate Player'")); 217 return gc; 218 }; 219 208 220 static HostSpinBox *VideoGalleryRows() 209 221 { 210 222 HostSpinBox *gc = new HostSpinBox("VideoGalleryRowsPerPage", 2, 5, 1); … … 285 297 VerticalConfigurationGroup* playersettings = new VerticalConfigurationGroup(false); 286 298 playersettings->setLabel(QObject::tr("Player Settings")); 287 299 playersettings->addChild(VideoDefaultPlayer()); 300 playersettings->addChild(VideoAlternatePlayer()); 288 301 addChild(playersettings); 289 302 } -
mythvideo/mythvideo/videotree.cpp
32 32 current_parental_level = gContext->GetNumSetting("VideoDefaultParentalLevel", 1); 33 33 34 34 file_browser = gContext->GetNumSetting("VideoTreeNoDB", 0); 35 hasAltPlayer = gContext->GetSetting("VideoAlternatePlayer") != ""; 35 36 36 37 // 37 38 // Theme and tree stuff … … 351 352 { 352 353 if(node_number > -1) 353 354 { 354 playVideo(curitem );355 playVideo(curitem, false); 355 356 } 356 357 } 357 358 … … 498 499 if(info) 499 500 { 500 501 focusButton = popup->addButton(tr("Watch This Video"), this, SLOT(slotWatchVideo())); 502 if(hasAltPlayer) 503 popup->addButton(tr("Watch In Alternate Player"), this, SLOT(slotAltWatchVideo())); 501 504 popup->addButton(tr("View Full Plot"), this, SLOT(slotViewPlot())); 502 505 } 503 506 else … … 593 596 cancelPopup(); 594 597 595 598 if (curitem) 596 playVideo(curitem );599 playVideo(curitem, false); 597 600 else 598 601 cerr << "no Item to watch" << endl; 599 602 600 603 } 601 604 605 void VideoTree::slotAltWatchVideo() 606 { 607 cancelPopup(); 608 609 if (curitem) 610 playVideo(curitem, true); 611 else 612 cerr << "no Item to watch" << endl; 602 613 603 void VideoTree::playVideo(Metadata *someItem) 614 } 615 616 617 618 void VideoTree::playVideo(Metadata *someItem, bool wantsAltPlayer) 604 619 { 605 620 if (!someItem) 606 621 return; 607 622 608 623 QString filename = someItem->Filename(); 609 QString handler = getHandler(someItem );624 QString handler = getHandler(someItem, wantsAltPlayer); 610 625 QString year = QString("%1").arg(someItem->Year()); 611 626 // See if this is being handled by a plugin.. 612 627 if(gContext->GetMainWindow()->HandleMedia(handler, filename, someItem->Plot(), … … 616 631 return; 617 632 } 618 633 619 QString command = getCommand(someItem );634 QString command = getCommand(someItem, wantsAltPlayer); 620 635 621 636 622 637 QTime playing_time; … … 649 664 if (parentItem->ChildID() > 0) 650 665 { 651 666 //Load up data about this child 652 command = getCommand(childItem );667 command = getCommand(childItem, wantsAltPlayer); 653 668 playing_time.start(); 654 669 myth_system((QString("%1 ") .arg(command)).local8Bit()); 655 670 } … … 671 686 } 672 687 673 688 674 QString VideoTree::getHandler(Metadata *someItem )689 QString VideoTree::getHandler(Metadata *someItem, bool wantsAltPlayer) 675 690 { 676 691 677 692 if (!someItem) … … 680 695 QString filename = someItem->Filename(); 681 696 QString ext = someItem->Filename().section('.',-1); 682 697 683 QString handler = gContext->GetSetting("VideoDefaultPlayer"); 698 QString handler = gContext->GetSetting(wantsAltPlayer ? "VideoAlternatePlayer": "VideoDefaultPlayer"); 699 if (wantsAltPlayer && handler != "") 700 { 701 // If user asked for the alternate player command, we don't check for 702 // specialized player commands 703 return handler; 704 } 684 705 QString special_handler = someItem->PlayCommand(); 685 706 686 707 // … … 724 745 return handler; 725 746 } 726 747 727 QString VideoTree::getCommand(Metadata *someItem )748 QString VideoTree::getCommand(Metadata *someItem, bool wantsAltPlayer) 728 749 { 729 750 if (!someItem) 730 751 return ""; 731 752 732 753 QString filename = someItem->Filename(); 733 QString handler = getHandler(someItem );754 QString handler = getHandler(someItem, wantsAltPlayer); 734 755 QString arg; 735 756 arg.sprintf("\"%s\"", 736 757 filename.replace(QRegExp("\""), "\\\"").utf8().data()); -
mythvideo/mythvideo/videodlg.cpp
43 43 44 44 isFileBrowser = false; 45 45 isFlatList = false; 46 hasAltPlayer = gContext->GetSetting("VideoAlternatePlayer") != ""; 46 47 video_list = new VideoList(_winName); 47 48 video_tree_root = NULL; 48 49 … … 178 179 cancelPopup(); 179 180 180 181 if (curitem) 181 playVideo(curitem );182 playVideo(curitem, false); 182 183 else 183 184 cerr << "no Item to watch" << endl; 184 185 185 186 } 186 187 188 void VideoDialog::slotAltWatchVideo() 189 { 190 cancelPopup(); 191 192 if (curitem) 193 playVideo(curitem, true); 194 else 195 cerr << "no Item to watch" << endl; 187 196 188 void VideoDialog::playVideo(Metadata *someItem) 197 } 198 199 200 201 void VideoDialog::playVideo(Metadata *someItem, bool wantsAltPlayer) 189 202 { 190 203 QString filename = someItem->Filename(); 191 QString handler = getHandler(someItem );204 QString handler = getHandler(someItem, wantsAltPlayer); 192 205 QString year = QString("%1").arg(someItem->Year()); 193 206 // See if this is being handled by a plugin.. 194 207 if(gContext->GetMainWindow()->HandleMedia(handler, filename, someItem->Plot(), … … 198 211 return; 199 212 } 200 213 201 QString command = getCommand(someItem );214 QString command = getCommand(someItem, wantsAltPlayer); 202 215 203 216 204 217 QTime playing_time; … … 231 244 if (parentItem->ChildID() > 0) 232 245 { 233 246 //Load up data about this child 234 command = getCommand(childItem );247 command = getCommand(childItem, wantsAltPlayer); 235 248 playing_time.start(); 236 249 myth_system((QString("%1 ") .arg(command)).local8Bit()); 237 250 } … … 253 266 } 254 267 255 268 256 QString VideoDialog::getHandler(Metadata *someItem )269 QString VideoDialog::getHandler(Metadata *someItem, bool wantsAltPlayer) 257 270 { 258 271 259 272 if (!someItem) … … 262 275 QString filename = someItem->Filename(); 263 276 QString ext = someItem->Filename().section('.',-1); 264 277 265 QString handler = gContext->GetSetting("VideoDefaultPlayer"); 278 QString handler = gContext->GetSetting(wantsAltPlayer ? "VideoAlternatePlayer": "VideoDefaultPlayer"); 279 if (wantsAltPlayer && handler != "") 280 { 281 // If user asked for the alternate player command, we don't check for 282 // specialized player commands 283 return handler; 284 } 266 285 QString special_handler = someItem->PlayCommand(); 267 286 268 287 // … … 306 325 return handler; 307 326 } 308 327 309 QString VideoDialog::getCommand(Metadata *someItem )328 QString VideoDialog::getCommand(Metadata *someItem, bool wantsAltPlayer) 310 329 { 311 330 if (!someItem) 312 331 return ""; 313 332 314 333 QString filename = someItem->Filename(); 315 QString handler = getHandler(someItem );334 QString handler = getHandler(someItem, wantsAltPlayer); 316 335 QString arg; 317 336 arg.sprintf("\"%s\"", 318 337 filename.replace(QRegExp("\""), "\\\"").utf8().data()); -
mythvideo/mythvideo/videobrowser.cpp
68 68 handled = true; 69 69 70 70 if ((action == "SELECT" || action == "PLAY") && curitem) 71 playVideo(curitem );71 playVideo(curitem, false); 72 72 else if (action == "INFO") 73 73 doMenu(true); 74 74 else if (action == "DOWN") … … 129 129 if(info) 130 130 { 131 131 focusButton = popup->addButton(tr("Watch This Video"), this, SLOT(slotWatchVideo())); 132 if(hasAltPlayer) 133 popup->addButton(tr("Watch In Alternate Player"), this, SLOT(slotAltWatchVideo())); 132 134 popup->addButton(tr("View Full Plot"), this, SLOT(slotViewPlot())); 133 135 } 134 136 else -
mythvideo/mythvideo/videogallery.cpp
489 489 if(info) 490 490 { 491 491 focusButton = popup->addButton(tr("Watch This Video"), this, SLOT(slotWatchVideo())); 492 if(hasAltPlayer) 493 popup->addButton(tr("Watch In Alternate Player"), this, SLOT(slotAltWatchVideo())); 492 494 popup->addButton(tr("View Full Plot"), this, SLOT(slotViewPlot())); 493 495 popup->addButton(tr("View Details"), this, SLOT(handleVideoSelect())); 494 496 -
mythvideo/mythvideo/videotree.h
27 27 28 28 void buildVideoList(); 29 29 30 virtual void playVideo(Metadata *someItem );31 QString getHandler(Metadata *someItem );32 QString getCommand(Metadata *someItem );30 virtual void playVideo(Metadata *someItem, bool wantsAltPlayer); 31 QString getHandler(Metadata *someItem, bool wantsAltPlayer); 32 QString getCommand(Metadata *someItem, bool wantsAltPlayer); 33 33 34 34 public slots: 35 35 void slotDoCancel(); … … 38 38 void slotViewPlot(); 39 39 void slotDoFilter(); 40 40 virtual void slotWatchVideo(); 41 virtual void slotAltWatchVideo(); 41 42 42 43 void handleTreeListSelection(int, IntVector*); 43 44 void handleTreeListEntry(int, IntVector*); … … 59 60 void wireUpTheme(); 60 61 int current_parental_level; 61 62 bool file_browser; 63 bool hasAltPlayer; 62 64 63 65 // 64 66 // Theme-related "widgets"