From ffeab3240391ea9b3e1d6fef1cf1d9be5cd887ad Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 31 Jan 2022 23:41:37 +0100 Subject: [PATCH] [libcalamares] Apply coding style --- src/libcalamares/JobQueue.cpp | 5 +++-- src/libcalamares/utils/Logger.cpp | 13 +++++++------ src/libcalamares/utils/Logger.h | 3 ++- src/libcalamares/utils/Retranslator.h | 15 ++++++++++----- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/libcalamares/JobQueue.cpp b/src/libcalamares/JobQueue.cpp index 039a28e26..d7078c6d2 100644 --- a/src/libcalamares/JobQueue.cpp +++ b/src/libcalamares/JobQueue.cpp @@ -122,8 +122,9 @@ public: } else { - cDebug() << o << "Starting" << ( failureEncountered ? "EMERGENCY JOB" : "job" ) << jobitem.job->prettyName() - << '(' << ( m_jobIndex + 1 ) << '/' << m_runningJobs->count() << ')'; + cDebug() << o << "Starting" << ( failureEncountered ? "EMERGENCY JOB" : "job" ) + << jobitem.job->prettyName() << '(' << ( m_jobIndex + 1 ) << '/' << m_runningJobs->count() + << ')'; o.refresh(); // So next time it shows the function header again emitProgress( 0.0 ); // 0% for *this job* connect( jobitem.job.data(), &Job::progress, this, &JobThread::emitProgress ); diff --git a/src/libcalamares/utils/Logger.cpp b/src/libcalamares/utils/Logger.cpp index d35d6891b..adb082687 100644 --- a/src/libcalamares/utils/Logger.cpp +++ b/src/libcalamares/utils/Logger.cpp @@ -259,21 +259,22 @@ operator<<( QDebug& s, const RedactedCommand& l ) * Identical strings with the same context will be hashed the same, * so that they can be logged and still recognized as the-same. */ -static uint insertRedactedName( const QString& context, const QString& s ) +static uint +insertRedactedName( const QString& context, const QString& s ) { static uint salt = QRandomGenerator::global()->generate(); // Just once - uint val = qHash(context, salt); - return qHash(s, val); + uint val = qHash( context, salt ); + return qHash( s, val ); } RedactedName::RedactedName( const QString& context, const QString& s ) - : m_id( insertRedactedName(context, s) ), - m_context(context) + : m_id( insertRedactedName( context, s ) ) + , m_context( context ) { } -RedactedName::RedactedName(const char *context, const QString& s ) +RedactedName::RedactedName( const char* context, const QString& s ) : RedactedName( QString::fromLatin1( context ), s ) { } diff --git a/src/libcalamares/utils/Logger.h b/src/libcalamares/utils/Logger.h index 25c19cf58..f4079388d 100644 --- a/src/libcalamares/utils/Logger.h +++ b/src/libcalamares/utils/Logger.h @@ -247,7 +247,8 @@ private: const QString m_context; }; -inline QDebug& operator<<( QDebug& s, const RedactedName& n ) +inline QDebug& +operator<<( QDebug& s, const RedactedName& n ) { return s << NoQuote << QString( n ) << Quote; } diff --git a/src/libcalamares/utils/Retranslator.h b/src/libcalamares/utils/Retranslator.h index efe12ef8a..8bb044983 100644 --- a/src/libcalamares/utils/Retranslator.h +++ b/src/libcalamares/utils/Retranslator.h @@ -29,7 +29,8 @@ namespace CalamaresUtils * @param locale the new locale (names as defined by Calamares). * @param brandingTranslationsPrefix the branding path prefix, from Calamares::Branding. */ -DLLEXPORT void installTranslator( const CalamaresUtils::Locale::Translation::Id& locale, const QString& brandingTranslationsPrefix ); +DLLEXPORT void installTranslator( const CalamaresUtils::Locale::Translation::Id& locale, + const QString& brandingTranslationsPrefix ); /** @brief Initializes the translations with the current system settings */ @@ -56,7 +57,8 @@ DLLEXPORT CalamaresUtils::Locale::Translation::Id translatorLocaleName(); * * @returns @c true on success */ -DLLEXPORT bool loadTranslator( const CalamaresUtils::Locale::Translation::Id& locale, const QString& prefix, QTranslator* translator ); +DLLEXPORT bool +loadTranslator( const CalamaresUtils::Locale::Translation::Id& locale, const QString& prefix, QTranslator* translator ); /** @brief Set @p allow to true to load translations from current dir. * @@ -88,7 +90,7 @@ public: static Retranslator* instance(); /// @brief Helper function for attaching lambdas - static void attach( QObject* o, std::function< void( void ) > f); + static void attach( QObject* o, std::function< void( void ) > f ); signals: void languageChanged(); @@ -138,8 +140,11 @@ private: #define CALAMARES_RETRANSLATE_SLOT( slotfunc ) \ do \ { \ - connect( CalamaresUtils::Retranslator::instance(), &CalamaresUtils::Retranslator::languageChanged, this, slotfunc ); \ - (this->*slotfunc)(); \ + connect( CalamaresUtils::Retranslator::instance(), \ + &CalamaresUtils::Retranslator::languageChanged, \ + this, \ + slotfunc ); \ + ( this->*slotfunc )(); \ } while ( false ) #endif