2007-11-14 22:18:48 -05:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006,2007 crypton
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
****************************************************************/
|
2010-05-05 18:03:43 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
#include "ChatToaster.h"
|
|
|
|
|
|
|
|
#include "ui_ChatToaster.h"
|
|
|
|
|
|
|
|
#include "QtToaster.h"
|
|
|
|
|
2010-05-05 18:03:43 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
#include <QtGui/QtGui>
|
2010-05-05 18:03:43 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
ChatToaster::ChatToaster()
|
|
|
|
: QObject(NULL) {
|
|
|
|
|
|
|
|
_chatToasterWidget = new QWidget(NULL);
|
2010-05-05 18:03:43 -04:00
|
|
|
|
|
|
|
_ui = new Ui::ChatToaster();
|
|
|
|
_ui->setupUi(_chatToasterWidget);
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
_ui->chatButton->setPixmaps(QPixmap(":/images/toaster/chat.png"),
|
|
|
|
QPixmap(),
|
|
|
|
QPixmap(),
|
|
|
|
QPixmap(":/images/toaster/chat.png"),
|
|
|
|
QPixmap(),
|
|
|
|
QPixmap());
|
2010-05-05 18:03:43 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
connect(_ui->chatButton, SIGNAL(clicked()), SLOT(chatButtonSlot()));
|
|
|
|
|
|
|
|
connect(_ui->closeButton, SIGNAL(clicked()), SLOT(close()));
|
|
|
|
|
2010-05-05 18:03:43 -04:00
|
|
|
_toaster = new QtToaster(this, _chatToasterWidget, _ui->windowFrame);
|
|
|
|
_toaster->setTimeOnTop(5000);
|
|
|
|
}
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
ChatToaster::~ChatToaster() {
|
|
|
|
delete(_ui);
|
|
|
|
}
|
2010-05-05 18:03:43 -04:00
|
|
|
|
|
|
|
void ChatToaster::setMessage(const QString & message) {
|
|
|
|
_ui->messageLabel->setText(message);
|
|
|
|
}
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
void ChatToaster::setPixmap(const QPixmap & pixmap) {
|
|
|
|
_ui->pixmapLabel->setPixmap(pixmap);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChatToaster::show() {
|
|
|
|
_toaster->show();
|
|
|
|
}
|
2010-05-05 18:03:43 -04:00
|
|
|
|
|
|
|
void ChatToaster::close() {
|
|
|
|
_toaster->close();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChatToaster::chatButtonSlot() {
|
|
|
|
chatButtonClicked();
|
|
|
|
close();
|
|
|
|
}
|