From 2e80ab98d72d7752f0aabc02eae1ffc8ab49be85 Mon Sep 17 00:00:00 2001 From: Gabriel Craciunescu Date: Mon, 30 Oct 2017 18:49:03 +0100 Subject: [PATCH 01/14] locale.conf: explain what all the settings are about --- src/modules/locale/locale.conf | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/modules/locale/locale.conf b/src/modules/locale/locale.conf index 824c8abeb..fd8e2ba04 100644 --- a/src/modules/locale/locale.conf +++ b/src/modules/locale/locale.conf @@ -1,7 +1,28 @@ --- +# This settings are used to set your default system time zone. +# Time zones are usually located under /usr/share/zoneinfo and +# provided by the 'tzdata' package of your Distribution. +# +# Distributions using systemd can list available +# time zones by using the timedatectl command. +# timedatectl list-timezones region: "America" zone: "New_York" -# GeoIP settings. Leave commented out to disable GeoIP. -#localeGenPath: "/etc/locale.gen" + +# System locales are detected in the following order: +# +# /usr/share/i18n/SUPPORTED +# localeGenPath ( when set ) +# /etc/locale.gen +# 'locale -a' output +# Enable only when your Distribution is using an +# custom path for locale.gen +#localeGenPath: "PATH_TO/locale.gen" + +# GeoIP based Language settings: +# GeoIP need an working Internet connecion. +# This can be managed from welcome.conf by adding +# internet to the list of required conditions. +# Leave commented out to disable GeoIP. #geoipUrl: "freegeoip.net" From fc53438be973591a433bdaf48442ed3e5f0d08bb Mon Sep 17 00:00:00 2001 From: Gabriel Craciunescu Date: Mon, 30 Oct 2017 19:21:51 +0100 Subject: [PATCH 02/14] locale.conf: fix localeGenPath comment --- src/modules/locale/locale.conf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/modules/locale/locale.conf b/src/modules/locale/locale.conf index fd8e2ba04..fdff51721 100644 --- a/src/modules/locale/locale.conf +++ b/src/modules/locale/locale.conf @@ -13,8 +13,7 @@ zone: "New_York" # System locales are detected in the following order: # # /usr/share/i18n/SUPPORTED -# localeGenPath ( when set ) -# /etc/locale.gen +# localeGenPath (defaults to /etc/locale.gen if not set) # 'locale -a' output # Enable only when your Distribution is using an # custom path for locale.gen From 35f5612ec1d2fa27235ad5a1d621e82e8c5a82ec Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 1 Nov 2017 11:07:18 +0100 Subject: [PATCH 03/14] [locale] Fix GeoIP (reported by demm, crazy) - data has already been read, don't try to read more from the QNM reply - regression introduced in 7e25909e --- src/modules/locale/LocaleViewStep.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/locale/LocaleViewStep.cpp b/src/modules/locale/LocaleViewStep.cpp index 4b4219751..73efc266f 100644 --- a/src/modules/locale/LocaleViewStep.cpp +++ b/src/modules/locale/LocaleViewStep.cpp @@ -120,7 +120,7 @@ LocaleViewStep::fetchGeoIpTimezone() try { - YAML::Node doc = YAML::Load( reply->readAll() ); + YAML::Node doc = YAML::Load( data ); QVariant var = CalamaresUtils::yamlToVariant( doc ); if ( !var.isNull() && From eed207ae2e7417abb073e9c952197e4b8470febf Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 2 Nov 2017 12:38:36 +0100 Subject: [PATCH 04/14] CMake: ensure configuration-test can #include yamlcpp headers --- src/modules/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt index d48ecd29f..680a9c12c 100644 --- a/src/modules/CMakeLists.txt +++ b/src/modules/CMakeLists.txt @@ -3,6 +3,7 @@ include( CMakeColors ) if( BUILD_TESTING ) add_executable( test_conf test_conf.cpp ) target_link_libraries( test_conf ${YAMLCPP_LIBRARY} ) + target_include_directories( test_conf PUBLIC ${YAMLCPP_INCLUDE_DIR} ) endif() file( GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*" ) From 2d31e987c0607b99412aa7935ed7438ead86fb29 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 3 Nov 2017 10:10:37 -0400 Subject: [PATCH 05/14] [libcalamaresui] Unrelated typedef for JobList --- src/libcalamares/JobQueue.cpp | 6 +++--- src/libcalamares/JobQueue.h | 6 +++--- src/libcalamares/Typedefs.h | 2 ++ src/libcalamaresui/ExecutionViewStep.cpp | 4 ++-- src/libcalamaresui/ExecutionViewStep.h | 2 +- src/libcalamaresui/modulesystem/CppJobModule.cpp | 4 ++-- src/libcalamaresui/modulesystem/CppJobModule.h | 2 +- src/libcalamaresui/modulesystem/Module.h | 4 ++-- src/libcalamaresui/modulesystem/ProcessJobModule.cpp | 4 ++-- src/libcalamaresui/modulesystem/ProcessJobModule.h | 2 +- src/libcalamaresui/modulesystem/PythonJobModule.cpp | 4 ++-- src/libcalamaresui/modulesystem/PythonJobModule.h | 2 +- src/libcalamaresui/modulesystem/PythonQtViewModule.cpp | 2 +- src/libcalamaresui/modulesystem/PythonQtViewModule.h | 2 +- src/libcalamaresui/modulesystem/ViewModule.cpp | 2 +- src/libcalamaresui/modulesystem/ViewModule.h | 2 +- src/libcalamaresui/utils/DebugWindow.cpp | 2 +- src/libcalamaresui/viewpages/PythonQtViewStep.cpp | 4 ++-- src/libcalamaresui/viewpages/PythonQtViewStep.h | 2 +- src/libcalamaresui/viewpages/ViewStep.h | 2 +- 20 files changed, 31 insertions(+), 29 deletions(-) diff --git a/src/libcalamares/JobQueue.cpp b/src/libcalamares/JobQueue.cpp index a1badcf86..86e33a0cd 100644 --- a/src/libcalamares/JobQueue.cpp +++ b/src/libcalamares/JobQueue.cpp @@ -46,7 +46,7 @@ public: #endif } - void setJobs( const QList< job_ptr >& jobs ) + void setJobs( const JobList& jobs ) { m_jobs = jobs; } @@ -73,7 +73,7 @@ public: } private: - QList< job_ptr > m_jobs; + JobList m_jobs; JobQueue* m_queue; int m_jobIndex; @@ -164,7 +164,7 @@ JobQueue::enqueue( const job_ptr& job ) void -JobQueue::enqueue( const QList< job_ptr >& jobs ) +JobQueue::enqueue( const JobList& jobs ) { Q_ASSERT( !m_thread->isRunning() ); m_jobs.append( jobs ); diff --git a/src/libcalamares/JobQueue.h b/src/libcalamares/JobQueue.h index 903783d53..2c1b85ed5 100644 --- a/src/libcalamares/JobQueue.h +++ b/src/libcalamares/JobQueue.h @@ -42,11 +42,11 @@ public: GlobalStorage* globalStorage() const; void enqueue( const job_ptr& job ); - void enqueue( const QList< job_ptr >& jobs ); + void enqueue( const JobList& jobs ); void start(); signals: - void queueChanged( const QList< job_ptr >& jobs ); + void queueChanged( const JobList& jobs ); void progress( qreal percent, const QString& prettyName ); void finished(); void failed( const QString& message, const QString& details ); @@ -54,7 +54,7 @@ signals: private: static JobQueue* s_instance; - QList< job_ptr > m_jobs; + JobList m_jobs; JobThread* m_thread; GlobalStorage* m_storage; }; diff --git a/src/libcalamares/Typedefs.h b/src/libcalamares/Typedefs.h index 8aefcd6af..4ff28e3d7 100644 --- a/src/libcalamares/Typedefs.h +++ b/src/libcalamares/Typedefs.h @@ -19,6 +19,7 @@ #ifndef TYPEDEFS_H #define TYPEDEFS_H +#include #include namespace Calamares @@ -26,6 +27,7 @@ namespace Calamares class Job; typedef QSharedPointer< Job > job_ptr; +using JobList = QList< job_ptr >; enum ModuleAction : char { diff --git a/src/libcalamaresui/ExecutionViewStep.cpp b/src/libcalamaresui/ExecutionViewStep.cpp index 37c2318d0..4c813bbca 100644 --- a/src/libcalamaresui/ExecutionViewStep.cpp +++ b/src/libcalamaresui/ExecutionViewStep.cpp @@ -148,10 +148,10 @@ ExecutionViewStep::onActivate() } -QList< Calamares::job_ptr > +JobList ExecutionViewStep::jobs() const { - return QList< Calamares::job_ptr >(); + return JobList(); } diff --git a/src/libcalamaresui/ExecutionViewStep.h b/src/libcalamaresui/ExecutionViewStep.h index 3101cf479..05b26a436 100644 --- a/src/libcalamaresui/ExecutionViewStep.h +++ b/src/libcalamaresui/ExecutionViewStep.h @@ -52,7 +52,7 @@ public: void onActivate() override; - QList< job_ptr > jobs() const override; + JobList jobs() const override; void appendJobModuleInstanceKey( const QString& instanceKey ); diff --git a/src/libcalamaresui/modulesystem/CppJobModule.cpp b/src/libcalamaresui/modulesystem/CppJobModule.cpp index 6ff846027..e6240b4c9 100644 --- a/src/libcalamaresui/modulesystem/CppJobModule.cpp +++ b/src/libcalamaresui/modulesystem/CppJobModule.cpp @@ -75,10 +75,10 @@ CppJobModule::loadSelf() } -QList< job_ptr > +JobList CppJobModule::jobs() const { - return QList< job_ptr >() << m_job; + return JobList() << m_job; } diff --git a/src/libcalamaresui/modulesystem/CppJobModule.h b/src/libcalamaresui/modulesystem/CppJobModule.h index 46d27bf8b..89cf19e06 100644 --- a/src/libcalamaresui/modulesystem/CppJobModule.h +++ b/src/libcalamaresui/modulesystem/CppJobModule.h @@ -36,7 +36,7 @@ public: Interface interface() const override; void loadSelf() override; - QList< job_ptr > jobs() const override; + JobList jobs() const override; protected: void initFrom( const QVariantMap& moduleDescriptor ) override; diff --git a/src/libcalamaresui/modulesystem/Module.h b/src/libcalamaresui/modulesystem/Module.h index 5f756938f..71390fa83 100644 --- a/src/libcalamaresui/modulesystem/Module.h +++ b/src/libcalamaresui/modulesystem/Module.h @@ -70,7 +70,6 @@ public: ProcessInterface, PythonQtInterface }; - virtual ~Module(); /** * @brief fromDescriptor creates a new Module object of the correct type. @@ -84,6 +83,7 @@ public: const QString& instanceId, const QString& configFileName, const QString& moduleDirectory ); + virtual ~Module(); /** * @brief name returns the name of this module. @@ -159,7 +159,7 @@ public: * @brief jobs returns any jobs exposed by this module. * @return a list of jobs (can be empty). */ - virtual QList< job_ptr > jobs() const = 0; + virtual JobList jobs() const = 0; /** * @brief configurationMap returns the contents of the configuration file for diff --git a/src/libcalamaresui/modulesystem/ProcessJobModule.cpp b/src/libcalamaresui/modulesystem/ProcessJobModule.cpp index aefcbf6f0..989385a18 100644 --- a/src/libcalamaresui/modulesystem/ProcessJobModule.cpp +++ b/src/libcalamaresui/modulesystem/ProcessJobModule.cpp @@ -53,10 +53,10 @@ ProcessJobModule::loadSelf() } -QList< job_ptr > +JobList ProcessJobModule::jobs() const { - return QList< job_ptr >() << m_job; + return JobList() << m_job; } diff --git a/src/libcalamaresui/modulesystem/ProcessJobModule.h b/src/libcalamaresui/modulesystem/ProcessJobModule.h index af9a46bd5..d2c8ba905 100644 --- a/src/libcalamaresui/modulesystem/ProcessJobModule.h +++ b/src/libcalamaresui/modulesystem/ProcessJobModule.h @@ -34,7 +34,7 @@ public: Interface interface() const override; void loadSelf() override; - QList< job_ptr > jobs() const override; + JobList jobs() const override; protected: void initFrom( const QVariantMap& moduleDescriptor ) override; diff --git a/src/libcalamaresui/modulesystem/PythonJobModule.cpp b/src/libcalamaresui/modulesystem/PythonJobModule.cpp index 544f27e1f..3c0a8234e 100644 --- a/src/libcalamaresui/modulesystem/PythonJobModule.cpp +++ b/src/libcalamaresui/modulesystem/PythonJobModule.cpp @@ -53,10 +53,10 @@ PythonJobModule::loadSelf() } -QList< job_ptr > +JobList PythonJobModule::jobs() const { - return QList< job_ptr >() << m_job; + return JobList() << m_job; } diff --git a/src/libcalamaresui/modulesystem/PythonJobModule.h b/src/libcalamaresui/modulesystem/PythonJobModule.h index c82137cb8..b5ae34c07 100644 --- a/src/libcalamaresui/modulesystem/PythonJobModule.h +++ b/src/libcalamaresui/modulesystem/PythonJobModule.h @@ -32,7 +32,7 @@ public: Interface interface() const override; void loadSelf() override; - QList< job_ptr > jobs() const override; + JobList jobs() const override; protected: void initFrom( const QVariantMap& moduleDescriptor ) override; diff --git a/src/libcalamaresui/modulesystem/PythonQtViewModule.cpp b/src/libcalamaresui/modulesystem/PythonQtViewModule.cpp index 96a1ce71c..f4fae4398 100644 --- a/src/libcalamaresui/modulesystem/PythonQtViewModule.cpp +++ b/src/libcalamaresui/modulesystem/PythonQtViewModule.cpp @@ -171,7 +171,7 @@ PythonQtViewModule::loadSelf() } -QList< job_ptr > +JobList PythonQtViewModule::jobs() const { return m_viewStep->jobs(); diff --git a/src/libcalamaresui/modulesystem/PythonQtViewModule.h b/src/libcalamaresui/modulesystem/PythonQtViewModule.h index ba18cfac6..06de7c6e9 100644 --- a/src/libcalamaresui/modulesystem/PythonQtViewModule.h +++ b/src/libcalamaresui/modulesystem/PythonQtViewModule.h @@ -33,7 +33,7 @@ public: Interface interface() const override; void loadSelf() override; - QList< job_ptr > jobs() const override; + JobList jobs() const override; protected: void initFrom( const QVariantMap& moduleDescriptor ) override; diff --git a/src/libcalamaresui/modulesystem/ViewModule.cpp b/src/libcalamaresui/modulesystem/ViewModule.cpp index ba054a8b1..419cad611 100644 --- a/src/libcalamaresui/modulesystem/ViewModule.cpp +++ b/src/libcalamaresui/modulesystem/ViewModule.cpp @@ -76,7 +76,7 @@ ViewModule::loadSelf() } -QList< job_ptr > +JobList ViewModule::jobs() const { return m_viewStep->jobs(); diff --git a/src/libcalamaresui/modulesystem/ViewModule.h b/src/libcalamaresui/modulesystem/ViewModule.h index 6b2e381a2..323315947 100644 --- a/src/libcalamaresui/modulesystem/ViewModule.h +++ b/src/libcalamaresui/modulesystem/ViewModule.h @@ -37,7 +37,7 @@ public: Interface interface() const override; void loadSelf() override; - QList< job_ptr > jobs() const override; + JobList jobs() const override; protected: void initFrom( const QVariantMap& moduleDescriptor ) override; diff --git a/src/libcalamaresui/utils/DebugWindow.cpp b/src/libcalamaresui/utils/DebugWindow.cpp index d4bc74f65..e00c2097b 100644 --- a/src/libcalamaresui/utils/DebugWindow.cpp +++ b/src/libcalamaresui/utils/DebugWindow.cpp @@ -62,7 +62,7 @@ DebugWindow::DebugWindow() // JobQueue page jobQueueText->setReadOnly( true ); connect( JobQueue::instance(), &JobQueue::queueChanged, - this, [ this ]( const QList< Calamares::job_ptr >& jobs ) + this, [ this ]( const JobList& jobs ) { QStringList text; for ( const auto &job : jobs ) diff --git a/src/libcalamaresui/viewpages/PythonQtViewStep.cpp b/src/libcalamaresui/viewpages/PythonQtViewStep.cpp index 78881e337..f5f84eadd 100644 --- a/src/libcalamaresui/viewpages/PythonQtViewStep.cpp +++ b/src/libcalamaresui/viewpages/PythonQtViewStep.cpp @@ -159,10 +159,10 @@ PythonQtViewStep::isAtEnd() const } -QList< Calamares::job_ptr > +JobList PythonQtViewStep::jobs() const { - QList< Calamares::job_ptr > jobs; + JobList jobs; PythonQtObjectPtr jobsCallable = PythonQt::self()->lookupCallable( m_obj, "jobs" ); if ( jobsCallable.isNull() ) diff --git a/src/libcalamaresui/viewpages/PythonQtViewStep.h b/src/libcalamaresui/viewpages/PythonQtViewStep.h index e1f8bd1e5..594af2817 100644 --- a/src/libcalamaresui/viewpages/PythonQtViewStep.h +++ b/src/libcalamaresui/viewpages/PythonQtViewStep.h @@ -46,7 +46,7 @@ public: bool isAtBeginning() const override; bool isAtEnd() const override; - QList< Calamares::job_ptr > jobs() const override; + JobList jobs() const override; void setConfigurationMap( const QVariantMap& configurationMap ) override; diff --git a/src/libcalamaresui/viewpages/ViewStep.h b/src/libcalamaresui/viewpages/ViewStep.h index 617d64fe1..f69f872e2 100644 --- a/src/libcalamaresui/viewpages/ViewStep.h +++ b/src/libcalamaresui/viewpages/ViewStep.h @@ -91,7 +91,7 @@ public: */ virtual void onLeave(); - virtual QList< job_ptr > jobs() const = 0; + virtual JobList jobs() const = 0; void setModuleInstanceKey( const QString& instanceKey ); QString moduleInstanceKey() const From f3eb557fdbdc8104562774ebf388cce82789edf7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 3 Nov 2017 11:01:55 -0400 Subject: [PATCH 06/14] [libcalamares] Provide some convenience functions for extracting configuration data --- src/libcalamares/utils/CalamaresUtils.cpp | 30 +++++++++++++++++++++++ src/libcalamares/utils/CalamaresUtils.h | 16 ++++++++++++ 2 files changed, 46 insertions(+) diff --git a/src/libcalamares/utils/CalamaresUtils.cpp b/src/libcalamares/utils/CalamaresUtils.cpp index db748ec94..ae3a14497 100644 --- a/src/libcalamares/utils/CalamaresUtils.cpp +++ b/src/libcalamares/utils/CalamaresUtils.cpp @@ -326,5 +326,35 @@ crash() *a = 1; } +bool +getBool( const QVariantMap& map, const QString& key, bool d ) +{ + bool result = d; + if ( map.contains( key ) ) + { + auto v = map.value( key ); + if ( v.type() == QVariant::Bool ) + result = v.toBool(); + } + + return result; +} + +QVariantMap +getSubMap( const QVariantMap& map, const QString& key, bool& success ) +{ + success = false; + + if ( map.contains( key ) ) + { + auto v = map.value( key ); + if ( v.type() == QVariant::Map ) + { + success = true; + return v.toMap(); + } + } + return QVariantMap(); +} } diff --git a/src/libcalamares/utils/CalamaresUtils.h b/src/libcalamares/utils/CalamaresUtils.h index 66650ff57..651c6746a 100644 --- a/src/libcalamares/utils/CalamaresUtils.h +++ b/src/libcalamares/utils/CalamaresUtils.h @@ -97,6 +97,22 @@ namespace CalamaresUtils * @brief crash makes Calamares crash immediately. */ DLLEXPORT void crash(); + + /** + * Get a bool value from a mapping with a given key; returns the default + * if no value is stored in the map. + */ + DLLEXPORT bool getBool( const QVariantMap& map, const QString& key, bool d ); + + /** + * Returns a sub-map (i.e. a nested map) from the given mapping with the + * given key. @p success is set to true if the @p key exists + * in @p map and converts to a map, false otherwise. + * + * Returns an empty map if there is no such key or it is not a map-value. + * (e.g. if @p success is false). + */ + DLLEXPORT QVariantMap getSubMap( const QVariantMap& map, const QString& key, bool& success ); } #endif // CALAMARESUTILS_H From 970b6fcb19496eac5a89da31f966d68f8b28a108 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 3 Nov 2017 12:48:16 -0400 Subject: [PATCH 07/14] CMake: find PythonQt better - replace weird distinction between 3.0 and 3.2 by searching once - prefer 3.2 - also look for suffixed versions (PythonXY) besides the Python3 suffix FIXES #857 --- CMakeModules/FindPythonQt.cmake | 74 ++++++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 10 deletions(-) diff --git a/CMakeModules/FindPythonQt.cmake b/CMakeModules/FindPythonQt.cmake index d016b57b1..0d886902d 100644 --- a/CMakeModules/FindPythonQt.cmake +++ b/CMakeModules/FindPythonQt.cmake @@ -9,6 +9,13 @@ if(NOT PYTHONLIBS_FOUND) message(FATAL_ERROR "error: Python is required to build PythonQt") endif() +string(REGEX REPLACE + "^([0-9][0-9]*)\.([0-9][0-9]*)" + "\\1" + PYTHONLIBS_MAJMIN + ${PYTHONLIBS_VERSION_STRING} +) + if(NOT EXISTS "${PYTHONQT_INSTALL_DIR}") find_path(PYTHONQT_INSTALL_DIR include/PythonQt/PythonQt.h DOC "Directory where PythonQt was installed.") endif() @@ -22,17 +29,58 @@ find_path(PYTHONQT_INCLUDE_DIR PythonQt.h "${PYTHONQT_INSTALL_DIR}/src" DOC "Path to the PythonQt include directory") -# Minimum v3.1 is needed -find_library(PYTHONQT_LIBRARY_RELEASE PythonQt PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.") -find_library(PYTHONQT_LIBRARY_DEBUG NAMES PythonQt${CTK_CMAKE_DEBUG_POSTFIX} PythonQt${CMAKE_DEBUG_POSTFIX} PythonQt PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.") -find_library(PYTHONQT_QTALL_LIBRARY_RELEASE PythonQt_QtAll PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.") -find_library(PYTHONQT_QTALL_LIBRARY_DEBUG NAMES PythonQt_QtAll${CTK_CMAKE_DEBUG_POSTFIX} PythonQt_QtAll${CMAKE_DEBUG_POSTFIX} PythonQt_QtAll PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.") +if ( NOT PythonQt_FIND_QUIETLY ) + message( STATUS "Searching for PythonQt (Python ${PYTHONLIBS_MAJMIN}) .." ) + if ( PYTHONQT_INCLUDE_DIR ) + message( STATUS " .. found include ${PYTHONQT_INCLUDE_DIR}" ) + endif() +endif() -# Also check for v3.2+ -find_library(PYTHONQT_LIBRARY_RELEASE PythonQt-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.") -find_library(PYTHONQT_LIBRARY_DEBUG NAMES PythonQt-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX} PythonQt-Qt5-Python3${CMAKE_DEBUG_POSTFIX} PythonQt-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.") -find_library(PYTHONQT_QTALL_LIBRARY_RELEASE PythonQt_QtAll-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.") -find_library(PYTHONQT_QTALL_LIBRARY_DEBUG NAMES PythonQt_QtAll-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX} PythonQt_QtAll-Qt5-Python3${CMAKE_DEBUG_POSTFIX} PythonQt_QtAll-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.") +# Minimum v3.1 is needed +find_library(PYTHONQT_LIBRARY_RELEASE + NAMES + PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN} + PythonQt-Qt5-Python3 + PythonQt + PATHS "${PYTHONQT_INSTALL_DIR}/lib" + DOC "The PythonQt library." +) +find_library(PYTHONQT_LIBRARY_DEBUG + NAMES + PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN}JMIN${CTK_CMAKE_DEBUG_POSTFIX} + PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN}${CMAKE_DEBUG_POSTFIX} + PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN} + PythonQt-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX} + PythonQt-Qt5-Python3${CMAKE_DEBUG_POSTFIX} + PythonQt-Qt5-Python3 + PythonQt${CTK_CMAKE_DEBUG_POSTFIX} + PythonQt${CMAKE_DEBUG_POSTFIX} + PythonQt + PATHS "${PYTHONQT_INSTALL_DIR}/lib" + DOC "The PythonQt library (debug build)." +) +find_library(PYTHONQT_QTALL_LIBRARY_RELEASE + NAMES + PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN} + PythonQt_QtAll-Qt5-Python3 + PythonQt_QtAll + PATHS "${PYTHONQT_INSTALL_DIR}/lib" + DOC "Full Qt bindings for the PythonQt library." +) +find_library(PYTHONQT_QTALL_LIBRARY_DEBUG + NAMES + PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN}${CTK_CMAKE_DEBUG_POSTFIX} + PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN}${CMAKE_DEBUG_POSTFIX} + PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN} + PythonQt_QtAll-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX} + PythonQt_QtAll-Qt5-Python3${CMAKE_DEBUG_POSTFIX} + PythonQt_QtAll-Qt5-Python3 + PythonQt_QtAll${CTK_CMAKE_DEBUG_POSTFIX} + PythonQt_QtAll${CMAKE_DEBUG_POSTFIX} + PythonQt_QtAll + PATHS "${PYTHONQT_INSTALL_DIR}/lib" + DOC "Full Qt bindings for the PythonQt library (debug build)." +) set(PYTHONQT_LIBRARY) if(PYTHONQT_LIBRARY_RELEASE) @@ -50,6 +98,12 @@ if(PYTHONQT_QTALL_LIBRARY_DEBUG) list(APPEND PYTHONQT_QTALL_LIBRARY debug ${PYTHONQT_QTALL_LIBRARY_DEBUG}) endif() +if ( NOT PythonQt_FIND_QUIETLY ) + message( STATUS " .. found library ${PYTHONQT_LIBRARY}" ) + message( STATUS " .. found qtall ${PYTHONQT_QTALL_LIBRARY}" ) +endif() + + mark_as_advanced(PYTHONQT_INSTALL_DIR) mark_as_advanced(PYTHONQT_INCLUDE_DIR) mark_as_advanced(PYTHONQT_LIBRARY_RELEASE) From ee0b3b85dc2f1f4991d82152b2e15343940b31c3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 6 Nov 2017 05:14:42 -0500 Subject: [PATCH 08/14] [netinstall] Improve 'next' button handling - Document netinstall.conf a little, - Add setting *required* which influences whether next is enabled or not in case of missing or corrupt data, - Enable *next* button only once some (any!) data is received. This can be used to disallow stepping past the netinstall step when there is no data (e.g. internet has failed between the welcome page and the netinstall page). --- src/modules/netinstall/NetInstallPage.cpp | 20 ++++++++++--------- src/modules/netinstall/NetInstallPage.h | 9 +++++++-- src/modules/netinstall/NetInstallViewStep.cpp | 17 ++++++++++++++-- src/modules/netinstall/NetInstallViewStep.h | 3 +++ src/modules/netinstall/netinstall.conf | 11 ++++++++++ 5 files changed, 47 insertions(+), 13 deletions(-) diff --git a/src/modules/netinstall/NetInstallPage.cpp b/src/modules/netinstall/NetInstallPage.cpp index 030537732..13c0da336 100644 --- a/src/modules/netinstall/NetInstallPage.cpp +++ b/src/modules/netinstall/NetInstallPage.cpp @@ -57,14 +57,6 @@ NetInstallPage::NetInstallPage( QWidget* parent ) ui->setupUi( this ); } -bool -NetInstallPage::isReady() -{ - // nothing to wait for, the data are immediately ready - // if the user does not select any group nothing is installed - return true; -} - bool NetInstallPage::readGroups( const QByteArray& yamlData ) { @@ -92,10 +84,13 @@ NetInstallPage::readGroups( const QByteArray& yamlData ) void NetInstallPage::dataIsHere( QNetworkReply* reply ) { + // If m_required is *false* then we still say we're ready + // even if the reply is corrupt or missing. if ( reply->error() != QNetworkReply::NoError ) { cDebug() << reply->errorString(); ui->netinst_status->setText( tr( "Network Installation. (Disabled: Unable to fetch package lists, check your network connection)" ) ); + emit checkReady( !m_required ); return; } @@ -104,6 +99,7 @@ NetInstallPage::dataIsHere( QNetworkReply* reply ) cDebug() << "Netinstall groups data was received, but invalid."; ui->netinst_status->setText( tr( "Network Installation. (Disabled: Unable to fetch package lists, check your network connection)" ) ); reply->deleteLater(); + emit checkReady( !m_required ); return; } @@ -112,7 +108,7 @@ NetInstallPage::dataIsHere( QNetworkReply* reply ) ui->groupswidget->header()->setSectionResizeMode( 1, QHeaderView::Stretch ); reply->deleteLater(); - emit checkReady( isReady() ); + emit checkReady( true ); } QList NetInstallPage::selectedPackages() const @@ -139,6 +135,12 @@ void NetInstallPage::loadGroupList() m_networkManager.get( request ); } +void NetInstallPage::setRequired(bool b) +{ + m_required = b; +} + + void NetInstallPage::onActivate() { ui->groupswidget->setFocus(); diff --git a/src/modules/netinstall/NetInstallPage.h b/src/modules/netinstall/NetInstallPage.h index 423c16b8e..f6939cea6 100644 --- a/src/modules/netinstall/NetInstallPage.h +++ b/src/modules/netinstall/NetInstallPage.h @@ -46,13 +46,17 @@ public: void onActivate(); - bool isReady(); - // Retrieves the groups, with name, description and packages, from // the remote URL configured in the settings. Assumes the URL is already // in the global storage. This should be called before displaying the page. void loadGroupList(); + // Sets the "required" state of netinstall data. Influences whether + // corrupt or unavailable data causes checkReady() to be emitted + // true (not-required) or false. + void setRequired( bool ); + bool getRequired() const { return m_required; } + // Returns the list of packages belonging to groups that are // selected in the view in this given moment. No data is cached here, so // this function does not have constant time. @@ -76,6 +80,7 @@ private: QNetworkAccessManager m_networkManager; PackageModel* m_groups; + bool m_required; }; #endif // NETINSTALLPAGE_H diff --git a/src/modules/netinstall/NetInstallViewStep.cpp b/src/modules/netinstall/NetInstallViewStep.cpp index 347b2bf27..20505cc34 100644 --- a/src/modules/netinstall/NetInstallViewStep.cpp +++ b/src/modules/netinstall/NetInstallViewStep.cpp @@ -2,6 +2,7 @@ * Copyright 2016, Luca Giambonini * Copyright 2016, Lisa Vitolo * Copyright 2017, Kyle Robbertze + * 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 @@ -30,11 +31,11 @@ CALAMARES_PLUGIN_FACTORY_DEFINITION( NetInstallViewStepFactory, registerPluginsetRequired( + configurationMap.contains( "required" ) && + configurationMap.value( "required" ).type() == QVariant::Bool && + configurationMap.value( "required" ).toBool() ); + if ( configurationMap.contains( "groupsUrl" ) && configurationMap.value( "groupsUrl" ).type() == QVariant::String ) { @@ -186,3 +192,10 @@ NetInstallViewStep::setConfigurationMap( const QVariantMap& configurationMap ) m_widget->loadGroupList(); } } + +void +NetInstallViewStep::nextIsReady( bool b ) +{ + m_nextEnabled = b; + emit nextStatusChanged( b ); +} diff --git a/src/modules/netinstall/NetInstallViewStep.h b/src/modules/netinstall/NetInstallViewStep.h index d9853f26f..ee53f61ce 100644 --- a/src/modules/netinstall/NetInstallViewStep.h +++ b/src/modules/netinstall/NetInstallViewStep.h @@ -60,6 +60,9 @@ public: void setConfigurationMap( const QVariantMap& configurationMap ) override; +public slots: + void nextIsReady( bool ); + private: NetInstallPage* m_widget; bool m_nextEnabled; diff --git a/src/modules/netinstall/netinstall.conf b/src/modules/netinstall/netinstall.conf index b87aef43e..f5977a267 100644 --- a/src/modules/netinstall/netinstall.conf +++ b/src/modules/netinstall/netinstall.conf @@ -1,2 +1,13 @@ --- +# This is the URL that is retrieved to get the netinstall groups-and-packages +# data (which should be in the format described in netinstall.yaml). groupsUrl: http://chakraos.org/netinstall.php + +# If the installation can proceed without netinstall (e.g. the Live CD +# can create a working installed system, but netinstall is preferred +# to bring it up-to-date or extend functionality) leave this set to +# false (the default). If set to true, the netinstall data is required. +# +# This only has an effect if the netinstall data cannot be retrieved, +# or is corrupt: having "required" set, means the install cannot proceed. +required: false From f424af36d3f79997a3e630d875e1221e52161805 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 6 Nov 2017 05:25:14 -0500 Subject: [PATCH 09/14] [netinstall] Avoid crash when do groups are available - m_groups is only set to a non-nullptr value when data is received and fully processed, - avoid nullptr dereference when paging *back* from a netinstall page that hasn't loaded groups data. FIXES #859 --- src/modules/netinstall/NetInstallPage.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/netinstall/NetInstallPage.cpp b/src/modules/netinstall/NetInstallPage.cpp index 13c0da336..0d5bd4049 100644 --- a/src/modules/netinstall/NetInstallPage.cpp +++ b/src/modules/netinstall/NetInstallPage.cpp @@ -113,7 +113,13 @@ NetInstallPage::dataIsHere( QNetworkReply* reply ) QList NetInstallPage::selectedPackages() const { - return m_groups->getPackages(); + if ( m_groups ) + return m_groups->getPackages(); + else + { + cDebug() << "WARNING: no netinstall groups are available."; + return QList(); + } } void NetInstallPage::loadGroupList() From 91e949f8fc623592ef1c50cabc453d9c217bf0f1 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 6 Nov 2017 05:34:57 -0500 Subject: [PATCH 10/14] [netinstall] Apply Calamares C++ style --- src/modules/netinstall/NetInstallPage.cpp | 12 ++++++++---- src/modules/netinstall/NetInstallPage.h | 5 ++++- src/modules/netinstall/NetInstallViewStep.cpp | 6 +++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/modules/netinstall/NetInstallPage.cpp b/src/modules/netinstall/NetInstallPage.cpp index 0d5bd4049..0e70bde15 100644 --- a/src/modules/netinstall/NetInstallPage.cpp +++ b/src/modules/netinstall/NetInstallPage.cpp @@ -111,7 +111,8 @@ NetInstallPage::dataIsHere( QNetworkReply* reply ) emit checkReady( true ); } -QList NetInstallPage::selectedPackages() const +QList +NetInstallPage::selectedPackages() const { if ( m_groups ) return m_groups->getPackages(); @@ -122,7 +123,8 @@ QList NetInstallPage::selectedPackages() const } } -void NetInstallPage::loadGroupList() +void +NetInstallPage::loadGroupList() { QString confUrl( Calamares::JobQueue::instance()->globalStorage()->value( @@ -141,13 +143,15 @@ void NetInstallPage::loadGroupList() m_networkManager.get( request ); } -void NetInstallPage::setRequired(bool b) +void +NetInstallPage::setRequired( bool b ) { m_required = b; } -void NetInstallPage::onActivate() +void +NetInstallPage::onActivate() { ui->groupswidget->setFocus(); } diff --git a/src/modules/netinstall/NetInstallPage.h b/src/modules/netinstall/NetInstallPage.h index f6939cea6..5671ac93e 100644 --- a/src/modules/netinstall/NetInstallPage.h +++ b/src/modules/netinstall/NetInstallPage.h @@ -55,7 +55,10 @@ public: // corrupt or unavailable data causes checkReady() to be emitted // true (not-required) or false. void setRequired( bool ); - bool getRequired() const { return m_required; } + bool getRequired() const + { + return m_required; + } // Returns the list of packages belonging to groups that are // selected in the view in this given moment. No data is cached here, so diff --git a/src/modules/netinstall/NetInstallViewStep.cpp b/src/modules/netinstall/NetInstallViewStep.cpp index 20505cc34..bb1f014cd 100644 --- a/src/modules/netinstall/NetInstallViewStep.cpp +++ b/src/modules/netinstall/NetInstallViewStep.cpp @@ -139,7 +139,7 @@ NetInstallViewStep::onLeave() QVariant details( package.packageName ); // If it's a package with a pre- or post-script, replace // with the more complicated datastructure. - if (!package.preScript.isEmpty() || !package.postScript.isEmpty()) + if ( !package.preScript.isEmpty() || !package.postScript.isEmpty() ) { QMap sdetails; sdetails.insert( "pre-script", package.preScript ); @@ -157,14 +157,14 @@ NetInstallViewStep::onLeave() { QMap op; op.insert( "install", QVariant( installPackages ) ); - packageOperations.append(op); + packageOperations.append( op ); cDebug() << " .." << installPackages.length() << "critical packages."; } if ( !tryInstallPackages.empty() ) { QMap op; op.insert( "try_install", QVariant( tryInstallPackages ) ); - packageOperations.append(op); + packageOperations.append( op ); cDebug() << " .." << tryInstallPackages.length() << "non-critical packages."; } From 51c74c6abb4ef2f17c1127bf443f68b3c433c4a9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 6 Nov 2017 05:42:13 -0500 Subject: [PATCH 11/14] [netinstall] Convenience typedefs --- src/modules/netinstall/NetInstallPage.cpp | 4 ++-- src/modules/netinstall/NetInstallPage.h | 2 +- src/modules/netinstall/NetInstallViewStep.cpp | 2 +- src/modules/netinstall/PackageModel.h | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/modules/netinstall/NetInstallPage.cpp b/src/modules/netinstall/NetInstallPage.cpp index 0e70bde15..07e0d2397 100644 --- a/src/modules/netinstall/NetInstallPage.cpp +++ b/src/modules/netinstall/NetInstallPage.cpp @@ -111,7 +111,7 @@ NetInstallPage::dataIsHere( QNetworkReply* reply ) emit checkReady( true ); } -QList +PackageModel::PackageItemDataList NetInstallPage::selectedPackages() const { if ( m_groups ) @@ -119,7 +119,7 @@ NetInstallPage::selectedPackages() const else { cDebug() << "WARNING: no netinstall groups are available."; - return QList(); + return PackageModel::PackageItemDataList(); } } diff --git a/src/modules/netinstall/NetInstallPage.h b/src/modules/netinstall/NetInstallPage.h index 5671ac93e..58308412d 100644 --- a/src/modules/netinstall/NetInstallPage.h +++ b/src/modules/netinstall/NetInstallPage.h @@ -63,7 +63,7 @@ public: // Returns the list of packages belonging to groups that are // selected in the view in this given moment. No data is cached here, so // this function does not have constant time. - QList selectedPackages() const; + PackageModel::PackageItemDataList selectedPackages() const; public slots: void dataIsHere( QNetworkReply* ); diff --git a/src/modules/netinstall/NetInstallViewStep.cpp b/src/modules/netinstall/NetInstallViewStep.cpp index bb1f014cd..50e08486b 100644 --- a/src/modules/netinstall/NetInstallViewStep.cpp +++ b/src/modules/netinstall/NetInstallViewStep.cpp @@ -127,7 +127,7 @@ NetInstallViewStep::onLeave() cDebug() << "Leaving netinstall, adding packages to be installed" << "to global storage"; - QList packages = m_widget->selectedPackages(); + PackageModel::PackageItemDataList packages = m_widget->selectedPackages(); QVariantList installPackages; QVariantList tryInstallPackages; QVariantList packageOperations; diff --git a/src/modules/netinstall/PackageModel.h b/src/modules/netinstall/PackageModel.h index 148bd99ab..06d6c0ca1 100644 --- a/src/modules/netinstall/PackageModel.h +++ b/src/modules/netinstall/PackageModel.h @@ -1,3 +1,4 @@ + /* === This file is part of Calamares - === * * Copyright (c) 2017, Kyle Robbertze @@ -28,14 +29,13 @@ #include -// Required forward declarations -class PackageTreeItem; - class PackageModel : public QAbstractItemModel { Q_OBJECT public: + using PackageItemDataList = QList< PackageTreeItem::ItemData >; + explicit PackageModel( const YAML::Node& data, QObject* parent = nullptr ); ~PackageModel() override; @@ -52,7 +52,7 @@ public: QModelIndex parent( const QModelIndex& index ) const override; int rowCount( const QModelIndex& parent = QModelIndex() ) const override; int columnCount( const QModelIndex& parent = QModelIndex() ) const override; - QList getPackages() const; + PackageItemDataList getPackages() const; QList getItemPackages( PackageTreeItem* item ) const; private: From fda4b4e3c2281cb332b264f52c3ec96af895a197 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 6 Nov 2017 06:12:26 -0500 Subject: [PATCH 12/14] CMake: improve searching for PythonQt - don't log when libs not found - log that it's the Python libraries version (not Python itself) - fix RE that was getting the wrong results for maj.min --- CMakeModules/FindPythonQt.cmake | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/CMakeModules/FindPythonQt.cmake b/CMakeModules/FindPythonQt.cmake index 0d886902d..8de40853f 100644 --- a/CMakeModules/FindPythonQt.cmake +++ b/CMakeModules/FindPythonQt.cmake @@ -9,12 +9,19 @@ if(NOT PYTHONLIBS_FOUND) message(FATAL_ERROR "error: Python is required to build PythonQt") endif() +# Cut X.Y[.Z] down to just X.Y string(REGEX REPLACE "^([0-9][0-9]*)\.([0-9][0-9]*)" - "\\1" - PYTHONLIBS_MAJMIN + "\\1.\\2@" + _PYTHONLIBS_MAJMIN ${PYTHONLIBS_VERSION_STRING} ) +string(REGEX REPLACE + "@.*" + "" + PYTHONLIBS_MAJMIN + ${_PYTHONLIBS_MAJMIN} +) if(NOT EXISTS "${PYTHONQT_INSTALL_DIR}") find_path(PYTHONQT_INSTALL_DIR include/PythonQt/PythonQt.h DOC "Directory where PythonQt was installed.") @@ -30,7 +37,7 @@ find_path(PYTHONQT_INCLUDE_DIR PythonQt.h DOC "Path to the PythonQt include directory") if ( NOT PythonQt_FIND_QUIETLY ) - message( STATUS "Searching for PythonQt (Python ${PYTHONLIBS_MAJMIN}) .." ) + message( STATUS "Searching for PythonQt (PythonLibs ${PYTHONLIBS_MAJMIN}) .." ) if ( PYTHONQT_INCLUDE_DIR ) message( STATUS " .. found include ${PYTHONQT_INCLUDE_DIR}" ) endif() @@ -99,8 +106,12 @@ if(PYTHONQT_QTALL_LIBRARY_DEBUG) endif() if ( NOT PythonQt_FIND_QUIETLY ) - message( STATUS " .. found library ${PYTHONQT_LIBRARY}" ) - message( STATUS " .. found qtall ${PYTHONQT_QTALL_LIBRARY}" ) + if ( PYTHONQT_LIBRARY ) + message( STATUS " .. found library ${PYTHONQT_LIBRARY}" ) + endif() + if ( PYTHONQT_QTALL_LIBRARY ) + message( STATUS " .. found qtall ${PYTHONQT_QTALL_LIBRARY}" ) + endif() endif() From b5f2f22a7871caa571287cfe38933fc9673b38ca Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 6 Nov 2017 06:58:05 -0500 Subject: [PATCH 13/14] Documentation: update HACKING --- ci/HACKING.md | 64 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 16 deletions(-) diff --git a/ci/HACKING.md b/ci/HACKING.md index 92d1a5a48..4d84fc33d 100644 --- a/ci/HACKING.md +++ b/ci/HACKING.md @@ -1,9 +1,15 @@ Hacking on Calamares ==================== +These are the guidelines for hacking on Calamares. Except for the licensing, +which **must** be GPLv3+, these are guidelines and -- like PEP8 -- the most +important thing is to know when you can ignore them. + + Licensing --------- -Calamares is released under the terms of the GNU GPL, version 3 or later. Every source file must have a license header, with a list of copyright holders and years. +Calamares is released under the terms of the GNU GPL, version 3 or later. +Every source file must have a license header, with a list of copyright holders and years. Example: ``` @@ -34,9 +40,9 @@ organization, etc. Please add your name to files you touch when making any contribution (even if it's just a typo-fix which might not be copyrightable in all jurisdictions). -Formatting ----------- +Formatting C++ +-------------- This formatting guide applies to C++ code only; for Python modules, we use [pycodestyle][https://github.com/PyCQA/pycodestyle] to apply a check of some PEP8 guidelines. @@ -48,10 +54,10 @@ some PEP8 guidelines. * No space before brackets, except for keywords, for example `function( argument )` but `if ( condition )`. * For pointer and reference variable declarations, put a space before the variable name - and no space between the type and the `*` or `&`. -* `for`, `if`, `else`, `while` and similar statements put the brackets on the next line, - although brackets are not needed for single statements. -* Function and class definitions have their brackets on separate lines. + and no space between the type and the `*` or `&`, e.g. `int* p`. +* `for`, `if`, `else`, `while` and similar statements put the braces on the next line, + if the following block is more than one statement. Use no braces for single statements. +* Function and class definitions have their braces on separate lines. * A function implementation's return type is on its own line. * `CamelCase.{cpp,h}` style file names. @@ -63,8 +69,9 @@ MyClass::myMethod( QStringList list, const QString& name ) if ( list.isEmpty() ) return false; + cDebug() << "Items in list .."; foreach ( const QString& string, list ) - cDebug() << "Current string is " << string; + cDebug() << " .." << string; switch ( m_enumValue ) { @@ -77,7 +84,7 @@ MyClass::myMethod( QStringList list, const QString& name ) } ``` -You can use the `hacking/calamaresstyle` script to run +You can use the `ci/calamaresstyle` script to run [astyle](http://astyle.sf.net) on your code and have it formatted the right way. @@ -85,6 +92,7 @@ way. order to take advantage of this functionality you will need to acquire the [EditorConfig](http://editorconfig.org/#download) plug-in for your editor. + Naming ------ * Use CamelCase for everything. @@ -97,6 +105,7 @@ Naming * If it's a getter for a boolean, prefix with 'is', so `isCondition()`. * A setter is `setVariable( arg )`. + Includes -------- Header includes should be listed in the following order: @@ -109,8 +118,9 @@ Header includes should be listed in the following order: They should also be sorted alphabetically for ease of locating them. -Includes in a header file should be kept to the absolute minimum, as to keep compile times short. This can be achieved by using forward declarations instead of includes, -like `class QListView;`. +Includes in a header file should be kept to the absolute minimum, as to keep +compile times short. This can be achieved by using forward declarations +instead of includes, like `class QListView;`. Example: ``` @@ -129,6 +139,7 @@ Example: Use include guards, not `#pragma once`. + C++ tips -------- All C++11 features are acceptable, and the use of new C++11 features is encouraged when @@ -141,8 +152,8 @@ range-based `for` syntax introduced with C++11 is preferred ([see this blog post When re-implementing a virtual method, always add the `override` keyword. -Try to keep your code const correct. Declare methods const if they don't mutate the -object, and use const variables. It improves safety, and also makes it easier to +Try to keep your code const correct. Declare methods const if they don't mutate the +object, and use const variables. It improves safety, and also makes it easier to understand the code. For the Qt signal-slot system, the new (Qt5) syntax is to be preferred because it allows @@ -160,10 +171,31 @@ connect( m_moduleManager, &Calamares::ModuleManager::modulesLoaded, [this] }); ``` +[1]: http://blog.qt.digia.com/blog/2011/05/26/cpp0x-in-qt/ +[2]: http://qt-project.org/wiki/New_Signal_Slot_Syntax + + Debugging --------- -Use `cDebug()` and `cLog()` from `utils/Logger.h`. +Use `cDebug()` and `cLog()` from `utils/Logger.h`. You can pass a debug-level to +either macro (1 is debugging, higher is less important). Use `cLog()` for warning +messages. It is recommended to add *WARNING* as the first part of a warning +message. +For log messages that are continued across multiple calls to `cDebug()`, +in particular listing things, conventional formatting is as follows: +* End the first debug message with ` ..` +* Indent following lines with ` ..` -[1]: http://blog.qt.digia.com/blog/2011/05/26/cpp0x-in-qt/ -[2]: http://qt-project.org/wiki/New_Signal_Slot_Syntax + +Commit Messages +--------------- +Keep commit messages short(-ish) and try to describe what is being changed +*as well as why*. Use the commit keywords for GitHub, especially *FIXES:* +to auto-close issues when they are resolved. + +For functional changes to Calamares modules or libraries, try to put +*[modulename]* in front of the first line of the commit message. + +For non-functional changes to infrastructure, try to label the change +with the kind of change, e.g. *CMake* or *i18n* or *Documentation*. From ac14e8a38c274597d974dd8b22cf8af162f34497 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 6 Nov 2017 07:00:44 -0500 Subject: [PATCH 14/14] Documentation: update AUTHORS --- AUTHORS | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index f39b579f4..a1c1bae5b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,2 +1,24 @@ -Teo Mrnjavac -Adriaan de Groot +# MAINTAINER + +Teo Mrnjavac (maintainer -2017) +Adriaan de Groot (maintainer 2017-) + +# CONTRIBUTORS + +Alf Gaida +Allen Welkie +Andrius Štikonas +Bernhard Landauer +Bezzy1999 +bill-auger +crispg72 +demmm +Gabriel Craciunescu +Kai Dohmen +Kevin Kofler +Kyle Robertze +Lisa Vitolo +n3rdopolis +Philip Müller +Ramon Buldó +Rohan Garg