Screensize: warn the user if the screen is too small to show the installer nicely.

Also document the welcome screen requirements-checks.

FIXES #751
This commit is contained in:
Adriaan de Groot 2017-06-21 06:51:18 -04:00 committed by Philip
parent 17f1f0f0b8
commit 69f51cb909
2 changed files with 25 additions and 1 deletions

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014-2017, Teo Mrnjavac <teo@kde.org> * Copyright 2014-2017, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
* *
* Calamares is free software: you can redistribute it and/or modify * Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,9 +30,11 @@
#include "JobQueue.h" #include "JobQueue.h"
#include "GlobalStorage.h" #include "GlobalStorage.h"
#include <QApplication>
#include <QBoxLayout> #include <QBoxLayout>
#include <QDBusConnection> #include <QDBusConnection>
#include <QDBusInterface> #include <QDBusInterface>
#include <QDesktopWidget>
#include <QDir> #include <QDir>
#include <QEventLoop> #include <QEventLoop>
#include <QFile> #include <QFile>
@ -60,6 +63,8 @@ RequirementsChecker::RequirementsChecker( QObject* parent )
mainLayout->addWidget( waitingWidget ); mainLayout->addWidget( waitingWidget );
CALAMARES_RETRANSLATE( waitingWidget->setText( tr( "Gathering system information..." ) ); ) CALAMARES_RETRANSLATE( waitingWidget->setText( tr( "Gathering system information..." ) ); )
QSize availableSize = qApp->desktop()->availableGeometry( m_widget ).size();
QTimer* timer = new QTimer; QTimer* timer = new QTimer;
timer->setSingleShot( true ); timer->setSingleShot( true );
connect( timer, &QTimer::timeout, connect( timer, &QTimer::timeout,
@ -70,6 +75,7 @@ RequirementsChecker::RequirementsChecker( QObject* parent )
bool hasPower = false; bool hasPower = false;
bool hasInternet = false; bool hasInternet = false;
bool isRoot = false; bool isRoot = false;
bool enoughScreen = (availableSize.width() >= CalamaresUtils::windowPreferredWidth) && (availableSize.height() >= CalamaresUtils::windowPreferredHeight);
qint64 requiredStorageB = m_requiredStorageGB * 1073741824L; /*powers of 2*/ qint64 requiredStorageB = m_requiredStorageGB * 1073741824L; /*powers of 2*/
cDebug() << "Need at least storage bytes:" << requiredStorageB; cDebug() << "Need at least storage bytes:" << requiredStorageB;
@ -140,7 +146,14 @@ RequirementsChecker::RequirementsChecker( QObject* parent )
isRoot, isRoot,
m_entriesToRequire.contains( entry ) 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 ); m_actualWidget->init( checkEntries );

View File

@ -7,12 +7,23 @@ requirements:
requiredStorage: 5.5 requiredStorage: 5.5
requiredRam: 1.0 requiredRam: 1.0
internetCheckUrl: http://google.com 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: check:
- storage - storage
- ram - ram
- power - power
- internet - internet
- root - 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: required:
- storage - storage
- ram - ram