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