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( - new QuickSwitcher(this), - [](QuickSwitcher *switcher) { switcher->deleteLater(); }); + auto dialog = new QuickSwitcher(this); - connect(quickSwitcher_.data(), - &QuickSwitcher::roomSelected, - room_list_, - &RoomList::highlightSelectedRoom); + connect(dialog, &QuickSwitcher::roomSelected, room_list_, &RoomList::highlightSelectedRoom); + connect(dialog, &QuickSwitcher::closing, this, [this]() { + MainWindow::instance()->hideOverlay(); + text_input_->setFocus(Qt::FocusReason::PopupFocusReason); + }); - connect(quickSwitcher_.data(), &QuickSwitcher::closing, this, [this]() { - if (!quickSwitcherModal_.isNull()) - quickSwitcherModal_->hide(); - text_input_->setFocus(Qt::FocusReason::PopupFocusReason); - }); - } - - if (quickSwitcherModal_.isNull()) { - quickSwitcherModal_ = QSharedPointer( - new OverlayModal(MainWindow::instance(), quickSwitcher_.data()), - [](OverlayModal *modal) { modal->deleteLater(); }); - quickSwitcherModal_->setColor(QColor(30, 30, 30, 170)); - } - - quickSwitcherModal_->show(); + MainWindow::instance()->showTransparentOverlayModal(dialog); } void @@ -917,26 +901,6 @@ ChatPage::removeLeftRooms(const std::map } } -void -ChatPage::showReadReceipts(const QString &event_id) -{ - if (receiptsDialog_.isNull()) { - receiptsDialog_ = QSharedPointer( - new dialogs::ReadReceipts(this), - [](dialogs::ReadReceipts *dialog) { dialog->deleteLater(); }); - } - - if (receiptsModal_.isNull()) { - receiptsModal_ = QSharedPointer( - 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) { diff --git a/src/ChatPage.h b/src/ChatPage.h index f032901a..a74748ed 100644 --- a/src/ChatPage.h +++ b/src/ChatPage.h @@ -44,10 +44,6 @@ class UserInfoWidget; class UserSettings; class NotificationsManager; -namespace dialogs { -class ReadReceipts; -} - constexpr int CONSENSUS_TIMEOUT = 1000; constexpr int SHOW_CONTENT_TIMEOUT = 3000; constexpr int TYPING_REFRESH_TIMEOUT = 10000; @@ -62,7 +58,6 @@ public: // Initialize all the components of the UI. void bootstrap(QString userid, QString homeserver, QString token); void showQuickSwitcher(); - void showReadReceipts(const QString &event_id); QString currentRoom() const { return current_room_; } static ChatPage *instance() { return instance_; } @@ -237,12 +232,6 @@ private: std::map> typingUsers_; QTimer *typingRefresher_; - QSharedPointer quickSwitcher_; - QSharedPointer quickSwitcherModal_; - - QSharedPointer receiptsDialog_; - QSharedPointer receiptsModal_; - // Global user settings. QSharedPointer userSettings_; diff --git a/src/LoginPage.h b/src/LoginPage.h index cf2d024b..ff7ba629 100644 --- a/src/LoginPage.h +++ b/src/LoginPage.h @@ -19,7 +19,6 @@ #include #include -#include #include class FlatButton; diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 7cb12caa..b6216feb 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -42,18 +42,19 @@ #include "dialogs/LeaveRoom.h" #include "dialogs/Logout.h" #include "dialogs/MemberList.h" +#include "dialogs/ReadReceipts.h" #include "dialogs/RoomSettings.h" MainWindow *MainWindow::instance_ = nullptr; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) - , progressModal_{nullptr} - , spinner_{nullptr} { setWindowTitle("nheko"); setObjectName("MainWindow"); + modal_ = new OverlayModal(this); + restoreWindowSize(); QFont font("Open Sans"); @@ -223,26 +224,20 @@ MainWindow::removeOverlayProgressBar() connect(timer, &QTimer::timeout, [this, timer]() { timer->deleteLater(); - if (!progressModal_.isNull()) - progressModal_->hide(); + if (modal_) + modal_->hide(); - if (!spinner_.isNull()) + if (spinner_) spinner_->stop(); - - progressModal_.reset(); - spinner_.reset(); }); // FIXME: Snackbar doesn't work if it's initialized in the constructor. QTimer::singleShot(0, this, [this]() { - snackBar_ = QSharedPointer(new SnackBar(this)); - connect(chat_page_, - &ChatPage::showNotification, - snackBar_.data(), - &SnackBar::showMessage); + snackBar_ = new SnackBar(this); + connect(chat_page_, &ChatPage::showNotification, snackBar_, &SnackBar::showMessage); }); - timer->start(500); + timer->start(50); } void @@ -312,18 +307,10 @@ MainWindow::hasActiveUser() void MainWindow::openUserProfile(const QString &user_id, const QString &room_id) { - if (!userProfileDialog_) - userProfileDialog_ = - QSharedPointer(new dialogs::UserProfile(this)); + auto dialog = new dialogs::UserProfile(this); + dialog->init(user_id, room_id); - userProfileDialog_->init(user_id, room_id); - - if (!userProfileModal_) - userProfileModal_ = - QSharedPointer(new OverlayModal(this, userProfileDialog_.data())); - - userProfileModal_->setContentAlignment(Qt::AlignTop | Qt::AlignHCenter); - userProfileModal_->show(); + showTransparentOverlayModal(dialog); } void @@ -331,18 +318,13 @@ MainWindow::openRoomSettings(const QString &room_id) { const auto roomToSearch = room_id.isEmpty() ? chat_page_->currentRoom() : ""; - roomSettingsDialog_ = - QSharedPointer(new dialogs::RoomSettings(roomToSearch, this)); - - connect(roomSettingsDialog_.data(), &dialogs::RoomSettings::closing, this, [this]() { - roomSettingsModal_->hide(); + auto dialog = new dialogs::RoomSettings(roomToSearch, this); + connect(dialog, &dialogs::RoomSettings::closing, this, [this]() { + if (modal_) + modal_->hide(); }); - roomSettingsModal_ = - QSharedPointer(new OverlayModal(this, roomSettingsDialog_.data())); - - roomSettingsModal_->setContentAlignment(Qt::AlignTop | Qt::AlignHCenter); - roomSettingsModal_->show(); + showTransparentOverlayModal(dialog); } void @@ -350,13 +332,8 @@ MainWindow::openMemberListDialog(const QString &room_id) { const auto roomToSearch = room_id.isEmpty() ? chat_page_->currentRoom() : ""; - memberListDialog_ = - QSharedPointer(new dialogs::MemberList(roomToSearch, this)); - - memberListModal_ = - QSharedPointer(new OverlayModal(this, memberListDialog_.data())); - - memberListModal_->show(); + modal_->setWidget(new dialogs::MemberList(roomToSearch, this)); + modal_->show(); } void @@ -364,161 +341,146 @@ MainWindow::openLeaveRoomDialog(const QString &room_id) { auto roomToLeave = room_id.isEmpty() ? chat_page_->currentRoom() : room_id; - leaveRoomDialog_ = QSharedPointer(new dialogs::LeaveRoom(this)); + auto dialog = new dialogs::LeaveRoom(this); + connect(dialog, &dialogs::LeaveRoom::closing, this, [this, roomToLeave](bool leaving) { + if (modal_) + modal_->hide(); - connect(leaveRoomDialog_.data(), - &dialogs::LeaveRoom::closing, - this, - [this, roomToLeave](bool leaving) { - leaveRoomModal_->hide(); + if (leaving) + chat_page_->leaveRoom(roomToLeave); + }); - if (leaving) - chat_page_->leaveRoom(roomToLeave); - }); - - leaveRoomModal_ = - QSharedPointer(new OverlayModal(this, leaveRoomDialog_.data())); - leaveRoomModal_->setColor(QColor(30, 30, 30, 170)); - - leaveRoomModal_->show(); + showTransparentOverlayModal(dialog, Qt::AlignCenter); } void MainWindow::showOverlayProgressBar() { - if (spinner_.isNull()) { - spinner_ = QSharedPointer( - new LoadingIndicator(this), - [](LoadingIndicator *indicator) { indicator->deleteLater(); }); - spinner_->setFixedHeight(100); - spinner_->setFixedWidth(100); - spinner_->setObjectName("ChatPageLoadSpinner"); - spinner_->start(); - } + spinner_ = new LoadingIndicator(this); + spinner_->setFixedHeight(100); + spinner_->setFixedWidth(100); + spinner_->setObjectName("ChatPageLoadSpinner"); + spinner_->start(); - if (progressModal_.isNull()) { - progressModal_ = - QSharedPointer(new OverlayModal(this, spinner_.data()), - [](OverlayModal *modal) { modal->deleteLater(); }); - progressModal_->setColor(QColor(30, 30, 30)); - progressModal_->setDismissible(false); - progressModal_->show(); - } + showSolidOverlayModal(spinner_); } void MainWindow::openInviteUsersDialog(std::function callback) { - if (inviteUsersDialog_.isNull()) { - inviteUsersDialog_ = - QSharedPointer(new dialogs::InviteUsers(this)); + auto dialog = new dialogs::InviteUsers(this); + connect(dialog, + &dialogs::InviteUsers::closing, + this, + [this, callback](bool isSending, QStringList invitees) { + if (modal_) + modal_->hide(); + if (isSending && !invitees.isEmpty()) + callback(invitees); + }); - connect(inviteUsersDialog_.data(), - &dialogs::InviteUsers::closing, - this, - [this, callback](bool isSending, QStringList invitees) { - inviteUsersModal_->hide(); - - if (isSending && !invitees.isEmpty()) - callback(invitees); - }); - } - - if (inviteUsersModal_.isNull()) { - inviteUsersModal_ = QSharedPointer( - new OverlayModal(MainWindow::instance(), inviteUsersDialog_.data())); - inviteUsersModal_->setColor(QColor(30, 30, 30, 170)); - } - - inviteUsersModal_->show(); + showTransparentOverlayModal(dialog); } void MainWindow::openJoinRoomDialog(std::function callback) { - if (joinRoomDialog_.isNull()) { - joinRoomDialog_ = QSharedPointer(new dialogs::JoinRoom(this)); + auto dialog = new dialogs::JoinRoom(this); + connect(dialog, + &dialogs::JoinRoom::closing, + this, + [this, callback](bool isJoining, const QString &room) { + if (modal_) + modal_->hide(); - connect(joinRoomDialog_.data(), - &dialogs::JoinRoom::closing, - this, - [this, callback](bool isJoining, const QString &room) { - joinRoomModal_->hide(); + if (isJoining && !room.isEmpty()) + callback(room); + }); - if (isJoining && !room.isEmpty()) - callback(room); - }); - } - - if (joinRoomModal_.isNull()) { - joinRoomModal_ = QSharedPointer( - new OverlayModal(MainWindow::instance(), joinRoomDialog_.data())); - } - - joinRoomModal_->show(); + showTransparentOverlayModal(dialog, Qt::AlignCenter); } void MainWindow::openCreateRoomDialog( std::function callback) { - if (createRoomDialog_.isNull()) { - createRoomDialog_ = - QSharedPointer(new dialogs::CreateRoom(this)); + auto dialog = new dialogs::CreateRoom(this); + connect(dialog, + &dialogs::CreateRoom::closing, + this, + [this, callback](bool isCreating, const mtx::requests::CreateRoom &request) { + if (modal_) + modal_->hide(); - connect( - createRoomDialog_.data(), - &dialogs::CreateRoom::closing, - this, - [this, callback](bool isCreating, const mtx::requests::CreateRoom &request) { - createRoomModal_->hide(); + if (isCreating) + callback(request); + }); - if (isCreating) - callback(request); - }); - } + showTransparentOverlayModal(dialog); +} - if (createRoomModal_.isNull()) { - createRoomModal_ = QSharedPointer( - new OverlayModal(MainWindow::instance(), createRoomDialog_.data())); - } +void +MainWindow::showTransparentOverlayModal(QWidget *content, QFlags flags) +{ + modal_->setWidget(content); + modal_->setColor(QColor(30, 30, 30, 150)); + modal_->setDismissible(true); + modal_->setContentAlignment(flags); + modal_->raise(); + modal_->show(); +} - createRoomModal_->show(); +void +MainWindow::showSolidOverlayModal(QWidget *content, QFlags flags) +{ + modal_->setWidget(content); + modal_->setColor(QColor(30, 30, 30)); + modal_->setDismissible(false); + modal_->setContentAlignment(flags); + modal_->raise(); + modal_->show(); } void MainWindow::openLogoutDialog(std::function callback) { - if (logoutDialog_.isNull()) { - logoutDialog_ = QSharedPointer(new dialogs::Logout(this)); - connect(logoutDialog_.data(), - &dialogs::Logout::closing, - this, - [this, callback](bool logging_out) { - logoutModal_->hide(); + auto dialog = new dialogs::Logout(this); + connect(dialog, &dialogs::Logout::closing, this, [this, callback](bool logging_out) { + if (modal_) + modal_->hide(); - if (logging_out) - callback(); - }); + if (logging_out) + callback(); + }); + + showTransparentOverlayModal(dialog, Qt::AlignCenter); +} + +void +MainWindow::openReadReceiptsDialog(const QString &event_id) +{ + auto dialog = new dialogs::ReadReceipts(this); + + const auto room_id = chat_page_->currentRoom(); + + try { + dialog->addUsers(cache::client()->readReceipts(event_id, room_id)); + } catch (const lmdb::error &e) { + nhlog::db()->warn("failed to retrieve read receipts for {} {}", + event_id.toStdString(), + chat_page_->currentRoom().toStdString()); + dialog->deleteLater(); + + return; } - if (logoutModal_.isNull()) { - logoutModal_ = QSharedPointer( - new OverlayModal(MainWindow::instance(), logoutDialog_.data())); - } - - logoutModal_->show(); + showTransparentOverlayModal(dialog); } bool MainWindow::hasActiveDialogs() const { - return (!leaveRoomModal_.isNull() && leaveRoomModal_->isVisible()) || - (!progressModal_.isNull() && progressModal_->isVisible()) || - (!inviteUsersModal_.isNull() && inviteUsersModal_->isVisible()) || - (!joinRoomModal_.isNull() && joinRoomModal_->isVisible()) || - (!createRoomModal_.isNull() && createRoomModal_->isVisible()) || - (!logoutModal_.isNull() && logoutModal_->isVisible()); + return !modal_ && modal_->isVisible(); } bool @@ -527,3 +489,10 @@ MainWindow::pageSupportsTray() const return !welcome_page_->isVisible() && !login_page_->isVisible() && !register_page_->isVisible(); } + +void +MainWindow::hideOverlay() +{ + if (modal_) + modal_->hide(); +} diff --git a/src/MainWindow.h b/src/MainWindow.h index 3d9a94d3..0fa49f17 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -29,6 +29,7 @@ #include "UserSettingsPage.h" #include "WelcomePage.h" #include "dialogs/UserProfile.h" +#include "ui/OverlayModal.h" class ChatPage; class LoadingIndicator; @@ -73,6 +74,14 @@ public: void openRoomSettings(const QString &room_id = ""); void openMemberListDialog(const QString &room_id = ""); void openUserProfile(const QString &user_id, const QString &room_id); + void openReadReceiptsDialog(const QString &event_id); + + void hideOverlay(); + void showSolidOverlayModal(QWidget *content, + QFlags flags = Qt::AlignCenter); + void showTransparentOverlayModal(QWidget *content, + QFlags flags = Qt::AlignTop | + Qt::AlignHCenter); protected: void closeEvent(QCloseEvent *event) override; @@ -138,42 +147,11 @@ private: ChatPage *chat_page_; UserSettingsPage *userSettingsPage_; QSharedPointer userSettings_; - //! Used to hide undefined states between page transitions. - QSharedPointer progressModal_; - QSharedPointer spinner_; //! Tray icon that shows the unread message count. TrayIcon *trayIcon_; //! Notifications display. - QSharedPointer snackBar_; - //! Leave room modal. - QSharedPointer leaveRoomModal_; - //! Leave room dialog. - QSharedPointer leaveRoomDialog_; - //! Invite users modal. - QSharedPointer inviteUsersModal_; - //! Invite users dialog. - QSharedPointer inviteUsersDialog_; - //! Join room modal. - QSharedPointer joinRoomModal_; - //! Join room dialog. - QSharedPointer joinRoomDialog_; - //! Create room modal. - QSharedPointer createRoomModal_; - //! Create room dialog. - QSharedPointer createRoomDialog_; - //! Logout modal. - QSharedPointer logoutModal_; - //! Logout dialog. - QSharedPointer logoutDialog_; - //! Room settings modal. - QSharedPointer roomSettingsModal_; - //! Room settings dialog. - QSharedPointer roomSettingsDialog_; - //! Member list modal. - QSharedPointer memberListModal_; - //! Member list dialog. - QSharedPointer memberListDialog_; - - QSharedPointer userProfileModal_; - QSharedPointer userProfileDialog_; + SnackBar *snackBar_ = nullptr; + //! Overlay modal used to project other widgets. + OverlayModal *modal_ = nullptr; + LoadingIndicator *spinner_ = nullptr; }; diff --git a/src/RegisterPage.h b/src/RegisterPage.h index d02de7c4..1f39ab0c 100644 --- a/src/RegisterPage.h +++ b/src/RegisterPage.h @@ -19,7 +19,6 @@ #include #include -#include #include class FlatButton; diff --git a/src/TopRoomBar.h b/src/TopRoomBar.h index ad74458c..21f8325a 100644 --- a/src/TopRoomBar.h +++ b/src/TopRoomBar.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/src/dialogs/RoomSettings.cpp b/src/dialogs/RoomSettings.cpp index df4eaeee..710c3de6 100644 --- a/src/dialogs/RoomSettings.cpp +++ b/src/dialogs/RoomSettings.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include diff --git a/src/dialogs/RoomSettings.h b/src/dialogs/RoomSettings.h index 192e922f..408804ba 100644 --- a/src/dialogs/RoomSettings.h +++ b/src/dialogs/RoomSettings.h @@ -19,9 +19,6 @@ class TextField; class TextField; class Toggle; -template -class QSharedPointer; - class EditModal : public QWidget { Q_OBJECT diff --git a/src/dialogs/UserProfile.cpp b/src/dialogs/UserProfile.cpp index c2c42ec4..df334b15 100644 --- a/src/dialogs/UserProfile.cpp +++ b/src/dialogs/UserProfile.cpp @@ -170,8 +170,6 @@ UserProfile::UserProfile(QWidget *parent) vlayout->setContentsMargins(WIDGET_MARGIN, TOP_WIDGET_MARGIN, WIDGET_MARGIN, WIDGET_MARGIN); qRegisterMetaType>(); - - connect(this, &UserProfile::devicesRetrieved, this, &UserProfile::updateDeviceList); } void @@ -227,10 +225,15 @@ UserProfile::init(const QString &userId, const QString &roomId) mtx::requests::QueryKeys req; req.device_keys[userId.toStdString()] = {}; + // A proxy object is used to emit the signal instead of the original object + // which might be destroyed by the time the http call finishes. + auto proxy = std::make_shared(); + QObject::connect(proxy.get(), &Proxy::done, this, &UserProfile::updateDeviceList); + http::client()->query_keys( req, - [user_id = userId.toStdString(), this](const mtx::responses::QueryKeys &res, - mtx::http::RequestErr err) { + [user_id = userId.toStdString(), proxy = std::move(proxy), this]( + const mtx::responses::QueryKeys &res, mtx::http::RequestErr err) { if (err) { nhlog::net()->warn("failed to query device keys: {} {}", err->matrix_error.error, @@ -264,7 +267,7 @@ UserProfile::init(const QString &userId, const QString &roomId) }); if (!deviceInfo.empty()) - emit devicesRetrieved(QString::fromStdString(user_id), deviceInfo); + emit proxy->done(QString::fromStdString(user_id), deviceInfo); }); } diff --git a/src/dialogs/UserProfile.h b/src/dialogs/UserProfile.h index 9901771d..7dc1c0c8 100644 --- a/src/dialogs/UserProfile.h +++ b/src/dialogs/UserProfile.h @@ -17,6 +17,14 @@ struct DeviceInfo Q_DECLARE_METATYPE(std::vector) +class Proxy : public QObject +{ + Q_OBJECT + +signals: + void done(const QString &user_id, const std::vector &devices); +}; + namespace dialogs { class DeviceItem : public QWidget @@ -43,9 +51,6 @@ public: protected: void paintEvent(QPaintEvent *) override; -signals: - void devicesRetrieved(const QString &user_id, const std::vector &devices); - private slots: void updateDeviceList(const QString &user_id, const std::vector &devices); diff --git a/src/timeline/TimelineItem.cpp b/src/timeline/TimelineItem.cpp index fcbabf5a..ab4461c4 100644 --- a/src/timeline/TimelineItem.cpp +++ b/src/timeline/TimelineItem.cpp @@ -166,7 +166,7 @@ TimelineItem::init() connect(showReadReceipts_, &QAction::triggered, this, [this]() { if (!event_id_.isEmpty()) - ChatPage::instance()->showReadReceipts(event_id_); + MainWindow::instance()->openReadReceiptsDialog(event_id_); }); connect(this, &TimelineItem::eventRedacted, this, [this](const QString &event_id) { diff --git a/src/ui/LoadingIndicator.cpp b/src/ui/LoadingIndicator.cpp index 05b7fff5..c8337089 100644 --- a/src/ui/LoadingIndicator.cpp +++ b/src/ui/LoadingIndicator.cpp @@ -12,17 +12,10 @@ LoadingIndicator::LoadingIndicator(QWidget *parent) setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); setFocusPolicy(Qt::NoFocus); - timer_ = new QTimer(); + timer_ = new QTimer(this); connect(timer_, SIGNAL(timeout()), this, SLOT(onTimeout())); } -LoadingIndicator::~LoadingIndicator() -{ - stop(); - - delete timer_; -} - void LoadingIndicator::paintEvent(QPaintEvent *e) { diff --git a/src/ui/LoadingIndicator.h b/src/ui/LoadingIndicator.h index bb33fe6c..e8de0aec 100644 --- a/src/ui/LoadingIndicator.h +++ b/src/ui/LoadingIndicator.h @@ -13,7 +13,6 @@ class LoadingIndicator : public QWidget public: LoadingIndicator(QWidget *parent = 0); - virtual ~LoadingIndicator(); void paintEvent(QPaintEvent *e); diff --git a/src/ui/OverlayModal.cpp b/src/ui/OverlayModal.cpp index 30ebdf5c..abd1827a 100644 --- a/src/ui/OverlayModal.cpp +++ b/src/ui/OverlayModal.cpp @@ -20,18 +20,31 @@ #include "OverlayModal.h" -OverlayModal::OverlayModal(QWidget *parent, QWidget *content) +OverlayModal::OverlayModal(QWidget *parent) : OverlayWidget(parent) - , content_{content} , color_{QColor(30, 30, 30, 170)} { layout_ = new QVBoxLayout(this); - layout_->addWidget(content); layout_->setSpacing(0); layout_->setContentsMargins(10, 40, 10, 20); setContentAlignment(Qt::AlignCenter); +} - content->setFocus(); +void +OverlayModal::setWidget(QWidget *widget) +{ + // Delete the previous widget + if (layout_->count() > 0) { + QLayoutItem *item; + while ((item = layout_->takeAt(0)) != nullptr) { + delete item->widget(); + delete item; + } + } + + layout_->addWidget(widget); + content_ = widget; + content_->setFocus(); } void diff --git a/src/ui/OverlayModal.h b/src/ui/OverlayModal.h index acba7a7a..e1fe8ec0 100644 --- a/src/ui/OverlayModal.h +++ b/src/ui/OverlayModal.h @@ -27,12 +27,13 @@ class OverlayModal : public OverlayWidget { public: - OverlayModal(QWidget *parent, QWidget *content); + OverlayModal(QWidget *parent); void setColor(QColor color) { color_ = color; } void setDismissible(bool state) { isDismissible_ = state; } void setContentAlignment(QFlags flag) { layout_->setAlignment(flag); } + void setWidget(QWidget *widget); protected: void paintEvent(QPaintEvent *event) override;