Skip to content
This repository
Browse code

Merge pull request #2294 from smfontes/14119

Fixes for bug 14119
  • Loading branch information...
commit 406f32d0d2919112e74eedd32049dc38266cfe30 2 parents c1aa24d + fe62d92
ulion authored March 01, 2013
2  xbmc/GUIInfoManager.cpp
@@ -5012,7 +5012,7 @@ void CGUIInfoManager::SetCurrentSlide(CFileItem &item)
5012 5012
 {
5013 5013
   if (m_currentSlide->GetPath() != item.GetPath())
5014 5014
   {
5015  
-    if (!item.HasPictureInfoTag() && !item.GetPictureInfoTag()->Loaded())
  5015
+    if (!item.GetPictureInfoTag()->Loaded()) // If picture metadata has not been loaded yet, load it now
5016 5016
       item.GetPictureInfoTag()->Load(item.GetPath());
5017 5017
     *m_currentSlide = item;
5018 5018
   }
4  xbmc/interfaces/legacy/ListItem.cpp
@@ -442,7 +442,6 @@ namespace XBMCAddon
442 442
       }
443 443
       else if (strcmpi(type,"pictures") == 0)
444 444
       {
445  
-        bool pictureTagLoaded = false;
446 445
         for (Dictionary::const_iterator it = infoLabels.begin(); it != infoLabels.end(); it++)
447 446
         {
448 447
           CStdString key = it->first;
@@ -468,11 +467,8 @@ namespace XBMCAddon
468 467
             if (!exifkey.Left(5).Equals("exif:") || exifkey.length() < 6) continue;
469 468
             int info = CPictureInfoTag::TranslateString(exifkey.Mid(5));
470 469
             item->GetPictureInfoTag()->SetInfo(info, value);
471  
-            pictureTagLoaded = true;
472 470
           }
473 471
         }
474  
-        if (pictureTagLoaded)
475  
-          item->GetPictureInfoTag()->SetLoaded(true);
476 472
       }
477 473
     } // end ListItem::setInfo
478 474
 
14  xbmc/pictures/PictureInfoTag.cpp
@@ -31,6 +31,7 @@ void CPictureInfoTag::Reset()
31 31
   memset(&m_exifInfo, 0, sizeof(m_exifInfo));
32 32
   memset(&m_iptcInfo, 0, sizeof(m_iptcInfo));
33 33
   m_isLoaded = false;
  34
+  m_isInfoSetExternally = false;
34 35
 }
35 36
 
36 37
 const CPictureInfoTag& CPictureInfoTag::operator=(const CPictureInfoTag& right)
@@ -39,6 +40,7 @@ const CPictureInfoTag& CPictureInfoTag::operator=(const CPictureInfoTag& right)
39 40
   memcpy(&m_exifInfo, &right.m_exifInfo, sizeof(m_exifInfo));
40 41
   memcpy(&m_iptcInfo, &right.m_iptcInfo, sizeof(m_iptcInfo));
41 42
   m_isLoaded = right.m_isLoaded;
  43
+  m_isInfoSetExternally = right.m_isInfoSetExternally;
42 44
   return *this;
43 45
 }
44 46
 
@@ -61,6 +63,7 @@ void CPictureInfoTag::Archive(CArchive& ar)
61 63
   if (ar.IsStoring())
62 64
   {
63 65
     ar << m_isLoaded;
  66
+    ar << m_isInfoSetExternally;
64 67
     ar << m_exifInfo.ApertureFNumber;
65 68
     ar << CStdString(m_exifInfo.CameraMake);
66 69
     ar << CStdString(m_exifInfo.CameraModel);
@@ -124,6 +127,7 @@ void CPictureInfoTag::Archive(CArchive& ar)
124 127
   else
125 128
   {
126 129
     ar >> m_isLoaded;
  130
+    ar >> m_isInfoSetExternally;
127 131
     ar >> m_exifInfo.ApertureFNumber;
128 132
     GetStringFromArchive(ar, m_exifInfo.CameraMake, sizeof(m_exifInfo.CameraMake));
129 133
     GetStringFromArchive(ar, m_exifInfo.CameraModel, sizeof(m_exifInfo.CameraModel));
@@ -267,7 +271,7 @@ void CPictureInfoTag::GetStringFromArchive(CArchive &ar, char *string, size_t le
267 271
 
268 272
 const CStdString CPictureInfoTag::GetInfo(int info) const
269 273
 {
270  
-  if (!m_isLoaded)
  274
+  if (!m_isLoaded && !m_isInfoSetExternally) // If no metadata has been loaded from the picture file or set with SetInfo(), just return
271 275
     return "";
272 276
 
273 277
   CStdString value;
@@ -590,21 +594,17 @@ void CPictureInfoTag::SetInfo(int info, const CStdString& value)
590 594
       {
591 595
         m_exifInfo.Width = atoi(dimension[0].c_str());
592 596
         m_exifInfo.Height = atoi(dimension[1].c_str());
  597
+        m_isInfoSetExternally = true; // Set the internal state to show metadata has been set by call to SetInfo
593 598
       }
594 599
       break;
595 600
     }
596 601
   case SLIDE_EXIF_DATE_TIME:
597 602
     {
598 603
       strcpy(m_exifInfo.DateTime, value.c_str());
  604
+      m_isInfoSetExternally = true; // Set the internal state to show metadata has been set by call to SetInfo
599 605
       break;
600 606
     }
601 607
   default:
602 608
     break;
603 609
   }
604 610
 }
605  
-
606  
-void CPictureInfoTag::SetLoaded(bool loaded)
607  
-{
608  
-  m_isLoaded = loaded;
609  
-}
610  
-
4  xbmc/pictures/PictureInfoTag.h
@@ -100,12 +100,12 @@ class CPictureInfoTag : public IArchivable, public ISerializable, public ISortab
100 100
   static int TranslateString(const CStdString &info);
101 101
 
102 102
   void SetInfo(int info, const CStdString& value);
103  
-  void SetLoaded(bool loaded = true);
104 103
 
105 104
 private:
106 105
   void GetStringFromArchive(CArchive &ar, char *string, size_t length);
107 106
   ExifInfo_t m_exifInfo;
108 107
   IPTCInfo_t m_iptcInfo;
109  
-  bool       m_isLoaded;
  108
+  bool       m_isLoaded;             // Set to true if metadata has been loaded from the picture file successfully
  109
+  bool       m_isInfoSetExternally;  // Set to true if metadata has been set by an external call to SetInfo
110 110
 };
111 111
 

0 notes on commit 406f32d

Please sign in to comment.
Something went wrong with that request. Please try again.