From c7ea4a479d2f63c73278f934f68bbb5d5430a334 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Mon, 23 May 2016 17:31:23 +0200 Subject: Changing default avatar to a blue circled swift The old default avatar does not work well with the new chat view design which uses circled avatars. This also uses the vector avatar internally in Swift and has Qt and the chat view engine scale it to the required size. Test-Information: Tested on OS X 10.11.5 with non-compact chat views and MUC conversations. Change-Id: I82580ecb91fc81f4fe9535aa9d3b214b720a40f3 diff --git a/Swift/QtUI/QtRosterHeader.cpp b/Swift/QtUI/QtRosterHeader.cpp index 11dacb0..b405d10 100644 --- a/Swift/QtUI/QtRosterHeader.cpp +++ b/Swift/QtUI/QtRosterHeader.cpp @@ -119,7 +119,7 @@ void QtRosterHeader::setAvatar(const QString& path) { avatar.load(scaledAvatarPath); } else { - avatar = QPixmap(":/icons/avatar.png").scaled(avatarSize_, avatarSize_, Qt::KeepAspectRatio, Qt::SmoothTransformation); + avatar = QPixmap(":/icons/avatar.svg").scaled(avatarSize_, avatarSize_, Qt::KeepAspectRatio, Qt::SmoothTransformation); } avatarLabel_->setPixmap(avatar); } diff --git a/Swift/QtUI/QtWebKitChatView.cpp b/Swift/QtUI/QtWebKitChatView.cpp index afa2d5e..f369e35 100644 --- a/Swift/QtUI/QtWebKitChatView.cpp +++ b/Swift/QtUI/QtWebKitChatView.cpp @@ -549,7 +549,7 @@ std::string QtWebKitChatView::addMessage( bool appendToPrevious = appendToPreviousCheck(PreviousMessageWasMessage, senderName, senderIsSelf); - QString qAvatarPath = scaledAvatarPath.isEmpty() ? "qrc:/icons/avatar.png" : QUrl::fromLocalFile(scaledAvatarPath).toEncoded(); + QString qAvatarPath = scaledAvatarPath.isEmpty() ? "qrc:/icons/avatar.svg" : QUrl::fromLocalFile(scaledAvatarPath).toEncoded(); std::string id = "id" + boost::lexical_cast(idCounter_++); addMessageBottom(std::make_shared(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(time), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), direction)); @@ -624,7 +624,7 @@ std::string QtWebKitChatView::addFileTransfer(const std::string& senderName, boo bool appendToPrevious = appendToPreviousCheck(PreviousMessageWasFileTransfer, senderName, senderIsSelf); - QString qAvatarPath = "qrc:/icons/avatar.png"; + QString qAvatarPath = "qrc:/icons/avatar.svg"; std::string id = "ftmessage" + boost::lexical_cast(idCounter_++); addMessageBottom(std::make_shared(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(boost::posix_time::second_clock::universal_time()), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), ChatSnippet::getDirection(actionText))); @@ -658,7 +658,7 @@ std::string QtWebKitChatView::addWhiteboardRequest(const QString& contact, bool buildChatWindowButton(tr("Accept"), ButtonWhiteboardSessionAcceptRequest, wb_id) + ""; } - QString qAvatarPath = "qrc:/icons/avatar.png"; + QString qAvatarPath = "qrc:/icons/avatar.svg"; std::string id = "wbmessage" + boost::lexical_cast(idCounter_++); addMessageBottom(std::make_shared(htmlString, QtUtilities::htmlEscape(contact), B2QDATE(boost::posix_time::second_clock::universal_time()), qAvatarPath, false, false, theme_, P2QSTRING(id), ChatSnippet::getDirection(actionText))); previousMessageWasSelf_ = false; @@ -919,7 +919,7 @@ void QtWebKitChatView::addMUCInvitation(const std::string& senderName, const JID bool appendToPrevious = appendToPreviousCheck(PreviousMessageWasMUCInvite, senderName, false); - QString qAvatarPath = "qrc:/icons/avatar.png"; + QString qAvatarPath = "qrc:/icons/avatar.svg"; addMessageBottom(std::make_shared(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(boost::posix_time::second_clock::universal_time()), qAvatarPath, false, appendToPrevious, theme_, id, ChatSnippet::getDirection(message))); previousMessageWasSelf_ = false; diff --git a/Swift/QtUI/Roster/DelegateCommons.cpp b/Swift/QtUI/Roster/DelegateCommons.cpp index 517683b..c1c1244 100644 --- a/Swift/QtUI/Roster/DelegateCommons.cpp +++ b/Swift/QtUI/Roster/DelegateCommons.cpp @@ -45,7 +45,7 @@ void DelegateCommons::paintContact(QPainter* painter, const QStyleOptionViewItem } } if (!compact && avatarPixmap.isNull()) { - avatarPixmap = QPixmap(":/icons/avatar.png").scaled(avatarRegion.height(), avatarRegion.width(), Qt::KeepAspectRatio, Qt::SmoothTransformation); + avatarPixmap = QPixmap(":/icons/avatar.svg").scaled(avatarRegion.height(), avatarRegion.width(), Qt::KeepAspectRatio, Qt::SmoothTransformation); } if (!compact) { diff --git a/Swift/QtUI/Roster/RosterTooltip.cpp b/Swift/QtUI/Roster/RosterTooltip.cpp index d151628..8ecd276 100644 --- a/Swift/QtUI/Roster/RosterTooltip.cpp +++ b/Swift/QtUI/Roster/RosterTooltip.cpp @@ -85,7 +85,7 @@ QString RosterTooltip::buildDetailedTooltip(ContactRosterItem* contact, QtScaled contact->onVCardRequested(); } - QString scaledAvatarPath = cachedImageScaler->getScaledAvatarPath(P2QSTRING(contact->getAvatarPath().empty() ? ":/icons/avatar.png" : pathToString(contact->getAvatarPath()))); + QString scaledAvatarPath = cachedImageScaler->getScaledAvatarPath(P2QSTRING(contact->getAvatarPath().empty() ? ":/icons/avatar.svg" : pathToString(contact->getAvatarPath()))); QString bareJID = contact->getDisplayJID().toString().empty() ? "" : "( " + P2QSTRING(contact->getDisplayJID().toString()) + " )"; diff --git a/Swift/QtUI/Swift.qrc b/Swift/QtUI/Swift.qrc index 3c9f43f..4c8fd55 100644 --- a/Swift/QtUI/Swift.qrc +++ b/Swift/QtUI/Swift.qrc @@ -16,7 +16,7 @@ ../resources/icons/warn.png ../resources/icons/check.png ../resources/icons/throbber.gif - ../resources/icons/avatar.png + ../resources/icons/avatar.svg ../resources/icons/no-avatar.png ../resources/icons/tray-standard.png ../resources/icons/new-chat.png diff --git a/Swift/resources/icons/avatar.png b/Swift/resources/icons/avatar.png deleted file mode 100644 index 4b73b44..0000000 Binary files a/Swift/resources/icons/avatar.png and /dev/null differ diff --git a/Swift/resources/icons/avatar.svg b/Swift/resources/icons/avatar.svg index e9f3a89..54e2aae 100644 --- a/Swift/resources/icons/avatar.svg +++ b/Swift/resources/icons/avatar.svg @@ -1,5 +1,6 @@ + + viewBox="0 0 89 89" + version="1.1"> + + + + image/svg+xml + + + + + + id="defs6"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id="linearGradient24" + spreadMethod="pad" + gradientTransform="matrix(0,20.8601,20.8601,0,100,1)" + gradientUnits="userSpaceOnUse" + y2="0" + x2="1" + y1="0" + x1="0"> + style="stop-opacity:1;stop-color:#fcfdf4" /> + style="stop-opacity:1;stop-color:#b7b7ad" /> + + + + + + + + + + + + + + + + + + + + + + + + + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 526.18109 : 1" + sodipodi:type="inkscape:persp3d" /> + id="linearGradient3150-6"> + + + + + + + - - - - image/svg+xml - - - - + inkscape:zoom="6.6691528" + inkscape:cx="64.454266" + inkscape:cy="68.648241" + inkscape:window-x="0" + inkscape:window-y="23" + inkscape:window-maximized="0" + inkscape:current-layer="g10" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> - + inkscape:label="ink_ext_XXXXXX" + transform="matrix(1.25,0,0,-1.25,-508.98876,369.64004)"> + + + + + + + + + + + + + sodipodi:open="true" + sodipodi:end="9.4489119" + sodipodi:start="3.2027767" + sodipodi:type="arc" + style="fill:#ffd632;fill-opacity:0;fill-rule:nonzero;stroke:#235071;stroke-width:5.0999999;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" + id="path6540" + sodipodi:cx="-102" + sodipodi:cy="82.462494" + sodipodi:rx="32" + sodipodi:ry="32" + d="m -133.94012,80.505826 a 32,32 0 0 1 33.60086,-30.000208 32,32 0 0 1 30.310148,33.32155 32,32 0 0 1 -33.039378,30.617482 32,32 0 0 1 -30.92219,-32.754367" + transform="matrix(1.0298331,0,0,-1.0298331,547.81489,345.01645)" /> -- cgit v0.10.2-6-g49f6