-
Notifications
You must be signed in to change notification settings - Fork 343
/
gamedetails.cpp
110 lines (93 loc) · 2.99 KB
/
gamedetails.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include <QFile>
#include <QApplication>
#include "mythcontext.h"
#include "mythuihelper.h"
#include "mythuitext.h"
#include "mythuiimage.h"
#include "mythuibutton.h"
#include "mythdialogbox.h"
#include "gamedetails.h"
GameDetailsPopup::GameDetailsPopup(MythScreenStack *parent,
const RomInfo *romInfo)
: MythScreenType (parent, "gamedetailspopup"),
m_romInfo(romInfo), m_id(""), m_retObject(NULL),
m_gameName(NULL), m_gameType(NULL), m_romName(NULL),
m_crc(NULL), m_romPath(NULL), m_genre(NULL),
m_year(NULL), m_country(NULL), m_plot(NULL),
m_publisher(NULL), m_allSystems(NULL), m_fanartImage(NULL),
m_boxImage(NULL), m_playButton(NULL), m_doneButton(NULL)
{
m_romInfo = romInfo;
}
GameDetailsPopup::~GameDetailsPopup(void)
{
}
void GameDetailsPopup::handleText(const QString &name, const QString &value)
{
MythUIText *textarea = NULL;
UIUtilE::Assign(this, textarea, name);
if (textarea)
{
textarea->SetText(value);
}
}
void GameDetailsPopup::handleImage(const QString &name, const QString &filename)
{
MythUIImage *image = NULL;
UIUtilW::Assign(this, image, name);
if (image)
{
if (filename.size())
{
image->SetFilename(filename);
image->Load();
}
else
image->Reset();
}
}
bool GameDetailsPopup::Create(void)
{
if (!LoadWindowFromXML("game-ui.xml", "gamedetailspopup", this))
return false;
UIUtilW::Assign(this, m_playButton, "play_button");
UIUtilW::Assign(this, m_doneButton, "done_button");
if (m_playButton)
connect(m_playButton, SIGNAL(Clicked()), SLOT(Play()));
if (m_doneButton)
connect(m_doneButton, SIGNAL(Clicked()), SLOT(Close()));
BuildFocusList();
if (m_playButton || m_doneButton)
SetFocusWidget(m_playButton ? m_playButton : m_doneButton);
handleText("title", m_romInfo->Gamename());
handleText("gametype", m_romInfo->GameType());
handleText("romname", m_romInfo->Romname());
handleText("crc", m_romInfo->CRC_VALUE());
handleText("rompath", m_romInfo->Rompath());
handleText("genre", m_romInfo->Genre());
handleText("year", m_romInfo->Year());
handleText("country", m_romInfo->Country());
handleText("publisher", m_romInfo->Publisher());
handleText("description", m_romInfo->Plot());
handleText("allsystems", m_romInfo->AllSystems());
handleImage("fanart", m_romInfo->Fanart());
handleImage("coverart", m_romInfo->Boxart());
handleImage("screenshot", m_romInfo->Screenshot());
return true;
}
void GameDetailsPopup::Play()
{
if (m_retObject)
{
DialogCompletionEvent *dce =
new DialogCompletionEvent(m_id, 0, "", "");
QApplication::postEvent(m_retObject, dce);
Close();
}
}
void GameDetailsPopup::SetReturnEvent(QObject *retobject,
const QString &resultid)
{
m_retObject = retobject;
m_id = resultid;
}