diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-10-24 13:42:25 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-10-24 13:42:25 (GMT) |
commit | 77fbff68d5aa3a292a3cb2aae4fdaf7f5619116a (patch) | |
tree | 8aa7cc62f10eb2b4fbf96fb10ca976625f6baaf1 /Swift/QtUI | |
parent | 0f078be02cd6818aeacc935a1ab790b41267a00d (diff) | |
download | swift-contrib-77fbff68d5aa3a292a3cb2aae4fdaf7f5619116a.zip swift-contrib-77fbff68d5aa3a292a3cb2aae4fdaf7f5619116a.tar.bz2 |
Provide feedback in the status header when attempting to connect.
Resolves: #657
Release-Notes: The status setter now shows when you're connecting.
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtMainWindow.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtMainWindow.h | 1 | ||||
-rw-r--r-- | Swift/QtUI/QtRosterHeader.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtRosterHeader.h | 1 | ||||
-rw-r--r-- | Swift/QtUI/QtStatusWidget.cpp | 22 | ||||
-rw-r--r-- | Swift/QtUI/QtStatusWidget.h | 4 |
6 files changed, 35 insertions, 1 deletions
diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp index 4b3fa9e..7d471db 100644 --- a/Swift/QtUI/QtMainWindow.cpp +++ b/Swift/QtUI/QtMainWindow.cpp @@ -162,5 +162,9 @@ void QtMainWindow::setMyStatusType(StatusShow::Type type) { meView_->setStatusType(type); } +void QtMainWindow::setConnecting() { + meView_->setConnecting(); +} + } diff --git a/Swift/QtUI/QtMainWindow.h b/Swift/QtUI/QtMainWindow.h index ac325bd..c92c62a 100644 --- a/Swift/QtUI/QtMainWindow.h +++ b/Swift/QtUI/QtMainWindow.h @@ -42,6 +42,7 @@ namespace Swift { void setMyAvatarPath(const String& path); void setMyStatusText(const String& status); void setMyStatusType(StatusShow::Type type); + void setConnecting(); QtEventWindow* getEventWindow(); QtChatListWindow* getChatListWindow(); void setRosterModel(Roster* roster); diff --git a/Swift/QtUI/QtRosterHeader.cpp b/Swift/QtUI/QtRosterHeader.cpp index 0270a5e..e6b5f1b 100644 --- a/Swift/QtUI/QtRosterHeader.cpp +++ b/Swift/QtUI/QtRosterHeader.cpp @@ -91,6 +91,10 @@ void QtRosterHeader::setStatusType(StatusShow::Type type) { statusWidget_->setStatusType(type); } +void QtRosterHeader::setConnecting() { + statusWidget_->setConnecting(); +} + void QtRosterHeader::setName(const QString& name) { name_ = name; QString escapedName = name_; diff --git a/Swift/QtUI/QtRosterHeader.h b/Swift/QtUI/QtRosterHeader.h index d4948cb..6330200 100644 --- a/Swift/QtUI/QtRosterHeader.h +++ b/Swift/QtUI/QtRosterHeader.h @@ -31,6 +31,7 @@ namespace Swift { void setName(const QString& name); void setStatusText(const QString& statusMessage); void setStatusType(StatusShow::Type type); + void setConnecting(); signals: void onChangeStatusRequest(StatusShow::Type showType, const QString &statusMessage); private slots: diff --git a/Swift/QtUI/QtStatusWidget.cpp b/Swift/QtUI/QtStatusWidget.cpp index 769f010..6971b33 100644 --- a/Swift/QtUI/QtStatusWidget.cpp +++ b/Swift/QtUI/QtStatusWidget.cpp @@ -17,6 +17,7 @@ #include <qdebug.h> #include <QListWidget> #include <QListWidgetItem> +#include <QMovie> #include "Swift/QtUI/QtElidingLabel.h" #include "Swift/QtUI/QtLineEdit.h" @@ -28,8 +29,11 @@ namespace Swift { QtStatusWidget::QtStatusWidget(QWidget *parent) : QWidget(parent), editCursor_(Qt::IBeamCursor), viewCursor_(Qt::PointingHandCursor) { isClicking_ = false; + connecting_ = false; setMaximumHeight(24); + connectingMovie_ = new QMovie(":/icons/throbber.gif"); + QHBoxLayout* mainLayout = new QHBoxLayout(this); mainLayout->setSpacing(0); mainLayout->setContentsMargins(0,0,0,0); @@ -97,6 +101,7 @@ QtStatusWidget::QtStatusWidget(QWidget *parent) : QWidget(parent), editCursor_(Q QtStatusWidget::~QtStatusWidget() { delete menu_; + delete connectingMovie_; } void QtStatusWidget::handleApplicationFocusChanged(QWidget* /*old*/, QWidget* /*now*/) { @@ -223,10 +228,15 @@ void QtStatusWidget::handleItemClicked(QListWidgetItem* item) { } void QtStatusWidget::setNewToolTip() { - statusTextLabel_->setToolTip(P2QSTRING(StatusShow::typeToFriendlyName(selectedStatusType_)) + ": " + statusTextLabel_->text()); + if (connecting_) { + statusTextLabel_->setToolTip("Connecting"); + } else { + statusTextLabel_->setToolTip(P2QSTRING(StatusShow::typeToFriendlyName(selectedStatusType_)) + ": " + statusTextLabel_->text()); + } } void QtStatusWidget::setStatusText(const QString& text) { + connectingMovie_->stop(); statusText_ = text; statusEdit_->setText(text); QString escapedText(text.isEmpty() ? NO_MESSAGE : text); @@ -236,12 +246,22 @@ void QtStatusWidget::setStatusText(const QString& text) { setNewToolTip(); } +void QtStatusWidget::setConnecting() { + connecting_ = true; + statusIcon_->setMovie(connectingMovie_); + connectingMovie_->start(); + setNewToolTip(); +} + void QtStatusWidget::setStatusType(StatusShow::Type type) { + connecting_ = false; selectedStatusType_ = icons_.contains(type) ? type : StatusShow::Online; statusIcon_->setPixmap(icons_[selectedStatusType_].pixmap(16, 16)); setNewToolTip(); } + + } diff --git a/Swift/QtUI/QtStatusWidget.h b/Swift/QtUI/QtStatusWidget.h index 2163d5a..dcff433 100644 --- a/Swift/QtUI/QtStatusWidget.h +++ b/Swift/QtUI/QtStatusWidget.h @@ -17,6 +17,7 @@ class QLabel; class QStackedWidget; class QListWidget; class QListWidgetItem; +class QMovie; namespace Swift { class QtLineEdit; @@ -28,6 +29,7 @@ namespace Swift { ~QtStatusWidget(); StatusShow::Type getSelectedStatusShow(); void setStatusType(StatusShow::Type type); + void setConnecting(); signals: void onChangeStatusRequest(StatusShow::Type showType, const QString& text); public slots: @@ -58,6 +60,8 @@ namespace Swift { QCursor editCursor_; QCursor viewCursor_; bool editing_; + QMovie* connectingMovie_; + bool connecting_; }; } |