--- a/QTfrontend/hwform.cpp Tue Dec 18 22:53:49 2018 +0100
+++ b/QTfrontend/hwform.cpp Tue Dec 18 23:28:40 2018 +0100
@@ -219,6 +219,7 @@
previousTeamName = "";
UpdateTeamsLists();
InitCampaignPage();
+ RestoreSingleplayerTeamSelection();
UpdateCampaignPage(0);
UpdateCampaignPageTeam(0);
UpdateCampaignPageMission(0);
@@ -928,6 +929,11 @@
GoBack();
}
+ if (curid == ID_PAGE_CAMPAIGN)
+ config->setValue("frontend/lastSingleplayerTeam", ui.pageCampaign->CBTeam->currentText());
+ if (curid == ID_PAGE_TRAINING)
+ config->setValue("frontend/lastSingleplayerTeam", ui.pageTraining->CBTeam->currentText());
+
if (curid == ID_PAGE_ROOMSLIST || curid == ID_PAGE_CONNECTING) NetDisconnect();
if (curid == ID_PAGE_NETGAME && hwnet && hwnet->isInRoom()) hwnet->partRoom();
// need to work on this, can cause invalid state for admin quit trying to prevent bad state message on kick
@@ -2054,6 +2060,21 @@
QString tName = team.name();
ui.pageCampaign->CBCampaign->addItem(getRealCampName(campaignName), campaignName);
}
+
+}
+
+void HWForm::RestoreSingleplayerTeamSelection()
+{
+ QString lastTeam = config->value("frontend/lastSingleplayerTeam", QString()).toString();
+ if (!lastTeam.isNull() && !lastTeam.isEmpty())
+ {
+ int index = ui.pageCampaign->CBTeam->findData(lastTeam, Qt::DisplayRole);
+ if(index != -1)
+ ui.pageCampaign->CBTeam->setCurrentIndex(index);
+ index = ui.pageTraining->CBTeam->findData(lastTeam, Qt::DisplayRole);
+ if(index != -1)
+ ui.pageTraining->CBTeam->setCurrentIndex(index);
+ }
}
void HWForm::UpdateCampaignPage(int index)
--- a/QTfrontend/hwform.h Tue Dec 18 22:53:49 2018 +0100
+++ b/QTfrontend/hwform.h Tue Dec 18 23:28:40 2018 +0100
@@ -137,6 +137,7 @@
void UpdateCampaignPageMission(int index);
void UpdateTrainingPageTeam(int index);
void InitCampaignPage();
+ void RestoreSingleplayerTeamSelection();
void showFeedbackDialog();
void showFeedbackDialogNetChecked();