10 #include <QHBoxLayout> 11 #include <QPushButton> 14 #include <QMouseEvent> 18 #include <QFileDialog> 19 #include <QButtonGroup> 21 #include <QRadioButton> 22 #include <QTreeWidget> 23 #include <QStackedWidget> 24 #include <qdrawutil.h> 27 #define STR_PROJECT_NAME QString::fromLatin1("PROJECT_NAME") 28 #define STR_PROJECT_LOGO QString::fromLatin1("PROJECT_LOGO") 29 #define STR_PROJECT_BRIEF QString::fromLatin1("PROJECT_BRIEF") 30 #define STR_INPUT QString::fromLatin1("INPUT") 31 #define STR_OUTPUT_DIRECTORY QString::fromLatin1("OUTPUT_DIRECTORY") 32 #define STR_PROJECT_NUMBER QString::fromLatin1("PROJECT_NUMBER") 33 #define STR_RECURSIVE QString::fromLatin1("RECURSIVE") 34 #define STR_OPTIMIZE_OUTPUT_FOR_C QString::fromLatin1("OPTIMIZE_OUTPUT_FOR_C") 35 #define STR_OPTIMIZE_OUTPUT_JAVA QString::fromLatin1("OPTIMIZE_OUTPUT_JAVA") 36 #define STR_OPTIMIZE_FOR_FORTRAN QString::fromLatin1("OPTIMIZE_FOR_FORTRAN") 37 #define STR_OPTIMIZE_OUTPUT_VHDL QString::fromLatin1("OPTIMIZE_OUTPUT_VHDL") 38 #define STR_CPP_CLI_SUPPORT QString::fromLatin1("CPP_CLI_SUPPORT") 39 #define STR_HIDE_SCOPE_NAMES QString::fromLatin1("HIDE_SCOPE_NAMES") 40 #define STR_EXTRACT_ALL QString::fromLatin1("EXTRACT_ALL") 41 #define STR_SOURCE_BROWSER QString::fromLatin1("SOURCE_BROWSER") 42 #define STR_GENERATE_HTML QString::fromLatin1("GENERATE_HTML") 43 #define STR_GENERATE_LATEX QString::fromLatin1("GENERATE_LATEX") 44 #define STR_GENERATE_MAN QString::fromLatin1("GENERATE_MAN") 45 #define STR_GENERATE_RTF QString::fromLatin1("GENERATE_RTF") 46 #define STR_GENERATE_XML QString::fromLatin1("GENERATE_XML") 47 #define STR_GENERATE_HTMLHELP QString::fromLatin1("GENERATE_HTMLHELP") 48 #define STR_GENERATE_TREEVIEW QString::fromLatin1("GENERATE_TREEVIEW") 49 #define STR_USE_PDFLATEX QString::fromLatin1("USE_PDFLATEX") 50 #define STR_PDF_HYPERLINKS QString::fromLatin1("PDF_HYPERLINKS") 51 #define STR_SEARCHENGINE QString::fromLatin1("SEARCHENGINE") 52 #define STR_HAVE_DOT QString::fromLatin1("HAVE_DOT") 53 #define STR_CLASS_DIAGRAMS QString::fromLatin1("CLASS_DIAGRAMS") 54 #define STR_CLASS_GRAPH QString::fromLatin1("CLASS_GRAPH") 55 #define STR_COLLABORATION_GRAPH QString::fromLatin1("COLLABORATION_GRAPH") 56 #define STR_GRAPHICAL_HIERARCHY QString::fromLatin1("GRAPHICAL_HIERARCHY") 57 #define STR_INCLUDE_GRAPH QString::fromLatin1("INCLUDE_GRAPH") 58 #define STR_INCLUDED_BY_GRAPH QString::fromLatin1("INCLUDED_BY_GRAPH") 59 #define STR_CALL_GRAPH QString::fromLatin1("CALL_GRAPH") 60 #define STR_CALLER_GRAPH QString::fromLatin1("CALLER_GRAPH") 61 #define STR_HTML_COLORSTYLE_HUE QString::fromLatin1("HTML_COLORSTYLE_HUE") 62 #define STR_HTML_COLORSTYLE_SAT QString::fromLatin1("HTML_COLORSTYLE_SAT") 63 #define STR_HTML_COLORSTYLE_GAMMA QString::fromLatin1("HTML_COLORSTYLE_GAMMA") 74 {
false,
false,
false,
false,
false,
false },
75 {
false,
false,
false,
false,
true,
false },
76 {
false,
true,
false,
false,
false,
false },
77 {
true,
false,
false,
false,
false,
true },
78 {
false,
false,
true,
false,
false,
false },
79 {
false,
false,
false,
true,
false,
false },
113 return option->
value().toInt();
121 return option->
value().toString();
142 int iOld = option->
value().toInt();
156 if (option->
value().toString()!=
s)
167 setWindowTitle(tr(
"Tune the color of the HTML output"));
168 QGridLayout *layout =
new QGridLayout(
this);
172 layout->addWidget(
new QLabel(tr(
"Example output: use the sliders on the right to adjust the color")),0,0);
174 QHBoxLayout *buttonsLayout =
new QHBoxLayout;
176 QPushButton *okButton =
new QPushButton(tr(
"Ok"));
177 connect(okButton,SIGNAL(clicked()),SLOT(accept()));
178 okButton->setDefault(
true);
179 QPushButton *cancelButton =
new QPushButton(tr(
"Cancel"));
180 connect(cancelButton,SIGNAL(clicked()),SLOT(reject()));
183 huePicker->
setCol(hue,sat,gamma);
184 huePicker->setFixedWidth(20);
185 layout->addWidget(huePicker,1,1);
187 satPicker->
setCol(hue,sat,gamma);
188 satPicker->setFixedWidth(20);
189 layout->addWidget(satPicker,1,2);
191 gamPicker->
setCol(hue,sat,gamma);
192 gamPicker->setFixedWidth(20);
193 layout->addWidget(gamPicker,1,3);
195 connect(huePicker,SIGNAL(newHsv(
int,
int,
int)),satPicker,SLOT(setCol(
int,
int,
int)));
196 connect(satPicker,SIGNAL(newHsv(
int,
int,
int)),huePicker,SLOT(setCol(
int,
int,
int)));
197 connect(huePicker,SIGNAL(newHsv(
int,
int,
int)),gamPicker,SLOT(setCol(
int,
int,
int)));
198 connect(satPicker,SIGNAL(newHsv(
int,
int,
int)),gamPicker,SLOT(setCol(
int,
int,
int)));
199 connect(gamPicker,SIGNAL(newHsv(
int,
int,
int)),satPicker,SLOT(setCol(
int,
int,
int)));
200 connect(gamPicker,SIGNAL(newHsv(
int,
int,
int)),huePicker,SLOT(setCol(
int,
int,
int)));
205 buttonsLayout->addStretch();
206 buttonsLayout->addWidget(okButton);
207 buttonsLayout->addWidget(cancelButton);
208 layout->addLayout(buttonsLayout,5,0,1,4);
212 double *pRed,
double *pGreen,
double *pBlue)
220 v = (l <= 0.5) ? (l * (1.0 +
s)) : (l + s - l *
s);
226 double fract, vsf, mid1, mid2;
233 vsf = v * sv * fract;
279 QImage coloredImg(
m_image->width(),
m_image->height(),QImage::Format_RGB32);
281 uint *dstPixel = (
uint *)coloredImg.scanLine(0);
282 uint nrPixels = coloredImg.width()*coloredImg.height();
283 for (
uint i=0;i<nrPixels;i++,srcPixel++,dstPixel++)
285 QColor
c = QColor::fromRgb(*srcPixel);
287 hsl2rgb(hue/359.0, sat/255.0,
pow(c.green()/255.0,gam/100.0),&
r,&
g,&
b);
288 *dstPixel = qRgb((
int)(r*255.0),(
int)(g*255.0),(
int)(b*255.0));
290 m_imageLab->setPixmap(QPixmap::fromImage(coloredImg));
331 QRect
r(0, foff, w, height() - 2*foff);
332 int wi = r.width() - 2;
333 int hi = r.height() - 2;
334 if (!m_pix || m_pix->height() != hi || m_pix->width() != wi)
337 QImage
img(wi, hi, QImage::Format_RGB32);
339 uint *pixel = (
uint *) img.scanLine(0);
340 for (y = 0; y < hi; y++)
343 int yh = y2hue(y+coff);
344 int ys = y2sat(y+coff);
345 int yg = y2gam(y+coff);
349 c.setHsv(yh, ys, (
int)(255*
pow(0.7,yg/100.0)));
354 m_pix =
new QPixmap(QPixmap::fromImage(img));
357 p.drawPixmap(1, coff, *m_pix);
359 qDrawShadePanel(&p, r, g,
true);
360 p.setPen(g.foreground().color());
361 p.setBrush(g.foreground());
363 int y = m_mode==Hue ? hue2y(
m_hue) :
364 m_mode==Saturation ? sat2y(
m_sat) :
366 a.setPoints(3, w, y, w+5, y+5, w+5, y-5);
367 p.eraseRect(w, 0, 5, height());
373 if (m_mode==Hue) setHue(y2hue(m->y()));
374 else if (m_mode==Saturation) setSat(y2sat(m->y()));
375 else setGam(y2gam(m->y()));
380 if (m_mode==Hue) setHue(y2hue(m->y()));
381 else if (m_mode==Saturation) setSat(y2sat(m->y()));
382 else setGam(y2gam(m->y()));
387 if (h==
m_hue)
return;
388 m_hue = qMax(0,qMin(h,359));
389 delete m_pix; m_pix=0;
396 if (s==
m_sat)
return;
397 m_sat = qMax(0,qMin(s,255));
398 delete m_pix; m_pix=0;
405 if (g==
m_gam)
return;
406 m_gam = qMax(40,qMin(g,240));
407 delete m_pix; m_pix=0;
419 delete m_pix; m_pix=0;
426 int d = height() - 2*coff - 1;
427 return m_mode==Hue ? (y - coff)*359/d :
m_hue;
432 int d = height() - 2*coff - 1;
433 return coff + v*d/359;
438 int d = height() - 2*coff - 1;
439 return m_mode==Saturation ? 255 - (y - coff)*255/d :
m_sat;
444 int d = height() - 2*coff - 1;
445 return coff + (255-v)*d/255;
450 int d = height() - 2*coff - 1;
451 return m_mode==Gamma ? 240 - (y - coff)*200/d :
m_gam;
456 int d = height() - 2*coff - 1;
457 return coff + (240-
g)*d/200;
462 Step1::Step1(
Wizard *wizard,
const QHash<QString,Input*> &modelData) : m_wizard(wizard), m_modelData(modelData)
464 QVBoxLayout *layout =
new QVBoxLayout(
this);
465 layout->setMargin(4);
466 layout->setSpacing(8);
467 QLabel *
l =
new QLabel(
this);
468 l->setText(tr(
"Provide some information " 469 "about the project you are documenting"));
470 layout->addWidget(l);
471 QWidget *
w =
new QWidget(
this );
472 QGridLayout *grid =
new QGridLayout(w);
473 grid->setSpacing(10);
476 QLabel *projName =
new QLabel(
this);
477 projName->setText(tr(
"Project name:"));
480 QLabel *projBrief =
new QLabel(
this);
481 projBrief->setText(tr(
"Project synopsis:"));
484 QLabel *projVersion =
new QLabel(
this);
485 projVersion->setText(tr(
"Project version or id:"));
488 QLabel *projLogo =
new QLabel(
this);
489 projLogo->setMinimumSize(1,55);
490 projLogo->setText(tr(
"Project logo:"));
493 grid->addWidget(projName,0,0);
494 grid->addWidget(projBrief,1,0);
495 grid->addWidget(projVersion,2,0);
496 grid->addWidget(projLogo,3,0);
501 QPushButton *projIconSel =
new QPushButton(
this);
502 projIconSel->setText(tr(
"Select..."));
508 grid->addWidget(projIconSel,3,1);
511 grid->setColumnStretch(2,1);
515 layout->addWidget(w);
518 QFrame *
f =
new QFrame(
this );
519 f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
520 layout->addWidget(f);
522 l =
new QLabel(
this);
523 l->setText(tr(
"Specify the directory to scan for source code"));
524 layout->addWidget(l);
525 QWidget *
row =
new QWidget;
526 QHBoxLayout *rowLayout =
new QHBoxLayout(row);
527 rowLayout->setSpacing(10);
528 l =
new QLabel(
this);
529 l->setText(tr(
"Source code directory:"));
530 rowLayout->addWidget(l);
536 layout->addWidget(row);
544 f =
new QFrame(
this );
545 f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
546 layout->addWidget(f);
548 l =
new QLabel(
this);
549 l->setText(tr(
"Specify the directory where doxygen should " 550 "put the generated documentation"));
551 layout->addWidget(l);
553 rowLayout =
new QHBoxLayout(row);
554 rowLayout->setSpacing(10);
555 l =
new QLabel(
this);
556 l->setText(tr(
"Destination directory:"));
557 rowLayout->addWidget(l);
563 layout->addWidget(row);
564 layout->addStretch(1);
567 connect(projIconSel,SIGNAL(clicked()),
584 QString iconName = QFileDialog::getOpenFileName(
this,
585 tr(
"Select project icon/image"),path);
592 QFile Fout(iconName);
599 QPixmap
pm(iconName);
602 m_projIconLab->setPixmap(pm.scaledToHeight(55,Qt::SmoothTransformation));
616 QString dirName = QFileDialog::getExistingDirectory(
this,
617 tr(
"Select source directory"),path);
621 dirName = dir.relativeFilePath(dirName);
633 QString dirName = QFileDialog::getExistingDirectory(
this,
634 tr(
"Select destination directory"),path);
638 dirName = dir.relativeFilePath(dirName);
665 if (option->
value().toStringList().count()>0)
671 option->
value() = sl;
701 QFile Fout(iconName);
708 QPixmap
pm(iconName);
711 m_projIconLab->setPixmap(pm.scaledToHeight(55,Qt::SmoothTransformation));
724 if (option->
value().toStringList().count()>0)
740 QVBoxLayout *layout =
new QVBoxLayout(
this);
745 m_extractMode->setTitle(tr(
"Select the desired extraction mode:"));
747 r =
new QRadioButton(tr(
"Documented entities only"));
750 gbox->addWidget(r,1,0);
752 r =
new QRadioButton(tr(
"All Entities"));
754 gbox->addWidget(r,2,0);
757 m_crossRef->setText(tr(
"Include cross-referenced source code in the output"));
763 QFrame *
f =
new QFrame(
this );
764 f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
765 layout->addWidget(f);
769 m_optimizeLang->setTitle(tr(
"Select programming language to optimize the results for"));
773 r->setText(tr(
"Optimize for C++ output"));
782 gbox->addWidget(r,0,0);
783 r =
new QRadioButton(tr(
"Optimize for C++/CLI output"));
784 gbox->addWidget(r,1,0);
792 r =
new QRadioButton(tr(
"Optimize for Java or C# output"));
800 gbox->addWidget(r,2,0);
801 r =
new QRadioButton(tr(
"Optimize for C or PHP output"));
809 gbox->addWidget(r,3,0);
810 r =
new QRadioButton(tr(
"Optimize for Fortran output"));
818 gbox->addWidget(r,4,0);
819 r =
new QRadioButton(tr(
"Optimize for VHDL output"));
827 gbox->addWidget(r,5,0);
830 layout->addStretch(1);
843 for (
int i=0;i<6;i++)
846 g_optimizeOptionNames[i],
881 QVBoxLayout *vbox = 0;
884 QGridLayout *gbox =
new QGridLayout(
this );
885 gbox->addWidget(
new QLabel(tr(
"Select the output format(s) to generate")),0,0);
891 QRadioButton *r =
new QRadioButton(tr(
"plain HTML"));
894 vbox =
new QVBoxLayout;
896 r =
new QRadioButton(tr(
"with navigation panel"));
900 r =
new QRadioButton(tr(
"prepare for compressed HTML (.chm)"));
907 QHBoxLayout *hbox =
new QHBoxLayout;
908 m_tuneColor=
new QPushButton(tr(
"Change color..."));
911 vbox->addLayout(hbox);
922 vbox =
new QVBoxLayout;
923 r =
new QRadioButton(tr(
"as intermediate format for hyperlinked PDF"));
928 r =
new QRadioButton(tr(
"as intermediate format for PDF"));
932 r =
new QRadioButton(tr(
"as intermediate format for PostScript"));
944 m_rtfEnabled=
new QCheckBox(tr(
"Rich Text Format (RTF)"));
952 gbox->setRowStretch(6,1);
972 if (tuneColor.exec()==QDialog::Accepted)
1088 QGridLayout *gbox =
new QGridLayout(
this );
1089 gbox->addWidget(
new QLabel(tr(
"Diagrams to generate")),0,0);
1091 QRadioButton *rb =
new QRadioButton(tr(
"No diagrams"));
1093 gbox->addWidget(rb,1,0);
1095 rb->setChecked(
true);
1096 rb =
new QRadioButton(tr(
"Use built-in class diagram generator"));
1099 gbox->addWidget(rb,2,0);
1100 rb =
new QRadioButton(tr(
"Use dot tool from the GraphViz package"));
1102 gbox->addWidget(rb,3,0);
1105 m_dotGroup =
new QGroupBox(tr(
"Dot graphs to generate"));
1106 QVBoxLayout *vbox =
new QVBoxLayout;
1107 m_dotClass=
new QCheckBox(tr(
"Class diagrams"));
1113 m_dotInclude=
new QCheckBox(tr(
"Include dependency graphs"));
1117 m_dotCall=
new QCheckBox(tr(
"Call graphs"));
1119 m_dotCaller=
new QCheckBox(tr(
"Called by graphs"));
1128 vbox->addStretch(1);
1136 gbox->setRowStretch(5,1);
1259 QWidget *rightSide =
new QWidget;
1260 QGridLayout *grid =
new QGridLayout(rightSide);
1261 m_prev =
new QPushButton(tr(
"Previous"));
1262 m_prev->setEnabled(
false);
1263 m_next =
new QPushButton(tr(
"Next"));
1267 grid->setColumnStretch(0,1);
1268 grid->setRowStretch(0,1);
1270 addWidget(rightSide);
1273 SIGNAL(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)),
1291 if (label==tr(
"Project"))
1294 m_prev->setEnabled(
false);
1295 m_next->setEnabled(
true);
1297 else if (label==tr(
"Mode"))
1300 m_prev->setEnabled(
true);
1301 m_next->setEnabled(
true);
1303 else if (label==tr(
"Output"))
1306 m_prev->setEnabled(
true);
1307 m_next->setEnabled(
true);
1309 else if (label==tr(
"Diagrams"))
1312 m_prev->setEnabled(
true);
1313 m_next->setEnabled(
true);
const QHash< QString, Input * > & m_modelData
Traverses directory structures and contents in a platform-independent way.
#define STR_INCLUDE_GRAPH
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
QGroupBox * m_optimizeLang
Step4(Wizard *parent, const QHash< QString, Input * > &modelData)
void changeCrossRefState(int choice)
#define STR_HTML_COLORSTYLE_HUE
void activateTopic(QTreeWidgetItem *item, QTreeWidgetItem *)
static constexpr double g
static void updateBoolOption(const QHash< QString, Input * > &model, const QString &name, bool bNew)
#define STR_PROJECT_BRIEF
void setIncludedByGraphEnabled(int state)
QGroupBox * m_htmlOptions
QPushButton * m_tuneColor
void setDestinationDir(const QString &dir)
void setCallerGraphEnabled(int state)
void updateImage(int hue, int sat, int val)
void append(const type *d)
QGroupBox * m_extractMode
void setProjectName(const QString &name)
#define STR_OPTIMIZE_OUTPUT_JAVA
#define STR_OPTIMIZE_FOR_FORTRAN
void setHtmlEnabled(bool)
#define STR_GENERATE_LATEX
void diagramModeChanged(int)
Step2(Wizard *parent, const QHash< QString, Input * > &modelData)
void setSearchEnabled(int)
#define STR_COLLABORATION_GRAPH
void setProjectBrief(const QString &desc)
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
const QHash< QString, Input * > & m_modelData
QCheckBox * m_dotInheritance
QButtonGroup * m_diagramModeGroup
QButtonGroup * m_texOptionsGroup
const QHash< QString, Input * > & m_modelData
static QString fromLatin1(const char *, int len=-1)
void mousePressEvent(QMouseEvent *)
#define STR_CPP_CLI_SUPPORT
def connect(nxgraph, k1, k2, p1=0, p2=0, kwds)
QPushButton * m_dstSelectDir
#define STR_OUTPUT_DIRECTORY
int getSaturation() const
QButtonGroup * m_extractModeGroup
QCheckBox * m_searchEnabled
void optimizeFor(int choice)
QString arg(long a, int fieldwidth=0, int base=10) const
const QHash< QString, Input * > & m_modelData
static void updateIntOption(const QHash< QString, Input * > &model, const QString &name, int iNew)
void setIncludeGraphEnabled(int state)
#define STR_CLASS_DIAGRAMS
QButtonGroup * m_htmlOptionsGroup
QPushButton * m_srcSelectDir
#define STR_PROJECT_NUMBER
#define STR_INCLUDED_BY_GRAPH
#define STR_HTML_COLORSTYLE_SAT
void setCol(int h, int s, int g)
void setClassGraphEnabled(int state)
void mouseMoveEvent(QMouseEvent *)
Step1(Wizard *parent, const QHash< QString, Input * > &modelData)
#define STR_HTML_COLORSTYLE_GAMMA
void setProjectNumber(const QString &num)
void setRecursiveScan(int)
void setLatexOptions(int)
double gamma(double KE, const simb::MCParticle *part)
QTreeWidget * m_treeWidget
static void updateStringOption(const QHash< QString, Input * > &model, const QString &name, const QString &s)
static QString getStringOption(const QHash< QString, Input * > &model, const QString &name)
The QFile class is an I/O device that operates on files.
TuneColorDialog(int hue, int sat, int gamma, QWidget *parent=0)
static int getIntOption(const QHash< QString, Input * > &model, const QString &name)
void setLatexEnabled(bool)
void selectDestinationDir()
#define STR_OPTIMIZE_OUTPUT_FOR_C
static bool g_optimizeMapping[6][6]
Wizard(const QHash< QString, Input * > &modelData, QWidget *parent=0)
void setSourceDir(const QString &dir)
QCheckBox * m_dotCollaboration
#define STR_GENERATE_HTML
#define STR_OPTIMIZE_OUTPUT_VHDL
static QString g_optimizeOptionNames[6]
#define STR_GENERATE_HTMLHELP
#define STR_GENERATE_TREEVIEW
void setCollaborationGraphEnabled(int state)
void paintEvent(QPaintEvent *)
#define STR_SOURCE_BROWSER
The QFileInfo class provides system-independent file information.
static bool getBoolOption(const QHash< QString, Input * > &model, const QString &name)
static constexpr double ys
static MainWindow & instance()
#define STR_PDF_HYPERLINKS
Step3(Wizard *parent, const QHash< QString, Input * > &modelData)
QStackedWidget * m_topicStack
void extractMode(int choice)
virtual bool exists() const
def parent(G, child, parent_type)
QCheckBox * m_dotIncludedBy
void setGraphicalHierarchyEnabled(int state)
#define STR_GRAPHICAL_HIERARCHY
QButtonGroup * m_optimizeLangGroup
static bool stringVariantToBool(const QVariant &v)
#define STR_HIDE_SCOPE_NAMES
void hsl2rgb(double h, double s, double l, double *pRed, double *pGreen, double *pBlue)
void setCallGraphEnabled(int state)