Commit 24fbf117 authored by Sébastien Blin's avatar Sébastien Blin

chatview: add video recorder

Change-Id: Ia71fa51bd2d490ba5b710ce2b77f489eb7f466f6
parent 9fbc163f
...@@ -23,7 +23,9 @@ ...@@ -23,7 +23,9 @@
<file alias="mute_video">ic_videocam_white_24px.svg</file> <file alias="mute_video">ic_videocam_white_24px.svg</file>
<file alias="pause">ic_pause_white_24px.svg</file> <file alias="pause">ic_pause_white_24px.svg</file>
<file alias="stop">baseline-stop-24px.svg</file> <file alias="stop">baseline-stop-24px.svg</file>
<file alias="stop-white">stop-white.svg</file>
<file alias="send">baseline-send-24px.svg</file> <file alias="send">baseline-send-24px.svg</file>
<file alias="send-white">send-white.svg</file>
<file alias="play">ic_play_arrow_white_24px.svg</file> <file alias="play">ic_play_arrow_white_24px.svg</file>
<file alias="quality">ic_high_quality_white_24px.svg</file> <file alias="quality">ic_high_quality_white_24px.svg</file>
<file alias="contacts_list">ic_people_black_24px.svg</file> <file alias="contacts_list">ic_people_black_24px.svg</file>
...@@ -52,5 +54,6 @@ ...@@ -52,5 +54,6 @@
<file alias="bottom_arrow">bottom_arrow.svg</file> <file alias="bottom_arrow">bottom_arrow.svg</file>
<file alias="up_arrow">up_arrow.svg</file> <file alias="up_arrow">up_arrow.svg</file>
<file alias="qrcode">qrcode.svg</file> <file alias="qrcode">qrcode.svg</file>
<file alias="retry">retry.svg</file>
</gresource> </gresource>
</gresources> </gresources>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z" fill="#ffffff"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" fill="white"/>
<path d="M0 0h24v24H0z" fill="none"/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24">
<path d="M0 0h24v24H0z" fill="white"/>
<path d="M6 6h12v12H6z" fill="none"/>
</svg>
This diff is collapsed.
...@@ -34,6 +34,7 @@ namespace lrc ...@@ -34,6 +34,7 @@ namespace lrc
{ {
namespace api namespace api
{ {
class AVModel;
namespace conversation namespace conversation
{ {
struct Info; struct Info;
...@@ -55,9 +56,11 @@ typedef struct _ChatViewClass ChatViewClass; ...@@ -55,9 +56,11 @@ typedef struct _ChatViewClass ChatViewClass;
GType chat_view_get_type (void) G_GNUC_CONST; GType chat_view_get_type (void) G_GNUC_CONST;
GtkWidget *chat_view_new (WebKitChatContainer* view, GtkWidget *chat_view_new (WebKitChatContainer* view,
AccountInfoPointer const & accountInfo, AccountInfoPointer const & accountInfo,
lrc::api::conversation::Info* conversation); lrc::api::conversation::Info* conversation,
lrc::api::AVModel& avModel);
lrc::api::conversation::Info chat_view_get_conversation(ChatView*); lrc::api::conversation::Info chat_view_get_conversation(ChatView*);
void chat_view_update_temporary(ChatView*); void chat_view_update_temporary(ChatView*);
void chat_view_set_header_visible(ChatView*, gboolean); void chat_view_set_header_visible(ChatView*, gboolean);
void chat_view_set_record_visible(ChatView*, gboolean);
G_END_DECLS G_END_DECLS
...@@ -1298,10 +1298,11 @@ CppImpl::setCallInfo() ...@@ -1298,10 +1298,11 @@ CppImpl::setCallInfo()
// init chat view // init chat view
widgets->chat_view = chat_view_new(WEBKIT_CHAT_CONTAINER(widgets->webkit_chat_container), widgets->chat_view = chat_view_new(WEBKIT_CHAT_CONTAINER(widgets->webkit_chat_container),
*accountInfo, conversation); *accountInfo, conversation, *avModel_);
gtk_container_add(GTK_CONTAINER(widgets->frame_chat), widgets->chat_view); gtk_container_add(GTK_CONTAINER(widgets->frame_chat), widgets->chat_view);
chat_view_set_header_visible(CHAT_VIEW(widgets->chat_view), FALSE); chat_view_set_header_visible(CHAT_VIEW(widgets->chat_view), FALSE);
chat_view_set_record_visible(CHAT_VIEW(widgets->chat_view), FALSE);
} }
void void
......
...@@ -83,6 +83,8 @@ struct _IncomingCallViewPrivate ...@@ -83,6 +83,8 @@ struct _IncomingCallViewPrivate
QMetaObject::Connection state_change_connection; QMetaObject::Connection state_change_connection;
GSettings *settings; GSettings *settings;
lrc::api::AVModel* avModel_;
}; };
G_DEFINE_TYPE_WITH_PRIVATE(IncomingCallView, incoming_call_view, GTK_TYPE_BOX); G_DEFINE_TYPE_WITH_PRIVATE(IncomingCallView, incoming_call_view, GTK_TYPE_BOX);
...@@ -295,9 +297,11 @@ set_call_info(IncomingCallView *view) { ...@@ -295,9 +297,11 @@ set_call_info(IncomingCallView *view) {
auto chat_view = chat_view_new(WEBKIT_CHAT_CONTAINER(priv->webkit_chat_container), auto chat_view = chat_view_new(WEBKIT_CHAT_CONTAINER(priv->webkit_chat_container),
*priv->accountInfo_, *priv->accountInfo_,
priv->conversation_); priv->conversation_,
*priv->avModel_);
gtk_widget_show(chat_view); gtk_widget_show(chat_view);
chat_view_set_header_visible(CHAT_VIEW(chat_view), FALSE); chat_view_set_header_visible(CHAT_VIEW(chat_view), FALSE);
chat_view_set_record_visible(CHAT_VIEW(chat_view), FALSE);
gtk_container_add(GTK_CONTAINER(priv->frame_chat), chat_view); gtk_container_add(GTK_CONTAINER(priv->frame_chat), chat_view);
} }
...@@ -313,6 +317,7 @@ incoming_call_view_new(WebKitChatContainer* view, ...@@ -313,6 +317,7 @@ incoming_call_view_new(WebKitChatContainer* view,
priv->webkit_chat_container = GTK_WIDGET(view); priv->webkit_chat_container = GTK_WIDGET(view);
priv->conversation_ = conversation; priv->conversation_ = conversation;
priv->accountInfo_ = &accountInfo; priv->accountInfo_ = &accountInfo;
priv->avModel_ = &avModel;
priv->messaging_widget = messaging_widget_new(avModel, conversation, accountInfo); priv->messaging_widget = messaging_widget_new(avModel, conversation, accountInfo);
gtk_box_pack_start(GTK_BOX(priv->box_messaging_widget), priv->messaging_widget, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(priv->box_messaging_widget), priv->messaging_widget, TRUE, TRUE, 0);
......
...@@ -592,5 +592,4 @@ media_settings_view_show_preview(MediaSettingsView *self, gboolean show_preview) ...@@ -592,5 +592,4 @@ media_settings_view_show_preview(MediaSettingsView *self, gboolean show_preview)
priv->cpp->avModel_->setAudioMeterState(false); priv->cpp->avModel_->setAudioMeterState(false);
priv->cpp->avModel_->stopAudioDevice(); priv->cpp->avModel_->stopAudioDevice();
} }
} }
...@@ -1489,7 +1489,7 @@ GtkWidget* ...@@ -1489,7 +1489,7 @@ GtkWidget*
CppImpl::displayChatView(lrc::api::conversation::Info conversation, bool redraw_webview) CppImpl::displayChatView(lrc::api::conversation::Info conversation, bool redraw_webview)
{ {
chatViewConversation_.reset(new lrc::api::conversation::Info(conversation)); chatViewConversation_.reset(new lrc::api::conversation::Info(conversation));
auto* new_view = chat_view_new(webkitChatContainer(redraw_webview), accountInfo_, chatViewConversation_.get()); auto* new_view = chat_view_new(webkitChatContainer(redraw_webview), accountInfo_, chatViewConversation_.get(), lrc_->getAVModel());
g_signal_connect_swapped(new_view, "hide-view-clicked", G_CALLBACK(on_hide_view_clicked), self); g_signal_connect_swapped(new_view, "hide-view-clicked", G_CALLBACK(on_hide_view_clicked), self);
g_signal_connect(new_view, "add-conversation-clicked", G_CALLBACK(on_add_conversation_clicked), self); g_signal_connect(new_view, "add-conversation-clicked", G_CALLBACK(on_add_conversation_clicked), self);
g_signal_connect(new_view, "place-audio-call-clicked", G_CALLBACK(on_place_audio_call_clicked), self); g_signal_connect(new_view, "place-audio-call-clicked", G_CALLBACK(on_place_audio_call_clicked), self);
......
...@@ -761,6 +761,14 @@ webkit_chat_set_header_visible(WebKitChatContainer *view, bool isVisible) ...@@ -761,6 +761,14 @@ webkit_chat_set_header_visible(WebKitChatContainer *view, bool isVisible)
g_free(function_call); g_free(function_call);
} }
void
webkit_chat_set_record_visible(WebKitChatContainer *view, bool isVisible)
{
gchar* function_call = g_strdup_printf("displayRecordControls(%s)", isVisible ? "true" : "false");
webkit_chat_container_execute_js(view, function_call);
g_free(function_call);
}
void void
webkit_chat_update_chatview_frame(WebKitChatContainer *view, bool accountEnabled, bool isBanned, bool isTemporary, const gchar* alias, const gchar* bestId) webkit_chat_update_chatview_frame(WebKitChatContainer *view, bool accountEnabled, bool isBanned, bool isTemporary, const gchar* alias, const gchar* bestId)
{ {
......
...@@ -55,6 +55,7 @@ gboolean webkit_chat_container_is_ready (WebKitChatContainer *view ...@@ -55,6 +55,7 @@ gboolean webkit_chat_container_is_ready (WebKitChatContainer *view
void webkit_chat_container_set_display_links (WebKitChatContainer *view, bool display); void webkit_chat_container_set_display_links (WebKitChatContainer *view, bool display);
void webkit_chat_container_set_invitation (WebKitChatContainer *view, bool show, const std::string& contactUri, const std::string& contactId); void webkit_chat_container_set_invitation (WebKitChatContainer *view, bool show, const std::string& contactUri, const std::string& contactId);
void webkit_chat_set_header_visible (WebKitChatContainer *view, bool isVisible); void webkit_chat_set_header_visible (WebKitChatContainer *view, bool isVisible);
void webkit_chat_set_record_visible (WebKitChatContainer *view, bool isVisible);
void webkit_chat_update_chatview_frame (WebKitChatContainer *view, bool accountEnabled, bool isBanned, bool isInvited, const gchar* alias, const gchar* bestId); void webkit_chat_update_chatview_frame (WebKitChatContainer *view, bool accountEnabled, bool isBanned, bool isInvited, const gchar* alias, const gchar* bestId);
G_END_DECLS G_END_DECLS
...@@ -4,101 +4,6 @@ ...@@ -4,101 +4,6 @@
<template class="ChatView" parent="GtkBox"> <template class="ChatView" parent="GtkBox">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<!-- chat info (only show for out of call conversations) -->
<child>
<object class="GtkBox" id="hbox_chat_info">
<property name="visible">False</property>
<property name="no-show-all">True</property>
<property name="orientation">horizontal</property>
<property name="spacing">5</property>
<child>
<object class="GtkButton" id="button_close_chatview">
<property name="image">image_back_arrow</property>
<property name="visible">True</property>
<property name="relief">none</property>
<property name="tooltip-text" translatable="yes">Hide chat view</property>
<child internal-child="accessible">
<object class="AtkObject" id="button_close_chatview-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Hide chat view</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkLabel" id="label_peer">
<property name="visible">True</property>
<property name="selectable">True</property>
<property name="ellipsize">end</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_placecall">
<property name="visible">True</property>
<property name="image">image_place_call</property>
<property name="tooltip-text" translatable="yes">Place call</property>
<child internal-child="accessible">
<object class="AtkObject" id="button_placecall-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Place call</property>
</object>
</child>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_place_audio_call">
<property name="image">image_place_audio_only_call</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip-text" translatable="yes">Place audio-only call</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_add_to_conversations">
<property name="visible">True</property>
<property name="image">image_invite</property>
<property name="tooltip-text" translatable="yes">Add to conversations</property>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_cm">
<property name="visible">True</property>
<property name="selectable">True</property>
<property name="ellipsize">end</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<!-- end of chat info -->
<!-- start of chat text view --> <!-- start of chat text view -->
<child> <child>
<object class="GtkScrolledWindow" id="scrolledwindow_chat"> <object class="GtkScrolledWindow" id="scrolledwindow_chat">
......
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