18#include "pencilerror.h"
23DebugDetails::DebugDetails()
29 for (
const QString& s : d.mDetails)
31 mDetails.
append(
" " + s);
38 return mDetails.
join(
"\n");
44 return mDetails.
join(
"<br>");
53void DebugDetails::appendSystemInfo()
55 if (mDetails.
empty() || mDetails.
last() ==
"end")
58#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
59 mDetails <<
"\n[System Info]\n";
60#if defined(PENCIL2D_RELEASE_BUILD)
61 mDetails <<
" Pencil2D version: " APP_VERSION
" (stable)";
62#elif defined(PENCIL2D_NIGHTLY_BUILD)
63 mDetails <<
" Pencil2D version: " APP_VERSION
" (nightly)";
65 mDetails <<
" Pencil2D version: " APP_VERSION
" (dev)";
68#if defined(GIT_EXISTS)
69 mDetails <<
" Commit: " S__GIT_COMMIT_HASH;
78Status::Status(ErrorCode code)
83Status::Status(
const ErrorCode code,
const QString& description)
85 , mDescription(description)
89Status::Status(Status::ErrorCode eCode,
const DebugDetails& detailsList)
91 , mDetails(detailsList)
98 , mDescription(description)
99 , mDetails(detailsList)
106 static std::map<ErrorCode, QString> msgMap =
109 { OK, tr(
"Everything ok.") },
110 { FAIL, tr(
"Ooops, Something went wrong.") },
111 { FILE_NOT_FOUND, tr(
"File doesn't exist.") },
112 { ERROR_FILE_CANNOT_OPEN, tr(
"Cannot open file.") },
113 { ERROR_INVALID_XML_FILE, tr(
"The file is not a valid xml document.") },
114 { ERROR_INVALID_PENCIL_FILE, tr(
"The file is not valid pencil document.") },
117 auto it = msgMap.find(mCode);
118 if (it == msgMap.end())
122 return msgMap[mCode];
125bool Status::operator==(Status::ErrorCode code)
const
127 return (mCode == code);
130bool Status::operator!=(Status::ErrorCode code)
const
132 return (mCode != code);
void append(const T &value)
QString name() const const
QString join(const QString &separator) const const
QString prettyProductName()