summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--resources/icons/ui/at-solid.svg1
-rw-r--r--resources/res.qrc1
-rw-r--r--src/ChatPage.cpp20
-rw-r--r--src/ChatPage.h5
-rw-r--r--src/TopRoomBar.cpp16
-rw-r--r--src/TopRoomBar.h3
6 files changed, 36 insertions, 10 deletions
diff --git a/resources/icons/ui/at-solid.svg b/resources/icons/ui/at-solid.svg
new file mode 100644
index 00000000..8b72d6f8
--- /dev/null
+++ b/resources/icons/ui/at-solid.svg
@@ -0,0 +1 @@
+<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="at" class="svg-inline--fa fa-at fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 8C118.941 8 8 118.919 8 256c0 137.059 110.919 248 248 248 48.154 0 95.342-14.14 135.408-40.223 12.005-7.815 14.625-24.288 5.552-35.372l-10.177-12.433c-7.671-9.371-21.179-11.667-31.373-5.129C325.92 429.757 291.314 440 256 440c-101.458 0-184-82.542-184-184S154.542 72 256 72c100.139 0 184 57.619 184 160 0 38.786-21.093 79.742-58.17 83.693-17.349-.454-16.91-12.857-13.476-30.024l23.433-121.11C394.653 149.75 383.308 136 368.225 136h-44.981a13.518 13.518 0 0 0-13.432 11.993l-.01.092c-14.697-17.901-40.448-21.775-59.971-21.775-74.58 0-137.831 62.234-137.831 151.46 0 65.303 36.785 105.87 96 105.87 26.984 0 57.369-15.637 74.991-38.333 9.522 34.104 40.613 34.103 70.71 34.103C462.609 379.41 504 307.798 504 232 504 95.653 394.023 8 256 8zm-21.68 304.43c-22.249 0-36.07-15.623-36.07-40.771 0-44.993 30.779-72.729 58.63-72.729 22.292 0 35.601 15.241 35.601 40.77 0 45.061-33.875 72.73-58.161 72.73z"></path></svg>
\ No newline at end of file
diff --git a/resources/res.qrc b/resources/res.qrc
index 6930909e..ad27af5a 100644
--- a/resources/res.qrc
+++ b/resources/res.qrc
@@ -1,5 +1,6 @@
 <RCC>
     <qresource prefix="/icons">
+        <file>icons/ui/at-solid.svg</file>
         <file>icons/ui/volume-off-indicator.png</file>
         <file>icons/ui/volume-off-indicator@2x.png</file>
         <file>icons/ui/black-bubble-speech.png</file>
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp
index 435d50c8..deefec14 100644
--- a/src/ChatPage.cpp
+++ b/src/ChatPage.cpp
@@ -91,12 +91,12 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
         connect(sidebarActions_, &SideBarActions::createRoom, this, &ChatPage::createRoom);
 
         user_info_widget_     = new UserInfoWidget(sideBar_);
-        user_mentions_widget_ = new UserMentionsWidget(sideBar_);
+        //user_mentions_widget_ = new UserMentionsWidget(sideBar_);
         room_list_            = new RoomList(sideBar_);
         connect(room_list_, &RoomList::joinRoom, this, &ChatPage::joinRoom);
 
         sideBarLayout_->addWidget(user_info_widget_);
-        sideBarLayout_->addWidget(user_mentions_widget_);
+        //sideBarLayout_->addWidget(user_mentions_widget_);
         sideBarLayout_->addWidget(room_list_);
         sideBarLayout_->addWidget(sidebarActions_);
 
@@ -154,12 +154,12 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
                 trySync();
         });
 
-        connect(user_mentions_widget_, &UserMentionsWidget::clicked, this, [this]() {
+        connect(top_bar_, &TopRoomBar::mentionsClicked, this, [this](const QPoint &mentionsPos) {
                 http::client()->notifications(
                   1000,
                   "",
                   "highlight",
-                  [this](const mtx::responses::Notifications &res, mtx::http::RequestErr err) {
+                  [this, mentionsPos](const mtx::responses::Notifications &res, mtx::http::RequestErr err) {
                           if (err) {
                                   nhlog::net()->warn("failed to retrieve notifications: {} ({})",
                                                      err->matrix_error.error,
@@ -167,7 +167,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
                                   return;
                           }
 
-                          emit highlightedNotifsRetrieved(std::move(res));
+                          emit highlightedNotifsRetrieved(std::move(res), mentionsPos);
                   });
         });
 
@@ -218,6 +218,8 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
                 }
         });
 
+
+
         connect(room_list_, &RoomList::roomChanged, this, [this](const QString &roomid) {
                 QStringList users;
 
@@ -986,7 +988,7 @@ ChatPage::sendDesktopNotifications(const mtx::responses::Notifications &res)
 }
 
 void
-ChatPage::showNotificationsDialog(const mtx::responses::Notifications &res)
+ChatPage::showNotificationsDialog(const mtx::responses::Notifications &res, const QPoint &widgetPos)
 {
         // TODO: This should NOT BE A DIALOG.  Make the TimelineView support
         // creating a timeline view from notifications (similarly to how it can show history views)
@@ -1005,8 +1007,10 @@ ChatPage::showNotificationsDialog(const mtx::responses::Notifications &res)
                         nhlog::db()->warn("error while sending desktop notification: {}", e.what());
                 }
         }
-        notifDialog->setFixedWidth(width());
-        notifDialog->setFixedHeight(height());
+        notifDialog->setGeometry(widgetPos.x() - (width() / 10), widgetPos.y() + 25, width() / 5, height() / 2); 
+        //notifDialog->move(widgetPos.x(), widgetPos.y());
+        //notifDialog->setFixedWidth(width() / 10);
+        //notifDialog->setFixedHeight(height() / 2);
         notifDialog->raise();
         notifDialog->show();
 }
diff --git a/src/ChatPage.h b/src/ChatPage.h
index 06fae57c..b2f04b02 100644
--- a/src/ChatPage.h
+++ b/src/ChatPage.h
@@ -24,6 +24,7 @@
 #include <QHBoxLayout>
 #include <QMap>
 #include <QPixmap>
+#include <QPoint>
 #include <QTimer>
 #include <QWidget>
 
@@ -88,7 +89,7 @@ signals:
         void messageReply(const RelatedInfo &related);
 
         void notificationsRetrieved(const mtx::responses::Notifications &);
-        void highlightedNotifsRetrieved(const mtx::responses::Notifications &);
+        void highlightedNotifsRetrieved(const mtx::responses::Notifications &, const QPoint widgetPos);
 
         void uploadFailed(const QString &msg);
         void imageUploaded(const QString &roomid,
@@ -206,7 +207,7 @@ private:
         //! Send desktop notification for the received messages.
         void sendDesktopNotifications(const mtx::responses::Notifications &);
 
-        void showNotificationsDialog(const mtx::responses::Notifications &);
+        void showNotificationsDialog(const mtx::responses::Notifications &, const QPoint &point);
 
         QStringList generateTypingUsers(const QString &room_id,
                                         const std::vector<std::string> &typing_users);
diff --git a/src/TopRoomBar.cpp b/src/TopRoomBar.cpp
index 5c817dc2..a8049e3a 100644
--- a/src/TopRoomBar.cpp
+++ b/src/TopRoomBar.cpp
@@ -80,11 +80,21 @@ TopRoomBar::TopRoomBar(QWidget *parent)
         settingsBtn_->setFixedSize(buttonSize_, buttonSize_);
         settingsBtn_->setCornerRadius(buttonSize_ / 2);
 
+        mentionsBtn_ = new FlatButton(this);
+        mentionsBtn_->setToolTip(tr("Mentions"));
+        mentionsBtn_->setFixedSize(buttonSize_, buttonSize_);
+        mentionsBtn_->setCornerRadius(buttonSize_ / 2);
+
         QIcon settings_icon;
         settings_icon.addFile(":/icons/icons/ui/vertical-ellipsis.png");
         settingsBtn_->setIcon(settings_icon);
         settingsBtn_->setIconSize(QSize(buttonSize_ / 2, buttonSize_ / 2));
 
+        QIcon mentions_icon;
+        mentions_icon.addFile(":/icons/icons/ui/at-solid.svg");
+        mentionsBtn_->setIcon(mentions_icon);
+        mentionsBtn_->setIconSize(QSize(buttonSize_ / 2, buttonSize_ / 2));
+
         backBtn_ = new FlatButton(this);
         backBtn_->setFixedSize(buttonSize_, buttonSize_);
         backBtn_->setCornerRadius(buttonSize_ / 2);
@@ -100,6 +110,7 @@ TopRoomBar::TopRoomBar(QWidget *parent)
         topLayout_->addWidget(avatar_);
         topLayout_->addWidget(backBtn_);
         topLayout_->addLayout(textLayout_, 1);
+        topLayout_->addWidget(mentionsBtn_, 0, Qt::AlignRight);
         topLayout_->addWidget(settingsBtn_, 0, Qt::AlignRight);
 
         menu_ = new Menu(this);
@@ -135,6 +146,11 @@ TopRoomBar::TopRoomBar(QWidget *parent)
                 menu_->popup(
                   QPoint(pos.x() + buttonSize_ - menu_->sizeHint().width(), pos.y() + buttonSize_));
         });
+
+        connect(mentionsBtn_, &QPushButton::clicked, this, [this]() {
+                auto pos = mapToGlobal(mentionsBtn_->pos());
+                emit mentionsClicked(pos);
+        });
 }
 
 void
diff --git a/src/TopRoomBar.h b/src/TopRoomBar.h
index 5b7d3344..5f2c936e 100644
--- a/src/TopRoomBar.h
+++ b/src/TopRoomBar.h
@@ -24,6 +24,7 @@
 #include <QPaintEvent>
 #include <QPainter>
 #include <QPen>
+#include <QPoint>
 #include <QStyle>
 #include <QStyleOption>
 #include <QVBoxLayout>
@@ -63,6 +64,7 @@ public slots:
 signals:
         void inviteUsers(QStringList users);
         void showRoomList();
+        void mentionsClicked(const QPoint &pos);
 
 protected:
         void mousePressEvent(QMouseEvent *) override
@@ -93,6 +95,7 @@ private:
         QAction *inviteUsers_  = nullptr;
 
         FlatButton *settingsBtn_;
+        FlatButton *mentionsBtn_;
         FlatButton *backBtn_;
 
         Avatar *avatar_;