4#include "include/settings/folder_path.h"
12namespace ehm_dal::file_io {
28 bool close(
const bool show_confirmation_dialog =
true);
47 bool open(
const QString &path);
53 bool open(QWidget *parent =
nullptr);
66 bool saveAs(QWidget *parent =
nullptr);
72 inline bool isOpen()
const {
return is_open_; }
76 inline bool isSaved()
const {
return has_been_saved_; }
80 inline void setOpenStatus(
const bool is_open) { is_open_ = is_open; }
81 void setSaveStatus(
const bool has_been_saved);
85 virtual void closeAll() = 0;
88 virtual bool read(
const QString &path) = 0;
91 virtual bool write(
const QString &path) = 0;
97 bool has_been_saved_{
false};
99 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:76
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:72
bool open(const QString &path)
Opens the file at path.
Definition: folder_path.h:11