More data entry and formatting improvements

This commit is contained in:
Gene Payne
2020-09-27 17:56:27 -06:00
parent 5e02bcd17c
commit 6a07619fa0
8 changed files with 46 additions and 26 deletions

View File

@@ -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);

View File

@@ -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", "<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));
menuOpenSpace_Launcher->setTitle(QCoreApplication::translate("LauncherWindow", "OpenSpace Launcher", nullptr));
menuOpenSpace_Launcher->setTitle(QCoreApplication::translate("LauncherWindow", "", nullptr));
} // retranslateUi
};

View File

@@ -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<int>(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);
}

View File

@@ -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);
}

View File

@@ -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<int>(_data.back().key.modifier));
ui->combo_key->setCurrentIndex(static_cast<int>(_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);
}

View File

@@ -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()));

View File

@@ -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);
}

View File

@@ -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();
}