|
@@ -254,13 +254,26 @@ void Editor::onConnectionItemSelected(ConnectionPixmapItem* connectionItem) {
|
254
|
254
|
}
|
255
|
255
|
}
|
256
|
256
|
current_connection_edit_item = connectionItem;
|
257
|
|
- current_connection_edit_item->setZValue(0);
|
258
|
257
|
setConnectionEditControlsEnabled(true);
|
259
|
258
|
setConnectionEditControlValues(current_connection_edit_item->connection);
|
260
|
259
|
ui->spinBox_ConnectionOffset->setMaximum(current_connection_edit_item->getMaxOffset());
|
261
|
260
|
ui->spinBox_ConnectionOffset->setMinimum(current_connection_edit_item->getMinOffset());
|
262
|
261
|
}
|
263
|
262
|
|
|
263
|
+void Editor::setSelectedConnectionFromMap(QString mapName) {
|
|
264
|
+ // Search for the first connection that connects to the given map map.
|
|
265
|
+ for (ConnectionPixmapItem* item : connection_edit_items) {
|
|
266
|
+ if (item->connection->map_name == mapName) {
|
|
267
|
+ onConnectionItemSelected(item);
|
|
268
|
+ break;
|
|
269
|
+ }
|
|
270
|
+ }
|
|
271
|
+}
|
|
272
|
+
|
|
273
|
+void Editor::onConnectionItemDoubleClicked(ConnectionPixmapItem* connectionItem) {
|
|
274
|
+ emit loadMapRequested(connectionItem->connection->map_name, map->name);
|
|
275
|
+}
|
|
276
|
+
|
264
|
277
|
void Editor::onConnectionDirectionChanged(QString newDirection) {
|
265
|
278
|
ui->comboBox_ConnectionDirection->blockSignals(true);
|
266
|
279
|
ui->comboBox_ConnectionDirection->setCurrentText(newDirection);
|
|
@@ -460,6 +473,7 @@ void Editor::createConnectionItem(Connection* connection, bool hide) {
|
460
|
473
|
scene->addItem(connection_edit_item);
|
461
|
474
|
connect(connection_edit_item, SIGNAL(connectionMoved(int)), this, SLOT(onConnectionOffsetChanged(int)));
|
462
|
475
|
connect(connection_edit_item, SIGNAL(connectionItemSelected(ConnectionPixmapItem*)), this, SLOT(onConnectionItemSelected(ConnectionPixmapItem*)));
|
|
476
|
+ connect(connection_edit_item, SIGNAL(connectionItemDoubleClicked(ConnectionPixmapItem*)), this, SLOT(onConnectionItemDoubleClicked(ConnectionPixmapItem*)));
|
463
|
477
|
connection_edit_items.append(connection_edit_item);
|
464
|
478
|
}
|
465
|
479
|
|
|
@@ -746,6 +760,9 @@ QVariant ConnectionPixmapItem::itemChange(GraphicsItemChange change, const QVari
|
746
|
760
|
void ConnectionPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent* event) {
|
747
|
761
|
emit connectionItemSelected(this);
|
748
|
762
|
}
|
|
763
|
+void ConnectionPixmapItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent*) {
|
|
764
|
+ emit connectionItemDoubleClicked(this);
|
|
765
|
+}
|
749
|
766
|
|
750
|
767
|
void ElevationMetatilesPixmapItem::updateCurHoveredMetatile(QPointF pos) {
|
751
|
768
|
int x = ((int)pos.x()) / 16;
|