All pastes #1218489 Raw Edit

Mine

public text v1 · immutable
#1218489 ·published 2008-10-03 22:50 UTC
rendered paste body
Index: mythtv/libs/libmythui/mythuibuttonlist.cpp
===================================================================
--- mythtv/libs/libmythui/mythuibuttonlist.cpp	(revision 18536)
+++ mythtv/libs/libmythui/mythuibuttonlist.cpp	(working copy)
@@ -1003,7 +1003,7 @@
 
 MythUIButtonListItem::MythUIButtonListItem(MythUIButtonList* lbtype,
                                        const QString& text,
-                                       MythImage *image, bool checkable,
+                                       const QString &image, bool checkable,
                                        CheckState state, bool showArrow)
 {
     if (!lbtype)
@@ -1036,7 +1036,7 @@
     m_text      = text;
     m_data      = data;
 
-    m_image     = NULL;
+    m_image     = "";
     m_checkable = false;
     m_state     = CantCheck;
     m_showArrow = false;
@@ -1050,14 +1050,6 @@
 {
     if (m_parent)
         m_parent->RemoveItem(this);
-    if (m_image)
-        m_image->DownRef();
-
-    QMapIterator<QString, MythImage*> it(m_images);
-    while (it.hasNext()) {
-        it.next();
-        it.value()->DownRef();
-    }
 }
 
 QString MythUIButtonListItem::text() const
@@ -1078,31 +1070,21 @@
         m_parent->Update();
 }
 
-const MythImage* MythUIButtonListItem::image() const
+const QString MythUIButtonListItem::Image() const
 {
     return m_image;
 }
 
-void MythUIButtonListItem::setImage(MythImage *image, const QString &name)
+void MythUIButtonListItem::SetImage(const QString &filename, const QString &name)
 {
     if (!name.isEmpty())
-    {
-        if (m_images.contains(name))
-            m_images.value(name)->DownRef();
-        m_images.insert(name, image);
-        if (image)
-            image->UpRef();
-    }
+        m_images.insert(name, filename);
     else
     {
-        if (image == m_image)
+        if (filename == m_image)
             return;
 
-        if (m_image)
-            m_image->DownRef();
-        m_image = image;
-        if (image)
-            image->UpRef();
+        m_image = filename;
     }
 
     if (m_parent)
@@ -1240,7 +1222,10 @@
     MythUIImage *buttonimage = dynamic_cast<MythUIImage *>
                                         (buttonstate->GetChild("buttonimage"));
     if (buttonimage)
-        buttonimage->SetImage(m_image);
+    {
+        buttonimage->SetFilename(m_image);
+        buttonimage->Load();
+    }
 
     MythUIImage *buttonarrow = dynamic_cast<MythUIImage *>
                                         (buttonstate->GetChild("buttonarrow"));
@@ -1276,13 +1261,16 @@
     }
 
     MythUIImage *image;
-    QMap<QString, MythImage*>::iterator image_it = m_images.begin();
+    QMap<QString, QString>::iterator image_it = m_images.begin();
     while (image_it != m_images.end())
     {
         image = dynamic_cast<MythUIImage *>
                                     (buttonstate->GetChild(image_it.key()));
         if (image)
-            image->SetImage(image_it.value());
+        {
+            image->SetFilename(image_it.value());
+            image->Load();
+        }
         ++image_it;
     }
 
Index: mythtv/libs/libmythui/mythuibuttonlist.h
===================================================================
--- mythtv/libs/libmythui/mythuibuttonlist.h	(revision 18536)
+++ mythtv/libs/libmythui/mythuibuttonlist.h	(working copy)
@@ -25,7 +25,7 @@
     };
 
     MythUIButtonListItem(MythUIButtonList *lbtype, const QString& text,
-                         MythImage *image = 0, bool checkable = false,
+                         const QString &image = "", bool checkable = false,
                          CheckState state = CantCheck, bool showArrow = false);
     MythUIButtonListItem(MythUIButtonList *lbtype, const QString& text,
                          QVariant data);
@@ -36,8 +36,8 @@
     void setText(const QString &text, const QString &name="");
     QString text() const;
 
-    void setImage(MythImage *image, const QString &name="");
-    const MythImage *image() const;
+    void SetImage(const QString &filename, const QString &name="");
+    const QString Image() const;
 
     void DisplayState(const QString &state, const QString &name);
 
@@ -67,7 +67,7 @@
   protected:
     MythUIButtonList *m_parent;
     QString         m_text;
-    MythImage      *m_image;
+    QString         m_image;
     bool            m_checkable;
     CheckState      m_state;
     QVariant        m_data;
@@ -75,7 +75,7 @@
     bool            m_overrideInactive;
 
     QMap<QString, QString> m_strings;
-    QMap<QString, MythImage*> m_images;
+    QMap<QString, QString> m_images;
     QMap<QString, QString> m_states;
 
     friend class MythUIButtonList;
@@ -153,7 +153,6 @@
                           int alphaMod, QRect clipRect);
     void Const();
     virtual void Init();
-    void LoadPixmap(MythImage **pix, QDomElement &element);
 
     void InsertItem(MythUIButtonListItem *item);
     void RemoveItem(MythUIButtonListItem *item);