aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-11-04 15:42:28 +0100
committerdec05eba <dec05eba@protonmail.com>2020-11-04 15:42:28 +0100
commitcc239ab9636e168ef92aa7f5ab0a515fadd02158 (patch)
tree9f5974e6dddc6e34bb4a94813ab61f5de3b64e3c
parente9d9e355f23f306198b0c49d9d24892514a1b2a5 (diff)
Show loading animation for initial login
-rw-r--r--include/QuickMedia.hpp1
-rw-r--r--src/QuickMedia.cpp12
2 files changed, 13 insertions, 0 deletions
diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp
index 0d4b384..90e24bc 100644
--- a/include/QuickMedia.hpp
+++ b/include/QuickMedia.hpp
@@ -107,6 +107,7 @@ namespace QuickMedia {
Display *disp;
sf::RenderWindow window;
Matrix *matrix = nullptr;
+ bool is_login_sync = false;
int monitor_hz;
sf::Vector2f window_size;
const char *plugin_name = nullptr;
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 373970a..ff1769b 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1365,6 +1365,11 @@ namespace QuickMedia {
}
if(matrix && !matrix->is_initial_sync_finished()) {
+ if(is_login_sync) {
+ load_sprite.setPosition(body_pos.x + body_size.x * 0.5f, body_pos.y + body_size.y * 0.5f);
+ load_sprite.setRotation(load_sprite_timer.getElapsedTime().asSeconds() * 400.0);
+ window.draw(load_sprite);
+ }
std::string err_msg;
if(matrix->did_initial_sync_fail(err_msg)) {
show_notification("QuickMedia", "Initial matrix sync failed, error: " + err_msg, Urgency::CRITICAL);
@@ -3005,6 +3010,8 @@ namespace QuickMedia {
window.draw(status_text);
window.display();
}
+
+ is_login_sync = true;
}
struct ChatTab {
@@ -4235,6 +4242,11 @@ namespace QuickMedia {
}
if(matrix && !matrix->is_initial_sync_finished()) {
+ if(is_login_sync) {
+ load_sprite.setPosition(body_pos.x + body_size.x * 0.5f, body_pos.y + body_size.y * 0.5f);
+ load_sprite.setRotation(load_sprite_timer.getElapsedTime().asSeconds() * 400.0);
+ window.draw(load_sprite);
+ }
std::string err_msg;
if(matrix->did_initial_sync_fail(err_msg)) {
show_notification("QuickMedia", "Initial matrix sync failed, error: " + err_msg, Urgency::CRITICAL);