diff --git a/CMakeLists.txt b/CMakeLists.txt index 5942e6354..89e44e93e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) set( CMAKE_C_FLAGS_RELEASE "-O4 -DNDEBUG" ) set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything -Wno-c++98-compat -Wno-padded" ) set( CMAKE_CXX_FLAGS_DEBUG "-g" ) set( CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG" ) set( CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG" ) diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index 251434a1d..271e22cb9 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -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; diff --git a/src/libcalamares/utils/Logger.cpp b/src/libcalamares/utils/Logger.cpp index 4acafa1cf..a8bcf8f4a 100644 --- a/src/libcalamares/utils/Logger.cpp +++ b/src/libcalamares/utils/Logger.cpp @@ -172,3 +172,6 @@ CLog::~CLog() log( m_msg.toUtf8().data(), m_debugLevel ); } +Logger::CDebug::~CDebug() +{ +} diff --git a/src/libcalamares/utils/Logger.h b/src/libcalamares/utils/Logger.h index 466ba7be5..8ab6b8515 100644 --- a/src/libcalamares/utils/Logger.h +++ b/src/libcalamares/utils/Logger.h @@ -48,6 +48,7 @@ namespace Logger CDebug( unsigned int debugLevel = LOGDEBUG ) : CLog( debugLevel ) { } + virtual ~CDebug(); }; DLLEXPORT void CalamaresLogHandler( QtMsgType type, const char* msg ); diff --git a/src/libcalamaresui/Settings.cpp b/src/libcalamaresui/Settings.cpp index 102026a33..b2ed81acf 100644 --- a/src/libcalamaresui/Settings.cpp +++ b/src/libcalamaresui/Settings.cpp @@ -46,8 +46,8 @@ Settings::Settings( const QString& settingsFilePath, QObject* parent ) : QObject( parent ) , m_debug( debugMode ) - , m_promptInstall( false ) , m_doChroot( true ) + , m_promptInstall( false ) { cDebug() << "Using Calamares settings file at" << settingsFilePath; QFile file( settingsFilePath ); diff --git a/src/libcalamaresui/Settings.h b/src/libcalamaresui/Settings.h index 58f2a61b2..90658513e 100644 --- a/src/libcalamaresui/Settings.h +++ b/src/libcalamaresui/Settings.h @@ -57,9 +57,6 @@ public: private: static Settings* s_instance; - bool m_debug; - bool m_doChroot; - QStringList m_modulesSearchPaths; QList< QMap< QString, QString > > m_customModuleInstances; @@ -67,6 +64,8 @@ private: QString m_brandingComponentName; + bool m_debug; + bool m_doChroot; bool m_promptInstall; }; diff --git a/src/libcalamaresui/utils/CalamaresUtilsGui.h b/src/libcalamaresui/utils/CalamaresUtilsGui.h index d838024f2..3c57d5930 100644 --- a/src/libcalamaresui/utils/CalamaresUtilsGui.h +++ b/src/libcalamaresui/utils/CalamaresUtilsGui.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac + * Copyright 2017, Adriaan de Groot * * 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 diff --git a/src/libcalamaresui/utils/YamlUtils.cpp b/src/libcalamaresui/utils/YamlUtils.cpp index 5003e98c7..313639537 100644 --- a/src/libcalamaresui/utils/YamlUtils.cpp +++ b/src/libcalamaresui/utils/YamlUtils.cpp @@ -24,7 +24,7 @@ void operator>>( const YAML::Node& node, QStringList& v ) { - for ( int i = 0; i < node.size(); ++i ) + for ( size_t i = 0; i < node.size(); ++i ) { v.append( QString::fromStdString( node[ i ].as< std::string >() ) ); } @@ -51,9 +51,11 @@ yamlToVariant( const YAML::Node& node ) return yamlMapToVariant( node ); case YAML::NodeType::Null: + case YAML::NodeType::Undefined: return QVariant(); } + // NOTREACHED return QVariant(); } diff --git a/src/modules/welcome/checker/RequirementsChecker.cpp b/src/modules/welcome/checker/RequirementsChecker.cpp index 80bc92974..29112de84 100644 --- a/src/modules/welcome/checker/RequirementsChecker.cpp +++ b/src/modules/welcome/checker/RequirementsChecker.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014-2017, Teo Mrnjavac + * Copyright 2017, Adriaan de Groot * * 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 #include #include #include +#include #include #include #include @@ -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 ); diff --git a/src/modules/welcome/welcome.conf b/src/modules/welcome/welcome.conf index f7cd72cec..18e71b1ef 100644 --- a/src/modules/welcome/welcome.conf +++ b/src/modules/welcome/welcome.conf @@ -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 diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index b3401a977..77b4897a5 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -1,3 +1,8 @@ +if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) + # Suppress warnings entirely; not interesting in third-party code + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w" ) +endif() + if( WITH_CRASHREPORTER ) macro( qt_wrap_ui ) qt5_wrap_ui( ${ARGN} )