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