Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 14, 2008, 1:42:17 AM (16 years ago)
Author:
rgrieder
Message:
  • updated msvc files
  • Fixed build by including util/Integer.h in NetworkPrereqs.h instead of util/Math.h
  • Fixed issue with a this pointer used in the base class c'tor initialisation
  • Fixed build under windows: INFINITE seems to be a macro, defined in winbase.h. Constant was somewhere in the quest files.
  • Fixed build: Only integral types can have header-file value when declared as static const. Float is not supported by the standard.
  • Fixed a potential bug in Planet.cc: "if (cond) doOne; doTwo" —> missing brances (indentation was correct, so I assume there have to be brances)
  • Corrected lots of indentation problems with tabs/spaces mix.
  • Changed all "@file Blubb.h" to "@file": Doxygen then assumes the actual filename. This gives more flexibility.
Location:
code/branches/presentation/src/orxonox/overlays/notifications
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/orxonox/overlays/notifications/Notification.cc

    r2385 r2435  
    3434#include "NotificationManager.h"
    3535
    36 namespace orxonox {
    37 
     36namespace orxonox
     37{
    3838    Notification::Notification(BaseObject* creator) : BaseObject(creator)
    3939    {
     
    4141    }
    4242   
    43     Notification::Notification(const std::string & message, const std::string & title, float time) : BaseObject(this)
     43    Notification::Notification(BaseObject* creator, const std::string & message, const std::string & title, float time) : BaseObject(creator)
    4444    {
    4545        this->title_ = title;
     
    5959        this->title_ = "";
    6060        this->message_ = "";
    61         this->displayTime_ = DISPLAY_TIME;
     61        this->displayTime_ = NOTIFICATION_DISPLAY_TIME;
    6262        this->sent_ = false;
    6363    }
     
    6868        if(successful)
    6969            this->sent_ = true;
    70         return successful;
     70        return successful;
    7171    }
    7272   
     
    7575        if(this->isSent())
    7676            return false;
    77         this->title_ = title;
    78         return true;
     77        this->title_ = title;
     78        return true;
    7979    }
    8080   
     
    8383        if(this->isSent())
    8484            return false;
    85         this->message_ = message;
    86         return true;
     85        this->message_ = message;
     86        return true;
    8787    }
    8888   
     
    9292        {
    9393            return false;
    94         }
    95         if(time > 0)
    96         {
    97             this->displayTime_ = time;
    98             return true;
    99         }
    100         return false;
     94        }
     95        if(time > 0)
     96        {
     97            this->displayTime_ = time;
     98            return true;
     99        }
     100        return false;
    101101    }
    102 
    103102}
  • code/branches/presentation/src/orxonox/overlays/notifications/Notification.h

    r2385 r2435  
    3636#include "core/BaseObject.h"
    3737
    38 namespace orxonox {
     38namespace orxonox
     39{
     40    static const float NOTIFICATION_DISPLAY_TIME = 4.0;
    3941
    4042    /**
    4143    @brief
    42         This is rather temporary, so don't start relying on it, some better version will come soon but the Interface will not likely be the same.
     44        This is rather temporary, so don't start relying on it, some better version will come soon but the Interface will not likely be the same.
    4345    @author
    4446        Damian 'Mozork' Frick
     
    4648    class _OrxonoxExport Notification : public BaseObject
    4749    {
    48         public:
    49             Notification(BaseObject* creator);
    50             Notification(const std::string & message, const std::string & title = "", float time = DISPLAY_TIME);
    51             virtual ~Notification();
    52            
    53             bool send(void);
    54            
    55             inline bool isSent(void) const
    56                 { return this->sent_; }
    57             inline const std::string & getTitle(void) const
    58                 { return this->title_; }
    59             inline const std::string & getMessage(void) const
    60                 { return this->message_; }
    61             inline const float getDisplayTime(void) const
    62                 { return displayTime_; }
    63            
    64             bool setTitle(const std::string & title);
    65             bool setMessage(const std::string & message);
    66             bool setDisplayTime(float time);
    67            
    68         private:
    69             static const float DISPLAY_TIME = 4.0;
    70        
    71             std::string title_; //!< The title of the Notification.
    72             std::string message_; //!< The Notification message.
    73             float displayTime_; //!< The time duration the Notification is displayed in seconds.
    74             bool sent_; //!< Whether Notification has been sent, if so it cannot be changed.
    75            
    76             void initialize(void);
    77        
     50    public:
     51        Notification(BaseObject* creator);
     52        Notification(BaseObject* creator, const std::string & message, const std::string & title = "", float time = NOTIFICATION_DISPLAY_TIME);
     53        virtual ~Notification();
     54       
     55        bool send(void);
     56       
     57        inline bool isSent(void) const
     58            { return this->sent_; }
     59        inline const std::string & getTitle(void) const
     60            { return this->title_; }
     61        inline const std::string & getMessage(void) const
     62            { return this->message_; }
     63        inline const float getDisplayTime(void) const
     64            { return displayTime_; }
     65       
     66        bool setTitle(const std::string & title);
     67        bool setMessage(const std::string & message);
     68        bool setDisplayTime(float time);
     69       
     70    private:
     71        std::string title_; //!< The title of the Notification.
     72        std::string message_; //!< The Notification message.
     73        float displayTime_; //!< The time duration the Notification is displayed in seconds.
     74        bool sent_; //!< Whether Notification has been sent, if so it cannot be changed.
     75       
     76        void initialize(void);
    7877    };
    79 
    8078}
    8179
  • code/branches/presentation/src/orxonox/overlays/notifications/NotificationManager.cc

    r2385 r2435  
    3636#include "NotificationQueue.h"
    3737
    38 namespace orxonox {
    39 
     38namespace orxonox
     39{
    4040    std::list<NotificationContainer*> NotificationManager::notifications_s;
    4141
     
    5555   
    5656        for (std::list<NotificationContainer*>::iterator notification = notifications_s.begin(); notification != notifications_s.end(); ++notification)
    57         {
     57        {
    5858            NotificationContainer* container = *notification;
    5959            if(container->remainingTime == 0)
    6060            {
    6161                continue;
    62             }
    63             else if(container->remainingTime - dt <= 0)
    64             {
    65                container->remainingTime = 0;
    66                update = true;
    67             }
    68             else
    69             {
     62            }
     63            else if(container->remainingTime - dt <= 0)
     64            {
     65                container->remainingTime = 0;
     66                update = true;
     67            }
     68            else
     69            {
    7070                container->remainingTime = container->remainingTime -dt;
    71             }
    72         }
    73        
    74         if(update)
     71            }
     72        }
     73   
     74        if(update)
    7575            updateQueue();
    7676    }
     
    8181            return false;
    8282           
    83         NotificationContainer* container = new NotificationContainer;
    84         container->notification = notification;
    85         container->remainingTime = notification->getDisplayTime();
     83        NotificationContainer* container = new NotificationContainer;
     84        container->notification = notification;
     85        container->remainingTime = notification->getDisplayTime();
    8686        notifications_s.push_front(container);
    8787       
     
    105105                continue;
    106106           
    107             text = text + "\n\n\n------------\n\n" + clipMessage(container->notification->getTitle()) + "\n\n" + clipMessage(container->notification->getMessage());
     107            text = text + "\n\n\n------------\n\n" + clipMessage(container->notification->getTitle()) + "\n\n" + clipMessage(container->notification->getMessage());
    108108        }
    109109       
  • code/branches/presentation/src/orxonox/overlays/notifications/NotificationManager.h

    r2385 r2435  
    3737#include <string>
    3838
    39 namespace orxonox {
    40 
     39namespace orxonox
     40{
    4141    struct NotificationContainer
    4242    {
     
    5454    {
    5555   
    56         public:
    57             NotificationManager(BaseObject* creator);
    58             virtual ~NotificationManager();
    59            
    60             static bool insertNotification(Notification* notification);
    61            
    62             static void tick(float dt);
    63            
    64         private:
    65             static std::list<NotificationContainer*> notifications_s;
    66            
    67             static void updateQueue(void);
    68             static const std::string clipMessage(const std::string & message);
     56    public:
     57        NotificationManager(BaseObject* creator);
     58        virtual ~NotificationManager();
     59       
     60        static bool insertNotification(Notification* notification);
     61       
     62        static void tick(float dt);
     63       
     64    private:
     65        static std::list<NotificationContainer*> notifications_s;
     66       
     67        static void updateQueue(void);
     68        static const std::string clipMessage(const std::string & message);
    6969
    7070    };
  • code/branches/presentation/src/orxonox/overlays/notifications/NotificationQueue.cc

    r2385 r2435  
    3535#include "NotificationManager.h"
    3636
    37 namespace orxonox {
    38 
     37namespace orxonox
     38{
    3939    NotificationQueue* NotificationQueue::queue_s = 0;
    4040   
     
    4646        //TDO: Does this work?
    4747        if(queue_s != NULL)
    48         {
    49             COUT(2) << "There is now more than one NotificationQueue, this shouldn't happen, since only the first NotificationQueue will be targeted by the NotificationManager." << std::endl;
    50         }
    51         else
    52         {
    53             queue_s = this;
    54         }
    55        
    56         this->length_ = 3;
    57         this->width_ = 50;
     48        {
     49                COUT(2) << "There is now more than one NotificationQueue, this shouldn't happen, since only the first NotificationQueue will be targeted by the NotificationManager." << std::endl;
     50        }
     51        else
     52        {
     53                queue_s = this;
     54        }
     55       
     56        this->length_ = 3;
     57        this->width_ = 50;
    5858    }
    5959   
  • code/branches/presentation/src/orxonox/overlays/notifications/NotificationQueue.h

    r2385 r2435  
    3838#include <string>
    3939
    40 namespace orxonox {
    41 
     40namespace orxonox
     41{
    4242    /**
    4343    @brief
     
    4848    class _OrxonoxExport NotificationQueue : public OverlayText, public Tickable
    4949    {
    50         public:
    51             NotificationQueue(BaseObject* creator);
    52             virtual ~NotificationQueue();
    53            
    54             static NotificationQueue* queue_s; //TDO Singleton? oder im level.
    55            
    56             virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
    57            
    58             virtual void tick(float dt);
    59            
    60             void update(void);
    61            
    62             int getLength(void) const
     50    public:
     51        NotificationQueue(BaseObject* creator);
     52        virtual ~NotificationQueue();
     53       
     54        static NotificationQueue* queue_s; //TDO Singleton? oder im level.
     55       
     56        virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
     57       
     58        virtual void tick(float dt);
     59       
     60        void update(void);
     61       
     62        int getLength(void) const
    6363                { return this->length_; }
    64             int getWidth(void) const
     64        int getWidth(void) const
    6565                { return this->width_; }
    66            
    67             void setQueueText(const std::string & text);
    68             bool setLength(int length);
    69             bool setWidth(int width);
    70            
    71         private:
    72             Ogre::UTFString queueText_;
    73             int length_;
    74             int width_;
     66       
     67        void setQueueText(const std::string & text);
     68        bool setLength(int length);
     69        bool setWidth(int width);
     70       
     71    private:
     72        Ogre::UTFString queueText_;
     73        int length_;
     74        int width_;
    7575   
    7676    };
Note: See TracChangeset for help on using the changeset viewer.