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.
This commit is contained in:
Adriaan de Groot 2017-06-20 18:18:56 -04:00 committed by Philip
parent b1ce6c3df1
commit ea7a45baa6

View File

@ -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;