diff --git a/apps/OpenSpace/ext/launcher/include/profile/actiondialog.h b/apps/OpenSpace/ext/launcher/include/profile/actiondialog.h index 1c95a7c98d..bb7896a08d 100644 --- a/apps/OpenSpace/ext/launcher/include/profile/actiondialog.h +++ b/apps/OpenSpace/ext/launcher/include/profile/actiondialog.h @@ -58,6 +58,8 @@ private: void actionSaved(); void clearActionFields(); void actionRejected(); + void chooseScripts(); + void appendScriptsToTextfield(std::string scripts); openspace::Profile::Keybinding* selectedKeybinding(); void keybindingAdd(); @@ -80,6 +82,7 @@ private: QLineEdit* guiPath = nullptr; QLineEdit* documentation = nullptr; QCheckBox* isLocal = nullptr; + QPushButton* chooseScripts = nullptr; QTextEdit* script = nullptr; QPushButton* addButton = nullptr; QPushButton* removeButton = nullptr; diff --git a/apps/OpenSpace/ext/launcher/src/profile/actiondialog.cpp b/apps/OpenSpace/ext/launcher/src/profile/actiondialog.cpp index 81dd9d81da..21b17fdfb1 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/actiondialog.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/actiondialog.cpp @@ -25,6 +25,7 @@ #include "profile/actiondialog.h" #include "profile/line.h" +#include "profile/scriptlogdialog.h" #include #include #include @@ -81,7 +82,7 @@ void ActionDialog::createWidgets() { // | | Name | [oooooooooooo] | Row 2 // | | GUI Path | [oooooooooooo] | Row 3 // | | Documentation | [oooooooooooo] | Row 4 - // | | Is Local | [] | Row 5 + // | | Is Local | [] [choosescr] | Row 5 // | | Script | [oooooooooooo] | Row 6 // *----------------------*---------------*----------------* // | [+] [-] | | [Save] [Cancel]| Row 7 @@ -205,6 +206,17 @@ void ActionDialog::createActionWidgets(QGridLayout* layout) { _actionWidgets.isLocal->setEnabled(false); layout->addWidget(_actionWidgets.isLocal, 5, 2); + _actionWidgets.chooseScripts = new QPushButton("Choose Scripts"); + _actionWidgets.chooseScripts->setToolTip( + "Press this button to choose scripts for your action from the logs/scriptlog.txt" + ); + connect( + _actionWidgets.chooseScripts, &QPushButton::clicked, + this, &ActionDialog::chooseScripts + ); + _actionWidgets.chooseScripts->setEnabled(false); + layout->addWidget(_actionWidgets.chooseScripts, 5, 2, Qt::AlignRight); + layout->addWidget(new QLabel("Script"), 6, 1); _actionWidgets.script = new QTextEdit; _actionWidgets.script->setToolTip( @@ -499,6 +511,7 @@ void ActionDialog::actionSelected() { _actionWidgets.documentation->setEnabled(true); _actionWidgets.isLocal->setChecked(action->isLocal); _actionWidgets.isLocal->setEnabled(true); + _actionWidgets.chooseScripts->setEnabled(true); _actionWidgets.script->setText(QString::fromStdString(action->script)); _actionWidgets.script->setEnabled(true); _actionWidgets.addButton->setEnabled(false); @@ -589,6 +602,7 @@ void ActionDialog::clearActionFields() { _actionWidgets.documentation->setEnabled(false); _actionWidgets.isLocal->setChecked(false); _actionWidgets.isLocal->setEnabled(false); + _actionWidgets.chooseScripts->setEnabled(false); _actionWidgets.script->clear(); _actionWidgets.script->setEnabled(false); _actionWidgets.saveButtons->setEnabled(false); @@ -604,6 +618,16 @@ void ActionDialog::actionRejected() { clearActionFields(); } +void ActionDialog::chooseScripts() { + ScriptlogDialog d(this); + connect(&d, &ScriptlogDialog::scriptsSelected, this, &ActionDialog::appendScriptsToTextfield); + d.exec(); +} + +void ActionDialog::appendScriptsToTextfield(std::string scripts) { + _actionWidgets.script->append(QString::fromStdString(std::move(scripts))); +} + Profile::Keybinding* ActionDialog::selectedKeybinding() { QListWidgetItem* item = _keybindingWidgets.list->currentItem(); const int idx = _keybindingWidgets.list->row(item);