Isis 3 Programmer Reference
BrowseDialog.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "BrowseDialog.h"
10
11#include <QFileDialog>
12#include <QMessageBox>
13#include <QPushButton>
14
15#include <iostream>
16
17namespace Isis {
18
28 BrowseDialog::BrowseDialog(QString title, QStringList &filterList, QDir &directory, QWidget *parent) :
29 FileDialog(title, filterList, directory, parent), p_dir(directory) {
30
31 /*This returns a list of all the buttons in QFileDialog. This way I can
32 disconnect the buttons from the old signals and substitue my own. The
33 text on the buttons can also be changed*/
34 QList<QPushButton *> allPButtons = this->findChildren<QPushButton *>();
35 /*Do stuff to the first (Open) button.*/
36 allPButtons[0]->setText("View");
37 disconnect(allPButtons[0], 0, 0, 0);
38 connect(allPButtons[0], SIGNAL(pressed()), this, SLOT(displayCube()));
39 /*Do stuff to the second (Cancel) button.*/
40 allPButtons[1]->setText("Close");
41
42 this->setFileMode(QFileDialog::ExistingFile);
43
44 }
45
46
55 p_dir = this->directory();
56 QStringList selectedFiles = this->selectedFiles();
57
58 /*If the user did not select a file warn them.*/
59 if(selectedFiles.size() < 1) {
60 QString message = tr("\nFile not found.\nPlease verify the "
61 "correct file name was given");
62 QMessageBox::warning(this, "File Not Found", message);
63
64 }
65 else {
66
67 emit fileSelected(selectedFiles[0]);
68 }
69
70 }
71
79 void BrowseDialog::done(int r) {
81 }
82
83}
void displayCube()
This method is called after the user has selected a file either by double clicking on the file name o...
QDir & p_dir
The directory to open the dialog with.
BrowseDialog(QString title, QStringList &filterList, QDir &dir, QWidget *parent=0)
BrowseDialog constructor.
Class for browsing cubes.
Definition FileDialog.h:32
void done()
Called when the user presses OK.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16