void MythNews::slotSiteSelected(MythUIButtonListItem *item) { QMutexLocker locker(&m_lock); if (!item || item->GetData().isNull()) return; NewsSite *site = qVariantValue<NewsSite*>(item->GetData()); if (!site) return; m_articlesList->Reset(); m_articles.clear(); NewsArticle::List articles = site->GetArticleList(); NewsArticle::List::iterator it = articles.begin(); for (; it != articles.end(); ++it) { MythUIButtonListItem *item = new MythUIButtonListItem(m_articlesList, (*it).title()); m_articles[item] = *it; } updateInfoView(item); }
bool MythNews::Create(void) { QMutexLocker locker(&m_lock); bool foundtheme = false; // Load the theme for this screen foundtheme = LoadWindowFromXML("news-ui.xml", "news", this); if (!foundtheme) return false; bool err = false; UIUtilE::Assign(this, m_sitesList, "siteslist", &err); UIUtilE::Assign(this, m_articlesList, "articleslist", &err); UIUtilE::Assign(this, m_titleText, "title", &err); UIUtilE::Assign(this, m_descText, "description", &err); // these are all optional UIUtilW::Assign(this, m_nositesText, "nosites", &err); UIUtilW::Assign(this, m_updatedText, "updated", &err); UIUtilW::Assign(this, m_thumbnailImage, "thumbnail", &err); UIUtilW::Assign(this, m_enclosureImage, "enclosures", &err); UIUtilW::Assign(this, m_downloadImage, "download", &err); UIUtilW::Assign(this, m_podcastImage, "ispodcast", &err); if (err) { LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'news'"); return false; } if (m_nositesText) { m_nositesText->SetText(tr("You haven't configured MythNews to use any sites.")); m_nositesText->Hide(); } BuildFocusList(); SetFocusWidget(m_sitesList); loadSites(); updateInfoView(m_sitesList->GetItemFirst()); connect(m_sitesList, SIGNAL(itemSelected(MythUIButtonListItem*)), this, SLOT( slotSiteSelected(MythUIButtonListItem*))); connect(m_articlesList, SIGNAL(itemSelected( MythUIButtonListItem*)), this, SLOT( updateInfoView(MythUIButtonListItem*))); connect(m_articlesList, SIGNAL(itemClicked( MythUIButtonListItem*)), this, SLOT( slotViewArticle(MythUIButtonListItem*))); return true; }
void KDMThemeWidget::selectTheme(const QString &path) { for (int i = 0; i < themeWidget->topLevelItemCount(); i++) { ThemeData *td = (ThemeData *)themeWidget->topLevelItem(i); if (td->path == path) { themeWidget->clearSelection(); td->setSelected(true); updateInfoView(td); } } }