void EmergencyWindowManager::removeWindow(Window* win)
{
	if (!win)
		return;

	if (win == m_emergencyWindow) {

		m_opacityAnimPtr = new QPropertyAnimation();
		m_opacityAnimPtr->setPropertyName("opacity");
		m_opacityAnimPtr->setEasingCurve(QEasingCurve::Linear);
		m_opacityAnimPtr->setTargetObject(m_emergencyWindow);
		m_opacityAnimPtr->setDuration(kFadeAnimDuration); 
		m_opacityAnimPtr->setEndValue(kFadedOpacity);
		connect(m_opacityAnimPtr, SIGNAL(finished()), SLOT(fadeAnimationFinished()));
		m_opacityAnimPtr->start(QAbstractAnimation::DeleteWhenStopped);

		IMEController::instance()->removeClient(static_cast<HostWindow*>(win));
		SystemUiController::instance()->setDirectRenderingForWindow(SystemUiController::EMERGENCY_MODE_WINDOW_MANAGER, static_cast<CardWindow*>(win), false);
		static_cast<CardWindow*>(m_emergencyWindow)->setPaintCompositionMode(QPainter::CompositionMode_SourceOver);

		return;
	}
	else {

		// this happens if window is closed quickly before it was added
		delete win;
	}

	// FIXME: Need to handle any popup alerts we have
}
示例#2
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()));
}
void EmergencyWindowManager::addWindow(Window* win)
{
	if (win->type() != Window::Type_Emergency)
		return;

	if (m_emergencyWindow) {

		luna_critical(s_logChannel, "Only one emergency window is allowed at a time");
		WebAppMgrProxy::instance()->closeWindow(win);
		return;
	}
	setVisible(true);
	
	m_emergencyWindow = win;
	static_cast<CardWindow*>(win)->focusEvent(true);
	IMEController::instance()->setClient(static_cast<HostWindow*>(win));

	m_emergencyWindow->setParentItem(this);
	m_emergencyWindow->stackBefore(m_cornerContainer);
	m_emergencyWindow->setOpacity(kFadedOpacity);
	m_emergencyWindow->setVisible(true);
	static_cast<CardWindow*>(m_emergencyWindow)->setPaintCompositionMode(QPainter::CompositionMode_SourceOver);

	static_cast<CardWindow*>(m_emergencyWindow)->setBoundingRect(m_winRect.width(), m_winRect.height());

	setPosTopLeft(win, m_winRect.x(), m_winRect.y());

	positionCornerWindows();
	showCornerWindows();

	SystemUiController::instance()->setEmergencyMode(true);

	if (static_cast<CardWindow*>(m_emergencyWindow)->fullScreen())
		SystemUiController::instance()->hideStatusBarAndNotificationArea();
	else {
		SystemUiController::instance()->showStatusBarAndNotificationArea();
	}
	
	m_opacityAnimPtr = new QPropertyAnimation();
	m_opacityAnimPtr->setPropertyName("opacity");
	m_opacityAnimPtr->setEasingCurve(QEasingCurve::Linear);
	m_opacityAnimPtr->setTargetObject(m_emergencyWindow);
	m_opacityAnimPtr->setDuration(kFadeAnimDuration);
	m_opacityAnimPtr->setEndValue(1.0);
	connect(m_opacityAnimPtr, SIGNAL(finished()), SLOT(fadeAnimationFinished()));
	m_opacityAnimPtr->start(QAbstractAnimation::DeleteWhenStopped);
	
	update();
}