Commit 74e4b8bc authored by Edric Milaret's avatar Edric Milaret

UI: wait screen for setup wizard

Refs #73052

Change-Id: Ib53a79cbd4104b21aeaad570f89c57979ecb243d
parent 12353822
......@@ -21,5 +21,6 @@
<file>images/sort-variant.png</file>
<file>images/arrow-down.png</file>
<file>images/arrow-up.png</file>
<file>images/spinner.gif</file>
</qresource>
</RCC>
......@@ -19,7 +19,10 @@
#include "wizarddialog.h"
#include "ui_wizarddialog.h"
#include <QMovie>
#include "accountmodel.h"
#include "account.h"
#include "utils.h"
......@@ -33,6 +36,14 @@ WizardDialog::WizardDialog(QWidget *parent) :
this->setWindowFlags(Qt::FramelessWindowHint);
this->setFixedSize(this->width(),this->height());
ui->buttonBox->setEnabled(false);
ui->spinnerLabel->hide();
QMovie* movie = new QMovie(":images/spinner.gif");
if (movie->isValid())
{
ui->spinnerLabel->setMovie(movie);
movie->start();
}
}
WizardDialog::~WizardDialog()
......@@ -43,32 +54,34 @@ WizardDialog::~WizardDialog()
void
WizardDialog::accept()
{
ui->label->setText("Working...");
//ui->spinnerLabel->show();
ui->label->setText("Please wait while we create your account.");
ui->buttonBox->setEnabled(false);
ui->usernameEdit->setEnabled(false);
QtConcurrent::run(this, &WizardDialog::setup).waitForFinished();
}
repaint();
void
WizardDialog::endSetup()
{
QDialog::accept();
}
Utils::CreateStartupLink();
void
WizardDialog::setup()
{
auto account = AccountModel::instance()->add(ui->usernameEdit->text(), Account::Protocol::RING);
AccountModel::instance()->ip2ip()->setRingtonePath(Utils::GetRingtonePath());
account->setRingtonePath(Utils::GetRingtonePath());
AccountModel::instance()->save();
Utils::CreateStartupLink();
endSetup();
account->setUpnpEnabled(true);
connect(account, SIGNAL(changed(Account*)), this, SLOT(endSetup(Account*)));
account->performAction(Account::EditAction::SAVE);
}
void
WizardDialog::endSetup(Account* a)
{
Q_UNUSED(a)
QDialog::accept();
}
void
WizardDialog::on_usernameEdit_textChanged(const QString &arg1)
{
ui->buttonBox->setEnabled(!arg1.isEmpty());
ui->buttonBox->setEnabled(!arg1.isEmpty());
}
......@@ -22,6 +22,8 @@
#include <QDialog>
#include <QtConcurrent/QtConcurrent>
#include "account.h"
namespace Ui {
class WizardDialog;
}
......@@ -38,13 +40,14 @@ private slots:
void on_usernameEdit_textChanged(const QString &arg1);
void accept();
void endSetup();
private:
Ui::WizardDialog *ui;
private:
void setup();
private slots:
void endSetup(Account* a);
};
#endif // WIZARDDIALOG_H
......@@ -435,7 +435,17 @@
<string/>
</property>
<property name="pixmap">
<pixmap>:/images/logo-ring-standard-coul.png</pixmap>
<pixmap resource="ressources.qrc">:/images/logo-ring-standard-coul.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="spinnerLabel">
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
......@@ -471,7 +481,9 @@
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="ressources.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
......
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