mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-04 07:05:26 -04:00
Merge branch 'master' into gxs_mail_experiments
This commit is contained in:
commit
5159e326c7
335 changed files with 12307 additions and 24670 deletions
|
@ -48,6 +48,7 @@
|
|||
#include "gui/common/FilesDefs.h"
|
||||
#include "gui/common/Emoticons.h"
|
||||
#include "gui/chat/ChatLobbyDialog.h"
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "util/misc.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "gui/chat/ChatUserNotify.h"//For BradCast
|
||||
|
@ -65,6 +66,8 @@
|
|||
|
||||
#define FMM 2.5//fontMetricsMultiplicator
|
||||
|
||||
#define PERSONID "PersonId:"
|
||||
|
||||
/*****
|
||||
* #define CHAT_DEBUG 1
|
||||
*****/
|
||||
|
@ -76,7 +79,7 @@ ChatWidget::ChatWidget(QWidget *parent) :
|
|||
|
||||
int iconHeight = FMM*QFontMetricsF(font()).height() ;
|
||||
QSize iconSize = QSize(iconHeight,iconHeight);
|
||||
QSize buttonSize = QSize(iconSize + QSize(FMM,FMM));
|
||||
QSize buttonSize = QSize(iconSize + QSize((int)FMM,(int)FMM));
|
||||
|
||||
newMessages = false;
|
||||
typing = false;
|
||||
|
@ -258,7 +261,7 @@ void ChatWidget::addChatBarWidget(QWidget *w)
|
|||
{
|
||||
int iconHeight = FMM*QFontMetricsF(font()).height() ;
|
||||
QSize iconSize = QSize(iconHeight,iconHeight);
|
||||
QSize buttonSize = QSize(iconSize + QSize(FMM,FMM));
|
||||
QSize buttonSize = QSize(iconSize + QSize((int)FMM,(int)FMM));
|
||||
w->setFixedSize(buttonSize);
|
||||
ui->pluginButtonFrame->layout()->addWidget(w) ;
|
||||
}
|
||||
|
@ -578,6 +581,9 @@ bool ChatWidget::eventFilter(QObject *obj, QEvent *event)
|
|||
if (ui->textBrowser->checkImage(helpEvent->pos(), imageStr)) {
|
||||
toolTipText = imageStr;
|
||||
}
|
||||
} else if (toolTipText.startsWith(PERSONID)){
|
||||
toolTipText = toolTipText.replace(PERSONID, tr("Person id: ") );
|
||||
toolTipText = toolTipText.append(tr("\nDouble click on it to add his name on text writer.") );
|
||||
}
|
||||
}
|
||||
if (!toolTipText.isEmpty()){
|
||||
|
@ -655,6 +661,39 @@ bool ChatWidget::eventFilter(QObject *obj, QEvent *event)
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (obj == ui->textBrowser->viewport()) {
|
||||
if (event->type() == QEvent::MouseButtonDblClick) {
|
||||
|
||||
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
|
||||
QTextCursor cursor = ui->textBrowser->cursorForPosition(mouseEvent->pos());
|
||||
cursor.select(QTextCursor::WordUnderCursor);
|
||||
if (!cursor.selectedText().isEmpty()){
|
||||
QRegExp rx("<a name=\"(.*)\"",Qt::CaseSensitive, QRegExp::RegExp2);
|
||||
rx.setMinimal(true);
|
||||
QString sel=cursor.selection().toHtml();
|
||||
QStringList anchors;
|
||||
int pos=0;
|
||||
while ((pos = rx.indexIn(sel,pos)) != -1) {
|
||||
anchors << rx.cap(1);
|
||||
pos += rx.matchedLength();
|
||||
}
|
||||
|
||||
if (!anchors.isEmpty()){
|
||||
if (anchors.at(0).startsWith(PERSONID)){
|
||||
RsGxsId mId = RsGxsId(QString(anchors.at(0)).replace(PERSONID,"").toStdString());
|
||||
if(!mId.isNull()) {
|
||||
RsIdentityDetails details;
|
||||
if (rsIdentity->getIdDetails(mId, details)){
|
||||
QString text = QString("@").append(GxsIdDetails::getName(details)).append(" ");
|
||||
ui->chatTextEdit->textCursor().insertText(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
if (event->type() == QEvent::WindowActivate) {
|
||||
if (isVisible() && (window() == NULL || window()->isActiveWindow())) {
|
||||
|
@ -954,9 +993,13 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const RsGxsId gx
|
|||
formatMsg.replace(QString("<a name=\"time\">"),QString("<a name=\"%1\">").arg(timeStamp));
|
||||
//replace Name anchors with GXS Id
|
||||
QString strGxsId = "";
|
||||
if (!gxsId.isNull())
|
||||
if (!gxsId.isNull()) {
|
||||
strGxsId = QString::fromStdString(gxsId.toStdString());
|
||||
formatMsg.replace(QString("<a name=\"name\">"),QString("<a name=\"Person Id: %1\">").arg(strGxsId));
|
||||
formatMsg.replace(QString("<a name=\"name\">")
|
||||
,QString("<a name=\"").append(PERSONID).append("%1\">").arg(strGxsId) );
|
||||
} else {
|
||||
formatMsg.replace(QString("<a name=\"name\">"),"");
|
||||
}
|
||||
|
||||
QTextCursor textCursor = QTextCursor(ui->textBrowser->textCursor());
|
||||
textCursor.movePosition(QTextCursor::End);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue