mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-08 12:39:49 -06:00
final fixes for merge with json profile
This commit is contained in:
@@ -152,7 +152,7 @@ public:
|
||||
* \param outputItems vector of #assetTreeItem * objects,
|
||||
* each of which are selected
|
||||
*/
|
||||
void selectedAssets(std::vector<openspace::Profile::Asset>& outputPaths,
|
||||
void selectedAssets(std::vector<std::string>& outputPaths,
|
||||
std::vector<assetTreeItem*>& outputItems);
|
||||
|
||||
/**
|
||||
@@ -161,7 +161,7 @@ public:
|
||||
*
|
||||
* \return vector of #assetTreeItem * objects, each of which are selected
|
||||
*/
|
||||
std::vector<openspace::Profile::Asset> selectedAssetsDetailed();
|
||||
std::vector<std::string> selectedAssetsDetailed();
|
||||
|
||||
/**
|
||||
* Imports asset tree data for this model. The import text format is unique to
|
||||
@@ -259,7 +259,7 @@ private:
|
||||
assetTreeItem *getItem(const QModelIndex &index) const;
|
||||
assetTreeItem *rootItem;
|
||||
void parseChildrenForSelected(assetTreeItem* item,
|
||||
std::vector<openspace::Profile::Asset>& outputPaths,
|
||||
std::vector<std::string>& outputPaths,
|
||||
std::vector<assetTreeItem*>& outputItems, std::string pathPrefix);
|
||||
void importInsertItem(std::istringstream& iss, assetTreeItem* parent,
|
||||
importElement& elem, int level);
|
||||
|
||||
@@ -35,7 +35,7 @@ addedScripts::addedScripts(openspace::Profile* imported, QWidget *parent)
|
||||
, _imported(imported)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
for (std::string s : _imported->additionalScripts()) {
|
||||
for (std::string s : imported->additionalScripts()) {
|
||||
_data += s + "\n";
|
||||
}
|
||||
ui->text_scripts->setText(QString(_data.c_str()));
|
||||
|
||||
@@ -69,8 +69,8 @@ assets::assets(openspace::Profile* imported, const std::string reportAssets,
|
||||
}
|
||||
|
||||
void assets::compareFilesystemWithProfileAssets() {
|
||||
for (openspace::Profile::Asset a : _imported->assets()) {
|
||||
findPathMatch(a.path);
|
||||
for (std::string a : _imported->assets()) {
|
||||
findPathMatch(a);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ bool assets::traverseToExpandSelectedItems(int rows, QModelIndex parent) {
|
||||
|
||||
QString assets::createTextSummary() {
|
||||
//compareFilesystemWithProfileAssets();
|
||||
std::vector<openspace::Profile::Asset> summaryPaths;
|
||||
std::vector<std::string> summaryPaths;
|
||||
std::vector<assetTreeItem*> summaryItems;
|
||||
_assetTreeModel.selectedAssets(summaryPaths, summaryItems);
|
||||
|
||||
@@ -171,7 +171,7 @@ QString assets::createTextSummary() {
|
||||
bool existsInFilesystem = summaryItems.at(i)->doesExistInFilesystem();
|
||||
std::string s = fmt::format("<font color='{}'>{}</font><br>",
|
||||
(existsInFilesystem ? "black" : "red"),
|
||||
summaryPaths.at(i).path
|
||||
summaryPaths.at(i)
|
||||
);
|
||||
summary += QString(s.c_str());
|
||||
}
|
||||
@@ -180,12 +180,12 @@ QString assets::createTextSummary() {
|
||||
|
||||
void assets::parseSelections() {
|
||||
_imported->clearAssets();
|
||||
std::vector<openspace::Profile::Asset> summaryPaths;
|
||||
std::vector<std::string> summaryPaths;
|
||||
std::vector<assetTreeItem*> summaryItems;
|
||||
_assetTreeModel.selectedAssets(summaryPaths, summaryItems);
|
||||
|
||||
for (openspace::Profile::Asset sel : summaryPaths) {
|
||||
_imported->addAsset(sel.path, sel.name);
|
||||
for (std::string sel : summaryPaths) {
|
||||
_imported->addAsset(sel);
|
||||
}
|
||||
accept();
|
||||
}
|
||||
|
||||
@@ -285,14 +285,14 @@ QVariant assetTreeModel::headerData(int section, Qt::Orientation orientation,
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void assetTreeModel::selectedAssets(std::vector<openspace::Profile::Asset>& outputPaths,
|
||||
void assetTreeModel::selectedAssets(std::vector<std::string>& outputPaths,
|
||||
std::vector<assetTreeItem*>& outputItems)
|
||||
{
|
||||
parseChildrenForSelected(rootItem, outputPaths, outputItems, "");
|
||||
}
|
||||
|
||||
void assetTreeModel::parseChildrenForSelected(assetTreeItem* item,
|
||||
std::vector<openspace::Profile::Asset>& outputPaths,
|
||||
std::vector<std::string>& outputPaths,
|
||||
std::vector<assetTreeItem*>& outputItems,
|
||||
std::string pathPrefix)
|
||||
{
|
||||
@@ -303,7 +303,7 @@ void assetTreeModel::parseChildrenForSelected(assetTreeItem* item,
|
||||
if (item->isChecked()) {
|
||||
std::string path = pathPrefix + itemName;
|
||||
outputItems.push_back(item);
|
||||
outputPaths.push_back(openspace::Profile::Asset({path, itemName}));
|
||||
outputPaths.push_back(path);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -43,7 +43,7 @@ camera::camera(openspace::Profile* imported, QWidget *parent)
|
||||
[&] (const openspace::Profile::CameraNavState& nav) {
|
||||
ui->tabWidget->setCurrentIndex(static_cast<int>(cameraTypeTab::Nav));
|
||||
ui->line_anchorNav->setText(QString(nav.anchor.c_str()));
|
||||
ui->line_aim->setText(QString(nav.aim.c_str()));
|
||||
ui->line_aim->setText(QString(nav.aim->c_str()));
|
||||
ui->line_referenceFrame->setText(QString(nav.referenceFrame.c_str()));
|
||||
ui->line_posX->setText(QString::number(nav.position.x));
|
||||
ui->line_posY->setText(QString::number(nav.position.y));
|
||||
|
||||
@@ -189,7 +189,7 @@ void LauncherWindow::saveProfileToFile(const std::string& path, openspace::Profi
|
||||
|
||||
bool LauncherWindow::loadProfileFromFile(openspace::Profile*& p, std::string filename) {
|
||||
bool successfulLoad = true;
|
||||
std::vector<std::string> content;
|
||||
std::string content;
|
||||
if (filename.length() > 0) {
|
||||
std::ifstream inFile;
|
||||
try {
|
||||
@@ -204,7 +204,7 @@ bool LauncherWindow::loadProfileFromFile(openspace::Profile*& p, std::string fil
|
||||
}
|
||||
std::string line;
|
||||
while (std::getline(inFile, line)) {
|
||||
content.push_back(std::move(line));
|
||||
content += line;
|
||||
}
|
||||
}
|
||||
try {
|
||||
|
||||
@@ -36,14 +36,14 @@ meta::meta(openspace::Profile* imported, QWidget *parent)
|
||||
ui->setupUi(this);
|
||||
|
||||
if (_imported->meta().has_value()) {
|
||||
ui->line_name->setText(QString(_imported->meta().value().name.c_str()));
|
||||
ui->line_version->setText(QString(_imported->meta().value().version.c_str()));
|
||||
ui->line_name->setText(QString(_imported->meta().value().name->c_str()));
|
||||
ui->line_version->setText(QString(_imported->meta().value().version->c_str()));
|
||||
ui->text_description->setText(
|
||||
QString(_imported->meta().value().description.c_str())
|
||||
QString(_imported->meta().value().description->c_str())
|
||||
);
|
||||
ui->line_author->setText(QString(_imported->meta().value().author.c_str()));
|
||||
ui->line_url->setText(QString(_imported->meta().value().url.c_str()));
|
||||
ui->line_license->setText(QString(_imported->meta().value().license.c_str()));
|
||||
ui->line_author->setText(QString(_imported->meta().value().author->c_str()));
|
||||
ui->line_url->setText(QString(_imported->meta().value().url->c_str()));
|
||||
ui->line_license->setText(QString(_imported->meta().value().license->c_str()));
|
||||
}
|
||||
else {
|
||||
ui->line_name->setText("");
|
||||
|
||||
@@ -55,8 +55,8 @@ osmodules::osmodules(openspace::Profile* imported, QWidget *parent)
|
||||
|
||||
QString osmodules::createOneLineSummary(openspace::Profile::Module m) {
|
||||
QString summary = QString(m.name.c_str());
|
||||
bool hasCommandForLoaded = (m.loadedInstruction.length() > 0);
|
||||
bool hasCommandForNotLoaded = (m.notLoadedInstruction.length() > 0);
|
||||
bool hasCommandForLoaded = (m.loadedInstruction->length() > 0);
|
||||
bool hasCommandForNotLoaded = (m.notLoadedInstruction->length() > 0);
|
||||
|
||||
if (hasCommandForLoaded && hasCommandForNotLoaded) {
|
||||
summary += " (commands set for both loaded & not-loaded conditions)";
|
||||
@@ -80,8 +80,8 @@ void osmodules::listItemSelected(void) {
|
||||
if (_data.size() > 0) {
|
||||
openspace::Profile::Module& m = _data[index];
|
||||
ui->line_module->setText(QString(m.name.c_str()));
|
||||
ui->line_loaded->setText(QString(m.loadedInstruction.c_str()));
|
||||
ui->line_notLoaded->setText(QString(m.notLoadedInstruction.c_str()));
|
||||
ui->line_loaded->setText(QString(m.loadedInstruction->c_str()));
|
||||
ui->line_notLoaded->setText(QString(m.notLoadedInstruction->c_str()));
|
||||
}
|
||||
transitionToEditMode();
|
||||
}
|
||||
@@ -119,8 +119,8 @@ void osmodules::listItemAdded(void) {
|
||||
|
||||
//Blank-out the 2 text fields, set combo box to index 0
|
||||
ui->line_module->setText(QString(_data.back().name.c_str()));
|
||||
ui->line_loaded->setText(QString(_data.back().loadedInstruction.c_str()));
|
||||
ui->line_notLoaded->setText(QString(_data.back().notLoadedInstruction.c_str()));
|
||||
ui->line_loaded->setText(QString(_data.back().loadedInstruction->c_str()));
|
||||
ui->line_notLoaded->setText(QString(_data.back().notLoadedInstruction->c_str()));
|
||||
ui->line_module->setFocus(Qt::OtherFocusReason);
|
||||
_editModeNewItem = true;
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ ostime::ostime(openspace::Profile* imported, QWidget *parent)
|
||||
if (_imported->time().has_value()) {
|
||||
_data = _imported->time().value();
|
||||
if (_data.type == openspace::Profile::Time::Type::Relative) {
|
||||
if (_data.time == "") {
|
||||
_data.time = "now";
|
||||
if (_data.value == "") {
|
||||
_data.value = "now";
|
||||
}
|
||||
ui->line_relative->setSelection(0, ui->line_relative->text().length());
|
||||
}
|
||||
@@ -51,7 +51,7 @@ ostime::ostime(openspace::Profile* imported, QWidget *parent)
|
||||
}
|
||||
else {
|
||||
_data.type = openspace::Profile::Time::Type::Relative;
|
||||
_data.time = "now";
|
||||
_data.value = "now";
|
||||
}
|
||||
_initializedAsAbsolute = (_data.type == openspace::Profile::Time::Type::Absolute);
|
||||
enableAccordingToType(static_cast<int>(_data.type));
|
||||
@@ -74,15 +74,15 @@ void ostime::enableAccordingToType(int idx) {
|
||||
ui->line_relative->setText("now");
|
||||
}
|
||||
else {
|
||||
ui->line_relative->setText(QString(_data.time.c_str()));
|
||||
ui->line_relative->setText(QString(_data.value.c_str()));
|
||||
}
|
||||
ui->line_relative->setFocus(Qt::OtherFocusReason);
|
||||
}
|
||||
else {
|
||||
ui->label_relative->setText("<font color='gray'>Relative Time:</font>");
|
||||
size_t tIdx = _data.time.find_first_of('T', 0);
|
||||
QString importDate = QString(_data.time.substr(0, tIdx).c_str());
|
||||
QString importTime = QString(_data.time.substr(tIdx + 1).c_str());
|
||||
size_t tIdx = _data.value.find_first_of('T', 0);
|
||||
QString importDate = QString(_data.value.substr(0, tIdx).c_str());
|
||||
QString importTime = QString(_data.value.substr(tIdx + 1).c_str());
|
||||
ui->dateTimeEdit->setDate(QDate::fromString(importDate, Qt::DateFormat::ISODate));
|
||||
ui->dateTimeEdit->setTime(QTime::fromString(importTime));
|
||||
ui->line_relative->setText("");
|
||||
@@ -115,7 +115,7 @@ void ostime::approved() {
|
||||
else {
|
||||
openspace::Profile::Time t;
|
||||
t.type = openspace::Profile::Time::Type::Relative;
|
||||
t.time = ui->line_relative->text().toUtf8().constData();
|
||||
t.value = ui->line_relative->text().toUtf8().constData();
|
||||
_imported->setTime(t);
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ void ostime::approved() {
|
||||
t.type = openspace::Profile::Time::Type::Absolute;
|
||||
QString res = ui->dateTimeEdit->date().toString("yyyy-MM-dd") +
|
||||
"T" + ui->dateTimeEdit->time().toString();
|
||||
t.time = res.toUtf8().constData();
|
||||
t.value = res.toUtf8().constData();
|
||||
_imported->setTime(t);
|
||||
}
|
||||
accept();
|
||||
|
||||
@@ -227,12 +227,12 @@ QString ProfileEdit::summarizeText_meta() {
|
||||
}
|
||||
QString s;
|
||||
if (_pData->meta().has_value()) {
|
||||
s += QString(_pData->meta().value().name.c_str());
|
||||
s += ", " + QString(_pData->meta().value().version.c_str());
|
||||
s += ", " + QString(_pData->meta().value().description.c_str());
|
||||
s += ", " + QString(_pData->meta().value().author.c_str());
|
||||
s += ", " + QString(_pData->meta().value().url.c_str());
|
||||
s += ", " + QString(_pData->meta().value().license.c_str());
|
||||
s += QString(_pData->meta().value().name->c_str());
|
||||
s += ", " + QString(_pData->meta().value().version->c_str());
|
||||
s += ", " + QString(_pData->meta().value().description->c_str());
|
||||
s += ", " + QString(_pData->meta().value().author->c_str());
|
||||
s += ", " + QString(_pData->meta().value().url->c_str());
|
||||
s += ", " + QString(_pData->meta().value().license->c_str());
|
||||
}
|
||||
|
||||
return s;
|
||||
@@ -264,13 +264,13 @@ QString ProfileEdit::summarizeText_modules() {
|
||||
QString results;
|
||||
for (openspace::Profile::Module m : _pData->modules()) {
|
||||
results += QString(m.name.c_str());
|
||||
if (m.loadedInstruction.size() > 0 && m.notLoadedInstruction.size() > 0) {
|
||||
if (m.loadedInstruction->size() > 0 && m.notLoadedInstruction->size() > 0) {
|
||||
results += "(has commands for both loaded & non-loaded conditions)";
|
||||
}
|
||||
else if (m.loadedInstruction.size() > 0) {
|
||||
else if (m.loadedInstruction->size() > 0) {
|
||||
results += "(has command for loaded condition)";
|
||||
}
|
||||
else if (m.notLoadedInstruction.size() > 0) {
|
||||
else if (m.notLoadedInstruction->size() > 0) {
|
||||
results += "(has command for non-loaded condition)";
|
||||
}
|
||||
results += "\n";
|
||||
@@ -309,8 +309,8 @@ QString ProfileEdit::summarizeText_keybindings() {
|
||||
|
||||
QString ProfileEdit::summarizeText_assets() {
|
||||
QString results;
|
||||
for (openspace::Profile::Asset a : _pData->assets()) {
|
||||
results += QString(a.path.c_str()) + "\n"; //" ";
|
||||
for (std::string a : _pData->assets()) {
|
||||
results += QString(a.c_str()) + "\n"; //" ";
|
||||
}
|
||||
return results;
|
||||
}
|
||||
@@ -329,7 +329,7 @@ QString ProfileEdit::summarizeText_time() {
|
||||
{
|
||||
results = "Relative time: ";
|
||||
}
|
||||
results += QString(_pData->time().value().time.c_str());
|
||||
results += QString(_pData->time().value().value.c_str());
|
||||
}
|
||||
return results;
|
||||
}
|
||||
@@ -356,7 +356,7 @@ QString ProfileEdit::summarizeText_camera() {
|
||||
[&] (const openspace::Profile::CameraNavState& nav) {
|
||||
results = "setNavigationState: ";
|
||||
results += QString(nav.anchor.c_str()) + " ";
|
||||
results += QString(nav.aim.c_str()) + " ";
|
||||
results += QString(nav.aim->c_str()) + " ";
|
||||
results += QString(nav.referenceFrame.c_str()) + " ";
|
||||
results += "Pos=" + QString::number(nav.position.x) + ",";
|
||||
results += QString::number(nav.position.y) + ",";
|
||||
|
||||
Reference in New Issue
Block a user