COPASI API  4.16.103
CQScreenshotOptionsDialog.h
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 #ifndef CQScreenshotOptionsDialog_H__
7 #define CQScreenshotOptionsDialog_H__
8 
9 #include "ui_CQScreenshotDialog.h"
10 
11 #include <set>
12 
13 #include <QtGui/QDialog>
14 #include <QtCore/QRegExp>
15 #include <QtGui/QValidator>
16 
17 class CQScreenshotOptionsDialog : public QDialog, private Ui::screenshot_option_dialog
18 {
19  Q_OBJECT
20 
21 public:
23  {
28  };
29 
30 protected:
31  // values needed by the dialog
32 
33  // the lowest x value of the layout
34  double mLayoutX;
35  // the lowest y value of the layout
36  double mLayoutY;
37  // the width of the layout
38  double mLayoutWidth;
39  // the height of the layout
40  double mLayoutHeight;
41  // the x value of the current view
42  double mCurrentX;
43  // the y value of the current view
44  double mCurrentY;
45  // the width of the current view
46  double mCurrentWidth;
47  // the height of the current view
49 
50  // stores the value of which frames are to be exported.
52 
53  // store the frames to export
54  std::set<size_t> mFrames;
55 
56  // the part of the layout to use for the screenshot
57  double mX;
58  double mY;
59  double mWidth;
60  double mHeight;
61  // the size of the image
62  unsigned int mImageWidth;
63  unsigned int mImageHeight;
64  // whether the selection decorations are
65  // to be drawn in the screenshot or not
67 
68  // whether to draw the options for the frame selection or not
70 
71  // color for background highlighting in
72  // the frames input field
73  QColor mDefaultColor;
76 
77 public:
78  CQScreenshotOptionsDialog(double layoutX, double layoutY, double layoutWidth, double layoutHeight,
79  double currentX, double currentY, double currentWidth, double currentHeight,
80  unsigned int imageWidth, unsigned int imageHeight, int lastFrame = -1,
81  QWidget* pParent = NULL);
82 
83  /*
84  * Returns the chosen lowest x value.
85  */
86  double getX() const;
87 
88  /*
89  * Returns the chosen lowest y value.
90  */
91  double getY() const;
92 
93  /*
94  * Returns the chosen width value.
95  */
96  double getWidth() const;
97 
98  /*
99  * Returns the chosen height value.
100  */
101  double getHeight() const;
102 
103  /*
104  * Returns the chosen image width value.
105  */
106  unsigned int getImageWidth() const;
107 
108  /*
109  * Returns the chosen image height value.
110  */
111  unsigned int getImageHeight() const;
112 
113  /*
114  * Returns whether the user has chosen to include
115  * the selection decoration in the screenshot or not.
116  */
117  bool isSetDrawSelectionDecoration() const;
118 
119  /**
120  * Returns which frames are to be exported.
121  * For a dialog that does not display the frames option, this will
122  * return UNSET.
123  * For dialogs with the frame option, possible values are CURRENT_FRAME,
124  * ALL_FRAMES, USER_DEFINED_FRAMES.
125  */
127 
128  /**
129  * Returns the set of frames.
130  */
131  const std::set<size_t>& getFrameSet() const;
132 
133 protected slots:
134  // if ok is pressed
135  virtual void accept();
136 
137  // if a radio button is clicked
138  void slotDisplayButtonClicked(QAbstractButton* pButton);
139 
140  // if a radio button in the frame options widget is clicked
141  void slotFrameButtonClicked(QAbstractButton* pButton);
142 
143  // called when the image width is changed
144  void slotImageWidthChanged(int w);
145 
146  // called when the image height is changed
147  void slotImageHeightChanged(int h);
148 
149  // called when the width is changed
150  void slotWidthChanged(const QString& wt);
151 
152  // called when the height is changed
153  void slotHeightChanged(const QString& ht);
154 
155  // called when the x value is changed
156  void slotXChanged(const QString& xt);
157 
158  // called when the y value is changed
159  void slotYChanged(const QString& yt);
160 
161  // called when the frames text is finished
163 
164  // called when the frames text is edited
165  void slotFramesTextEdited(const QString& text);
166 
167  // called when the draw selection item checkbox is toggled
168  void slotDrawSelectionToggled(bool v);
169 };
170 
171 class CQFrameInputValidator : public QValidator
172 {
173 protected:
174  static const QString ValidRegExpString;
175  static const QString IntermediateRegExpString;
176  static const QString ClosedRangeGroupRegExpString;
177 
181 
182 public:
183  CQFrameInputValidator(QObject* pParent = NULL);
184 
185  virtual QValidator::State validate(QString& input, int & pos) const;
186 };
187 
188 #endif // CQScreenshotOptionsDialog_H__
void slotHeightChanged(const QString &ht)
void slotFrameButtonClicked(QAbstractButton *pButton)
static const QString IntermediateRegExpString
virtual QValidator::State validate(QString &input, int &pos) const
void slotYChanged(const QString &yt)
void slotFramesTextEdited(const QString &text)
CQScreenshotOptionsDialog(double layoutX, double layoutY, double layoutWidth, double layoutHeight, double currentX, double currentY, double currentWidth, double currentHeight, unsigned int imageWidth, unsigned int imageHeight, int lastFrame=-1, QWidget *pParent=NULL)
static const QString ClosedRangeGroupRegExpString
void slotWidthChanged(const QString &wt)
CQFrameInputValidator(QObject *pParent=NULL)
void slotDisplayButtonClicked(QAbstractButton *pButton)
void slotXChanged(const QString &xt)
static const QString ValidRegExpString
const std::set< size_t > & getFrameSet() const