From 0edf041b31d27dda71042c0058d30876204d1168 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 20 Jun 2017 18:18:56 -0400 Subject: [PATCH] Screensize: on small screens, be smaller. On 1024x768, limit to 1024x520. On 800x600, limit to 800x520. This is too small to show everything in the timezone widget and keyboard, so it needs some more work. --- src/calamares/CalamaresWindow.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index 251434a1d..6bc2adf3f 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -49,13 +49,24 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) constexpr int min_w = 800; constexpr int min_h = 520; + constexpr int preferred_min_w = 1050; + constexpr int preferred_min_h = 520; - setMinimumSize( min_w, min_h ); QSize availableSize = qApp->desktop()->availableGeometry( this ).size(); - int w = qBound( min_w, CalamaresUtils::defaultFontHeight() * 60, availableSize.width() ); - int h = qBound( min_h, CalamaresUtils::defaultFontHeight() * 36, availableSize.height() ); - cDebug() << "Proposed window size:" << w << h; + cDebug() << "Available size" << availableSize; + + if ( (availableSize.width() < preferred_min_w) || (availableSize.height() < preferred_min_h) ) + cDebug() << " Small screen detected."; + QSize minimumSize( qBound( min_w, availableSize.width(), preferred_min_w ), + qBound( min_h, availableSize.height(), preferred_min_h ) ); + setMinimumSize( minimumSize ); + + + int w = qBound( minimumSize.width(), CalamaresUtils::defaultFontHeight() * 60, availableSize.width() ); + int h = qBound( minimumSize.height(), CalamaresUtils::defaultFontHeight() * 36, availableSize.height() ); + + cDebug() << " Proposed window size:" << w << h; resize( w, h ); QBoxLayout* mainLayout = new QHBoxLayout;