Skip to content
Snippets Groups Projects
Commit 74e4b8bc authored by Edric Milaret's avatar Edric Milaret
Browse files

UI: wait screen for setup wizard

Refs #73052

Change-Id: Ib53a79cbd4104b21aeaad570f89c57979ecb243d
parent 12353822
No related branches found
No related tags found
No related merge requests found
images/spinner.gif

10.5 KiB

...@@ -21,5 +21,6 @@ ...@@ -21,5 +21,6 @@
<file>images/sort-variant.png</file> <file>images/sort-variant.png</file>
<file>images/arrow-down.png</file> <file>images/arrow-down.png</file>
<file>images/arrow-up.png</file> <file>images/arrow-up.png</file>
<file>images/spinner.gif</file>
</qresource> </qresource>
</RCC> </RCC>
...@@ -19,7 +19,10 @@ ...@@ -19,7 +19,10 @@
#include "wizarddialog.h" #include "wizarddialog.h"
#include "ui_wizarddialog.h" #include "ui_wizarddialog.h"
#include <QMovie>
#include "accountmodel.h" #include "accountmodel.h"
#include "account.h"
#include "utils.h" #include "utils.h"
...@@ -33,6 +36,14 @@ WizardDialog::WizardDialog(QWidget *parent) : ...@@ -33,6 +36,14 @@ WizardDialog::WizardDialog(QWidget *parent) :
this->setWindowFlags(Qt::FramelessWindowHint); this->setWindowFlags(Qt::FramelessWindowHint);
this->setFixedSize(this->width(),this->height()); this->setFixedSize(this->width(),this->height());
ui->buttonBox->setEnabled(false); 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() WizardDialog::~WizardDialog()
...@@ -43,28 +54,30 @@ WizardDialog::~WizardDialog() ...@@ -43,28 +54,30 @@ WizardDialog::~WizardDialog()
void void
WizardDialog::accept() WizardDialog::accept()
{ {
ui->label->setText("Working..."); //ui->spinnerLabel->show();
ui->label->setText("Please wait while we create your account.");
ui->buttonBox->setEnabled(false); ui->buttonBox->setEnabled(false);
ui->usernameEdit->setEnabled(false); ui->usernameEdit->setEnabled(false);
QtConcurrent::run(this, &WizardDialog::setup).waitForFinished(); repaint();
}
void Utils::CreateStartupLink();
WizardDialog::endSetup()
{
QDialog::accept();
}
void
WizardDialog::setup()
{
auto account = AccountModel::instance()->add(ui->usernameEdit->text(), Account::Protocol::RING); auto account = AccountModel::instance()->add(ui->usernameEdit->text(), Account::Protocol::RING);
AccountModel::instance()->ip2ip()->setRingtonePath(Utils::GetRingtonePath()); AccountModel::instance()->ip2ip()->setRingtonePath(Utils::GetRingtonePath());
account->setRingtonePath(Utils::GetRingtonePath()); account->setRingtonePath(Utils::GetRingtonePath());
AccountModel::instance()->save(); account->setUpnpEnabled(true);
Utils::CreateStartupLink();
endSetup(); 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 void
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include <QDialog> #include <QDialog>
#include <QtConcurrent/QtConcurrent> #include <QtConcurrent/QtConcurrent>
#include "account.h"
namespace Ui { namespace Ui {
class WizardDialog; class WizardDialog;
} }
...@@ -38,13 +40,14 @@ private slots: ...@@ -38,13 +40,14 @@ private slots:
void on_usernameEdit_textChanged(const QString &arg1); void on_usernameEdit_textChanged(const QString &arg1);
void accept(); void accept();
void endSetup();
private: private:
Ui::WizardDialog *ui; Ui::WizardDialog *ui;
private: private:
void setup(); void setup();
private slots:
void endSetup(Account* a);
}; };
#endif // WIZARDDIALOG_H #endif // WIZARDDIALOG_H
...@@ -435,7 +435,17 @@ ...@@ -435,7 +435,17 @@
<string/> <string/>
</property> </property>
<property name="pixmap"> <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>
<property name="scaledContents"> <property name="scaledContents">
<bool>true</bool> <bool>true</bool>
...@@ -471,7 +481,9 @@ ...@@ -471,7 +481,9 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<resources/> <resources>
<include location="ressources.qrc"/>
</resources>
<connections> <connections>
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment