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/Key.h"
26 #include "guilib/LocalizeStrings.h"
27 #include "PictureInfoTag.h"
29 #define CONTROL_PICTURE_INFO 5
31 #define SLIDE_STRING_BASE 21800 - SLIDE_INFO_START
33 CGUIDialogPictureInfo::CGUIDialogPictureInfo(void)
34 : CGUIDialog(WINDOW_DIALOG_PICTURE_INFO, "DialogPictureInfo.xml")
36 m_pictureInfo = new CFileItemList;
37 m_loadType = KEEP_IN_MEMORY;
40 CGUIDialogPictureInfo::~CGUIDialogPictureInfo(void)
45 void CGUIDialogPictureInfo::SetPicture(CFileItem *item)
47 g_infoManager.SetCurrentSlide(*item);
50 void CGUIDialogPictureInfo::OnInitWindow()
53 CGUIDialog::OnInitWindow();
56 bool CGUIDialogPictureInfo::OnAction(const CAction& action)
58 switch (action.GetID())
60 // if we're running from slideshow mode, drop the "next picture" and "previous picture" actions through.
61 case ACTION_NEXT_PICTURE:
62 case ACTION_PREV_PICTURE:
63 case ACTION_PLAYER_PLAY:
65 if (g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW)
67 CGUIWindow* pWindow = g_windowManager.GetWindow(WINDOW_SLIDESHOW);
68 return pWindow->OnAction(action);
72 case ACTION_SHOW_INFO:
76 return CGUIDialog::OnAction(action);
79 void CGUIDialogPictureInfo::FrameMove()
81 if (g_infoManager.GetCurrentSlide().GetPath() != m_currentPicture)
84 m_currentPicture = g_infoManager.GetCurrentSlide().GetPath();
86 CGUIDialog::FrameMove();
89 void CGUIDialogPictureInfo::UpdatePictureInfo()
91 // add stuff from the current slide to the list
92 CGUIMessage msgReset(GUI_MSG_LABEL_RESET, GetID(), CONTROL_PICTURE_INFO);
94 m_pictureInfo->Clear();
95 for (int info = SLIDE_INFO_START; info <= SLIDE_INFO_END; ++info)
97 // we only want to add SLIDE_EXIF_DATE_TIME
98 // so we skip the other date formats
99 if (info == SLIDE_EXIF_DATE || info == SLIDE_EXIF_LONG_DATE || info == SLIDE_EXIF_LONG_DATE_TIME )
102 CStdString picInfo = g_infoManager.GetLabel(info);
103 if (!picInfo.empty())
105 CFileItemPtr item(new CFileItem(g_localizeStrings.Get(SLIDE_STRING_BASE + info)));
106 item->SetLabel2(picInfo);
107 m_pictureInfo->Add(item);
110 CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_PICTURE_INFO, 0, 0, m_pictureInfo);
114 void CGUIDialogPictureInfo::OnDeinitWindow(int nextWindowID)
116 CGUIDialog::OnDeinitWindow(nextWindowID);
117 CGUIMessage msgReset(GUI_MSG_LABEL_RESET, GetID(), CONTROL_PICTURE_INFO);
119 m_pictureInfo->Clear();
120 m_currentPicture.clear();