MythTV  master
videopopups.cpp
Go to the documentation of this file.
1 #include <QStringList>
2 
3 #include "mythlogging.h"
4 
5 #include "mythuibuttonlist.h"
6 #include "mythuitext.h"
7 #include "mythuibutton.h"
8 #include "videometadata.h"
9 #include "videoutils.h"
10 
11 #include "videopopups.h"
12 
14 {
15  if (!LoadWindowFromXML("video-ui.xml", "castpopup", this))
16  return false;
17 
18  MythUIButtonList *castList = nullptr;
19  MythUIButton *okButton = nullptr;
20 
21  bool err = false;
22  UIUtilE::Assign(this, castList, "cast", &err);
23 
24  if (err)
25  {
26  LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'castpopup'");
27  return false;
28  }
29 
30  UIUtilW::Assign(this, okButton, "ok");
31 
32  if (okButton)
33  connect(okButton, SIGNAL(Clicked()), SLOT(Close()));
34 
35  QStringList cast = GetDisplayCast(*m_metadata);
36  QStringListIterator castIterator(cast);
37  while (castIterator.hasNext())
38  {
39  new MythUIButtonListItem(castList, castIterator.next());
40  }
41 
43 
44  return true;
45 }
46 
48 
50 {
51  if (!LoadWindowFromXML("video-ui.xml", "descriptionpopup", this))
52  return false;
53 
54  MythUIText *plotText = nullptr;
55  MythUIButton *okButton = nullptr;
56 
57  bool err = false;
58  UIUtilE::Assign(this, plotText, "description", &err);
59 
60  if (err)
61  {
62  LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'descriptionpopup'");
63  return false;
64  }
65 
66  UIUtilW::Assign(this, okButton, "ok");
67 
68  plotText->SetText(m_metadata->GetPlot());
69 
70  if (okButton)
71  connect(okButton, SIGNAL(Clicked()), SLOT(Close()));
72 
74 
75  return true;
76 }
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
virtual void SetText(const QString &text)
Definition: mythuitext.cpp:136
bool Create() override
Definition: videopopups.cpp:49
QStringList GetDisplayCast(const VideoMetadata &item)
Definition: videoutils.cpp:232
void BuildFocusList(void)
bool Create() override
Definition: videopopups.cpp:13
VideoMetadata * m_metadata
Definition: videopopups.h:22
virtual void Close()
const QString & GetPlot() const
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
Definition: mythuiutils.h:27
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
A single button widget.
Definition: mythuibutton.h:21
#define LOG(_MASK_, _LEVEL_, _STRING_)
Definition: mythlogging.h:41
VideoMetadata * m_metadata
Definition: videopopups.h:36