/home/docs/checkouts/readthedocs.org/user_builds/mathvizanimator/checkouts/latest/libs/mva_workflow/include/workflow/savefilehandler.h Source File

MathVizAnimator: /home/docs/checkouts/readthedocs.org/user_builds/mathvizanimator/checkouts/latest/libs/mva_workflow/include/workflow/savefilehandler.h Source File
MathVizAnimator  0.0.1
savefilehandler.h
1 /* mathvizanimator
2  * Copyright (C) 2023 codingwithmagga
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef LIBS_MVA_WORKFLOW_INCLUDE_WORKFLOW_SAVEFILEHANDLER_H_
19 #define LIBS_MVA_WORKFLOW_INCLUDE_WORKFLOW_SAVEFILEHANDLER_H_
20 
21 #include <QDir>
22 #include <QJsonDocument>
23 #include <QJsonObject>
24 #include <QSaveFile>
25 
27  public:
28  SaveFileHandler() = default;
29 
30  QDir saveDir() const;
31  void setSaveDir(const QDir& new_save_dir);
32 
33  bool saveJSON(const QString& file_name, const QJsonObject json_data) const;
34  QJsonDocument loadJSON(const QFileInfo& fileinfo) const;
35 
36  private:
37  QSaveFile prepareSaveFile(const QString& name, const QString& extension) const;
38 
39  QString prepareFileName(const QString& extension, const QFileInfo& file_info) const;
40 
41  QDir m_save_dir = QDir::home();
42 };
43 
44 #endif // LIBS_MVA_WORKFLOW_INCLUDE_WORKFLOW_SAVEFILEHANDLER_H_
Definition: savefilehandler.h:26