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();
|
Widget* w = Widget::getInstance();
|
||||||
if (!w->isFriendWidgetCurActiveWidget(f)|| w->isMinimized() || !w->isActiveWindow())
|
if (!w->isFriendWidgetCurActiveWidget(f)|| w->isMinimized() || !w->isActiveWindow())
|
||||||
{
|
{
|
||||||
w->newMessageAlert();
|
w->newMessageAlert(f->getFriendWidget());
|
||||||
f->setEventFlag(true);
|
f->setEventFlag(true);
|
||||||
f->getFriendWidget()->updateStatusLight();
|
f->getFriendWidget()->updateStatusLight();
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ void ChatForm::onAvInvite(int FriendId, int CallId, bool video)
|
||||||
Widget* w = Widget::getInstance();
|
Widget* w = Widget::getInstance();
|
||||||
if (!w->isFriendWidgetCurActiveWidget(f)|| w->isMinimized() || !w->isActiveWindow())
|
if (!w->isFriendWidgetCurActiveWidget(f)|| w->isMinimized() || !w->isActiveWindow())
|
||||||
{
|
{
|
||||||
w->newMessageAlert();
|
w->newMessageAlert(f->getFriendWidget());
|
||||||
f->setEventFlag(true);
|
f->setEventFlag(true);
|
||||||
f->getFriendWidget()->updateStatusLight();
|
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
|
//won't print the message if there were no messages before
|
||||||
if(!f->getChatForm()->isEmpty()
|
if(!f->getChatForm()->isEmpty()
|
||||||
&& Settings::getInstance().getStatusChangeNotificationEnabled() == true)
|
&& Settings::getInstance().getStatusChangeNotificationEnabled())
|
||||||
{
|
{
|
||||||
QString fStatus = "";
|
QString fStatus = "";
|
||||||
switch(f->getStatus()){
|
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())
|
if ((static_cast<GenericChatroomWidget*>(f->getFriendWidget()) != activeChatroomWidget) || isMinimized() || !isActiveWindow())
|
||||||
{
|
{
|
||||||
f->setEventFlag(true);
|
f->setEventFlag(true);
|
||||||
newMessageAlert();
|
newMessageAlert(f->getFriendWidget());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
f->setEventFlag(true);
|
f->setEventFlag(true);
|
||||||
newMessageAlert();
|
newMessageAlert(f->getFriendWidget());
|
||||||
}
|
}
|
||||||
|
|
||||||
f->getFriendWidget()->updateStatusLight();
|
f->getFriendWidget()->updateStatusLight();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::newMessageAlert()
|
void Widget::newMessageAlert(GenericChatroomWidget* chat)
|
||||||
{
|
{
|
||||||
QApplication::alert(this);
|
QApplication::alert(this);
|
||||||
|
|
||||||
static QFile sndFile(":audio/notification.pcm");
|
static QFile sndFile(":audio/notification.pcm");
|
||||||
if(Settings::getInstance().getShowInFront() == true)
|
if ((isMinimized() || !isActiveWindow()) && Settings::getInstance().getShowInFront())
|
||||||
{
|
{
|
||||||
this->show();
|
this->show();
|
||||||
|
emit chat->chatroomWidgetClicked(chat);
|
||||||
}
|
}
|
||||||
static QByteArray sndData;
|
static QByteArray sndData;
|
||||||
if (sndData.isEmpty())
|
if (sndData.isEmpty())
|
||||||
|
@ -882,7 +883,7 @@ void Widget::onGroupMessageReceived(int groupnumber, const QString& message, con
|
||||||
g->hasNewMessages = 1;
|
g->hasNewMessages = 1;
|
||||||
if (targeted)
|
if (targeted)
|
||||||
{
|
{
|
||||||
newMessageAlert();
|
newMessageAlert(g->widget);
|
||||||
g->userWasMentioned = 1; // useful for highlighting line or desktop notifications
|
g->userWasMentioned = 1; // useful for highlighting line or desktop notifications
|
||||||
}
|
}
|
||||||
g->widget->updateStatusLight();
|
g->widget->updateStatusLight();
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
QThread* getCoreThread();
|
QThread* getCoreThread();
|
||||||
Camera* getCamera();
|
Camera* getCamera();
|
||||||
static Widget* getInstance();
|
static Widget* getInstance();
|
||||||
void newMessageAlert();
|
void newMessageAlert(GenericChatroomWidget* chat);
|
||||||
bool isFriendWidgetCurActiveWidget(Friend* f);
|
bool isFriendWidgetCurActiveWidget(Friend* f);
|
||||||
bool getIsWindowMinimized();
|
bool getIsWindowMinimized();
|
||||||
static QList<QString> searchProfiles();
|
static QList<QString> searchProfiles();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user