Skip to content
Snippets Groups Projects
Commit 155eae0b authored by Daniel Brötzmann's avatar Daniel Brötzmann Committed by Philipp Hörist
Browse files

Rewrite Profile Dialog

parent 51107584
No related branches found
No related tags found
No related merge requests found
Showing
with 1672 additions and 1757 deletions
......@@ -194,6 +194,7 @@ class URIType(Enum):
WEB = 'web'
FILE = 'file'
AT = 'at'
TEL = 'tel'
class URIAction(Enum):
......
......@@ -1063,6 +1063,10 @@ def parse_uri(uri):
uri = uri[7:]
return URI(type=URIType.MAIL, data=uri)
if uri.startswith('tel:'):
uri = uri[4:]
return URI(type=URIType.TEL, data=uri)
if app.interface.sth_at_sth_dot_sth_re.match(uri):
return URI(type=URIType.AT, data=uri)
......@@ -1092,6 +1096,9 @@ def open_uri(uri, account=None):
if uri.type == URIType.FILE:
open_file(uri.data)
elif uri.type == URIType.TEL:
Gio.AppInfo.launch_default_for_uri(f'tel:{uri.data}')
elif uri.type == URIType.MAIL:
Gio.AppInfo.launch_default_for_uri(f'mailto:{uri.data}')
......
......@@ -71,6 +71,7 @@
'user_mood',
'user_nickname',
'user_tune',
'vcard4',
'vcard_avatars',
'vcard_temp',
'announce',
......
......@@ -35,6 +35,7 @@ class PubSub(BaseModule):
'delete',
'set_node_configuration',
'get_node_configuration',
'get_access_model',
]
def __init__(self, con):
......
......@@ -29,6 +29,7 @@ class UserAvatar(BaseModule):
'request_avatar_metadata',
'request_avatar_data',
'set_avatar',
'set_access_model'
]
def __init__(self, con):
......
......@@ -30,6 +30,7 @@ class UserNickname(BaseModule):
_nbxmpp_extends = 'Nickname'
_nbxmpp_methods = [
'set_nickname',
'set_access_model',
]
def __init__(self, con):
......
# This file is part of Gajim.
#
# Gajim 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; version 3 only.
#
# Gajim 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 Gajim. If not, see <http://www.gnu.org/licenses/>.
# XEP-0292: vCard4 Over XMPP
from gajim.common.modules.base import BaseModule
class VCard4(BaseModule):
_nbxmpp_extends = 'VCard4'
_nbxmpp_methods = [
'request_vcard',
'set_vcard',
]
def __init__(self, con):
BaseModule.__init__(self, con)
def get_instance(*args, **kwargs):
return VCard4(*args, **kwargs), 'VCard4'
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="feather feather-briefcase"
version="1.1"
id="svg793"
sodipodi:docname="feather-briefcase-symbolic.svg"
inkscape:version="1.0.1 (0767f8302a, 2020-10-17)">
<metadata
id="metadata799">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs797" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1916"
inkscape:window-height="996"
id="namedview795"
showgrid="false"
inkscape:zoom="50.125"
inkscape:cx="8"
inkscape:cy="8"
inkscape:window-x="0"
inkscape:window-y="82"
inkscape:window-maximized="0"
inkscape:current-layer="svg793" />
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
d="M 4 6 C 2.3552972 6 1 7.3552972 1 9 L 1 19 C 1 20.644703 2.3552972 22 4 22 L 20 22 C 21.644703 22 23 20.644703 23 19 L 23 9 C 23 7.3552972 21.644703 6 20 6 L 4 6 z M 4 8 L 20 8 C 20.571297 8 21 8.4287028 21 9 L 21 19 C 21 19.571297 20.571297 20 20 20 L 4 20 C 3.4287028 20 3 19.571297 3 19 L 3 9 C 3 8.4287028 3.4287028 8 4 8 z "
id="path804" />
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
d="M 10 2 C 8.3549904 2 7 3.3549904 7 5 L 7 21 A 1 1 0 0 0 8 22 A 1 1 0 0 0 9 21 L 9 5 C 9 4.4358706 9.4358706 4 10 4 L 14 4 C 14.564129 4 15 4.4358706 15 5 L 15 21 A 1 1 0 0 0 16 22 A 1 1 0 0 0 17 21 L 17 5 C 17 3.3549904 15.64501 2 14 2 L 10 2 z "
id="path808" />
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="feather feather-home"
version="1.1"
id="svg858"
sodipodi:docname="feather-home-symbolic.svg"
inkscape:version="1.0.1 (0767f8302a, 2020-10-17)">
<metadata
id="metadata864">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs862" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1916"
inkscape:window-height="996"
id="namedview860"
showgrid="false"
inkscape:zoom="50.125"
inkscape:cx="8"
inkscape:cy="8"
inkscape:window-x="0"
inkscape:window-y="82"
inkscape:window-maximized="0"
inkscape:current-layer="svg858" />
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
d="M 11.988281 1 A 1.0001 1.0001 0 0 0 11.386719 1.2109375 L 2.3867188 8.2109375 A 1.0001 1.0001 0 0 0 2 9 L 2 20 C 2 21.64501 3.3549904 23 5 23 L 19 23 C 20.64501 23 22 21.64501 22 20 L 22 9 A 1.0001 1.0001 0 0 0 21.613281 8.2109375 L 12.613281 1.2109375 A 1.0001 1.0001 0 0 0 11.988281 1 z M 12 3.2675781 L 20 9.4882812 L 20 20 C 20 20.564129 19.564129 21 19 21 L 5 21 C 4.4358706 21 4 20.564129 4 20 L 4 9.4882812 L 12 3.2675781 z "
id="path873" />
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
d="M 9 11 A 1.0001 1.0001 0 0 0 8 12 L 8 22 A 1 1 0 0 0 9 23 A 1 1 0 0 0 10 22 L 10 13 L 14 13 L 14 22 A 1 1 0 0 0 15 23 A 1 1 0 0 0 16 22 L 16 12 A 1.0001 1.0001 0 0 0 15 11 L 9 11 z "
id="path869" />
</svg>
......@@ -35,6 +35,34 @@ .link-button { min-height: 0px; }
/* VCardWindow */
.VCard-GtkLinkButton { padding-left: 5px; border-left: none; }
#NicknameEntry:disabled {
font-size: 28px;
font-weight: bold;
border: none;
padding: 0px 0px 0px 0px;
background-color: @theme_unfocused_bg_color;
color: @theme_fg_color;
}
#ProfileWindow grid { padding: 18px; }
#ProfileWindow grid > button {
padding-left: 4px;
padding-right: 4px;
}
#ProfileWindow popover { padding: 6px; }
#ProfileWindow actionbar box {
padding: 0px;
}
#ProfileWindow actionbar button {
margin-top: 12px;
}
.profile-scrolled {
border: 1px solid;
border-radius: 4px;
border-color: @borders;
}
/* Emoticon Popover */
popover#EmoticonPopover button { background: none; border: none; box-shadow:none; padding: 0px;}
popover#EmoticonPopover button > label { font-size: 24px; }
......@@ -265,6 +293,7 @@ .large-header { font-size: 20px; font-weight: bold; }
.insensitive-fg-color {color: @insensitive_fg_color;}
/* Padding/Margins */
.margin-right18 { margin-right: 18px; }
.margin-top6 { margin-top: 6px; }
.margin-top12 { margin-top: 12px; }
.margin-3 { margin: 3px; }
......
......@@ -198,25 +198,26 @@ def __init__(self):
def invalidate_cache(self, jid):
self._cache.pop(jid, None)
def get_pixbuf(self, contact, size, scale, show=None):
surface = self.get_surface(contact, size, scale, show)
def get_pixbuf(self, contact, size, scale, show=None, default=False):
surface = self.get_surface(contact, size, scale, show, default)
return Gdk.pixbuf_get_from_surface(surface, 0, 0, size, size)
def get_surface(self, contact, size, scale, show=None):
def get_surface(self, contact, size, scale, show=None, default=False):
jid = contact.jid
if contact.is_gc_contact:
jid = contact.get_full_jid()
surface = self._cache[jid].get((size, scale, show))
if surface is not None:
return surface
if not default:
surface = self._cache[jid].get((size, scale, show))
if surface is not None:
return surface
surface = self._get_avatar_from_storage(contact, size, scale)
if surface is not None:
if show is not None:
surface = add_status_to_avatar(surface, show)
self._cache[jid][(size, scale, show)] = surface
return surface
surface = self._get_avatar_from_storage(contact, size, scale)
if surface is not None:
if show is not None:
surface = add_status_to_avatar(surface, show)
self._cache[jid][(size, scale, show)] = surface
return surface
name = contact.get_shown_name()
# Use nickname for group chats and bare JID for single contacts
......@@ -233,19 +234,20 @@ def get_surface(self, contact, size, scale, show=None):
self._cache[jid][(size, scale, show)] = surface
return surface
def get_muc_surface(self, account, jid, size, scale):
surface = self._cache[jid].get((size, scale))
if surface is not None:
return surface
avatar_sha = app.storage.cache.get_muc_avatar_sha(jid)
if avatar_sha is not None:
surface = self.surface_from_filename(avatar_sha, size, scale)
if surface is None:
return None
surface = clip_circle(surface)
self._cache[jid][(size, scale)] = surface
return surface
def get_muc_surface(self, account, jid, size, scale, default=False):
if not default:
surface = self._cache[jid].get((size, scale))
if surface is not None:
return surface
avatar_sha = app.storage.cache.get_muc_avatar_sha(jid)
if avatar_sha is not None:
surface = self.surface_from_filename(avatar_sha, size, scale)
if surface is None:
return None
surface = clip_circle(surface)
self._cache[jid][(size, scale)] = surface
return surface
con = app.connections[account]
name = get_groupchat_name(con, jid)
......
......@@ -85,6 +85,8 @@ def __init__(self):
self._helper_label.get_style_context().add_class('bold')
self._helper_label.get_style_context().add_class('dim-label')
self._helper_label.set_vexpand(True)
self._helper_label.set_no_show_all(True)
self._helper_label.show()
self.add(self._helper_label)
self.show_all()
......@@ -129,24 +131,25 @@ def _scale_for_publish(pixbuf):
pixbuf = pixbuf.scale_simple(width,
height,
GdkPixbuf.InterpType.BILINEAR)
return pixbuf
return pixbuf, width, height
def get_avatar_surface(self):
pixbuf = self._crop_area.get_pixbuf()
if pixbuf is None:
return None
scaled = self._scale_for_publish(pixbuf)
scaled, width, height = self._scale_for_publish(pixbuf)
return Gdk.cairo_surface_create_from_pixbuf(
scaled, self.get_scale_factor())
scaled, self.get_scale_factor()), width, height
def get_avatar_bytes(self):
pixbuf = self._crop_area.get_pixbuf()
if pixbuf is None:
return None
scaled = self._scale_for_publish(pixbuf)
scaled, width, height = self._scale_for_publish(pixbuf)
return scaled.save_to_bufferv('png', [], [])
success, data = scaled.save_to_bufferv('png', [], [])
return success, data, width, height
class CropArea(Gtk.DrawingArea):
......
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment