File indexing completed on 2024-05-19 04:29:14

0001 /*
0002  *  SPDX-FileCopyrightText: 2017 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KISIMPORTEXPORTUTILS_H
0008 #define KISIMPORTEXPORTUTILS_H
0009 
0010 #include <mutex>
0011 
0012 #include <QFlags>
0013 #include <QString>
0014 
0015 #include <kritaui_export.h>
0016 #include "KisImportExportErrorCode.h"
0017 #include <KisImageBarrierLock.h>
0018 
0019 class KisImportUserFeedbackInterface;
0020 
0021 
0022 namespace KritaUtils {
0023 
0024 enum SaveFlag {
0025     SaveNone = 0,
0026     SaveShowWarnings = 0x1,
0027     SaveIsExporting = 0x2,
0028     SaveInAutosaveMode = 0x4
0029 };
0030 
0031 enum JobResult {
0032     Success = 0,
0033     Failure = 1,
0034     Busy = 2
0035 };
0036 
0037 Q_DECLARE_FLAGS(SaveFlags, SaveFlag)
0038 Q_DECLARE_OPERATORS_FOR_FLAGS(SaveFlags)
0039 
0040 struct ExportFileJob {
0041     ExportFileJob()
0042         : flags(SaveNone)
0043     {
0044     }
0045 
0046     ExportFileJob(QString _filePath, QByteArray _mimeType, SaveFlags _flags = SaveNone)
0047         : filePath(_filePath), mimeType(_mimeType), flags(_flags)
0048     {
0049     }
0050 
0051     bool isValid() const {
0052         return !filePath.isEmpty();
0053     }
0054 
0055     QString filePath;
0056     QByteArray mimeType;
0057     SaveFlags flags;
0058 };
0059 
0060 /**
0061  * When the image has a colorspace that is not suitable for displaying,
0062  * Krita should convert that into something more useful. This tool funcion
0063  * asks the user about the desired working color space and converts into
0064  * it.
0065  */
0066 KisImportExportErrorCode KRITAUI_EXPORT
0067 workaroundUnsuitableImageColorSpace(KisImageSP image,
0068                                     KisImportUserFeedbackInterface *feedbackInterface,
0069                                     KisImageBarrierLock &lock);
0070 
0071 }
0072 
0073 #endif // KISIMPORTEXPORTUTILS_H