2025-09-05 20:44:47 +00:00
|
|
|
#include "rumblefileviewer.h"
|
|
|
|
|
#include "ui_rumblefileviewer.h"
|
|
|
|
|
|
|
|
|
|
RumbleFileViewer::RumbleFileViewer(QWidget *parent)
|
|
|
|
|
: QWidget(parent)
|
|
|
|
|
, ui(new Ui::RumbleFileViewer)
|
|
|
|
|
, mPropertyCount()
|
|
|
|
|
, mRumbleFile(nullptr) {
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
|
|
ui->tableWidget_Properties->setColumnCount(2);
|
|
|
|
|
ui->tableWidget_Properties->setRowCount(0);
|
|
|
|
|
ui->tableWidget_Properties->setColumnWidth(0, 200);
|
|
|
|
|
ui->tableWidget_Properties->horizontalHeader()->setStretchLastSection(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RumbleFileViewer::~RumbleFileViewer() {
|
|
|
|
|
delete ui;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RumbleFileViewer::SetRumbleFile(XRawFile *aRumbleFile) {
|
|
|
|
|
mRumbleFile = aRumbleFile;
|
|
|
|
|
|
|
|
|
|
ui->tableWidget_Properties->clear();
|
|
|
|
|
|
|
|
|
|
// const QString magic = aRumbleFile->contents.left(6);
|
|
|
|
|
// if (magic != "RUMBLE") {
|
|
|
|
|
// qDebug() << "Rumble file has invalid magic: " << magic;
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// int firstIndex = 0;
|
|
|
|
|
// int secondIndex = 0;
|
|
|
|
|
// int thirdIndex = 0;
|
|
|
|
|
|
|
|
|
|
// int startIndex = 0;
|
|
|
|
|
// for (int i = 0; i < aRumbleFile->contents.count("\\") / 2; i++) {
|
|
|
|
|
// ui->tableWidget_Properties->setRowCount(i + 1);
|
|
|
|
|
// ui->spinBox_Entries->setValue(i + 1);
|
|
|
|
|
|
|
|
|
|
// firstIndex = aRumbleFile->contents.indexOf("\\", startIndex);
|
|
|
|
|
// secondIndex = aRumbleFile->contents.indexOf("\\", firstIndex + 1);
|
|
|
|
|
// thirdIndex = aRumbleFile->contents.indexOf("\\", secondIndex + 1);
|
|
|
|
|
// if (thirdIndex == -1) {
|
|
|
|
|
// thirdIndex = aRumbleFile->contents.size();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// const QString keyStr = aRumbleFile->contents.mid(firstIndex + 1, secondIndex - firstIndex - 1);
|
|
|
|
|
// QTableWidgetItem *keyItem = new QTableWidgetItem(keyStr);
|
|
|
|
|
// ui->tableWidget_Properties->setItem(i, 0, keyItem);
|
|
|
|
|
|
|
|
|
|
// const QString valStr = aRumbleFile->contents.mid(secondIndex + 1, thirdIndex - secondIndex - 1);
|
|
|
|
|
// QTableWidgetItem *valueItem = new QTableWidgetItem(valStr);
|
|
|
|
|
// ui->tableWidget_Properties->setItem(i, 1, valueItem);
|
|
|
|
|
|
|
|
|
|
// startIndex = thirdIndex;
|
|
|
|
|
// }
|
|
|
|
|
}
|