mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-11 15:50:38 -04:00
Added UserNotify to gxs channels and forums.
Count new messages by retrieving all messages of all subscribed groups until getServiceStatistic is available. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7435 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c32ac6821a
commit
bd58cca832
13 changed files with 571 additions and 78 deletions
|
@ -28,34 +28,38 @@
|
|||
|
||||
UserNotify::UserNotify(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
mMainToolButton = NULL;
|
||||
mMainAction = NULL;
|
||||
mListItem = NULL;
|
||||
mTrayIcon = NULL;
|
||||
mNotifyIcon = NULL;
|
||||
mNewCount = 0;
|
||||
{
|
||||
mMainToolButton = NULL;
|
||||
mMainAction = NULL;
|
||||
mListItem = NULL;
|
||||
mTrayIcon = NULL;
|
||||
mNotifyIcon = NULL;
|
||||
mNewCount = 0;
|
||||
mLastBlinking = false;
|
||||
|
||||
connect(rApp, SIGNAL(blink(bool)), this, SLOT(blink(bool)));
|
||||
}
|
||||
|
||||
void UserNotify::initialize(QToolBar *mainToolBar, QAction *mainAction, QListWidgetItem *listItem)
|
||||
{
|
||||
mMainAction = mainAction;
|
||||
if (mMainAction) {
|
||||
connect(rApp, SIGNAL(blink(bool)), this, SLOT(blink(bool)));
|
||||
}
|
||||
|
||||
UserNotify::~UserNotify()
|
||||
{
|
||||
}
|
||||
|
||||
void UserNotify::initialize(QToolBar *mainToolBar, QAction *mainAction, QListWidgetItem *listItem)
|
||||
{
|
||||
mMainAction = mainAction;
|
||||
if (mMainAction) {
|
||||
mButtonText = mMainAction->text();
|
||||
if (mainToolBar) {
|
||||
mMainToolButton = dynamic_cast<QToolButton*>(mainToolBar->widgetForAction(mMainAction));
|
||||
}
|
||||
}
|
||||
mListItem = listItem;
|
||||
if (mListItem && !mMainAction) {
|
||||
mButtonText = mMainAction->text();
|
||||
}
|
||||
}
|
||||
|
||||
void UserNotify::createIcons(QMenu *notifyMenu)
|
||||
mMainToolButton = dynamic_cast<QToolButton*>(mainToolBar->widgetForAction(mMainAction));
|
||||
}
|
||||
}
|
||||
mListItem = listItem;
|
||||
if (mListItem && !mMainAction) {
|
||||
mButtonText = mMainAction->text();
|
||||
}
|
||||
}
|
||||
|
||||
void UserNotify::createIcons(QMenu *notifyMenu)
|
||||
{
|
||||
#define DELETE_OBJECT(x) if (x) { delete(x); x = NULL; }
|
||||
|
||||
|
@ -87,6 +91,16 @@ void UserNotify::createIcons(QMenu *notifyMenu)
|
|||
}
|
||||
|
||||
void UserNotify::updateIcon()
|
||||
{
|
||||
startUpdate();
|
||||
}
|
||||
|
||||
void UserNotify::startUpdate()
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
void UserNotify::update()
|
||||
{
|
||||
unsigned int count = getNewCount();
|
||||
|
||||
|
@ -96,20 +110,20 @@ void UserNotify::updateIcon()
|
|||
|
||||
QFont font = mMainAction->font();
|
||||
font.setBold(count > 0);
|
||||
mMainAction->setFont(font);
|
||||
}
|
||||
|
||||
if (mListItem) {
|
||||
mListItem->setIcon(getMainIcon(count > 0));
|
||||
mListItem->setText((count > 0) ? QString("%1 (%2)").arg(mButtonText).arg(count) : mButtonText);
|
||||
|
||||
QFont font = mListItem->font();
|
||||
font.setBold(count > 0);
|
||||
mListItem->setFont(font);
|
||||
}
|
||||
if (mMainToolButton) {
|
||||
mMainToolButton->setStyleSheet((count > 0) ? "QToolButton { color: #E21D3A; }" : "");
|
||||
|
||||
mMainAction->setFont(font);
|
||||
}
|
||||
|
||||
if (mListItem) {
|
||||
mListItem->setIcon(getMainIcon(count > 0));
|
||||
mListItem->setText((count > 0) ? QString("%1 (%2)").arg(mButtonText).arg(count) : mButtonText);
|
||||
|
||||
QFont font = mListItem->font();
|
||||
font.setBold(count > 0);
|
||||
mListItem->setFont(font);
|
||||
}
|
||||
if (mMainToolButton) {
|
||||
mMainToolButton->setStyleSheet((count > 0) ? "QToolButton { color: #E21D3A; }" : "");
|
||||
|
||||
QFont font = mMainToolButton->font();
|
||||
font.setBold(count > 0);
|
||||
mMainToolButton->setFont(font);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue