Added simple toaster for download complete.

Added new icon in MainWindow and systray icon for existing completed downloads.
You can enable/disable the toaster and the systray icon in NotifyPage.
Recompile of the GUI needed.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3868 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-11-25 00:20:25 +00:00
parent e7813892bc
commit fc08d1171f
22 changed files with 656 additions and 70 deletions

View file

@ -211,7 +211,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
ui.stackPages->add(transfersDialog = new TransfersDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_TRANSFERS), tr("Transfers"), grp));
transferAction = createPageAction(QIcon(IMAGE_TRANSFERS), tr("Transfers"), grp));
ui.stackPages->add(sharedfilesDialog = new SharedFilesDialog(ui.stackPages),
@ -409,6 +409,11 @@ void MainWindow::createTrayIcon()
trayIconChat = new QSystemTrayIcon(this);
trayIconChat->setIcon(QIcon(":/images/chat.png"));
connect(trayIconChat, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconChatClicked(QSystemTrayIcon::ActivationReason)));
// Create the tray icon for transfers
trayIconTransfers = new QSystemTrayIcon(this);
trayIconTransfers->setIcon(QIcon(":/images/ktorrent32.png"));
connect(trayIconTransfers, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconTransfersClicked(QSystemTrayIcon::ActivationReason)));
}
/*static*/ void MainWindow::installGroupChatNotifier()
@ -501,6 +506,26 @@ void MainWindow::updateChannels(int type)
}
}
void MainWindow::updateTransfers(int count)
{
if (count) {
transferAction->setIcon(QIcon(":/images/transfers_new32.png")) ;
} else {
transferAction->setIcon(QIcon(IMAGE_TRANSFERS)) ;
}
if (count && (Settings->getTrayNotifyFlags() & TRAYNOTIFY_TRANSFERS)) {
if (count > 1) {
trayIconTransfers->setToolTip(tr("RetroShare") + "\n" + tr("You have %1 completed downloads").arg(count));
} else {
trayIconTransfers->setToolTip(tr("RetroShare") + "\n" + tr("You have %1 completed download").arg(count));
}
trayIconTransfers->show();
} else {
trayIconTransfers->hide();
}
}
void MainWindow::updateStatus()
{
// This call is essential to remove locks due to QEventLoop re-entrance while asking gpg passwds. Dont' remove it!
@ -935,6 +960,13 @@ void MainWindow::trayIconChatClicked(QSystemTrayIcon::ActivationReason e)
}
}
void MainWindow::trayIconTransfersClicked(QSystemTrayIcon::ActivationReason e)
{
if(e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick) {
showWindow(MainWindow::Transfers);
}
}
void MainWindow::toggleVisibilitycontextmenu()
{
if (isVisible())