Added blinking of the chat icon for private chat window and chat lobby.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5722 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-10-25 18:06:33 +00:00
parent 179618edbf
commit 7272b7e768
8 changed files with 103 additions and 23 deletions

View file

@ -29,7 +29,8 @@
#include "gui/settings/RsharePeerSettings.h"
#include "gui/common/StatusDefs.h"
#include "gui/style/RSStyle.h"
#include"util/misc.h"
#include "util/misc.h"
#include "rshare.h"
#include <retroshare/rsmsgs.h>
#include <retroshare/rsnotify.h>
@ -70,6 +71,7 @@ PopupChatWindow::PopupChatWindow(bool tabbed, QWidget *parent, Qt::WFlags flags)
tabbedWindow = tabbed;
firstShow = true;
chatDialog = NULL;
mEmptyIcon = NULL;
ui.tabWidget->setVisible(tabbedWindow);
@ -92,6 +94,8 @@ PopupChatWindow::PopupChatWindow(bool tabbed, QWidget *parent, Qt::WFlags flags)
connect(ui.tabWidget, SIGNAL(tabChanged(ChatDialog*)), this, SLOT(tabChanged(ChatDialog*)));
connect(ui.tabWidget, SIGNAL(tabClosed(ChatDialog*)), this, SLOT(tabClosed(ChatDialog*)));
connect(rApp, SIGNAL(blink(bool)), this, SLOT(blink(bool)));
if (tabbedWindow) {
/* signal toggled is called */
ui.actionSetOnTop->setChecked(Settings->valueFromGroup("ChatWindow", "OnTop", false).toBool());
@ -105,6 +109,10 @@ PopupChatWindow::~PopupChatWindow()
{
saveSettings();
if (mEmptyIcon) {
delete(mEmptyIcon);
}
if (this == instance) {
instance = NULL;
}
@ -263,10 +271,13 @@ void PopupChatWindow::calculateTitle(ChatDialog *dialog)
QIcon icon;
if (isTyping) {
mBlinkIcon = QIcon();
icon = QIcon(IMAGE_TYPING);
} else if (hasNewMessages) {
icon = QIcon(IMAGE_CHAT);
mBlinkIcon = icon;
} else {
mBlinkIcon = QIcon();
if (cd && cd->hasPeerStatus()) {
icon = QIcon(StatusDefs::imageIM(cd->getPeerStatus()));
} else {
@ -405,3 +416,16 @@ void PopupChatWindow::calculateStyle(ChatDialog *dialog)
ui.chatstatusbar->setStyleSheet(statusSheet);
ui.chatcentralwidget->setStyleSheet(widgetSheet);
}
void PopupChatWindow::blink(bool on)
{
if (!mBlinkIcon.isNull()) {
if (mEmptyIcon == NULL) {
/* create empty icon */
QPixmap pixmap(16, 16);
pixmap.fill(Qt::transparent);
mEmptyIcon = new QIcon(pixmap);
}
setWindowIcon(on ? mBlinkIcon : *mEmptyIcon);
}
}