Merge branch 'screen-size'
This commit is contained in:
commit
1f458ac067
@ -47,13 +47,24 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
|
|||||||
string( Calamares::Branding::ProductName ) ) );
|
string( Calamares::Branding::ProductName ) ) );
|
||||||
)
|
)
|
||||||
|
|
||||||
constexpr int min_w = 800;
|
using CalamaresUtils::windowMinimumHeight;
|
||||||
constexpr int min_h = 520;
|
using CalamaresUtils::windowMinimumWidth;
|
||||||
|
using CalamaresUtils::windowPreferredHeight;
|
||||||
|
using CalamaresUtils::windowPreferredWidth;
|
||||||
|
|
||||||
setMinimumSize( min_w, min_h );
|
|
||||||
QSize availableSize = qApp->desktop()->availableGeometry( this ).size();
|
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() << "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;
|
cDebug() << " Proposed window size:" << w << h;
|
||||||
resize( w, h );
|
resize( w, h );
|
||||||
@ -66,7 +77,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
|
|||||||
|
|
||||||
QBoxLayout* sideLayout = new QVBoxLayout;
|
QBoxLayout* sideLayout = new QVBoxLayout;
|
||||||
sideBox->setLayout( sideLayout );
|
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 );
|
sideBox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
||||||
|
|
||||||
QHBoxLayout* logoLayout = new QHBoxLayout;
|
QHBoxLayout* logoLayout = new QHBoxLayout;
|
||||||
|
@ -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-2015, Teo Mrnjavac <teo@kde.org>
|
* 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
|
* 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
|
||||||
@ -113,6 +114,13 @@ UIDLLEXPORT int defaultFontHeight(); // in pixels, DPI-specific
|
|||||||
UIDLLEXPORT QFont defaultFont();
|
UIDLLEXPORT QFont defaultFont();
|
||||||
UIDLLEXPORT QSize defaultIconSize();
|
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
|
#endif // CALAMARESUTILSGUI_H
|
||||||
|
@ -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 );
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user