107 void processRecentFileChanges();
108 void pruneRecentFiles();
110 QString openFileDialog(QString title);
111 QString saveFileDialog(QString title);
116 bool loadData(
const QString& filePath);
117 void reportLoadError();
119 var8* readSaveData(QString filePath);
120 void writeSaveData(QString filePath,
var8*
data);
122 void expandRecentFiles(QString files);
125 QList<QString> recentFiles;
130 enum FileLoadError { LoadErrorNone, LoadErrorCannotOpen, LoadErrorTooShort };
132 FileLoadError lastError = LoadErrorNone;
133 QString lastErrorMessage;
134 QString lastErrorDetail;
void setPath(QString path)
Set the active path (backs the path property).
void newFile()
Start a fresh blank save.
int recentFilesMax()
The cap (MAX_RECENT_FILES).
QString getLastErrorDetail()
void clearRecentFiles()
Forget the entire recent-files list.
SaveFile * data
The live save file these operations load into / save from.
QString getLastErrorMessage()
bool saveFileAs()
Prompt for a new path and save there.
void recentFilesRemove(int ind)
Drop one entry from the recent list.
QList< QString > getRecentFiles()
The whole recent-files list.
protected::void pathChanged(QString newPath, QString oldPath)
The active path changed.
int recentFilesCount()
How many recent files are currently remembered.
void recentFilesChanged(QList< QString > files)
The recent-files list changed.
QString getRecentFile(int index=0)
Recent path at index (0 = most recent).
void addRecentFile(QString path)
Push a path onto the recent list (de-duped, capped).
void loadError()
A load failed on a file that exists (unreadable / truncated).
FileManagement(QObject *parent=nullptr)
Current file path. Setting it triggers a load via setPath().
void wipeUnusedSpace()
Zero out save regions that aren't meaningfully used.
bool openFileRecent(int index)
Open an entry from the recent-files list.
void reset()
Clear path + data back to a blank starting state.
void reopenFile()
Reload the current path from disk, discarding edits.
bool saveFile()
Save to the current path.
void recentFilesSwap(int from, int to)
Reorder the recent list (e.g. drag to reorder).
bool saveFileCopy()
Save a copy elsewhere without changing the active path.
QString getPath()
Current file path.
bool openFile()
Prompt for and open a save.
void dataChanged()
The live SaveFile was replaced.
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Project-wide fixed-width integer aliases (var8, var16, ...).
var8e var8
Everyday 8-bit alias. Exact (not "fastest") to dodge the pointer-width bug noted above.
constexpr const char * KEY_LAST_FILE
QSettings key for the most-recent path.
constexpr var8 MAX_RECENT_FILES
How many recent paths to remember.
constexpr const char * KEY_RECENT_FILES
QSettings key for the recent-files list.
Import/export macro for the savefile library, plus the central list of QObject types kept deliberatel...
#define SAVEFILE_AUTOPORT
Expands to the correct dllexport/dllimport decoration for this library.