Commit 18d308be authored by Sébastien Blin's avatar Sébastien Blin

wizard: re-work account creation

+ Add backup page
+ Separate PIN/backup
+ Some renames
+ Add connect to JAMS

Change-Id: Ia173231837d6ef560957d99728f1b87447319ccc
parent 0c09fc32
......@@ -26,6 +26,11 @@
<summary>Display the chat to the rigth (default) or at the bottom.</summary>
<description>If the chat pane is horizontal then the chat is displayed to the right of the video; otherwise it will be displayed bellow it.</description>
</key>
<key name="never-show-backup-again" type="b">
<default>false</default>
<summary>Never display the backup key window.</summary>
<description>At the end of the account creation, the wizard show a window to export the account's key. This boolean is used to avoid to show this window again</description>
</key>
<key name="enable-display-links" type="b">
<default>true</default>
<summary>Enable chatview to display external images.</summary>
......
This diff is collapsed.
......@@ -32,6 +32,7 @@ namespace lrc
namespace api
{
class AVModel;
class NewAccountModel;
}
}
......@@ -47,11 +48,10 @@ typedef struct _AccountCreationWizard AccountCreationWizard;
typedef struct _AccountCreationWizardClass AccountCreationWizardClass;
GType account_creation_wizard_get_type (void) G_GNUC_CONST;
GtkWidget *account_creation_wizard_new (bool cancel_button, lrc::api::AVModel& avModel);
GtkWidget *account_creation_wizard_new (lrc::api::AVModel& avModel, lrc::api::NewAccountModel& accountModel);
void account_creation_wizard_show_preview (AccountCreationWizard *win, gboolean show_preview = TRUE);
void account_creation_wizard_cancel (AccountCreationWizard *win);
void account_creation_wizard_account_added (AccountCreationWizard *view, AccountInfoPointer const & accountInfo);
void account_creation_wizard_account_added (AccountCreationWizard *view, const std::string& id);
void account_creation_show_error_view (AccountCreationWizard *view, const std::string& id);
G_END_DECLS
......@@ -343,7 +343,7 @@ chat_view_init(ChatView *view)
gtk_widget_init_template(GTK_WIDGET(view));
ChatViewPrivate *priv = CHAT_VIEW_GET_PRIVATE(view);
priv->settings = g_settings_new_full(get_ring_schema(), NULL, NULL);
priv->settings = g_settings_new_full(get_settings_schema(), NULL, NULL);
}
static void
......
......@@ -947,7 +947,7 @@ CppImpl::insertControls()
g_signal_connect(widgets->togglebutton_chat, "toggled", G_CALLBACK(on_togglebutton_chat_toggled), self);
/* bind the chat orientation to the gsetting */
widgets->settings = g_settings_new_full(get_ring_schema(), nullptr, nullptr);
widgets->settings = g_settings_new_full(get_settings_schema(), nullptr, nullptr);
g_settings_bind_with_mapping(widgets->settings, "chat-pane-horizontal",
widgets->paned_call, "orientation",
G_SETTINGS_BIND_GET,
......
......@@ -198,7 +198,7 @@ change_prefered_directory (gchar * directory, GeneralSettingsView *self, gchar *
g_return_if_fail(IS_GENERAL_SETTINGS_VIEW(self));
GeneralSettingsViewPrivate *priv = GENERAL_SETTINGS_VIEW_GET_PRIVATE(self);
priv->settings = g_settings_new_full(get_ring_schema(), NULL, NULL);
priv->settings = g_settings_new_full(get_settings_schema(), NULL, NULL);
g_settings_set_value(priv->settings, id, g_variant_new("s", directory));
cb(self);
}
......@@ -291,7 +291,7 @@ general_settings_view_init(GeneralSettingsView *self)
GeneralSettingsViewPrivate *priv = GENERAL_SETTINGS_VIEW_GET_PRIVATE(self);
priv->settings = g_settings_new_full(get_ring_schema(), NULL, NULL);
priv->settings = g_settings_new_full(get_settings_schema(), NULL, NULL);
GtkStyleContext* context;
context = gtk_widget_get_style_context(GTK_WIDGET(priv->button_clear_history));
......
......@@ -184,7 +184,7 @@ incoming_call_view_init(IncomingCallView *view)
auto priv = INCOMING_CALL_VIEW_GET_PRIVATE(view);
/* bind the chat orientation to the gsetting */
priv->settings = g_settings_new_full(get_ring_schema(), NULL, NULL);
priv->settings = g_settings_new_full(get_settings_schema(), NULL, NULL);
g_settings_bind_with_mapping(priv->settings, "chat-pane-horizontal",
priv->paned_call, "orientation",
G_SETTINGS_BIND_GET,
......
......@@ -604,7 +604,7 @@ ring_client_init(RingClient *self)
priv->win = NULL;
priv->qtapp = NULL;
priv->settings = g_settings_new_full(get_ring_schema(), NULL, NULL);
priv->settings = g_settings_new_full(get_settings_schema(), NULL, NULL);
/* add custom cmd line options */
ring_client_add_options(G_APPLICATION(self));
......
......@@ -371,6 +371,8 @@ public:
std::string eventUid_;
std::string eventBody_;
bool isCreatingAccount {false};
private:
CppImpl() = delete;
CppImpl(const CppImpl&) = delete;
......@@ -519,9 +521,26 @@ on_account_creation_completed(RingMainWindow* self)
{
g_return_if_fail(IS_RING_MAIN_WINDOW(self));
auto* priv = RING_MAIN_WINDOW_GET_PRIVATE(RING_MAIN_WINDOW(self));
priv->cpp->isCreatingAccount = false;
priv->cpp->leaveAccountCreationWizard();
}
static void
on_account_creation_unlock(RingMainWindow* self)
{
g_return_if_fail(IS_RING_MAIN_WINDOW(self));
auto* priv = RING_MAIN_WINDOW_GET_PRIVATE(RING_MAIN_WINDOW(self));
priv->cpp->isCreatingAccount = false;
}
static void
on_account_creation_lock(RingMainWindow* self)
{
g_return_if_fail(IS_RING_MAIN_WINDOW(self));
auto* priv = RING_MAIN_WINDOW_GET_PRIVATE(RING_MAIN_WINDOW(self));
priv->cpp->isCreatingAccount = true;
}
static void
on_account_changed(RingMainWindow* self)
{
......@@ -542,7 +561,7 @@ on_account_changed(RingMainWindow* self)
if (g_strcmp0("", accountId) == 0) {
priv->cpp->enterAccountCreationWizard(true);
} else {
priv->cpp->leaveAccountCreationWizard();
if (!priv->cpp->isCreatingAccount) priv->cpp->leaveAccountCreationWizard();
if (priv->cpp->accountInfo_ && changeTopAccount) {
priv->cpp->accountInfo_->accountModel->setTopAccount(accountId);
}
......@@ -1170,7 +1189,7 @@ CppImpl::init()
[this](const std::string& id){ slotInvalidAccountFromLrc(id); });
/* bind to window size settings */
widgets->settings = g_settings_new_full(get_ring_schema(), nullptr, nullptr);
widgets->settings = g_settings_new_full(get_settings_schema(), nullptr, nullptr);
auto width = g_settings_get_int(widgets->settings, "window-width");
auto height = g_settings_get_int(widgets->settings, "window-height");
gtk_window_set_default_size(GTK_WINDOW(self), width, height);
......@@ -1654,9 +1673,13 @@ void
CppImpl::enterAccountCreationWizard(bool showControls)
{
if (!widgets->account_creation_wizard) {
widgets->account_creation_wizard = account_creation_wizard_new(false, lrc_->getAVModel());
widgets->account_creation_wizard = account_creation_wizard_new(lrc_->getAVModel(), lrc_->getAccountModel());
g_object_add_weak_pointer(G_OBJECT(widgets->account_creation_wizard),
reinterpret_cast<gpointer*>(&widgets->account_creation_wizard));
g_signal_connect_swapped(widgets->account_creation_wizard, "account-creation-lock",
G_CALLBACK(on_account_creation_lock), self);
g_signal_connect_swapped(widgets->account_creation_wizard, "account-creation-unlock",
G_CALLBACK(on_account_creation_unlock), self);
g_signal_connect_swapped(widgets->account_creation_wizard, "account-creation-completed",
G_CALLBACK(on_account_creation_completed), self);
......@@ -2000,7 +2023,7 @@ CppImpl::slotAccountAddedFromLrc(const std::string& id)
auto old_view = gtk_stack_get_visible_child(GTK_STACK(widgets->stack_main_view));
if(IS_ACCOUNT_CREATION_WIZARD(old_view)) {
// TODO finalize (set avatar + register name)
account_creation_wizard_account_added(ACCOUNT_CREATION_WIZARD(old_view), &account_info);
account_creation_wizard_account_added(ACCOUNT_CREATION_WIZARD(old_view), id);
}
if (!accountInfo_) {
updateLrc(id);
......
......@@ -133,7 +133,7 @@ autostart_symlink(gboolean autostart)
}
GSettingsSchema *
get_ring_schema()
get_settings_schema()
{
static std::unique_ptr<GSettingsSchema, decltype(g_settings_schema_unref )&>
ring_schema(nullptr, g_settings_schema_unref);
......
......@@ -26,7 +26,7 @@ G_BEGIN_DECLS
void autostart_symlink(gboolean autostart);
GSettingsSchema *get_ring_schema();
GSettingsSchema *get_settings_schema();
G_END_DECLS
......
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