18#include "pencilerror.h"
22DebugDetails::DebugDetails()
28 for (
const QString& s : d.mDetails)
30 mDetails.
append(
" " + s);
37 return mDetails.
join(
"\n");
43 return mDetails.
join(
"<br>");
52void DebugDetails::appendSystemInfo()
54 if (mDetails.
empty() || mDetails.
last() ==
"end")
57#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
58 mDetails <<
"System Info";
59#if defined(PENCIL2D_RELEASE_BUILD)
60 mDetails <<
"Pencil2D version: " APP_VERSION
" (stable)";
61#elif defined(PENCIL2D_NIGHTLY_BUILD)
62 mDetails <<
"Pencil2D version: " APP_VERSION
" (nightly)";
64 mDetails <<
"Pencil2D version: " APP_VERSION
" (dev)";
67#if defined(GIT_EXISTS)
68 mDetails <<
"Commit: " S__GIT_COMMIT_HASH;
77Status::Status(ErrorCode code)
82Status::Status(
const ErrorCode code,
const QString& description)
84 , mDescription(description)
88Status::Status(Status::ErrorCode eCode,
const DebugDetails& detailsList)
90 , mDetails(detailsList)
97 , mDescription(description)
98 , mDetails(detailsList)
105 static std::map<ErrorCode, QString> msgMap =
108 { OK, tr(
"Everything ok.") },
109 { FAIL, tr(
"Ooops, Something went wrong.") },
110 { FILE_NOT_FOUND, tr(
"File doesn't exist.") },
111 { ERROR_FILE_CANNOT_OPEN, tr(
"Cannot open file.") },
112 { ERROR_INVALID_XML_FILE, tr(
"The file is not a valid xml document.") },
113 { ERROR_INVALID_PENCIL_FILE, tr(
"The file is not valid pencil document.") },
116 auto it = msgMap.find(mCode);
117 if (it == msgMap.end())
121 return msgMap[mCode];
124bool Status::operator==(Status::ErrorCode code)
const
126 return (mCode == code);
129bool Status::operator!=(Status::ErrorCode code)
const
131 return (mCode != code);
void append(const T &value)
QString join(const QString &separator) const const
QString prettyProductName()