|
1 #include "wizard.h" |
|
2 #include "input.h" |
|
3 #include "doxywizard.h" |
|
4 |
|
5 #include <QtGui> |
|
6 |
|
7 // step1 options |
|
8 #define STR_PROJECT_NAME QString::fromAscii("PROJECT_NAME") |
|
9 #define STR_INPUT QString::fromAscii("INPUT") |
|
10 #define STR_OUTPUT_DIRECTORY QString::fromAscii("OUTPUT_DIRECTORY") |
|
11 #define STR_PROJECT_NUMBER QString::fromAscii("PROJECT_NUMBER") |
|
12 #define STR_RECURSIVE QString::fromAscii("RECURSIVE") |
|
13 #define STR_OPTIMIZE_OUTPUT_FOR_C QString::fromAscii("OPTIMIZE_OUTPUT_FOR_C") |
|
14 #define STR_OPTIMIZE_OUTPUT_JAVA QString::fromAscii("OPTIMIZE_OUTPUT_JAVA") |
|
15 #define STR_OPTIMIZE_FOR_FORTRAN QString::fromAscii("OPTIMIZE_FOR_FORTRAN") |
|
16 #define STR_OPTIMIZE_OUTPUT_VHDL QString::fromAscii("OPTIMIZE_OUTPUT_VHDL") |
|
17 #define STR_CPP_CLI_SUPPORT QString::fromAscii("CPP_CLI_SUPPORT") |
|
18 #define STR_HIDE_SCOPE_NAMES QString::fromAscii("HIDE_SCOPE_NAMES") |
|
19 #define STR_EXTRACT_ALL QString::fromAscii("EXTRACT_ALL") |
|
20 #define STR_SOURCE_BROWSER QString::fromAscii("SOURCE_BROWSER") |
|
21 #define STR_GENERATE_HTML QString::fromAscii("GENERATE_HTML") |
|
22 #define STR_GENERATE_LATEX QString::fromAscii("GENERATE_LATEX") |
|
23 #define STR_GENERATE_MAN QString::fromAscii("GENERATE_MAN") |
|
24 #define STR_GENERATE_RTF QString::fromAscii("GENERATE_RTF") |
|
25 #define STR_GENERATE_XML QString::fromAscii("GENERATE_XML") |
|
26 #define STR_GENERATE_HTMLHELP QString::fromAscii("GENERATE_HTMLHELP") |
|
27 #define STR_GENERATE_TREEVIEW QString::fromAscii("GENERATE_TREEVIEW") |
|
28 #define STR_USE_PDFLATEX QString::fromAscii("USE_PDFLATEX") |
|
29 #define STR_PDF_HYPERLINKS QString::fromAscii("PDF_HYPERLINKS") |
|
30 #define STR_SEARCHENGINE QString::fromAscii("SEARCHENGINE") |
|
31 #define STR_HAVE_DOT QString::fromAscii("HAVE_DOT") |
|
32 #define STR_CLASS_DIAGRAMS QString::fromAscii("CLASS_DIAGRAMS") |
|
33 #define STR_CLASS_GRAPH QString::fromAscii("CLASS_GRAPH") |
|
34 #define STR_COLLABORATION_GRAPH QString::fromAscii("COLLABORATION_GRAPH") |
|
35 #define STR_GRAPHICAL_HIERARCHY QString::fromAscii("GRAPHICAL_HIERARCHY") |
|
36 #define STR_INCLUDE_GRAPH QString::fromAscii("INCLUDE_GRAPH") |
|
37 #define STR_INCLUDED_BY_GRAPH QString::fromAscii("INCLUDED_BY_GRAPH") |
|
38 #define STR_CALL_GRAPH QString::fromAscii("CALL_GRAPH") |
|
39 #define STR_CALLER_GRAPH QString::fromAscii("CALLER_GRAPH") |
|
40 |
|
41 |
|
42 static bool g_optimizeMapping[6][6] = |
|
43 { |
|
44 // A: OPTIMIZE_OUTPUT_FOR_C |
|
45 // B: OPTIMIZE_OUTPUT_JAVA |
|
46 // C: OPTIMIZE_FOR_FORTRAN |
|
47 // D: OPTIMIZE_OUTPUT_VHDL |
|
48 // E: CPP_CLI_SUPPORT |
|
49 // F: HIDE_SCOPE_NAMES |
|
50 // A B C D E F |
|
51 { false,false,false,false,false,false }, // 0: C++ |
|
52 { false,false,false,false,true, false }, // 1: C++/CLI |
|
53 { false,true, false,false,false,false }, // 2: C#/Java |
|
54 { true, false,false,false,false,true }, // 3: C/PHP |
|
55 { false,false,true, false,false,false }, // 4: Fortran |
|
56 { false,false,false,true, false,false }, // 5: VHDL |
|
57 }; |
|
58 |
|
59 static QString g_optimizeOptionNames[6] = |
|
60 { |
|
61 STR_OPTIMIZE_OUTPUT_FOR_C, |
|
62 STR_OPTIMIZE_OUTPUT_JAVA, |
|
63 STR_OPTIMIZE_FOR_FORTRAN, |
|
64 STR_OPTIMIZE_OUTPUT_VHDL, |
|
65 STR_CPP_CLI_SUPPORT, |
|
66 STR_HIDE_SCOPE_NAMES |
|
67 }; |
|
68 |
|
69 //========================================================================== |
|
70 |
|
71 static bool stringVariantToBool(const QVariant &v) |
|
72 { |
|
73 QString s = v.toString().toLower(); |
|
74 return s==QString::fromAscii("yes") || s==QString::fromAscii("true") || s==QString::fromAscii("1"); |
|
75 } |
|
76 |
|
77 static bool getBoolOption( |
|
78 const QHash<QString,Input*>&model,const QString &name) |
|
79 { |
|
80 Input *option = model[name]; |
|
81 Q_ASSERT(option!=0); |
|
82 return stringVariantToBool(option->value()); |
|
83 } |
|
84 |
|
85 static QString getStringOption( |
|
86 const QHash<QString,Input*>&model,const QString &name) |
|
87 { |
|
88 Input *option = model[name]; |
|
89 Q_ASSERT(option!=0); |
|
90 return option->value().toString(); |
|
91 } |
|
92 |
|
93 static void updateBoolOption( |
|
94 const QHash<QString,Input*>&model,const QString &name,bool bNew) |
|
95 { |
|
96 Input *option = model[name]; |
|
97 Q_ASSERT(option!=0); |
|
98 bool bOld = stringVariantToBool(option->value()); |
|
99 if (bOld!=bNew) |
|
100 { |
|
101 option->value()=QString::fromAscii(bNew ? "true" : "false"); |
|
102 option->update(); |
|
103 } |
|
104 } |
|
105 |
|
106 static void updateStringOption( |
|
107 const QHash<QString,Input*>&model,const QString &name,const QString &s) |
|
108 { |
|
109 Input *option = model[name]; |
|
110 Q_ASSERT(option!=0); |
|
111 if (option->value().toString()!=s) |
|
112 { |
|
113 option->value() = s; |
|
114 option->update(); |
|
115 } |
|
116 } |
|
117 |
|
118 //========================================================================== |
|
119 |
|
120 Step1::Step1(Wizard *wizard,const QHash<QString,Input*> &modelData) : m_wizard(wizard), m_modelData(modelData) |
|
121 { |
|
122 QVBoxLayout *layout = new QVBoxLayout(this); |
|
123 layout->setMargin(4); |
|
124 layout->setSpacing(8); |
|
125 QLabel *l = new QLabel(this); |
|
126 l->setText(tr("Provide some information " |
|
127 "about the project you are documenting")); |
|
128 layout->addWidget(l); |
|
129 QWidget *w = new QWidget( this ); |
|
130 QHBoxLayout *bl = new QHBoxLayout(w); |
|
131 bl->setSpacing(10); |
|
132 |
|
133 QWidget *col1 = new QWidget; |
|
134 QVBoxLayout *col1Layout = new QVBoxLayout(col1); |
|
135 col1Layout->setSpacing(8); |
|
136 QLabel *projName = new QLabel(this); |
|
137 projName->setText(tr("Project name:")); |
|
138 projName->setAlignment(Qt::AlignRight|Qt::AlignVCenter); |
|
139 QLabel *projVersion = new QLabel(this); |
|
140 projVersion->setText(tr("Project version or id:")); |
|
141 projVersion->setAlignment(Qt::AlignRight|Qt::AlignVCenter); |
|
142 col1Layout->addWidget(projName); |
|
143 col1Layout->addWidget(projVersion); |
|
144 |
|
145 QWidget *col2 = new QWidget; |
|
146 QVBoxLayout *col2Layout = new QVBoxLayout(col2); |
|
147 col2Layout->setSpacing(8); |
|
148 m_projName = new QLineEdit; |
|
149 m_projNumber = new QLineEdit; |
|
150 col2Layout->addWidget(m_projName); |
|
151 col2Layout->addWidget(m_projNumber); |
|
152 |
|
153 bl->addWidget(col1); |
|
154 bl->addWidget(col2); |
|
155 w->setLayout(bl); |
|
156 |
|
157 layout->addWidget(w); |
|
158 |
|
159 //--------------------------------------------------- |
|
160 QFrame *f = new QFrame( this ); |
|
161 f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); |
|
162 layout->addWidget(f); |
|
163 |
|
164 l = new QLabel(this); |
|
165 l->setText(tr("Specify the directory to scan for source code")); |
|
166 layout->addWidget(l); |
|
167 QWidget *row = new QWidget; |
|
168 QHBoxLayout *rowLayout = new QHBoxLayout(row); |
|
169 rowLayout->setSpacing(10); |
|
170 l = new QLabel(this); |
|
171 l->setText(tr("Source code directory:")); |
|
172 rowLayout->addWidget(l); |
|
173 m_sourceDir = new QLineEdit; |
|
174 m_srcSelectDir = new QPushButton(this); |
|
175 m_srcSelectDir->setText(tr("Select...")); |
|
176 rowLayout->addWidget(m_sourceDir); |
|
177 rowLayout->addWidget(m_srcSelectDir); |
|
178 layout->addWidget(row); |
|
179 |
|
180 m_recursive = new QCheckBox(this); |
|
181 m_recursive->setText(tr("Scan recursively")); |
|
182 m_recursive->setChecked(TRUE); |
|
183 layout->addWidget(m_recursive); |
|
184 |
|
185 //--------------------------------------------------- |
|
186 f = new QFrame( this ); |
|
187 f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); |
|
188 layout->addWidget(f); |
|
189 |
|
190 l = new QLabel(this); |
|
191 l->setText(tr("Specify the directory where doxygen should " |
|
192 "put the generated documentation")); |
|
193 layout->addWidget(l); |
|
194 row = new QWidget; |
|
195 rowLayout = new QHBoxLayout(row); |
|
196 rowLayout->setSpacing(10); |
|
197 l = new QLabel(this); |
|
198 l->setText(tr("Destination directory:")); |
|
199 rowLayout->addWidget(l); |
|
200 m_destDir = new QLineEdit; |
|
201 m_dstSelectDir = new QPushButton(this); |
|
202 m_dstSelectDir->setText(tr("Select...")); |
|
203 rowLayout->addWidget(m_destDir); |
|
204 rowLayout->addWidget(m_dstSelectDir); |
|
205 layout->addWidget(row); |
|
206 layout->addStretch(1); |
|
207 setLayout(layout); |
|
208 |
|
209 connect(m_srcSelectDir,SIGNAL(clicked()), |
|
210 this,SLOT(selectSourceDir())); |
|
211 connect(m_dstSelectDir,SIGNAL(clicked()), |
|
212 this,SLOT(selectDestinationDir())); |
|
213 connect(m_projName,SIGNAL(textChanged(const QString &)),SLOT(setProjectName(const QString &))); |
|
214 connect(m_projNumber,SIGNAL(textChanged(const QString &)),SLOT(setProjectNumber(const QString &))); |
|
215 connect(m_sourceDir,SIGNAL(textChanged(const QString &)),SLOT(setSourceDir(const QString &))); |
|
216 connect(m_recursive,SIGNAL(stateChanged(int)),SLOT(setRecursiveScan(int))); |
|
217 connect(m_destDir,SIGNAL(textChanged(const QString &)),SLOT(setDestinationDir(const QString &))); |
|
218 } |
|
219 |
|
220 void Step1::selectSourceDir() |
|
221 { |
|
222 QString path = QFileInfo(MainWindow::instance().configFileName()).path(); |
|
223 QString dirName = QFileDialog::getExistingDirectory(this, |
|
224 tr("Select source directory"),path); |
|
225 QDir dir(path); |
|
226 if (!MainWindow::instance().configFileName().isEmpty() && dir.exists()) |
|
227 { |
|
228 dirName = dir.relativeFilePath(dirName); |
|
229 } |
|
230 if (dirName.isEmpty()) |
|
231 { |
|
232 dirName=QString::fromAscii("."); |
|
233 } |
|
234 m_sourceDir->setText(dirName); |
|
235 } |
|
236 |
|
237 void Step1::selectDestinationDir() |
|
238 { |
|
239 QString path = QFileInfo(MainWindow::instance().configFileName()).path(); |
|
240 QString dirName = QFileDialog::getExistingDirectory(this, |
|
241 tr("Select destination directory"),path); |
|
242 QDir dir(path); |
|
243 if (!MainWindow::instance().configFileName().isEmpty() && dir.exists()) |
|
244 { |
|
245 dirName = dir.relativeFilePath(dirName); |
|
246 } |
|
247 if (dirName.isEmpty()) |
|
248 { |
|
249 dirName=QString::fromAscii("."); |
|
250 } |
|
251 m_destDir->setText(dirName); |
|
252 } |
|
253 |
|
254 void Step1::setProjectName(const QString &name) |
|
255 { |
|
256 updateStringOption(m_modelData,STR_PROJECT_NAME,name); |
|
257 } |
|
258 |
|
259 void Step1::setProjectNumber(const QString &num) |
|
260 { |
|
261 updateStringOption(m_modelData,STR_PROJECT_NUMBER,num); |
|
262 } |
|
263 |
|
264 void Step1::setSourceDir(const QString &dir) |
|
265 { |
|
266 Input *option = m_modelData[STR_INPUT]; |
|
267 if (option->value().toStringList().count()>0) |
|
268 { |
|
269 QStringList sl = option->value().toStringList(); |
|
270 if (sl[0]!=dir) |
|
271 { |
|
272 sl[0] = dir; |
|
273 option->value() = sl; |
|
274 option->update(); |
|
275 } |
|
276 } |
|
277 else |
|
278 { |
|
279 option->value() = QStringList() << dir; |
|
280 option->update(); |
|
281 } |
|
282 } |
|
283 |
|
284 void Step1::setDestinationDir(const QString &dir) |
|
285 { |
|
286 updateStringOption(m_modelData,STR_OUTPUT_DIRECTORY,dir); |
|
287 } |
|
288 |
|
289 void Step1::setRecursiveScan(int s) |
|
290 { |
|
291 updateBoolOption(m_modelData,STR_RECURSIVE,s==Qt::Checked); |
|
292 } |
|
293 |
|
294 void Step1::init() |
|
295 { |
|
296 Input *option; |
|
297 m_projName->setText(getStringOption(m_modelData,STR_PROJECT_NAME)); |
|
298 m_projNumber->setText(getStringOption(m_modelData,STR_PROJECT_NUMBER)); |
|
299 option = m_modelData[STR_INPUT]; |
|
300 if (option->value().toStringList().count()>0) |
|
301 { |
|
302 m_sourceDir->setText(option->value().toStringList().first()); |
|
303 } |
|
304 m_recursive->setChecked( |
|
305 getBoolOption(m_modelData,STR_RECURSIVE) ? Qt::Checked : Qt::Unchecked); |
|
306 m_destDir->setText(getStringOption(m_modelData,STR_OUTPUT_DIRECTORY)); |
|
307 } |
|
308 |
|
309 |
|
310 //========================================================================== |
|
311 |
|
312 Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData) |
|
313 : m_wizard(wizard), m_modelData(modelData) |
|
314 { |
|
315 QRadioButton *r; |
|
316 QVBoxLayout *layout = new QVBoxLayout(this); |
|
317 |
|
318 //--------------------------------------------------- |
|
319 m_extractModeGroup = new QButtonGroup(this); |
|
320 m_extractMode = new QGroupBox(this); |
|
321 m_extractMode->setTitle(tr("Select the desired extraction mode:")); |
|
322 QGridLayout *gbox = new QGridLayout( m_extractMode ); |
|
323 r = new QRadioButton(tr("Documented entities only")); |
|
324 r->setChecked(true); |
|
325 m_extractModeGroup->addButton(r, 0); |
|
326 gbox->addWidget(r,1,0); |
|
327 // 1 -> EXTRACT_ALL = NO |
|
328 r = new QRadioButton(tr("All Entities")); |
|
329 m_extractModeGroup->addButton(r, 1); |
|
330 gbox->addWidget(r,2,0); |
|
331 // 2 -> EXTRACT_ALL = YES |
|
332 m_crossRef = new QCheckBox(m_extractMode); |
|
333 m_crossRef->setText(tr("Include cross-referenced source code in the output")); |
|
334 // m_crossRef -> SOURCE_BROWSER = YES/NO |
|
335 gbox->addWidget(m_crossRef,3,0); |
|
336 layout->addWidget(m_extractMode); |
|
337 |
|
338 //--------------------------------------------------- |
|
339 QFrame *f = new QFrame( this ); |
|
340 f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); |
|
341 layout->addWidget(f); |
|
342 |
|
343 m_optimizeLangGroup = new QButtonGroup(this); |
|
344 m_optimizeLang = new QGroupBox(this); |
|
345 m_optimizeLang->setTitle(tr("Select programming language to optimize the results for")); |
|
346 gbox = new QGridLayout( m_optimizeLang ); |
|
347 |
|
348 r = new QRadioButton(m_optimizeLang); |
|
349 r->setText(tr("Optimize for C++ output")); |
|
350 r->setChecked(true); |
|
351 m_optimizeLangGroup->addButton(r, 0); |
|
352 // 0 -> OPTIMIZE_OUTPUT_FOR_C = NO |
|
353 // OPTIMIZE_OUTPUT_JAVA = NO |
|
354 // OPTIMIZE_FOR_FORTRAN = NO |
|
355 // OPTIMIZE_OUTPUT_VHDL = NO |
|
356 // CPP_CLI_SUPPORT = NO |
|
357 // HIDE_SCOPE_NAMES = NO |
|
358 gbox->addWidget(r,0,0); |
|
359 r = new QRadioButton(tr("Optimize for C++/CLI output")); |
|
360 gbox->addWidget(r,1,0); |
|
361 m_optimizeLangGroup->addButton(r, 1); |
|
362 // 1 -> OPTIMIZE_OUTPUT_FOR_C = NO |
|
363 // OPTIMIZE_OUTPUT_JAVA = NO |
|
364 // OPTIMIZE_FOR_FORTRAN = NO |
|
365 // OPTIMIZE_OUTPUT_VHDL = NO |
|
366 // CPP_CLI_SUPPORT = YES |
|
367 // HIDE_SCOPE_NAMES = NO |
|
368 r = new QRadioButton(tr("Optimize for Java or C# output")); |
|
369 m_optimizeLangGroup->addButton(r, 2); |
|
370 // 2 -> OPTIMIZE_OUTPUT_FOR_C = NO |
|
371 // OPTIMIZE_OUTPUT_JAVA = YES |
|
372 // OPTIMIZE_FOR_FORTRAN = NO |
|
373 // OPTIMIZE_OUTPUT_VHDL = NO |
|
374 // CPP_CLI_SUPPORT = NO |
|
375 // HIDE_SCOPE_NAMES = NO |
|
376 gbox->addWidget(r,2,0); |
|
377 r = new QRadioButton(tr("Optimize for C or PHP output")); |
|
378 m_optimizeLangGroup->addButton(r, 3); |
|
379 // 3 -> OPTIMIZE_OUTPUT_FOR_C = YES |
|
380 // OPTIMIZE_OUTPUT_JAVA = NO |
|
381 // OPTIMIZE_FOR_FORTRAN = NO |
|
382 // OPTIMIZE_OUTPUT_VHDL = NO |
|
383 // CPP_CLI_SUPPORT = NO |
|
384 // HIDE_SCOPE_NAMES = YES |
|
385 gbox->addWidget(r,3,0); |
|
386 r = new QRadioButton(tr("Optimize for Fortran output")); |
|
387 m_optimizeLangGroup->addButton(r, 4); |
|
388 // 4 -> OPTIMIZE_OUTPUT_FOR_C = NO |
|
389 // OPTIMIZE_OUTPUT_JAVA = NO |
|
390 // OPTIMIZE_FOR_FORTRAN = YES |
|
391 // OPTIMIZE_OUTPUT_VHDL = NO |
|
392 // CPP_CLI_SUPPORT = NO |
|
393 // HIDE_SCOPE_NAMES = NO |
|
394 gbox->addWidget(r,4,0); |
|
395 r = new QRadioButton(tr("Optimize for VHDL output")); |
|
396 m_optimizeLangGroup->addButton(r, 5); |
|
397 // 5 -> OPTIMIZE_OUTPUT_FOR_C = NO |
|
398 // OPTIMIZE_OUTPUT_JAVA = NO |
|
399 // OPTIMIZE_FOR_FORTRAN = NO |
|
400 // OPTIMIZE_OUTPUT_VHDL = YES |
|
401 // CPP_CLI_SUPPORT = NO |
|
402 // HIDE_SCOPE_NAMES = NO |
|
403 gbox->addWidget(r,5,0); |
|
404 |
|
405 layout->addWidget(m_optimizeLang); |
|
406 layout->addStretch(1); |
|
407 |
|
408 connect(m_crossRef,SIGNAL(stateChanged(int)), |
|
409 SLOT(changeCrossRefState(int))); |
|
410 connect(m_optimizeLangGroup,SIGNAL(buttonClicked(int)), |
|
411 SLOT(optimizeFor(int))); |
|
412 connect(m_extractModeGroup,SIGNAL(buttonClicked(int)), |
|
413 SLOT(extractMode(int))); |
|
414 } |
|
415 |
|
416 |
|
417 void Step2::optimizeFor(int choice) |
|
418 { |
|
419 for (int i=0;i<6;i++) |
|
420 { |
|
421 updateBoolOption(m_modelData, |
|
422 g_optimizeOptionNames[i], |
|
423 g_optimizeMapping[choice][i]); |
|
424 } |
|
425 } |
|
426 |
|
427 void Step2::extractMode(int choice) |
|
428 { |
|
429 updateBoolOption(m_modelData,STR_EXTRACT_ALL,choice==1); |
|
430 } |
|
431 |
|
432 void Step2::changeCrossRefState(int choice) |
|
433 { |
|
434 updateBoolOption(m_modelData,STR_SOURCE_BROWSER,choice==Qt::Checked); |
|
435 } |
|
436 |
|
437 void Step2::init() |
|
438 { |
|
439 m_extractModeGroup->button( |
|
440 getBoolOption(m_modelData,STR_EXTRACT_ALL) ? 1 : 0)->setChecked(true); |
|
441 m_crossRef->setChecked(getBoolOption(m_modelData,STR_SOURCE_BROWSER)); |
|
442 |
|
443 int x=0; |
|
444 if (getBoolOption(m_modelData,STR_CPP_CLI_SUPPORT)) x=1; |
|
445 else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_JAVA)) x=2; |
|
446 else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_FOR_C)) x=3; |
|
447 else if (getBoolOption(m_modelData,STR_OPTIMIZE_FOR_FORTRAN)) x=4; |
|
448 else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_VHDL)) x=5; |
|
449 m_optimizeLangGroup->button(x)->setChecked(true); |
|
450 } |
|
451 |
|
452 //========================================================================== |
|
453 |
|
454 Step3::Step3(Wizard *wizard,const QHash<QString,Input*> &modelData) |
|
455 : m_wizard(wizard), m_modelData(modelData) |
|
456 { |
|
457 QVBoxLayout *vbox = 0; |
|
458 QRadioButton *r = 0; |
|
459 |
|
460 QGridLayout *gbox = new QGridLayout( this ); |
|
461 gbox->addWidget(new QLabel(tr("Select the output format(s) to generate")),0,0); |
|
462 { |
|
463 m_htmlOptions = new QGroupBox(tr("HTML")); |
|
464 m_htmlOptions->setCheckable(true); |
|
465 // GENERATE_HTML |
|
466 m_htmlOptionsGroup = new QButtonGroup(m_htmlOptions); |
|
467 QRadioButton *r = new QRadioButton(tr("plain HTML")); |
|
468 r->setChecked(true); |
|
469 m_htmlOptionsGroup->addButton(r, 0); |
|
470 vbox = new QVBoxLayout; |
|
471 vbox->addWidget(r); |
|
472 r = new QRadioButton(tr("with frames and a navigation tree")); |
|
473 m_htmlOptionsGroup->addButton(r, 1); |
|
474 // GENERATE_TREEVIEW |
|
475 vbox->addWidget(r); |
|
476 r = new QRadioButton(tr("prepare for compressed HTML (.chm)")); |
|
477 m_htmlOptionsGroup->addButton(r, 2); |
|
478 // GENERATE_HTMLHELP |
|
479 vbox->addWidget(r); |
|
480 m_searchEnabled=new QCheckBox(tr("With search function (requires PHP enabled web server)")); |
|
481 vbox->addWidget(m_searchEnabled); |
|
482 // SEARCH_ENGINE |
|
483 m_htmlOptions->setLayout(vbox); |
|
484 m_htmlOptions->setChecked(true); |
|
485 } |
|
486 gbox->addWidget(m_htmlOptions,1,0); |
|
487 |
|
488 { |
|
489 m_texOptions = new QGroupBox(tr("LaTeX")); |
|
490 m_texOptions->setCheckable(true); |
|
491 // GENERATE_LATEX |
|
492 m_texOptionsGroup = new QButtonGroup(m_texOptions); |
|
493 vbox = new QVBoxLayout; |
|
494 r = new QRadioButton(tr("as intermediate format for hyperlinked PDF")); |
|
495 m_texOptionsGroup->addButton(r, 0); |
|
496 // PDF_HYPERLINKS = YES |
|
497 r->setChecked(true); |
|
498 vbox->addWidget(r); |
|
499 r = new QRadioButton(tr("as intermediate format for PDF")); |
|
500 m_texOptionsGroup->addButton(r, 1); |
|
501 // PDF_HYPERLINKS = NO, USE_PDFLATEX = YES |
|
502 vbox->addWidget(r); |
|
503 r = new QRadioButton(tr("as intermediate format for PostScript")); |
|
504 m_texOptionsGroup->addButton(r, 2); |
|
505 // USE_PDFLATEX = NO |
|
506 vbox->addWidget(r); |
|
507 vbox->addStretch(1); |
|
508 m_texOptions->setLayout(vbox); |
|
509 m_texOptions->setChecked(true); |
|
510 } |
|
511 gbox->addWidget(m_texOptions,2,0); |
|
512 |
|
513 m_manEnabled=new QCheckBox(tr("Man pages")); |
|
514 // GENERATE_MAN |
|
515 m_rtfEnabled=new QCheckBox(tr("Rich Text Format (RTF)")); |
|
516 // GENERATE_RTF |
|
517 m_xmlEnabled=new QCheckBox(tr("XML")); |
|
518 // GENERATE_XML |
|
519 gbox->addWidget(m_manEnabled,3,0); |
|
520 gbox->addWidget(m_rtfEnabled,4,0); |
|
521 gbox->addWidget(m_xmlEnabled,5,0); |
|
522 |
|
523 gbox->setRowStretch(6,1); |
|
524 connect(m_htmlOptions,SIGNAL(toggled(bool)),SLOT(setHtmlEnabled(bool))); |
|
525 connect(m_texOptions,SIGNAL(toggled(bool)),SLOT(setLatexEnabled(bool))); |
|
526 connect(m_manEnabled,SIGNAL(stateChanged(int)),SLOT(setManEnabled(int))); |
|
527 connect(m_rtfEnabled,SIGNAL(stateChanged(int)),SLOT(setRtfEnabled(int))); |
|
528 connect(m_xmlEnabled,SIGNAL(stateChanged(int)),SLOT(setXmlEnabled(int))); |
|
529 connect(m_searchEnabled,SIGNAL(stateChanged(int)),SLOT(setSearchEnabled(int))); |
|
530 connect(m_htmlOptionsGroup,SIGNAL(buttonClicked(int)), |
|
531 SLOT(setHtmlOptions(int))); |
|
532 connect(m_texOptionsGroup,SIGNAL(buttonClicked(int)), |
|
533 SLOT(setLatexOptions(int))); |
|
534 } |
|
535 |
|
536 void Step3::setHtmlEnabled(bool b) |
|
537 { |
|
538 updateBoolOption(m_modelData,STR_GENERATE_HTML,b); |
|
539 } |
|
540 |
|
541 void Step3::setLatexEnabled(bool b) |
|
542 { |
|
543 updateBoolOption(m_modelData,STR_GENERATE_LATEX,b); |
|
544 } |
|
545 |
|
546 void Step3::setManEnabled(int state) |
|
547 { |
|
548 updateBoolOption(m_modelData,STR_GENERATE_MAN,state==Qt::Checked); |
|
549 } |
|
550 |
|
551 void Step3::setRtfEnabled(int state) |
|
552 { |
|
553 updateBoolOption(m_modelData,STR_GENERATE_RTF,state==Qt::Checked); |
|
554 } |
|
555 |
|
556 void Step3::setXmlEnabled(int state) |
|
557 { |
|
558 updateBoolOption(m_modelData,STR_GENERATE_XML,state==Qt::Checked); |
|
559 } |
|
560 |
|
561 void Step3::setSearchEnabled(int state) |
|
562 { |
|
563 updateBoolOption(m_modelData,STR_SEARCHENGINE,state==Qt::Checked); |
|
564 } |
|
565 |
|
566 void Step3::setHtmlOptions(int id) |
|
567 { |
|
568 if (id==0) // plain HTML |
|
569 { |
|
570 updateBoolOption(m_modelData,STR_GENERATE_HTMLHELP,false); |
|
571 updateBoolOption(m_modelData,STR_GENERATE_TREEVIEW,false); |
|
572 } |
|
573 else if (id==1) // with navigation tree |
|
574 { |
|
575 updateBoolOption(m_modelData,STR_GENERATE_HTMLHELP,false); |
|
576 updateBoolOption(m_modelData,STR_GENERATE_TREEVIEW,true); |
|
577 } |
|
578 else if (id==2) // with compiled help |
|
579 { |
|
580 updateBoolOption(m_modelData,STR_GENERATE_HTMLHELP,true); |
|
581 updateBoolOption(m_modelData,STR_GENERATE_TREEVIEW,false); |
|
582 } |
|
583 } |
|
584 |
|
585 void Step3::setLatexOptions(int id) |
|
586 { |
|
587 if (id==0) // hyperlinked PDF |
|
588 { |
|
589 updateBoolOption(m_modelData,STR_USE_PDFLATEX,true); |
|
590 updateBoolOption(m_modelData,STR_PDF_HYPERLINKS,true); |
|
591 } |
|
592 else if (id==1) // PDF |
|
593 { |
|
594 updateBoolOption(m_modelData,STR_USE_PDFLATEX,true); |
|
595 updateBoolOption(m_modelData,STR_PDF_HYPERLINKS,false); |
|
596 } |
|
597 else if (id==2) // PostScript |
|
598 { |
|
599 updateBoolOption(m_modelData,STR_USE_PDFLATEX,false); |
|
600 updateBoolOption(m_modelData,STR_PDF_HYPERLINKS,false); |
|
601 } |
|
602 } |
|
603 |
|
604 void Step3::init() |
|
605 { |
|
606 m_htmlOptions->setChecked(getBoolOption(m_modelData,STR_GENERATE_HTML)); |
|
607 m_texOptions->setChecked(getBoolOption(m_modelData,STR_GENERATE_LATEX)); |
|
608 m_manEnabled->setChecked(getBoolOption(m_modelData,STR_GENERATE_MAN)); |
|
609 m_rtfEnabled->setChecked(getBoolOption(m_modelData,STR_GENERATE_RTF)); |
|
610 m_xmlEnabled->setChecked(getBoolOption(m_modelData,STR_GENERATE_XML)); |
|
611 m_searchEnabled->setChecked(getBoolOption(m_modelData,STR_SEARCHENGINE)); |
|
612 if (getBoolOption(m_modelData,STR_GENERATE_HTMLHELP)) |
|
613 { |
|
614 m_htmlOptionsGroup->button(2)->setChecked(true); // compiled help |
|
615 } |
|
616 else if (getBoolOption(m_modelData,STR_GENERATE_TREEVIEW)) |
|
617 { |
|
618 m_htmlOptionsGroup->button(1)->setChecked(true); // navigation tree |
|
619 } |
|
620 else |
|
621 { |
|
622 m_htmlOptionsGroup->button(0)->setChecked(true); // plain HTML |
|
623 } |
|
624 if (!getBoolOption(m_modelData,STR_USE_PDFLATEX)) |
|
625 { |
|
626 m_texOptionsGroup->button(2)->setChecked(true); // PostScript |
|
627 } |
|
628 else if (!getBoolOption(m_modelData,STR_PDF_HYPERLINKS)) |
|
629 { |
|
630 m_texOptionsGroup->button(1)->setChecked(true); // Plain PDF |
|
631 } |
|
632 else |
|
633 { |
|
634 m_texOptionsGroup->button(0)->setChecked(true); // PDF with hyperlinks |
|
635 } |
|
636 } |
|
637 |
|
638 //========================================================================== |
|
639 |
|
640 Step4::Step4(Wizard *wizard,const QHash<QString,Input*> &modelData) |
|
641 : m_wizard(wizard), m_modelData(modelData) |
|
642 { |
|
643 m_diagramModeGroup = new QButtonGroup(this); |
|
644 QGridLayout *gbox = new QGridLayout( this ); |
|
645 gbox->addWidget(new QLabel(tr("Diagrams to generate")),0,0); |
|
646 |
|
647 QRadioButton *rb = new QRadioButton(tr("No diagrams")); |
|
648 m_diagramModeGroup->addButton(rb, 0); |
|
649 gbox->addWidget(rb,1,0); |
|
650 // CLASS_DIAGRAMS = NO, HAVE_DOT = NO |
|
651 rb->setChecked(true); |
|
652 rb = new QRadioButton(tr("Use built-in class diagram generator")); |
|
653 m_diagramModeGroup->addButton(rb, 1); |
|
654 // CLASS_DIAGRAMS = YES, HAVE_DOT = NO |
|
655 gbox->addWidget(rb,2,0); |
|
656 rb = new QRadioButton(tr("Use dot tool from the GraphViz package")); |
|
657 m_diagramModeGroup->addButton(rb, 2); |
|
658 gbox->addWidget(rb,3,0); |
|
659 // CLASS_DIAGRAMS = NO, HAVE_DOT = YES |
|
660 |
|
661 m_dotGroup = new QGroupBox(tr("Dot graphs to generate")); |
|
662 QVBoxLayout *vbox = new QVBoxLayout; |
|
663 m_dotClass=new QCheckBox(tr("Class diagrams")); |
|
664 // CLASS_GRAPH |
|
665 m_dotCollaboration=new QCheckBox(tr("Collaboration diagrams")); |
|
666 // COLLABORATION_GRAPH |
|
667 m_dotInheritance=new QCheckBox(tr("Overall Class hierarchy")); |
|
668 // GRAPHICAL_HIERARCHY |
|
669 m_dotInclude=new QCheckBox(tr("Include dependency graphs")); |
|
670 // INCLUDE_GRAPH |
|
671 m_dotIncludedBy=new QCheckBox(tr("Included by dependency graphs")); |
|
672 // INCLUDED_BY_GRAPH |
|
673 m_dotCall=new QCheckBox(tr("Call graphs")); |
|
674 // CALL_GRAPH |
|
675 m_dotCaller=new QCheckBox(tr("Called by graphs")); |
|
676 // CALLER_GRAPH |
|
677 vbox->addWidget(m_dotClass); |
|
678 vbox->addWidget(m_dotCollaboration); |
|
679 vbox->addWidget(m_dotInheritance); |
|
680 vbox->addWidget(m_dotInclude); |
|
681 vbox->addWidget(m_dotIncludedBy); |
|
682 vbox->addWidget(m_dotCall); |
|
683 vbox->addWidget(m_dotCaller); |
|
684 vbox->addStretch(1); |
|
685 m_dotGroup->setLayout(vbox); |
|
686 m_dotClass->setChecked(true); |
|
687 m_dotGroup->setEnabled(false); |
|
688 gbox->addWidget(m_dotGroup,4,0); |
|
689 |
|
690 m_dotInclude->setChecked(true); |
|
691 m_dotCollaboration->setChecked(true); |
|
692 gbox->setRowStretch(5,1); |
|
693 |
|
694 connect(m_diagramModeGroup,SIGNAL(buttonClicked(int)), |
|
695 this,SLOT(diagramModeChanged(int))); |
|
696 connect(m_dotClass,SIGNAL(stateChanged(int)), |
|
697 this,SLOT(setClassGraphEnabled(int))); |
|
698 connect(m_dotCollaboration,SIGNAL(stateChanged(int)), |
|
699 this,SLOT(setCollaborationGraphEnabled(int))); |
|
700 connect(m_dotInheritance,SIGNAL(stateChanged(int)), |
|
701 this,SLOT(setGraphicalHierarchyEnabled(int))); |
|
702 connect(m_dotInclude,SIGNAL(stateChanged(int)), |
|
703 this,SLOT(setIncludeGraphEnabled(int))); |
|
704 connect(m_dotIncludedBy,SIGNAL(stateChanged(int)), |
|
705 this,SLOT(setIncludedByGraphEnabled(int))); |
|
706 connect(m_dotCall,SIGNAL(stateChanged(int)), |
|
707 this,SLOT(setCallGraphEnabled(int))); |
|
708 connect(m_dotCaller,SIGNAL(stateChanged(int)), |
|
709 this,SLOT(setCallerGraphEnabled(int))); |
|
710 } |
|
711 |
|
712 void Step4::diagramModeChanged(int id) |
|
713 { |
|
714 if (id==0) // no diagrams |
|
715 { |
|
716 updateBoolOption(m_modelData,STR_HAVE_DOT,false); |
|
717 updateBoolOption(m_modelData,STR_CLASS_DIAGRAMS,false); |
|
718 } |
|
719 else if (id==1) // builtin diagrams |
|
720 { |
|
721 updateBoolOption(m_modelData,STR_HAVE_DOT,false); |
|
722 updateBoolOption(m_modelData,STR_CLASS_DIAGRAMS,true); |
|
723 } |
|
724 else if (id==2) // dot diagrams |
|
725 { |
|
726 updateBoolOption(m_modelData,STR_HAVE_DOT,true); |
|
727 updateBoolOption(m_modelData,STR_CLASS_DIAGRAMS,false); |
|
728 } |
|
729 m_dotGroup->setEnabled(id==2); |
|
730 } |
|
731 |
|
732 void Step4::setClassGraphEnabled(int state) |
|
733 { |
|
734 updateBoolOption(m_modelData,STR_CLASS_GRAPH,state==Qt::Checked); |
|
735 } |
|
736 |
|
737 void Step4::setCollaborationGraphEnabled(int state) |
|
738 { |
|
739 updateBoolOption(m_modelData,STR_COLLABORATION_GRAPH,state==Qt::Checked); |
|
740 } |
|
741 |
|
742 void Step4::setGraphicalHierarchyEnabled(int state) |
|
743 { |
|
744 updateBoolOption(m_modelData,STR_GRAPHICAL_HIERARCHY,state==Qt::Checked); |
|
745 } |
|
746 |
|
747 void Step4::setIncludeGraphEnabled(int state) |
|
748 { |
|
749 updateBoolOption(m_modelData,STR_INCLUDE_GRAPH,state==Qt::Checked); |
|
750 } |
|
751 |
|
752 void Step4::setIncludedByGraphEnabled(int state) |
|
753 { |
|
754 updateBoolOption(m_modelData,STR_INCLUDED_BY_GRAPH,state==Qt::Checked); |
|
755 } |
|
756 |
|
757 void Step4::setCallGraphEnabled(int state) |
|
758 { |
|
759 updateBoolOption(m_modelData,STR_CALL_GRAPH,state==Qt::Checked); |
|
760 } |
|
761 |
|
762 void Step4::setCallerGraphEnabled(int state) |
|
763 { |
|
764 updateBoolOption(m_modelData,STR_CALLER_GRAPH,state==Qt::Checked); |
|
765 } |
|
766 |
|
767 void Step4::init() |
|
768 { |
|
769 if (getBoolOption(m_modelData,STR_HAVE_DOT)) |
|
770 { |
|
771 m_diagramModeGroup->button(2)->setChecked(true); // Dot |
|
772 } |
|
773 else if (getBoolOption(m_modelData,STR_CLASS_DIAGRAMS)) |
|
774 { |
|
775 m_diagramModeGroup->button(1)->setChecked(true); // Builtin diagrams |
|
776 } |
|
777 else |
|
778 { |
|
779 m_diagramModeGroup->button(0)->setChecked(true); // no diagrams |
|
780 } |
|
781 m_dotClass->setChecked(getBoolOption(m_modelData,STR_CLASS_GRAPH)); |
|
782 m_dotCollaboration->setChecked(getBoolOption(m_modelData,STR_COLLABORATION_GRAPH)); |
|
783 m_dotInheritance->setChecked(getBoolOption(m_modelData,STR_GRAPHICAL_HIERARCHY)); |
|
784 m_dotInclude->setChecked(getBoolOption(m_modelData,STR_INCLUDE_GRAPH)); |
|
785 m_dotIncludedBy->setChecked(getBoolOption(m_modelData,STR_INCLUDED_BY_GRAPH)); |
|
786 m_dotCall->setChecked(getBoolOption(m_modelData,STR_CALL_GRAPH)); |
|
787 m_dotCaller->setChecked(getBoolOption(m_modelData,STR_CALLER_GRAPH)); |
|
788 } |
|
789 |
|
790 //========================================================================== |
|
791 |
|
792 Wizard::Wizard(const QHash<QString,Input*> &modelData, QWidget *parent) : |
|
793 QSplitter(parent), m_modelData(modelData) |
|
794 { |
|
795 m_treeWidget = new QTreeWidget; |
|
796 m_treeWidget->setColumnCount(1); |
|
797 m_treeWidget->setHeaderLabels(QStringList() << QString::fromAscii("Topics")); |
|
798 QList<QTreeWidgetItem*> items; |
|
799 items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(tr("Project")))); |
|
800 items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(tr("Mode")))); |
|
801 items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(tr("Output")))); |
|
802 items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(tr("Diagrams")))); |
|
803 m_treeWidget->insertTopLevelItems(0,items); |
|
804 |
|
805 m_topicStack = new QStackedWidget; |
|
806 m_step1 = new Step1(this,modelData); |
|
807 m_step2 = new Step2(this,modelData); |
|
808 m_step3 = new Step3(this,modelData); |
|
809 m_step4 = new Step4(this,modelData); |
|
810 m_topicStack->addWidget(m_step1); |
|
811 m_topicStack->addWidget(m_step2); |
|
812 m_topicStack->addWidget(m_step3); |
|
813 m_topicStack->addWidget(m_step4); |
|
814 |
|
815 QWidget *rightSide = new QWidget; |
|
816 QGridLayout *grid = new QGridLayout(rightSide); |
|
817 m_prev = new QPushButton(tr("Previous")); |
|
818 m_prev->setEnabled(false); |
|
819 m_next = new QPushButton(tr("Next")); |
|
820 grid->addWidget(m_topicStack,0,0,1,2); |
|
821 grid->addWidget(m_prev,1,0,Qt::AlignLeft); |
|
822 grid->addWidget(m_next,1,1,Qt::AlignRight); |
|
823 grid->setColumnStretch(0,1); |
|
824 grid->setRowStretch(0,1); |
|
825 addWidget(m_treeWidget); |
|
826 addWidget(rightSide); |
|
827 |
|
828 connect(m_treeWidget, |
|
829 SIGNAL(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)), |
|
830 SLOT(activateTopic(QTreeWidgetItem *,QTreeWidgetItem *))); |
|
831 connect(m_next,SIGNAL(clicked()),SLOT(nextTopic())); |
|
832 connect(m_prev,SIGNAL(clicked()),SLOT(prevTopic())); |
|
833 |
|
834 refresh(); |
|
835 } |
|
836 |
|
837 Wizard::~Wizard() |
|
838 { |
|
839 } |
|
840 |
|
841 void Wizard::activateTopic(QTreeWidgetItem *item,QTreeWidgetItem *) |
|
842 { |
|
843 if (item) |
|
844 { |
|
845 |
|
846 QString label = item->text(0); |
|
847 if (label==tr("Project")) |
|
848 { |
|
849 m_topicStack->setCurrentWidget(m_step1); |
|
850 m_prev->setEnabled(false); |
|
851 m_next->setEnabled(true); |
|
852 } |
|
853 else if (label==tr("Mode")) |
|
854 { |
|
855 m_topicStack->setCurrentWidget(m_step2); |
|
856 m_prev->setEnabled(true); |
|
857 m_next->setEnabled(true); |
|
858 } |
|
859 else if (label==tr("Output")) |
|
860 { |
|
861 m_topicStack->setCurrentWidget(m_step3); |
|
862 m_prev->setEnabled(true); |
|
863 m_next->setEnabled(true); |
|
864 } |
|
865 else if (label==tr("Diagrams")) |
|
866 { |
|
867 m_topicStack->setCurrentWidget(m_step4); |
|
868 m_prev->setEnabled(true); |
|
869 m_next->setEnabled(false); |
|
870 } |
|
871 } |
|
872 } |
|
873 |
|
874 void Wizard::nextTopic() |
|
875 { |
|
876 m_topicStack->setCurrentIndex(m_topicStack->currentIndex()+1); |
|
877 m_next->setEnabled(m_topicStack->count()!=m_topicStack->currentIndex()+1); |
|
878 m_prev->setEnabled(m_topicStack->currentIndex()!=0); |
|
879 m_treeWidget->setCurrentItem(m_treeWidget->invisibleRootItem()->child(m_topicStack->currentIndex())); |
|
880 } |
|
881 |
|
882 void Wizard::prevTopic() |
|
883 { |
|
884 m_topicStack->setCurrentIndex(m_topicStack->currentIndex()-1); |
|
885 m_next->setEnabled(m_topicStack->count()!=m_topicStack->currentIndex()+1); |
|
886 m_prev->setEnabled(m_topicStack->currentIndex()!=0); |
|
887 m_treeWidget->setCurrentItem(m_treeWidget->invisibleRootItem()->child(m_topicStack->currentIndex())); |
|
888 } |
|
889 |
|
890 void Wizard::refresh() |
|
891 { |
|
892 m_step1->init(); |
|
893 m_step2->init(); |
|
894 m_step3->init(); |
|
895 m_step4->init(); |
|
896 } |