/** * \copydoc MythUIType::CopyFrom() */ void MythUIImage::CopyFrom(MythUIType *base) { d->m_UpdateLock.lockForWrite(); MythUIImage *im = dynamic_cast<MythUIImage *>(base); if (!im) { LOG(VB_GENERAL, LOG_ERR, QString("'%1' (%2) ERROR, bad parsing '%3' (%4)") .arg(objectName()).arg(GetXMLLocation()) .arg(base->objectName()).arg(base->GetXMLLocation())); d->m_UpdateLock.unlock(); return; } m_OrigFilename = im->m_OrigFilename; m_Delay = im->m_Delay; m_LowNum = im->m_LowNum; m_HighNum = im->m_HighNum; m_LastDisplay = QTime::currentTime(); m_CurPos = 0; m_imageProperties = im->m_imageProperties; m_animationCycle = im->m_animationCycle; m_animatedImage = im->m_animatedImage; m_showingRandomImage = im->m_showingRandomImage; m_imageDirectory = im->m_imageDirectory; MythUIType::CopyFrom(base); // We need to update forceSize in case the parent area has changed // however we only want to set forceSize if it was previously in use if (!m_imageProperties.forceSize.isNull()) m_imageProperties.forceSize = m_Area.size(); m_NeedLoad = im->m_NeedLoad; d->m_UpdateLock.unlock(); d->m_UpdateLock.lockForRead(); if (m_NeedLoad) { d->m_UpdateLock.unlock(); Load(); } else d->m_UpdateLock.unlock(); }
void MythUIText::SetCutDown(Qt::TextElideMode mode) { if (mode != m_Cutdown) { m_Cutdown = mode; if (m_scrolling && m_Cutdown != Qt::ElideNone) { LOG(VB_GENERAL, LOG_ERR, QString("'%1' (%2): <scroll> and " "<cutdown> are not combinable.") .arg(objectName()).arg(GetXMLLocation())); m_Cutdown = Qt::ElideNone; } if (!m_Message.isEmpty()) { FillCutMessage(); SetRedraw(); } } }
/*! * \brief Initialise the tree having loaded the formatting options from the * theme */ void MythUIButtonTree::Init() { if (!m_listTemplate) m_listTemplate = dynamic_cast<MythUIButtonList *> (GetChild("listtemplate")); if (!m_listTemplate) { LOG(VB_GENERAL, LOG_ERR, QString("(%1) MythUIButtonList listtemplate " "is required in mythuibuttonlist: %2") .arg(GetXMLLocation().arg(objectName()))); return; } m_listTemplate->SetVisible(false); int width = (m_Area.width() - (m_listSpacing * (m_numLists - 1))) / m_numLists; int height = m_Area.height(); int i = 0; while (i < (int)m_numLists) { QString listname = QString("buttontree list %1").arg(i); MythUIButtonList *list = new MythUIButtonList(this, listname); list->CopyFrom(m_listTemplate); list->SetVisible(false); list->SetActive(false); list->SetCanTakeFocus(false); int x = i * (width + m_listSpacing); MythRect listArea = MythRect(x, 0, width, height); list->SetArea(listArea); m_buttonlists.append(list); i++; } m_initialized = true; }