]> git.sesse.net Git - nageru/commitdiff
Make the aspect calculations follow from WIDTH/HEIGHT instead of hardcoding 16:9.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 4 Dec 2016 15:39:56 +0000 (16:39 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 4 Dec 2016 15:39:56 +0000 (16:39 +0100)
mainwindow.cpp

index 37b3af11659c700a1d3cf674d20999024157e1c1..ec85041eb190ade92fff217c00ea85781f0ab40e 100644 (file)
@@ -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));
        }