From a6caf0f52dbb24577e3730d9c42415e89e18a99b Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Tue, 25 May 2010 14:48:28 +0100
Subject: Correctly scale avatars in the MeView.

Resolves: #376

diff --git a/Swift/QtUI/QtRosterHeader.cpp b/Swift/QtUI/QtRosterHeader.cpp
index fc3d0e6..5c89e2a 100644
--- a/Swift/QtUI/QtRosterHeader.cpp
+++ b/Swift/QtUI/QtRosterHeader.cpp
@@ -16,6 +16,7 @@
 #include "QtStatusWidget.h"
 #include "Swift/QtUI/QtElidingLabel.h"
 
+
 namespace Swift {
 QtRosterHeader::QtRosterHeader(QWidget* parent) : QWidget(parent) {
 	QHBoxLayout* topLayout = new QHBoxLayout();
@@ -26,10 +27,11 @@ QtRosterHeader::QtRosterHeader(QWidget* parent) : QWidget(parent) {
 	setMaximumHeight(50);
 
 	avatarLabel_ = new QLabel(this);
-	avatarLabel_->setMinimumSize(40, 40);
-	avatarLabel_->setMaximumSize(40, 40);
+	avatarLabel_->setMinimumSize(avatarSize_, avatarSize_);
+	avatarLabel_->setMaximumSize(avatarSize_, avatarSize_);
+	avatarLabel_->setAlignment(Qt::AlignCenter);
 	setAvatar(":/icons/avatar.png");
-	avatarLabel_->setScaledContents(true);
+	avatarLabel_->setScaledContents(false);
 	topLayout->addWidget(avatarLabel_);
 
 	QVBoxLayout* rightLayout = new QVBoxLayout();
@@ -125,11 +127,13 @@ void QtRosterHeader::setAvatar(const QString& path) {
 		qDebug() << "Setting null avatar";
 		avatar = QIcon(":/icons/avatar.png");
 	} 
-	avatarLabel_->setPixmap(avatar.pixmap(64, 64));
+	avatarLabel_->setPixmap(avatar.pixmap(avatarSize_, avatarSize_));
 }
 
 //QSize QtRosterHeader::sizeHint() const {
 //	return minimumSizeHint();
 //}
 
+const int QtRosterHeader::avatarSize_ = 40;
+
 }
diff --git a/Swift/QtUI/QtRosterHeader.h b/Swift/QtUI/QtRosterHeader.h
index 72091cb..6d36b75 100644
--- a/Swift/QtUI/QtRosterHeader.h
+++ b/Swift/QtUI/QtRosterHeader.h
@@ -30,26 +30,17 @@ namespace Swift {
 		void setName(const QString& name);
 		void setStatusText(const QString& statusMessage);
 		void setStatusType(StatusShow::Type type);
-//		QSize sizeHint() const;
-//	public slots:
-//		void emitStatus();
 	signals:
 		void onChangeStatusRequest(StatusShow::Type showType, const QString &statusMessage);
 	private slots:
 		void handleChangeStatusRequest(StatusShow::Type type, const QString &statusMessage);
-//	protected:
-//		virtual void resizeEvent(QResizeEvent* event);
-//		virtual void mousePressEvent(QMouseEvent* event);
 	private:
-//		void resizeNameLabel();
-//		void toggleExpanded();
 		QString name_;
 		QLabel* avatarLabel_;
 		QLabel* nameLabel_;
 		QtTextEdit* statusEdit_;
 		QToolBar* toolBar_;
 		QtStatusWidget* statusWidget_;
-		//QHBoxLayout* expandedLayout_;
-		//bool expanded_;
+		static const int avatarSize_;
 	};
 }
-- 
cgit v0.10.2-6-g49f6