Isis 3.0 Programmer Reference
Back | Home
SaveAsDialog.cpp
1 #include "SaveAsDialog.h"
2 
3 #include <iostream>
4 
5 #include <QButtonGroup>
6 #include <QLayout>
7 #include <QFileDialog>
8 #include <QPushButton>
9 
10 using namespace std;
11 
12 namespace Isis {
13 
24  SaveAsDialog::SaveAsDialog(QString pTitle, QStringList &pFilterList, QDir &pDir, QWidget *pParent) :
25  FileDialog(pTitle, pFilterList, pDir, pParent), p_dir(pDir) {
26 
27  this->setFileMode(QFileDialog::AnyFile);
28 
29  // This returns a list of all the buttons in QFileDialog
30  QList<QPushButton *> allPButtons = this->findChildren<QPushButton *>();
31  // Edit the first (Open) button title.
32  allPButtons[0]->setText("&Save");
33 
35  allPButtons[1]->setText("Close");
36 
37  p_saveAsType = FullImage;
38  QHBoxLayout *hBoxLayout = new QHBoxLayout;
39  hBoxLayout->setAlignment(Qt::AlignLeft);
40  hBoxLayout->setSpacing(25);
41  hBoxLayout->setContentsMargins (25, 11, 25, 11 );
42 
43  // Button Group
44  QButtonGroup *exportOptionsGrp = new QButtonGroup();
45  exportOptionsGrp->setExclusive(true); // only one option can be clicked
46 
47  p_fullImage = new QRadioButton("Full &Image", this);
48  connect(p_fullImage, SIGNAL(clicked(bool)), this, SLOT(setFullImage(bool)));
49  exportOptionsGrp->addButton(p_fullImage);
50  p_fullImage->setWhatsThis("Save the entire Image");
51 
52  p_exportAsIs = new QRadioButton("Export &As Is", this);
53  connect(p_exportAsIs, SIGNAL(clicked(bool)), this, SLOT(setAsIs(bool)));
54  exportOptionsGrp->addButton(p_exportAsIs);
55  p_exportAsIs->setWhatsThis("Save the Image As Viewed");
56 
57  p_exportFullRes = new QRadioButton("Export Full &Res", this);
58  connect(p_exportFullRes, SIGNAL(clicked(bool)), this, SLOT(setFullResolution(bool)));
59  exportOptionsGrp->addButton(p_exportFullRes);
60  p_exportFullRes->setWhatsThis("Save the Image As Viewed with Full Resoultion");
61 
62  hBoxLayout->addWidget(p_exportAsIs);
63  hBoxLayout->addWidget(p_exportFullRes);
64 
65  p_fullImage->setEnabled(true);
66  p_exportAsIs->setEnabled(true);
67  p_exportFullRes->setEnabled(true);
68 
69  p_fullImage->setChecked(true);
70 
71  QLayout *dialogLayout = layout();
72  dialogLayout->addWidget(p_fullImage);
73  dialogLayout->addItem(hBoxLayout);
74  dialogLayout->setAlignment(hBoxLayout, Qt::AlignLeft );
75  setLayout(dialogLayout);
76  }
77 
86  {
87  if (p_exportAsIs->isChecked())
88  return ExportAsIs;
89  if(p_exportFullRes->isChecked())
90  return ExportFullRes;
91  return FullImage;
92  }
93 
102  void SaveAsDialog::setFullImage(bool pbChecked)
103  {
104  if(pbChecked) {
105  p_saveAsType = FullImage;
106  }
107  }
108 
117  void SaveAsDialog::setAsIs(bool pbChecked)
118  {
119  if(pbChecked) {
120  p_saveAsType = ExportAsIs;
121  }
122  }
123 
132  void SaveAsDialog::setFullResolution(bool pbChecked)
133  {
134  if(pbChecked) {
135  p_saveAsType = ExportFullRes;
136  }
137  }
138 }
QRadioButton * p_fullImage
FullImage Button.
Definition: SaveAsDialog.h:60
void setAsIs(bool)
Check ExportAsIs radio button and if checked set the saveAsType to ExportAsIs.
void setFullImage(bool)
Check FullImage radio button and if checked set the saveAsType to FullImage.
Class for browsing cubes.
Definition: FileDialog.h:32
void setFullResolution(bool)
Check ExportFullRes radio button and if checked set the saveAsType to ExportFullRes.
QRadioButton * p_exportAsIs
ExportAsIs Button.
Definition: SaveAsDialog.h:61
saveAsType p_saveAsType
Current Save Type.
Definition: SaveAsDialog.h:63
int getSaveAsType()
Get user chosen save type.
QRadioButton * p_exportFullRes
ExportFullRes Button.
Definition: SaveAsDialog.h:62

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:28:37