/***************************************************************************
                          dcsplash.cpp  -  description
                             -------------------
    begin                : Fre Apr 12 2002
    copyright            : (C) 2002 by Mathias Küster
    email                : mathen@users.berlios.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 "dcsplash.h"
#include <config.h>

#include <QDesktopWidget>
#include <QLabel>
#include <QPixmap>

#include "dciconloader.h"

/** */
DCSplash::DCSplash(QWidget * parent) : QWidget(parent) {
    setupUi(this);

    setWindowFlags(Qt::SplashScreen);

    // make forced centering for the splash window
    // NOTE: fixes a problem of centering linked to Compiz WM
    QRect desktop_geometry = QApplication::desktop()->geometry();
    move(desktop_geometry.center() - rect().center());

    QPalette palette = Frame_PIXMAP->palette();
    palette.setBrush(Frame_PIXMAP->backgroundRole(), QBrush(DCIconLoader::Instance()->GetPixmap(eiSPLASH)));
    palette.setColor(Frame_PIXMAP->foregroundRole(), QColor(32, 32, 64));

    Frame_PIXMAP->setPalette(palette);

    // no tr() since translator hasn't been loaded yet
    Frame_PIXMAP->setText(QString::fromAscii("EiskaltDC ") + QString::fromAscii(PACKAGE_VERSION) + QString::fromAscii("\n\n\nhttps://sourceforge.net/projects/eiskaltdc/"));
}

/** */
DCSplash::~DCSplash() {
}

/** */
void DCSplash::mouseDoubleClickEvent(QMouseEvent * event) {
    hide();

    QWidget::mouseDoubleClickEvent(event); // standard event processing
}

/** */
void DCSplash::mousePressEvent(QMouseEvent * event) {
    hide();

    QWidget::mousePressEvent(event); // standard event processing
}

/** */
void DCSplash::mouseReleaseEvent(QMouseEvent * event) {
    hide();

    QWidget::mouseReleaseEvent(event); // standard event processing
}

