Implement delete for wild encounter table
This commit is contained in:
parent
b9aaef24c6
commit
49737d16cc
5 changed files with 52 additions and 0 deletions
|
@ -2527,6 +2527,23 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_DeleteWildMonGroup">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Delete a group of wild pokemon data on this map.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/images.qrc">
|
||||
<normaloff>:/icons/delete.ico</normaloff>:/icons/delete.ico</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<property name="orientation">
|
||||
|
|
|
@ -84,6 +84,7 @@ public:
|
|||
void addNewConnection();
|
||||
void removeCurrentConnection();
|
||||
void addNewWildMonGroup(QWidget *window);
|
||||
void deleteWildMonGroup();
|
||||
void updateDiveMap(QString mapName);
|
||||
void updateEmergeMap(QString mapName);
|
||||
void setSelectedConnectionFromMap(QString mapName);
|
||||
|
|
|
@ -225,6 +225,7 @@ private slots:
|
|||
void on_tableWidget_CustomHeaderFields_cellChanged(int row, int column);
|
||||
void on_horizontalSlider_MetatileZoom_valueChanged(int value);
|
||||
void on_pushButton_NewWildMonGroup_clicked();
|
||||
void on_pushButton_DeleteWildMonGroup_clicked();
|
||||
void on_pushButton_ConfigureEncountersJSON_clicked();
|
||||
|
||||
void on_actionRegion_Map_Editor_triggered();
|
||||
|
|
|
@ -356,6 +356,35 @@ void Editor::addNewWildMonGroup(QWidget *window) {
|
|||
}
|
||||
}
|
||||
|
||||
void Editor::deleteWildMonGroup() {
|
||||
QComboBox *labelCombo = ui->comboBox_EncounterGroupLabel;
|
||||
|
||||
if (labelCombo->count() < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Confirm Delete");
|
||||
msgBox.setInformativeText("Are you sure you want to delete " + labelCombo->currentText() + "?");
|
||||
|
||||
QPushButton *deleteButton = msgBox.addButton("Delete", QMessageBox::DestructiveRole);
|
||||
msgBox.addButton(QMessageBox::Cancel);
|
||||
msgBox.setDefaultButton(QMessageBox::Cancel);
|
||||
msgBox.exec();
|
||||
|
||||
if (msgBox.clickedButton() == deleteButton) {
|
||||
auto it = project->wildMonData.find(map->constantName);
|
||||
it.value().erase(labelCombo->currentText());
|
||||
|
||||
int i = project->encounterGroupLabels.indexOf(labelCombo->currentText());
|
||||
project->encounterGroupLabels.remove(i);
|
||||
|
||||
displayWildMonTables();
|
||||
|
||||
emit wildMonDataChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::configureEncounterJSON(QWidget *window) {
|
||||
QVector<QWidget *> fieldSlots;
|
||||
|
||||
|
|
|
@ -2376,6 +2376,10 @@ void MainWindow::on_pushButton_NewWildMonGroup_clicked() {
|
|||
editor->addNewWildMonGroup(this);
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_DeleteWildMonGroup_clicked() {
|
||||
editor->deleteWildMonGroup();
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_ConfigureEncountersJSON_clicked() {
|
||||
editor->configureEncounterJSON(this);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue