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
parent d9ea22a486
commit b0c4cc1481
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> ===
*
* 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
* it under the terms of the GNU General Public License as published by
@ -29,9 +30,11 @@
#include "JobQueue.h"
#include "GlobalStorage.h"
#include <QApplication>
#include <QBoxLayout>
#include <QDBusConnection>
#include <QDBusInterface>
#include <QDesktopWidget>
#include <QDir>
#include <QEventLoop>
#include <QFile>
@ -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 );