mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'pr2688'
This commit is contained in:
commit
0c2f70eb7e
|
@ -1225,9 +1225,12 @@ bool Widget::newMessageAlert(QWidget* currentWindow, bool isActive, bool sound,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (notify)
|
if (notify)
|
||||||
|
{
|
||||||
|
if (inactiveWindow)
|
||||||
{
|
{
|
||||||
QApplication::alert(currentWindow);
|
QApplication::alert(currentWindow);
|
||||||
eventFlag = true;
|
eventFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (Settings::getInstance().getShowWindow())
|
if (Settings::getInstance().getShowWindow())
|
||||||
{
|
{
|
||||||
|
@ -1577,6 +1580,10 @@ bool Widget::event(QEvent * e)
|
||||||
{
|
{
|
||||||
switch (e->type())
|
switch (e->type())
|
||||||
{
|
{
|
||||||
|
case QEvent::MouseButtonPress:
|
||||||
|
case QEvent::MouseButtonDblClick:
|
||||||
|
focusChatInput();
|
||||||
|
break;
|
||||||
case QEvent::WindowActivate:
|
case QEvent::WindowActivate:
|
||||||
if (activeChatroomWidget != nullptr)
|
if (activeChatroomWidget != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -1584,6 +1591,7 @@ bool Widget::event(QEvent * e)
|
||||||
activeChatroomWidget->updateStatusLight();
|
activeChatroomWidget->updateStatusLight();
|
||||||
setWindowTitle(activeChatroomWidget->getTitle());
|
setWindowTitle(activeChatroomWidget->getTitle());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventFlag)
|
if (eventFlag)
|
||||||
{
|
{
|
||||||
eventFlag = false;
|
eventFlag = false;
|
||||||
|
@ -1591,13 +1599,15 @@ bool Widget::event(QEvent * e)
|
||||||
updateIcons();
|
updateIcons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
focusChatInput();
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
emit windowStateChanged(windowState());
|
emit windowStateChanged(windowState());
|
||||||
|
|
||||||
case QEvent::WindowStateChange:
|
case QEvent::WindowStateChange:
|
||||||
Nexus::getInstance().updateWindowsStates();
|
Nexus::getInstance().updateWindowsStates();
|
||||||
#endif
|
#endif
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2080,3 +2090,14 @@ void Widget::retranslateUi()
|
||||||
previousConversationAction->setText(tr("Previous Conversation"));
|
previousConversationAction->setText(tr("Previous Conversation"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Widget::focusChatInput()
|
||||||
|
{
|
||||||
|
if (activeChatroomWidget)
|
||||||
|
{
|
||||||
|
if (Friend* f = activeChatroomWidget->getFriend())
|
||||||
|
f->getChatForm()->focusInput();
|
||||||
|
else if (Group* g = activeChatroomWidget->getGroup())
|
||||||
|
g->getChatForm()->focusInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -221,6 +221,7 @@ private:
|
||||||
static bool filterOnline(int index);
|
static bool filterOnline(int index);
|
||||||
static bool filterOffline(int index);
|
static bool filterOffline(int index);
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
void focusChatInput();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SystemTrayIcon *icon;
|
SystemTrayIcon *icon;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user