]> icculus.org git repositories - duncan/yast2-qt4.git/blob - src/YQOptionalWidgetFactory.cc
compile some more
[duncan/yast2-qt4.git] / src / YQOptionalWidgetFactory.cc
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:         YQOptionalWidgetFactory.cc
14
15   Author:       Stefan Hundhammer <sh@suse.de>
16
17 /-*/
18
19 #define QT3_SUPPORT
20
21 #include "YQOptionalWidgetFactory.h"
22 #include "YQUI.h"
23 #include "YUIException.h"
24 #include "YQPackageSelectorPlugin.h"
25 #include "YQWizard.h"
26
27 #define THROW_UNSUPPORTED( WIDGET_TYPE ) \
28     YUI_THROW( YUIUnsupportedWidgetException( WIDGET_TYPE ) );  \
29     return 0
30
31
32
33 YQOptionalWidgetFactory::YQOptionalWidgetFactory()
34     : YOptionalWidgetFactory()
35 {
36     // NOP
37 }
38
39 YQOptionalWidgetFactory::~YQOptionalWidgetFactory()
40 {
41     // NOP
42 }
43
44
45
46 bool YQOptionalWidgetFactory::hasWizard()
47 {
48     return true;
49 }
50
51 YWizard *
52 YQOptionalWidgetFactory::createWizard( YWidget *        parent,
53                                        const string &   backButtonLabel,
54                                        const string &   abortButtonLabel,
55                                        const string &   nextButtonLabel,
56                                        YWizardMode      wizardMode )
57 {
58     YQWizard * wizard = new YQWizard( parent,
59                                       backButtonLabel,
60                                       abortButtonLabel,
61                                       nextButtonLabel,
62                                       wizardMode );
63     YUI_CHECK_NEW( wizard );
64
65     return wizard;
66 }
67
68
69
70 bool YQOptionalWidgetFactory::hasDumbTab()
71 {
72     return true;
73 }
74
75 YQDumbTab *
76 YQOptionalWidgetFactory::createDumbTab( YWidget * parent )
77 {
78     YQDumbTab * dumbTab = new YQDumbTab( parent );
79     YUI_CHECK_NEW( dumbTab );
80
81     return dumbTab;
82 }
83
84
85
86 bool YQOptionalWidgetFactory::hasSlider()
87 {
88     return true;
89 }
90
91 YQSlider *
92 YQOptionalWidgetFactory::createSlider( YWidget *        parent,
93                                       const string &    label,
94                                       int               minVal,
95                                       int               maxVal,
96                                       int               initialVal )
97 {
98     YQSlider * slider = new YQSlider( parent, label, minVal, maxVal, initialVal );
99     YUI_CHECK_NEW( slider );
100
101     return slider;
102 }
103
104
105
106 bool YQOptionalWidgetFactory::hasDateField()
107 {
108     return true;
109 }
110
111 YQDateField *
112 YQOptionalWidgetFactory::createDateField( YWidget * parent, const string & label )
113 {
114     YQDateField * dateField = new YQDateField( parent, label );
115     YUI_CHECK_NEW( dateField );
116
117     return dateField;
118 }
119
120
121
122 bool YQOptionalWidgetFactory::hasTimeField()
123 {
124     return true;
125 }
126
127 YQTimeField *
128 YQOptionalWidgetFactory::createTimeField( YWidget * parent, const string & label )
129 {
130     YQTimeField * timeField = new YQTimeField( parent, label );
131     YUI_CHECK_NEW( timeField );
132
133     return timeField;
134 }
135
136
137
138 bool YQOptionalWidgetFactory::hasBarGraph()
139 {
140     return true;
141 }
142
143 YQBarGraph *
144 YQOptionalWidgetFactory::createBarGraph( YWidget * parent )
145 {
146     YQBarGraph * barGraph = new YQBarGraph( parent );
147     YUI_CHECK_NEW( barGraph );
148
149     return barGraph;
150 }
151
152
153
154 bool YQOptionalWidgetFactory::hasPatternSelector()
155 {
156     return true;
157 }
158
159 YQPatternSelector *
160 YQOptionalWidgetFactory::createPatternSelector( YWidget * parent, long modeFlags )
161 {
162     YQPackageSelectorPlugin * plugin = YQUI::ui()->packageSelectorPlugin();
163
164     if ( plugin )
165         return plugin->createPatternSelector( parent, modeFlags );
166     else
167         return 0;
168 }
169
170
171
172 bool YQOptionalWidgetFactory::hasSimplePatchSelector()
173 {
174     return true;
175 }
176
177 YQSimplePatchSelector *
178 YQOptionalWidgetFactory::createSimplePatchSelector( YWidget * parent, long modeFlags )
179 {
180     YQPackageSelectorPlugin * plugin = YQUI::ui()->packageSelectorPlugin();
181
182     if ( plugin )
183         return plugin->createSimplePatchSelector( parent, modeFlags );
184     else
185         return 0;
186 }
187
188
189
190 bool YQOptionalWidgetFactory::hasMultiProgressMeter()
191 {
192     return true;
193 }
194
195 YQMultiProgressMeter *
196 YQOptionalWidgetFactory::createMultiProgressMeter( YWidget * parent, YUIDimension dim, const vector<float> & maxValues )
197 {
198     YQMultiProgressMeter * multiProgressMeter = new YQMultiProgressMeter( parent, dim, maxValues );
199     YUI_CHECK_NEW( multiProgressMeter );
200
201     return multiProgressMeter;
202 }
203
204
205
206 bool YQOptionalWidgetFactory::hasPartitionSplitter()
207 {
208     return true;
209 }
210
211 YQPartitionSplitter *
212 YQOptionalWidgetFactory::createPartitionSplitter( YWidget *             parent,
213                                                   int                   usedSize,
214                                                   int                   totalFreeSize,
215                                                   int                   newPartSize,
216                                                   int                   minNewPartSize,
217                                                   int                   minFreeSize,
218                                                   const string &        usedLabel,
219                                                   const string &        freeLabel,
220                                                   const string &        newPartLabel,
221                                                   const string &        freeFieldLabel,
222                                                   const string &        newPartFieldLabel )
223 {
224     YQPartitionSplitter * partitionSplitter = new YQPartitionSplitter(  parent,
225                                                                         usedSize,
226                                                                         totalFreeSize,
227                                                                         newPartSize,
228                                                                         minNewPartSize,
229                                                                         minFreeSize,
230                                                                         usedLabel,
231                                                                         freeLabel,
232                                                                         newPartLabel,
233                                                                         freeFieldLabel,
234                                                                         newPartFieldLabel );
235     YUI_CHECK_NEW( partitionSplitter );
236
237     return partitionSplitter;
238 }
239
240
241
242 bool YQOptionalWidgetFactory::hasDownloadProgress()
243 {
244     return true;
245 }
246
247 YQDownloadProgress *
248 YQOptionalWidgetFactory::createDownloadProgress( YWidget *      parent,
249                                                  const string & label,
250                                                  const string & filename,
251                                                  YFileSize_t    expectedSize )
252 {
253     YQDownloadProgress * downloadProgress = new YQDownloadProgress( parent,
254                                                                     label,
255                                                                     filename,
256                                                                     expectedSize );
257     YUI_CHECK_NEW( downloadProgress );
258
259     return downloadProgress;
260 }
261