Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/UIFactory.cpp

    rd7940e r9fe36b  
    88
    99#include <cassert>
    10 #include "Patterns/Singleton_impl.hpp"
    1110#include "UIElements/UIFactory.hpp"
    1211
    1312// all factories that can be used:
    1413#include "UIElements/TextUIFactory.hpp"
     14#ifdef USE_GUI_QT
     15#include "UIElements/QT4/QTUIFactory.hpp"
     16#endif
     17
     18UIFactory *UIFactory::theFactory = 0;
    1519
    1620UIFactory::UIFactory()
     
    2630
    2731void UIFactory::makeUserInterface(InterfaceTypes type) {
     32  assert(theFactory == 0 && "makeUserInterface should only be called once");
    2833  switch(type) {
    2934    case Text :
    30       setInstance(new TextUIFactory());
     35      theFactory = new TextUIFactory();
    3136      break;
    32 
     37#ifdef USE_GUI_QT
     38    case QT4 :
     39      theFactory = new QTUIFactory();
     40      break;
     41#endif
    3342    default:
    3443      assert(0 && "No such Factory in stock");
     
    3746}
    3847
    39 CONSTRUCT_SINGLETON(UIFactory)
     48UIFactory* UIFactory::get(){
     49  assert(theFactory != 0 && "No UserInterface created prior to factory access");
     50  return theFactory;
     51}
     52
     53
     54void UIFactory::purgeInstance(){
     55  if(theFactory) {
     56    delete theFactory;
     57    theFactory = 0;
     58  }
     59}
Note: See TracChangeset for help on using the changeset viewer.