示例#1
0
ChatLobbyToaster::ChatLobbyToaster(const std::string &peerId, const QString &name, const QString &message) : QWidget(NULL)
{
	/* Invoke the Qt Designer generated object setup routine */
	ui.setupUi(this);

	this->peerId = peerId;

	connect(ui.toasterButton, SIGNAL(clicked()), SLOT(chatButtonSlot()));
	connect(ui.closeButton, SIGNAL(clicked()), SLOT(hide()));

	/* set informations */
	ui.textLabel->setText(RsHtml().formatText(NULL, message, RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS | RSHTML_FORMATTEXT_CLEANSTYLE));
	ui.avatarWidget->setFrameType(AvatarWidget::NORMAL_FRAME);
	ui.avatarWidget->setDefaultAvatar(":images/chat_64.png");

	QString lobbyName = RsHtml::plainText(name);

	std::list<ChatLobbyInfo> linfos;
	rsMsgs->getChatLobbyList(linfos);

	ChatLobbyId lobbyId;
	if (rsMsgs->isLobbyId(peerId, lobbyId)) {
		for (std::list<ChatLobbyInfo>::const_iterator it(linfos.begin()); it != linfos.end(); ++it) {
			if ((*it).lobby_id == lobbyId) {
				lobbyName += "@" + RsHtml::plainText(it->lobby_name);
				break;
			}
		}
	}
	ui.toasterLabel->setText(lobbyName);
}
OnlineToaster::OnlineToaster()
    : QObject(NULL) {

    _onlineToasterWidget = new QWidget(NULL);

    _ui = new Ui::OnlineToaster();
    _ui->setupUi(_onlineToasterWidget);

    connect(_ui->chatButton, SIGNAL(clicked()), SLOT(chatButtonSlot()));

    _toaster = new QtToaster(_onlineToasterWidget);
    _toaster->setTimeOnTop(5000);
}
示例#3
0
ForumsToaster::ForumsToaster()
	: QObject(NULL) {

	_ForumsToasterWidget = new QWidget(NULL);

	_ui = new Ui::ForumsToaster();
	_ui->setupUi(_ForumsToasterWidget);

	connect(_ui->messageButton, SIGNAL(clicked()), SLOT(chatButtonSlot()));

	connect(_ui->closeButton, SIGNAL(clicked()), SLOT(close()));

	_toaster = new QtToaster(_ForumsToasterWidget, _ui->windowFrame);
	_toaster->setTimeOnTop(5000);
}
示例#4
0
GroupChatToaster::GroupChatToaster(const RsPeerId &peerId, const QString &message) : QWidget(NULL)
{
	/* Invoke the Qt Designer generated object setup routine */
	ui.setupUi(this);

	this->peerId = peerId;

	connect(ui.toasterButton, SIGNAL(clicked()), SLOT(chatButtonSlot()));
	connect(ui.closeButton, SIGNAL(clicked()), SLOT(hide()));

	/* set informations */
	ui.textLabel->setText(RsHtml().formatText(NULL, message, RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS | RSHTML_FORMATTEXT_CLEANSTYLE));
	ui.toasterLabel->setText(QString::fromUtf8(rsPeers->getPeerName(peerId).c_str()));
	ui.avatarWidget->setFrameType(AvatarWidget::STATUS_FRAME);
	ui.avatarWidget->setDefaultAvatar(":/images/user/personal64.png");
    ui.avatarWidget->setId(ChatId(peerId));
}
示例#5
0
ChatLobbyToaster::ChatLobbyToaster(const ChatLobbyId &lobby_id, const QString &name, const QString &message):
    QWidget(NULL), mLobbyId(lobby_id)
{
	/* Invoke the Qt Designer generated object setup routine */
	ui.setupUi(this);

	connect(ui.toasterButton, SIGNAL(clicked()), SLOT(chatButtonSlot()));
	connect(ui.closeButton, SIGNAL(clicked()), SLOT(hide()));

	/* set informations */
	ui.textLabel->setText(RsHtml().formatText(NULL, message, RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS | RSHTML_FORMATTEXT_CLEANSTYLE));
	ui.avatarWidget->setFrameType(AvatarWidget::NORMAL_FRAME);
	ui.avatarWidget->setDefaultAvatar(":images/chat_64.png");

	QString lobbyName = RsHtml::plainText(name);

    ChatLobbyInfo clinfo ;
    if(rsMsgs->getChatLobbyInfo(mLobbyId,clinfo))
            lobbyName += "@" + RsHtml::plainText(clinfo.lobby_name);

	ui.toasterLabel->setText(lobbyName);
}