From 0ec1cf69f8bea4d78922f93aa2a52f21ac147ca7 Mon Sep 17 00:00:00 2001 From: GPayne Date: Fri, 11 Sep 2020 12:18:26 -0600 Subject: [PATCH] New support for additional scripts in profile --- apps/OpenSpace/ext/launcher/CMakeLists.txt | 9 +- .../ext/launcher/include/addedscripts.h | 32 ++++++ .../ext/launcher/include/profileedit.h | 6 +- .../ext/launcher/include/ui_addedscripts.h | 70 +++++++++++++ .../ext/launcher/src/addedscripts.cpp | 25 +++++ .../ext/launcher/src/addedscripts.ui | 97 +++++++++++++++++++ 6 files changed, 233 insertions(+), 6 deletions(-) create mode 100644 apps/OpenSpace/ext/launcher/include/addedscripts.h create mode 100644 apps/OpenSpace/ext/launcher/include/ui_addedscripts.h create mode 100644 apps/OpenSpace/ext/launcher/src/addedscripts.cpp create mode 100644 apps/OpenSpace/ext/launcher/src/addedscripts.ui diff --git a/apps/OpenSpace/ext/launcher/CMakeLists.txt b/apps/OpenSpace/ext/launcher/CMakeLists.txt index 77bfeffb06..d55676bf90 100644 --- a/apps/OpenSpace/ext/launcher/CMakeLists.txt +++ b/apps/OpenSpace/ext/launcher/CMakeLists.txt @@ -21,21 +21,24 @@ target_include_directories( ) set(HEADER_FILES + include/addedscripts.h include/assettreeitem.h include/assettreemodel.h - include/profileedit.h - include/ui_editorwindow.h include/filesystemaccess.h include/launcherwindow.h + include/profileedit.h + include/ui/addedscripts.h + include/ui_editorwindow.h include/ui_launcherwindow.h ) set(SOURCE_FILES + src/addedscripts.cpp src/assettreeitem.cpp src/assettreemodel.cpp - src/profileedit.cpp src/filesystemaccess.cpp src/launcherwindow.cpp + src/profileedit.cpp ) add_library(profileGUIw STATIC ${HEADER_FILES} ${SOURCE_FILES}) diff --git a/apps/OpenSpace/ext/launcher/include/addedscripts.h b/apps/OpenSpace/ext/launcher/include/addedscripts.h new file mode 100644 index 0000000000..4e7c64d5f3 --- /dev/null +++ b/apps/OpenSpace/ext/launcher/include/addedscripts.h @@ -0,0 +1,32 @@ +#ifndef ADDEDSCRIPTS_H +#define ADDEDSCRIPTS_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE +namespace Ui { +class addedScripts; +} +QT_END_NAMESPACE + +class addedScripts : public QDialog +{ + Q_OBJECT + +public slots: + void parseScript(); + +public: + explicit addedScripts(std::string& imported, QWidget *parent = nullptr); + ~addedScripts(); + void setScriptText(std::string s); + +private: + Ui::addedScripts *ui; + QWidget* _parent; + std::string& _imported; +}; + +#endif // ADDEDSCRIPTS_H diff --git a/apps/OpenSpace/ext/launcher/include/profileedit.h b/apps/OpenSpace/ext/launcher/include/profileedit.h index 0feff6a030..47bbe1ce7b 100644 --- a/apps/OpenSpace/ext/launcher/include/profileedit.h +++ b/apps/OpenSpace/ext/launcher/include/profileedit.h @@ -9,10 +9,10 @@ #include "keybindings.h" #include "assets.h" #include "ostime.h" -#include "addedScripts.h" -#include "deltaTimes.h" +#include "addedscripts.h" +#include "deltatimes.h" #include "camera.h" -#include "markNodes.h" +#include "marknodes.h" #include "ostime.h" QT_BEGIN_NAMESPACE diff --git a/apps/OpenSpace/ext/launcher/include/ui_addedscripts.h b/apps/OpenSpace/ext/launcher/include/ui_addedscripts.h new file mode 100644 index 0000000000..59c79ae051 --- /dev/null +++ b/apps/OpenSpace/ext/launcher/include/ui_addedscripts.h @@ -0,0 +1,70 @@ +/******************************************************************************** +** Form generated from reading UI file 'addedScripts.ui' +** +** Created by: Qt User Interface Compiler version 5.15.0 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_ADDEDSCRIPTS_H +#define UI_ADDEDSCRIPTS_H + +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Ui_addedScripts +{ +public: + QDialogButtonBox *buttonBox; + QLabel *label_module; + QTextEdit *text_scripts; + + void setupUi(QDialog *addedScripts) + { + if (addedScripts->objectName().isEmpty()) + addedScripts->setObjectName(QString::fromUtf8("addedScripts")); + addedScripts->resize(591, 469); + buttonBox = new QDialogButtonBox(addedScripts); + buttonBox->setObjectName(QString::fromUtf8("buttonBox")); + buttonBox->setGeometry(QRect(240, 430, 341, 32)); + buttonBox->setOrientation(Qt::Horizontal); + buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); + label_module = new QLabel(addedScripts); + label_module->setObjectName(QString::fromUtf8("label_module")); + label_module->setGeometry(QRect(20, 20, 357, 20)); + QFont font; + font.setFamily(QString::fromUtf8("Arial")); + font.setPointSize(12); + label_module->setFont(font); + text_scripts = new QTextEdit(addedScripts); + text_scripts->setObjectName(QString::fromUtf8("text_scripts")); + text_scripts->setGeometry(QRect(20, 50, 551, 371)); + + retranslateUi(addedScripts); + QObject::connect(buttonBox, SIGNAL(accepted()), addedScripts, SLOT(accept())); + QObject::connect(buttonBox, SIGNAL(rejected()), addedScripts, SLOT(reject())); + + QMetaObject::connectSlotsByName(addedScripts); + } // setupUi + + void retranslateUi(QDialog *addedScripts) + { + addedScripts->setWindowTitle(QCoreApplication::translate("addedScripts", "Additional Scripts", nullptr)); + label_module->setText(QCoreApplication::translate("addedScripts", "Additional Lua Scripts for Configuration", nullptr)); + } // retranslateUi + +}; + +namespace Ui { + class addedScripts: public Ui_addedScripts {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_ADDEDSCRIPTS_H diff --git a/apps/OpenSpace/ext/launcher/src/addedscripts.cpp b/apps/OpenSpace/ext/launcher/src/addedscripts.cpp new file mode 100644 index 0000000000..25fb8c4ce5 --- /dev/null +++ b/apps/OpenSpace/ext/launcher/src/addedscripts.cpp @@ -0,0 +1,25 @@ +#include "addedscripts.h" +#include "./ui_addedscripts.h" +#include + +addedScripts::addedScripts(std::string& imported, QWidget *parent) + : QDialog(parent) + , ui(new Ui::addedScripts) + , _imported(imported) +{ + ui->setupUi(this); + ui->text_scripts->setText(QString(_imported.c_str())); + + connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(parseScript())); +} + +void addedScripts::setScriptText(std::string s) { + ui->text_scripts->setText(QString(s.c_str())); +} + +void addedScripts::parseScript() { + _imported = ui->text_scripts->toPlainText().toUtf8().constData(); + accept(); +} + +addedScripts::~addedScripts() { } diff --git a/apps/OpenSpace/ext/launcher/src/addedscripts.ui b/apps/OpenSpace/ext/launcher/src/addedscripts.ui new file mode 100644 index 0000000000..0c50f85a29 --- /dev/null +++ b/apps/OpenSpace/ext/launcher/src/addedscripts.ui @@ -0,0 +1,97 @@ + + + addedScripts + + + + 0 + 0 + 591 + 469 + + + + Additional Scripts + + + + + 240 + 430 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 20 + 20 + 357 + 20 + + + + + Arial + 12 + + + + Additional Lua Scripts for Configuration + + + + + + 20 + 50 + 551 + 371 + + + + + + + + buttonBox + accepted() + addedScripts + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + addedScripts + reject() + + + 316 + 260 + + + 286 + 274 + + + + +