Merge branch 'master' of https://github.com/calamares/calamares into development

This commit is contained in:
Philip 2017-06-21 14:26:35 +02:00
commit f5ad4b12b2
11 changed files with 67 additions and 14 deletions

View File

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

View File

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

View File

@ -172,3 +172,6 @@ CLog::~CLog()
log( m_msg.toUtf8().data(), m_debugLevel );
}
Logger::CDebug::~CDebug()
{
}

View File

@ -48,6 +48,7 @@ namespace Logger
CDebug( unsigned int debugLevel = LOGDEBUG ) : CLog( debugLevel )
{
}
virtual ~CDebug();
};
DLLEXPORT void CalamaresLogHandler( QtMsgType type, const char* msg );

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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