Moving window working

Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>
feat/with_dbus-1-tqt
Emanoil Kotsev 3 years ago
parent 5916f27b64
commit 8cc56c2bc6

@ -101,7 +101,12 @@ void NotificationsService::NotifyAsync(
const TQStringList& actions,
const TQMap<TQString, TQT_DBusVariant>& hints, TQ_INT32 timeout)
{
if (notificationMap.contains(id))
{
NotifyAsyncError(asyncCallId, TQT_DBusError::stdFailed("Requested id already displayed"));
tqDebug("Requested id %i already in use", id);
return;
}
notificationMap[id] = new NotifyWidget(0, app_name.ascii(), this, id );
notificationMap[id]->setFrameStyle( TQFrame::NoFrame );
@ -115,15 +120,12 @@ void NotificationsService::NotifyAsync(
notificationMap[id]->setActions(actions);
notificationMap[id]->setHints(hints);
notificationMap[id]->setTimeout(timeout);
TQPoint p( 100, 100 );
notificationMap[id]->move( p );
notificationMap[id]->adjustSize();
notificationMap[id]->raise();
notificationMap[id]->show();
notificationMap[id]->adjustSize();
notificationMap[id]->setActiveWindow();
NotifyAsyncReply(asyncCallId, id);
}
void NotificationsService::handleMethodReply(const TQT_DBusMessage& reply) {

@ -28,6 +28,8 @@
#include "NotifyWidget.h"
#include "NotificationsService.h"
#define FADE_SPEED 5
NotifyWidget::NotifyWidget(TQWidget *parent, const char *name, NotificationsService *ns, TQ_INT32 id )
: TQLabel( parent, name, WStyle_Customize | TQt::WStyle_StaysOnTop | TQt::WStyle_NoBorder),
mName(TQString(name)), notificationService(ns), mId(id)
@ -35,6 +37,7 @@ NotifyWidget::NotifyWidget(TQWidget *parent, const char *name, NotificationsServ
// TODO Auto-generated constructor stub
TQDesktopWidget *d = TQApplication::desktop();
mPosition=TQPoint(d->width()-50, d->height()-20);
move(mPosition);
TQTimer::singleShot(100, this, TQT_SLOT(fadeAway()));
}
@ -59,9 +62,9 @@ void NotifyWidget::timeout()
void NotifyWidget::fadeAway()
{
mPosition.setY(mPosition.y()-10);
mPosition.setY(mPosition.y()-1);
move(mPosition);
TQTimer::singleShot(10, this, TQT_SLOT(fadeAway()));
TQTimer::singleShot(FADE_SPEED, this, TQT_SLOT(fadeAway()));
}
void NotifyWidget::setAutoMask(bool b)
@ -97,13 +100,6 @@ void NotifyWidget::setHints(const TQMap< TQString, TQT_DBusVariant >& hints) {
void NotifyWidget::setTimeout(TQ_INT32 t) {
TDEApplication::kApplication()->setTopWidget(this);
// update(0,0,width(),height());
//
// int extraWidth = width() - minimumWidth();
// int extraHeight = height() - minimumHeight();
// setGeometry(70, 10, 50 + extraWidth, 20 + extraHeight);
// adjustSize();
TQTimer::singleShot(t, this, TQT_SLOT(timeout()));
}

Loading…
Cancel
Save