summary refs log tree commit diff
path: root/src/popups
diff options
context:
space:
mode:
authorJoseph Donofry <joedonofry@gmail.com>2019-08-19 18:11:38 -0400
committerJoseph Donofry <joedonofry@gmail.com>2019-08-19 18:11:38 -0400
commitbcdd97c85fb3b2aeb0cd46c05562f880792737aa (patch)
treee4fb62482c5b93b6b7a6b0ed667620dada71dea0 /src/popups
parentFix issues with caching and loading of mentions. (diff)
downloadnheko-bcdd97c85fb3b2aeb0cd46c05562f880792737aa.tar.xz
More updates to mentions functionality
Diffstat (limited to 'src/popups')
-rw-r--r--src/popups/UserMentions.cpp18
-rw-r--r--src/popups/UserMentions.h7
2 files changed, 16 insertions, 9 deletions
diff --git a/src/popups/UserMentions.cpp b/src/popups/UserMentions.cpp

index 267540cc..152cd82d 100644 --- a/src/popups/UserMentions.cpp +++ b/src/popups/UserMentions.cpp
@@ -3,6 +3,7 @@ #include "Cache.h" #include "ChatPage.h" +#include "Logging.h" #include "UserMentions.h" #include "timeline/TimelineItem.h" @@ -12,7 +13,7 @@ UserMentions::UserMentions(QWidget *parent) : QWidget{parent} { setAttribute(Qt::WA_ShowWithoutActivating, true); - setWindowFlags(Qt::ToolTip | Qt::NoDropShadowWindowHint); + setWindowFlags(Qt::FramelessWindowHint | Qt::Popup); tab_layout_ = new QTabWidget(this); @@ -66,12 +67,7 @@ void UserMentions::initializeMentions(const QMap<QString, mtx::responses::Notifications> &notifs) { nhlog::ui()->debug("Initializing " + std::to_string(notifs.size()) + " notifications."); - for (auto widget : all_scroll_layout_->findChildren<QWidget *>()) { - delete widget; - } - for (auto widget : local_scroll_layout_->findChildren<QWidget *>()) { - delete widget; - } + for (const auto &item : notifs) { for (const auto notif : item.notifications) { const auto event_id = QString::fromStdString(utils::event_id(notif.event)); @@ -98,10 +94,16 @@ UserMentions::initializeMentions(const QMap<QString, mtx::responses::Notificatio void UserMentions::showPopup() { + for (auto widget : all_scroll_layout_->findChildren<QWidget *>()) { + delete widget; + } + for (auto widget : local_scroll_layout_->findChildren<QWidget *>()) { + delete widget; + } + auto notifs = cache::client()->getTimelineMentions(); initializeMentions(notifs); - show(); } diff --git a/src/popups/UserMentions.h b/src/popups/UserMentions.h
index 0029eedd..a74bf2ec 100644 --- a/src/popups/UserMentions.h +++ b/src/popups/UserMentions.h
@@ -2,6 +2,8 @@ #include <mtx/responses.hpp> +#include <QApplication> +#include <QEvent> #include <QMap> #include <QScrollArea> #include <QScrollBar> @@ -9,6 +11,9 @@ #include <QTabWidget> #include <QVBoxLayout> #include <QWidget> +#include <Qt> + +#include "Logging.h" namespace popups { @@ -18,8 +23,8 @@ class UserMentions : public QWidget public: UserMentions(QWidget *parent = nullptr); - void showPopup(); void initializeMentions(const QMap<QString, mtx::responses::Notifications> &notifs); + void showPopup(); private: void pushItem(const QString &event_id,