mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-13 17:09:05 -05:00
Various bug fixes and removal of simulated test data
This commit is contained in:
@@ -23,6 +23,7 @@ public:
|
||||
explicit addedScripts(openspace::Profile* imported, QWidget *parent = nullptr);
|
||||
~addedScripts();
|
||||
void setScriptText(std::string s);
|
||||
void keyPressEvent(QKeyEvent *evt);
|
||||
|
||||
private:
|
||||
Ui::addedScripts *ui;
|
||||
|
||||
@@ -29,6 +29,7 @@ public:
|
||||
QWidget *parent = nullptr);
|
||||
~assets();
|
||||
std::string createTextSummary();
|
||||
void keyPressEvent(QKeyEvent *evt);
|
||||
|
||||
protected:
|
||||
//void resizeEvent(QResizeEvent* event);
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
Nav = 0,
|
||||
Geo
|
||||
};
|
||||
void keyPressEvent(QKeyEvent *evt);
|
||||
|
||||
private:
|
||||
bool isNumericalValue(QLineEdit* le);
|
||||
|
||||
@@ -12,7 +12,7 @@ class deltaTimes;
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
||||
static const double _defaultDeltaTimes[30] = {
|
||||
static const int _defaultDeltaTimes[30] = {
|
||||
1, 2, 5, 10, 30,
|
||||
60, 120, 300, 600, 1800,
|
||||
3600, 7200, 10800, 21600, 43200,
|
||||
@@ -21,36 +21,6 @@ static const double _defaultDeltaTimes[30] = {
|
||||
63072000, 157680000, 315360000, 630720000, 1576800000
|
||||
};
|
||||
|
||||
struct DeltaTimes {
|
||||
std::vector<double> _times;
|
||||
DeltaTimes() {
|
||||
_times.resize(sizeof(_defaultDeltaTimes)/sizeof(double));
|
||||
zeroValues();
|
||||
};
|
||||
DeltaTimes(std::vector<double> dt) {
|
||||
_times.resize(sizeof(_defaultDeltaTimes)/sizeof(double));
|
||||
zeroValues();
|
||||
_times = dt;
|
||||
};
|
||||
void loadValues(std::vector<double>& dt) {
|
||||
for (size_t i = 0; i < dt.size(); ++i) {
|
||||
_times[i] = dt[i];
|
||||
}
|
||||
}
|
||||
size_t size() {
|
||||
auto it = find(_times.begin(), _times.end(), 0);
|
||||
return std::distance(_times.begin(), it);
|
||||
};
|
||||
size_t totalSize() {
|
||||
return (sizeof(_defaultDeltaTimes) / sizeof(double));
|
||||
}
|
||||
void zeroValues() {
|
||||
for (size_t i = 0; i < _times.size(); ++i) {
|
||||
_times[i] = 0.0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class deltaTimes : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -58,20 +28,22 @@ class deltaTimes : public QDialog
|
||||
public slots:
|
||||
void listItemSelected();
|
||||
void saveDeltaTimeValue();
|
||||
void clearDeltaTimeValue();
|
||||
void addDeltaTimeValue();
|
||||
void removeDeltaTimeValue();
|
||||
void parseSelections();
|
||||
|
||||
public:
|
||||
explicit deltaTimes(openspace::Profile* _imported, QWidget *parent = nullptr);
|
||||
~deltaTimes();
|
||||
void setDeltaTimes(std::vector<double>& dt);
|
||||
QString createSummaryForDeltaTime(size_t idx, double dt, bool forListView);
|
||||
QString createSummaryForDeltaTime(size_t idx, int dt, bool forListView);
|
||||
void keyPressEvent(QKeyEvent *evt);
|
||||
struct timeIntervals {
|
||||
int index;
|
||||
double secondsPerInterval;
|
||||
int secondsPerInterval;
|
||||
QString intervalName;
|
||||
};
|
||||
|
||||
int _maxSize = sizeof(_defaultDeltaTimes) / sizeof(int);
|
||||
const int secondsPerYear = 31536000;
|
||||
const int secondsPerMonth = 18144000;
|
||||
const int secondsPerWeek = 604800;
|
||||
@@ -80,10 +52,10 @@ public:
|
||||
const int secondsPerMinute = 60;
|
||||
|
||||
private:
|
||||
QString timeDescription(double value);
|
||||
QString timeDescription(int value);
|
||||
bool checkForTimeDescription(QString& description, QString unit,
|
||||
int interval, double value);
|
||||
QString checkForTimeDescription(int intervalIndex, double value);
|
||||
int interval, int value);
|
||||
QString checkForTimeDescription(int intervalIndex, int value);
|
||||
int lastSelectableItem();
|
||||
bool isNumericalValue(QLineEdit* le);
|
||||
|
||||
@@ -91,7 +63,7 @@ private:
|
||||
QWidget* _parent;
|
||||
|
||||
openspace::Profile* _imported;
|
||||
DeltaTimes _data;
|
||||
std::vector<int> _data;
|
||||
std::vector<std::string> _deltaTimeStrings;
|
||||
std::vector<QListWidgetItem*> _deltaListItems;
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ public slots:
|
||||
public:
|
||||
explicit keybindings(openspace::Profile* imported, QWidget *parent = nullptr);
|
||||
~keybindings();
|
||||
void keyPressEvent(QKeyEvent *evt);
|
||||
|
||||
protected:
|
||||
//void resizeEvent(QResizeEvent* event);
|
||||
|
||||
@@ -18,48 +18,25 @@ class LauncherWindow : public QMainWindow
|
||||
public slots:
|
||||
void openWindow_edit();
|
||||
void openWindow_new();
|
||||
void simulateData();
|
||||
|
||||
public:
|
||||
LauncherWindow(std::string basePath, QWidget *parent = nullptr);
|
||||
~LauncherWindow();
|
||||
void receiveAssets(std::vector<std::string> results);
|
||||
|
||||
private:
|
||||
void populateProfilesList();
|
||||
void populateWindowConfigsList();
|
||||
bool loadProfileFromFile(openspace::Profile*& p, std::string filename);
|
||||
void displayProfileParseErrorDialogThenQuit(std::string msg);
|
||||
void clearData();
|
||||
void initialize_meta();
|
||||
void initialize_modules();
|
||||
void initialize_assets();
|
||||
void initialize_properties();
|
||||
void initialize_keybindings();
|
||||
void initialize_deltaTimes();
|
||||
void initialize_time();
|
||||
void initialize_camera();
|
||||
void initialize_markNodes();
|
||||
void initialize_addedScripts();
|
||||
void saveProfileToFile(const std::string& path, openspace::Profile* p);
|
||||
void displayErrorDialog(std::string msg);
|
||||
|
||||
Ui::LauncherWindow *ui;
|
||||
ProfileEdit* myEditorWindow;
|
||||
errordialog* _myDialog;
|
||||
filesystemAccess _fileAccess_profiles;
|
||||
filesystemAccess _fileAccess_winConfigs;
|
||||
openspace::Profile::Meta _metaData;
|
||||
std::vector<openspace::Profile::Module> _moduleData;
|
||||
std::vector<openspace::Profile::Asset> _assetData;
|
||||
filesystemAccess _filesystemAccess;
|
||||
std::string _reportAssetsInFilesystem;
|
||||
std::vector<openspace::Profile::Property> _propsData;
|
||||
std::vector<openspace::Profile::Keybinding> _keybindingsData;
|
||||
DeltaTimes _deltaTimesData;
|
||||
openspace::Profile::Time _timeData;
|
||||
openspace::Profile::CameraType _cameraData;
|
||||
std::vector<std::string> _markNodesData;
|
||||
std::string _addedScriptsData;
|
||||
//ProfileBlock _pData;
|
||||
QString _basePath;
|
||||
};
|
||||
#endif // LAUNCHERWINDOW_H
|
||||
|
||||
@@ -25,6 +25,7 @@ public slots:
|
||||
public:
|
||||
explicit markNodes(openspace::Profile* imported, QWidget *parent = nullptr);
|
||||
~markNodes();
|
||||
void keyPressEvent(QKeyEvent *evt);
|
||||
|
||||
private:
|
||||
Ui::markNodes *ui;
|
||||
|
||||
@@ -23,6 +23,7 @@ public:
|
||||
explicit meta(openspace::Profile* imported, QWidget *parent = nullptr);
|
||||
~meta();
|
||||
bool areAllEntriesBlank();
|
||||
void keyPressEvent(QKeyEvent *evt);
|
||||
|
||||
private:
|
||||
Ui::meta *ui;
|
||||
|
||||
@@ -27,6 +27,7 @@ public slots:
|
||||
public:
|
||||
explicit osmodules(openspace::Profile* imported, QWidget *parent = nullptr);
|
||||
~osmodules();
|
||||
void keyPressEvent(QKeyEvent *evt);
|
||||
|
||||
protected:
|
||||
//void resizeEvent(QResizeEvent* event);
|
||||
|
||||
@@ -19,6 +19,7 @@ public slots:
|
||||
void enableAccordingToType(int);
|
||||
void cancel();
|
||||
void approved();
|
||||
void keyPressEvent(QKeyEvent *evt);
|
||||
|
||||
public:
|
||||
explicit ostime(openspace::Profile* imported, QWidget *parent = nullptr);
|
||||
|
||||
@@ -45,6 +45,9 @@ public:
|
||||
explicit ProfileEdit(openspace::Profile* profile, const std::string reportedAssets, QWidget *parent = nullptr);
|
||||
~ProfileEdit();
|
||||
void setProfileName(QString profileToSet);
|
||||
bool wasSaved();
|
||||
std::string specifiedFilename();
|
||||
void keyPressEvent(QKeyEvent *evt);
|
||||
|
||||
private:
|
||||
void initSummaryTextForEachCategory();
|
||||
@@ -73,6 +76,7 @@ private:
|
||||
markNodes* _markNodes;
|
||||
openspace::Profile* _pData;
|
||||
const std::string _reportedAssets;
|
||||
bool _saveSelected = false;
|
||||
};
|
||||
|
||||
#endif // PROFILEEDIT_H
|
||||
|
||||
@@ -27,6 +27,7 @@ public slots:
|
||||
public:
|
||||
explicit properties(openspace::Profile* imported, QWidget *parent = nullptr);
|
||||
~properties();
|
||||
void keyPressEvent(QKeyEvent *evt);
|
||||
|
||||
protected:
|
||||
//void resizeEvent(QResizeEvent* event);
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
QFont font;
|
||||
font.setFamily(QString::fromUtf8("Arial"));
|
||||
treeView->setFont(font);
|
||||
treeView->setStyleSheet(QString::fromUtf8("background-color: rgb(85, 87, 83);"));
|
||||
//treeView->setStyleSheet(QString::fromUtf8("background-color: rgb(85, 87, 83);"));
|
||||
treeView->setAlternatingRowColors(false);
|
||||
treeView->setAnimated(false);
|
||||
varName = new QPushButton(assets);
|
||||
|
||||
@@ -28,6 +28,7 @@ public:
|
||||
QListWidget *listWidget;
|
||||
QLabel *label_adjust;
|
||||
QPushButton *button_save;
|
||||
QPushButton *button_add;
|
||||
QPushButton *button_remove;
|
||||
QLineEdit *line_seconds;
|
||||
|
||||
@@ -60,9 +61,12 @@ public:
|
||||
button_save = new QPushButton(deltaTimes);
|
||||
button_save->setObjectName(QString::fromUtf8("button_save"));
|
||||
button_save->setGeometry(QRect(20, 354, 71, 25));
|
||||
button_add = new QPushButton(deltaTimes);
|
||||
button_add->setObjectName(QString::fromUtf8("button_add"));
|
||||
button_add->setGeometry(QRect(20, 230, 151, 25));
|
||||
button_remove = new QPushButton(deltaTimes);
|
||||
button_remove->setObjectName(QString::fromUtf8("button_remove"));
|
||||
button_remove->setGeometry(QRect(20, 230, 151, 25));
|
||||
button_remove->setGeometry(QRect(190, 230, 151, 25));
|
||||
line_seconds = new QLineEdit(deltaTimes);
|
||||
line_seconds->setObjectName(QString::fromUtf8("line_seconds"));
|
||||
line_seconds->setGeometry(QRect(20, 310, 191, 31));
|
||||
@@ -81,6 +85,7 @@ public:
|
||||
label_module->setText(QCoreApplication::translate("deltaTimes", "Delta Times", nullptr));
|
||||
label_adjust->setText(QCoreApplication::translate("deltaTimes", "Set Delta Time for key", nullptr));
|
||||
button_save->setText(QCoreApplication::translate("deltaTimes", "Save", nullptr));
|
||||
button_add->setText(QCoreApplication::translate("deltaTimes", "Add New Entry", nullptr));
|
||||
button_remove->setText(QCoreApplication::translate("deltaTimes", "Remove Last Entry", nullptr));
|
||||
} // retranslateUi
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ public:
|
||||
QComboBox *comboBoxWindowConfigs;
|
||||
QLabel *labelChoose;
|
||||
QLabel *labelOptions;
|
||||
QPushButton *buttonSim;
|
||||
QMenuBar *menubar;
|
||||
QMenu *menuOpenSpace_Launcher;
|
||||
QStatusBar *statusbar;
|
||||
@@ -89,9 +88,6 @@ public:
|
||||
labelOptions->setGeometry(QRect(130, 250, 151, 17));
|
||||
labelOptions->setFont(font);
|
||||
labelOptions->setTextFormat(Qt::RichText);
|
||||
buttonSim = new QPushButton(centralwidget);
|
||||
buttonSim->setObjectName(QString::fromUtf8("buttonSim"));
|
||||
buttonSim->setGeometry(QRect(210, 500, 89, 25));
|
||||
LauncherWindow->setCentralWidget(centralwidget);
|
||||
menubar = new QMenuBar(LauncherWindow);
|
||||
menubar->setObjectName(QString::fromUtf8("menubar"));
|
||||
@@ -121,7 +117,6 @@ public:
|
||||
logolabel->setText(QString());
|
||||
labelChoose->setText(QCoreApplication::translate("LauncherWindow", "<html><head/><body><p><span style=\" font-size:12pt; font-weight:600; color:#ffffff;\">Choose Profile</span></p></body></html>", nullptr));
|
||||
labelOptions->setText(QCoreApplication::translate("LauncherWindow", "<html><head/><body><p><span style=\" font-size:12pt; font-weight:600; color:#ffffff;\">Window Options</span></p></body></html>", nullptr));
|
||||
buttonSim->setText(QCoreApplication::translate("LauncherWindow", "simData", nullptr));
|
||||
menuOpenSpace_Launcher->setTitle(QCoreApplication::translate("LauncherWindow", "OpenSpace Launcher", nullptr));
|
||||
} // retranslateUi
|
||||
|
||||
|
||||
@@ -329,7 +329,7 @@ public:
|
||||
line_profile->setFont(font3);
|
||||
|
||||
retranslateUi(ProfileEdit);
|
||||
QObject::connect(buttonBox, SIGNAL(accepted()), ProfileEdit, SLOT(accept()));
|
||||
//QObject::connect(buttonBox, SIGNAL(accepted()), ProfileEdit, SLOT(accept()));
|
||||
QObject::connect(buttonBox, SIGNAL(rejected()), ProfileEdit, SLOT(reject()));
|
||||
|
||||
QMetaObject::connectSlotsByName(ProfileEdit);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <qevent.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <QKeyEvent>
|
||||
|
||||
addedScripts::addedScripts(openspace::Profile* imported, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
@@ -35,4 +36,11 @@ void addedScripts::parseScript() {
|
||||
accept();
|
||||
}
|
||||
|
||||
void addedScripts::keyPressEvent(QKeyEvent *evt)
|
||||
{
|
||||
if(evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return)
|
||||
return;
|
||||
QDialog::keyPressEvent(evt);
|
||||
}
|
||||
|
||||
addedScripts::~addedScripts() { }
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <qevent.h>
|
||||
#include <QFileSystemModel>
|
||||
#include <QScreen>
|
||||
#include <QKeyEvent>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <openspace/scene/profile.h>
|
||||
@@ -168,3 +169,10 @@ assets::~assets() {
|
||||
|
||||
void assets::cancel() {
|
||||
}
|
||||
|
||||
void assets::keyPressEvent(QKeyEvent *evt)
|
||||
{
|
||||
if(evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return)
|
||||
return;
|
||||
QDialog::keyPressEvent(evt);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <openspace/scene/profile.h>
|
||||
#include "camera.h"
|
||||
#include "./ui_camera.h"
|
||||
#include <QKeyEvent>
|
||||
|
||||
template <class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
|
||||
template <class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
|
||||
@@ -252,3 +253,11 @@ bool camera::isUpVectorValid() {
|
||||
&& isNumericalValue(ui->line_upY)
|
||||
&& isNumericalValue(ui->line_upZ));
|
||||
}
|
||||
|
||||
void camera::keyPressEvent(QKeyEvent *evt)
|
||||
{
|
||||
if(evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return)
|
||||
return;
|
||||
QDialog::keyPressEvent(evt);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,27 +2,33 @@
|
||||
#include "./ui_deltatimes.h"
|
||||
#include <qevent.h>
|
||||
#include <iostream>
|
||||
#include <QKeyEvent>
|
||||
|
||||
deltaTimes::deltaTimes(openspace::Profile* imported, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::deltaTimes)
|
||||
, _imported(imported)
|
||||
, _data(imported->deltaTimes())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
_data.clear();
|
||||
for (double dt : imported->deltaTimes()) {
|
||||
_data.push_back(static_cast<int>(dt));
|
||||
}
|
||||
|
||||
for (size_t d = 0; d < _data.size(); ++d) {
|
||||
QString summary = createSummaryForDeltaTime(d, _data._times.at(d), true);
|
||||
QString summary = createSummaryForDeltaTime(d, _data.at(d), true);
|
||||
_deltaListItems.push_back(new QListWidgetItem(summary));
|
||||
ui->listWidget->addItem(_deltaListItems[d]);
|
||||
}
|
||||
connect(ui->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(listItemSelected()));
|
||||
connect(ui->button_save, SIGNAL(clicked()), this, SLOT(saveDeltaTimeValue()));
|
||||
connect(ui->button_remove, SIGNAL(clicked()), this, SLOT(clearDeltaTimeValue()));
|
||||
connect(ui->button_add, SIGNAL(clicked()), this, SLOT(addDeltaTimeValue()));
|
||||
connect(ui->button_remove, SIGNAL(clicked()), this, SLOT(removeDeltaTimeValue()));
|
||||
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(parseSelections()));
|
||||
}
|
||||
|
||||
QString deltaTimes::createSummaryForDeltaTime(size_t idx, double dt, bool forListView) {
|
||||
QString deltaTimes::createSummaryForDeltaTime(size_t idx, int dt, bool forListView) {
|
||||
std::string s;
|
||||
int k = (idx%10 == 9) ? 0 : idx%10 + 1;
|
||||
k = (idx == 0) ? 1 : k;
|
||||
@@ -40,7 +46,7 @@ QString deltaTimes::createSummaryForDeltaTime(size_t idx, double dt, bool forLis
|
||||
}
|
||||
|
||||
if (dt != 0) {
|
||||
s += (forListView) ? "\t" + std::to_string(static_cast<int>(dt)) : "";
|
||||
s += (forListView) ? "\t" + std::to_string(dt) : "";
|
||||
}
|
||||
|
||||
if (forListView) {
|
||||
@@ -54,22 +60,22 @@ void deltaTimes::listItemSelected() {
|
||||
QListWidgetItem *item = ui->listWidget->currentItem();
|
||||
int index = ui->listWidget->row(item);
|
||||
|
||||
if (index < (static_cast<int>(_data.totalSize()) - 1)) {
|
||||
if (index > lastSelectableItem() + 1) {
|
||||
index = lastSelectableItem() + 1;
|
||||
ui->listWidget->setCurrentRow(index);
|
||||
}
|
||||
if (index < (static_cast<int>(_data.size()) - 1)) {
|
||||
//if (index > lastSelectableItem() + 1) {
|
||||
// index = lastSelectableItem() + 1;
|
||||
ui->listWidget->setCurrentRow(index);
|
||||
//}
|
||||
}
|
||||
|
||||
QString labelS = "Set Delta Time for key ";
|
||||
labelS += createSummaryForDeltaTime(index, _data._times.at(index), false);
|
||||
labelS += createSummaryForDeltaTime(index, _data.at(index), false);
|
||||
labelS += " :\t";
|
||||
|
||||
ui->label_adjust->setText(labelS);
|
||||
ui->line_seconds->setText(QString::number(_data._times.at(index)));
|
||||
ui->line_seconds->setText(QString::number(_data.at(index)));
|
||||
}
|
||||
|
||||
int deltaTimes::lastSelectableItem() {
|
||||
/*int deltaTimes::lastSelectableItem() {
|
||||
if (_data.size() == 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -89,9 +95,9 @@ int deltaTimes::lastSelectableItem() {
|
||||
else {
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
QString deltaTimes::timeDescription(double value) {
|
||||
QString deltaTimes::timeDescription(int value) {
|
||||
QString description;
|
||||
|
||||
if (value == 0) {
|
||||
@@ -107,29 +113,36 @@ QString deltaTimes::timeDescription(double value) {
|
||||
return checkForTimeDescription(i, value);
|
||||
}
|
||||
|
||||
QString deltaTimes::checkForTimeDescription(int intervalIndex, double value) {
|
||||
double amount = static_cast<double>(value) /
|
||||
static_cast<double>(_timeIntervals[intervalIndex].secondsPerInterval);
|
||||
QString deltaTimes::checkForTimeDescription(int intervalIndex, int value) {
|
||||
// double amount = static_cast<double>(value) /
|
||||
// static_cast<double>(_timeIntervals[intervalIndex].secondsPerInterval);
|
||||
int amount = value /_timeIntervals[intervalIndex].secondsPerInterval;
|
||||
QString description = QString::number(amount, 'g', 2);
|
||||
return description += " " + _timeIntervals[intervalIndex].intervalName + "/sec";
|
||||
}
|
||||
|
||||
void deltaTimes::addDeltaTimeValue() {
|
||||
if (_data.size() < _maxSize) {
|
||||
if (_data.size() != 0 && _data.back() == 0) {
|
||||
return;
|
||||
}
|
||||
_data.push_back(0);
|
||||
QString summary = createSummaryForDeltaTime(_data.size() - 1, 0, true);
|
||||
_deltaListItems.push_back(new QListWidgetItem(summary));
|
||||
ui->listWidget->addItem(_deltaListItems.back());
|
||||
}
|
||||
}
|
||||
|
||||
void deltaTimes::saveDeltaTimeValue() {
|
||||
QListWidgetItem *item = ui->listWidget->currentItem();
|
||||
if (item != nullptr) {
|
||||
int index = ui->listWidget->row(item);
|
||||
if (isNumericalValue(ui->line_seconds) && index <= lastSelectableItem() + 1) {
|
||||
_data._times.at(index) = ui->line_seconds->text().toDouble();
|
||||
QString summary = createSummaryForDeltaTime(index, _data._times.at(index), true);
|
||||
if (isNumericalValue(ui->line_seconds) /*&& index <= lastSelectableItem() + 1*/) {
|
||||
_data.at(index) = ui->line_seconds->text().toInt();
|
||||
QString summary = createSummaryForDeltaTime(index, _data.at(index), true);
|
||||
_deltaListItems.at(index)->setText(summary);
|
||||
}
|
||||
}
|
||||
else if (_data.size() == 0) {
|
||||
_data._times.at(0) = ui->line_seconds->text().toDouble();
|
||||
QString summary = createSummaryForDeltaTime(0, _data._times.at(0), true);
|
||||
_deltaListItems.push_back(new QListWidgetItem(summary));
|
||||
ui->listWidget->addItem(_deltaListItems[0]);
|
||||
}
|
||||
}
|
||||
|
||||
bool deltaTimes::isNumericalValue(QLineEdit* le) {
|
||||
@@ -139,23 +152,24 @@ bool deltaTimes::isNumericalValue(QLineEdit* le) {
|
||||
return validConversion;
|
||||
}
|
||||
|
||||
void deltaTimes::clearDeltaTimeValue() {
|
||||
int i;
|
||||
for (i = _data.size() - 1; i >= 0; --i) {
|
||||
if (_data._times.at(i) != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i >= 0) {
|
||||
_data._times.at(i) = 0;
|
||||
QString summary = createSummaryForDeltaTime(i, _data._times.at(i), true);
|
||||
_deltaListItems.at(i)->setText(summary);
|
||||
ui->listWidget->setCurrentRow(i);
|
||||
}
|
||||
void deltaTimes::removeDeltaTimeValue() {
|
||||
ui->listWidget->takeItem(_deltaListItems.size() - 1);
|
||||
_data.pop_back();
|
||||
_deltaListItems.pop_back();
|
||||
}
|
||||
|
||||
void deltaTimes::parseSelections() {
|
||||
_imported->setDeltaTimes(_data._times);
|
||||
int finalNonzeroIndex = _data.size() - 1;
|
||||
for (; finalNonzeroIndex >= 0; --finalNonzeroIndex) {
|
||||
if (_data.at(finalNonzeroIndex) != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
std::vector<double> tempDt;
|
||||
for (size_t i = 0; i < (finalNonzeroIndex + 1); ++i) {
|
||||
tempDt.push_back(static_cast<double>(_data[i]));
|
||||
}
|
||||
_imported->setDeltaTimes(tempDt);
|
||||
accept();
|
||||
}
|
||||
|
||||
@@ -165,3 +179,10 @@ deltaTimes::~deltaTimes() {
|
||||
}
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void deltaTimes::keyPressEvent(QKeyEvent *evt)
|
||||
{
|
||||
if(evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return)
|
||||
return;
|
||||
QDialog::keyPressEvent(evt);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "./ui_keybindings.h"
|
||||
#include <qevent.h>
|
||||
#include <algorithm>
|
||||
#include <QKeyEvent>
|
||||
|
||||
keybindings::keybindings(openspace::Profile* imported, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
@@ -270,3 +271,11 @@ keybindings::~keybindings() {
|
||||
}
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void keybindings::keyPressEvent(QKeyEvent *evt)
|
||||
{
|
||||
if(evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return)
|
||||
return;
|
||||
QDialog::keyPressEvent(evt);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "profileedit.h"
|
||||
#include "./ui_launcherwindow.h"
|
||||
#include <QPixmap>
|
||||
#include <QKeyEvent>
|
||||
#include "filesystemaccess.h"
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
@@ -22,7 +23,6 @@ LauncherWindow::LauncherWindow(std::string basePath, QWidget *parent)
|
||||
ui->logolabel->setPixmap(pix.scaled(400, 120, Qt::KeepAspectRatio));
|
||||
connect(ui->newButton, SIGNAL(released()), this, SLOT(openWindow_new()));
|
||||
connect(ui->editButton, SIGNAL(released()), this, SLOT(openWindow_edit()));
|
||||
connect(ui->buttonSim, SIGNAL(released()), this, SLOT(simulateData()));
|
||||
_reportAssetsInFilesystem = _filesystemAccess.useQtFileSystemModelToTraverseDir(
|
||||
QString(basePath.c_str()) + "/data/assets");
|
||||
populateProfilesList();
|
||||
@@ -30,15 +30,19 @@ LauncherWindow::LauncherWindow(std::string basePath, QWidget *parent)
|
||||
}
|
||||
|
||||
void LauncherWindow::populateProfilesList() {
|
||||
for (int i = 0; i < ui->comboBoxProfiles->count(); ++i) {
|
||||
ui->comboBoxProfiles->removeItem(i);
|
||||
}
|
||||
std::string reportProfiles = _fileAccess_profiles.useQtFileSystemModelToTraverseDir(
|
||||
_basePath + "/data/profiles");
|
||||
std::stringstream instream(reportProfiles);
|
||||
std::string iline;
|
||||
QStringList profilesListLine;
|
||||
while (std::getline(instream, iline)) {
|
||||
profilesListLine << iline.c_str();
|
||||
if (ui->comboBoxProfiles->findText(QString(iline.c_str())) == -1) {
|
||||
ui->comboBoxProfiles->addItem(iline.c_str());
|
||||
}
|
||||
}
|
||||
ui->comboBoxProfiles->addItems(profilesListLine);
|
||||
}
|
||||
|
||||
void LauncherWindow::populateWindowConfigsList() {
|
||||
@@ -54,33 +58,72 @@ void LauncherWindow::populateWindowConfigsList() {
|
||||
}
|
||||
|
||||
void LauncherWindow::openWindow_new() {
|
||||
clearData();
|
||||
openspace::Profile* pData = new openspace::Profile();
|
||||
if (pData != nullptr) {
|
||||
myEditorWindow = new ProfileEdit(pData, _reportAssetsInFilesystem);
|
||||
myEditorWindow->exec();
|
||||
if (myEditorWindow->wasSaved()) {
|
||||
std::string saveProfilePath = _basePath.toUtf8().constData();
|
||||
saveProfilePath += "/data/profiles/";
|
||||
saveProfilePath += myEditorWindow->specifiedFilename() + ".profile";
|
||||
saveProfileToFile(saveProfilePath, pData);
|
||||
}
|
||||
delete pData;
|
||||
populateProfilesList();
|
||||
}
|
||||
delete pData;
|
||||
}
|
||||
|
||||
void LauncherWindow::openWindow_edit() {
|
||||
std::string editProfilePath = _basePath.toUtf8().constData();
|
||||
editProfilePath += "/data/profiles/";
|
||||
std::string profilePath = _basePath.toUtf8().constData();
|
||||
profilePath += "/data/profiles/";
|
||||
int selectedProfileIdx = ui->comboBoxProfiles->currentIndex();
|
||||
QString profileToSet = ui->comboBoxProfiles->itemText(selectedProfileIdx);
|
||||
editProfilePath += profileToSet.toUtf8().constData();
|
||||
std::string editProfilePath = profilePath + profileToSet.toUtf8().constData();
|
||||
editProfilePath += ".profile";
|
||||
openspace::Profile* pData;
|
||||
loadProfileFromFile(pData, editProfilePath);
|
||||
if (pData != nullptr) {
|
||||
bool validFile = loadProfileFromFile(pData, editProfilePath);
|
||||
if (pData != nullptr && validFile) {
|
||||
myEditorWindow = new ProfileEdit(pData, _reportAssetsInFilesystem);
|
||||
myEditorWindow->setProfileName(profileToSet);
|
||||
myEditorWindow->exec();
|
||||
if (myEditorWindow->wasSaved()) {
|
||||
profilePath += myEditorWindow->specifiedFilename() + ".profile";
|
||||
saveProfileToFile(profilePath, pData);
|
||||
}
|
||||
delete pData;
|
||||
populateProfilesList();
|
||||
}
|
||||
delete pData;
|
||||
}
|
||||
|
||||
void LauncherWindow::saveProfileToFile(const std::string& path, openspace::Profile* p) {
|
||||
std::ofstream outFile;
|
||||
try {
|
||||
outFile.open(path, std::ofstream::out);
|
||||
}
|
||||
catch (const std::ofstream::failure& e) {
|
||||
displayErrorDialog(fmt::format(
|
||||
"Exception opening profile file {} for write: ({})",
|
||||
path,
|
||||
e.what()
|
||||
));
|
||||
}
|
||||
|
||||
try {
|
||||
outFile << p->serialize();
|
||||
}
|
||||
catch (const std::ofstream::failure& e) {
|
||||
displayErrorDialog(fmt::format(
|
||||
"Data write error to file: {} ({})",
|
||||
path,
|
||||
e.what()
|
||||
));
|
||||
}
|
||||
|
||||
outFile.close();
|
||||
}
|
||||
|
||||
bool LauncherWindow::loadProfileFromFile(openspace::Profile*& p, std::string filename) {
|
||||
bool successfulLoad = true;
|
||||
std::vector<std::string> content;
|
||||
if (filename.length() > 0) {
|
||||
std::ifstream inFile;
|
||||
@@ -103,249 +146,41 @@ bool LauncherWindow::loadProfileFromFile(openspace::Profile*& p, std::string fil
|
||||
p = new openspace::Profile(content);
|
||||
}
|
||||
catch (const ghoul::MissingCaseException& e) {
|
||||
displayProfileParseErrorDialogThenQuit(fmt::format(
|
||||
displayErrorDialog(fmt::format(
|
||||
"Missing case exception in {}: {}",
|
||||
filename,
|
||||
e.what()
|
||||
));
|
||||
return false;
|
||||
successfulLoad = false;
|
||||
}
|
||||
catch (const openspace::Profile::ParsingError& e) {
|
||||
displayProfileParseErrorDialogThenQuit(fmt::format(
|
||||
displayErrorDialog(fmt::format(
|
||||
"ParsingError exception in {}: {}, {}",
|
||||
filename,
|
||||
e.component,
|
||||
e.message
|
||||
));
|
||||
return false;
|
||||
successfulLoad = false;
|
||||
}
|
||||
catch (const ghoul::RuntimeError& e) {
|
||||
displayProfileParseErrorDialogThenQuit(fmt::format(
|
||||
displayErrorDialog(fmt::format(
|
||||
"RuntimeError exception in {}, component {}: {}",
|
||||
filename,
|
||||
e.component,
|
||||
e.message
|
||||
));
|
||||
return false;
|
||||
successfulLoad = false;
|
||||
}
|
||||
return true;
|
||||
return successfulLoad;
|
||||
}
|
||||
|
||||
void LauncherWindow::displayProfileParseErrorDialogThenQuit(std::string msg) {
|
||||
void LauncherWindow::displayErrorDialog(std::string msg) {
|
||||
//New instance of info dialog window
|
||||
_myDialog = new errordialog(QString(msg.c_str()));
|
||||
_myDialog->exec();
|
||||
}
|
||||
|
||||
void LauncherWindow::receiveAssets(std::vector<std::string> results) {
|
||||
std::string windowText;
|
||||
for (std::string line : results) {
|
||||
windowText += line + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
LauncherWindow::~LauncherWindow() {
|
||||
delete ui;
|
||||
delete myEditorWindow;
|
||||
}
|
||||
|
||||
void LauncherWindow::simulateData() {
|
||||
initialize_meta();
|
||||
initialize_modules();
|
||||
initialize_assets();
|
||||
initialize_properties();
|
||||
initialize_keybindings();
|
||||
initialize_deltaTimes();
|
||||
initialize_time();
|
||||
initialize_camera();
|
||||
initialize_markNodes();
|
||||
initialize_addedScripts();
|
||||
}
|
||||
|
||||
void LauncherWindow::clearData() {
|
||||
_metaData = {"", "", "", "", "", ""};
|
||||
_moduleData.clear();
|
||||
_assetData.clear();
|
||||
_propsData.clear();
|
||||
_keybindingsData.clear();
|
||||
_deltaTimesData._times.clear();
|
||||
_timeData.time = "";
|
||||
openspace::Profile::CameraNavState c = {"", "", "", {0.0, 0.0, 0.0}, std::nullopt, std::nullopt, std::nullopt};
|
||||
_cameraData = c;
|
||||
_markNodesData.clear();
|
||||
_addedScriptsData = "";
|
||||
}
|
||||
|
||||
void LauncherWindow::initialize_meta() {
|
||||
_metaData.name = "The meta name";
|
||||
_metaData.version = "0.15.2";
|
||||
_metaData.description = "Description here";
|
||||
_metaData.author = "Author";
|
||||
_metaData.url = "http://openspaceproject.com";
|
||||
_metaData.license = "MIT";
|
||||
}
|
||||
|
||||
void LauncherWindow::initialize_modules() {
|
||||
_moduleData = {
|
||||
{
|
||||
"base",
|
||||
"Do stuff for base if it's loaded",
|
||||
""
|
||||
},
|
||||
{
|
||||
"globebrowsing",
|
||||
"",
|
||||
""
|
||||
},
|
||||
{
|
||||
"gaia",
|
||||
"",
|
||||
"Command if gaia not loaded"
|
||||
},
|
||||
{
|
||||
"kameleon",
|
||||
"script {\n line1\n line2\n}",
|
||||
"Command if gaia not loaded"
|
||||
},
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
void LauncherWindow::initialize_assets() {
|
||||
|
||||
|
||||
_assetData = {
|
||||
{"", "base"},
|
||||
{"examples", "spheres"},
|
||||
{"examples", "slidedeck"},
|
||||
{"scene/milkyway/gaia", "galah"},
|
||||
{"scene/solarsystem/missions/pioneer", "pioneer10"},
|
||||
{"scene/solarsystem/missions/spacex", "roadster"},
|
||||
{"scene/solarsystem/sun", "glare"},
|
||||
{"scene/solarsystem/sun", "marker"},
|
||||
{"util", "layer_helper"},
|
||||
{"customization", "gui"}
|
||||
};
|
||||
}
|
||||
|
||||
void LauncherWindow::initialize_properties() {
|
||||
_propsData = {
|
||||
{
|
||||
openspace::Profile::Property::SetType::SetPropertyValueSingle,
|
||||
"NavigationHandler.OrbitalNavigator.FollowAnchorNodeRotationDistance",
|
||||
"20.0"
|
||||
},
|
||||
{
|
||||
openspace::Profile::Property::SetType::SetPropertyValue,
|
||||
"Scene.Pluto.Renderable.Enabled",
|
||||
"false"
|
||||
},
|
||||
{
|
||||
openspace::Profile::Property::SetType::SetPropertyValueSingle,
|
||||
"Scene.Charon.Renderable.Enabled",
|
||||
"false"
|
||||
},
|
||||
{
|
||||
openspace::Profile::Property::SetType::SetPropertyValueSingle,
|
||||
"Scene.PlutoBarycenterTrail.Renderable.Enabled",
|
||||
"false"
|
||||
},
|
||||
{
|
||||
openspace::Profile::Property::SetType::SetPropertyValueSingle,
|
||||
"NavigationHandler.OrbitalNavigator.FollowAnchorNodeRotationDistance",
|
||||
"20.0"
|
||||
},
|
||||
{
|
||||
openspace::Profile::Property::SetType::SetPropertyValue,
|
||||
"Scene.Pluto.Renderable.Enabled",
|
||||
"false"
|
||||
},
|
||||
{
|
||||
openspace::Profile::Property::SetType::SetPropertyValueSingle,
|
||||
"Scene.Styx.Renderable.Enabled",
|
||||
"false"
|
||||
},
|
||||
{
|
||||
openspace::Profile::Property::SetType::SetPropertyValueSingle,
|
||||
"Scene.PlutoBarycenterTrail.Renderable.Enabled",
|
||||
"false"
|
||||
},
|
||||
{
|
||||
openspace::Profile::Property::SetType::SetPropertyValueSingle,
|
||||
"NavigationHandler.OrbitalNavigator.FollowAnchorNodeRotationDistance",
|
||||
"20.0"
|
||||
},
|
||||
{
|
||||
openspace::Profile::Property::SetType::SetPropertyValue,
|
||||
"Scene.Pluto.Renderable.Enabled",
|
||||
"false"
|
||||
},
|
||||
{
|
||||
openspace::Profile::Property::SetType::SetPropertyValueSingle,
|
||||
"Scene.StyxRenderableTrail.Renderable.Enabled",
|
||||
"false"
|
||||
},
|
||||
{
|
||||
openspace::Profile::Property::SetType::SetPropertyValueSingle,
|
||||
"Scene.PlutoBarycenterTrail.Renderable.Enabled",
|
||||
"false"
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
void LauncherWindow::initialize_keybindings() {
|
||||
_keybindingsData = {
|
||||
{
|
||||
{openspace::Key::Equal, openspace::KeyModifier::Control},
|
||||
"Documentation for ctrl+=",
|
||||
"Name for the keybinding",
|
||||
"/Path/to/keys",
|
||||
true,
|
||||
"openspace.keybindings.local.variable.1"
|
||||
},
|
||||
{
|
||||
{openspace::Key::KeypadAdd, openspace::KeyModifier::Shift},
|
||||
"Documentation for shift++",
|
||||
"Name for the keybinding",
|
||||
"/Path/to/keys",
|
||||
true,
|
||||
"openspace.keybindings.local.variable.2"
|
||||
},
|
||||
{
|
||||
{openspace::Key::Keypad3, openspace::KeyModifier::NoModifier},
|
||||
"Documentation for '3'",
|
||||
"Name for the keybinding",
|
||||
"/Path/to/keys",
|
||||
false,
|
||||
"openspace.keybindings.local.variable.3"
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
void LauncherWindow::initialize_deltaTimes() {
|
||||
std::vector<double> dt = {1, 2, 5, 10, 30,
|
||||
60, 120, 300, 600, 1800,
|
||||
3600, 7200, 10800, 21600, 43200,
|
||||
86400, 172800, 345600, 604800};
|
||||
_deltaTimesData.loadValues(dt);
|
||||
}
|
||||
|
||||
void LauncherWindow::initialize_time() {
|
||||
_timeData.type = openspace::Profile::Time::Type::Absolute;
|
||||
_timeData.time = "2011-04-17T21:23:59";
|
||||
}
|
||||
|
||||
void LauncherWindow::initialize_camera() {
|
||||
glm::dvec3 p = {1.0, 2.0, 3.0};
|
||||
glm::dvec3 u = {4.0, 5.0, 6.0};
|
||||
openspace::Profile::CameraNavState c = {"Earth", "Moon", "SUNREF", p, u, 180.0, 359.9};
|
||||
_cameraData = c;
|
||||
}
|
||||
|
||||
void LauncherWindow::initialize_markNodes() {
|
||||
_markNodesData = {"Earth", "Moon", "Mars", "Jupiter", "Sun"};
|
||||
}
|
||||
|
||||
void LauncherWindow::initialize_addedScripts() {
|
||||
_addedScriptsData = "line1\nline2\nline3\nline4\nline5";
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "./ui_marknodes.h"
|
||||
#include <qevent.h>
|
||||
#include <iterator>
|
||||
#include <QKeyEvent>
|
||||
|
||||
markNodes::markNodes(openspace::Profile* imported, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
@@ -77,3 +78,11 @@ markNodes::~markNodes() {
|
||||
}
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void markNodes::keyPressEvent(QKeyEvent *evt)
|
||||
{
|
||||
if(evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return)
|
||||
return;
|
||||
QDialog::keyPressEvent(evt);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <openspace/scene/profile.h>
|
||||
#include "meta.h"
|
||||
#include "./ui_meta.h"
|
||||
#include <algorithm>
|
||||
#include <QKeyEvent>
|
||||
|
||||
meta::meta(openspace::Profile* imported, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
@@ -29,12 +31,21 @@ meta::meta(openspace::Profile* imported, QWidget *parent)
|
||||
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(save()));
|
||||
}
|
||||
|
||||
void meta::keyPressEvent(QKeyEvent *evt)
|
||||
{
|
||||
if(evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return)
|
||||
return;
|
||||
QDialog::keyPressEvent(evt);
|
||||
}
|
||||
|
||||
void meta::save() {
|
||||
if (!areAllEntriesBlank()) {
|
||||
openspace::Profile::Meta m;
|
||||
m.name = ui->line_name->text().toUtf8().constData();
|
||||
m.version = ui->line_version->text().toUtf8().constData();
|
||||
m.description = ui->text_description->toPlainText().toUtf8().constData();
|
||||
std::string desc = ui->text_description->toPlainText().toUtf8().constData();
|
||||
std::replace(desc.begin(), desc.end(), '\n', ' ');
|
||||
m.description = desc;
|
||||
m.author = ui->line_author->text().toUtf8().constData();
|
||||
m.url = ui->line_url->text().toUtf8().constData();
|
||||
m.license = ui->line_license->text().toUtf8().constData();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "osmodules.h"
|
||||
#include "./ui_osmodules.h"
|
||||
#include <qevent.h>
|
||||
#include <QKeyEvent>
|
||||
|
||||
osmodules::osmodules(openspace::Profile* imported, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
@@ -151,3 +152,11 @@ osmodules::~osmodules() {
|
||||
}
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void osmodules::keyPressEvent(QKeyEvent *evt)
|
||||
{
|
||||
if(evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return)
|
||||
return;
|
||||
QDialog::keyPressEvent(evt);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "ostime.h"
|
||||
#include "./ui_ostime.h"
|
||||
#include <algorithm>
|
||||
#include <QKeyEvent>
|
||||
|
||||
ostime::ostime(openspace::Profile* imported, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
@@ -10,14 +11,19 @@ ostime::ostime(openspace::Profile* imported, QWidget *parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QStringList types { "Absolute", "Relative" };
|
||||
ui->combo_type->addItems(types);
|
||||
if (_imported->time().has_value()) {
|
||||
QStringList types { "Absolute", "Relative" };
|
||||
ui->combo_type->addItems(types);
|
||||
_data = _imported->time().value();
|
||||
_data = _imported->time().value();
|
||||
if (_data.type == openspace::Profile::Time::Type::Relative) {
|
||||
if (_data.time == "") {
|
||||
_data.time = "now";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
_data.type = openspace::Profile::Time::Type::Relative;
|
||||
_data.time = "";
|
||||
_data.time = "now";
|
||||
}
|
||||
_initializedAsAbsolute = (_data.type == openspace::Profile::Time::Type::Absolute);
|
||||
enableAccordingToType(static_cast<int>(_data.type));
|
||||
@@ -36,7 +42,7 @@ void ostime::enableAccordingToType(int idx) {
|
||||
if (comboIdx == openspace::Profile::Time::Type::Relative) {
|
||||
ui->label_relative->setText("<font color='black'>Relative Time:</font>");
|
||||
if (_initializedAsAbsolute) {
|
||||
ui->line_relative->setText("");
|
||||
ui->line_relative->setText("now");
|
||||
}
|
||||
else {
|
||||
ui->line_relative->setText(QString(_data.time.c_str()));
|
||||
@@ -92,3 +98,11 @@ void ostime::approved() {
|
||||
}
|
||||
accept();
|
||||
}
|
||||
|
||||
void ostime::keyPressEvent(QKeyEvent *evt)
|
||||
{
|
||||
if(evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return)
|
||||
return;
|
||||
QDialog::keyPressEvent(evt);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "profileedit.h"
|
||||
#include "./ui_profileedit.h"
|
||||
#include "filesystemaccess.h"
|
||||
#include <QKeyEvent>
|
||||
|
||||
template <class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
|
||||
template <class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
|
||||
@@ -325,9 +326,36 @@ QString ProfileEdit::summarizeText_markNodes() {
|
||||
return results;
|
||||
}
|
||||
|
||||
bool ProfileEdit::wasSaved() {
|
||||
return _saveSelected;
|
||||
}
|
||||
|
||||
std::string ProfileEdit::specifiedFilename() {
|
||||
return ui->line_profile->text().toUtf8().constData();
|
||||
}
|
||||
|
||||
void ProfileEdit::cancel() {
|
||||
_saveSelected = false;
|
||||
reject();
|
||||
}
|
||||
|
||||
void ProfileEdit::approved() {
|
||||
if (ui->line_profile->text().length() > 0) {
|
||||
_saveSelected = true;
|
||||
accept();
|
||||
}
|
||||
else {
|
||||
QString formatText = "<font color='red'>";
|
||||
formatText += ui->label_profile->text();
|
||||
formatText += "</font>";
|
||||
ui->label_profile->setText(formatText);
|
||||
}
|
||||
}
|
||||
|
||||
void ProfileEdit::keyPressEvent(QKeyEvent *evt)
|
||||
{
|
||||
if(evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return)
|
||||
return;
|
||||
QDialog::keyPressEvent(evt);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "properties.h"
|
||||
#include "./ui_properties.h"
|
||||
#include <qevent.h>
|
||||
#include <QKeyEvent>
|
||||
|
||||
properties::properties(openspace::Profile* imported, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
@@ -203,3 +204,11 @@ properties::~properties() {
|
||||
}
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void properties::keyPressEvent(QKeyEvent *evt)
|
||||
{
|
||||
if(evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return)
|
||||
return;
|
||||
QDialog::keyPressEvent(evt);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user