Commit d5a9a2e0 authored by Sébastien Blin's avatar Sébastien Blin

setting: add rendez-vous option

Change-Id: I1e9479c0967fdd9dbcdc064e22408b73275824f1
parent 69e52c12
......@@ -322,7 +322,6 @@ public:
void toggleFullScreen();
void resetToWelcome();
void refreshPendingContactRequestTab();
void changeAccountSelection(const std::string& id);
void onAccountSelectionChange(const std::string& id);
void enterAccountCreationWizard(bool showControls = false);
void leaveAccountCreationWizard();
......@@ -364,7 +363,6 @@ public:
QMetaObject::Connection closeTrustRequestNotification_;
QMetaObject::Connection slotNewInteraction_;
QMetaObject::Connection slotReadInteraction_;
QMetaObject::Connection changeAccountConnection_;
QMetaObject::Connection newAccountConnection_;
QMetaObject::Connection rmAccountConnection_;
QMetaObject::Connection invalidAccountConnection_;
......@@ -1446,7 +1444,6 @@ CppImpl::~CppImpl()
QObject::disconnect(filterChangedConnection_);
QObject::disconnect(newConversationConnection_);
QObject::disconnect(conversationRemovedConnection_);
QObject::disconnect(changeAccountConnection_);
QObject::disconnect(newAccountConnection_);
QObject::disconnect(rmAccountConnection_);
QObject::disconnect(invalidAccountConnection_);
......@@ -1778,35 +1775,6 @@ CppImpl::leaveAccountCreationWizard()
showAccountSelectorWidget();
}
/// Change the selection of the account ComboBox by account Id.
/// Find in displayed accounts with one corresponding to the given id, then select it
void
CppImpl::changeAccountSelection(const std::string& id)
{
// already selected?
if (id == accountInfo_->id.toStdString())
return;
if (auto* model = gtk_combo_box_get_model(GTK_COMBO_BOX(widgets->combobox_account_selector))) {
GtkTreeIter iter;
auto valid = gtk_tree_model_get_iter_first(model, &iter);
while (valid) {
gchar* account_id;
gtk_tree_model_get(model, &iter, 0 /* col# */, &account_id /* data */, -1);
if (id == account_id) {
widgets->set_top_account_flag = false;
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(widgets->combobox_account_selector), &iter);
g_free(account_id);
return;
}
valid = gtk_tree_model_iter_next(model, &iter);
g_free(account_id);
}
g_debug("BUGS: account not listed: %s", id.c_str());
}
}
void
CppImpl::onAccountSelectionChange(const std::string& id)
{
......@@ -1938,7 +1906,6 @@ CppImpl::updateLrc(const std::string& id, const std::string& accountIdToFlagFree
QObject::disconnect(showLeaveMessageViewConnection_);
QObject::disconnect(showChatViewConnection_);
QObject::disconnect(showIncomingViewConnection_);
QObject::disconnect(changeAccountConnection_);
QObject::disconnect(showCallViewConnection_);
QObject::disconnect(newTrustRequestNotification_);
QObject::disconnect(closeTrustRequestNotification_);
......@@ -2395,7 +2362,8 @@ CppImpl::slotShowChatView(const std::string& id, lrc::api::conversation::Info or
if (IS_INCOMING_CALL_VIEW(old_view) && is_showing_let_a_message_view(INCOMING_CALL_VIEW(old_view), origin)) {
return;
}
changeAccountSelection(id);
if (accountInfo_->id.toStdString() != id)
return;
// Show chat view if not in call (unless if it's the same conversation)
lrc::api::conversation::Info current_item;
current_item.uid = "-1";
......@@ -2425,7 +2393,8 @@ CppImpl::slotShowLeaveMessageView(lrc::api::conversation::Info conv)
void
CppImpl::slotShowCallView(const std::string& id, lrc::api::conversation::Info origin)
{
changeAccountSelection(id);
if (accountInfo_->id.toStdString() != id)
return;
// Change the view if we want a different view.
auto* old_view = gtk_bin_get_child(GTK_BIN(widgets->frame_call));
......@@ -2565,7 +2534,8 @@ CppImpl::slotCloseInteraction(const std::string& accountId, const std::string& c
void
CppImpl::slotShowIncomingCallView(const std::string& id, lrc::api::conversation::Info origin)
{
changeAccountSelection(id);
if (accountInfo_->id.toStdString() != id)
return;
/* call changeView even if we are already in an incoming call view, since
the incoming call view holds a copy of the conversation info which has
......
......@@ -114,6 +114,7 @@ struct _NewAccountSettingsViewPrivate
GtkWidget* allow_call_row;
GtkWidget* call_allow_button;
GtkWidget* auto_answer_button;
GtkWidget* rendez_vous_button;
GtkWidget* custom_ringtone_button;
GtkWidget* filechooserbutton_custom_ringtone;
GtkWidget* box_name_server;
......@@ -291,6 +292,7 @@ new_account_settings_view_class_init(NewAccountSettingsViewClass *klass)
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, allow_call_row);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, call_allow_button);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, auto_answer_button);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, rendez_vous_button);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, custom_ringtone_button);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, filechooserbutton_custom_ringtone);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, box_name_server);
......@@ -1004,6 +1006,18 @@ update_auto_answer(GObject*, GParamSpec*, NewAccountSettingsView *view)
}
}
static void
update_rendez_vous(GObject*, GParamSpec*, NewAccountSettingsView *view)
{
if (!is_config_ok(view)) return;
auto* priv = NEW_ACCOUNT_SETTINGS_VIEW_GET_PRIVATE(view);
auto newState = gtk_switch_get_active(GTK_SWITCH(priv->rendez_vous_button));
if (newState != priv->currentProp_->isRendezVous) {
priv->currentProp_->isRendezVous = newState;
new_account_settings_view_save_account(view);
}
}
static void
enable_custom_ringtone(GObject*, GParamSpec*, NewAccountSettingsView *view)
{
......@@ -1917,6 +1931,7 @@ build_settings_view(NewAccountSettingsView* view)
g_signal_connect_swapped(priv->sip_button_delete_account, "clicked", G_CALLBACK(remove_account), view);
g_signal_connect(priv->call_allow_button, "notify::active", G_CALLBACK(update_allow_call), view);
g_signal_connect(priv->auto_answer_button, "notify::active", G_CALLBACK(update_auto_answer), view);
g_signal_connect(priv->rendez_vous_button, "notify::active", G_CALLBACK(update_rendez_vous), view);
g_signal_connect(priv->custom_ringtone_button, "notify::active", G_CALLBACK(enable_custom_ringtone), view);
g_signal_connect(priv->filechooserbutton_custom_ringtone, "file-set", G_CALLBACK(update_custom_ringtone), view);
g_signal_connect(priv->entry_name_server, "focus-out-event", G_CALLBACK(update_nameserver), view);
......@@ -2186,6 +2201,7 @@ new_account_settings_view_update(NewAccountSettingsView *view, gboolean reset_vi
// advanced
gtk_switch_set_active(GTK_SWITCH(priv->call_allow_button), priv->currentProp_->DHT.PublicInCalls);
gtk_switch_set_active(GTK_SWITCH(priv->auto_answer_button), priv->currentProp_->autoAnswer);
gtk_switch_set_active(GTK_SWITCH(priv->rendez_vous_button), priv->currentProp_->isRendezVous);
gtk_entry_set_text(GTK_ENTRY(priv->entry_name_server), qUtf8Printable(priv->currentProp_->RingNS.uri));
gtk_entry_set_text(GTK_ENTRY(priv->entry_dht_proxy), qUtf8Printable(priv->currentProp_->proxyServer));
......
......@@ -1240,6 +1240,44 @@
</child>
</object>
</child>
<!-- Rendez Vous -->
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">fill</property>
<child>
<object class="GtkBox" id="rendez_vous_box">
<property name="visible">True</property>
<property name="halign">fill</property>
<property name="orientation">horizontal</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<child>
<object class="GtkLabel" id="label_rendez_vous">
<property name="margin_right">12</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">(Experimental) Rendez-vous: turn your account into a conference room</property>
</object>
</child>
<child>
<object class="GtkSwitch" id="rendez_vous_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
......
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