Screensize: refactor, move screen-size constants into global constexpr
Also drop the minimum size a tiny bit, to 1024x520.
This commit is contained in:
parent
d0c7577fb4
commit
17f1f0f0b8
@ -47,19 +47,19 @@ 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;
|
||||||
constexpr int preferred_min_w = 1050;
|
using CalamaresUtils::windowPreferredHeight;
|
||||||
constexpr int preferred_min_h = 520;
|
using CalamaresUtils::windowPreferredWidth;
|
||||||
|
|
||||||
QSize availableSize = qApp->desktop()->availableGeometry( this ).size();
|
QSize availableSize = qApp->desktop()->availableGeometry( this ).size();
|
||||||
|
|
||||||
cDebug() << "Available size" << availableSize;
|
cDebug() << "Available size" << availableSize;
|
||||||
|
|
||||||
if ( (availableSize.width() < preferred_min_w) || (availableSize.height() < preferred_min_h) )
|
if ( (availableSize.width() < windowPreferredWidth) || (availableSize.height() < windowPreferredHeight) )
|
||||||
cDebug() << " Small screen detected.";
|
cDebug() << " Small screen detected.";
|
||||||
QSize minimumSize( qBound( min_w, availableSize.width(), preferred_min_w ),
|
QSize minimumSize( qBound( windowMinimumWidth, availableSize.width(), windowPreferredWidth ),
|
||||||
qBound( min_h, availableSize.height(), preferred_min_h ) );
|
qBound( windowMinimumHeight, availableSize.height(), windowPreferredHeight ) );
|
||||||
setMinimumSize( minimumSize );
|
setMinimumSize( minimumSize );
|
||||||
|
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
|
|||||||
|
|
||||||
QBoxLayout* sideLayout = new QVBoxLayout;
|
QBoxLayout* sideLayout = new QVBoxLayout;
|
||||||
sideBox->setLayout( sideLayout );
|
sideBox->setLayout( sideLayout );
|
||||||
sideBox->setFixedWidth( qBound( 100, CalamaresUtils::defaultFontHeight() * 12, w < preferred_min_w ? 100 : 190 ) );
|
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
|
||||||
@ -70,6 +71,13 @@ UIDLLEXPORT int defaultFontHeight();
|
|||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user