Krita Source Code Documentation
Loading...
Searching...
No Matches
KisImportExportComplexError Struct Referenceabstract

#include <KisImportExportErrorCode.h>

+ Inheritance diagram for KisImportExportComplexError:

Public Member Functions

virtual QString errorMessage () const =0
 
 KisImportExportComplexError (QFileDevice::FileError error)
 
virtual ~KisImportExportComplexError ()=default
 

Protected Member Functions

QString qtErrorMessage () const
 

Protected Attributes

QFileDevice::FileError m_error
 

Friends

QDebug & operator<< (QDebug &d, const KisImportExportErrorCode &errorCode)
 

Detailed Description

Definition at line 57 of file KisImportExportErrorCode.h.

Constructor & Destructor Documentation

◆ KisImportExportComplexError()

KisImportExportComplexError::KisImportExportComplexError ( QFileDevice::FileError error)

Definition at line 13 of file KisImportExportErrorCode.cpp.

13: m_error(error) { }

◆ ~KisImportExportComplexError()

virtual KisImportExportComplexError::~KisImportExportComplexError ( )
virtualdefault

Member Function Documentation

◆ errorMessage()

virtual QString KisImportExportComplexError::errorMessage ( ) const
pure virtual

◆ qtErrorMessage()

QString KisImportExportComplexError::qtErrorMessage ( ) const
protected

Definition at line 16 of file KisImportExportErrorCode.cpp.

17{
18 // Error descriptions in most cases taken from https://doc.qt.io/qt-5/qfiledevice.html
19 QString unspecifiedError = i18n("An unspecified error occurred.");
20 switch (m_error) {
21 case QFileDevice::FileError::NoError :
22 // Returning this file error may mean that something is wrong in our code.
23 // Successful operation should return ImportExportCodes::OK instead.
24 return i18n("The action has been completed successfully.");
25 case QFileDevice::FileError::ReadError :
26 return i18n("An error occurred when reading from the file.");
27 case QFileDevice::FileError::WriteError :
28 return i18n("An error occurred when writing to the file.");
29 case QFileDevice::FileError::FatalError :
30 return i18n("A fatal error occurred.");
31 case QFileDevice::FileError::ResourceError :
32 return i18n("Out of resources (e.g. out of memory).");
33 case QFileDevice::FileError::OpenError :
34 return i18n("The file could not be opened.");
35 case QFileDevice::FileError::AbortError :
36 return i18n("The operation was aborted.");
37 case QFileDevice::FileError::TimeOutError :
38 return i18n("A timeout occurred.");
39 case QFileDevice::FileError::UnspecifiedError :
40 return unspecifiedError;
41 case QFileDevice::FileError::RemoveError :
42 return i18n("The file could not be removed.");
43 case QFileDevice::FileError::RenameError :
44 return i18n("The file could not be renamed.");
45 case QFileDevice::FileError::PositionError :
46 return i18n("The position in the file could not be changed.");
47 case QFileDevice::FileError::ResizeError :
48 return i18n("The file could not be resized.");
49 case QFileDevice::FileError::PermissionsError :
50 return i18n("Permission denied. Krita is not allowed to read or write to the file.");
51 case QFileDevice::FileError::CopyError :
52 return i18n("The file could not be copied.");
53 }
54 return unspecifiedError;
55}

References m_error.

Friends And Related Symbol Documentation

◆ operator<<

QDebug & operator<< ( QDebug & d,
const KisImportExportErrorCode & errorCode )
friend

Definition at line 145 of file KisImportExportErrorCode.h.

146{
147 switch (errorCode.errorFieldUsed) {
149 d << "None of the error fields is in use.";
150 break;
152 d << "Cannot read: " << errorCode.cannotRead.m_error;
153 break;
155 d << "Cannot write: " << errorCode.cannotRead.m_error;
156 break;
158 d << "Error code = " << errorCode.codeId;
159 }
160 d << " " << errorCode.errorMessage();
161 return d;
162}
KisImportExportErrorCannotRead cannotRead
ImportExportCodes::ErrorCodeID codeId

Member Data Documentation

◆ m_error

QFileDevice::FileError KisImportExportComplexError::m_error
protected

Definition at line 68 of file KisImportExportErrorCode.h.


The documentation for this struct was generated from the following files: