?? guidisplay.cpp
字號(hào):
/***************************************** Copyright (c) 2001-2003 Sigma Designs, Inc. All Rights Reserved Proprietary and Confidential *****************************************/#ifndef ALLOW_OS_CODE#define ALLOW_OS_CODE 1#endif //ALLOW_OS_CODE#include "gui.h"#include "guicommands.h"#include "guinavigation.h"#include "rmlibhttp/include/rmlibhttp.h"#if 1#define GUIDBG ENABLE#else#define GUIDBG DISABLE#endif#include <unistd.h>#include <signal.h>#include <fcntl.h>static RMremoteKey g_secretmenuCode[] ={ RM_HW_DOWN, RM_HW_UP, RM_HW_DOWN, RM_HW_UP, RM_HW_RIGHT, RM_HW_LEFT };RMstatus RMcuracaoGui::ShowList(RMuint32 listId, RMbool bRet){ if (!m_initialized) { RMDBGLOG((GUIDBG, "GUI not initialised !!\n")); return RM_ERROR; } RMuint16 listIndex; RMuint16 currentSelectedList; m_pnav->GetObjectIndex(m_pnav->SelectedObjectId(), ¤tSelectedList); m_pnav->GetObjectIndex(listId, &listIndex); if (m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex]->nbItems == 0) return RM_ERROR; // if(m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex]->object.dynamic) // { // HTTPFile* f; // // f = fetchOpen(m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex]->object.url, RM_HTTP_VERBOSE); // { // RMuint8 buffer[8192]; // RMint16 n = fetchRead(buffer, 8192, f); // buffer[n] = '\0'; // printf("%s\n", (RMascii*) buffer); // guiListType* list = NULL;// = m_osdPages[pageId] // m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex] = m_pnav->m_parser->ParseWEBList(&list, m_pnav->ActivePageId(), listId, listIndex, buffer, n); // } // fetchClose(f); // } //gfxHideList(m_pRua, &m_pnav->m_osdPages[m_pnav->ActivePageId()]->object, &m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[currentSelectedList]->object); if (bRet == FALSE) { m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex]->object.selecteditem = 0; m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex]->object.previouslyselecteditem = 0; m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex]->object.firstvisible = 0; m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex]->object.lastvisible = 0; } if(currentSelectedList != listIndex) m_pnav->MorphLists(currentSelectedList, listIndex); m_pnav->SelectObject(listId); if (m_pnav->m_osdPages[m_pnav->ActivePageId()]->selectedObject) RFREE(m_pnav->m_osdPages[m_pnav->ActivePageId()]->selectedObject); m_pnav->m_osdPages[m_pnav->ActivePageId()]->selectedObject = STRDUP(m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex]->name); return m_pnav->DisplayList(listIndex, TRUE, TRUE); //return RM_OK;}RMstatus RMcuracaoGui::ShowListShortcut(RMuint32 listId, RMuint8 bRet){ if (!m_initialized) { RMDBGLOG((GUIDBG, "GUI not initialised !!\n")); return RM_ERROR; } RMuint16 listIndex; RMuint16 currentSelectedList; m_pnav->GetObjectIndex(m_pnav->SelectedObjectId(), ¤tSelectedList); m_pnav->GetObjectIndex(listId, &listIndex); if (m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex]->nbItems == 0) return RM_ERROR; // if(m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex]->object.dynamic) // { // HTTPFile* f; // // f = fetchOpen(m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex]->object.url, RM_HTTP_VERBOSE); // { // RMuint8 buffer[8192]; // RMint16 n = fetchRead(buffer, 8192, f); // buffer[n] = '\0'; // printf("%s\n", (RMascii*) buffer); // guiListType* list = NULL;// = m_osdPages[pageId] // m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex] = m_pnav->m_parser->ParseWEBList(&list, m_pnav->ActivePageId(), listId, listIndex, buffer, n); // } // fetchClose(f); // } //gfxHideList(m_pRua, &m_pnav->m_osdPages[m_pnav->ActivePageId()]->object, &m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[currentSelectedList]->object); //if (bRet == FALSE) { m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex]->object.selecteditem = bRet; m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex]->object.previouslyselecteditem = 0; m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex]->object.firstvisible = 0; m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex]->object.lastvisible = 0; } if(currentSelectedList != listIndex) m_pnav->MorphLists(currentSelectedList, listIndex); m_pnav->SelectObject(listId); if (m_pnav->m_osdPages[m_pnav->ActivePageId()]->selectedObject) RFREE(m_pnav->m_osdPages[m_pnav->ActivePageId()]->selectedObject); m_pnav->m_osdPages[m_pnav->ActivePageId()]->selectedObject = STRDUP(m_pnav->m_osdPages[m_pnav->ActivePageId()]->lists[listIndex]->name); return m_pnav->DisplayList(listIndex, TRUE, TRUE); //return RM_OK;}// this function displays the page primitive with pre and post processing// all pages should be displayed through it rather than calling DisplayPage directlyRMstatus RMcuracaoGui::ShowPage(RMuint32 pageId){ if (!m_initialized) { RMDBGLOG((GUIDBG, "GUI not initialised !!\n")); return RM_ERROR; } // if setup page is going down,save player settings if (m_pnav->ActivePageId() == m_pnav->SetupPageId()) { // hack, setup page id taken by another page in wmvhd // so this shouldn't apply if (m_pnav->WMVHDOn() == FALSE) SavePlayerSettings(); m_scrollOn = FALSE; } SetfipStopMode(); return m_pnav->DisplayPage(pageId);}// this function displays the popup primitive with pre and post processing// all popups should be displayed through it rather than calling DisplayPopup directlyRMstatus RMcuracaoGui::ShowPopup(RMuint32 popupId, RMbool bshow, guiPopupType *popup/*=NULL*/){ RMstatus status; status = m_pnav->DisplayPopup(popupId, bshow, popup); if (bshow == FALSE) { SetfipStopMode(); m_scrollOn = FALSE; fipWriteScrollText(m_fipOldText); } return status;}RMstatus RMcuracaoGui::ShowPopup(RMascii *name){ RMstatus status; RMuint32 id; status = m_pnav->GetObjectIdByName(name, &id); if (RMFAILED(status)) return RM_ERROR; return ShowPopup(id, TRUE);}RMstatus RMcuracaoGui::ShowPopup(RMascii *name, RMuint32 timeoutsecs){ RMstatus status; RMuint32 id; status = m_pnav->GetObjectIdByName(name, &id); if (RMFAILED(status)) return RM_ERROR; if (RMSUCCEEDED(ShowPopup(id, TRUE))) { if (timeoutsecs == 0) return RM_ERROR; SetTimer(TIMER_REMOVEPOPUP, timeoutsecs * 10); m_pnav->SetTimedPopup(id); } return status;}RMstatus RMcuracaoGui::RemovePopup(RMascii *name){ RMstatus status; RMuint32 id; status = m_pnav->GetObjectIdByName(name, &id); if (RMFAILED(status)) return RM_ERROR; return ShowPopup(id, FALSE);}RMstatus RMcuracaoGui::DisplayMainPage(){ if (m_pnav == NULL) return RM_ERROR; return ShowPage(m_pnav->MainPageId());}RMstatus RMcuracaoGui::RestoreOsd(RMbool forceMainPage){ RMuint32 pageId; RMDBGLOG((GUIDBG, "RestoreOsd()\n")); // make sure we deselect current object without // drawing it since it cannot be drawn before the page m_pnav->SetCurrentObjectDeSelectedAttribute(); pageId = (forceMainPage ? m_pnav->MainPageId() : m_pnav->ActivePageId()); return ShowPage(pageId);}RMstatus RMcuracaoGui::BeginWaitCursor(){ RMEnterCriticalSection(m_csBlocked); m_blocked = TRUE; printf("begin wait cursor\n"); RMLeaveCriticalSection(m_csBlocked); return SetTimer(TIMER_LOAD_ANIMATION, 1);}RMstatus RMcuracaoGui::EndWaitCursor(){ RMbool redraw = FALSE;// if (!m_bTV && (m_playMode != STATE_STOP) && (m_playMode != STATE_CLOSE))// showPage = TRUE;// return m_pnav->RemoveWaitCursor(showPage); RMEnterCriticalSection(m_csBlocked); if(m_blocked) { m_blocked = FALSE; redraw = TRUE; } RMLeaveCriticalSection(m_csBlocked); printf("end wait cursor\n"); if(redraw) return KillTimer(TIMER_LOAD_ANIMATION, FALSE); return RM_OK;}RMbool RMcuracaoGui::BlockedKEY(){// RMEnterCriticalSection(m_csBlocked);// RMbool b = m_blocked; //RMLeaveCriticalSection(m_csBlocked); printf("blocked %d\n",m_blocked); return m_blocked;}RMstatus RMcuracaoGui::RestoreNonTimedEvent(){ // step, ff, sf, fr, etc // if(m_playMode == STATE_PAUSE) // m_pnav->DisplayEvent(PAUSE_EVENT, TRUE, TIMER_NONE, m_eventText, PAUSE_STR, DISPLAY_TEXT_ON_EVENT_ARG, 8, 180, 40); if (m_muteOn) m_pnav->DisplayEvent(MUTE_EVENT, TRUE, TIMER_NONE, m_eventText, MUTE_STR, DISPLAY_TEXT_ON_EVENT_ARG, 8, 180, 40); return RM_OK;}RMstatus RMcuracaoGui::ReenableDisplay(){ return SetTVOut(m_videoOut);}RMstatus RMcuracaoGui::CheckPinChanbermade(RMascii* link){ RMstatus status = RM_ERROR; RMascii* where = RMCatAscii(m_pnav->m_parser->GetUrl(), link, "checkpin=1", NULL); HTTPFile* f; f = fetchOpen(where, (RMHTTPFlags)(RM_HTTP_VERBOSE)); if (f) { RMuint8 buffer[32]; if (buffer) { RMint16 n = fetchRead(buffer, 32, f); if(n != -1) { buffer[n] = '\0'; printf("%s\n %d bytes read\n", (RMascii*) buffer, n); RMuint32 id; m_pnav->GetObjectIdByName((RMascii*)buffer, &id); if (ISPOPUP(id)) { ShowPopup(id, TRUE); } status = RM_OK; } else status = RM_ERROR; } else status = RM_ERROR; fetchClose(f); } RFREE(where); return RM_OK;}RMstatus RMcuracaoGui::SetChambermaid(){ RMstatus status; RMascii* passws[3]; guiPopupType popup; RMuint8 j = 0; if (!m_initialized) { RMDBGLOG((GUIDBG, "GUI not initialised !!\n")); return RM_ERROR; } if (!ISPOPUP(m_pnav->SelectedObjectId())) return RM_ERROR; status = m_pnav->GetPopup(m_pnav->SelectedObjectId(), &popup); if (RMFAILED(status)) return status; for (RMuint8 i = 0; i < popup.nbStrings; i++) { if (popup.strings[i]->object.type == STRING_PASSWORD) { passws[j] = popup.strings[i]->object.text; j++; //RMCopyAscii(passws, popup.strings[i]->object.text); //break; } } { RMascii *where; if(j) where = RMCatAscii(m_pnav->m_parser->GetUrl(), m_pnav->GetCommandLink(m_pnav->SelectedObjectId(), ACTIVATE_EVENT), "newPinCode=", passws[0], NULL); else where = RMCatAscii(m_pnav->m_parser->GetUrl(), m_pnav->GetCommandLink(m_pnav->SelectedObjectId(), ACTIVATE_EVENT), "newPinCode=", NULL); ShowPopup(m_pnav->SelectedObjectId(), FALSE); HTTPFile* f; f = fetchOpen(where, RM_HTTP_VERBOSE); if (f) { RMuint8 buffer[32]; if (buffer) { RMint16 n = fetchRead(buffer, 32, f); if(n != -1) { buffer[n] = '\0'; printf("%s\n %d bytes read\n", (RMascii*) buffer, n);// if (RMCompareAscii((RMascii*) buffer, "401")) { RMuint32 id; m_pnav->GetObjectIdByName((RMascii*)buffer, &id); if (ISPOPUP(id)) { ShowPopup(id, TRUE); } status = RM_OK; }// if (RMCompareAscii((RMascii*) buffer, "404"))// {// // RMascii popup[] = ;// RMuint32 id;// m_pnav->GetObjectIdByName("NoServicePopup", &id);// if (ISPOPUP(id))// {// ShowPopup(id, TRUE);// }//// status = RM_OK;// } // guiListType* list = m_osdPages[m_pnav->ActivePageId()]->lists; // guiListType* list = m_parser->ParseWEBList(m_osdPages, m_activePageId, buffer, n); // if(list) // status = GetObjectIdByName(list->name, &cmdInfo->linkId); // RFREE(buffer); //status = RM_OK; } else status = RM_ERROR; } else status = RM_ERROR; fetchClose(f); } else status = RM_ERROR; RFREE(where); where = NULL; } return status;}RMstatus RMcuracaoGui::InsertPIN(RMbool checkPass){ RMstatus status; RMascii* passws[3]; guiPopupType popup; if (!m_initialized) { RMDBGLOG((GUIDBG, "GUI not initialised !!\n")); return RM_ERROR; } if (!ISPOPUP(m_pnav->SelectedObjectId())) return RM_ERROR; status = m_pnav->GetPopup(m_pnav->SelectedObjectId(), &popup); if (RMFAILED(status)) return status; if (checkPass) { RMuint8 j = 0; for (RMuint8 i = 0; i < popup.nbStrings; i++) { if (popup.strings[i]->object.type == STRING_PASSWORD) { passws[j] = popup.strings[i]->object.text; j++; //RMCopyAscii(passws, popup.strings[i]->object.text); //break; } } } if (!RMCompareAscii(passws[1], passws[2])) { RMuint32 id; ShowPopup(m_pnav->SelectedObjectId(), FALSE); m_pnav->GetObjectIdByName("WrongPinPopup", &id); if (ISPOPUP(id)) { ShowPopup(id, TRUE); } status = RM_OK; } else { RMascii *where; if(passws[0][0] != '#') where = RMCatAscii(m_pnav->m_parser->GetUrl(), m_pnav->GetCommandLink(m_pnav->SelectedObjectId(), ACTIVATE_EVENT), "oldpin=", passws[0], "&newpin=", passws[1], NULL); else where = RMCatAscii(m_pnav->m_parser->GetUrl(), m_pnav->GetCommandLink(m_pnav->SelectedObjectId(), ACTIVATE_EVENT), "newpin=", passws[1], NULL); ShowPopup(m_pnav->SelectedObjectId(), FALSE); HTTPFile* f; f = fetchOpen(where, RM_HTTP_VERBOSE); if (f) { RMuint8 buffer[32]; if (buffer) { RMint16 n = fetchRead(buffer, 32, f); if(n != -1) { buffer[n] = '\0'; printf("%s\n %d bytes read\n", (RMascii*) buffer, n); //if (RMCompareAscii((RMascii*) buffer, "401")) { RMuint32 id; m_pnav->GetObjectIdByName((RMascii*)buffer, &id); if (ISPOPUP(id)) { ShowPopup(id, TRUE); } status = RM_OK; }// if (RMCompareAscii((RMascii*) buffer, "404"))// {// // RMascii popup[] = ;// RMuint32 id;// m_pnav->GetObjectIdByName("NoServicePopup", &id);// if (ISPOPUP(id))// {// ShowPopup(id, TRUE);// }//// status = RM_OK;// } // guiListType* list = m_osdPages[m_pnav->ActivePageId()]->lists; // guiListType* list = m_parser->ParseWEBList(m_osdPages, m_activePageId, buffer, n); // if(list) // status = GetObjectIdByName(list->name, &cmdInfo->linkId); // RFREE(buffer); // status = RM_OK; } else status = RM_ERROR; } else status = RM_ERROR; fetchClose(f); } else
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -