[libcalamares] Apply coding style

This commit is contained in:
Adriaan de Groot 2022-01-31 23:41:37 +01:00
parent 80300e412c
commit ffeab32403
4 changed files with 22 additions and 14 deletions

View File

@ -122,8 +122,9 @@ public:
} }
else else
{ {
cDebug() << o << "Starting" << ( failureEncountered ? "EMERGENCY JOB" : "job" ) << jobitem.job->prettyName() cDebug() << o << "Starting" << ( failureEncountered ? "EMERGENCY JOB" : "job" )
<< '(' << ( m_jobIndex + 1 ) << '/' << m_runningJobs->count() << ')'; << jobitem.job->prettyName() << '(' << ( m_jobIndex + 1 ) << '/' << m_runningJobs->count()
<< ')';
o.refresh(); // So next time it shows the function header again o.refresh(); // So next time it shows the function header again
emitProgress( 0.0 ); // 0% for *this job* emitProgress( 0.0 ); // 0% for *this job*
connect( jobitem.job.data(), &Job::progress, this, &JobThread::emitProgress ); connect( jobitem.job.data(), &Job::progress, this, &JobThread::emitProgress );

View File

@ -259,21 +259,22 @@ operator<<( QDebug& s, const RedactedCommand& l )
* Identical strings with the same context will be hashed the same, * Identical strings with the same context will be hashed the same,
* so that they can be logged and still recognized as 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 static uint salt = QRandomGenerator::global()->generate(); // Just once
uint val = qHash(context, salt); uint val = qHash( context, salt );
return qHash(s, val); return qHash( s, val );
} }
RedactedName::RedactedName( const QString& context, const QString& s ) RedactedName::RedactedName( const QString& context, const QString& s )
: m_id( insertRedactedName(context, s) ), : m_id( insertRedactedName( context, s ) )
m_context(context) , m_context( context )
{ {
} }
RedactedName::RedactedName(const char *context, const QString& s ) RedactedName::RedactedName( const char* context, const QString& s )
: RedactedName( QString::fromLatin1( context ), s ) : RedactedName( QString::fromLatin1( context ), s )
{ {
} }

View File

@ -247,7 +247,8 @@ private:
const QString m_context; 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; return s << NoQuote << QString( n ) << Quote;
} }

View File

@ -29,7 +29,8 @@ namespace CalamaresUtils
* @param locale the new locale (names as defined by Calamares). * @param locale the new locale (names as defined by Calamares).
* @param brandingTranslationsPrefix the branding path prefix, from Calamares::Branding. * @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 /** @brief Initializes the translations with the current system settings
*/ */
@ -56,7 +57,8 @@ DLLEXPORT CalamaresUtils::Locale::Translation::Id translatorLocaleName();
* *
* @returns @c true on success * @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. /** @brief Set @p allow to true to load translations from current dir.
* *
@ -88,7 +90,7 @@ public:
static Retranslator* instance(); static Retranslator* instance();
/// @brief Helper function for attaching lambdas /// @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: signals:
void languageChanged(); void languageChanged();
@ -138,8 +140,11 @@ private:
#define CALAMARES_RETRANSLATE_SLOT( slotfunc ) \ #define CALAMARES_RETRANSLATE_SLOT( slotfunc ) \
do \ do \
{ \ { \
connect( CalamaresUtils::Retranslator::instance(), &CalamaresUtils::Retranslator::languageChanged, this, slotfunc ); \ connect( CalamaresUtils::Retranslator::instance(), \
(this->*slotfunc)(); \ &CalamaresUtils::Retranslator::languageChanged, \
this, \
slotfunc ); \
( this->*slotfunc )(); \
} while ( false ) } while ( false )
#endif #endif