mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-08 20:39:47 -05:00
Version working with json output of sgct configuration
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <random>
|
||||
#include <sgct/readconfig.h>
|
||||
|
||||
using namespace openspace;
|
||||
|
||||
@@ -148,7 +149,7 @@ namespace {
|
||||
std::ofstream outFile;
|
||||
try {
|
||||
outFile.open(path, std::ofstream::out);
|
||||
//outFile << p.serialize();
|
||||
outFile << sgct::serializeWindowConfig(windowList, cluster);
|
||||
}
|
||||
catch (const std::ofstream::failure& e) {
|
||||
QMessageBox::critical(
|
||||
@@ -524,7 +525,7 @@ void LauncherWindow::openWindowEditor() {
|
||||
SgctEdit editor(this, windowList, cluster, _qApp);
|
||||
editor.exec();
|
||||
if (editor.wasSaved()) {
|
||||
const std::string path = _userConfigPath + editor.saveFilename() + ".config";
|
||||
const std::string path = _userConfigPath + editor.saveFilename() + ".json";
|
||||
saveWindowConfig(this, path, windowList, cluster);
|
||||
populateWindowConfigsList(editor.saveFilename());
|
||||
}
|
||||
|
||||
@@ -16,8 +16,10 @@ FileSupport::FileSupport(QVBoxLayout* parentLayout, std::vector<QRect>& monitorL
|
||||
_lineFilename = new QLineEdit();
|
||||
QLabel* labelFilename = new QLabel();
|
||||
labelFilename->setText("Filename: ");
|
||||
layoutFilename->addStretch(1);
|
||||
layoutFilename->addWidget(labelFilename);
|
||||
layoutFilename->addWidget(_lineFilename);
|
||||
layoutFilename->addStretch(1);
|
||||
|
||||
_layoutButtonBox = new QHBoxLayout;
|
||||
_saveButton = new QPushButton("Save");
|
||||
@@ -27,9 +29,7 @@ FileSupport::FileSupport(QVBoxLayout* parentLayout, std::vector<QRect>& monitorL
|
||||
|
||||
_cancelButton = new QPushButton("Cancel");
|
||||
_cancelButton->setToolTip("Cancel global orientation changes");
|
||||
//connect(_buttonCancel, &QPushButton::clicked, this, &ModulesDialog::listItemCancelSave);
|
||||
_layoutButtonBox->addWidget(_cancelButton);
|
||||
//_layoutButtonBox->setSizeConstraint(QLayout::SetFixedSize);
|
||||
layoutFullVertical->addLayout(layoutFilename);
|
||||
layoutFullVertical->addLayout(_layoutButtonBox);
|
||||
parentLayout->addLayout(layoutFullVertical);
|
||||
@@ -108,14 +108,25 @@ void FileSupport::saveWindows() {
|
||||
}
|
||||
if (isOneOfWindowsSetAsWebGui) {
|
||||
if (windowIndex == webGuiWindowIndex) {
|
||||
_windowList.back().draw2D = true;
|
||||
_windowList.back().draw3D = false;
|
||||
_windowList.back().viewports.back().isTracked = false;
|
||||
_windowList.back().tags.push_back("GUI");
|
||||
}
|
||||
else {
|
||||
_windowList.back().draw2D = false;
|
||||
_windowList.back().draw3D = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_windowList.back().draw2D = true;
|
||||
_windowList.back().draw3D = true;
|
||||
_windowList.back().viewports.back().isTracked = true;
|
||||
}
|
||||
if (!_displayWidgets[m]->windowControls()[w]->windowName().empty()) {
|
||||
_windowList.back().name
|
||||
= _displayWidgets[m]->windowControls()[w]->windowName();
|
||||
}
|
||||
_windowList.back().id = windowIndex++;
|
||||
}
|
||||
}
|
||||
@@ -182,7 +193,7 @@ void FileSupport::saveProjectionInformation(bool isSpoutSelected, int projection
|
||||
default:
|
||||
{
|
||||
sgct::config::PlanarProjection projection;
|
||||
projection.fov.left = winControl->fov() / 2.0;
|
||||
projection.fov.left = -winControl->fov() / 2.0;
|
||||
projection.fov.right = winControl->fov() / 2.0;
|
||||
viewport.projection = std::move(projection);
|
||||
}
|
||||
@@ -192,7 +203,6 @@ void FileSupport::saveProjectionInformation(bool isSpoutSelected, int projection
|
||||
}
|
||||
|
||||
void FileSupport::filenameEdited(const QString& newString) {
|
||||
std::cout << "Edited callback." << std::endl;
|
||||
if (newString.isEmpty()) {
|
||||
_saveButton->setEnabled(false);
|
||||
}
|
||||
@@ -206,6 +216,8 @@ std::string FileSupport::saveFilename() {
|
||||
}
|
||||
|
||||
void FileSupport::save() {
|
||||
saveCluster();
|
||||
saveWindows();
|
||||
_finishedCallback(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,10 +36,6 @@ void SgctEdit::systemMonitorConfiguration(QApplication& qtApp) {
|
||||
actualHeight
|
||||
});
|
||||
}
|
||||
|
||||
//_monitorSizeList.clear();
|
||||
//_monitorSizeList.push_back({3440, 0, 1920, 1200});
|
||||
//_monitorSizeList.push_back({1080, 0, 1920, 1080});
|
||||
}
|
||||
|
||||
void SgctEdit::createWidgets() {
|
||||
|
||||
+1
-1
Submodule apps/OpenSpace/ext/sgct updated: b462de9f90...6c7bf16b6f
Reference in New Issue
Block a user