From b82042a0783f318bb17d15f8604635d3e883202c Mon Sep 17 00:00:00 2001 From: Gabriel C Date: Tue, 12 Sep 2017 12:39:09 +0200 Subject: [PATCH 01/20] fstab: fix btrfs with LUKS and systemd we forgot to fix that in #730 tested with efi/BIOS+LUKS+btrfs , efi/BIOS+btrfs --- src/modules/fstab/main.py | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/modules/fstab/main.py b/src/modules/fstab/main.py index 553eb65ef..3b639d68f 100644 --- a/src/modules/fstab/main.py +++ b/src/modules/fstab/main.py @@ -225,6 +225,7 @@ class FstabGenerator(object): def generate_fstab_line_info(self, partition): """ Generates information for each fstab entry. """ filesystem = partition["fs"].lower() + has_luks = "luksMapperName" in partition mount_point = partition["mountPoint"] disk_name = disk_name_for_partition(partition) is_ssd = disk_name in self.ssd_disks @@ -252,17 +253,28 @@ class FstabGenerator(object): self.root_is_ssd = is_ssd if filesystem == "btrfs" and "subvol" in partition: - return dict( - device="UUID=" + partition["uuid"], - mount_point=mount_point, - fs=filesystem, - options=",".join( - ["subvol={}".format(partition["subvol"]), options] - ), - check=check, - ) + if has_luks: + return dict( + device="/dev/mapper/" + partition["luksMapperName"], + mount_point=mount_point, + fs=filesystem, + options=",".join( + ["subvol={}".format(partition["subvol"]), options] + ), + check=check, + ) + else: + return dict( + device="UUID=" + partition["uuid"], + mount_point=mount_point, + fs=filesystem, + options=",".join( + ["subvol={}".format(partition["subvol"]), options] + ), + check=check, + ) - if "luksMapperName" in partition: + if has_luks: return dict(device="/dev/mapper/" + partition["luksMapperName"], mount_point=mount_point or "swap", fs=filesystem, From d8a47bb8befa5a0627d60c6e0350b86c662dd1a2 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Sep 2017 06:13:28 -0400 Subject: [PATCH 02/20] Simplify dict() construction for fstab-lines --- src/modules/fstab/main.py | 44 +++++++++++---------------------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/src/modules/fstab/main.py b/src/modules/fstab/main.py index 3b639d68f..1f46fec99 100644 --- a/src/modules/fstab/main.py +++ b/src/modules/fstab/main.py @@ -233,6 +233,8 @@ class FstabGenerator(object): if not mount_point and not filesystem == "swap": return None + if not mount_point: + mount_point = "swap" options = self.mount_options.get(filesystem, self.mount_options["default"]) @@ -253,41 +255,19 @@ class FstabGenerator(object): self.root_is_ssd = is_ssd if filesystem == "btrfs" and "subvol" in partition: - if has_luks: - return dict( - device="/dev/mapper/" + partition["luksMapperName"], - mount_point=mount_point, - fs=filesystem, - options=",".join( - ["subvol={}".format(partition["subvol"]), options] - ), - check=check, - ) - else: - return dict( - device="UUID=" + partition["uuid"], - mount_point=mount_point, - fs=filesystem, - options=",".join( - ["subvol={}".format(partition["subvol"]), options] - ), - check=check, - ) + options="subvol={},".format(partition["subvol"]) + options if has_luks: - return dict(device="/dev/mapper/" + partition["luksMapperName"], - mount_point=mount_point or "swap", - fs=filesystem, - options=options, - check=check, - ) + device="/dev/mapper/" + partition["luksMapperName"] else: - return dict(device="UUID=" + partition["uuid"], - mount_point=mount_point or "swap", - fs=filesystem, - options=options, - check=check, - ) + device="UUID=" + partition["uuid"] + + return dict(device=device, + mount_point=mount_point, + fs=filesystem, + options=options, + check=check, + ) def print_fstab_line(self, dct, file=None): """ Prints line to '/etc/fstab' file. """ From ec86922839eae9794ccb95f3bd2a260849225d67 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Sep 2017 07:01:19 -0400 Subject: [PATCH 03/20] Find KPMCore 3.2 quietly, less frightening --- src/modules/partition/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/partition/CMakeLists.txt b/src/modules/partition/CMakeLists.txt index 0291c46e4..1ea69c027 100644 --- a/src/modules/partition/CMakeLists.txt +++ b/src/modules/partition/CMakeLists.txt @@ -8,7 +8,7 @@ find_package( KF5 REQUIRED CoreAddons ) # These are needed because KPMcore links publicly against ConfigCore, I18n, IconThemes, KIOCore and Service find_package( KF5 REQUIRED Config I18n IconThemes KIO Service ) -find_package( KPMcore 3.1.50 ) +find_package( KPMcore 3.1.50 QUIET ) if ( ${KPMcore_FOUND} ) add_definitions(-DWITH_KPMCORE22) endif() From be2338ff08b2ea9ae6e7fb8178e17d9731bab526 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Sep 2017 08:03:18 -0400 Subject: [PATCH 04/20] Clang: reduce warnings --- src/libcalamares/ProcessJob.h | 2 +- src/libcalamares/utils/PluginFactory.cpp | 8 +- src/libcalamares/utils/PluginFactory.h | 80 +++++++++---------- .../modulesystem/CppJobModule.h | 2 +- .../modulesystem/ProcessJobModule.h | 2 +- src/libcalamaresui/modulesystem/ViewModule.h | 2 +- 6 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/libcalamares/ProcessJob.h b/src/libcalamares/ProcessJob.h index ba6e650f6..1ac7f7f08 100644 --- a/src/libcalamares/ProcessJob.h +++ b/src/libcalamares/ProcessJob.h @@ -32,7 +32,7 @@ public: bool runInChroot = false, int secondsTimeout = 30, QObject* parent = nullptr ); - virtual ~ProcessJob(); + virtual ~ProcessJob() override; QString prettyName() const override; QString prettyStatusMessage() const override; diff --git a/src/libcalamares/utils/PluginFactory.cpp b/src/libcalamares/utils/PluginFactory.cpp index 30a5bf4bf..ff6c9913f 100644 --- a/src/libcalamares/utils/PluginFactory.cpp +++ b/src/libcalamares/utils/PluginFactory.cpp @@ -34,7 +34,7 @@ namespace Calamares { PluginFactory::PluginFactory() - : d_ptr(new PluginFactoryPrivate) + : d_ptr_p(new PluginFactoryPrivate) { Q_D(PluginFactory); d->q_ptr = this; @@ -43,14 +43,14 @@ PluginFactory::PluginFactory() } PluginFactory::PluginFactory(PluginFactoryPrivate &d) - : d_ptr(&d) + : d_ptr_p(&d) { factorycleanup()->add(this); } PluginFactory::~PluginFactory() { - delete d_ptr; + delete d_ptr_p; } void PluginFactory::doRegisterPlugin(const QString &keyword, const QMetaObject *metaObject, CreateInstanceFunction instanceFunction) @@ -97,7 +97,7 @@ QObject *PluginFactory::create(const char *iface, QWidget *parentWidget, QObject { Q_D(PluginFactory); - QObject *obj = 0; + QObject *obj( nullptr ); const QList candidates(d->createInstanceHash.values(keyword)); // for !keyword.isEmpty() candidates.count() is 0 or 1 diff --git a/src/libcalamares/utils/PluginFactory.h b/src/libcalamares/utils/PluginFactory.h index a45078f65..d7dc61783 100644 --- a/src/libcalamares/utils/PluginFactory.h +++ b/src/libcalamares/utils/PluginFactory.h @@ -199,7 +199,7 @@ namespace Calamares class DLLEXPORT PluginFactory : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(PluginFactory) + Q_DECLARE_PRIVATE( PluginFactory ) public: /** * This constructor creates a factory for a plugin. @@ -222,7 +222,7 @@ public: * \returns A pointer to the created object is returned, or 0 if an error occurred. */ template - T *create(QObject *parent = 0); + T* create( QObject* parent = nullptr ); /** * Use this method to create an object. It will try to create an object which inherits @@ -235,34 +235,35 @@ public: * \returns A pointer to the created object is returned, or 0 if an error occurred. */ template - T *create(const QString &keyword, QObject *parent = 0); + T* create( const QString& keyword, QObject* parent = nullptr ); Q_SIGNALS: - void objectCreated(QObject *object); + void objectCreated( QObject* object ); protected: /** * Function pointer type to a function that instantiates a plugin. */ - typedef QObject *(*CreateInstanceFunction)(QWidget *, QObject *); + typedef QObject* ( *CreateInstanceFunction )( QWidget*, QObject* ); /** * This is used to detect the arguments need for the constructor of plugin classes. * You can inherit it, if you want to add new classes and still keep support for the old ones. */ template - struct InheritanceChecker { - CreateInstanceFunction createInstanceFunction(QWidget *) + struct InheritanceChecker + { + CreateInstanceFunction createInstanceFunction( QWidget* ) { return &createInstance; } - CreateInstanceFunction createInstanceFunction(...) + CreateInstanceFunction createInstanceFunction( ... ) { return &createInstance; } }; - explicit PluginFactory(PluginFactoryPrivate &dd); + explicit PluginFactory( PluginFactoryPrivate& dd ); /** * Registers a plugin with the factory. Call this function from the constructor of the @@ -292,14 +293,14 @@ protected: * \endcode */ template - void registerPlugin(const QString &keyword = QString(), - CreateInstanceFunction instanceFunction - = InheritanceChecker().createInstanceFunction(reinterpret_cast(0))) + void registerPlugin( const QString& keyword = QString(), + CreateInstanceFunction instanceFunction + = InheritanceChecker().createInstanceFunction( reinterpret_cast( 0 ) ) ) { - doRegisterPlugin(keyword, &T::staticMetaObject, instanceFunction); + doRegisterPlugin( keyword, &T::staticMetaObject, instanceFunction ); } - PluginFactoryPrivate *const d_ptr; + PluginFactoryPrivate* const d_ptr_p; /** * This function is called when the factory asked to create an Object. @@ -314,56 +315,55 @@ protected: * \param keyword A string that uniquely identifies the plugin. If a KService is used this * keyword is read from the X-KDE-PluginKeyword entry in the .desktop file. */ - virtual QObject *create(const char *iface, QWidget *parentWidget, QObject *parent, const QString &keyword); + virtual QObject* create( const char* iface, QWidget* parentWidget, QObject* parent, const QString& keyword ); template - static QObject *createInstance(QWidget *parentWidget, QObject *parent) + static QObject* createInstance( QWidget* parentWidget, QObject* parent ) { - Q_UNUSED(parentWidget); - ParentType *p = 0; - if (parent) { - p = qobject_cast(parent); - Q_ASSERT(p); + Q_UNUSED( parentWidget ); + ParentType* p( nullptr ); + if ( parent ) + { + p = qobject_cast( parent ); + Q_ASSERT( p ); } - return new impl(p); + return new impl( p ); } private: - void doRegisterPlugin(const QString &keyword, const QMetaObject *metaObject, CreateInstanceFunction instanceFunction); + void doRegisterPlugin( const QString& keyword, const QMetaObject* metaObject, CreateInstanceFunction instanceFunction ); }; template -inline T *PluginFactory::create(QObject *parent) +inline T* PluginFactory::create( QObject* parent ) { - QObject *o = create(T::staticMetaObject.className(), - parent && parent->isWidgetType() ? reinterpret_cast(parent) : 0, - parent, - QString()); + QObject* o = create( T::staticMetaObject.className(), + parent && parent->isWidgetType() ? reinterpret_cast( parent ) : nullptr, + parent, + QString() ); - T *t = qobject_cast(o); - if (!t) { + T* t = qobject_cast( o ); + if ( !t ) delete o; - } return t; } template -inline T *PluginFactory::create(const QString &keyword, QObject *parent) +inline T* PluginFactory::create( const QString& keyword, QObject* parent ) { - QObject *o = create(T::staticMetaObject.className(), - parent && parent->isWidgetType() ? reinterpret_cast(parent) : 0, - parent, - keyword); + QObject* o = create( T::staticMetaObject.className(), + parent && parent->isWidgetType() ? reinterpret_cast( parent ) : nullptr, + parent, + keyword ); - T *t = qobject_cast(o); - if (!t) { + T* t = qobject_cast( o ); + if ( !t ) delete o; - } return t; } } -Q_DECLARE_INTERFACE(Calamares::PluginFactory, CalamaresPluginFactory_iid) +Q_DECLARE_INTERFACE( Calamares::PluginFactory, CalamaresPluginFactory_iid ) #endif // CALAMARESPLUGINFACTORY_H diff --git a/src/libcalamaresui/modulesystem/CppJobModule.h b/src/libcalamaresui/modulesystem/CppJobModule.h index 127614ec5..92c4224d3 100644 --- a/src/libcalamaresui/modulesystem/CppJobModule.h +++ b/src/libcalamaresui/modulesystem/CppJobModule.h @@ -42,7 +42,7 @@ protected: private: friend class Module; //so only the superclass can instantiate explicit CppJobModule(); - virtual ~CppJobModule(); + virtual ~CppJobModule() override; QPluginLoader* m_loader; job_ptr m_job; diff --git a/src/libcalamaresui/modulesystem/ProcessJobModule.h b/src/libcalamaresui/modulesystem/ProcessJobModule.h index b160fd25f..5bb1699be 100644 --- a/src/libcalamaresui/modulesystem/ProcessJobModule.h +++ b/src/libcalamaresui/modulesystem/ProcessJobModule.h @@ -40,7 +40,7 @@ protected: private: friend class Module; explicit ProcessJobModule(); - virtual ~ProcessJobModule(); + virtual ~ProcessJobModule() override; QString m_command; QString m_workingPath; diff --git a/src/libcalamaresui/modulesystem/ViewModule.h b/src/libcalamaresui/modulesystem/ViewModule.h index 177c1eba1..bfbbdadf3 100644 --- a/src/libcalamaresui/modulesystem/ViewModule.h +++ b/src/libcalamaresui/modulesystem/ViewModule.h @@ -43,7 +43,7 @@ protected: private: friend class Module; //so only the superclass can instantiate explicit ViewModule(); - virtual ~ViewModule(); + virtual ~ViewModule() override; QPluginLoader* m_loader; ViewStep* m_viewStep = nullptr; From cbef79bb93d1197fc99de36388154ef43fac7431 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Sep 2017 08:32:22 -0400 Subject: [PATCH 05/20] Clean up CMake stuff, remove unneeded modules --- CMakeLists.txt | 56 ++++--- CMakeModules/MacroLogFeature.cmake | 157 -------------------- CMakeModules/MacroOptionalFindPackage.cmake | 48 ------ 3 files changed, 32 insertions(+), 229 deletions(-) delete mode 100644 CMakeModules/MacroLogFeature.cmake delete mode 100644 CMakeModules/MacroOptionalFindPackage.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 5978a1c53..b14521417 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,7 @@ cmake_policy( SET CMP0028 NEW ) # double colons in KF5::Foo and Qt5::Foo are nec cmake_policy( SET CMP0043 OLD ) include( MacroOptionalFindPackage ) -include( MacroLogFeature ) +include( FeatureSummary ) set( QT_VERSION 5.6.0 ) @@ -80,35 +80,29 @@ if( CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR NOT EXISTS "${CMAKE_CURRENT_SOURCE_D set( WITH_CRASHREPORTER OFF ) endif() -macro_optional_find_package( PythonLibs 3.3 ) -macro_log_feature( - PYTHONLIBS_FOUND - "Python" - "C interface libraries for the Python 3 interpreter." - "http://python.org" - FALSE "3.3" - "Python 3 is used for some Calamares job modules." +find_package( PythonLibs 3.3 OPTIONAL ) +set_package_properties( + PYTHONLIBS PROPERTIES + DESCRIPTION "C interface libraries for the Python 3 interpreter." + URL "http://python.org" + PURPOSE "Python 3 is used for some Calamares job modules." ) if ( PYTHONLIBS_FOUND ) include( BoostPython3 ) find_boost_python3( 1.54.0 ${PYTHONLIBS_VERSION_STRING} CALAMARES_BOOST_PYTHON3_FOUND ) - macro_log_feature( - CALAMARES_BOOST_PYTHON3_FOUND - "Boost.Python" - "A C++ library which enables seamless interoperability between C++ and Python 3." - "http://www.boost.org" - FALSE "1.54.0" - "Boost.Python is used for interfacing with Calamares job modules written in Python 3." + set_package_properties( + CALAMARES_BOOST_PYTHON3 PROPERTIES + DESCRIPTION "A C++ library which enables seamless interoperability between C++ and Python 3." + URL "http://www.boost.org" + PURPOSE "Boost.Python is used for interfacing with Calamares job modules written in Python 3." ) macro_optional_find_package( PythonQt ) - macro_log_feature( PYTHONQT_FOUND - "PythonQt" - "A Python embedding solution for Qt applications." - "http://pythonqt.sourceforge.net" - FALSE "3.1" - "PythonQt is used for the Python modules API." + set_package_properties( PYTHONQT PROPERTIES + DESCRIPTION "A Python embedding solution for Qt applications." + URL "http://pythonqt.sourceforge.net" + PURPOSE "PythonQt is used for the Python modules API." ) endif() @@ -203,8 +197,12 @@ set( THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/thirdparty" ) # make example-distro # find_program( mksquashfs_PROGRAM mksquashfs ) -macro_log_feature( mksquashfs_PROGRAM "mksquashfs" "Create example distro" "http://tldp.org/HOWTO/SquashFS-HOWTO/creatingandusing.html") +set_package_properties( mksquashfs PROPERTIES + DESCRIPTION "Create example distro" + URL "http://tldp.org/HOWTO/SquashFS-HOWTO/creatingandusing.html" +) if( mksquashfs_PROGRAM ) + set( mksquashfs_FOUND ON ) set( src_fs ${CMAKE_SOURCE_DIR}/data/example-root/ ) set( dst_fs ${CMAKE_BINARY_DIR}/example.sqfs ) if( EXISTS ${src_fs} ) @@ -227,12 +225,22 @@ if( mksquashfs_PROGRAM ) ) add_custom_target(example-distro DEPENDS ${dst_fs}) endif() +else() + set( mksquashfs_FOUND OFF ) endif() +# Doesn't list mksquashfs as an optional dep, though, because it +# hasn't been sent through the find_package() scheme. +set_package_properties( mksquashfs PROPERTIES + DESCRIPTION "Create squashed filesystems" + URL "http://tldp.org/HOWTO/SquashFS-HOWTO/creatingandusing.html" + PURPOSE "Create example distro" + TYPE OPTIONAL +) add_subdirectory( thirdparty ) add_subdirectory( src ) -macro_display_feature_log() +feature_summary(WHAT ALL) if( NOT WITH_PYTHON ) message( "-- WARNING: Building Calamares without Python support. Legacy Python job modules will not work.\n" ) diff --git a/CMakeModules/MacroLogFeature.cmake b/CMakeModules/MacroLogFeature.cmake deleted file mode 100644 index 45e27b6df..000000000 --- a/CMakeModules/MacroLogFeature.cmake +++ /dev/null @@ -1,157 +0,0 @@ -# This file defines the Feature Logging macros. -# -# MACRO_LOG_FEATURE(VAR FEATURE DESCRIPTION URL [REQUIRED [MIN_VERSION [COMMENTS]]]) -# Logs the information so that it can be displayed at the end -# of the configure run -# VAR : TRUE or FALSE, indicating whether the feature is supported -# FEATURE: name of the feature, e.g. "libjpeg" -# DESCRIPTION: description what this feature provides -# URL: home page -# REQUIRED: TRUE or FALSE, indicating whether the featue is required -# MIN_VERSION: minimum version number. empty string if unneeded -# COMMENTS: More info you may want to provide. empty string if unnecessary -# -# MACRO_DISPLAY_FEATURE_LOG() -# Call this to display the collected results. -# Exits CMake with a FATAL error message if a required feature is missing -# -# Example: -# -# INCLUDE(MacroLogFeature) -# -# FIND_PACKAGE(JPEG) -# MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "Support JPEG images" "http://www.ijg.org" TRUE "3.2a" "") -# ... -# MACRO_DISPLAY_FEATURE_LOG() - -# Copyright (c) 2006, Alexander Neundorf, -# Copyright (c) 2006, Allen Winter, -# Copyright (c) 2009, Sebastian Trueg, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -IF (NOT _macroLogFeatureAlreadyIncluded) - SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt) - IF (EXISTS ${_file}) - FILE(REMOVE ${_file}) - ENDIF (EXISTS ${_file}) - - SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) - IF (EXISTS ${_file}) - FILE(REMOVE ${_file}) - ENDIF (EXISTS ${_file}) - - SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) - IF (EXISTS ${_file}) - FILE(REMOVE ${_file}) - ENDIF (EXISTS ${_file}) - - SET(_macroLogFeatureAlreadyIncluded TRUE) - - INCLUDE(FeatureSummary) - -ENDIF (NOT _macroLogFeatureAlreadyIncluded) - - -MACRO(MACRO_LOG_FEATURE _var _package _description _url ) # _required _minvers _comments) - - STRING(TOUPPER "${ARGV4}" _required) - SET(_minvers "${ARGV5}") - SET(_comments "${ARGV6}") - - IF (${_var}) - SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) - ELSE (${_var}) - IF ("${_required}" STREQUAL "TRUE") - SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/MissingRequirements.txt) - ELSE ("${_required}" STREQUAL "TRUE") - SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) - ENDIF ("${_required}" STREQUAL "TRUE") - ENDIF (${_var}) - - SET(_logtext " * ${_package}") - - IF (NOT ${_var}) - IF (${_minvers} MATCHES ".*") - SET(_logtext "${_logtext} (${_minvers} or higher)") - ENDIF (${_minvers} MATCHES ".*") - SET(_logtext "${_logtext} <${_url}>\n ") - ELSE (NOT ${_var}) - SET(_logtext "${_logtext} - ") - ENDIF (NOT ${_var}) - - SET(_logtext "${_logtext}${_description}") - - IF (NOT ${_var}) - IF (${_comments} MATCHES ".*") - SET(_logtext "${_logtext}\n ${_comments}") - ENDIF (${_comments} MATCHES ".*") -# SET(_logtext "${_logtext}\n") #double-space missing features? - ENDIF (NOT ${_var}) - - FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n") - - IF(COMMAND SET_PACKAGE_INFO) # in FeatureSummary.cmake since CMake 2.8.3 - SET_PACKAGE_INFO("${_package}" "\"${_description}\"" "${_url}" "\"${_comments}\"") - ENDIF(COMMAND SET_PACKAGE_INFO) - -ENDMACRO(MACRO_LOG_FEATURE) - - -MACRO(MACRO_DISPLAY_FEATURE_LOG) - IF(COMMAND FEATURE_SUMMARY) # in FeatureSummary.cmake since CMake 2.8.3 - FEATURE_SUMMARY(FILENAME ${CMAKE_CURRENT_BINARY_DIR}/FindPackageLog.txt - WHAT ALL) - ENDIF(COMMAND FEATURE_SUMMARY) - - SET(_missingFile ${CMAKE_BINARY_DIR}/MissingRequirements.txt) - SET(_enabledFile ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) - SET(_disabledFile ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) - - IF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile}) - SET(_printSummary TRUE) - ENDIF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile}) - - IF(_printSummary) - SET(_missingDeps 0) - IF (EXISTS ${_enabledFile}) - FILE(READ ${_enabledFile} _enabled) - FILE(REMOVE ${_enabledFile}) - SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following external packages were located on your system.\n-- This installation will have the extra features provided by these packages.\n-----------------------------------------------------------------------------\n${_enabled}") - ENDIF (EXISTS ${_enabledFile}) - - - IF (EXISTS ${_disabledFile}) - SET(_missingDeps 1) - FILE(READ ${_disabledFile} _disabled) - FILE(REMOVE ${_disabledFile}) - SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following OPTIONAL packages could NOT be located on your system.\n-- Consider installing them to enable more features from this software.\n-----------------------------------------------------------------------------\n${_disabled}") - ENDIF (EXISTS ${_disabledFile}) - - - IF (EXISTS ${_missingFile}) - SET(_missingDeps 1) - FILE(READ ${_missingFile} _requirements) - SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following REQUIRED packages could NOT be located on your system.\n-- You must install these packages before continuing.\n-----------------------------------------------------------------------------\n${_requirements}") - FILE(REMOVE ${_missingFile}) - SET(_haveMissingReq 1) - ENDIF (EXISTS ${_missingFile}) - - - IF (NOT ${_missingDeps}) - SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- Congratulations! All external packages have been found.") - ENDIF (NOT ${_missingDeps}) - - - MESSAGE(${_summary}) - MESSAGE("-----------------------------------------------------------------------------\n") - - - IF(_haveMissingReq) - MESSAGE(FATAL_ERROR "Exiting: Missing Requirements") - ENDIF(_haveMissingReq) - - ENDIF(_printSummary) - -ENDMACRO(MACRO_DISPLAY_FEATURE_LOG) diff --git a/CMakeModules/MacroOptionalFindPackage.cmake b/CMakeModules/MacroOptionalFindPackage.cmake deleted file mode 100644 index d4ed48e33..000000000 --- a/CMakeModules/MacroOptionalFindPackage.cmake +++ /dev/null @@ -1,48 +0,0 @@ -# - MACRO_OPTIONAL_FIND_PACKAGE() combines FIND_PACKAGE() with an OPTION() -# MACRO_OPTIONAL_FIND_PACKAGE( [QUIT] ) -# This macro is a combination of OPTION() and FIND_PACKAGE(), it -# works like FIND_PACKAGE(), but additionally it automatically creates -# an option name WITH_, which can be disabled via the cmake GUI. -# or via -DWITH_=OFF -# The standard _FOUND variables can be used in the same way -# as when using the normal FIND_PACKAGE() - -# Copyright (c) 2006-2010 Alexander Neundorf, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -# This is just a helper macro to set a bunch of variables empty. -# We don't know whether the package uses UPPERCASENAME or CamelCaseName, so we try both: -macro(_MOFP_SET_EMPTY_IF_DEFINED _name _var) - if(DEFINED ${_name}_${_var}) - set(${_name}_${_var} "") - endif(DEFINED ${_name}_${_var}) - - string(TOUPPER ${_name} _nameUpper) - if(DEFINED ${_nameUpper}_${_var}) - set(${_nameUpper}_${_var} "") - endif(DEFINED ${_nameUpper}_${_var}) -endmacro(_MOFP_SET_EMPTY_IF_DEFINED _package _var) - - -macro (MACRO_OPTIONAL_FIND_PACKAGE _name ) - option(WITH_${_name} "Search for ${_name} package" ON) - if (WITH_${_name}) - find_package(${_name} ${ARGN}) - else (WITH_${_name}) - string(TOUPPER ${_name} _nameUpper) - set(${_name}_FOUND FALSE) - set(${_nameUpper}_FOUND FALSE) - - _mofp_set_empty_if_defined(${_name} INCLUDE_DIRS) - _mofp_set_empty_if_defined(${_name} INCLUDE_DIR) - _mofp_set_empty_if_defined(${_name} INCLUDES) - _mofp_set_empty_if_defined(${_name} LIBRARY) - _mofp_set_empty_if_defined(${_name} LIBRARIES) - _mofp_set_empty_if_defined(${_name} LIBS) - _mofp_set_empty_if_defined(${_name} FLAGS) - _mofp_set_empty_if_defined(${_name} DEFINITIONS) - endif (WITH_${_name}) -endmacro (MACRO_OPTIONAL_FIND_PACKAGE) - From 199627012845606f7d3788b5c25412d7362f2128 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Sep 2017 08:38:51 -0400 Subject: [PATCH 06/20] Drop crashreporter-qt - Reporting URL we use is unused right now anyway - Not compatible with glibc 2.26 - Not compatible with ARM --- .gitmodules | 6 +++--- CMakeLists.txt | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.gitmodules b/.gitmodules index 4fc249f44..8ef1ca6af 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "thirdparty/libcrashreporter-qt"] - path = thirdparty/libcrashreporter-qt - url = https://github.com/dschmidt/libcrashreporter-qt +#[submodule "thirdparty/libcrashreporter-qt"] +# path = thirdparty/libcrashreporter-qt +# url = https://github.com/dschmidt/libcrashreporter-qt diff --git a/CMakeLists.txt b/CMakeLists.txt index b14521417..935b1d7a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,7 @@ find_package( YAMLCPP 0.5.1 REQUIRED ) find_package( PolkitQt5-1 REQUIRED ) option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON ) -option( WITH_CRASHREPORTER "Build with CrashReporter" ON ) +# option( WITH_CRASHREPORTER "Build with CrashReporter" OFF ) option( INSTALL_CONFIG "Install configuration files" ON ) option( WITH_PYTHONQT "Enable next generation Python modules API (experimental, requires PythonQt)." OFF ) option( BUILD_TESTING "Build the testing tree." ON ) @@ -75,10 +75,10 @@ if( BUILD_TESTING ) enable_testing() endif () -if( CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libcrashreporter-qt/CMakeLists.txt" ) - message( STATUS "Build of crashreporter disabled." ) - set( WITH_CRASHREPORTER OFF ) -endif() +# if( CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libcrashreporter-qt/CMakeLists.txt" ) +# message( STATUS "Build of crashreporter disabled." ) +# set( WITH_CRASHREPORTER OFF ) +# endif() find_package( PythonLibs 3.3 OPTIONAL ) set_package_properties( @@ -237,7 +237,7 @@ set_package_properties( mksquashfs PROPERTIES TYPE OPTIONAL ) -add_subdirectory( thirdparty ) +# add_subdirectory( thirdparty ) add_subdirectory( src ) feature_summary(WHAT ALL) From 3246b6cb1b59d3b9572a5034d95c3e14effa3082 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Sep 2017 08:43:20 -0400 Subject: [PATCH 07/20] Drop submodule the right way --- .gitmodules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 8ef1ca6af..4fc249f44 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -#[submodule "thirdparty/libcrashreporter-qt"] -# path = thirdparty/libcrashreporter-qt -# url = https://github.com/dschmidt/libcrashreporter-qt +[submodule "thirdparty/libcrashreporter-qt"] + path = thirdparty/libcrashreporter-qt + url = https://github.com/dschmidt/libcrashreporter-qt From 6c3b308a039ba53dada7fcc2b3e6473a44cde17e Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Sep 2017 08:47:07 -0400 Subject: [PATCH 08/20] Remove libcrashreporter-qt more thoroughly --- .gitmodules | 3 --- thirdparty/CMakeLists.txt | 11 ----------- thirdparty/libcrashreporter-qt | 1 - 3 files changed, 15 deletions(-) delete mode 100644 thirdparty/CMakeLists.txt delete mode 160000 thirdparty/libcrashreporter-qt diff --git a/.gitmodules b/.gitmodules index 4fc249f44..e69de29bb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "thirdparty/libcrashreporter-qt"] - path = thirdparty/libcrashreporter-qt - url = https://github.com/dschmidt/libcrashreporter-qt diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt deleted file mode 100644 index 77b4897a5..000000000 --- a/thirdparty/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -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} ) - endmacro() - add_subdirectory( libcrashreporter-qt ) -endif() diff --git a/thirdparty/libcrashreporter-qt b/thirdparty/libcrashreporter-qt deleted file mode 160000 index 61dc3963c..000000000 --- a/thirdparty/libcrashreporter-qt +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 61dc3963c2b59894e7d3f3bd758c43b59665054a From 63ecce93fd8c23a45d148d8a5fc79dfd4401ec9a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Sep 2017 08:56:29 -0400 Subject: [PATCH 09/20] Remove unused CMake module --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 935b1d7a3..c8b4f208b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,7 +56,6 @@ cmake_policy( SET CMP0023 OLD ) cmake_policy( SET CMP0028 NEW ) # double colons in KF5::Foo and Qt5::Foo are necessarily IMPORTED or ALIAS targets, don't search further cmake_policy( SET CMP0043 OLD ) -include( MacroOptionalFindPackage ) include( FeatureSummary ) set( QT_VERSION 5.6.0 ) From 90fc268cc4535f60d67f2b8929a9911a6e2ede49 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Sep 2017 18:04:36 +0200 Subject: [PATCH 10/20] Clean up CMakeLists wrt. optional --- CMakeLists.txt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8b4f208b..faaf3b8d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,10 +52,6 @@ if( CMAKE_COMPILER_IS_GNUCXX ) endif() endif() -cmake_policy( SET CMP0023 OLD ) -cmake_policy( SET CMP0028 NEW ) # double colons in KF5::Foo and Qt5::Foo are necessarily IMPORTED or ALIAS targets, don't search further -cmake_policy( SET CMP0043 OLD ) - include( FeatureSummary ) set( QT_VERSION 5.6.0 ) @@ -79,7 +75,7 @@ endif () # set( WITH_CRASHREPORTER OFF ) # endif() -find_package( PythonLibs 3.3 OPTIONAL ) +find_package( PythonLibs 3.3 ) set_package_properties( PYTHONLIBS PROPERTIES DESCRIPTION "C interface libraries for the Python 3 interpreter." @@ -97,7 +93,7 @@ if ( PYTHONLIBS_FOUND ) PURPOSE "Boost.Python is used for interfacing with Calamares job modules written in Python 3." ) - macro_optional_find_package( PythonQt ) + find_package( PythonQt ) set_package_properties( PYTHONQT PROPERTIES DESCRIPTION "A Python embedding solution for Qt applications." URL "http://pythonqt.sourceforge.net" From 03d9dbe099c7c58eabd744d6cf37e290362a3415 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Sep 2017 18:29:56 +0200 Subject: [PATCH 11/20] Clean up CMakeLists, linking --- CMakeLists.txt | 4 ---- CMakeModules/CalamaresAddLibrary.cmake | 13 ++++++++----- src/calamares/CMakeLists.txt | 1 - src/libcalamares/CMakeLists.txt | 12 ++---------- 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index faaf3b8d4..74f69a8a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -192,10 +192,6 @@ set( THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/thirdparty" ) # make example-distro # find_program( mksquashfs_PROGRAM mksquashfs ) -set_package_properties( mksquashfs PROPERTIES - DESCRIPTION "Create example distro" - URL "http://tldp.org/HOWTO/SquashFS-HOWTO/creatingandusing.html" -) if( mksquashfs_PROGRAM ) set( mksquashfs_FOUND ON ) set( src_fs ${CMAKE_SOURCE_DIR}/data/example-root/ ) diff --git a/CMakeModules/CalamaresAddLibrary.cmake b/CMakeModules/CalamaresAddLibrary.cmake index a774b1f31..f183277c8 100644 --- a/CMakeModules/CalamaresAddLibrary.cmake +++ b/CMakeModules/CalamaresAddLibrary.cmake @@ -45,9 +45,6 @@ function(calamares_add_library) add_library(${target} SHARED ${LIBRARY_SOURCES}) endif() - # HACK: add qt modules - every lib should define its own set of modules - qt5_use_modules(${target} Core Gui Widgets ${LIBRARY_QT5_MODULES}) - # definitions - can this be moved into set_target_properties below? add_definitions(${QT_DEFINITIONS}) set_target_properties(${target} PROPERTIES AUTOMOC TRUE) @@ -67,9 +64,15 @@ function(calamares_add_library) endif() # add link targets - target_link_libraries(${target} ${CALAMARES_LIBRARIES}) + target_link_libraries(${target} + LINK_PUBLIC ${CALAMARES_LIBRARIES} + Qt5::Core + Qt5::Gui + Qt5::Widgets + ${LIBRARY_QT5_MODULES} + ) if(LIBRARY_LINK_LIBRARIES) - target_link_libraries(${target} ${LIBRARY_LINK_LIBRARIES}) + target_link_libraries(${target} LINK_PUBLIC ${LIBRARY_LINK_LIBRARIES}) endif() if(LIBRARY_LINK_PRIVATE_LIBRARIES) target_link_libraries(${target} LINK_PRIVATE ${LIBRARY_LINK_PRIVATE_LIBRARIES}) diff --git a/src/calamares/CMakeLists.txt b/src/calamares/CMakeLists.txt index c0f9ecb66..62be0ed34 100644 --- a/src/calamares/CMakeLists.txt +++ b/src/calamares/CMakeLists.txt @@ -55,7 +55,6 @@ if( WITH_CRASHREPORTER ) list( APPEND LINK_LIBRARIES ${LINK_LIBRARIES} pthread crashreporter-handler ) endif() -qt5_use_modules( calamares_bin Core Widgets ) target_link_libraries( calamares_bin PRIVATE ${CALAMARES_LIBRARIES} diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index fd94e3eab..cdd31b782 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -81,17 +81,9 @@ set_target_properties( calamares SOVERSION ${CALAMARES_VERSION_SHORT} ) -qt5_use_modules( calamares Core ) - - target_link_libraries( calamares - LINK_PRIVATE - # internal deps, if any - ${OPTIONAL_PRIVATE_LIBRARIES} - - LINK_PUBLIC - # External deps - Qt5::Core + LINK_PRIVATE ${OPTIONAL_PRIVATE_LIBRARIES} + LINK_PUBLIC Qt5::Core ) install( TARGETS calamares From bd37572fd8d1b76bda97c0e315e3971b9b2cf3f1 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Sep 2017 18:35:56 +0200 Subject: [PATCH 12/20] Clang: reduce warnings --- src/libcalamaresui/utils/ImageRegistry.cpp | 2 +- src/libcalamaresui/utils/qjsonitem.h | 4 ++-- src/libcalamaresui/utils/qjsonmodel.h | 2 +- src/libcalamaresui/viewpages/ViewStep.cpp | 4 +++- src/libcalamaresui/widgets/ClickableLabel.h | 6 +++--- src/libcalamaresui/widgets/FixedAspectRatioLabel.cpp | 1 + src/libcalamaresui/widgets/FixedAspectRatioLabel.h | 2 +- src/libcalamaresui/widgets/QtWaitingSpinner.cpp | 10 +++++----- src/libcalamaresui/widgets/QtWaitingSpinner.h | 2 +- src/modules/keyboard/KeyboardViewStep.h | 2 +- src/modules/netinstall/NetInstallViewStep.h | 2 +- src/modules/netinstall/PackageModel.h | 2 +- 12 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/libcalamaresui/utils/ImageRegistry.cpp b/src/libcalamaresui/utils/ImageRegistry.cpp index 5e55b2293..9ed646e50 100644 --- a/src/libcalamaresui/utils/ImageRegistry.cpp +++ b/src/libcalamaresui/utils/ImageRegistry.cpp @@ -29,7 +29,7 @@ #include "utils/Logger.h" static QHash< QString, QHash< int, QHash< qint64, QPixmap > > > s_cache; -ImageRegistry* ImageRegistry::s_instance = 0; +ImageRegistry* ImageRegistry::s_instance = nullptr; ImageRegistry* diff --git a/src/libcalamaresui/utils/qjsonitem.h b/src/libcalamaresui/utils/qjsonitem.h index 58ea02d32..1dfa5c65e 100644 --- a/src/libcalamaresui/utils/qjsonitem.h +++ b/src/libcalamaresui/utils/qjsonitem.h @@ -26,7 +26,7 @@ class QJsonTreeItem { public: - QJsonTreeItem(QJsonTreeItem * parent = 0); + QJsonTreeItem(QJsonTreeItem * parent = nullptr); virtual ~QJsonTreeItem(); void appendChild(QJsonTreeItem * item); QJsonTreeItem *child(int row); @@ -41,7 +41,7 @@ public: QJsonValue::Type type() const; - static QJsonTreeItem* load(const QJsonValue& value, QJsonTreeItem * parent = 0); + static QJsonTreeItem* load(const QJsonValue& value, QJsonTreeItem * parent = nullptr); protected: diff --git a/src/libcalamaresui/utils/qjsonmodel.h b/src/libcalamaresui/utils/qjsonmodel.h index a76d807d8..0bf8f5dab 100644 --- a/src/libcalamaresui/utils/qjsonmodel.h +++ b/src/libcalamaresui/utils/qjsonmodel.h @@ -30,7 +30,7 @@ class QJsonModel : public QAbstractItemModel { Q_OBJECT public: - explicit QJsonModel(QObject *parent = 0); + explicit QJsonModel(QObject *parent = nullptr); virtual ~QJsonModel(); bool load(const QString& fileName); bool load(QIODevice * device); diff --git a/src/libcalamaresui/viewpages/ViewStep.cpp b/src/libcalamaresui/viewpages/ViewStep.cpp index 6d5a5f746..a81787673 100644 --- a/src/libcalamaresui/viewpages/ViewStep.cpp +++ b/src/libcalamaresui/viewpages/ViewStep.cpp @@ -61,6 +61,8 @@ ViewStep::setModuleInstanceKey( const QString& instanceKey ) void ViewStep::setConfigurationMap( const QVariantMap& configurationMap ) -{} +{ + Q_UNUSED( configurationMap ); +} } diff --git a/src/libcalamaresui/widgets/ClickableLabel.h b/src/libcalamaresui/widgets/ClickableLabel.h index fc198b98b..7a6556e3f 100644 --- a/src/libcalamaresui/widgets/ClickableLabel.h +++ b/src/libcalamaresui/widgets/ClickableLabel.h @@ -28,14 +28,14 @@ class ClickableLabel : public QLabel public: explicit ClickableLabel( QWidget* parent = nullptr, Qt::WindowFlags f = 0 ); explicit ClickableLabel( const QString& text, QWidget* parent = nullptr, Qt::WindowFlags f = 0 ); - virtual ~ClickableLabel(); + virtual ~ClickableLabel() override; signals: void clicked(); protected: - virtual void mousePressEvent( QMouseEvent* event ); - virtual void mouseReleaseEvent( QMouseEvent* event ); + virtual void mousePressEvent( QMouseEvent* event ) override; + virtual void mouseReleaseEvent( QMouseEvent* event ) override; private: QTime m_time; diff --git a/src/libcalamaresui/widgets/FixedAspectRatioLabel.cpp b/src/libcalamaresui/widgets/FixedAspectRatioLabel.cpp index 4920605bc..99d3d51f4 100644 --- a/src/libcalamaresui/widgets/FixedAspectRatioLabel.cpp +++ b/src/libcalamaresui/widgets/FixedAspectRatioLabel.cpp @@ -42,6 +42,7 @@ FixedAspectRatioLabel::setPixmap( const QPixmap& pixmap ) void FixedAspectRatioLabel::resizeEvent( QResizeEvent* event ) { + Q_UNUSED( event ); QLabel::setPixmap( m_pixmap.scaled( contentsRect().size(), Qt::KeepAspectRatio, diff --git a/src/libcalamaresui/widgets/FixedAspectRatioLabel.h b/src/libcalamaresui/widgets/FixedAspectRatioLabel.h index 4483576f6..33cc4708f 100644 --- a/src/libcalamaresui/widgets/FixedAspectRatioLabel.h +++ b/src/libcalamaresui/widgets/FixedAspectRatioLabel.h @@ -28,7 +28,7 @@ class FixedAspectRatioLabel : public QLabel Q_OBJECT public: explicit FixedAspectRatioLabel( QWidget* parent = nullptr ); - virtual ~FixedAspectRatioLabel(); + virtual ~FixedAspectRatioLabel() override; public slots: void setPixmap( const QPixmap &pixmap ); diff --git a/src/libcalamaresui/widgets/QtWaitingSpinner.cpp b/src/libcalamaresui/widgets/QtWaitingSpinner.cpp index c298a61ec..93ad6f9ee 100644 --- a/src/libcalamaresui/widgets/QtWaitingSpinner.cpp +++ b/src/libcalamaresui/widgets/QtWaitingSpinner.cpp @@ -57,7 +57,7 @@ void QtWaitingSpinner::paintEvent(QPaintEvent* /*ev*/) { for (int i = 0; i < myLinesNumber; ++i) { painter.save(); painter.translate(myRadius + myLength, myRadius + myLength); - qreal rotateAngle = (qreal)360 * qreal(i) / qreal(myLinesNumber); + qreal rotateAngle = 360.0 * qreal(i) / qreal(myLinesNumber); painter.rotate(rotateAngle); painter.translate(myRadius, 0); int distance = lineDistance(i, myCurrentCounter, myLinesNumber); @@ -160,14 +160,14 @@ QColor QtWaitingSpinner::countTrailColor(int distance, int lines, int trail, int if (distance == 0) { return color; } - const qreal minAlphaF = (qreal)minOpacity / 100; - int distanceThreshold = ceil( (lines - 1) * (qreal)trail / 100); + const qreal minAlphaF = qreal(minOpacity) / 100.0; + int distanceThreshold = ceil( (lines - 1) * qreal(trail) / 100.0); if (distance > distanceThreshold) { color.setAlphaF(minAlphaF); return color; } - qreal alphaDiff = color.alphaF() - (qreal)minAlphaF; - qreal gradation = alphaDiff / (qreal)(distanceThreshold + 1); + qreal alphaDiff = color.alphaF() - minAlphaF; + qreal gradation = alphaDiff / qreal(distanceThreshold + 1); qreal resultAlpha = color.alphaF() - gradation * distance; resultAlpha = std::min(1.0, std::max(0.0, resultAlpha)); //if alpha is out of bound, force it to bounds color.setAlphaF(resultAlpha); diff --git a/src/libcalamaresui/widgets/QtWaitingSpinner.h b/src/libcalamaresui/widgets/QtWaitingSpinner.h index b01ebd1a8..1c1b3eb10 100644 --- a/src/libcalamaresui/widgets/QtWaitingSpinner.h +++ b/src/libcalamaresui/widgets/QtWaitingSpinner.h @@ -33,7 +33,7 @@ class UIDLLEXPORT QtWaitingSpinner : public QWidget { Q_OBJECT public: - explicit QtWaitingSpinner(int linesNumber = 12, int length = 7, int width = 5, int radius = 10, QWidget* parent = 0); + explicit QtWaitingSpinner(int linesNumber = 12, int length = 7, int width = 5, int radius = 10, QWidget* parent = nullptr); public Q_SLOTS: void start(); diff --git a/src/modules/keyboard/KeyboardViewStep.h b/src/modules/keyboard/KeyboardViewStep.h index 239639251..39f3f56a7 100644 --- a/src/modules/keyboard/KeyboardViewStep.h +++ b/src/modules/keyboard/KeyboardViewStep.h @@ -34,7 +34,7 @@ class PLUGINDLLEXPORT KeyboardViewStep : public Calamares::ViewStep public: explicit KeyboardViewStep( QObject* parent = nullptr ); - virtual ~KeyboardViewStep(); + virtual ~KeyboardViewStep() override; QString prettyName() const override; QString prettyStatus() const override; diff --git a/src/modules/netinstall/NetInstallViewStep.h b/src/modules/netinstall/NetInstallViewStep.h index de4d411d8..651c53266 100644 --- a/src/modules/netinstall/NetInstallViewStep.h +++ b/src/modules/netinstall/NetInstallViewStep.h @@ -34,7 +34,7 @@ class PLUGINDLLEXPORT NetInstallViewStep : public Calamares::ViewStep public: explicit NetInstallViewStep( QObject* parent = nullptr ); - virtual ~NetInstallViewStep(); + virtual ~NetInstallViewStep() override; QString prettyName() const override; QString prettyStatus() const override; diff --git a/src/modules/netinstall/PackageModel.h b/src/modules/netinstall/PackageModel.h index d49dd88c2..4a41f1879 100644 --- a/src/modules/netinstall/PackageModel.h +++ b/src/modules/netinstall/PackageModel.h @@ -35,7 +35,7 @@ class PackageModel : public QAbstractItemModel Q_OBJECT public: - explicit PackageModel( const YAML::Node& data, QObject* parent = 0 ); + explicit PackageModel( const YAML::Node& data, QObject* parent = nullptr ); ~PackageModel(); QVariant data( const QModelIndex& index, int role ) const override; From da4fa6a63ab0ce6d6b8be6cc943c2dcce08f6720 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Sep 2017 18:49:43 +0200 Subject: [PATCH 13/20] Fix link / library name --- src/libcalamaresui/CMakeLists.txt | 2 +- src/modules/locale/CMakeLists.txt | 2 +- src/modules/netinstall/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcalamaresui/CMakeLists.txt b/src/libcalamaresui/CMakeLists.txt index ee039b46d..0648807b8 100644 --- a/src/libcalamaresui/CMakeLists.txt +++ b/src/libcalamaresui/CMakeLists.txt @@ -63,7 +63,7 @@ calamares_add_library( ${CALAMARESUI_LIBRARY_TARGET} UI ${${CALAMARESUI_LIBRARY_TARGET}_UI} EXPORT_MACRO UIDLLEXPORT_PRO LINK_PRIVATE_LIBRARIES - yaml-cpp + ${YAMLCPP_LIBRARY} Qt5::Svg Qt5::QuickWidgets ${OPTIONAL_PRIVATE_LIBRARIES} diff --git a/src/modules/locale/CMakeLists.txt b/src/modules/locale/CMakeLists.txt index 61bdfc707..e32f6e613 100644 --- a/src/modules/locale/CMakeLists.txt +++ b/src/modules/locale/CMakeLists.txt @@ -17,6 +17,6 @@ calamares_add_plugin( locale LINK_PRIVATE_LIBRARIES calamaresui Qt5::Network - yaml-cpp + ${YAMLCPP_LIBRARY} SHARED_LIB ) diff --git a/src/modules/netinstall/CMakeLists.txt b/src/modules/netinstall/CMakeLists.txt index 1de1c7505..67f805734 100644 --- a/src/modules/netinstall/CMakeLists.txt +++ b/src/modules/netinstall/CMakeLists.txt @@ -15,6 +15,6 @@ calamares_add_plugin( netinstall LINK_PRIVATE_LIBRARIES calamaresui Qt5::Network - yaml-cpp + ${YAMLCPP_LIBRARY} SHARED_LIB ) From 5d241f8e0908c66f531d690f540765ef6a8aeade Mon Sep 17 00:00:00 2001 From: Gabriel C Date: Wed, 13 Sep 2017 21:44:15 +0200 Subject: [PATCH 14/20] CreateUserJob: do not force any autologin group There is no need to force folks haing a random group bc that is a Distro think. SDDM/GDM works just fine without having a group for the user to autologin. Just setup a group in users.conf .. is why we have a configuration option for that. --- src/modules/users/CreateUserJob.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/modules/users/CreateUserJob.cpp b/src/modules/users/CreateUserJob.cpp index c666bd9ad..5f6843db5 100644 --- a/src/modules/users/CreateUserJob.cpp +++ b/src/modules/users/CreateUserJob.cpp @@ -115,13 +115,12 @@ CreateUserJob::exec() { QString autologinGroup; if ( gs->contains( "autologinGroup" ) && - !gs->value( "autologinGroup" ).toString().isEmpty() ) + !gs->value( "autologinGroup" ).toString().isEmpty() ) + { autologinGroup = gs->value( "autologinGroup" ).toString(); - else - autologinGroup = QStringLiteral( "autologin" ); - - CalamaresUtils::System::instance()->targetEnvCall( { "groupadd", autologinGroup } ); - defaultGroups.append( QString( ",%1" ).arg( autologinGroup ) ); + CalamaresUtils::System::instance()->targetEnvCall( { "groupadd", autologinGroup } ); + defaultGroups.append( QString( ",%1" ).arg( autologinGroup ) ); + } } // If we're looking to reuse the contents of an existing /home From edb1dbaa6e65196886c977f76082c2983eab904f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Sep 2017 20:07:09 +0200 Subject: [PATCH 15/20] Clang: warnings-- --- src/calamares/progresstree/ProgressTreeDelegate.cpp | 2 -- src/calamares/progresstree/ProgressTreeModel.cpp | 9 ++++++--- src/calamares/progresstree/ProgressTreeModel.h | 2 +- src/calamares/progresstree/ProgressTreeView.h | 4 ++-- src/libcalamaresui/widgets/QtWaitingSpinner.cpp | 4 ++-- src/modules/netinstall/PackageModel.cpp | 2 ++ src/modules/netinstall/PackageModel.h | 4 ++-- src/modules/netinstall/PackageTreeItem.cpp | 6 +++--- src/modules/netinstall/PackageTreeItem.h | 8 ++++---- src/modules/users/SetPasswordJob.cpp | 4 ++-- src/modules/users/SetPasswordJob.h | 2 +- src/modules/users/UsersViewStep.h | 2 +- src/modules/webview/WebViewStep.h | 2 +- 13 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/calamares/progresstree/ProgressTreeDelegate.cpp b/src/calamares/progresstree/ProgressTreeDelegate.cpp index f6b52b978..34835c8fa 100644 --- a/src/calamares/progresstree/ProgressTreeDelegate.cpp +++ b/src/calamares/progresstree/ProgressTreeDelegate.cpp @@ -64,8 +64,6 @@ ProgressTreeDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { - bool isFirstLevel = !index.parent().isValid(); - QStyleOptionViewItem opt = option; painter->save(); diff --git a/src/calamares/progresstree/ProgressTreeModel.cpp b/src/calamares/progresstree/ProgressTreeModel.cpp index dbe8315eb..33e985809 100644 --- a/src/calamares/progresstree/ProgressTreeModel.cpp +++ b/src/calamares/progresstree/ProgressTreeModel.cpp @@ -96,6 +96,10 @@ ProgressTreeModel::data( const QModelIndex& index, int role ) const QVariant ProgressTreeModel::headerData( int section, Qt::Orientation orientation, int role ) const { + Q_UNUSED( section ); + Q_UNUSED( orientation ); + Q_UNUSED( role ); + return QVariant(); } @@ -146,12 +150,11 @@ ProgressTreeModel::indexFromItem( ProgressTreeItem* item ) if ( !item || !item->parent() ) return QModelIndex(); - // Reconstructs a QModelIndex from a ProgressTreeItem that is somewhere in the tree. - // Traverses the item to the root node, then rebuilds the qmodeindices from there + // Traverses the item to the root node, then rebuilds the qmodelindices from there // back down; each int is the row of that item in the parent. /** - * In this diagram, if the \param item is G, childIndexList will contain [0, 2, 0] + * In this diagram, if the item is G, childIndexList will contain [0, 2, 0] * * A * D diff --git a/src/calamares/progresstree/ProgressTreeModel.h b/src/calamares/progresstree/ProgressTreeModel.h index 60db77939..0311a28a0 100644 --- a/src/calamares/progresstree/ProgressTreeModel.h +++ b/src/calamares/progresstree/ProgressTreeModel.h @@ -39,7 +39,7 @@ public: }; explicit ProgressTreeModel( QObject* parent = nullptr ); - virtual ~ProgressTreeModel(); + virtual ~ProgressTreeModel() override; // Reimplemented from QAbstractItemModel Qt::ItemFlags flags( const QModelIndex& index ) const override; diff --git a/src/calamares/progresstree/ProgressTreeView.h b/src/calamares/progresstree/ProgressTreeView.h index fae75d0dc..9e735ef2d 100644 --- a/src/calamares/progresstree/ProgressTreeView.h +++ b/src/calamares/progresstree/ProgressTreeView.h @@ -34,8 +34,8 @@ class ProgressTreeView : public QTreeView public: static ProgressTreeView* instance(); - explicit ProgressTreeView( QWidget* parent = 0 ); - virtual ~ProgressTreeView(); + explicit ProgressTreeView( QWidget* parent = nullptr ); + virtual ~ProgressTreeView() override; /** * @brief setModel assigns a model to this view. diff --git a/src/libcalamaresui/widgets/QtWaitingSpinner.cpp b/src/libcalamaresui/widgets/QtWaitingSpinner.cpp index 93ad6f9ee..18c6264bd 100644 --- a/src/libcalamaresui/widgets/QtWaitingSpinner.cpp +++ b/src/libcalamaresui/widgets/QtWaitingSpinner.cpp @@ -145,7 +145,7 @@ void QtWaitingSpinner::updateTimer() { } int QtWaitingSpinner::countTimeout(int lines, qreal speed) { - return 1000 / (lines * speed); + return int( 1000.0 / (lines * speed) ); } int QtWaitingSpinner::lineDistance(int from, int to, int lines) { @@ -161,7 +161,7 @@ QColor QtWaitingSpinner::countTrailColor(int distance, int lines, int trail, int return color; } const qreal minAlphaF = qreal(minOpacity) / 100.0; - int distanceThreshold = ceil( (lines - 1) * qreal(trail) / 100.0); + int distanceThreshold = int( ceil( (lines - 1) * qreal(trail) / 100.0) ); if (distance > distanceThreshold) { color.setAlphaF(minAlphaF); return color; diff --git a/src/modules/netinstall/PackageModel.cpp b/src/modules/netinstall/PackageModel.cpp index 629133c86..8a2025b0e 100644 --- a/src/modules/netinstall/PackageModel.cpp +++ b/src/modules/netinstall/PackageModel.cpp @@ -126,6 +126,8 @@ bool PackageModel::setHeaderData( int section, Qt::Orientation orientation, const QVariant& value, int role ) { + Q_UNUSED( role ); + if ( orientation == Qt::Horizontal ) { if ( m_columnHeadings.value( section ) != QVariant() ) diff --git a/src/modules/netinstall/PackageModel.h b/src/modules/netinstall/PackageModel.h index 4a41f1879..ef2bc1794 100644 --- a/src/modules/netinstall/PackageModel.h +++ b/src/modules/netinstall/PackageModel.h @@ -36,13 +36,13 @@ class PackageModel : public QAbstractItemModel public: explicit PackageModel( const YAML::Node& data, QObject* parent = nullptr ); - ~PackageModel(); + ~PackageModel() override; QVariant data( const QModelIndex& index, int role ) const override; bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole ) override; bool setHeaderData( int section, Qt::Orientation orientation, - const QVariant& value, int role = Qt::EditRole ); + const QVariant& value, int role = Qt::EditRole ) override; Qt::ItemFlags flags( const QModelIndex& index ) const override; QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override; diff --git a/src/modules/netinstall/PackageTreeItem.cpp b/src/modules/netinstall/PackageTreeItem.cpp index 0cbc52223..bbd7f792f 100644 --- a/src/modules/netinstall/PackageTreeItem.cpp +++ b/src/modules/netinstall/PackageTreeItem.cpp @@ -18,9 +18,9 @@ #include "PackageTreeItem.h" -PackageTreeItem::PackageTreeItem( const ItemData& data, PackageTreeItem* parent ) : - m_data( data ), - m_parentItem( parent ) +PackageTreeItem::PackageTreeItem( const ItemData& data, PackageTreeItem* parent ) + : m_parentItem( parent ) + , m_data( data ) { } PackageTreeItem::PackageTreeItem( const QString packageName, PackageTreeItem* parent ) : diff --git a/src/modules/netinstall/PackageTreeItem.h b/src/modules/netinstall/PackageTreeItem.h index 291def37d..a95a4fe31 100644 --- a/src/modules/netinstall/PackageTreeItem.h +++ b/src/modules/netinstall/PackageTreeItem.h @@ -37,10 +37,10 @@ public: bool isHidden = false; Qt::CheckState selected = Qt::Unchecked; }; - explicit PackageTreeItem( const ItemData& data, PackageTreeItem* parent = 0 ); - explicit PackageTreeItem( const QString packageName, PackageTreeItem* parent = 0 ); - explicit PackageTreeItem( PackageTreeItem* parent = 0 ); - ~PackageTreeItem(); + explicit PackageTreeItem( const ItemData& data, PackageTreeItem* parent = nullptr ); + explicit PackageTreeItem( const QString packageName, PackageTreeItem* parent = nullptr ); + explicit PackageTreeItem( PackageTreeItem* parent = nullptr ); + ~PackageTreeItem() override; void appendChild( PackageTreeItem* child ); PackageTreeItem* child( int row ); diff --git a/src/modules/users/SetPasswordJob.cpp b/src/modules/users/SetPasswordJob.cpp index bf3423347..a077d8cb5 100644 --- a/src/modules/users/SetPasswordJob.cpp +++ b/src/modules/users/SetPasswordJob.cpp @@ -54,7 +54,7 @@ SetPasswordJob::prettyStatusMessage() const /// Returns a modular hashing salt for method 6 (SHA512) with a 16 character random salt. QString -SetPasswordJob::make_salt(size_t length) +SetPasswordJob::make_salt(int length) { Q_ASSERT(length >= 8); Q_ASSERT(length <= 128); @@ -73,7 +73,7 @@ SetPasswordJob::make_salt(size_t length) std::mt19937_64 twister(seed); std::uint64_t next; - size_t current_length = 0; + int current_length = 0; QString salt_string; salt_string.reserve(length + 10); diff --git a/src/modules/users/SetPasswordJob.h b/src/modules/users/SetPasswordJob.h index 45e99a57a..8a53d4941 100644 --- a/src/modules/users/SetPasswordJob.h +++ b/src/modules/users/SetPasswordJob.h @@ -33,7 +33,7 @@ public: QString prettyStatusMessage() const override; Calamares::JobResult exec() override; - static QString make_salt(size_t length); + static QString make_salt(int length); private: QString m_userName; diff --git a/src/modules/users/UsersViewStep.h b/src/modules/users/UsersViewStep.h index ea5d9101b..c7e0f447d 100644 --- a/src/modules/users/UsersViewStep.h +++ b/src/modules/users/UsersViewStep.h @@ -36,7 +36,7 @@ class PLUGINDLLEXPORT UsersViewStep : public Calamares::ViewStep public: explicit UsersViewStep( QObject* parent = nullptr ); - virtual ~UsersViewStep(); + virtual ~UsersViewStep() override; QString prettyName() const override; diff --git a/src/modules/webview/WebViewStep.h b/src/modules/webview/WebViewStep.h index 9d8405a97..5b8a85049 100644 --- a/src/modules/webview/WebViewStep.h +++ b/src/modules/webview/WebViewStep.h @@ -43,7 +43,7 @@ class PLUGINDLLEXPORT WebViewStep : public Calamares::ViewStep public: explicit WebViewStep( QObject* parent = nullptr ); - virtual ~WebViewStep(); + virtual ~WebViewStep() override; QString prettyName() const override; From c9f4bc0cc865e2f97d5a28d38b296877687dfa7f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Sep 2017 22:24:30 +0200 Subject: [PATCH 16/20] Check for crypt(3), also on FreeBSD --- CMakeModules/FindCrypt.cmake | 27 +++++++++++++++++++-------- src/modules/users/CMakeLists.txt | 2 +- src/modules/users/SetPasswordJob.cpp | 4 ++++ 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/CMakeModules/FindCrypt.cmake b/CMakeModules/FindCrypt.cmake index 293228e6f..d17d70178 100644 --- a/CMakeModules/FindCrypt.cmake +++ b/CMakeModules/FindCrypt.cmake @@ -5,19 +5,30 @@ # LIBCRYPT_LIBRARY, the path to libcrypt # LIBCRYPT_FOUND, whether libcrypt was found +if( CMAKE_SYSTEM MATCHES "FreeBSD" ) + # FreeBSD has crypt(3) declared in unistd.h, which lives in + # libc; the libcrypt found here is not used. + find_path( CRYPT_INCLUDE_DIR NAMES unistd.h ) + add_definitions( -DNO_CRYPT_H ) +else() + find_path( CRYPT_INCLUDE_DIR + NAMES crypt.h + HINTS + ${CMAKE_INSTALL_INCLUDEDIR} + NO_CACHE + ) +endif() -find_path( CRYPT_INCLUDE_DIR NAMES crypt.h - HINTS - ${CMAKE_INSTALL_INCLUDEDIR} -) - -find_library( CRYPT_LIBRARIES NAMES crypt +find_library( CRYPT_LIBRARIES + NAMES crypt HINTS ${CMAKE_INSTALL_LIBDIR} ) include( FindPackageHandleStandardArgs ) -find_package_handle_standard_args( Crypt - REQUIRED_VARS CRYPT_LIBRARIES CRYPT_INCLUDE_DIR ) +find_package_handle_standard_args( + Crypt + REQUIRED_VARS CRYPT_LIBRARIES CRYPT_INCLUDE_DIR +) mark_as_advanced( CRYPT_INCLUDE_DIR CRYPT_LIBRARIES ) diff --git a/src/modules/users/CMakeLists.txt b/src/modules/users/CMakeLists.txt index 116da68e4..074118d54 100644 --- a/src/modules/users/CMakeLists.txt +++ b/src/modules/users/CMakeLists.txt @@ -5,7 +5,7 @@ if( ECM_FOUND ) endif() find_package( Qt5 COMPONENTS Core Test REQUIRED ) -find_package( Crypt ) +find_package( Crypt REQUIRED ) include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) diff --git a/src/modules/users/SetPasswordJob.cpp b/src/modules/users/SetPasswordJob.cpp index a077d8cb5..d917e6d5f 100644 --- a/src/modules/users/SetPasswordJob.cpp +++ b/src/modules/users/SetPasswordJob.cpp @@ -27,7 +27,11 @@ #include #include + +#ifndef NO_CRYPT_H #include +#endif +#include SetPasswordJob::SetPasswordJob( const QString& userName, const QString& newPassword ) From 9f1cca5ec785bbc340e846c31b389f36cc6f0233 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 14 Sep 2017 06:20:43 -0400 Subject: [PATCH 17/20] FS: use untranslated name to identify filesystem Resolves issue where 'linuxswap' is translated to 'Linux-Swap', for instance. FileSystem::name() provides a translated name, not an untranslated one. This should move to KPMCore. FIXES #797 --- .../partition/jobs/FillGlobalStorageJob.cpp | 49 ++++++++++++++++++- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/src/modules/partition/jobs/FillGlobalStorageJob.cpp b/src/modules/partition/jobs/FillGlobalStorageJob.cpp index 09eaf232d..f8194f2b3 100644 --- a/src/modules/partition/jobs/FillGlobalStorageJob.cpp +++ b/src/modules/partition/jobs/FillGlobalStorageJob.cpp @@ -76,6 +76,50 @@ getLuksUuid( const QString& path ) return uuid; } +// TODO: this will be available from KPMCore soon +static const char* filesystem_labels[] = { + "unknown", + "extended", + + "ext2", + "ext3", + "ext4", + "linuxswap", + "fat16", + "fat32", + "ntfs", + "reiser", + "reiser4", + "xfs", + "jfs", + "hfs", + "hfsplus", + "ufs", + "unformatted", + "btrfs", + "hpfs", + "luks", + "ocfs2", + "zfs", + "exfat", + "nilfs2", + "lvm2 pv", + "f2fs", + "udf", + "iso9660", +}; + +Q_STATIC_ASSERT_X((sizeof(filesystem_labels) / sizeof(char *)) >= FileSystem::__lastType, "Mismatch in filesystem labels"); + +static QString +untranslatedTypeName(FileSystem::Type t) +{ + + Q_ASSERT( t >= 0 ); + Q_ASSERT( t <= FileSystem::__lastType ); + + return QLatin1String(filesystem_labels[t]); +} static QVariant mapForPartition( Partition* partition, const QString& uuid ) @@ -83,14 +127,15 @@ mapForPartition( Partition* partition, const QString& uuid ) QVariantMap map; map[ "device" ] = partition->partitionPath(); map[ "mountPoint" ] = PartitionInfo::mountPoint( partition ); - map[ "fs" ] = partition->fileSystem().name(); + map[ "fsName" ] = partition->fileSystem().name(); + map[ "fs" ] = untranslatedTypeName( partition->fileSystem().type() ); if ( partition->fileSystem().type() == FileSystem::Luks && dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS() ) map[ "fs" ] = dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS()->name(); map[ "uuid" ] = uuid; cDebug() << partition->partitionPath() << "mtpoint:" << PartitionInfo::mountPoint( partition ) - << "fs:" << map[ "fs" ] + << "fs:" << map[ "fs" ] << '(' << map[ "fsName" ] << ')' << uuid; if ( partition->roles().has( PartitionRole::Luks ) ) From c6297f1db5c47eb08c1e04fe195992663c83238e Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 14 Sep 2017 06:34:07 -0400 Subject: [PATCH 18/20] Clang: warnings-- --- src/libcalamaresui/viewpages/ViewStep.h | 2 +- src/modules/dracutlukscfg/DracutLuksCfgJob.h | 2 +- .../interactiveterminal/InteractiveTerminalViewStep.h | 2 +- src/modules/partition/jobs/CreatePartitionJob.cpp | 7 ++++--- src/modules/partition/jobs/CreatePartitionTableJob.cpp | 2 +- src/modules/partition/jobs/DeletePartitionJob.cpp | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/libcalamaresui/viewpages/ViewStep.h b/src/libcalamaresui/viewpages/ViewStep.h index 2c07dace5..617d64fe1 100644 --- a/src/libcalamaresui/viewpages/ViewStep.h +++ b/src/libcalamaresui/viewpages/ViewStep.h @@ -45,7 +45,7 @@ class UIDLLEXPORT ViewStep : public QObject Q_OBJECT public: explicit ViewStep( QObject* parent = nullptr ); - virtual ~ViewStep(); + virtual ~ViewStep() override; virtual QString prettyName() const = 0; diff --git a/src/modules/dracutlukscfg/DracutLuksCfgJob.h b/src/modules/dracutlukscfg/DracutLuksCfgJob.h index ce981850c..71994e2b6 100644 --- a/src/modules/dracutlukscfg/DracutLuksCfgJob.h +++ b/src/modules/dracutlukscfg/DracutLuksCfgJob.h @@ -34,7 +34,7 @@ class PLUGINDLLEXPORT DracutLuksCfgJob : public Calamares::CppJob public: explicit DracutLuksCfgJob( QObject* parent = nullptr ); - virtual ~DracutLuksCfgJob(); + virtual ~DracutLuksCfgJob() override; QString prettyName() const override; diff --git a/src/modules/interactiveterminal/InteractiveTerminalViewStep.h b/src/modules/interactiveterminal/InteractiveTerminalViewStep.h index 77f7bdf34..025c6cec3 100644 --- a/src/modules/interactiveterminal/InteractiveTerminalViewStep.h +++ b/src/modules/interactiveterminal/InteractiveTerminalViewStep.h @@ -34,7 +34,7 @@ class PLUGINDLLEXPORT InteractiveTerminalViewStep : public Calamares::ViewStep public: explicit InteractiveTerminalViewStep( QObject* parent = nullptr ); - virtual ~InteractiveTerminalViewStep(); + virtual ~InteractiveTerminalViewStep() override; QString prettyName() const override; diff --git a/src/modules/partition/jobs/CreatePartitionJob.cpp b/src/modules/partition/jobs/CreatePartitionJob.cpp index 9fc1b86a2..6c4fc5259 100644 --- a/src/modules/partition/jobs/CreatePartitionJob.cpp +++ b/src/modules/partition/jobs/CreatePartitionJob.cpp @@ -20,6 +20,7 @@ #include "jobs/CreatePartitionJob.h" #include "utils/Logger.h" +#include "utils/Units.h" // KPMcore #include @@ -47,7 +48,7 @@ CreatePartitionJob::prettyName() const { return tr( "Create new %2MB partition on %4 (%3) with file system %1." ) .arg( m_partition->fileSystem().name() ) - .arg( m_partition->capacity() / 1024 / 1024 ) + .arg( CalamaresUtils::BytesToMiB( m_partition->capacity() ) .arg( m_device->name() ) .arg( m_device->deviceNode() ); } @@ -59,7 +60,7 @@ CreatePartitionJob::prettyDescription() const return tr( "Create new %2MB partition on %4 " "(%3) with file system %1." ) .arg( m_partition->fileSystem().name() ) - .arg( m_partition->capacity() / 1024 / 1024 ) + .arg( CalamaresUtils::BytesToMiB( m_partition->capacity() ) .arg( m_device->name() ) .arg( m_device->deviceNode() ); } @@ -79,7 +80,7 @@ CreatePartitionJob::exec() int step = 0; const qreal stepCount = 4; - Report report( 0 ); + Report report( nullptr ); QString message = tr( "The installer failed to create partition on disk '%1'." ).arg( m_device->name() ); progress( step++ / stepCount ); diff --git a/src/modules/partition/jobs/CreatePartitionTableJob.cpp b/src/modules/partition/jobs/CreatePartitionTableJob.cpp index 5a0c4cd66..eaa2fe712 100644 --- a/src/modules/partition/jobs/CreatePartitionTableJob.cpp +++ b/src/modules/partition/jobs/CreatePartitionTableJob.cpp @@ -72,7 +72,7 @@ CreatePartitionTableJob::prettyStatusMessage() const Calamares::JobResult CreatePartitionTableJob::exec() { - Report report( 0 ); + Report report( nullptr ); QString message = tr( "The installer failed to create a partition table on %1." ).arg( m_device->name() ); CoreBackend* backend = CoreBackendManager::self()->backend(); diff --git a/src/modules/partition/jobs/DeletePartitionJob.cpp b/src/modules/partition/jobs/DeletePartitionJob.cpp index 0aafc542e..43f2d94c6 100644 --- a/src/modules/partition/jobs/DeletePartitionJob.cpp +++ b/src/modules/partition/jobs/DeletePartitionJob.cpp @@ -63,7 +63,7 @@ DeletePartitionJob::prettyStatusMessage() const Calamares::JobResult DeletePartitionJob::exec() { - Report report( 0 ); + Report report( nullptr ); QString message = tr( "The installer failed to delete partition %1." ).arg( m_partition->devicePath() ); if ( m_device->deviceNode() != m_partition->devicePath() ) From 342b819a1d6f5145f6f451e0921d9e01d902dc07 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 14 Sep 2017 06:59:34 -0400 Subject: [PATCH 19/20] Fix build (warnings--, but breakage++ is not good) --- src/modules/partition/jobs/CreatePartitionJob.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/partition/jobs/CreatePartitionJob.cpp b/src/modules/partition/jobs/CreatePartitionJob.cpp index 6c4fc5259..cff4ae1cf 100644 --- a/src/modules/partition/jobs/CreatePartitionJob.cpp +++ b/src/modules/partition/jobs/CreatePartitionJob.cpp @@ -48,7 +48,7 @@ CreatePartitionJob::prettyName() const { return tr( "Create new %2MB partition on %4 (%3) with file system %1." ) .arg( m_partition->fileSystem().name() ) - .arg( CalamaresUtils::BytesToMiB( m_partition->capacity() ) + .arg( CalamaresUtils::BytesToMiB( m_partition->capacity() ) ) .arg( m_device->name() ) .arg( m_device->deviceNode() ); } @@ -60,7 +60,7 @@ CreatePartitionJob::prettyDescription() const return tr( "Create new %2MB partition on %4 " "(%3) with file system %1." ) .arg( m_partition->fileSystem().name() ) - .arg( CalamaresUtils::BytesToMiB( m_partition->capacity() ) + .arg( CalamaresUtils::BytesToMiB( m_partition->capacity() ) ) .arg( m_device->name() ) .arg( m_device->deviceNode() ); } From ca60a7fc164c0b29b939dda8e38374e7ebab32e0 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 14 Sep 2017 07:02:24 -0400 Subject: [PATCH 20/20] Clang: warnings-- --- src/modules/partition/core/DeviceModel.h | 4 ++-- src/modules/partition/core/PartitionModel.h | 2 +- src/modules/partition/gui/PartitionBarsView.h | 2 +- src/modules/partition/gui/PartitionLabelsView.h | 2 +- src/modules/partition/gui/PartitionViewStep.h | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/modules/partition/core/DeviceModel.h b/src/modules/partition/core/DeviceModel.h index 21c6bd939..5c07586e0 100644 --- a/src/modules/partition/core/DeviceModel.h +++ b/src/modules/partition/core/DeviceModel.h @@ -32,8 +32,8 @@ class DeviceModel : public QAbstractListModel { Q_OBJECT public: - DeviceModel( QObject* parent = 0 ); - ~DeviceModel(); + DeviceModel( QObject* parent = nullptr ); + ~DeviceModel() override; /** * Init the model with the list of devices. Does *not* take ownership of the diff --git a/src/modules/partition/core/PartitionModel.h b/src/modules/partition/core/PartitionModel.h index c792058e7..7437efa79 100644 --- a/src/modules/partition/core/PartitionModel.h +++ b/src/modules/partition/core/PartitionModel.h @@ -90,7 +90,7 @@ public: ColumnCount // Must remain last }; - PartitionModel( QObject* parent = 0 ); + PartitionModel( QObject* parent = nullptr ); /** * device must remain alive for the life of PartitionModel */ diff --git a/src/modules/partition/gui/PartitionBarsView.h b/src/modules/partition/gui/PartitionBarsView.h index 002d2c943..ccdb5d36a 100644 --- a/src/modules/partition/gui/PartitionBarsView.h +++ b/src/modules/partition/gui/PartitionBarsView.h @@ -42,7 +42,7 @@ public: }; explicit PartitionBarsView( QWidget* parent = nullptr ); - virtual ~PartitionBarsView(); + virtual ~PartitionBarsView() override; void setNestedPartitionsMode( NestedPartitionsMode mode ); diff --git a/src/modules/partition/gui/PartitionLabelsView.h b/src/modules/partition/gui/PartitionLabelsView.h index c5646a417..363d54cc7 100644 --- a/src/modules/partition/gui/PartitionLabelsView.h +++ b/src/modules/partition/gui/PartitionLabelsView.h @@ -36,7 +36,7 @@ class PartitionLabelsView : public QAbstractItemView Q_OBJECT public: explicit PartitionLabelsView( QWidget* parent = nullptr ); - virtual ~PartitionLabelsView(); + virtual ~PartitionLabelsView() override; QSize minimumSizeHint() const override; diff --git a/src/modules/partition/gui/PartitionViewStep.h b/src/modules/partition/gui/PartitionViewStep.h index 7f31a3d1b..c1217c5a2 100644 --- a/src/modules/partition/gui/PartitionViewStep.h +++ b/src/modules/partition/gui/PartitionViewStep.h @@ -41,8 +41,8 @@ class PLUGINDLLEXPORT PartitionViewStep : public Calamares::ViewStep Q_OBJECT public: - explicit PartitionViewStep( QObject* parent = 0 ); - virtual ~PartitionViewStep(); + explicit PartitionViewStep( QObject* parent = nullptr ); + virtual ~PartitionViewStep() override; QString prettyName() const override; QWidget* createSummaryWidget() const override;