summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2009-08-16 09:16:33 (GMT)
committerKevin Smith <git@kismith.co.uk>2009-08-16 09:16:33 (GMT)
commit585b65f17d50dfbb14b25e5372819033c964e79d (patch)
tree2ec7040acbd655d020145c672b8d0625fe403d4a /Swift/QtUI/QtRosterHeader.cpp
parent6fd62cfe8859ad4cdba4113552ba9bb1ef9563e4 (diff)
downloadswift-585b65f17d50dfbb14b25e5372819033c964e79d.zip
swift-585b65f17d50dfbb14b25e5372819033c964e79d.tar.bz2
Adding the start of a 'me view' to the head of the roster.
Diffstat (limited to 'Swift/QtUI/QtRosterHeader.cpp')
-rw-r--r--Swift/QtUI/QtRosterHeader.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/Swift/QtUI/QtRosterHeader.cpp b/Swift/QtUI/QtRosterHeader.cpp
new file mode 100644
index 0000000..7401b30
--- /dev/null
+++ b/Swift/QtUI/QtRosterHeader.cpp
@@ -0,0 +1,71 @@
+#include "QtRosterHeader.h"
+
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QIcon>
+#include <QSizePolicy>
+
+#include "QtStatusWidget.h"
+
+namespace Swift {
+QtRosterHeader::QtRosterHeader(QWidget* parent) : QWidget(parent) {
+ QVBoxLayout* vLayout = new QVBoxLayout();
+ vLayout->setSpacing(0);
+ vLayout->setContentsMargins(0,0,0,0);
+ setLayout(vLayout);
+
+ //QHBoxLayout* topLayout = new QHBoxLayout();
+ //vLayout->addLayout(topLayout);
+
+ toolBar_ = new QToolBar(this);
+ vLayout->addWidget(toolBar_);
+
+ statusWidget_ = new QtStatusWidget(this);
+ toolBar_->addWidget(statusWidget_);
+ statusWidget_->resize(50, statusWidget_->height());
+ connect(statusWidget_, SIGNAL(onChangeStatusRequest(StatusShow::Type, const QString&)), this, SIGNAL(onChangeStatusRequest(StatusShow::Type, const QString&)));
+
+ nameLabel_ = new QLabel(this);
+ setName("Me");
+ //topLayout->addWidget(nameLabel_);
+ toolBar_->addWidget(nameLabel_);
+
+ QHBoxLayout* expandedLayout = new QHBoxLayout();
+ expandedLayout->setContentsMargins(5,5,5,5);
+ expandedLayout->setSpacing(11);
+
+ avatarLabel_ = new QLabel(this);
+ setAvatar(":/icons/avatar.png");
+ expandedLayout->addWidget(avatarLabel_);
+
+ statusEdit_ = new QTextEdit(this);
+ expandedLayout->addWidget(statusEdit_);
+ statusEdit_->resize(statusEdit_->width(), 64);
+ statusEdit_->setAcceptRichText(false);
+ statusEdit_->setReadOnly(false);
+ setStatusText("Could be here, could be away.");
+
+ vLayout->addLayout(expandedLayout);
+
+ setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
+}
+
+void QtRosterHeader::setStatusText(const QString& statusMessage) {
+ statusEdit_->setText(statusMessage);
+}
+
+void QtRosterHeader::setName(const QString& name) {
+ QString escapedName = name;
+ escapedName.replace("<","&lt;");
+ nameLabel_->setText("<b>" + escapedName + "</b>");
+}
+
+void QtRosterHeader::setAvatar(const QString& path) {
+ avatarLabel_->setPixmap(QIcon(path).pixmap(64, 64));
+}
+
+QSize QtRosterHeader::sizeHint() const {
+ return minimumSizeHint();
+}
+
+}