mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
switch to relevant chat room when minimized
fixes #688, except that for me it doesn't actually unminimize
This commit is contained in:
parent
cbad1c4966
commit
f2d358f222
|
@ -188,7 +188,7 @@ void ChatForm::onFileRecvRequest(ToxFile file)
|
|||
Widget* w = Widget::getInstance();
|
||||
if (!w->isFriendWidgetCurActiveWidget(f)|| w->isMinimized() || !w->isActiveWindow())
|
||||
{
|
||||
w->newMessageAlert();
|
||||
w->newMessageAlert(f->getFriendWidget());
|
||||
f->setEventFlag(true);
|
||||
f->getFriendWidget()->updateStatusLight();
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ void ChatForm::onAvInvite(int FriendId, int CallId, bool video)
|
|||
Widget* w = Widget::getInstance();
|
||||
if (!w->isFriendWidgetCurActiveWidget(f)|| w->isMinimized() || !w->isActiveWindow())
|
||||
{
|
||||
w->newMessageAlert();
|
||||
w->newMessageAlert(f->getFriendWidget());
|
||||
f->setEventFlag(true);
|
||||
f->getFriendWidget()->updateStatusLight();
|
||||
}
|
||||
|
|
|
@ -675,7 +675,7 @@ void Widget::onFriendStatusChanged(int friendId, Status status)
|
|||
|
||||
//won't print the message if there were no messages before
|
||||
if(!f->getChatForm()->isEmpty()
|
||||
&& Settings::getInstance().getStatusChangeNotificationEnabled() == true)
|
||||
&& Settings::getInstance().getStatusChangeNotificationEnabled())
|
||||
{
|
||||
QString fStatus = "";
|
||||
switch(f->getStatus()){
|
||||
|
@ -750,26 +750,27 @@ void Widget::onFriendMessageReceived(int friendId, const QString& message, bool
|
|||
if ((static_cast<GenericChatroomWidget*>(f->getFriendWidget()) != activeChatroomWidget) || isMinimized() || !isActiveWindow())
|
||||
{
|
||||
f->setEventFlag(true);
|
||||
newMessageAlert();
|
||||
newMessageAlert(f->getFriendWidget());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
f->setEventFlag(true);
|
||||
newMessageAlert();
|
||||
newMessageAlert(f->getFriendWidget());
|
||||
}
|
||||
|
||||
f->getFriendWidget()->updateStatusLight();
|
||||
}
|
||||
|
||||
void Widget::newMessageAlert()
|
||||
void Widget::newMessageAlert(GenericChatroomWidget* chat)
|
||||
{
|
||||
QApplication::alert(this);
|
||||
|
||||
static QFile sndFile(":audio/notification.pcm");
|
||||
if(Settings::getInstance().getShowInFront() == true)
|
||||
if ((isMinimized() || !isActiveWindow()) && Settings::getInstance().getShowInFront())
|
||||
{
|
||||
this->show();
|
||||
emit chat->chatroomWidgetClicked(chat);
|
||||
}
|
||||
static QByteArray sndData;
|
||||
if (sndData.isEmpty())
|
||||
|
@ -882,7 +883,7 @@ void Widget::onGroupMessageReceived(int groupnumber, const QString& message, con
|
|||
g->hasNewMessages = 1;
|
||||
if (targeted)
|
||||
{
|
||||
newMessageAlert();
|
||||
newMessageAlert(g->widget);
|
||||
g->userWasMentioned = 1; // useful for highlighting line or desktop notifications
|
||||
}
|
||||
g->widget->updateStatusLight();
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
QThread* getCoreThread();
|
||||
Camera* getCamera();
|
||||
static Widget* getInstance();
|
||||
void newMessageAlert();
|
||||
void newMessageAlert(GenericChatroomWidget* chat);
|
||||
bool isFriendWidgetCurActiveWidget(Friend* f);
|
||||
bool getIsWindowMinimized();
|
||||
static QList<QString> searchProfiles();
|
||||
|
|
Loading…
Reference in New Issue
Block a user