Go to the documentation of this file.
7 #include <QApplication>
24 m_nextpageInterval(
gCoreContext->GetDurSetting<std::chrono::seconds>(
"weatherTimeout", 10s)),
25 m_nextPageTimer(new QTimer(this))
66 LOG(VB_GENERAL, LOG_ERR,
"Missing required window - weatherbase.");
78 LOG(VB_GENERAL, LOG_ERR,
79 "Window weatherbase is missing required elements.");
126 "SELECT screen_id, container, units, draworder FROM weatherscreens "
127 " WHERE hostname = :HOST ORDER BY draworder;";
144 auto *ssetup =
new ScreenSetup(mainStack,
"weatherscreensetup",
149 if (ssetup->Create())
167 int id = db.
value(0).toInt();
168 QString container = db.
value(1).toString();
192 LOG(VB_GENERAL, LOG_ERR,
"No weather screens left, aborting.");
196 m_updatedText->
SetText(tr(
"None of the configured screens are complete in this theme (missing copyright information)."));
248 for (
int i = 0; i < actions.size() && !handled; i++)
250 const QString&
action = actions[i];
255 else if (
action ==
"RIGHT")
257 else if (
action ==
"PAUSE")
259 else if (
action ==
"MENU")
261 else if (
action ==
"UPDATE")
265 else if (
action ==
"ESCAPE")
333 if (ssetup->Create())
381 LOG(VB_GENERAL, LOG_ERR,
"Next screen not ready");
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
QSqlQuery wrapper that fetches a DB connection from the connection pool.
MythScreenStack * GetMainStack()
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
static WeatherScreen * loadScreen(MythScreenStack *parent, ScreenListInfo *screenDefn, int id)
Weather(MythScreenStack *parent, const QString &name, SourceManager *srcMan)
WeatherScreen * nextScreen()
void showScreen(WeatherScreen *ws)
QVariant value(int i) const
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
MythScreenStack * m_weatherStack
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Screen in which all other widgets are contained and rendered.
void setUnits(units_t units)
MythUIText * m_updatedText
MythUIType * GetFocusWidget(void) const
ScreenListMap loadScreens()
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
static void DBError(const QString &where, const MSqlQuery &query)
void doUpdate(bool forceUpdate=false)
WeatherScreen * m_currScreen
bool connectScreen(uint id, WeatherScreen *screen)
ScreenListMap m_allScreens
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
virtual bool canShowScreen()
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
void setInUse(bool inuse)
QString getValue(const QString &key)
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
bool Create(void) override
virtual void SetText(const QString &text)
virtual void PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
MythMainWindow * GetMythMainWindow(void)
void screenReady(WeatherScreen *ws)
MythUIText * m_headerText
void screenReady(WeatherScreen *)
QString GetHostName(void)
bool Create(void) override
std::chrono::seconds m_nextpageInterval
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
WeatherScreen * prevScreen()
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.