20 m_screenDefn(screenDefn),
21 m_name(m_screenDefn->m_name),
27 for (
const QString&
type : std::as_const(
types))
54 if (i.key().isEmpty())
56 LOG(VB_GENERAL, LOG_DEBUG, i.key());
73 DataMap::iterator itr = data.begin();
74 while (itr != data.end())
83 LOG(VB_GENERAL, LOG_ERR,
"Theme is missing a required widget!");
91 return QString::fromUtf8(
"°") +
"F";
92 return QString::fromUtf8(
"°") +
"C";
100 QString name = itr.key();
105 LOG(VB_GENERAL, LOG_ERR,
"Widget not found " + itr.key());
107 if (name ==
"copyright")
109 LOG(VB_GENERAL, LOG_WARNING,
110 QString(
"No copyright widget found, skipping screen %1.")
114 if (name ==
"copyrightlogo")
116 LOG(VB_GENERAL, LOG_WARNING,
117 QString(
"No copyrightlogo widget found, skipping screen %1.")
123 if( !widget || checkOnly )
129 if (
auto *w2 =
dynamic_cast<MythUIText *
>(widget))
131 w2->SetText(itr.value());
133 else if (
auto *w3 =
dynamic_cast<MythUIImage *
>(widget))
135 w3->SetFilename(itr.value());
162 if (key.startsWith(
"relative_humidity") || key.startsWith(
"pop"))
165 if (key ==
"pressure")
168 if (key ==
"visibility")
171 if (key.startsWith(
"temp") ||
172 key.startsWith(
"appt") ||
173 key.startsWith(
"low") ||
174 key.startsWith(
"high"))
176 if ((value ==
"NA") || (value ==
"N/A"))
181 if (key.startsWith(
"wind_gust") ||
182 key.startsWith(
"wind_spdgst") ||
183 key.startsWith(
"wind_speed"))
188 if (key.startsWith(
"date"))
190 bool isNumber =
false;
191 (void)value.toInt( &isNumber);
195 int dayOfWeek = value.toInt();
206 return tr(
"Tuesday");
209 return tr(
"Wednesday");
212 return tr(
"Thursday");
218 return tr(
"Saturday");
224 if (key ==
"copyrightlogo" && value ==
"none")
Screen in which all other widgets are contained and rendered.
MythUIType * GetFocusWidget(void) const
Image widget, displays a single image or multiple images in sequence.
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
All purpose text widget, displays a text string.
The base class on which all widgets and screens are based.
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
virtual void prepareWidget(MythUIType *widget)
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
ScreenListInfo * m_screenDefn
QMap< QString, QString > m_dataValueMap
void setValue(const QString &key, const QString &value)
WeatherScreen(MythScreenStack *parent, ScreenListInfo *screenDefn, int id)
virtual QString getTemperatureUnit()
virtual bool canShowScreen()
static WeatherScreen * loadScreen(MythScreenStack *parent, ScreenListInfo *screenDefn, int id)
QString formatDataItem(const QString &key, const QString &value)
virtual bool prepareScreen(bool checkOnly=false)
virtual QString prepareDataItem(const QString &key, const QString &value)
void screenReady(WeatherScreen *)
bool Create(void) override
virtual void newData(const QString &, units_t, DataMap data)
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
static const struct wl_interface * types[]
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
static constexpr uint8_t ENG_UNITS
QMap< QString, QString > DataMap