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

53 lines
1.3 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
2023-10-10 18:02:13 -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
2023-09-26 00:37:55 -04:00
exdPart->loadSheet(QString::fromStdString(name.c_str()));
});
2022-03-16 00:31:24 -04:00
}