COPASI API  4.16.103
Public Types | Public Member Functions | Protected Slots | Protected Attributes | List of all members
CQScreenshotOptionsDialog Class Reference

#include <CQScreenshotOptionsDialog.h>

Inheritance diagram for CQScreenshotOptionsDialog:
Inheritance graph
[legend]
Collaboration diagram for CQScreenshotOptionsDialog:
Collaboration graph
[legend]

Public Types

enum  FRAME_OPTION { UNSET, CURRENT_FRAME, ALL_FRAMES, USER_DEFINED_FRAMES }
 

Public Member Functions

 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)
 
FRAME_OPTION getFrameOption () const
 
const std::set< size_t > & getFrameSet () const
 
double getHeight () const
 
unsigned int getImageHeight () const
 
unsigned int getImageWidth () const
 
double getWidth () const
 
double getX () const
 
double getY () const
 
bool isSetDrawSelectionDecoration () const
 

Protected Slots

virtual void accept ()
 
void slotDisplayButtonClicked (QAbstractButton *pButton)
 
void slotDrawSelectionToggled (bool v)
 
void slotFrameButtonClicked (QAbstractButton *pButton)
 
void slotFramesTextEdited (const QString &text)
 
void slotFramesTextEditingFinished ()
 
void slotHeightChanged (const QString &ht)
 
void slotImageHeightChanged (int h)
 
void slotImageWidthChanged (int w)
 
void slotWidthChanged (const QString &wt)
 
void slotXChanged (const QString &xt)
 
void slotYChanged (const QString &yt)
 

Protected Attributes

double mCurrentHeight
 
double mCurrentWidth
 
double mCurrentX
 
double mCurrentY
 
QColor mDefaultColor
 
bool mDrawSelectionDecorations
 
FRAME_OPTION mFrameOption
 
std::set< size_t > mFrames
 
bool mFramesEditHighlighted
 
double mHeight
 
QColor mHighlightColor
 
unsigned int mImageHeight
 
unsigned int mImageWidth
 
int mLastFrame
 
double mLayoutHeight
 
double mLayoutWidth
 
double mLayoutX
 
double mLayoutY
 
double mWidth
 
double mX
 
double mY
 

Detailed Description

Definition at line 17 of file CQScreenshotOptionsDialog.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

CQScreenshotOptionsDialog::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 
)

Definition at line 18 of file CQScreenshotOptionsDialog.cpp.

References mCurrentHeight, mCurrentWidth, mCurrentX, mCurrentY, mDefaultColor, mHeight, mHighlightColor, mImageHeight, mImageWidth, mLastFrame, mLayoutHeight, mLayoutWidth, mLayoutX, mLayoutY, mWidth, mX, mY, slotDisplayButtonClicked(), slotDrawSelectionToggled(), slotFrameButtonClicked(), slotFramesTextEdited(), slotFramesTextEditingFinished(), slotHeightChanged(), slotImageHeightChanged(), slotImageWidthChanged(), slotWidthChanged(), slotXChanged(), and slotYChanged().

20  :
21  QDialog(pParent),
22  mLayoutX(layoutX),
23  mLayoutY(layoutY),
24  mLayoutWidth(layoutWidth),
25  mLayoutHeight(layoutHeight),
26  mCurrentX(currentX),
27  mCurrentY(currentY),
28  mCurrentWidth(currentWidth),
29  mCurrentHeight(currentHeight),
31  mX(mCurrentX),
32  mY(mCurrentY),
35  mImageWidth(imageWidth),
36  mImageHeight(imageHeight),
38  mLastFrame(lastFrame),
40 {
41  setupUi(this);
42  QPalette palette = this->mpFramesEdit->palette();
43  this->mDefaultColor = palette.color(this->mpFramesEdit->backgroundRole());
44  this->mHighlightColor = QColor(224, 128, 128);
45  // we disable the edit window after we get the background color
46  // otherwise we save the background for the disabled state
47  this->mpFramesEdit->setEnabled(false);
48 
49  // check if we need to display the frame options, if yes make them visible and enable them
50  this->mpFramesWidget->setEnabled(this->mLastFrame > 0);
51  this->mpFramesWidget->setVisible(this->mLastFrame > 0);
52  //
53  // hide the custom size options
54  this->mpAdvancedWidget->setVisible(false);
55  this->adjustSize();
56 
57  // set a validator on the frames input field
58  CQFrameInputValidator* pFrameVal = new CQFrameInputValidator(this);
59  this->mpFramesEdit->setValidator(pFrameVal);
60 
61  // create a button group for the frame option checkboxes
62  QButtonGroup* pFrameButtonGroup = new QButtonGroup(this);
63  pFrameButtonGroup->addButton(this->mpCurrentFrameButton);
64  pFrameButtonGroup->addButton(this->mpAllFramesButton);
65  pFrameButtonGroup->addButton(this->mpFramesButton);
66  pFrameButtonGroup->setExclusive(true);
67  connect(pFrameButtonGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(slotFrameButtonClicked(QAbstractButton*)));
68 
69  // create a button group for the display selection
70  QButtonGroup* pDisplayButtonGroup = new QButtonGroup(this);
71  pDisplayButtonGroup->addButton(this->mpCompleteButton);
72  pDisplayButtonGroup->addButton(this->mpVisibleButton);
73  pDisplayButtonGroup->addButton(this->mpCustomButton);
74  pDisplayButtonGroup->setExclusive(true);
75  connect(pDisplayButtonGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(slotDisplayButtonClicked(QAbstractButton*)));
76 
77  //
78  // set validators on the input fields
79  QDoubleValidator* pVal = new QDoubleValidator(this->mpXLineEdit);
80  this->mpXLineEdit->setValidator(pVal);
81  this->mpXLineEdit->setText(QString("%1").arg(this->mCurrentX));
82  pVal = new QDoubleValidator(this->mpYLineEdit);
83  this->mpYLineEdit->setValidator(pVal);
84  this->mpXLineEdit->setText(QString("%1").arg(this->mCurrentY));
85  pVal = new QDoubleValidator(this->mpWidthLineEdit);
86  pVal->setBottom(0.0);
87  this->mpWidthLineEdit->setValidator(pVal);
88  this->mpWidthLineEdit->setText(QString("%1").arg(this->mCurrentWidth));
89  pVal = new QDoubleValidator(this->mpHeightLineEdit);
90  pVal->setBottom(0.0);
91  this->mpHeightLineEdit->setValidator(pVal);
92  this->mpHeightLineEdit->setText(QString("%1").arg(this->mCurrentHeight));
93 
94  // set the information labels text at the top
95  std::ostringstream os;
96  os << "visible area: " << this->mCurrentX << "," << this->mCurrentY;
97  os << " " << this->mCurrentWidth << " x " << this->mCurrentHeight;
98  this->visible_area_label->setText(QString(os.str().c_str()));
99  os.str("");
100  os << "layout area: " << this->mLayoutX << "," << this->mLayoutY;
101  os << " " << this->mLayoutWidth << " x " << this->mLayoutHeight;
102  this->layout_area_label->setText(QString(os.str().c_str()));
103  // set the values of the input fields
104  this->mpXLineEdit->setText(QString("%1").arg(this->mX));
105  this->mpYLineEdit->setText(QString("%1").arg(this->mY));
106  this->mpWidthLineEdit->setText(QString("%1").arg(this->mWidth));
107  this->mpHeightLineEdit->setText(QString("%1").arg(this->mHeight));
108  this->mpImageWidthSpinbox->setValue(this->mImageWidth);
109  this->mpImageHeightSpinbox->setValue(this->mImageHeight);
110 
111  // check if the image width or the image height are 0, if so uncheck
112  // and disable the aspect check box
113  if (this->mImageWidth == 0 || this->mImageHeight == 0)
114  {
115  this->mpKeepImageAspectCheckbox->setChecked(false);
116  this->mpKeepImageAspectCheckbox->setEnabled(false);
117  }
118 
119  //
120  // check if the mCurrentWidth or the mCurrentHeight are 0.0, if so
121  // uncheck and disable the aspect check box
122  if (this->mCurrentWidth == 0.0 || this->mCurrentHeight == 0.0)
123  {
124  this->mpKeepAreaAspectCheckbox->setChecked(false);
125  this->mpKeepAreaAspectCheckbox->setEnabled(false);
126  }
127 
128  connect(this->mpImageWidthSpinbox, SIGNAL(valueChanged(int)), this, SLOT(slotImageWidthChanged(int)));
129  connect(this->mpImageHeightSpinbox, SIGNAL(valueChanged(int)), this, SLOT(slotImageHeightChanged(int)));
130  connect(this->mpWidthLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotWidthChanged(const QString&)));
131  connect(this->mpHeightLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotHeightChanged(const QString&)));
132  connect(this->mpXLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotXChanged(const QString&)));
133  connect(this->mpYLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotYChanged(const QString&)));
134  connect(this->mpDrawSelectionCheckbox, SIGNAL(toggled(bool)), this, SLOT(slotDrawSelectionToggled(bool)));
135  connect(this->mpFramesEdit, SIGNAL(textEdited(const QString&)), this, SLOT(slotFramesTextEdited(const QString&)));
136  connect(this->mpFramesEdit, SIGNAL(editingFinished()), this, SLOT(slotFramesTextEditingFinished()));
137 }
void slotHeightChanged(const QString &ht)
void slotFrameButtonClicked(QAbstractButton *pButton)
void slotYChanged(const QString &yt)
void slotFramesTextEdited(const QString &text)
void slotWidthChanged(const QString &wt)
void slotDisplayButtonClicked(QAbstractButton *pButton)
void slotXChanged(const QString &xt)

Member Function Documentation

void CQScreenshotOptionsDialog::accept ( )
protectedvirtualslot

Definition at line 197 of file CQScreenshotOptionsDialog.cpp.

198 {
199  this->QDialog::accept();
200 }
CQScreenshotOptionsDialog::FRAME_OPTION CQScreenshotOptionsDialog::getFrameOption ( ) const

Returns which frames are to be exported. For a dialog that does not display the frames option, this will return UNSET. For dialogs with the frame option, possible values are CURRENT_FRAME, ALL_FRAMES, USER_DEFINED_FRAMES.

Definition at line 250 of file CQScreenshotOptionsDialog.cpp.

References mFrameOption.

Referenced by CQLayoutMainWindow::saveImage().

251 {
252  return this->mFrameOption;
253 }
const std::set< size_t > & CQScreenshotOptionsDialog::getFrameSet ( ) const

Returns the set of frames.

Definition at line 258 of file CQScreenshotOptionsDialog.cpp.

References mFrames.

Referenced by CQLayoutMainWindow::saveImage().

259 {
260  return this->mFrames;
261 }
double CQScreenshotOptionsDialog::getHeight ( ) const

Definition at line 166 of file CQScreenshotOptionsDialog.cpp.

References mHeight.

Referenced by CQLayoutMainWindow::saveImage(), and CQNewMainWindow::slotScreenshot().

167 {
168  return this->mHeight;
169 }
unsigned int CQScreenshotOptionsDialog::getImageHeight ( ) const

Definition at line 182 of file CQScreenshotOptionsDialog.cpp.

References mImageHeight.

Referenced by CQLayoutMainWindow::saveImage(), and CQNewMainWindow::slotScreenshot().

183 {
184  return this->mImageHeight;
185 }
unsigned int CQScreenshotOptionsDialog::getImageWidth ( ) const

Definition at line 174 of file CQScreenshotOptionsDialog.cpp.

References mImageWidth.

Referenced by CQLayoutMainWindow::saveImage(), and CQNewMainWindow::slotScreenshot().

175 {
176  return this->mImageWidth;
177 }
double CQScreenshotOptionsDialog::getWidth ( ) const

Definition at line 158 of file CQScreenshotOptionsDialog.cpp.

References mWidth.

Referenced by CQLayoutMainWindow::saveImage(), and CQNewMainWindow::slotScreenshot().

159 {
160  return this->mWidth;
161 }
double CQScreenshotOptionsDialog::getX ( ) const

Definition at line 142 of file CQScreenshotOptionsDialog.cpp.

References mX.

Referenced by CQLayoutMainWindow::saveImage(), and CQNewMainWindow::slotScreenshot().

143 {
144  return this->mX;
145 }
double CQScreenshotOptionsDialog::getY ( ) const

Definition at line 150 of file CQScreenshotOptionsDialog.cpp.

References mY.

Referenced by CQLayoutMainWindow::saveImage(), and CQNewMainWindow::slotScreenshot().

151 {
152  return this->mY;
153 }
bool CQScreenshotOptionsDialog::isSetDrawSelectionDecoration ( ) const

Definition at line 191 of file CQScreenshotOptionsDialog.cpp.

References mDrawSelectionDecorations.

Referenced by CQNewMainWindow::slotScreenshot().

192 {
194 }
void CQScreenshotOptionsDialog::slotDisplayButtonClicked ( QAbstractButton *  pButton)
protectedslot

Definition at line 203 of file CQScreenshotOptionsDialog.cpp.

References mCurrentHeight, mCurrentWidth, mCurrentX, mCurrentY, mHeight, mLayoutHeight, mLayoutWidth, mLayoutX, mLayoutY, mWidth, mX, and mY.

Referenced by CQScreenshotOptionsDialog().

204 {
205  if (pButton == this->mpCustomButton)
206  {
207  this->mpAdvancedWidget->setEnabled(true);
208  this->mpAdvancedWidget->setVisible(true);
209  this->adjustSize();
210  // set mX and mY to the entries in the edit fields
211  this->mX = this->mpXLineEdit->text().toDouble();
212  this->mY = this->mpYLineEdit->text().toDouble();
213  // set mWidth and mHeight to the entries in the edit fields
214  this->mWidth = this->mpWidthLineEdit->text().toDouble();
215  this->mHeight = this->mpHeightLineEdit->text().toDouble();
216  }
217  else
218  {
219  this->mpAdvancedWidget->setVisible(false);
220  this->adjustSize();
221 
222  if (pButton == this->mpVisibleButton)
223  {
224  // set mX and mY to mCurrentX and mCurrentY
225  this->mX = this->mCurrentX;
226  this->mY = this->mCurrentY;
227  // set mWidth and mHeight to mCurrentWidth and mCurrentHeight
228  this->mWidth = this->mCurrentWidth;
229  this->mHeight = this->mCurrentHeight;
230  }
231  else
232  {
233  // set mX and mY to mLayoutX and mLayoutY
234  this->mX = this->mLayoutX;
235  this->mY = this->mLayoutY;
236  // set mWidth and mHeight to mLayoutWidth and mLayoutHeight
237  this->mWidth = this->mLayoutWidth;
238  this->mHeight = this->mLayoutHeight;
239  }
240  }
241 }
void CQScreenshotOptionsDialog::slotDrawSelectionToggled ( bool  v)
protectedslot

Definition at line 416 of file CQScreenshotOptionsDialog.cpp.

References mDrawSelectionDecorations.

Referenced by CQScreenshotOptionsDialog().

417 {
418  this->mDrawSelectionDecorations = v;
419 }
void CQScreenshotOptionsDialog::slotFrameButtonClicked ( QAbstractButton *  pButton)
protectedslot

Definition at line 264 of file CQScreenshotOptionsDialog.cpp.

References ALL_FRAMES, CURRENT_FRAME, mFrameOption, and USER_DEFINED_FRAMES.

Referenced by CQScreenshotOptionsDialog().

265 {
266  if (pButton == this->mpCurrentFrameButton)
267  {
269  this->mpFramesEdit->setEnabled(false);
270  }
271  else if (pButton == this->mpAllFramesButton)
272  {
274  this->mpFramesEdit->setEnabled(false);
275  }
276  else if (pButton == this->mpFramesButton)
277  {
279  this->mpFramesEdit->setEnabled(true);
280  }
281 }
void CQScreenshotOptionsDialog::slotFramesTextEdited ( const QString &  text)
protectedslot

Definition at line 422 of file CQScreenshotOptionsDialog.cpp.

References mDefaultColor, mFramesEditHighlighted, and mHighlightColor.

Referenced by CQScreenshotOptionsDialog().

423 {
424  if (this->mpFramesEdit->hasAcceptableInput() && this->mFramesEditHighlighted == true)
425  {
426  // set background to normal
427  mpFramesEdit->setStyleSheet(QString(mpFramesEdit->metaObject()->className()) + " {background-color:" + mDefaultColor.name() + ";}");
428  mFramesEditHighlighted = false;
429  }
430  else if (!this->mpFramesEdit->hasAcceptableInput() && this->mFramesEditHighlighted == false)
431  {
432  // set background to red
433  mpFramesEdit->setStyleSheet(QString(mpFramesEdit->metaObject()->className()) + " {background-color:" + mHighlightColor.name() + ";}");
434  mFramesEditHighlighted = true;
435  }
436 }
void CQScreenshotOptionsDialog::slotFramesTextEditingFinished ( )
protectedslot

Definition at line 439 of file CQScreenshotOptionsDialog.cpp.

References mFrames, and mLastFrame.

Referenced by CQScreenshotOptionsDialog().

440 {
441  QString yt = this->mpFramesEdit->text();
442  // the [0-9] are used instead of \\d because I only want these digits and not any symbol of any alphabet that counts as a digit
443  //const QString complete("^(\\s*[0-9]+\\s*(-\\s*(?:[0-9]+\\s*)?)?|\\s*-\\s*[0-9]+\\s*)(?:,(\\s*[0-9]+\\s*(?:-\\s*([0-9]+\\s*)?)?|\\s*-\\s*[0-9]+\\s*))*$");
444  //QRegExp completeRegExp(complete);
445  //completeRegExp.setPatternSyntax(QRegExp::RegExp2);
446  const QString number("^[0-9]+$");
447  QRegExp numberRegExp(number);
448  numberRegExp.setPatternSyntax(QRegExp::RegExp2);
449  const QString closed("^([0-9]+)\\s*-\\s*([0-9]+)$");
450  QRegExp closedRegExp(closed);
451  closedRegExp.setPatternSyntax(QRegExp::RegExp2);
452  const QString start("^([0-9]+)\\s*-$");
453  QRegExp startRegExp(start);
454  startRegExp.setPatternSyntax(QRegExp::RegExp2);
455  const QString end("^-\\s*([0-9]+)$");
456  QRegExp endRegExp(end);
457  endRegExp.setPatternSyntax(QRegExp::RegExp2);
458  // split the input into groups and parse the groups
459  //bool match = completeRegExp.exactMatch(yt);
460  //assert(match == true);
461 
462  //if (!match) return;
463 
464  //QStringList l = completeRegExp.capturedTexts();
465  QStringList l = yt.split(QString(","), QString::SkipEmptyParts);
466  int i, iMax = l.size();
467  assert(iMax != 0);
468  this->mFrames.clear();
469  QString s1, s2;
470 
471  for (i = 0; i < iMax; ++i)
472  {
473  s1 = l[i].trimmed();
474 
475  // check if it is a number, a closed range or one of
476  // the two possible open ranges
477  if (numberRegExp.exactMatch(s1))
478  {
479  QStringList l2 = numberRegExp.capturedTexts();
480  assert(l2.size() == 1);
481 
482  if (l2.size() > 0)
483  {
484  unsigned int n = l2[0].toUInt();
485 
486  if (this->mLastFrame > 0 && n <= (unsigned int)this->mLastFrame)
487  {
488  this->mFrames.insert(n);
489  }
490  }
491  }
492  else if (closedRegExp.exactMatch(s1))
493  {
494  QStringList l2 = closedRegExp.capturedTexts();
495  assert(l2.size() == 3);
496 
497  if (l2.size() > 2)
498  {
499  unsigned int n1 = l2[1].toUInt();
500  unsigned int n2 = l2[2].toUInt();
501  assert(n1 <= n2);
502 
503  if (this->mLastFrame > 0 && n1 <= (unsigned int)this->mLastFrame)
504  {
505  n2 = (n2 > (unsigned int)this->mLastFrame) ? (unsigned int)this->mLastFrame : n2;
506 
507  while (n1 <= n2)
508  {
509  this->mFrames.insert(n1);
510  ++n1;
511  }
512  }
513  }
514  }
515  else if (startRegExp.exactMatch(s1))
516  {
517  QStringList l2 = startRegExp.capturedTexts();
518  assert(l2.size() == 2);
519 
520  if (l2.size() > 1)
521  {
522  unsigned int n = l2[1].toUInt();
523 
524  if (this->mLastFrame > 0 && n <= (unsigned int)this->mLastFrame)
525  {
526  // add all number from n to this->mLastFrame
527  while (n <= (unsigned int)this->mLastFrame)
528  {
529  this->mFrames.insert(n);
530  ++n;
531  }
532  }
533  }
534  }
535  else if (endRegExp.exactMatch(s1))
536  {
537  QStringList l2 = endRegExp.capturedTexts();
538  assert(l2.size() == 2);
539 
540  if (l2.size() > 1)
541  {
542  unsigned int n = l2[1].toUInt();
543 
544  if (this->mLastFrame > 0 && n <= (unsigned int)this->mLastFrame)
545  {
546  // add all number from 1 to n
547  while (n != 0)
548  {
549  this->mFrames.insert(n);
550  --n;
551  }
552  }
553  }
554  }
555  else
556  {
557  // it be an empty string
558  this->mFrames.clear();
559  return;
560  }
561  }
562 }
void CQScreenshotOptionsDialog::slotHeightChanged ( const QString &  ht)
protectedslot

Definition at line 373 of file CQScreenshotOptionsDialog.cpp.

References mHeight, mWidth, and slotWidthChanged().

Referenced by CQScreenshotOptionsDialog(), and slotWidthChanged().

374 {
375  double newHeight = ht.toDouble();
376 
377  // is the keep aspect check box is set, we need to calculate the aspect first
378  if (this->mpKeepAreaAspectCheckbox->isChecked())
379  {
380  double aspect = (double)this->mWidth / (double)this->mHeight;
381  double w = newHeight * aspect;
382  disconnect(this->mpWidthLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotWidthChanged(const QString&)));
383  this->mpWidthLineEdit->setText(QString("%1").arg(w));
384  this->mWidth = w;
385  connect(this->mpWidthLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotWidthChanged(const QString&)));
386  }
387 
388  // set the new width
389  this->mHeight = newHeight;
390 
391  // if either the new width or new height is 0, we have to disable the aspect check box
392  if ((this->mWidth == 0.0 || this->mHeight == 0.0) && (this->mpKeepAreaAspectCheckbox->isEnabled() || this->mpKeepAreaAspectCheckbox->isChecked()))
393  {
394  this->mpKeepAreaAspectCheckbox->setChecked(false);
395  this->mpKeepAreaAspectCheckbox->setEnabled(false);
396  }
397  else if (this->mpKeepAreaAspectCheckbox->isEnabled() == false)
398  {
399  this->mpKeepAreaAspectCheckbox->setEnabled(true);
400  }
401 }
void slotWidthChanged(const QString &wt)
void CQScreenshotOptionsDialog::slotImageHeightChanged ( int  h)
protectedslot

Definition at line 313 of file CQScreenshotOptionsDialog.cpp.

References mImageHeight, mImageWidth, and slotImageWidthChanged().

Referenced by CQScreenshotOptionsDialog(), and slotImageWidthChanged().

314 {
315  // is the keep aspect check box is set, we need to calculate the aspect first
316  if (this->mpKeepImageAspectCheckbox->isChecked())
317  {
318  double aspect = (double)this->mImageWidth / (double)this->mImageHeight;
319  int w = (int)(round(h * aspect));
320  disconnect(this->mpImageWidthSpinbox, SIGNAL(valueChanged(int)), this, SLOT(slotImageWidthChanged(int)));
321  this->mpImageWidthSpinbox->setValue(w);
322  this->mImageWidth = w;
323  connect(this->mpImageWidthSpinbox, SIGNAL(valueChanged(int)), this, SLOT(slotImageWidthChanged(int)));
324  }
325 
326  // set the new width
327  this->mImageHeight = h;
328 
329  // if either the new width or new height is 0, we have to disable the aspect check box
330  if ((this->mImageWidth == 0 || this->mImageHeight == 0) && (this->mpKeepImageAspectCheckbox->isEnabled() || this->mpKeepImageAspectCheckbox->isChecked()))
331  {
332  this->mpKeepImageAspectCheckbox->setChecked(false);
333  this->mpKeepImageAspectCheckbox->setEnabled(false);
334  }
335  else if (this->mpKeepImageAspectCheckbox->isEnabled() == false)
336  {
337  this->mpKeepImageAspectCheckbox->setEnabled(true);
338  }
339 }
void CQScreenshotOptionsDialog::slotImageWidthChanged ( int  w)
protectedslot

Definition at line 284 of file CQScreenshotOptionsDialog.cpp.

References mImageHeight, mImageWidth, and slotImageHeightChanged().

Referenced by CQScreenshotOptionsDialog(), and slotImageHeightChanged().

285 {
286  // is the keep aspect check box is set, we need to calculate the aspect first
287  if (this->mpKeepImageAspectCheckbox->isChecked())
288  {
289  double aspect = (double)this->mImageHeight / (double)this->mImageWidth;
290  int h = (int)(round(w * aspect));
291  disconnect(this->mpImageHeightSpinbox, SIGNAL(valueChanged(int)), this, SLOT(slotImageHeightChanged(int)));
292  this->mpImageHeightSpinbox->setValue(h);
293  this->mImageHeight = h;
294  connect(this->mpImageHeightSpinbox, SIGNAL(valueChanged(int)), this, SLOT(slotImageHeightChanged(int)));
295  }
296 
297  // set the new width
298  this->mImageWidth = w;
299 
300  // if either the new width or new height is 0, we have to disable the aspect check box
301  if ((this->mImageWidth == 0 || this->mImageHeight == 0) && (this->mpKeepImageAspectCheckbox->isEnabled() || this->mpKeepImageAspectCheckbox->isChecked()))
302  {
303  this->mpKeepImageAspectCheckbox->setChecked(false);
304  this->mpKeepImageAspectCheckbox->setEnabled(false);
305  }
306  else if (this->mpKeepImageAspectCheckbox->isEnabled() == false)
307  {
308  this->mpKeepImageAspectCheckbox->setEnabled(true);
309  }
310 }
void CQScreenshotOptionsDialog::slotWidthChanged ( const QString &  wt)
protectedslot

Definition at line 342 of file CQScreenshotOptionsDialog.cpp.

References mHeight, mWidth, and slotHeightChanged().

Referenced by CQScreenshotOptionsDialog(), and slotHeightChanged().

343 {
344  double newWidth = wt.toDouble();
345 
346  // is the keep aspect check box is set, we need to calculate the aspect first
347  if (this->mpKeepAreaAspectCheckbox->isChecked())
348  {
349  double aspect = (double)this->mHeight / (double)this->mWidth;
350  double h = newWidth * aspect;
351  disconnect(this->mpHeightLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotHeightChanged(const QString&)));
352  this->mpHeightLineEdit->setText(QString("%1").arg(h));
353  this->mHeight = h;
354  connect(this->mpHeightLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotHeightChanged(const QString&)));
355  }
356 
357  // set the new width
358  this->mWidth = newWidth;
359 
360  // if either the new width or new height is 0, we have to disable the aspect check box
361  if ((this->mWidth == 0.0 || this->mHeight == 0.0) && (this->mpKeepAreaAspectCheckbox->isEnabled() || this->mpKeepAreaAspectCheckbox->isChecked()))
362  {
363  this->mpKeepAreaAspectCheckbox->setChecked(false);
364  this->mpKeepAreaAspectCheckbox->setEnabled(false);
365  }
366  else if (this->mpKeepAreaAspectCheckbox->isEnabled() == false)
367  {
368  this->mpKeepAreaAspectCheckbox->setEnabled(true);
369  }
370 }
void slotHeightChanged(const QString &ht)
void CQScreenshotOptionsDialog::slotXChanged ( const QString &  xt)
protectedslot

Definition at line 404 of file CQScreenshotOptionsDialog.cpp.

References mX.

Referenced by CQScreenshotOptionsDialog().

405 {
406  this->mX = xt.toDouble();
407 }
void CQScreenshotOptionsDialog::slotYChanged ( const QString &  yt)
protectedslot

Definition at line 410 of file CQScreenshotOptionsDialog.cpp.

References mY.

Referenced by CQScreenshotOptionsDialog().

411 {
412  this->mY = yt.toDouble();
413 }

Member Data Documentation

double CQScreenshotOptionsDialog::mCurrentHeight
protected
double CQScreenshotOptionsDialog::mCurrentWidth
protected
double CQScreenshotOptionsDialog::mCurrentX
protected
double CQScreenshotOptionsDialog::mCurrentY
protected
QColor CQScreenshotOptionsDialog::mDefaultColor
protected

Definition at line 73 of file CQScreenshotOptionsDialog.h.

Referenced by CQScreenshotOptionsDialog(), and slotFramesTextEdited().

bool CQScreenshotOptionsDialog::mDrawSelectionDecorations
protected
FRAME_OPTION CQScreenshotOptionsDialog::mFrameOption
protected

Definition at line 51 of file CQScreenshotOptionsDialog.h.

Referenced by getFrameOption(), and slotFrameButtonClicked().

std::set<size_t> CQScreenshotOptionsDialog::mFrames
protected

Definition at line 54 of file CQScreenshotOptionsDialog.h.

Referenced by getFrameSet(), and slotFramesTextEditingFinished().

bool CQScreenshotOptionsDialog::mFramesEditHighlighted
protected

Definition at line 75 of file CQScreenshotOptionsDialog.h.

Referenced by slotFramesTextEdited().

double CQScreenshotOptionsDialog::mHeight
protected
QColor CQScreenshotOptionsDialog::mHighlightColor
protected

Definition at line 74 of file CQScreenshotOptionsDialog.h.

Referenced by CQScreenshotOptionsDialog(), and slotFramesTextEdited().

unsigned int CQScreenshotOptionsDialog::mImageHeight
protected
unsigned int CQScreenshotOptionsDialog::mImageWidth
protected
int CQScreenshotOptionsDialog::mLastFrame
protected
double CQScreenshotOptionsDialog::mLayoutHeight
protected
double CQScreenshotOptionsDialog::mLayoutWidth
protected
double CQScreenshotOptionsDialog::mLayoutX
protected
double CQScreenshotOptionsDialog::mLayoutY
protected
double CQScreenshotOptionsDialog::mWidth
protected
double CQScreenshotOptionsDialog::mX
protected
double CQScreenshotOptionsDialog::mY
protected

The documentation for this class was generated from the following files: