2 * Copyright (C) 2005-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 #include "GUIDialogPictureInfo.h"
22 #include "GUIInfoManager.h"
23 #include "guilib/GUIWindowManager.h"
25 #include "guilib/LocalizeStrings.h"
26 #include "PictureInfoTag.h"
28 #define CONTROL_PICTURE_INFO 5
30 #define SLIDE_STRING_BASE 21800 - SLIDE_INFO_START
32 CGUIDialogPictureInfo::CGUIDialogPictureInfo(void)
33 : CGUIDialog(WINDOW_DIALOG_PICTURE_INFO, "DialogPictureInfo.xml")
35 m_pictureInfo = new CFileItemList;
36 m_loadType = KEEP_IN_MEMORY;
39 CGUIDialogPictureInfo::~CGUIDialogPictureInfo(void)
44 void CGUIDialogPictureInfo::SetPicture(CFileItem *item)
46 g_infoManager.SetCurrentSlide(*item);
49 void CGUIDialogPictureInfo::OnInitWindow()
52 CGUIDialog::OnInitWindow();
55 bool CGUIDialogPictureInfo::OnAction(const CAction& action)
57 switch (action.GetID())
59 // if we're running from slideshow mode, drop the "next picture" and "previous picture" actions through.
60 case ACTION_NEXT_PICTURE:
61 case ACTION_PREV_PICTURE:
62 case ACTION_PLAYER_PLAY:
64 if (g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW)
66 CGUIWindow* pWindow = g_windowManager.GetWindow(WINDOW_SLIDESHOW);
67 return pWindow->OnAction(action);
71 case ACTION_SHOW_INFO:
75 return CGUIDialog::OnAction(action);
78 void CGUIDialogPictureInfo::FrameMove()
80 if (g_infoManager.GetCurrentSlide().GetPath() != m_currentPicture)
83 m_currentPicture = g_infoManager.GetCurrentSlide().GetPath();
85 CGUIDialog::FrameMove();
88 void CGUIDialogPictureInfo::UpdatePictureInfo()
90 // add stuff from the current slide to the list
91 CGUIMessage msgReset(GUI_MSG_LABEL_RESET, GetID(), CONTROL_PICTURE_INFO);
93 m_pictureInfo->Clear();
94 for (int info = SLIDE_INFO_START; info <= SLIDE_INFO_END; ++info)
96 // we don't need want to add both SLIDE_EXIF_DATE_TIME and SLIDE_EXIF_DATE
97 // so we skip one without time
98 if (info == SLIDE_EXIF_DATE)
101 CStdString picInfo = g_infoManager.GetLabel(info);
102 if (!picInfo.IsEmpty())
104 CFileItemPtr item(new CFileItem(g_localizeStrings.Get(SLIDE_STRING_BASE + info)));
105 item->SetLabel2(picInfo);
106 m_pictureInfo->Add(item);
109 CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_PICTURE_INFO, 0, 0, m_pictureInfo);
113 void CGUIDialogPictureInfo::OnDeinitWindow(int nextWindowID)
115 CGUIDialog::OnDeinitWindow(nextWindowID);
116 CGUIMessage msgReset(GUI_MSG_LABEL_RESET, GetID(), CONTROL_PICTURE_INFO);
118 m_pictureInfo->Clear();
119 m_currentPicture.Empty();