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:
parent
a3785f3c27
commit
f0c8be43db
@ -23,7 +23,7 @@ Friend::Friend(int FriendId, QString UserId)
|
|||||||
{
|
{
|
||||||
widget = new FriendWidget(friendId, userId);
|
widget = new FriendWidget(friendId, userId);
|
||||||
chatForm = new ChatForm(this);
|
chatForm = new ChatForm(this);
|
||||||
hasNewMessages = 0;
|
hasNewEvents = 0;
|
||||||
friendStatus = Status::Offline;
|
friendStatus = Status::Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
friend.h
2
friend.h
@ -36,7 +36,7 @@ public:
|
|||||||
int friendId;
|
int friendId;
|
||||||
QString userId;
|
QString userId;
|
||||||
ChatForm* chatForm;
|
ChatForm* chatForm;
|
||||||
int hasNewMessages;
|
int hasNewEvents;
|
||||||
Status friendStatus;
|
Status friendStatus;
|
||||||
QPixmap avatar;
|
QPixmap avatar;
|
||||||
};
|
};
|
||||||
|
@ -376,6 +376,13 @@ void ChatForm::onFileRecvRequest(ToxFile file)
|
|||||||
connect(Widget::getInstance()->getCore(), &Core::fileTransferInfo, fileTrans, &FileTransfertWidget::onFileTransferInfo);
|
connect(Widget::getInstance()->getCore(), &Core::fileTransferInfo, fileTrans, &FileTransfertWidget::onFileTransferInfo);
|
||||||
connect(Widget::getInstance()->getCore(), &Core::fileTransferCancelled, fileTrans, &FileTransfertWidget::onFileTransferCancelled);
|
connect(Widget::getInstance()->getCore(), &Core::fileTransferCancelled, fileTrans, &FileTransfertWidget::onFileTransferCancelled);
|
||||||
connect(Widget::getInstance()->getCore(), &Core::fileTransferFinished, fileTrans, &FileTransfertWidget::onFileTransferFinished);
|
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)
|
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))
|
if (!w->isFriendWidgetCurActiveWidget(f))
|
||||||
{
|
{
|
||||||
w->newMessageAlert();
|
w->newMessageAlert();
|
||||||
f->hasNewMessages=true;
|
f->hasNewEvents=true;
|
||||||
f->widget->updateStatusLight();
|
f->widget->updateStatusLight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,20 +211,20 @@ void FriendWidget::updateStatusLight()
|
|||||||
Friend* f = FriendList::findFriend(friendId);
|
Friend* f = FriendList::findFriend(friendId);
|
||||||
Status status = f->friendStatus;
|
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"));
|
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"));
|
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"));
|
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"));
|
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"));
|
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"));
|
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"));
|
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"));
|
statusPic.setPixmap(QPixmap(":img/status/dot_away_notification.png"));
|
||||||
}
|
}
|
||||||
|
@ -511,8 +511,8 @@ void Widget::onFriendWidgetClicked(FriendWidget *widget)
|
|||||||
isFriendWidgetActive = 1;
|
isFriendWidgetActive = 1;
|
||||||
isGroupWidgetActive = 0;
|
isGroupWidgetActive = 0;
|
||||||
|
|
||||||
if (f->hasNewMessages != 0)
|
if (f->hasNewEvents != 0)
|
||||||
f->hasNewMessages = 0;
|
f->hasNewEvents = 0;
|
||||||
|
|
||||||
f->widget->updateStatusLight();
|
f->widget->updateStatusLight();
|
||||||
}
|
}
|
||||||
@ -530,13 +530,13 @@ void Widget::onFriendMessageReceived(int friendId, const QString& message)
|
|||||||
Friend* f2 = FriendList::findFriend(activeFriendWidget->friendId);
|
Friend* f2 = FriendList::findFriend(activeFriendWidget->friendId);
|
||||||
if (((f->friendId != f2->friendId) || isFriendWidgetActive == 0) || isWindowMinimized || !isActiveWindow())
|
if (((f->friendId != f2->friendId) || isFriendWidgetActive == 0) || isWindowMinimized || !isActiveWindow())
|
||||||
{
|
{
|
||||||
f->hasNewMessages = 1;
|
f->hasNewEvents = 1;
|
||||||
newMessageAlert();
|
newMessageAlert();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
f->hasNewMessages = 1;
|
f->hasNewEvents = 1;
|
||||||
newMessageAlert();
|
newMessageAlert();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -768,7 +768,7 @@ bool Widget::event(QEvent * e)
|
|||||||
if (isFriendWidgetActive && activeFriendWidget != nullptr)
|
if (isFriendWidgetActive && activeFriendWidget != nullptr)
|
||||||
{
|
{
|
||||||
Friend* f = FriendList::findFriend(activeFriendWidget->friendId);
|
Friend* f = FriendList::findFriend(activeFriendWidget->friendId);
|
||||||
f->hasNewMessages = 0;
|
f->hasNewEvents = 0;
|
||||||
f->widget->updateStatusLight();
|
f->widget->updateStatusLight();
|
||||||
}
|
}
|
||||||
else if (isGroupWidgetActive && activeGroupWidget != nullptr)
|
else if (isGroupWidgetActive && activeGroupWidget != nullptr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user