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 @@
+
\ 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 @@
+ icons/ui/at-solid.svg
icons/ui/volume-off-indicator.png
icons/ui/volume-off-indicator@2x.png
icons/ui/black-bubble-speech.png
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, 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, 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, QWidget *parent)
return;
}
- emit highlightedNotifsRetrieved(std::move(res));
+ emit highlightedNotifsRetrieved(std::move(res), mentionsPos);
});
});
@@ -218,6 +218,8 @@ ChatPage::ChatPage(QSharedPointer 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
#include
#include
+#include
#include
#include
@@ -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 &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
#include
#include
+#include
#include
#include
#include
@@ -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_;