00001 #include <iostream> 00002 00003 // qt 00004 #include <QKeyEvent> 00005 00006 // myth 00007 #include <mythdialogbox.h> 00008 00009 // mythmusic 00010 #include "musiccommon.h" 00011 #include "playlistview.h" 00012 00013 PlaylistView::PlaylistView(MythScreenStack *parent) 00014 :MusicCommon(parent, "playlistview") 00015 { 00016 m_currentView = MV_PLAYLIST; 00017 } 00018 00019 PlaylistView::~PlaylistView() 00020 { 00021 } 00022 00023 bool PlaylistView::Create(void) 00024 { 00025 bool err = false; 00026 00027 // Load the theme for this screen 00028 err = LoadWindowFromXML("music-ui.xml", "playlistview", this); 00029 00030 if (!err) 00031 return false; 00032 00033 // find common widgets available on any view 00034 err = CreateCommon(); 00035 00036 if (err) 00037 { 00038 LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'playlisteditorview'"); 00039 return false; 00040 } 00041 00042 BuildFocusList(); 00043 00044 return true; 00045 } 00046 00047 void PlaylistView::customEvent(QEvent *event) 00048 { 00049 bool handled = false; 00050 00051 #if 0 00052 if (event->type() == DialogCompletionEvent::kEventType) 00053 { 00054 DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); 00055 00056 QString resultid = dce->GetId(); 00057 QString resulttext = dce->GetResultText(); 00058 //TODO:: 00059 if (resultid == "menu") 00060 { 00061 } 00062 } 00063 #endif 00064 00065 if (!handled) 00066 MusicCommon::customEvent(event); 00067 } 00068 00069 00070 bool PlaylistView::keyPressEvent(QKeyEvent *event) 00071 { 00072 if (!m_moveTrackMode && GetFocusWidget() && GetFocusWidget()->keyPressEvent(event)) 00073 return true; 00074 00075 bool handled = false; 00076 QStringList actions; 00077 handled = GetMythMainWindow()->TranslateKeyPress("Music", event, actions); 00078 00079 #if 0 00080 for (int i = 0; i < actions.size() && !handled; i++) 00081 { 00082 QString action = actions[i]; 00083 handled = true; 00084 00085 if (action == "MENU") 00086 { 00087 showMenu(); 00088 } 00089 else 00090 handled = false; 00091 } 00092 #endif 00093 00094 if (!handled && MusicCommon::keyPressEvent(event)) 00095 handled = true; 00096 00097 if (!handled && MythScreenType::keyPressEvent(event)) 00098 handled = true; 00099 00100 return handled; 00101 }
1.6.3