4#include "include/settings/folder_path.h"
12namespace ehm_dal::file_io {
29 bool close(
const bool show_confirmation_dialog =
true);
48 bool open(
const QString &path);
54 bool open(QWidget *parent =
nullptr);
67 bool saveAs(QWidget *parent =
nullptr);
73 inline bool isOpen()
const {
return is_open_; }
77 inline bool isSaved()
const {
return has_been_saved_; }
81 inline void setOpenStatus(
const bool is_open) { is_open_ = is_open; }
82 void setSaveStatus(
const bool has_been_saved);
86 virtual void closeAll() = 0;
89 virtual bool read(
const QString &path) = 0;
92 virtual bool write(
const QString &path) = 0;
98 bool has_been_saved_{
false};
100 QTime last_saved_time_{QTime::currentTime()};
The AbstractFileManager class is a base class providing simple read and write file access to database...
Definition: abstract_file_manager.h:18
bool isSaved() const
Returns whether or not the file has been previously saved.
Definition: abstract_file_manager.h:77
virtual QString descriptor() const =0
Returns the file manager descriptor. E.g. This will return "database" for a database file manager.
bool open(QWidget *parent=nullptr)
Displays a file dialog window and opens the user selected file.
bool saveAs(QWidget *parent=nullptr)
Displays a file dialog window and saves the user selected destination.
bool save()
Saves the data to the existing file.
bool close(const bool show_confirmation_dialog=true)
Closes the active database/saved game and clears all tables.
virtual QString fileFilterString() const =0
Returns a list of supported file type filters for QFileDialog.
bool isOpen() const
Returns whether or not a file is presently open.
Definition: abstract_file_manager.h:73
bool open(const QString &path)
Opens the file at path.
Definition: folder_path.h:11