2023-08-06 08:48:11 -04:00
|
|
|
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-04-11 21:59:37 -04:00
|
|
|
#include "mainwindow.h"
|
|
|
|
|
2022-04-12 12:19:46 -04:00
|
|
|
#include <QHBoxLayout>
|
2022-04-12 00:30:17 -04:00
|
|
|
#include <QLineEdit>
|
2023-07-07 16:16:21 -04:00
|
|
|
#include <QListWidget>
|
|
|
|
#include <QTableWidget>
|
2022-04-12 16:19:06 -04:00
|
|
|
#include <QTimer>
|
2023-04-09 15:31:19 -04:00
|
|
|
|
2023-09-23 15:45:38 -04:00
|
|
|
#include <KAboutApplicationDialog>
|
|
|
|
#include <KAboutData>
|
2023-07-07 16:16:21 -04:00
|
|
|
#include <QAction>
|
2023-08-06 08:48:11 -04:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QDesktopServices>
|
2022-04-12 20:18:22 -04:00
|
|
|
#include <QFileDialog>
|
2022-04-28 23:20:58 -04:00
|
|
|
#include <QMenuBar>
|
2023-07-07 16:16:21 -04:00
|
|
|
#include <QPushButton>
|
2022-05-03 13:19:48 -04:00
|
|
|
#include <QTreeWidget>
|
2023-07-07 16:16:21 -04:00
|
|
|
#include <glm/gtc/type_ptr.hpp>
|
|
|
|
#include <magic_enum.hpp>
|
2022-08-10 14:52:28 -04:00
|
|
|
#include <physis.hpp>
|
2022-04-28 17:50:05 -04:00
|
|
|
|
2023-07-06 17:37:49 -04:00
|
|
|
#include "cmpeditor.h"
|
2023-07-09 10:54:27 -04:00
|
|
|
#include "filecache.h"
|
2023-09-23 15:45:38 -04:00
|
|
|
#include "gearlistwidget.h"
|
2022-05-03 13:19:48 -04:00
|
|
|
|
2023-10-10 18:10:42 -04:00
|
|
|
MainWindow::MainWindow(GameData *in_data)
|
|
|
|
: NovusMainWindow()
|
|
|
|
, data(*in_data)
|
|
|
|
, cache(FileCache{*in_data})
|
|
|
|
{
|
2023-04-09 15:31:19 -04:00
|
|
|
setMinimumSize(QSize(800, 600));
|
2022-04-11 21:59:37 -04:00
|
|
|
|
2023-09-26 00:37:55 -04:00
|
|
|
auto toolsMenu = menuBar()->addMenu(QStringLiteral("Tools"));
|
2023-07-06 17:37:49 -04:00
|
|
|
|
2023-09-26 00:37:55 -04:00
|
|
|
auto cmpEditorMenu = toolsMenu->addAction(QStringLiteral("CMP Editor"));
|
|
|
|
cmpEditorMenu->setIcon(QIcon::fromTheme(QStringLiteral("document-edit")));
|
2023-07-06 17:37:49 -04:00
|
|
|
connect(cmpEditorMenu, &QAction::triggered, [=] {
|
|
|
|
auto cmpEditor = new CmpEditor(in_data);
|
|
|
|
cmpEditor->show();
|
|
|
|
});
|
|
|
|
|
2022-04-11 21:59:37 -04:00
|
|
|
auto dummyWidget = new QWidget();
|
|
|
|
setCentralWidget(dummyWidget);
|
|
|
|
|
2022-04-12 12:19:46 -04:00
|
|
|
auto layout = new QHBoxLayout();
|
2022-04-11 21:59:37 -04:00
|
|
|
dummyWidget->setLayout(layout);
|
2022-04-11 23:11:33 -04:00
|
|
|
|
2023-07-08 09:13:02 -04:00
|
|
|
auto gearListWidget = new GearListWidget(&data);
|
|
|
|
gearListWidget->setMaximumWidth(350);
|
|
|
|
connect(gearListWidget, &GearListWidget::gearSelected, this, [=](const GearInfo& gear) {
|
|
|
|
gearView->setGear(gear);
|
|
|
|
});
|
|
|
|
layout->addWidget(gearListWidget);
|
2022-04-11 23:11:33 -04:00
|
|
|
|
2023-07-09 10:54:27 -04:00
|
|
|
gearView = new SingleGearView(&data, cache);
|
2023-04-09 15:31:19 -04:00
|
|
|
connect(gearView, &SingleGearView::addToFullModelViewer, this, [=](GearInfo& info) {
|
|
|
|
fullModelViewer->addGear(info);
|
2022-04-12 12:39:33 -04:00
|
|
|
});
|
2023-09-26 20:21:06 -04:00
|
|
|
|
|
|
|
auto tabWidget = new QTabWidget();
|
|
|
|
tabWidget->addTab(gearView, QStringLiteral("Models"));
|
|
|
|
layout->addWidget(tabWidget);
|
|
|
|
|
|
|
|
fullModelViewer = new FullModelViewer(&data, cache);
|
2023-09-25 23:48:03 -04:00
|
|
|
connect(fullModelViewer, &FullModelViewer::loadingChanged, this, [=](const bool loading) {
|
|
|
|
gearView->setFMVAvailable(!loading);
|
|
|
|
});
|
2023-04-09 15:31:19 -04:00
|
|
|
fullModelViewer->show();
|
2022-04-17 20:02:06 -04:00
|
|
|
}
|