[SCM] ktp-contact-list packaging branch, master, updated. debian/15.12.1-2-1070-g6c56f91

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:11:30 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=3e4e8fa

The following commit has been merged in the master branch:
commit 3e4e8fab29a6a0fb3dfe27513b073369cb8a191f
Author: Michael Zanetti <mzanetti at kde.org>
Date:   Sun Oct 21 16:36:13 2012 +0200

    get rid of hardcoded size values to make the UI usable on high-res screens
---
 contact-delegate-compact.cpp |  8 ++++----
 contact-delegate.cpp         | 35 ++++++++++++++++-------------------
 contact-delegate.h           |  3 +++
 contact-overlays.cpp         | 18 ++++++++++--------
 4 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/contact-delegate-compact.cpp b/contact-delegate-compact.cpp
index 2cb00dc..fcaffe6 100644
--- a/contact-delegate-compact.cpp
+++ b/contact-delegate-compact.cpp
@@ -163,14 +163,14 @@ void ContactDelegateCompact::setListMode(ContactDelegateCompact::ListSize size)
 {
     if (size == ContactDelegateCompact::Mini) {
         m_spacing = 2;
-        m_avatarSize = qMax(12, KGlobalSettings::smallestReadableFont().pixelSize() + m_spacing);
+        m_avatarSize = IconSize(KIconLoader::Toolbar);
         m_presenceIconSize = qMax(12, KGlobalSettings::smallestReadableFont().pixelSize() + m_spacing);
         m_clientTypeIconSize = qMax(12, KGlobalSettings::smallestReadableFont().pixelSize() + m_spacing);
     } else if (size == ContactDelegateCompact::Normal) {
         m_spacing = 4;
-        m_avatarSize = 22;
-        m_presenceIconSize = 16;
-        m_clientTypeIconSize = 16;
+        m_avatarSize = IconSize(KIconLoader::Toolbar);
+        m_presenceIconSize = IconSize(KIconLoader::Small);
+        m_clientTypeIconSize = IconSize(KIconLoader::Small);
     }
 
     m_listSize = size;
diff --git a/contact-delegate.cpp b/contact-delegate.cpp
index 19ed1f0..01137f3 100644
--- a/contact-delegate.cpp
+++ b/contact-delegate.cpp
@@ -41,14 +41,11 @@
 #include <KTp/Models/groups-model.h>
 #include <KTp/presence.h>
 
-const int SPACING = 4;
-const int AVATAR_SIZE = 32;
-const int PRESENCE_ICON_SIZE = 22;
-const int CLIENT_TYPE_ICON_SIZE = 22;
-const int ACCOUNT_ICON_SIZE = 13;
-
 ContactDelegate::ContactDelegate(QObject * parent)
     : AbstractContactDelegate(parent)
+    , m_avatarSize(IconSize(KIconLoader::Dialog))
+    , m_presenceIconSize(IconSize(KIconLoader::Toolbar))
+    , m_spacing(IconSize(KIconLoader::Dialog) / 8)
 {
 
 }
@@ -72,8 +69,8 @@ void ContactDelegate::paintContact(QPainter *painter, const QStyleOptionViewItem
     style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter);
 
     QRect iconRect = optV4.rect;
-    iconRect.setSize(QSize(AVATAR_SIZE, AVATAR_SIZE));
-    iconRect.moveTo(QPoint(iconRect.x() + SPACING, iconRect.y() + SPACING));
+    iconRect.setSize(QSize(m_avatarSize, m_avatarSize));
+    iconRect.moveTo(QPoint(iconRect.x() + m_spacing, iconRect.y() + m_spacing));
 
     QPixmap avatar;
     avatar.load(index.data(AccountsModel::AvatarRole).toString());
@@ -102,33 +99,33 @@ void ContactDelegate::paintContact(QPainter *painter, const QStyleOptionViewItem
     KTp::Presence presence = index.data(AccountsModel::PresenceRole).value<KTp::Presence>();
 
     // This value is used to set the correct width for the username and the presence message.
-    int rightIconsWidth = PRESENCE_ICON_SIZE + SPACING;
+    int rightIconsWidth = m_presenceIconSize + m_spacing;
 
     QPixmap icon = presence.icon().pixmap(KIconLoader::SizeSmallMedium);
 
     QRect statusIconRect = optV4.rect;
-    statusIconRect.setSize(QSize(PRESENCE_ICON_SIZE, PRESENCE_ICON_SIZE));
+    statusIconRect.setSize(QSize(m_presenceIconSize, m_presenceIconSize));
     statusIconRect.moveTo(QPoint(optV4.rect.right() - rightIconsWidth,
-                                 optV4.rect.top() + (optV4.rect.height() - PRESENCE_ICON_SIZE) / 2));
+                                 optV4.rect.top() + (optV4.rect.height() - m_presenceIconSize) / 2));
 
     painter->drawPixmap(statusIconRect, icon);
 
     // Right now we only check for 'phone', as that's the most interesting type.
     if (index.data(AccountsModel::ClientTypesRole).toStringList().contains(QLatin1String("phone"))) {
         // Additional space is needed for the icons, don't add too much spacing between the two icons
-        rightIconsWidth += CLIENT_TYPE_ICON_SIZE + (SPACING / 2);
+        rightIconsWidth += m_presenceIconSize + m_spacing / 2;
 
-        QPixmap phone = QIcon::fromTheme("phone").pixmap(CLIENT_TYPE_ICON_SIZE);
+        QPixmap phone = QIcon::fromTheme("phone").pixmap(m_presenceIconSize);
         QRect phoneIconRect = optV4.rect;
-        phoneIconRect.setSize(QSize(CLIENT_TYPE_ICON_SIZE, CLIENT_TYPE_ICON_SIZE));
+        phoneIconRect.setSize(QSize(m_presenceIconSize, m_presenceIconSize));
         phoneIconRect.moveTo(QPoint(optV4.rect.right() - rightIconsWidth,
-                                    optV4.rect.top() + (optV4.rect.height() - CLIENT_TYPE_ICON_SIZE) / 2));
+                                    optV4.rect.top() + (optV4.rect.height() - m_presenceIconSize) / 2));
         painter->drawPixmap(phoneIconRect, phone);
     }
 
     QRect userNameRect = optV4.rect;
-    userNameRect.setX(iconRect.x() + iconRect.width() + SPACING);
-    userNameRect.setY(userNameRect.y() + 2);
+    userNameRect.setX(iconRect.x() + iconRect.width() + m_spacing);
+    userNameRect.setY(userNameRect.y() + m_spacing / 2);
     userNameRect.setWidth(userNameRect.width() - rightIconsWidth);
 
     const QFontMetrics nameFontMetrics(KGlobalSettings::generalFont());
@@ -145,7 +142,7 @@ void ContactDelegate::paintContact(QPainter *painter, const QStyleOptionViewItem
     const QFontMetrics statusFontMetrics(KGlobalSettings::smallestReadableFont());
 
     QRect statusMsgRect = optV4.rect;
-    statusMsgRect.setX(iconRect.x() + iconRect.width() + SPACING);
+    statusMsgRect.setX(iconRect.x() + iconRect.width() + m_spacing);
     statusMsgRect.setY(userNameRect.bottom() - statusFontMetrics.height() - 4);
     statusMsgRect.setWidth(statusMsgRect.width() - rightIconsWidth);
 
@@ -175,7 +172,7 @@ QSize ContactDelegate::sizeHintContact(const QStyleOptionViewItem &option, const
 {
     Q_UNUSED(option);
     Q_UNUSED(index);
-    return QSize(0, AVATAR_SIZE + 2 * SPACING);
+    return QSize(0, m_avatarSize + 2 * m_spacing);
 }
 
 void ContactDelegate::hideStatusMessageSlot(const QModelIndex& index)
diff --git a/contact-delegate.h b/contact-delegate.h
index 8508f7e..9f0e5df 100644
--- a/contact-delegate.h
+++ b/contact-delegate.h
@@ -54,6 +54,9 @@ protected:
 private:
     QModelIndex m_indexForHiding;
     int         m_fadingValue;
+    int         m_avatarSize;
+    int         m_presenceIconSize;
+    int         m_spacing;
 };
 
 #endif // CONTACTDELEGATE_H
diff --git a/contact-overlays.cpp b/contact-overlays.cpp
index 8ea1b1a..9ff4ae2 100644
--- a/contact-overlays.cpp
+++ b/contact-overlays.cpp
@@ -28,6 +28,8 @@
 #include <KTp/Models/accounts-model.h>
 #include <KTp/Models/contact-model-item.h>
 
+const int spacing = IconSize(KIconLoader::Dialog) / 8;
+
 class GuiItemContactViewHoverButton : public ContactViewHoverButton
 {
 public:
@@ -52,14 +54,14 @@ GuiItemContactViewHoverButton::GuiItemContactViewHoverButton(QAbstractItemView *
 
 QSize GuiItemContactViewHoverButton::sizeHint() const
 {
-    return QSize(KIconLoader::SizeSmall, KIconLoader::SizeSmall);
+    return QSize(IconSize(KIconLoader::Small), IconSize(KIconLoader::Small));
 }
 
 QPixmap GuiItemContactViewHoverButton::icon()
 {
     return KIconLoader::global()->loadIcon(m_guiItem.iconName(),
                                            KIconLoader::NoGroup,
-                                           KIconLoader::SizeSmall);
+                                           IconSize(KIconLoader::Small));
 }
 
 void GuiItemContactViewHoverButton::updateToolTip()
@@ -100,7 +102,7 @@ void StartChannelContactOverlay::updateButton(const QModelIndex &index)
     const QRect rect = m_view->visualRect(index);
     const QSize size = button()->size();
 
-    const int gap = 2;
+    const int gap = spacing / 2;
     const int x   = rect.left() + m_xpos; // rect.right() - gap - 96 - size.width();
     const int y   = rect.bottom() - gap - size.height();
     button()->move(QPoint(x, y));
@@ -132,7 +134,7 @@ TextChannelContactOverlay::TextChannelContactOverlay(QObject *parent)
         KGuiItem(i18n("Start Chat"), "text-x-generic",
                  i18n("Start Chat"), i18n("Start a text chat")),
         AccountsModel::TextChatCapabilityRole,
-        40)
+        IconSize(KIconLoader::Dialog) + spacing * 2)
 {
 }
 
@@ -144,7 +146,7 @@ AudioChannelContactOverlay::AudioChannelContactOverlay(QObject *parent)
         KGuiItem(i18n("Start Audio Call"), "audio-headset",
                  i18n("Start Audio Call"), i18n("Start an audio call")),
         AccountsModel::AudioCallCapabilityRole,
-        64)
+        IconSize(KIconLoader::Dialog) + spacing * 3 + IconSize(KIconLoader::Small))
 
 {
 }
@@ -157,7 +159,7 @@ VideoChannelContactOverlay::VideoChannelContactOverlay(QObject *parent)
         KGuiItem(i18n("Start Video Call"), "camera-web",
                  i18n("Start Video Call"), i18n("Start a video call")),
         AccountsModel::VideoCallCapabilityRole,
-        88)
+        IconSize(KIconLoader::Dialog) + spacing * 4 + IconSize(KIconLoader::Small) * 2)
 {
 }
 
@@ -169,7 +171,7 @@ FileTransferContactOverlay::FileTransferContactOverlay(QObject *parent)
         KGuiItem(i18n("Send File..."), "mail-attachment",
                  i18n("Send File..."), i18n("Send a file")),
         AccountsModel::FileTransferCapabilityRole,
-        128)
+        IconSize(KIconLoader::Dialog) + spacing * 5 + IconSize(KIconLoader::Small) * 3)
 {
 }
 
@@ -181,7 +183,7 @@ DesktopSharingContactOverlay::DesktopSharingContactOverlay(QObject *parent)
         KGuiItem(i18n("Share my desktop"), "krfb",
                  i18n("Share my desktop"), i18n("Share desktop using RFB")),
         AccountsModel::DesktopSharingCapabilityRole,
-        152)
+        IconSize(KIconLoader::Dialog) + spacing * 6 + IconSize(KIconLoader::Small) * 4)
 {
 }
 

-- 
ktp-contact-list packaging



More information about the pkg-kde-commits mailing list