1
Fork 0
mirror of https://github.com/redstrate/Novus.git synced 2025-04-24 13:07:44 +00:00

sagasu: Add support for viewing raw data with the new hex part

This commit is contained in:
Joshua Goins 2023-10-12 20:18:22 -04:00
parent 95f10d9622
commit c7a3f9cf5a
4 changed files with 12 additions and 7 deletions

View file

@ -22,6 +22,6 @@ target_sources(novus-sagasu PRIVATE
src/filepropertieswindow.cpp src/filepropertieswindow.cpp
src/filetreemodel.cpp) src/filetreemodel.cpp)
target_include_directories(novus-sagasu PRIVATE include) target_include_directories(novus-sagasu PRIVATE include)
target_link_libraries(novus-sagasu PRIVATE Qt6::Concurrent novus-sagasu-static) target_link_libraries(novus-sagasu PRIVATE Qt6::Concurrent hexpart novus-sagasu-static)
install(TARGETS novus-sagasu ${KF${QT_MAJOR_VERSION}_INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS novus-sagasu ${KF${QT_MAJOR_VERSION}_INSTALL_TARGETS_DEFAULT_ARGS})

View file

@ -10,7 +10,7 @@ class FilePropertiesWindow : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit FilePropertiesWindow(GameData *data, QString path, QWidget *parent = nullptr); explicit FilePropertiesWindow(QString path, physis_Buffer buffer, QWidget *parent = nullptr);
private: private:
GameData *data = nullptr; GameData *data = nullptr;

View file

@ -9,7 +9,7 @@
#include "filepropertieswindow.h" #include "filepropertieswindow.h"
FilePropertiesWindow::FilePropertiesWindow(GameData *data, QString path, QWidget *parent) FilePropertiesWindow::FilePropertiesWindow(QString path, physis_Buffer buffer, QWidget *parent)
: QWidget(parent) : QWidget(parent)
, data(data) , data(data)
{ {
@ -24,9 +24,7 @@ FilePropertiesWindow::FilePropertiesWindow(GameData *data, QString path, QWidget
auto typeLabel = new QLabel(QStringLiteral("Unknown type")); auto typeLabel = new QLabel(QStringLiteral("Unknown type"));
layout->addRow(QStringLiteral("Type"), typeLabel); layout->addRow(QStringLiteral("Type"), typeLabel);
auto file = physis_gamedata_extract_file(data, path.toStdString().c_str()); auto sizeLabel = new QLabel(QString::number(buffer.size));
auto sizeLabel = new QLabel(QString::number(file.size));
layout->addRow(QStringLiteral("Size (in bytes)"), sizeLabel); layout->addRow(QStringLiteral("Size (in bytes)"), sizeLabel);
} }

View file

@ -11,6 +11,7 @@
#include "filepropertieswindow.h" #include "filepropertieswindow.h"
#include "filetreewindow.h" #include "filetreewindow.h"
#include "hexpart.h"
MainWindow::MainWindow(GameData *data) MainWindow::MainWindow(GameData *data)
: NovusMainWindow() : NovusMainWindow()
@ -63,7 +64,13 @@ void MainWindow::refreshParts(QString path)
return; return;
} }
auto file = physis_gamedata_extract_file(data, path.toStdString().c_str());
// Add properties tab // Add properties tab
auto propertiesWidget = new FilePropertiesWindow(data, path); auto propertiesWidget = new FilePropertiesWindow(path, file);
partHolder->addTab(propertiesWidget, QStringLiteral("Properties")); partHolder->addTab(propertiesWidget, QStringLiteral("Properties"));
auto hexWidget = new HexPart();
hexWidget->loadFile(file);
partHolder->addTab(hexWidget, QStringLiteral("Raw Hex"));
} }