// Implementation of QTreeEasterEgg.
#include <qcursor.h>
#include <qbitmap.h>
#include "qtreeeasteregg.h"
QTreeEasterEgg::QTreeEasterEgg( QWidget* parent )
: eggtimer( 0 ), widget( parent )
{
}
QTreeEasterEgg::~QTreeEasterEgg()
{
}
void QTreeEasterEgg::KeyPress( int k )
{
switch( (Qt::Key)k )
{
case Qt::Key_4:
if ( eggtimer == 1 ) eggtimer++;
else if ( eggtimer == 5 ) Activate();
else eggtimer = 0;
return;
case Qt::Key_8:
if ( eggtimer == 3 ) eggtimer++;
else eggtimer = 0;
return;
case Qt::Key_D:
if ( eggtimer == 4 ) eggtimer++;
else eggtimer = 0;
return;
case Qt::Key_L:
eggtimer = 1;
return;
case Qt::Key_M:
if ( eggtimer == 2 ) eggtimer++;
else eggtimer = 0;
return;
default:
eggtimer = 0;
}
}
void QTreeEasterEgg::Activate()
{
uchar egg_bits[] =
{
0x1F, 0x00, 0x00, 0x00, 0x21, 0x80, 0x00, 0x00,
0x40, 0xC0, 0x00, 0x00, 0x88, 0x60, 0x00, 0x00,
0x90, 0x30, 0x00, 0x00, 0x90, 0x18, 0x00, 0x00,
0xA3, 0x0C, 0x00, 0x00, 0xE7, 0x84, 0x00, 0x00,
0x6D, 0xC6, 0x00, 0x00, 0x2C, 0xE3, 0x00, 0x00,
0x38, 0x61, 0x00, 0x00, 0x10, 0x31, 0x80, 0x00,
0x00, 0x30, 0x80, 0x00, 0x00, 0x18, 0xC0, 0x00,
0x00, 0x18, 0x60, 0x00, 0x00, 0x0C, 0x20, 0x00,
0x00, 0x0C, 0x30, 0x00, 0x00, 0x06, 0x10, 0x00,
0x00, 0x06, 0x18, 0x00, 0x00, 0x03, 0x08, 0x00,
0x00, 0x03, 0x84, 0x00, 0x00, 0x01, 0x86, 0x00,
0x00, 0x00, 0xC2, 0x00, 0x00, 0x00, 0xC3, 0x00,
0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x71, 0x80,
0x00, 0x00, 0x30, 0xC0, 0x00, 0x00, 0x18, 0x60,
0x00, 0x00, 0x1C, 0x30, 0x00, 0x00, 0x0E, 0x10,
0x00, 0x00, 0x06, 0x18, 0x00, 0x00, 0x03, 0x0C
};
uchar egg_mask[] =
{
0x1F, 0x00, 0x00, 0x00, 0x3F, 0x80, 0x00, 0x00,
0x7F, 0xC0, 0x00, 0x00, 0xFF, 0xE0, 0x00, 0x00,
0xFF, 0xF0, 0x00, 0x00, 0xFF, 0xF8, 0x00, 0x00,
0xFF, 0xFC, 0x00, 0x00, 0xFF, 0xFC, 0x00, 0x00,
0x7D, 0xFE, 0x00, 0x00, 0x3C, 0xFF, 0x00, 0x00,
0x38, 0x7F, 0x00, 0x00, 0x10, 0x3F, 0x80, 0x00,
0x00, 0x3F, 0x80, 0x00, 0x00, 0x1F, 0xC0, 0x00,
0x00, 0x1F, 0xE0, 0x00, 0x00, 0x0F, 0xE0, 0x00,
0x00, 0x0F, 0xF0, 0x00, 0x00, 0x07, 0xF0, 0x00,
0x00, 0x07, 0xF8, 0x00, 0x00, 0x03, 0xF8, 0x00,
0x00, 0x03, 0xFC, 0x00, 0x00, 0x01, 0xFE, 0x00,
0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0xFF, 0x00,
0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x7F, 0x80,
0x00, 0x00, 0x3F, 0xC0, 0x00, 0x00, 0x1F, 0xE0,
0x00, 0x00, 0x1F, 0xF0, 0x00, 0x00, 0x0F, 0xF0,
0x00, 0x00, 0x07, 0xF8, 0x00, 0x00, 0x03, 0xFC
};
QBitmap cb = QBitmap( 32, 32, egg_bits, FALSE );
QBitmap cm = QBitmap( 32, 32, egg_mask, FALSE );
QCursor cs = QCursor( cb, cm, 3, 11 );
widget->setCursor( cs );
}