void DockModeWindow::setPrepareAddedToWindowManager() {
	m_prepareAddedToWm = true;
	if (G_LIKELY(s_dockGlow == 0)) {
		QString path(Settings::LunaSettings()->lunaSystemResourcesPath.c_str());
		path.append("/dockmode/dock-loading-glow.png");
		s_dockGlow = new QPixmap(path);
		if(s_dockGlow)
			s_dockGlowRefCount++;
		if (!s_dockGlow || s_dockGlow->isNull()) {
			g_critical("%s: Failed to load image '%s'", __PRETTY_FUNCTION__, qPrintable(path));
		}
	} else {
		s_dockGlowRefCount++;
	}

	ApplicationDescription* appDesc = static_cast<Window*>(this)->appDescription();
	int size = Settings::LunaSettings()->splashIconSize;
	m_icon.load(appDesc->splashIconName().c_str());
	if (!m_icon.isNull()) {
		// scale splash icon to fit the devices screen dimensions
		m_icon = m_icon.scaled(size, size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
	}
	else {
		// just use the launcher icon
		m_icon = appDesc->getDefaultLaunchPoint()->icon();
		int newWidth = qMin((int)(m_icon.width()*1.5), size);
		int newHeight = qMin((int)(m_icon.height()*1.5), size);
		m_icon = m_icon.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
	}
	

	// set up the pulsing animation
	QPropertyAnimation* pulseIn = new QPropertyAnimation(this, "pulseOpacity");
	pulseIn->setDuration(AS(cardLoadingPulseDuration));
	pulseIn->setEasingCurve(AS_CURVE(cardLoadingPulseCurve));
	pulseIn->setEndValue(1.0);

	QPropertyAnimation* pulseOut = new QPropertyAnimation(this, "pulseOpacity");
	pulseOut->setDuration(AS(cardLoadingPulseDuration));
	pulseOut->setEasingCurve(AS_CURVE(cardLoadingPulseCurve));
	pulseOut->setEndValue(0.0);

	QSequentialAnimationGroup* pulseGroup = new QSequentialAnimationGroup;
	pulseGroup->addAnimation(pulseIn);
	pulseGroup->addAnimation(pulseOut);
	pulseGroup->setLoopCount(-1);

	m_pulseAnimation.addPause(AS(cardLoadingTimeBeforeShowingPulsing));
	m_pulseAnimation.addAnimation(pulseGroup);

	m_loadingOverlayEnabled = true;
	m_pulseAnimation.start();

	update();
}
//TODO: this is a poor-man's assignment operator (operator=). Should probably be rewritten as such
//TODO: won't update the icon; add that.
//returns > 0 on success
int ApplicationDescription::update(const ApplicationDescription& appDesc)
{
    m_category = appDesc.m_category;
    m_entryPoint = appDesc.m_entryPoint;
    m_version = appDesc.m_version;
    m_folderPath = appDesc.m_folderPath;
    m_vendorName = appDesc.m_vendorName;
    m_vendorUrl = appDesc.m_vendorUrl;
    m_isHeadLess = appDesc.m_isHeadLess;
    m_hasTransparentWindows = appDesc.m_hasTransparentWindows;
    m_isVisible = appDesc.m_isVisible;
    m_appSize = appDesc.m_appSize;
    m_runtimeMemoryRequired = appDesc.m_runtimeMemoryRequired;
    m_miniIconName = appDesc.m_miniIconName;
    m_tapToShareSupported = appDesc.m_tapToShareSupported;
    m_universalSearchJsonStr = appDesc.m_universalSearchJsonStr;
    m_servicesJsonStr = appDesc.m_servicesJsonStr;
    m_accountsJsonStr = appDesc.m_accountsJsonStr;
    m_dockMode = appDesc.m_dockMode;
    m_dockModeTitle = appDesc.m_dockModeTitle;

    const LaunchPoint* lp = getDefaultLaunchPoint();
    const LaunchPoint* nlp = appDesc.getDefaultLaunchPoint();
    if ((lp) && (nlp))
    {
        if (!nlp->iconPath().empty()) //guard a little bit...you don't know where nlp has been.
        {
            const_cast<LaunchPoint*>(lp)->updateIconPath(nlp->iconPath());
        }
        if ((!nlp->title().empty()) && (nlp->title() != lp->title()))
        {
            const_cast<LaunchPoint*>(lp)->updateTitle(nlp->title());
        }
    }
    //WARNING...doesn't propagate changes automatically to launcher, or things that are holding a ref to this...
    //				currently this is done in the callers of update()
    // TODO: update m_keywords
    // TODO: update defaultLP->title
    return 1;
}
Exemple #3
0
void AppEffector::launch(ExternalApp * pApp,const QUuid& optionalIconUid)
{
	if (!pApp)
	{
		return;
	}

	//TODO: TEMP: only handle WebOS apps for the moment
	WebOSApp * pWoApp = qobject_cast<WebOSApp *>(pApp);
	if (!pWoApp)
	{
		return;
	}

	ApplicationDescription * pAppDesc = ApplicationManager::instance()->getAppById(StringTranslator::outputString(pWoApp->appId()));
	if (!pAppDesc)
	{
		//check to see if it is a pending application
		pAppDesc = ApplicationManager::instance()->getPendingAppById(StringTranslator::outputString(pWoApp->appId()));
		if (!pAppDesc)
		{
			g_message("%s: error: It's hopeless; app id [%s] that was being launched by the launcher has no mapping in application manager (neither as an installed app nor a pending app. Aborting launch attempt.",
					__FUNCTION__,qPrintable(pWoApp->appId()));
			return;
		}
	}

	//check and see if this is some auxiliary launch point of the app

	//virtual QString launchpointIdOfIcon(const QUuid& iconUid,WOAppIconType::Enum * p_r_type = 0) const;
	WOAppIconType::Enum type;
	QString launchPointId = pWoApp->launchpointIdOfIcon(optionalIconUid,&type);

	std::string launcherAppId = std::string("com.palm.launcher");
	std::string launcherProcessId = std::string("launcher-0");
	std::string procId = std::string("");
	std::string errMsg = std::string("");
	std::string request = pAppDesc->getDefaultLaunchPoint()->params();

	if (type == WOAppIconType::Auxiliary)
	{
		//retrieve the launch point
		const LaunchPoint * pLaunchPoint = pAppDesc->findLaunchPoint(StringTranslator::outputString(launchPointId));
		if (pLaunchPoint)
		{
			request = pLaunchPoint->params();
		}
	}
	//see if the app is actually a built-in
	if (pAppDesc->type() == ApplicationDescription::Type_SysmgrBuiltin)
	{
		///launch direct
		pAppDesc->startSysmgrBuiltIn();
//		//fake a procId
		procId = "SYSMGR_BUILTIN";

	}
	else
	if (procId.empty())
	{
		//normal launch
		procId = WebAppMgrProxy::instance()->appLaunch(
				StringTranslator::outputString(pWoApp->appId()),
				request,
				launcherAppId, launcherProcessId, errMsg);
	}

	if (procId.empty()) {
		qDebug() << "Failed to launch " << pWoApp->appId() << ": " << StringTranslator::inputString(errMsg);
	} else {
		qDebug() << "Request to launch " << pWoApp->appId() << " " << StringTranslator::inputString(request);
	}


}
Exemple #4
0
//TODO: CHANGEME!!! This way of getting info is deprecated, as the JS component of com.palm.launcher that did the work is no longer existing
//				in Dfish and onward.
void AppEffector::info(ExternalApp * pApp)
{
	//TODO: IMPLEMENT (unfinished)
	if (!pApp)
	{
		return;
	}

	//TODO: TEMP: only handle WebOS apps for the moment
	WebOSApp * pWoApp = qobject_cast<WebOSApp *>(pApp);
	if (!pWoApp)
	{
		return;
	}

	ApplicationDescription * pAppDesc = ApplicationManager::instance()->getAppById(StringTranslator::outputString(pWoApp->appId()));
	if (!pAppDesc)
	{
		//qDebug() << "ApplicationDescription for " << pWoApp->appId() << " not found in the AppMan";
		return;
	}

	//see if the app is actually a built-in
	if (pAppDesc->type() == ApplicationDescription::Type_SysmgrBuiltin)
	{
		//TODO: no info for these...handle it better by giving the user something, but for now since the javascript part that gives the
		// info probably will go all weird on a sysmgr builtin, don't try it right now
		return;
	}

	//get the primary launchpoint, because that's what the app info command wants
	const LaunchPoint * pLp =  pAppDesc->getDefaultLaunchPoint();
	if (!pLp)
	{
		//there isn't one? hmm ok.
		return;
	}

	std::string launcherAppId = std::string("com.palm.launcher");
	std::string launcherProcessId = std::string("launcher-0");
	std::string procId = std::string("");
	std::string errMsg = std::string("");
	//TODO: don't form the json manually
	std::string request = std::string("{\"action\":\"showAppInfo\", \"appInfo\":\"") + pLp->launchPointId() + std::string("\"}");

	if (procId.empty())
	{
		//normal launch
		procId = WebAppMgrProxy::instance()->appLaunch(
				launcherAppId,
				request,
				launcherAppId, launcherProcessId, errMsg);
	}

	if (procId.empty()) {
		//qDebug() << "Failed to launch " << pWoApp->appId() << ": " << StringTranslator::inputString(errMsg);
	} else {
		//qDebug() << "Request to launch " << pWoApp->appId() << " " << StringTranslator::inputString(request);
	}

}