blob: 6d4cfdacd6b732e6587293b7f980d7da78a5eee0 [file] [log] [blame]
Olivier SOLDANO47aa97f2017-04-04 10:40:00 -04001/**************************************************************************
Anthony Léonard2fde81d2017-04-17 10:06:55 -04002* Copyright (C) 2015-2017 by Savoir-faire Linux *
Olivier SOLDANO47aa97f2017-04-04 10:40:00 -04003* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
4* Author: Anthony Léonard <anthony.leonard@savoirfairelinux.com> *
5* Author: Olivier Soldano <olivier.soldano@savoirfairelinux.com> *
6* *
7* This program is free software; you can redistribute it and/or modify *
8* it under the terms of the GNU General Public License as published by *
9* the Free Software Foundation; either version 3 of the License, or *
10* (at your option) any later version. *
11* *
12* This program is distributed in the hope that it will be useful, *
13* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15* GNU General Public License for more details. *
16* *
17* You should have received a copy of the GNU General Public License *
18* along with this program. If not, see <http://www.gnu.org/licenses/>. *
19**************************************************************************/
Edric Milaret67007d12015-05-07 09:40:09 -040020
Edric Milaret5f316da2015-09-28 11:57:42 -040021#pragma once
Edric Milaret559bda52015-04-29 17:02:31 -040022
23#include <QDialog>
Edric Milaret67007d12015-05-07 09:40:09 -040024#include <QtConcurrent/QtConcurrent>
Edric Milaret559bda52015-04-29 17:02:31 -040025
Edric Milaret74e4b8b2015-05-15 10:25:00 -040026#include "account.h"
Edric Milaret25236d92016-03-28 09:40:58 -040027#include "person.h"
Edric Milaret74e4b8b2015-05-15 10:25:00 -040028
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040029// new lrc
30#include "lrcinstance.h"
31
Edric Milaret559bda52015-04-29 17:02:31 -040032namespace Ui {
33class WizardDialog;
34}
35
36class WizardDialog : public QDialog
37{
38 Q_OBJECT
39
40public:
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040041 using AccountInfo = lrc::api::account::Info;
42
Edric Milaret57467842016-08-30 13:06:11 -040043 enum WizardMode {
44 WIZARD,
45 NEW_ACCOUNT,
Olivier SOLDANO1cd96172017-09-22 16:57:22 -040046 IMPORT,
Edric Milaret57467842016-08-30 13:06:11 -040047 MIGRATION
48 };
49
50public:
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040051 explicit WizardDialog(WizardMode wizardMode = WIZARD, AccountInfo* toBeMigrated = nullptr, QWidget* parent = 0);
Edric Milaret559bda52015-04-29 17:02:31 -040052 ~WizardDialog();
53
Edric Milaret25236d92016-03-28 09:40:58 -040054//UI Slots
55private slots:
Edric Milaret57467842016-08-30 13:06:11 -040056 void on_existingPushButton_clicked();
57 void on_newAccountButton_clicked();
Anthony Léonard955b9572016-11-10 13:28:39 -050058 void on_nextButton_clicked();
Edric Milaret57467842016-08-30 13:06:11 -040059 void on_previousButton_clicked();
60 void on_passwordEdit_textChanged(const QString& arg1);
Edric Milaret74e4b8b2015-05-15 10:25:00 -040061
62private slots:
Anthony Léonardaa90e1a2016-10-12 11:24:17 -040063 void on_usernameEdit_textChanged(const QString& arg1);
Olivier SOLDANOb58f9c22017-07-20 13:44:05 -040064 void handle_registeredNameFound(Account *account, NameDirectory::LookupStatus status, const QString& address, const QString& name);
Anthony Léonardaa90e1a2016-10-12 11:24:17 -040065 void handle_nameRegistrationEnded(NameDirectory::RegisterNameStatus status, const QString& name);
66 void timeoutNameLookupTimer();
Olivier SOLDANO3dad1752017-07-13 14:08:53 -040067 void on_photoTaken(QString fileName);
Olivier SOLDANOaa47f602017-08-17 16:38:11 -040068 void on_signUpCheckbox_toggled(bool checked);
Olivier SOLDANOc1ca2df2017-09-06 16:01:46 -040069 void closeEvent(QCloseEvent* event);
Olivier SOLDANO1cd96172017-09-22 16:57:22 -040070 void on_archivePathSelector_clicked();
71 void on_dhtImportBtn_clicked();
72 void on_fileImportBtn_clicked();
Edric Milaret25236d92016-03-28 09:40:58 -040073
74private:
75 Ui::WizardDialog* ui;
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040076 AccountInfo* account_;
Edric Milaret57467842016-08-30 13:06:11 -040077 WizardMode wizardMode_;
78 QMovie* movie_;
Anthony Léonardaa90e1a2016-10-12 11:24:17 -040079 QTimer nameLookupTimer_;
Edric Milaret25236d92016-03-28 09:40:58 -040080
81 void setup();
Edric Milaret57467842016-08-30 13:06:11 -040082 void changePage(bool existingAccount);
Olivier SOLDANO1cd96172017-09-22 16:57:22 -040083 void validateFileImport();
84 void createRingAccount(const QString &displayName = QString(),
85 const QString &password = QString(),
86 const QString &pin = QString(),
87 const QString &archivePath = QString());
88 void processWizardInformations();
Edric Milaret559bda52015-04-29 17:02:31 -040089};