Commit c64523bf authored by Stepan Salenikovich's avatar Stepan Salenikovich

gnome: current call view

Change-Id: I01d51e589508865dd0551fb46506758131d297c6
parent d2dbcee5
......@@ -113,6 +113,8 @@ SET( SRC_FILES
src/ringmainwindow.cpp
src/incomingcallview.h
src/incomingcallview.cpp
src/currentcallview.h
src/currentcallview.cpp
src/models/gtkaccessproxymodel.h
src/models/gtkaccessproxymodel.cpp
src/models/gtkqtreemodel.h
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.48.4 r9939"
version="1.0"
sodipodi:docname="hold.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
sodipodi:modified="true">
<title
id="title3003">hold.svg</title>
<defs
id="defs4">
<linearGradient
inkscape:collect="always"
id="linearGradient2433">
<stop
style="stop-color:#008000;stop-opacity:1;"
offset="0"
id="stop2435" />
<stop
style="stop-color:#008000;stop-opacity:0;"
offset="1"
id="stop2437" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 12 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="24 : 12 : 1"
inkscape:persp3d-origin="12 : 8 : 1"
id="perspective32" />
<linearGradient
id="linearGradient4269">
<stop
style="stop-color:#26b000;stop-opacity:1;"
offset="0"
id="stop4271" />
<stop
style="stop-color:#26b000;stop-opacity:0;"
offset="1"
id="stop4273" />
</linearGradient>
<linearGradient
id="linearGradient4183">
<stop
id="stop4185"
offset="0"
style="stop-color:#26b000;stop-opacity:1;" />
<stop
id="stop4187"
offset="1"
style="stop-color:#145f00;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient4167">
<stop
style="stop-color:#80000e;stop-opacity:1;"
offset="0"
id="stop4169" />
<stop
style="stop-color:#b00014;stop-opacity:0;"
offset="1"
id="stop4171" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2433"
id="linearGradient2439"
x1="2.965755"
y1="-0.80084854"
x2="32.578228"
y2="16.739393"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="24.875"
inkscape:cx="-9.0251257"
inkscape:cy="12"
inkscape:document-units="px"
inkscape:current-layer="layer1"
width="32px"
height="32px"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1313"
inkscape:window-height="744"
inkscape:window-x="337"
inkscape:window-y="1224"
showgrid="false"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>hold.svg</dc:title>
<dc:date>2014/06/24</dc:date>
<dc:creator>
<cc:Agent>
<dc:title>Gabrielle Maheux-Leclerc &lt;gabrielle.maheux@savoirfairelinux.com&gt;</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>Savoir-faire Linux Inc.</dc:title>
</cc:Agent>
</dc:rights>
<dc:publisher>
<cc:Agent>
<dc:title>Savoir-faire Linux Inc.</dc:title>
</cc:Agent>
</dc:publisher>
<dc:source>http://sflphone.org/download/source-code</dc:source>
<dc:subject>
<rdf:Bag>
<rdf:li>gnome</rdf:li>
<rdf:li>voip</rdf:li>
<rdf:li>sip</rdf:li>
</rdf:Bag>
</dc:subject>
<dc:coverage>SFLphone project</dc:coverage>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="color:#bebebe;fill:none;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
id="rect44095-0-2"
width="27.25"
height="27.25"
x="-25.687498"
y="-27.12499"
inkscape:label="a"
transform="scale(-1,-1)" />
<rect
style="color:#bebebe;fill:none;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
id="rect44095-0"
width="27.357903"
height="27.357903"
x="-1.6802465"
y="-4.3527112"
inkscape:label="a" />
<rect
inkscape:label="a"
y="-18.073694"
x="-1.6802227"
height="27.402094"
width="27.402094"
id="rect44122-0"
style="color:#bebebe;fill:none;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
inkscape:connector-curvature="0"
id="path44084-2-0"
d="m 16.029921,21.423862 c 0.254848,-1.219754 -0.510198,-2.362984 -1.146134,-3.339955 -0.742963,-0.978503 -1.568402,-1.994204 -2.707712,-2.518854 -0.356634,-0.09662 -0.648954,0.300579 -0.978359,0.419881 -0.856281,0.556767 -2.062243,1.043172 -2.963771,0.301789 C 7.105814,15.280153 6.573243,13.807679 5.7598696,12.563649 5.189408,11.579726 4.3969237,10.303434 5.1700028,9.2129354 5.7515946,8.4063694 6.721629,8.0998704 7.473819,7.5510554 7.658419,6.5623256 7.286042,5.5466087 7.006723,4.6032864 6.531916,3.3631272 5.8950609,2.0397499 4.7242153,1.3222893 3.771279,0.82956144 2.9428394,1.7471716 2.2338636,2.2619178 0.603842,3.5856661 -0.1446539,5.7500489 0.033574,7.8098564 c 0.2637689,3.3112416 1.8456243,6.3464556 3.5854636,9.1123186 1.594147,2.392713 3.5703334,4.79904 6.3613604,5.798852 1.963975,0.698846 4.227997,0.209183 5.875489,-1.006925 l 0.103075,-0.139047 0.07098,-0.151144 z"
style="fill:#545454;fill-opacity:1;stroke:none;display:inline;enable-background:new" />
<g
id="g3221-1"
transform="matrix(1.13683,0,0,1.13683,-126.08662,-556.85188)"
style="opacity:1;fill:#1aac36;fill-opacity:1">
<path
sodipodi:nodetypes="ccccc"
id="path3807-1-1-5-8-6-5"
d="m 124,491 0,8 3,0 0,-8 -3,0 z"
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0pt;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;text-anchor:start;color:#bebebe;fill:#1aac36;fill-opacity:1;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;font-family:Andale Mono"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="ccccc"
id="path3807-1-1-5-8-6-3-8"
d="m 129,491 0,8 3,0 0,-8 -3,0 z"
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0pt;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;text-anchor:start;color:#bebebe;fill:#1aac36;fill-opacity:1;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;font-family:Andale Mono"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.48.4 r9939"
version="1.0"
sodipodi:docname="rec_call.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
sodipodi:modified="true">
<title
id="title3001">rec_call.svg</title>
<defs
id="defs4">
<linearGradient
inkscape:collect="always"
id="linearGradient2433">
<stop
style="stop-color:#008000;stop-opacity:1;"
offset="0"
id="stop2435" />
<stop
style="stop-color:#008000;stop-opacity:0;"
offset="1"
id="stop2437" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 12 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="24 : 12 : 1"
inkscape:persp3d-origin="12 : 8 : 1"
id="perspective32" />
<linearGradient
id="linearGradient4269">
<stop
style="stop-color:#26b000;stop-opacity:1;"
offset="0"
id="stop4271" />
<stop
style="stop-color:#26b000;stop-opacity:0;"
offset="1"
id="stop4273" />
</linearGradient>
<linearGradient
id="linearGradient4183">
<stop
id="stop4185"
offset="0"
style="stop-color:#26b000;stop-opacity:1;" />
<stop
id="stop4187"
offset="1"
style="stop-color:#145f00;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient4167">
<stop
style="stop-color:#80000e;stop-opacity:1;"
offset="0"
id="stop4169" />
<stop
style="stop-color:#b00014;stop-opacity:0;"
offset="1"
id="stop4171" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2433"
id="linearGradient2439"
x1="2.965755"
y1="-0.80084854"
x2="32.578228"
y2="16.739393"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.627417"
inkscape:cx="-3.8248442"
inkscape:cy="12.018537"
inkscape:document-units="px"
inkscape:current-layer="layer1"
width="32px"
height="32px"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1313"
inkscape:window-height="744"
inkscape:window-x="337"
inkscape:window-y="1224"
showgrid="false"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>rec_call.svg</dc:title>
<dc:date>2014/01/04</dc:date>
<dc:creator>
<cc:Agent>
<dc:title>Gabrielle Maheux-Leclerc &lt;gabrielle.maheux@savoirfairelinux.com&gt;</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>Savoir-faire Linux Inc.</dc:title>
</cc:Agent>
</dc:rights>
<dc:publisher>
<cc:Agent>
<dc:title>Savoir-faire Linux Inc.</dc:title>
</cc:Agent>
</dc:publisher>
<dc:source>http://sflphone.org/download/source-code</dc:source>
<dc:subject>
<rdf:Bag>
<rdf:li>gnome</rdf:li>
<rdf:li>voip</rdf:li>
<rdf:li>sip</rdf:li>
</rdf:Bag>
</dc:subject>
<dc:coverage>SFLphone project</dc:coverage>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="color:#bebebe;fill:none;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
id="rect44095-0-2"
width="27.25"
height="27.25"
x="-25.687498"
y="-27.12499"
inkscape:label="a"
transform="scale(-1,-1)" />
<rect
style="color:#bebebe;fill:none;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
id="rect44095-0"
width="27.357903"
height="27.357903"
x="-1.6802465"
y="-4.3527112"
inkscape:label="a" />
<rect
inkscape:label="a"
y="-18.073694"
x="-1.6802227"
height="27.402094"
width="27.402094"
id="rect44122-0"
style="color:#bebebe;fill:none;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
inkscape:connector-curvature="0"
style="fill:#545454;fill-opacity:1;stroke:none;display:inline;enable-background:new"
d="M 8.043354,1.0992236 C 7.372235,1.1739056 6.754867,1.7746355 6.22085,2.162351 4.58382,3.4917909 3.864992,5.6624501 4.043969,7.7311139 4.255429,10.385652 5.32003,12.868341 6.62585,15.173007 6.901251,15.125217 7.197388,15.07176 7.486477,15.07176 c 2.716066,0 4.910637,2.194572 4.910637,4.910639 0,0.622438 -0.14337,1.223768 -0.354376,1.771879 0.605266,0.405309 1.273631,0.710858 1.97438,0.961877 1.972419,0.70185 4.217939,0.208836 5.872514,-1.012502 l 0.151795,-0.101246 0.05054,-0.151795 c 0.255962,-1.224999 -0.525691,-2.410711 -1.164378,-3.391883 -0.746142,-0.982713 -1.589548,-2.004351 -2.733757,-2.531258 -0.358166,-0.09704 -0.631072,0.33581 -0.961877,0.455626 -0.859962,0.559161 -2.081461,1.048321 -2.986881,0.303751 C 11.112111,15.275942 10.581333,13.789961 9.764446,12.540582 9.191531,11.552428 8.380541,10.243886 9.156944,9.1486983 9.741037,8.3386639 10.730276,8.0292432 11.4857,7.4780694 11.671093,6.4850879 11.31061,5.4891906 11.030074,4.5418126 10.553242,3.2963213 9.927823,1.9717251 8.751943,1.2511799 8.512685,1.1274116 8.266898,1.0744213 8.043192,1.0993856 z"
id="path44084-2-0-3-8-3" />
<path
sodipodi:type="arc"
style="fill:#de2c2c;fill-opacity:0.98431373;stroke:none"
id="path12471-2"
sodipodi:cx="83.928574"
sodipodi:cy="507.45148"
sodipodi:rx="2.0535715"
sodipodi:ry="2.0535715"
d="m 85.982145,507.45148 a 2.0535715,2.0535715 0 1 1 -4.107143,0 2.0535715,2.0535715 0 1 1 4.107143,0 z"
transform="matrix(1.6200038,0,0,1.6200038,-128.49259,-802.01204)" />
</g>
</svg>
/*
* Copyright (C) 2015 Savoir-Faire Linux Inc.
* Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#include "currentcallview.h"
#include <gtk/gtk.h>
#include <call.h>
#include "utils/drawing.h"
#include <callmodel.h>
struct _CurrentCallView
{
GtkBox parent;
};
struct _CurrentCallViewClass
{
GtkBoxClass parent_class;
};
typedef struct _CurrentCallViewPrivate CurrentCallViewPrivate;
struct _CurrentCallViewPrivate
{
GtkWidget *image_peer;
GtkWidget *label_identity;
GtkWidget *label_status;
GtkWidget *label_duration;
QMetaObject::Connection state_change_connection;
QMetaObject::Connection call_details_connection;
};
G_DEFINE_TYPE_WITH_PRIVATE(CurrentCallView, current_call_view, GTK_TYPE_BOX);
#define CURRENT_CALL_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CURRENT_CALL_VIEW_TYPE, CurrentCallViewPrivate))
static void
current_call_view_dispose(GObject *object)
{
CurrentCallView *view;
CurrentCallViewPrivate *priv;
view = CURRENT_CALL_VIEW(object);
priv = CURRENT_CALL_VIEW_GET_PRIVATE(view);
QObject::disconnect(priv->state_change_connection);
QObject::disconnect(priv->call_details_connection);
G_OBJECT_CLASS(current_call_view_parent_class)->dispose(object);
}
static void
current_call_view_init(CurrentCallView *view)
{
gtk_widget_init_template(GTK_WIDGET(view));
}
static void
current_call_view_class_init(CurrentCallViewClass *klass)
{
G_OBJECT_CLASS(klass)->dispose = current_call_view_dispose;
gtk_widget_class_set_template_from_resource(GTK_WIDGET_CLASS (klass),
"/cx/ring/RingGnome/currentcallview.ui");
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), CurrentCallView, image_peer);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), CurrentCallView, label_identity);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), CurrentCallView, label_status);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), CurrentCallView, label_duration);
}
GtkWidget *
current_call_view_new(void)
{
return (GtkWidget *)g_object_new(CURRENT_CALL_VIEW_TYPE, NULL);
}
static void
update_state(CurrentCallView *view, Call *call)
{
CurrentCallViewPrivate *priv = CURRENT_CALL_VIEW_GET_PRIVATE(view);
/* change state label */
Call::State state = call->state();
switch(state) {
case Call::State::INCOMING:
gtk_label_set_text(GTK_LABEL(priv->label_status), "Incoming...");
break;
case Call::State::RINGING:
gtk_label_set_text(GTK_LABEL(priv->label_status), "Ringing...");
break;
case Call::State::CURRENT:
/* note: shouldn't be displayed, as the view should change */
gtk_label_set_text(GTK_LABEL(priv->label_status), "In progress.");
break;
case Call::State::DIALING:
gtk_label_set_text(GTK_LABEL(priv->label_status), "Dialing...");
break;
case Call::State::HOLD:
/* note: shouldn't be displayed, as the view should change */
gtk_label_set_text(GTK_LABEL(priv->label_status), "On hold.");
break;
case Call::State::FAILURE:
gtk_label_set_text(GTK_LABEL(priv->label_status), "Failed.");
break;
case Call::State::BUSY:
gtk_label_set_text(GTK_LABEL(priv->label_status), "Busy.");
break;
case Call::State::TRANSFERRED:
/* note: shouldn't be displayed, as the view should change */
gtk_label_set_text(GTK_LABEL(priv->label_status), "Transfered.");
break;
case Call::State::TRANSF_HOLD:
/* note: shouldn't be displayed, as the view should change */
gtk_label_set_text(GTK_LABEL(priv->label_status), "Transfer hold.");
break;
case Call::State::OVER:
/* note: shouldn't be displayed, as the view should change */
gtk_label_set_text(GTK_LABEL(priv->label_status), "Over.");
break;
case Call::State::ERROR:
gtk_label_set_text(GTK_LABEL(priv->label_status), "Error.");
break;
case Call::State::CONFERENCE:
/* note: shouldn't be displayed, as the view should change */
gtk_label_set_text(GTK_LABEL(priv->label_status), "Conference.");
break;
case Call::State::CONFERENCE_HOLD:
/* note: shouldn't be displayed, as the view should change */
gtk_label_set_text(GTK_LABEL(priv->label_status), "Conference hold.");
break;
case Call::State::INITIALIZATION:
gtk_label_set_text(GTK_LABEL(priv->label_status), "Initialization...");
break;
case Call::State::COUNT__:
break;
}
}
static void
update_details(CurrentCallView *view, Call *call)
{
CurrentCallViewPrivate *priv = CURRENT_CALL_VIEW_GET_PRIVATE(view);
/* update call duration */
QByteArray ba_length = call->length().toLocal8Bit();
gtk_label_set_text(GTK_LABEL(priv->label_duration), ba_length.constData());
}
void
current_call_view_set_call_info(CurrentCallView *view, const QModelIndex& idx) {
CurrentCallViewPrivate *priv = CURRENT_CALL_VIEW_GET_PRIVATE(view);
/* get image and frame it */
GdkPixbuf *avatar = ring_draw_fallback_avatar(50);
GdkPixbuf *framed_avatar = ring_frame_avatar(avatar);
g_object_unref(avatar);
gtk_image_set_from_pixbuf(GTK_IMAGE(priv->image_peer), framed_avatar);
g_object_unref(framed_avatar);
/* get name */
QVariant var = idx.model()->data(idx, Call::Role::Name);
QByteArray ba_name = var.toString().toLocal8Bit();
gtk_label_set_text(GTK_LABEL(priv->label_identity), ba_name.constData());
/* change some things depending on call state */
Call *call = CallModel::instance()->getCall(idx);
update_state(view, call);
update_details(view, call);
priv->state_change_connection = QObject::connect(
call,
&Call::stateChanged,
[=]() { update_state(view, call); }
);
priv->call_details_connection = QObject::connect(
call,
static_cast<void (Call::*)(void)>(&Call::changed),
[=]() { update_details(view, call); }
);
}
/*
* Copyright (C) 2015 Savoir-Faire Linux Inc.
* Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifndef _CURRENTCALLVIEW_H
#define _CURRENTCALLVIEW_H
#include <gtk/gtk.h>
#include <call.h>
G_BEGIN_DECLS
#define CURRENT_CALL_VIEW_TYPE (current_call_view_get_type ())
#define CURRENT_CALL_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CURRENT_CALL_VIEW_TYPE, CurrentCallView))
#define CURRENT_CALL_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), CURRENT_CALL_VIEW_TYPE, CurrentCallViewClass))
#define IS_CURRENT_CALL_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), CURRENT_CALL_VIEW_TYPE))
#define IS_CURRENT_CALL_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), CURRENT_CALL_VIEW_TYPE))
typedef struct _CurrentCallView CurrentCallView;
typedef struct _CurrentCallViewClass CurrentCallViewClass;
GType current_call_view_get_type (void) G_GNUC_CONST;
GtkWidget *current_call_view_new (void);
void current_call_view_set_call_info (CurrentCallView *view, const QModelIndex& idx);
G_END_DECLS
#endif /* _CURRENTCALLVIEW_H */
\ No newline at end of file
......@@ -201,18 +201,17 @@ void
incoming_call_view_set_call_info(IncomingCallView *view, const QModelIndex& idx) {
IncomingCallViewPrivate *priv = INCOMING_CALL_VIEW_GET_PRIVATE(view);
QVariant var = idx.model()->data(idx, Call::Role::Name);
QByteArray ba_name = var.toString().toLocal8Bit();
/* get image and frame it */
GdkPixbuf *avatar = ring_draw_fallback_avatar(100);
GdkPixbuf *framed_avatar = ring_frame_avatar(avatar);
g_object_unref(avatar);
gtk_image_set_from_pixbuf(GTK_IMAGE(priv->image_incoming), framed_avatar);
g_object_unref(framed_avatar);
gtk_label_set_text(GTK_LABEL(priv->label_identity), ba_name.data());
/* get name */
QVariant var = idx.model()->data(idx, Call::Role::Name);
QByteArray ba_name = var.toString().toLocal8Bit();
gtk_label_set_text(GTK_LABEL(priv->label_identity), ba_name.constData());
/* change some things depending on call state */
Call *call = CallModel::instance()->getCall(idx);
......
......@@ -37,6 +37,7 @@
#include <QtCore/QByteArray>
#include <callmodel.h>
#include <QtCore/QItemSelectionModel>
#include <useractionmodel.h>
#include "ring_client_options.h"
#include "ringmainwindow.h"
......@@ -137,10 +138,7 @@ call_accept(G_GNUC_UNUSED GSimpleAction *action, G_GNUC_UNUSED GVariant *param,
{
g_debug("call accpet action");
/* TODO: implement using UserActionModel once its fixed
* UserActionModel action_model = UserActionModel(CallModel::instance());
* if (action_model.isActionEnabled())
*/
/* TODO: implement using UserActionModel once its fixed */
QModelIndex idx = CallModel::instance()->selectionModel()->currentIndex();
if (idx.isValid()) {
......@@ -154,10 +152,7 @@ call_hangup(G_GNUC_UNUSED GSimpleAction *action, G_GNUC_UNUSED GVariant *param,
{
g_debug("call hangup action");