summary refs log tree commit diff
path: root/src/ChatPage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ChatPage.cpp')
-rw-r--r--src/ChatPage.cpp50
1 files changed, 7 insertions, 43 deletions
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp
index 71ea0649..8f3c37a4 100644
--- a/src/ChatPage.cpp
+++ b/src/ChatPage.cpp
@@ -835,31 +835,15 @@ ChatPage::loadStateFromCache()
 void
 ChatPage::showQuickSwitcher()
 {
-        if (quickSwitcher_.isNull()) {
-                quickSwitcher_ = QSharedPointer<QuickSwitcher>(
-                  new QuickSwitcher(this),
-                  [](QuickSwitcher *switcher) { switcher->deleteLater(); });
-
-                connect(quickSwitcher_.data(),
-                        &QuickSwitcher::roomSelected,
-                        room_list_,
-                        &RoomList::highlightSelectedRoom);
-
-                connect(quickSwitcher_.data(), &QuickSwitcher::closing, this, [this]() {
-                        if (!quickSwitcherModal_.isNull())
-                                quickSwitcherModal_->hide();
-                        text_input_->setFocus(Qt::FocusReason::PopupFocusReason);
-                });
-        }
+        auto dialog = new QuickSwitcher(this);
 
-        if (quickSwitcherModal_.isNull()) {
-                quickSwitcherModal_ = QSharedPointer<OverlayModal>(
-                  new OverlayModal(MainWindow::instance(), quickSwitcher_.data()),
-                  [](OverlayModal *modal) { modal->deleteLater(); });
-                quickSwitcherModal_->setColor(QColor(30, 30, 30, 170));
-        }
+        connect(dialog, &QuickSwitcher::roomSelected, room_list_, &RoomList::highlightSelectedRoom);
+        connect(dialog, &QuickSwitcher::closing, this, [this]() {
+                MainWindow::instance()->hideOverlay();
+                text_input_->setFocus(Qt::FocusReason::PopupFocusReason);
+        });
 
-        quickSwitcherModal_->show();
+        MainWindow::instance()->showTransparentOverlayModal(dialog);
 }
 
 void
@@ -918,26 +902,6 @@ ChatPage::removeLeftRooms(const std::map<std::string, mtx::responses::LeftRoom>
 }
 
 void
-ChatPage::showReadReceipts(const QString &event_id)
-{
-        if (receiptsDialog_.isNull()) {
-                receiptsDialog_ = QSharedPointer<dialogs::ReadReceipts>(
-                  new dialogs::ReadReceipts(this),
-                  [](dialogs::ReadReceipts *dialog) { dialog->deleteLater(); });
-        }
-
-        if (receiptsModal_.isNull()) {
-                receiptsModal_ = QSharedPointer<OverlayModal>(
-                  new OverlayModal(MainWindow::instance(), receiptsDialog_.data()),
-                  [](OverlayModal *modal) { modal->deleteLater(); });
-                receiptsModal_->setColor(QColor(30, 30, 30, 170));
-        }
-
-        receiptsDialog_->addUsers(cache::client()->readReceipts(event_id, current_room_));
-        receiptsModal_->show();
-}
-
-void
 ChatPage::setGroupViewState(bool isEnabled)
 {
         if (!isEnabled) {