MythTV
master
mythplugins
mythgame
mythgame
gamedetails.cpp
Go to the documentation of this file.
1
// Qt
2
#include <QApplication>
3
#include <QFile>
4
5
// MythTV
6
#include <
libmythui/mythdialogbox.h
>
7
#include <
libmythui/mythuibutton.h
>
8
#include <
libmythui/mythuihelper.h
>
9
#include <
libmythui/mythuiimage.h
>
10
#include <
libmythui/mythuitext.h
>
11
12
// MythGame
13
#include "
gamedetails.h
"
14
15
void
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
25
void
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
43
bool
GameDetailsPopup::Create
(
void
)
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
)
52
connect(
m_playButton
, &
MythUIButton::Clicked
,
this
, &
GameDetailsPopup::Play
);
53
54
if
(
m_doneButton
)
55
connect(
m_doneButton
, &
MythUIButton::Clicked
,
this
, &
MythScreenType::Close
);
56
57
BuildFocusList
();
58
59
if
(
m_playButton
||
m_doneButton
)
60
SetFocusWidget
(
m_playButton
?
m_playButton
:
m_doneButton
);
61
62
handleText
(
"title"
,
m_romInfo
->
Gamename
());
63
handleText
(
"gametype"
,
m_romInfo
->
GameType
());
64
handleText
(
"romname"
,
m_romInfo
->
Romname
());
65
handleText
(
"crc"
,
m_romInfo
->
CRC_VALUE
());
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
80
void
GameDetailsPopup::Play
()
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
90
void
GameDetailsPopup::SetReturnEvent
(QObject *retobject,
91
const
QString &resultid)
92
{
93
m_retObject
= retobject;
94
m_id
= resultid;
95
}
96
MythUIButton::Clicked
void Clicked()
RomInfo::CRC_VALUE
QString CRC_VALUE() const
Definition:
rominfo.h:99
RomInfo::Boxart
QString Boxart() const
Definition:
rominfo.h:69
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:102
RomInfo::AllSystems
QString AllSystems() const
Definition:
rominfo.h:93
MythScreenType::Close
virtual void Close()
Definition:
mythscreentype.cpp:384
RomInfo::Country
QString Country() const
Definition:
rominfo.h:84
RomInfo::Gamename
QString Gamename() const
Definition:
rominfo.h:78
GameDetailsPopup::m_retObject
QObject * m_retObject
Definition:
gamedetails.h:35
MythUIImage::Load
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
Definition:
mythuiimage.cpp:971
mythdialogbox.h
RomInfo::Genre
QString Genre() const
Definition:
rominfo.h:81
GameDetailsPopup::handleText
void handleText(const QString &name, const QString &value)
Definition:
gamedetails.cpp:15
GameDetailsPopup::Play
void Play(void)
Definition:
gamedetails.cpp:80
MythUIImage::Reset
void Reset(void) override
Reset the image back to the default defined in the theme.
Definition:
mythuiimage.cpp:644
mythuiimage.h
GameDetailsPopup::m_playButton
MythUIButton * m_playButton
Definition:
gamedetails.h:51
RomInfo::Screenshot
QString Screenshot() const
Definition:
rominfo.h:63
GameDetailsPopup::m_doneButton
MythUIButton * m_doneButton
Definition:
gamedetails.h:52
MythScreenType::SetFocusWidget
bool SetFocusWidget(MythUIType *widget=nullptr)
Definition:
mythscreentype.cpp:116
RomInfo::Rompath
QString Rompath() const
Definition:
rominfo.h:60
MythScreenType::BuildFocusList
void BuildFocusList(void)
Definition:
mythscreentype.cpp:204
GameDetailsPopup::m_romInfo
const RomInfo * m_romInfo
Definition:
gamedetails.h:33
GameDetailsPopup::Create
bool Create(void) override
Definition:
gamedetails.cpp:43
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:105
mythuihelper.h
GameDetailsPopup::SetReturnEvent
void SetReturnEvent(QObject *retobject, const QString &resultid)
Definition:
gamedetails.cpp:90
MythUIText
All purpose text widget, displays a text string.
Definition:
mythuitext.h:28
RomInfo::Fanart
QString Fanart() const
Definition:
rominfo.h:66
XMLParseBase::LoadWindowFromXML
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
Definition:
xmlparsebase.cpp:701
GameDetailsPopup::m_id
QString m_id
Definition:
gamedetails.h:34
DialogCompletionEvent
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition:
mythdialogbox.h:40
MythUIText::SetText
virtual void SetText(const QString &text)
Definition:
mythuitext.cpp:115
GameDetailsPopup::handleImage
void handleImage(const QString &name, const QString &filename)
Definition:
gamedetails.cpp:25
mythuibutton.h
MythUIImage::SetFilename
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
Definition:
mythuiimage.cpp:677
build_compdb.filename
filename
Definition:
build_compdb.py:21
RomInfo::GameType
QString GameType() const
Definition:
rominfo.h:87
RomInfo::Year
QString Year() const
Definition:
rominfo.h:111
gamedetails.h
RomInfo::Romname
QString Romname() const
Definition:
rominfo.h:72
Generated on Wed Feb 26 2025 03:17:51 for MythTV by
1.8.17