Go to the documentation of this file.
18 #define LOC QString("MythNewsConfig: ")
19 #define LOC_WARN QString("MythNewsConfig, Warning: ")
20 #define LOC_ERR QString("MythNewsConfig, Error: ")
36 m_updateFreq(
gCoreContext->GetNumSetting(
"NewsUpdateFrequency", 30))
48 QMutexLocker locker(&
m_lock);
55 if (!xmlFile.exists() || !xmlFile.open(QIODevice::ReadOnly))
57 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Cannot open news-sites.xml");
67 if (!domDoc.setContent(&xmlFile,
false, &errorMsg,
68 &errorLine, &errorColumn))
70 LOG(VB_GENERAL, LOG_ERR,
LOC +
71 "Could not read content of news-sites.xml" +
72 QString(
"\n\t\t\tError parsing %1").arg(
filename) +
73 QString(
"\n\t\t\tat line: %1 column: %2 msg: %3")
74 .arg(errorLine).arg(errorColumn).arg(errorMsg));
80 QDomNodeList catList =
81 domDoc.elementsByTagName(QString::fromUtf8(
"category"));
85 for (
int i = 0; i < catList.count(); i++)
87 catNode = catList.item(i);
90 cat.m_name = catNode.toElement().attribute(
"name");
92 QDomNodeList siteList = catNode.childNodes();
94 for (
int j = 0; j < siteList.count(); j++)
96 siteNode = siteList.item(j);
99 site.
m_name = siteNode.namedItem(QString(
"title")).toElement().text();
101 site.
m_url = siteNode.namedItem(QString(
"url")).toElement().text();
102 site.
m_ico = siteNode.namedItem(QString(
"ico")).toElement().text();
106 cat.m_siteList.push_back(site);
117 QMutexLocker locker(&
m_lock);
132 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'config'");
152 QMutexLocker locker(&
m_lock);
157 item->SetData(QVariant::fromValue(&category));
158 if (!category.m_siteList.empty())
159 item->setDrawArrow(
true);
166 QMutexLocker locker(&
m_lock);
189 site->m_inDB =
false;
197 QMutexLocker locker(&
m_lock);
208 for (
auto & site :
cat->m_siteList)
215 newitem->SetData(QVariant::fromValue(&site));
bool insertInDB(RSSSite *site)
bool findInDB(const QString &url, ArticleType type)
NewsCategory::List m_categoryList
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Screen in which all other widgets are contained and rendered.
std::vector< NewsCategory > List
MythUIType * GetFocusWidget(void) const
QStringList m_selectedSitesList
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
bool SetFocusWidget(MythUIType *widget=nullptr)
bool removeFromDB(RSSSite *site)
QString GetShareDir(void)
void BuildFocusList(void)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
~MythNewsConfig() override
bool Create(void) override
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
MythNewsConfigPriv * m_priv
MythMainWindow * GetMythMainWindow(void)
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void toggleItem(MythUIButtonListItem *item)
MythNewsConfig(MythScreenStack *parent, const QString &name)
MythUIButtonList * m_categoriesList
MythUIButtonList * m_siteList
void slotCategoryChanged(MythUIButtonListItem *item)