Skip to content

Commit

Permalink
Path Editor Layout (#169)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
RobertBColton authored Sep 3, 2020
1 parent 8293b0f commit 7a4ba6f
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 254 deletions.
13 changes: 5 additions & 8 deletions Editors/PathEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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() {
Expand Down
Loading

0 comments on commit 7a4ba6f

Please sign in to comment.