1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

change status light on incoming file request

This commit is contained in:
apprb 2014-08-31 21:48:15 +07:00
parent a3785f3c27
commit f0c8be43db
5 changed files with 23 additions and 16 deletions

View File

@ -23,7 +23,7 @@ Friend::Friend(int FriendId, QString UserId)
{
widget = new FriendWidget(friendId, userId);
chatForm = new ChatForm(this);
hasNewMessages = 0;
hasNewEvents = 0;
friendStatus = Status::Offline;
}

View File

@ -36,7 +36,7 @@ public:
int friendId;
QString userId;
ChatForm* chatForm;
int hasNewMessages;
int hasNewEvents;
Status friendStatus;
QPixmap avatar;
};

View File

@ -376,6 +376,13 @@ void ChatForm::onFileRecvRequest(ToxFile file)
connect(Widget::getInstance()->getCore(), &Core::fileTransferInfo, fileTrans, &FileTransfertWidget::onFileTransferInfo);
connect(Widget::getInstance()->getCore(), &Core::fileTransferCancelled, fileTrans, &FileTransfertWidget::onFileTransferCancelled);
connect(Widget::getInstance()->getCore(), &Core::fileTransferFinished, fileTrans, &FileTransfertWidget::onFileTransferFinished);
if (!f->widget->isActive())
{
f->hasNewEvents = 1;
// FIXME: add sound alert, as for incoming message
}
f->widget->updateStatusLight();
}
void ChatForm::onAvInvite(int FriendId, int CallId, bool video)
@ -407,7 +414,7 @@ void ChatForm::onAvInvite(int FriendId, int CallId, bool video)
if (!w->isFriendWidgetCurActiveWidget(f))
{
w->newMessageAlert();
f->hasNewMessages=true;
f->hasNewEvents=true;
f->widget->updateStatusLight();
}
}

View File

@ -211,20 +211,20 @@ void FriendWidget::updateStatusLight()
Friend* f = FriendList::findFriend(friendId);
Status status = f->friendStatus;
if (status == Status::Online && f->hasNewMessages == 0)
if (status == Status::Online && f->hasNewEvents == 0)
statusPic.setPixmap(QPixmap(":img/status/dot_online.png"));
else if (status == Status::Online && f->hasNewMessages == 1)
else if (status == Status::Online && f->hasNewEvents == 1)
statusPic.setPixmap(QPixmap(":img/status/dot_online_notification.png"));
else if (status == Status::Away && f->hasNewMessages == 0)
else if (status == Status::Away && f->hasNewEvents == 0)
statusPic.setPixmap(QPixmap(":img/status/dot_idle.png"));
else if (status == Status::Away && f->hasNewMessages == 1)
else if (status == Status::Away && f->hasNewEvents == 1)
statusPic.setPixmap(QPixmap(":img/status/dot_idle_notification.png"));
else if (status == Status::Busy && f->hasNewMessages == 0)
else if (status == Status::Busy && f->hasNewEvents == 0)
statusPic.setPixmap(QPixmap(":img/status/dot_busy.png"));
else if (status == Status::Busy && f->hasNewMessages == 1)
else if (status == Status::Busy && f->hasNewEvents == 1)
statusPic.setPixmap(QPixmap(":img/status/dot_busy_notification.png"));
else if (status == Status::Offline && f->hasNewMessages == 0)
else if (status == Status::Offline && f->hasNewEvents == 0)
statusPic.setPixmap(QPixmap(":img/status/dot_away.png"));
else if (status == Status::Offline && f->hasNewMessages == 1)
else if (status == Status::Offline && f->hasNewEvents == 1)
statusPic.setPixmap(QPixmap(":img/status/dot_away_notification.png"));
}

View File

@ -511,8 +511,8 @@ void Widget::onFriendWidgetClicked(FriendWidget *widget)
isFriendWidgetActive = 1;
isGroupWidgetActive = 0;
if (f->hasNewMessages != 0)
f->hasNewMessages = 0;
if (f->hasNewEvents != 0)
f->hasNewEvents = 0;
f->widget->updateStatusLight();
}
@ -530,13 +530,13 @@ void Widget::onFriendMessageReceived(int friendId, const QString& message)
Friend* f2 = FriendList::findFriend(activeFriendWidget->friendId);
if (((f->friendId != f2->friendId) || isFriendWidgetActive == 0) || isWindowMinimized || !isActiveWindow())
{
f->hasNewMessages = 1;
f->hasNewEvents = 1;
newMessageAlert();
}
}
else
{
f->hasNewMessages = 1;
f->hasNewEvents = 1;
newMessageAlert();
}
@ -768,7 +768,7 @@ bool Widget::event(QEvent * e)
if (isFriendWidgetActive && activeFriendWidget != nullptr)
{
Friend* f = FriendList::findFriend(activeFriendWidget->friendId);
f->hasNewMessages = 0;
f->hasNewEvents = 0;
f->widget->updateStatusLight();
}
else if (isGroupWidgetActive && activeGroupWidget != nullptr)