aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-11-16 13:32:49 +0100
committerdec05eba <dec05eba@protonmail.com>2020-11-16 13:32:49 +0100
commite68ff632e2f54c705ae1d69033e58a8f2d1ca00c (patch)
tree24f6d1b220767dd393b7ee62b9267ac958d521a2 /include
parentf9608af936c39c57633129a62472d315aef62d9c (diff)
Matrix: show provisional messages as the message is being sent and received
Diffstat (limited to 'include')
-rw-r--r--include/Body.hpp2
-rw-r--r--include/MessageQueue.hpp9
2 files changed, 11 insertions, 0 deletions
diff --git a/include/Body.hpp b/include/Body.hpp
index f4742bc..236a02d 100644
--- a/include/Body.hpp
+++ b/include/Body.hpp
@@ -207,6 +207,8 @@ namespace QuickMedia {
float get_page_scroll() const { return page_scroll; }
bool is_last_item_fully_visible() const { return last_item_fully_visible; }
+ bool is_body_full_with_items() const { return items_cut_off; }
+
sf::Text progress_text;
sf::Text replies_text;
sf::Text embedded_item_load_text;
diff --git a/include/MessageQueue.hpp b/include/MessageQueue.hpp
index 4f1e036..7c34d51 100644
--- a/include/MessageQueue.hpp
+++ b/include/MessageQueue.hpp
@@ -31,6 +31,15 @@ namespace QuickMedia {
return data;
}
+ std::optional<T> pop_if_available() {
+ std::unique_lock<std::mutex> lock(mutex);
+ if(data_queue.empty())
+ return std::nullopt;
+ T data = std::move(data_queue.front());
+ data_queue.pop_front();
+ return data;
+ }
+
void close() {
std::unique_lock<std::mutex> lock(mutex);
running = false;