|
|
|
|
@ -47,10 +47,12 @@ NotifyWidget::NotifyWidget(TQWidget *parent, const char *name, TQ_INT32 id )
|
|
|
|
|
// TODO: give the user an option to configure if he/she wants to have
|
|
|
|
|
// the notification fading away from down to top
|
|
|
|
|
// TQTimer::singleShot(100, this, TQ_SLOT(fadeAway()));
|
|
|
|
|
mIconLabel = new TQLabel(this);
|
|
|
|
|
mIconLabel->setFrameStyle( TQFrame::NoFrame );
|
|
|
|
|
mImageLabel = new TQLabel(this);
|
|
|
|
|
mImageLabel->setFrameStyle( TQFrame::NoFrame );
|
|
|
|
|
mTextLabel = new TQLabel(this);
|
|
|
|
|
mTextLabel->setTextFormat(TQt::RichText);
|
|
|
|
|
mImageLabel->setFrameStyle( TQFrame::NoFrame );
|
|
|
|
|
mTextLabel->setFrameStyle( TQFrame::NoFrame );
|
|
|
|
|
// TODO: give the user an option to configure the background
|
|
|
|
|
// mImageLabel[nId]->setPaletteBackgroundColor(TQt::black);
|
|
|
|
|
@ -58,11 +60,16 @@ NotifyWidget::NotifyWidget(TQWidget *parent, const char *name, TQ_INT32 id )
|
|
|
|
|
// mTextLabel[nId]->setPaletteBackgroundColor(TQt::black);
|
|
|
|
|
// mTextLabel[nId]->setPaletteForegroundColor(TQt::white);
|
|
|
|
|
|
|
|
|
|
TQBoxLayout* wLayout = new TQHBoxLayout(this);
|
|
|
|
|
wLayout->addWidget(mImageLabel);
|
|
|
|
|
wLayout->addWidget(mTextLabel);
|
|
|
|
|
wLayout->setAlignment(TQt::AlignTop);
|
|
|
|
|
// wLayout->setSpacing(5);
|
|
|
|
|
TQBoxLayout* hLayout = new TQHBoxLayout(this);
|
|
|
|
|
TQBoxLayout* vLayout = new TQVBoxLayout();
|
|
|
|
|
vLayout->addWidget(mIconLabel);
|
|
|
|
|
vLayout->addWidget(mImageLabel);
|
|
|
|
|
vLayout->setAlignment(TQt::AlignTop);
|
|
|
|
|
vLayout->setAlignment(TQt::AlignCenter);
|
|
|
|
|
hLayout->addLayout(vLayout);
|
|
|
|
|
hLayout->addWidget(mTextLabel);
|
|
|
|
|
hLayout->setAlignment(TQt::AlignTop);
|
|
|
|
|
// hLayout->setSpacing(5);
|
|
|
|
|
|
|
|
|
|
mTimer = new TQTimer( this );
|
|
|
|
|
connect( mTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(slotTimeout()) );
|
|
|
|
|
@ -92,7 +99,9 @@ void NotifyWidget::setAutoMask(bool b)
|
|
|
|
|
bool NotifyWidget::setIcon(const TQString& icon) {
|
|
|
|
|
TQPixmap pixmap;
|
|
|
|
|
if ( pixmap.load(icon) ) {
|
|
|
|
|
mImageLabel->setPixmap(pixmap);
|
|
|
|
|
mIconLabel->setPixmap(pixmap);
|
|
|
|
|
mIconLabel->setAlignment(TQLabel::AlignTop);
|
|
|
|
|
mIconLabel->setMargin(3);
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
@ -131,27 +140,41 @@ void NotifyWidget::setPersistence(bool p) {
|
|
|
|
|
void NotifyWidget::setImage(const TQString& i) {
|
|
|
|
|
TQPixmap myImage(i); // Load the image
|
|
|
|
|
mImageLabel->setPixmap(myImage);
|
|
|
|
|
mImageLabel->setAlignment(TQt::AlignCenter); // Use TQt namespace for alignment
|
|
|
|
|
// mImageLabel->setAlignment(TQt::AlignCenter); // Use TQt namespace for alignment
|
|
|
|
|
mImageLabel->setAlignment(TQLabel::AlignTop);
|
|
|
|
|
mImageLabel->setMargin(3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NotifyWidget::setImageData(const TQValueList<TQT_DBusData>& data) {
|
|
|
|
|
|
|
|
|
|
int x = data[0].toInt32();
|
|
|
|
|
int y = data[1].toInt32();
|
|
|
|
|
int r = data[2].toInt32(); // rowstride
|
|
|
|
|
int a = data[3].toBool(); // alpha
|
|
|
|
|
int b = data[4].toInt32(); // bits per sample
|
|
|
|
|
int c = data[5].toInt32(); // channels
|
|
|
|
|
// tqDebug("Processing ImageData");
|
|
|
|
|
TQ_UINT32 x = data[0].toUInt32(); // width
|
|
|
|
|
TQ_UINT32 y = data[1].toUInt32(); // height
|
|
|
|
|
TQ_UINT32 r = data[2].toUInt32(); // rowstride
|
|
|
|
|
bool a = data[3].toBool(); // has alpha
|
|
|
|
|
TQ_UINT32 b = data[4].toUInt32(); // bits per sample
|
|
|
|
|
TQ_UINT32 c = data[5].toUInt32(); // channels
|
|
|
|
|
TQValueList<TQT_DBusData> v = data[6].toTQValueList(); // image bytes
|
|
|
|
|
// int w, int h, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian
|
|
|
|
|
mImageData = TQPixmap(x,y);
|
|
|
|
|
TQByteArray byteArr;
|
|
|
|
|
|
|
|
|
|
// tqDebug(" Width : %i", x);
|
|
|
|
|
// tqDebug(" Height: %i", y);
|
|
|
|
|
// tqDebug(" Rowstride: %i", r);
|
|
|
|
|
// tqDebug(" Has alpha: %i", a);
|
|
|
|
|
// tqDebug("Bits per sample: %i", b);
|
|
|
|
|
// tqDebug(" Channels: %i", c);
|
|
|
|
|
// tqDebug(" data size: %li", v.size());
|
|
|
|
|
|
|
|
|
|
TQ_UINT32 i = 0;
|
|
|
|
|
TQMemArray<char> cList(v.size());
|
|
|
|
|
TQValueList<TQT_DBusData>::Iterator it;
|
|
|
|
|
TQ_UINT32 count;
|
|
|
|
|
for ( it = v.begin(); it != v.end(); ++it )
|
|
|
|
|
byteArr[count++]=(*it).toByte();
|
|
|
|
|
mImageData.loadFromData(byteArr);
|
|
|
|
|
mImageLabel->setPixmap(mImageData);
|
|
|
|
|
cList[i++] = (*it).toByte();
|
|
|
|
|
mImageData = TQImage( x, y, b, c);
|
|
|
|
|
mImageData.loadFromData(cList);
|
|
|
|
|
mImageData.setAlphaBuffer(a);
|
|
|
|
|
mImageLabel->setPixmap(TQPixmap(mImageData));
|
|
|
|
|
mImageLabel->setAlignment(TQLabel::AlignTop);
|
|
|
|
|
mImageLabel->setMargin(3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NotifyWidget::setSoundFile(const TQString& f) {
|
|
|
|
|
@ -170,7 +193,7 @@ void NotifyWidget::setTransient(bool t) {
|
|
|
|
|
mTransient = t;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NotifyWidget::setUrgency(TQ_UINT16 l) {
|
|
|
|
|
void NotifyWidget::setUrgency(TQ_UINT8 l) {
|
|
|
|
|
mUrgency = l;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -192,6 +215,7 @@ void NotifyWidget::setTimeout(TQ_INT32 t) {
|
|
|
|
|
void NotifyWidget::setText(TQString t)
|
|
|
|
|
{
|
|
|
|
|
mTextLabel->setText(t);
|
|
|
|
|
mTextLabel->setAlignment(TQLabel::AlignTop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NotifyWidget::mousePressEvent( TQMouseEvent *e )
|
|
|
|
|
|