From aa332477fd1858603f528a5f036925624446249a Mon Sep 17 00:00:00 2001 From: Artem Grinev Date: Mon, 6 Dec 2021 03:11:16 +0400 Subject: [PATCH] [libcalamaresui] Run clang-format on TranslationFix.cpp --- src/libcalamaresui/widgets/TranslationFix.cpp | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/libcalamaresui/widgets/TranslationFix.cpp b/src/libcalamaresui/widgets/TranslationFix.cpp index b73bd0e16..dbfd0bd83 100644 --- a/src/libcalamaresui/widgets/TranslationFix.cpp +++ b/src/libcalamaresui/widgets/TranslationFix.cpp @@ -10,34 +10,35 @@ #include "TranslationFix.h" #include -#include #include -#include #include +#include +#include namespace Calamares { //Using QMessageBox's StandardButton enum here but according to headers they should be kept in-sync between multiple classes. static std::pair< decltype( QMessageBox::Ok ), const char* > maps[] = { - { QMessageBox::Ok, QT_TRANSLATE_NOOP( "StandardButtons", "&OK" ) }, - { QMessageBox::Yes, QT_TRANSLATE_NOOP( "StandardButtons", "&Yes" ) }, - { QMessageBox::No, QT_TRANSLATE_NOOP( "StandardButtons", "&No" ) }, - { QMessageBox::Cancel, QT_TRANSLATE_NOOP( "StandardButtons", "&Cancel" ) }, - { QMessageBox::Close, QT_TRANSLATE_NOOP( "StandardButtons", "&Close" ) }, - }; + { QMessageBox::Ok, QT_TRANSLATE_NOOP( "StandardButtons", "&OK" ) }, + { QMessageBox::Yes, QT_TRANSLATE_NOOP( "StandardButtons", "&Yes" ) }, + { QMessageBox::No, QT_TRANSLATE_NOOP( "StandardButtons", "&No" ) }, + { QMessageBox::Cancel, QT_TRANSLATE_NOOP( "StandardButtons", "&Cancel" ) }, + { QMessageBox::Close, QT_TRANSLATE_NOOP( "StandardButtons", "&Close" ) }, +}; -template -void fixButtonLabels ( TButtonBox* box ) +template < typename TButtonBox > +void +fixButtonLabels( TButtonBox* box ) { if ( !box ) { return; } - + for ( auto [ sb, label ] : maps ) { - auto* button = box->button( static_cast(int(sb)) ); + auto* button = box->button( static_cast< typename TButtonBox::StandardButton >( int( sb ) ) ); if ( button ) { button->setText( QCoreApplication::translate( "StandardButtons", label ) ); @@ -48,13 +49,13 @@ void fixButtonLabels ( TButtonBox* box ) void fixButtonLabels( QMessageBox* box ) { - fixButtonLabels(box); + fixButtonLabels< QMessageBox >( box ); } void -fixButtonLabels(QDialogButtonBox *box) +fixButtonLabels( QDialogButtonBox* box ) { - fixButtonLabels(box); + fixButtonLabels< QDialogButtonBox >( box ); } } // namespace Calamares