switch trayicon if online count is 0 or bigger

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1262 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2009-05-20 22:51:15 +00:00
parent 3d37a0c242
commit eea261d739
3 changed files with 26 additions and 1 deletions

View File

@ -109,6 +109,9 @@
#define IMG_HELP ":/images/help.png"
#define IMAGE_NEWSFEED ":/images/konqsidebar_news24.png"
#define IMAGE_PLUGINS ":/images/extension_32.png"
#define IMAGE_NOONLINE ":/images/rstray0.png"
#define IMAGE_ONEONLINE ":/images/rstray1.png"
#define IMAGE_TWOONLINE ":/images/rstray2.png"
/* Keys for UI Preferences */
@ -326,7 +329,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
trayIcon = new QSystemTrayIcon(this);
trayIcon->setToolTip(tr("RetroShare"));
trayIcon->setContextMenu(menu);
trayIcon->setIcon(QIcon(IMAGE_RETROSHARE));
trayIcon->setIcon(QIcon(IMAGE_NOONLINE));
connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this,
SLOT(toggleVisibility(QSystemTrayIcon::ActivationReason)));
@ -351,6 +354,27 @@ void MainWindow::updateStatus()
if (natstatus)
natstatus->getNATStatus();
std::list<std::string> ids;
rsPeers->getOnlineList(ids);
int online = ids.size();
if (online == 0)
{
trayIcon->setIcon(QIcon(IMAGE_NOONLINE));
}
else if (online < 2)
{
trayIcon->setIcon(QIcon(IMAGE_ONEONLINE));
}
else if (online < 3)
{
trayIcon->setIcon(QIcon(IMAGE_TWOONLINE));
}
else
{
trayIcon->setIcon(QIcon(IMAGE_RETROSHARE));
}
}

View File

@ -275,6 +275,7 @@
<file>images/rstray3.png</file>
<file>images/rstray0.png</file>
<file>images/rstray1.png</file>
<file>images/rstray2.png</file>
<file>images/save24.png</file>
<file>images/send24.png</file>
<file>images/settings.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB