1 #include "PvlEditDialog.h" 10 #include <QPushButton> 13 #include <QVBoxLayout> 35 p_textEdit =
new QTextEdit;
39 input.open(pvl.
fileName().toLatin1().data(), ios::in);
43 getline(input, output);
46 p_textEdit->append(QString::fromStdString(output));
49 getline(input, output);
54 p_saveButton =
new QPushButton(
"Save Changes &As...");
55 p_saveButton->setEnabled(
false);
56 QPushButton *closeButton =
new QPushButton(
"&Close");
58 QHBoxLayout *buttonLayout =
new QHBoxLayout;
59 buttonLayout->addWidget(p_saveButton);
60 buttonLayout->addWidget(closeButton);
64 QVBoxLayout *vLayout =
new QVBoxLayout;
65 vLayout->addWidget(p_textEdit);
66 vLayout->addLayout(buttonLayout);
69 QString titleBar =
"Pvl File: " + QString(pvl.
fileName()) ;
70 setWindowTitle(titleBar);
74 connect(p_saveButton, SIGNAL(clicked()),
this, SLOT(
saveTextEdit()));
75 connect(closeButton, SIGNAL(clicked()),
this, SLOT(reject()));
87 p_saveButton->setEnabled(
true);
104 string textEditContents = p_textEdit->toPlainText().toStdString();
107 ss << textEditContents;
116 QMessageBox::warning((
QWidget *)parent(),
"Error", message);
122 QString filter =
"Select registration template (*.def *.pvl);;";
124 QString pvlFile = QFileDialog::getSaveFileName((
QWidget *)parent(),
125 "Select a registration template",
128 if(!pvlFile.isEmpty()) {
130 QString saveFile = pvlFile;
137 QMessageBox::warning((
QWidget *)parent(),
"Error", message);
143 setWindowTitle(
"Pvl File: " + pvlFile);
void enableSaveButton()
Allow the "Save Changes" button to be activated.
Namespace for the standard library.
Container for cube-like labels.
QString toString() const
Returns a string representation of this exception.
QString fileName() const
Returns the filename used to initialise the Pvl object.
Namespace for ISIS/Bullet specific routines.
void saveTextEdit()
Save the edited text as a new Pvl file.
void write(const QString &file)
Opens and writes PVL information to a file and handles the end of line sequence.