cleanup shortcuts

This commit is contained in:
garak 2024-04-18 12:21:09 -04:00
parent dc72643e09
commit 89fb4019a5
4 changed files with 58 additions and 12 deletions

View file

@ -280,6 +280,9 @@ private slots:
void on_horizontalSlider_CollisionTransparency_valueChanged(int value); 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_HideShow_Groups_clicked();
void on_toolButton_ExpandAll_Groups_clicked(); void on_toolButton_ExpandAll_Groups_clicked();
void on_toolButton_CollapseAll_Groups_clicked(); void on_toolButton_CollapseAll_Groups_clicked();

View file

@ -186,6 +186,5 @@ void Map::clean() {
} }
bool Map::hasUnsavedChanges() { 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; return !editHistory.isClean() || !this->layout->editHistory.isClean() || hasUnsavedDataChanges || !isPersistedToFile;
} }

View file

@ -139,7 +139,7 @@ void Editor::setEditorView() {
} }
break; break;
case EditMode::Connections: case EditMode::Connections:
populateConnectionMapPickers(); // !TODO: move to setmap or sumn/ displaymapconnections type ish populateConnectionMapPickers();
ui->label_NumConnections->setText(QString::number(map->connections.length())); ui->label_NumConnections->setText(QString::number(map->connections.length()));
setDiveEmergeControls(); setDiveEmergeControls();
@ -155,7 +155,7 @@ void Editor::setEditorView() {
setConnectionItemsVisible(true); setConnectionItemsVisible(true);
setConnectionsEditable(true); setConnectionsEditable(true);
this->cursorMapTileRect->setActive(false); this->cursorMapTileRect->setActive(false);
map_item->setEditsEnabled(false); // !TODO map_item->setEditsEnabled(false);
case EditMode::Header: case EditMode::Header:
case EditMode::Encounters: case EditMode::Encounters:
default: default:

View file

@ -162,14 +162,17 @@ void MainWindow::initExtraShortcuts() {
shortcutToggle_Smart_Paths->setObjectName("shortcutToggle_Smart_Paths"); shortcutToggle_Smart_Paths->setObjectName("shortcutToggle_Smart_Paths");
shortcutToggle_Smart_Paths->setWhatsThis("Toggle Smart Paths"); shortcutToggle_Smart_Paths->setWhatsThis("Toggle Smart Paths");
/// !TODO auto *shortcutHide_Show = new Shortcut(QKeySequence(), this, SLOT(on_toolButton_HideShow_clicked()));
// auto *shortcutExpand_All = new Shortcut(QKeySequence(), this, SLOT(on_toolButton_ExpandAll_clicked())); shortcutHide_Show->setObjectName("shortcutHide_Show");
// shortcutExpand_All->setObjectName("shortcutExpand_All"); shortcutHide_Show->setWhatsThis("Map List: Hide/Show Empty Folders");
// shortcutExpand_All->setWhatsThis("Map List: Expand all folders");
// auto *shortcutCollapse_All = new Shortcut(QKeySequence(), this, SLOT(on_toolButton_CollapseAll_clicked())); auto *shortcutExpand_All = new Shortcut(QKeySequence(), this, SLOT(on_toolButton_ExpandAll_clicked()));
// shortcutCollapse_All->setObjectName("shortcutCollapse_All"); shortcutExpand_All->setObjectName("shortcutExpand_All");
// shortcutCollapse_All->setWhatsThis("Map List: Collapse all folders"); 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())); auto *shortcut_Open_Scripts = new Shortcut(QKeySequence(), ui->toolButton_Open_Scripts, SLOT(click()));
shortcut_Open_Scripts->setObjectName("shortcut_Open_Scripts"); shortcut_Open_Scripts->setObjectName("shortcut_Open_Scripts");
@ -905,8 +908,7 @@ bool MainWindow::setLayout(QString layoutId) {
updateMapList(); updateMapList();
// !TODO: make sure these connections are not duplicated / cleared later // !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, Qt::UniqueConnection);
connect(editor->layout, &Layout::needsRedrawing, this, &MainWindow::onLayoutNeedsRedrawing);
// connect(editor->map, &Map::modified, [this](){ this->markMapEdited(); }); // connect(editor->map, &Map::modified, [this](){ this->markMapEdited(); });
updateTilesetEditor(); updateTilesetEditor();
@ -3178,6 +3180,48 @@ void MainWindow::initTilesetEditor() {
connect(this->tilesetEditor, &TilesetEditor::tilesetsSaved, this, &MainWindow::onTilesetsSaved); 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() { void MainWindow::on_toolButton_HideShow_Groups_clicked() {
if (ui->mapList) { if (ui->mapList) {
this->groupListProxyModel->toggleHideEmpty(); this->groupListProxyModel->toggleHideEmpty();