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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
// license:BSD-3-Clause
// copyright-holders:Andrew Gardner
#include "emu.h"
#include "deviceinformationwindow.h"
#include "util/xmlfile.h"
#include <QtWidgets/QFrame>
#include <QtWidgets/QLabel>
#include <QtWidgets/QVBoxLayout>
namespace osd::debugger::qt {
DeviceInformationWindow::DeviceInformationWindow(DebuggerQt &debugger, device_t *device, QWidget *parent) :
WindowQt(debugger, nullptr),
m_device(device)
{
if (parent)
{
QPoint parentPos = parent->pos();
setGeometry(parentPos.x()+100, parentPos.y()+100, 600, 400);
}
if (m_device)
fill_device_information();
}
DeviceInformationWindow::~DeviceInformationWindow()
{
}
void DeviceInformationWindow::restoreConfiguration(util::xml::data_node const &node)
{
WindowQt::restoreConfiguration(node);
auto const tag = node.get_attribute_string(ATTR_WINDOW_DEVICE_TAG, ":");
set_device(tag);
}
void DeviceInformationWindow::saveConfigurationToNode(util::xml::data_node &node)
{
WindowQt::saveConfigurationToNode(node);
node.set_attribute_int(ATTR_WINDOW_TYPE, WINDOW_TYPE_DEVICE_INFO_VIEWER);
node.set_attribute(ATTR_WINDOW_DEVICE_TAG, m_device->tag());
}
void DeviceInformationWindow::fill_device_information()
{
setWindowTitle(util::string_format("Debug: Device %s", m_device->tag()).c_str());
QFrame *mainWindowFrame = new QFrame(this);
QVBoxLayout *vLayout = new QVBoxLayout(mainWindowFrame);
vLayout->setObjectName("vlayout");
vLayout->setSpacing(3);
vLayout->setContentsMargins(2,2,2,2);
QFrame *primaryFrame = new QFrame(mainWindowFrame);
primaryFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
QGridLayout *gl1 = new QGridLayout(primaryFrame);
gl1->addWidget(new QLabel(QString("Tag"), primaryFrame), 0, 0);
gl1->addWidget(new QLabel(QString(m_device->tag()), primaryFrame), 0, 1);
gl1->addWidget(new QLabel(QString("Name"), primaryFrame), 1, 0);
gl1->addWidget(new QLabel(QString(m_device->name()), primaryFrame), 1, 1);
gl1->addWidget(new QLabel(QString("Shortname"), primaryFrame), 2, 0);
gl1->addWidget(new QLabel(QString(m_device->shortname()), primaryFrame), 2, 1);
int cpos = 3;
device_interface *intf = m_device->interfaces().first();
if (intf)
{
gl1->addWidget(new QLabel(QString("Interfaces"), primaryFrame), cpos, 0);
while(intf)
{
gl1->addWidget(new QLabel(QString(intf->interface_type()), primaryFrame), cpos, 1);
cpos++;
intf = intf->interface_next();
}
}
vLayout->addWidget(primaryFrame);
device_memory_interface *d_memory;
if (m_device->interface(d_memory))
{
QFrame *f = new QFrame(mainWindowFrame);
f->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
QVBoxLayout *vb = new QVBoxLayout(f);
bool first = true;
for (int i=0; i<d_memory->max_space_count(); i++)
if (d_memory->has_space(i))
{
QFrame *ff = new QFrame(f);
QHBoxLayout *hb = new QHBoxLayout(ff);
if (first)
{
hb->addWidget(new QLabel("Memory maps"));
first = false;
}
hb->addStretch();
hb->addWidget(new QLabel(d_memory->space_config(i)->name()));
vb->addWidget(ff);
}
vLayout->addWidget(f);
}
vLayout->addStretch();
setCentralWidget(mainWindowFrame);
}
void DeviceInformationWindow::set_device(const char *tag)
{
m_device = m_machine.root_device().subdevice(tag);
if (!m_device)
m_device = &m_machine.root_device();
fill_device_information();
}
} // namespace osd::debugger::qt
|