diff options
author | AlTheKiller <AlTheKiller@svn> | 2009-09-23 01:49:50 +0000 |
---|---|---|
committer | AlTheKiller <AlTheKiller@svn> | 2009-09-23 01:49:50 +0000 |
commit | 45285e8a9300cd754a760560640b75b09f98035e (patch) | |
tree | ad9f093885ad5c98e9dd4156674e7691c22ed0a2 /xbmc/GUIDialogPictureInfo.cpp |
step 3/4: Move linuxport to trunk. How'd I get roped into this?
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@23097 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'xbmc/GUIDialogPictureInfo.cpp')
-rw-r--r-- | xbmc/GUIDialogPictureInfo.cpp | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/xbmc/GUIDialogPictureInfo.cpp b/xbmc/GUIDialogPictureInfo.cpp new file mode 100644 index 0000000000..ecf17727c5 --- /dev/null +++ b/xbmc/GUIDialogPictureInfo.cpp @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2005-2008 Team XBMC + * http://www.xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#include "GUIDialogPictureInfo.h" +#include "utils/GUIInfoManager.h" +#include "GUIWindowManager.h" +#include "FileItem.h" +#include "LocalizeStrings.h" + +#define CONTROL_PICTURE_INFO 5 + +#define SLIDE_STRING_BASE 21800 - SLIDE_INFO_START + +CGUIDialogPictureInfo::CGUIDialogPictureInfo(void) + : CGUIDialog(WINDOW_DIALOG_PICTURE_INFO, "DialogPictureInfo.xml") +{ + m_pictureInfo = new CFileItemList; +} + +CGUIDialogPictureInfo::~CGUIDialogPictureInfo(void) +{ + delete m_pictureInfo; +} + +void CGUIDialogPictureInfo::SetPicture(CFileItem *item) +{ + g_infoManager.SetCurrentSlide(*item); +} + +void CGUIDialogPictureInfo::OnInitWindow() +{ + CGUIDialog::OnInitWindow(); + UpdatePictureInfo(); +} + +bool CGUIDialogPictureInfo::OnAction(const CAction& action) +{ + switch (action.id) + { + // if we're running from slideshow mode, drop the "next picture" and "previous picture" actions through. + case ACTION_NEXT_PICTURE: + case ACTION_PREV_PICTURE: + case ACTION_PLAYER_PLAY: + case ACTION_PAUSE: + if (m_gWindowManager.GetActiveWindow() == WINDOW_SLIDESHOW) + { + CGUIWindow* pWindow = m_gWindowManager.GetWindow(WINDOW_SLIDESHOW); + return pWindow->OnAction(action); + } + break; + }; + return CGUIDialog::OnAction(action); +} + +void CGUIDialogPictureInfo::Render() +{ + if (g_infoManager.GetCurrentSlide().m_strPath != m_currentPicture) + { + UpdatePictureInfo(); + m_currentPicture = g_infoManager.GetCurrentSlide().m_strPath; + } + CGUIDialog::Render(); +} + +void CGUIDialogPictureInfo::UpdatePictureInfo() +{ + // add stuff from the current slide to the list + CGUIMessage msgReset(GUI_MSG_LABEL_RESET, GetID(), CONTROL_PICTURE_INFO); + OnMessage(msgReset); + m_pictureInfo->Clear(); + for (int info = SLIDE_INFO_START; info <= SLIDE_INFO_END; ++info) + { + CStdString picInfo = g_infoManager.GetLabel(info); + if (!picInfo.IsEmpty()) + { + CFileItemPtr item(new CFileItem(g_localizeStrings.Get(SLIDE_STRING_BASE + info))); + item->SetLabel2(picInfo); + m_pictureInfo->Add(item); + CGUIMessage msg(GUI_MSG_LABEL_ADD, GetID(), CONTROL_PICTURE_INFO, 0, 0, item); + OnMessage(msg); + } + } +} + +void CGUIDialogPictureInfo::OnDeinitWindow(int nextWindowID) +{ + CGUIDialog::OnDeinitWindow(nextWindowID); + CGUIMessage msgReset(GUI_MSG_LABEL_RESET, GetID(), CONTROL_PICTURE_INFO); + OnMessage(msgReset); + m_pictureInfo->Clear(); + m_currentPicture.Empty(); +} |