[libcalamaresui] Set button texts always

- if the welcome module wasn't loaded (or loading otherwise failed)
   then no text was set, leading to confusing screens with
   buttons with icons but no label.
This commit is contained in:
Adriaan de Groot 2019-10-21 19:47:58 +02:00
parent 5ac4f3ec38
commit b78eacd7a8

View File

@ -86,9 +86,11 @@ setButtonIcon( QPushButton* button, const QString& name )
* to worry about as well as state. * to worry about as well as state.
*/ */
static inline QPushButton* static inline QPushButton*
makeButton( QWidget* parent, const QString& name ) makeButton( QWidget* parent, const QString& name, const QString& label )
{ {
QPushButton* button = new QPushButton( parent ); QPushButton* button = new QPushButton( parent );
button->setObjectName( name );
button->setText( label );
setButtonIcon( button, name ); setButtonIcon( button, name );
return button; return button;
} }
@ -108,9 +110,9 @@ ViewManager::ViewManager( QObject* parent )
mainLayout->addWidget( m_stack ); mainLayout->addWidget( m_stack );
// Create buttons and sets an initial icon; the icons may change // Create buttons and sets an initial icon; the icons may change
m_back = makeButton( m_widget, "go-previous" ); m_back = makeButton( m_widget, QStringLiteral( "go-previous" ), tr( "&Back" ) );
m_next = makeButton( m_widget, "go-next" ); m_next = makeButton( m_widget, QStringLiteral( "go-next" ), tr( "&Next" ) );
m_quit = makeButton( m_widget, "dialog-cancel" ); m_quit = makeButton( m_widget, QStringLiteral( "dialog-cancel" ), tr( "&Cancel" ) );
CALAMARES_RETRANSLATE_SLOT( &ViewManager::updateButtonLabels ) CALAMARES_RETRANSLATE_SLOT( &ViewManager::updateButtonLabels )