From 6a07619fa07238576b6227c10c4ab377cfb1dd63 Mon Sep 17 00:00:00 2001 From: Gene Payne Date: Sun, 27 Sep 2020 17:56:27 -0600 Subject: [PATCH] More data entry and formatting improvements --- apps/OpenSpace/ext/launcher/include/camera.h | 11 +---------- .../ext/launcher/include/ui_launcherwindow.h | 18 ++++++++++-------- apps/OpenSpace/ext/launcher/src/camera.cpp | 14 ++++++++++++-- apps/OpenSpace/ext/launcher/src/deltatimes.cpp | 8 +++++++- .../OpenSpace/ext/launcher/src/keybindings.cpp | 9 ++++++++- .../ext/launcher/src/launcherwindow.cpp | 2 +- apps/OpenSpace/ext/launcher/src/marknodes.cpp | 8 ++++++-- apps/OpenSpace/ext/launcher/src/properties.cpp | 2 +- 8 files changed, 46 insertions(+), 26 deletions(-) diff --git a/apps/OpenSpace/ext/launcher/include/camera.h b/apps/OpenSpace/ext/launcher/include/camera.h index 7534606233..ba157ceb93 100644 --- a/apps/OpenSpace/ext/launcher/include/camera.h +++ b/apps/OpenSpace/ext/launcher/include/camera.h @@ -14,16 +14,6 @@ class camera; } QT_END_NAMESPACE -/*struct Camera { - enum class Type { - Nav, - Geo - }; - Type type; - openspace::Profile::CameraNavState nav; - openspace::Profile::CameraGoToGeo geo; -};*/ - class camera: public QDialog { Q_OBJECT @@ -31,6 +21,7 @@ class camera: public QDialog public slots: void cancel(); void approved(); + void tabSelect(int); public: explicit camera(openspace::Profile* imported, QWidget *parent = nullptr); diff --git a/apps/OpenSpace/ext/launcher/include/ui_launcherwindow.h b/apps/OpenSpace/ext/launcher/include/ui_launcherwindow.h index 3320b2e599..0481e96ff0 100644 --- a/apps/OpenSpace/ext/launcher/include/ui_launcherwindow.h +++ b/apps/OpenSpace/ext/launcher/include/ui_launcherwindow.h @@ -45,11 +45,13 @@ public: LauncherWindow->setObjectName(QString::fromUtf8("LauncherWindow")); LauncherWindow->resize(473, 576); LauncherWindow->setAutoFillBackground(false); - LauncherWindow->setStyleSheet(QString::fromUtf8("background: rgb(46, 52, 54);\n" -"\n" -"QPushButton {\n" -" background: rgb(186, 189, 182);\n" -"}")); + LauncherWindow->setStyleSheet(QString::fromUtf8( + "background: rgb(46, 52, 54);\n" + "\n" + "QPushButton {\n" + " background: rgb(186, 189, 182);\n" + "}") + ); centralwidget = new QWidget(LauncherWindow); centralwidget->setObjectName(QString::fromUtf8("centralwidget")); newButton = new QPushButton(centralwidget); @@ -71,7 +73,7 @@ public: editButton->setStyleSheet(QString::fromUtf8("background: rgb(186, 189, 182)")); logolabel = new QLabel(centralwidget); logolabel->setObjectName(QString::fromUtf8("logolabel")); - logolabel->setGeometry(QRect(40, 10, 400, 120)); + logolabel->setGeometry(QRect(20, -20, 580, 200)); comboBoxProfiles = new QComboBox(centralwidget); comboBoxProfiles->setObjectName(QString::fromUtf8("comboBoxProfiles")); comboBoxProfiles->setGeometry(QRect(130, 180, 240, 50)); @@ -110,14 +112,14 @@ public: void retranslateUi(QMainWindow *LauncherWindow) { - LauncherWindow->setWindowTitle(QCoreApplication::translate("LauncherWindow", "LauncherWindow", nullptr)); + LauncherWindow->setWindowTitle(QCoreApplication::translate("LauncherWindow", "OpenSpace Launcher", nullptr)); newButton->setText(QCoreApplication::translate("LauncherWindow", "New Profile", nullptr)); qBtn_start->setText(QCoreApplication::translate("LauncherWindow", "Start OpenSpace", nullptr)); editButton->setText(QCoreApplication::translate("LauncherWindow", "Edit Profile", nullptr)); logolabel->setText(QString()); labelChoose->setText(QCoreApplication::translate("LauncherWindow", "

Choose Profile

", nullptr)); labelOptions->setText(QCoreApplication::translate("LauncherWindow", "

Window Options

", nullptr)); - menuOpenSpace_Launcher->setTitle(QCoreApplication::translate("LauncherWindow", "OpenSpace Launcher", nullptr)); + menuOpenSpace_Launcher->setTitle(QCoreApplication::translate("LauncherWindow", "", nullptr)); } // retranslateUi }; diff --git a/apps/OpenSpace/ext/launcher/src/camera.cpp b/apps/OpenSpace/ext/launcher/src/camera.cpp index 035d4b2cc2..7df10783b3 100644 --- a/apps/OpenSpace/ext/launcher/src/camera.cpp +++ b/apps/OpenSpace/ext/launcher/src/camera.cpp @@ -46,6 +46,7 @@ camera::camera(openspace::Profile* imported, QWidget *parent) else { ui->line_pitch->setText(""); } + tabSelect(0); }, [&] (const openspace::Profile::CameraGoToGeo& geo) { ui->tabWidget->setCurrentIndex(static_cast(cameraTypeTab::Geo)); @@ -58,6 +59,7 @@ camera::camera(openspace::Profile* imported, QWidget *parent) else { ui->line_altitude->setText(""); } + tabSelect(1); } }, _data); } @@ -82,6 +84,7 @@ camera::camera(openspace::Profile* imported, QWidget *parent) connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(approved())); connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(cancel())); + connect(ui->tabWidget, SIGNAL(tabBarClicked(int)), this, SLOT(tabSelect(int))); } bool camera::isNumericalValue(QLineEdit* le) { @@ -254,10 +257,17 @@ bool camera::isUpVectorValid() { && isNumericalValue(ui->line_upZ)); } +void camera::tabSelect(int tabIndex) { + if (tabIndex == 0) { + ui->line_anchorNav->setFocus(Qt::OtherFocusReason); + } + else if (tabIndex == 1) { + ui->line_anchorGeo->setFocus(Qt::OtherFocusReason); + } +} + void camera::keyPressEvent(QKeyEvent *evt) { - if(evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return) - return; QDialog::keyPressEvent(evt); } diff --git a/apps/OpenSpace/ext/launcher/src/deltatimes.cpp b/apps/OpenSpace/ext/launcher/src/deltatimes.cpp index 7d58076c06..4e5b7fb818 100644 --- a/apps/OpenSpace/ext/launcher/src/deltatimes.cpp +++ b/apps/OpenSpace/ext/launcher/src/deltatimes.cpp @@ -77,6 +77,7 @@ void deltaTimes::listItemSelected() { ui->line_seconds->setText(QString::number(_data.at(index))); } } + _editModeNewItem = true; transitionToEditMode(); } @@ -275,6 +276,11 @@ void deltaTimes::keyPressEvent(QKeyEvent *evt) } return; } - + else if(evt->key() == Qt::Key_Escape) { + if (_editModeNewItem) { + cancelDeltaTimeValue(); + } + return; + } QDialog::keyPressEvent(evt); } diff --git a/apps/OpenSpace/ext/launcher/src/keybindings.cpp b/apps/OpenSpace/ext/launcher/src/keybindings.cpp index 31b631ae19..36852b1084 100644 --- a/apps/OpenSpace/ext/launcher/src/keybindings.cpp +++ b/apps/OpenSpace/ext/launcher/src/keybindings.cpp @@ -156,11 +156,12 @@ void keybindings::listItemAdded(void) { //Blank-out the 2 text fields, set combo box to index 0 ui->line_name->setText(QString(_data.back().name.c_str())); ui->line_documentation->setText(QString(_data.back().documentation.c_str())); - ui->line_guiPath->setText(QString(_data.back().guiPath.c_str())); + ui->line_guiPath->setText(QString("/")); ui->text_script->setText(QString(_data.back().script.c_str())); ui->combo_keyMod->setCurrentIndex(static_cast(_data.back().key.modifier)); ui->combo_key->setCurrentIndex(static_cast(_data.back().key.key)); + ui->combo_keyMod->setFocus(Qt::OtherFocusReason); ui->checkBox_local->setChecked(false); _editModeNewItem = true; @@ -315,6 +316,12 @@ void keybindings::keyPressEvent(QKeyEvent *evt) { if(evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return) return; + else if(evt->key() == Qt::Key_Escape) { + if (_editModeNewItem) { + listItemCancelSave(); + } + return; + } QDialog::keyPressEvent(evt); } diff --git a/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp b/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp index 1632299c48..417142aeef 100644 --- a/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp +++ b/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp @@ -27,7 +27,7 @@ LauncherWindow::LauncherWindow(std::string basePath, bool profileEnabled, ui->setupUi(this); QString logoPath = _basePath + "/data/openspace-horiz-logo.png"; QPixmap pix(logoPath); - ui->logolabel->setPixmap(pix.scaled(400, 120, Qt::KeepAspectRatio)); + ui->logolabel->setPixmap(pix.scaled(600, 240, Qt::KeepAspectRatio)); connect(ui->qBtn_start, SIGNAL(released()), this, SLOT(startOpenSpace())); connect(ui->newButton, SIGNAL(released()), this, SLOT(openWindow_new())); connect(ui->editButton, SIGNAL(released()), this, SLOT(openWindow_edit())); diff --git a/apps/OpenSpace/ext/launcher/src/marknodes.cpp b/apps/OpenSpace/ext/launcher/src/marknodes.cpp index 4bba573698..a34bab7e6b 100644 --- a/apps/OpenSpace/ext/launcher/src/marknodes.cpp +++ b/apps/OpenSpace/ext/launcher/src/marknodes.cpp @@ -81,8 +81,12 @@ markNodes::~markNodes() { void markNodes::keyPressEvent(QKeyEvent *evt) { - if(evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return) - return; + if(evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return) { + if (ui->line_node->text().length() > 0 && ui->line_node->hasFocus()) { + listItemAdded(); + return; + } + } QDialog::keyPressEvent(evt); } diff --git a/apps/OpenSpace/ext/launcher/src/properties.cpp b/apps/OpenSpace/ext/launcher/src/properties.cpp index e886119c7a..aa90c767ab 100644 --- a/apps/OpenSpace/ext/launcher/src/properties.cpp +++ b/apps/OpenSpace/ext/launcher/src/properties.cpp @@ -262,7 +262,7 @@ void properties::keyPressEvent(QKeyEvent *evt) } return; } - else if(evt->key() == Qt::Key_Escape) { + else if(evt->key() == Qt::Key_Escape) { if (_editModeNewItem) { listItemCancelSave(); }