Browse Source

Own the independent popup and handle all keyboard mouse input

master
evgeny 4 days ago
parent
commit
1108c773dc
  1. 7
      tools/chatgui/src/mainwindow.cpp
  2. 3
      tools/chatgui/src/mainwindow.h
  3. 3
      tools/chatgui/src/user_activity_monitor.cpp

7
tools/chatgui/src/mainwindow.cpp

@ -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) {

3
tools/chatgui/src/mainwindow.h

@ -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;

3
tools/chatgui/src/user_activity_monitor.cpp

@ -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:

Loading…
Cancel
Save