diff --git a/forms/connectionslistitem.ui b/forms/connectionslistitem.ui
index c39c86d0..bf04e8be 100644
--- a/forms/connectionslistitem.ui
+++ b/forms/connectionslistitem.ui
@@ -65,7 +65,7 @@
-
- Remove this connection
+ Remove this connection.
...
@@ -79,21 +79,35 @@
-
- Where the connected map should be positioned relative to the current map
+ Where the connected map should be positioned relative to the current map.
-
- The name of the map to connect to the current map
+ The name of the map to connect to the current map.
-
- The number of spaces to move the connected map perpendicular to its connected direction
+ The number of spaces to move the connected map perpendicular to its connected direction.
+
+
+
+ -
+
+
+ Open the connected map.
+
+
+ ...
+
+
+
+ :/icons/map_go.ico:/icons/map_go.ico
diff --git a/forms/mainwindow.ui b/forms/mainwindow.ui
index ff12136e..8c9059bb 100644
--- a/forms/mainwindow.ui
+++ b/forms/mainwindow.ui
@@ -2664,6 +2664,9 @@
-
+
+ If enabled, the connected Emerge and/or Dive maps will be displayed with an opacity set using the slider.
+
Show Emerge/Dive Maps
@@ -2874,8 +2877,8 @@
0
0
- 100
- 30
+ 365
+ 651
diff --git a/forms/newmapconnectiondialog.ui b/forms/newmapconnectiondialog.ui
index da109604..9b3a3b6e 100644
--- a/forms/newmapconnectiondialog.ui
+++ b/forms/newmapconnectiondialog.ui
@@ -7,7 +7,7 @@
0
0
234
- 120
+ 162
@@ -43,7 +43,11 @@
-
-
+
+
+ The name of the map to connect to the current map.
+
+
-
@@ -53,7 +57,24 @@
-
-
+
+
+ Where the connected map should be positioned relative to the current map.
+
+
+
+ -
+
+
+ color: rgb(255, 0, 0)
+
+
+ 'Map' must be the name of an existing map.
+
+
+ true
+
+
@@ -84,12 +105,32 @@
accepted()
NewMapConnectionDialog
accept()
+
+
+ 20
+ 20
+
+
+ 20
+ 20
+
+
buttonBox
rejected()
NewMapConnectionDialog
reject()
+
+
+ 20
+ 20
+
+
+ 20
+ 20
+
+
diff --git a/include/ui/connectionslistitem.h b/include/ui/connectionslistitem.h
index 87051c37..18c3434c 100644
--- a/include/ui/connectionslistitem.h
+++ b/include/ui/connectionslistitem.h
@@ -14,8 +14,7 @@ class ConnectionsListItem;
// We show the data for each map connection in the panel on the right side of the Connections tab.
// An instance of this class is used for each item in that list.
-// It communicates with the ConnectionPixmapItem on the map through a shared MapConnection pointer,
-// and the two classes should signal one another when they change this data.
+// It communicates with the ConnectionPixmapItem on the map through a shared MapConnection pointer.
class ConnectionsListItem : public QFrame
{
Q_OBJECT
@@ -27,28 +26,27 @@ public:
void updateUI();
void setSelected(bool selected);
- QPointer connection;
-
private:
Ui::ConnectionsListItem *ui;
+ QPointer connection;
Map *map;
bool isSelected = false;
unsigned actionId = 0;
protected:
void mousePressEvent(QMouseEvent*) override;
- void mouseDoubleClickEvent(QMouseEvent*) override;
signals:
- void removed(MapConnection*);
void selected();
- void doubleClicked(MapConnection*);
+ void removed(MapConnection*);
+ void openMapClicked(MapConnection*);
private slots:
void on_comboBox_Direction_currentTextChanged(const QString &direction);
void on_comboBox_Map_currentTextChanged(const QString &mapName);
void on_spinBox_Offset_valueChanged(int offset);
void on_button_Delete_clicked();
+ void on_button_OpenMap_clicked();
};
#endif // CONNECTIONSLISTITEM_H
diff --git a/include/ui/newmapconnectiondialog.h b/include/ui/newmapconnectiondialog.h
index 2e0ba28e..4781c971 100644
--- a/include/ui/newmapconnectiondialog.h
+++ b/include/ui/newmapconnectiondialog.h
@@ -24,6 +24,9 @@ signals:
private:
Ui::NewMapConnectionDialog *ui;
+
+ bool mapNameIsValid();
+ void setWarningVisible(bool visible);
};
#endif // NEWMAPCONNECTIONDIALOG_H
diff --git a/src/editor.cpp b/src/editor.cpp
index c7acdea0..de1caa9a 100644
--- a/src/editor.cpp
+++ b/src/editor.cpp
@@ -758,8 +758,8 @@ void Editor::displayConnection(MapConnection* connection) {
QObject::disconnect(connection, &MapConnection::directionChanged, nullptr, nullptr);
QObject::disconnect(connection, &MapConnection::offsetChanged, nullptr, nullptr);
- // Double clicking the list item or pixmap opens the connected map
- connect(listItem, &ConnectionsListItem::doubleClicked, this, &Editor::onMapConnectionDoubleClicked);
+ // Double clicking the pixmap or clicking the list item's map button opens the connected map
+ connect(listItem, &ConnectionsListItem::openMapClicked, this, &Editor::onMapConnectionDoubleClicked);
connect(pixmapItem, &ConnectionPixmapItem::connectionItemDoubleClicked, this, &Editor::onMapConnectionDoubleClicked);
// Sync the selection highlight between the list UI and the pixmap
@@ -937,7 +937,6 @@ void Editor::setDivingMapName(QString mapName, QString direction) {
auto pixmapItem = diving_map_items.value(direction);
MapConnection *connection = pixmapItem ? pixmapItem->connection() : nullptr;
- // TODO: Test edit history
if (connection) {
if (mapName == connection->targetMapName())
return; // No change
@@ -1823,11 +1822,8 @@ void Editor::updateMapBorder() {
void Editor::updateMapConnections() {
for (auto item : connection_items)
item->render(true);
-
- maskNonVisibleConnectionTiles();
}
-// TODO: Check first condition, move to Map
int Editor::getBorderDrawDistance(int dimension) {
// Draw sufficient border blocks to fill the player's view (BORDER_DISTANCE)
if (dimension >= BORDER_DISTANCE) {
@@ -1920,7 +1916,12 @@ void Editor::updateBorderVisibility() {
item->setVisible(visible);
item->setEditable(editingConnections);
item->setEnabled(visible);
- item->render();
+
+ // When connecting a map to itself we don't bother to re-render the map connections in real-time,
+ // i.e. if the user paints a new metatile on the map this isn't immediately reflected in the connection.
+ // We're rendering them now, so we take the opportunity to do a full re-render for self-connections.
+ bool fullRender = (this->map && item->connection && this->map->name == item->connection->targetMapName());
+ item->render(fullRender);
}
}
diff --git a/src/ui/connectionslistitem.cpp b/src/ui/connectionslistitem.cpp
index eb7f94a6..337623b4 100644
--- a/src/ui/connectionslistitem.cpp
+++ b/src/ui/connectionslistitem.cpp
@@ -75,11 +75,6 @@ void ConnectionsListItem::mousePressEvent(QMouseEvent *) {
this->setSelected(true);
}
-// TODO: This happens by accident a lot. Convert to button?
-void ConnectionsListItem::mouseDoubleClickEvent(QMouseEvent *) {
- emit doubleClicked(this->connection);
-}
-
void ConnectionsListItem::on_comboBox_Direction_currentTextChanged(const QString &direction) {
this->setSelected(true);
if (this->map)
@@ -102,3 +97,7 @@ void ConnectionsListItem::on_button_Delete_clicked() {
if (this->map)
this->map->editHistory.push(new MapConnectionRemove(this->map, this->connection));
}
+
+void ConnectionsListItem::on_button_OpenMap_clicked() {
+ emit openMapClicked(this->connection);
+}
diff --git a/src/ui/newmapconnectiondialog.cpp b/src/ui/newmapconnectiondialog.cpp
index 254b4b6e..af06789f 100644
--- a/src/ui/newmapconnectiondialog.cpp
+++ b/src/ui/newmapconnectiondialog.cpp
@@ -9,10 +9,8 @@ NewMapConnectionDialog::NewMapConnectionDialog(QWidget *parent, Map* map, const
setAttribute(Qt::WA_DeleteOnClose);
ui->comboBox_Direction->setEditable(false);
- ui->comboBox_Direction->setMinimumContentsLength(0);
ui->comboBox_Direction->addItems(MapConnection::cardinalDirections);
- ui->comboBox_Map->setMinimumContentsLength(6);
ui->comboBox_Map->addItems(mapNames);
ui->comboBox_Map->setInsertPolicy(QComboBox::NoInsert);
@@ -42,6 +40,12 @@ NewMapConnectionDialog::NewMapConnectionDialog(QWidget *parent, Map* map, const
defaultMapName = mapNames.first();
}
ui->comboBox_Map->setTextItem(defaultMapName);
+
+ connect(ui->comboBox_Map, &QComboBox::currentTextChanged, [this] {
+ if (ui->label_Warning->isVisible() && mapNameIsValid())
+ setWarningVisible(false);
+ });
+ setWarningVisible(false);
}
NewMapConnectionDialog::~NewMapConnectionDialog()
@@ -49,10 +53,18 @@ NewMapConnectionDialog::~NewMapConnectionDialog()
delete ui;
}
+bool NewMapConnectionDialog::mapNameIsValid() {
+ return ui->comboBox_Map->findText(ui->comboBox_Map->currentText()) >= 0;
+}
+
+void NewMapConnectionDialog::setWarningVisible(bool visible) {
+ ui->label_Warning->setVisible(visible);
+ adjustSize();
+}
+
void NewMapConnectionDialog::accept() {
- // Invalid map names are not allowed
- if (ui->comboBox_Map->findText(ui->comboBox_Map->currentText()) < 0) {
- // TODO: Display error message
+ if (!mapNameIsValid()) {
+ setWarningVisible(true);
return;
}
emit accepted(new MapConnection(ui->comboBox_Map->currentText(), ui->comboBox_Direction->currentText()));