diff options
author | Christian <zerov83@gmail.com> | 2016-03-09 21:24:36 +0100 |
---|---|---|
committer | Christian <zerov83@gmail.com> | 2016-03-09 21:24:36 +0100 |
commit | 0049f41e432de2018bc1111b0e3fc0c5920ab7e8 (patch) | |
tree | 2ece5e38ec9ba7d7cb9ee58887b30c2de866ea85 | |
parent | 36e3c6837bb338faf61fffd6888bdca2354a1bbc (diff) | |
download | vdr-plugin-plex-0049f41e432de2018bc1111b0e3fc0c5920ab7e8.tar.gz vdr-plugin-plex-0049f41e432de2018bc1111b0e3fc0c5920ab7e8.tar.bz2 |
Fixes for DetailView
-rw-r--r-- | PVideo.cpp | 1 | ||||
-rw-r--r-- | detailView.cpp | 17 | ||||
-rw-r--r-- | detailView.h | 2 | ||||
-rw-r--r-- | plexSdOsd.cpp | 134 | ||||
-rw-r--r-- | plexSdOsd.h | 4 | ||||
-rw-r--r-- | po/de_DE.po | 17 | ||||
-rw-r--r-- | viewGridNavigator.h | 2 |
7 files changed, 95 insertions, 82 deletions
@@ -55,6 +55,7 @@ bool Video::UpdateFromServer() while(pNode) { if(Poco::icompare(pNode->nodeName(), "Video") == 0) { Parse(pNode); + break; } pNode = it.nextNode(); diff --git a/detailView.cpp b/detailView.cpp index ef84179..6f9880a 100644 --- a/detailView.cpp +++ b/detailView.cpp @@ -27,6 +27,8 @@ void cDetailView::Flush() m_pfooter->Display(); m_pGrid->Display(); m_pScrollbar->Display(); + + m_pRootView->Display(); } void cDetailView::Draw() @@ -76,16 +78,13 @@ void cDetailView::DrawBackground() void cDetailView::DrawFooter() { - string textGreen = ""; + string textRed = tr("Play"); + string textGreen = tr("Rewind"); string textYellow = ""; - string textRed = ""; - string textBlue = "Play"; - - if(auto vid = dynamic_cast<plexclient::Video*>(SelectedObject()) ) { - if(vid->m_iViewCount > 0) textRed = tr("Unscrobble"); - else textRed = tr("Scrobble"); - } + string textBlue = ""; + if(m_pVideo->m_iViewCount > 0) textYellow = tr("Unscrobble"); + else textYellow = tr("Scrobble"); int colorKeys[4] = { Setup.ColorKey0, Setup.ColorKey1, Setup.ColorKey2, Setup.ColorKey3 }; @@ -167,6 +166,6 @@ eOSState cDetailView::NavigateSelect() eOSState cDetailView::NavigateBack() { - if(m_setIterator) return eOSState::osContinue;; + if(m_setIterator) return eOSState::osContinue; return eOSState::osBack; } diff --git a/detailView.h b/detailView.h index cc5f156..38cbdba 100644 --- a/detailView.h +++ b/detailView.h @@ -14,7 +14,7 @@ public: cDetailView(std::shared_ptr<skindesignerapi::cOsdView> detailView, plexclient::Video *video); void Draw(); - void Flush(); + virtual void Flush(); virtual eOSState NavigateSelect(); virtual eOSState NavigateBack(); plexclient::Video* GetVideo() { return m_pVideo; }; diff --git a/plexSdOsd.cpp b/plexSdOsd.cpp index 1515ccd..5eadc9a 100644 --- a/plexSdOsd.cpp +++ b/plexSdOsd.cpp @@ -69,43 +69,38 @@ void cPlexSdOsd::Flush() eOSState cPlexSdOsd::ProcessKey(eKeys Key) { eOSState state = eOSState::osContinue; - plexclient::Video* vid = NULL; - - 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_detailsActive) { + state = ProcessKeyDetailView(Key); + } else { + //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_pBrowserGrid->DrawTime()) m_pBrowserGrid->Flush(); + state = ProcessKeyBrowserView(Key); } + + return state; +} - if(m_messageDisplayed) { - vid = dynamic_cast<plexclient::Video*>(m_pBrowserGrid->SelectedObject()); - switch (Key & ~k_Repeat) { - case kOk: - vid->m_iMyPlayOffset = vid->m_lViewoffset/1000; - m_messageDisplayed = false; - state = eOSState::osUser1; - break; - case kBack: - vid->m_lViewoffset = 0; - state = eOSState::osUser1; - default: - break; - } - } else if(m_detailsActive) { - switch (Key & ~k_Repeat) { + +eOSState cPlexSdOsd::ProcessKeyDetailView(eKeys Key) +{ + eOSState state = eOSState::osContinue; + plexclient::Video* vid = NULL; + + switch (Key & ~k_Repeat) { case kUp: if(m_pDetailGrid->NavigateUp()) Flush(); break; @@ -120,37 +115,55 @@ eOSState cPlexSdOsd::ProcessKey(eKeys Key) break; case kOk: state = m_pDetailGrid->NavigateSelect(); + vid = dynamic_cast<plexclient::Video*>(m_pDetailGrid->SelectedObject()); Flush(); break; case kBack: - state = m_pDetailGrid->NavigateBack(); + state = eOSState::osContinue; m_pDetailGrid->Clear(); m_pDetailsView->Deactivate(true); m_pDetailGrid = nullptr; m_pDetailsView = nullptr; m_detailsActive = false; m_pRootView->Activate(); + Flush(); break; - case kBlue: - vid = m_pDetailGrid->GetVideo(); - state = eOSState::osUser1; + case kYellow: + if(m_pDetailGrid->GetVideo()) { + if(m_pDetailGrid->GetVideo()->m_iViewCount > 0) m_pDetailGrid->GetVideo()->SetUnwatched(); + else m_pDetailGrid->GetVideo()->SetWatched(); + m_pDetailGrid->GetVideo()->UpdateFromServer(); + Flush(); + } break; + case kGreen: + vid = m_pDetailGrid->GetVideo(); + state = eOSState::osUser1; + break; case kRed: - if(m_pDetailGrid->GetVideo()) { - if(m_pDetailGrid->GetVideo()->m_iViewCount > 0) m_pDetailGrid->GetVideo()->SetUnwatched(); - else m_pDetailGrid->GetVideo()->SetWatched(); - m_pDetailGrid->GetVideo()->UpdateFromServer(); - Flush(); - } + vid = m_pDetailGrid->GetVideo(); + vid->m_iMyPlayOffset = vid->m_lViewoffset/1000; + state = eOSState::osUser1; break; - case kGreen: - case kYellow: + case kBlue: default: break; - } - } else { + } + + if(state == eOSState::osUser1 && vid) { + cMyPlugin::PlayFile(*vid); + state = eOSState::osEnd; + } + + return state; +} - switch (Key & ~k_Repeat) { +eOSState cPlexSdOsd::ProcessKeyBrowserView(eKeys Key) +{ + eOSState state = eOSState::osContinue; + plexclient::Video* vid = NULL; + + switch (Key & ~k_Repeat) { case kUp: if(m_pBrowserGrid->NavigateUp()) Flush(); break; @@ -168,6 +181,7 @@ eOSState cPlexSdOsd::ProcessKey(eKeys Key) state = m_pBrowserGrid->NavigateSelect(); if(state == eOSState::osUser1) { vid = dynamic_cast<plexclient::Video*>(m_pBrowserGrid->SelectedObject()); + vid->m_iMyPlayOffset = vid->m_lViewoffset/1000; } Flush(); break; @@ -193,7 +207,6 @@ eOSState cPlexSdOsd::ProcessKey(eKeys Key) if(vid) { vid->UpdateFromServer(); ShowDetails(vid); - //Flush(); } break; case kYellow: @@ -202,20 +215,13 @@ eOSState cPlexSdOsd::ProcessKey(eKeys Key) break; default: break; - } - } - - if(state == eOSState::osUser1) { - if(vid->m_iMyPlayOffset == 0 && vid->m_lViewoffset > 0 ) { - cString message = cString::sprintf(tr("'Ok' to start from %ld minutes, 'Back' to start from beginning."), vid->m_lViewoffset / 60000); - DrawMessage(std::string(message)); - m_messageDisplayed = true; - } else { - cMyPlugin::PlayFile(*vid); - state = eOSState::osEnd; - } + + if(state == eOSState::osUser1 && vid) { + cMyPlugin::PlayFile(*vid); + state = eOSState::osEnd; } + return state; } @@ -227,10 +233,10 @@ void cPlexSdOsd::ShowDetails(plexclient::Video *vid) m_pDetailsView = std::shared_ptr<skindesignerapi::cOsdView>(GetOsdView((int)eViews::detailView)); m_pDetailGrid = std::shared_ptr<cDetailView>(new cDetailView(m_pDetailsView, vid)); + m_pDetailsView->Activate(); m_pDetailGrid->Draw(); - m_pDetailGrid->Flush(); + m_pDetailGrid->Flush(); m_detailsActive = true; - } void cPlexSdOsd::DrawMessage(std::string message) @@ -406,4 +412,4 @@ void cPlexSdOsd::DefineDetailsTokens(eViewElementsDetail ve, skindesignerapi::cT default: break; } -}
\ No newline at end of file +} diff --git a/plexSdOsd.h b/plexSdOsd.h index 73c7885..fe1b69b 100644 --- a/plexSdOsd.h +++ b/plexSdOsd.h @@ -46,7 +46,9 @@ public: cPlexSdOsd(skindesignerapi::cPluginStructure *plugStruct); ~cPlexSdOsd(); virtual void Show(void); - virtual eOSState ProcessKey(eKeys Key); + virtual eOSState ProcessKey(eKeys Key); + eOSState ProcessKeyDetailView(eKeys Key); + eOSState ProcessKeyBrowserView(eKeys Key); bool SdSupport(); static cMutex RedrawMutex; diff --git a/po/de_DE.po b/po/de_DE.po index c80f352..c48775b 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: vdr-plex 0.1.0\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2016-02-13 20:52+0100\n" -"PO-Revision-Date: 2016-01-14 20:20+0200\n" +"POT-Creation-Date: 2016-03-09 21:22+0100\n" +"PO-Revision-Date: 2016-03-09 21:24+0200\n" "Last-Translator: Chris <zerov83@gmail.com>\n" "Language-Team: chriszero\n" "Language: de\n" @@ -100,6 +100,12 @@ msgstr "Ungesehen" msgid "Scrobble" msgstr "Gesehen" +msgid "Play" +msgstr "Wiedergeben" + +msgid "Rewind" +msgstr "Anfang" + msgid "Skip Back" msgstr "Vorspringen" @@ -140,10 +146,6 @@ msgstr "Durchsuche Plex - %s" msgid "Browse Plex" msgstr "Durchsuche Plex" -#, c-format -msgid "'Ok' to start from %ld minutes, 'Back' to start from beginning." -msgstr "'Ok' um von %ld weiter zu schauen, 'Zurück' um von Beginn an zu starten." - msgid "All Movies" msgstr "Alle Filme" @@ -219,6 +221,9 @@ msgstr "Kürzlich angesehene Folgen" msgid "Recently Viewed Shows" msgstr "Kürzlich angesehene Serien" +#~ msgid "'Ok' to start from %ld minutes, 'Back' to start from beginning." +#~ msgstr "'Ok' um von %ld weiter zu schauen, 'Zurück' um von Beginn an zu starten." + #~ msgid "%s - Video Channels" #~ msgstr "%s - Video Kanäle" diff --git a/viewGridNavigator.h b/viewGridNavigator.h index ea5a3f5..2f6ad7e 100644 --- a/viewGridNavigator.h +++ b/viewGridNavigator.h @@ -55,7 +55,7 @@ protected: public: cViewGridNavigator(std::shared_ptr<skindesignerapi::cOsdView> rootView); void SetGridDimensions(int rows, int columns); - virtual void Flush() { m_pGrid->Display(); }; + virtual void Flush() { m_pGrid->Display(); m_pRootView->Display(); }; virtual void Clear() = 0; virtual bool NavigateLeft(); virtual bool NavigateRight(); |