From e66036c9fc6478185a3edbac463b3cabc8d9e193 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Thu, 31 Aug 2023 14:18:50 +0200 Subject: [PATCH] Add sdklauncher application --- CMakeLists.txt | 3 +- sdklauncher/CMakeLists.txt | 10 ++++++ sdklauncher/include/mainwindow.h | 8 +++++ sdklauncher/src/main.cpp | 12 +++++++ sdklauncher/src/mainwindow.cpp | 60 ++++++++++++++++++++++++++++++++ 5 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 sdklauncher/CMakeLists.txt create mode 100644 sdklauncher/include/mainwindow.h create mode 100644 sdklauncher/src/main.cpp create mode 100644 sdklauncher/src/mainwindow.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 9475021..59f12a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,4 +47,5 @@ add_subdirectory(explorer) add_subdirectory(bonedecomp) add_subdirectory(parts) add_subdirectory(common) -add_subdirectory(mdlviewer) \ No newline at end of file +add_subdirectory(mdlviewer) +add_subdirectory(sdklauncher) \ No newline at end of file diff --git a/sdklauncher/CMakeLists.txt b/sdklauncher/CMakeLists.txt new file mode 100644 index 0000000..7ff5fbc --- /dev/null +++ b/sdklauncher/CMakeLists.txt @@ -0,0 +1,10 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +find_package(Qt5 COMPONENTS Widgets REQUIRED) + +add_executable(sdklauncher + src/main.cpp + src/mainwindow.cpp) +target_link_libraries(sdklauncher PUBLIC Qt5::Widgets) +target_include_directories(sdklauncher PUBLIC include) diff --git a/sdklauncher/include/mainwindow.h b/sdklauncher/include/mainwindow.h new file mode 100644 index 0000000..c69fbf5 --- /dev/null +++ b/sdklauncher/include/mainwindow.h @@ -0,0 +1,8 @@ +#pragma once + +#include + +class MainWindow : public QMainWindow { +public: + MainWindow(); +}; diff --git a/sdklauncher/src/main.cpp b/sdklauncher/src/main.cpp new file mode 100644 index 0000000..aac60eb --- /dev/null +++ b/sdklauncher/src/main.cpp @@ -0,0 +1,12 @@ +#include + +#include "mainwindow.h" + +int main(int argc, char* argv[]) { + QApplication app(argc, argv); + + MainWindow window; + window.show(); + + return app.exec(); +} diff --git a/sdklauncher/src/mainwindow.cpp b/sdklauncher/src/mainwindow.cpp new file mode 100644 index 0000000..339d079 --- /dev/null +++ b/sdklauncher/src/mainwindow.cpp @@ -0,0 +1,60 @@ +#include "mainwindow.h" + +#include +#include +#include +#include +#include +#include + +static QMap applications = { + {"Armoury", "armoury"}, + {"EXD Viewer", "exdviewer"}, + {"Explorer", "explorer"}, + {"Model Viewer", "mdlviewer"} +}; + +MainWindow::MainWindow() { + setWindowTitle("Novus SDK"); + + auto appList = new QListWidget(); + + auto applicationHeader = new QListWidgetItem(); + applicationHeader->setText("Applications"); + applicationHeader->setFlags(Qt::NoItemFlags); + + appList->addItem(applicationHeader); + + for(const auto& name : applications.keys()) { + appList->addItem(name); + } + + connect(appList, &QListWidget::itemClicked, [this](QListWidgetItem* item) { + QString exec = "./" + applications[item->text()]; + + qDebug() << "Launching" << exec; + + QProcess::startDetached(exec, QStringList()); + }); + + auto appListLayout = new QVBoxLayout(); + appListLayout->addWidget(appList); + + auto centralFrame = new QFrame(); + centralFrame->setLayout(appListLayout); + + auto formLayout = new QFormLayout(); + + auto gameCombo = new QComboBox(); + formLayout->addRow("Current Game", gameCombo); + formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); + gameCombo->addItem("Placeholder"); + + auto mainLayout = new QVBoxLayout(); + mainLayout->addWidget(centralFrame); + mainLayout->addLayout(formLayout); + auto centralWidget = new QWidget(); + centralWidget->setLayout(mainLayout); + + setCentralWidget(centralWidget); +}