save progress

This commit is contained in:
garak 2023-02-05 14:52:40 -05:00
parent e2253939fc
commit 1497f42ab0
4 changed files with 47 additions and 26 deletions

View file

@ -84,12 +84,6 @@ public:
void updateMapBorder();
void updateMapConnections();
void setEditingMap();
void setEditingCollision();
void setEditingObjects();
void setEditingConnections();
void setMapEditingButtonsEnabled(bool enabled);
void setCurrentConnectionDirection(QString curDirection);
void updateCurrentConnectionDirection(QString curDirection);
void setConnectionsVisibility(bool visible);
@ -160,8 +154,19 @@ public:
EditAction objectEditAction = EditAction::Select;
/// !TODO this
enum class EditMode { None, Map, Layout };
enum class EditMode { None, Disabled, Map, Layout, Objects, Connections, Encounters };
EditMode editMode = EditMode::Map;
void setEditMode(EditMode mode) { this->editMode = mode; }
EditMode getEditMode() { return this->editMode; }
void setEditingMap();
void setEditingCollision();
void setEditingLayout();
void setEditingObjects();
void setEditingConnections();
void setEditingEncounters();
void setMapEditingButtonsEnabled(bool enabled);
int scaleIndex = 2;
qreal collisionOpacity = 0.5;

View file

@ -81,7 +81,6 @@ void Editor::closeProject() {
}
void Editor::setEditingMap() {
qDebug() << "Editor::setEditingMap()";
current_view = map_item;
if (map_item) {
map_item->paintingMode = LayoutPixmapItem::PaintMode::Metatiles;
@ -104,6 +103,10 @@ void Editor::setEditingMap() {
setMapEditingButtonsEnabled(true);
}
void Editor::setEditingLayout() {
//
}
void Editor::setEditingCollision() {
current_view = collision_item;
if (collision_item) {
@ -152,22 +155,6 @@ void Editor::setEditingObjects() {
setMapEditingButtonsEnabled(false);
}
void Editor::setMapEditingButtonsEnabled(bool enabled) {
this->ui->toolButton_Fill->setEnabled(enabled);
this->ui->toolButton_Dropper->setEnabled(enabled);
this->ui->pushButton_ChangeDimensions->setEnabled(enabled);
// If the fill button is pressed, unpress it and select the pointer.
if (!enabled && (this->ui->toolButton_Fill->isChecked() || this->ui->toolButton_Dropper->isChecked())) {
this->mapEditAction = EditAction::Select;
this->settings->mapCursor = QCursor();
this->cursorMapTileRect->setSingleTileMode();
this->ui->toolButton_Fill->setChecked(false);
this->ui->toolButton_Dropper->setChecked(false);
this->ui->toolButton_Select->setChecked(true);
}
this->ui->checkBox_smartPaths->setEnabled(enabled);
}
void Editor::setEditingConnections() {
current_view = map_item;
if (map_item) {
@ -199,6 +186,26 @@ void Editor::setEditingConnections() {
this->cursorMapTileRect->setActive(false);
}
void Editor::setEditingEncounters() {
//
}
void Editor::setMapEditingButtonsEnabled(bool enabled) {
this->ui->toolButton_Fill->setEnabled(enabled);
this->ui->toolButton_Dropper->setEnabled(enabled);
this->ui->pushButton_ChangeDimensions->setEnabled(enabled);
// If the fill button is pressed, unpress it and select the pointer.
if (!enabled && (this->ui->toolButton_Fill->isChecked() || this->ui->toolButton_Dropper->isChecked())) {
this->mapEditAction = EditAction::Select;
this->settings->mapCursor = QCursor();
this->cursorMapTileRect->setSingleTileMode();
this->ui->toolButton_Fill->setChecked(false);
this->ui->toolButton_Dropper->setChecked(false);
this->ui->toolButton_Select->setChecked(true);
}
this->ui->checkBox_smartPaths->setEnabled(enabled);
}
void Editor::displayWildMonTables() {
QStackedWidget *stack = ui->stackedWidget_WildMons;
QComboBox *labelCombo = ui->comboBox_EncounterGroupLabel;

View file

@ -335,6 +335,7 @@ void MainWindow::initMiscHeapObjects() {
ui->tabWidget_EventType->clear();
}
// TODO
void MainWindow::initMapSortOrder() {
// QMenu *mapSortOrderMenu = new QMenu(this);
// QActionGroup *mapSortOrderActionGroup = new QActionGroup(ui->toolButton_MapSortOrder);
@ -356,6 +357,7 @@ void MainWindow::initMapSortOrder() {
}
void MainWindow::showWindowTitle() {
// !TODO, check editor editmode
if (editor->map) {
setWindowTitle(QString("%1%2 - %3")
.arg(editor->map->hasUnsavedChanges() ? "* " : "")
@ -363,6 +365,13 @@ void MainWindow::showWindowTitle() {
.arg(editor->project->getProjectTitle())
);
}
else if (editor->layout) {
setWindowTitle(QString("%1%2 - %3")
.arg(editor->layout->hasUnsavedChanges() ? "* " : "")
.arg(editor->layout->id)
.arg(editor->project->getProjectTitle())
);
}
}
void MainWindow::markMapEdited() {
@ -1780,7 +1789,6 @@ void MainWindow::on_mapViewTab_tabBarClicked(int index)
Scripting::cb_MapViewTabChanged(oldIndex, index);
if (index == 0) {
//if ()
editor->setEditingMap();
} else if (index == 1) {
editor->setEditingCollision();

View file

@ -274,7 +274,8 @@ LayoutTreeModel::LayoutTreeModel(Project *project, QObject *parent) : QStandardI
QStandardItem *LayoutTreeModel::createLayoutItem(QString layoutId) {
QStandardItem *layout = new QStandardItem;
layout->setText(layoutId);
layout->setText(this->project->layoutIdsToNames[layoutId]);
//layout->setText(layoutId);
layout->setEditable(false);
layout->setData(layoutId, Qt::UserRole);
layout->setData("map_layout", MapListRoles::TypeRole);