1
Fork 0
mirror of https://github.com/redstrate/Novus.git synced 2025-04-21 03:57:44 +00:00
novus/exdviewer/src/mainwindow.cpp

40 lines
1 KiB
C++
Raw Normal View History

2022-03-16 00:31:24 -04:00
#include "mainwindow.h"
#include <QHBoxLayout>
2022-03-16 00:31:24 -04:00
#include <QTableWidget>
#include <fmt/core.h>
#include <QListWidget>
#include <physis.hpp>
2022-03-16 00:31:24 -04:00
#include "exdpart.h"
2022-03-16 00:31:24 -04:00
MainWindow::MainWindow(GameData* data) : data(data) {
2022-04-11 21:59:37 -04:00
setWindowTitle("exdviewer");
2022-03-16 00:31:24 -04:00
auto dummyWidget = new QWidget();
2022-03-16 00:31:24 -04:00
setCentralWidget(dummyWidget);
auto layout = new QHBoxLayout();
2022-03-16 00:31:24 -04:00
dummyWidget->setLayout(layout);
auto listWidget = new QListWidget();
auto names = physis_gamedata_get_all_sheet_names(data);
for (int i = 0; i < names.name_count; i++) {
listWidget->addItem(names.names[i]);
2022-03-16 00:31:24 -04:00
}
listWidget->setMaximumWidth(200);
listWidget->sortItems();
layout->addWidget(listWidget);
auto exdPart = new EXDPart(data);
layout->addWidget(exdPart);
2022-03-16 00:31:24 -04:00
connect(listWidget, &QListWidget::itemClicked, this, [exdPart](QListWidgetItem* item) {
auto name = item->text().toStdString();
auto nameLowercase = item->text().toLower().toStdString();
2022-03-16 00:31:24 -04:00
exdPart->loadSheet(name.c_str());
});
2022-03-16 00:31:24 -04:00
}