From 3bb1c162515089e5f20300029095edef2c1a2387 Mon Sep 17 00:00:00 2001 From: chriszero Date: Sat, 23 May 2015 20:24:17 +0200 Subject: More error handling if plexserver is gone or not availiable. --- browserGrid.cpp | 2 ++ plexSdOsd.cpp | 16 ++++++++++++++++ viewGridNavigator.cpp | 8 ++++---- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/browserGrid.cpp b/browserGrid.cpp index 7d4c8fb..9422eec 100644 --- a/browserGrid.cpp +++ b/browserGrid.cpp @@ -202,6 +202,7 @@ void cBrowserGrid::ProcessData() eOSState cBrowserGrid::NavigateSelect() { + if(m_setIterator) return eOSState::osContinue;; plexclient::Directory* dir = dynamic_cast(SelectedObject()); if(dir) { m_pContainer = m_pService->GetSection(dir->m_sKey); @@ -222,6 +223,7 @@ eOSState cBrowserGrid::NavigateSelect() eOSState cBrowserGrid::NavigateBack() { + if(m_setIterator) return eOSState::osContinue;; std::shared_ptr pCont = NULL; if(m_pService) { pCont = m_pService->GetLastSection(); diff --git a/plexSdOsd.cpp b/plexSdOsd.cpp index ac0c26a..1c25fed 100644 --- a/plexSdOsd.cpp +++ b/plexSdOsd.cpp @@ -69,6 +69,22 @@ eOSState cPlexSdOsd::ProcessKey(eKeys Key) if (m_pBrowserGrid->DrawTime()) m_pBrowserGrid->Flush(); + //check if some plexservers are online + if(plexclient::plexgdm::GetInstance().GetFirstServer() == NULL || + (plexclient::plexgdm::GetInstance().GetFirstServer() && plexclient::plexgdm::GetInstance().GetFirstServer()->Offline) + ) { + DrawMessage(std::string(tr("No Plex Media Server found."))); + + switch (Key & ~k_Repeat) { + case kOk: + case kBack: + return eOSState::osEnd; + break; + default: + return eOSState::osContinue; + } + } + if(m_messageDisplayed) { vid = dynamic_cast(m_pBrowserGrid->SelectedObject()); switch (Key & ~k_Repeat) { diff --git a/viewGridNavigator.cpp b/viewGridNavigator.cpp index f8d71c9..83c86e3 100644 --- a/viewGridNavigator.cpp +++ b/viewGridNavigator.cpp @@ -152,7 +152,7 @@ void cViewGridNavigator::SetGridDimensions(int rows, int columns) bool cViewGridNavigator::NavigateDown() { - if (m_activeElementIter == m_vElements.end() - 1) return false; + if (m_setIterator || m_activeElementIter == m_vElements.end() - 1) return false; auto next = m_activeElementIter + m_columns; if(next >= m_vElements.end()) next = m_vElements.end()-1; @@ -169,7 +169,7 @@ bool cViewGridNavigator::NavigateDown() bool cViewGridNavigator::NavigateUp() { - if (m_activeElementIter == m_vElements.begin()) return false; + if (m_setIterator || m_activeElementIter == m_vElements.begin()) return false; auto next = m_activeElementIter - m_columns; if(next < m_vElements.begin()) next = m_vElements.begin(); @@ -186,7 +186,7 @@ bool cViewGridNavigator::NavigateUp() bool cViewGridNavigator::NavigateLeft() { - if (m_activeElementIter == m_vElements.begin()) return false; + if (m_setIterator || m_activeElementIter == m_vElements.begin()) return false; auto next = m_activeElementIter - 1; if(next < m_vElements.begin()) next = m_vElements.begin(); @@ -204,7 +204,7 @@ bool cViewGridNavigator::NavigateLeft() bool cViewGridNavigator::NavigateRight() { - if (m_activeElementIter == m_vElements.end() - 1) return false; + if (m_setIterator || m_activeElementIter == m_vElements.end() - 1) return false; auto next = m_activeElementIter + 1; if(next >= m_vElements.end()) next = m_vElements.end()-1; -- cgit v1.2.3