diff --git a/include/mainwindow.h b/include/mainwindow.h index 177196bb..12af3585 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -280,6 +280,9 @@ private slots: void on_horizontalSlider_CollisionTransparency_valueChanged(int value); + void on_toolButton_HideShow_clicked(); + void on_toolButton_ExpandAll_clicked(); + void on_toolButton_CollapseAll_clicked(); void on_toolButton_HideShow_Groups_clicked(); void on_toolButton_ExpandAll_Groups_clicked(); void on_toolButton_CollapseAll_Groups_clicked(); diff --git a/src/core/map.cpp b/src/core/map.cpp index f9782266..1d52a0ba 100644 --- a/src/core/map.cpp +++ b/src/core/map.cpp @@ -186,6 +186,5 @@ void Map::clean() { } bool Map::hasUnsavedChanges() { - // !TODO: layout not working here? map needs to be in cache before the layout being edited works return !editHistory.isClean() || !this->layout->editHistory.isClean() || hasUnsavedDataChanges || !isPersistedToFile; } diff --git a/src/editor.cpp b/src/editor.cpp index aaad47db..1ae94b40 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -139,7 +139,7 @@ void Editor::setEditorView() { } break; case EditMode::Connections: - populateConnectionMapPickers(); // !TODO: move to setmap or sumn/ displaymapconnections type ish + populateConnectionMapPickers(); ui->label_NumConnections->setText(QString::number(map->connections.length())); setDiveEmergeControls(); @@ -155,7 +155,7 @@ void Editor::setEditorView() { setConnectionItemsVisible(true); setConnectionsEditable(true); this->cursorMapTileRect->setActive(false); - map_item->setEditsEnabled(false); // !TODO + map_item->setEditsEnabled(false); case EditMode::Header: case EditMode::Encounters: default: diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 842f9fb3..5675d79e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -162,14 +162,17 @@ void MainWindow::initExtraShortcuts() { shortcutToggle_Smart_Paths->setObjectName("shortcutToggle_Smart_Paths"); shortcutToggle_Smart_Paths->setWhatsThis("Toggle Smart Paths"); - /// !TODO - // auto *shortcutExpand_All = new Shortcut(QKeySequence(), this, SLOT(on_toolButton_ExpandAll_clicked())); - // shortcutExpand_All->setObjectName("shortcutExpand_All"); - // shortcutExpand_All->setWhatsThis("Map List: Expand all folders"); + auto *shortcutHide_Show = new Shortcut(QKeySequence(), this, SLOT(on_toolButton_HideShow_clicked())); + shortcutHide_Show->setObjectName("shortcutHide_Show"); + shortcutHide_Show->setWhatsThis("Map List: Hide/Show Empty Folders"); - // auto *shortcutCollapse_All = new Shortcut(QKeySequence(), this, SLOT(on_toolButton_CollapseAll_clicked())); - // shortcutCollapse_All->setObjectName("shortcutCollapse_All"); - // shortcutCollapse_All->setWhatsThis("Map List: Collapse all folders"); + auto *shortcutExpand_All = new Shortcut(QKeySequence(), this, SLOT(on_toolButton_ExpandAll_clicked())); + shortcutExpand_All->setObjectName("shortcutExpand_All"); + shortcutExpand_All->setWhatsThis("Map List: Expand all folders"); + + auto *shortcutCollapse_All = new Shortcut(QKeySequence(), this, SLOT(on_toolButton_CollapseAll_clicked())); + shortcutCollapse_All->setObjectName("shortcutCollapse_All"); + shortcutCollapse_All->setWhatsThis("Map List: Collapse all folders"); auto *shortcut_Open_Scripts = new Shortcut(QKeySequence(), ui->toolButton_Open_Scripts, SLOT(click())); shortcut_Open_Scripts->setObjectName("shortcut_Open_Scripts"); @@ -905,8 +908,7 @@ bool MainWindow::setLayout(QString layoutId) { updateMapList(); // !TODO: make sure these connections are not duplicated / cleared later - connect(editor->layout, &Layout::layoutChanged, [this]() { onMapChanged(nullptr); }); - connect(editor->layout, &Layout::needsRedrawing, this, &MainWindow::onLayoutNeedsRedrawing); + connect(editor->layout, &Layout::needsRedrawing, this, &MainWindow::onLayoutNeedsRedrawing, Qt::UniqueConnection); // connect(editor->map, &Map::modified, [this](){ this->markMapEdited(); }); updateTilesetEditor(); @@ -3178,6 +3180,48 @@ void MainWindow::initTilesetEditor() { connect(this->tilesetEditor, &TilesetEditor::tilesetsSaved, this, &MainWindow::onTilesetsSaved); } +void MainWindow::on_toolButton_ExpandAll_clicked() { + switch (ui->mapListContainer->currentIndex()) { + case MapListTab::Groups: + this->on_toolButton_ExpandAll_Groups_clicked(); + break; + case MapListTab::Areas: + this->on_toolButton_ExpandAll_Areas_clicked(); + break; + case MapListTab::Layouts: + this->on_toolButton_ExpandAll_Layouts_clicked(); + break; + } +} + +void MainWindow::on_toolButton_CollapseAll_clicked() { + switch (ui->mapListContainer->currentIndex()) { + case MapListTab::Groups: + this->on_toolButton_CollapseAll_Groups_clicked(); + break; + case MapListTab::Areas: + this->on_toolButton_CollapseAll_Areas_clicked(); + break; + case MapListTab::Layouts: + this->on_toolButton_CollapseAll_Layouts_clicked(); + break; + } +} + +void MainWindow::on_toolButton_HideShow_clicked() { + switch (ui->mapListContainer->currentIndex()) { + case MapListTab::Groups: + this->on_toolButton_HideShow_Groups_clicked(); + break; + case MapListTab::Areas: + this->on_toolButton_HideShow_Areas_clicked(); + break; + case MapListTab::Layouts: + this->on_toolButton_HideShow_Layouts_clicked(); + break; + } +} + void MainWindow::on_toolButton_HideShow_Groups_clicked() { if (ui->mapList) { this->groupListProxyModel->toggleHideEmpty();