Commit 71f1beee authored by Sébastien Blin's avatar Sébastien Blin

currencallview: improve conference UI

Add a button to call a contact or easily join calls

Change-Id: I88c94f8a10a49393ef76237b70ca65380f8dc307
Gitlab: #1052
parent ce89161d
<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"> <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="M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z"/></svg>
<path d="M0 0h24v24H0z" fill="none"/> \ No newline at end of file
<path d="M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z"/>
</svg>
\ No newline at end of file
<svg fill="#ffffff" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm-9-2V7H4v3H1v2h3v3h2v-3h3v-2H6zm9 4c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/>
</svg>
\ No newline at end of file
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
<file alias="block">block.svg</file> <file alias="block">block.svg</file>
<file alias="block_black">block_black.svg</file> <file alias="block_black">block_black.svg</file>
<file alias="invite">ic_person_add_black_24px.svg</file> <file alias="invite">ic_person_add_black_24px.svg</file>
<file alias="invite_white">ic_person_add_white_24px.svg</file>
<file alias="temporary-item">ic_search_black_48px.svg</file> <file alias="temporary-item">ic_search_black_48px.svg</file>
<file alias="audio_only_call_start">ic_call_black_24px.svg</file> <file alias="audio_only_call_start">ic_call_black_24px.svg</file>
<file alias="fallbackavatar">fallbackavatar.svg</file> <file alias="fallbackavatar">fallbackavatar.svg</file>
......
This diff is collapsed.
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "api/account.h" #include "api/account.h"
#include "api/lrc.h"
#include "webkitchatcontainer.h" #include "webkitchatcontainer.h"
#include "accountinfopointer.h" #include "accountinfopointer.h"
...@@ -54,7 +55,8 @@ GType current_call_view_get_type (void) G_GNUC_CONST; ...@@ -54,7 +55,8 @@ GType current_call_view_get_type (void) G_GNUC_CONST;
GtkWidget *current_call_view_new (WebKitChatContainer* view, GtkWidget *current_call_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::AVModel& avModel,
const lrc::api::Lrc& lrc);
lrc::api::conversation::Info current_call_view_get_conversation(CurrentCallView*); lrc::api::conversation::Info current_call_view_get_conversation(CurrentCallView*);
GtkWidget *current_call_view_get_chat_view(CurrentCallView*); GtkWidget *current_call_view_get_chat_view(CurrentCallView*);
void current_call_view_show_chat(CurrentCallView*); void current_call_view_show_chat(CurrentCallView*);
......
...@@ -373,6 +373,7 @@ public: ...@@ -373,6 +373,7 @@ public:
std::string eventBody_; std::string eventBody_;
bool isCreatingAccount {false}; bool isCreatingAccount {false};
QHash<QString, QMetaObject::Connection> pendingConferences_;
private: private:
CppImpl() = delete; CppImpl() = delete;
CppImpl(const CppImpl&) = delete; CppImpl(const CppImpl&) = delete;
...@@ -1468,7 +1469,7 @@ CppImpl::displayCurrentCallView(lrc::api::conversation::Info conversation, bool ...@@ -1468,7 +1469,7 @@ CppImpl::displayCurrentCallView(lrc::api::conversation::Info conversation, bool
auto* new_view = current_call_view_new(webkitChatContainer(redraw_webview), auto* new_view = current_call_view_new(webkitChatContainer(redraw_webview),
accountInfo_, accountInfo_,
chatViewConversation_.get(), chatViewConversation_.get(),
lrc_->getAVModel()); lrc_->getAVModel(), *lrc_.get()); // TODO improve. Only LRC is needed
try { try {
auto contactUri = chatViewConversation_->participants.front(); auto contactUri = chatViewConversation_->participants.front();
...@@ -2378,8 +2379,7 @@ CppImpl::slotShowCallView(const std::string& id, lrc::api::conversation::Info or ...@@ -2378,8 +2379,7 @@ CppImpl::slotShowCallView(const std::string& id, lrc::api::conversation::Info or
if (IS_CURRENT_CALL_VIEW(old_view)) if (IS_CURRENT_CALL_VIEW(old_view))
current_item = current_call_view_get_conversation(CURRENT_CALL_VIEW(old_view)); current_item = current_call_view_get_conversation(CURRENT_CALL_VIEW(old_view));
if (current_item.uid != origin.uid) changeView(CURRENT_CALL_VIEW_TYPE, origin);
changeView(CURRENT_CALL_VIEW_TYPE, origin);
} }
void void
......
...@@ -74,6 +74,7 @@ struct _VideoWidgetPrivate { ...@@ -74,6 +74,7 @@ struct _VideoWidgetPrivate {
/* local peer data */ /* local peer data */
VideoWidgetRenderer *local; VideoWidgetRenderer *local;
bool show_preview {true};
guint frame_timeout_source; guint frame_timeout_source;
...@@ -106,7 +107,6 @@ struct _VideoWidgetRenderer { ...@@ -106,7 +107,6 @@ struct _VideoWidgetRenderer {
* this will be set back to false once the black frame is rendered * this will be set back to false once the black frame is rendered
*/ */
std::atomic_bool show_black_frame; std::atomic_bool show_black_frame;
std::atomic_bool pause_rendering;
QMetaObject::Connection render_stop; QMetaObject::Connection render_stop;
QMetaObject::Connection render_start; QMetaObject::Connection render_start;
}; };
...@@ -595,9 +595,6 @@ clutter_render_image(VideoWidgetRenderer* wg_renderer) ...@@ -595,9 +595,6 @@ clutter_render_image(VideoWidgetRenderer* wg_renderer)
auto actor = wg_renderer->actor; auto actor = wg_renderer->actor;
g_return_if_fail(CLUTTER_IS_ACTOR(actor)); g_return_if_fail(CLUTTER_IS_ACTOR(actor));
if (wg_renderer->pause_rendering)
return;
if (wg_renderer->show_black_frame) { if (wg_renderer->show_black_frame) {
/* render a black frame set the bool back to false, this is likely done /* render a black frame set the bool back to false, this is likely done
* when the renderer is stopped so we ignore whether or not it is running * when the renderer is stopped so we ignore whether or not it is running
...@@ -729,7 +726,8 @@ check_frame_queue(VideoWidget *self) ...@@ -729,7 +726,8 @@ check_frame_queue(VideoWidget *self)
VideoWidgetPrivate *priv = VIDEO_WIDGET_GET_PRIVATE(self); VideoWidgetPrivate *priv = VIDEO_WIDGET_GET_PRIVATE(self);
/* display renderer's frames */ /* display renderer's frames */
clutter_render_image(priv->local); if (priv->show_preview)
clutter_render_image(priv->local);
clutter_render_image(priv->remote); clutter_render_image(priv->remote);
if (priv->remote->snapshot_status == HAS_A_NEW_ONE) { if (priv->remote->snapshot_status == HAS_A_NEW_ONE) {
priv->remote->snapshot_status = NOTHING; priv->remote->snapshot_status = NOTHING;
...@@ -858,33 +856,26 @@ video_widget_add_new_renderer(VideoWidget* self, lrc::api::AVModel* avModel, ...@@ -858,33 +856,26 @@ video_widget_add_new_renderer(VideoWidget* self, lrc::api::AVModel* avModel,
new_video_renderer->render_stop = QObject::connect( new_video_renderer->render_stop = QObject::connect(
&*avModel, &*avModel,
&lrc::api::AVModel::rendererStopped, &lrc::api::AVModel::rendererStopped,
[=](const std::string&) { [=](const std::string& id) {
renderer_stop(new_video_renderer); if (renderer->getId() == id)
renderer_stop(new_video_renderer);
}); });
new_video_renderer->render_start = QObject::connect( new_video_renderer->render_start = QObject::connect(
&*avModel, &*avModel,
&lrc::api::AVModel::rendererStarted, &lrc::api::AVModel::rendererStarted,
[=](const std::string&) { [=](const std::string& id) {
renderer_start(new_video_renderer); if (renderer->getId() == id)
renderer_start(new_video_renderer);
}); });
g_async_queue_push(priv->new_renderer_queue, new_video_renderer); g_async_queue_push(priv->new_renderer_queue, new_video_renderer);
} }
void
video_widget_pause_rendering(VideoWidget *self, gboolean pause)
{
g_return_if_fail(IS_VIDEO_WIDGET(self));
VideoWidgetPrivate *priv = VIDEO_WIDGET_GET_PRIVATE(self);
priv->local->pause_rendering = pause;
priv->remote->pause_rendering = pause;
}
void void
video_widget_take_snapshot(VideoWidget *self) video_widget_take_snapshot(VideoWidget *self)
{ {
g_return_if_fail(IS_VIDEO_WIDGET(self));
VideoWidgetPrivate *priv = VIDEO_WIDGET_GET_PRIVATE(self); VideoWidgetPrivate *priv = VIDEO_WIDGET_GET_PRIVATE(self);
priv->remote->snapshot_status = HAS_TO_TAKE_ONE; priv->remote->snapshot_status = HAS_TO_TAKE_ONE;
...@@ -893,7 +884,18 @@ video_widget_take_snapshot(VideoWidget *self) ...@@ -893,7 +884,18 @@ video_widget_take_snapshot(VideoWidget *self)
GdkPixbuf* GdkPixbuf*
video_widget_get_snapshot(VideoWidget *self) video_widget_get_snapshot(VideoWidget *self)
{ {
g_return_val_if_fail(IS_VIDEO_WIDGET(self), nullptr);
VideoWidgetPrivate *priv = VIDEO_WIDGET_GET_PRIVATE(self); VideoWidgetPrivate *priv = VIDEO_WIDGET_GET_PRIVATE(self);
return priv->remote->snapshot; return priv->remote->snapshot;
} }
void
video_widget_set_preview_visible(VideoWidget *self, bool show)
{
g_return_if_fail(IS_VIDEO_WIDGET(self));
VideoWidgetPrivate *priv = VIDEO_WIDGET_GET_PRIVATE(self);
if (priv) {
priv->show_preview = show;
}
}
\ No newline at end of file
...@@ -53,7 +53,6 @@ typedef enum { ...@@ -53,7 +53,6 @@ typedef enum {
GType video_widget_get_type (void) G_GNUC_CONST; GType video_widget_get_type (void) G_GNUC_CONST;
GtkWidget* video_widget_new (void); GtkWidget* video_widget_new (void);
void video_widget_add_new_renderer (VideoWidget*, lrc::api::AVModel* avModel, const lrc::api::video::Renderer*, VideoRendererType); void video_widget_add_new_renderer (VideoWidget*, lrc::api::AVModel* avModel, const lrc::api::video::Renderer*, VideoRendererType);
void video_widget_pause_rendering (VideoWidget *self, gboolean pause);
void video_widget_on_drag_data_received (GtkWidget *self, void video_widget_on_drag_data_received (GtkWidget *self,
GdkDragContext *context, GdkDragContext *context,
gint x, gint x,
...@@ -67,6 +66,7 @@ gboolean video_widget_on_button_press_in_screen_event (VideoWidget *self, ...@@ -67,6 +66,7 @@ gboolean video_widget_on_button_press_in_screen_event (VideoWidget *self,
G_GNUC_UNUSED gpointer); G_GNUC_UNUSED gpointer);
void video_widget_take_snapshot (VideoWidget *self); void video_widget_take_snapshot (VideoWidget *self);
GdkPixbuf* video_widget_get_snapshot (VideoWidget *self); GdkPixbuf* video_widget_get_snapshot (VideoWidget *self);
void video_widget_set_preview_visible (VideoWidget *self, bool show);
G_END_DECLS G_END_DECLS
......
...@@ -261,6 +261,25 @@ ...@@ -261,6 +261,25 @@
<property name="fill">True</property> <property name="fill">True</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkToggleButton" id="togglebutton_add_participant">
<style>
<class name="call-button"/>
</style>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="width-request">48</property>
<property name="height-request">48</property>
<property name="has_tooltip">True</property>
<property name="tooltip-text" translatable="yes">Add participant</property>
<property name="image">image_add_participant</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child> <child>
<object class="GtkToggleButton" id="togglebutton_transfer"> <object class="GtkToggleButton" id="togglebutton_transfer">
<style> <style>
...@@ -466,6 +485,15 @@ ...@@ -466,6 +485,15 @@
</object> </object>
</child> </child>
</object> </object>
<object class="GtkImage" id="image_add_participant">
<property name="visible">True</property>
<property name="resource">/net/jami/JamiGnome/invite_white</property>
<child internal-child="accessible">
<object class="AtkObject" id="image_add_participant-atkobject">
<property name="AtkObject::accessible-description" translatable="yes">Add participant</property>
</object>
</child>
</object>
<object class="GtkImage" id="image_transfer"> <object class="GtkImage" id="image_transfer">
<property name="visible">True</property> <property name="visible">True</property>
<property name="resource">/net/jami/JamiGnome/transfer</property> <property name="resource">/net/jami/JamiGnome/transfer</property>
...@@ -572,4 +600,68 @@ ...@@ -572,4 +600,68 @@
</object> </object>
</child> </child>
</object> </object>
<object class="GtkPopover" id="add_participant_popover">
<property name="can_focus">False</property>
<property name="height_request">400</property>
<property name="width_request">300</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">False</property>
<property name="halign">center</property>
<property name="label" translatable="yes">Add</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSearchEntry" id="conversation_filter_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<style>
<class name="search-entry-style"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkListBox" id="list_conversations_invite">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</interface> </interface>
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