18 #include "pencilerror.h"
22 #include "pencildef.h"
24 DebugDetails::DebugDetails()
28 DebugDetails::~DebugDetails()
34 for (
const QString& s : d.mDetails)
36 mDetails.
append(
" " + s);
43 return mDetails.
join(
"\n");
49 return mDetails.
join(
"<br>");
58 void DebugDetails::appendSystemInfo()
60 if (mDetails.
empty() || mDetails.
last() ==
"end")
63 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
64 mDetails <<
"System Info";
65 #if defined(PENCIL2D_RELEASE_BUILD)
66 mDetails <<
"Pencil2D version: " APP_VERSION
" (stable)";
67 #elif defined(PENCIL2D_NIGHTLY_BUILD)
68 mDetails <<
"Pencil2D version: " APP_VERSION
" (nightly)";
70 mDetails <<
"Pencil2D version: " APP_VERSION
" (dev)";
73 #if defined(GIT_EXISTS)
74 mDetails <<
"Commit: " S__GIT_COMMIT_HASH;
83 Status::Status(ErrorCode code)
91 , mDescription(description)
92 , mDetails(detailsList)
96 Status::Status(
const ErrorCode code,
const QString& title,
const QString& description)
99 , mDescription(description)
105 static std::map<ErrorCode, QString> msgMap =
109 { FAIL,
QObject::tr(
"Ooops, Something went wrong.") },
110 { FILE_NOT_FOUND,
QObject::tr(
"File doesn't exist.") },
111 { ERROR_FILE_CANNOT_OPEN,
QObject::tr(
"Cannot open file.") },
112 { ERROR_INVALID_XML_FILE,
QObject::tr(
"The file is not a valid xml document.") },
113 { ERROR_INVALID_PENCIL_FILE,
QObject::tr(
"The file is not valid pencil document.") },
116 auto it = msgMap.find(mCode);
117 if (it == msgMap.end())
121 return msgMap[mCode];
124 bool Status::operator==(Status::ErrorCode code)
const
126 return (mCode == code);
129 bool Status::operator!=(Status::ErrorCode code)
const
131 return (mCode != code);
QString join(const QString &separator) const const
QString tr(const char *sourceText, const char *disambiguation, int n)
void append(const T &value)
QString prettyProductName()