Esempio n. 1
0
void CDownloadQueue::AddDownload(CPartFile* file, bool paused, uint8 category)
{
	wxCHECK_RET(!IsFileExisting(file->GetFileHash()), wxT("Adding duplicate part-file"));

	if (file->GetStatus(true) == PS_ALLOCATING) {
		file->PauseFile();
	} else if (paused && GetFileCount()) {
		file->StopFile();
	}

	{
		wxMutexLocker lock(m_mutex);
		m_filelist.push_back( file );
		DoSortByPriority();
	}

	NotifyObservers( EventType( EventType::INSERTED, file ) );
	if (category < theApp->glob_prefs->GetCatCount()) {
		file->SetCategory(category);
	} else {
		AddDebugLogLineN( logDownloadQueue, wxT("Tried to add download into invalid category.") );
	}
	Notify_DownloadCtrlAddFile( file );
	theApp->searchlist->UpdateSearchFileByHash(file->GetFileHash());	// Update file in the search dialog if it's still open
	AddLogLineC(CFormat(_("Downloading %s")) % file->GetFileName() );
}
void CLogServBackupManager::RunL()
//
// This method does two things
//
// 1) Keeps trying to create a backup object - which may fail on device
//    bootup until the ui framework starts the backup server.
//
// 2) Handles the case where the server fails to restart correctly after a backup - it keeps trying
//
{
    LOGTEXT2("CLogServBackupManager::RunL(%d)", iStatus.Int());

    if	(!iBackup)
    {
        LOGTEXT("CLogServBackupManager::RunL() - trying to create backup object");

        // Keep trying to create backup object
        iBackup = CreateBackupL(*iDatabaseName);

        LOGTEXT("CLogServBackupManager::RunL() - backup object created okay");
    }
    else
    {
        // This branch is executed if we failed to create the backup object on our first
        // attempt in BISetDatabaseNameL
        LOGTEXT("CLogServBackupManager::RunL() - notifying observers about dummy backup ended event");
        NotifyObservers(MLogServBackupObserver::EBackupEnded);
    }

    LOGTEXT("CLogServBackupManager::RunL() - end");
}
Esempio n. 3
0
void Actor::SetPosition( const Vector3& pos, const bool notify /*= true*/ )
{
	if(pos.x != pos.x || pos.y != pos.y || pos.z != pos.z)
	{
		throw "Invalid position";
	}

	this->zPreviousPos = this->zPos;
	this->zPos = pos;

	
	
	if (this->zPhysicsObject)
	{
		this->zPhysicsObject->SetPosition(pos);
	}

	if(notify)
	{
		ActorPositionEvent APE;
		APE.zActor = this;
		NotifyObservers(&APE);
	}

}
void LongParameter::UpdatePercRef()
{
    if (m_pSizeData == NULL)
        return;
    switch (m_PercType)
    {
    case AREA:
        m_PercRef = m_pSizeData->GetArea();
        break;
    case HEIGHT:
        m_PercRef = m_pSizeData->GetHeight();
        break;
    case WIDTH:
        m_PercRef = m_pSizeData->GetWidth();
        break;
    case COLOUR_RANGE:
        m_PercRef = 255;
        break;
    default:
        m_PercRef = -1;
    }
    if (IsPercentModification())
        UpdateValueFromPercent();
    else
        UpdatePercentValue();
    NotifyObservers();
}
Parameter::~Parameter(void)
{
    m_Destroyed = true;
    NotifyObservers();
    if (m_pSizeData != NULL)
        m_pSizeData->RemoveObserver(this);
}
Esempio n. 6
0
/*****************************************************************************
 * Function -
 * DESCRIPTION:
 * Update subscribers when the alarm limit or warning limit datapoint
 * have been changed through the interface obtained by calls to
 * GetAlarmLimit() and GetWarningLimit()
 ****************************************************************************/
void AlarmConfig::Update(Subject* pSubject)
{
  if (!mLimitDatapointsChangedByAlarmConfig)
  {
    NotifyObservers();
    NotifyObserversE();
  }
}
Esempio n. 7
0
bool
CUDPChannel::DoNotifyObservers( const CORE::CEvent& eventid               ,
                                CORE::CICloneable* eventData /* = NULL */ )
{GUCEF_TRACE;
    
    return NotifyObservers( eventid   ,
                            eventData );
}
Esempio n. 8
0
void	CItemSlot::ChangeItemStatus( int iInvenIdx )
{
	m_pEvent->SetID( CTEventItem::EID_CHANGE_ITEM );
	m_pEvent->SetIndex( iInvenIdx );
	m_pEvent->SetItem( GetItem( iInvenIdx ) );
	SetChanged();
	NotifyObservers( m_pEvent );
}
bool
CFileSystemDialogImp::OnCancelButtonClick( const CEGUI::EventArgs& e )
{GUCE_TRACE;

    Hide();
    NotifyObservers( CancelPressedEvent );
    return true;
}
// -----------------------------------------------------------------------------
// CSipSnapAvailabilityMonitor::RunL
// -----------------------------------------------------------------------------
//
void CSipSnapAvailabilityMonitor::RunL()
{
    if ( iStatus == KErrNone )
    {
        iSnapAvailable = IsSnapAvailable( iSnapInfoBuf(), iSnapId );
        NotifyObservers();
    }
}
Esempio n. 11
0
void HourDataPoint::Update(Subject* pSubject)
{
  I32 value = ActTime::GetInstance()->GetTime(HOURS);
  if (mValue != value)
  {
    mValue = value;
    NotifyObservers();
  }
}
Esempio n. 12
0
void CAddonMgr::RemoveAddon(const CStdString& ID)
{
  if (m_cpluff && m_cp_context)
  {
    m_cpluff->uninstall_plugin(m_cp_context,ID.c_str());
    SetChanged();
    NotifyObservers(ObservableMessageAddons);
  }
}
Esempio n. 13
0
void
CButtonImp::OnMouseClick( MyGUI::Widget* sender )
{GUCEF_TRACE;

    GUCEF_USER_LOG( GUCEF::CORE::LOGLEVEL_NORMAL, "MyGUIOgre: User clicked button \"" + GetName() + "\"" );
    
    CWidgetImp< GUCEF::GUI::CButton >::OnMouseClick( sender );    
    NotifyObservers( ButtonClickedEvent );
}
Esempio n. 14
0
void
CTSGNotifier::OnPumpedNotify( CNotifier* notifier                 ,
                              const CEvent& eventid               ,
                              CICloneable* eventdata /* = NULL */ )
{GUCEF_TRACE;

    NotifyObservers( eventid   ,
                     eventdata );
}
Esempio n. 15
0
Model::Model()
{
	isGameOver = false;
	isGameWin = false;
	secondsPassed = 0;
	minutesPassed = 0;
	mtable = ntable = 0;
	NotifyObservers(Change::TIME);
}
Esempio n. 16
0
void YearDataPoint::Update(Subject* pSubject)
{
  I32 value = ActTime::GetInstance()->GetDate(YEAR);
  if (mValue != value)
  {
    mValue = value;
    NotifyObservers();
  }
}
Esempio n. 17
0
void MinuteDataPoint::Update(Subject* pSubject)
{
  I32 value = ActTime::GetInstance()->GetTime(MINUTES);
  if (mValue != value)
  {
    mValue = value;
    NotifyObservers();
  }
}
Esempio n. 18
0
///////////////////////////////////////////////////////////////////////////////
// Function: int CResourceGroup::PrimOnMediaCommandResponse(const CSipCallInfoSptr &a_sipCallInfo)
//
// Description: Handle a MSML server response for a command
//
// Return: int - 0 on success, otherwise failure
//
// Parameters: const CSipCallInfoSptr &a_sipCallInfo
//
///////////////////////////////////////////////////////////////////////////////
int CResourceGroup::PrimOnMediaCommandResponse( const CSipCallInfoSptr& a_sipCallInfo)
{
   LogDebug("PrimOnMediaCommandResponse");

 // TODO:   There may be an HMP bug on Linux because the 200 OK message 
 //         in Ethereal has the correct data but the GC event doesnt.  
 //         Works OK on Windows.
 //         There is an INFO message for setting video attribs that
 //         arrives immediately after the 200 OK.


   CMsmlResponseSptr l_responseData( new CMsmlResponse( a_sipCallInfo->MimeData()));

 #ifdef _WIN32

//   std::string l_response = a_sipCallInfo->MimeData();
//   std::string l_responseCode;
//   const std::string l_responseCodeLabel = "result response=\"";
//   unsigned int l_seperatorPos = l_response.find(l_responseCodeLabel);
//   if ( l_seperatorPos != l_response.npos)
//   {
//      l_responseCode = l_response.substr( l_seperatorPos + l_responseCodeLabel.size(), 3);
//   }

   if ( l_responseData->ResponseCode() == "200")

#else

   if ( a_sipCallInfo->ResponseCode() == 200)

#endif
   {
      LogDebug("PrimOnMediaCommandResponse", "started");
      NotifyObservers( RESOURCEGROUP_MEDIA_COMMAND_COMPLETE, l_responseData);
   }
   else
   {
      LogDebug("PrimOnMediaCommandResponse", "failed");
      NotifyObservers( RESOURCEGROUP_MEDIA_COMMAND_FAILED, l_responseData);
      return -1;
   }

   return 0;
}
Esempio n. 19
0
void
URLSearchParams::ParseInput(const nsACString& aInput,
                            URLSearchParamsObserver* aObserver)
{
  // Remove all the existing data before parsing a new input.
  DeleteAll();

  nsACString::const_iterator start, end;
  aInput.BeginReading(start);
  aInput.EndReading(end);
  nsACString::const_iterator iter(start);

  while (start != end) {
    nsAutoCString string;

    if (FindCharInReadable('&', iter, end)) {
      string.Assign(Substring(start, iter));
      start = ++iter;
    } else {
      string.Assign(Substring(start, end));
      start = end;
    }

    if (string.IsEmpty()) {
      continue;
    }

    nsACString::const_iterator eqStart, eqEnd;
    string.BeginReading(eqStart);
    string.EndReading(eqEnd);
    nsACString::const_iterator eqIter(eqStart);

    nsAutoCString name;
    nsAutoCString value;

    if (FindCharInReadable('=', eqIter, eqEnd)) {
      name.Assign(Substring(eqStart, eqIter));

      ++eqIter;
      value.Assign(Substring(eqIter, eqEnd));
    } else {
      name.Assign(string);
    }

    nsAutoCString decodedName;
    DecodeString(name, decodedName);

    nsAutoCString decodedValue;
    DecodeString(value, decodedValue);

    AppendInternal(NS_ConvertUTF8toUTF16(decodedName),
                   NS_ConvertUTF8toUTF16(decodedValue));
  }

  NotifyObservers(aObserver);
}
nsresult nsMsgRDFDataSource::NotifyPropertyChanged(nsIRDFResource *resource,
                                                   nsIRDFResource *propertyResource,
                                                   nsIRDFNode *newNode,
                                                   nsIRDFNode *oldNode /* = nullptr */)
{

  NotifyObservers(resource, propertyResource, newNode, oldNode, false, true);
  return NS_OK;

}
Esempio n. 21
0
//**************************
//Description : Function managing all input events
//Parameters : None
//Return Value : None
//Note : None
//**************************
void CEventManager::ManageEvents()
{
    while ( m_RenderWindow->GetEvent(m_CurrentEvent) )
    {
        if ( m_CurrentEvent.Type == sf::Event::Closed )
            m_RenderWindow->Close();

        NotifyObservers(m_CurrentEvent);
    }
}
Esempio n. 22
0
nsresult
nsMsgAccountManagerDataSource::OnItemBoolPropertyChanged(nsIRDFResource *aItem,
                                                         nsIAtom *aProperty,
                                                         PRBool aOldValue,
                                                         PRBool aNewValue)
{
  if (aProperty == kDefaultServerAtom)
    NotifyObservers(aItem, kNC_IsDefaultServer, kTrueLiteral, nsnull, aNewValue, PR_FALSE);
  return NS_OK;
}
Esempio n. 23
0
void CServerList::ObserverAdded( ObserverType* o )
{
	CObservableQueue<CServer*>::ObserverAdded( o );

	EventType::ValueList ilist;
	ilist.reserve( m_servers.size() );
	ilist.assign( m_servers.begin(), m_servers.end() );

	NotifyObservers( EventType( EventType::INITIAL, &ilist ), o );
}
Esempio n. 24
0
NS_IMETHODIMP
nsMsgAccountManagerDataSource::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData)
{
  nsMsgRDFDataSource::Observe(aSubject, aTopic, aData);

  if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
    nsDependentString prefName(aData);
    if (prefName.EqualsLiteral(PREF_SHOW_FAKE_ACCOUNT)) {
      NotifyObservers(kNC_AccountRoot, kNC_Child, kNC_PageTitleFakeAccount, nsnull, PR_FALSE, PR_FALSE);
      NotifyObservers(kNC_AccountRoot, kNC_Settings, kNC_PageTitleFakeAccount, nsnull, PR_FALSE, PR_FALSE);
    }
  }
  else if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
    nsCOMPtr<nsIPrefBranch2> prefBranchInternal = do_GetService(NS_PREFSERVICE_CONTRACTID);
    if (prefBranchInternal)
      prefBranchInternal->RemoveObserver(PREF_SHOW_FAKE_ACCOUNT, this);
  }
  return NS_OK;
}
Esempio n. 25
0
void CDownloadQueue::RemoveFile(CPartFile* file)
{
	RemoveLocalServerRequest( file );

	NotifyObservers( EventType( EventType::REMOVED, file ) );

	wxMutexLocker lock( m_mutex );

	EraseValue( m_filelist, file );
}
bool
CPatchEngine::Start( void )
{GUCEF_TRACE;

    GUCEF_DEBUG_LOG( CORE::LOGLEVEL_NORMAL, "CPatchEngine: Starting" );

    // The user should explicitly stop first if we are already busy
    if ( !m_isActive )
    {
        // configuration sanity check
        if ( ( m_config.GetPatchListURL().Length() > 0 )   &&
             ( m_config.GetPatchListCodec().Length() > 0 ) &&
             ( m_config.GetLocalRootDir().Length() > 0 )    )
        {
            m_isActive = true;
            m_stopSignalGiven = false;
            m_listDataBuffer.Clear();

            NotifyObservers( PatchProcessStartedEvent );

            // We must obtain the patch list before we can use it,..
            // Set the URL for the list location
            if ( m_url.SetURL( m_config.GetPatchListURL() ) )
            {
                // Now we try and obtain it
                NotifyObservers( PatchListRetrievalStartedEvent );
                if ( !m_url.Activate() )
                {
                    NotifyObservers( PatchListRetrievalFailedEvent );
                    NotifyObservers( PatchProcessFailedEvent );
                    return false;
                }

                // Now we wait
                return true;
            }
        }
    }

    NotifyObservers( PatchProcessFailedEvent );
    return false;
}
Esempio n. 27
0
void Entity::SetSelected( bool selected )
{
	if ( zSelected != selected )
	{
		zSelected = selected;

		EntitySelectedEvent ESE;
		ESE.entity = this;
		NotifyObservers( &ESE );
	}
}
Esempio n. 28
0
int SamplePool::ImportSample(Path &path) {

	if (count_==MAX_PIG_SAMPLES) return -1 ;

	// construct target path

	std::string dpath="samples:" ;
	dpath+=path.GetName() ;
	Path dstPath(dpath.c_str()) ;

    // Opens files

	I_File *fin=FileSystem::GetInstance()->Open(path.GetPath().c_str(),"r") ;
	if (!fin) {
		Trace::Error("Failed to open input file %s",path.GetPath().c_str()) ;
		return -1;
	} ;
	fin->Seek(0,SEEK_END) ;
	long size=fin->Tell() ;
	fin->Seek(0,SEEK_SET) ;

	I_File *fout=FileSystem::GetInstance()->Open(dstPath.GetPath().c_str(),"w") ;
	if (!fout) {
		fin->Close() ;
		delete (fin) ;
		return -1 ;
	} ;

	// copy file to current project

	char buffer[IMPORT_CHUNK_SIZE] ;
	while (size>0) {
		int count=(size>IMPORT_CHUNK_SIZE)?IMPORT_CHUNK_SIZE:size ;
		fin->Read(buffer,1,count) ;
		fout->Write(buffer,1,count) ;
		size-=count ;
	} ;

	fin->Close() ;
	fout->Close() ;
	delete(fin) ;
	delete(fout) ;

	// now load the sample

	bool status=loadSample(dstPath.GetPath().c_str()) ;

	SetChanged() ;
	SamplePoolEvent ev ;
	ev.index_=count_-1 ;
	ev.type_=SPET_INSERT ;
	NotifyObservers(&ev) ;
	return status?(count_-1):-1 ;
};
Esempio n. 29
0
// -----------------------------------------------------------------------------
// CSipRfsMonitorAo::RunL
// -----------------------------------------------------------------------------
//
void CSipRfsMonitorAo::RunL()
    {
    TInt state ( 0 );  
    if ( KErrNone == iProperty.Get( state ) )
        {
        if (MappedState(state))
            NotifyObservers();
        }
    iProperty.Subscribe( iStatus );
    SetActive();
    }
Esempio n. 30
0
void
CPing::OnPumpedNotify( CORE::CNotifier* notifier    ,
                       const CORE::CEvent& eventid  ,
                       CORE::CICloneable* eventdata )
{GUCEF_TRACE;

    if ( CPingTaskConsumer::PingStartedEvent == eventid )
    {
        CPingTaskConsumer::CEchoReceivedEventData* taskData = static_cast< CPingTaskConsumer::CEchoReceivedEventData* >( eventdata );
        CPingEventData eventData( taskData->GetHostAddress(), taskData->GetEchoSize(), taskData->GetRoundTripTime() );
        NotifyObservers( PingStartedEvent, &eventData );
    }
    else
    if ( CPingTaskConsumer::PingReponseEvent == eventid )
    {
        CPingTaskConsumer::CEchoReceivedEventData* taskData = static_cast< CPingTaskConsumer::CEchoReceivedEventData* >( eventdata );
        CPingEventData eventData( taskData->GetHostAddress(), taskData->GetEchoSize(), taskData->GetRoundTripTime() );
        NotifyObservers( PingReponseEvent, &eventData );
    }
    else
    if ( CPingTaskConsumer::PingTimeoutEvent == eventid )
    {
        CPingTaskConsumer::CEchoReceivedEventData* taskData = static_cast< CPingTaskConsumer::CEchoReceivedEventData* >( eventdata );
        CPingEventData eventData( taskData->GetHostAddress(), taskData->GetEchoSize(), taskData->GetRoundTripTime() );
        NotifyObservers( PingTimeoutEvent, &eventData );
    }
    else
    if ( CPingTaskConsumer::PingFailedEvent == eventid )
    {
        CPingTaskConsumer::CEchoReceivedEventData* taskData = static_cast< CPingTaskConsumer::CEchoReceivedEventData* >( eventdata );
        CPingEventData eventData( taskData->GetHostAddress(), taskData->GetEchoSize(), taskData->GetRoundTripTime() );
        NotifyObservers( PingFailedEvent, &eventData );
    }
    else
    if ( CPingTaskConsumer::PingStoppedEvent == eventid )
    {
        CPingTaskConsumer::CEchoReceivedEventData* taskData = static_cast< CPingTaskConsumer::CEchoReceivedEventData* >( eventdata );
        CPingEventData eventData( taskData->GetHostAddress(), taskData->GetEchoSize(), taskData->GetRoundTripTime() );
        NotifyObservers( PingStoppedEvent, &eventData );
    }
}