trunk/src/osd/modules/debugger/debugqt.c
| r242528 | r242529 | |
| 26 | 26 | #include "qt/debugqtmemorywindow.h" |
| 27 | 27 | #include "qt/debugqtbreakpointswindow.h" |
| 28 | 28 | #include "qt/debugqtdeviceswindow.h" |
| 29 | #include "qt/debugqtdeviceinformationwindow.h" |
| 29 | 30 | #include "debugqt.h" |
| 30 | 31 | |
| 31 | 32 | |
| r242528 | r242529 | |
| 86 | 87 | WindowQtConfig::WindowType type = (WindowQtConfig::WindowType)xml_get_attribute_int(wnode, "type", WindowQtConfig::WIN_TYPE_UNKNOWN); |
| 87 | 88 | switch (type) |
| 88 | 89 | { |
| 89 | | case WindowQtConfig::WIN_TYPE_MAIN: xmlConfigurations.push_back(new MainWindowQtConfig()); break; |
| 90 | | case WindowQtConfig::WIN_TYPE_MEMORY: xmlConfigurations.push_back(new MemoryWindowQtConfig()); break; |
| 91 | | case WindowQtConfig::WIN_TYPE_DASM: xmlConfigurations.push_back(new DasmWindowQtConfig()); break; |
| 92 | | case WindowQtConfig::WIN_TYPE_LOG: xmlConfigurations.push_back(new LogWindowQtConfig()); break; |
| 93 | | case WindowQtConfig::WIN_TYPE_BREAK_POINTS: xmlConfigurations.push_back(new BreakpointsWindowQtConfig()); break; |
| 94 | | case WindowQtConfig::WIN_TYPE_DEVICES: xmlConfigurations.push_back(new DevicesWindowQtConfig()); break; |
| 90 | case WindowQtConfig::WIN_TYPE_MAIN: xmlConfigurations.push_back(new MainWindowQtConfig()); break; |
| 91 | case WindowQtConfig::WIN_TYPE_MEMORY: xmlConfigurations.push_back(new MemoryWindowQtConfig()); break; |
| 92 | case WindowQtConfig::WIN_TYPE_DASM: xmlConfigurations.push_back(new DasmWindowQtConfig()); break; |
| 93 | case WindowQtConfig::WIN_TYPE_LOG: xmlConfigurations.push_back(new LogWindowQtConfig()); break; |
| 94 | case WindowQtConfig::WIN_TYPE_BREAK_POINTS: xmlConfigurations.push_back(new BreakpointsWindowQtConfig()); break; |
| 95 | case WindowQtConfig::WIN_TYPE_DEVICES: xmlConfigurations.push_back(new DevicesWindowQtConfig()); break; |
| 96 | case WindowQtConfig::WIN_TYPE_DEVICE_INFORMATION: xmlConfigurations.push_back(new DeviceInformationWindowQtConfig()); break; |
| 95 | 97 | default: continue; |
| 96 | 98 | } |
| 97 | 99 | xmlConfigurations.back()->recoverFromXmlNode(wnode); |
| r242528 | r242529 | |
| 149 | 151 | xmlConfigurations.push_back(new BreakpointsWindowQtConfig()); |
| 150 | 152 | else if (dynamic_cast<DevicesWindow*>(widget)) |
| 151 | 153 | xmlConfigurations.push_back(new DevicesWindowQtConfig()); |
| 154 | else if (dynamic_cast<DeviceInformationWindow*>(widget)) |
| 155 | xmlConfigurations.push_back(new DeviceInformationWindowQtConfig()); |
| 152 | 156 | |
| 153 | 157 | xmlConfigurations.back()->buildFromQWidget(widget); |
| 154 | 158 | } |
| r242528 | r242529 | |
| 193 | 197 | foo = new BreakpointsWindow(&machine); break; |
| 194 | 198 | case WindowQtConfig::WIN_TYPE_DEVICES: |
| 195 | 199 | foo = new DevicesWindow(&machine); break; |
| 200 | case WindowQtConfig::WIN_TYPE_DEVICE_INFORMATION: |
| 201 | foo = new DeviceInformationWindow(&machine); break; |
| 196 | 202 | default: break; |
| 197 | 203 | } |
| 198 | 204 | config->applyToQWidget(foo); |
trunk/src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.c
| r0 | r242529 | |
| 1 | #define NO_MEM_TRACKING |
| 2 | |
| 3 | #include "debugqtdeviceinformationwindow.h" |
| 4 | |
| 5 | |
| 6 | DeviceInformationWindow::DeviceInformationWindow(running_machine* machine, device_t* device, QWidget* parent) : |
| 7 | WindowQt(machine, NULL) |
| 8 | { |
| 9 | m_device = device; |
| 10 | |
| 11 | if (parent != NULL) |
| 12 | { |
| 13 | QPoint parentPos = parent->pos(); |
| 14 | setGeometry(parentPos.x()+100, parentPos.y()+100, 600, 400); |
| 15 | } |
| 16 | |
| 17 | if(m_device) |
| 18 | fill_device_information(); |
| 19 | } |
| 20 | |
| 21 | |
| 22 | DeviceInformationWindow::~DeviceInformationWindow() |
| 23 | { |
| 24 | } |
| 25 | |
| 26 | void DeviceInformationWindow::fill_device_information() |
| 27 | { |
| 28 | char title[4069]; |
| 29 | sprintf(title, "Debug: Device %s", m_device->tag()); |
| 30 | setWindowTitle(title); |
| 31 | |
| 32 | |
| 33 | QFrame *mainWindowFrame = new QFrame(this); |
| 34 | QVBoxLayout *vLayout = new QVBoxLayout(mainWindowFrame); |
| 35 | vLayout->setObjectName("vlayout"); |
| 36 | vLayout->setSpacing(3); |
| 37 | vLayout->setContentsMargins(2,2,2,2); |
| 38 | |
| 39 | QFrame *primaryFrame = new QFrame(mainWindowFrame); |
| 40 | primaryFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); |
| 41 | QGridLayout *gl1 = new QGridLayout(primaryFrame); |
| 42 | gl1->addWidget(new QLabel(QString("Tag"), primaryFrame), 0, 0); |
| 43 | gl1->addWidget(new QLabel(QString(m_device->tag()), primaryFrame), 0, 1); |
| 44 | gl1->addWidget(new QLabel(QString("Name"), primaryFrame), 1, 0); |
| 45 | gl1->addWidget(new QLabel(QString(m_device->name()), primaryFrame), 1, 1); |
| 46 | gl1->addWidget(new QLabel(QString("Shortname"), primaryFrame), 2, 0); |
| 47 | gl1->addWidget(new QLabel(QString(m_device->shortname()), primaryFrame), 2, 1); |
| 48 | |
| 49 | int cpos = 3; |
| 50 | device_interface *intf = m_device->first_interface(); |
| 51 | if(intf) { |
| 52 | gl1->addWidget(new QLabel(QString("Interfaces"), primaryFrame), cpos, 0); |
| 53 | while(intf) { |
| 54 | gl1->addWidget(new QLabel(QString(intf->interface_type()), primaryFrame), cpos, 1); |
| 55 | cpos++; |
| 56 | intf = intf->interface_next(); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | vLayout->addWidget(primaryFrame); |
| 61 | |
| 62 | device_memory_interface *d_memory; |
| 63 | if(m_device->interface(d_memory)) { |
| 64 | QFrame *f = new QFrame(mainWindowFrame); |
| 65 | f->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); |
| 66 | QVBoxLayout *vb = new QVBoxLayout(f); |
| 67 | bool first = true; |
| 68 | for(address_spacenum i=AS_0; i<ADDRESS_SPACES; i++) |
| 69 | if(d_memory->has_space(i)) { |
| 70 | QFrame *ff = new QFrame(f); |
| 71 | QHBoxLayout *hb = new QHBoxLayout(ff); |
| 72 | if(first) { |
| 73 | hb->addWidget(new QLabel("Memory maps")); |
| 74 | first = false; |
| 75 | } |
| 76 | hb->addStretch(); |
| 77 | hb->addWidget(new QLabel(d_memory->space_config(i)->name())); |
| 78 | vb->addWidget(ff); |
| 79 | } |
| 80 | vLayout->addWidget(f); |
| 81 | } |
| 82 | |
| 83 | vLayout->addStretch(); |
| 84 | |
| 85 | setCentralWidget(mainWindowFrame); |
| 86 | } |
| 87 | |
| 88 | void DeviceInformationWindow::set_device(const char *tag) |
| 89 | { |
| 90 | m_device = m_machine->device(tag); |
| 91 | if(!m_device) |
| 92 | m_device = &m_machine->root_device(); |
| 93 | fill_device_information(); |
| 94 | } |
| 95 | |
| 96 | const char *DeviceInformationWindow::device_tag() const |
| 97 | { |
| 98 | return m_device->tag(); |
| 99 | } |
| 100 | |
| 101 | |
| 102 | //========================================================================= |
| 103 | // DeviceInformationWindowQtConfig |
| 104 | //========================================================================= |
| 105 | void DeviceInformationWindowQtConfig::buildFromQWidget(QWidget* widget) |
| 106 | { |
| 107 | WindowQtConfig::buildFromQWidget(widget); |
| 108 | DeviceInformationWindow* window = dynamic_cast<DeviceInformationWindow*>(widget); |
| 109 | m_device_tag = window->device_tag(); |
| 110 | } |
| 111 | |
| 112 | |
| 113 | void DeviceInformationWindowQtConfig::applyToQWidget(QWidget* widget) |
| 114 | { |
| 115 | WindowQtConfig::applyToQWidget(widget); |
| 116 | DeviceInformationWindow* window = dynamic_cast<DeviceInformationWindow*>(widget); |
| 117 | window->set_device(m_device_tag.cstr()); |
| 118 | } |
| 119 | |
| 120 | |
| 121 | void DeviceInformationWindowQtConfig::addToXmlDataNode(xml_data_node* node) const |
| 122 | { |
| 123 | WindowQtConfig::addToXmlDataNode(node); |
| 124 | xml_set_attribute(node, "device-tag", m_device_tag); |
| 125 | } |
| 126 | |
| 127 | |
| 128 | void DeviceInformationWindowQtConfig::recoverFromXmlNode(xml_data_node* node) |
| 129 | { |
| 130 | WindowQtConfig::recoverFromXmlNode(node); |
| 131 | m_device_tag = xml_get_attribute_string(node, "device-tag", ":"); |
| 132 | } |
trunk/src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.h
| r0 | r242529 | |
| 1 | #ifndef __DEBUG_QT_DEVICE_INFORMATION_WINDOW_H__ |
| 2 | #define __DEBUG_QT_DEVICE_INFORMATION_WINDOW_H__ |
| 3 | |
| 4 | #include <QtGui/QtGui> |
| 5 | |
| 6 | #include "debugqtwindow.h" |
| 7 | |
| 8 | //============================================================ |
| 9 | // The Device Information Window. |
| 10 | //============================================================ |
| 11 | class DeviceInformationWindow : public WindowQt |
| 12 | { |
| 13 | Q_OBJECT |
| 14 | |
| 15 | public: |
| 16 | DeviceInformationWindow(running_machine* machine, device_t* device = NULL, QWidget* parent=NULL); |
| 17 | virtual ~DeviceInformationWindow(); |
| 18 | |
| 19 | void set_device(const char *tag); |
| 20 | const char *device_tag() const; |
| 21 | |
| 22 | private: |
| 23 | device_t *m_device; |
| 24 | |
| 25 | void fill_device_information(); |
| 26 | }; |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | //========================================================================= |
| 32 | // A way to store the configuration of a window long enough to read/write. |
| 33 | //========================================================================= |
| 34 | class DeviceInformationWindowQtConfig : public WindowQtConfig |
| 35 | { |
| 36 | public: |
| 37 | astring m_device_tag; |
| 38 | |
| 39 | DeviceInformationWindowQtConfig() : |
| 40 | WindowQtConfig(WIN_TYPE_DEVICE_INFORMATION) |
| 41 | { |
| 42 | } |
| 43 | |
| 44 | ~DeviceInformationWindowQtConfig() {} |
| 45 | |
| 46 | void buildFromQWidget(QWidget* widget); |
| 47 | void applyToQWidget(QWidget* widget); |
| 48 | void addToXmlDataNode(xml_data_node* node) const; |
| 49 | void recoverFromXmlNode(xml_data_node* node); |
| 50 | }; |
| 51 | |
| 52 | |
| 53 | #endif |
trunk/src/osd/modules/debugger/qt/debugqtdeviceswindow.c
| r242528 | r242529 | |
| 1 | 1 | #define NO_MEM_TRACKING |
| 2 | 2 | |
| 3 | 3 | #include "debugqtdeviceswindow.h" |
| 4 | #include "debugqtdeviceinformationwindow.h" |
| 4 | 5 | |
| 5 | 6 | DevicesWindowModel::DevicesWindowModel(running_machine *machine, QObject *parent) |
| 6 | 7 | { |
| r242528 | r242529 | |
| 18 | 19 | |
| 19 | 20 | device_t *dev = static_cast<device_t *>(index.internalPointer()); |
| 20 | 21 | switch(index.column()) { |
| 21 | | case 0: return QString(dev->basetag()); break; |
| 22 | | case 1: return QString(dev->name()); break; |
| 22 | case 0: return dev == &m_machine->root_device() ? QString("<root>") : QString(dev->basetag()); |
| 23 | case 1: return QString(dev->name()); |
| 23 | 24 | } |
| 24 | 25 | |
| 25 | 26 | return QVariant(); |
| r242528 | r242529 | |
| 108 | 109 | WindowQt(machine, NULL), |
| 109 | 110 | m_devices_model(machine) |
| 110 | 111 | { |
| 112 | m_selected_device = NULL; |
| 113 | |
| 111 | 114 | setWindowTitle("Debug: All Devices"); |
| 112 | 115 | |
| 113 | 116 | if (parent != NULL) |
| r242528 | r242529 | |
| 123 | 126 | m_devices_view->setModel(&m_devices_model); |
| 124 | 127 | m_devices_view->expandAll(); |
| 125 | 128 | m_devices_view->resizeColumnToContents(0); |
| 129 | connect(m_devices_view->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &,const QModelIndex &)), this, SLOT(currentRowChanged(const QModelIndex &,const QModelIndex &))); |
| 130 | connect(m_devices_view, SIGNAL(activated(const QModelIndex &)), this, SLOT(activated(const QModelIndex &))); |
| 126 | 131 | setCentralWidget(m_devices_view); |
| 127 | 132 | } |
| 128 | 133 | |
| r242528 | r242529 | |
| 132 | 137 | } |
| 133 | 138 | |
| 134 | 139 | |
| 140 | void DevicesWindow::currentRowChanged(const QModelIndex ¤t, const QModelIndex &previous) |
| 141 | { |
| 142 | m_selected_device = static_cast<device_t *>(current.internalPointer()); |
| 143 | } |
| 135 | 144 | |
| 145 | |
| 146 | void DevicesWindow::activated(const QModelIndex &index) |
| 147 | { |
| 148 | device_t *dev = static_cast<device_t *>(index.internalPointer()); |
| 149 | (new DeviceInformationWindow(m_machine, dev, this))->show(); |
| 150 | } |
| 151 | |
| 152 | |
| 153 | |
| 136 | 154 | //========================================================================= |
| 137 | 155 | // DevicesWindowQtConfig |
| 138 | 156 | //========================================================================= |