From 0edf041b31d27dda71042c0058d30876204d1168 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 20 Jun 2017 18:18:56 -0400 Subject: [PATCH 1/4] 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; From f9ee774d4ec900707b7f8535bc4fd11b95fd1eb7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 21 Jun 2017 04:42:02 -0400 Subject: [PATCH 2/4] Screensize: on small screens, crush the sidebar. This still isn't enough to show the whole timezone or keyboard widget, but does make more of it visible. --- src/calamares/CalamaresWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index 6bc2adf3f..aaeeced55 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -77,7 +77,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) QBoxLayout* sideLayout = new QVBoxLayout; sideBox->setLayout( sideLayout ); - sideBox->setFixedWidth( qMax( 190, CalamaresUtils::defaultFontHeight() * 12 ) ); + sideBox->setFixedWidth( qBound( 100, CalamaresUtils::defaultFontHeight() * 12, w < preferred_min_w ? 100 : 190 ) ); sideBox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); QHBoxLayout* logoLayout = new QHBoxLayout; From d9ea22a48667f7f521ff6c07dcd0df3aab67a0e1 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 21 Jun 2017 06:23:05 -0400 Subject: [PATCH 3/4] Screensize: refactor, move screen-size constants into global constexpr Also drop the minimum size a tiny bit, to 1024x520. --- src/calamares/CalamaresWindow.cpp | 16 ++++++++-------- src/libcalamaresui/utils/CalamaresUtilsGui.h | 8 ++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index aaeeced55..271e22cb9 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -47,19 +47,19 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) string( Calamares::Branding::ProductName ) ) ); ) - constexpr int min_w = 800; - constexpr int min_h = 520; - constexpr int preferred_min_w = 1050; - constexpr int preferred_min_h = 520; + using CalamaresUtils::windowMinimumHeight; + using CalamaresUtils::windowMinimumWidth; + using CalamaresUtils::windowPreferredHeight; + using CalamaresUtils::windowPreferredWidth; QSize availableSize = qApp->desktop()->availableGeometry( this ).size(); cDebug() << "Available size" << availableSize; - if ( (availableSize.width() < preferred_min_w) || (availableSize.height() < preferred_min_h) ) + if ( (availableSize.width() < windowPreferredWidth) || (availableSize.height() < windowPreferredHeight) ) cDebug() << " Small screen detected."; - QSize minimumSize( qBound( min_w, availableSize.width(), preferred_min_w ), - qBound( min_h, availableSize.height(), preferred_min_h ) ); + QSize minimumSize( qBound( windowMinimumWidth, availableSize.width(), windowPreferredWidth ), + qBound( windowMinimumHeight, availableSize.height(), windowPreferredHeight ) ); setMinimumSize( minimumSize ); @@ -77,7 +77,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) QBoxLayout* sideLayout = new QVBoxLayout; sideBox->setLayout( sideLayout ); - sideBox->setFixedWidth( qBound( 100, CalamaresUtils::defaultFontHeight() * 12, w < preferred_min_w ? 100 : 190 ) ); + sideBox->setFixedWidth( qBound( 100, CalamaresUtils::defaultFontHeight() * 12, w < windowPreferredWidth ? 100 : 190 ) ); sideBox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); QHBoxLayout* logoLayout = new QHBoxLayout; diff --git a/src/libcalamaresui/utils/CalamaresUtilsGui.h b/src/libcalamaresui/utils/CalamaresUtilsGui.h index d838024f2..3c57d5930 100644 --- a/src/libcalamaresui/utils/CalamaresUtilsGui.h +++ b/src/libcalamaresui/utils/CalamaresUtilsGui.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac + * Copyright 2017, Adriaan de Groot * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -113,6 +114,13 @@ UIDLLEXPORT int defaultFontHeight(); // in pixels, DPI-specific UIDLLEXPORT QFont defaultFont(); UIDLLEXPORT QSize defaultIconSize(); +/** + * @brief Size constants for the main Calamares window. + */ +constexpr int windowMinimumWidth = 800; +constexpr int windowMinimumHeight = 520; +constexpr int windowPreferredWidth = 1024; +constexpr int windowPreferredHeight = 520; } #endif // CALAMARESUTILSGUI_H From b0c4cc1481cc2d9d2da725a54a51fd40c263f3ec Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 21 Jun 2017 06:51:18 -0400 Subject: [PATCH 4/4] Screensize: warn the user if the screen is too small to show the installer nicely. Also document the welcome screen requirements-checks. FIXES #751 --- .../welcome/checker/RequirementsChecker.cpp | 15 ++++++++++++++- src/modules/welcome/welcome.conf | 11 +++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/modules/welcome/checker/RequirementsChecker.cpp b/src/modules/welcome/checker/RequirementsChecker.cpp index 80bc92974..29112de84 100644 --- a/src/modules/welcome/checker/RequirementsChecker.cpp +++ b/src/modules/welcome/checker/RequirementsChecker.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014-2017, Teo Mrnjavac + * Copyright 2017, Adriaan de Groot * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,9 +30,11 @@ #include "JobQueue.h" #include "GlobalStorage.h" +#include #include #include #include +#include #include #include #include @@ -60,6 +63,8 @@ RequirementsChecker::RequirementsChecker( QObject* parent ) mainLayout->addWidget( waitingWidget ); CALAMARES_RETRANSLATE( waitingWidget->setText( tr( "Gathering system information..." ) ); ) + QSize availableSize = qApp->desktop()->availableGeometry( m_widget ).size(); + QTimer* timer = new QTimer; timer->setSingleShot( true ); connect( timer, &QTimer::timeout, @@ -70,6 +75,7 @@ RequirementsChecker::RequirementsChecker( QObject* parent ) bool hasPower = false; bool hasInternet = false; bool isRoot = false; + bool enoughScreen = (availableSize.width() >= CalamaresUtils::windowPreferredWidth) && (availableSize.height() >= CalamaresUtils::windowPreferredHeight); qint64 requiredStorageB = m_requiredStorageGB * 1073741824L; /*powers of 2*/ cDebug() << "Need at least storage bytes:" << requiredStorageB; @@ -140,7 +146,14 @@ RequirementsChecker::RequirementsChecker( QObject* parent ) isRoot, m_entriesToRequire.contains( entry ) } ); - + else if ( entry == "screen" ) + checkEntries.append( { + entry, + [this]{ return QString(); }, // we hide it + [this]{ return tr( "The screen is too small to display the installer." ); }, + enoughScreen, + false + } ); } m_actualWidget->init( checkEntries ); diff --git a/src/modules/welcome/welcome.conf b/src/modules/welcome/welcome.conf index f7cd72cec..18e71b1ef 100644 --- a/src/modules/welcome/welcome.conf +++ b/src/modules/welcome/welcome.conf @@ -7,12 +7,23 @@ requirements: requiredStorage: 5.5 requiredRam: 1.0 internetCheckUrl: http://google.com + + # List conditions to check. Each listed condition will be + # probed in some way, and yields true or false according to + # the host system satisfying the condition. + # + # This sample file lists all the conditions that are know. check: - storage - ram - power - internet - root + - screen + # List conditions that must be satisfied (from the list + # of conditions, above) for installation to proceed. + # If any of these conditions are not met, the user cannot + # continue past the welcome page. required: - storage - ram