Ticket #3600: osd_menu_rev_20003.diff
File osd_menu_rev_20003.diff, 53.3 KB (added by , 15 years ago) |
---|
-
themes/default/osdedit-ui.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 <mythuitheme> 3 <window name="osdmenueditor"> 4 5 <font name="title" face="Bitstream Vera Sans"> 6 <color>#ffffff</color> 7 <size>16</size> 8 <bold>yes</bold> 9 </font> 10 11 12 <textarea name="title" from="basetextarea"> 13 <font>baselarge</font> 14 <area>0,30,800,40</area> 15 <value>OSD Menu Editor</value> 16 <align>center</align> 17 </textarea> 18 19 <buttonlist name="states" from="basebuttonlist"> 20 <area>56,140,200,200</area> 21 </buttonlist> 22 23 <button name="done" from="basebutton"> 24 <position>300,550</position> 25 </button> 26 27 <buttonlist name="categories" from="basebuttonlist"> 28 <area>260,140,400,400</area> 29 <statetype name="buttonitem"> 30 <state name="active"> 31 <statetype name="inactivecolors"> 32 <state name="inactive"> 33 <imagetype name="buttonbackground"> 34 <area> 0,0,400,30</area> 35 <gradient start="#111CCC" end="#FFF000" alpha="100" /> 36 </imagetype> 37 </state> 38 <state name="active"></state> 39 </statetype> 40 <statetype name="entrycolors"> 41 <state name="inactive"> 42 <imagetype name="buttonbackground"> 43 <area>0, 0, 400, 30</area> 44 <gradient start="#123456" end="#FFF000" alpha="100" /> 45 </imagetype> 46 </state> 47 <state name="active"></state> 48 </statetype> 49 </state> 50 <state name="inactive"> 51 <imagetype name="buttonbackground"> 52 <gradient start="#111999" end="#555111" alpha="100" /> 53 </imagetype> 54 </state> 55 </statetype> 56 <showarrow>no</showarrow> 57 </buttonlist> 58 </window> 59 </mythuitheme> -
themes/defaultmenu/tv_settings.xml
91 91 <action>SETTINGS OSD</action> 92 92 </button> 93 93 94 <button> 95 <type>TV_SETTINGS_OSD_MENU_EDITOR</type> 96 <text>OSD Menu Editor</text> 97 <action>OSDMENUEDITOR</action> 98 </button> 94 99 <button> 95 100 <type>TV_SETTINGS_PLAYBACK_GROUPS</type> 96 101 <text>Playback Groups</text> … … 176 181 </button> 177 182 178 183 </mythmenu> 179 -
themes/default-wide/osdedit-ui.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 <mythuitheme> 3 <window name="osdmenueditor"> 4 5 <font name="title" face="Bitstream Vera Sans"> 6 <color>#ffffff</color> 7 <size>18</size> 8 <bold>yes</bold> 9 </font> 10 11 12 <textarea name="title" from="basetextarea"> 13 <font>baselarge</font> 14 <area>0,60,1000,40</area> 15 <value>OSD Menu Editor</value> 16 <align>center</align> 17 </textarea> 18 19 <buttonlist name="states" from="basebuttonlist"> 20 <area>100,140,300,300</area> 21 <showarrow>no</showarrow> 22 </buttonlist> 23 24 <button name="done" from="basebutton"> 25 <position>500,620</position> 26 </button> 27 28 <buttonlist name="categories" from="basebuttonlist"> 29 <area>402,140,500,500</area> 30 <statetype name="buttonitem"> 31 <state name="active"> 32 <statetype name="inactivecolors"> 33 <state name="inactive"> 34 <imagetype name="buttonbackground"> 35 <area> 0,0,500,30</area> 36 <gradient start="#111CCC" end="#FFF000" alpha="100" /> 37 </imagetype> 38 </state> 39 <state name="active"></state> 40 </statetype> 41 <statetype name="entrycolors"> 42 <state name="inactive"> 43 <imagetype name="buttonbackground"> 44 <area>0, 0, 500, 30</area> 45 <gradient start="#123456" end="#FFF000" alpha="100" /> 46 </imagetype> 47 </state> 48 <state name="active"></state> 49 </statetype> 50 </state> 51 <state name="inactive"> 52 <imagetype name="buttonbackground"> 53 <gradient start="#111999" end="#555111" alpha="100" /> 54 </imagetype> 55 </state> 56 </statetype> 57 <showarrow>no</showarrow> 58 </buttonlist> 59 </window> 60 </mythuitheme> -
themes/button_types.txt
141 141 5. TV_SETTINGS_RECORDING_PROFILES 142 142 6. TV_SETTINGS_RECPRIORITIES 143 143 7. TV_SETTINGS_PLAYBACK_OSD 144 8. TV_SETTINGS_OSD_MENU_EDITOR 144 145 145 146 util_menu.xml 146 147 -
libs/libmythtv/tv.h
17 17 18 18 /** \brief TVState is an enumeration of the states used by TV and TVRec. 19 19 */ 20 typedef enum 20 typedef enum 21 21 { 22 22 /** \brief Error State, if we ever try to enter this state errored is set. 23 23 */ … … 35 35 * watching a pre-existing recording. 36 36 */ 37 37 kState_WatchingPreRecorded, 38 /** \brief Watching Video is the state when we are watching a video and is not 39 * a dvd 40 */ 41 kState_WatchingVideo, 42 /** \brief Watching DVD is the state when we are watching a DVD */ 43 kState_WatchingDVD, 38 44 /** \brief Watching Recording is the state for when we are watching 39 45 * an in progress recording, but the user does not have control 40 46 * over the channel and recorder to use. … … 51 57 kState_ChangingState, 52 58 } TVState; 53 59 54 QString StateToString(TVState state );60 QString StateToString(TVState state, bool brief = false); 55 61 56 62 typedef enum PictureAdjustType 57 63 { … … 72 78 kCommSkipIncr, 73 79 } CommSkipMode; 74 80 QString toString(CommSkipMode type); 75 76 81 #endif -
libs/libmythtv/libmythtv.pro
280 280 HEADERS += osd.h osdtypes.h 281 281 HEADERS += osdsurface.h osdlistbtntype.h 282 282 HEADERS += osdimagecache.h osdtypeteletext.h 283 HEADERS += udpnotify.h 283 HEADERS += udpnotify.h tvosdmenuentry.h 284 284 SOURCES += osd.cpp osdtypes.cpp 285 285 SOURCES += osdsurface.cpp osdlistbtntype.cpp 286 286 SOURCES += osdimagecache.cpp osdtypeteletext.cpp 287 SOURCES += udpnotify.cpp 287 SOURCES += udpnotify.cpp tvosdmenuentry.cpp 288 288 289 289 # Video output 290 290 HEADERS += videooutbase.h videoout_null.h -
libs/libmythtv/tv_play.h
43 43 class OSDGenericTree; 44 44 class PlayerContext; 45 45 class UDPNotifyOSDSet; 46 class TVOSDMenuEntryList; 46 47 47 48 typedef QMap<QString,QString> InfoMap; 48 49 typedef QMap<QString,InfoMap> DDValueMap; … … 84 85 class VBIMode 85 86 { 86 87 public: 87 typedef enum 88 typedef enum 88 89 { 89 90 None = 0, 90 91 PAL_TT = 1, … … 363 364 364 365 // key queue commands 365 366 void AddKeyToInputQueue(PlayerContext*, char key); 366 void ClearInputQueues(const PlayerContext*, bool hideosd); 367 void ClearInputQueues(const PlayerContext*, bool hideosd); 367 368 bool CommitQueuedInput(PlayerContext*); 368 369 bool ProcessSmartChannel(const PlayerContext*, QString&); 369 370 … … 381 382 382 383 void SwitchSource(uint source_direction); 383 384 void SwitchInputs(PlayerContext*, uint inputid); 384 void ToggleInputs(PlayerContext*, uint inputid = 0); 385 void ToggleInputs(PlayerContext*, uint inputid = 0); 385 386 void SwitchCards(PlayerContext*, 386 387 uint chanid = 0, QString channum = "", uint inputid = 0); 387 388 … … 434 435 static void *load_dd_map_thunk(void*); 435 436 static void *load_dd_map_post_thunk(void*); 436 437 437 void DoQueueTranscode(PlayerContext*,QString profile); 438 void DoQueueTranscode(PlayerContext*,QString profile); 438 439 439 440 void SetAutoCommercialSkip(const PlayerContext*, 440 441 CommSkipMode skipMode = kCommSkipOff); … … 445 446 const QStringList &actions); 446 447 447 448 void DoDisplayJumpMenu(void); 448 449 449 450 bool ClearOSD(const PlayerContext*); 450 void ToggleOSD(const PlayerContext*, bool includeStatusOSD); 451 void ToggleOSD(const PlayerContext*, bool includeStatusOSD); 451 452 void UpdateOSDProgInfo(const PlayerContext*, const char *whichInfo); 452 453 void UpdateOSDSeekMessage(const PlayerContext*, 453 454 const QString &mesg, int disptime); … … 507 508 508 509 void ShowOSDTreeMenu(const PlayerContext*); 509 510 510 void FillOSDTreeMenu( const PlayerContext*, OSDGenericTree* ) const;511 void FillMenuPlaying( const PlayerContext*, OSDGenericTree* ) const;511 void FillOSDTreeMenu( const PlayerContext*, OSDGenericTree*, QString category) const; 512 void FillMenuPlaying( const PlayerContext*, OSDGenericTree*, QString category) const; 512 513 void FillMenuPxP( const PlayerContext*, OSDGenericTree*) const; 513 514 void FillMenuInputSwitching(const PlayerContext*, OSDGenericTree*) const; 514 515 void FillMenuVideoAspect( const PlayerContext*, OSDGenericTree*) const; … … 559 560 static bool StateIsLiveTV(TVState state); 560 561 static TVState RemoveRecording(TVState state); 561 562 void RestoreScreenSaver(const PlayerContext*); 562 563 563 564 void InitUDPNotifyEvent(void); 564 565 565 566 /// true if dialog is either videoplayexit, playexit or askdelete dialog … … 606 607 int stickykeys; 607 608 float ff_rew_repos; 608 609 bool ff_rew_reverse; 609 bool jumped_back; ///< Used by PromptDeleteRecording 610 bool jumped_back; ///< Used by PromptDeleteRecording 610 611 vector<int> ff_rew_speeds; 611 612 612 613 uint vbimode; … … 716 717 // OSD info 717 718 OSDGenericTree *treeMenu; ///< OSD menu, 'm' using default keybindings 718 719 QMap<OSD*,const PlayerContext*> osd_lctx; 720 TVOSDMenuEntryList *osdMenuEntries; 719 721 720 722 /// UDPNotify instance which shows messages sent 721 723 /// to the "UDPNotifyPort" in an OSD dialog. -
libs/libmythtv/tvosdmenuentry.h
1 #ifndef TVOSDMENUENTRY_H_ 2 #define TVOSDMENUENTRY_H_ 3 4 #include <qstring.h> 5 #include <qstringlist.h> 6 #include <qmutex.h> 7 #include <QVariant> 8 #include "tv.h" 9 10 class TVOSDMenuEntry 11 { 12 public: 13 TVOSDMenuEntry(QString category_entry, int livetv_setting, 14 int recorded_setting, int video_setting, 15 int dvd_setting, QString description_entry) 16 { 17 category = category_entry; 18 livetv = livetv_setting; 19 recorded = recorded_setting; 20 video = video_setting; 21 dvd = dvd_setting, 22 description = description_entry; 23 24 } 25 ~TVOSDMenuEntry(void) {} 26 QString GetCategory(void) { return category; } 27 QString GetDescription(void) { return description; } 28 int LiveTVSetting(void) { return livetv; } 29 int RecordedSetting(void) { return recorded; } 30 int VideoSetting(void) { return video; } 31 int DVDSetting(void) { return dvd; } 32 int GetEntry(TVState state); 33 QStringList GetData(void); 34 void UpdateEntry(int change, TVState state); 35 void UpdateEntry(int livetv_entry, int recorded_entry, 36 int video, int dvd); 37 void UpdateDBEntry(void); 38 void CreateDBEntry(void); 39 40 private: 41 QString category; 42 int livetv; 43 int recorded; 44 int video; 45 int dvd; 46 QString description; 47 QMutex updateEntryLock; 48 49 }; 50 51 Q_DECLARE_METATYPE(TVOSDMenuEntry*) 52 53 class TVOSDMenuEntryList 54 { 55 public: 56 TVOSDMenuEntryList(void); 57 ~TVOSDMenuEntryList(void); 58 bool ShowOSDMenuOption(QString category, TVState state); 59 void UpdateDB(void); 60 int GetCount(void); 61 QListIterator<TVOSDMenuEntry*> GetIterator(void); 62 TVOSDMenuEntry* FindEntry(QString category); 63 64 private: 65 void GetEntriesFromDB(void); 66 void InitDefaultEntries(void); 67 68 private: 69 QList<TVOSDMenuEntry*> curMenuEntries; 70 }; 71 72 #endif -
libs/libmythtv/playercontext.cpp
38 38 // Other state 39 39 paused(false), playingState(kState_None), 40 40 errored(false), 41 // pseudo states 41 // pseudo states 42 42 pseudoLiveTVRec(NULL), pseudoLiveTVState(kPseudoNormalLiveTV), 43 43 // DB values 44 44 fftime(0), rewtime(0), … … 47 47 playingInfoLock(QMutex::Recursive), deleteNVPLock(QMutex::Recursive), 48 48 stateLock(QMutex::Recursive), 49 49 // pip 50 pipState(kPIPOff), pipRect(0,0,0,0), parentWidget(NULL), 50 pipState(kPIPOff), pipRect(0,0,0,0), parentWidget(NULL), 51 51 useNullVideo(false), 52 52 // embedding 53 53 embedWinID(0), embedBounds(0,0,0,0) … … 100 100 101 101 if (curtime < recendts && !playingInfo->isVideo) 102 102 newState = kState_WatchingRecording; 103 else if (playingInfo->isVideo) 104 { 105 if (playingInfo->pathname.startsWith("dvd:")) 106 newState = kState_WatchingDVD; 107 else 108 newState = kState_WatchingVideo; 109 } 103 110 else 104 111 newState = kState_WatchingPreRecorded; 105 112 … … 174 181 } 175 182 else 176 183 name = "pip player"; 177 184 178 185 if (widget) 179 186 parentWidget = widget; 180 187 … … 230 237 231 238 // Centre video in the y axis 232 239 if (img.height() < pipRect.height()) 233 video_y = pipRect.y() + 240 video_y = pipRect.y() + 234 241 (pipRect.height() - img.height()) / 2; 235 242 else 236 243 video_y = pipRect.y(); 237 244 238 245 // Centre video in the x axis 239 246 if (img.width() < pipRect.width()) 240 video_x = pipRect.x() + 247 video_x = pipRect.x() + 241 248 (pipRect.width() - img.width()) / 2; 242 249 else 243 250 video_x = pipRect.x(); 244 251 245 252 p->drawImage(video_x, video_y, img); 246 253 } 247 254 } … … 257 264 parentWidget->winId(), &rect); 258 265 } 259 266 260 if (useNullVideo || !ok) 261 { 267 if (useNullVideo || !ok) 268 { 262 269 SetNVP(NULL); 263 270 useNullVideo = true; 264 271 ok = CreateNVP(tv, NULL, desiredState, … … 270 277 271 278 272 279 /** 273 * \brief stop NVP but pause the ringbuffer. used in PIP/PBP swap or 280 * \brief stop NVP but pause the ringbuffer. used in PIP/PBP swap or 274 281 * switching from PIP <-> PBP or enabling PBP 275 282 */ 276 283 … … 450 457 { 451 458 _nvp->LoadExternalSubtitles(buffer->GetFilename()); 452 459 } 453 460 454 461 if ((embedwinid > 0) && embedbounds) 455 462 { 456 463 _nvp->EmbedInWidget( … … 502 509 gContext->SaveSetting("AudioNag", 0); 503 510 if (kDialogCodeButton2 == ret) 504 511 gContext->SetSetting("AudioNag", 0); 505 else if ((kDialogCodeButton3 == ret) || 512 else if ((kDialogCodeButton3 == ret) || 506 513 (kDialogCodeRejected == ret)) 507 514 { 508 515 return false; 509 516 } */ 510 517 } 511 518 512 519 } 513 520 else if (pipState == kPBPRight) 514 521 nvp->SetMuted(true); 515 522 516 523 int maxWait = -1; 517 524 //if (isPIP()) 518 // maxWait = 1000; 525 // maxWait = 1000; 519 526 520 527 return StartDecoderThread(maxWait); 521 528 } … … 634 641 635 642 // This method builds the stack of previous channels 636 643 QString curChan = tvchain->GetChannelName(-1); 637 if (prevChan.size() == 0 || 644 if (prevChan.size() == 0 || 638 645 curChan != prevChan[prevChan.size() - 1]) 639 646 { 640 647 QString chan = curChan; … … 789 796 { 790 797 filters = chanFilters; 791 798 } 792 else 799 else 793 800 { 794 801 if (!filters.isEmpty() && (filters.right(1) != ",")) 795 802 filters += ","; -
libs/libmythtv/tv_play.cpp
55 55 #include "mythdialogbox.h" 56 56 #include "mythmainwindow.h" 57 57 #include "mythscreenstack.h" 58 #include "tvosdmenuentry.h" 58 59 59 60 #ifndef HAVE_ROUND 60 61 #define round(x) ((int) ((x) + 0.5)) … … 687 688 //Recorder switching info 688 689 switchToRec(NULL), 689 690 // OSD info 690 treeMenu(NULL), udpnotify(NULL),691 treeMenu(NULL), osdMenuEntries(NULL), udpnotify(NULL), 691 692 // LCD Info 692 693 lcdTitle(""), lcdSubtitle(""), lcdCallsign(""), 693 694 // Window info (GUI is optional, transcoding, preview img, etc) … … 749 750 sleep_times.push_back(SleepTimerInfo(QObject::tr("1h30m"), 90*60)); 750 751 sleep_times.push_back(SleepTimerInfo(QObject::tr("2h"), 120*60)); 751 752 753 osdMenuEntries = new TVOSDMenuEntryList(); 754 752 755 gContext->addListener(this); 753 756 gContext->addCurrentLocation("Playback"); 754 757 … … 948 951 pthread_detach(ddMapLoader); 949 952 } 950 953 } 954 955 if (osdMenuEntries) 956 delete osdMenuEntries; 951 957 952 958 PlayerContext *mctx = GetPlayerWriteLock(0, __FILE__, __LINE__); 953 959 while (!player.empty()) … … 1736 1742 SET_NEXT(); 1737 1743 } 1738 1744 else if (TRANSITION(kState_None, kState_WatchingPreRecorded) || 1745 TRANSITION(kState_None, kState_WatchingVideo) || 1746 TRANSITION(kState_None, kState_WatchingDVD) || 1739 1747 TRANSITION(kState_None, kState_WatchingRecording)) 1740 1748 { 1741 1749 ctx->LockPlayingInfo(__FILE__, __LINE__); … … 1809 1817 } 1810 1818 } 1811 1819 else if (TRANSITION(kState_WatchingPreRecorded, kState_None) || 1820 TRANSITION(kState_WatchingVideo, kState_None) || 1821 TRANSITION(kState_WatchingDVD, kState_None) || 1812 1822 TRANSITION(kState_WatchingRecording, kState_None)) 1813 1823 { 1814 1824 SET_NEXT(); … … 9499 9509 9500 9510 void TV::ShowOSDTreeMenu(const PlayerContext *ctx) 9501 9511 { 9512 int osdMenuCount = osdMenuEntries->GetCount(); 9502 9513 if (treeMenu) 9503 9514 { 9504 9515 for (uint i = 0; i < player.size(); i++) … … 9513 9524 9514 9525 treeMenu = new OSDGenericTree(NULL, "treeMenu"); 9515 9526 9516 FillOSDTreeMenu(ctx, treeMenu); 9527 QListIterator<TVOSDMenuEntry*> cm = osdMenuEntries->GetIterator(); 9528 while(cm.hasNext()) 9529 { 9530 TVOSDMenuEntry *entry = cm.next(); 9531 if (entry->GetEntry(GetState(ctx)) > 0) 9532 FillOSDTreeMenu(ctx, treeMenu, entry->GetCategory()); 9533 } 9517 9534 9518 9535 OSDListTreeType *tree = NULL; 9519 9536 … … 9521 9538 9522 9539 OSD *osd = GetOSDLock(ctx); 9523 9540 if (osd) 9524 tree = osd->ShowTreeMenu("menu", treeMenu); 9541 { 9542 // something is wrong with reading osd menu DB table 9543 if (osdMenuCount == 0) 9544 osd->SetSettingsText("Cannot Display OSD Menu", 5); 9545 else 9546 tree = osd->ShowTreeMenu("menu", treeMenu); 9547 } 9525 9548 ReturnOSDLock(ctx, osd); 9526 9549 9527 9550 if (tree) … … 9539 9562 } 9540 9563 9541 9564 void TV::FillOSDTreeMenu( 9542 const PlayerContext *ctx, OSDGenericTree *treeMenu) const 9565 const PlayerContext *ctx, OSDGenericTree *treeMenu, 9566 QString category) const 9543 9567 { 9544 new OSDGenericTree(treeMenu, tr("Program Guide"), "GUIDE");9545 9546 FillMenuPxP(ctx, treeMenu);9547 9548 TVState state = GetState(ctx);9549 bool liveTV = StateIsLiveTV(state);9550 bool playingRec = StateIsPlaying(state);9551 bool playingDVD = playingRec && ctx->buffer && ctx->buffer->isDVD();9552 9568 bool mainCtx = ctx == GetPlayer(ctx, 0); 9553 9554 if ( liveTV)9569 // DVD menu stuff first 9570 if (category == "DVD") 9555 9571 { 9556 FillMenuInputSwitching(ctx, treeMenu);9557 new OSDGenericTree(treeMenu, tr("Edit Channel"), "TOGGLEEDIT");9558 }9559 else if (playingDVD)9560 {9561 9572 new OSDGenericTree( 9562 9573 treeMenu, tr("DVD Root Menu"), "JUMPTODVDROOTMENU"); 9563 9574 new OSDGenericTree( … … 9565 9576 new OSDGenericTree( 9566 9577 treeMenu, tr("DVD Chapter Menu"), "JUMPTODVDCHAPTERMENU"); 9567 9578 } 9568 else if (playingRec && mainCtx) 9579 else if (category == "GUIDE") 9580 new OSDGenericTree(treeMenu, tr("Program Guide"), "GUIDE"); 9581 else if (category == "PIP") 9582 FillMenuPxP(ctx, treeMenu); 9583 else if (category == "INPUTSWITCHING") 9584 FillMenuInputSwitching(ctx, treeMenu); 9585 else if (category == "EDITCHANNEL") 9586 new OSDGenericTree(treeMenu, tr("Edit Channel"), "TOGGLEEDIT"); 9587 else if (category == "EDITRECORDING") 9588 new OSDGenericTree(treeMenu, tr("Edit Recording"), "TOGGLEEDIT"); 9589 else if (category == "JUMPREC") 9569 9590 { 9570 new OSDGenericTree(treeMenu, tr("Edit Recording"), "TOGGLEEDIT"); 9591 OSDGenericTree *jtp_item = 9592 new OSDGenericTree(treeMenu, tr("Jump to Program")); 9593 new OSDGenericTree(jtp_item, tr("Recorded Program"), "JUMPREC"); 9594 if (lastProgram != NULL) 9595 new OSDGenericTree(jtp_item, lastProgram->title, "JUMPPREV"); 9571 9596 } 9572 9573 OSDGenericTree *jtp_item = 9574 new OSDGenericTree(treeMenu, tr("Jump to Program")); 9575 new OSDGenericTree(jtp_item, tr("Recorded Program"), "JUMPREC"); 9576 if (lastProgram != NULL) 9577 new OSDGenericTree(jtp_item, lastProgram->title, "JUMPPREV"); 9578 9579 if (liveTV) 9597 else if (category == "TOGGLEBROWSE") 9580 9598 { 9581 9599 if (!db_browse_always) 9582 9600 { 9583 9601 new OSDGenericTree( 9584 9602 treeMenu, tr("Enable Browse Mode"), "TOGGLEBROWSE"); 9585 9603 } 9604 } 9605 else if ( category == "PREVCHAN") 9586 9606 new OSDGenericTree(treeMenu, tr("Previous Channel"), "PREVCHAN"); 9587 }9588 else if (playingRec && !playingDVD)9589 FillMenuPlaying(ctx, treeMenu);9590 9607 9591 FillMenuTracks(ctx, treeMenu, kTrackTypeAudio); 9592 FillMenuTracks(ctx, treeMenu, kTrackTypeSubtitle); 9593 FillMenuTracks(ctx, treeMenu, kTrackTypeCC708); 9608 FillMenuPlaying(ctx, treeMenu, category); 9594 9609 9595 if (VBIMode::NTSC_CC == vbimode) 9596 FillMenuTracks(ctx, treeMenu, kTrackTypeCC608); 9597 else if (VBIMode::PAL_TT == vbimode) 9610 if (category == "AUDIOTRACKS") 9611 FillMenuTracks(ctx, treeMenu, kTrackTypeAudio); 9612 else if (category == "SUBTITLETRACKS") 9613 FillMenuTracks(ctx, treeMenu, kTrackTypeSubtitle); 9614 else if (category == "CCTRACKS") 9598 9615 { 9599 new OSDGenericTree( 9600 treeMenu, tr("Toggle Teletext Captions"), "TOGGLETTC"); 9601 new OSDGenericTree( 9602 treeMenu, tr("Toggle Teletext Menu"), "TOGGLETTM"); 9603 FillMenuTracks(ctx, treeMenu, kTrackTypeTeletextCaptions); 9616 FillMenuTracks(ctx, treeMenu, kTrackTypeCC708); 9617 if (VBIMode::NTSC_CC == vbimode) 9618 FillMenuTracks(ctx, treeMenu, kTrackTypeCC608); 9619 else if (VBIMode::PAL_TT == vbimode) 9620 { 9621 new OSDGenericTree( 9622 treeMenu, tr("Toggle Teletext Captions"), "TOGGLETTC"); 9623 new OSDGenericTree( 9624 treeMenu, tr("Toggle Teletext Menu"), "TOGGLETTM"); 9625 FillMenuTracks(ctx, treeMenu, kTrackTypeTeletextCaptions); 9626 } 9604 9627 } 9605 9628 9606 9629 if (mainCtx) 9607 9630 { 9608 FillMenuVideoAspect(ctx, treeMenu); 9609 FillMenuAdjustFill(ctx, treeMenu); 9610 new OSDGenericTree(treeMenu, tr("Manual Zoom Mode"), "TOGGLEMANUALZOOM"); 9611 FillMenuAdjustPicture(ctx, treeMenu); 9631 if (category == "VIDEOASPECT") 9632 FillMenuVideoAspect(ctx, treeMenu); 9633 else if (category == "ADJUSTFILL") 9634 FillMenuAdjustFill(ctx, treeMenu); 9635 else if (category == "MANUAL_ZOOM") 9636 new OSDGenericTree(treeMenu, tr("Manual Zoom Mode"), "TOGGLEMANUALZOOM"); 9637 else if (category == "ADJUSTPICTURE") 9638 FillMenuAdjustPicture(ctx, treeMenu); 9612 9639 } 9613 9640 9614 new OSDGenericTree(treeMenu, tr("Adjust Audio Sync"), "TOGGLEAUDIOSYNC"); 9615 FillMenuTimeStretch(ctx, treeMenu); 9616 FillMenuVideoScan(ctx, treeMenu); 9617 FillMenuSleepMode(ctx, treeMenu); 9641 if (category == "AUDIOSYNC") 9642 new OSDGenericTree(treeMenu, tr("Adjust Audio Sync"), "TOGGLEAUDIOSYNC"); 9643 else if (category == "TIMESTRETCH") 9644 FillMenuTimeStretch(ctx, treeMenu); 9645 else if (category == "VIDEOSCAN") 9646 FillMenuVideoScan(ctx, treeMenu); 9647 else if (category == "SLEEP") 9648 FillMenuSleepMode(ctx, treeMenu); 9618 9649 } 9619 9650 9620 9651 void TV::FillMenuPlaying( 9621 const PlayerContext *ctx, OSDGenericTree *treeMenu) const 9652 const PlayerContext *ctx, OSDGenericTree *treeMenu, 9653 QString category) const 9622 9654 { 9623 9655 ctx->LockPlayingInfo(__FILE__, __LINE__); 9624 if (JobQueue::IsJobQueuedOrRunning( 9656 if (category == "TRANSCODE") 9657 { 9658 if (JobQueue::IsJobQueuedOrRunning( 9625 9659 JOB_TRANSCODE, ctx->playingInfo->chanid, 9626 9660 ctx->playingInfo->startts)) 9627 {9628 new OSDGenericTree(treeMenu, tr("Stop Transcoding"), "QUEUETRANSCODE");9629 }9630 else9631 {9632 OSDGenericTree *bt_item =9633 new OSDGenericTree(treeMenu, tr("Begin Transcoding"));9634 new OSDGenericTree(bt_item, tr("Default"),9635 "QUEUETRANSCODE");9636 new OSDGenericTree(bt_item, tr("Autodetect"),9661 { 9662 new OSDGenericTree(treeMenu, tr("Stop Transcoding"), "QUEUETRANSCODE"); 9663 } 9664 else 9665 { 9666 OSDGenericTree *bt_item = 9667 new OSDGenericTree(treeMenu, tr("Begin Transcoding")); 9668 new OSDGenericTree(bt_item, tr("Default"), 9669 "QUEUETRANSCODE"); 9670 new OSDGenericTree(bt_item, tr("Autodetect"), 9637 9671 "QUEUETRANSCODE_AUTO"); 9638 new OSDGenericTree(bt_item, tr("High Quality"),9672 new OSDGenericTree(bt_item, tr("High Quality"), 9639 9673 "QUEUETRANSCODE_HIGH"); 9640 new OSDGenericTree(bt_item, tr("Medium Quality"),9674 new OSDGenericTree(bt_item, tr("Medium Quality"), 9641 9675 "QUEUETRANSCODE_MEDIUM"); 9642 new OSDGenericTree(bt_item, tr("Low Quality"),9676 new OSDGenericTree(bt_item, tr("Low Quality"), 9643 9677 "QUEUETRANSCODE_LOW"); 9678 } 9644 9679 } 9645 9680 9646 OSDGenericTree *cas_item = 9647 new OSDGenericTree(treeMenu, tr("Commercial Auto-Skip")); 9648 uint cas_ord[] = { 0, 2, 1 }; 9681 else if (category == "COMMSKIP") 9682 { 9683 OSDGenericTree *cas_item = 9684 new OSDGenericTree(treeMenu, tr("Commercial Auto-Skip")); 9685 uint cas_ord[] = { 0, 2, 1 }; 9649 9686 9650 ctx->LockDeleteNVP(__FILE__, __LINE__);9651 CommSkipMode cur = kCommSkipOff;9652 if (ctx->nvp)9653 cur = ctx->nvp->GetAutoCommercialSkip();9654 ctx->UnlockDeleteNVP(__FILE__, __LINE__);9687 ctx->LockDeleteNVP(__FILE__, __LINE__); 9688 CommSkipMode cur = kCommSkipOff; 9689 if (ctx->nvp) 9690 cur = ctx->nvp->GetAutoCommercialSkip(); 9691 ctx->UnlockDeleteNVP(__FILE__, __LINE__); 9655 9692 9656 for (uint i = 0; i < sizeof(cas_ord)/sizeof(uint); i++) 9657 { 9658 const CommSkipMode mode = (CommSkipMode) cas_ord[i]; 9659 new OSDGenericTree( 9660 cas_item, toString(mode), 9661 QString("TOGGLECOMMSKIP%1").arg(cas_ord[i]), 9662 (mode == cur) ? 1 : 0, NULL, "COMMSKIPGROUP"); 9693 for (uint i = 0; i < sizeof(cas_ord)/sizeof(uint); i++) 9694 { 9695 const CommSkipMode mode = (CommSkipMode) cas_ord[i]; 9696 new OSDGenericTree( 9697 cas_item, toString(mode), 9698 QString("TOGGLECOMMSKIP%1").arg(cas_ord[i]), 9699 (mode == cur) ? 1 : 0, NULL, "COMMSKIPGROUP"); 9700 } 9663 9701 } 9664 9702 9665 if (ctx->playingInfo->GetAutoExpireFromRecorded())9703 else if (category == "TOGGLEEXPIRE") 9666 9704 { 9667 new OSDGenericTree( 9668 treeMenu, tr("Turn Auto-Expire OFF"), "TOGGLEAUTOEXPIRE"); 9705 if (ctx->playingInfo->GetAutoExpireFromRecorded()) 9706 { 9707 new OSDGenericTree( 9708 treeMenu, tr("Turn Auto-Expire OFF"), "TOGGLEAUTOEXPIRE"); 9709 } 9710 else 9711 { 9712 new OSDGenericTree( 9713 treeMenu, tr("Turn Auto-Expire ON"), "TOGGLEAUTOEXPIRE"); 9714 } 9669 9715 } 9670 else 9716 9717 ctx->UnlockPlayingInfo(__FILE__, __LINE__); 9718 9719 if (category == "SCHEDULERECORDING") 9671 9720 { 9721 OSDGenericTree *sr_item = 9722 new OSDGenericTree(treeMenu, tr("Schedule Recordings")); 9723 new OSDGenericTree( 9724 sr_item, tr("Upcoming Recordings"), "VIEWSCHEDULED"); 9672 9725 new OSDGenericTree( 9673 treeMenu, tr("Turn Auto-Expire ON"), "TOGGLEAUTOEXPIRE"); 9726 sr_item, tr("Program Finder"), "FINDER"); 9727 new OSDGenericTree( 9728 sr_item, tr("Edit Recording Schedule"), "SCHEDULE"); 9674 9729 } 9675 9676 ctx->UnlockPlayingInfo(__FILE__, __LINE__);9677 9678 OSDGenericTree *sr_item =9679 new OSDGenericTree(treeMenu, tr("Schedule Recordings"));9680 new OSDGenericTree(9681 sr_item, tr("Program Guide"), "GUIDE");9682 new OSDGenericTree(9683 sr_item, tr("Upcoming Recordings"), "VIEWSCHEDULED");9684 new OSDGenericTree(9685 sr_item, tr("Program Finder"), "FINDER");9686 new OSDGenericTree(9687 sr_item, tr("Edit Recording Schedule"), "SCHEDULE");9688 9730 } 9689 9731 9690 9732 /// \brief Constructs Picture-X-Picture portion of menu … … 11238 11280 ctx = NULL; 11239 11281 } 11240 11282 11241 11242 11283 /* vim: set expandtab tabstop=4 shiftwidth=4: */ -
libs/libmythtv/tvosdmenuentry.cpp
1 #include "tvosdmenuentry.h" 2 #include "libmyth/mythcontext.h" 3 #include "libmythdb/mythdb.h" 4 #include "libmythdb/mythverbose.h" 5 #define LOC QString("OSDMenuEntry:") 6 #define LOC_ERR QString("OSDMenuEntry Error:") 7 8 /**\class TVOSDMenuEntry 9 * \brief Holds information on which tv state one can view 10 * a tv osd menu option. There are 4 states. LiveTV, prerecorded , Video, 11 * and DVD. Values can be directly edited in the tvosdmenu table 12 * or through the TV OSD Menu Editor 13 */ 14 15 /** 16 * \brief returns the contents of the osd menu entry 17 * in the form of a qstringlist 18 */ 19 QStringList TVOSDMenuEntry::GetData(void) 20 { 21 QStringList values; 22 values << category 23 << QString("%1").arg(livetv) 24 << QString("%1").arg(recorded) 25 << QString("%1").arg(video) 26 << QString("%1").arg(dvd) 27 << description; 28 return values; 29 } 30 31 /** 32 * \brief returns whether or not this osd menu entry 33 * should be displayed in the mentioned TVState 34 * return -1 if not applicable to the TVState provided 35 */ 36 int TVOSDMenuEntry::GetEntry(TVState state) 37 { 38 switch (state) 39 { 40 case kState_WatchingLiveTV: 41 return livetv; 42 case kState_WatchingPreRecorded: 43 return recorded; 44 case kState_WatchingRecording: 45 return recorded; 46 case kState_WatchingVideo: 47 return video; 48 case kState_WatchingDVD: 49 return dvd; 50 default: 51 return -1; 52 } 53 54 return -1; 55 } 56 57 /** 58 * \brief update the OSD Menu Entry livetv, recorded, video and 59 * dvd settings 60 */ 61 void TVOSDMenuEntry::UpdateEntry(int livetv_setting, int recorded_setting, 62 int video_setting, int dvd_setting) 63 { 64 QMutexLocker locker(&updateEntryLock); 65 livetv = livetv_setting; 66 recorded = recorded_setting; 67 video = video_setting; 68 dvd = dvd_setting; 69 } 70 71 /** 72 * \brief update the tv state option in the tv osd menu entry 73 */ 74 void TVOSDMenuEntry::UpdateEntry(int change, TVState state) 75 { 76 QMutexLocker locker(&updateEntryLock); 77 switch (state) 78 { 79 case kState_WatchingLiveTV: 80 livetv = change; 81 break; 82 case kState_WatchingPreRecorded: 83 recorded = change; 84 break; 85 case kState_WatchingVideo: 86 video = change; 87 break; 88 case kState_WatchingDVD: 89 dvd = change; 90 break; 91 default: 92 break; 93 } 94 } 95 96 /** 97 * \brief save the entry to the tvosdmenu table 98 */ 99 void TVOSDMenuEntry::UpdateDBEntry(void) 100 { 101 QMutexLocker locker(&updateEntryLock); 102 MSqlQuery query(MSqlQuery::InitCon()); 103 if (!query.isConnected()) 104 return; 105 106 query.prepare( " UPDATE tvosdmenu " 107 " SET livetv = :LIVETV, recorded = :RECORDED, " 108 " video = :VIDEO, dvd = :DVD " 109 " WHERE osdcategory = :OSDCATEGORY;"); 110 111 query.bindValue(":LIVETV", QString("%1").arg(livetv)); 112 query.bindValue(":RECORDED", QString("%1").arg(recorded)); 113 query.bindValue(":VIDEO", QString("%1").arg(video)); 114 query.bindValue(":DVD", QString("%1").arg(dvd)); 115 query.bindValue(":OSDCATEGORY", QString("%1").arg(category)); 116 117 if (!query.exec()) 118 MythDB::DBError(LOC + "UpdateDBEntry", query); 119 } 120 121 /** 122 * \brief add the tv osd menu entry to the tvosdmenu db table 123 */ 124 void TVOSDMenuEntry::CreateDBEntry(void) 125 { 126 QMutexLocker locker(&updateEntryLock); 127 MSqlQuery query(MSqlQuery::InitCon()); 128 if (!query.isConnected()) 129 return; 130 131 query.prepare( "INSERT IGNORE INTO tvosdmenu " 132 " (osdcategory, livetv, recorded, " 133 " video, dvd, description) " 134 " VALUES ( :OSDCATEGORY, :LIVETV, " 135 " :RECORDED, :VIDEO, :DVD, :DESCRIPTION);"); 136 137 query.bindValue(":OSDCATEGORY", category); 138 query.bindValue(":LIVETV", QString("%1").arg(livetv)); 139 query.bindValue(":RECORDED", QString("%1").arg(recorded)); 140 query.bindValue(":VIDEO", QString("%1").arg(video)); 141 query.bindValue(":DVD", QString("%1").arg(dvd)); 142 query.bindValue(":DESCRIPTION", description); 143 144 if (!query.exec()) 145 MythDB::DBError(LOC + "CreateDBEntry", query); 146 } 147 148 TVOSDMenuEntryList::TVOSDMenuEntryList(void) 149 { 150 InitDefaultEntries(); 151 } 152 153 TVOSDMenuEntryList::~TVOSDMenuEntryList(void) 154 { 155 if (curMenuEntries.isEmpty()) 156 return; 157 while (!curMenuEntries.isEmpty()) 158 delete curMenuEntries.takeFirst(); 159 } 160 161 bool TVOSDMenuEntryList::ShowOSDMenuOption(QString category, TVState state) 162 { 163 TVOSDMenuEntry *entry = FindEntry(category); 164 if (!entry) 165 return false; 166 return (entry->GetEntry(state) > 0); 167 } 168 169 TVOSDMenuEntry *TVOSDMenuEntryList::FindEntry(QString category) 170 { 171 TVOSDMenuEntry *entry = NULL; 172 QListIterator<TVOSDMenuEntry*> cm = GetIterator(); 173 while(cm.hasNext()) 174 { 175 entry = cm.next(); 176 if (category.compare(entry->GetCategory()) == 0) 177 return entry; 178 } 179 return NULL; 180 } 181 182 183 /* \brief List default settings for the osd menu. settings are as follows: 184 * -1: not allowed. 185 * 0: disabled, can be enabled through osd menu editor, 186 * 1: active by default 187 */ 188 void TVOSDMenuEntryList::InitDefaultEntries(void) 189 { 190 curMenuEntries.append( 191 new TVOSDMenuEntry("DVD", -1, -1, -1, 1, "DVD Menu")); 192 curMenuEntries.append( 193 new TVOSDMenuEntry("GUIDE", 1, 1, 0, 0, "Program Guide")); 194 curMenuEntries.append( 195 new TVOSDMenuEntry("PIP", 1, 1, 1, -1, "Picture-in-Picture")); 196 curMenuEntries.append( 197 new TVOSDMenuEntry("INPUTSWITCHING", 1, -1, -1, -1, "Change TV Input")); 198 curMenuEntries.append( 199 new TVOSDMenuEntry("EDITCHANNEL", 1, -1, -1, -1, "Edit Channel")); 200 curMenuEntries.append( 201 new TVOSDMenuEntry("EDITRECORDING", -1, 1, -1, -1, "Edit Recording")); 202 curMenuEntries.append( 203 new TVOSDMenuEntry("JUMPREC", 1, 1, 1, 0, "List of Recorded Shows")); 204 curMenuEntries.append( 205 new TVOSDMenuEntry("TOGGLEBROWSE", 1, -1, -1, -1, "Live TV Browse Mode")); 206 curMenuEntries.append( 207 new TVOSDMenuEntry("PREVCHAN", 1, -1, -1, -1, "Previous TV Channel")); 208 curMenuEntries.append( 209 new TVOSDMenuEntry("TRANSCODE", 1, 1, -1, -1, "Transcode Show")); 210 curMenuEntries.append( 211 new TVOSDMenuEntry("COMMSKIP", 1, 1, 0, -1, "Commercial Skip")); 212 curMenuEntries.append( 213 new TVOSDMenuEntry("TOGGLEEXPIRE", 1, 1, -1, -1, "Toggle Expire")); 214 curMenuEntries.append( 215 new TVOSDMenuEntry("SCHEDULEREC", 1, 1, 0, 0, "Schedule Recordings")); 216 curMenuEntries.append( 217 new TVOSDMenuEntry("AUDIOTRACKS", 1, 1, 1, 1, "Audio Tracks")); 218 curMenuEntries.append( 219 new TVOSDMenuEntry("SUBTITLETRACKS", 1, 1, 1, 1, "Subtitle Tracks")); 220 curMenuEntries.append( 221 new TVOSDMenuEntry("CCTRACKS", 1, 1, 1, 1, "Closed Caption Tracks")); 222 curMenuEntries.append( 223 new TVOSDMenuEntry("VIDEOASPECT", 1, 1, 1, 1, "Video Aspect")); 224 curMenuEntries.append( 225 new TVOSDMenuEntry("ADJUSTFILL", 1, 1, 1, 1, "Adjust Fill")); 226 curMenuEntries.append( 227 new TVOSDMenuEntry("MANUALZOOM", 1, 1, 1, 1, "Manual Zoom")); 228 curMenuEntries.append( 229 new TVOSDMenuEntry("ADJUSTPICTURE", 1, 1, 1, 1, "Adjust Picture")); 230 curMenuEntries.append( 231 new TVOSDMenuEntry("AUDIOSYNC", 1, 1, 1, 1 , "Audio Sync")); 232 curMenuEntries.append( 233 new TVOSDMenuEntry("TIMESTRETCH", 1, 1, 1, 1, "Time Stretch")); 234 curMenuEntries.append( 235 new TVOSDMenuEntry("VIDEOSCAN", 1, 1, 1, 1, "Video Scan")); 236 curMenuEntries.append( 237 new TVOSDMenuEntry("SLEEP", 1, 1, 1, 1, "Sleep")); 238 239 GetEntriesFromDB(); 240 if (GetCount() != curMenuEntries.count()) 241 UpdateDB(); 242 } 243 244 int TVOSDMenuEntryList::GetCount(void) 245 { 246 MSqlQuery query(MSqlQuery::InitCon()); 247 if (!query.isConnected()) 248 return curMenuEntries.count(); 249 250 query.prepare ("SELECT COUNT(osdcategory) FROM tvosdmenu;"); 251 if (query.exec() && query.isActive() && query.size() > 0) 252 { 253 query.next(); 254 return query.value(0).toUInt(); 255 } 256 257 MythDB::DBError(LOC + "GetCount()", query); 258 return 0; 259 } 260 261 void TVOSDMenuEntryList::GetEntriesFromDB(void) 262 { 263 MSqlQuery query(MSqlQuery::InitCon()); 264 if (!query.isConnected()) 265 return; 266 267 TVOSDMenuEntry *entry = NULL; 268 QString osdcategory; 269 QListIterator<TVOSDMenuEntry *> cm = GetIterator(); 270 while (cm.hasNext()) 271 { 272 entry = cm.next(); 273 osdcategory = entry->GetCategory(); 274 query.prepare("SELECT livetv, recorded, video, dvd " 275 "FROM tvosdmenu WHERE osdcategory = :OSDCATEGORY;"); 276 query.bindValue(":OSDCATEGORY", osdcategory); 277 278 if (query.exec() && query.isActive() && query.size() == 1) 279 { 280 query.next(); 281 entry->UpdateEntry(query.value(0).toInt(), 282 query.value(1).toInt(), 283 query.value(2).toInt(), 284 query.value(3).toInt()); 285 } 286 } 287 } 288 289 void TVOSDMenuEntryList::UpdateDB(void) 290 { 291 MSqlQuery query(MSqlQuery::InitCon()); 292 if (!query.isConnected()) 293 return; 294 295 TVOSDMenuEntry *entry = NULL; 296 QString osdcategory; 297 QListIterator<TVOSDMenuEntry *> cm = GetIterator(); 298 while (cm.hasNext()) 299 { 300 entry = cm.next(); 301 osdcategory = entry->GetCategory(); 302 query.prepare("SELECT osdcategory FROM tvosdmenu " 303 "WHERE osdcategory = :OSDCATEGORY;"); 304 query.bindValue(":OSDCATEGORY", osdcategory); 305 if (query.exec() && query.isActive() && query.size() > 0) 306 entry->UpdateDBEntry(); 307 else 308 entry->CreateDBEntry(); 309 } 310 } 311 312 313 QListIterator<TVOSDMenuEntry*> TVOSDMenuEntryList::GetIterator(void) 314 { 315 return QListIterator<TVOSDMenuEntry*>(curMenuEntries); 316 } -
libs/libmythtv/tv.cpp
9 9 * \brief Returns a human readable QString representing a TVState. 10 10 * \param state State to print. 11 11 */ 12 QString StateToString(TVState state )12 QString StateToString(TVState state, bool brief) 13 13 { 14 bool appendWatching = false; 14 15 QString statestr = QString("Unknown(%1)").arg((int)state); 15 16 switch (state) { 16 17 case kState_Error: statestr = "Error"; break; 17 18 case kState_None: statestr = "None"; break; 18 case kState_WatchingLiveTV: statestr = "WatchingLiveTV"; break; 19 case kState_WatchingLiveTV: 20 statestr = "WatchingLiveTV"; 21 appendWatching = true; 22 break; 19 23 case kState_WatchingPreRecorded: 20 statestr = "WatchingPreRecorded"; break; 21 case kState_WatchingRecording: statestr = "WatchingRecording"; break; 22 case kState_RecordingOnly: statestr = "RecordingOnly"; break; 24 statestr = "WatchingPreRecorded"; 25 appendWatching = true; 26 break; 27 case kState_WatchingVideo: 28 statestr = "Video"; 29 appendWatching = true; 30 break; 31 case kState_WatchingDVD: 32 statestr = "DVD"; 33 appendWatching = true; 34 break; 35 case kState_WatchingRecording: 36 statestr = "WatchingRecording"; 37 appendWatching = true; 38 break; 39 case kState_RecordingOnly: 40 statestr = "RecordingOnly"; 41 appendWatching = true; 42 break; 23 43 case kState_ChangingState: statestr = "ChangingState"; break; 24 44 } 25 45 statestr.detach(); 46 if (!brief && appendWatching) 47 statestr.prepend("Watching "); 26 48 return statestr; 27 49 } 28 50 -
programs/mythfrontend/main.cpp
61 61 #include "mythcontrols.h" 62 62 #include "mythuihelper.h" 63 63 #include "mythdirs.h" 64 #include "mythosdmenueditor.h" 64 65 65 66 static ExitPrompter *exitPopup = NULL; 66 67 static MythThemedMenu *menu; … … 142 143 delete mythcontrols; 143 144 } 144 145 146 void startOSDMenuEditor(void) 147 { 148 MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); 149 150 MythOSDMenuEditor *mythosdmenueditor = 151 new MythOSDMenuEditor(mainStack, "mythosdmenueditor"); 152 153 if (mythosdmenueditor->Create()) 154 mainStack->AddScreen(mythosdmenueditor); 155 } 156 157 145 158 void startGuide(void) 146 159 { 147 160 uint chanid = 0; … … 458 471 { 459 472 startAppearWiz(); 460 473 } 474 else if (sel == "osdmenueditor") 475 { 476 startOSDMenuEditor(); 477 } 461 478 else if (sel == "setup_keys") 462 479 { 463 480 startKeysSetup(); -
programs/mythfrontend/mythosdmenueditor.h
1 #ifndef MYTHOSDMENUEDITOR_H 2 #define MYTHOSDMENUEDITOR_H 3 4 #include "mythscreentype.h" 5 #include "tv.h" 6 //#include "tvosdmenuentry.h" 7 8 class MythUIButtonList; 9 class MythUIButton; 10 class TVOSDMenuEntryList; 11 12 class MythOSDMenuEditor : public MythScreenType 13 { 14 Q_OBJECT 15 16 public: 17 MythOSDMenuEditor(MythScreenStack *parent, const char *name); 18 ~MythOSDMenuEditor(); 19 20 bool Create(void); 21 bool keyPressEvent(QKeyEvent *); 22 23 private: 24 TVOSDMenuEntryList *m_menuEntryList; 25 26 static TVState WatchingLiveTV; 27 static TVState WatchingPreRecorded; 28 static TVState WatchingVideo; 29 static TVState WatchingDVD; 30 31 MythUIButtonList *m_states; 32 MythUIButtonList *m_categories; 33 MythUIButton *m_doneButton; 34 TVState m_tvstate; 35 36 void updateCategoryList(bool active = true); 37 bool moveUpOrDown(QString direction); 38 void moveRightOrLeft(QString direction); 39 40 private slots: 41 void slotStateChanged(MythUIButtonListItem *item); 42 void slotToggleItem(MythUIButtonListItem *item); 43 }; 44 45 #endif -
programs/mythfrontend/mythfrontend.pro
26 26 HEADERS += mediarenderer.h mythfexml.h playbackboxlistitem.h 27 27 HEADERS += mythappearance.h exitprompt.h proglist.h 28 28 HEADERS += action.h mythcontrols.h keybindings.h keygrabber.h 29 HEADERS += mythosdmenueditor.h 29 30 30 31 SOURCES += main.cpp playbackbox.cpp viewscheduled.cpp 31 32 SOURCES += globalsettings.cpp manualschedule.cpp programrecpriority.cpp … … 33 34 SOURCES += mediarenderer.cpp mythfexml.cpp playbackboxlistitem.cpp 34 35 SOURCES += custompriority.cpp mythappearance.cpp exitprompt.cpp proglist.cpp 35 36 SOURCES += action.cpp actionset.cpp mythcontrols.cpp keybindings.cpp 36 SOURCES += keygrabber.cpp 37 SOURCES += keygrabber.cpp mythosdmenueditor.cpp 37 38 38 39 macx { 39 40 mac_bundle { -
programs/mythfrontend/mythosdmenueditor.cpp
1 #define MYTHOSDMENUEDITOR_CPP 2 3 /* QT includes */ 4 #include <qnamespace.h> 5 #include <qstringlist.h> 6 #include <qapplication.h> 7 #include <qdom.h> 8 #include <qbuttongroup.h> 9 #include <qimage.h> 10 #include <qevent.h> 11 #include <qdir.h> 12 #include <qstring.h> 13 14 /* MythTV includes */ 15 #include "mythcontext.h" 16 #include "mythdbcon.h" 17 #include "mythmainwindow.h" 18 #include "myththemebase.h" 19 #include "mythuibuttonlist.h" 20 #include "mythuibutton.h" 21 #include "mythosdmenueditor.h" 22 #include "tvosdmenuentry.h" 23 24 25 using namespace std; 26 27 /* Static data members */ 28 TVState MythOSDMenuEditor::WatchingLiveTV = kState_WatchingLiveTV; 29 TVState MythOSDMenuEditor::WatchingPreRecorded = kState_WatchingPreRecorded; 30 TVState MythOSDMenuEditor::WatchingVideo = kState_WatchingVideo; 31 TVState MythOSDMenuEditor::WatchingDVD = kState_WatchingDVD; 32 33 Q_DECLARE_METATYPE(TVState*) 34 35 36 MythOSDMenuEditor::MythOSDMenuEditor(MythScreenStack *parent, const char *name) 37 : MythScreenType(parent, name), m_menuEntryList(NULL), m_states(NULL), 38 m_categories(NULL), m_doneButton(NULL), m_tvstate(WatchingLiveTV) 39 { 40 m_menuEntryList = new TVOSDMenuEntryList(); 41 } 42 43 MythOSDMenuEditor::~MythOSDMenuEditor() { 44 m_menuEntryList->UpdateDB(); 45 delete m_menuEntryList; 46 } 47 48 void MythOSDMenuEditor::updateCategoryList(bool active) 49 { 50 QString state_name = (active)? "entrycolors" : "inactivecolors"; 51 52 m_categories->Reset(); 53 QListIterator<TVOSDMenuEntry*> cm = m_menuEntryList->GetIterator(); 54 while(cm.hasNext()) 55 { 56 TVOSDMenuEntry *entry = cm.next(); 57 MythUIButtonListItem::CheckState checked = 58 MythUIButtonListItem::NotChecked; 59 int enable_entry = entry->GetEntry(m_tvstate); 60 QString entry_state = "inactive"; 61 if (enable_entry > 0) 62 { 63 checked = MythUIButtonListItem::FullChecked; 64 if (active) 65 entry_state = "active"; 66 } 67 if (enable_entry > -1) 68 { 69 MythUIButtonListItem *item = 70 new MythUIButtonListItem(m_categories, entry->GetDescription(), 71 0, true, checked); 72 item->SetData(qVariantFromValue(entry)); 73 item->DisplayState(entry_state, state_name); 74 } 75 } 76 } 77 78 bool MythOSDMenuEditor::Create() 79 { 80 bool foundtheme = false; 81 82 // Load the theme for this screen 83 foundtheme = LoadWindowFromXML("osdedit-ui.xml", "osdmenueditor", this); 84 85 if (!foundtheme) 86 return false; 87 88 bool err = false; 89 UIUtilE::Assign(this, m_states, "states", &err); 90 UIUtilE::Assign(this, m_categories, "categories", &err); 91 UIUtilE::Assign(this, m_doneButton, "done", &err); 92 93 if (err) 94 { 95 VERBOSE(VB_IMPORTANT, "Cannot load screen 'MythOSDMenuEditor'"); 96 return false; 97 } 98 99 m_doneButton->SetText("Return"); 100 101 connect(m_doneButton, SIGNAL(Clicked()), this, SLOT(Close())); 102 connect(m_states, SIGNAL(itemSelected(MythUIButtonListItem*)), 103 this, SLOT(slotStateChanged(MythUIButtonListItem*))); 104 connect(m_categories, SIGNAL(itemClicked(MythUIButtonListItem*)), 105 this, SLOT(slotToggleItem(MythUIButtonListItem*))); 106 107 if (!BuildFocusList()) 108 VERBOSE(VB_IMPORTANT, "Failed to build a focuslist. Something is wrong"); 109 110 MythUIButtonListItem* item = new MythUIButtonListItem(m_states, "Live TV"); 111 item->SetData(qVariantFromValue(&WatchingLiveTV)); 112 113 item = new MythUIButtonListItem(m_states, "Recorded TV"); 114 item->SetData(qVariantFromValue(&WatchingPreRecorded)); 115 116 item = new MythUIButtonListItem(m_states, "Video"); 117 item->SetData(qVariantFromValue(&WatchingVideo)); 118 119 item = new MythUIButtonListItem(m_states, "DVD"); 120 item->SetData(qVariantFromValue(&WatchingDVD)); 121 122 updateCategoryList(false); 123 SetFocusWidget(m_states); 124 125 return true; 126 } 127 128 bool MythOSDMenuEditor::keyPressEvent(QKeyEvent *event) 129 { 130 if (GetFocusWidget()->keyPressEvent(event)) 131 return true; 132 133 QStringList actions; 134 bool handled = false; 135 136 gContext->GetMainWindow()->TranslateKeyPress("Global", event, actions); 137 138 for (int i = 0; i < actions.size() && !handled; i++) 139 { 140 QString action = actions[i]; 141 handled = true; 142 143 if (action == "RIGHT" || action == "LEFT") 144 moveRightOrLeft(action); 145 else if (action == "UP") 146 handled = moveUpOrDown("up"); 147 else if (action == "DOWN") 148 handled = moveUpOrDown("down"); 149 else 150 handled = false; 151 } 152 153 if (!handled && MythScreenType::keyPressEvent(event)) 154 handled = true; 155 156 return handled; 157 } 158 159 bool MythOSDMenuEditor::moveUpOrDown(QString direction) 160 { 161 MythUIButtonList *buttonlist = (MythUIButtonList *)GetFocusWidget(); 162 int current_pos = buttonlist->GetCurrentPos(); 163 int count = buttonlist->GetCount(); 164 bool handled = true; 165 if (direction == "up" && current_pos == 0) 166 buttonlist->SetItemCurrent(count - 1); 167 else if (direction == "down" && current_pos == (count - 1)) 168 buttonlist->SetItemCurrent(0); 169 else 170 handled = false; 171 172 return handled; 173 } 174 175 void MythOSDMenuEditor::moveRightOrLeft(QString direction) 176 { 177 QString entry_state = "inactive"; 178 MythUIType *widget = GetFocusWidget(); 179 if (widget == m_categories) 180 { 181 if (direction == "LEFT") 182 SetFocusWidget(m_states); 183 else 184 SetFocusWidget(m_doneButton); 185 } 186 else if (widget == m_states) 187 { 188 if (direction == "LEFT") 189 SetFocusWidget(m_doneButton); 190 else 191 { 192 entry_state = "active"; 193 SetFocusWidget(m_categories); 194 } 195 } 196 else if (widget == m_doneButton) 197 { 198 if (direction == "LEFT") 199 { 200 entry_state = "active"; 201 SetFocusWidget(m_categories); 202 } 203 else 204 SetFocusWidget(m_states); 205 } 206 207 updateCategoryList(entry_state == "active"); 208 209 } 210 211 void MythOSDMenuEditor::slotStateChanged(MythUIButtonListItem *item) 212 { 213 TVState *state = qVariantValue<TVState*>(item->GetData()); 214 215 if (state == NULL || *state == m_tvstate) return; 216 m_tvstate = *state; 217 updateCategoryList(false); 218 219 } 220 221 void MythOSDMenuEditor::slotToggleItem(MythUIButtonListItem *item) 222 { 223 224 TVOSDMenuEntry *entry = 225 qVariantValue<TVOSDMenuEntry *>(item->GetData()); 226 227 if (entry == NULL) return; 228 229 QString entry_state = "inactive"; 230 int enable_entry = 0; 231 MythUIButtonListItem::CheckState entry_checkstate = 232 MythUIButtonListItem::NotChecked; 233 if (item->state() == MythUIButtonListItem::NotChecked) 234 { 235 enable_entry = 1; 236 entry_checkstate = MythUIButtonListItem::FullChecked; 237 entry_state = "active"; 238 } 239 240 item->setChecked(entry_checkstate); 241 item->DisplayState(entry_state, "entrycolors"); 242 entry->UpdateEntry(enable_entry, m_tvstate); 243 }