trunk/src/osd/sdl/debugqtmainwindow.c
| r22572 | r22573 | |
| 50 | 50 | |
| 51 | 51 | // Right bar options |
| 52 | 52 | QActionGroup* rightBarGroup = new QActionGroup(this); |
| 53 | rightBarGroup->setObjectName("rightbargroup"); |
| 53 | 54 | QAction* rightActRaw = new QAction("Raw Opcodes", this); |
| 54 | 55 | QAction* rightActEncrypted = new QAction("Encrypted Opcodes", this); |
| 55 | 56 | QAction* rightActComments = new QAction("Comments", this); |
| r22572 | r22573 | |
| 83 | 84 | |
| 84 | 85 | // The processor dock |
| 85 | 86 | QDockWidget* cpuDock = new QDockWidget("processor", this); |
| 87 | cpuDock->setObjectName("cpudock"); |
| 86 | 88 | cpuDock->setAllowedAreas(Qt::LeftDockWidgetArea); |
| 87 | 89 | m_procFrame = new ProcessorDockWidget(m_machine, cpuDock); |
| 88 | 90 | cpuDock->setWidget(dynamic_cast<QWidget*>(m_procFrame)); |
| r22572 | r22573 | |
| 92 | 94 | |
| 93 | 95 | // The disassembly dock |
| 94 | 96 | QDockWidget* dasmDock = new QDockWidget("dasm", this); |
| 97 | dasmDock->setObjectName("dasmdock"); |
| 95 | 98 | dasmDock->setAllowedAreas(Qt::TopDockWidgetArea); |
| 96 | 99 | m_dasmFrame = new DasmDockWidget(m_machine, dasmDock); |
| 97 | 100 | dasmDock->setWidget(m_dasmFrame); |
| r22572 | r22573 | |
| 122 | 125 | void MainWindow::closeEvent(QCloseEvent* event) |
| 123 | 126 | { |
| 124 | 127 | debugActQuit(); |
| 128 | |
| 129 | // Insure the window doesn't disappear before we get a chance to save its parameters |
| 130 | event->ignore(); |
| 125 | 131 | } |
| 126 | 132 | |
| 127 | 133 | |
| r22572 | r22573 | |
| 318 | 324 | m_inputHistory.push_back(m_inputEdit->text()); |
| 319 | 325 | } |
| 320 | 326 | } |
| 327 | |
| 328 | |
| 329 | //========================================================================= |
| 330 | // MainWindowQtConfig |
| 331 | //========================================================================= |
| 332 | void MainWindowQtConfig::buildFromQWidget(QWidget* widget) |
| 333 | { |
| 334 | WindowQtConfig::buildFromQWidget(widget); |
| 335 | MainWindow* window = dynamic_cast<MainWindow*>(widget); |
| 336 | m_windowState = window->saveState(); |
| 337 | |
| 338 | QActionGroup* rightBarGroup = window->findChild<QActionGroup*>("rightbargroup"); |
| 339 | if (rightBarGroup->checkedAction()->text() == "Raw Opcodes") |
| 340 | m_rightBar = 0; |
| 341 | else if (rightBarGroup->checkedAction()->text() == "Encrypted Opcodes") |
| 342 | m_rightBar = 1; |
| 343 | else if (rightBarGroup->checkedAction()->text() == "Comments") |
| 344 | m_rightBar = 2; |
| 345 | } |
| 346 | |
| 347 | |
| 348 | void MainWindowQtConfig::applyToQWidget(QWidget* widget) |
| 349 | { |
| 350 | WindowQtConfig::applyToQWidget(widget); |
| 351 | MainWindow* window = dynamic_cast<MainWindow*>(widget); |
| 352 | window->restoreState(m_windowState); |
| 353 | |
| 354 | QActionGroup* rightBarGroup = window->findChild<QActionGroup*>("rightbargroup"); |
| 355 | rightBarGroup->actions()[m_rightBar]->trigger(); |
| 356 | } |
| 357 | |
| 358 | |
| 359 | void MainWindowQtConfig::addToXmlDataNode(xml_data_node* node) const |
| 360 | { |
| 361 | WindowQtConfig::addToXmlDataNode(node); |
| 362 | xml_set_attribute_int(node, "rightbar", m_rightBar); |
| 363 | xml_set_attribute(node, "qtwindowstate", m_windowState.toPercentEncoding().data()); |
| 364 | } |
| 365 | |
| 366 | |
| 367 | void MainWindowQtConfig::recoverFromXmlNode(xml_data_node* node) |
| 368 | { |
| 369 | WindowQtConfig::recoverFromXmlNode(node); |
| 370 | const char* state = xml_get_attribute_string(node, "qtwindowstate", ""); |
| 371 | m_windowState = QByteArray::fromPercentEncoding(state); |
| 372 | m_rightBar = xml_get_attribute_int(node, "rightbar", m_rightBar); |
| 373 | } |
trunk/src/osd/sdl/debugqtwindow.c
| r22572 | r22573 | |
| 199 | 199 | { |
| 200 | 200 | m_machine->schedule_exit(); |
| 201 | 201 | } |
| 202 | |
| 203 | |
| 204 | //========================================================================= |
| 205 | // WindowQtConfig |
| 206 | //========================================================================= |
| 207 | void WindowQtConfig::buildFromQWidget(QWidget* widget) |
| 208 | { |
| 209 | m_position.setX(widget->geometry().topLeft().x()); |
| 210 | m_position.setY(widget->geometry().topLeft().y()); |
| 211 | m_size.setX(widget->size().width()); |
| 212 | m_size.setY(widget->size().height()); |
| 213 | } |
| 214 | |
| 215 | |
| 216 | void WindowQtConfig::applyToQWidget(QWidget* widget) |
| 217 | { |
| 218 | widget->setGeometry(m_position.x(), m_position.y(), m_size.x(), m_size.y()); |
| 219 | } |
| 220 | |
| 221 | |
| 222 | void WindowQtConfig::addToXmlDataNode(xml_data_node* node) const |
| 223 | { |
| 224 | xml_set_attribute_int(node, "type", m_type); |
| 225 | xml_set_attribute_int(node, "position_x", m_position.x()); |
| 226 | xml_set_attribute_int(node, "position_y", m_position.y()); |
| 227 | xml_set_attribute_int(node, "size_x", m_size.x()); |
| 228 | xml_set_attribute_int(node, "size_y", m_size.y()); |
| 229 | } |
| 230 | |
| 231 | |
| 232 | void WindowQtConfig::recoverFromXmlNode(xml_data_node* node) |
| 233 | { |
| 234 | m_size.setX(xml_get_attribute_int(node, "size_x", m_size.x())); |
| 235 | m_size.setY(xml_get_attribute_int(node, "size_y", m_size.y())); |
| 236 | m_position.setX(xml_get_attribute_int(node, "position_x", m_position.x())); |
| 237 | m_position.setY(xml_get_attribute_int(node, "position_y", m_position.y())); |
| 238 | m_type = (WindowQtConfig::WindowType)xml_get_attribute_int(node, "type", m_type); |
| 239 | } |
trunk/src/osd/sdl/debugqt.c
| r22572 | r22573 | |
| 46 | 46 | |
| 47 | 47 | static void xml_configuration_load(running_machine &machine, int config_type, xml_data_node *parentnode) |
| 48 | 48 | { |
| 49 | | xml_data_node *wnode; |
| 50 | | |
| 51 | 49 | // We only care about game files |
| 52 | 50 | if (config_type != CONFIG_TYPE_GAME) |
| 53 | 51 | return; |
| r22572 | r22573 | |
| 59 | 57 | xmlConfigurations.reset(); |
| 60 | 58 | |
| 61 | 59 | // Configuration load |
| 60 | xml_data_node* wnode = NULL; |
| 62 | 61 | for (wnode = xml_get_sibling(parentnode->child, "window"); wnode != NULL; wnode = xml_get_sibling(wnode->next, "window")) |
| 63 | 62 | { |
| 64 | | WindowQtConfig& config = xmlConfigurations.append(*global_alloc(WindowQtConfig)); |
| 65 | | config.m_size.setX(xml_get_attribute_int(wnode, "size_x", config.m_size.x())); |
| 66 | | config.m_size.setY(xml_get_attribute_int(wnode, "size_y", config.m_size.y())); |
| 67 | | config.m_position.setX(xml_get_attribute_int(wnode, "position_x", config.m_position.x())); |
| 68 | | config.m_position.setY(xml_get_attribute_int(wnode, "position_y", config.m_position.y())); |
| 69 | | config.m_type = (WindowQtConfig::WindowType)xml_get_attribute_int(wnode, "type", config.m_type); |
| 63 | WindowQtConfig* config = NULL; |
| 64 | WindowQtConfig::WindowType type = (WindowQtConfig::WindowType)xml_get_attribute_int(wnode, "type", WindowQtConfig::WIN_TYPE_UNKNOWN); |
| 65 | switch (type) |
| 66 | { |
| 67 | case WindowQtConfig::WIN_TYPE_MAIN: config = &xmlConfigurations.append(*global_alloc(MainWindowQtConfig)); break; |
| 68 | case WindowQtConfig::WIN_TYPE_MEMORY: config = &xmlConfigurations.append(*global_alloc(MemoryWindowQtConfig)); break; |
| 69 | case WindowQtConfig::WIN_TYPE_DASM: config = &xmlConfigurations.append(*global_alloc(DasmWindowQtConfig)); break; |
| 70 | case WindowQtConfig::WIN_TYPE_LOG: config = &xmlConfigurations.append(*global_alloc(LogWindowQtConfig)); break; |
| 71 | default: break; |
| 72 | } |
| 73 | config->recoverFromXmlNode(wnode); |
| 70 | 74 | } |
| 71 | 75 | } |
| 72 | 76 | |
| 73 | 77 | |
| 74 | 78 | static void xml_configuration_save(running_machine &machine, int config_type, xml_data_node *parentnode) |
| 75 | 79 | { |
| 76 | | // We only care about game files |
| 80 | // We only write to game configurations |
| 77 | 81 | if (config_type != CONFIG_TYPE_GAME) |
| 78 | 82 | return; |
| 79 | 83 | |
| r22572 | r22573 | |
| 85 | 89 | if (debugger_node == NULL) |
| 86 | 90 | continue; |
| 87 | 91 | |
| 88 | | xml_set_attribute_int(debugger_node, "type", config->m_type); |
| 89 | | xml_set_attribute_int(debugger_node, "position_x", config->m_position.x()); |
| 90 | | xml_set_attribute_int(debugger_node, "position_y", config->m_position.y()); |
| 91 | | xml_set_attribute_int(debugger_node, "size_x", config->m_size.x()); |
| 92 | | xml_set_attribute_int(debugger_node, "size_y", config->m_size.y()); |
| 92 | // Insert the appropriate information |
| 93 | config->addToXmlDataNode(debugger_node); |
| 93 | 94 | } |
| 94 | 95 | } |
| 95 | 96 | |
| r22572 | r22573 | |
| 108 | 109 | continue; |
| 109 | 110 | |
| 110 | 111 | // Figure out its type |
| 111 | | WindowQtConfig::WindowType type = WindowQtConfig::WIN_TYPE_UNKNOWN; |
| 112 | WindowQtConfig* config = NULL; |
| 112 | 113 | if (dynamic_cast<MainWindow*>(widget)) |
| 113 | | type = WindowQtConfig::WIN_TYPE_MAIN; |
| 114 | config = &xmlConfigurations.append(*global_alloc(MainWindowQtConfig)); |
| 114 | 115 | else if (dynamic_cast<MemoryWindow*>(widget)) |
| 115 | | type = WindowQtConfig::WIN_TYPE_MEMORY; |
| 116 | config = &xmlConfigurations.append(*global_alloc(MemoryWindowQtConfig)); |
| 116 | 117 | else if (dynamic_cast<DasmWindow*>(widget)) |
| 117 | | type = WindowQtConfig::WIN_TYPE_DISASM; |
| 118 | config = &xmlConfigurations.append(*global_alloc(DasmWindowQtConfig)); |
| 118 | 119 | else if (dynamic_cast<LogWindow*>(widget)) |
| 119 | | type = WindowQtConfig::WIN_TYPE_LOG; |
| 120 | config = &xmlConfigurations.append(*global_alloc(LogWindowQtConfig)); |
| 120 | 121 | |
| 121 | | WindowQtConfig& config = xmlConfigurations.append(*global_alloc(WindowQtConfig)); |
| 122 | | config.m_type = type; |
| 123 | | config.m_position.setX(widget->geometry().topLeft().x()); |
| 124 | | config.m_position.setY(widget->geometry().topLeft().y()); |
| 125 | | config.m_size.setX(widget->size().width()); |
| 126 | | config.m_size.setY(widget->size().height()); |
| 122 | config->buildFromQWidget(widget); |
| 127 | 123 | } |
| 128 | 124 | } |
| 129 | 125 | |
| r22572 | r22573 | |
| 138 | 134 | { |
| 139 | 135 | if (config->m_type == WindowQtConfig::WIN_TYPE_MAIN) |
| 140 | 136 | { |
| 141 | | mainQtWindow->setGeometry(config->m_position.x(), config->m_position.y(), |
| 142 | | config->m_size.x(), config->m_size.y()); |
| 137 | config->applyToQWidget(mainQtWindow); |
| 143 | 138 | configList.remove(*config); |
| 144 | 139 | break; |
| 145 | 140 | } |
| r22572 | r22573 | |
| 156 | 151 | { |
| 157 | 152 | case WindowQtConfig::WIN_TYPE_MEMORY: |
| 158 | 153 | foo = new MemoryWindow(&machine); break; |
| 159 | | case WindowQtConfig::WIN_TYPE_DISASM: |
| 154 | case WindowQtConfig::WIN_TYPE_DASM: |
| 160 | 155 | foo = new DasmWindow(&machine); break; |
| 161 | 156 | case WindowQtConfig::WIN_TYPE_LOG: |
| 162 | 157 | foo = new LogWindow(&machine); break; |
| 163 | 158 | default: break; |
| 164 | 159 | } |
| 165 | | foo->setGeometry(config->m_position.x(), config->m_position.y(), |
| 166 | | config->m_size.x(), config->m_size.y()); |
| 160 | config->applyToQWidget(foo); |
| 167 | 161 | foo->show(); |
| 168 | 162 | } |
| 169 | 163 | } |
trunk/src/osd/sdl/debugqtdasmwindow.c
| r22572 | r22573 | |
| 30 | 30 | |
| 31 | 31 | // The cpu combo box |
| 32 | 32 | m_cpuComboBox = new QComboBox(topSubFrame); |
| 33 | m_cpuComboBox->setObjectName("cpu"); |
| 33 | 34 | m_cpuComboBox->setMinimumWidth(300); |
| 34 | 35 | connect(m_cpuComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(cpuChanged(int))); |
| 35 | 36 | |
| r22572 | r22573 | |
| 76 | 77 | |
| 77 | 78 | // Right bar options |
| 78 | 79 | QActionGroup* rightBarGroup = new QActionGroup(this); |
| 80 | rightBarGroup->setObjectName("rightbargroup"); |
| 79 | 81 | QAction* rightActRaw = new QAction("Raw Opcodes", this); |
| 80 | 82 | QAction* rightActEncrypted = new QAction("Encrypted Opcodes", this); |
| 81 | 83 | QAction* rightActComments = new QAction("Comments", this); |
| r22572 | r22573 | |
| 202 | 204 | m_cpuComboBox->addItem(source->name()); |
| 203 | 205 | } |
| 204 | 206 | } |
| 207 | |
| 208 | |
| 209 | //========================================================================= |
| 210 | // DasmWindowQtConfig |
| 211 | //========================================================================= |
| 212 | void DasmWindowQtConfig::buildFromQWidget(QWidget* widget) |
| 213 | { |
| 214 | WindowQtConfig::buildFromQWidget(widget); |
| 215 | DasmWindow* window = dynamic_cast<DasmWindow*>(widget); |
| 216 | QComboBox* cpu = window->findChild<QComboBox*>("cpu"); |
| 217 | m_cpu = cpu->currentIndex(); |
| 218 | |
| 219 | QActionGroup* rightBarGroup = window->findChild<QActionGroup*>("rightbargroup"); |
| 220 | if (rightBarGroup->checkedAction()->text() == "Raw Opcodes") |
| 221 | m_rightBar = 0; |
| 222 | else if (rightBarGroup->checkedAction()->text() == "Encrypted Opcodes") |
| 223 | m_rightBar = 1; |
| 224 | else if (rightBarGroup->checkedAction()->text() == "Comments") |
| 225 | m_rightBar = 2; |
| 226 | } |
| 227 | |
| 228 | void DasmWindowQtConfig::applyToQWidget(QWidget* widget) |
| 229 | { |
| 230 | WindowQtConfig::applyToQWidget(widget); |
| 231 | DasmWindow* window = dynamic_cast<DasmWindow*>(widget); |
| 232 | QComboBox* cpu = window->findChild<QComboBox*>("cpu"); |
| 233 | cpu->setCurrentIndex(m_cpu); |
| 234 | |
| 235 | QActionGroup* rightBarGroup = window->findChild<QActionGroup*>("rightbargroup"); |
| 236 | rightBarGroup->actions()[m_rightBar]->trigger(); |
| 237 | } |
| 238 | |
| 239 | void DasmWindowQtConfig::addToXmlDataNode(xml_data_node* node) const |
| 240 | { |
| 241 | WindowQtConfig::addToXmlDataNode(node); |
| 242 | xml_set_attribute_int(node, "cpu", m_cpu); |
| 243 | xml_set_attribute_int(node, "rightbar", m_rightBar); |
| 244 | } |
| 245 | |
| 246 | void DasmWindowQtConfig::recoverFromXmlNode(xml_data_node* node) |
| 247 | { |
| 248 | WindowQtConfig::recoverFromXmlNode(node); |
| 249 | m_cpu = xml_get_attribute_int(node, "cpu", m_cpu); |
| 250 | m_rightBar = xml_get_attribute_int(node, "rightbar", m_rightBar); |
| 251 | } |
trunk/src/osd/sdl/debugqtmemorywindow.c
| r22572 | r22573 | |
| 30 | 30 | |
| 31 | 31 | // The memory space combo box |
| 32 | 32 | m_memoryComboBox = new QComboBox(topSubFrame); |
| 33 | m_memoryComboBox->setObjectName("memoryregion"); |
| 33 | 34 | m_memoryComboBox->setMinimumWidth(300); |
| 34 | 35 | connect(m_memoryComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(memoryRegionChanged(int))); |
| 35 | 36 | |
| r22572 | r22573 | |
| 58 | 59 | // |
| 59 | 60 | // Create a byte-chunk group |
| 60 | 61 | QActionGroup* chunkGroup = new QActionGroup(this); |
| 62 | chunkGroup->setObjectName("chunkgroup"); |
| 61 | 63 | QAction* chunkActOne = new QAction("1-byte chunks", this); |
| 62 | 64 | chunkActOne->setObjectName("chunkActOne"); |
| 63 | 65 | QAction* chunkActTwo = new QAction("2-byte chunks", this); |
| r22572 | r22573 | |
| 78 | 80 | |
| 79 | 81 | // Create a address display group |
| 80 | 82 | QActionGroup* addressGroup = new QActionGroup(this); |
| 83 | addressGroup->setObjectName("addressgroup"); |
| 81 | 84 | QAction* addressActLogical = new QAction("Logical Addresses", this); |
| 82 | 85 | QAction* addressActPhysical = new QAction("Physical Addresses", this); |
| 83 | 86 | addressActLogical->setCheckable(true); |
| r22572 | r22573 | |
| 91 | 94 | |
| 92 | 95 | // Create a reverse view radio |
| 93 | 96 | QAction* reverseAct = new QAction("Reverse View", this); |
| 97 | reverseAct->setObjectName("reverse"); |
| 94 | 98 | reverseAct->setCheckable(true); |
| 95 | 99 | reverseAct->setShortcut(QKeySequence("Ctrl+R")); |
| 96 | 100 | connect(reverseAct, SIGNAL(toggled(bool)), this, SLOT(reverseChanged(bool))); |
| r22572 | r22573 | |
| 258 | 262 | } |
| 259 | 263 | return NULL; |
| 260 | 264 | } |
| 265 | |
| 266 | |
| 267 | //========================================================================= |
| 268 | // MemoryWindowQtConfig |
| 269 | //========================================================================= |
| 270 | void MemoryWindowQtConfig::buildFromQWidget(QWidget* widget) |
| 271 | { |
| 272 | WindowQtConfig::buildFromQWidget(widget); |
| 273 | MemoryWindow* window = dynamic_cast<MemoryWindow*>(widget); |
| 274 | QComboBox* memoryRegion = window->findChild<QComboBox*>("memoryregion"); |
| 275 | m_memoryRegion = memoryRegion->currentIndex(); |
| 276 | |
| 277 | QAction* reverse = window->findChild<QAction*>("reverse"); |
| 278 | m_reverse = reverse->isChecked(); |
| 279 | |
| 280 | QActionGroup* addressGroup = window->findChild<QActionGroup*>("addressgroup"); |
| 281 | if (addressGroup->checkedAction()->text() == "Logical Addresses") |
| 282 | m_addressMode = 0; |
| 283 | else if (addressGroup->checkedAction()->text() == "Physical Addresses") |
| 284 | m_addressMode = 1; |
| 285 | |
| 286 | QActionGroup* chunkGroup = window->findChild<QActionGroup*>("chunkgroup"); |
| 287 | if (chunkGroup->checkedAction()->text() == "1-byte chunks") |
| 288 | m_chunkSize = 0; |
| 289 | else if (chunkGroup->checkedAction()->text() == "2-byte chunks") |
| 290 | m_chunkSize = 1; |
| 291 | else if (chunkGroup->checkedAction()->text() == "4-byte chunks") |
| 292 | m_chunkSize = 2; |
| 293 | } |
| 294 | |
| 295 | |
| 296 | void MemoryWindowQtConfig::applyToQWidget(QWidget* widget) |
| 297 | { |
| 298 | WindowQtConfig::applyToQWidget(widget); |
| 299 | MemoryWindow* window = dynamic_cast<MemoryWindow*>(widget); |
| 300 | QComboBox* memoryRegion = window->findChild<QComboBox*>("memoryregion"); |
| 301 | memoryRegion->setCurrentIndex(m_memoryRegion); |
| 302 | |
| 303 | QAction* reverse = window->findChild<QAction*>("reverse"); |
| 304 | if (m_reverse) reverse->trigger(); |
| 305 | |
| 306 | QActionGroup* addressGroup = window->findChild<QActionGroup*>("addressgroup"); |
| 307 | addressGroup->actions()[m_addressMode]->trigger(); |
| 308 | |
| 309 | QActionGroup* chunkGroup = window->findChild<QActionGroup*>("chunkgroup"); |
| 310 | chunkGroup->actions()[m_chunkSize]->trigger(); |
| 311 | } |
| 312 | |
| 313 | |
| 314 | void MemoryWindowQtConfig::addToXmlDataNode(xml_data_node* node) const |
| 315 | { |
| 316 | WindowQtConfig::addToXmlDataNode(node); |
| 317 | xml_set_attribute_int(node, "memoryregion", m_memoryRegion); |
| 318 | xml_set_attribute_int(node, "reverse", m_reverse); |
| 319 | xml_set_attribute_int(node, "addressmode", m_addressMode); |
| 320 | xml_set_attribute_int(node, "chunksize", m_chunkSize); |
| 321 | } |
| 322 | |
| 323 | |
| 324 | void MemoryWindowQtConfig::recoverFromXmlNode(xml_data_node* node) |
| 325 | { |
| 326 | WindowQtConfig::recoverFromXmlNode(node); |
| 327 | m_memoryRegion = xml_get_attribute_int(node, "memoryregion", m_memoryRegion); |
| 328 | m_reverse = xml_get_attribute_int(node, "reverse", m_reverse); |
| 329 | m_addressMode = xml_get_attribute_int(node, "addressmode", m_addressMode); |
| 330 | m_chunkSize = xml_get_attribute_int(node, "chunksize", m_chunkSize); |
| 331 | } |