18#include "pencilerror.h"
24DebugDetails::DebugDetails()
30 for (
const QString& s : d.mDetails)
32 mDetails.
append(
" " + s);
39 return mDetails.
join(
"\n");
45 return mDetails.
join(
"<br>");
54void DebugDetails::appendSystemInfo()
56 if (mDetails.
empty() || mDetails.
last() ==
"end")
59#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
60 mDetails <<
"System Info";
61#if defined(PENCIL2D_RELEASE_BUILD)
62 mDetails <<
"Pencil2D version: " APP_VERSION
" (stable)";
63#elif defined(PENCIL2D_NIGHTLY_BUILD)
64 mDetails <<
"Pencil2D version: " APP_VERSION
" (nightly)";
66 mDetails <<
"Pencil2D version: " APP_VERSION
" (dev)";
69#if defined(GIT_EXISTS)
70 mDetails <<
"Commit: " S__GIT_COMMIT_HASH;
79Status::Status(ErrorCode code)
84Status::Status(
const ErrorCode code,
const QString& description)
86 , mDescription(description)
90Status::Status(Status::ErrorCode eCode,
const DebugDetails& detailsList)
92 , mDetails(detailsList)
99 , mDescription(description)
100 , mDetails(detailsList)
107 static std::map<ErrorCode, QString> msgMap =
110 { OK, tr(
"Everything ok.") },
111 { FAIL, tr(
"Ooops, Something went wrong.") },
112 { FILE_NOT_FOUND, tr(
"File doesn't exist.") },
113 { ERROR_FILE_CANNOT_OPEN, tr(
"Cannot open file.") },
114 { ERROR_INVALID_XML_FILE, tr(
"The file is not a valid xml document.") },
115 { ERROR_INVALID_PENCIL_FILE, tr(
"The file is not valid pencil document.") },
118 auto it = msgMap.find(mCode);
119 if (it == msgMap.end())
123 return msgMap[mCode];
126bool Status::operator==(Status::ErrorCode code)
const
128 return (mCode == code);
131bool Status::operator!=(Status::ErrorCode code)
const
133 return (mCode != code);
void append(const T &value)
QString join(const QString &separator) const const
QString prettyProductName()