Qt: Start work on ROM information view

This commit is contained in:
Jeffrey Pfau 2015-12-20 02:44:19 -08:00
parent 080c975328
commit cd6b6862ff
7 changed files with 172 additions and 0 deletions

View File

@ -6,6 +6,7 @@ Features:
- Customization of GIF recording
- Libretro: Cheat code support
- Support for GLSL shaders
- ROM information view
Bugfixes:
- Util: Fix PowerPC PNG read/write pixel order
- VFS: Fix VFileReadline and remove _vfdReadline

View File

@ -91,6 +91,7 @@ set(SOURCE_FILES
MultiplayerController.cpp
OverrideView.cpp
PaletteView.cpp
ROMInfo.cpp
SavestateButton.cpp
SensorView.cpp
SettingsView.cpp
@ -112,6 +113,7 @@ qt5_wrap_ui(UI_FILES
MemoryView.ui
OverrideView.ui
PaletteView.ui
ROMInfo.ui
SensorView.ui
SettingsView.ui
ShaderSelector.ui

View File

@ -0,0 +1,29 @@
/* Copyright (c) 2013-2015 Jeffrey Pfau
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ROMInfo.h"
#include "GameController.h"
using namespace QGBA;
ROMInfo::ROMInfo(GameController* controller, QWidget* parent) {
m_ui.setupUi(this);
if (!controller->isLoaded()) {
return;
}
controller->threadInterrupt();
GBA* gba = controller->thread()->gba;
char title[13] = {};
GBAGetGameCode(gba, title);
m_ui.id->setText(QLatin1String(title));
GBAGetGameTitle(gba, title);
m_ui.title->setText(QLatin1String(title));
m_ui.size->setText(QString::number(gba->pristineRomSize));
m_ui.crc->setText(QString::number(gba->romCrc32, 16));
controller->threadContinue();
}

33
src/platform/qt/ROMInfo.h Normal file
View File

@ -0,0 +1,33 @@
/* Copyright (c) 2013-2015 Jeffrey Pfau
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef QGBA_ROM_INFO
#define QGBA_ROM_INFO
#include <QWidget>
#include "ui_ROMInfo.h"
extern "C" {
#include "gba/supervisor/thread.h"
}
namespace QGBA {
class GameController;
class ROMInfo : public QDialog {
Q_OBJECT
public:
ROMInfo(GameController* controller, QWidget* parent = nullptr);
private:
Ui::ROMInfo m_ui;
};
}
#endif

View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ROMInfo</class>
<widget class="QDialog" name="ROMInfo">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>236</width>
<height>142</height>
</rect>
</property>
<property name="windowTitle">
<string>ROM Info</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="fieldGrowthPolicy">
<enum>QFormLayout::FieldsStayAtSizeHint</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Game ID:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="id">
<property name="text">
<string>{ID}</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Internal name:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="title">
<property name="text">
<string>{TITLE}</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>File size:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="size">
<property name="text">
<string>{SIZE}</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>CRC32:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="crc">
<property name="text">
<string>{CRC}</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -31,6 +31,7 @@
#include "MemoryView.h"
#include "OverrideView.h"
#include "PaletteView.h"
#include "ROMInfo.h"
#include "SensorView.h"
#include "SettingsView.h"
#include "ShaderSelector.h"
@ -400,6 +401,11 @@ void Window::openAboutScreen() {
openView(about);
}
void Window::openROMInfo() {
ROMInfo* romInfo = new ROMInfo(m_controller);
openView(romInfo);
}
#ifdef BUILD_SDL
void Window::openGamepadWindow() {
const char* profile = m_inputController.profileForType(SDL_BINDING_BUTTON);
@ -767,6 +773,11 @@ void Window::setupMenu(QMenuBar* menubar) {
addControlledAction(fileMenu, fileMenu->addAction(tr("Replace ROM..."), this, SLOT(replaceROM())), "replaceROM");
QAction* romInfo = new QAction(tr("ROM &info..."), fileMenu);
connect(romInfo, SIGNAL(triggered()), this, SLOT(openROMInfo()));
m_gameActions.append(romInfo);
addControlledAction(fileMenu, romInfo, "romInfo");
m_mruMenu = fileMenu->addMenu(tr("Recent"));
fileMenu->addSeparator();

View File

@ -88,6 +88,7 @@ public slots:
void openIOViewer();
void openAboutScreen();
void openROMInfo();
#ifdef BUILD_SDL
void openGamepadWindow();