diff --git a/forms/mainwindow.ui b/forms/mainwindow.ui index 2428b619..ff12136e 100644 --- a/forms/mainwindow.ui +++ b/forms/mainwindow.ui @@ -1715,7 +1715,7 @@ 0 0 100 - 16 + 30 @@ -1809,7 +1809,7 @@ 0 0 100 - 16 + 30 @@ -1903,7 +1903,7 @@ 0 0 100 - 16 + 30 @@ -2003,7 +2003,7 @@ 0 0 100 - 16 + 30 @@ -2097,7 +2097,7 @@ 0 0 100 - 16 + 30 @@ -2596,9 +2596,6 @@ true - - true - @@ -2636,9 +2633,6 @@ true - - true - @@ -2880,8 +2874,8 @@ 0 0 - 365 - 651 + 100 + 30 @@ -3082,6 +3076,7 @@ + @@ -3421,6 +3416,17 @@ Ctrl+W + + + true + + + true + + + Dive/Emerge Map + + diff --git a/include/mainwindow.h b/include/mainwindow.h index 20d3965f..eb6f4be1 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -269,6 +269,7 @@ private slots: void eventTabChanged(int index); + void on_actionDive_Emerge_Map_triggered(); void on_groupBox_DiveMapOpacity_toggled(bool on); void on_slider_DiveEmergeMapOpacity_valueChanged(int value); void on_slider_DiveMapOpacity_valueChanged(int value); @@ -409,6 +410,7 @@ private: int insertTilesetLabel(QStringList * list, QString label); void checkForUpdates(bool requestedByUser); + void setDiveEmergeMapVisible(bool visible); }; enum MapListUserRoles { diff --git a/src/editor.cpp b/src/editor.cpp index 944119c8..b3eefda7 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -951,7 +951,6 @@ void Editor::createDiveEmergeConnection(MapConnection* connection) { } else { item = new QGraphicsPixmapItem(connectedMap->render()); } - // TODO: Set pos. In-game, how are diving coordinates converted if the maps are different sizes? scene->addItem(item); if (connection->direction == "dive") { @@ -995,9 +994,6 @@ void Editor::setDiveEmergeMapName(QString mapName, QString direction) { } if (connection) { - if (connection->map_name == mapName) - return; - // Update existing connection if (mapName.isEmpty()) { removeConnection(map, connection); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 07a21fbc..519fee16 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -486,7 +486,6 @@ void MainWindow::loadUserSettings() { this->editor->settings->cursorTileRectEnabled = porymapConfig.showCursorTile; ui->checkBox_ToggleBorder->setChecked(porymapConfig.showBorder); ui->checkBox_ToggleGrid->setChecked(porymapConfig.showGrid); - ui->groupBox_DiveMapOpacity->setChecked(porymapConfig.showDiveEmergeMaps); mapSortOrder = porymapConfig.mapSortOrder; this->editor->collisionOpacity = static_cast(porymapConfig.collisionOpacity) / 100; @@ -498,6 +497,7 @@ void MainWindow::loadUserSettings() { ui->horizontalSlider_CollisionZoom->setValue(porymapConfig.collisionZoom); setTheme(porymapConfig.theme); + setDiveEmergeMapVisible(porymapConfig.showDiveEmergeMaps); } void MainWindow::restoreWindowState() { @@ -910,12 +910,8 @@ void MainWindow::displayMapProperties() { ui->frame_3->setEnabled(true); Map *map = editor->map; - ui->comboBox_PrimaryTileset->blockSignals(true); - ui->comboBox_SecondaryTileset->blockSignals(true); ui->comboBox_PrimaryTileset->setCurrentText(map->layout->tileset_primary_label); ui->comboBox_SecondaryTileset->setCurrentText(map->layout->tileset_secondary_label); - ui->comboBox_PrimaryTileset->blockSignals(false); - ui->comboBox_SecondaryTileset->blockSignals(false); ui->comboBox_Song->setCurrentText(map->song); ui->comboBox_Location->setCurrentText(map->location); @@ -1058,8 +1054,10 @@ bool MainWindow::setProjectUI() { ui->comboBox_Type->addItems(project->mapTypes); ui->comboBox_DiveMap->clear(); ui->comboBox_DiveMap->addItems(project->mapNames); + ui->comboBox_DiveMap->setClearButtonEnabled(true); ui->comboBox_EmergeMap->clear(); ui->comboBox_EmergeMap->addItems(project->mapNames); + ui->comboBox_EmergeMap->setClearButtonEnabled(true); sortMapList(); @@ -2270,15 +2268,29 @@ void MainWindow::eventTabChanged(int index) { isProgrammaticEventTabChange = false; } +void MainWindow::on_actionDive_Emerge_Map_triggered() { + setDiveEmergeMapVisible(ui->actionDive_Emerge_Map->isChecked()); +} + void MainWindow::on_groupBox_DiveMapOpacity_toggled(bool on) { + setDiveEmergeMapVisible(on); +} + +void MainWindow::setDiveEmergeMapVisible(bool visible) { // Qt doesn't change the style of disabled sliders, so we do it ourselves - QString stylesheet = on ? "" : "QSlider::groove:horizontal {border: 1px solid #999999; border-radius: 3px; height: 2px; background: #B1B1B1;}" - "QSlider::handle:horizontal {border: 1px solid #444444; border-radius: 3px; width: 10px; height: 9px; margin: -5px -1px; background: #5C5C5C; }"; + QString stylesheet = visible ? "" : "QSlider::groove:horizontal {border: 1px solid #999999; border-radius: 3px; height: 2px; background: #B1B1B1;}" + "QSlider::handle:horizontal {border: 1px solid #444444; border-radius: 3px; width: 10px; height: 9px; margin: -5px -1px; background: #5C5C5C; }"; ui->slider_DiveEmergeMapOpacity->setStyleSheet(stylesheet); ui->slider_DiveMapOpacity->setStyleSheet(stylesheet); ui->slider_EmergeMapOpacity->setStyleSheet(stylesheet); - porymapConfig.showDiveEmergeMaps = on; + // Sync UI toggle elements + const QSignalBlocker blocker1(ui->groupBox_DiveMapOpacity); + const QSignalBlocker blocker2(ui->actionDive_Emerge_Map); + ui->groupBox_DiveMapOpacity->setChecked(visible); + ui->actionDive_Emerge_Map->setChecked(visible); + + porymapConfig.showDiveEmergeMaps = visible; this->editor->updateDiveEmergeVisibility(); }