[kde] MegaDriveView: Display most of the information.

SRAM information isn't displayed yet, and Shift-JIS ROM names aren't
decoded correctly.
This commit is contained in:
David Korth 2016-07-19 23:32:20 -04:00
parent 314b2cd68f
commit 19b2eea6c5
2 changed files with 102 additions and 6 deletions

View File

@ -21,6 +21,7 @@
#include "MegaDriveView.hpp"
#include "libromdata/MegaDrive.hpp"
#include <cstdio>
#include "ui_MegaDriveView.h"
class MegaDriveViewPrivate
@ -38,6 +39,11 @@ class MegaDriveViewPrivate
public:
Ui::MegaDriveView ui;
const LibRomData::MegaDrive *rom;
/**
* Update the display widgets.
*/
void updateDisplay(void);
};
/** MegaDriveViewPrivate **/
@ -52,6 +58,57 @@ MegaDriveViewPrivate::~MegaDriveViewPrivate()
delete rom;
}
/**
* Update the display widgets.
*/
void MegaDriveViewPrivate::updateDisplay(void)
{
ui.lblSystem->setText(QString::fromUtf8(rom->m_system.c_str()));
ui.lblCopyright->setText(QString::fromUtf8(rom->m_copyright.c_str()));
ui.lblTitleDomestic->setText(QString::fromUtf8(rom->m_title_domestic.c_str()));
ui.lblTitleExport->setText(QString::fromUtf8(rom->m_title_export.c_str()));
ui.lblSerialNumber->setText(QString::fromUtf8(rom->m_serial.c_str()));
// TODO: Company.
// Checksum, in hex.
char buf[128];
snprintf(buf, sizeof(buf), "0x%04X", rom->m_checksum);
ui.lblChecksum->setText(QLatin1String(buf));
// FIXME: Verify checksum?
ui.lblChecksumStatus->setVisible(false);
// I/O support.
ui.chkIO3btn->setChecked(!!(rom->m_io_support & LibRomData::MegaDrive::IO_JOYPAD_3));
ui.chkIO6btn->setChecked(!!(rom->m_io_support & LibRomData::MegaDrive::IO_JOYPAD_6));
ui.chkIO2btn->setChecked(!!(rom->m_io_support & LibRomData::MegaDrive::IO_JOYPAD_SMS));
ui.chkIOTeamPlayer->setChecked(!!(rom->m_io_support & LibRomData::MegaDrive::IO_TEAM_PLAYER));
ui.chkIOKeyboard->setChecked(!!(rom->m_io_support & LibRomData::MegaDrive::IO_KEYBOARD));
ui.chkIOSerial->setChecked(!!(rom->m_io_support & LibRomData::MegaDrive::IO_SERIAL));
ui.chkIOPrinter->setChecked(!!(rom->m_io_support & LibRomData::MegaDrive::IO_PRINTER));
ui.chkIOTablet->setChecked(!!(rom->m_io_support & LibRomData::MegaDrive::IO_TABLET));
ui.chkIOTrackball->setChecked(!!(rom->m_io_support & LibRomData::MegaDrive::IO_TRACKBALL));
ui.chkIOPaddle->setChecked(!!(rom->m_io_support & LibRomData::MegaDrive::IO_PADDLE));
ui.chkIOFloppy->setChecked(!!(rom->m_io_support & LibRomData::MegaDrive::IO_FDD));
ui.chkIOMegaCD->setChecked(!!(rom->m_io_support & LibRomData::MegaDrive::IO_CDROM));
ui.chkIOActivator->setChecked(!!(rom->m_io_support & LibRomData::MegaDrive::IO_ACTIVATOR));
ui.chkIOMegaMouse->setChecked(!!(rom->m_io_support & LibRomData::MegaDrive::IO_MEGA_MOUSE));
// ROM range.
snprintf(buf, sizeof(buf), "0x%08X - 0x%08X", rom->m_rom_start, rom->m_rom_end);
ui.lblROMRange->setText(QLatin1String(buf));
// RAM range.
snprintf(buf, sizeof(buf), "0x%08X - 0x%08X", rom->m_ram_start, rom->m_ram_end);
ui.lblRAMRange->setText(QLatin1String(buf));
// TODO: SRAM.
// Vectors.
snprintf(buf, sizeof(buf), "0x%08X", rom->m_entry_point);
ui.lblEntryPoint->setText(QLatin1String(buf));
snprintf(buf, sizeof(buf), "0x%08X", rom->m_initial_sp);
ui.lblInitialSP->setText(QLatin1String(buf));
}
/** MegaDriveView **/
MegaDriveView::MegaDriveView(const LibRomData::MegaDrive *rom, QWidget *parent)
@ -60,6 +117,9 @@ MegaDriveView::MegaDriveView(const LibRomData::MegaDrive *rom, QWidget *parent)
{
Q_D(MegaDriveView);
d->ui.setupUi(this);
// Update the display widgets.
d->updateDisplay();
}
MegaDriveView::~MegaDriveView()

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>373</width>
<height>359</height>
<width>483</width>
<height>373</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
@ -29,6 +29,9 @@
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="1" column="0">
@ -46,10 +49,13 @@
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblDomesticTitleDesc">
<widget class="QLabel" name="lblTitleDomesticDesc">
<property name="text">
<string>Domestic Title:</string>
</property>
@ -59,14 +65,17 @@
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="lblDomesticTitle">
<widget class="QLabel" name="lblTitleDomestic">
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lblExportTitleDesc">
<widget class="QLabel" name="lblTitleExportDesc">
<property name="text">
<string>Export Title:</string>
</property>
@ -76,10 +85,13 @@
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="lblExportTitle">
<widget class="QLabel" name="lblTitleExport">
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="4" column="0">
@ -97,6 +109,9 @@
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="5" column="0">
@ -114,6 +129,9 @@
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="6" column="0">
@ -133,6 +151,9 @@
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
@ -287,6 +308,9 @@
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="9" column="0">
@ -304,6 +328,9 @@
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="10" column="0">
@ -321,6 +348,9 @@
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="11" column="0">
@ -338,6 +368,9 @@
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="12" column="0">
@ -355,6 +388,9 @@
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>