void loop() {

    char tmp[3];
    int charPosition = 0;

    // While there is data in the buffer, lets read it.
    while(client.available()) {

        char c = client.read();

        // Check if we reached the end of the data
        if(c == ',') {

            // use the accumulated value
            pData(tmp);

            // Reset
            tmp[0];
            charPosition = 0;

        } else {

            // Save char in to the temp array
            tmp[charPosition] = c;

            // Increment the position of the array
            charPosition++;

        }

    }

}
Exemplo n.º 2
0
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
void
GameObjectType::addChild(Zen::Studio::Workbench::I_ExplorerNode& _selectedNode)
{
    Zen::Studio::Workbench::I_ExplorerNode::pUserData_type pData(new GameObjectType(m_project, "NewObjectType"));

    m_project.getController().createChildNode(*getNode(), pData);
}
Exemplo n.º 3
0
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
void
Project::onCreated()
{
    /// Create the default child node
    Zen::Studio::Workbench::I_ExplorerNode::pUserData_type pData(new Folder(*this, "Game Object Types"));

    getController().createChildNode(*getNode(), pData);
}
Exemplo n.º 4
0
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
void
Folder::newTerrainGroup(Zen::Studio::Workbench::I_ExplorerNode& _selectedNode)
{
    Zen::Studio::Workbench::I_ExplorerNode::pUserData_type pData(
        new TerrainGroupNode(m_parent, "NewTerrainGroup")
    );

    m_parent.getController().createChildNode(*getNode(), pData);
}
Exemplo n.º 5
0
void SBVAR::SetupSBVAR(void)
{
  TData_predetermined *data=(TData_predetermined*)pData();
  YY=lambda*TransposeMultiply(data->Data(),data->Data());
  XX=lambda*TransposeMultiply(data->PredeterminedData(),data->PredeterminedData());
  XY=lambda*TransposeMultiply(data->PredeterminedData(),data->Data());
  log_likelihood_constant=-lambda_T*n_vars*0.918938533204673;      // 0.918938533204673 = 0.5*ln(2*pi)
  delete data;
}
Exemplo n.º 6
0
void KbIntCallback(
   const char* name, int name_len,
   const char* instruction, int instruction_len,
   int num_prompts,
   const LIBSSH2_USERAUTH_KBDINT_PROMPT* prompts,
   LIBSSH2_USERAUTH_KBDINT_RESPONSE* responses,
   void** anstract )
{
	if ( num_prompts <= 0 ) { return; }

	if ( !kbdIntInfo ) { return; }

	try
	{

		std::vector<FSPromptData> pData( num_prompts );
		int i;

		for ( i = 0; i < num_prompts; i++ )
		{
			pData[i].visible = prompts[i].echo != 0;
			pData[i].prompt = utf8_to_unicode( CopyToStrZ( prompts[i].text, prompts[i].length ).data() ).data();
		}

		static unicode_t userSymbol = '@';

		if ( !kbdIntInfo->Prompt(
		        utf8_to_unicode( "SFTP" ).data(),
		        carray_cat<unicode_t>( kbdIntParam->user.Data(), &userSymbol, kbdIntParam->server.Data() ).data(),
		        pData.data(), num_prompts ) ) { return; }

		for ( i = 0; i < num_prompts; i++ )
		{
			std::vector<char> str = new_char_str( ( char* )FSString( pData[i].prompt.Data() ).Get( kbdIntParam->charset ) );

			if ( str.data() )
			{
				int l = strlen( str.data() );
				responses[i].length = l;
				responses[i].text = ( char* ) malloc( l + 1 );

				if ( responses[i].text ) { strcpy( responses[i].text, str.data() ); }

			}
		}

	}
	catch ( cexception* ex )
	{
		fprintf( stderr, "exception in kbdint callback used with libssh2: %s\n", ex->message() );
		ex->destroy();
	}
	catch ( ... )
	{
		fprintf( stderr, "excention (...) in kbdint callback used with libssh2\n" );
	}
}
Exemplo n.º 7
0
int CRealControlSocket::ContinueConnect()
{
	wxString host;
	unsigned int port = 0;

	const int proxy_type = m_pEngine->GetOptions()->GetOptionVal(OPTION_PROXY_TYPE);
	if (proxy_type > CProxySocket::unknown && proxy_type < CProxySocket::proxytype_count && !m_pCurrentServer->GetBypassProxy())
	{
		LogMessage(::Status, _("Connecting to %s through proxy"), m_pCurrentServer->FormatHost().c_str());

		host = m_pEngine->GetOptions()->GetOption(OPTION_PROXY_HOST);
		port = m_pEngine->GetOptions()->GetOptionVal(OPTION_PROXY_PORT);

		delete m_pBackend;
		m_pProxyBackend = new CProxySocket(this, m_pSocket, this);
		m_pBackend = m_pProxyBackend;
		int res = m_pProxyBackend->Handshake((enum CProxySocket::ProxyType)proxy_type,
											 m_pCurrentServer->GetHost(), m_pCurrentServer->GetPort(),
											  m_pEngine->GetOptions()->GetOption(OPTION_PROXY_USER),
											  m_pEngine->GetOptions()->GetOption(OPTION_PROXY_PASS));

		if (res != EINPROGRESS)
		{
			LogMessage(::Error, _("Could not start proxy handshake: %s"), CSocket::GetErrorDescription(res).c_str());
			DoClose();
			return FZ_REPLY_ERROR;
		}
	}
	else
	{
		if (m_pCurOpData && m_pCurOpData->opId == cmd_connect)
		{
			CConnectOpData* pData(static_cast<CConnectOpData*>(m_pCurOpData));
			host = ConvertDomainName(pData->host);
			port = pData->port;
		}
		if (host == _T(""))
		{
			host = m_pCurrentServer->GetHost();
			port = m_pCurrentServer->GetPort();
		}
	}
	if (!IsIpAddress(host))
		LogMessage(Status, _("Resolving address of %s"), host.c_str());

	int res = m_pSocket->Connect(host, port);

	// Treat success same as EINPROGRESS, we wait for connect notification in any case
	if (res && res != EINPROGRESS)
	{
		LogMessage(::Error, _("Could not connect to server: %s"), CSocket::GetErrorDescription(res).c_str());
		DoClose();
		return FZ_REPLY_ERROR;
	}

	return FZ_REPLY_WOULDBLOCK;
}
void QEnginioOperationShared::dumpDebugInfo(QDebug &d) const
{
    QRestOperationShared::dumpDebugInfo(d);
#if 0
    QByteArray json = _client->_requestData.value(_nreply);

    if (!json.isEmpty()) {
        if (request.url().toString(QUrl::None).endsWith(QString::fromUtf8("account/auth/identity"))) {
            qDebug() << "Request Data hidden because it contains password";
        } else {
            qDebug() << "Request Data:" << json;
        }
    }

    if (!pData().isEmpty()) {
        qDebug() << "Reply Data:" << pData();
    }

#endif
}
Exemplo n.º 9
0
void tGauge::SetCaptions()
{
    if( m_Indicators.size() > 0 )
    {
        //Get everything we need from tDigitalData
        tDigitalData pData( m_Indicators.at( 0 ).dataId );

        //Captions and units
        m_ShortCaption = pData.Caption( true ).toUpper();
        m_Caption = pData.Caption( false ).toUpper();
        m_UnitsStr = pData.UnitStr();
    }
}
Exemplo n.º 10
0
void tGauge::UnitsChanged( tUnitsType type, int unitsValue )
{
    if( ( m_Indicators.size() > 0 ) && ( m_UnitsType == type ) )
    {
        tDigitalData pData( m_Indicators.at( 0 ).dataId );
        tConvert* pConverter = tConvert::Instance();

        //special case for UNITS_ECONOMY. They can be inverted by the user, and we need
        //to retrieve the new limits from tDigitalData, which handles this.
        if( type == UNITS_ECONOMY )
        {
            RealLimits.max = pData.MaxConverted();
            RealLimits.min = pData.MinConverted();

            RealWarnings.max = pData.WarningHighConverted();
            RealWarnings.min = pData.WarningLowConverted();

            AbsoluteLimits.max = pData.AbsoluteMaxConverted();
            AbsoluteLimits.min = pData.AbsoluteMinConverted();
        }
        else
        {
            tFloatLimits limits;
            limits.max = pConverter->ToUser( m_UnitsType, m_UnitsValue, RealLimits.max );
            limits.min = pConverter->ToUser( m_UnitsType, m_UnitsValue, RealLimits.min );

            tFloatLimits warnings;
            warnings.max = pConverter->ToUser( m_UnitsType, m_UnitsValue, RealWarnings.max );
            warnings.min = pConverter->ToUser( m_UnitsType, m_UnitsValue, RealWarnings.min );

            tFloatLimits absLimits;
            absLimits.max = pConverter->ToUser( m_UnitsType, m_UnitsValue, AbsoluteLimits.max );
            absLimits.min = pConverter->ToUser( m_UnitsType, m_UnitsValue, AbsoluteLimits.min );
            AbsoluteLimits = absLimits;
            SetLimits( limits, warnings );
        }

        m_UnitsType = type;
        m_UnitsValue = unitsValue;

        int limitIndex = GetCustomHobartLimits();
        SetCustomHobartLimits( limitIndex );

        OnLimitsChanged();

        m_UnitsStr = pData.UnitStr();
        ReconfigureGauge();
        InvalidateBackground();
    }
}
Exemplo n.º 11
0
size_t BinaryData::ReadFromResource(LPCTSTR lpName, LPCTSTR lpType, HMODULE hModule /* = NULL */)
{
    SetData();
    HRSRC hRSRC(FindResource(hModule, lpName, lpType));
    if (hRSRC != NULL) {
        HGLOBAL hRes(LoadResource(hModule, hRSRC));
        if (hRes != NULL) {
            LPVOID pData(LockResource(hRes));
            if (pData != NULL) {
                SetData(pData, SizeofResource(hModule, hRSRC), true);
            }
        }
    }
    return Size();
}
Exemplo n.º 12
0
TDenseMatrix SBVAR::SimulateData(const TDenseVector &parameters, int n_obs)
{
  TData_predetermined *data=(TData_predetermined*)pData();

  int n_exogenous=data->NumberPredeterminedVariables() - data->NumberLags()*data->NumberVariables();
  if ((n_exogenous > 1) || ((n_exogenous == 1) && !(data->IsConstant())))
    throw dw_exception("SBVAR::SimulateData() - the only exogenous variable permissible is a constant");

  if (parameters.dim != NumberParameters())
    throw dw_exception("SBVAR::SimulationData() - invalid number of parameters");
 
 
  SetParameters(parameters.vector);
  TDenseMatrix A0=GetA0(), Aplus=GetAplus();
  return ::SimulateData(n_obs+n_lags,A0,Aplus,data->IsConstant(),n_obs);
}
Exemplo n.º 13
0
void* FX_OpenFolder(const FX_WCHAR* path) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
  std::unique_ptr<CFindFileDataW> pData(new CFindFileDataW);
  pData->m_Handle = FindFirstFileExW((CFX_WideString(path) + L"/*.*").c_str(),
                                     FindExInfoStandard, &pData->m_FindData,
                                     FindExSearchNameMatch, nullptr, 0);
  if (pData->m_Handle == INVALID_HANDLE_VALUE)
    return nullptr;

  pData->m_bEnd = FALSE;
  return pData.release();
#else
  DIR* dir = opendir(CFX_ByteString::FromUnicode(path).c_str());
  return dir;
#endif
}
HBufC8* CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC( TAny*& aCellAddress, TThreadId aThreadId )
    {
    //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - START - aCellAddress: 0x%08x, aThread: %d", aCellAddress, I64INT(aThreadId.Id()));

    // This is what we'll return, if we find it...
    HBufC8* heapCellData = NULL;

    // Now walk the heap!
    TInt err = iEngine.Driver().WalkHeapInit( aThreadId );
    User::LeaveIfError( err );

    // Now we can try to find the cell's info
    TMemSpyDriverCellType cellType;
    TInt cellLength;
    TInt cellNestingLevel;
    TInt cellAllocationNumber;
    TInt cellHeaderSize;
    TAny* cellPayloadAddress;
    //
    err = iEngine.Driver().WalkHeapGetCellInfo( aCellAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
    //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - err: %d, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, cellLength, cellAllocationNumber, cellType);
    User::LeaveIfError( err );
    
	if (cellType & EMemSpyDriverAllocatedCellMask)
        {
        const TInt payloadLength = cellLength;
        HBufC8* data = HBufC8::NewLC( payloadLength );
        TPtr8 pData( data->Des() );
        //
        err = iEngine.Driver().WalkHeapReadCellData( aCellAddress, pData, payloadLength );
        //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - data fetch returned error: %d", err);
        User::LeaveIfError( err );
        heapCellData = data;
        CleanupStack::Pop( data );
        }
    //
    if  ( heapCellData == NULL )
        {
        //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - END - didn't find the right cell => KErrNotFound");
        User::Leave( KErrNotFound );
        }
    //
    CleanupStack::PushL( heapCellData );

    //RDebug::Printf("CMemSpyEngineHelperActiveObject::SchedulerHeapCellDataLC() - END - everything okay, cell is: 0x%08x", aCellAddress);
    return heapCellData;
    }
Exemplo n.º 15
0
void tGauge::ChangeDataType( const tDataId& dataId )
{
    m_SaveLimits = false;

    if( dataId == DATA_TYPE_INVALID )
    {
        return;
    }
    //clear existing indicators
    m_Indicators.clear();
    m_Indicators << tIndicator( dataId );

    //set captions and limits
    tDigitalData pData( dataId );
    AbsoluteLimits = pData.AbsoluteLimitsConverted();
    tFloatLimits limits( pData.MinConverted(), pData.MaxConverted() );
    tFloatLimits warnings( pData.WarningLowConverted(), pData.WarningHighConverted() );
    m_UnitsType = pData.Units();
    m_UnitsValue = tUnitsSettings::Instance()->Units( m_UnitsType );

    //set update timer and update immediately
    UpdateValues();

    //autoconfigure if applicable
    if( CanAutoConfigure() && AutoConfigure() )
    {
        DoAutoConfigure();
    }

    SetLimits( limits, warnings );
    SetCaptions();

    //does any type specific config
    ReconfigureGauge();

    m_BackIsCached = false;
    m_ForeIsCached = false;
    update();

    m_Modified = true;

    if( m_UnitsType != UNITS_ECONOMY )
    {
//        m_SaveLimits = true;
    }
}
void ListProcessInfo::decapsulate(std::string &message, int id){
  namespace bpt = boost::property_tree;
  std::stringstream ss(message);
  bpt::ptree pt;
  bpt::read_json(ss, pt);
  lock_.lock();
  lProcesses.clear();

//  std::cout << "--- message ("<< id << ") [" << strip(message)<<"]"<<std::endl;
  BOOST_FOREACH(const bpt::ptree::value_type& child, pt.get_child("data") ) {
    std::shared_ptr<ProcessInfo> pData(new ProcessInfo);
    pData->name              = child.second.get<std::string>("name");
// std::cout << "---    name:\t\t\t" << pData->name << std::endl;
    pData->username          = child.second.get<std::string>("username");
// std::cout << "---    username:\t\t" << pData->username << std::endl;
    pData->status            = child.second.get<std::string>("status");
// std::cout << "---    status:\t\t\t" << pData->status << std::endl;
    pData->cpu_times         = child.second.get<std::string>("cpu_times");
// std::cout << "---    cpu_times:\t\t" << pData->cpu_times << std::endl;
    pData->memory_vms_label  = child.second.get<std::string>("memory_vms_label");
// std::cout << "---    memory_vms_label:\t" << pData->memory_vms_label << std::endl;
    pData->memory_rss_label  = child.second.get<std::string>("memory_rss_label");
// std::cout << "---    memory_rss_label:\t" << pData->memory_rss_label << std::endl;

    pData->memory_vms_info   = child.second.get<long>("memory_vms_info");
// std::cout << "---    memory_vms_info:\t\t" << pData->memory_vms_info << std::endl;
    pData->memory_rss_info   = child.second.get<long>("memory_rss_info");
// std::cout << "---    memory_rss_info:\t\t" << pData->memory_rss_info << std::endl;
    pData->nice              = child.second.get<int>("nice");
// std::cout << "---    nice:\t\t\t" << pData->nice << std::endl;
    pData->pid  			 = child.second.get<int>("pid");
// std::cout << "---    pid:\t" << pData->pid << std::endl;

    pData->cpu_percent       = child.second.get<double>("cpu_percent");
// std::cout << "---    cpu_percent:\t\t" << pData->cpu_percent << std::endl;
    pData->memory_percent    = child.second.get<double>("memory_percent");
// std::cout << "---    memory_percent:\t\t" << pData->memory_percent << std::endl;

//    cout << "  *** name: " << pData->name << endl;
    lProcesses.push_back (  std::move(pData) );
  }
  processSize = lProcesses.size();
  lock_.unlock();
//  cout << "  *** processSize: " << processSize << endl;
}
Exemplo n.º 17
0
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
ExplorerNodeFactory::pUserData_type
ExplorerNodeFactory::createTerrainChunk(Zen::Studio::Workbench::I_ExplorerNode& _node)
{
    Zen::Studio::Workbench::I_ExplorerNode::UserData* pParentUserData =
        _node.getUserData().get();

    TerrainGroupNode* pParentNode = dynamic_cast<TerrainGroupNode*>(pParentUserData);

    if (pParentNode != NULL)
    {
        // The TerrainGroupNode will get the name from the database later, so
        // just pass an empty string for now.
        pUserData_type pData(new TerrainChunkNode(pParentNode->getProject(), ""));
        return pData;
    }
    else
    {
        throw Zen::Utility::runtime_exception("Error, invalid parent type.");
    }
}
//*************************************************************************************
void CConsoleAlarmAlertSession::SetAlarmL(const RMessage2& aMessage)
	{
	TPckg<TASShdAlarm> pA(iAlarm);
	aMessage.ReadL(KSlot0, pA);
	if	(iAlarm.HasAssociatedData())
		{
		iAlarmAssociatedDataSize = aMessage.GetDesLength(2);
		TPckg<TAgnAlarmInfo> pB(iAlarmData);
		aMessage.ReadL(KSlot2, pB);

		//Storing the data in the server for the test session to read..
		HBufC8* data = HBufC8::NewLC(iAlarmAssociatedDataSize);
		TPtr8 pData(data->Des());
		aMessage.ReadL(KSlot2, pData);
		iServer->SetAttachment(data);  //Server takes an ownership
		CleanupStack::Pop(data);
		}
	else
		iAlarmAssociatedDataSize = 0;
	}
Exemplo n.º 19
0
void CTreSubfile::ParseLevels()
{
	if (m_fLevelsParsed || !m_pSubFile)
		return;
	// Levels
	// Read levels data
	std::auto_ptr<Byte> pData(new Byte[m_uiMapLevelsLen]);
	m_pSubFile->Read(pData.get(), m_uiMapLevelsOffset, m_uiMapLevelsLen);
	// Parse the data from the beginning
	UInt uiLevelOffset;
	for (uiLevelOffset = 0; uiLevelOffset < m_uiMapLevelsLen; uiLevelOffset += CMapLevel::cnSize)
	{
		// Add level & make it read its data
		m_Levels.push_back(CMapLevel());
		m_Levels.back().Read(pData.get() + uiLevelOffset);
	}
	// Tell the last level it's last
	m_Levels.back().SetLast();
	m_fLevelsParsed = true;
}
void VJSXMLHttpRequest::Construct(XBOX::VJSParms_construct& ioParms)
{
    XMLHttpRequest* xhr=new XMLHttpRequest();

    if(!xhr)
    {
        XBOX::vThrowError(VE_XHRQ_IMPL_FAIL_ERROR);
        return;
    }
	

    XBOX::VJSObject pData(ioParms.GetContext());
	bool resData;
    resData=ioParms.GetParamObject(1, pData);

	if(resData)
	{
		XBOX::VJSValue hostValue=pData.GetProperty("host", NULL);
		XBOX::VString hostString;
		bool hostRes=hostValue.GetString(hostString, NULL);

		if(hostRes) //we have a proxy
		{
			XBOX::VJSValue portValue=pData.GetProperty("port", NULL);
			sLONG portLong=0;
			bool portRes=portValue.GetLong(&portLong, NULL);

			portLong=(portRes && portLong>0) ? portLong : 80;

			//todo : user and passwd

			XBOX::VError res=xhr->SetProxy(hostString, portLong);

			if(res!=XBOX::VE_OK)
				XBOX::vThrowError(res);
		}
	}

    ioParms.ReturnConstructedObject(VJSXMLHttpRequest::CreateInstance(ioParms.GetContextRef(), xhr));

}
Exemplo n.º 21
0
tGaugeParams tGauge::GetGaugeParams()
{
    tGaugeParams params;

    if( m_Indicators.size() > 0 )
    {
        params.m_Limits = tFloatLimits();
        tDigitalData pData( tDataId( m_Indicators.at( 0 ).dataId ) );

        if( ( tFloatLimits( pData.MinConverted(), pData.MaxConverted() ) != RealLimits ) /*|| m_SaveLimits*/ )
        {
            //the user has set their own limits - save them in base units.
            params.m_Limits = pData.UnconvertLimits( RealLimits );
        }

        params.m_Warnings = tFloatLimits();

        if( ( tFloatLimits( pData.WarningLowConverted(), pData.WarningHighConverted() ) != RealWarnings ) /*|| m_SaveLimits*/ )
        {
            //the user has set their own warnings - save them in base units
            params.m_Warnings = pData.UnconvertLimits( RealWarnings );
        }

        params.m_DataList = GetDataSources();
        params.m_UsesGauge = objectName();
        params.m_Geometry = QRect();
        params.m_GaugeFlags = GaugeFlags();

        if( m_IsOverlay )
        {
            params.m_Geometry = QRect( pos(), size() );
            params.m_GaugeType = GaugeType();
        }
    }

    m_Modified = false;
    m_SaveLimits = false;

    return params;
}
Exemplo n.º 22
0
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
ExplorerNodeFactory::pUserData_type
ExplorerNodeFactory::createFolder(Zen::Studio::Workbench::I_ExplorerNode& _node)
{
    Zen::Studio::Workbench::I_ExplorerNode::UserData* pParentUserData =
        _node.getUserData().get();

    // This is a folder, so quite likely (always?) the parent's user data is 
    // a project.
    Project* pParentProject = dynamic_cast<Project*>(pParentUserData);

    if (pParentProject != NULL)
    {
        // The Folder will get the name from the database, so just
        // pass an empty string for now.
        pUserData_type pData(new Folder(*pParentProject, ""));
        return pData;
    }
    else
    {
        throw Zen::Utility::runtime_exception("Error, invalid parent type.");
    }
}
Exemplo n.º 23
0
static void TestUtcAlarmDataFunctionalityL()
{
    TheAlarmTest.Test().Next(_L("Test alarm data functionality"));

    time.HomeTime();
    time += TTimeIntervalMinutes(1);
    id = AddUtcAlarm(time);

    _LIT8(KAlarmData, "some 8-bit data to attach to the alarm");

    ret = TheAlarmTest.Session().AlarmDataAttachL(id, KAlarmData());
    TheAlarmTest(ret == KErrNone, __LINE__);
    ret = TheAlarmTest.Session().AlarmDataSize(id);
    TheAlarmTest(ret > 0, __LINE__);

    HBufC8* temp = HBufC8::NewLC(KAlarmData().Size());
    TPtr8 pData(temp->Des());
    ret = TheAlarmTest.Session().GetAlarmData(id, pData);
    TheAlarmTest(ret == KErrNone, __LINE__);
    TheAlarmTest(pData.CompareC(KAlarmData()) == 0, __LINE__);
    CleanupStack::PopAndDestroy(temp);
}
Exemplo n.º 24
0
void tGauge::InitialiseLimits()
{
    tDigitalData pData( GetDataId() );

    m_UnitsType = pData.Units( GetDataId().DataType() );
    m_UnitsValue = tUnitsSettings::Instance()->Units( m_UnitsType );

    AbsoluteLimits = pData.AbsoluteLimitsConverted();

    //Check for user specified limits, else get from tDigitalData.
    tFloatLimits limits;
    if( m_GaugeParams.m_Limits.IsValid() && m_UnitsType != UNITS_ECONOMY )
    {
        limits = pData.ConvertLimits( m_GaugeParams.m_Limits );
    }
    else
    {
        limits = tFloatLimits( pData.MinConverted(), pData.MaxConverted() );
    }

    //Check for user specified warnings, else get from tDigitalData.
    tFloatLimits warnings;
    if( m_GaugeParams.m_Warnings.IsValid() && m_UnitsType != UNITS_ECONOMY )
    {
        warnings = pData.ConvertLimits( m_GaugeParams.m_Warnings );
    }
    else
    {
        warnings = tFloatLimits( pData.WarningLowConverted(), pData.WarningHighConverted() );
    }

    SetCaptions();

    //mildly bad form when called from the constructor as SetLimits is virtual.. but base implementation is desired in this case, so all good.
    tGauge::SetLimits( limits, warnings );

    // We may have dynamically changing custom limits.
    OnLimitsChanged();
}
Exemplo n.º 25
0
bool tGauge::UpdateValues()
{
    bool changed = false;

    for( int i = 0; i < m_Indicators.size(); ++i )
    {
        tDigitalData pData( m_Indicators[ i ].dataId );

        float value = 0.0f;
        if( pData.DampedValueConverted( value ) )
        {
            if( m_Indicators[ i ].value != value || m_Indicators[ i ].isValid == false )
            {
                m_Indicators[ i ].isValid = true;
                m_Indicators[ i ].value = value;
                changed = true;
            }
        }
        else
        {
            if( m_Indicators[ i ].isValid != false )
            {
                m_Indicators[ i ].isValid = false;
                changed = true;
            }
        }
    }
    if( GaugeType() == AnalogGauge )
    {
        setEnabled( AnyValidIndicators() );
    }
    if( changed )
    {
        InvalidateForeground();
    }

    return changed;
}
Exemplo n.º 26
0
bool CGeppetto::BuildFromInputScript(const tstring& sScript)
{
	FILE* fp = tfopen_asset(GetPath(sScript), "r");
	if (!fp)
	{
		TError("Could not read input script '" + sScript + "'\n");
		return false;
	}

	std::shared_ptr<CData> pData(new CData());
	CDataSerializer::Read(fp, pData.get());

	CData* pOutput = pData->FindChild("Output");
	if (!pOutput)
	{
		TError("Could not find Output section in input script '" + sScript + "'\n");
		return false;
	}

	CData* pGame = pData->FindChild("Game");
	if (!pGame)
	{
		TError("Could not find Game section in input script '" + sScript + "'\n");
		return false;
	}

	t.SetGameDirectory(FindAbsolutePath(GetPath(pGame->GetValueString())));

	tstring sOutputDir = ToForwardSlashes(pOutput->GetValueString());
	t.SetOutputDirectory(GetDirectory(sOutputDir));
	t.SetOutputFile(GetFilename(sOutputDir));
	t.SetScriptDirectory(GetDirectory((GetPath(sScript))));

	m_sOutput = FindAbsolutePath(t.GetGameDirectory() + T_DIR_SEP + pOutput->GetValueString());

	CData* pSceneAreas = pData->FindChild("SceneAreas");
	CData* pMesh = pData->FindChild("Mesh");
	CData* pPhysics = pData->FindChild("Physics");
	CData* pPhysicsShapes = pData->FindChild("PhysicsShapes");

	// Find all file modification times.
	time_t iScriptModificationTime = GetFileModificationTime(sScript.c_str());
	time_t iOutputModificationTime = GetFileModificationTime(m_sOutput.c_str());

	tmap<tstring, time_t> aiSceneModificationTimes;

	if (pSceneAreas)
	{
		for (size_t i = 0; i < pSceneAreas->GetNumChildren(); i++)
		{
			CData* pArea = pSceneAreas->GetChild(i);

			if (pArea->GetKey() != "Area")
				continue;

			tstring sFile = pArea->FindChildValueString("File");
			TAssert(sFile.length());
			if (!sFile.length())
				continue;

			auto it = aiSceneModificationTimes.find(sFile);
			if (it == aiSceneModificationTimes.end())
				aiSceneModificationTimes[sFile] = GetFileModificationTime(sFile.c_str());
		}
	}

	time_t iInputModificationTime = 0;
	if (pMesh)
		iInputModificationTime = GetFileModificationTime(pMesh->GetValueString().c_str());
	time_t iPhysicsModificationTime = 0;
	if (pPhysics)
		iPhysicsModificationTime = GetFileModificationTime(pPhysics->GetValueString().c_str());

	bool bRecompile = false;
	if (iScriptModificationTime > iOutputModificationTime)
		bRecompile = true;
	else if (iInputModificationTime > iOutputModificationTime)
		bRecompile = true;
	else if (iPhysicsModificationTime > iOutputModificationTime)
		bRecompile = true;
	else if (m_iBinaryModificationTime > iOutputModificationTime)
		bRecompile = true;
	else
	{
		for (auto it = aiSceneModificationTimes.begin(); it != aiSceneModificationTimes.end(); it++)
		{
			if (it->second > iOutputModificationTime)
			{
				bRecompile = true;
				break;
			}
		}
	}

	if (!bRecompile)
	{
		if (m_bForceCompile)
		{
			TMsg("Forcing rebuild even though no changes detected.\n");
		}
		else
		{
			TMsg("No changes detected. Skipping '" + m_sOutput + "'.\n\n");
			return true;
		}
	}

	CData* pGlobalTransforms = pData->FindChild("UseGlobalTransforms");
	if (pGlobalTransforms)
		t.UseGlobalTransformations();
	else
		t.UseLocalTransformations();

	t.UseUV();
	t.UseNormals();

	if (pMesh)
	{
		tstring sExtension = pMesh->GetValueString().substr(pMesh->GetValueString().length()-4);
		if (sExtension == ".png")
		{
			TUnimplemented();	// Not updated since the switch to materials.
			int x, y, n;
			unsigned char* pData = stbi_load((GetPath(pMesh->GetValueString())).c_str(), &x, &y, &n, 0);

			if (!pData)
			{
				TError("Couldn't load '" + pMesh->GetValueString() + "', reason: " + stbi_failure_reason() + "\n");
				return false;
			}

			stbi_image_free(pData); // Don't need it, just need the dimensions.

			Vector vecUp = Vector(0, 0, 0.5f) * ((float)y/100);
			Vector vecLeft = Vector(0, 0.5f, 0) * ((float)x/100);

			t.UseNormals(false);

			if (IsAbsolutePath(pMesh->GetValueString()))
				t.AddMaterial(GetPath(pMesh->GetValueString()));
			else
				t.AddMaterial(t.GetOutputDirectory() + "/" + pMesh->GetValueString(), GetPath(pMesh->GetValueString()));
			t.AddVertex(0, -vecLeft + vecUp, Vector2D(0.0f, 1.0f));
			t.AddVertex(0, -vecLeft - vecUp, Vector2D(0.0f, 0.0f));
			t.AddVertex(0, vecLeft - vecUp, Vector2D(1.0f, 0.0f));

			t.AddVertex(0, -vecLeft + vecUp, Vector2D(0.0f, 1.0f));
			t.AddVertex(0, vecLeft - vecUp, Vector2D(1.0f, 0.0f));
			t.AddVertex(0, vecLeft + vecUp, Vector2D(1.0f, 1.0f));
		}
		else if (sExtension == ".mat")
		{
			CMaterialHandle hMaterial(pMesh->GetValueString());
			if (!hMaterial.IsValid())
			{
				TError("Input material  '" + pMesh->GetValueString() + "' does not exist or is invalid.\n");
				return false;
			}

			if (!hMaterial->m_ahTextures.size())
			{
				TError("Input material  '" + pMesh->GetValueString() + "' has no textures.\n");
				return false;
			}

			float w = (float)hMaterial->m_ahTextures[0]->m_iWidth;
			float h = (float)hMaterial->m_ahTextures[0]->m_iHeight;

			Vector vecUp = Vector(0, 0.5f, 0) * (h/hMaterial->m_iTexelsPerMeter);
			Vector vecRight = Vector(0, 0, 0.5f) * (w/hMaterial->m_iTexelsPerMeter);

			t.UseNormals(false);

			t.AddMaterial(pMesh->GetValueString());

			t.AddVertex(0, -vecRight + vecUp, Vector2D(0.0f, 1.0f));
			t.AddVertex(0, -vecRight - vecUp, Vector2D(0.0f, 0.0f));
			t.AddVertex(0, vecRight - vecUp, Vector2D(1.0f, 0.0f));

			t.AddVertex(0, -vecRight + vecUp, Vector2D(0.0f, 1.0f));
			t.AddVertex(0, vecRight - vecUp, Vector2D(1.0f, 0.0f));
			t.AddVertex(0, vecRight + vecUp, Vector2D(1.0f, 1.0f));
		}
		else
		{
			TMsg("Reading model '" + GetPath(pMesh->GetValueString()) + "' ...");
			std::shared_ptr<CConversionScene> pScene(new CConversionScene());
			CModelConverter c(pScene.get());

			if (!c.ReadModel(GetPath(pMesh->GetValueString())))
			{
				TError("Couldn't read '" + GetPath(pMesh->GetValueString()) + "'.\n");
				return false;
			}
			TMsg(" Done.\n");

			TMsg("Building toy mesh ...");
			LoadSceneIntoToy(pScene.get(), &t);
			TMsg(" Done.\n");
		}
	}

	if (pPhysics)
	{
		TMsg("Reading physics model '" + GetPath(pPhysics->GetValueString()) + "' ...");
		std::shared_ptr<CConversionScene> pScene(new CConversionScene());
		CModelConverter c(pScene.get());

		if (!c.ReadModel(GetPath(pPhysics->GetValueString())))
		{
			TError("Couldn't read '" + GetPath(pPhysics->GetValueString()) + "'.\n");
			return false;
		}
		TMsg(" Done.\n");

		TMsg("Building toy physics model ...");
		LoadSceneIntoToyPhysics(pScene.get(), &t);
		TMsg(" Done.\n");
	}

	if (pPhysicsShapes)
	{
		for (size_t i = 0; i < pPhysicsShapes->GetNumChildren(); i++)
		{
			CData* pShape = pPhysicsShapes->GetChild(i);

			TAssert(pShape->GetKey() == "Box");
			if (pShape->GetKey() != "Box")
				continue;

			TRS trs = pShape->GetValueTRS();

			t.AddPhysBox(trs);
		}
	}

	if (pSceneAreas)
		LoadSceneAreas(pSceneAreas);

	return Compile();
}
void CMemSpyEngineHelperHeap::OutputHeapDataKernelL(const TMemSpyHeapInfo& aHeapInfo, 
                                                    TBool aCreateDataStream, 
                                                    const RArray<TMemSpyDriverCell>* aCells)
    {
    TFullName threadName;
    MemSpyEngineUtils::GetKernelHeapThreadName( threadName, EFalse );

    // Begin a new data stream
    if  ( aCreateDataStream )
        {
        _LIT( KMemSpyFolder, "Heap\\Data" );
        _LIT( KMemSpyContext, "Heap Data - %S" );
        HBufC* context = HBufC::NewLC( KMaxFileName );
        TPtr pContext( context->Des() );
        pContext.Format( KMemSpyContext, &threadName );
        iEngine.Sink().DataStreamBeginL( pContext, KMemSpyFolder );
        CleanupStack::PopAndDestroy( context );
        }

    TBuf<KMaxFullName + 100> printFormat;

    // Start marker
    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerHeapData, &KNullDesC, aHeapInfo.Tid() );

    // Set overall prefix
    iEngine.Sink().OutputPrefixSetFormattedLC( KMemSpyPrefixHeapData, &threadName );

    // Info section
    OutputHeapInfoL( aHeapInfo, threadName, aCells );

    // Code segments (needed for map file reading...)
    _LIT(KCellListCodeSegInfoFormat, "CodeSegs - ");
    iEngine.HelperCodeSegment().OutputCodeSegmentsL( aHeapInfo.Pid(), printFormat, KCellListCodeSegInfoFormat, '-', ETrue );

    // Dump section
    _LIT(KHeaderDump, "Heap Data");
    iEngine.Sink().OutputSectionHeadingL( KHeaderDump, '-' );

    HBufC8* data = HBufC8::NewLC( 4096 * 12 );
    TPtr8 pData(data->Des());
    TUint remaining = 0;
    TUint readAddress = 0;

    TInt r = iEngine.Driver().GetHeapDataKernel(aHeapInfo.Tid(), pData, readAddress, remaining);
    TUint prevEndAddress = readAddress + pData.Length();
    if (r == KErrNone)
        {
        while (r == KErrNone)
            {
            if (readAddress > prevEndAddress)
                {
                // We've hit a discontinuity, ie one or more unmapped pages
                _LIT(KBreak, "........");
                iEngine.Sink().OutputLineL(KBreak);
                }
            _LIT(KHeapDumpDataFormat, "%S");
            iEngine.Sink().OutputBinaryDataL(KHeapDumpDataFormat, pData.Ptr(), (const TUint8*) readAddress, pData.Length());
            readAddress += pData.Length();
            if (remaining > 0)
                {
                prevEndAddress = readAddress;
                r = iEngine.Driver().GetHeapDataKernelNext(aHeapInfo.Tid(), pData, readAddress, remaining);
                }
            else
                break;
            }
        }
    else
        {
        _LIT( KHeapFetchError, "Heap error: %d");
        iEngine.Sink().OutputLineFormattedL( KHeapFetchError, r );
        }

    CleanupStack::PopAndDestroy( data );

    CleanupStack::PopAndDestroy(); // clear prefix

    // End marker
    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerHeapData, &KMemSpySinkTagClose, aHeapInfo.Tid() );

    if  ( aCreateDataStream )
        {
        iEngine.Sink().DataStreamEndL();
        }
    }
TAny* CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL( TAny* aCellAddress, CMemSpyEngineActiveObjectArray& aArray )
    {
    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - START");

    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.cellAddress:     0x%08x", aCellAddress);
    TAny* nextCellAddress = NULL;
    
    TMemSpyDriverCellType cellType;
    TInt cellLength;
    TInt cellNestingLevel;
    TInt cellAllocationNumber;
    TInt cellHeaderSize;
    TAny* cellPayloadAddress;

    // Make a separate copy of the cell address - calling GetCellInfo may well result in the address being
    // changed in order to match the real starting address of a *heap cell*.
    TAny* requestedCellAddress = aCellAddress;
    TInt err = iEngine.Driver().WalkHeapGetCellInfo( requestedCellAddress, cellType, cellLength, cellNestingLevel, cellAllocationNumber, cellHeaderSize, cellPayloadAddress );
    //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - err: %d, cellLength: %d, cellAllocationNumber: %d, cellType: %d", err, cellLength, cellAllocationNumber, cellType);
    User::LeaveIfError( err );
    
    if (cellType & EMemSpyDriverAllocatedCellMask)
        {
        const TInt payloadLength = cellLength;
        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - payloadLength: %d", payloadLength);

        // const TInt payloadLength = Max( 512, cellLength - iHeapInfo.iHeapCellHeaderLengthAllocated ); // Prevent negative payload lengths?
        CBufFlat* data = CBufFlat::NewL( payloadLength );
        CleanupStack::PushL( data );
        data->ResizeL( payloadLength );
        TPtr8 pData( data->Ptr( 0 ) );
        //
        err = iEngine.Driver().WalkHeapReadCellData( requestedCellAddress, pData, payloadLength );
        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.heapCellAddress: 0x%08x (err: %d)", requestedCellAddress, err);
        User::LeaveIfError( err );

        // If an object is embedded directly within a class, for example
        //
        // class CSomething : public CBase
        //   {
        //   CIdle iEmbeddedIdler;
        //   }
        //
        // then aCellAddress actually points to somewhere *within* a heap cell, not to the actual starting address of
        // the heap cell itself. We must take this into account when parsing the heap cell data (i.e. the bit of the cell we
        // are interested in starts part way through the cell data).
        TInt cellOffset = TUint32( aCellAddress ) - TUint32( requestedCellAddress );
        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.cellOffset:      %d (ignoring cell header)", cellOffset);
        cellOffset -= cellHeaderSize;
        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.cellOffset:      %d (adjusted for cell header)", cellOffset);

        // Got the cell data for the active object. Let's parse it.
        RBufReadStream stream( *data, cellOffset );
        CleanupClosePushL( stream );

        // First item should be vTable
        TAny* vTable = (TAny*) stream.ReadUint32L();
        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.vTable:          0x%08x", vTable );

        // Next item should be the request status. First the iStatus, then the iFlags
        const TInt requestStatusValue = stream.ReadInt32L();
        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.rsVal:           %10d", requestStatusValue );
        const TUint requestStatusFlags = stream.ReadUint32L();
        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.rsFlags:         0x%02x", requestStatusFlags );

        // Next comes the baseclass for the link - TDblQueLinkBase
        TAny* nextEntryAddress = (TAny*) stream.ReadUint32L();
        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.iLink.Next:      0x%08x", nextEntryAddress );
        TAny* prevEntryAddress = (TAny*) stream.ReadUint32L();
        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.iLink.Prev:      0x%08x", prevEntryAddress );

        // Next comes the TPriQueueLink itself
        const TInt priority = stream.ReadInt32L();
        //RDebug::Printf("CMemSpyEngineHelperActiveObject::ReadActiveObjectDataL() - AO.iLink.Pri:       %d", priority );
        
        // Done - save object & tidy up
        CMemSpyEngineActiveObject* object = CMemSpyEngineActiveObject::NewLC( aCellAddress, vTable, priority, requestStatusValue, requestStatusFlags, nextEntryAddress, prevEntryAddress, iEngine );
        aArray.AddItemL( object );
        CleanupStack::Pop( object );
        CleanupStack::PopAndDestroy( 2, data ); // stream & data
        
        nextCellAddress = (TAny*) nextEntryAddress;
        //RDebug::Printf(" ");
        }

    return nextCellAddress;
    }
Exemplo n.º 29
0
UIAbout::UIAbout( QWidget* parent )
    : QDialog( parent )
{
    const QString tabString = "&nbsp;&nbsp;&nbsp;";
    
    const QString teamatesMask =
    "\t<tr>"
    "\t\t<td>%1 aka %2 (%3)<br />" +tabString +"<a href=\"mailto:%4\">%4</a><br />" +tabString +"%5</td>"
    "\t</tr>";
    
    const QString linksMask =
    "\t<tr>"
    "\t\t<td>%1<br />" +tabString +"<a href=\"%2\">%2</a></td>"
    "\t</tr>";
    
    const QString donationsMask =
    "\t<tr>"
    "\t\t<td>%1 aka %2 (%3)<br />" +tabString +"<a href=\"mailto:%4\">%4</a><br />" +tabString +"%5</td>"
    "\t</tr>";
    
    const QList<pData> teamates = QList<pData>()
        << pData( "Filipe Azevedo", "Nox P@sNox", QObject::tr( "France" ), "*****@*****.**", QObject::tr( "Creator & Principal Developer" ) )
        << pData( "Kopats Andrei", "hlamer", QObject::tr( "Belarus" ), "*****@*****.**", QObject::tr( "Principal Developer, Class Browser, Beloruss translator" ) )
        << pData( "Yannick", "xiantia", QObject::tr( "France" ), "*****@*****.**", QObject::tr( "GNU Debugger Plugin" ) )
        << pData( "Roper Alexander", "Minirop", QObject::tr( "France" ), "*****@*****.**", QObject::tr( "Qt Pro Parser, Some Features/Help" ) )
        << pData( "Mashin Evgeniy", "evgenM", QObject::tr( "Russia" ), "*****@*****.**", QObject::tr( "Many shared code between our IDEs" ) )
        << pData( "Manuel Schmidt", "oversize", QObject::tr( "Germany" ), "*****@*****.**", QObject::tr( "Web Developer & Web Designer" ) )
        << pData( "Julien Decologne", "Judd", QObject::tr( "France" ), "*****@*****.**", QObject::tr( "Splashscreen & Icons Designer" ) )
        << pData( "Plano Marc", "Marc31", QObject::tr( "France" ), "*****@*****.**", QObject::tr( "French Translator" ) )
        << pData( "Lukic Djordje", "rumpl", QObject::tr( "Serbia" ), "*****@*****.**", QObject::tr( "SDK Script Generator" ) )
        << pData( QString::fromUtf8( "Aurélien MICHON" ), "aurelien", QObject::tr( "France" ), "*****@*****.**", QObject::tr( "Winter Splashscreen Designer" ) )
    ;
    
    const QList<pData> links = QList<pData>()
        << pData( QString::null, QString::null, QString::null, QString( "http://%1" ).arg( PACKAGE_DOMAIN ), QObject::tr( "%1 homepage" ).arg( PACKAGE_NAME ) )
        << pData( QString::null, QString::null, QString::null, "https://launchpad.net/monkeystudio", QObject::tr( "Bug tracker" ) )
        << pData( QString::null, QString::null, QString::null, "http://monkeystudio.org/forum", QObject::tr( "Forums" ) )
        << pData( QString::null, QString::null, QString::null, "http://monkeystudio.org/rss.xml", QObject::tr( "News feed" ) )
        << pData( QString::null, QString::null, QString::null, "http://monkeystudio.org/team", QObject::tr( "MkS Team" ) )
        << pData( QString::null, QString::null, QString::null, "http://qt.nokia.com", QObject::tr( "Nokia's Qt homepage" ) )
        << pData( QString::null, QString::null, QString::null, "http://webissues.mimec.org", QObject::tr( "WebIssues" ) )
        << pData( QString::null, QString::null, QString::null, "http://webissues.monkeystudio.org", QObject::tr( "Our WebIssues Server (login/password: anonymous)" ) )
    ;
    
    const QList<pData> donations = QList<pData>()
        << pData( "Filipe Azevedo", "Nox P@sNox", QObject::tr( "France" ), "*****@*****.**", QObject::tr( "You can use this <a href=\"%1\">link</a> to make donation. Donations will help paying host/domain, and relatives things about the project." ).arg( PACKAGE_DONATION_LINK ) )
        << pData( "Viosoft Corporation", "Viosoft Corporation", QObject::tr( "U.S.A." ), "*****@*****.**", QObject::tr( "<a href=\"http://www.viosoft.com\">Homepage</a>" ) )
    ;
    
    setAttribute( Qt::WA_DeleteOnClose );
    setWindowTitle( tr( "About : %1" ).arg( PACKAGE_NAME ) );
    
    ui = new Ui::UIAbout;
    ui->setupUi( this );
    
    foreach ( QWidget* widget, findChildren<QWidget*>() ) {
        widget->setAttribute( Qt::WA_MacSmallSize );
    }
void CMemSpyEngineHelperHeap::OutputHeapDataUserL(const TProcessId& aPid, 
                                                  const TThreadId& aTid, 
                                                  const TDesC& aThreadName, 
                                                  const TMemSpyHeapInfo& aInfo, 
                                                  TBool aCreateDataStream, 
                                                  const RArray<TMemSpyDriverCell>* aCells )
    {
    TBuf<KMaxFullName + 100> printFormat;

    // Begin a new data stream
    if  ( aCreateDataStream )
        {
        _LIT( KMemSpyFolder, "Heap\\Data" );
        _LIT( KMemSpyContext, "Heap Data - %S" );
        HBufC* context = HBufC::NewLC( KMaxFileName );
        TPtr pContext( context->Des() );
        pContext.Format( KMemSpyContext, &aThreadName );
        iEngine.Sink().DataStreamBeginL( pContext, KMemSpyFolder );
        CleanupStack::PopAndDestroy( context );
        }

    // Get the heap info first of all
    iEngine.ProcessSuspendLC( aPid );

    // Start marker
    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerHeapData, &KNullDesC, (TUint) aTid );

    // Set overall prefix
    iEngine.Sink().OutputPrefixSetFormattedLC( KMemSpyPrefixHeapData, &aThreadName );

    // Info section
    OutputHeapInfoL( aInfo, aThreadName, aCells );

    // Code segments (needed for map file reading...)
    _LIT(KCellListCodeSegInfoFormat, "CodeSegs - ");
    iEngine.HelperCodeSegment().OutputCodeSegmentsL( aPid, printFormat, KCellListCodeSegInfoFormat, '-', ETrue );

    // Dump section
    _LIT(KHeaderDump, "Heap Data");
    iEngine.Sink().OutputSectionHeadingL( KHeaderDump, '-' );

    HBufC8* data = HBufC8::NewLC( 4096 * 12 );
    TPtr8 pData(data->Des());
    TUint remaining = 0;
    TUint readAddress = 0;

    // When we obtained the heap info, we also obtained a checksum of all the free cells
    // within the specified heap. We validate that this hasn't changed at the time we
    // request the heap data for paranoia purposes (There have been "Issues" with MemSpy
    // not actually suspending a process between fetching heap info & heap data, causing
    // a mismatch in free cell information).
    const TUint32 checksum = aInfo.AsRHeap().Statistics().StatsFree().Checksum();
    TRACE( RDebug::Printf( "CMemSpyEngineHelperHeap::OutputHeapDataUserL() - checksum: 0x%08x", checksum ) );

    TInt r = iEngine.Driver().GetHeapData( aTid, checksum, pData, readAddress, remaining );
	TUint prevEndAddress = readAddress + pData.Length();
    if (r == KErrNone)
        {
        while (r == KErrNone)
            {
			if (readAddress > prevEndAddress)
				{
				// We've hit a discontinuity, ie one or more unmapped pages
				_LIT(KBreak, "........");
				iEngine.Sink().OutputLineL(KBreak);
				}
            _LIT(KHeapDumpDataFormat, "%S");
            iEngine.Sink().OutputBinaryDataL(KHeapDumpDataFormat, pData.Ptr(), (const TUint8*) readAddress, pData.Length());
			readAddress += pData.Length();
            if (remaining > 0)
				{
				prevEndAddress = readAddress;
                r = iEngine.Driver().GetHeapDataNext(aTid, pData, readAddress, remaining);
				}
            else
                break;
            }
        }
    else
        {
        _LIT( KHeapFetchError, "Heap error: %d");
        iEngine.Sink().OutputLineFormattedL( KHeapFetchError, r );
        }

    CleanupStack::PopAndDestroy( data );

    CleanupStack::PopAndDestroy(); // clear prefix
    CleanupStack::PopAndDestroy(); // resume process

    // End marker
    iEngine.Sink().OutputLineFormattedL( KMemSpyMarkerHeapData, &KMemSpySinkTagClose, (TUint) aTid );

    if  ( aCreateDataStream )
        {
        iEngine.Sink().DataStreamEndL();
        }
    }