Root/
Source at commit 1406 created 12 years 10 months ago. By meklort, Revert drivers.c so that kexts are only loaded when OSBundleRequired is set and that value is not safe mode. Added some comments about it too. | |
---|---|
1 | #include "wizard.h"␊ |
2 | #include "input.h"␊ |
3 | #include "doxywizard.h"␊ |
4 | ␊ |
5 | #include <math.h>␊ |
6 | #include <QtGui>␊ |
7 | ␊ |
8 | // options configurable via the wizard␊ |
9 | #define STR_PROJECT_NAME QString::fromAscii("PROJECT_NAME")␊ |
10 | #define STR_PROJECT_LOGO QString::fromAscii("PROJECT_LOGO")␊ |
11 | #define STR_PROJECT_BRIEF QString::fromAscii("PROJECT_BRIEF")␊ |
12 | #define STR_INPUT QString::fromAscii("INPUT")␊ |
13 | #define STR_OUTPUT_DIRECTORY QString::fromAscii("OUTPUT_DIRECTORY")␊ |
14 | #define STR_PROJECT_NUMBER QString::fromAscii("PROJECT_NUMBER")␊ |
15 | #define STR_RECURSIVE QString::fromAscii("RECURSIVE")␊ |
16 | #define STR_OPTIMIZE_OUTPUT_FOR_C QString::fromAscii("OPTIMIZE_OUTPUT_FOR_C")␊ |
17 | #define STR_OPTIMIZE_OUTPUT_JAVA QString::fromAscii("OPTIMIZE_OUTPUT_JAVA")␊ |
18 | #define STR_OPTIMIZE_FOR_FORTRAN QString::fromAscii("OPTIMIZE_FOR_FORTRAN")␊ |
19 | #define STR_OPTIMIZE_OUTPUT_VHDL QString::fromAscii("OPTIMIZE_OUTPUT_VHDL")␊ |
20 | #define STR_CPP_CLI_SUPPORT QString::fromAscii("CPP_CLI_SUPPORT")␊ |
21 | #define STR_HIDE_SCOPE_NAMES QString::fromAscii("HIDE_SCOPE_NAMES")␊ |
22 | #define STR_EXTRACT_ALL QString::fromAscii("EXTRACT_ALL")␊ |
23 | #define STR_SOURCE_BROWSER QString::fromAscii("SOURCE_BROWSER")␊ |
24 | #define STR_GENERATE_HTML QString::fromAscii("GENERATE_HTML")␊ |
25 | #define STR_GENERATE_LATEX QString::fromAscii("GENERATE_LATEX")␊ |
26 | #define STR_GENERATE_MAN QString::fromAscii("GENERATE_MAN")␊ |
27 | #define STR_GENERATE_RTF QString::fromAscii("GENERATE_RTF")␊ |
28 | #define STR_GENERATE_XML QString::fromAscii("GENERATE_XML")␊ |
29 | #define STR_GENERATE_HTMLHELP QString::fromAscii("GENERATE_HTMLHELP")␊ |
30 | #define STR_GENERATE_TREEVIEW QString::fromAscii("GENERATE_TREEVIEW")␊ |
31 | #define STR_USE_PDFLATEX QString::fromAscii("USE_PDFLATEX")␊ |
32 | #define STR_PDF_HYPERLINKS QString::fromAscii("PDF_HYPERLINKS")␊ |
33 | #define STR_SEARCHENGINE QString::fromAscii("SEARCHENGINE")␊ |
34 | #define STR_HAVE_DOT QString::fromAscii("HAVE_DOT")␊ |
35 | #define STR_CLASS_DIAGRAMS QString::fromAscii("CLASS_DIAGRAMS")␊ |
36 | #define STR_CLASS_GRAPH QString::fromAscii("CLASS_GRAPH")␊ |
37 | #define STR_COLLABORATION_GRAPH QString::fromAscii("COLLABORATION_GRAPH")␊ |
38 | #define STR_GRAPHICAL_HIERARCHY QString::fromAscii("GRAPHICAL_HIERARCHY")␊ |
39 | #define STR_INCLUDE_GRAPH QString::fromAscii("INCLUDE_GRAPH")␊ |
40 | #define STR_INCLUDED_BY_GRAPH QString::fromAscii("INCLUDED_BY_GRAPH")␊ |
41 | #define STR_CALL_GRAPH QString::fromAscii("CALL_GRAPH")␊ |
42 | #define STR_CALLER_GRAPH QString::fromAscii("CALLER_GRAPH")␊ |
43 | #define STR_HTML_COLORSTYLE_HUE QString::fromAscii("HTML_COLORSTYLE_HUE")␊ |
44 | #define STR_HTML_COLORSTYLE_SAT QString::fromAscii("HTML_COLORSTYLE_SAT")␊ |
45 | #define STR_HTML_COLORSTYLE_GAMMA QString::fromAscii("HTML_COLORSTYLE_GAMMA")␊ |
46 | ␊ |
47 | static bool g_optimizeMapping[6][6] = ␊ |
48 | {␊ |
49 | // A: OPTIMIZE_OUTPUT_FOR_C␊ |
50 | // B: OPTIMIZE_OUTPUT_JAVA␊ |
51 | // C: OPTIMIZE_FOR_FORTRAN␊ |
52 | // D: OPTIMIZE_OUTPUT_VHDL␊ |
53 | // E: CPP_CLI_SUPPORT␊ |
54 | // F: HIDE_SCOPE_NAMES␊ |
55 | // A B C D E F␊ |
56 | { false,false,false,false,false,false }, // 0: C++␊ |
57 | { false,false,false,false,true, false }, // 1: C++/CLI␊ |
58 | { false,true, false,false,false,false }, // 2: C#/Java␊ |
59 | { true, false,false,false,false,true }, // 3: C/PHP ␊ |
60 | { false,false,true, false,false,false }, // 4: Fortran␊ |
61 | { false,false,false,true, false,false }, // 5: VHDL␊ |
62 | };␊ |
63 | ␊ |
64 | static QString g_optimizeOptionNames[6] =␊ |
65 | {␊ |
66 | STR_OPTIMIZE_OUTPUT_FOR_C,␊ |
67 | STR_OPTIMIZE_OUTPUT_JAVA,␊ |
68 | STR_OPTIMIZE_FOR_FORTRAN,␊ |
69 | STR_OPTIMIZE_OUTPUT_VHDL,␊ |
70 | STR_CPP_CLI_SUPPORT,␊ |
71 | STR_HIDE_SCOPE_NAMES␊ |
72 | };␊ |
73 | ␊ |
74 | //==========================================================================␊ |
75 | ␊ |
76 | static bool stringVariantToBool(const QVariant &v)␊ |
77 | {␊ |
78 | QString s = v.toString().toLower();␊ |
79 | return s==QString::fromAscii("yes") || s==QString::fromAscii("true") || s==QString::fromAscii("1");␊ |
80 | } ␊ |
81 | ␊ |
82 | static bool getBoolOption(␊ |
83 | const QHash<QString,Input*>&model,const QString &name)␊ |
84 | {␊ |
85 | Input *option = model[name];␊ |
86 | Q_ASSERT(option!=0);␊ |
87 | return stringVariantToBool(option->value());␊ |
88 | } ␊ |
89 | ␊ |
90 | static int getIntOption(␊ |
91 | const QHash<QString,Input*>&model,const QString &name)␊ |
92 | {␊ |
93 | Input *option = model[name];␊ |
94 | Q_ASSERT(option!=0);␊ |
95 | return option->value().toInt();␊ |
96 | } ␊ |
97 | ␊ |
98 | static QString getStringOption(␊ |
99 | const QHash<QString,Input*>&model,const QString &name)␊ |
100 | {␊ |
101 | Input *option = model[name];␊ |
102 | Q_ASSERT(option!=0);␊ |
103 | return option->value().toString();␊ |
104 | }␊ |
105 | ␊ |
106 | static void updateBoolOption(␊ |
107 | const QHash<QString,Input*>&model,const QString &name,bool bNew)␊ |
108 | {␊ |
109 | Input *option = model[name];␊ |
110 | Q_ASSERT(option!=0);␊ |
111 | bool bOld = stringVariantToBool(option->value());␊ |
112 | if (bOld!=bNew)␊ |
113 | {␊ |
114 | option->value()=QString::fromAscii(bNew ? "true" : "false");␊ |
115 | option->update();␊ |
116 | }␊ |
117 | }␊ |
118 | ␊ |
119 | static void updateIntOption(␊ |
120 | const QHash<QString,Input*>&model,const QString &name,int iNew)␊ |
121 | {␊ |
122 | Input *option = model[name];␊ |
123 | Q_ASSERT(option!=0);␊ |
124 | int iOld = option->value().toInt();␊ |
125 | if (iOld!=iNew)␊ |
126 | {␊ |
127 | option->value()=QString::fromAscii("%1").arg(iNew);␊ |
128 | option->update();␊ |
129 | }␊ |
130 | }␊ |
131 | ␊ |
132 | ␊ |
133 | static void updateStringOption(␊ |
134 | const QHash<QString,Input*>&model,const QString &name,const QString &s)␊ |
135 | {␊ |
136 | Input *option = model[name];␊ |
137 | Q_ASSERT(option!=0);␊ |
138 | if (option->value().toString()!=s)␊ |
139 | {␊ |
140 | option->value() = s;␊ |
141 | option->update();␊ |
142 | }␊ |
143 | }␊ |
144 | ␊ |
145 | //==========================================================================␊ |
146 | ␊ |
147 | TuneColorDialog::TuneColorDialog(int hue,int sat,int gamma,QWidget *parent) : QDialog(parent)␊ |
148 | {␊ |
149 | setWindowTitle(tr("Tune the color of the HTML output"));␊ |
150 | QGridLayout *layout = new QGridLayout(this);␊ |
151 | m_image = new QImage(QString::fromAscii(":/images/tunecolor.png"));␊ |
152 | m_imageLab = new QLabel;␊ |
153 | updateImage(hue,sat,gamma);␊ |
154 | layout->addWidget(new QLabel(tr("Example output: use the sliders on the right to adjust the color")),0,0);␊ |
155 | layout->addWidget(m_imageLab,1,0);␊ |
156 | QHBoxLayout *buttonsLayout = new QHBoxLayout;␊ |
157 | ␊ |
158 | QPushButton *okButton = new QPushButton(tr("Ok"));␊ |
159 | connect(okButton,SIGNAL(clicked()),SLOT(accept()));␊ |
160 | okButton->setDefault(true);␊ |
161 | QPushButton *cancelButton = new QPushButton(tr("Cancel"));␊ |
162 | connect(cancelButton,SIGNAL(clicked()),SLOT(reject()));␊ |
163 | ␊ |
164 | ColorPicker *huePicker = new ColorPicker(ColorPicker::Hue);␊ |
165 | huePicker->setCol(hue,sat,gamma);␊ |
166 | huePicker->setFixedWidth(20);␊ |
167 | layout->addWidget(huePicker,1,1);␊ |
168 | ColorPicker *satPicker = new ColorPicker(ColorPicker::Saturation);␊ |
169 | satPicker->setCol(hue,sat,gamma);␊ |
170 | satPicker->setFixedWidth(20);␊ |
171 | layout->addWidget(satPicker,1,2);␊ |
172 | ColorPicker *gamPicker = new ColorPicker(ColorPicker::Gamma);␊ |
173 | gamPicker->setCol(hue,sat,gamma);␊ |
174 | gamPicker->setFixedWidth(20);␊ |
175 | layout->addWidget(gamPicker,1,3);␊ |
176 | ␊ |
177 | connect(huePicker,SIGNAL(newHsv(int,int,int)),satPicker,SLOT(setCol(int,int,int)));␊ |
178 | connect(satPicker,SIGNAL(newHsv(int,int,int)),huePicker,SLOT(setCol(int,int,int)));␊ |
179 | connect(huePicker,SIGNAL(newHsv(int,int,int)),gamPicker,SLOT(setCol(int,int,int)));␊ |
180 | connect(satPicker,SIGNAL(newHsv(int,int,int)),gamPicker,SLOT(setCol(int,int,int)));␊ |
181 | connect(gamPicker,SIGNAL(newHsv(int,int,int)),satPicker,SLOT(setCol(int,int,int)));␊ |
182 | connect(gamPicker,SIGNAL(newHsv(int,int,int)),huePicker,SLOT(setCol(int,int,int)));␊ |
183 | connect(huePicker,SIGNAL(newHsv(int,int,int)),this,SLOT(updateImage(int,int,int)));␊ |
184 | connect(satPicker,SIGNAL(newHsv(int,int,int)),this,SLOT(updateImage(int,int,int)));␊ |
185 | connect(gamPicker,SIGNAL(newHsv(int,int,int)),this,SLOT(updateImage(int,int,int)));␊ |
186 | ␊ |
187 | buttonsLayout->addStretch();␊ |
188 | buttonsLayout->addWidget(okButton);␊ |
189 | buttonsLayout->addWidget(cancelButton);␊ |
190 | layout->addLayout(buttonsLayout,5,0,1,4);␊ |
191 | }␊ |
192 | ␊ |
193 | void hsl2rgb(double h,double s,double l,␊ |
194 | double *pRed,double *pGreen,double *pBlue)␊ |
195 | {␊ |
196 | double v;␊ |
197 | double r,g,b;␊ |
198 | ␊ |
199 | r = l; // default to gray␊ |
200 | g = l;␊ |
201 | b = l;␊ |
202 | v = (l <= 0.5) ? (l * (1.0 + s)) : (l + s - l * s);␊ |
203 | if (v > 0)␊ |
204 | {␊ |
205 | double m;␊ |
206 | double sv;␊ |
207 | int sextant;␊ |
208 | double fract, vsf, mid1, mid2;␊ |
209 | ␊ |
210 | m = l + l - v;␊ |
211 | sv = (v - m ) / v;␊ |
212 | h *= 6.0;␊ |
213 | sextant = (int)h;␊ |
214 | fract = h - sextant;␊ |
215 | vsf = v * sv * fract;␊ |
216 | mid1 = m + vsf;␊ |
217 | mid2 = v - vsf;␊ |
218 | switch (sextant)␊ |
219 | {␊ |
220 | case 0:␊ |
221 | r = v;␊ |
222 | g = mid1;␊ |
223 | b = m;␊ |
224 | break;␊ |
225 | case 1:␊ |
226 | r = mid2;␊ |
227 | g = v;␊ |
228 | b = m;␊ |
229 | break;␊ |
230 | case 2:␊ |
231 | r = m;␊ |
232 | g = v;␊ |
233 | b = mid1;␊ |
234 | break;␊ |
235 | case 3:␊ |
236 | r = m;␊ |
237 | g = mid2;␊ |
238 | b = v;␊ |
239 | break;␊ |
240 | case 4:␊ |
241 | r = mid1;␊ |
242 | g = m;␊ |
243 | b = v;␊ |
244 | break;␊ |
245 | case 5:␊ |
246 | r = v;␊ |
247 | g = m;␊ |
248 | b = mid2;␊ |
249 | break;␊ |
250 | }␊ |
251 | }␊ |
252 | *pRed = r;␊ |
253 | *pGreen = g;␊ |
254 | *pBlue = b;␊ |
255 | }␊ |
256 | ␊ |
257 | ␊ |
258 | ␊ |
259 | void TuneColorDialog::updateImage(int hue,int sat,int gam)␊ |
260 | {␊ |
261 | QImage coloredImg(m_image->width(),m_image->height(),QImage::Format_RGB32);␊ |
262 | uint *srcPixel = (uint *)m_image->scanLine(0);␊ |
263 | uint *dstPixel = (uint *)coloredImg.scanLine(0);␊ |
264 | uint nrPixels = coloredImg.width()*coloredImg.height();␊ |
265 | for (uint i=0;i<nrPixels;i++,srcPixel++,dstPixel++)␊ |
266 | {␊ |
267 | QColor c = QColor::fromRgb(*srcPixel);␊ |
268 | double r,g,b;␊ |
269 | hsl2rgb(hue/359.0, sat/255.0, pow(c.green()/255.0,gam/100.0),&r,&g,&b);␊ |
270 | *dstPixel = qRgb((int)(r*255.0),(int)(g*255.0),(int)(b*255.0));␊ |
271 | }␊ |
272 | m_imageLab->setPixmap(QPixmap::fromImage(coloredImg));␊ |
273 | m_hue = hue;␊ |
274 | m_sat = sat;␊ |
275 | m_gam = gam;␊ |
276 | }␊ |
277 | ␊ |
278 | int TuneColorDialog::getHue() const␊ |
279 | {␊ |
280 | return m_hue;␊ |
281 | }␊ |
282 | ␊ |
283 | int TuneColorDialog::getSaturation() const␊ |
284 | {␊ |
285 | return m_sat;␊ |
286 | }␊ |
287 | ␊ |
288 | int TuneColorDialog::getGamma() const␊ |
289 | {␊ |
290 | return m_gam;␊ |
291 | }␊ |
292 | ␊ |
293 | //==========================================================================␊ |
294 | ␊ |
295 | ColorPicker::ColorPicker(Mode m)␊ |
296 | {␊ |
297 | m_hue = 220;␊ |
298 | m_gam = 100;␊ |
299 | m_sat = 100;␊ |
300 | m_mode = m;␊ |
301 | m_pix = 0;␊ |
302 | }␊ |
303 | ␊ |
304 | ColorPicker::~ColorPicker()␊ |
305 | {␊ |
306 | delete m_pix;␊ |
307 | }␊ |
308 | ␊ |
309 | void ColorPicker::paintEvent(QPaintEvent*)␊ |
310 | {␊ |
311 | int w = width() - 5;␊ |
312 | ␊ |
313 | QRect r(0, foff, w, height() - 2*foff);␊ |
314 | int wi = r.width() - 2;␊ |
315 | int hi = r.height() - 2;␊ |
316 | if (!m_pix || m_pix->height() != hi || m_pix->width() != wi) ␊ |
317 | {␊ |
318 | delete m_pix;␊ |
319 | QImage img(wi, hi, QImage::Format_RGB32);␊ |
320 | int y;␊ |
321 | uint *pixel = (uint *) img.scanLine(0);␊ |
322 | for (y = 0; y < hi; y++) ␊ |
323 | {␊ |
324 | const uint *end = pixel + wi;␊ |
325 | int yh = y2hue(y+coff);␊ |
326 | int ys = y2sat(y+coff);␊ |
327 | int yg = y2gam(y+coff);␊ |
328 | while (pixel < end) ␊ |
329 | {␊ |
330 | QColor c;␊ |
331 | c.setHsv(yh, ys, (int)(255*pow(0.7,yg/100.0)));␊ |
332 | *pixel = c.rgb();␊ |
333 | ++pixel;␊ |
334 | }␊ |
335 | }␊ |
336 | m_pix = new QPixmap(QPixmap::fromImage(img));␊ |
337 | }␊ |
338 | QPainter p(this);␊ |
339 | p.drawPixmap(1, coff, *m_pix);␊ |
340 | const QPalette &g = palette();␊ |
341 | qDrawShadePanel(&p, r, g, true);␊ |
342 | p.setPen(g.foreground().color());␊ |
343 | p.setBrush(g.foreground());␊ |
344 | QPolygon a;␊ |
345 | int y = m_mode==Hue ? hue2y(m_hue) : ␊ |
346 | m_mode==Saturation ? sat2y(m_sat) :␊ |
347 | gam2y(m_gam);␊ |
348 | a.setPoints(3, w, y, w+5, y+5, w+5, y-5);␊ |
349 | p.eraseRect(w, 0, 5, height());␊ |
350 | p.drawPolygon(a);␊ |
351 | }␊ |
352 | ␊ |
353 | void ColorPicker::mouseMoveEvent(QMouseEvent *m)␊ |
354 | {␊ |
355 | if (m_mode==Hue) setHue(y2hue(m->y())); ␊ |
356 | else if (m_mode==Saturation) setSat(y2sat(m->y()));␊ |
357 | else setGam(y2gam(m->y()));␊ |
358 | }␊ |
359 | ␊ |
360 | void ColorPicker::mousePressEvent(QMouseEvent *m)␊ |
361 | {␊ |
362 | if (m_mode==Hue) setHue(y2hue(m->y())); ␊ |
363 | else if (m_mode==Saturation) setSat(y2sat(m->y()));␊ |
364 | else setGam(y2gam(m->y()));␊ |
365 | }␊ |
366 | ␊ |
367 | void ColorPicker::setHue(int h)␊ |
368 | {␊ |
369 | if (h==m_hue) return;␊ |
370 | m_hue = qMax(0,qMin(h,359));␊ |
371 | delete m_pix; m_pix=0;␊ |
372 | repaint();␊ |
373 | emit newHsv(m_hue,m_sat,m_gam);␊ |
374 | }␊ |
375 | ␊ |
376 | void ColorPicker::setSat(int s)␊ |
377 | {␊ |
378 | if (s==m_sat) return;␊ |
379 | m_sat = qMax(0,qMin(s,255));␊ |
380 | delete m_pix; m_pix=0;␊ |
381 | repaint();␊ |
382 | emit newHsv(m_hue,m_sat,m_gam);␊ |
383 | }␊ |
384 | ␊ |
385 | void ColorPicker::setGam(int g)␊ |
386 | {␊ |
387 | if (g==m_gam) return;␊ |
388 | m_gam = qMax(40,qMin(g,240));␊ |
389 | delete m_pix; m_pix=0;␊ |
390 | repaint();␊ |
391 | emit newHsv(m_hue,m_sat,m_gam);␊ |
392 | }␊ |
393 | ␊ |
394 | void ColorPicker::setCol(int h, int s, int g)␊ |
395 | {␊ |
396 | if (m_hue!=h || m_sat!=s || m_gam!=g)␊ |
397 | {␊ |
398 | m_hue = h;␊ |
399 | m_sat = s;␊ |
400 | m_gam = g;␊ |
401 | delete m_pix; m_pix=0;␊ |
402 | repaint();␊ |
403 | }␊ |
404 | }␊ |
405 | ␊ |
406 | int ColorPicker::y2hue(int y)␊ |
407 | {␊ |
408 | int d = height() - 2*coff - 1;␊ |
409 | return m_mode==Hue ? (y - coff)*359/d : m_hue;␊ |
410 | }␊ |
411 | ␊ |
412 | int ColorPicker::hue2y(int v)␊ |
413 | {␊ |
414 | int d = height() - 2*coff - 1;␊ |
415 | return coff + v*d/359;␊ |
416 | }␊ |
417 | ␊ |
418 | int ColorPicker::y2sat(int y)␊ |
419 | {␊ |
420 | int d = height() - 2*coff - 1;␊ |
421 | return m_mode==Saturation ? 255 - (y - coff)*255/d : m_sat;␊ |
422 | }␊ |
423 | ␊ |
424 | int ColorPicker::sat2y(int v)␊ |
425 | {␊ |
426 | int d = height() - 2*coff - 1;␊ |
427 | return coff + (255-v)*d/255;␊ |
428 | }␊ |
429 | ␊ |
430 | int ColorPicker::y2gam(int y)␊ |
431 | {␊ |
432 | int d = height() - 2*coff - 1;␊ |
433 | return m_mode==Gamma ? 240 - (y - coff)*200/d : m_gam;␊ |
434 | }␊ |
435 | ␊ |
436 | int ColorPicker::gam2y(int g)␊ |
437 | {␊ |
438 | int d = height() - 2*coff - 1;␊ |
439 | return coff + (240-g)*d/200;␊ |
440 | }␊ |
441 | ␊ |
442 | //==========================================================================␊ |
443 | ␊ |
444 | Step1::Step1(Wizard *wizard,const QHash<QString,Input*> &modelData) : m_wizard(wizard), m_modelData(modelData)␊ |
445 | {␊ |
446 | QVBoxLayout *layout = new QVBoxLayout(this);␊ |
447 | layout->setMargin(4);␊ |
448 | layout->setSpacing(8);␊ |
449 | QLabel *l = new QLabel(this);␊ |
450 | l->setText(tr("Provide some information "␊ |
451 | "about the project you are documenting"));␊ |
452 | layout->addWidget(l);␊ |
453 | QWidget *w = new QWidget( this );␊ |
454 | QGridLayout *grid = new QGridLayout(w);␊ |
455 | grid->setSpacing(10);␊ |
456 | ␊ |
457 | // project name␊ |
458 | QLabel *projName = new QLabel(this);␊ |
459 | projName->setText(tr("Project name:"));␊ |
460 | projName->setAlignment(Qt::AlignRight|Qt::AlignVCenter);␊ |
461 | // project brief␊ |
462 | QLabel *projBrief = new QLabel(this);␊ |
463 | projBrief->setText(tr("Project synopsis:"));␊ |
464 | projBrief->setAlignment(Qt::AlignRight|Qt::AlignVCenter);␊ |
465 | // project version␊ |
466 | QLabel *projVersion = new QLabel(this);␊ |
467 | projVersion->setText(tr("Project version or id:"));␊ |
468 | projVersion->setAlignment(Qt::AlignRight|Qt::AlignVCenter);␊ |
469 | // project icon␊ |
470 | QLabel *projLogo = new QLabel(this);␊ |
471 | projLogo->setText(tr("Project logo:"));␊ |
472 | projLogo->setAlignment(Qt::AlignRight|Qt::AlignVCenter);␊ |
473 | ␊ |
474 | grid->addWidget(projName,0,0);␊ |
475 | grid->addWidget(projBrief,1,0);␊ |
476 | grid->addWidget(projVersion,2,0);␊ |
477 | grid->addWidget(projLogo,3,0);␊ |
478 | ␊ |
479 | m_projName = new QLineEdit;␊ |
480 | m_projBrief = new QLineEdit;␊ |
481 | m_projNumber = new QLineEdit;␊ |
482 | QPushButton *projIconSel = new QPushButton(this);␊ |
483 | projIconSel->setText(tr("Select..."));␊ |
484 | QPixmap pm(QSize(120,55));␊ |
485 | pm.fill();␊ |
486 | m_projIconLab = new QLabel;␊ |
487 | m_projIconLab->setPixmap(pm);␊ |
488 | ␊ |
489 | grid->addWidget(m_projName,0,1,1,2);␊ |
490 | grid->addWidget(m_projBrief,1,1,1,2);␊ |
491 | grid->addWidget(m_projNumber,2,1,1,2);␊ |
492 | grid->addWidget(projIconSel,3,1);␊ |
493 | grid->addWidget(m_projIconLab,3,2);␊ |
494 | ␊ |
495 | grid->setColumnStretch(2,1);␊ |
496 | ␊ |
497 | w->setLayout(grid);␊ |
498 | ␊ |
499 | layout->addWidget(w);␊ |
500 | ␊ |
501 | //---------------------------------------------------␊ |
502 | QFrame *f = new QFrame( this );␊ |
503 | f->setFrameStyle( QFrame::HLine | QFrame::Sunken );␊ |
504 | layout->addWidget(f);␊ |
505 | ␊ |
506 | l = new QLabel(this);␊ |
507 | l->setText(tr("Specify the directory to scan for source code"));␊ |
508 | layout->addWidget(l);␊ |
509 | QWidget *row = new QWidget;␊ |
510 | QHBoxLayout *rowLayout = new QHBoxLayout(row);␊ |
511 | rowLayout->setSpacing(10);␊ |
512 | l = new QLabel(this);␊ |
513 | l->setText(tr("Source code directory:"));␊ |
514 | rowLayout->addWidget(l);␊ |
515 | m_sourceDir = new QLineEdit;␊ |
516 | m_srcSelectDir = new QPushButton(this);␊ |
517 | m_srcSelectDir->setText(tr("Select..."));␊ |
518 | rowLayout->addWidget(m_sourceDir);␊ |
519 | rowLayout->addWidget(m_srcSelectDir);␊ |
520 | layout->addWidget(row);␊ |
521 | ␊ |
522 | m_recursive = new QCheckBox(this);␊ |
523 | m_recursive->setText(tr("Scan recursively"));␊ |
524 | m_recursive->setChecked(TRUE);␊ |
525 | layout->addWidget(m_recursive);␊ |
526 | ␊ |
527 | //---------------------------------------------------␊ |
528 | f = new QFrame( this );␊ |
529 | f->setFrameStyle( QFrame::HLine | QFrame::Sunken );␊ |
530 | layout->addWidget(f);␊ |
531 | ␊ |
532 | l = new QLabel(this);␊ |
533 | l->setText(tr("Specify the directory where doxygen should "␊ |
534 | "put the generated documentation"));␊ |
535 | layout->addWidget(l);␊ |
536 | row = new QWidget;␊ |
537 | rowLayout = new QHBoxLayout(row);␊ |
538 | rowLayout->setSpacing(10);␊ |
539 | l = new QLabel(this);␊ |
540 | l->setText(tr("Destination directory:"));␊ |
541 | rowLayout->addWidget(l);␊ |
542 | m_destDir = new QLineEdit;␊ |
543 | m_dstSelectDir = new QPushButton(this);␊ |
544 | m_dstSelectDir->setText(tr("Select..."));␊ |
545 | rowLayout->addWidget(m_destDir);␊ |
546 | rowLayout->addWidget(m_dstSelectDir);␊ |
547 | layout->addWidget(row);␊ |
548 | layout->addStretch(1);␊ |
549 | setLayout(layout);␊ |
550 | ␊ |
551 | connect(projIconSel,SIGNAL(clicked()),␊ |
552 | this,SLOT(selectProjectIcon()));␊ |
553 | connect(m_srcSelectDir,SIGNAL(clicked()),␊ |
554 | this,SLOT(selectSourceDir()));␊ |
555 | connect(m_dstSelectDir,SIGNAL(clicked()),␊ |
556 | this,SLOT(selectDestinationDir()));␊ |
557 | connect(m_projName,SIGNAL(textChanged(const QString &)),SLOT(setProjectName(const QString &)));␊ |
558 | connect(m_projBrief,SIGNAL(textChanged(const QString &)),SLOT(setProjectBrief(const QString &)));␊ |
559 | connect(m_projNumber,SIGNAL(textChanged(const QString &)),SLOT(setProjectNumber(const QString &)));␊ |
560 | connect(m_sourceDir,SIGNAL(textChanged(const QString &)),SLOT(setSourceDir(const QString &)));␊ |
561 | connect(m_recursive,SIGNAL(stateChanged(int)),SLOT(setRecursiveScan(int)));␊ |
562 | connect(m_destDir,SIGNAL(textChanged(const QString &)),SLOT(setDestinationDir(const QString &)));␊ |
563 | }␊ |
564 | ␊ |
565 | void Step1::selectProjectIcon()␊ |
566 | {␊ |
567 | QString path = QFileInfo(MainWindow::instance().configFileName()).path();␊ |
568 | QString iconName = QFileDialog::getOpenFileName(this,␊ |
569 | tr("Select project icon/image"),path);␊ |
570 | QPixmap pm(iconName);␊ |
571 | if (!pm.isNull())␊ |
572 | {␊ |
573 | m_projIconLab->setPixmap(pm.scaledToHeight(55,Qt::SmoothTransformation));␊ |
574 | updateStringOption(m_modelData,STR_PROJECT_LOGO,iconName);␊ |
575 | }␊ |
576 | }␊ |
577 | ␊ |
578 | void Step1::selectSourceDir()␊ |
579 | {␊ |
580 | QString path = QFileInfo(MainWindow::instance().configFileName()).path();␊ |
581 | QString dirName = QFileDialog::getExistingDirectory(this,␊ |
582 | tr("Select source directory"),path);␊ |
583 | QDir dir(path);␊ |
584 | if (!MainWindow::instance().configFileName().isEmpty() && dir.exists())␊ |
585 | {␊ |
586 | dirName = dir.relativeFilePath(dirName);␊ |
587 | }␊ |
588 | if (dirName.isEmpty())␊ |
589 | {␊ |
590 | dirName=QString::fromAscii(".");␊ |
591 | }␊ |
592 | m_sourceDir->setText(dirName);␊ |
593 | }␊ |
594 | ␊ |
595 | void Step1::selectDestinationDir()␊ |
596 | {␊ |
597 | QString path = QFileInfo(MainWindow::instance().configFileName()).path();␊ |
598 | QString dirName = QFileDialog::getExistingDirectory(this,␊ |
599 | tr("Select destination directory"),path);␊ |
600 | QDir dir(path);␊ |
601 | if (!MainWindow::instance().configFileName().isEmpty() && dir.exists())␊ |
602 | {␊ |
603 | dirName = dir.relativeFilePath(dirName);␊ |
604 | }␊ |
605 | if (dirName.isEmpty())␊ |
606 | {␊ |
607 | dirName=QString::fromAscii(".");␊ |
608 | }␊ |
609 | m_destDir->setText(dirName);␊ |
610 | }␊ |
611 | ␊ |
612 | void Step1::setProjectName(const QString &name)␊ |
613 | {␊ |
614 | updateStringOption(m_modelData,STR_PROJECT_NAME,name);␊ |
615 | }␊ |
616 | ␊ |
617 | void Step1::setProjectBrief(const QString &desc)␊ |
618 | {␊ |
619 | updateStringOption(m_modelData,STR_PROJECT_BRIEF,desc);␊ |
620 | }␊ |
621 | ␊ |
622 | void Step1::setProjectNumber(const QString &num)␊ |
623 | {␊ |
624 | updateStringOption(m_modelData,STR_PROJECT_NUMBER,num);␊ |
625 | }␊ |
626 | ␊ |
627 | void Step1::setSourceDir(const QString &dir)␊ |
628 | {␊ |
629 | Input *option = m_modelData[STR_INPUT];␊ |
630 | if (option->value().toStringList().count()>0)␊ |
631 | {␊ |
632 | QStringList sl = option->value().toStringList();␊ |
633 | if (sl[0]!=dir)␊ |
634 | {␊ |
635 | sl[0] = dir;␊ |
636 | option->value() = sl;␊ |
637 | option->update();␊ |
638 | }␊ |
639 | }␊ |
640 | else␊ |
641 | {␊ |
642 | option->value() = QStringList() << dir;␊ |
643 | option->update();␊ |
644 | }␊ |
645 | }␊ |
646 | ␊ |
647 | void Step1::setDestinationDir(const QString &dir)␊ |
648 | {␊ |
649 | updateStringOption(m_modelData,STR_OUTPUT_DIRECTORY,dir);␊ |
650 | }␊ |
651 | ␊ |
652 | void Step1::setRecursiveScan(int s)␊ |
653 | {␊ |
654 | updateBoolOption(m_modelData,STR_RECURSIVE,s==Qt::Checked);␊ |
655 | }␊ |
656 | ␊ |
657 | void Step1::init()␊ |
658 | {␊ |
659 | Input *option;␊ |
660 | m_projName->setText(getStringOption(m_modelData,STR_PROJECT_NAME));␊ |
661 | m_projBrief->setText(getStringOption(m_modelData,STR_PROJECT_BRIEF));␊ |
662 | m_projNumber->setText(getStringOption(m_modelData,STR_PROJECT_NUMBER));␊ |
663 | QString iconName = getStringOption(m_modelData,STR_PROJECT_LOGO);␊ |
664 | if (!iconName.isEmpty())␊ |
665 | {␊ |
666 | QPixmap pm(iconName);␊ |
667 | if (!pm.isNull())␊ |
668 | {␊ |
669 | m_projIconLab->setPixmap(pm.scaledToHeight(55,Qt::SmoothTransformation));␊ |
670 | }␊ |
671 | }␊ |
672 | else␊ |
673 | {␊ |
674 | QPixmap pm(QSize(120,55));␊ |
675 | pm.fill();␊ |
676 | m_projIconLab->setPixmap(pm);␊ |
677 | }␊ |
678 | option = m_modelData[STR_INPUT];␊ |
679 | if (option->value().toStringList().count()>0)␊ |
680 | {␊ |
681 | m_sourceDir->setText(option->value().toStringList().first());␊ |
682 | }␊ |
683 | m_recursive->setChecked(␊ |
684 | getBoolOption(m_modelData,STR_RECURSIVE) ? Qt::Checked : Qt::Unchecked);␊ |
685 | m_destDir->setText(getStringOption(m_modelData,STR_OUTPUT_DIRECTORY));␊ |
686 | }␊ |
687 | ␊ |
688 | ␊ |
689 | //==========================================================================␊ |
690 | ␊ |
691 | Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData) ␊ |
692 | : m_wizard(wizard), m_modelData(modelData)␊ |
693 | {␊ |
694 | QRadioButton *r;␊ |
695 | QVBoxLayout *layout = new QVBoxLayout(this);␊ |
696 | ␊ |
697 | //---------------------------------------------------␊ |
698 | m_extractModeGroup = new QButtonGroup(this);␊ |
699 | m_extractMode = new QGroupBox(this);␊ |
700 | m_extractMode->setTitle(tr("Select the desired extraction mode:"));␊ |
701 | QGridLayout *gbox = new QGridLayout( m_extractMode );␊ |
702 | r = new QRadioButton(tr("Documented entities only"));␊ |
703 | r->setChecked(true);␊ |
704 | m_extractModeGroup->addButton(r, 0);␊ |
705 | gbox->addWidget(r,1,0);␊ |
706 | // 1 -> EXTRACT_ALL = NO␊ |
707 | r = new QRadioButton(tr("All Entities"));␊ |
708 | m_extractModeGroup->addButton(r, 1);␊ |
709 | gbox->addWidget(r,2,0);␊ |
710 | // 2 -> EXTRACT_ALL = YES␊ |
711 | m_crossRef = new QCheckBox(m_extractMode);␊ |
712 | m_crossRef->setText(tr("Include cross-referenced source code in the output"));␊ |
713 | // m_crossRef -> SOURCE_BROWSER = YES/NO␊ |
714 | gbox->addWidget(m_crossRef,3,0);␊ |
715 | layout->addWidget(m_extractMode);␊ |
716 | ␊ |
717 | //---------------------------------------------------␊ |
718 | QFrame *f = new QFrame( this );␊ |
719 | f->setFrameStyle( QFrame::HLine | QFrame::Sunken );␊ |
720 | layout->addWidget(f);␊ |
721 | ␊ |
722 | m_optimizeLangGroup = new QButtonGroup(this);␊ |
723 | m_optimizeLang = new QGroupBox(this);␊ |
724 | m_optimizeLang->setTitle(tr("Select programming language to optimize the results for"));␊ |
725 | gbox = new QGridLayout( m_optimizeLang ); ␊ |
726 | ␊ |
727 | r = new QRadioButton(m_optimizeLang);␊ |
728 | r->setText(tr("Optimize for C++ output"));␊ |
729 | r->setChecked(true);␊ |
730 | m_optimizeLangGroup->addButton(r, 0);␊ |
731 | // 0 -> OPTIMIZE_OUTPUT_FOR_C = NO␊ |
732 | // OPTIMIZE_OUTPUT_JAVA = NO␊ |
733 | // OPTIMIZE_FOR_FORTRAN = NO␊ |
734 | // OPTIMIZE_OUTPUT_VHDL = NO␊ |
735 | // CPP_CLI_SUPPORT = NO␊ |
736 | // HIDE_SCOPE_NAMES = NO␊ |
737 | gbox->addWidget(r,0,0);␊ |
738 | r = new QRadioButton(tr("Optimize for C++/CLI output"));␊ |
739 | gbox->addWidget(r,1,0);␊ |
740 | m_optimizeLangGroup->addButton(r, 1);␊ |
741 | // 1 -> OPTIMIZE_OUTPUT_FOR_C = NO␊ |
742 | // OPTIMIZE_OUTPUT_JAVA = NO␊ |
743 | // OPTIMIZE_FOR_FORTRAN = NO␊ |
744 | // OPTIMIZE_OUTPUT_VHDL = NO␊ |
745 | // CPP_CLI_SUPPORT = YES␊ |
746 | // HIDE_SCOPE_NAMES = NO␊ |
747 | r = new QRadioButton(tr("Optimize for Java or C# output"));␊ |
748 | m_optimizeLangGroup->addButton(r, 2);␊ |
749 | // 2 -> OPTIMIZE_OUTPUT_FOR_C = NO␊ |
750 | // OPTIMIZE_OUTPUT_JAVA = YES␊ |
751 | // OPTIMIZE_FOR_FORTRAN = NO␊ |
752 | // OPTIMIZE_OUTPUT_VHDL = NO␊ |
753 | // CPP_CLI_SUPPORT = NO␊ |
754 | // HIDE_SCOPE_NAMES = NO␊ |
755 | gbox->addWidget(r,2,0);␊ |
756 | r = new QRadioButton(tr("Optimize for C or PHP output"));␊ |
757 | m_optimizeLangGroup->addButton(r, 3);␊ |
758 | // 3 -> OPTIMIZE_OUTPUT_FOR_C = YES␊ |
759 | // OPTIMIZE_OUTPUT_JAVA = NO␊ |
760 | // OPTIMIZE_FOR_FORTRAN = NO␊ |
761 | // OPTIMIZE_OUTPUT_VHDL = NO␊ |
762 | // CPP_CLI_SUPPORT = NO␊ |
763 | // HIDE_SCOPE_NAMES = YES␊ |
764 | gbox->addWidget(r,3,0);␊ |
765 | r = new QRadioButton(tr("Optimize for Fortran output"));␊ |
766 | m_optimizeLangGroup->addButton(r, 4);␊ |
767 | // 4 -> OPTIMIZE_OUTPUT_FOR_C = NO␊ |
768 | // OPTIMIZE_OUTPUT_JAVA = NO␊ |
769 | // OPTIMIZE_FOR_FORTRAN = YES␊ |
770 | // OPTIMIZE_OUTPUT_VHDL = NO␊ |
771 | // CPP_CLI_SUPPORT = NO␊ |
772 | // HIDE_SCOPE_NAMES = NO␊ |
773 | gbox->addWidget(r,4,0);␊ |
774 | r = new QRadioButton(tr("Optimize for VHDL output"));␊ |
775 | m_optimizeLangGroup->addButton(r, 5);␊ |
776 | // 5 -> OPTIMIZE_OUTPUT_FOR_C = NO␊ |
777 | // OPTIMIZE_OUTPUT_JAVA = NO␊ |
778 | // OPTIMIZE_FOR_FORTRAN = NO␊ |
779 | // OPTIMIZE_OUTPUT_VHDL = YES␊ |
780 | // CPP_CLI_SUPPORT = NO␊ |
781 | // HIDE_SCOPE_NAMES = NO␊ |
782 | gbox->addWidget(r,5,0);␊ |
783 | ␊ |
784 | layout->addWidget(m_optimizeLang);␊ |
785 | layout->addStretch(1);␊ |
786 | ␊ |
787 | connect(m_crossRef,SIGNAL(stateChanged(int)),␊ |
788 | SLOT(changeCrossRefState(int)));␊ |
789 | connect(m_optimizeLangGroup,SIGNAL(buttonClicked(int)),␊ |
790 | SLOT(optimizeFor(int)));␊ |
791 | connect(m_extractModeGroup,SIGNAL(buttonClicked(int)),␊ |
792 | SLOT(extractMode(int)));␊ |
793 | }␊ |
794 | ␊ |
795 | ␊ |
796 | void Step2::optimizeFor(int choice)␊ |
797 | {␊ |
798 | for (int i=0;i<6;i++)␊ |
799 | {␊ |
800 | updateBoolOption(m_modelData,␊ |
801 | g_optimizeOptionNames[i],␊ |
802 | g_optimizeMapping[choice][i]);␊ |
803 | }␊ |
804 | }␊ |
805 | ␊ |
806 | void Step2::extractMode(int choice)␊ |
807 | {␊ |
808 | updateBoolOption(m_modelData,STR_EXTRACT_ALL,choice==1);␊ |
809 | }␊ |
810 | ␊ |
811 | void Step2::changeCrossRefState(int choice)␊ |
812 | {␊ |
813 | updateBoolOption(m_modelData,STR_SOURCE_BROWSER,choice==Qt::Checked);␊ |
814 | }␊ |
815 | ␊ |
816 | void Step2::init()␊ |
817 | {␊ |
818 | m_extractModeGroup->button(␊ |
819 | getBoolOption(m_modelData,STR_EXTRACT_ALL) ? 1 : 0)->setChecked(true);␊ |
820 | m_crossRef->setChecked(getBoolOption(m_modelData,STR_SOURCE_BROWSER));␊ |
821 | ␊ |
822 | int x=0;␊ |
823 | if (getBoolOption(m_modelData,STR_CPP_CLI_SUPPORT)) x=1;␊ |
824 | else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_JAVA)) x=2;␊ |
825 | else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_FOR_C)) x=3;␊ |
826 | else if (getBoolOption(m_modelData,STR_OPTIMIZE_FOR_FORTRAN)) x=4;␊ |
827 | else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_VHDL)) x=5;␊ |
828 | m_optimizeLangGroup->button(x)->setChecked(true);␊ |
829 | }␊ |
830 | ␊ |
831 | //==========================================================================␊ |
832 | ␊ |
833 | Step3::Step3(Wizard *wizard,const QHash<QString,Input*> &modelData) ␊ |
834 | : m_wizard(wizard), m_modelData(modelData)␊ |
835 | {␊ |
836 | QVBoxLayout *vbox = 0;␊ |
837 | QRadioButton *r = 0;␊ |
838 | ␊ |
839 | QGridLayout *gbox = new QGridLayout( this );␊ |
840 | gbox->addWidget(new QLabel(tr("Select the output format(s) to generate")),0,0);␊ |
841 | {␊ |
842 | m_htmlOptions = new QGroupBox(tr("HTML"));␊ |
843 | m_htmlOptions->setCheckable(true);␊ |
844 | // GENERATE_HTML␊ |
845 | m_htmlOptionsGroup = new QButtonGroup(m_htmlOptions);␊ |
846 | QRadioButton *r = new QRadioButton(tr("plain HTML"));␊ |
847 | r->setChecked(true);␊ |
848 | m_htmlOptionsGroup->addButton(r, 0);␊ |
849 | vbox = new QVBoxLayout;␊ |
850 | vbox->addWidget(r);␊ |
851 | r = new QRadioButton(tr("with navigation panel"));␊ |
852 | m_htmlOptionsGroup->addButton(r, 1);␊ |
853 | // GENERATE_TREEVIEW␊ |
854 | vbox->addWidget(r);␊ |
855 | r = new QRadioButton(tr("prepare for compressed HTML (.chm)"));␊ |
856 | m_htmlOptionsGroup->addButton(r, 2);␊ |
857 | // GENERATE_HTMLHELP␊ |
858 | vbox->addWidget(r);␊ |
859 | m_searchEnabled=new QCheckBox(tr("With search function"));␊ |
860 | vbox->addWidget(m_searchEnabled);␊ |
861 | // SEARCH_ENGINE␊ |
862 | QHBoxLayout *hbox = new QHBoxLayout;␊ |
863 | m_tuneColor=new QPushButton(tr("Change color..."));␊ |
864 | hbox->addWidget(m_tuneColor);␊ |
865 | hbox->addStretch(1);␊ |
866 | vbox->addLayout(hbox);␊ |
867 | m_htmlOptions->setLayout(vbox);␊ |
868 | m_htmlOptions->setChecked(true);␊ |
869 | }␊ |
870 | gbox->addWidget(m_htmlOptions,1,0);␊ |
871 | ␊ |
872 | {␊ |
873 | m_texOptions = new QGroupBox(tr("LaTeX"));␊ |
874 | m_texOptions->setCheckable(true);␊ |
875 | // GENERATE_LATEX␊ |
876 | m_texOptionsGroup = new QButtonGroup(m_texOptions);␊ |
877 | vbox = new QVBoxLayout;␊ |
878 | r = new QRadioButton(tr("as intermediate format for hyperlinked PDF"));␊ |
879 | m_texOptionsGroup->addButton(r, 0);␊ |
880 | // PDF_HYPERLINKS = YES␊ |
881 | r->setChecked(true);␊ |
882 | vbox->addWidget(r);␊ |
883 | r = new QRadioButton(tr("as intermediate format for PDF"));␊ |
884 | m_texOptionsGroup->addButton(r, 1);␊ |
885 | // PDF_HYPERLINKS = NO, USE_PDFLATEX = YES␊ |
886 | vbox->addWidget(r);␊ |
887 | r = new QRadioButton(tr("as intermediate format for PostScript"));␊ |
888 | m_texOptionsGroup->addButton(r, 2);␊ |
889 | // USE_PDFLATEX = NO␊ |
890 | vbox->addWidget(r);␊ |
891 | vbox->addStretch(1);␊ |
892 | m_texOptions->setLayout(vbox);␊ |
893 | m_texOptions->setChecked(true);␊ |
894 | }␊ |
895 | gbox->addWidget(m_texOptions,2,0);␊ |
896 | ␊ |
897 | m_manEnabled=new QCheckBox(tr("Man pages"));␊ |
898 | // GENERATE_MAN␊ |
899 | m_rtfEnabled=new QCheckBox(tr("Rich Text Format (RTF)"));␊ |
900 | // GENERATE_RTF␊ |
901 | m_xmlEnabled=new QCheckBox(tr("XML"));␊ |
902 | // GENERATE_XML␊ |
903 | gbox->addWidget(m_manEnabled,3,0);␊ |
904 | gbox->addWidget(m_rtfEnabled,4,0);␊ |
905 | gbox->addWidget(m_xmlEnabled,5,0);␊ |
906 | ␊ |
907 | gbox->setRowStretch(6,1);␊ |
908 | connect(m_htmlOptions,SIGNAL(toggled(bool)),SLOT(setHtmlEnabled(bool)));␊ |
909 | connect(m_texOptions,SIGNAL(toggled(bool)),SLOT(setLatexEnabled(bool)));␊ |
910 | connect(m_manEnabled,SIGNAL(stateChanged(int)),SLOT(setManEnabled(int)));␊ |
911 | connect(m_rtfEnabled,SIGNAL(stateChanged(int)),SLOT(setRtfEnabled(int)));␊ |
912 | connect(m_xmlEnabled,SIGNAL(stateChanged(int)),SLOT(setXmlEnabled(int)));␊ |
913 | connect(m_searchEnabled,SIGNAL(stateChanged(int)),SLOT(setSearchEnabled(int)));␊ |
914 | connect(m_htmlOptionsGroup,SIGNAL(buttonClicked(int)),␊ |
915 | SLOT(setHtmlOptions(int)));␊ |
916 | connect(m_texOptionsGroup,SIGNAL(buttonClicked(int)),␊ |
917 | SLOT(setLatexOptions(int)));␊ |
918 | connect(m_tuneColor,SIGNAL(clicked()),SLOT(tuneColorDialog()));␊ |
919 | }␊ |
920 | ␊ |
921 | void Step3::tuneColorDialog()␊ |
922 | {␊ |
923 | int hue = getIntOption(m_modelData,STR_HTML_COLORSTYLE_HUE);␊ |
924 | int sat = getIntOption(m_modelData,STR_HTML_COLORSTYLE_SAT);␊ |
925 | int gam = getIntOption(m_modelData,STR_HTML_COLORSTYLE_GAMMA);␊ |
926 | TuneColorDialog tuneColor(hue,sat,gam,this);␊ |
927 | if (tuneColor.exec()==QDialog::Accepted)␊ |
928 | {␊ |
929 | updateIntOption(m_modelData,STR_HTML_COLORSTYLE_HUE,tuneColor.getHue());␊ |
930 | updateIntOption(m_modelData,STR_HTML_COLORSTYLE_SAT,tuneColor.getSaturation());␊ |
931 | updateIntOption(m_modelData,STR_HTML_COLORSTYLE_GAMMA,tuneColor.getGamma());␊ |
932 | }␊ |
933 | }␊ |
934 | ␊ |
935 | void Step3::setHtmlEnabled(bool b)␊ |
936 | {␊ |
937 | updateBoolOption(m_modelData,STR_GENERATE_HTML,b);␊ |
938 | }␊ |
939 | ␊ |
940 | void Step3::setLatexEnabled(bool b)␊ |
941 | {␊ |
942 | updateBoolOption(m_modelData,STR_GENERATE_LATEX,b);␊ |
943 | }␊ |
944 | ␊ |
945 | void Step3::setManEnabled(int state)␊ |
946 | {␊ |
947 | updateBoolOption(m_modelData,STR_GENERATE_MAN,state==Qt::Checked);␊ |
948 | }␊ |
949 | ␊ |
950 | void Step3::setRtfEnabled(int state)␊ |
951 | {␊ |
952 | updateBoolOption(m_modelData,STR_GENERATE_RTF,state==Qt::Checked);␊ |
953 | }␊ |
954 | ␊ |
955 | void Step3::setXmlEnabled(int state)␊ |
956 | {␊ |
957 | updateBoolOption(m_modelData,STR_GENERATE_XML,state==Qt::Checked);␊ |
958 | }␊ |
959 | ␊ |
960 | void Step3::setSearchEnabled(int state)␊ |
961 | {␊ |
962 | updateBoolOption(m_modelData,STR_SEARCHENGINE,state==Qt::Checked);␊ |
963 | }␊ |
964 | ␊ |
965 | void Step3::setHtmlOptions(int id)␊ |
966 | {␊ |
967 | if (id==0) // plain HTML␊ |
968 | {␊ |
969 | updateBoolOption(m_modelData,STR_GENERATE_HTMLHELP,false);␊ |
970 | updateBoolOption(m_modelData,STR_GENERATE_TREEVIEW,false);␊ |
971 | }␊ |
972 | else if (id==1) // with navigation tree␊ |
973 | {␊ |
974 | updateBoolOption(m_modelData,STR_GENERATE_HTMLHELP,false);␊ |
975 | updateBoolOption(m_modelData,STR_GENERATE_TREEVIEW,true);␊ |
976 | }␊ |
977 | else if (id==2) // with compiled help␊ |
978 | {␊ |
979 | updateBoolOption(m_modelData,STR_GENERATE_HTMLHELP,true);␊ |
980 | updateBoolOption(m_modelData,STR_GENERATE_TREEVIEW,false);␊ |
981 | }␊ |
982 | }␊ |
983 | ␊ |
984 | void Step3::setLatexOptions(int id)␊ |
985 | {␊ |
986 | if (id==0) // hyperlinked PDF␊ |
987 | {␊ |
988 | updateBoolOption(m_modelData,STR_USE_PDFLATEX,true);␊ |
989 | updateBoolOption(m_modelData,STR_PDF_HYPERLINKS,true);␊ |
990 | }␊ |
991 | else if (id==1) // PDF␊ |
992 | {␊ |
993 | updateBoolOption(m_modelData,STR_USE_PDFLATEX,true);␊ |
994 | updateBoolOption(m_modelData,STR_PDF_HYPERLINKS,false);␊ |
995 | }␊ |
996 | else if (id==2) // PostScript␊ |
997 | {␊ |
998 | updateBoolOption(m_modelData,STR_USE_PDFLATEX,false);␊ |
999 | updateBoolOption(m_modelData,STR_PDF_HYPERLINKS,false);␊ |
1000 | }␊ |
1001 | }␊ |
1002 | ␊ |
1003 | void Step3::init()␊ |
1004 | {␊ |
1005 | m_htmlOptions->setChecked(getBoolOption(m_modelData,STR_GENERATE_HTML));␊ |
1006 | m_texOptions->setChecked(getBoolOption(m_modelData,STR_GENERATE_LATEX));␊ |
1007 | m_manEnabled->setChecked(getBoolOption(m_modelData,STR_GENERATE_MAN));␊ |
1008 | m_rtfEnabled->setChecked(getBoolOption(m_modelData,STR_GENERATE_RTF));␊ |
1009 | m_xmlEnabled->setChecked(getBoolOption(m_modelData,STR_GENERATE_XML));␊ |
1010 | m_searchEnabled->setChecked(getBoolOption(m_modelData,STR_SEARCHENGINE));␊ |
1011 | if (getBoolOption(m_modelData,STR_GENERATE_HTMLHELP))␊ |
1012 | {␊ |
1013 | m_htmlOptionsGroup->button(2)->setChecked(true); // compiled help␊ |
1014 | }␊ |
1015 | else if (getBoolOption(m_modelData,STR_GENERATE_TREEVIEW))␊ |
1016 | {␊ |
1017 | m_htmlOptionsGroup->button(1)->setChecked(true); // navigation tree␊ |
1018 | }␊ |
1019 | else␊ |
1020 | {␊ |
1021 | m_htmlOptionsGroup->button(0)->setChecked(true); // plain HTML␊ |
1022 | }␊ |
1023 | if (!getBoolOption(m_modelData,STR_USE_PDFLATEX))␊ |
1024 | {␊ |
1025 | m_texOptionsGroup->button(2)->setChecked(true); // PostScript␊ |
1026 | }␊ |
1027 | else if (!getBoolOption(m_modelData,STR_PDF_HYPERLINKS))␊ |
1028 | {␊ |
1029 | m_texOptionsGroup->button(1)->setChecked(true); // Plain PDF␊ |
1030 | }␊ |
1031 | else␊ |
1032 | {␊ |
1033 | m_texOptionsGroup->button(0)->setChecked(true); // PDF with hyperlinks␊ |
1034 | }␊ |
1035 | }␊ |
1036 | ␊ |
1037 | //==========================================================================␊ |
1038 | ␊ |
1039 | Step4::Step4(Wizard *wizard,const QHash<QString,Input*> &modelData) ␊ |
1040 | : m_wizard(wizard), m_modelData(modelData)␊ |
1041 | {␊ |
1042 | m_diagramModeGroup = new QButtonGroup(this);␊ |
1043 | QGridLayout *gbox = new QGridLayout( this );␊ |
1044 | gbox->addWidget(new QLabel(tr("Diagrams to generate")),0,0);␊ |
1045 | ␊ |
1046 | QRadioButton *rb = new QRadioButton(tr("No diagrams"));␊ |
1047 | m_diagramModeGroup->addButton(rb, 0);␊ |
1048 | gbox->addWidget(rb,1,0);␊ |
1049 | // CLASS_DIAGRAMS = NO, HAVE_DOT = NO␊ |
1050 | rb->setChecked(true);␊ |
1051 | rb = new QRadioButton(tr("Use built-in class diagram generator"));␊ |
1052 | m_diagramModeGroup->addButton(rb, 1);␊ |
1053 | // CLASS_DIAGRAMS = YES, HAVE_DOT = NO␊ |
1054 | gbox->addWidget(rb,2,0);␊ |
1055 | rb = new QRadioButton(tr("Use dot tool from the GraphViz package"));␊ |
1056 | m_diagramModeGroup->addButton(rb, 2);␊ |
1057 | gbox->addWidget(rb,3,0);␊ |
1058 | // CLASS_DIAGRAMS = NO, HAVE_DOT = YES␊ |
1059 | ␊ |
1060 | m_dotGroup = new QGroupBox(tr("Dot graphs to generate"));␊ |
1061 | QVBoxLayout *vbox = new QVBoxLayout;␊ |
1062 | m_dotClass=new QCheckBox(tr("Class diagrams"));␊ |
1063 | // CLASS_GRAPH␊ |
1064 | m_dotCollaboration=new QCheckBox(tr("Collaboration diagrams"));␊ |
1065 | // COLLABORATION_GRAPH␊ |
1066 | m_dotInheritance=new QCheckBox(tr("Overall Class hierarchy"));␊ |
1067 | // GRAPHICAL_HIERARCHY␊ |
1068 | m_dotInclude=new QCheckBox(tr("Include dependency graphs"));␊ |
1069 | // INCLUDE_GRAPH␊ |
1070 | m_dotIncludedBy=new QCheckBox(tr("Included by dependency graphs"));␊ |
1071 | // INCLUDED_BY_GRAPH␊ |
1072 | m_dotCall=new QCheckBox(tr("Call graphs"));␊ |
1073 | // CALL_GRAPH␊ |
1074 | m_dotCaller=new QCheckBox(tr("Called by graphs"));␊ |
1075 | // CALLER_GRAPH␊ |
1076 | vbox->addWidget(m_dotClass);␊ |
1077 | vbox->addWidget(m_dotCollaboration);␊ |
1078 | vbox->addWidget(m_dotInheritance);␊ |
1079 | vbox->addWidget(m_dotInclude);␊ |
1080 | vbox->addWidget(m_dotIncludedBy);␊ |
1081 | vbox->addWidget(m_dotCall);␊ |
1082 | vbox->addWidget(m_dotCaller);␊ |
1083 | vbox->addStretch(1);␊ |
1084 | m_dotGroup->setLayout(vbox);␊ |
1085 | m_dotClass->setChecked(true);␊ |
1086 | m_dotGroup->setEnabled(false);␊ |
1087 | gbox->addWidget(m_dotGroup,4,0);␊ |
1088 | ␊ |
1089 | m_dotInclude->setChecked(true);␊ |
1090 | m_dotCollaboration->setChecked(true);␊ |
1091 | gbox->setRowStretch(5,1);␊ |
1092 | ␊ |
1093 | connect(m_diagramModeGroup,SIGNAL(buttonClicked(int)),␊ |
1094 | this,SLOT(diagramModeChanged(int)));␊ |
1095 | connect(m_dotClass,SIGNAL(stateChanged(int)),␊ |
1096 | this,SLOT(setClassGraphEnabled(int)));␊ |
1097 | connect(m_dotCollaboration,SIGNAL(stateChanged(int)),␊ |
1098 | this,SLOT(setCollaborationGraphEnabled(int)));␊ |
1099 | connect(m_dotInheritance,SIGNAL(stateChanged(int)),␊ |
1100 | this,SLOT(setGraphicalHierarchyEnabled(int)));␊ |
1101 | connect(m_dotInclude,SIGNAL(stateChanged(int)),␊ |
1102 | this,SLOT(setIncludeGraphEnabled(int)));␊ |
1103 | connect(m_dotIncludedBy,SIGNAL(stateChanged(int)),␊ |
1104 | this,SLOT(setIncludedByGraphEnabled(int)));␊ |
1105 | connect(m_dotCall,SIGNAL(stateChanged(int)),␊ |
1106 | this,SLOT(setCallGraphEnabled(int)));␊ |
1107 | connect(m_dotCaller,SIGNAL(stateChanged(int)),␊ |
1108 | this,SLOT(setCallerGraphEnabled(int)));␊ |
1109 | }␊ |
1110 | ␊ |
1111 | void Step4::diagramModeChanged(int id)␊ |
1112 | {␊ |
1113 | if (id==0) // no diagrams␊ |
1114 | {␊ |
1115 | updateBoolOption(m_modelData,STR_HAVE_DOT,false);␊ |
1116 | updateBoolOption(m_modelData,STR_CLASS_DIAGRAMS,false);␊ |
1117 | }␊ |
1118 | else if (id==1) // builtin diagrams␊ |
1119 | {␊ |
1120 | updateBoolOption(m_modelData,STR_HAVE_DOT,false);␊ |
1121 | updateBoolOption(m_modelData,STR_CLASS_DIAGRAMS,true);␊ |
1122 | }␊ |
1123 | else if (id==2) // dot diagrams␊ |
1124 | {␊ |
1125 | updateBoolOption(m_modelData,STR_HAVE_DOT,true);␊ |
1126 | updateBoolOption(m_modelData,STR_CLASS_DIAGRAMS,false);␊ |
1127 | }␊ |
1128 | m_dotGroup->setEnabled(id==2);␊ |
1129 | }␊ |
1130 | ␊ |
1131 | void Step4::setClassGraphEnabled(int state)␊ |
1132 | {␊ |
1133 | updateBoolOption(m_modelData,STR_CLASS_GRAPH,state==Qt::Checked);␊ |
1134 | }␊ |
1135 | ␊ |
1136 | void Step4::setCollaborationGraphEnabled(int state)␊ |
1137 | {␊ |
1138 | updateBoolOption(m_modelData,STR_COLLABORATION_GRAPH,state==Qt::Checked);␊ |
1139 | }␊ |
1140 | ␊ |
1141 | void Step4::setGraphicalHierarchyEnabled(int state)␊ |
1142 | {␊ |
1143 | updateBoolOption(m_modelData,STR_GRAPHICAL_HIERARCHY,state==Qt::Checked);␊ |
1144 | }␊ |
1145 | ␊ |
1146 | void Step4::setIncludeGraphEnabled(int state)␊ |
1147 | {␊ |
1148 | updateBoolOption(m_modelData,STR_INCLUDE_GRAPH,state==Qt::Checked);␊ |
1149 | }␊ |
1150 | ␊ |
1151 | void Step4::setIncludedByGraphEnabled(int state)␊ |
1152 | {␊ |
1153 | updateBoolOption(m_modelData,STR_INCLUDED_BY_GRAPH,state==Qt::Checked);␊ |
1154 | }␊ |
1155 | ␊ |
1156 | void Step4::setCallGraphEnabled(int state)␊ |
1157 | {␊ |
1158 | updateBoolOption(m_modelData,STR_CALL_GRAPH,state==Qt::Checked);␊ |
1159 | }␊ |
1160 | ␊ |
1161 | void Step4::setCallerGraphEnabled(int state)␊ |
1162 | {␊ |
1163 | updateBoolOption(m_modelData,STR_CALLER_GRAPH,state==Qt::Checked);␊ |
1164 | }␊ |
1165 | ␊ |
1166 | void Step4::init()␊ |
1167 | {␊ |
1168 | if (getBoolOption(m_modelData,STR_HAVE_DOT))␊ |
1169 | {␊ |
1170 | m_diagramModeGroup->button(2)->setChecked(true); // Dot␊ |
1171 | }␊ |
1172 | else if (getBoolOption(m_modelData,STR_CLASS_DIAGRAMS))␊ |
1173 | {␊ |
1174 | m_diagramModeGroup->button(1)->setChecked(true); // Builtin diagrams␊ |
1175 | }␊ |
1176 | else␊ |
1177 | {␊ |
1178 | m_diagramModeGroup->button(0)->setChecked(true); // no diagrams␊ |
1179 | }␊ |
1180 | m_dotClass->setChecked(getBoolOption(m_modelData,STR_CLASS_GRAPH));␊ |
1181 | m_dotCollaboration->setChecked(getBoolOption(m_modelData,STR_COLLABORATION_GRAPH));␊ |
1182 | m_dotInheritance->setChecked(getBoolOption(m_modelData,STR_GRAPHICAL_HIERARCHY));␊ |
1183 | m_dotInclude->setChecked(getBoolOption(m_modelData,STR_INCLUDE_GRAPH));␊ |
1184 | m_dotIncludedBy->setChecked(getBoolOption(m_modelData,STR_INCLUDED_BY_GRAPH));␊ |
1185 | m_dotCall->setChecked(getBoolOption(m_modelData,STR_CALL_GRAPH));␊ |
1186 | m_dotCaller->setChecked(getBoolOption(m_modelData,STR_CALLER_GRAPH));␊ |
1187 | }␊ |
1188 | ␊ |
1189 | //==========================================================================␊ |
1190 | ␊ |
1191 | Wizard::Wizard(const QHash<QString,Input*> &modelData, QWidget *parent) : ␊ |
1192 | QSplitter(parent), m_modelData(modelData)␊ |
1193 | {␊ |
1194 | m_treeWidget = new QTreeWidget;␊ |
1195 | m_treeWidget->setColumnCount(1);␊ |
1196 | m_treeWidget->setHeaderLabels(QStringList() << QString::fromAscii("Topics"));␊ |
1197 | QList<QTreeWidgetItem*> items;␊ |
1198 | items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(tr("Project"))));␊ |
1199 | items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(tr("Mode"))));␊ |
1200 | items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(tr("Output"))));␊ |
1201 | items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(tr("Diagrams"))));␊ |
1202 | m_treeWidget->insertTopLevelItems(0,items);␊ |
1203 | ␊ |
1204 | m_topicStack = new QStackedWidget;␊ |
1205 | m_step1 = new Step1(this,modelData);␊ |
1206 | m_step2 = new Step2(this,modelData);␊ |
1207 | m_step3 = new Step3(this,modelData);␊ |
1208 | m_step4 = new Step4(this,modelData);␊ |
1209 | m_topicStack->addWidget(m_step1);␊ |
1210 | m_topicStack->addWidget(m_step2);␊ |
1211 | m_topicStack->addWidget(m_step3);␊ |
1212 | m_topicStack->addWidget(m_step4);␊ |
1213 | ␊ |
1214 | QWidget *rightSide = new QWidget;␊ |
1215 | QGridLayout *grid = new QGridLayout(rightSide);␊ |
1216 | m_prev = new QPushButton(tr("Previous"));␊ |
1217 | m_prev->setEnabled(false);␊ |
1218 | m_next = new QPushButton(tr("Next"));␊ |
1219 | grid->addWidget(m_topicStack,0,0,1,2);␊ |
1220 | grid->addWidget(m_prev,1,0,Qt::AlignLeft);␊ |
1221 | grid->addWidget(m_next,1,1,Qt::AlignRight);␊ |
1222 | grid->setColumnStretch(0,1);␊ |
1223 | grid->setRowStretch(0,1);␊ |
1224 | addWidget(m_treeWidget);␊ |
1225 | addWidget(rightSide);␊ |
1226 | ␊ |
1227 | connect(m_treeWidget,␊ |
1228 | SIGNAL(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)),␊ |
1229 | SLOT(activateTopic(QTreeWidgetItem *,QTreeWidgetItem *)));␊ |
1230 | connect(m_next,SIGNAL(clicked()),SLOT(nextTopic()));␊ |
1231 | connect(m_prev,SIGNAL(clicked()),SLOT(prevTopic()));␊ |
1232 | ␊ |
1233 | refresh();␊ |
1234 | }␊ |
1235 | ␊ |
1236 | Wizard::~Wizard()␊ |
1237 | {␊ |
1238 | }␊ |
1239 | ␊ |
1240 | void Wizard::activateTopic(QTreeWidgetItem *item,QTreeWidgetItem *)␊ |
1241 | {␊ |
1242 | if (item)␊ |
1243 | {␊ |
1244 | ␊ |
1245 | QString label = item->text(0);␊ |
1246 | if (label==tr("Project"))␊ |
1247 | {␊ |
1248 | m_topicStack->setCurrentWidget(m_step1);␊ |
1249 | m_prev->setEnabled(false);␊ |
1250 | m_next->setEnabled(true);␊ |
1251 | }␊ |
1252 | else if (label==tr("Mode"))␊ |
1253 | {␊ |
1254 | m_topicStack->setCurrentWidget(m_step2);␊ |
1255 | m_prev->setEnabled(true);␊ |
1256 | m_next->setEnabled(true);␊ |
1257 | }␊ |
1258 | else if (label==tr("Output"))␊ |
1259 | {␊ |
1260 | m_topicStack->setCurrentWidget(m_step3);␊ |
1261 | m_prev->setEnabled(true);␊ |
1262 | m_next->setEnabled(true);␊ |
1263 | }␊ |
1264 | else if (label==tr("Diagrams"))␊ |
1265 | {␊ |
1266 | m_topicStack->setCurrentWidget(m_step4);␊ |
1267 | m_prev->setEnabled(true);␊ |
1268 | m_next->setEnabled(false);␊ |
1269 | }␊ |
1270 | }␊ |
1271 | }␊ |
1272 | ␊ |
1273 | void Wizard::nextTopic()␊ |
1274 | {␊ |
1275 | m_topicStack->setCurrentIndex(m_topicStack->currentIndex()+1);␊ |
1276 | m_next->setEnabled(m_topicStack->count()!=m_topicStack->currentIndex()+1);␊ |
1277 | m_prev->setEnabled(m_topicStack->currentIndex()!=0);␊ |
1278 | m_treeWidget->setCurrentItem(m_treeWidget->invisibleRootItem()->child(m_topicStack->currentIndex()));␊ |
1279 | }␊ |
1280 | ␊ |
1281 | void Wizard::prevTopic()␊ |
1282 | {␊ |
1283 | m_topicStack->setCurrentIndex(m_topicStack->currentIndex()-1);␊ |
1284 | m_next->setEnabled(m_topicStack->count()!=m_topicStack->currentIndex()+1);␊ |
1285 | m_prev->setEnabled(m_topicStack->currentIndex()!=0);␊ |
1286 | m_treeWidget->setCurrentItem(m_treeWidget->invisibleRootItem()->child(m_topicStack->currentIndex()));␊ |
1287 | }␊ |
1288 | ␊ |
1289 | void Wizard::refresh()␊ |
1290 | {␊ |
1291 | m_step1->init();␊ |
1292 | m_step2->init();␊ |
1293 | m_step3->init();␊ |
1294 | m_step4->init();␊ |
1295 | }␊ |
1296 |