Commit 955b957b authored by Anthony Léonard's avatar Anthony Léonard

Refactoring of wizard dialog for UI consistency and clarity

The following changes have been made:
 - Many labels were changed for consistency between versions
 - Account creation is split between profile and account panels
 - Linking a device now show a little explanation on how to generate
   a PIN code

Change-Id: Ifdd832f36ada09c2d1ed61f35b670e8b94983c88
Tuleap: #1293
parent ea6d71b1
......@@ -285,7 +285,7 @@ QWidget#messagingPage{
background: rgb(242, 242, 242);
}
QPushButton#wizardButton, QPushButton#playButton, QPushButton#clearHistoryButton, QPushButton#doTransferButton,
QPushButton#nextButton, QPushButton#playButton, QPushButton#clearHistoryButton, QPushButton#doTransferButton,
QPushButton#checkUpdateButton, QPushButton#photoButton, QPushButton#takePhotoButton, QPushButton#importButton,
QPushButton#existingPushButton, QPushButton#newAccountButton, QPushButton#previousButton, QPushButton#exportButton,
QPushButton#cancelAddButton, QPushButton#exportOnRingButton, QPushButton#addDeviceButton, QPushButton#exportEndedOkButton,
......@@ -296,7 +296,7 @@ QPushButton#errorPushButton, QPushButton#registerButton{
font: 14px;
}
QPushButton#wizardButton:hover, QPushButton#playButton:hover, QPushButton#clearHistoryButton:hover,
QPushButton#nextButton:hover, QPushButton#playButton:hover, QPushButton#clearHistoryButton:hover,
QPushButton#checkUpdateButton:hover, QPushButton#doTransferButton:hover, QPushButton#photoButton:hover,
QPushButton#takePhotoButton:hover, QPushButton#importButton:hover,
QPushButton#existingPushButton:hover, QPushButton#newAccountButton:hover, QPushButton#previousButton:hover,
......@@ -306,7 +306,7 @@ QPushButton#registerButton:hover{
background-color: #4dc6d6;
}
QPushButton#wizardButton:pressed, QPushButton#playButton:pressed, QPushButton#clearHistoryButton:pressed,
QPushButton#nextButton:pressed, QPushButton#playButton:pressed, QPushButton#clearHistoryButton:pressed,
QPushButton#checkUpdateButton:pressed, QPushButton#doTransferButton:pressed, QPushButton#photoButton:pressed,
QPushButton#takePhotoButton:pressed, QPushButton#importButton:pressed,
QPushButton#existingPushButton:pressed, QPushButton#newAccountButton:pressed, QPushButton#previousButton:pressed,
......@@ -316,7 +316,8 @@ QPushButton#registerButton:pressed{
background-color: #34acbd;
}
QLineEdit#usernameEdit:enabled, QLineEdit#passwordEdit:enabled, QLineEdit#confirmPasswordEdit:enabled, QLineEdit#pinEdit:enabled{
QLineEdit#usernameEdit:enabled, QLineEdit#passwordEdit:enabled, QLineEdit#confirmPasswordEdit:enabled,
QLineEdit#pinEdit:enabled, QLineEdit#fullNameEdit:enabled{
border-color: rgb(0, 192, 212);
border-radius: 5px;
border-width: 1px;
......@@ -324,7 +325,8 @@ QLineEdit#usernameEdit:enabled, QLineEdit#passwordEdit:enabled, QLineEdit#confir
background-color: rgb(255, 255, 255);
}
QLineEdit#usernameEdit:disabled, QLineEdit#passwordEdit:disabled, QLineEdit#confirmPasswordEdit:disabled, QLineEdit#pinEdit:disabled{
QLineEdit#usernameEdit:disabled, QLineEdit#passwordEdit:disabled, QLineEdit#confirmPasswordEdit:disabled,
QLineEdit#pinEdit:disabled, QLineEdit#fullNameEdit:disabled{
border-color: rgb(159, 157, 154);
border-radius: 5px;
border-width: 1px;
......@@ -542,7 +544,7 @@ QPushButton#upAudioButton, QPushButton#downAudioButton, QPushButton#upVideoButto
QPushButton#avatarButton:hover {
border: 2px solid rgb(77, 77, 77);
border-radius: 37px;
border-radius: 50px;
}
QWidget#leftPannel{
......
......@@ -45,27 +45,27 @@ WizardDialog::WizardDialog(WizardMode wizardMode, Account* toBeMigrated, QWidget
setWindowFlags(flags);
QPixmap logo(":/images/logo-ring-standard-coul.png");
ui->ringLogo->setPixmap(logo.scaledToHeight(65, Qt::SmoothTransformation));
ui->ringLogo->setAlignment(Qt::AlignHCenter);
ui->welcomeLogo->setPixmap(logo.scaledToHeight(65, Qt::SmoothTransformation));
ui->welcomeLogo->setAlignment(Qt::AlignHCenter);
ui->usernameEdit->setText(Utils::GetCurrentUserName());
ui->fullNameEdit->setText(Utils::GetCurrentUserName());
movie_ = new QMovie(":/images/loading.gif");
ui->spinnerLabel->setMovie(movie_);
movie_->start();
if (wizardMode_ == MIGRATION) {
ui->stackedWidget->setCurrentIndex(1);
ui->stackedWidget->setCurrentWidget(ui->profilePage);
ui->usernameEdit->setEnabled(false);
ui->usernameEdit->setText(toBeMigrated->displayName());
ui->previousButton->hide();
ui->avatarButton->hide();
ui->pinEdit->hide();
ui->label->setText(tr("Your account needs to be migrated. Choose a password."));
}
ui->usernameLabel->setText(tr("Your account needs to be migrated. Choose a password."));
} else
ui->navBarWidget->hide();
ui->searchingStateLabel->clear();
connect(&NameDirectory::instance(), SIGNAL(registeredNameFound(const Account*,NameDirectory::LookupStatus,const QString&,const QString&)),
this, SLOT(handle_registeredNameFound(const Account*,NameDirectory::LookupStatus,const QString&,const QString&)));
......@@ -97,9 +97,12 @@ WizardDialog::accept()
ui->confirmPasswordEdit->setStyleSheet("border-color: rgb(0, 192, 212);");
ui->pinEdit->setStyleSheet("border-color: rgb(0, 192, 212);");
}
ui->progressLabel->setText(tr("Generating your Ring account..."));
ui->stackedWidget->setCurrentIndex(2);
if (wizardMode_ == MIGRATION)
ui->progressLabel->setText(tr("Migrating your Ring account..."));
else
ui->progressLabel->setText(tr("Generating your Ring account..."));
ui->navBarWidget->hide();
ui->stackedWidget->setCurrentWidget(ui->spinnerPage);
auto profile = ProfileModel::instance().selectedProfile();
......@@ -109,9 +112,9 @@ WizardDialog::accept()
if (account_ == nullptr) {
account_ = AccountModel::instance().add(ui->usernameEdit->text(), Account::Protocol::RING);
if (not ui->usernameEdit->text().isEmpty()) {
account_->setDisplayName(ui->usernameEdit->text());
profile->person()->setFormattedName(ui->usernameEdit->text());
if (not ui->fullNameEdit->text().isEmpty()) {
account_->setDisplayName(ui->fullNameEdit->text());
profile->person()->setFormattedName(ui->fullNameEdit->text());
}
else {
profile->person()->setFormattedName(tr("Unknown"));
......@@ -208,11 +211,17 @@ WizardDialog::on_newAccountButton_clicked()
void
WizardDialog::changePage(bool existingAccount)
{
ui->stackedWidget->setCurrentIndex(1);
if (existingAccount) { // If user want to add a device
ui->accountLabel->setText(tr("Add a device"));
ui->stackedWidget->setCurrentWidget(ui->explanationPage);
} else { // If user want to create a new account
ui->accountLabel->setText(tr("Create your account"));
ui->stackedWidget->setCurrentWidget(ui->profilePage);
}
ui->navBarWidget->show();
ui->avatarButton->setHidden(existingAccount);
ui->ringLogo->setHidden(existingAccount);
ui->label->setHidden(existingAccount);
ui->usernameLabel->setHidden(existingAccount);
ui->usernameEdit->setHidden(existingAccount);
ui->signUpCheckbox->setHidden(existingAccount);
ui->signUpCheckbox->setChecked(!existingAccount);
......@@ -222,10 +231,42 @@ WizardDialog::changePage(bool existingAccount)
ui->pinEdit->setVisible(existingAccount);
}
void
WizardDialog::on_nextButton_clicked()
{
const QWidget* curWidget = ui->stackedWidget->currentWidget();
if (curWidget == ui->profilePage) {
ui->stackedWidget->setCurrentWidget(ui->accountPage);
}
else if (curWidget == ui->explanationPage) {
ui->stackedWidget->setCurrentWidget(ui->accountPage);
}
else if (curWidget == ui->accountPage) {
accept();
}
}
void
WizardDialog::on_previousButton_clicked()
{
ui->stackedWidget->setCurrentIndex(0);
const QWidget* curWidget = ui->stackedWidget->currentWidget();
if (curWidget == ui->profilePage) {
ui->navBarWidget->hide();
ui->stackedWidget->setCurrentWidget(ui->welcomePage);
}
else if (curWidget == ui->explanationPage) {
ui->navBarWidget->hide();
ui->stackedWidget->setCurrentWidget(ui->welcomePage);
}
else if (curWidget == ui->accountPage) {
if (ui->pinEdit->isVisible()) // If we are adding a device
ui->stackedWidget->setCurrentWidget(ui->explanationPage);
else // If we are creating a new account
ui->stackedWidget->setCurrentWidget(ui->profilePage);
}
ui->passwordEdit->setStyleSheet("border-color: rgb(0, 192, 212);");
ui->confirmPasswordEdit->setStyleSheet("border-color: rgb(0, 192, 212);");
ui->pinEdit->setStyleSheet("border-color: rgb(0, 192, 212);");
......
......@@ -53,6 +53,7 @@ private slots:
void on_avatarButton_clicked();
void on_existingPushButton_clicked();
void on_newAccountButton_clicked();
void on_nextButton_clicked();
void on_previousButton_clicked();
void on_passwordEdit_textChanged(const QString& arg1);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment