mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-26 06:49:09 -06:00
More cleanup
Update QSS
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "filesystemaccess.h"
|
||||
#include <openspace/scene/profile.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <optional>
|
||||
|
||||
class LauncherWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
@@ -46,16 +47,11 @@ public:
|
||||
* \param sgctConfigName the name of the sgct configuration function used to
|
||||
* generate window config (blank if file is used)
|
||||
* \param parentItem The parent that contains this (and possibly other) children
|
||||
* in the tree structure (optional).
|
||||
* in the tree structure.
|
||||
*/
|
||||
LauncherWindow(std::string basePath, bool profileEnabled,
|
||||
openspace::configuration::Configuration& globalConfig, bool sgctConfigEnabled,
|
||||
std::string sgctConfigName, QWidget *parent = nullptr);
|
||||
|
||||
/**
|
||||
* Destructor for LauncherWindow class
|
||||
*/
|
||||
~LauncherWindow();
|
||||
std::string sgctConfigName, QWidget* parent);
|
||||
|
||||
/**
|
||||
* Returns bool for whether "start OpenSpace" was chosen when this window closed.
|
||||
@@ -95,12 +91,11 @@ public slots:
|
||||
void startOpenSpace();
|
||||
|
||||
private:
|
||||
void populateProfilesList(QString preset);
|
||||
void populateWindowConfigsList(QString preset);
|
||||
bool loadProfileFromFile(openspace::Profile*& p, std::string filename);
|
||||
void populateProfilesList(std::string preset);
|
||||
void populateWindowConfigsList(std::string preset);
|
||||
std::optional<openspace::Profile> loadProfileFromFile(std::string filename);
|
||||
void saveProfileToFile(const std::string& path, const openspace::Profile& p);
|
||||
|
||||
ProfileEdit* myEditorWindow;
|
||||
FileSystemAccess _fileAccessProfiles;
|
||||
FileSystemAccess _fileAccessWinConfigs;
|
||||
FileSystemAccess _filesystemAccess;
|
||||
|
||||
@@ -32,7 +32,7 @@ LauncherWindow QComboBox#config {
|
||||
border-color: rgb(225, 225, 225);
|
||||
padding: 1px 18px 1px 3px;
|
||||
min-width: 6em;
|
||||
font-size: 14px;
|
||||
font-size: 10pt;
|
||||
font-family: Segoe UI;
|
||||
font-weight: bold;
|
||||
color: rgb(255, 255, 255);
|
||||
@@ -47,18 +47,14 @@ LauncherWindow QComboBox#config:disabled {
|
||||
color: rgb(225, 225, 225);
|
||||
}
|
||||
|
||||
LauncherWindow QPushButton {
|
||||
font-family: Segoe UI;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
LauncherWindow QPushButton#large {
|
||||
background: rgb(128, 128, 128);
|
||||
border-radius: 2px;
|
||||
border-style: outset;
|
||||
border-width: 2px;
|
||||
border-color: rgb(225, 225, 225);
|
||||
font-size: 24px;
|
||||
font-size: 16pt;
|
||||
font-weight: bold;
|
||||
color: rgb(239, 239, 239);
|
||||
}
|
||||
LauncherWindow QPushButton#large:hover {
|
||||
@@ -71,7 +67,9 @@ LauncherWindow QPushButton#small {
|
||||
border-style: outset;
|
||||
border-width: 1px;
|
||||
border-color: rgb(225, 225, 225);
|
||||
font-size: 14px;
|
||||
min-height: 1em;
|
||||
font-size: 10pt;
|
||||
font-weight: bold;
|
||||
color: rgb(255, 255, 255);
|
||||
}
|
||||
|
||||
@@ -86,11 +84,13 @@ ProfileEdit QTextEdit {
|
||||
min-width: 30em;
|
||||
}
|
||||
|
||||
ProfileEdit QLabel {
|
||||
font-size: 14px;
|
||||
ProfileEdit QLabel#profile {
|
||||
font-size: 10pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
ProfileEdit QLabel#profile {
|
||||
ProfileEdit QLabel#heading {
|
||||
font-size: 10pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ void FileSystemAccess::parseChildDirElements(QFileInfo fileInfo, std::string spa
|
||||
QFileInfoList fileList = dir.entryInfoList(_fileFilterOptions);
|
||||
for (int i = 0; i < fileList.size(); i++) {
|
||||
QFileInfo fileInfo = fileList[i];
|
||||
std::string res = space + fileInfo.fileName().toUtf8().constData();
|
||||
std::string res = space + fileInfo.fileName().toStdString();
|
||||
|
||||
if (fileInfo.isDir()) {
|
||||
if (level != 0 || (level == 0 && isApprovedPath(res))) {
|
||||
|
||||
@@ -51,13 +51,13 @@ using namespace openspace;
|
||||
LauncherWindow::LauncherWindow(std::string basePath, bool profileEnabled,
|
||||
configuration::Configuration& globalConfig,
|
||||
bool sgctConfigEnabled, std::string sgctConfigName,
|
||||
QWidget *parent)
|
||||
QWidget* parent)
|
||||
: QMainWindow(parent)
|
||||
, _fileAccessProfiles(".profile", { "./" }, true, false)
|
||||
, _fileAccessWinConfigs(".xml", { "./" }, true, false)
|
||||
, _filesystemAccess(".asset",
|
||||
{"scene", "global", "customization", "examples", "util"},
|
||||
true, true)
|
||||
, _filesystemAccess(
|
||||
".asset", { "scene", "global", "customization", "examples", "util" }, true, true
|
||||
)
|
||||
, _basePath(QString::fromStdString(basePath))
|
||||
, _profileChangeAllowed(profileEnabled)
|
||||
, _sgctConfigChangeAllowed(sgctConfigEnabled)
|
||||
@@ -65,6 +65,15 @@ LauncherWindow::LauncherWindow(std::string basePath, bool profileEnabled,
|
||||
{
|
||||
Q_INIT_RESOURCE(resources);
|
||||
|
||||
qInstallMessageHandler(
|
||||
// Now that the log is enabled and available, we can pipe all Qt messages to that
|
||||
[](QtMsgType type, const QMessageLogContext&, const QString& msg) {
|
||||
if (type == QtCriticalMsg || type == QtFatalMsg || type == QtSystemMsg) {
|
||||
std::cerr << msg.toStdString() << std::endl;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
setWindowTitle("OpenSpace Launcher");
|
||||
setFixedSize(ScreenWidth, ScreenHeight);
|
||||
setAutoFillBackground(false);
|
||||
@@ -127,16 +136,18 @@ LauncherWindow::LauncherWindow(std::string basePath, bool profileEnabled,
|
||||
|
||||
_reportAssetsInFilesystem = _filesystemAccess.useQtFileSystemModelToTraverseDir(
|
||||
QString::fromStdString(basePath) + "/data/assets");
|
||||
populateProfilesList(QString::fromStdString(globalConfig.profile));
|
||||
populateProfilesList(globalConfig.profile);
|
||||
|
||||
_profileBox->setDisabled(!_profileChangeAllowed);
|
||||
|
||||
populateWindowConfigsList(QString(sgctConfigName.c_str()));
|
||||
populateWindowConfigsList(sgctConfigName);
|
||||
_windowConfigBox->setDisabled(!_sgctConfigChangeAllowed);
|
||||
_fullyConfiguredViaCliArgs = (!profileEnabled && !sgctConfigEnabled);
|
||||
|
||||
bool hasSyncFiles = false;
|
||||
QString syncFilePath = QString(globalConfig.pathTokens["SYNC"].c_str()) + "/http/launcher_images/1/profile1.png";
|
||||
QString syncFilePath = QString::fromStdString(
|
||||
globalConfig.pathTokens["SYNC"] + "/http/launcher_images/1/profile1.png"
|
||||
);
|
||||
QFileInfo check_file(syncFilePath);
|
||||
// check if file exists and if yes: Is it really a file and no directory?
|
||||
if (check_file.exists() && check_file.isFile()) {
|
||||
@@ -150,7 +161,9 @@ LauncherWindow::LauncherWindow(std::string basePath, bool profileEnabled,
|
||||
std::mt19937 rng(rd());
|
||||
std::uniform_int_distribution<int> uni(0, 4);
|
||||
auto random_integer = uni(rng);
|
||||
filename = QString::fromStdString("/http/launcher_images/1/profile" + std::to_string(random_integer) + ".png");
|
||||
filename = QString::fromStdString(
|
||||
"/http/launcher_images/1/profile" + std::to_string(random_integer) + ".png"
|
||||
);
|
||||
bgpath = QString::fromStdString(globalConfig.pathTokens["SYNC"]) + filename;
|
||||
}
|
||||
else {
|
||||
@@ -160,7 +173,7 @@ LauncherWindow::LauncherWindow(std::string basePath, bool profileEnabled,
|
||||
backgroundImage->setPixmap(QPixmap(bgpath));
|
||||
}
|
||||
|
||||
void LauncherWindow::populateProfilesList(QString preset) {
|
||||
void LauncherWindow::populateProfilesList(std::string preset) {
|
||||
for (int i = 0; i < _profileBox->count(); ++i) {
|
||||
_profileBox->removeItem(i);
|
||||
}
|
||||
@@ -171,19 +184,19 @@ void LauncherWindow::populateProfilesList(QString preset) {
|
||||
std::string iline;
|
||||
QStringList profilesListLine;
|
||||
while (std::getline(instream, iline)) {
|
||||
if (_profileBox->findText(QString(iline.c_str())) == -1) {
|
||||
_profileBox->addItem(iline.c_str());
|
||||
if (_profileBox->findText(QString::fromStdString(iline)) == -1) {
|
||||
_profileBox->addItem(QString::fromStdString(iline));
|
||||
}
|
||||
}
|
||||
if (preset.length() > 0) {
|
||||
int presetMatchIdx = _profileBox->findText(preset);
|
||||
int presetMatchIdx = _profileBox->findText(QString::fromStdString(preset));
|
||||
if (presetMatchIdx != -1) {
|
||||
_profileBox->setCurrentIndex(presetMatchIdx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LauncherWindow::populateWindowConfigsList(QString preset) {
|
||||
void LauncherWindow::populateWindowConfigsList(std::string preset) {
|
||||
std::string reportConfigs = _fileAccessWinConfigs.useQtFileSystemModelToTraverseDir(
|
||||
_basePath + "/config"
|
||||
);
|
||||
@@ -195,61 +208,64 @@ void LauncherWindow::populateWindowConfigsList(QString preset) {
|
||||
}
|
||||
_windowConfigBox->addItems(windowConfigsListLine);
|
||||
if (preset.length() > 0) {
|
||||
int presetMatchIdx = _windowConfigBox->findText(preset);
|
||||
int presetMatchIdx = _windowConfigBox->findText(QString::fromStdString(preset));
|
||||
if (presetMatchIdx != -1) {
|
||||
_windowConfigBox->setCurrentIndex(presetMatchIdx);
|
||||
}
|
||||
else {
|
||||
_windowConfigBox->addItem(preset);
|
||||
_windowConfigBox->addItem(QString::fromStdString(preset));
|
||||
_windowConfigBox->setCurrentIndex(_windowConfigBox->count() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LauncherWindow::openWindow_new() {
|
||||
QString initialProfileSelection = _profileBox->currentText();
|
||||
std::string initialProfileSelection = _profileBox->currentText().toStdString();
|
||||
Profile profile;
|
||||
myEditorWindow = new ProfileEdit(profile, _reportAssetsInFilesystem,
|
||||
_globalConfig.profilesReadOnly, this);
|
||||
myEditorWindow->exec();
|
||||
if (myEditorWindow->wasSaved()) {
|
||||
std::string saveProfilePath = _basePath.toUtf8().constData();
|
||||
ProfileEdit editor(
|
||||
profile,
|
||||
_reportAssetsInFilesystem,
|
||||
_globalConfig.profilesReadOnly,
|
||||
this
|
||||
);
|
||||
editor.exec();
|
||||
if (editor.wasSaved()) {
|
||||
std::string saveProfilePath = _basePath.toStdString();
|
||||
saveProfilePath += "/data/profiles/";
|
||||
saveProfilePath += myEditorWindow->specifiedFilename() + ".profile";
|
||||
saveProfilePath += editor.specifiedFilename() + ".profile";
|
||||
saveProfileToFile(saveProfilePath, profile);
|
||||
populateProfilesList(QString(myEditorWindow->specifiedFilename().c_str()));
|
||||
populateProfilesList(editor.specifiedFilename());
|
||||
}
|
||||
else {
|
||||
populateProfilesList(initialProfileSelection);
|
||||
}
|
||||
delete myEditorWindow;
|
||||
}
|
||||
|
||||
void LauncherWindow::openWindow_edit() {
|
||||
QString initialProfileSelection = _profileBox->currentText();
|
||||
std::string profilePath = _basePath.toStdString();
|
||||
profilePath += "/data/profiles/";
|
||||
std::string initialProfileSelection = _profileBox->currentText().toStdString();
|
||||
std::string profilePath = _basePath.toStdString() + "/data/profiles/";
|
||||
int selectedProfileIdx = _profileBox->currentIndex();
|
||||
QString profileToSet = _profileBox->itemText(selectedProfileIdx);
|
||||
std::string editProfilePath = profilePath + profileToSet.toStdString();
|
||||
editProfilePath += ".profile";
|
||||
Profile* profile;
|
||||
bool validFile = loadProfileFromFile(profile, editProfilePath);
|
||||
if (profile != nullptr && validFile) {
|
||||
myEditorWindow = new ProfileEdit(*profile, _reportAssetsInFilesystem,
|
||||
_globalConfig.profilesReadOnly, this);
|
||||
myEditorWindow->setProfileName(profileToSet);
|
||||
myEditorWindow->exec();
|
||||
if (myEditorWindow->wasSaved()) {
|
||||
profilePath += myEditorWindow->specifiedFilename() + ".profile";
|
||||
std::string editProfilePath = profilePath + profileToSet.toStdString() + ".profile";
|
||||
|
||||
std::optional<Profile> profile = loadProfileFromFile(editProfilePath);
|
||||
if (profile.has_value()) {
|
||||
ProfileEdit editor(
|
||||
*profile,
|
||||
_reportAssetsInFilesystem,
|
||||
_globalConfig.profilesReadOnly,
|
||||
this
|
||||
);
|
||||
editor.setProfileName(profileToSet);
|
||||
editor.exec();
|
||||
if (editor.wasSaved()) {
|
||||
profilePath += editor.specifiedFilename() + ".profile";
|
||||
saveProfileToFile(profilePath, *profile);
|
||||
populateProfilesList(QString(myEditorWindow->specifiedFilename().c_str()));
|
||||
populateProfilesList(editor.specifiedFilename());
|
||||
}
|
||||
else {
|
||||
populateProfilesList(initialProfileSelection);
|
||||
}
|
||||
delete myEditorWindow;
|
||||
delete profile;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,7 +300,7 @@ void LauncherWindow::saveProfileToFile(const std::string& path, const Profile& p
|
||||
outFile.close();
|
||||
}
|
||||
|
||||
bool LauncherWindow::loadProfileFromFile(Profile*& p, std::string filename) {
|
||||
std::optional<Profile> LauncherWindow::loadProfileFromFile(std::string filename) {
|
||||
bool successfulLoad = true;
|
||||
std::string content;
|
||||
if (filename.length() > 0) {
|
||||
@@ -305,7 +321,7 @@ bool LauncherWindow::loadProfileFromFile(Profile*& p, std::string filename) {
|
||||
}
|
||||
}
|
||||
try {
|
||||
p = new Profile(content);
|
||||
return Profile(content);
|
||||
}
|
||||
catch (const Profile::ParsingError& e) {
|
||||
QMessageBox::critical(
|
||||
@@ -315,7 +331,7 @@ bool LauncherWindow::loadProfileFromFile(Profile*& p, std::string filename) {
|
||||
"ParsingError exception in {}: {}, {}", filename, e.component, e.message
|
||||
))
|
||||
);
|
||||
successfulLoad = false;
|
||||
return std::nullopt;
|
||||
}
|
||||
catch (const ghoul::RuntimeError& e) {
|
||||
QMessageBox::critical(
|
||||
@@ -326,14 +342,7 @@ bool LauncherWindow::loadProfileFromFile(Profile*& p, std::string filename) {
|
||||
filename, e.component, e.message
|
||||
))
|
||||
);
|
||||
successfulLoad = false;
|
||||
}
|
||||
return successfulLoad;
|
||||
}
|
||||
|
||||
LauncherWindow::~LauncherWindow() {
|
||||
if (myEditorWindow != nullptr) {
|
||||
delete myEditorWindow;
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,11 +355,11 @@ bool LauncherWindow::isFullyConfiguredFromCliArgs() {
|
||||
}
|
||||
|
||||
std::string LauncherWindow::selectedProfile() {
|
||||
return _profileBox->currentText().toUtf8().constData();
|
||||
return _profileBox->currentText().toStdString();
|
||||
}
|
||||
|
||||
std::string LauncherWindow::selectedWindowConfig() {
|
||||
return _windowConfigBox->currentText().toUtf8().constData();
|
||||
return _windowConfigBox->currentText().toStdString();
|
||||
}
|
||||
|
||||
void LauncherWindow::startOpenSpace() {
|
||||
|
||||
@@ -80,7 +80,7 @@ AdditionalScriptsDialog::AdditionalScriptsDialog(openspace::Profile& profile,
|
||||
|
||||
void AdditionalScriptsDialog::parseScript() {
|
||||
std::vector<std::string> tmpMultilineStringToVector;
|
||||
std::istringstream iss(_textScripts->toPlainText().toUtf8().constData());
|
||||
std::istringstream iss(_textScripts->toPlainText().toStdString());
|
||||
while (!iss.eof()) {
|
||||
std::string s;
|
||||
getline(iss, s);
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace {
|
||||
bool foundDirMatch = false;
|
||||
for (int r = 0; r < nRows; r++) {
|
||||
QModelIndex idx = model.index(r, 0, parent);
|
||||
std::string assetName = model.name(idx).toUtf8().constData();
|
||||
std::string assetName = model.name(idx).toStdString();
|
||||
if (!model.isAsset(idx)) {
|
||||
if (firstDir.compare(assetName) == 0) {
|
||||
int nChildRows = model.childCount(idx);
|
||||
@@ -86,7 +86,7 @@ namespace {
|
||||
//Insert missing directory here with name and exists=false condition
|
||||
model.assetItem(parent)->insertChildren(nRows, 1, 3);
|
||||
QModelIndex idx = model.index(nRows, 0, parent);
|
||||
model.setName(idx, QString(firstDir.c_str()));
|
||||
model.setName(idx, QString::fromStdString(firstDir));
|
||||
model.setExistenceInFilesystem(idx, false);
|
||||
traverseToFindFilesystemMatch(model, idx, 0, nextPath);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ namespace {
|
||||
bool foundFileMatch = false;
|
||||
for (int r = 0; r < nRows; r++) {
|
||||
QModelIndex idx = model.index(r, 0, parent);
|
||||
std::string assetName = model.name(idx).toUtf8().constData();
|
||||
std::string assetName = model.name(idx).toStdString();
|
||||
|
||||
if (path.compare(assetName) == 0) {
|
||||
foundFileMatch = true;
|
||||
@@ -107,7 +107,7 @@ namespace {
|
||||
//Insert missing file here with name and exists=false condition
|
||||
model.assetItem(parent)->insertChildren(nRows, 1, 3);
|
||||
QModelIndex idx = model.index(nRows, 0, parent);
|
||||
model.setName(idx, QString(path.c_str()));
|
||||
model.setName(idx, QString::fromStdString(path));
|
||||
model.setChecked(idx, true);
|
||||
model.setExistenceInFilesystem(idx, false);
|
||||
}
|
||||
@@ -214,7 +214,7 @@ QString AssetsDialog::createTextSummary() {
|
||||
(existsInFilesystem ? "black" : "red"),
|
||||
summaryPaths.at(i)
|
||||
);
|
||||
summary += QString(s.c_str());
|
||||
summary += QString::fromStdString(s);
|
||||
}
|
||||
return summary;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ AssetTreeModel::AssetTreeModel(QObject* parent)
|
||||
}
|
||||
|
||||
void AssetTreeModel::importModelData(const std::string& contents) {
|
||||
std::istringstream iss(contents.c_str());
|
||||
std::istringstream iss(contents);
|
||||
ImportElement rootElem = { "", 0, false };
|
||||
|
||||
if (importGetNextLine(rootElem, iss)) {
|
||||
|
||||
@@ -368,9 +368,9 @@ void CameraDialog::approved() {
|
||||
|
||||
if (_tabWidget->currentIndex() == CameraTypeNav) {
|
||||
openspace::Profile::CameraNavState nav;
|
||||
nav.anchor = _navState.anchor->text().toUtf8().constData();
|
||||
nav.aim = _navState.aim->text().toUtf8().constData();
|
||||
nav.referenceFrame = _navState.refFrame->text().toUtf8().constData();
|
||||
nav.anchor = _navState.anchor->text().toStdString();
|
||||
nav.aim = _navState.aim->text().toStdString();
|
||||
nav.referenceFrame = _navState.refFrame->text().toStdString();
|
||||
nav.position.x = _navState.positionX->text().toDouble();
|
||||
nav.position.y = _navState.positionY->text().toDouble();
|
||||
nav.position.z = _navState.positionZ->text().toDouble();
|
||||
@@ -404,7 +404,7 @@ void CameraDialog::approved() {
|
||||
}
|
||||
else if (_tabWidget->currentIndex() == CameraTypeGeo) {
|
||||
openspace::Profile::CameraGoToGeo geo;
|
||||
geo.anchor = _geoState.anchor->text().toUtf8().constData();
|
||||
geo.anchor = _geoState.anchor->text().toStdString();
|
||||
geo.latitude = _geoState.latitude->text().toDouble();
|
||||
geo.longitude = _geoState.longitude->text().toDouble();
|
||||
if (!_geoState.altitude->text().isEmpty()) {
|
||||
|
||||
@@ -170,7 +170,7 @@ KeybindingsDialog::KeybindingsDialog(openspace::Profile& profile, QWidget *paren
|
||||
QStringList comboKeysStringList;
|
||||
for (int i = 0; i < static_cast<int>(openspace::Key::Last); ++i) {
|
||||
if (openspace::KeyNames.find(i) != openspace::KeyNames.end()) {
|
||||
comboKeysStringList += QString(openspace::KeyNames.at(i).c_str());
|
||||
comboKeysStringList += QString::fromStdString(openspace::KeyNames.at(i));
|
||||
// Create map to relate key combo box to integer value defined in Key
|
||||
_mapKeyComboBoxIndexToKeyValue.push_back(i);
|
||||
}
|
||||
@@ -297,11 +297,11 @@ void KeybindingsDialog::listItemSelected(void) {
|
||||
}
|
||||
|
||||
// Do key here
|
||||
_nameEdit->setText(QString(k.name.c_str()));
|
||||
_guiPathEdit->setText(QString(k.guiPath.c_str()));
|
||||
_documentationEdit->setText(QString(k.documentation.c_str()));
|
||||
_nameEdit->setText(QString::fromStdString(k.name));
|
||||
_guiPathEdit->setText(QString::fromStdString(k.guiPath));
|
||||
_documentationEdit->setText(QString::fromStdString(k.documentation));
|
||||
_localCheck->setChecked(k.isLocal);
|
||||
_scriptEdit->setText(QString(k.script.c_str()));
|
||||
_scriptEdit->setText(QString::fromStdString(k.script));
|
||||
}
|
||||
transitionToEditMode();
|
||||
}
|
||||
@@ -392,10 +392,10 @@ void KeybindingsDialog::listItemSave(void) {
|
||||
_data[index].key.modifier = static_cast<openspace::KeyModifier>(keyModIdx);
|
||||
int keyIdx = _mapKeyComboBoxIndexToKeyValue.at(_keyCombo->currentIndex());
|
||||
_data[index].key.key = static_cast<openspace::Key>(keyIdx);
|
||||
_data[index].name = _nameEdit->text().toUtf8().constData();
|
||||
_data[index].guiPath = _guiPathEdit->text().toUtf8().constData();
|
||||
_data[index].documentation = _documentationEdit->text().toUtf8().constData();
|
||||
_data[index].script = _scriptEdit->toPlainText().toUtf8().constData();
|
||||
_data[index].name = _nameEdit->text().toStdString();
|
||||
_data[index].guiPath = _guiPathEdit->text().toStdString();
|
||||
_data[index].documentation = _documentationEdit->text().toStdString();
|
||||
_data[index].script = _scriptEdit->toPlainText().toStdString();
|
||||
_data[index].isLocal = (_localCheck->isChecked());
|
||||
std::string summary = createOneLineSummary(_data[index]);
|
||||
_list->item(index)->setText(QString::fromStdString(summary));
|
||||
|
||||
@@ -149,7 +149,7 @@ ModulesDialog::ModulesDialog(openspace::Profile& profile, QWidget *parent)
|
||||
}
|
||||
|
||||
QString ModulesDialog::createOneLineSummary(openspace::Profile::Module m) {
|
||||
QString summary = QString(m.name.c_str());
|
||||
QString summary = QString::fromStdString(m.name);
|
||||
bool hasCommandForLoaded = (m.loadedInstruction->length() > 0);
|
||||
bool hasCommandForNotLoaded = (m.notLoadedInstruction->length() > 0);
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ ProfileEdit::ProfileEdit(Profile& profile, const std::string reportedAssets,
|
||||
container->setColumnStretch(1, 1);
|
||||
|
||||
_propertiesLabel = new QLabel("Properties");
|
||||
_propertiesLabel->setObjectName("heading");
|
||||
_propertiesLabel->setWordWrap(true);
|
||||
container->addWidget(_propertiesLabel, 0, 0);
|
||||
|
||||
@@ -107,6 +108,7 @@ ProfileEdit::ProfileEdit(Profile& profile, const std::string reportedAssets,
|
||||
container->setColumnStretch(1, 1);
|
||||
|
||||
_assetsLabel = new QLabel("Assets");
|
||||
_assetsLabel->setObjectName("heading");
|
||||
_assetsLabel->setWordWrap(true);
|
||||
container->addWidget(_assetsLabel, 0, 0);
|
||||
|
||||
@@ -131,6 +133,7 @@ ProfileEdit::ProfileEdit(Profile& profile, const std::string reportedAssets,
|
||||
container->setColumnStretch(1, 1);
|
||||
|
||||
_keybindingsLabel = new QLabel("Keybindings");
|
||||
_keybindingsLabel->setObjectName("heading");
|
||||
_keybindingsLabel->setWordWrap(true);
|
||||
container->addWidget(_keybindingsLabel, 0, 0);
|
||||
|
||||
@@ -160,6 +163,7 @@ ProfileEdit::ProfileEdit(Profile& profile, const std::string reportedAssets,
|
||||
{
|
||||
QBoxLayout* container = new QVBoxLayout;
|
||||
_metaLabel = new QLabel("Meta");
|
||||
_metaLabel->setObjectName("heading");
|
||||
_metaLabel->setWordWrap(true);
|
||||
container->addWidget(_metaLabel);
|
||||
|
||||
@@ -178,6 +182,7 @@ ProfileEdit::ProfileEdit(Profile& profile, const std::string reportedAssets,
|
||||
{
|
||||
QBoxLayout* container = new QVBoxLayout;
|
||||
_interestingNodesLabel = new QLabel("Mark Interesting Nodes");
|
||||
_interestingNodesLabel->setObjectName("heading");
|
||||
_interestingNodesLabel->setWordWrap(true);
|
||||
container->addWidget(_interestingNodesLabel);
|
||||
|
||||
@@ -199,6 +204,7 @@ ProfileEdit::ProfileEdit(Profile& profile, const std::string reportedAssets,
|
||||
{
|
||||
QBoxLayout* container = new QVBoxLayout;
|
||||
_deltaTimesLabel = new QLabel("Simulation Time Increments");
|
||||
_deltaTimesLabel->setObjectName("heading");
|
||||
_deltaTimesLabel->setWordWrap(true);
|
||||
container->addWidget(_deltaTimesLabel);
|
||||
|
||||
@@ -220,6 +226,7 @@ ProfileEdit::ProfileEdit(Profile& profile, const std::string reportedAssets,
|
||||
{
|
||||
QBoxLayout* container = new QVBoxLayout;
|
||||
_cameraLabel = new QLabel("Camera");
|
||||
_cameraLabel->setObjectName("heading");
|
||||
_cameraLabel->setWordWrap(true);
|
||||
container->addWidget(_cameraLabel);
|
||||
|
||||
@@ -238,6 +245,7 @@ ProfileEdit::ProfileEdit(Profile& profile, const std::string reportedAssets,
|
||||
{
|
||||
QBoxLayout* container = new QVBoxLayout;
|
||||
_timeLabel = new QLabel("Time");
|
||||
_timeLabel->setObjectName("heading");
|
||||
_timeLabel->setWordWrap(true);
|
||||
container->addWidget(_timeLabel);
|
||||
|
||||
@@ -256,6 +264,7 @@ ProfileEdit::ProfileEdit(Profile& profile, const std::string reportedAssets,
|
||||
{
|
||||
QBoxLayout* container = new QVBoxLayout;
|
||||
_modulesLabel = new QLabel("Modules");
|
||||
_modulesLabel->setObjectName("heading");
|
||||
_modulesLabel->setWordWrap(true);
|
||||
container->addWidget(_modulesLabel);
|
||||
|
||||
@@ -274,6 +283,7 @@ ProfileEdit::ProfileEdit(Profile& profile, const std::string reportedAssets,
|
||||
{
|
||||
QBoxLayout* container = new QVBoxLayout;
|
||||
_additionalScriptsLabel = new QLabel("Additional Scripts");
|
||||
_additionalScriptsLabel->setObjectName("heading");
|
||||
_additionalScriptsLabel->setWordWrap(true);
|
||||
container->addWidget(_additionalScriptsLabel);
|
||||
|
||||
@@ -485,7 +495,7 @@ bool ProfileEdit::wasSaved() {
|
||||
}
|
||||
|
||||
std::string ProfileEdit::specifiedFilename() {
|
||||
return _profileEdit->text().toUtf8().constData();
|
||||
return _profileEdit->text().toStdString();
|
||||
}
|
||||
|
||||
void ProfileEdit::cancel() {
|
||||
@@ -500,7 +510,7 @@ bool ProfileEdit::isReadOnly(std::string profileSave) {
|
||||
|
||||
void ProfileEdit::approved() {
|
||||
QString profileName = _profileEdit->text();
|
||||
if ((profileName.length() > 0) && !isReadOnly(profileName.toUtf8().constData())) {
|
||||
if ((profileName.length() > 0) && !isReadOnly(profileName.toStdString())) {
|
||||
_saveSelected = true;
|
||||
_errorMsg->setText("");
|
||||
accept();
|
||||
|
||||
@@ -155,9 +155,9 @@ PropertiesDialog::PropertiesDialog(openspace::Profile& profile, QWidget *parent)
|
||||
}
|
||||
|
||||
QString PropertiesDialog::createOneLineSummary(openspace::Profile::Property p) {
|
||||
QString summary = QString(p.name.c_str());
|
||||
QString summary = QString::fromStdString(p.name);
|
||||
summary += " = ";
|
||||
summary += QString(p.value.c_str());
|
||||
summary += QString::fromStdString(p.value);
|
||||
summary += " (SetPropertyValue";
|
||||
if (p.setType == openspace::Profile::Property::SetType::SetPropertyValueSingle) {
|
||||
summary += "Single";
|
||||
@@ -216,8 +216,8 @@ void PropertiesDialog::listItemAdded(void) {
|
||||
|
||||
// Blank-out the 2 text fields, set combo box to index 0
|
||||
_commandCombo->setCurrentIndex(0);
|
||||
_propertyEdit->setText(QString(_data.back().name.c_str()));
|
||||
_valueEdit->setText(QString(_data.back().value.c_str()));
|
||||
_propertyEdit->setText(QString::fromStdString(_data.back().name));
|
||||
_valueEdit->setText(QString::fromStdString(_data.back().value));
|
||||
_commandCombo->setFocus(Qt::OtherFocusReason);
|
||||
_editModeNewItem = true;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ void TimeDialog::approved() {
|
||||
else {
|
||||
Profile::Time t;
|
||||
t.type = Profile::Time::Type::Relative;
|
||||
t.value = _relativeEdit->text().toUtf8().constData();
|
||||
t.value = _relativeEdit->text().toStdString();
|
||||
_profile.setTime(t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1173,7 +1173,7 @@ int main(int argc, char** argv) {
|
||||
int qac = 0;
|
||||
qaobj.reset(new QApplication(qac, nullptr));
|
||||
launchwin.reset(new LauncherWindow(absPath("${BASE}"), !haveCliProfile,
|
||||
global::configuration, !haveCliSGCTConfig, windowCfgPreset));
|
||||
global::configuration, !haveCliSGCTConfig, windowCfgPreset, nullptr));
|
||||
launchwin->show();
|
||||
qaobj->exec();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user