From: Steinar H. Gunderson Date: Sun, 4 Dec 2016 15:39:56 +0000 (+0100) Subject: Make the aspect calculations follow from WIDTH/HEIGHT instead of hardcoding 16:9. X-Git-Tag: 1.5.0~98 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=3b3d6c07f35ad077ec5bd19a641118e86c334398;p=nageru Make the aspect calculations follow from WIDTH/HEIGHT instead of hardcoding 16:9. --- diff --git a/mainwindow.cpp b/mainwindow.cpp index 37b3af1..ec85041 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -855,9 +855,9 @@ void MainWindow::relayout() double remaining_height = height; // Allocate the height; the most important part is to keep the main displays - // at 16:9 if at all possible. + // at the right aspect if at all possible. double me_width = ui->me_preview->width(); - double me_height = me_width * 9.0 / 16.0 + ui->label_preview->height() + ui->preview_vertical_layout->spacing(); + double me_height = me_width * double(HEIGHT) / double(WIDTH) + ui->label_preview->height() + ui->preview_vertical_layout->spacing(); // TODO: Scale the widths when we need to do this. if (me_height / double(height) > 0.8) { @@ -877,7 +877,7 @@ void MainWindow::relayout() double preview_label_height = previews[0]->title_bar->geometry().height() + previews[0]->main_vertical_layout->spacing(); int preview_total_width = ui->preview_displays->geometry().width() - (previews.size() - 1) * ui->preview_displays->spacing(); - double preview_height = min(remaining_height - preview_label_height, (preview_total_width / double(previews.size())) * 9.0 / 16.0); + double preview_height = min(remaining_height - preview_label_height, (preview_total_width / double(previews.size())) * double(HEIGHT) / double(WIDTH)); remaining_height -= preview_height + preview_label_height + ui->vertical_layout->spacing(); ui->vertical_layout->setStretch(0, lrintf(me_height)); @@ -891,7 +891,7 @@ void MainWindow::relayout() ui->compact_audio_layout->setStretch(2, lrintf(preview_height + preview_label_height)); // Set the widths for the previews. - double preview_width = preview_height * 16.0 / 9.0; + double preview_width = preview_height * double(WIDTH) / double(HEIGHT); for (unsigned i = 0; i < previews.size(); ++i) { ui->preview_displays->setStretch(i, lrintf(preview_width)); }