Installer: factorize _SetStatusMessage() calls in _UpdateControls()

Change-Id: I34306c8c13bff0d8d3e7e8841c552fd05fa11d41
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6083
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
This commit is contained in:
Panagiotis "Ivory" Vasilopoulos 2023-02-25 03:13:43 +01:00 committed by Jérôme Duval
parent ded3731e44
commit be7386be30

View File

@ -799,22 +799,23 @@ InstallerWindow::_UpdateControls()
}
fDestMenuField->MenuItem()->SetLabel(label.String());
BString statusText;
if (srcItem != NULL && dstItem != NULL) {
BString message;
message.SetToFormat(B_TRANSLATE("Press the Begin button to install "
statusText.SetToFormat(B_TRANSLATE("Press the Begin button to install "
"from '%1s' onto '%2s'."), srcItem->Name(), dstItem->Name());
_SetStatusMessage(message.String());
} else if (srcItem != NULL) {
_SetStatusMessage(B_TRANSLATE("Choose the disk you want to install "
"onto from the pop-up menu. Then click \"Begin\"."));
statusText = B_TRANSLATE("Choose the disk you want to install "
"onto from the pop-up menu. Then click \"Begin\".");
} else if (dstItem != NULL) {
_SetStatusMessage(B_TRANSLATE("Choose the source disk from the "
"pop-up menu. Then click \"Begin\"."));
statusText = B_TRANSLATE("Choose the source disk from the "
"pop-up menu. Then click \"Begin\".");
} else {
_SetStatusMessage(B_TRANSLATE("Choose the source and destination disk "
"from the pop-up menus. Then click \"Begin\"."));
statusText = B_TRANSLATE("Choose the source and destination disk "
"from the pop-up menus. Then click \"Begin\".");
}
_SetStatusMessage(statusText.String());
fInstallStatus = kReadyForInstall;
fBeginButton->SetLabel(B_TRANSLATE("Begin"));
fBeginButton->SetEnabled(srcItem && dstItem);