summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/MainController.cpp3
-rw-r--r--Swift/Controllers/UIInterfaces/MainWindow.h1
-rw-r--r--Swift/Controllers/UnitTest/MockMainWindow.h1
-rw-r--r--Swift/QtUI/QtMainWindow.cpp4
-rw-r--r--Swift/QtUI/QtMainWindow.h1
-rw-r--r--Swift/QtUI/QtRosterHeader.cpp4
-rw-r--r--Swift/QtUI/QtRosterHeader.h1
-rw-r--r--Swift/QtUI/QtStatusWidget.cpp22
-rw-r--r--Swift/QtUI/QtStatusWidget.h4
9 files changed, 40 insertions, 1 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index fcd161b..26d29e7 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -425,6 +425,9 @@ void MainController::performLoginFromCachedCredentials() {
/* In case we're in the middle of another login, make sure they don't overlap */
client_->disconnect();
}
+ if (rosterController_) {
+ rosterController_->getWindow()->setConnecting();
+ }
/* If we logged in with a bare JID, and we have a full bound JID, re-login with the
* bound JID to try and keep dynamically assigned resources */
if (boundJID_.isValid() && jid_.isBare() && boundJID_.toBare() == jid_) {
diff --git a/Swift/Controllers/UIInterfaces/MainWindow.h b/Swift/Controllers/UIInterfaces/MainWindow.h
index 570c919..26b4ae8 100644
--- a/Swift/Controllers/UIInterfaces/MainWindow.h
+++ b/Swift/Controllers/UIInterfaces/MainWindow.h
@@ -30,6 +30,7 @@ namespace Swift {
virtual void setMyStatusText(const String& status) = 0;
virtual void setMyStatusType(StatusShow::Type type) = 0;
virtual void setRosterModel(Roster* roster) = 0;
+ virtual void setConnecting() = 0;
boost::signal<void (StatusShow::Type, const String&)> onChangeStatusRequest;
boost::signal<void (bool)> onShowOfflineToggled;
diff --git a/Swift/Controllers/UnitTest/MockMainWindow.h b/Swift/Controllers/UnitTest/MockMainWindow.h
index 4d0c67a..3d786d9 100644
--- a/Swift/Controllers/UnitTest/MockMainWindow.h
+++ b/Swift/Controllers/UnitTest/MockMainWindow.h
@@ -19,6 +19,7 @@ namespace Swift {
virtual void setMyAvatarPath(const String& /*path*/) {};
virtual void setMyStatusText(const String& /*status*/) {};
virtual void setMyStatusType(StatusShow::Type /*type*/) {};
+ virtual void setConnecting() {};
Roster* roster;
};
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_;
};
}