2012-03-30 19:02:52 -04:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 RetroShare Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#include "ChatToaster.h"
|
|
|
|
#include "gui/chat/ChatDialog.h"
|
2012-05-11 20:40:53 -04:00
|
|
|
#include "util/HandleRichText.h"
|
2012-03-30 19:02:52 -04:00
|
|
|
|
|
|
|
#include <retroshare/rspeers.h>
|
|
|
|
|
2014-12-29 16:41:05 -05:00
|
|
|
ChatToaster::ChatToaster(const RsPeerId &peer_id, const QString &message) : QWidget(NULL), mPeerId(peer_id)
|
2012-03-30 19:02:52 -04:00
|
|
|
{
|
|
|
|
/* Invoke the Qt Designer generated object setup routine */
|
|
|
|
ui.setupUi(this);
|
|
|
|
|
2012-09-03 06:58:11 -04:00
|
|
|
connect(ui.toasterButton, SIGNAL(clicked()), SLOT(chatButtonSlot()));
|
2012-03-30 19:02:52 -04:00
|
|
|
connect(ui.closeButton, SIGNAL(clicked()), SLOT(hide()));
|
|
|
|
|
|
|
|
/* set informations */
|
2017-01-19 08:01:54 -05:00
|
|
|
//ui.textLabel->setText(RsHtml().formatText(NULL, message, RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS | RSHTML_FORMATTEXT_CLEANSTYLE));
|
|
|
|
// emoticons disabled because they kill performance.
|
|
|
|
ui.textLabel->setText(RsHtml().formatText(NULL, message, RSHTML_FORMATTEXT_CLEANSTYLE));
|
2014-12-29 16:41:05 -05:00
|
|
|
ui.toasterLabel->setText(QString::fromUtf8(rsPeers->getPeerName(mPeerId).c_str()));
|
2012-03-30 19:02:52 -04:00
|
|
|
ui.avatarWidget->setFrameType(AvatarWidget::STATUS_FRAME);
|
2015-02-07 17:43:53 -05:00
|
|
|
ui.avatarWidget->setId(ChatId(mPeerId));
|
2012-03-30 19:02:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void ChatToaster::chatButtonSlot()
|
|
|
|
{
|
2014-12-29 16:41:05 -05:00
|
|
|
ChatDialog::chatFriend(ChatId(mPeerId));
|
2012-03-30 19:02:52 -04:00
|
|
|
hide();
|
|
|
|
}
|