Debian Codegraph @

addon/doxywizard/wizard.h

raw
1 /******************************************************************************
2 *
3 * Copyright (C) 1997-2025 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 */
12
13 #ifndef WIZARD_H
14 #define WIZARD_H
15
16 #include <QSplitter>
17 #include <QHash>
18 #include <QDialog>
19 #include <QImage>
20
21 class Input;
22 class QTreeWidget;
23 class QTreeWidgetItem;
24 class QStackedWidget;
25 class QCheckBox;
26 class QLineEdit;
27 class QPushButton;
28 class QRadioButton;
29 class QGroupBox;
30 class QButtonGroup;
31 class QTabWidget;
32 class Wizard;
33 class QLabel;
34
35 class TuneColorDialog : public QDialog
36 {
37 Q_OBJECT
38
39 public:
40 TuneColorDialog(int hue,int sat,int gamma,QWidget *parent=nullptr);
41 int getHue() const;
42 int getSaturation() const;
43 int getGamma() const;
44
45 private slots:
46 void updateImage(int hue,int sat,int val);
47 void tabChanged(int);
48
49 private:
50 QImage m_imageLight;
51 QImage m_imageDark;
52 QLabel *m_imageLabLight = nullptr;
53 QLabel *m_imageLabDark = nullptr;
54 QTabWidget *m_tab = nullptr;
55 int m_hue = 0;
56 int m_sat = 0;
57 int m_gam = 0;
58 };
59
60 class ColorPicker : public QWidget
61 {
62 Q_OBJECT
63 public:
64 enum Mode { Hue, Saturation, Gamma };
65 ColorPicker(Mode m);
66 ~ColorPicker();
67
68 public slots:
69 void setCol(int h, int s, int g);
70 //void setCol(int h, int s);
71
72 signals:
73 void newHsv(int h, int s, int g);
74
75 protected:
76 void paintEvent(QPaintEvent*);
77 void mouseMoveEvent(QMouseEvent *);
78 void mousePressEvent(QMouseEvent *);
79
80 private:
81 enum { foff = 3, coff = 4 }; //frame and contents offset
82 int y2hue(int y);
83 int y2sat(int y);
84 int y2gam(int y);
85 int hue2y(int hue);
86 int sat2y(int sat);
87 int gam2y(int gamma);
88 void setHue(int v);
89 void setSat(int v);
90 void setGam(int v);
91
92 QPixmap *m_pix = nullptr;
93 Mode m_mode = Hue;
94 int m_gam = 0;
95 int m_hue = 0;
96 int m_sat = 0;
97
98 };
99
100
101 class Step1 : public QWidget
102 {
103 Q_OBJECT
104
105 public:
106 Step1(Wizard *parent,const QHash<QString,Input*> &modelData);
107 void init();
108
109 private slots:
110 void selectSourceDir();
111 void selectDestinationDir();
112 void selectProjectIcon();
113 void setProjectName(const QString &name);
114 void setProjectBrief(const QString &desc);
115 void setProjectNumber(const QString &num);
116 void setSourceDir(const QString &dir);
117 void setDestinationDir(const QString &dir);
118 void setRecursiveScan(int);
119
120 private:
121 QLineEdit *m_projName = nullptr;
122 QLineEdit *m_projBrief = nullptr;
123 QLineEdit *m_projNumber = nullptr;
124 QLineEdit *m_sourceDir = nullptr;
125 QLineEdit *m_destDir = nullptr;
126 QLabel *m_projIconLab = nullptr;
127 QCheckBox *m_recursive = nullptr;
128 QPushButton *m_srcSelectDir = nullptr;
129 QPushButton *m_dstSelectDir = nullptr;
130 Wizard *m_wizard = nullptr;
131 const QHash<QString,Input *> &m_modelData;
132 };
133
134 class Step2 : public QWidget
135 {
136 Q_OBJECT
137 public:
138 Step2(Wizard *parent,const QHash<QString,Input*> &modelData);
139 void init();
140
141 private slots:
142 void optimizeFor(int choice);
143 void extractMode(int choice);
144 void changeCrossRefState(int choice);
145
146 private:
147 QGroupBox *m_extractMode = nullptr;
148 QGroupBox *m_optimizeLang = nullptr;
149 QButtonGroup *m_extractModeGroup = nullptr;
150 QButtonGroup *m_optimizeLangGroup = nullptr;
151 QCheckBox *m_crossRef = nullptr;
152 Wizard *m_wizard = nullptr;
153 const QHash<QString,Input *> &m_modelData;
154 };
155
156 class Step3 : public QWidget
157 {
158 Q_OBJECT
159
160 public:
161 Step3(Wizard *parent,const QHash<QString,Input*> &modelData);
162 void init();
163
164 private slots:
165 void setHtmlEnabled(bool);
166 void setLatexEnabled(bool);
167 void setManEnabled(int);
168 void setRtfEnabled(int);
169 void setXmlEnabled(int);
170 void setDocbookEnabled(int);
171 void setSearchEnabled(int);
172 void setHtmlOptions(int);
173 void setLatexOptions(int);
174 void tuneColorDialog();
175
176 private:
177 QGroupBox *m_texOptions = nullptr;
178 QButtonGroup *m_texOptionsGroup = nullptr;
179 QGroupBox *m_htmlOptions = nullptr;
180 QButtonGroup *m_htmlOptionsGroup = nullptr;
181 QCheckBox *m_htmlEnabled = nullptr;
182 QCheckBox *m_latexEnabled = nullptr;
183 QCheckBox *m_manEnabled = nullptr;
184 QCheckBox *m_rtfEnabled = nullptr;
185 QCheckBox *m_xmlEnabled = nullptr;
186 QCheckBox *m_docbookEnabled = nullptr;
187 QCheckBox *m_searchEnabled = nullptr;
188 QPushButton *m_tuneColor = nullptr;
189 Wizard *m_wizard = nullptr;
190 const QHash<QString,Input *> &m_modelData;
191 };
192
193 class Step4 : public QWidget
194 {
195 Q_OBJECT
196
197 public:
198 Step4(Wizard *parent,const QHash<QString,Input*> &modelData);
199 void init();
200
201 private slots:
202 void diagramModeChanged(int);
203 void setClassGraphEnabled(int state);
204 void setCollaborationGraphEnabled(int state);
205 void setGraphicalHierarchyEnabled(int state);
206 void setIncludeGraphEnabled(int state);
207 void setIncludedByGraphEnabled(int state);
208 void setCallGraphEnabled(int state);
209 void setCallerGraphEnabled(int state);
210
211 private:
212 QGroupBox *m_diagramMode = nullptr;
213 QButtonGroup *m_diagramModeGroup = nullptr;
214 QGroupBox *m_dotGroup = nullptr;
215 QCheckBox *m_dotClass = nullptr;
216 QCheckBox *m_dotCollaboration = nullptr;
217 QCheckBox *m_dotInclude = nullptr;
218 QCheckBox *m_dotIncludedBy = nullptr;
219 QCheckBox *m_dotInheritance = nullptr;
220 QCheckBox *m_dotCall = nullptr;
221 QCheckBox *m_dotCaller = nullptr;
222 Wizard *m_wizard = nullptr;
223 const QHash<QString,Input *> &m_modelData;
224 };
225
226 class Wizard : public QSplitter
227 {
228 Q_OBJECT
229 public:
230 Wizard(const QHash<QString,Input*> &modelData, QWidget *parent=nullptr);
231 ~Wizard();
232
233 public slots:
234 void refresh();
235
236 private slots:
237 void activateTopic(QTreeWidgetItem *item,QTreeWidgetItem *);
238 void nextTopic();
239 void prevTopic();
240
241 signals:
242 void done();
243
244 private:
245 const QHash<QString,Input *> &m_modelData;
246 QTreeWidget *m_treeWidget = nullptr;
247 QStackedWidget *m_topicStack = nullptr;
248 Step1 *m_step1 = nullptr;
249 Step2 *m_step2 = nullptr;
250 Step3 *m_step3 = nullptr;
251 Step4 *m_step4 = nullptr;
252 QPushButton *m_next = nullptr;
253 QPushButton *m_prev = nullptr;
254 };
255
256 #endif