Isis 3 Programmer Reference
BrowseDialog.cpp
1 #include "BrowseDialog.h"
2 
3 #include <QFileDialog>
4 #include <QMessageBox>
5 #include <QPushButton>
6 
7 #include <iostream>
8 
9 namespace Isis {
10 
20  BrowseDialog::BrowseDialog(QString title, QStringList &filterList, QDir &directory, QWidget *parent) :
21  FileDialog(title, filterList, directory, parent), p_dir(directory) {
22 
23  /*This returns a list of all the buttons in QFileDialog. This way I can
24  disconnect the buttons from the old signals and substitue my own. The
25  text on the buttons can also be changed*/
26  QList<QPushButton *> allPButtons = this->findChildren<QPushButton *>();
27  /*Do stuff to the first (Open) button.*/
28  allPButtons[0]->setText("View");
29  disconnect(allPButtons[0], 0, 0, 0);
30  connect(allPButtons[0], SIGNAL(pressed()), this, SLOT(displayCube()));
31  /*Do stuff to the second (Cancel) button.*/
32  allPButtons[1]->setText("Close");
33 
34  this->setFileMode(QFileDialog::ExistingFile);
35 
36  }
37 
38 
47  p_dir = this->directory();
48  QStringList selectedFiles = this->selectedFiles();
49 
50  /*If the user did not select a file warn them.*/
51  if(selectedFiles.size() < 1) {
52  QString message = tr("\nFile not found.\nPlease verify the "
53  "correct file name was given");
54  QMessageBox::warning(this, "File Not Found", message);
55 
56  }
57  else {
58 
59  emit fileSelected(selectedFiles[0]);
60  }
61 
62  }
63 
71  void BrowseDialog::done(int r) {
72  displayCube();
73  }
74 
75 }
76 
Class for browsing cubes.
Definition: FileDialog.h:32
QDir & p_dir
The directory to open the dialog with.
Definition: BrowseDialog.h:38
void done()
Called when the user presses OK.
Definition: FileDialog.cpp:122
void displayCube()
This method is called after the user has selected a file either by double clicking on the file name o...
BrowseDialog(QString title, QStringList &filterList, QDir &dir, QWidget *parent=0)
BrowseDialog constructor.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31