mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-27 06:07:45 +00:00
exdpart: Add more header information, adapt to physis API changes
This commit is contained in:
parent
f271eb7991
commit
ae41124f93
3 changed files with 50 additions and 19 deletions
|
@ -44,10 +44,14 @@ MainWindow::MainWindow(GameData *data)
|
||||||
auto exdPart = new EXDPart(data);
|
auto exdPart = new EXDPart(data);
|
||||||
layout->addWidget(exdPart);
|
layout->addWidget(exdPart);
|
||||||
|
|
||||||
connect(listWidget, &QListWidget::itemClicked, this, [exdPart](QListWidgetItem *item) {
|
connect(listWidget, &QListWidget::itemClicked, this, [data, exdPart](QListWidgetItem *item) {
|
||||||
auto name = item->text().toStdString();
|
auto nameLowercase = item->text().toLower();
|
||||||
auto nameLowercase = item->text().toLower().toStdString();
|
|
||||||
|
|
||||||
exdPart->loadSheet(QString::fromStdString(name.c_str()));
|
auto path = QStringLiteral("exd/%1.exh").arg(nameLowercase);
|
||||||
|
auto pathStd = path.toStdString();
|
||||||
|
|
||||||
|
auto file = physis_gamedata_extract_file(data, pathStd.c_str());
|
||||||
|
|
||||||
|
exdPart->loadSheet(item->text(), file);
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -5,24 +5,37 @@
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QTableWidget>
|
#include <QGroupBox>
|
||||||
#include <QVBoxLayout>
|
#include <QJsonArray>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QJsonArray>
|
#include <QLabel>
|
||||||
|
#include <QTableWidget>
|
||||||
|
#include <QVBoxLayout>
|
||||||
#include <physis.hpp>
|
#include <physis.hpp>
|
||||||
|
|
||||||
EXDPart::EXDPart(GameData* data) : data(data) {
|
EXDPart::EXDPart(GameData *data)
|
||||||
pageTabWidget = new QTabWidget();
|
: data(data)
|
||||||
|
{
|
||||||
auto layout = new QVBoxLayout();
|
auto layout = new QVBoxLayout();
|
||||||
layout->addWidget(pageTabWidget);
|
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
|
auto headerBox = new QGroupBox(QStringLiteral("Header"));
|
||||||
|
layout->addWidget(headerBox);
|
||||||
|
headerFormLayout = new QFormLayout();
|
||||||
|
headerBox->setLayout(headerFormLayout);
|
||||||
|
|
||||||
|
auto contentsBox = new QGroupBox(QStringLiteral("Contents"));
|
||||||
|
layout->addWidget(contentsBox);
|
||||||
|
auto contentsBoxLayout = new QVBoxLayout();
|
||||||
|
contentsBox->setLayout(contentsBoxLayout);
|
||||||
|
|
||||||
|
pageTabWidget = new QTabWidget();
|
||||||
|
contentsBoxLayout->addWidget(pageTabWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EXDPart::loadSheet(const QString& name) {
|
void EXDPart::loadSheet(QString name, physis_Buffer buffer)
|
||||||
qDebug() << "Loading" << name;
|
{
|
||||||
|
|
||||||
pageTabWidget->clear();
|
pageTabWidget->clear();
|
||||||
|
|
||||||
QFile definitionFile(QStringLiteral("Achievement.json"));
|
QFile definitionFile(QStringLiteral("Achievement.json"));
|
||||||
|
@ -38,7 +51,7 @@ void EXDPart::loadSheet(const QString& name) {
|
||||||
&& definition.toObject()[QLatin1String("converter")].toObject()[QLatin1String("type")].toString() == QStringLiteral("link")) {
|
&& definition.toObject()[QLatin1String("converter")].toObject()[QLatin1String("type")].toString() == QStringLiteral("link")) {
|
||||||
auto linkName = definition.toObject()[QLatin1String("converter")].toObject()[QLatin1String("target")].toString();
|
auto linkName = definition.toObject()[QLatin1String("converter")].toObject()[QLatin1String("target")].toString();
|
||||||
|
|
||||||
auto linkExh = physis_gamedata_read_excel_sheet_header(data, linkName.toStdString().c_str());
|
auto linkExh = physis_parse_excel_sheet_header(buffer);
|
||||||
auto linkExd = physis_gamedata_read_excel_sheet(data, linkName.toStdString().c_str(), linkExh, getSuitableLanguage(linkExh), 0);
|
auto linkExd = physis_gamedata_read_excel_sheet(data, linkName.toStdString().c_str(), linkExh, getSuitableLanguage(linkExh), 0);
|
||||||
|
|
||||||
if (linkExd.p_ptr != nullptr) {
|
if (linkExd.p_ptr != nullptr) {
|
||||||
|
@ -48,7 +61,18 @@ void EXDPart::loadSheet(const QString& name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto exh = physis_gamedata_read_excel_sheet_header(data, name.toStdString().c_str());
|
auto exh = physis_parse_excel_sheet_header(buffer);
|
||||||
|
|
||||||
|
QLayoutItem *child;
|
||||||
|
while ((child = headerFormLayout->takeAt(0)) != 0) {
|
||||||
|
delete child->widget();
|
||||||
|
delete child;
|
||||||
|
}
|
||||||
|
|
||||||
|
headerFormLayout->addRow(QStringLiteral("Num Rows"), new QLabel(QString::number(exh->row_count)));
|
||||||
|
headerFormLayout->addRow(QStringLiteral("Num Columns"), new QLabel(QString::number(exh->column_count)));
|
||||||
|
headerFormLayout->addRow(QStringLiteral("Num Pages"), new QLabel(QString::number(exh->page_count)));
|
||||||
|
headerFormLayout->addRow(QStringLiteral("Num Languages"), new QLabel(QString::number(exh->language_count)));
|
||||||
|
|
||||||
for(int i = 0; i < exh->page_count; i++) {
|
for(int i = 0; i < exh->page_count; i++) {
|
||||||
auto tableWidget = new QTableWidget();
|
auto tableWidget = new QTableWidget();
|
||||||
|
|
|
@ -3,21 +3,24 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QFormLayout>
|
||||||
#include <QTabWidget>
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
#include <QTabWidget>
|
||||||
|
#include <QWidget>
|
||||||
#include <physis.hpp>
|
#include <physis.hpp>
|
||||||
|
|
||||||
|
// TODO: rename to "EXDH" or "Excel" part or something similar because you cannot preview EXD on it's own
|
||||||
class EXDPart : public QWidget {
|
class EXDPart : public QWidget {
|
||||||
public:
|
public:
|
||||||
explicit EXDPart(GameData* data);
|
explicit EXDPart(GameData* data);
|
||||||
|
|
||||||
void loadSheet(const QString& name);
|
void loadSheet(QString name, physis_Buffer buffer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GameData* data = nullptr;
|
GameData* data = nullptr;
|
||||||
|
|
||||||
QTabWidget* pageTabWidget = nullptr;
|
QTabWidget* pageTabWidget = nullptr;
|
||||||
|
QFormLayout *headerFormLayout = nullptr;
|
||||||
|
|
||||||
struct CachedExcel {
|
struct CachedExcel {
|
||||||
physis_EXH* exh = nullptr;
|
physis_EXH* exh = nullptr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue