mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
added systray notification for group chat
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1367 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a2c29ba507
commit
72112fb54c
@ -340,6 +340,11 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
timer->start(1000);
|
||||
}
|
||||
|
||||
void MainWindow::displaySystrayMsg(const QString& title,const QString& msg)
|
||||
{
|
||||
trayIcon->showMessage(title, msg, QSystemTrayIcon::Information, 1000);
|
||||
}
|
||||
|
||||
void MainWindow::updateStatus()
|
||||
{
|
||||
|
||||
|
@ -139,6 +139,7 @@ private slots:
|
||||
void showsmplayer();
|
||||
void showabout();
|
||||
void openShareManager();
|
||||
void displaySystrayMsg(const QString&,const QString&) ;
|
||||
|
||||
/** Displays the help browser and displays the most recently viewed help
|
||||
* topic. */
|
||||
|
@ -707,6 +707,20 @@ void PeersDialog::insertChat()
|
||||
|
||||
extraTxt += QString::fromStdWString(it->msg);
|
||||
|
||||
// notify with a systray icon msg
|
||||
if(it->rsid != rsPeers->getOwnId())
|
||||
{
|
||||
QTextEdit editor ;
|
||||
editor.setHtml(QString::fromStdWString(it->msg));
|
||||
QString notifyMsg(QString::fromStdString(it->name)+": "+editor.toPlainText()) ;
|
||||
|
||||
if(notifyMsg.length() > 30)
|
||||
emit notifyGroupChat(QString("New group chat"), notifyMsg.left(30)+QString("..."));
|
||||
else
|
||||
emit notifyGroupChat(QString("New group chat"), notifyMsg);
|
||||
}
|
||||
|
||||
|
||||
/* add it everytime */
|
||||
currenttxt += extraTxt;
|
||||
|
||||
|
@ -106,6 +106,7 @@ private slots:
|
||||
|
||||
signals:
|
||||
void friendsUpdated() ;
|
||||
void notifyGroupChat(const QString&,const QString&) ;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -177,6 +177,9 @@ int main(int argc, char *argv[])
|
||||
QObject::connect(ConfCertDialog::instance(),SIGNAL(configChanged()),w->networkDialog,SLOT(insertConnect())) ;
|
||||
QObject::connect(w->peersDialog,SIGNAL(friendsUpdated()),w->networkDialog,SLOT(insertConnect())) ;
|
||||
|
||||
|
||||
QObject::connect(w->peersDialog,SIGNAL(notifyGroupChat(const QString&,const QString&)),w,SLOT(displaySystrayMsg(const QString&,const QString&))) ;
|
||||
|
||||
/* only show window, if not startMinimized */
|
||||
RshareSettings *_settings = new RshareSettings();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user