Add buttons to open Dive/Emerge maps
This commit is contained in:
parent
db35ec2c79
commit
391285aee8
6 changed files with 92 additions and 83 deletions
|
@ -992,7 +992,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>98</width>
|
<width>91</width>
|
||||||
<height>74</height>
|
<height>74</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1193,7 +1193,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>98</width>
|
<width>91</width>
|
||||||
<height>512</height>
|
<height>512</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1413,8 +1413,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>98</width>
|
<width>93</width>
|
||||||
<height>444</height>
|
<height>460</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_14">
|
<layout class="QVBoxLayout" name="verticalLayout_14">
|
||||||
|
@ -1715,7 +1715,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>100</width>
|
<width>100</width>
|
||||||
<height>30</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -1809,7 +1809,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>100</width>
|
<width>100</width>
|
||||||
<height>30</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -1903,7 +1903,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>100</width>
|
<width>100</width>
|
||||||
<height>30</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -2003,7 +2003,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>100</width>
|
<width>100</width>
|
||||||
<height>30</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -2097,7 +2097,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>100</width>
|
<width>100</width>
|
||||||
<height>30</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -2588,7 +2588,7 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="3">
|
<item row="0" column="4">
|
||||||
<spacer name="horizontalSpacer_6">
|
<spacer name="horizontalSpacer_6">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
@ -2601,7 +2601,7 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="4">
|
<item row="0" column="5">
|
||||||
<widget class="QCheckBox" name="checkBox_MirrorConnections">
|
<widget class="QCheckBox" name="checkBox_MirrorConnections">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>If enabled, connections will automatically be updated on the connected map.</string>
|
<string>If enabled, connections will automatically be updated on the connected map.</string>
|
||||||
|
@ -2614,41 +2614,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_EmergeMap">
|
|
||||||
<property name="text">
|
|
||||||
<string>Emerge Map</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLabel" name="label_DiveMap">
|
|
||||||
<property name="text">
|
|
||||||
<string>Dive Map</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="NoScrollComboBox" name="comboBox_DiveMap">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>Destination map name when using <span style=" font-weight:600;">Dive</span>. If empty, no such connection will exist.</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="editable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="NoScrollComboBox" name="comboBox_EmergeMap">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>Destination map name when emerging using <span style=" font-weight:600;">Dive</span>. If empty, no such connection will exist.</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="editable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QToolButton" name="button_OpenDiveMap">
|
<widget class="QToolButton" name="button_OpenDiveMap">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Open the selected Dive Map</string>
|
<string>Open the selected Dive Map</string>
|
||||||
|
@ -2662,7 +2628,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QToolButton" name="button_OpenEmergeMap">
|
<widget class="QToolButton" name="button_OpenEmergeMap">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Open the selected Emerge Map</string>
|
<string>Open the selected Emerge Map</string>
|
||||||
|
@ -2676,6 +2642,40 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_EmergeMap">
|
||||||
|
<property name="text">
|
||||||
|
<string>Emerge Map</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="label_DiveMap">
|
||||||
|
<property name="text">
|
||||||
|
<string>Dive Map</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="NoScrollComboBox" name="comboBox_DiveMap">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Destination map name when using <span style=" font-weight:600;">Dive</span>. If empty, no such connection will exist.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="editable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="NoScrollComboBox" name="comboBox_EmergeMap">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Destination map name when emerging using <span style=" font-weight:600;">Dive</span>. If empty, no such connection will exist.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="editable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -248,6 +248,8 @@ private slots:
|
||||||
void on_comboBox_ConnectedMap_currentTextChanged(const QString &mapName);
|
void on_comboBox_ConnectedMap_currentTextChanged(const QString &mapName);
|
||||||
void on_pushButton_AddConnection_clicked();
|
void on_pushButton_AddConnection_clicked();
|
||||||
void on_pushButton_RemoveConnection_clicked();
|
void on_pushButton_RemoveConnection_clicked();
|
||||||
|
void on_button_OpenDiveMap_clicked();
|
||||||
|
void on_button_OpenEmergeMap_clicked();
|
||||||
void on_comboBox_DiveMap_currentTextChanged(const QString &mapName);
|
void on_comboBox_DiveMap_currentTextChanged(const QString &mapName);
|
||||||
void on_comboBox_EmergeMap_currentTextChanged(const QString &mapName);
|
void on_comboBox_EmergeMap_currentTextChanged(const QString &mapName);
|
||||||
void on_comboBox_PrimaryTileset_currentTextChanged(const QString &arg1);
|
void on_comboBox_PrimaryTileset_currentTextChanged(const QString &arg1);
|
||||||
|
@ -342,6 +344,7 @@ private:
|
||||||
|
|
||||||
bool tilesetNeedsRedraw = false;
|
bool tilesetNeedsRedraw = false;
|
||||||
|
|
||||||
|
bool userSetMap(QString, bool scrollTreeView = false);
|
||||||
bool setMap(QString, bool scrollTreeView = false);
|
bool setMap(QString, bool scrollTreeView = false);
|
||||||
void redrawMapScene();
|
void redrawMapScene();
|
||||||
void refreshMapScene();
|
void refreshMapScene();
|
||||||
|
|
|
@ -119,6 +119,7 @@ public:
|
||||||
bool readMapGroups();
|
bool readMapGroups();
|
||||||
Map* addNewMapToGroup(QString, int, Map*, bool, bool);
|
Map* addNewMapToGroup(QString, int, Map*, bool, bool);
|
||||||
QString getNewMapName();
|
QString getNewMapName();
|
||||||
|
bool isExistingMapName(const QString&);
|
||||||
QString getProjectTitle();
|
QString getProjectTitle();
|
||||||
|
|
||||||
QString readMapLayoutId(QString map_name);
|
QString readMapLayoutId(QString map_name);
|
||||||
|
|
|
@ -763,7 +763,7 @@ void Editor::populateConnectionsList() {
|
||||||
addConnectionToList(item->connection);
|
addConnectionToList(item->connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Vertical scrolling
|
// TODO: Don't allow splitter resizing to shrink list items to the point where horizontal scroll is needed
|
||||||
void Editor::addConnectionToList(const MapConnection * connection) {
|
void Editor::addConnectionToList(const MapConnection * connection) {
|
||||||
ConnectionsListItem *listItem = new ConnectionsListItem(ui->scrollAreaContents_ConnectionsList, project->mapNames);
|
ConnectionsListItem *listItem = new ConnectionsListItem(ui->scrollAreaContents_ConnectionsList, project->mapNames);
|
||||||
listItem->populate(connection);
|
listItem->populate(connection);
|
||||||
|
|
|
@ -718,6 +718,21 @@ void MainWindow::on_action_Reload_Project_triggered() {
|
||||||
openProject(editor->project->root);
|
openProject(editor->project->root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setMap, but with a visible error message in case of failure.
|
||||||
|
// Use when the user is specifically requesting a map to open.
|
||||||
|
bool MainWindow::userSetMap(QString map_name, bool scrollTreeView) {
|
||||||
|
if (!setMap(map_name, scrollTreeView)) {
|
||||||
|
QMessageBox msgBox(this);
|
||||||
|
QString errorMsg = QString("There was an error opening map %1. Please see %2 for full error details.\n\n%3")
|
||||||
|
.arg(map_name)
|
||||||
|
.arg(getLogPath())
|
||||||
|
.arg(getMostRecentError());
|
||||||
|
msgBox.critical(nullptr, "Error Opening Map", errorMsg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool MainWindow::setMap(QString map_name, bool scrollTreeView) {
|
bool MainWindow::setMap(QString map_name, bool scrollTreeView) {
|
||||||
logInfo(QString("Setting map to '%1'").arg(map_name));
|
logInfo(QString("Setting map to '%1'").arg(map_name));
|
||||||
if (map_name.isEmpty()) {
|
if (map_name.isEmpty()) {
|
||||||
|
@ -810,15 +825,8 @@ void MainWindow::openWarpMap(QString map_name, int event_id, Event::Group event_
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open the destination map.
|
// Open the destination map.
|
||||||
if (!setMap(map_name, true)) {
|
if (!userSetMap(map_name, true))
|
||||||
QMessageBox msgBox(this);
|
|
||||||
QString errorMsg = QString("There was an error opening map %1. Please see %2 for full error details.\n\n%3")
|
|
||||||
.arg(map_name)
|
|
||||||
.arg(getLogPath())
|
|
||||||
.arg(getMostRecentError());
|
|
||||||
msgBox.critical(nullptr, "Error Opening Map", errorMsg);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// Select the target event.
|
// Select the target event.
|
||||||
int index = event_id - Event::getIndexOffset(event_group);
|
int index = event_id - Event::getIndexOffset(event_group);
|
||||||
|
@ -1468,17 +1476,8 @@ void MainWindow::currentMetatilesSelectionChanged() {
|
||||||
void MainWindow::on_mapList_activated(const QModelIndex &index)
|
void MainWindow::on_mapList_activated(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
QVariant data = index.data(Qt::UserRole);
|
QVariant data = index.data(Qt::UserRole);
|
||||||
if (index.data(MapListUserRoles::TypeRole) == "map_name" && !data.isNull()) {
|
if (index.data(MapListUserRoles::TypeRole) == "map_name" && !data.isNull())
|
||||||
QString mapName = data.toString();
|
userSetMap(data.toString());
|
||||||
if (!setMap(mapName)) {
|
|
||||||
QMessageBox msgBox(this);
|
|
||||||
QString errorMsg = QString("There was an error opening map %1. Please see %2 for full error details.\n\n%3")
|
|
||||||
.arg(mapName)
|
|
||||||
.arg(getLogPath())
|
|
||||||
.arg(getMostRecentError());
|
|
||||||
msgBox.critical(nullptr, "Error Opening Map", errorMsg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::drawMapListIcons(QAbstractItemModel *model) {
|
void MainWindow::drawMapListIcons(QAbstractItemModel *model) {
|
||||||
|
@ -2421,16 +2420,8 @@ void MainWindow::clickToolButtonFromEditMode(QString editMode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onLoadMapRequested(QString mapName, QString fromMapName) {
|
void MainWindow::onLoadMapRequested(QString mapName, QString fromMapName) {
|
||||||
if (!setMap(mapName, true)) {
|
if (userSetMap(mapName, true))
|
||||||
QMessageBox msgBox(this);
|
editor->setSelectedConnectionFromMap(fromMapName);
|
||||||
QString errorMsg = QString("There was an error opening map %1. Please see %2 for full error details.\n\n%3")
|
|
||||||
.arg(mapName)
|
|
||||||
.arg(getLogPath())
|
|
||||||
.arg(getMostRecentError());
|
|
||||||
msgBox.critical(nullptr, "Error Opening Map", errorMsg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
editor->setSelectedConnectionFromMap(fromMapName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMapChanged(Map *) {
|
void MainWindow::onMapChanged(Map *) {
|
||||||
|
@ -2592,17 +2583,27 @@ void MainWindow::on_pushButton_ConfigureEncountersJSON_clicked() {
|
||||||
editor->configureEncounterJSON(this);
|
editor->configureEncounterJSON(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_comboBox_DiveMap_currentTextChanged(const QString &mapName)
|
void MainWindow::on_button_OpenDiveMap_clicked() {
|
||||||
{
|
const QString mapName = ui->comboBox_DiveMap->currentText();
|
||||||
if (mapName.isEmpty() || editor->project->mapNames.contains(mapName)) {
|
if (editor->project->isExistingMapName(mapName))
|
||||||
|
userSetMap(mapName, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_button_OpenEmergeMap_clicked() {
|
||||||
|
const QString mapName = ui->comboBox_EmergeMap->currentText();
|
||||||
|
if (editor->project->isExistingMapName(mapName))
|
||||||
|
userSetMap(mapName, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_comboBox_DiveMap_currentTextChanged(const QString &mapName) {
|
||||||
|
if (editor->project->isExistingMapName(mapName)) {
|
||||||
editor->updateDiveMap(mapName);
|
editor->updateDiveMap(mapName);
|
||||||
markMapEdited();
|
markMapEdited();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_comboBox_EmergeMap_currentTextChanged(const QString &mapName)
|
void MainWindow::on_comboBox_EmergeMap_currentTextChanged(const QString &mapName) {
|
||||||
{
|
if (editor->project->isExistingMapName(mapName)) {
|
||||||
if (mapName.isEmpty() || editor->project->mapNames.contains(mapName)) {
|
|
||||||
editor->updateEmergeMap(mapName);
|
editor->updateEmergeMap(mapName);
|
||||||
markMapEdited();
|
markMapEdited();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1800,6 +1800,10 @@ QString Project::getNewMapName() {
|
||||||
return newMapName;
|
return newMapName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Project::isExistingMapName(const QString &mapName) {
|
||||||
|
return !mapName.isEmpty() && mapName != DYNAMIC_MAP_NAME && this->mapNames.contains(mapName);
|
||||||
|
}
|
||||||
|
|
||||||
Project::DataQualifiers Project::getDataQualifiers(QString text, QString label) {
|
Project::DataQualifiers Project::getDataQualifiers(QString text, QString label) {
|
||||||
Project::DataQualifiers qualifiers;
|
Project::DataQualifiers qualifiers;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue