]> Shamusworld >> Repos - architektonas/blob - src/base/rs_dialogfactory.cpp
Fixed thumbnail rendering in LibraryWidget and DXF detection.
[architektonas] / src / base / rs_dialogfactory.cpp
1 // rs_dialogfactory.cpp
2 //
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
9 //
10 // JLH = James L. Hammons <jlhamm@acm.org>
11 //
12 // Who  When        What
13 // ---  ----------  -----------------------------------------------------------
14 // JLH  05/28/2010  Added this text. :-)
15 //
16
17 #include "rs_dialogfactory.h"
18
19 #include "rs_debug.h"
20
21 RS_DialogFactory * RS_DialogFactory::uniqueInstance = NULL;
22
23 /**
24  * Private constructor.
25  */
26 RS_DialogFactory::RS_DialogFactory()
27 {
28         RS_DEBUG->print("RS_DialogFacgory::RS_DialogFactory");
29         factoryObject = NULL;
30         RS_DEBUG->print("RS_DialogFacgory::RS_DialogFactory: OK");
31 }
32
33 /*virtual*/ RS_DialogFactory::~RS_DialogFactory()
34 {
35 }
36
37 /**
38  * @return Instance to the unique font list.
39  */
40 RS_DialogFactory * RS_DialogFactory::instance()
41 {
42         RS_DEBUG->print("RS_DialogFactory::instance()");
43
44         if (uniqueInstance == NULL)
45                 uniqueInstance = new RS_DialogFactory();
46
47         RS_DEBUG->print("RS_DialogFactory::instance(): OK");
48
49         return uniqueInstance;
50 }
51
52 /**
53  * Sets the real factory object that can create and show dialogs.
54  */
55 void RS_DialogFactory::setFactoryObject(RS_DialogFactoryInterface * fo)
56 {
57         RS_DEBUG->print("RS_DialogFactory::setFactoryObject");
58         factoryObject = fo;
59         RS_DEBUG->print("RS_DialogFactory::setFactoryObject: OK");
60 }
61
62 /**
63  * @return Factory object. This is never NULL. If no factory
64  * object was set, the default adapter will be returned.
65  */
66 RS_DialogFactoryInterface * RS_DialogFactory::getFactoryObject()
67 {
68         RS_DEBUG->print("RS_DialogFactory::getFactoryObject");
69
70         if (factoryObject != NULL)
71         {
72                 RS_DEBUG->print("RS_DialogFactory::getFactoryObject: returning factory object");
73                 return factoryObject;
74         }
75         else
76         {
77                 RS_DEBUG->print("RS_DialogFactory::getFactoryObject: returning adapter");
78                 return &factoryAdapter;
79         }
80 }
81
82 void RS_DialogFactory::commandMessage(const QString & m)
83 {
84         RS_DEBUG->print("RS_DialogFactory::commandMessage");
85
86         if (factoryObject != NULL)
87                 factoryObject->commandMessage(m);
88 }