[libcalamares] Make the RETRANSLATE macros more statement-line
Require a ; after RETRANSLATE macros. They are statement-like; this makes it easier for some of them to be recognized by clang-format and resolves some existing weird formatting.
This commit is contained in:
parent
a90f510b85
commit
9341a84820
@ -134,9 +134,10 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug,
|
|||||||
{
|
{
|
||||||
QPushButton* debugWindowBtn = new QPushButton;
|
QPushButton* debugWindowBtn = new QPushButton;
|
||||||
debugWindowBtn->setObjectName( "debugButton" );
|
debugWindowBtn->setObjectName( "debugButton" );
|
||||||
CALAMARES_RETRANSLATE_WIDGET( debugWindowBtn,
|
CALAMARES_RETRANSLATE_WIDGET(
|
||||||
debugWindowBtn->setText( QCoreApplication::translate(
|
debugWindowBtn,
|
||||||
CalamaresWindow::staticMetaObject.className(), "Show debug information" ) ); )
|
debugWindowBtn->setText( QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(),
|
||||||
|
"Show debug information" ) ); );
|
||||||
sideLayout->addWidget( debugWindowBtn );
|
sideLayout->addWidget( debugWindowBtn );
|
||||||
debugWindowBtn->setFlat( true );
|
debugWindowBtn->setFlat( true );
|
||||||
debugWindowBtn->setCheckable( true );
|
debugWindowBtn->setCheckable( true );
|
||||||
@ -365,7 +366,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
|
|||||||
CALAMARES_RETRANSLATE( const auto* branding = Calamares::Branding::instance();
|
CALAMARES_RETRANSLATE( const auto* branding = Calamares::Branding::instance();
|
||||||
setWindowTitle( Calamares::Settings::instance()->isSetupMode()
|
setWindowTitle( Calamares::Settings::instance()->isSetupMode()
|
||||||
? tr( "%1 Setup Program" ).arg( branding->productName() )
|
? tr( "%1 Setup Program" ).arg( branding->productName() )
|
||||||
: tr( "%1 Installer" ).arg( branding->productName() ) ); )
|
: tr( "%1 Installer" ).arg( branding->productName() ) ); );
|
||||||
|
|
||||||
const Calamares::Branding* const branding = Calamares::Branding::instance();
|
const Calamares::Branding* const branding = Calamares::Branding::instance();
|
||||||
using ImageEntry = Calamares::Branding::ImageEntry;
|
using ImageEntry = Calamares::Branding::ImageEntry;
|
||||||
|
@ -213,7 +213,7 @@ DebugWindow::DebugWindow()
|
|||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE( m_ui->retranslateUi( this ); setWindowTitle( tr( "Debug information" ) ); )
|
CALAMARES_RETRANSLATE( m_ui->retranslateUi( this ); setWindowTitle( tr( "Debug information" ) ); );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,15 +91,16 @@ private:
|
|||||||
|
|
||||||
} // namespace CalamaresUtils
|
} // namespace CalamaresUtils
|
||||||
|
|
||||||
#define CALAMARES_RETRANSLATE( body ) CalamaresUtils::Retranslator::attachRetranslator( this, [=] { body } );
|
#define CALAMARES_RETRANSLATE( body ) CalamaresUtils::Retranslator::attachRetranslator( this, [=] { body } )
|
||||||
#define CALAMARES_RETRANSLATE_WIDGET( widget, body ) \
|
#define CALAMARES_RETRANSLATE_WIDGET( widget, body ) \
|
||||||
CalamaresUtils::Retranslator::attachRetranslator( widget, [=] { body } );
|
CalamaresUtils::Retranslator::attachRetranslator( widget, [=] { body } )
|
||||||
#define CALAMARES_RETRANSLATE_SLOT( slotfunc ) \
|
#define CALAMARES_RETRANSLATE_SLOT( slotfunc ) \
|
||||||
|
do \
|
||||||
{ \
|
{ \
|
||||||
this->connect( CalamaresUtils::Retranslator::retranslatorFor( this ), \
|
this->connect( CalamaresUtils::Retranslator::retranslatorFor( this ), \
|
||||||
&CalamaresUtils::Retranslator::languageChange, \
|
&CalamaresUtils::Retranslator::languageChange, \
|
||||||
this, \
|
this, \
|
||||||
slotfunc ); \
|
slotfunc ); \
|
||||||
}
|
} while ( 0 )
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -81,7 +81,7 @@ ViewManager::ViewManager( QObject* parent )
|
|||||||
connect( JobQueue::instance(), &JobQueue::failed, this, &ViewManager::onInstallationFailed );
|
connect( JobQueue::instance(), &JobQueue::failed, this, &ViewManager::onInstallationFailed );
|
||||||
connect( JobQueue::instance(), &JobQueue::finished, this, &ViewManager::next );
|
connect( JobQueue::instance(), &JobQueue::finished, this, &ViewManager::next );
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE_SLOT( &ViewManager::updateButtonLabels )
|
CALAMARES_RETRANSLATE_SLOT( &ViewManager::updateButtonLabels );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ SlideshowQML::SlideshowQML( QWidget* parent )
|
|||||||
, m_qmlComponent( nullptr )
|
, m_qmlComponent( nullptr )
|
||||||
, m_qmlObject( nullptr )
|
, m_qmlObject( nullptr )
|
||||||
{
|
{
|
||||||
m_qmlShow->setObjectName("qml");
|
m_qmlShow->setObjectName( "qml" );
|
||||||
|
|
||||||
CalamaresUtils::registerQmlModels();
|
CalamaresUtils::registerQmlModels();
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ SlideshowQML::SlideshowQML( QWidget* parent )
|
|||||||
|
|
||||||
cDebug() << "QML import paths:" << Logger::DebugList( m_qmlShow->engine()->importPathList() );
|
cDebug() << "QML import paths:" << Logger::DebugList( m_qmlShow->engine()->importPathList() );
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 )
|
#if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 )
|
||||||
CALAMARES_RETRANSLATE( if ( m_qmlShow ) { m_qmlShow->engine()->retranslate(); } )
|
CALAMARES_RETRANSLATE( if ( m_qmlShow ) { m_qmlShow->engine()->retranslate(); } );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( Branding::instance()->slideshowAPI() == 2 )
|
if ( Branding::instance()->slideshowAPI() == 2 )
|
||||||
@ -205,7 +205,7 @@ SlideshowPictures::SlideshowPictures( QWidget* parent )
|
|||||||
, m_imageIndex( 0 )
|
, m_imageIndex( 0 )
|
||||||
, m_images( Branding::instance()->slideshowImages() )
|
, m_images( Branding::instance()->slideshowImages() )
|
||||||
{
|
{
|
||||||
m_label->setObjectName("image");
|
m_label->setObjectName( "image" );
|
||||||
|
|
||||||
m_label->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
m_label->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
||||||
m_label->setAlignment( Qt::AlignCenter );
|
m_label->setAlignment( Qt::AlignCenter );
|
||||||
|
@ -99,5 +99,6 @@ void
|
|||||||
InteractiveTerminalPage::setCommand( const QString& command )
|
InteractiveTerminalPage::setCommand( const QString& command )
|
||||||
{
|
{
|
||||||
m_command = command;
|
m_command = command;
|
||||||
CALAMARES_RETRANSLATE( m_headerLabel->setText( tr( "Executing script: <code>%1</code>" ).arg( m_command ) ); )
|
CALAMARES_RETRANSLATE(
|
||||||
|
m_headerLabel->setText( tr( "Executing script: <code>%1</code>" ).arg( m_command ) ); );
|
||||||
}
|
}
|
||||||
|
@ -70,9 +70,8 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent )
|
|||||||
cDebug() << "Variants now" << model->rowCount() << model->currentIndex();
|
cDebug() << "Variants now" << model->rowCount() << model->currentIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
connect( ui->buttonRestore, &QPushButton::clicked, [ config = config ] {
|
connect(
|
||||||
config->keyboardModels()->setCurrentIndex();
|
ui->buttonRestore, &QPushButton::clicked, [config = config] { config->keyboardModels()->setCurrentIndex(); } );
|
||||||
} );
|
|
||||||
|
|
||||||
connect( ui->physicalModelSelector,
|
connect( ui->physicalModelSelector,
|
||||||
QOverload< int >::of( &QComboBox::currentIndexChanged ),
|
QOverload< int >::of( &QComboBox::currentIndexChanged ),
|
||||||
@ -83,25 +82,24 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent )
|
|||||||
ui->physicalModelSelector,
|
ui->physicalModelSelector,
|
||||||
&QComboBox::setCurrentIndex );
|
&QComboBox::setCurrentIndex );
|
||||||
|
|
||||||
connect(
|
connect( ui->layoutSelector->selectionModel(),
|
||||||
ui->layoutSelector->selectionModel(),
|
&QItemSelectionModel::currentChanged,
|
||||||
&QItemSelectionModel::currentChanged,
|
[this]( const QModelIndex& current ) { m_config->keyboardLayouts()->setCurrentIndex( current.row() ); } );
|
||||||
[ this ]( const QModelIndex& current ) { m_config->keyboardLayouts()->setCurrentIndex( current.row() ); } );
|
connect( config->keyboardLayouts(), &KeyboardLayoutModel::currentIndexChanged, [this]( int index ) {
|
||||||
connect( config->keyboardLayouts(), &KeyboardLayoutModel::currentIndexChanged, [ this ]( int index ) {
|
|
||||||
ui->layoutSelector->setCurrentIndex( m_config->keyboardLayouts()->index( index ) );
|
ui->layoutSelector->setCurrentIndex( m_config->keyboardLayouts()->index( index ) );
|
||||||
m_keyboardPreview->setLayout( m_config->keyboardLayouts()->key( index ) );
|
m_keyboardPreview->setLayout( m_config->keyboardLayouts()->key( index ) );
|
||||||
m_keyboardPreview->setVariant( m_config->keyboardVariants()->key( m_config->keyboardVariants()->currentIndex() ) );
|
m_keyboardPreview->setVariant(
|
||||||
|
m_config->keyboardVariants()->key( m_config->keyboardVariants()->currentIndex() ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
connect(
|
connect( ui->variantSelector->selectionModel(),
|
||||||
ui->variantSelector->selectionModel(),
|
&QItemSelectionModel::currentChanged,
|
||||||
&QItemSelectionModel::currentChanged,
|
[this]( const QModelIndex& current ) { m_config->keyboardVariants()->setCurrentIndex( current.row() ); } );
|
||||||
[ this ]( const QModelIndex& current ) { m_config->keyboardVariants()->setCurrentIndex( current.row() ); } );
|
connect( config->keyboardVariants(), &KeyboardVariantsModel::currentIndexChanged, [this]( int index ) {
|
||||||
connect( config->keyboardVariants(), &KeyboardVariantsModel::currentIndexChanged, [ this ]( int index ) {
|
|
||||||
ui->variantSelector->setCurrentIndex( m_config->keyboardVariants()->index( index ) );
|
ui->variantSelector->setCurrentIndex( m_config->keyboardVariants()->index( index ) );
|
||||||
m_keyboardPreview->setVariant( m_config->keyboardVariants()->key( index ) );
|
m_keyboardPreview->setVariant( m_config->keyboardVariants()->key( index ) );
|
||||||
} );
|
} );
|
||||||
CALAMARES_RETRANSLATE_SLOT( &KeyboardPage::retranslate )
|
CALAMARES_RETRANSLATE_SLOT( &KeyboardPage::retranslate );
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyboardPage::~KeyboardPage()
|
KeyboardPage::~KeyboardPage()
|
||||||
|
@ -105,7 +105,7 @@ LicensePage::LicensePage( QWidget* parent )
|
|||||||
|
|
||||||
connect( ui->acceptCheckBox, &QCheckBox::toggled, this, &LicensePage::checkAcceptance );
|
connect( ui->acceptCheckBox, &QCheckBox::toggled, this, &LicensePage::checkAcceptance );
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE_SLOT( &LicensePage::retranslate )
|
CALAMARES_RETRANSLATE_SLOT( &LicensePage::retranslate );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -117,7 +117,7 @@ LocalePage::LocalePage( Config* config, QWidget* parent )
|
|||||||
connect( m_localeChangeButton, &QPushButton::clicked, this, &LocalePage::changeLocale );
|
connect( m_localeChangeButton, &QPushButton::clicked, this, &LocalePage::changeLocale );
|
||||||
connect( m_formatsChangeButton, &QPushButton::clicked, this, &LocalePage::changeFormats );
|
connect( m_formatsChangeButton, &QPushButton::clicked, this, &LocalePage::changeFormats );
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE_SLOT( &LocalePage::updateLocaleLabels )
|
CALAMARES_RETRANSLATE_SLOT( &LocalePage::updateLocaleLabels );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ NetInstallPage::NetInstallPage( Config* c, QWidget* parent )
|
|||||||
connect( c, &Config::statusReady, this, &NetInstallPage::expandGroups );
|
connect( c, &Config::statusReady, this, &NetInstallPage::expandGroups );
|
||||||
|
|
||||||
setPageTitle( nullptr );
|
setPageTitle( nullptr );
|
||||||
CALAMARES_RETRANSLATE_SLOT( &NetInstallPage::retranslate )
|
CALAMARES_RETRANSLATE_SLOT( &NetInstallPage::retranslate );
|
||||||
}
|
}
|
||||||
|
|
||||||
NetInstallPage::~NetInstallPage() {}
|
NetInstallPage::~NetInstallPage() {}
|
||||||
|
@ -29,7 +29,7 @@ public:
|
|||||||
{
|
{
|
||||||
m_ui->setupUi( this );
|
m_ui->setupUi( this );
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE( m_ui->retranslateUi( this ); )
|
CALAMARES_RETRANSLATE( m_ui->retranslateUi( this ); );
|
||||||
}
|
}
|
||||||
|
|
||||||
~OEMPage() override;
|
~OEMPage() override;
|
||||||
|
@ -28,7 +28,7 @@ PackageChooserPage::PackageChooserPage( PackageChooserMode mode, QWidget* parent
|
|||||||
m_introduction.screenshot = QPixmap( QStringLiteral( ":/images/no-selection.png" ) );
|
m_introduction.screenshot = QPixmap( QStringLiteral( ":/images/no-selection.png" ) );
|
||||||
|
|
||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
CALAMARES_RETRANSLATE( updateLabels(); )
|
CALAMARES_RETRANSLATE( updateLabels(); );
|
||||||
|
|
||||||
switch ( mode )
|
switch ( mode )
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,7 @@ PlasmaLnfPage::PlasmaLnfPage( Config* config, QWidget* parent )
|
|||||||
"You can also skip this step and configure the look-and-feel "
|
"You can also skip this step and configure the look-and-feel "
|
||||||
"once the system is installed. Clicking on a look-and-feel "
|
"once the system is installed. Clicking on a look-and-feel "
|
||||||
"selection will give you a live preview of that look-and-feel." ) );
|
"selection will give you a live preview of that look-and-feel." ) );
|
||||||
} )
|
} );
|
||||||
|
|
||||||
auto* view = new QListView( this );
|
auto* view = new QListView( this );
|
||||||
view->setModel( m_config->themeModel() );
|
view->setModel( m_config->themeModel() );
|
||||||
|
@ -48,7 +48,7 @@ SummaryPage::SummaryPage( const SummaryViewStep* thisViewStep, QWidget* parent )
|
|||||||
headerLabel->setText( tr( "This is an overview of what will happen once you start "
|
headerLabel->setText( tr( "This is an overview of what will happen once you start "
|
||||||
"the setup procedure." ) );
|
"the setup procedure." ) );
|
||||||
else headerLabel->setText( tr( "This is an overview of what will happen once you start "
|
else headerLabel->setText( tr( "This is an overview of what will happen once you start "
|
||||||
"the install procedure." ) ); )
|
"the install procedure." ) ); );
|
||||||
layout->addWidget( headerLabel );
|
layout->addWidget( headerLabel );
|
||||||
layout->addWidget( m_scrollArea );
|
layout->addWidget( m_scrollArea );
|
||||||
m_scrollArea->setWidgetResizable( true );
|
m_scrollArea->setWidgetResizable( true );
|
||||||
|
@ -28,7 +28,7 @@ TrackingPage::TrackingPage( Config* config, QWidget* parent )
|
|||||||
, ui( new Ui::TrackingPage )
|
, ui( new Ui::TrackingPage )
|
||||||
{
|
{
|
||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
CALAMARES_RETRANSLATE_SLOT( &TrackingPage::retranslate )
|
CALAMARES_RETRANSLATE_SLOT( &TrackingPage::retranslate );
|
||||||
|
|
||||||
ui->noneCheckBox->setChecked( true );
|
ui->noneCheckBox->setChecked( true );
|
||||||
ui->noneCheckBox->setEnabled( false );
|
ui->noneCheckBox->setEnabled( false );
|
||||||
|
@ -140,7 +140,7 @@ UsersPage::UsersPage( Config* config, QWidget* parent )
|
|||||||
config, &Config::requireStrongPasswordsChanged, ui->checkBoxRequireStrongPassword, &QCheckBox::setChecked );
|
config, &Config::requireStrongPasswordsChanged, ui->checkBoxRequireStrongPassword, &QCheckBox::setChecked );
|
||||||
}
|
}
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE_SLOT( &UsersPage::retranslate )
|
CALAMARES_RETRANSLATE_SLOT( &UsersPage::retranslate );
|
||||||
|
|
||||||
onReuseUserPasswordChanged( m_config->reuseUserPasswordForRoot() );
|
onReuseUserPasswordChanged( m_config->reuseUserPasswordForRoot() );
|
||||||
onFullNameTextEdited( m_config->fullName() );
|
onFullNameTextEdited( m_config->fullName() );
|
||||||
|
@ -30,7 +30,7 @@ Config::Config( QObject* parent )
|
|||||||
{
|
{
|
||||||
initLanguages();
|
initLanguages();
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE_SLOT( &Config::retranslate )
|
CALAMARES_RETRANSLATE_SLOT( &Config::retranslate );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -75,7 +75,7 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent )
|
|||||||
|
|
||||||
initLanguages();
|
initLanguages();
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE_SLOT( &WelcomePage::retranslate )
|
CALAMARES_RETRANSLATE_SLOT( &WelcomePage::retranslate );
|
||||||
|
|
||||||
connect( ui->aboutButton, &QPushButton::clicked, this, &WelcomePage::showAboutBox );
|
connect( ui->aboutButton, &QPushButton::clicked, this, &WelcomePage::showAboutBox );
|
||||||
connect( Calamares::ModuleManager::instance(),
|
connect( Calamares::ModuleManager::instance(),
|
||||||
|
@ -34,7 +34,8 @@ CheckerContainer::CheckerContainer( const Calamares::RequirementsModel& model, Q
|
|||||||
CalamaresUtils::unmarginLayout( mainLayout );
|
CalamaresUtils::unmarginLayout( mainLayout );
|
||||||
|
|
||||||
mainLayout->addWidget( m_waitingWidget );
|
mainLayout->addWidget( m_waitingWidget );
|
||||||
CALAMARES_RETRANSLATE( if ( m_waitingWidget ) m_waitingWidget->setText( tr( "Gathering system information..." ) ); )
|
CALAMARES_RETRANSLATE( if ( m_waitingWidget )
|
||||||
|
m_waitingWidget->setText( tr( "Gathering system information..." ) ); );
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckerContainer::~CheckerContainer()
|
CheckerContainer::~CheckerContainer()
|
||||||
|
@ -121,7 +121,7 @@ ResultsListDialog::ResultsListDialog( const Calamares::RequirementsModel& model,
|
|||||||
|
|
||||||
connect( buttonBox, &QDialogButtonBox::clicked, this, &QDialog::close );
|
connect( buttonBox, &QDialogButtonBox::clicked, this, &QDialog::close );
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE_SLOT( &ResultsListDialog::retranslate )
|
CALAMARES_RETRANSLATE_SLOT( &ResultsListDialog::retranslate );
|
||||||
retranslate(); // Do it now to fill in the texts
|
retranslate(); // Do it now to fill in the texts
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ ResultsListWidget::ResultsListWidget( const Calamares::RequirementsModel& model,
|
|||||||
m_explanation->setAlignment( Qt::AlignCenter );
|
m_explanation->setAlignment( Qt::AlignCenter );
|
||||||
}
|
}
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE_SLOT( &ResultsListWidget::retranslate )
|
CALAMARES_RETRANSLATE_SLOT( &ResultsListWidget::retranslate );
|
||||||
retranslate();
|
retranslate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user