Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Make sure the delete DICOM object dialog is not too tall #1140

Merged

Conversation

cpinter
Copy link
Member

@cpinter cpinter commented Sep 18, 2023

When deleting many patients (or studies or series) it can occur that the confirmation dialog that is created with all the deleted object names is taller than the screen height, so the buttons are cut off and not available. This commit ensures that the said dialog cannot be higher than the DICOM browser.

Note that the height of one row is calculated from the first row height in the patients table, which may not be the same as the height of a row in the label that shows the deleted item names. This is implemented like this for simplicity, however, since the table row is typically somewhat higher than a line in the label, it is safe. Also, the height calculation does not include the window header and the buttons.

This is how the shortened message looks:
20230918_DeletePatientsDialogHeight

Copy link
Member

@lassoan lassoan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you, looks good, just added two trivial comments.

// add the information about the selected UIDs
int numUIDs = uids.size();
for (int i = 0; i < numUIDs; ++i)
{
if (i >= maxNumberOfPatientsToShow)
{
message += QString("\n(and %1 more)").arg(numUIDs - maxNumberOfPatientsToShow);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use tr() and explain the message using a translator's comment (it shows up in Qt translator and Weblate) - indicated by //:

Suggested change
message += QString("\n(and %1 more)").arg(numUIDs - maxNumberOfPatientsToShow);
message += QString("\n") + tr("(and %1 more)").arg(numUIDs - maxNumberOfPatientsToShow); //: displayed when there are additional DICOM items to delete that do not fit on screen

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Yes I was wondering about the translation, if it worked or not in CTK. OK I'll do this.

// on the items to show in the dialog
int browserHeight = this->geometry().height();
int patientsTableRowHeight = d->dicomTableManager->patientsTable()->tableView()->rowHeight(0);
int maxNumberOfPatientsToShow = browserHeight / patientsTableRowHeight - 1; // Subtract 1 due to the do not show checkbox
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is safer then we could subtract 2-3. Also make sure that the value is at least 3 (or so).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just didn't want to use arbitrary numbers (1 seemed easy to justify with the checkbox that is within the same layout). With the status bar and the toolbar and window header and OS taskbar even 1 is more than safe.

But I can make it 3, it's safer for sure. And I'll add the minimum number.

@cpinter cpinter force-pushed the fix-delete-dicom-object-dialog-max-height branch from b1a938b to 8b0346e Compare September 19, 2023 09:45
@cpinter
Copy link
Member Author

cpinter commented Sep 25, 2023

I made the requested small changes last Tuesday. If it looks good please approve. Thank you!

@lassoan
Copy link
Member

lassoan commented Sep 25, 2023

Just a really small thing: is it possible that something like this is displayed:

PatientName1,
PatientName2,
PatientName3,
PatientName4,
and 1 more patient

If the "more" message takes a line then it should not be displayed if only 1 more patient cannot be displayed (because that patient could be displayed on that line). Removing the "1 more patient" option would also make translation simpler (there would only be a plural mode).

PatientName1,
PatientName2,
PatientName3,
and 2 more patients

@cpinter
Copy link
Member Author

cpinter commented Sep 25, 2023

Thanks Andras! I'll make sure the message is not triggered with only one left. One sec.

@cpinter
Copy link
Member Author

cpinter commented Sep 25, 2023

By the way there is no singular/plural issue, because the message right now is "(and 2 more)". Just adding patient is not correct because the same code is used when deleting studies and series so I'd need to make an if/else to handle the three cases. Would you like to change the message? In the meantime I'll do the one item check. Thanks!

When deleting many patients (or studies or series) it can occur that the confirmation dialog that is created with all the deleted object names is taller than the screen height, so the buttons are cut off and not available. This commit ensures that the said dialog cannot be higher than the DICOM browser.

Note that the height of one row is calculated from the first row height in the patients table, which may not be the same as the height of a row in the label that shows the deleted item names. This is implemented like this for simplicity, however, since the table row is typically somewhat higher than a line in the label, it is safe.
@cpinter cpinter force-pushed the fix-delete-dicom-object-dialog-max-height branch from 8b0346e to 30d4903 Compare September 25, 2023 12:53
Copy link
Member

@lassoan lassoan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this is good, no more changes needed. Thanks for your patience with these nitpicks.

@lassoan lassoan merged commit b9ef9b8 into commontk:master Sep 25, 2023
1 check passed
@cpinter
Copy link
Member Author

cpinter commented Sep 25, 2023

Thank you for reviewing all my PRs :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants