mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-19 20:04:24 -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
5 changed files with 24 additions and 0 deletions
|
@ -340,6 +340,11 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||||
timer->start(1000);
|
timer->start(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::displaySystrayMsg(const QString& title,const QString& msg)
|
||||||
|
{
|
||||||
|
trayIcon->showMessage(title, msg, QSystemTrayIcon::Information, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::updateStatus()
|
void MainWindow::updateStatus()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -139,6 +139,7 @@ private slots:
|
||||||
void showsmplayer();
|
void showsmplayer();
|
||||||
void showabout();
|
void showabout();
|
||||||
void openShareManager();
|
void openShareManager();
|
||||||
|
void displaySystrayMsg(const QString&,const QString&) ;
|
||||||
|
|
||||||
/** Displays the help browser and displays the most recently viewed help
|
/** Displays the help browser and displays the most recently viewed help
|
||||||
* topic. */
|
* topic. */
|
||||||
|
|
|
@ -707,6 +707,20 @@ void PeersDialog::insertChat()
|
||||||
|
|
||||||
extraTxt += QString::fromStdWString(it->msg);
|
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 */
|
/* add it everytime */
|
||||||
currenttxt += extraTxt;
|
currenttxt += extraTxt;
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,7 @@ private slots:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void friendsUpdated() ;
|
void friendsUpdated() ;
|
||||||
|
void notifyGroupChat(const QString&,const QString&) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -177,6 +177,9 @@ int main(int argc, char *argv[])
|
||||||
QObject::connect(ConfCertDialog::instance(),SIGNAL(configChanged()),w->networkDialog,SLOT(insertConnect())) ;
|
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(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 */
|
/* only show window, if not startMinimized */
|
||||||
RshareSettings *_settings = new RshareSettings();
|
RshareSettings *_settings = new RshareSettings();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue