Engauge Digitizer 2
Loading...
Searching...
No Matches
MainDirectoryPersist Class Reference

Persist the directory between successive Import/Open operations, or successive Export/Save operations. More...

#include <MainDirectoryPersist.h>

Collaboration diagram for MainDirectoryPersist:
Collaboration graph

Public Member Functions

 MainDirectoryPersist ()
 Default constructor.
QDir getDirectoryExportSave () const
 Get the current Export/Save directory.
QDir getDirectoryImportOpen () const
 Get the current Import/Open directory.
void setDirectoryExportSaveFromFilename (const QString &fileName)
 Save the current Export/Save directory, after user has accepted the Export/Save dialog.
void setDirectoryExportSaveFromSavedPath (const QString &path)
 Set the current Export/Save directory at startup to path from previous execution.
void setDirectoryImportOpenFromFilename (const QString &fileName)
 Save the current Import/Open directory, after user has accepted the Import/Open dialog.
void setDirectoryImportLoadFromSavedPath (const QString &path)
 Set the current Import/Open directory at startup to path from previous execution.

Detailed Description

Persist the directory between successive Import/Open operations, or successive Export/Save operations.

The Export/Import/Open/Save operations are performed by the MainWindow class. This functionality is for the convenience of users who want to return to the same directory automatically rather than manually move from the Engauge startup directory to a user directory

Definition at line 17 of file MainDirectoryPersist.h.

Constructor & Destructor Documentation

◆ MainDirectoryPersist()

MainDirectoryPersist::MainDirectoryPersist ( )

Default constructor.

Definition at line 15 of file MainDirectoryPersist.cpp.

16{
17}

Member Function Documentation

◆ getDirectoryExportSave()

QDir MainDirectoryPersist::getDirectoryExportSave ( ) const

Get the current Export/Save directory.

Definition at line 19 of file MainDirectoryPersist.cpp.

20{
21 return m_directoryExportSave;
22}

◆ getDirectoryImportOpen()

QDir MainDirectoryPersist::getDirectoryImportOpen ( ) const

Get the current Import/Open directory.

Definition at line 24 of file MainDirectoryPersist.cpp.

25{
26 return m_directoryImportOpen;
27}

◆ setDirectoryExportSaveFromFilename()

void MainDirectoryPersist::setDirectoryExportSaveFromFilename ( const QString & fileName)

Save the current Export/Save directory, after user has accepted the Export/Save dialog.

Definition at line 29 of file MainDirectoryPersist.cpp.

30{
31 m_setExportSave = true;
32 setDirectoryExportSaveFromSavedPath (QFileInfo (fileName).dir ().absolutePath());
33}
void setDirectoryExportSaveFromSavedPath(const QString &path)
Set the current Export/Save directory at startup to path from previous execution.

◆ setDirectoryExportSaveFromSavedPath()

void MainDirectoryPersist::setDirectoryExportSaveFromSavedPath ( const QString & path)

Set the current Export/Save directory at startup to path from previous execution.

When called within this class the path is not saved from the previous execution

Definition at line 35 of file MainDirectoryPersist.cpp.

36{
37 m_directoryExportSave = QDir(path);
38
39 if (!m_directoryExportSave.exists ()) {
40
41 // Directory has been (re)moved so fall back on a safe alternative
42 m_directoryExportSave = QDir::current ();
43
44 }
45
46 if (!m_setImportOpen) {
47
48 // Use the export directory for import since no better alternative is available
49 m_directoryImportOpen = m_directoryExportSave;
50
51 }
52}

◆ setDirectoryImportLoadFromSavedPath()

void MainDirectoryPersist::setDirectoryImportLoadFromSavedPath ( const QString & path)

Set the current Import/Open directory at startup to path from previous execution.

When called within this class the path is not saved from the previous execution

Definition at line 60 of file MainDirectoryPersist.cpp.

61{
62 m_directoryImportOpen = QDir (path);
63
64 if (!m_directoryImportOpen.exists ()) {
65
66 // Directory has been (re)moved so fall back on a safe alternative
67 m_directoryImportOpen = QDir::current ();
68
69 }
70
71 if (!m_setExportSave) {
72
73 // Use the import directory for export since no better alternative is available
74 m_directoryExportSave = m_directoryImportOpen;
75
76 }
77}

◆ setDirectoryImportOpenFromFilename()

void MainDirectoryPersist::setDirectoryImportOpenFromFilename ( const QString & fileName)

Save the current Import/Open directory, after user has accepted the Import/Open dialog.

Definition at line 54 of file MainDirectoryPersist.cpp.

55{
56 m_setImportOpen = true;
57 setDirectoryImportLoadFromSavedPath (QFileInfo (fileName).dir ().absolutePath());
58}
void setDirectoryImportLoadFromSavedPath(const QString &path)
Set the current Import/Open directory at startup to path from previous execution.

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