diff options
author | chriszero <zerov83@gmail.com> | 2015-04-05 13:31:04 +0200 |
---|---|---|
committer | chriszero <zerov83@gmail.com> | 2015-04-05 13:31:04 +0200 |
commit | f7f62b7ff1f12c1563a04560ad87d2f92a3e0af9 (patch) | |
tree | 4dd38d637ad2d5427c93a8d8d695e91c11df33d4 /plexSdOsd.cpp | |
parent | 21ee9e67ff7029c099c9fd772d3dc3e23c955199 (diff) | |
download | vdr-plugin-plex-f7f62b7ff1f12c1563a04560ad87d2f92a3e0af9.tar.gz vdr-plugin-plex-f7f62b7ff1f12c1563a04560ad87d2f92a3e0af9.tar.bz2 |
More Skindesigner support.
Define a custom server
Diffstat (limited to 'plexSdOsd.cpp')
-rw-r--r-- | plexSdOsd.cpp | 125 |
1 files changed, 6 insertions, 119 deletions
diff --git a/plexSdOsd.cpp b/plexSdOsd.cpp index 843eafa..0379dd7 100644 --- a/plexSdOsd.cpp +++ b/plexSdOsd.cpp @@ -21,43 +21,16 @@ void cPlexSdOsd::Show(void) esyslog("[plex]: used skindesigner skin does not support plex"); return; } - m_pBackground = std::shared_ptr<cViewElement>(m_pRootView->GetViewElement(eViewElementsRoot::verBackground)); - - m_pViewHeader = std::shared_ptr<cViewHeader>( - new cViewHeader(m_pRootView->GetViewElement(eViewElementsRoot::verHeader)) - ); - m_pfooter = std::shared_ptr<cViewElement>(m_pRootView->GetViewElement(eViewElementsRoot::verFooter)); - - SwitchGrid(m_pViewHeader->CurrentTab()); - + + m_pBrowserGrid = std::shared_ptr<cBrowserGrid>(new cBrowserGrid(m_pRootView)); + m_pBrowserGrid->SwitchGrid(ePlexMenuTab::pmtOnDeck); Flush(); } void cPlexSdOsd::Flush() { - cMutexLock MutexLock(&cPlexSdOsd::RedrawMutex); - DrawBackground(); - m_pViewHeader->Draw(m_pBrowserGrid->SelectedObject()); - - m_pBackground->Display(); - + m_pBrowserGrid->DrawGrid(); m_pBrowserGrid->Flush(); - - m_pRootView->Display(); -} - -void cPlexSdOsd::DrawBackground() -{ - m_pBackground->ClearTokens(); - - if(auto video = dynamic_cast<plexclient::Video*>(m_pBrowserGrid->SelectedObject()) ) { - bool cached = false; - std::string path = cPictureCache::GetInstance().GetPath(video->ArtUri(), 1920, 1080, cached); - m_pBackground->AddStringToken("selecteditembackground", path); - } - - m_pBackground->AddIntToken("isdirectory", 1); - m_pBackground->AddStringToken("currentdirectorybackground", "/path"); } eOSState cPlexSdOsd::ProcessKey(eKeys Key) @@ -92,12 +65,12 @@ eOSState cPlexSdOsd::ProcessKey(eKeys Key) break; case kRed: // Prev Tab - SwitchGrid(m_pViewHeader->NextTab()); + //SwitchGrid(m_pViewHeader->NextTab()); Flush(); break; case kGreen: // Next Tab - SwitchGrid(m_pViewHeader->PrevTab()); + //SwitchGrid(m_pViewHeader->PrevTab()); Flush(); break; default: @@ -105,89 +78,3 @@ eOSState cPlexSdOsd::ProcessKey(eKeys Key) } return state; } - -void cPlexSdOsd::SwitchGrid(ePlexMenuTab currentTab) -{ - if(currentTab == ePlexMenuTab::pmtOnDeck) { - auto service = std::shared_ptr<plexclient::Plexservice>(new plexclient::Plexservice( plexclient::plexgdm::GetInstance().GetServer("192.168.1.175", 32400), "/hubs/home/onDeck" ) ); - m_pBrowserGrid = std::shared_ptr<cBrowserGrid>( - new cBrowserGrid( m_pRootView->GetViewGrid(eViewGrids::vgBrowser), service) - ); - m_pBrowserGrid->m_pRootView = m_pRootView; - - } else if(currentTab == ePlexMenuTab::pmtRecentlyAdded) { - auto service = std::shared_ptr<plexclient::Plexservice>(new plexclient::Plexservice( plexclient::plexgdm::GetInstance().GetServer("192.168.1.175", 32400), "/library/sections" ) ); - m_pBrowserGrid = std::shared_ptr<cBrowserGrid>( - new cBrowserGrid( m_pRootView->GetViewGrid(eViewGrids::vgBrowser), service) - ); - m_pBrowserGrid->m_pRootView = m_pRootView; - - } else if(currentTab == ePlexMenuTab::pmtLibrary) { - - m_pBrowserGrid = std::shared_ptr<cBrowserGrid>( - new cBrowserGrid( m_pRootView->GetViewGrid(eViewGrids::vgBrowser)) - ); - m_pBrowserGrid->m_pRootView = m_pRootView; - } -} - -void cPlexSdOsd::DrawFooter() -{ - //if (!active) - // return; - - string textGreen = tr("Prev. Tab"); - string textYellow = tr("Next Tab"); - string textRed = ""; - string textBlue = ""; - - if(auto vid = dynamic_cast<plexclient::Video*>(m_pBrowserGrid->SelectedObject()) ) { - if(vid->m_iViewCount > 0) textRed = tr("Unscrobble"); - else textRed = tr("Scrobble"); - textBlue = tr("Info"); - } - - - int colorKeys[4] = { Setup.ColorKey0, Setup.ColorKey1, Setup.ColorKey2, Setup.ColorKey3 }; - - m_pfooter->Clear(); - m_pfooter->ClearTokens(); - - m_pfooter->AddStringToken("red", textRed); - m_pfooter->AddStringToken("green", textGreen); - m_pfooter->AddStringToken("yellow", textYellow); - m_pfooter->AddStringToken("blue", textBlue); - - for (int button = 1; button < 5; button++) { - string red = *cString::sprintf("red%d", button); - string green = *cString::sprintf("green%d", button); - string yellow = *cString::sprintf("yellow%d", button); - string blue = *cString::sprintf("blue%d", button); - bool isRed = false; - bool isGreen = false; - bool isYellow = false; - bool isBlue = false; - switch (colorKeys[button-1]) { - case 0: - isRed = true; - break; - case 1: - isGreen = true; - break; - case 2: - isYellow = true; - break; - case 3: - isBlue = true; - break; - default: - break; - } - m_pfooter->AddIntToken(red, isRed); - m_pfooter->AddIntToken(green, isGreen); - m_pfooter->AddIntToken(yellow, isYellow); - m_pfooter->AddIntToken(blue, isBlue); - } - - m_pfooter->Display(); -} |