Ejemplo n.º 1
0
KStartupLogo::KStartupLogo() :
    QObject(0),
    m_splash(0)
{
  // splash screen setting
  if (!KMyMoneyGlobalSettings::showSplash())
    return;

  QString filename = KGlobal::dirs()->findResource("appdata", "pics/startlogo.png");
  QString localeFilename = KGlobal::locale()->localizedFilePath(filename);
  QPixmap logoOverlay(localeFilename);

  QPixmap logoPixmap(logoOverlay.size());
  logoPixmap.fill(KColorScheme(QPalette::Active, KColorScheme::Selection).background(KColorScheme::NormalBackground).color());
  QPainter pixmapPainter(&logoPixmap);
  pixmapPainter.drawPixmap(0, 0, logoOverlay, 0, 0, logoOverlay.width(), logoOverlay.height());

  if (!logoOverlay.isNull()) {
    const KAboutData *aboutData = KCmdLineArgs::aboutData();
    KSplashScreen* splash = new KSplashScreen(logoPixmap);
    splash->setFixedSize(logoPixmap.size());

    splash->show();
    splash->showMessage(i18n("Loading %1...", aboutData->version()),  //krazy:exclude=qmethods
                        Qt::AlignLeft | Qt::AlignBottom,
                        KColorScheme(QPalette::Active, KColorScheme::Selection)
                        .foreground(KColorScheme::NormalText).color());
    m_splash = splash;
  }
}
Ejemplo n.º 2
0
bool MarbleSplashLayer::render( GeoPainter *painter, ViewportParams *viewport,
                                const QString &renderPos, GeoSceneLayer *layer )
{
    Q_UNUSED( renderPos );
    Q_UNUSED( layer );

    painter->save();

    QPixmap logoPixmap( MarbleDirs::path( "svg/marble-logo-inverted-72dpi.png" ) );

    if ( logoPixmap.width() > viewport->width() * 0.7
         || logoPixmap.height() > viewport->height() * 0.7 )
    {
        logoPixmap = logoPixmap.scaled( QSize( viewport->width(), viewport->height() ) * 0.7,
                                        Qt::KeepAspectRatio, Qt::SmoothTransformation );
    }

    QPoint logoPosition( ( viewport->width()  - logoPixmap.width() ) / 2,
                         ( viewport->height() - logoPixmap.height() ) / 2 );
    painter->drawPixmap( logoPosition, logoPixmap );

    QString message; // "Please assign a map theme!";

    painter->setPen( Qt::white );

    int yTop = logoPosition.y() + logoPixmap.height() + 10;
    QRect textRect( 0, yTop,
                    viewport->width(), viewport->height() - yTop );
    painter->drawText( textRect, Qt::AlignHCenter | Qt::AlignTop, message );

    painter->restore();

    return true;
}
Ejemplo n.º 3
0
void BootupAnimationTransition::init()
{
	HostBase* host = HostBase::instance();
	const HostInfo& info = host->getInfo();
	
	m_bounds = QRect(-info.displayWidth/2, -info.displayHeight/2, info.displayWidth, info.displayHeight);

	std::string imageRootPath = Settings::LunaSettings()->lunaSystemResourcesPath + "/";
	std::string imagePath;

	imagePath = imageRootPath + "hp-logo.png";
	QPixmap logoPixmap(imagePath.c_str());
	if (logoPixmap.isNull())
		g_warning("Failed to load image: %s", imagePath.c_str());
	
	m_screenPixmap = new QPixmap(info.displayWidth, info.displayHeight);

	m_rotation = Settings::LunaSettings()->homeButtonOrientationAngle;
	
	// prepare the full screen pixmap for the animation
	QPainter painter(m_screenPixmap);
	painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
	painter.fillRect(QRect(0, 0, info.displayWidth, info.displayHeight), QColor(0x00, 0x00, 0x00, 0xFF));
	if (m_rotation != 0) {
		painter.translate(info.displayWidth/2, info.displayHeight/2);
		painter.rotate(m_rotation);
		painter.translate(-info.displayWidth/2, -info.displayHeight/2);
	}

	painter.drawPixmap(info.displayWidth/2 - logoPixmap.width()/ 2, info.displayHeight/2 - logoPixmap.height()/ 2, logoPixmap);
	painter.setRenderHint(QPainter::SmoothPixmapTransform, false);
	painter.end();

	m_opacityAnimationPtr = new QPropertyAnimation();
	m_opacityAnimationPtr->setPropertyName("opacity");
	m_opacityAnimationPtr->setEasingCurve(QEasingCurve::Linear);
	m_opacityAnimationPtr->setTargetObject(this);
	m_opacityAnimationPtr->setDuration(kFadeAnimDuration); 
	m_opacityAnimationPtr->setStartValue(1.0);
	m_opacityAnimationPtr->setEndValue(0.0);
	
	m_scaleAnimationPtr   = new QPropertyAnimation();
	m_scaleAnimationPtr->setPropertyName("scale");
	m_scaleAnimationPtr->setEasingCurve(QEasingCurve::Linear);
	m_scaleAnimationPtr->setTargetObject(this);
	m_scaleAnimationPtr->setDuration(kFadeAnimDuration); 
	m_scaleAnimationPtr->setStartValue(1.0);
	m_scaleAnimationPtr->setEndValue(2.0);

	m_fadeAnimationGroupPtr = new QParallelAnimationGroup();
	m_fadeAnimationGroupPtr->addAnimation(m_opacityAnimationPtr);	
	m_fadeAnimationGroupPtr->addAnimation(m_scaleAnimationPtr);
	connect(m_fadeAnimationGroupPtr, SIGNAL(finished()), SLOT(fadeAnimationFinished()));
}