Isis 3 Programmer Reference
Isis::GuiEditFile Class Reference

Opens a window in Gui Application to be able to edit, save and create text files. More...

#include <GuiEditFile.h>

Inheritance diagram for Isis::GuiEditFile:
Inheritance graph
Collaboration diagram for Isis::GuiEditFile:
Collaboration graph

Public Slots

void open ()
 For action File->Open.
 
void OpenFile (QString)
 To display the contents of an opened file.
 
void setTextChanged ()
 Indicator that the text has changed.
 
void saveAs ()
 For action File->Save As.
 
void saveAsFile (QString)
 Save the contents of text editor to another file.
 
void saveFile ()
 For action File->Save.
 
void closeFile ()
 For action File->Close.
 
void closeWin ()
 For action Exit (close the window)
 

Public Member Functions

void showWindow (QString psFile="")
 If there is already an instance of this object, then display the window.
 
 ~GuiEditFile ()
 Destructor.
 
void clearFile ()
 Delete the contents of a file.
 

Static Public Member Functions

static void EditFile (UserInterface &pUI, QString psFile="")
 Creates a single instance of the GuiEditFile.
 

Private Member Functions

 GuiEditFile (UserInterface &pUI, QString psFile="")
 Constructor.
 
void windowTitle (QString &psfile)
 display only the file base name
 

Private Attributes

QWidgetm_parent
 Parent widget.
 
QString m_fileName
 Current file open.
 
QMainWindowm_editWin
 Editor window.
 
QTextEdit * m_txtEdit
 Text Editor.
 
QFile * m_editFile
 File pointer to current file.
 
bool m_textChanged
 Flag to indicate text changed.
 
QActionm_open
 Actioons.
 
QActionm_save
 Action Save.
 
QActionm_saveAs
 Action Save As.
 
QActionm_close
 Action Close.
 
QActionm_exit
 Action Exit.
 

Static Private Attributes

static GuiEditFilem_instance = NULL
 Instance of this object - singleton.
 

Detailed Description

Opens a window in Gui Application to be able to edit, save and create text files.

Creates a singleton window to edit files.

Example can be used to edit DefFiles in control net applications. Refer to cnetedit Application

Author
2011-05-21 Sharmila Prasad
History

2011-05-21 Sharmila Prasad - Initial Version

2011-10-07 Sharmila Prasad - Added message if the file does not have
write permissions and is unable to load it.

Definition at line 54 of file GuiEditFile.h.

Constructor & Destructor Documentation

◆ ~GuiEditFile()

Isis::GuiEditFile::~GuiEditFile ( )

Destructor.

Author
Sharmila Prasad (5/20/2011)

Definition at line 155 of file GuiEditFile.cpp.

References m_editFile, m_editWin, m_instance, and m_txtEdit.

◆ GuiEditFile()

Isis::GuiEditFile::GuiEditFile ( UserInterface & pUI,
QString psFile = "" )
private

Constructor.

Author
Sharmila Prasad (5/20/2011)
Parameters
pUI
psFile

Definition at line 69 of file GuiEditFile.cpp.

References closeFile(), closeWin(), m_close, m_editFile, m_editWin, m_exit, m_fileName, m_open, m_parent, m_save, m_saveAs, m_textChanged, m_txtEdit, open(), OpenFile(), saveAs(), saveFile(), and setTextChanged().

Referenced by EditFile().

Member Function Documentation

◆ clearFile()

void Isis::GuiEditFile::clearFile ( )

Delete the contents of a file.

Delete the contents of the current file - especially if changes are made and they are not to be saved.

Author
Sharmila Prasad (5/23/2011)

Definition at line 329 of file GuiEditFile.cpp.

References m_editFile.

Referenced by saveFile().

◆ closeFile

void Isis::GuiEditFile::closeFile ( )
slot

For action File->Close.

Action File->close, close the opened file.

Author
Sharmila Prasad (5/20/2011)

Definition at line 218 of file GuiEditFile.cpp.

References m_editFile, m_editWin, m_textChanged, m_txtEdit, and saveFile().

Referenced by GuiEditFile().

◆ closeWin

void Isis::GuiEditFile::closeWin ( )
slot

For action Exit (close the window)

Action Exit - Close window and clear text editor.

Author
Sharmila Prasad (5/23/2011)

Definition at line 174 of file GuiEditFile.cpp.

References m_editWin, and m_txtEdit.

Referenced by GuiEditFile().

◆ EditFile()

void Isis::GuiEditFile::EditFile ( UserInterface & pUI,
QString psFile = "" )
static

Creates a single instance of the GuiEditFile.

If already an instance, display the object

Author
Sharmila Prasad (5/20/2011)
Parameters
pUI- User Interface of parent app
psFile- File to edit

Definition at line 38 of file GuiEditFile.cpp.

References GuiEditFile(), and m_instance.

◆ open

void Isis::GuiEditFile::open ( )
slot

For action File->Open.

Action File->Open.

Author
Sharmila Prasad (5/20/2011)

Definition at line 193 of file GuiEditFile.cpp.

References m_textChanged, OpenFile(), and saveFile().

Referenced by GuiEditFile().

◆ OpenFile

void Isis::GuiEditFile::OpenFile ( QString psOutFile)
slot

To display the contents of an opened file.

Display the selected file.

Author
Sharmila Prasad (5/20/2011)
Parameters
psOutFile

Definition at line 239 of file GuiEditFile.cpp.

References m_editFile, m_textChanged, m_txtEdit, and windowTitle().

Referenced by GuiEditFile(), open(), and showWindow().

◆ saveAs

void Isis::GuiEditFile::saveAs ( )
slot

For action File->Save As.

Action File->Save As.

Author
Sharmila Prasad (5/23/2011)

Definition at line 291 of file GuiEditFile.cpp.

References saveAsFile().

Referenced by GuiEditFile().

◆ saveAsFile

void Isis::GuiEditFile::saveAsFile ( QString psNewFile)
slot

Save the contents of text editor to another file.

Copy the current file into user selected file.

Author
Sharmila Prasad (5/23/2011)
Parameters
psNewFile

Definition at line 314 of file GuiEditFile.cpp.

References m_editFile, saveFile(), and windowTitle().

Referenced by saveAs().

◆ saveFile

void Isis::GuiEditFile::saveFile ( )
slot

For action File->Save.

Action File->Save.

Author
Sharmila Prasad (5/20/2011)

Definition at line 277 of file GuiEditFile.cpp.

References clearFile(), m_editFile, m_textChanged, and m_txtEdit.

Referenced by closeFile(), GuiEditFile(), open(), and saveAsFile().

◆ setTextChanged

void Isis::GuiEditFile::setTextChanged ( )
slot

Indicator that the text has changed.

Flag to indicate text has changed.

Author
Sharmila Prasad (5/20/2011)

Definition at line 184 of file GuiEditFile.cpp.

References m_textChanged.

Referenced by GuiEditFile().

◆ showWindow()

void Isis::GuiEditFile::showWindow ( QString psFile = "")

If there is already an instance of this object, then display the window.

Display the window if there is already an instance of this object.

Author
Sharmila Prasad (5/23/2011)
Parameters
psFile- File to edit

Definition at line 54 of file GuiEditFile.cpp.

References m_editWin, m_fileName, and OpenFile().

◆ windowTitle()

void Isis::GuiEditFile::windowTitle ( QString & psfile)
private

display only the file base name

Display only the base name of the file.

Author
Sharmila Prasad (5/23/2011)
Parameters
psfile- current file

Definition at line 344 of file GuiEditFile.cpp.

References m_editWin.

Referenced by OpenFile(), and saveAsFile().

Member Data Documentation

◆ m_close

QAction* Isis::GuiEditFile::m_close
private

Action Close.

Definition at line 96 of file GuiEditFile.h.

Referenced by GuiEditFile().

◆ m_editFile

QFile* Isis::GuiEditFile::m_editFile
private

File pointer to current file.

Definition at line 89 of file GuiEditFile.h.

Referenced by clearFile(), closeFile(), GuiEditFile(), OpenFile(), saveAsFile(), saveFile(), and ~GuiEditFile().

◆ m_editWin

QMainWindow* Isis::GuiEditFile::m_editWin
private

Editor window.

Definition at line 87 of file GuiEditFile.h.

Referenced by closeFile(), closeWin(), GuiEditFile(), showWindow(), windowTitle(), and ~GuiEditFile().

◆ m_exit

QAction* Isis::GuiEditFile::m_exit
private

Action Exit.

Definition at line 97 of file GuiEditFile.h.

Referenced by GuiEditFile().

◆ m_fileName

QString Isis::GuiEditFile::m_fileName
private

Current file open.

Definition at line 86 of file GuiEditFile.h.

Referenced by GuiEditFile(), and showWindow().

◆ m_instance

GuiEditFile * Isis::GuiEditFile::m_instance = NULL
staticprivate

Instance of this object - singleton.

Definition at line 84 of file GuiEditFile.h.

Referenced by EditFile(), and ~GuiEditFile().

◆ m_open

QAction* Isis::GuiEditFile::m_open
private

Actioons.

Action Open

Definition at line 93 of file GuiEditFile.h.

Referenced by GuiEditFile().

◆ m_parent

QWidget* Isis::GuiEditFile::m_parent
private

Parent widget.

Definition at line 85 of file GuiEditFile.h.

Referenced by GuiEditFile().

◆ m_save

QAction* Isis::GuiEditFile::m_save
private

Action Save.

Definition at line 94 of file GuiEditFile.h.

Referenced by GuiEditFile().

◆ m_saveAs

QAction* Isis::GuiEditFile::m_saveAs
private

Action Save As.

Definition at line 95 of file GuiEditFile.h.

Referenced by GuiEditFile().

◆ m_textChanged

bool Isis::GuiEditFile::m_textChanged
private

Flag to indicate text changed.

Definition at line 90 of file GuiEditFile.h.

Referenced by closeFile(), GuiEditFile(), open(), OpenFile(), saveFile(), and setTextChanged().

◆ m_txtEdit

QTextEdit* Isis::GuiEditFile::m_txtEdit
private

Text Editor.

Definition at line 88 of file GuiEditFile.h.

Referenced by closeFile(), closeWin(), GuiEditFile(), OpenFile(), saveFile(), and ~GuiEditFile().


The documentation for this class was generated from the following files: