summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-02-07 18:46:28 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-02-07 18:46:42 (GMT)
commit9a00b89112861cf81554da9e956b2b3b5cddbdf7 (patch)
tree944928beb9b7fe16463b73a95f3968118b5e02f4 /Swift/QtUI
parentd1837d06c5d655de759bbfcc66711a71c92296ad (diff)
downloadswift-contrib-9a00b89112861cf81554da9e956b2b3b5cddbdf7.zip
swift-contrib-9a00b89112861cf81554da9e956b2b3b5cddbdf7.tar.bz2
Now make the roster header *really* clickable.
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtRosterHeader.cpp33
-rw-r--r--Swift/QtUI/QtRosterHeader.h3
-rw-r--r--Swift/QtUI/SConscript1
3 files changed, 7 insertions, 30 deletions
diff --git a/Swift/QtUI/QtRosterHeader.cpp b/Swift/QtUI/QtRosterHeader.cpp
index 0fad137..57e7af1 100644
--- a/Swift/QtUI/QtRosterHeader.cpp
+++ b/Swift/QtUI/QtRosterHeader.cpp
@@ -15,6 +15,7 @@
#include "QtStatusWidget.h"
#include <Swift/QtUI/QtElidingLabel.h>
+#include <Swift/QtUI/QtClickableLabel.h>
#include <Swift/QtUI/QtNameWidget.h>
namespace Swift {
@@ -26,14 +27,14 @@ QtRosterHeader::QtRosterHeader(QtSettingsProvider* settings, QWidget* parent) :
setMinimumHeight(50);
setMaximumHeight(50);
- avatarLabel_ = new QLabel(this);
+ avatarLabel_ = new QtClickableLabel(this);
avatarLabel_->setMinimumSize(avatarSize_, avatarSize_);
avatarLabel_->setMaximumSize(avatarSize_, avatarSize_);
avatarLabel_->setAlignment(Qt::AlignCenter);
setAvatar(":/icons/avatar.png");
avatarLabel_->setScaledContents(false);
topLayout->addWidget(avatarLabel_);
- //connect(avatarLabel_, SIGNAL(clicked()), this, SIGNAL(onEditProfileRequest())); /* FIXME: clickableish signal for label */
+ connect(avatarLabel_, SIGNAL(clicked()), this, SIGNAL(onEditProfileRequest()));
QVBoxLayout* rightLayout = new QVBoxLayout();
rightLayout->setSpacing(4);
@@ -49,38 +50,12 @@ QtRosterHeader::QtRosterHeader(QtSettingsProvider* settings, QWidget* parent) :
connect(statusWidget_, SIGNAL(onChangeStatusRequest(StatusShow::Type, const QString&)), this, SLOT(handleChangeStatusRequest(StatusShow::Type, const QString&)));
rightLayout->addWidget(statusWidget_);
show();
- //statusWidget_->setMaximumWidth(60);
-
- // statusEdit_ = new QtTextEdit(this);
- // expandedLayout_->addWidget(statusEdit_);
- // statusEdit_->resize(statusEdit_->width(), 64);
- // statusEdit_->setAcceptRichText(false);
- // statusEdit_->setReadOnly(false);
- // setStatusText("");
- // connect(statusEdit_, SIGNAL(returnPressed()), this, SLOT(emitStatus()));
-
- //setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
}
-// void QtRosterHeader::mousePressEvent(QMouseEvent* event) {
-// if (nameLabel_->underMouse() || (toolBar_->underMouse() && !statusWidget_->underMouse())) {
-// toggleExpanded();
-// event->accept();
-// } else {
-// event->ignore();
-// }
-
-// }
-
-
void QtRosterHeader::handleChangeStatusRequest(StatusShow::Type type, const QString& text) {
emit onChangeStatusRequest(type, text);
}
-//void QtRosterHeader::emitStatus() {
-// emit onChangeStatusRequest(statusWidget_->getSelectedStatusShow(), statusEdit_->toPlainText());
-//}
-
void QtRosterHeader::setStatusText(const QString& statusMessage) {
statusWidget_->setStatusText(statusMessage);
}
@@ -96,7 +71,7 @@ void QtRosterHeader::setConnecting() {
void QtRosterHeader::setAvatar(const QString& path) {
QIcon avatar(path);
if (avatar.isNull()) {
- qDebug() << "Setting null avatar";
+ //qDebug() << "Setting null avatar";
avatar = QIcon(":/icons/avatar.png");
}
avatarLabel_->setPixmap(avatar.pixmap(avatarSize_, avatarSize_));
diff --git a/Swift/QtUI/QtRosterHeader.h b/Swift/QtUI/QtRosterHeader.h
index 6c76993..0dc611d 100644
--- a/Swift/QtUI/QtRosterHeader.h
+++ b/Swift/QtUI/QtRosterHeader.h
@@ -20,6 +20,7 @@
class QHBoxLayout;
namespace Swift {
+ class QtClickableLabel;
class QtStatusWidget;
class QtNameWidget;
class QtSettingsProvider;
@@ -44,7 +45,7 @@ namespace Swift {
void handleChangeStatusRequest(StatusShow::Type type, const QString &statusMessage);
private:
QString name_;
- QLabel* avatarLabel_;
+ QtClickableLabel* avatarLabel_;
QtNameWidget* nameWidget_;
QtTextEdit* statusEdit_;
QToolBar* toolBar_;
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index d27dc8c..cc6db35 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -69,6 +69,7 @@ sources = [
"QtUIFactory.cpp",
"QtChatWindowFactory.cpp",
"QtChatWindow.cpp",
+ "QtClickableLabel.cpp",
"QtLoginWindow.cpp",
"QtMainWindow.cpp",
"QtProfileWindow.cpp",