mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-29 17:59:21 +00:00
Display a profile icon if phone number in place of '+'
This commit is contained in:
parent
fe4c1982bb
commit
2f657c6ceb
4 changed files with 24 additions and 1 deletions
|
|
@ -540,3 +540,11 @@ bool Utils::isAnimatedImage(const QString& path){
|
|||
QImageReader reader(path);
|
||||
return reader.supportsAnimation() && reader.imageCount() > 1;
|
||||
}
|
||||
|
||||
bool Utils::isPhoneNumber(const QString& txt){
|
||||
auto core = CoreManager::getInstance()->getCore();
|
||||
if(!core)
|
||||
return false;
|
||||
auto account = core->getDefaultAccount();
|
||||
return account && account->isPhoneNumber(Utils::appStringToCoreString(txt));
|
||||
}
|
||||
|
|
@ -61,6 +61,7 @@ public:
|
|||
Q_INVOKABLE static QString toString(const LinphoneEnums::TunnelMode& mode);
|
||||
Q_INVOKABLE static bool isMe(const QString& address);
|
||||
Q_INVOKABLE static bool isAnimatedImage(const QString& path);
|
||||
Q_INVOKABLE static bool isPhoneNumber(const QString& txt);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
static inline QString coreStringToAppString (const std::string &str) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import Common 1.0
|
|||
import Linphone 1.0
|
||||
import Linphone.Styles 1.0
|
||||
|
||||
import Utils 1.0
|
||||
import UtilsCpp 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
Item {
|
||||
|
|
@ -19,6 +22,8 @@ Item {
|
|||
|
||||
property var _initialsRegex: /^\s*([^\s\.]+)(?:[\s\.]+([^\s\.]+))?/
|
||||
|
||||
property bool isPhoneNumber: UtilsCpp.isPhoneNumber(username)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function isLoaded () {
|
||||
|
|
@ -47,9 +52,16 @@ Item {
|
|||
backgroundColor: avatar.backgroundColor
|
||||
foregroundColor: avatar.foregroundColor
|
||||
source: avatar.image || ''
|
||||
Icon{
|
||||
anchors.fill: parent
|
||||
icon: AvatarStyle.personImage
|
||||
visible: parent.source == '' && avatar.isPhoneNumber
|
||||
overwriteColor: AvatarStyle.initials.color
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: initialsText
|
||||
anchors.centerIn: parent
|
||||
color: AvatarStyle.initials.color
|
||||
font.pointSize: {
|
||||
|
|
@ -63,7 +75,7 @@ Item {
|
|||
}
|
||||
|
||||
text: _computeInitials()
|
||||
visible: roundedImage.status !== Image.Ready
|
||||
visible: roundedImage.status !== Image.Ready && !avatar.isPhoneNumber
|
||||
}
|
||||
|
||||
PresenceLevel {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ QtObject {
|
|||
property string sectionName: 'Avatar'
|
||||
property color backgroundColor: ColorsList.add(sectionName+'_bg', 'd').color
|
||||
|
||||
property string personImage : 'contact_custom'
|
||||
|
||||
property QtObject initials: QtObject {
|
||||
property color color: ColorsList.add(sectionName+'_initials', 'q').color
|
||||
property int pointSize: Units.dp * 10
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue