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