mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-13 17:09:05 -05:00
New support for additional scripts in profile
This commit is contained in:
@@ -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})
|
||||
|
||||
32
apps/OpenSpace/ext/launcher/include/addedscripts.h
Normal file
32
apps/OpenSpace/ext/launcher/include/addedscripts.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef ADDEDSCRIPTS_H
|
||||
#define ADDEDSCRIPTS_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QWidget>
|
||||
#include <QListWidgetItem>
|
||||
|
||||
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
|
||||
@@ -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
|
||||
|
||||
70
apps/OpenSpace/ext/launcher/include/ui_addedscripts.h
Normal file
70
apps/OpenSpace/ext/launcher/include/ui_addedscripts.h
Normal file
@@ -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 <QtCore/QVariant>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QtWidgets/QDialog>
|
||||
#include <QtWidgets/QDialogButtonBox>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QTextEdit>
|
||||
|
||||
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
|
||||
25
apps/OpenSpace/ext/launcher/src/addedscripts.cpp
Normal file
25
apps/OpenSpace/ext/launcher/src/addedscripts.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include "addedscripts.h"
|
||||
#include "./ui_addedscripts.h"
|
||||
#include <qevent.h>
|
||||
|
||||
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() { }
|
||||
97
apps/OpenSpace/ext/launcher/src/addedscripts.ui
Normal file
97
apps/OpenSpace/ext/launcher/src/addedscripts.ui
Normal file
@@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>addedScripts</class>
|
||||
<widget class="QDialog" name="addedScripts">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>591</width>
|
||||
<height>469</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Additional Scripts</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<y>430</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_module">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>357</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Additional Lua Scripts for Configuration</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="text_scripts">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>50</y>
|
||||
<width>551</width>
|
||||
<height>371</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>addedScripts</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>addedScripts</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user