From b0c4cc1481cc2d9d2da725a54a51fd40c263f3ec Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 21 Jun 2017 06:51:18 -0400 Subject: [PATCH] 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