Completely reworked the toasters. Now there is only one place that moves the toaster and the toasters are stacked.

Removed the chat and call toaster.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3900 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-12-08 00:14:12 +00:00
parent 9bb5f304b7
commit 2a69abe570
21 changed files with 357 additions and 2329 deletions

View File

@ -41,8 +41,8 @@ const uint32_t RS_SYS_WARNING = 0x0002;
const uint32_t RS_SYS_INFO = 0x0004;
const uint32_t RS_POPUP_MSG = 0x0001;
const uint32_t RS_POPUP_CHAT = 0x0002;
const uint32_t RS_POPUP_CALL = 0x0004;
//const uint32_t RS_POPUP_CHAT = 0x0002;
//const uint32_t RS_POPUP_CALL = 0x0004;
const uint32_t RS_POPUP_CONNECT = 0x0008;
const uint32_t RS_SYSTRAY_GROUP_MSG = 0x0010;
const uint32_t RS_POPUP_DOWNLOAD = 0x0020;

View File

@ -273,11 +273,7 @@ HEADERS += rshare.h \
gui/settings/AddFileAssociationDialog.h \
gui/toaster/MessageToaster.h \
gui/toaster/OnlineToaster.h \
gui/toaster/ChatToaster.h \
gui/toaster/DownloadToaster.h \
gui/toaster/CallToaster.h \
gui/toaster/QtToaster.h \
gui/toaster/IQtToaster.h \
gui/toaster/RetroStyleLabelProxy.h \
gui/common/vmessagebox.h \
gui/common/rwindow.h \
@ -377,8 +373,6 @@ FORMS += gui/StartDialog.ui \
gui/settings/TransferPage.ui \
gui/settings/SoundPage.ui \
gui/settings/ChatPage.ui \
gui/toaster/CallToaster.ui \
gui/toaster/ChatToaster.ui \
gui/toaster/MessageToaster.ui \
gui/toaster/OnlineToaster.ui \
gui/toaster/DownloadToaster.ui \
@ -515,12 +509,9 @@ SOURCES += main.cpp \
gui/statusbar/dhtstatus.cpp \
gui/statusbar/ratesstatus.cpp \
gui/statusbar/hashingstatus.cpp \
gui/toaster/ChatToaster.cpp \
gui/toaster/MessageToaster.cpp \
gui/toaster/DownloadToaster.cpp \
gui/toaster/CallToaster.cpp \
gui/toaster/OnlineToaster.cpp \
gui/toaster/QtToaster.cpp \
gui/advsearch/advancedsearchdialog.cpp \
gui/advsearch/expressionwidget.cpp \
gui/advsearch/guiexprelement.cpp \

View File

@ -1,5 +1,29 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2010 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 <QInputDialog>
#include <QMessageBox>
#include <QTimer>
//#include <QMutexLocker>
#include <QDesktopWidget>
#include "notifyqt.h"
#include <retroshare/rsnotify.h>
@ -10,14 +34,12 @@
#include <retroshare/rsturtle.h>
#endif
#include "gui/RsAutoUpdatePage.h"
#include "RsAutoUpdatePage.h"
#ifndef MINIMAL_RSGUI
#include "gui/toaster/OnlineToaster.h"
#include "gui/toaster/MessageToaster.h"
#include "gui/toaster/ChatToaster.h"
#include "gui/toaster/CallToaster.h"
#include "gui/toaster/DownloadToaster.h"
#include "toaster/OnlineToaster.h"
#include "toaster/MessageToaster.h"
#include "toaster/DownloadToaster.h"
#endif // MINIMAL_RSGUI
#include "gui/settings/rsharesettings.h"
@ -30,6 +52,40 @@
* #define NOTIFY_DEBUG
****/
class Toaster
{
public:
Toaster(QWidget *widget)
{
this->widget = widget;
/* Standard values */
timeToShow = 500;
timeToLive = 3000;
timeToHide = 500;
/* Calculated values */
elapsedTimeToShow = 0;
elapsedTimeToLive = 0;
elapsedTimeToHide = 0;
}
public:
QWidget *widget;
/* Standard values */
int timeToShow;
int timeToLive;
int timeToHide;
/* Calculated values */
QPoint startPos;
QPoint endPos;
int elapsedTimeToShow;
int elapsedTimeToLive;
int elapsedTimeToHide;
};
/*static*/ NotifyQt *NotifyQt::_instance = NULL;
/*static*/ NotifyQt *NotifyQt::Create ()
@ -46,6 +102,14 @@
return _instance;
}
NotifyQt::NotifyQt() : cDialog(NULL)
{
runningToasterTimer = new QTimer(this);
connect(runningToasterTimer, SIGNAL(timeout()), this, SLOT(runningTick()));
runningToasterTimer->setInterval(10); // tick 100 times a second
runningToasterTimer->setSingleShot(true);
}
void NotifyQt::notifyErrorMsg(int list, int type, std::string msg)
{
emit errorOccurred(list,type,QString::fromStdString(msg)) ;
@ -373,6 +437,9 @@ void NotifyQt::UpdateGUI()
{
uint popupflags = Settings->getNotifyFlags();
/* You can set timeToShow, timeToLive and timeToHide or can leave the standard */
Toaster *toaster = NULL;
/* id the name */
std::string name;
std::string realmsg;
@ -391,59 +458,32 @@ void NotifyQt::UpdateGUI()
switch(type)
{
case RS_POPUP_MSG:
if (popupflags & RS_POPUP_MSG)
{
MessageToaster * msgToaster = new MessageToaster();
msgToaster->setMessage(QString::fromStdString(msg));
msgToaster->setName(QString::fromStdString(realmsg));
msgToaster->setTitle(QString::fromStdString(title));
msgToaster->displayPopup();
}
if (popupflags & RS_POPUP_MSG)
{
toaster = new Toaster(new MessageToaster(QString::fromStdString(realmsg), QString::fromStdString(title), QString::fromStdString(msg)));
}
break;
case RS_POPUP_CHAT:
if (popupflags & RS_POPUP_CHAT)
{
ChatToaster * chatToaster = new ChatToaster();
chatToaster->setMessage(QString::fromStdString(realmsg));
chatToaster->show();
}
break;
case RS_POPUP_CALL:
if (popupflags & RS_POPUP_CALL)
{
CallToaster * callToaster = new CallToaster();
callToaster->setMessage(QString::fromStdString(realmsg));
callToaster->show();
}
break;
default:
case RS_POPUP_CONNECT:
if (popupflags & RS_POPUP_CONNECT)
{
OnlineToaster * onlineToaster = new OnlineToaster();
onlineToaster->setMessage(QString::fromStdString(realmsg));
if(size != 0)
if (popupflags & RS_POPUP_CONNECT)
{
// set the image
QPixmap pix ;
pix.loadFromData(data,size,"PNG") ;
onlineToaster->setPixmap(pix);
}
else
{
onlineToaster->setPixmap(QPixmap(":/images/user/personal64.png"));
}
QPixmap avatar;
if(size != 0)
{
// set the image
avatar.loadFromData(data,size,"PNG");
}
else
{
avatar = QPixmap(":/images/user/personal64.png");
}
onlineToaster->show();
onlineToaster->play();
}
toaster = new Toaster(new OnlineToaster(id, QString::fromStdString(realmsg), avatar));
}
break;
case RS_POPUP_DOWNLOAD:
if (popupflags & RS_POPUP_DOWNLOAD)
{
DownloadToaster *downloadToaster = new DownloadToaster();
downloadToaster->displayPopup(id, QString::fromUtf8(title.c_str()));
toaster = new Toaster(new DownloadToaster(id, QString::fromUtf8(title.c_str())));
}
break;
}
@ -451,6 +491,15 @@ void NotifyQt::UpdateGUI()
if (data) {
delete[] data;
}
if (toaster) {
/* init attributes */
toaster->widget->setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
/* add toaster to waiting list */
// QMutexLocker lock(&waitingToasterMutex);
waitingToasterList.push_back(toaster);
}
}
if (rsNotify->NotifySysMessage(sysid, type, title, msg))
@ -476,6 +525,7 @@ void NotifyQt::UpdateGUI()
break;
}
}
if (rsNotify->NotifyLogMessage(sysid, type, title, msg))
{
/* make a log message */
@ -489,6 +539,10 @@ void NotifyQt::UpdateGUI()
}
}
}
/* Now start the waiting toasters */
startWaitingToasters();
#endif // MINIMAL_RSGUI
}
@ -496,7 +550,134 @@ void NotifyQt::notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType
{
emit chatStyleChanged(styleType);
}
void NotifyQt::startWaitingToasters()
{
{
// QMutexLocker lock(&waitingToasterMutex);
if (waitingToasterList.empty()) {
/* No toasters are waiting */
return;
}
}
{
// QMutexLocker lock(&runningToasterMutex);
if (runningToasterList.size() >= 3) {
/* Don't show more than 3 toasters at once */
return;
}
}
Toaster *toaster = NULL;
{
// QMutexLocker lock(&waitingToasterMutex);
if (waitingToasterList.size()) {
/* Take one toaster of the waiting list */
toaster = waitingToasterList.front();
waitingToasterList.pop_front();
}
}
if (toaster) {
/* 10 pixels of x margin */
static const int MARGIN_X = 10;
/* 10 pixels of y margin */
static const int MARGIN_Y = 10;
// QMutexLocker lock(&runningToasterMutex);
/* Calculate positions */
QSize size = toaster->widget->size();
QDesktopWidget *desktop = QApplication::desktop();
QRect screenGeometry = desktop->screenGeometry(desktop->primaryScreen());
QRect desktopGeometry = desktop->availableGeometry(desktop->primaryScreen());
/* From bottom */
toaster->startPos = QPoint(screenGeometry.right() - size.width() - MARGIN_X, screenGeometry.bottom());
toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.bottom() - size.height() - MARGIN_Y);
/* From top */
// toaster->startPos = QPoint(screenGeometry.right() - size.width() - MARGIN_X, screenGeometry.top() - size.height());
// toaster->endPos = QPoint(toaster->startPos.x(), desktopGeometry.top() + MARGIN_Y);
/* Initialize widget */
toaster->widget->move(toaster->startPos);
toaster->widget->show();
/* Initialize toaster */
toaster->elapsedTimeToShow = 0;
toaster->elapsedTimeToLive = 0;
toaster->elapsedTimeToHide = 0;
/* Add toaster to the running list */
runningToasterList.push_front(toaster);
if (runningToasterTimer->isActive() == false) {
/* Start the toaster timer */
runningToasterTimer->start();
}
}
}
void NotifyQt::runningTick()
{
// QMutexLocker lock(&runningToasterMutex);
int interval = runningToasterTimer->interval();
QPoint diff;
QList<Toaster*>::iterator it = runningToasterList.begin();
while (it != runningToasterList.end()) {
Toaster *toaster = *it;
bool visible = toaster->widget->isVisible();
if (visible && toaster->elapsedTimeToShow <= toaster->timeToShow) {
/* Toaster is showing */
toaster->elapsedTimeToShow += interval;
QPoint newPos(toaster->startPos.x() - (toaster->startPos.x() - toaster->endPos.x()) * toaster->elapsedTimeToShow / toaster->timeToShow,
toaster->startPos.y() - (toaster->startPos.y() - toaster->endPos.y()) * toaster->elapsedTimeToShow / toaster->timeToShow);
toaster->widget->move(newPos + diff);
diff += newPos - toaster->startPos;
} else if (visible && toaster->elapsedTimeToLive <= toaster->timeToLive) {
/* Toaster is living */
toaster->elapsedTimeToLive += interval;
toaster->widget->move(toaster->endPos + diff);
diff += toaster->endPos - toaster->startPos;
} else if (visible && toaster->elapsedTimeToHide <= toaster->timeToHide) {
/* Toaster is hiding */
toaster->elapsedTimeToHide += interval;
QPoint newPos(toaster->startPos.x() - (toaster->startPos.x() - toaster->endPos.x()) * (toaster->timeToHide - toaster->elapsedTimeToHide) / toaster->timeToHide,
toaster->startPos.y() - (toaster->startPos.y() - toaster->endPos.y()) * (toaster->timeToHide - toaster->elapsedTimeToHide) / toaster->timeToHide);
toaster->widget->move(newPos + diff);
diff += newPos - toaster->startPos;
} else {
/* Toaster is hidden, delete it */
it = runningToasterList.erase(it);
delete(toaster->widget);
delete(toaster);
continue;
}
++it;
}
if (runningToasterList.size()) {
/* There are more running toasters, start the timer again */
runningToasterTimer->start();
}
}
//void NotifyQt::displaySearch()
//{
// iface->lockData(); /* Lock Interface */
@ -579,6 +760,3 @@ void NotifyQt::notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType
//
//
//}

View File

@ -4,9 +4,11 @@
#include <retroshare/rsiface.h>
#include <retroshare/rsturtle.h>
#include <QObject>
//#include <QMutex>
#include <string>
class QTimer;
class NetworkDialog;
class PeersDialog;
class SharedFilesDialog;
@ -15,6 +17,7 @@ class ChatDialog;
class MessagesDialog;
class ChannelsDialog;
class MessengerWindow;
class Toaster;
struct TurtleFileInfo;
//class NotifyQt: public NotifyBase, public QObject
@ -95,11 +98,23 @@ class NotifyQt: public QObject, public NotifyBase
void UpdateGUI(); /* called by timer */
private slots:
void runningTick();
private:
NotifyQt() : cDialog(NULL) { return; }
NotifyQt();
static NotifyQt *_instance;
void startWaitingToasters();
// QMutex waitingToasterMutex; // for lock of the waiting toaster list
QList<Toaster*> waitingToasterList;
QTimer *runningToasterTimer;
// QMutex runningToasterMutex; // for lock of the running toaster list
QList<Toaster*> runningToasterList;
// void displayNeighbours();
// void displayFriends();
// void displayDirectories();

View File

@ -22,16 +22,12 @@
#include <rshare.h>
#include "NotifyPage.h"
#include <iostream>
#include <sstream>
#include <retroshare/rsnotify.h>
#include "rsharesettings.h"
#include "gui/MainWindow.h"
#include <QTimer>
/** Constructor */
NotifyPage::NotifyPage(QWidget * parent, Qt::WFlags flags)
@ -76,12 +72,6 @@ NotifyPage::save(QString &errmsg)
if (ui.popup_DownloadFinished->isChecked())
notifyflags |= RS_POPUP_DOWNLOAD;
//if (ui.popup_NewChat->isChecked())
notifyflags |= RS_POPUP_CHAT;
//if (ui.popup_Call->isChecked())
// notifyflags |= RS_POPUP_CALL;
if (ui.notify_Peers->isChecked())
newsflags |= RS_FEED_TYPE_PEER;
if (ui.notify_Channels->isChecked())
@ -145,8 +135,6 @@ void NotifyPage::load()
ui.popup_Connect->setChecked(notifyflags & RS_POPUP_CONNECT);
ui.popup_NewMsg->setChecked(notifyflags & RS_POPUP_MSG);
ui.popup_DownloadFinished->setChecked(notifyflags & RS_POPUP_DOWNLOAD);
//ui.popup_NewChat->setChecked(notifyflags & RS_POPUP_CHAT);
//ui.popup_Call->setChecked(notifyflags & RS_POPUP_CALL);
ui.notify_Peers->setChecked(newsflags & RS_FEED_TYPE_PEER);
ui.notify_Channels->setChecked(newsflags & RS_FEED_TYPE_CHAN);

View File

@ -122,8 +122,7 @@ void RshareSettings::initSettings()
uint defChat = RS_CHAT_OPEN;
// This is not default... RS_CHAT_FOCUS.
uint defNotify = (RS_POPUP_CONNECT | RS_POPUP_MSG |
RS_POPUP_CHAT | RS_POPUP_CALL);
uint defNotify = (RS_POPUP_CONNECT | RS_POPUP_MSG);
uint defNewsFeed = (RS_FEED_TYPE_PEER | RS_FEED_TYPE_CHAN |
RS_FEED_TYPE_FORUM | RS_FEED_TYPE_BLOG |

View File

@ -1,97 +0,0 @@
/****************************************************************
* 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.
****************************************************************/
#include "CallToaster.h"
#include "QtToaster.h"
#include "ui_CallToaster.h"
//#include <util/SafeDelete.h>
//#include <util/SafeConnect.h>
#include <QtGui/QtGui>
CallToaster::CallToaster()
: QObject(NULL) {
_callToasterWidget = new QWidget(NULL);
_ui = new Ui::CallToaster();
_ui->setupUi(_callToasterWidget);
_ui->hangUpButton->setPixmaps(QPixmap(":/images/toaster/hangup.png"),
QPixmap(),
QPixmap(),
QPixmap(":/images/toaster/hangup.png"),
QPixmap(),
QPixmap());
_ui->pickUpButton->setPixmaps(QPixmap(":/images/toaster/pickup.png"),
QPixmap(),
QPixmap(),
QPixmap(":/images/toaster/pickup.png"),
QPixmap(),
QPixmap());
_ui->pickUpButton->setMinimumSize(QSize(48, 56));
_ui->pickUpButton->setMaximumSize(QSize(48, 56));
connect(_ui->pickUpButton, SIGNAL(clicked()), SLOT(pickUpButtonSlot()));
_ui->hangUpButton->setMinimumSize(QSize(28, 56));
_ui->hangUpButton->setMaximumSize(QSize(28, 56));
connect(_ui->hangUpButton, SIGNAL(clicked()), SLOT(hangUpButtonSlot()));
connect(_ui->closeButton, SIGNAL(clicked()), SLOT(close()));
_toaster = new QtToaster(this, _callToasterWidget, _ui->windowFrame);
_toaster->setTimeOnTop(10000);
}
CallToaster::~CallToaster() {
delete(_ui);
}
void CallToaster::setMessage(const QString & message) {
_ui->messageLabel->setText(message);
}
void CallToaster::setPixmap(const QPixmap & pixmap) {
_ui->pixmapLabel->setPixmap(pixmap);
}
void CallToaster::show() {
_toaster->show();
}
void CallToaster::close() {
_toaster->close();
}
void CallToaster::hangUpButtonSlot() {
hangUpButtonClicked();
close();
}
void CallToaster::pickUpButtonSlot() {
pickUpButtonClicked();
close();
}

View File

@ -1,80 +0,0 @@
/****************************************************************
* 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.
****************************************************************/
#ifndef CALLTOASTER_H
#define CALLTOASTER_H
#include "IQtToaster.h"
#include <QtCore/QObject>
class QtToaster;
class QWidget;
class QString;
class QPixmap;
namespace Ui { class CallToaster; }
/**
* Shows a toaster when a phone call is incoming.
*
*
*/
class CallToaster : public QObject, public IQtToaster {
Q_OBJECT
public:
CallToaster();
~CallToaster();
void setMessage(const QString & message);
void setPixmap(const QPixmap & pixmap);
void show();
public Q_SLOTS:
void close();
Q_SIGNALS:
void hangUpButtonClicked();
void pickUpButtonClicked();
private Q_SLOTS:
void hangUpButtonSlot();
void pickUpButtonSlot();
private:
Ui::CallToaster * _ui;
QWidget * _callToasterWidget;
QtToaster * _toaster;
};
#endif //CALLTOASTER_H

View File

@ -1,681 +0,0 @@
<ui version="4.0" >
<class>CallToaster</class>
<widget class="QWidget" name="CallToaster" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>0</number>
</property>
<item row="0" column="0" >
<widget class="QFrame" name="windowFrame" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>0</number>
</property>
<item row="2" column="0" >
<layout class="QGridLayout" >
<property name="margin" >
<number>6</number>
</property>
<property name="spacing" >
<number>0</number>
</property>
<item row="0" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3" >
<widget class="RetroStyleLabel" name="pickUpButton" >
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="pixmap" >
<pixmap resource="../images.qrc" >:/images/toaster/pickup.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="RetroStyleLabel" name="hangUpButton" >
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="pixmap" >
<pixmap resource="../images.qrc" >:/images/toaster/hangup.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="pixmapLabel" >
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="4" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="closeButton" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/close-down.png</iconset>
</property>
<property name="autoRaise" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" >
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>0</number>
</property>
<item row="0" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="messageLabel" >
<property name="palette" >
<palette>
<active>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>212</red>
<green>208</green>
<blue>200</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>234</red>
<green>229</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>141</red>
<green>139</green>
<blue>133</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>212</red>
<green>208</green>
<blue>200</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>64</red>
<green>64</green>
<blue>64</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>10</red>
<green>36</green>
<blue>106</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>212</red>
<green>208</green>
<blue>200</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>234</red>
<green>229</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>141</red>
<green>139</green>
<blue>133</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>212</red>
<green>208</green>
<blue>200</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>64</red>
<green>64</green>
<blue>64</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>212</red>
<green>208</green>
<blue>200</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>106</red>
<green>104</green>
<blue>100</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>212</red>
<green>208</green>
<blue>200</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>233</red>
<green>231</green>
<blue>227</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>141</red>
<green>139</green>
<blue>133</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>106</red>
<green>104</green>
<blue>100</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>106</red>
<green>104</green>
<blue>100</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>212</red>
<green>208</green>
<blue>200</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>212</red>
<green>208</green>
<blue>200</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>10</red>
<green>36</green>
<blue>106</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase" >
<brush brushstyle="SolidPattern" >
<color alpha="255" >
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text" >
<string>Message</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>RetroStyleLabel</class>
<extends>QLabel</extends>
<header>gui/toaster/RetroStyleLabelProxy.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc" />
</resources>
<connections/>
</ui>

View File

@ -1,77 +0,0 @@
/****************************************************************
* 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.
****************************************************************/
#include "ChatToaster.h"
#include "ui_ChatToaster.h"
#include "QtToaster.h"
#include <QtGui/QtGui>
ChatToaster::ChatToaster()
: QObject(NULL) {
_chatToasterWidget = new QWidget(NULL);
_ui = new Ui::ChatToaster();
_ui->setupUi(_chatToasterWidget);
_ui->chatButton->setPixmaps(QPixmap(":/images/toaster/chat.png"),
QPixmap(),
QPixmap(),
QPixmap(":/images/toaster/chat.png"),
QPixmap(),
QPixmap());
connect(_ui->chatButton, SIGNAL(clicked()), SLOT(chatButtonSlot()));
connect(_ui->closeButton, SIGNAL(clicked()), SLOT(close()));
_toaster = new QtToaster(this, _chatToasterWidget, _ui->windowFrame);
_toaster->setTimeOnTop(5000);
}
ChatToaster::~ChatToaster() {
delete(_ui);
}
void ChatToaster::setMessage(const QString & message) {
_ui->messageLabel->setText(message);
}
void ChatToaster::setPixmap(const QPixmap & pixmap) {
_ui->pixmapLabel->setPixmap(pixmap);
}
void ChatToaster::show() {
_toaster->show();
}
void ChatToaster::close() {
_toaster->close();
}
void ChatToaster::chatButtonSlot() {
chatButtonClicked();
close();
}

View File

@ -1,76 +0,0 @@
/****************************************************************
* 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.
****************************************************************/
#ifndef CHATTOASTER_H
#define CHATTOASTER_H
#include "IQtToaster.h"
#include <QtCore/QObject>
class QtToaster;
class QWidget;
class QString;
class QPixmap;
namespace Ui { class ChatToaster; }
/**
* Shows a toaster when a chat is incoming.
*
*
*/
class ChatToaster : public QObject, public IQtToaster {
Q_OBJECT
public:
ChatToaster();
~ChatToaster();
void setMessage(const QString & message);
void setPixmap(const QPixmap & pixmap);
void show();
public Q_SLOTS:
void close();
Q_SIGNALS:
void chatButtonClicked();
private Q_SLOTS:
void chatButtonSlot();
private:
Ui::ChatToaster * _ui;
QWidget * _chatToasterWidget;
QtToaster * _toaster;
};
#endif //CHATTOASTER_H

View File

@ -1,672 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ChatToaster</class>
<widget class="QWidget" name="ChatToaster">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="windowFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="2" column="0">
<layout class="QGridLayout">
<property name="margin">
<number>6</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="1">
<widget class="QLabel" name="pixmapLabel">
<property name="pixmap">
<pixmap>../images/toaster/chat.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="RetroStyleLabel" name="chatButton">
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="1">
<widget class="QLabel" name="messageLabel">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>212</red>
<green>208</green>
<blue>200</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>234</red>
<green>229</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>141</red>
<green>139</green>
<blue>133</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>212</red>
<green>208</green>
<blue>200</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>64</red>
<green>64</green>
<blue>64</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>10</red>
<green>36</green>
<blue>106</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>212</red>
<green>208</green>
<blue>200</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>234</red>
<green>229</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>141</red>
<green>139</green>
<blue>133</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>212</red>
<green>208</green>
<blue>200</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>64</red>
<green>64</green>
<blue>64</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>212</red>
<green>208</green>
<blue>200</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>106</red>
<green>104</green>
<blue>100</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>212</red>
<green>208</green>
<blue>200</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>233</red>
<green>231</green>
<blue>227</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>141</red>
<green>139</green>
<blue>133</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>106</red>
<green>104</green>
<blue>100</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>106</red>
<green>104</green>
<blue>100</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>212</red>
<green>208</green>
<blue>200</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>212</red>
<green>208</green>
<blue>200</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>10</red>
<green>36</green>
<blue>106</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string notr="true">Message</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="2">
<widget class="QToolButton" name="closeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/close-down.png</normaloff>:/images/close-down.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>225</width>
<height>22</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>RetroStyleLabel</class>
<extends>QLabel</extends>
<header>gui/toaster/RetroStyleLabelProxy.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>chatButton</tabstop>
<tabstop>closeButton</tabstop>
</tabstops>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -20,110 +20,47 @@
*
*************************************************************************/
#include <QTimer>
#include <QDesktopWidget>
#include <QDesktopServices>
#include <QMessageBox>
#include <QFileInfo>
#include <QUrl>
#include "DownloadToaster.h"
#include <retroshare/rsfiles.h>
DownloadToaster::DownloadToaster(QWidget * parent, Qt::WFlags flags)
: QWidget(parent, flags)
DownloadToaster::DownloadToaster(const std::string &hash, const QString &name) : QWidget(NULL)
{
setupUi(this);
ui.setupUi(this);
/* set window flags */
QWidget::setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
fileHash = hash;
/* init the timer */
displayTimer = new QTimer(this);
connect(displayTimer, SIGNAL(timeout()), this, SLOT(displayTimerOnTimer()));
/* connect buttons */
connect(ui.spbClose, SIGNAL(clicked()), this, SLOT(hide()));
connect(ui.startButton, SIGNAL(clicked()), this, SLOT(play()));
/* connect buttons */
connect(spbClose, SIGNAL(clicked()), this, SLOT(closeClicked()));
connect(startButton, SIGNAL(clicked()), this, SLOT(play()));
/* init state */
displayState = dsInactive;
}
DownloadToaster::~DownloadToaster()
{
delete displayTimer;
}
void DownloadToaster::displayTimerOnTimer()
{
if (!isVisible()) return;
QDesktopWidget *desktop = QApplication::desktop();
QRect availableGeometry = desktop->availableGeometry(this);
// display popup animation
if (displayState == dsShowing)
if (pos().x() > availableGeometry.width() - size().width())// - 15)
move(pos().x() - 2, pos().y());
else
{
displayState = dsWaiting;
displayTimer->start(5000);
}
// hide popup animation
else if (displayState == dsHiding)
if (pos().x() < availableGeometry.width())
move(pos().x() + 2, pos().y());
else
{
displayState = dsWaiting;
displayTimer->stop();
hide();
}
else if (displayState == dsWaiting)
{
displayState = dsHiding;
displayTimer->start(2);
}
}
void DownloadToaster::displayPopup(const std::string &hash, const QString &name)
{
fileHash = hash;
labelTitle->setText(name);
QDesktopWidget *desktop = QApplication::desktop();
QRect availableGeometry = desktop->availableGeometry(this);
move(desktop->width(), availableGeometry.height() - size().height());
show();
displayState = dsShowing;
displayTimer->start(2);
}
void DownloadToaster::closeClicked()
{
displayState = dsHiding;
displayTimer->start(2);
/* set informations */
ui.labelTitle->setText(name);
}
void DownloadToaster::play()
{
/* look up path */
FileInfo fi;
if (!rsFiles->FileDetails(fileHash, RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_DOWNLOAD | RS_FILE_HINTS_SPEC_ONLY, fi)) {
return;
}
/* look up path */
FileInfo fi;
if (!rsFiles->FileDetails(fileHash, RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_DOWNLOAD | RS_FILE_HINTS_SPEC_ONLY, fi)) {
return;
}
std::string filename = fi.path + "/" + fi.fname;
std::string filename = fi.path + "/" + fi.fname;
/* open file with a suitable application */
QFileInfo qinfo;
qinfo.setFile(filename.c_str());
if (qinfo.exists()) {
QDesktopServices::openUrl(QUrl::fromLocalFile(qinfo.absoluteFilePath()));
}else{
QMessageBox::information(this, "RetroShare", tr("File %1 does not exist at location.").arg(fi.path.c_str()));
}
/* open file with a suitable application */
QFileInfo qinfo;
qinfo.setFile(filename.c_str());
if (qinfo.exists()) {
QDesktopServices::openUrl(QUrl::fromLocalFile(qinfo.absoluteFilePath()));
}else{
// QMessageBox::information(this, "RetroShare", tr("File %1 does not exist at location.").arg(fi.path.c_str()));
}
hide();
}

View File

@ -23,28 +23,23 @@
#ifndef DOWNLOADTOASTER_H
#define DOWNLOADTOASTER_H
#include "MessageToaster.h" // for DisplayState
#include "ui_DownloadToaster.h"
class DownloadToaster : public QWidget, public Ui::DownloadToaster
class DownloadToaster : public QWidget
{
Q_OBJECT
Q_OBJECT
public:
DownloadToaster(QWidget *parent = 0, Qt::WFlags f = 0);
~DownloadToaster();
void displayPopup(const std::string &hash, const QString &name);
DownloadToaster(const std::string &hash, const QString &name);
private slots:
void displayTimerOnTimer();
void closeClicked();
void play();
void play();
private:
QTimer *displayTimer;
std::string fileHash;
DisplayState displayState;
std::string fileHash;
/** Qt Designer generated object */
Ui::DownloadToaster ui;
};
#endif

View File

@ -1,65 +0,0 @@
/****************************************************************
* 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.
****************************************************************/
#ifndef IQTTOASTER_H
#define IQTTOASTER_H
#include <util/Interface.h>
class QString;
class QPixmap;
/**
* Shows a toaster when a phone call or a chat is incoming.
*
* A toaster is a small window in the lower right of the desktop.
*
*
*/
class IQtToaster : Interface {
public:
/**
* Sets the toaster window message.
*
* @param message toaster message
*/
virtual void setMessage(const QString & message) = 0;
/**
* Sets the toaster window picture.
*
* @param pixmap toaster picture
*/
virtual void setPixmap(const QPixmap & pixmap) = 0;
/**
* Shows the toaster window.
*/
virtual void show() = 0;
/**
* Closes the toaster window.
*/
virtual void close() = 0;
};
#endif //IQTTOASTER_H

View File

@ -17,111 +17,29 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <QTimer>
#include <QDesktopWidget>
#include "MessageToaster.h"
#include "../MainWindow.h"
MessageToaster::MessageToaster( QWidget * parent, Qt::WFlags f)
: QWidget(parent, f)
MessageToaster::MessageToaster(const QString &name, const QString &title, const QString &message) : QWidget(NULL)
{
setupUi(this);
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
/* connect buttons */
connect(ui.closebtn, SIGNAL(clicked()), this, SLOT(hide()));
connect(ui.openmessagebtn, SIGNAL(clicked()), this, SLOT(openmessageClicked()));
connect(ui.openmessagetoolButton, SIGNAL(clicked()), this, SLOT(openmessageClicked()));
// set window flags
QWidget::setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
// init the timer
displayTimer = new QTimer(this);
connect(displayTimer, SIGNAL(timeout()), this, SLOT(displayTimerOnTimer()));
// connect buttons
connect(closebtn, SIGNAL(clicked()), this, SLOT(closeClicked()));
connect(openmessagebtn, SIGNAL(clicked()), this, SLOT(openmessageClicked()));
connect(openmessagetoolButton, SIGNAL(clicked()), this, SLOT(openmessageClicked()));
// init state
displayState = dsInactive;
}
MessageToaster::~MessageToaster()
{
delete displayTimer;
}
void MessageToaster::displayTimerOnTimer()
{
if (!isVisible()) {
close();
return;
}
QDesktopWidget *desktop = QApplication::desktop();
QRect availableGeometry = desktop->availableGeometry(this);
// display popup animation
if (displayState == dsShowing)
if (pos().x() > availableGeometry.width() - size().width())// - 15)
move(pos().x() - 2, pos().y());
else
{
displayState = dsWaiting;
displayTimer->start(5000);
}
// hide popup animation
else if (displayState == dsHiding)
if (pos().x() < availableGeometry.width())
move(pos().x() + 2, pos().y());
else
{
displayState = dsWaiting;
displayTimer->stop();
hide();
close();
}
else if (displayState == dsWaiting)
{
displayState = dsHiding;
displayTimer->start(2);
}
}
void MessageToaster::displayPopup()
{
QDesktopWidget *desktop = QApplication::desktop();
QRect availableGeometry = desktop->availableGeometry(this);
move(desktop->width(), availableGeometry.height() - size().height());
this->show();
displayState = dsShowing;
displayTimer->start(2);
}
void MessageToaster::closeClicked()
{
displayState = dsHiding;
displayTimer->start(2);
/* set informations */
ui.subjectline->setText(tr("Sub:") + " " + title);
ui.subjectline->setToolTip(title);
ui.contentBrowser->setText(message);
ui.contentBrowser->setToolTip(message);
ui.namelabel->setText(name);
}
void MessageToaster::openmessageClicked()
{
MainWindow::showWindow (MainWindow::Messages);
}
void MessageToaster::setTitle(const QString & title)
{
subjectline->setText("Sub: " + title);
subjectline->setToolTip(title);
}
void MessageToaster::setMessage(const QString & message)
{
contentBrowser->setText(message);
contentBrowser->setToolTip(message);
}
void MessageToaster::setName(const QString & name)
{
namelabel->setText(name);
MainWindow::showWindow(MainWindow::Messages);
hide();
}

View File

@ -28,29 +28,19 @@
#include "ui_MessageToaster.h"
enum DisplayState {dsInactive, dsShowing, dsWaiting, dsHiding};
class MessageToaster : public QWidget, public Ui::MessageToaster
class MessageToaster : public QWidget
{
Q_OBJECT
public:
MessageToaster( QWidget * parent = 0, Qt::WFlags f = 0 );
~MessageToaster();
void displayPopup();
void setTitle(const QString &title);
void setMessage(const QString & message);
void setName(const QString & name);
Q_OBJECT
private slots:
void displayTimerOnTimer();
void closeClicked();
void openmessageClicked();
private:
QTimer *displayTimer;
DisplayState displayState;
public:
MessageToaster(const QString &name, const QString &title, const QString &message);
private slots:
void openmessageClicked();
private:
/** Qt Designer generated object */
Ui::MessageToaster ui;
};
#endif

View File

@ -17,66 +17,52 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <QSound>
#include "OnlineToaster.h"
#include "ui_OnlineToaster.h"
#include "QtToaster.h"
#include "gui/settings/rsharesettings.h"
#include "gui/chat/PopupChatDialog.h"
#include "util/WidgetBackgroundImage.h"
#include <QtGui/QtGui>
OnlineToaster::OnlineToaster(const std::string &peerId, const QString &name, const QPixmap &avatar) : QWidget(NULL)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
OnlineToaster::OnlineToaster()
: QObject(NULL) {
this->peerId = peerId;
_onlineToasterWidget = new QWidget(NULL);
/* connect buttons */
connect(ui.messageButton, SIGNAL(clicked()), SLOT(chatButtonSlot()));
connect(ui.closeButton, SIGNAL(clicked()), SLOT(hide()));
_ui = new Ui::OnlineToaster();
_ui->setupUi(_onlineToasterWidget);
/* set informations */
ui.messageLabel->setText(name);
ui.pixmaplabel->setPixmap(avatar);
connect(_ui->messageButton, SIGNAL(clicked()), SLOT(chatButtonSlot()));
WidgetBackgroundImage::setBackgroundImage(ui.windowFrame, ":images/toaster/toaster-backrs4.png", WidgetBackgroundImage::AdjustSize);
resize(184, 128);
connect(_ui->closeButton, SIGNAL(clicked()), SLOT(close()));
_toaster = new QtToaster(this, _onlineToasterWidget, _ui->windowFrame);
_toaster->setTimeOnTop(5000);
play();
}
OnlineToaster::~OnlineToaster() {
delete _ui;
void OnlineToaster::chatButtonSlot()
{
PopupChatDialog::chatFriend(peerId);
hide();
}
void OnlineToaster::setMessage(const QString & message) {
_ui->messageLabel->setText(message);
}
void OnlineToaster::play()
{
Settings->beginGroup("Sound");
Settings->beginGroup("SoundFilePath");
QString OnlineSound = Settings->value("User_go_Online","").toString();
Settings->endGroup();
Settings->beginGroup("Enable");
bool flag = Settings->value("User_go_Online",false).toBool();
Settings->endGroup();
Settings->endGroup();
void OnlineToaster::setPixmap(const QPixmap & pixmap) {
_ui->pixmaplabel->setPixmap(pixmap);
}
void OnlineToaster::show() {
_toaster->show();
}
void OnlineToaster::close() {
_toaster->close();
}
void OnlineToaster::chatButtonSlot() {
chatButtonClicked();
close();
}
void OnlineToaster::play(){
Settings->beginGroup("Sound");
Settings->beginGroup("SoundFilePath");
QString OnlineSound = Settings->value("User_go_Online","").toString();
Settings->endGroup();
Settings->beginGroup("Enable");
bool flag = Settings->value("User_go_Online",false).toBool();
Settings->endGroup();
Settings->endGroup();
if(!OnlineSound.isEmpty()&&flag)
if(QSound::isAvailable())
QSound::play(OnlineSound);
if(!OnlineSound.isEmpty()&&flag)
if(QSound::isAvailable())
QSound::play(OnlineSound);
}

View File

@ -20,54 +20,30 @@
#ifndef ONLINETOASTER_H
#define ONLINETOASTER_H
#include "IQtToaster.h"
#include <QtCore/QObject>
#include <QSound>
class QtToaster;
class QWidget;
class QString;
class QPixmap;
namespace Ui { class OnlineToaster; }
#include "ui_OnlineToaster.h"
/**
* Shows a toaster when friend is Online .
*
*
*/
class OnlineToaster : public QObject, public IQtToaster {
class OnlineToaster : public QWidget
{
Q_OBJECT
public:
OnlineToaster(const std::string &peerId, const QString &name, const QPixmap &avatar);
OnlineToaster();
~OnlineToaster();
void setMessage(const QString & message);
void setPixmap(const QPixmap & pixmap);
void show();
void play();
Q_SIGNALS:
void chatButtonClicked();
private Q_SLOTS:
private slots:
void chatButtonSlot();
void close();
private:
Ui::OnlineToaster * _ui;
void play();
QWidget * _onlineToasterWidget;
std::string peerId;
QtToaster * _toaster;
/** Qt Designer generated object */
Ui::OnlineToaster ui;
};
#endif //MESSAGETOASTER_H

View File

@ -1,124 +0,0 @@
/****************************************************************
* 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.
****************************************************************/
#include "QtToaster.h"
#include <util/WidgetBackgroundImage.h>
#include <QtGui/QtGui>
static const unsigned TIME_TO_SHOW = 20;
QtToaster::QtToaster(QObject *master, QWidget * toaster, QFrame * toasterWindowFrame)
: QObject(toaster) {
_timer = NULL;
_show = true;
_toaster = toaster;
_toaster->setParent(_toaster->parentWidget(), Qt::ToolTip | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
_toaster->setWindowFlags(_toaster->windowFlags() | Qt::ToolTip);
_toaster->setAttribute ( Qt::WA_DeleteOnClose, true );
_master = master;
if (toasterWindowFrame) {
WidgetBackgroundImage::setBackgroundImage(toasterWindowFrame, ":images/toaster/toaster-backrs4.png", WidgetBackgroundImage::AdjustSize);
}
_toaster->resize(184, 128);
}
QtToaster::~QtToaster()
{
if (_master) {
delete (_master);
}
}
void QtToaster::setTimeOnTop(unsigned time) {
_timeOnTop = time;
}
void QtToaster::close() {
if (_timer) {
_timer->stop();
}
_toaster->close();
delete (this);
}
void QtToaster::show() {
//10 pixels of margin
#if !defined(OS_WINDOWS)
static const int MARGIN_X = 30;
#else
static const int MARGIN_X = 10;
#endif
QDesktopWidget * desktop = QApplication::desktop();
QRect screenGeometry = desktop->screenGeometry(desktop->primaryScreen());
_toaster->move(screenGeometry.right() - _toaster->size().width() - MARGIN_X, screenGeometry.bottom());
_toaster->show();
_timer = new QTimer(this);
connect(_timer, SIGNAL(timeout()), SLOT(changeToasterPosition()));
_timer->start(TIME_TO_SHOW);
}
void QtToaster::changeToasterPosition() {
QDesktopWidget * desktop = QApplication::desktop();
QPoint p = _toaster->pos();
//Toaster is showing slowly
if (_show) {
_toaster->move(p.x(), p.y() - 3);
QRect desktopGeometry = desktop->availableGeometry(desktop->primaryScreen());
if (p.y() < (desktopGeometry.bottom() - _toaster->size().height() - 5)) {
//Toaster should be hidden now
_show = false;
_timer->stop();
//Waits 5 seconds with the toaster on top
_timer->start(_timeOnTop);
}
}
//Toaster is hiding slowly
else {
_toaster->move(p.x(), p.y() + 3);
QRect screenGeometry = desktop->screenGeometry(desktop->primaryScreen());
_timer->stop();
_timer->start(TIME_TO_SHOW);
if (p.y() > (screenGeometry.bottom())) {
//Closes the toaster -> hide it completely
close();
}
}
}

View File

@ -1,73 +0,0 @@
/****************************************************************
* 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.
****************************************************************/
#ifndef QTTOASTER_H
#define QTTOASTER_H
#include <QtCore/QObject>
class QWidget;
class QTimer;
class QFrame;
/**
* This class codes the algorithm that show/hide the toaster.
*
* This class helps factorizing the code between QtCallToaster and QtChatToaster.
*
*
*/
class QtToaster : public QObject {
Q_OBJECT
public:
QtToaster(QObject *master, QWidget * toaster, QFrame * toasterWindowFrame);
~QtToaster();
/**
* Sets the time with the toaster on top.
*
* @param time time toaster on top in milliseconds
*/
void setTimeOnTop(unsigned time);
void show();
void close();
private Q_SLOTS:
void changeToasterPosition();
private:
QWidget * _toaster;
QObject *_master;
QTimer * _timer;
bool _show;
unsigned _timeOnTop;
};
#endif //QTTOASTER_H