| 1 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 2 |
|
| 3 |
/*************************************************************************** |
| 4 |
* Copyright (c) 2024 Werner Mayer <wmayer[at]users.sourceforge.net> * |
| 5 |
* * |
| 6 |
* This file is part of FreeCAD. * |
| 7 |
* * |
| 8 |
* FreeCAD is free software: you can redistribute it and/or modify it * |
| 9 |
* under the terms of the GNU Lesser General Public License as * |
| 10 |
* published by the Free Software Foundation, either version 2.1 of the * |
| 11 |
* License, or (at your option) any later version. * |
| 12 |
* * |
| 13 |
* FreeCAD is distributed in the hope that it will be useful, but * |
| 14 |
* WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
| 16 |
* Lesser General Public License for more details. * |
| 17 |
* * |
| 18 |
* You should have received a copy of the GNU Lesser General Public * |
| 19 |
* License along with FreeCAD. If not, see * |
| 20 |
* <https://www.gnu.org/licenses/>. * |
| 21 |
* * |
| 22 |
**************************************************************************/ |
| 23 |
|
| 24 |
#ifndef GUI_MODULE_IO_H |
| 25 |
#define GUI_MODULE_IO_H |
| 26 |
|
| 27 |
#include <QCoreApplication> |
| 28 |
#include <FCGlobal.h> |
| 29 |
|
| 30 |
namespace Gui |
| 31 |
{ |
| 32 |
|
| 33 |
class GuiExport ModuleIO |
| 34 |
{ |
| 35 |
Q_DECLARE_TR_FUNCTIONS(Gui::ModuleIO) |
| 36 |
|
| 37 |
public: |
| 38 |
/*! |
| 39 |
* \brief verifyFile |
| 40 |
* Verifies the existence of the file. If it doesn't exist an error dialog |
| 41 |
* pops up and false is returned, otherwise true is returned. |
| 42 |
* \param filename |
| 43 |
* \return |
| 44 |
*/ |
| 45 |
static bool verifyFile(const QString& filename); |
| 46 |
/*! |
| 47 |
* \brief openFile |
| 48 |
* Opens the file. |
| 49 |
* The handling module is supposed to create a new document. |
| 50 |
* \param filename |
| 51 |
*/ |
| 52 |
static void openFile(const QString& filename); |
| 53 |
/*! |
| 54 |
* \brief verifyAndOpenFile |
| 55 |
* Verifies the existence of the file and opens it. |
| 56 |
* The handling module is supposed to create a new document. |
| 57 |
* \param filename |
| 58 |
*/ |
| 59 |
static void verifyAndOpenFile(const QString& filename); |
| 60 |
/*! |
| 61 |
* \brief importFile |
| 62 |
* Imports the files into the given document. |
| 63 |
* The handling module is supposed to create a new document if the passed |
| 64 |
* document doesn't exist. |
| 65 |
* \param filename |
| 66 |
* \param document |
| 67 |
*/ |
| 68 |
static void importFiles(const QStringList& filenames, const char* document); |
| 69 |
}; |
| 70 |
|
| 71 |
} // namespace Gui |
| 72 |
|
| 73 |
#endif // GUI_MODULE_IO_H |