parent
7e2f835eec
commit
c8bfb02211
@ -77,6 +77,7 @@ signals:
|
|||||||
void showNotification(const QString &msg);
|
void showNotification(const QString &msg);
|
||||||
void showLoginPage(const QString &msg);
|
void showLoginPage(const QString &msg);
|
||||||
void showUserSettingsPage();
|
void showUserSettingsPage();
|
||||||
|
void showOverlayProgressBar();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showUnreadMessageNotification(int count);
|
void showUnreadMessageNotification(int count);
|
||||||
|
@ -40,6 +40,8 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void backButtonClicked();
|
void backButtonClicked();
|
||||||
|
void loggingIn();
|
||||||
|
void errorOccured();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
@ -59,7 +59,11 @@ private slots:
|
|||||||
void iconActivated(QSystemTrayIcon::ActivationReason reason);
|
void iconActivated(QSystemTrayIcon::ActivationReason reason);
|
||||||
|
|
||||||
//! Show the welcome page in the main window.
|
//! Show the welcome page in the main window.
|
||||||
void showWelcomePage() { pageStack_->setCurrentWidget(welcome_page_); }
|
void showWelcomePage()
|
||||||
|
{
|
||||||
|
removeOverlayProgressBar();
|
||||||
|
pageStack_->setCurrentWidget(welcome_page_);
|
||||||
|
}
|
||||||
|
|
||||||
//! Show the login page in the main window.
|
//! Show the login page in the main window.
|
||||||
void showLoginPage() { pageStack_->setCurrentWidget(login_page_); }
|
void showLoginPage() { pageStack_->setCurrentWidget(login_page_); }
|
||||||
@ -73,6 +77,7 @@ private slots:
|
|||||||
//! Show the chat page and start communicating with the given access token.
|
//! Show the chat page and start communicating with the given access token.
|
||||||
void showChatPage(QString user_id, QString home_server, QString token);
|
void showChatPage(QString user_id, QString home_server, QString token);
|
||||||
|
|
||||||
|
void showOverlayProgressBar();
|
||||||
void removeOverlayProgressBar();
|
void removeOverlayProgressBar();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -141,8 +141,11 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
|
|||||||
typingRefresher_ = new QTimer(this);
|
typingRefresher_ = new QTimer(this);
|
||||||
typingRefresher_->setInterval(TYPING_REFRESH_TIMEOUT);
|
typingRefresher_->setInterval(TYPING_REFRESH_TIMEOUT);
|
||||||
|
|
||||||
connect(user_info_widget_, SIGNAL(logout()), client_.data(), SLOT(logout()));
|
connect(user_info_widget_, &UserInfoWidget::logout, this, [=]() {
|
||||||
connect(client_.data(), SIGNAL(loggedOut()), this, SLOT(logout()));
|
client_->logout();
|
||||||
|
emit showOverlayProgressBar();
|
||||||
|
});
|
||||||
|
connect(client_.data(), &MatrixClient::loggedOut, this, &ChatPage::logout);
|
||||||
|
|
||||||
connect(top_bar_, &TopRoomBar::inviteUsers, this, [=](QStringList users) {
|
connect(top_bar_, &TopRoomBar::inviteUsers, this, [=](QStringList users) {
|
||||||
for (int ii = 0; ii < users.size(); ++ii) {
|
for (int ii = 0; ii < users.size(); ++ii) {
|
||||||
|
@ -141,6 +141,7 @@ LoginPage::LoginPage(QSharedPointer<MatrixClient> client, QWidget *parent)
|
|||||||
connect(password_input_, SIGNAL(returnPressed()), login_button_, SLOT(click()));
|
connect(password_input_, SIGNAL(returnPressed()), login_button_, SLOT(click()));
|
||||||
connect(serverInput_, SIGNAL(returnPressed()), login_button_, SLOT(click()));
|
connect(serverInput_, SIGNAL(returnPressed()), login_button_, SLOT(click()));
|
||||||
connect(client_.data(), SIGNAL(loginError(QString)), this, SLOT(loginError(QString)));
|
connect(client_.data(), SIGNAL(loginError(QString)), this, SLOT(loginError(QString)));
|
||||||
|
connect(client_.data(), SIGNAL(loginError(QString)), this, SIGNAL(errorOccured()));
|
||||||
connect(matrixid_input_, SIGNAL(editingFinished()), this, SLOT(onMatrixIdEntered()));
|
connect(matrixid_input_, SIGNAL(editingFinished()), this, SLOT(onMatrixIdEntered()));
|
||||||
connect(client_.data(), SIGNAL(versionError(QString)), this, SLOT(versionError(QString)));
|
connect(client_.data(), SIGNAL(versionError(QString)), this, SLOT(versionError(QString)));
|
||||||
connect(client_.data(), SIGNAL(versionSuccess()), this, SLOT(versionSuccess()));
|
connect(client_.data(), SIGNAL(versionSuccess()), this, SLOT(versionSuccess()));
|
||||||
@ -262,6 +263,7 @@ LoginPage::onLoginButtonClicked()
|
|||||||
QString password = password_input_->text();
|
QString password = password_input_->text();
|
||||||
client_->setServer(serverInput_->text());
|
client_->setServer(serverInput_->text());
|
||||||
client_->login(user, password);
|
client_->login(user, password);
|
||||||
|
emit loggingIn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,9 +76,13 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
connect(welcome_page_, SIGNAL(userRegister()), this, SLOT(showRegisterPage()));
|
connect(welcome_page_, SIGNAL(userRegister()), this, SLOT(showRegisterPage()));
|
||||||
|
|
||||||
connect(login_page_, SIGNAL(backButtonClicked()), this, SLOT(showWelcomePage()));
|
connect(login_page_, SIGNAL(backButtonClicked()), this, SLOT(showWelcomePage()));
|
||||||
|
connect(login_page_, &LoginPage::loggingIn, this, &MainWindow::showOverlayProgressBar);
|
||||||
|
connect(login_page_, &LoginPage::errorOccured, this, [=]() { removeOverlayProgressBar(); });
|
||||||
connect(register_page_, SIGNAL(backButtonClicked()), this, SLOT(showWelcomePage()));
|
connect(register_page_, SIGNAL(backButtonClicked()), this, SLOT(showWelcomePage()));
|
||||||
|
|
||||||
connect(chat_page_, SIGNAL(close()), this, SLOT(showWelcomePage()));
|
connect(chat_page_, SIGNAL(close()), this, SLOT(showWelcomePage()));
|
||||||
|
connect(
|
||||||
|
chat_page_, &ChatPage::showOverlayProgressBar, this, &MainWindow::showOverlayProgressBar);
|
||||||
connect(
|
connect(
|
||||||
chat_page_, SIGNAL(changeWindowTitle(QString)), this, SLOT(setWindowTitle(QString)));
|
chat_page_, SIGNAL(changeWindowTitle(QString)), this, SLOT(setWindowTitle(QString)));
|
||||||
connect(chat_page_, SIGNAL(unreadMessages(int)), trayIcon_, SLOT(setUnreadCount(int)));
|
connect(chat_page_, SIGNAL(unreadMessages(int)), trayIcon_, SLOT(setUnreadCount(int)));
|
||||||
@ -191,32 +195,9 @@ MainWindow::showChatPage(QString userid, QString homeserver, QString token)
|
|||||||
settings.setValue("auth/home_server", homeserver);
|
settings.setValue("auth/home_server", homeserver);
|
||||||
settings.setValue("auth/user_id", userid);
|
settings.setValue("auth/user_id", userid);
|
||||||
|
|
||||||
int modalOpacityDuration = 300;
|
showOverlayProgressBar();
|
||||||
|
|
||||||
// If we go directly from the welcome page don't show an animation.
|
QTimer::singleShot(100, this, [=]() { pageStack_->setCurrentWidget(chat_page_); });
|
||||||
if (pageStack_->currentIndex() == 0)
|
|
||||||
modalOpacityDuration = 0;
|
|
||||||
|
|
||||||
QTimer::singleShot(
|
|
||||||
modalOpacityDuration + 100, this, [=]() { pageStack_->setCurrentWidget(chat_page_); });
|
|
||||||
|
|
||||||
if (spinner_.isNull()) {
|
|
||||||
spinner_ = QSharedPointer<LoadingIndicator>(
|
|
||||||
new LoadingIndicator(this),
|
|
||||||
[=](LoadingIndicator *indicator) { indicator->deleteLater(); });
|
|
||||||
spinner_->setFixedHeight(100);
|
|
||||||
spinner_->setFixedWidth(100);
|
|
||||||
spinner_->setObjectName("ChatPageLoadSpinner");
|
|
||||||
spinner_->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (progressModal_.isNull()) {
|
|
||||||
progressModal_ =
|
|
||||||
QSharedPointer<OverlayModal>(new OverlayModal(this, spinner_.data()),
|
|
||||||
[=](OverlayModal *modal) { modal->deleteLater(); });
|
|
||||||
progressModal_->setDismissible(false);
|
|
||||||
progressModal_->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
login_page_->reset();
|
login_page_->reset();
|
||||||
chat_page_->bootstrap(userid, homeserver, token);
|
chat_page_->bootstrap(userid, homeserver, token);
|
||||||
@ -282,3 +263,25 @@ MainWindow::openLeaveRoomDialog(const QString &room_id)
|
|||||||
|
|
||||||
leaveRoomModal_->show();
|
leaveRoomModal_->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MainWindow::showOverlayProgressBar()
|
||||||
|
{
|
||||||
|
if (spinner_.isNull()) {
|
||||||
|
spinner_ = QSharedPointer<LoadingIndicator>(
|
||||||
|
new LoadingIndicator(this),
|
||||||
|
[=](LoadingIndicator *indicator) { indicator->deleteLater(); });
|
||||||
|
spinner_->setFixedHeight(100);
|
||||||
|
spinner_->setFixedWidth(100);
|
||||||
|
spinner_->setObjectName("ChatPageLoadSpinner");
|
||||||
|
spinner_->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (progressModal_.isNull()) {
|
||||||
|
progressModal_ =
|
||||||
|
QSharedPointer<OverlayModal>(new OverlayModal(this, spinner_.data()),
|
||||||
|
[=](OverlayModal *modal) { modal->deleteLater(); });
|
||||||
|
progressModal_->setDismissible(false);
|
||||||
|
progressModal_->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user