Merge branch 'screen-size'

main
Adriaan de Groot 8 years ago
commit 1f458ac067

@ -47,15 +47,26 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
string( Calamares::Branding::ProductName ) ) );
)
constexpr int min_w = 800;
constexpr int min_h = 520;
using CalamaresUtils::windowMinimumHeight;
using CalamaresUtils::windowMinimumWidth;
using CalamaresUtils::windowPreferredHeight;
using CalamaresUtils::windowPreferredWidth;
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() < windowPreferredWidth) || (availableSize.height() < windowPreferredHeight) )
cDebug() << " Small screen detected.";
QSize minimumSize( qBound( windowMinimumWidth, availableSize.width(), windowPreferredWidth ),
qBound( windowMinimumHeight, availableSize.height(), windowPreferredHeight ) );
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;
@ -66,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 < windowPreferredWidth ? 100 : 190 ) );
sideBox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
QHBoxLayout* logoLayout = new QHBoxLayout;

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014-2015, 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
@ -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

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

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

Loading…
Cancel
Save