All pastes #1964985 Raw Edit

Someone

public text v1 · immutable
#1964985 ·published 2010-10-17 17:22 UTC
rendered paste body
Index: libs/libmythui/mythuiclock.h
===================================================================
--- libs/libmythui/mythuiclock.h	(revision 26847)
+++ libs/libmythui/mythuiclock.h	(working copy)
@@ -32,6 +32,7 @@
     virtual void SetText(const QString &text);
 
   protected:
+    virtual void Finalize(void);
     virtual bool ParseElement(
         const QString &filename, QDomElement &element, bool showWarnings);
     virtual void CopyFrom(MythUIType *base);
Index: libs/libmythui/mythuiclock.cpp
===================================================================
--- libs/libmythui/mythuiclock.cpp	(revision 26847)
+++ libs/libmythui/mythuiclock.cpp	(working copy)
@@ -14,9 +14,6 @@
 MythUIClock::MythUIClock(MythUIType *parent, const QString &name)
            : MythUIText(parent, name)
 {
-    m_Time = QDateTime::currentDateTime();
-    m_Message = m_Time.toString(m_Format);
-
     m_DateFormat = GetMythDB()->GetSetting("DateFormat", "ddd d MMMM");
     m_ShortDateFormat = GetMythDB()->GetSetting("ShortDateFormat", "ddd d");
     m_TimeFormat = GetMythDB()->GetSetting("TimeFormat", "hh:mm");
@@ -24,8 +21,6 @@
     m_Format = QString("%1, %2").arg(m_DateFormat).arg(m_TimeFormat);
 
     m_Flash = false;
-
-    MythUIText::SetText(GetTimeText());
 }
 
 MythUIClock::~MythUIClock()
@@ -34,6 +29,14 @@
     m_Font = NULL;
 }
 
+// This needs to be done here since SetText() isn't fully functional
+// until we've loaded the XML.
+void MythUIClock::Finalize(void)
+{
+    m_Time = QDateTime::currentDateTime();
+    MythUIText::SetText(GetTimeText());
+}
+
 /** \brief Looks up the time and sets the clock if the current time is
  *         greater than or equal to m_nextUpdate.
  */