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