Ticket #2426: embed_playback_part2.diff
File embed_playback_part2.diff, 17.1 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/libmythtv.pro
139 139 HEADERS += playgroup.h progdetails.h 140 140 HEADERS += channeleditor.h channelsettings.h 141 141 HEADERS += previewgenerator.h dvbtransporteditor.h 142 HEADERS += playbackbox.h 142 143 143 144 SOURCES += programinfo.cpp proglist.cpp 144 145 SOURCES += RingBuffer.cpp … … 160 161 SOURCES += progdetails.cpp 161 162 SOURCES += channeleditor.cpp channelsettings.cpp 162 163 SOURCES += previewgenerator.cpp dvbtransporteditor.cpp 164 SOURCES += playbackbox.cpp 163 165 164 166 # DiSEqC 165 167 HEADERS += diseqc.h diseqcsettings.h -
libs/libmythtv/tv_play.h
68 68 enum scheduleEditTypes { 69 69 kScheduleProgramGuide = 0, 70 70 kScheduleProgramFinder, 71 kScheduledRecording 71 kScheduledRecording, 72 kPlaybackBox, 72 73 }; 73 74 74 75 class MPUBLIC TV : public QObject … … 112 113 // Recording commands 113 114 int PlayFromRecorder(int recordernum); 114 115 int Playback(ProgramInfo *rcinfo); 116 117 // Various commands 115 118 void setLastProgram(ProgramInfo *rcinfo); 116 119 ProgramInfo *getLastProgram(void) { return lastProgram; } 117 120 void setInPlayList(bool setting) { inPlaylist = setting; } 118 121 void setUnderNetworkControl(bool setting) { underNetworkControl = setting; } 122 bool IsSameProgram(ProgramInfo *p); 119 123 120 // Various commands121 124 void ShowNoRecorderDialog(void); 122 125 void FinishRecording(void); 123 126 void AskAllowRecording(const QStringList&, int, bool); … … 194 197 static void *EPGMenuHandler(void *param); 195 198 static void *FinderMenuHandler(void *param); 196 199 static void *ScheduleMenuHandler(void *param); 200 static void *RecordedShowMenuHandler(void *param); 197 201 198 202 void RunTV(void); 199 203 static void *EventThread(void *param); … … 297 301 void SetAutoCommercialSkip(enum commSkipMode skipMode = CommSkipOff); 298 302 void SetManualZoom(bool zoomON = false); 299 303 300 void DoDisplayJumpMenu(void);301 304 void SetJumpToProgram(QString progKey = "", int progIndex = 0); 302 305 303 306 bool ClearOSD(void); … … 325 328 void ToggleActiveWindow(void); 326 329 void SwapPIP(void); 327 330 void SwapPIPSoon(void) { needToSwapPIP = true; } 328 void DisplayJumpMenuSoon(void) { needToJumpMenu = true; }329 331 330 332 void ToggleAutoExpire(void); 331 333 … … 426 428 427 429 bool ignoreKeys; 428 430 bool needToSwapPIP; 429 bool needToJumpMenu;430 431 QMap<QString,ProgramList> progLists; 431 432 432 433 mutable QMutex chanEditMapLock; ///< Lock for chanEditMap and ddMap -
libs/libmythtv/tv_play.cpp
39 39 #include "DVDRingBuffer.h" 40 40 #include "datadirect.h" 41 41 #include "sourceutil.h" 42 #include "playbackbox.h" 42 43 43 44 #ifndef HAVE_ROUND 44 45 #define round(x) ((int) ((x) + 0.5)) … … 415 416 queuedTranscode(false), getRecorderPlaybackInfo(false), 416 417 adjustingPicture(kAdjustingPicture_None), 417 418 adjustingPictureAttribute(kPictureAttribute_None), 418 ignoreKeys(false), needToSwapPIP(false), needToJumpMenu(false),419 ignoreKeys(false), needToSwapPIP(false), 419 420 // Channel Editing 420 421 chanEditMapLock(true), ddMapSourceId(0), ddMapLoaderRunning(false), 421 422 // Sleep Timer … … 1935 1936 SwapPIP(); 1936 1937 needToSwapPIP = false; 1937 1938 } 1938 1939 if (needToJumpMenu)1940 {1941 DoDisplayJumpMenu();1942 needToJumpMenu = false;1943 }1944 1939 } 1945 1940 1946 1941 if (!IsErrored() && (GetState() != kState_None)) … … 2720 2715 jumpToProgram = true; 2721 2716 } 2722 2717 else if (action == "JUMPREC") 2723 DisplayJumpMenuSoon();2718 EditSchedule(kPlaybackBox); 2724 2719 else if (action == "SIGNALMON") 2725 2720 { 2726 2721 if ((GetState() == kState_WatchingLiveTV) && activerecorder) … … 4973 4968 pbinfoLock.unlock(); 4974 4969 4975 4970 bool changeChannel = false; 4971 ProgramInfo *nextProgram = NULL; 4976 4972 4977 4973 if (StateIsLiveTV(GetState())) 4978 4974 { … … 5002 4998 RunProgramFind(true, false); 5003 4999 break; 5004 5000 case kScheduledRecording: 5001 { 5005 5002 pbinfoLock.lock(); 5006 5003 ScheduledRecording record; 5007 5004 record.loadByProgram(playbackinfo); 5008 5005 record.exec(); 5009 5006 pbinfoLock.unlock(); 5010 5007 break; 5008 } 5009 case kPlaybackBox: 5010 { 5011 pbinfoLock.lock(); 5012 nextProgram = PlaybackBox::RunPlaybackBox(this, true); 5013 if (nextProgram) 5014 { 5015 setLastProgram(nextProgram); 5016 jumpToProgram = true; 5017 exitPlayer = true; 5018 delete nextProgram; 5019 } 5020 pbinfoLock.unlock(); 5021 break; 5022 } 5011 5023 } 5012 5024 5013 5025 if (!stayPaused) … … 5053 5065 return NULL; 5054 5066 } 5055 5067 5068 void *TV::RecordedShowMenuHandler(void *param) 5069 { 5070 TV *obj = (TV *)param; 5071 obj->doEditSchedule(kPlaybackBox); 5072 5073 return NULL; 5074 } 5075 5056 5076 void TV::EditSchedule(int editType) 5057 5077 { 5058 5078 if (menurunning == true) … … 5075 5095 case kScheduledRecording: 5076 5096 pthread_create(&tid, &attr, TV::ScheduleMenuHandler, this); 5077 5097 break; 5098 case kPlaybackBox: 5099 pthread_create(&tid, &attr, TV::RecordedShowMenuHandler, this); 5078 5100 } 5079 5101 } 5080 5102 … … 6370 6392 jumpToProgram = true; 6371 6393 } 6372 6394 else if (action == "JUMPREC") 6373 DisplayJumpMenuSoon();6395 EditSchedule(kPlaybackBox); 6374 6396 else if (action.left(8) == "JUMPPROG") 6375 6397 { 6376 6398 SetJumpToProgram(action.section(" ",1,-2), … … 6401 6423 } 6402 6424 } 6403 6425 6404 void TV::DoDisplayJumpMenu(void)6405 {6406 if (treeMenu)6407 delete treeMenu;6408 6409 treeMenu = new OSDGenericTree(NULL, "treeMenu");6410 OSDGenericTree *item, *subitem;6411 6412 // Build jumpMenu of recorded program titles6413 ProgramInfo *p;6414 progLists.clear();6415 vector<ProgramInfo *> *infoList;6416 infoList = RemoteGetRecordedList(false);6417 6418 bool LiveTVInAllPrograms = gContext->GetNumSetting("LiveTVInAllPrograms",0);6419 6420 if (infoList)6421 {6422 pbinfoLock.lock();6423 vector<ProgramInfo *>::iterator i = infoList->begin();6424 for ( ; i != infoList->end(); i++)6425 {6426 p = *i;6427 //if (p->recgroup != "LiveTV" || LiveTVInAllPrograms)6428 if (p->recgroup == playbackinfo->recgroup)6429 progLists[p->title].prepend(p);6430 }6431 pbinfoLock.unlock();6432 6433 QMap<QString,ProgramList>::Iterator Iprog;6434 for (Iprog = progLists.begin(); Iprog != progLists.end(); Iprog++)6435 {6436 ProgramList plist = Iprog.data();6437 int progIndex = plist.count();6438 if (progIndex == 1)6439 {6440 item = new OSDGenericTree(treeMenu, tr(Iprog.key()),6441 QString("JUMPPROG %1 0").arg(Iprog.key()));6442 }6443 else6444 {6445 item = new OSDGenericTree(treeMenu, tr(Iprog.key()));6446 for (int i = 0; i < progIndex; i++)6447 {6448 p = plist.at(i);6449 if (p->subtitle != "")6450 subitem = new OSDGenericTree(item, tr(p->subtitle),6451 QString("JUMPPROG %1 %2").arg(Iprog.key()).arg(i));6452 else6453 subitem = new OSDGenericTree(item, tr(p->title),6454 QString("JUMPPROG %1 %2").arg(Iprog.key()).arg(i));6455 }6456 }6457 }6458 }6459 6460 if (GetOSD())6461 {6462 ClearOSD();6463 6464 OSDListTreeType *tree = GetOSD()->ShowTreeMenu("menu", treeMenu);6465 if (tree)6466 {6467 connect(tree, SIGNAL(itemSelected(OSDListTreeType *,OSDGenericTree *)),6468 this, SLOT(TreeMenuSelected(OSDListTreeType *, OSDGenericTree *)));6469 6470 connect(tree, SIGNAL(itemEntered(OSDListTreeType *, OSDGenericTree *)),6471 this, SLOT(TreeMenuEntered(OSDListTreeType *, OSDGenericTree *)));6472 }6473 }6474 }6475 6476 6426 void TV::ShowOSDTreeMenu(void) 6477 6427 { 6478 6428 BuildOSDTreeMenu(); … … 7443 7393 lastProgram = NULL; 7444 7394 } 7445 7395 7396 bool TV::IsSameProgram(ProgramInfo *rcinfo) 7397 { 7398 if (rcinfo && playbackinfo) 7399 return playbackinfo->IsSameProgram(*rcinfo); 7400 7401 return false; 7402 } 7403 7446 7404 /* vim: set expandtab tabstop=4 shiftwidth=4: */ -
programs/mythfrontend/playbackbox.cpp
16 16 #include <qfileinfo.h> 17 17 #include <qsqldatabase.h> 18 18 #include <qmap.h> 19 #include <qwaitcondition.h> 19 20 20 21 #include <cmath> 21 22 #include <unistd.h> … … 50 51 51 52 #define USE_PREV_GEN_THREAD 52 53 54 QWaitCondition pbbIsVisibleCond; 55 53 56 static int comp_programid(ProgramInfo *a, ProgramInfo *b) 54 57 { 55 58 if (a->programid == b->programid) … … 185 188 return (a->startts.date() > b->startts.date() ? 1 : -1); 186 189 } 187 190 191 192 ProgramInfo * PlaybackBox::RunPlaybackBox(TV *player, bool thread) 193 { 194 ProgramInfo *nextProgram = NULL; 195 if (thread) 196 qApp->lock(); 197 198 PlaybackBox *pbb = new PlaybackBox(PlaybackBox::Play, 199 gContext->GetMainWindow(), "tvplayselect", player); 200 pbb->Show(); 201 202 if (thread) 203 { 204 qApp->unlock(); 205 pbbIsVisibleCond.wait(); 206 } 207 else 208 pbb->exec(); 209 210 if (pbb->getSelected()) 211 nextProgram = new ProgramInfo(*pbb->getSelected()); 212 213 delete pbb; 214 215 return nextProgram; 216 } 217 188 218 PlaybackBox::PlaybackBox(BoxType ltype, MythMainWindow *parent, 189 const char *name )219 const char *name, TV *player) 190 220 : MythDialog(parent, name), 191 221 // Settings 192 222 type(ltype), … … 248 278 previewPixmapEnabled(false), previewPixmap(NULL), 249 279 previewSuspend(false), previewChanid(""), 250 280 // Network Control Variables 251 underNetworkControl(false) 281 underNetworkControl(false), 282 m_player(NULL) 252 283 { 253 284 formatShortDate = gContext->GetSetting("ShortDateFormat", "M/d"); 254 285 formatLongDate = gContext->GetSetting("DateFormat", "ddd MMMM d"); … … 263 294 groupnameAsAllProg = gContext->GetNumSetting("DispRecGroupAsAllProg", 0); 264 295 arrowAccel = gContext->GetNumSetting("UseArrowAccels", 1); 265 296 inTitle = gContext->GetNumSetting("PlaybackBoxStartInTitle", 0); 266 previewVideoEnabled =gContext->GetNumSetting("PlaybackPreview"); 297 if (!player) 298 previewVideoEnabled =gContext->GetNumSetting("PlaybackPreview"); 267 299 previewPixmapEnabled=gContext->GetNumSetting("GeneratePreviewPixmaps"); 268 300 previewFromBookmark= gContext->GetNumSetting("PreviewFromBookmark"); 269 301 drawTransPixmap = gContext->LoadScalePixmap("trans-backup.png"); … … 283 315 titleList << ""; 284 316 playList.clear(); 285 317 318 if (player) 319 m_player = player; 320 286 321 // recording group stuff 287 322 recGroupType.clear(); 288 323 recGroupType[recGroup] = (displayCat) ? "category" : "recgroup"; … … 369 404 gContext->removeListener(this); 370 405 gContext->removeCurrentLocation(); 371 406 372 killPlayerSafe(); 407 if (!m_player) 408 killPlayerSafe(); 373 409 374 410 if (previewVideoRefreshTimer) 375 411 { … … 566 602 567 603 void PlaybackBox::exitWin() 568 604 { 569 killPlayerSafe(); 605 if (m_player) 606 { 607 if (curitem) 608 delete curitem; 609 curitem = NULL; 610 pbbIsVisibleCond.wakeAll(); 611 } 612 else 613 killPlayerSafe(); 614 570 615 accept(); 571 616 } 572 617 … … 1247 1292 if (playList.grep(tempInfo->MakeUniqueKey()).count()) 1248 1293 ltype->EnableForcedFont(cnt, "tagged"); 1249 1294 1250 if (tempInfo->availableStatus != asAvailable) 1295 if (tempInfo->availableStatus != asAvailable || 1296 (m_player && m_player->IsSameProgram(tempInfo))) 1251 1297 ltype->EnableForcedFont(cnt, "inactive"); 1252 1298 } 1253 1299 } … … 2079 2125 if (!curitem) 2080 2126 return; 2081 2127 2128 if (m_player && m_player->IsSameProgram(curitem)) 2129 exitWin(); 2130 2082 2131 if (curitem && curitem->availableStatus != asAvailable) 2083 2132 showAvailablePopup(curitem); 2084 2133 else 2085 2134 play(curitem); 2135 2136 if (m_player) 2137 { 2138 pbbIsVisibleCond.wakeAll(); 2139 accept(); 2140 } 2086 2141 } 2087 2142 2088 2143 void PlaybackBox::stopSelected() … … 2211 2266 popup->addButton(tr("Playlist options"), this, 2212 2267 SLOT(showPlaylistPopup())); 2213 2268 } 2214 else 2269 else if (!m_player) 2215 2270 { 2216 2271 if (inTitle) 2217 2272 { … … 2254 2309 if (!rec) 2255 2310 return false; 2256 2311 2312 if (m_player) 2313 return true; 2314 2257 2315 if (fileExists(rec) == false) 2258 2316 { 2259 2317 QString msg = … … 2912 2970 2913 2971 initPopup(popup, program, "", ""); 2914 2972 2915 QButton *playButton ;2973 QButton *playButton = new QButton(); 2916 2974 2917 if (curitem->programflags & FL_BOOKMARK) 2918 playButton = popup->addButton(tr("Play from..."), this, 2919 SLOT(showPlayFromPopup())); 2920 else 2921 playButton = popup->addButton(tr("Play"), this, SLOT(doPlay())); 2975 if (!(m_player && m_player->IsSameProgram(curitem))) 2976 { 2977 if (curitem->programflags & FL_BOOKMARK) 2978 popup->addButton(tr("Play from..."), this, 2979 SLOT(showPlayFromPopup())); 2980 else 2981 popup->addButton(tr("Play"), this, SLOT(doPlay())); 2982 } 2922 2983 2923 if (playList.grep(curitem->MakeUniqueKey()).count()) 2924 popup->addButton(tr("Remove from Playlist"), this, 2925 SLOT(togglePlayListItem())); 2926 else 2927 popup->addButton(tr("Add to Playlist"), this, 2928 SLOT(togglePlayListItem())); 2984 if (!m_player) 2985 { 2986 if (playList.grep(curitem->MakeUniqueKey()).count()) 2987 popup->addButton(tr("Remove from Playlist"), this, 2988 SLOT(togglePlayListItem())); 2989 else 2990 popup->addButton(tr("Add to Playlist"), this, 2991 SLOT(togglePlayListItem())); 2992 } 2929 2993 2930 2994 if (program->recstatus == rsRecording) 2931 2995 popup->addButton(tr("Stop Recording"), this, SLOT(askStop())); … … 2941 3005 popup->addButton(tr("Recording Options"), this, SLOT(showRecordingPopup())); 2942 3006 popup->addButton(tr("Job Options"), this, SLOT(showJobPopup())); 2943 3007 2944 popup->addButton(tr("Delete"), this, SLOT(askDelete())); 3008 if (!(m_player && m_player->IsSameProgram(curitem))) 3009 popup->addButton(tr("Delete"), this, SLOT(askDelete())); 2945 3010 2946 3011 popup->ShowPopup(this, SLOT(doCancel())); 2947 3012 -
programs/mythfrontend/mythfrontend.pro
23 23 QMAKE_CLEAN += $(TARGET) 24 24 25 25 # Input 26 HEADERS += manualbox.h playbackbox.hviewscheduled.h globalsettings.h26 HEADERS += manualbox.h viewscheduled.h globalsettings.h 27 27 HEADERS += manualschedule.h programrecpriority.h channelrecpriority.h 28 28 HEADERS += statusbox.h networkcontrol.h 29 29 30 SOURCES += main.cpp manualbox.cpp playbackbox.cppviewscheduled.cpp30 SOURCES += main.cpp manualbox.cpp viewscheduled.cpp 31 31 SOURCES += globalsettings.cpp manualschedule.cpp programrecpriority.cpp 32 32 SOURCES += channelrecpriority.cpp statusbox.cpp networkcontrol.cpp 33 33 -
programs/mythfrontend/playbackbox.h
13 13 #include "xmlparse.h" 14 14 #include "programinfo.h" 15 15 #include "jobqueue.h" 16 #include "tv_play.h" 16 17 17 18 #include <qvaluelist.h> 18 19 #include <pthread.h> … … 98 99 } killStateType; 99 100 100 101 101 PlaybackBox(BoxType ltype, MythMainWindow *parent, const char *name = 0 );102 PlaybackBox(BoxType ltype, MythMainWindow *parent, const char *name = 0, TV *player = NULL); 102 103 ~PlaybackBox(void); 103 104 104 105 void customEvent(QCustomEvent *e); 105 106 static ProgramInfo *RunPlaybackBox(TV *player, bool thread = false); 107 108 106 109 protected slots: 107 110 void timeout(void); 108 111 … … 246 249 void stop(ProgramInfo *); 247 250 void remove(ProgramInfo *); 248 251 void showActions(ProgramInfo *); 252 ProgramInfo *getSelected(void){ return curitem; } 253 249 254 250 255 void togglePlayListItem(ProgramInfo *pginfo); 251 256 void randomizePlayList(void); … … 451 456 mutable QMutex ncLock; 452 457 QValueList<QString> networkControlCommands; 453 458 bool underNetworkControl; 459 460 TV *m_player; 454 461 }; 455 462 456 463 #endif