Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2785


Ignore:
Timestamp:
Mar 15, 2009, 11:41:25 AM (15 years ago)
Author:
dafrick
Message:

Made QuestManager and NotificationManager to Singletons. Fixed/Changed som other stuff I don't remember…

Location:
code/branches/questsystem5/src/orxonox
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • code/branches/questsystem5/src/orxonox/objects/quest/AddQuest.cc

    r2779 r2785  
    9797        try
    9898        {
    99             Quest* quest = QuestManager::findQuest(this->getQuestId());
     99            Quest* quest = QuestManager::getInstance().findQuest(this->getQuestId());
    100100            if(quest == NULL || !quest->start(player))
    101101            {
  • code/branches/questsystem5/src/orxonox/objects/quest/AddQuestHint.cc

    r2779 r2785  
    117117        try
    118118        {
    119             QuestHint* hint = QuestManager::findHint(this->hintId_);
     119            QuestHint* hint = QuestManager::getInstance().findHint(this->hintId_);
    120120            if(hint == NULL || !hint->setActive(player))
    121121            {
  • code/branches/questsystem5/src/orxonox/objects/quest/CompleteQuest.cc

    r2779 r2785  
    9696        try
    9797        {
    98             quest = QuestManager::findQuest(this->getQuestId());
     98            quest = QuestManager::getInstance().findQuest(this->getQuestId());
    9999            if(quest == NULL || !quest->complete(player))
    100100            {
  • code/branches/questsystem5/src/orxonox/objects/quest/FailQuest.cc

    r2779 r2785  
    9595        try
    9696        {
    97             quest = QuestManager::findQuest(this->getQuestId());
     97            quest = QuestManager::getInstance().findQuest(this->getQuestId());
    9898            if(quest == NULL || !quest->fail(player))
    9999            {
  • code/branches/questsystem5/src/orxonox/objects/quest/Quest.cc

    r2779 r2785  
    7979        XMLPortObject(Quest, QuestEffect, "complete-effects", addCompleteEffect, getCompleteEffect, xmlelement, mode);
    8080
    81         QuestManager::registerQuest(this); //!<Registers the Quest with the QuestManager.
     81        QuestManager::getInstance().registerQuest(this); //!<Registers the Quest with the QuestManager.
    8282    }
    8383
  • code/branches/questsystem5/src/orxonox/objects/quest/QuestHint.cc

    r2779 r2785  
    7373        SUPER(QuestHint, XMLPort, xmlelement, mode);
    7474
    75         QuestManager::registerHint(this); //!< Registers the QuestHint with the QuestManager.
     75        QuestManager::getInstance().registerHint(this); //!< Registers the QuestHint with the QuestManager.
    7676       
    7777        COUT(3) << "New QuestHint {" << this->getId() << "} created." << std::endl;
  • code/branches/questsystem5/src/orxonox/objects/quest/QuestListener.cc

    r2779 r2785  
    112112    bool QuestListener::setQuestId(const std::string & id)
    113113    {
    114         this->quest_ = QuestManager::findQuest(id); //!< Find the Quest corresponding to the given questId.
     114        this->quest_ = QuestManager::getInstance().findQuest(id); //!< Find the Quest corresponding to the given questId.
    115115       
    116116        if(this->quest_ == NULL) //!< If there is no such Quest.
  • code/branches/questsystem5/src/orxonox/objects/quest/QuestManager.cc

    r2779 r2785  
    4343namespace orxonox
    4444{
    45     //! All Quests registered by their id's.
    46     std::map<std::string, Quest*> QuestManager::questMap_s;
    47     //! All QuestHints registered by their id's.
    48     std::map<std::string, QuestHint*> QuestManager::hintMap_s;
     45    //! Pointer to the current (and single) instance of this class.
     46    QuestManager* QuestManager::singletonRef_s = NULL;
    4947
    5048    /**
    5149    @brief
    5250        Constructor. Registers the object.
    53     */
    54     QuestManager::QuestManager(BaseObject* creator) : BaseObject(creator)
    55     {
    56         RegisterObject(QuestManager);
     51    @todo
     52        Is inheriting from BaseObject proper?
     53    */
     54    QuestManager::QuestManager() : BaseObject(this)
     55    {
     56        RegisterRootObject(QuestManager);
     57
    5758    }
    5859
     
    6465    {
    6566
     67    }
     68
     69    /**
     70    @brief
     71        Returns a reference to the current (and single) instance of the QuestManager, and creates one if there isn't one to begin with.
     72    @return
     73        Returns a reference to the single instance of the Quest Manager.
     74    */
     75    /*static*/ QuestManager & QuestManager::getInstance()
     76    {
     77        if(singletonRef_s == NULL)
     78        {
     79            singletonRef_s = new QuestManager();
     80        }
     81        return *singletonRef_s;
    6682    }
    6783
     
    7591        Returns true if successful, false if not.
    7692    */
    77     /*static*/ bool QuestManager::registerQuest(Quest* quest)
     93    bool QuestManager::registerQuest(Quest* quest)
    7894    {
    7995        if(quest == NULL) //!< Doh! Just as if there were actual quests behind NULL-pointers.
     
    84100
    85101        std::pair<std::map<std::string, Quest*>::iterator,bool> result;
    86         result = questMap_s.insert( std::pair<std::string,Quest*>(quest->getId(),quest) ); //!< Inserting the Quest.
     102        result = this->questMap_.insert( std::pair<std::string,Quest*>(quest->getId(),quest) ); //!< Inserting the Quest.
    87103
    88104        if(result.second) //!< If inserting was a success.
     
    107123        Returns true if successful, false if not.
    108124    */
    109     /*static*/ bool QuestManager::registerHint(QuestHint* hint)
     125    bool QuestManager::registerHint(QuestHint* hint)
    110126    {
    111127        if(hint == NULL) //!< Still not liking NULL-pointers.
     
    116132
    117133        std::pair<std::map<std::string, QuestHint*>::iterator,bool> result;
    118         result = hintMap_s.insert ( std::pair<std::string,QuestHint*>(hint->getId(),hint) ); //!< Inserting the QuestHSint.
     134        result = this->hintMap_.insert ( std::pair<std::string,QuestHint*>(hint->getId(),hint) ); //!< Inserting the QuestHSint.
    119135
    120136        if(result.second) //!< If inserting was a success.
     
    141157        Throws an exception if the given questId is invalid.
    142158    */
    143     /*static*/ Quest* QuestManager::findQuest(const std::string & questId)
     159    Quest* QuestManager::findQuest(const std::string & questId)
    144160    {
    145161        if(!QuestItem::isId(questId)) //!< Check vor validity of the given id.
     
    149165
    150166        Quest* quest;
    151         std::map<std::string, Quest*>::iterator it = questMap_s.find(questId);
    152         if (it != questMap_s.end()) //!< If the Quest is registered.
     167        std::map<std::string, Quest*>::iterator it = this->questMap_.find(questId);
     168        if (it != this->questMap_.end()) //!< If the Quest is registered.
    153169        {
    154170            quest = it->second;
     
    175191        Throws an exception if the given hintId is invalid.
    176192    */
    177     /*static*/ QuestHint* QuestManager::findHint(const std::string & hintId)
     193    QuestHint* QuestManager::findHint(const std::string & hintId)
    178194    {
    179195        if(!QuestItem::isId(hintId)) //!< Check vor validity of the given id.
     
    183199
    184200        QuestHint* hint;
    185         std::map<std::string, QuestHint*>::iterator it = hintMap_s.find(hintId);
    186         if (it != hintMap_s.end()) //!< If the QuestHint is registered.
     201        std::map<std::string, QuestHint*>::iterator it = this->hintMap_.find(hintId);
     202        if (it != this->hintMap_.end()) //!< If the QuestHint is registered.
    187203        {
    188204            hint = it->second;
  • code/branches/questsystem5/src/orxonox/objects/quest/QuestManager.h

    r2779 r2785  
    4646    /**
    4747    @brief
    48         Is a static class and manages Quests, by registering every Quest/QuestHint (through registerX()) and making them globally accessable (through findX()).
     48        Is a Singleton and manages Quests, by registering every Quest/QuestHint (through registerX()) and making them globally accessable (through findX()).
    4949        Quests (and QuestHints) are registered in the QuestManager with their id, and can be accessed in the same way.
    5050    @author
     
    5454    {
    5555
     56        protected:
     57            QuestManager();
     58
    5659        public:
    57             QuestManager(BaseObject* creator);
    5860            virtual ~QuestManager();
    5961
    60             static bool registerQuest(Quest* quest); //!< Registers a Quest in the QuestManager.
    61             static bool registerHint(QuestHint* quest); //!< Registers a QuestHint in the QuestManager.
     62            static QuestManager& getInstance(); //!< Returns a reference to the single instance of the Quest Manager.
    6263
    63             static Quest* findQuest(const std::string & questId); //!< Returns the Quest with the input id.
    64             static QuestHint* findHint(const std::string & hintId); //!< Returns the QuestHint with the input id.
     64            bool registerQuest(Quest* quest); //!< Registers a Quest in the QuestManager.
     65            bool registerHint(QuestHint* quest); //!< Registers a QuestHint in the QuestManager.
     66
     67            Quest* findQuest(const std::string & questId); //!< Returns the Quest with the input id.
     68            QuestHint* findHint(const std::string & hintId); //!< Returns the QuestHint with the input id.
    6569
    6670        private:
    67             static std::map<std::string, Quest*> questMap_s; //!< All Quests registered by their id's.
    68             static std::map<std::string, QuestHint*> hintMap_s; //!< All QuestHints registered by their id's.
     71            static QuestManager* singletonRef_s;
     72
     73            std::map<std::string, Quest*> questMap_; //!< All Quests registered by their id's.
     74            std::map<std::string, QuestHint*> hintMap_; //!< All QuestHints registered by their id's.
    6975
    7076    };
  • code/branches/questsystem5/src/orxonox/overlays/notifications/Notification.cc

    r2779 r2785  
    106106    {
    107107        this->sender_ = sender;
    108         bool successful = NotificationManager::registerNotification(this);
     108        bool successful = NotificationManager::getInstance().registerNotification(this);
    109109        if(!successful)
    110110            return false;
  • code/branches/questsystem5/src/orxonox/overlays/notifications/NotificationManager.cc

    r2783 r2785  
    4848    const std::string NotificationManager::NONE = "none";
    4949
    50     std::multimap<std::time_t,Notification*> NotificationManager::allNotificationsList_s;
    51     std::map<int,std::multimap<std::time_t,Notification*>*> NotificationManager::notificationLists_s;
    52     std::map<NotificationQueue*,int> NotificationManager::queueList_s;
    53    
    54     int NotificationManager::highestIndex_s = 0;
     50    NotificationManager* NotificationManager::singletonRef_s = NULL;
    5551
    5652    /**
     
    5854        Constructor. Registers the Object.
    5955    */
    60     NotificationManager::NotificationManager(BaseObject* creator) : BaseObject(creator)
    61     {
    62         RegisterObject(NotificationManager);
     56    NotificationManager::NotificationManager() : BaseObject(this)
     57    {
     58        RegisterRootObject(NotificationManager);
     59
     60        this->highestIndex_ = 0;
    6361    }
    6462
     
    6967    NotificationManager::~NotificationManager()
    7068    {
     69    }
     70
     71    /**
     72    @brief
     73        Returns the current (and single) instance of the NotificationManager. Creates one, if there isn't one to begin with.
     74    @return
     75        Returns a reference to the single instance of the NotificationManager.
     76    */
     77    /*static*/ NotificationManager & NotificationManager::getInstance()
     78    {
     79        if(singletonRef_s == NULL)
     80        {
     81            singletonRef_s = new NotificationManager();
     82        }
     83        return *singletonRef_s;
    7184    }
    7285   
     
    7992        Returns true if successful.
    8093    */
    81     /*static*/ bool NotificationManager::registerNotification(Notification* notification)
     94    bool NotificationManager::registerNotification(Notification* notification)
    8295    {
    8396   
     
    87100        std::time_t time = std::time(0); //TDO: Doesn't this expire? //!< Get current time.
    88101       
    89         allNotificationsList_s.insert(std::pair<std::time_t,Notification*>(time,notification));
     102        this->allNotificationsList_.insert(std::pair<std::time_t,Notification*>(time,notification));
    90103       
    91104        if(notification->getSender() == NONE) //!< If the sender has no specific name, then the Notification is only added to the list of all Notifications.
     
    97110       
    98111        //!< Insert the notification in all queues that have its sender as target.
    99         for(std::map<NotificationQueue*,int>::iterator it = queueList_s.begin(); it != queueList_s.end(); it++) //!< Iterate through all queues.
     112        for(std::map<NotificationQueue*,int>::iterator it = this->queueList_.begin(); it != this->queueList_.end(); it++) //!< Iterate through all queues.
    100113        {
    101114            std::set<std::string> set = it->first->getTargetsSet();
    102115            if(all || set.find(notification->getSender()) != set.end() || set.find(ALL) != set.end()) //TDO: Make sure this works.
    103116            {
    104                 notificationLists_s[it->second]->insert(std::pair<std::time_t,Notification*>(time,notification)); //!< Insert the Notification in the Notifications list of the current NotificationQueue.
     117                this->notificationLists_[it->second]->insert(std::pair<std::time_t,Notification*>(time,notification)); //!< Insert the Notification in the Notifications list of the current NotificationQueue.
    105118                it->first->update(notification, time); //!< Update the queue.
    106119            }
     
    120133        Returns true if successful.
    121134    */
    122     /*static*/ bool NotificationManager::registerQueue(NotificationQueue* queue)
    123     {
    124         NotificationManager::highestIndex_s += 1;
    125         int index = NotificationManager::highestIndex_s;
    126        
    127         queueList_s[queue] = index; //!< Add the NotificationQueue to the list of queues.
     135    bool NotificationManager::registerQueue(NotificationQueue* queue)
     136    {
     137        this->highestIndex_ += 1;
     138        int index = this->highestIndex_;
     139       
     140        this->queueList_[queue] = index; //!< Add the NotificationQueue to the list of queues.
    128141       
    129142        std::set<std::string> set = queue->getTargetsSet(); //TDO: Works this?
     
    132145        if(set.find(ALL) != set.end())
    133146        {
    134             notificationLists_s[index] = &allNotificationsList_s;
     147            this->notificationLists_[index] = &this->allNotificationsList_;
    135148            COUT(3) << "NotificationQueue registered with the NotificationManager." << std::endl;
    136149            return true;
    137150        }
    138151       
    139         notificationLists_s[index] = new std::multimap<std::time_t,Notification*>;
    140         std::multimap<std::time_t,Notification*> map = *notificationLists_s[index];
     152        this->notificationLists_[index] = new std::multimap<std::time_t,Notification*>;
     153        std::multimap<std::time_t,Notification*> map = *this->notificationLists_[index];
    141154       
    142155        //! Iterate through all Notifications to determine whether any of them should belong to the newly registered NotificationQueue.
    143         for(std::multimap<std::time_t,Notification*>::iterator it = allNotificationsList_s.begin(); it != allNotificationsList_s.end(); it++)
     156        for(std::multimap<std::time_t,Notification*>::iterator it = this->allNotificationsList_.begin(); it != this->allNotificationsList_.end(); it++)
    144157        {
    145158            if(set.find(it->second->getSender()) != set.end()) //!< Checks whether the overlay has the sender of the current notification as target.
     
    170183        Make sure the map is deleted.
    171184    */
    172     /*static*/ std::multimap<std::time_t,Notification*>* NotificationManager::getNotifications(NotificationQueue* queue, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd)
    173     {
    174         std::multimap<std::time_t,Notification*>* notifications = NotificationManager::notificationLists_s[NotificationManager::queueList_s[queue]];
     185    std::multimap<std::time_t,Notification*>* NotificationManager::getNotifications(NotificationQueue* queue, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd)
     186    {
     187        std::multimap<std::time_t,Notification*>* notifications = this->notificationLists_[this->queueList_[queue]];
    175188       
    176189        if(notifications == NULL)
  • code/branches/questsystem5/src/orxonox/overlays/notifications/NotificationManager.h

    r2779 r2785  
    5050    /**
    5151    @brief
    52         The NotificationManager functions as a gateway between Notifications and NotificationQueues.
     52        The Singleton NotificationManager functions as a gateway between Notifications and NotificationQueues.
    5353        It receives, organizes Notifications and the redistributes them to the specific NotificationQueues.
    5454    @author
     
    5757    class _OrxonoxExport NotificationManager : public BaseObject
    5858    {
     59        protected:
     60            NotificationManager();
     61
    5962        public:
    60             NotificationManager(BaseObject* creator);
    6163            virtual ~NotificationManager();
    6264               
     
    6466            static const std::string NONE;
    6567         
     68            static NotificationManager & getInstance(); //! Returns a reference to the single instance of the NotificationManager.
     69
    6670            //TDO: Visibility?
    67             static bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager.
    68             static bool registerQueue(NotificationQueue* queue); //!< Registers a NotificationQueue within the NotificationManager.
     71            bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager.
     72            bool registerQueue(NotificationQueue* queue); //!< Registers a NotificationQueue within the NotificationManager.
    6973           
    70             static std::multimap<std::time_t,Notification*>* getNotifications(NotificationQueue* queue, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Returns the Notifications for a specific NotificationQueue in a specified timeframe.
     74            std::multimap<std::time_t,Notification*>* getNotifications(NotificationQueue* queue, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Returns the Notifications for a specific NotificationQueue in a specified timeframe.
    7175           
    7276            /**
     
    7680            @return Returns a time-ordered list of Notifications.
    7781            */
    78             static std::multimap<std::time_t,Notification*>* getNotifications(NotificationQueue* queue, const std::time_t & timeFrameStart)
    79                 { return NotificationManager::getNotifications(queue, timeFrameStart, std::time(0)); }
     82            std::multimap<std::time_t,Notification*>* getNotifications(NotificationQueue* queue, const std::time_t & timeFrameStart)
     83                { return this->getNotifications(queue, timeFrameStart, std::time(0)); }
    8084            /**
    8185            @brief Fetches the Notifications for a specific NotificationQueue starting at a specified timespan before now.
     
    8488            @return Returns a time-ordered list of Notifications.
    8589            */
    86             static std::multimap<std::time_t,Notification*>* getNotifications(NotificationQueue* queue, int timeDelay)
    87                 { return NotificationManager::getNotifications(queue, std::time(0)-timeDelay, std::time(0)); }
     90            std::multimap<std::time_t,Notification*>* getNotifications(NotificationQueue* queue, int timeDelay)
     91                { return this->getNotifications(queue, std::time(0)-timeDelay, std::time(0)); }
    8892     
    89                private:
    90             static int highestIndex_s; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that  no key appears twice.
     93        private:
     94            static NotificationManager* singletonRef_s;
     95
     96            int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that  no key appears twice.
    9197       
    92             static std::multimap<std::time_t,Notification*> allNotificationsList_s; //!< Container where all notifications are stored (together with their respecive timestamps).
    93             static std::map<NotificationQueue*,int> queueList_s; //!< Container where all NotificationQueues are stored with a number as identifier.
    94             static std::map<int,std::multimap<std::time_t,Notification*>*> notificationLists_s; //!< Container where all Notifications, for each identifier (associated with a NotificationQueue), are stored.
     98            std::multimap<std::time_t,Notification*> allNotificationsList_; //!< Container where all notifications are stored (together with their respecive timestamps).
     99            std::map<NotificationQueue*,int> queueList_; //!< Container where all NotificationQueues are stored with a number as identifier.
     100            std::map<int,std::multimap<std::time_t,Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationQueue), are stored.
    95101           
    96102
  • code/branches/questsystem5/src/orxonox/overlays/notifications/NotificationOverlay.cc

    r2783 r2785  
    7474        this->setFont(this->queue_->getFont());
    7575        this->setTextSize(this->queue_->getFontSize());
     76
     77        this->setPosition(this->queue_->getPosition());
    7678    }
    7779
  • code/branches/questsystem5/src/orxonox/overlays/notifications/NotificationQueue.cc

    r2783 r2785  
    4646   
    4747    const std::string NotificationQueue::DEFAULT_FONT = "VeraMono";
     48    const Vector2 NotificationQueue::DEFAULT_POSITION = Vector2(0.0,0.0);
    4849
    4950    /**
     
    7879        this->tickTime_ = 0.0;
    7980       
    80         NotificationManager::registerQueue(this);
     81        NotificationManager::getInstance().registerQueue(this);
    8182    }
    8283   
     
    9091        this->setNotificationLength(DEFAULT_LENGTH);
    9192        this->setDisplayTime(DEFAULT_DISPLAY_TIME);
     93        this->setPosition(DEFAULT_POSITION);
    9294       
    9395        this->setTargets(NotificationManager::ALL);
     
    113115        XMLPortParam(NotificationQueue, "font", setFont, getFont, xmlElement, mode);
    114116        XMLPortParam(NotificationQueue, "fontSize", setFontSize, getFontSize, xmlElement, mode);
     117        XMLPortParam(NotificationQueue, "position", setPosition, getPosition, xmlElement, mode);
    115118       
    116119        COUT(3) << "NotificationQueue created." << std::endl;
     
    152155        this->clear();
    153156   
    154         std::multimap<std::time_t,Notification*>* notifications = NotificationManager::getNotifications(this, this->displayTime_);
     157        std::multimap<std::time_t,Notification*>* notifications = NotificationManager::getInstance().getNotifications(this, this->displayTime_);
    155158       
    156159        if(notifications == NULL)
     
    315318            return false;
    316319        this->fontSize_ = size;
    317         for (std::map<Notification*, NotificationOverlayContainer*>::iterator it = this->overlays_.begin(); it != this->overlays_.end(); ++it) //!< Set the font size for each overlay.
     320        for (std::map<Notification*, NotificationOverlayContainer*>::iterator it = this->overlays_.begin(); it != this->overlays_.end(); it++) //!< Set the font size for each overlay.
    318321        {
    319322            it->second->overlay->setFontSize(size);
     
    333336    {
    334337        this->font_ = font;
    335         for (std::map<Notification*, NotificationOverlayContainer*>::iterator it = this->overlays_.begin(); it != this->overlays_.end(); ++it) //!< Set the font for each overlay.
     338        for (std::map<Notification*, NotificationOverlayContainer*>::iterator it = this->overlays_.begin(); it != this->overlays_.end(); it++) //!< Set the font for each overlay.
    336339        {
    337340            it->second->overlay->setFont(font);
     
    345348        {
    346349            it->second->overlay->scroll(pos);
     350        }
     351    }
     352
     353    void NotificationQueue::positionChanged()
     354    {
     355        int counter = 0;
     356        for (std::multiset<NotificationOverlayContainer*, NotificationOverlayContainerCompare>::iterator it = this->containers_.begin(); it != this->containers_.end(); it++) //!< Set the position for each overlay.
     357        {
     358            (*it)->overlay->setPosition(this->getPosition());
     359            (*it)->overlay->scroll(Vector2(0.0,(1.1*this->getFontSize())*counter));
     360            counter++;
    347361        }
    348362    }
  • code/branches/questsystem5/src/orxonox/overlays/notifications/NotificationQueue.h

    r2783 r2785  
    4444#include <map>
    4545#include <ctime>
    46 #include "util/Math.h"
    4746
    4847#include "orxonox/overlays/OverlayGroup.h"
     
    114113            inline int getDisplayTime() const
    115114                { return this->displayTime_; }
    116                
    117115            /**
    118             @brief Returns the targets of this queue, reps. the senders which Notifications are displayed in this queue.
    119             @return Retuns a set of string holding the different targets.
     116            @brief Returns the position of the NotificationQueue.
     117            @return Returns the position.
    120118            */
    121             inline const std::set<std::string> & getTargetsSet()
    122                 { return this->targets_; }
    123             bool getTargets(std::string* string) const; //!< Returns a string consisting of the concatination of the targets.
    124            
     119            inline const Vector2 & getPosition() const
     120                { return this->position_; }
    125121            /**
    126122            @brief Returns the font size used to display the Notifications.
     
    135131            inline const std::string & getFont() const
    136132                { return this->font_; }
     133               
     134            /**
     135            @brief Returns the targets of this queue, reps. the senders which Notifications are displayed in this queue.
     136            @return Retuns a set of string holding the different targets.
     137            */
     138            inline const std::set<std::string> & getTargetsSet()
     139                { return this->targets_; }
     140            bool getTargets(std::string* string) const; //!< Returns a string consisting of the concatination of the targets.
     141           
     142            inline void setPosition(Vector2 pos)
     143                { this->position_ = pos; this->positionChanged(); }
    137144
    138145            void scroll(const Vector2 pos);
     
    142149            static const int DEFAULT_LENGTH = 64; //!< The default maximum number of Notifications displayed.
    143150            static const int DEFAULT_DISPLAY_TIME = 30; //!< The default display time.
    144             static const float DEFAULT_FONT_SIZE = 0.02; //!< The default font size.
     151            static const float DEFAULT_FONT_SIZE = 0.025; //!< The default font size.
     152
    145153            static const std::string DEFAULT_FONT; //!< The default font.
     154            static const Vector2 DEFAULT_POSITION; //!< the default position.
    146155       
    147156            int maxSize_; //!< The maximal number of Notifications displayed.
     
    149158            int notificationLength_; //!< The maximal number of characters a Notification-message is allowed to have.
    150159            int displayTime_; //!< The time a Notification is displayed.
     160            Vector2 position_; //!< The position of the NotificationQueue.
    151161           
    152162            std::set<std::string> targets_; //!< The targets the Queue displays Notifications of.
     
    172182            bool setFontSize(float size); //!< Set the font size.
    173183            bool setFont(const std::string & font); //!< Set the font.
     184
     185            void positionChanged();
    174186           
    175187            void addNotification(Notification* notification, const std::time_t & time); //!< Add a notification to the queue.
Note: See TracChangeset for help on using the changeset viewer.