Removed peer name from "is typing..." message of the sender and add it of the receiver side.

Now the "is typing..." message can be translated.
It is still not a good solution, but it works for now.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3408 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-08-30 18:33:19 +00:00
parent 7b20984574
commit 77418bd4b6
6 changed files with 54 additions and 40 deletions

View File

@ -1003,27 +1003,33 @@ void PeersDialog::resetStatusBar()
void PeersDialog::updateStatusTyping()
{
if(time(NULL) - last_status_send_time > 5) // limit 'peer is typing' packets to at most every 10 sec
{
#ifdef PEERS_DEBUG
std::cerr << "PeersDialog: sending group chat typing info." << std::endl ;
#endif
if(time(NULL) - last_status_send_time > 5) // limit 'peer is typing' packets to at most every 10 sec
{
#ifdef PEERS_DEBUG
std::cerr << "PeersDialog: sending group chat typing info." << std::endl ;
#endif
rsMsgs->sendGroupChatStatusString(rsiface->getConfig().ownName + " is typing...");
last_status_send_time = time(NULL) ;
}
#ifdef ONLY_FOR_LINGUIST
tr("is typing...");
#endif
rsMsgs->sendGroupChatStatusString("is typing...");
last_status_send_time = time(NULL) ;
}
}
// Called by libretroshare through notifyQt to display the peer's status
//
void PeersDialog::updateStatusString(const QString& status_string)
void PeersDialog::updateStatusString(const QString& peer_id, const QString& status_string)
{
#ifdef PEERS_DEBUG
std::cerr << "PeersDialog: received group chat typing info. updating gui." << std::endl ;
#endif
#ifdef PEERS_DEBUG
std::cerr << "PeersDialog: received group chat typing info. updating gui." << std::endl ;
#endif
ui.statusStringLabel->setText(status_string) ; // displays info for 5 secs.
QString status = QString::fromStdString(rsPeers->getPeerName(peer_id.toStdString())) + " " + tr(status_string.toAscii());
ui.statusStringLabel->setText(status) ; // displays info for 5 secs.
QTimer::singleShot(5000,this,SLOT(resetStatusBar())) ;
QTimer::singleShot(5000,this,SLOT(resetStatusBar())) ;
}
void PeersDialog::updatePeersCustomStateString(const QString& peer_id)
@ -1050,19 +1056,19 @@ void PeersDialog::updatePeersAvatar(const QString& peer_id)
void PeersDialog::updatePeerStatusString(const QString& peer_id,const QString& status_string,bool is_private_chat)
{
if(is_private_chat)
{
PopupChatDialog *pcd = PopupChatDialog::getPrivateChat(peer_id.toStdString(),rsPeers->getPeerName(peer_id.toStdString()), 0);
pcd->updateStatusString(status_string);
}
else
{
#ifdef PEERS_DEBUG
std::cerr << "Updating public chat msg from peer " << rsPeers->getPeerName(peer_id.toStdString()) << ": " << status_string.toStdString() << std::endl ;
#endif
if(is_private_chat)
{
PopupChatDialog *pcd = PopupChatDialog::getPrivateChat(peer_id.toStdString(),rsPeers->getPeerName(peer_id.toStdString()), 0);
pcd->updateStatusString(peer_id, status_string);
}
else
{
#ifdef PEERS_DEBUG
std::cerr << "Updating public chat msg from peer " << rsPeers->getPeerName(peer_id.toStdString()) << ": " << status_string.toStdString() << std::endl ;
#endif
updateStatusString(status_string) ;
}
updateStatusString(peer_id, status_string);
}
}
void PeersDialog::insertChat()

View File

@ -100,7 +100,7 @@ private slots:
/** Create the context popup menu and it's submenus */
void peertreeWidgetCostumPopupMenu( QPoint point );
void updateStatusString(const QString& statusString) ; // called when a peer is typing in group chat
void updateStatusString(const QString& peer_id, const QString& statusString) ; // called when a peer is typing in group chat
void updateStatusTyping() ; // called each time a key is hit
//void updatePeerStatusString(const QString& peer_id,const QString& chat_status) ;

View File

@ -176,13 +176,10 @@ PopupChatDialog::~PopupChatDialog()
{
// save settings
processSettings(false);
}
void PopupChatDialog::processSettings(bool bLoad)
{
Settings->beginGroup(QString("ChatDialog"));
if (bLoad) {
@ -365,22 +362,25 @@ void PopupChatDialog::resetStatusBar()
void PopupChatDialog::updateStatusTyping()
{
if(time(NULL) - last_status_send_time > 5) // limit 'peer is typing' packets to at most every 10 sec
{
if (time(NULL) - last_status_send_time > 5) // limit 'peer is typing' packets to at most every 10 sec
{
#ifdef ONLY_FOR_LINGUIST
tr("is typing...");
#endif
rsMsgs->sendStatusString(dialogId, rsiface->getConfig().ownName + " is typing...");
last_status_send_time = time(NULL) ;
}
rsMsgs->sendStatusString(dialogId, "is typing...");
last_status_send_time = time(NULL) ;
}
}
// Called by libretroshare through notifyQt to display the peer's status
//
void PopupChatDialog::updateStatusString(const QString& status_string)
void PopupChatDialog::updateStatusString(const QString& peer_id, const QString& status_string)
{
//statusBar()->showMessage(status_string,5000) ; // displays info for 5 secs.
ui.statusLabel->setText(status_string) ; // displays info for 5 secs.
QString status = QString::fromStdString(rsPeers->getPeerName(peer_id.toStdString())) + " " + tr(status_string.toAscii());
ui.statusLabel->setText(status) ; // displays info for 5 secs.
QTimer::singleShot(5000,this,SLOT(resetStatusBar())) ;
QTimer::singleShot(5000,this,SLOT(resetStatusBar())) ;
}
/**

View File

@ -71,7 +71,7 @@ public slots:
void resetStatusBar() ;
void updateStatusTyping() ;
void updateStatusString(const QString&) ;
void updateStatusString(const QString& peer_id, const QString& statusString) ;
void anchorClicked (const QUrl &);
void updateStatus(const QString &peer_id, int status);

View File

@ -7399,6 +7399,10 @@ p, li { white-space: pre-wrap; }
<source>Paste Person Link</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>is typing...</source>
<translation type="unfinished">tippt...</translation>
</message>
</context>
<context>
<name>PeersFeed</name>
@ -7907,6 +7911,10 @@ p, li { white-space: pre-wrap; }
<source>Messages you send will be lost and not delivered, rs-Mail this contact instead.</source>
<translation>Nachrichten, die Sie versenden gehen bei diesem Kontakt nicht ein. Diesem Kontakt stattdessen eine RS-Mail senden.</translation>
</message>
<message>
<source>is typing...</source>
<translation type="unfinished">tippt...</translation>
</message>
</context>
<context>
<name>PrintPreview</name>