1
Fork 0
mirror of https://github.com/redstrate/Novus.git synced 2025-04-23 20:47:45 +00:00
novus/karuku/src/mainwindow.cpp

59 lines
1.5 KiB
C++
Raw Normal View History

// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later
2022-03-16 00:31:24 -04:00
#include "mainwindow.h"
#include <KAboutApplicationDialog>
#include <KAboutData>
#include <QAction>
#include <QApplication>
#include <QDesktopServices>
#include <QHBoxLayout>
#include <QListWidget>
#include <QMenuBar>
#include <QTableWidget>
#include <QUrl>
#include <physis.hpp>
2022-03-16 00:31:24 -04:00
#include "exdpart.h"
2022-03-16 00:31:24 -04:00
2023-10-10 18:02:13 -04:00
MainWindow::MainWindow(GameData *data)
2023-10-10 18:11:40 -04:00
: NovusMainWindow()
, data(data)
2023-10-10 18:02:13 -04:00
{
2023-09-23 14:09:09 -04:00
setMinimumSize(1280, 720);
setupMenubar();
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++) {
2023-09-26 00:37:55 -04:00
listWidget->addItem(QString::fromStdString(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, [data, exdPart](QListWidgetItem *item) {
auto nameLowercase = item->text().toLower();
2022-03-16 00:31:24 -04:00
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);
});
2023-10-12 23:44:59 -04:00
}
#include "moc_mainwindow.cpp"