Own the independent popup and handle all keyboard mouse input
This commit is contained in:
1 parent
bc42df12f5
commit
1108c773dc
3 files changed
+9
-4
No files matched your search
@@ -183,6 +183,7 @@ MainWindow::MainWindow(QWidget *parent, DbManager* db, const QString& cfgPath,
|
||||
MainWindow::~MainWindow() {
|
||||
s_mainWindow = nullptr;
|
||||
if (m_messageNotification) m_messageNotification->dismiss("shutdown");
|
||||
m_messageNotification.reset();
|
||||
delete AvatarManager::instance();
|
||||
delete GroupAvatarManager::instance();
|
||||
gui_bridge_set_group_avatar_result_cb(nullptr);
|
||||
@@ -816,8 +817,8 @@ void MainWindow::setupTray() {
|
||||
m_trayIcon->setIcon(QIcon(":/icons/app_icon.png"));
|
||||
m_trayIcon->setToolTip("vibechat");
|
||||
|
||||
m_messageNotification = new MessageNotification(this);
|
||||
connect(m_messageNotification, &MessageNotification::activated, this, [this](const QString& target) {
|
||||
m_messageNotification = std::make_unique<MessageNotification>();
|
||||
connect(m_messageNotification.get(), &MessageNotification::activated, this, [this](const QString& target) {
|
||||
if (isMinimized()) setWindowState(windowState() & ~Qt::WindowMinimized);
|
||||
show();
|
||||
raise();
|
||||
@@ -873,7 +874,7 @@ void MainWindow::showIncomingMessageNotification(const QString& target, quint64
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_messageNotification->showMessage(target, m_db->getDisplayName(author), channel, m_trayIcon->geometry());
|
||||
m_messageNotification->showMessage(target, m_db->getDisplayName(author), channel, m_trayIcon->geometry(), screen());
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event) {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <QHash>
|
||||
#include <QTimer>
|
||||
#include <QPointer>
|
||||
#include <memory>
|
||||
|
||||
class ChannelList;
|
||||
class MessageList;
|
||||
@@ -110,7 +111,7 @@ private:
|
||||
QSplitter *m_splitter = nullptr;
|
||||
QSystemTrayIcon *m_trayIcon;
|
||||
QMenu *m_trayMenu;
|
||||
MessageNotification* m_messageNotification = nullptr;
|
||||
std::unique_ptr<MessageNotification> m_messageNotification;
|
||||
DbManager *m_db;
|
||||
UtunNode *m_node = nullptr;
|
||||
QString m_cfgPath;
|
||||
|
||||
@@ -81,8 +81,11 @@ bool UserActivityMonitor::eventFilter(QObject*, QEvent* event) {
|
||||
switch (event->type()) {
|
||||
case QEvent::MouseMove:
|
||||
case QEvent::MouseButtonPress:
|
||||
case QEvent::MouseButtonRelease:
|
||||
case QEvent::MouseButtonDblClick:
|
||||
case QEvent::Wheel:
|
||||
case QEvent::KeyPress:
|
||||
case QEvent::KeyRelease:
|
||||
case QEvent::TouchBegin:
|
||||
case QEvent::TouchUpdate:
|
||||
case QEvent::TabletMove:
|
||||
|
||||
Reference in new issue
Block a user