[welcome] Simplify code

- Kevin Kofler pointed out there was a redundant else-if
 - Only use size for comparison if it's valid
main
Adriaan de Groot
parent 7029c427f1
commit 5cb0ee6cc5

@ -67,11 +67,7 @@ biggestSingleScreen()
for ( const auto* screen : QGuiApplication::screens() ) for ( const auto* screen : QGuiApplication::screens() )
{ {
QSize thisScreen = screen->availableSize(); QSize thisScreen = screen->availableSize();
if ( !s.isValid() ) if ( !s.isValid() || ( s.width() * s.height() < thisScreen.width() * thisScreen.height() ) )
{
s = thisScreen;
}
else if ( s.width() * s.height() < thisScreen.width() * thisScreen.height() )
{ {
s = thisScreen; s = thisScreen;
} }
@ -88,7 +84,7 @@ Calamares::RequirementsList GeneralRequirements::checkRequirements()
bool hasPower = false; bool hasPower = false;
bool hasInternet = false; bool hasInternet = false;
bool isRoot = false; bool isRoot = false;
bool enoughScreen = (availableSize.width() >= CalamaresUtils::windowMinimumWidth) && (availableSize.height() >= CalamaresUtils::windowMinimumHeight); bool enoughScreen = availableSize.isValid() && (availableSize.width() >= CalamaresUtils::windowMinimumWidth) && (availableSize.height() >= CalamaresUtils::windowMinimumHeight);
qint64 requiredStorageB = CalamaresUtils::GiBtoBytes(m_requiredStorageGiB); qint64 requiredStorageB = CalamaresUtils::GiBtoBytes(m_requiredStorageGiB);
cDebug() << "Need at least storage bytes:" << requiredStorageB; cDebug() << "Need at least storage bytes:" << requiredStorageB;

Loading…
Cancel
Save