From 7a4ba6fabf4cbcbcf11ae05462badd9f90ada10a Mon Sep 17 00:00:00 2001 From: Robert Colton Date: Thu, 3 Sep 2020 16:23:30 -0400 Subject: [PATCH] Path Editor Layout (#169) * Removed the hard coded toolbar style that was manually setting the spacing. It was inconsistent because we aren't doing it for the other editors. * Removed the spinboxes because they are confusing since we aren't doing a master detail view like GM does. The user can just edit the values inside the table by double clicking. This also gives more vertical space to show more points. * Used default values everywhere the spinboxes were being referred to in code. * Gave unique names to several widgets in the form that didn't previously have any. * Added label mnemonics and buddies to several widgets. * Gave the points list buttons text and showed it so they don't look so bland and they can have the GM mnemonic. * Changed the insert icon from the pencil to the copy icon because it more accurately, while not perfectly, represents the insert behavior. Since the insert button actually behaved like duplicate in GM, this is actually more correct. Duplicate is also more useful than a plain insert button anyway. * Made the save button the default button. * Made the point preview widget stretch so that it looks correct in the form designer. * Removed the extra separator at the beginning of the toolbar. I'm not sure why it was there. --- Editors/PathEditor.cpp | 13 +- Editors/PathEditor.ui | 319 ++++++++++------------------------------- 2 files changed, 78 insertions(+), 254 deletions(-) diff --git a/Editors/PathEditor.cpp b/Editors/PathEditor.cpp index 7977a2f64..1e349d5ff 100644 --- a/Editors/PathEditor.cpp +++ b/Editors/PathEditor.cpp @@ -17,10 +17,8 @@ PathEditor::PathEditor(MessageModel* model, QWidget* parent) : BaseEditor(model, _ui->pathPreviewBackground->SetAssetView(_ui->roomView); // Prefer resizing the path view over the points editor - _ui->splitter->setStretchFactor(0, 0); - _ui->splitter->setStretchFactor(1, 1); - - _ui->mainToolBar->setStyleSheet("QToolBar{spacing:8px;}"); + _ui->contentSplitter->setStretchFactor(0, 0); + _ui->contentSplitter->setStretchFactor(1, 1); QLabel* xSnapLabel(new QLabel(tr("X Snap"), this)); _ui->mainToolBar->addWidget(xSnapLabel); @@ -199,8 +197,7 @@ void PathEditor::MousePressed(Qt::MouseButton button) { } } // No point found. Add one and select it - InsertPoint(_pointsModel->rowCount(), _ui->roomView->mousePos.x(), _ui->roomView->mousePos.y(), - _ui->speedSpinBox->value()); + InsertPoint(_pointsModel->rowCount(), _ui->roomView->mousePos.x(), _ui->roomView->mousePos.y(), 100); } } @@ -224,13 +221,13 @@ void PathEditor::UpdateSelection(const QItemSelection& /*selected*/, const QItem } void PathEditor::on_addPointButton_pressed() { - InsertPoint(_pointsModel->rowCount(), _ui->xSpinBox->value(), _ui->yspinBox->value(), _ui->speedSpinBox->value()); + InsertPoint(_pointsModel->rowCount(), 0, 0, 100); } void PathEditor::on_insertPointButton_pressed() { int insertIndex = _ui->pointsTableView->selectionModel()->currentIndex().row(); if (insertIndex < 0) insertIndex = 0; - InsertPoint(insertIndex, _ui->xSpinBox->value(), _ui->yspinBox->value(), _ui->speedSpinBox->value()); + InsertPoint(insertIndex, 0, 0, 100); } void PathEditor::on_deletePointButton_pressed() { diff --git a/Editors/PathEditor.ui b/Editors/PathEditor.ui index a0052bf17..3309b12fa 100644 --- a/Editors/PathEditor.ui +++ b/Editors/PathEditor.ui @@ -26,10 +26,10 @@ helloenigmasssss - + - - + + 0 @@ -46,7 +46,7 @@ 0 - + 0 @@ -75,7 +75,7 @@ 0 - + 2 @@ -96,7 +96,7 @@ - + 0 @@ -127,7 +127,10 @@ - Name + &Name + + + nameEdit @@ -139,7 +142,7 @@ - + 0 @@ -170,7 +173,10 @@ - Precision + P&recision + + + precisionSpinBox @@ -198,7 +204,7 @@ - + 2 @@ -212,253 +218,50 @@ 0 - - - - 0 - - - 0 - - - 2 - - - 2 - - - - - - 0 - 0 - - - - Smooth - - - - - - - - 0 - 0 - - - - Closed - - - - - - - - - - - - - - 8 - - - 0 - - - 2 - - - 0 - - - 2 - - - + - + 0 0 - - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - X - - - - - - - - 0 - 0 - - - - - 60 - 0 - - - - -999999999 - - - 999999999 - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Y - - - - - - - - 0 - 0 - - - - - 60 - 0 - - - - -999999999 - - - 999999999 - - - - + + Smooth + - + - + 0 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Speed - - - - - - - - 0 - 0 - - - - - 60 - 0 - - - - -999999999 - - - 999999999 - - - 100 - - - - + + Closed + + + + + Qt::Horizontal + + + + 40 + 20 + + + + - + 8 @@ -477,34 +280,56 @@ - ... + &Add :/actions/add.png:/actions/add.png + + Qt::ToolButtonTextBesideIcon + - ... + &Insert - :/actions/edit.png:/actions/edit.png + :/actions/copy.png:/actions/copy.png + + + Qt::ToolButtonTextBesideIcon + + + + Qt::Horizontal + + + + 40 + 20 + + + + - ... + &Delete :/actions/delete.png:/actions/delete.png + + Qt::ToolButtonTextBesideIcon + @@ -535,18 +360,21 @@ :/actions/accept.png:/actions/accept.png + + true + - - 0 + + 1 0 - + 0 @@ -585,7 +413,6 @@ false - @@ -616,7 +443,7 @@ true - + QLayout::SetDefaultConstraint