Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 29, 2011, 11:24:31 AM (13 years ago)
Author:
dafrick
Message:

Adding network callbacks. Still doesn't work yet, though.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/modules/notifications/NotificationQueue.cc

    r8651 r8656  
    136136    {
    137137        this->tickTime_ += dt; // Add the time interval that has passed to the time counter.
    138         if(this->displayTime_ != INF && this->tickTime_ >= 1.0) // If the time counter is greater than 1s all Notifications that have expired are removed, if it is smaller we wait to the next tick.
     138        if(this->displayTime_ != INF && this->tickTime_ >= 1.0) // If the time counter is greater than 1 s all Notifications that have expired are removed, if it is smaller we wait to the next tick.
    139139        {
    140140            this->timeLimit_.time = std::time(0)-this->displayTime_; // Container containing the current time.
     
    171171    void NotificationQueue::registerVariables()
    172172    {
    173         registerVariable( this->maxSize_, VariableDirection::ToClient );
    174         registerVariable( this->targets_, VariableDirection::ToClient );
    175         registerVariable( this->displayTime_, VariableDirection::ToClient );
     173        registerVariable( this->maxSize_, VariableDirection::ToClient, new NetworkCallback<NotificationQueue>(this, &NotificationQueue::maxSizeChanged));
     174        registerVariable( this->targets_, VariableDirection::ToClient, new NetworkCallback<NotificationQueue>(this, &NotificationQueue::targetsChanged));
     175        registerVariable( this->displayTime_, VariableDirection::ToClient, new NetworkCallback<NotificationQueue>(this, &NotificationQueue::displayTimeChanged));
    176176    }
    177177
     
    229229    @brief
    230230        Adds (pushes) a Notification to the NotificationQueue.
    231         It inserts it into the storage containers, creates a corresponding container and pushes the Notification message to the GUI.
     231        It inserts it into the storage containers, creates a corresponding container and pushes the notification message to the GUI.
    232232    @param notification
    233233        The Notification to be pushed.
     
    363363       
    364364        this->maxSize_ = size;
    365 
     365        this->maxSizeChanged();
     366    }
     367
     368    /**
     369    @brief
     370        Is called when the maximum number of displayed Notifications has changed.
     371    */
     372    void NotificationQueue::maxSizeChanged(void)
     373    {
    366374        if(this->isRegistered())
    367375            this->update();
     
    385393           
    386394        this->displayTime_ = time;
    387 
     395        this->displayTimeChanged();
     396    }
     397
     398    /**
     399    @brief
     400        Is called when the maximum number of seconds a Notification is displayed has changed.
     401    */
     402    void NotificationQueue::displayTimeChanged(void)
     403    {
    388404        if(this->isRegistered())
    389405            this->update();
     
    428444            this->targets_.insert(string[i]);
    429445
     446        this->targetsChanged();
     447    }
     448
     449    /**
     450    @brief
     451        Is called when the NotificationQueue's targets have changed.
     452    */
     453    void NotificationQueue::targetsChanged(void)
     454    {
    430455        // TODO: Why?
    431456        if(this->isRegistered())
Note: See TracChangeset for help on using the changeset viewer.