[users] Use tooltips

- the explanations under and around the boxes is noisy,
   hard to size correctly (viz. issue #1202)
 - use tooltips in almost-all fields instead
 - add placeholder text to be more suggestive
This commit is contained in:
Adriaan de Groot 2019-10-29 14:37:26 +01:00
parent b3765bc144
commit 9ee0609b72
2 changed files with 49 additions and 66 deletions

View File

@ -88,7 +88,6 @@ UsersPage::UsersPage( QWidget* parent )
} );
connect( ui->checkBoxReusePassword, &QCheckBox::stateChanged, this, [this]( int checked ) {
ui->labelChooseRootPassword->setVisible( !checked );
ui->labelExtraRootPassword->setVisible( !checked );
ui->labelRootPassword->setVisible( !checked );
ui->labelRootPasswordError->setVisible( !checked );
ui->textBoxRootPassword->setVisible( !checked );
@ -105,24 +104,21 @@ UsersPage::UsersPage( QWidget* parent )
setPasswordCheckboxVisible( false );
// Don't expand the explanations to "stupid wide", but keep them vaguely as-wide-as
// the things they are explaining.
int boxWidth
= qMax( qMax( ui->textBoxUsername->width(), ui->textBoxHostname->width() ), ui->textBoxUserPassword->width() );
ui->username_extra_label_2->setMaximumWidth( 3 * boxWidth );
ui->hostname_extra_label_2->setMaximumWidth( 3 * boxWidth );
ui->password_extra_label_3->setMaximumWidth( 3 * boxWidth );
CALAMARES_RETRANSLATE(
ui->retranslateUi( this ); if ( Calamares::Settings::instance()->isSetupMode() ) {
ui->username_extra_label_2->setText( tr( "<small>If more than one person will "
ui->retranslateUi( this );
if ( Calamares::Settings::instance()->isSetupMode() )
{
ui->textBoxUsername->setToolTip( tr( "<small>If more than one person will "
"use this computer, you can create multiple "
"accounts after setup.</small>" ) );
} else {
ui->username_extra_label_2->setText( tr( "<small>If more than one person will "
}
else
{
ui->textBoxUsername->setToolTip( tr( "<small>If more than one person will "
"use this computer, you can create multiple "
"accounts after installation.</small>" ) );
} )
}
)
}

View File

@ -47,6 +47,9 @@
<height>0</height>
</size>
</property>
<property name="placeholderText">
<string>Your Full Name</string>
</property>
</widget>
</item>
<item>
@ -137,6 +140,9 @@
<height>0</height>
</size>
</property>
<property name="placeholderText">
<string>login</string>
</property>
</widget>
</item>
<item>
@ -191,19 +197,6 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="username_extra_label_2">
<property name="styleSheet">
<string notr="true">font-weight: normal</string>
</property>
<property name="text">
<string notr="true">&lt;Username extra label 2 text&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
@ -246,6 +239,12 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;small&gt;This name will be used if you make the computer visible to others on a network.&lt;/small&gt;</string>
</property>
<property name="placeholderText">
<string>Computer Name</string>
</property>
</widget>
</item>
<item>
@ -300,19 +299,6 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="hostname_extra_label_2">
<property name="styleSheet">
<string notr="true">font-weight: normal</string>
</property>
<property name="text">
<string>&lt;small&gt;This name will be used if you make the computer visible to others on a network.&lt;/small&gt;</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
@ -355,9 +341,15 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;small&gt;Enter the same password twice, so that it can be checked for typing errors. A good password will contain a mixture of letters, numbers and punctuation, should be at least eight characters long, and should be changed at regular intervals.&lt;/small&gt;</string>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
<property name="placeholderText">
<string>Password</string>
</property>
</widget>
</item>
<item>
@ -374,9 +366,15 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;small&gt;Enter the same password twice, so that it can be checked for typing errors. A good password will contain a mixture of letters, numbers and punctuation, should be at least eight characters long, and should be changed at regular intervals.&lt;/small&gt;</string>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
<property name="placeholderText">
<string>Repeat Password</string>
</property>
</widget>
</item>
<item>
@ -431,19 +429,6 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="password_extra_label_3">
<property name="styleSheet">
<string notr="true">font-weight: normal</string>
</property>
<property name="text">
<string>&lt;small&gt;Enter the same password twice, so that it can be checked for typing errors. A good password will contain a mixture of letters, numbers and punctuation, should be at least eight characters long, and should be changed at regular intervals.&lt;/small&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
@ -462,6 +447,9 @@
</item>
<item>
<widget class="QCheckBox" name="checkBoxValidatePassword">
<property name="toolTip">
<string>When this box is checked, password-strength checking is done and you will not be able to use a weak password.</string>
</property>
<property name="text">
<string>Require strong passwords.</string>
</property>
@ -523,9 +511,15 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;small&gt;Enter the same password twice, so that it can be checked for typing errors.&lt;/small&gt;</string>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
<property name="placeholderText">
<string>Password</string>
</property>
</widget>
</item>
<item>
@ -542,9 +536,15 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;small&gt;Enter the same password twice, so that it can be checked for typing errors.&lt;/small&gt;</string>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
<property name="placeholderText">
<string>Repeat Password</string>
</property>
</widget>
</item>
<item>
@ -599,19 +599,6 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="labelExtraRootPassword">
<property name="styleSheet">
<string notr="true">font-weight: normal</string>
</property>
<property name="text">
<string>&lt;small&gt;Enter the same password twice, so that it can be checked for typing errors.&lt;/small&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_7">
<property name="orientation">