Isis 3 Programmer Reference
GuiLog.cpp
1 #include <QVBoxLayout>
2 #include <QLabel>
3 #include <QFileDialog>
4 #include <iostream>
5 #include <fstream>
6 
7 #include "GuiLog.h"
8 
9 namespace Isis {
11  GuiLog::GuiLog(QWidget *parent) : QWidget(parent) {
12 
13  QVBoxLayout *lo = new QVBoxLayout;
14  setLayout(lo);
15 
16 // QLabel *lb = new QLabel("Log");
17 // lo->addWidget(lb);
18 
19  p_textEdit = new QTextEdit;
20  p_textEdit->setFont(QFont("Courier"));
21  p_textEdit->setFontPointSize(10);
22 // p_textEdit->setReadOnly(true);
23 
24  lo->addWidget(p_textEdit);
25  }
26 
29  }
30 
32  void GuiLog::Write(const QString &string) {
33  p_textEdit->append(string);
34  }
35 
37  void GuiLog::Clear() {
38  p_textEdit->clear();
39  p_textEdit->setFont(QFont("Courier"));
40  p_textEdit->setFontPointSize(10);
41  }
42 
44  void GuiLog::Save() {
45  QString s = QFileDialog::getSaveFileName(this, "Save log to file");
46  if(s != "") {
47  std::ofstream fout;
48  std::string filename(s.toStdString());
49  fout.open(filename.c_str());
50  fout << p_textEdit->toPlainText().toStdString();
51  fout.close();
52  }
53  }
54 }
void Write(const QString &string)
Add more information to the log widget.
Definition: GuiLog.cpp:32
GuiLog(QWidget *parent=0)
Constructor.
Definition: GuiLog.cpp:11
void Save()
Save the contents of the log widget to a file.
Definition: GuiLog.cpp:44
void Clear()
Clear the contents of the log widget.
Definition: GuiLog.cpp:37
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
~GuiLog()
Destructor.
Definition: GuiLog.cpp:28