mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-25 05:17:44 +00:00
Use the new EXD part in exdviewer and remove it's libxiv dependency
This commit is contained in:
parent
97f46bcca1
commit
102ccd96ae
4 changed files with 19 additions and 56 deletions
|
@ -4,7 +4,7 @@ add_executable(exdviewer
|
||||||
target_include_directories(exdviewer
|
target_include_directories(exdviewer
|
||||||
PUBLIC
|
PUBLIC
|
||||||
include)
|
include)
|
||||||
target_link_libraries(exdviewer PUBLIC libxiv ${LIBRARIES} Qt5::Core Qt5::Widgets)
|
target_link_libraries(exdviewer PUBLIC physis z ${LIBRARIES} Qt5::Core Qt5::Widgets exdpart)
|
||||||
|
|
||||||
install(TARGETS exdviewer
|
install(TARGETS exdviewer
|
||||||
DESTINATION "${INSTALL_BIN_PATH}")
|
DESTINATION "${INSTALL_BIN_PATH}")
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
|
||||||
class GameData;
|
struct GameData;
|
||||||
|
|
||||||
class MainWindow : public QMainWindow {
|
class MainWindow : public QMainWindow {
|
||||||
public:
|
public:
|
||||||
MainWindow(GameData& data);
|
MainWindow(GameData* data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GameData& data;
|
GameData* data = nullptr;
|
||||||
};
|
};
|
|
@ -1,14 +1,12 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <physis.hpp>
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "gamedata.h"
|
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
GameData data(argv[1]);
|
MainWindow w(physis_gamedata_initialize(argv[1]));
|
||||||
|
|
||||||
MainWindow w(data);
|
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
|
|
@ -4,13 +4,11 @@
|
||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
|
#include <physis.hpp>
|
||||||
|
|
||||||
#include "gamedata.h"
|
#include "exdpart.h"
|
||||||
#include "exhparser.h"
|
|
||||||
#include "exdparser.h"
|
|
||||||
#include "mdlparser.h"
|
|
||||||
|
|
||||||
MainWindow::MainWindow(GameData& data) : data(data) {
|
MainWindow::MainWindow(GameData* data) : data(data) {
|
||||||
setWindowTitle("exdviewer");
|
setWindowTitle("exdviewer");
|
||||||
|
|
||||||
auto dummyWidget = new QWidget();
|
auto dummyWidget = new QWidget();
|
||||||
|
@ -20,56 +18,23 @@ MainWindow::MainWindow(GameData& data) : data(data) {
|
||||||
dummyWidget->setLayout(layout);
|
dummyWidget->setLayout(layout);
|
||||||
|
|
||||||
auto listWidget = new QListWidget();
|
auto listWidget = new QListWidget();
|
||||||
for(auto name : data.getAllSheetNames()) {
|
|
||||||
listWidget->addItem(name.c_str());
|
auto names = physis_gamedata_get_all_sheet_names(data);
|
||||||
|
for (int i = 0; i < names.name_count; i++) {
|
||||||
|
listWidget->addItem(names.names[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
listWidget->setMaximumWidth(200);
|
listWidget->setMaximumWidth(200);
|
||||||
|
listWidget->sortItems();
|
||||||
|
layout->addWidget(listWidget);
|
||||||
|
|
||||||
auto* pageTabWidget = new QTabWidget();
|
auto exdPart = new EXDPart(data);
|
||||||
|
layout->addWidget(exdPart);
|
||||||
connect(listWidget, &QListWidget::itemClicked, this, [&data, pageTabWidget](QListWidgetItem* item) {
|
|
||||||
pageTabWidget->clear();
|
|
||||||
|
|
||||||
|
connect(listWidget, &QListWidget::itemClicked, this, [exdPart](QListWidgetItem* item) {
|
||||||
auto name = item->text().toStdString();
|
auto name = item->text().toStdString();
|
||||||
auto nameLowercase = item->text().toLower().toStdString();
|
auto nameLowercase = item->text().toLower().toStdString();
|
||||||
|
|
||||||
auto exh = *data.readExcelSheet(name);
|
exdPart->loadSheet(name.c_str());
|
||||||
for (auto column: exh.columnDefinitions) {
|
|
||||||
fmt::print("type = {}, offset = {}\n", column.type, column.offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto page : exh.pages) {
|
|
||||||
QTableWidget* tableWidget = new QTableWidget();
|
|
||||||
|
|
||||||
tableWidget->setColumnCount(exh.columnDefinitions.size());
|
|
||||||
tableWidget->setRowCount(exh.header.rowCount);
|
|
||||||
fmt::print("page, row count = {}, start id = {}\n", page.rowCount, page.startId);
|
|
||||||
|
|
||||||
std::string path;
|
|
||||||
if (exh.language[0] == Language::None) {
|
|
||||||
path = getEXDFilename(exh, nameLowercase, "", page);
|
|
||||||
} else {
|
|
||||||
path = getEXDFilename(exh, nameLowercase, getLanguageCode(Language::English), page);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto exd = readEXD(exh, *data.extractFile("exd/" + path), page);
|
|
||||||
for (int i = 0; i < exd.rows.size(); i++) {
|
|
||||||
for (int j = 0; j < exd.rows[i].data.size(); j++) {
|
|
||||||
auto newItem = new QTableWidgetItem(exd.rows[i].data[j].data.c_str());
|
|
||||||
|
|
||||||
tableWidget->setItem(i, j, newItem);
|
|
||||||
|
|
||||||
QTableWidgetItem* headerItem = new QTableWidgetItem();
|
|
||||||
headerItem->setText(exd.rows[i].data[j].type.c_str());
|
|
||||||
tableWidget->setHorizontalHeaderItem(j, headerItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pageTabWidget->addTab(tableWidget, QString("Page %1").arg(page.startId));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
layout->addWidget(listWidget);
|
|
||||||
layout->addWidget(pageTabWidget);
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue