/*
 *  copyright (C) 2000
 *  Michael Edwardes <mte @users.sourceforge.net>
 */

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#include "kstartuplogo.h"
#include <tdeapplication.h>
#include <kstandarddirs.h>
#include <tqtimer.h>

TDEStartupLogo::TDEStartupLogo(TQWidget * parent, const char *name)
        : TQWidget(parent,name, TQt::WStyle_NoBorder | TQt::WStyle_Customize | TQt::WDestructiveClose )
,m_bReadyToHide(false) {
    //pm.load(locate("appdata", "pics/startlogo.png"));
    TDEStandardDirs * dirs = TDEGlobal::dirs();
    TQString dataDir = dirs -> findResourceDir("data", "umbrello/pics/object.png");
    dataDir += "/umbrello/pics/";
    TQPixmap pm(dataDir + "startlogo.png");
    setBackgroundPixmap(pm);
    setGeometry(TQApplication::desktop()->width()/2-pm.width()/2,
                TQApplication::desktop()->height()/2-pm.height()/2,
                pm.width(),pm.height());

    timer = new TQTimer(this);
    connect( timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(timerDone()) );
    timer->start(2000, true);
}

TDEStartupLogo::~TDEStartupLogo() {
    delete timer;
}

void TDEStartupLogo::mousePressEvent( TQMouseEvent*) {
    // for the haters of raising startlogos
    if (m_bReadyToHide)
        hide();
}

void TDEStartupLogo::timerDone() {
    this->hide();
}

void TDEStartupLogo::setHideEnabled(bool bEnabled) {
    m_bReadyToHide = bEnabled;
}
#include "kstartuplogo.moc"
