MythTV master
gamedetails.cpp
Go to the documentation of this file.
1// Qt
2#include <QApplication>
3#include <QFile>
4
5// MythTV
11
12// MythGame
13#include "gamedetails.h"
14
15void GameDetailsPopup::handleText(const QString &name, const QString &value)
16{
17 MythUIText *textarea = nullptr;
18 UIUtilE::Assign(this, textarea, name);
19 if (textarea)
20 {
21 textarea->SetText(value);
22 }
23}
24
25void GameDetailsPopup::handleImage(const QString &name, const QString &filename)
26{
27 MythUIImage *image = nullptr;
28 UIUtilW::Assign(this, image, name);
29 if (image)
30 {
31 if (!filename.isEmpty())
32 {
33 image->SetFilename(filename);
34 image->Load();
35 }
36 else
37 {
38 image->Reset();
39 }
40 }
41}
42
44{
45 if (!LoadWindowFromXML("game-ui.xml", "gamedetailspopup", this))
46 return false;
47
48 UIUtilW::Assign(this, m_playButton, "play_button");
49 UIUtilW::Assign(this, m_doneButton, "done_button");
50
51 if (m_playButton)
53
54 if (m_doneButton)
56
58
61
62 handleText("title", m_romInfo->Gamename());
63 handleText("gametype", m_romInfo->GameType());
64 handleText("romname", m_romInfo->Romname());
66 handleText("rompath", m_romInfo->Rompath());
67 handleText("genre", m_romInfo->Genre());
68 handleText("year", m_romInfo->Year());
69 handleText("country", m_romInfo->Country());
70 handleText("publisher", m_romInfo->Publisher());
71 handleText("description", m_romInfo->Plot());
72 handleText("allsystems", m_romInfo->AllSystems());
73 handleImage("fanart", m_romInfo->Fanart());
74 handleImage("coverart", m_romInfo->Boxart());
75 handleImage("screenshot", m_romInfo->Screenshot());
76
77 return true;
78}
79
81{
82 if (m_retObject)
83 {
84 auto *dce = new DialogCompletionEvent(m_id, 0, "", "");
85 QApplication::postEvent(m_retObject, dce);
86 Close();
87 }
88}
89
90void GameDetailsPopup::SetReturnEvent(QObject *retobject,
91 const QString &resultid)
92{
93 m_retObject = retobject;
94 m_id = resultid;
95}
96
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition: mythdialogbox.h:41
bool Create(void) override
Definition: gamedetails.cpp:43
MythUIButton * m_doneButton
Definition: gamedetails.h:52
void SetReturnEvent(QObject *retobject, const QString &resultid)
Definition: gamedetails.cpp:90
void handleText(const QString &name, const QString &value)
Definition: gamedetails.cpp:15
const RomInfo * m_romInfo
Definition: gamedetails.h:33
QObject * m_retObject
Definition: gamedetails.h:35
void handleImage(const QString &name, const QString &filename)
Definition: gamedetails.cpp:25
void Play(void)
Definition: gamedetails.cpp:80
MythUIButton * m_playButton
Definition: gamedetails.h:51
void BuildFocusList(void)
bool SetFocusWidget(MythUIType *widget=nullptr)
virtual void Close()
void Clicked()
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:98
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
void Reset(void) override
Reset the image back to the default defined in the theme.
All purpose text widget, displays a text string.
Definition: mythuitext.h:29
virtual void SetText(const QString &text)
Definition: mythuitext.cpp:115
QString Screenshot() const
Definition: rominfo.h:63
QString Country() const
Definition: rominfo.h:84
QString Plot() const
Definition: rominfo.h:102
QString Gamename() const
Definition: rominfo.h:78
QString CRC_VALUE() const
Definition: rominfo.h:99
QString AllSystems() const
Definition: rominfo.h:93
QString Fanart() const
Definition: rominfo.h:66
QString Boxart() const
Definition: rominfo.h:69
QString Genre() const
Definition: rominfo.h:81
QString Publisher() const
Definition: rominfo.h:105
QString Romname() const
Definition: rominfo.h:72
QString GameType() const
Definition: rominfo.h:87
QString Rompath() const
Definition: rominfo.h:60
QString Year() const
Definition: rominfo.h:111
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
Definition: mythuiutils.h:27