summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2009-08-16 11:10:59 (GMT)
committerKevin Smith <git@kismith.co.uk>2009-08-16 11:15:20 (GMT)
commitc16133bf881a4eeb988d17ff318e4833a524997e (patch)
tree43fbd90e2691f971f73566cb069b0f38fbd7dae5 /Swift
parent585b65f17d50dfbb14b25e5372819033c964e79d (diff)
downloadswift-contrib-c16133bf881a4eeb988d17ff318e4833a524997e.zip
swift-contrib-c16133bf881a4eeb988d17ff318e4833a524997e.tar.bz2
Set the status text when changing presence.
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/QtRosterHeader.cpp10
-rw-r--r--Swift/QtUI/QtRosterHeader.h3
-rw-r--r--Swift/QtUI/QtStatusWidget.cpp9
-rw-r--r--Swift/QtUI/QtStatusWidget.h4
4 files changed, 21 insertions, 5 deletions
diff --git a/Swift/QtUI/QtRosterHeader.cpp b/Swift/QtUI/QtRosterHeader.cpp
index 7401b30..c479643 100644
--- a/Swift/QtUI/QtRosterHeader.cpp
+++ b/Swift/QtUI/QtRosterHeader.cpp
@@ -23,7 +23,7 @@ QtRosterHeader::QtRosterHeader(QWidget* parent) : QWidget(parent) {
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&)));
+ connect(statusWidget_, SIGNAL(onChangeStatusRequest(StatusShow::Type)), this, SLOT(handleChangeStatusRequest(StatusShow::Type)));
nameLabel_ = new QLabel(this);
setName("Me");
@@ -50,6 +50,14 @@ QtRosterHeader::QtRosterHeader(QWidget* parent) : QWidget(parent) {
setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
}
+void QtRosterHeader::handleChangeStatusRequest(StatusShow::Type type) {
+ emitStatus();
+}
+
+void QtRosterHeader::emitStatus() {
+ emit onChangeStatusRequest(statusWidget_->getSelectedStatusShow(), statusEdit_->toPlainText());
+}
+
void QtRosterHeader::setStatusText(const QString& statusMessage) {
statusEdit_->setText(statusMessage);
}
diff --git a/Swift/QtUI/QtRosterHeader.h b/Swift/QtUI/QtRosterHeader.h
index 94b7249..aeccf9a 100644
--- a/Swift/QtUI/QtRosterHeader.h
+++ b/Swift/QtUI/QtRosterHeader.h
@@ -20,8 +20,11 @@ namespace Swift {
void setName(const QString& name);
void setStatusText(const QString& statusMessage);
QSize sizeHint() const;
+ void emitStatus();
signals:
void onChangeStatusRequest(StatusShow::Type showType, const QString &statusMessage);
+ private slots:
+ void handleChangeStatusRequest(StatusShow::Type type);
private:
QLabel* avatarLabel_;
QLabel* nameLabel_;
diff --git a/Swift/QtUI/QtStatusWidget.cpp b/Swift/QtUI/QtStatusWidget.cpp
index 53f93b5..57ef3e0 100644
--- a/Swift/QtUI/QtStatusWidget.cpp
+++ b/Swift/QtUI/QtStatusWidget.cpp
@@ -6,7 +6,7 @@
namespace Swift {
-QtStatusWidget::QtStatusWidget(QWidget *parent) {
+QtStatusWidget::QtStatusWidget(QWidget *parent) : QWidget(parent) {
types_ = new QComboBox(this);
types_->addItem("Available", QVariant(StatusShow::Online));
types_->addItem("Free For Chat", QVariant(StatusShow::FFC));
@@ -22,7 +22,12 @@ QtStatusWidget::QtStatusWidget(QWidget *parent) {
}
void QtStatusWidget::handleTypeSelected(int index) {
- emit onChangeStatusRequest((StatusShow::Type)types_->itemData(index).toInt(), "");
+ Q_UNUSED(index);
+ emit onChangeStatusRequest(getSelectedStatusShow());
+}
+
+StatusShow::Type QtStatusWidget::getSelectedStatusShow() {
+ return (StatusShow::Type)types_->itemData(types_->currentIndex()).toInt();
}
}
diff --git a/Swift/QtUI/QtStatusWidget.h b/Swift/QtUI/QtStatusWidget.h
index abd352f..a1c345d 100644
--- a/Swift/QtUI/QtStatusWidget.h
+++ b/Swift/QtUI/QtStatusWidget.h
@@ -13,13 +13,13 @@ namespace Swift {
Q_OBJECT
public:
QtStatusWidget(QWidget *parent);
+ StatusShow::Type getSelectedStatusShow();
signals:
- void onChangeStatusRequest(StatusShow::Type showType, const QString &statusMessage);
+ void onChangeStatusRequest(StatusShow::Type showType);
private slots:
void handleTypeSelected(int index);
private:
QComboBox *types_;
- QLineEdit *message_;
};
}