Skip to content

Commit d564329

Browse files
Remove old TODOs and add confirmation
Copying to other team can erase a lot of progress, therefore make sure we ask for confirmation.
1 parent 534c69e commit d564329

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

qtfred/src/mission/dialogs/LoadoutEditorDialogModel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct TeamLoadout {
3535
skipValidation = false;
3636
}
3737

38-
int startingShipCount; // TODO: Make sure this gets pop everywhere
38+
int startingShipCount;
3939
int largestPrimaryBankCount;
4040
int largestSecondaryCapacity;
4141
SCP_vector<LoadoutItem> ships;

qtfred/src/ui/dialogs/LoadoutDialog.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <qlist.h>
66
#include <qtablewidget.h>
77
#include <QListWidget>
8+
#include <QMessageBox>
89

910
constexpr int TABLE_MODE = 0;
1011
constexpr int VARIABLE_MODE = 1;
@@ -253,7 +254,6 @@ void LoadoutDialog::onSwitchViewButtonPressed()
253254
}
254255
else {
255256
ui->tableVarLabel->setText("Loadout Editor: Loadout View");
256-
// TODO! FIXME! Some of the labels are missing from this function. Please check QT Creator
257257
ui->listShipsNotUsedLabel->setText("Ships Not in Loadout");
258258
ui->listWeaponsNotUsedLabel->setText("Weapons Not In Loadout");
259259
ui->startingShipsLabel->setText("Ships in Loadout");
@@ -446,8 +446,23 @@ void LoadoutDialog::onCurrentTeamSpinboxUpdated()
446446

447447
void LoadoutDialog::onCopyLoadoutToOtherTeamsButtonPressed()
448448
{
449-
// TODO! Add confirmation button
450-
_model->copyToOtherTeam();
449+
QMessageBox msgBox;
450+
msgBox.setText("Are you sure that you want to overwrite the other team's loadout with this team's loadout?");
451+
msgBox.setInformativeText("This can't be undone.");
452+
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
453+
msgBox.setDefaultButton(QMessageBox::Cancel);
454+
int ret = msgBox.exec();
455+
456+
switch (ret) {
457+
case QMessageBox::Yes:
458+
_model->copyToOtherTeam();
459+
break;
460+
case QMessageBox::Cancel:
461+
break;
462+
default:
463+
UNREACHABLE("Bad return value from confirmation message box in the Loadout dialog editor.");
464+
break;
465+
}
451466
}
452467

453468

0 commit comments

Comments
 (0)