forked from qt-creator/qt-creator
QmlDesigner: Cleanup exceptions
Remoing unused exceptions and using source_location to simplify the code. QmlDesigner::Exception is now derived from Sqlite::Exception. Task-number: QDS-14575 Change-Id: I36325e6113313ae1e6c0b0fdc183be86f920db94 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -10,8 +10,6 @@
|
|||||||
#include <qmldesignerconstants.h>
|
#include <qmldesignerconstants.h>
|
||||||
#include <qmldesignerplugin.h>
|
#include <qmldesignerplugin.h>
|
||||||
|
|
||||||
#include <invalidqmlsourceexception.h>
|
|
||||||
|
|
||||||
#include <coreplugin/messagebox.h>
|
#include <coreplugin/messagebox.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
|
@@ -116,12 +116,12 @@ T jsonSafeValue(const QJsonObject &jsonObject, const QString &symbolName,
|
|||||||
std::function<bool (const T&)> validityCheck = [](const T&) -> bool {return true;})
|
std::function<bool (const T&)> validityCheck = [](const T&) -> bool {return true;})
|
||||||
{
|
{
|
||||||
if (!jsonObject.contains(symbolName))
|
if (!jsonObject.contains(symbolName))
|
||||||
throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, symbolName.toLatin1());
|
throw InvalidArgumentException(symbolName);
|
||||||
|
|
||||||
QVariant symbolVar = jsonObject.value(symbolName);
|
QVariant symbolVar = jsonObject.value(symbolName);
|
||||||
T extractedVal = symbolVar.value<T>();
|
T extractedVal = symbolVar.value<T>();
|
||||||
if (!validityCheck(extractedVal))
|
if (!validityCheck(extractedVal))
|
||||||
throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, symbolName.toLatin1());
|
throw InvalidArgumentException(symbolName);
|
||||||
|
|
||||||
return extractedVal;
|
return extractedVal;
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ QSize jsonSafeSize(const QJsonObject &jsonObject, const QString &symbolName)
|
|||||||
if (wOk && hOk)
|
if (wOk && hOk)
|
||||||
return {cWidth, cHeight};
|
return {cWidth, cHeight};
|
||||||
}
|
}
|
||||||
throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, symbolName.toLatin1());
|
throw InvalidArgumentException(symbolName);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ T jsonSafeMetaEnum(const QJsonObject &jsonObject, const QString &symbolName = De
|
|||||||
if (ok)
|
if (ok)
|
||||||
return enumIndex;
|
return enumIndex;
|
||||||
|
|
||||||
throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, symbolName.toLatin1());
|
throw InvalidArgumentException(symbolName);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,8 +10,6 @@
|
|||||||
#include <qmldesignerconstants.h>
|
#include <qmldesignerconstants.h>
|
||||||
#include <qmldesignerplugin.h>
|
#include <qmldesignerplugin.h>
|
||||||
|
|
||||||
#include <invalidqmlsourceexception.h>
|
|
||||||
|
|
||||||
#include <coreplugin/messagebox.h>
|
#include <coreplugin/messagebox.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
|
@@ -9,8 +9,6 @@
|
|||||||
#include <qrcodegen/src/qrcodeimageprovider.h>
|
#include <qrcodegen/src/qrcodeimageprovider.h>
|
||||||
#include <theme.h>
|
#include <theme.h>
|
||||||
|
|
||||||
#include <invalidqmlsourceexception.h>
|
|
||||||
|
|
||||||
#include <coreplugin/messagebox.h>
|
#include <coreplugin/messagebox.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
|
@@ -19,7 +19,6 @@
|
|||||||
#include <designersettings.h>
|
#include <designersettings.h>
|
||||||
#include <designmodewidget.h>
|
#include <designmodewidget.h>
|
||||||
#include <import.h>
|
#include <import.h>
|
||||||
#include <invalididexception.h>
|
|
||||||
#include <itemlibraryentry.h>
|
#include <itemlibraryentry.h>
|
||||||
#include <materialutils.h>
|
#include <materialutils.h>
|
||||||
#include <modelutils.h>
|
#include <modelutils.h>
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
#include <qmldesignerconstants.h>
|
#include <qmldesignerconstants.h>
|
||||||
#include <qmltimeline.h>
|
#include <qmltimeline.h>
|
||||||
|
|
||||||
#include <invalididexception.h>
|
|
||||||
#include <rewritingexception.h>
|
#include <rewritingexception.h>
|
||||||
#include <variantproperty.h>
|
#include <variantproperty.h>
|
||||||
|
|
||||||
|
@@ -11,8 +11,6 @@
|
|||||||
#include <qmldesignerconstants.h>
|
#include <qmldesignerconstants.h>
|
||||||
#include <qmldesignerplugin.h>
|
#include <qmldesignerplugin.h>
|
||||||
|
|
||||||
#include <invalidqmlsourceexception.h>
|
|
||||||
|
|
||||||
#include <coreplugin/messagebox.h>
|
#include <coreplugin/messagebox.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
|
@@ -80,19 +80,17 @@ extend_qtc_library(QmlDesignerCore
|
|||||||
SOURCES
|
SOURCES
|
||||||
exception.cpp
|
exception.cpp
|
||||||
invalidargumentexception.cpp
|
invalidargumentexception.cpp
|
||||||
invalididexception.cpp
|
|
||||||
invalidmetainfoexception.cpp
|
|
||||||
invalidmodelnodeexception.cpp
|
|
||||||
invalidmodelstateexception.cpp
|
|
||||||
invalidpropertyexception.cpp
|
|
||||||
invalidqmlsourceexception.cpp
|
|
||||||
invalidreparentingexception.cpp
|
|
||||||
invalidslideindexexception.cpp
|
|
||||||
notimplementedexception.cpp
|
|
||||||
removebasestateexception.cpp
|
|
||||||
rewritingexception.cpp
|
rewritingexception.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
extend_qtc_library(QmlDesignerCore
|
||||||
|
CONDITION NOT USE_PROJECTSTORAGE
|
||||||
|
INCLUDES exceptions
|
||||||
|
SOURCES_PREFIX exceptions
|
||||||
|
SOURCES
|
||||||
|
invalidmetainfoexception.cpp
|
||||||
|
)
|
||||||
|
|
||||||
extend_qtc_library(QmlDesignerCore
|
extend_qtc_library(QmlDesignerCore
|
||||||
INCLUDES filemanager
|
INCLUDES filemanager
|
||||||
SOURCES_PREFIX filemanager
|
SOURCES_PREFIX filemanager
|
||||||
@@ -186,6 +184,7 @@ extend_qtc_library(QmlDesignerCore
|
|||||||
CONDITION NOT USE_PROJECTSTORAGE
|
CONDITION NOT USE_PROJECTSTORAGE
|
||||||
SOURCES_PREFIX include
|
SOURCES_PREFIX include
|
||||||
SOURCES
|
SOURCES
|
||||||
|
invalidmetainfoexception.h
|
||||||
itemlibraryinfo.h
|
itemlibraryinfo.h
|
||||||
metainforeader.h
|
metainforeader.h
|
||||||
subcomponentmanager.h
|
subcomponentmanager.h
|
||||||
@@ -214,14 +213,6 @@ extend_qtc_library(QmlDesignerCore
|
|||||||
imagecacheauxiliarydata.h
|
imagecacheauxiliarydata.h
|
||||||
import.h
|
import.h
|
||||||
invalidargumentexception.h
|
invalidargumentexception.h
|
||||||
invalididexception.h
|
|
||||||
invalidmetainfoexception.h
|
|
||||||
invalidmodelnodeexception.h
|
|
||||||
invalidmodelstateexception.h
|
|
||||||
invalidpropertyexception.h
|
|
||||||
invalidqmlsourceexception.h
|
|
||||||
invalidreparentingexception.h
|
|
||||||
invalidslideindexexception.h
|
|
||||||
iwidgetplugin.h
|
iwidgetplugin.h
|
||||||
mathutils.h
|
mathutils.h
|
||||||
modelfwd.h
|
modelfwd.h
|
||||||
@@ -233,7 +224,6 @@ extend_qtc_library(QmlDesignerCore
|
|||||||
nodelistproperty.h
|
nodelistproperty.h
|
||||||
nodemetainfo.h
|
nodemetainfo.h
|
||||||
nodeproperty.h
|
nodeproperty.h
|
||||||
notimplementedexception.h
|
|
||||||
objectpropertybinding.h
|
objectpropertybinding.h
|
||||||
projectstorageids.h
|
projectstorageids.h
|
||||||
propertybinding.h
|
propertybinding.h
|
||||||
@@ -244,7 +234,6 @@ extend_qtc_library(QmlDesignerCore
|
|||||||
qmldesignercorelib_exports.h
|
qmldesignercorelib_exports.h
|
||||||
qmldesignercorelib_global.h
|
qmldesignercorelib_global.h
|
||||||
qmldesignercoreconstants.h
|
qmldesignercoreconstants.h
|
||||||
removebasestateexception.h
|
|
||||||
rewritertransaction.h
|
rewritertransaction.h
|
||||||
rewritingexception.h
|
rewritingexception.h
|
||||||
signalhandlerproperty.h
|
signalhandlerproperty.h
|
||||||
|
@@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
#include <abstractview.h>
|
#include <abstractview.h>
|
||||||
#include <bindingproperty.h>
|
#include <bindingproperty.h>
|
||||||
#include <invalididexception.h>
|
|
||||||
#include <invalidmodelnodeexception.h>
|
|
||||||
#include <invalidreparentingexception.h>
|
|
||||||
#include <modelmerger.h>
|
#include <modelmerger.h>
|
||||||
#include <nodeabstractproperty.h>
|
#include <nodeabstractproperty.h>
|
||||||
#include <nodelistproperty.h>
|
#include <nodelistproperty.h>
|
||||||
@@ -250,20 +247,10 @@ void StylesheetMerger::preprocessStyleSheet()
|
|||||||
newParentProperty.slide(styleParentIndex, templateParentIndex);
|
newParentProperty.slide(styleParentIndex, templateParentIndex);
|
||||||
}
|
}
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
}catch (InvalidIdException &ide) {
|
} catch (Exception &exception) {
|
||||||
qDebug().noquote() << "Invalid id exception while preprocessing the style sheet.";
|
|
||||||
ide.createWarning();
|
|
||||||
} catch (InvalidReparentingException &rpe) {
|
|
||||||
qDebug().noquote() << "Invalid reparenting exception while preprocessing the style sheet.";
|
|
||||||
rpe.createWarning();
|
|
||||||
} catch (InvalidModelNodeException &mne) {
|
|
||||||
qDebug().noquote() << "Invalid model node exception while preprocessing the style sheet.";
|
|
||||||
mne.createWarning();
|
|
||||||
} catch (Exception &e) {
|
|
||||||
qDebug().noquote() << "Exception while preprocessing the style sheet.";
|
qDebug().noquote() << "Exception while preprocessing the style sheet.";
|
||||||
e.createWarning();
|
qDebug() << exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StylesheetMerger::replaceNode(ModelNode &replacedNode, ModelNode &newNode)
|
void StylesheetMerger::replaceNode(ModelNode &replacedNode, ModelNode &newNode)
|
||||||
@@ -313,18 +300,9 @@ void StylesheetMerger::replaceRootNode(ModelNode& templateRootNode)
|
|||||||
ModelNode newRoot = m_templateView->rootModelNode();
|
ModelNode newRoot = m_templateView->rootModelNode();
|
||||||
newRoot.setIdWithoutRefactoring(rootId);
|
newRoot.setIdWithoutRefactoring(rootId);
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
} catch (InvalidIdException &ide) {
|
} catch (Exception &exception) {
|
||||||
qDebug().noquote() << "Invalid id exception while replacing root node of template.";
|
|
||||||
ide.createWarning();
|
|
||||||
} catch (InvalidReparentingException &rpe) {
|
|
||||||
qDebug().noquote() << "Invalid reparenting exception while replacing root node of template.";
|
|
||||||
rpe.createWarning();
|
|
||||||
} catch (InvalidModelNodeException &mne) {
|
|
||||||
qDebug().noquote() << "Invalid model node exception while replacing root node of template.";
|
|
||||||
mne.createWarning();
|
|
||||||
} catch (Exception &e) {
|
|
||||||
qDebug().noquote() << "Exception while replacing root node of template.";
|
qDebug().noquote() << "Exception while replacing root node of template.";
|
||||||
e.createWarning();
|
qDebug() << exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,18 +375,9 @@ void StylesheetMerger::parseTemplateOptions()
|
|||||||
RewriterTransaction transaction(m_templateView, "remove-options-node");
|
RewriterTransaction transaction(m_templateView, "remove-options-node");
|
||||||
optionsNode.destroy();
|
optionsNode.destroy();
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
} catch (InvalidIdException &ide) {
|
} catch (Exception &exception) {
|
||||||
qDebug().noquote() << "Invalid id exception while removing options from template.";
|
|
||||||
ide.createWarning();
|
|
||||||
} catch (InvalidReparentingException &rpe) {
|
|
||||||
qDebug().noquote() << "Invalid reparenting exception while removing options from template.";
|
|
||||||
rpe.createWarning();
|
|
||||||
} catch (InvalidModelNodeException &mne) {
|
|
||||||
qDebug().noquote() << "Invalid model node exception while removing options from template.";
|
|
||||||
mne.createWarning();
|
|
||||||
} catch (Exception &e) {
|
|
||||||
qDebug().noquote() << "Exception while removing options from template.";
|
qDebug().noquote() << "Exception while removing options from template.";
|
||||||
e.createWarning();
|
qDebug() << exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,9 +452,9 @@ void StylesheetMerger::mergeStates(ModelNode &outputNode, const ModelNode &input
|
|||||||
ModelNode stateClone = merger.insertModel(inputStateNode);
|
ModelNode stateClone = merger.insertModel(inputStateNode);
|
||||||
if (stateClone.isValid())
|
if (stateClone.isValid())
|
||||||
outputNode.nodeListProperty("states").reparentHere(stateClone);
|
outputNode.nodeListProperty("states").reparentHere(stateClone);
|
||||||
} catch (Exception &e) {
|
} catch (Exception &exception) {
|
||||||
qDebug().noquote() << "Exception while merging states.";
|
qDebug().noquote() << "Exception while merging states.";
|
||||||
e.createWarning();
|
qDebug() << exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -542,21 +511,9 @@ void StylesheetMerger::merge()
|
|||||||
|
|
||||||
replaceNode(replacedNode, replacementNode);
|
replaceNode(replacedNode, replacementNode);
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
} catch (InvalidIdException &ide) {
|
} catch (Exception &exception) {
|
||||||
qDebug().noquote() << "Invalid id exception while replacing template node";
|
|
||||||
ide.createWarning();
|
|
||||||
continue;
|
|
||||||
} catch (InvalidReparentingException &rpe) {
|
|
||||||
qDebug().noquote() << "Invalid reparenting exception while replacing template node";
|
|
||||||
rpe.createWarning();
|
|
||||||
continue;
|
|
||||||
} catch (InvalidModelNodeException &mne) {
|
|
||||||
qDebug().noquote() << "Invalid model node exception while replacing template node";
|
|
||||||
mne.createWarning();
|
|
||||||
continue;
|
|
||||||
} catch (Exception &e) {
|
|
||||||
qDebug().noquote() << "Exception while replacing template node.";
|
qDebug().noquote() << "Exception while replacing template node.";
|
||||||
e.createWarning();
|
qDebug() << exception;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -584,21 +541,9 @@ void StylesheetMerger::merge()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
} catch (InvalidIdException &ide) {
|
} catch (Exception &exception) {
|
||||||
qDebug().noquote() << "Invalid id exception while syncing style properties to template";
|
|
||||||
ide.createWarning();
|
|
||||||
continue;
|
|
||||||
} catch (InvalidReparentingException &rpe) {
|
|
||||||
qDebug().noquote() << "Invalid reparenting exception while syncing style properties to template";
|
|
||||||
rpe.createWarning();
|
|
||||||
continue;
|
|
||||||
} catch (InvalidModelNodeException &mne) {
|
|
||||||
qDebug().noquote() << "Invalid model node exception while syncing style properties to template";
|
|
||||||
mne.createWarning();
|
|
||||||
continue;
|
|
||||||
} catch (Exception &e) {
|
|
||||||
qDebug().noquote() << "Exception while syncing style properties.";
|
qDebug().noquote() << "Exception while syncing style properties.";
|
||||||
e.createWarning();
|
qDebug() << exception;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,55 +14,9 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
/*!
|
|
||||||
\defgroup CoreExceptions
|
|
||||||
*/
|
|
||||||
/*!
|
|
||||||
\class QmlDesigner::Exception
|
|
||||||
\ingroup CoreExceptions
|
|
||||||
\brief The Exception class is the abstract base class for all exceptions.
|
|
||||||
|
|
||||||
Exceptions should be used if there is no other way to indicate that
|
|
||||||
something is going wrong. For example,
|
|
||||||
the result would be a inconsistent model or a crash.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
|
||||||
const char* demangle(const char* name)
|
|
||||||
{
|
|
||||||
char buf[1024];
|
|
||||||
size_t size = 1024;
|
|
||||||
int status;
|
|
||||||
char* res;
|
|
||||||
res = abi::__cxa_demangle(name,
|
|
||||||
buf,
|
|
||||||
&size,
|
|
||||||
&status);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
const char* demangle(const char* name)
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
bool Exception::s_shouldAssert = false;
|
|
||||||
|
|
||||||
void Exception::setShouldAssert(bool assert)
|
|
||||||
{
|
|
||||||
s_shouldAssert = assert;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Exception::shouldAssert()
|
|
||||||
{
|
|
||||||
return s_shouldAssert;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Exception::s_warnAboutException = true;
|
bool Exception::s_warnAboutException = true;
|
||||||
|
|
||||||
void Exception::setWarnAboutException(bool warn)
|
void Exception::setWarnAboutException(bool warn)
|
||||||
@@ -75,63 +29,22 @@ bool Exception::warnAboutException()
|
|||||||
return s_warnAboutException;
|
return s_warnAboutException;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
namespace {
|
||||||
static QString getBackTrace()
|
#if defined(__cpp_lib_stacktrace) && __cpp_lib_stacktrace >= 202011L
|
||||||
|
QString getBackTrace()
|
||||||
{
|
{
|
||||||
QString backTrace;
|
auto trace = std::stacktrace::current();
|
||||||
void * array[50];
|
return QString::fromStdString(std::to_string(trace));
|
||||||
int nSize = backtrace(array, 50);
|
|
||||||
char ** symbols = backtrace_symbols(array, nSize);
|
|
||||||
|
|
||||||
for (int i = 0; i < nSize; i++)
|
|
||||||
backTrace.append(QString("%1\n").arg(QLatin1String(symbols[i])));
|
|
||||||
|
|
||||||
free(symbols);
|
|
||||||
|
|
||||||
return backTrace;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
} // namespace
|
||||||
|
|
||||||
QString Exception::defaultDescription(int line, const QByteArray &function, const QByteArray &file)
|
QString Exception::defaultDescription(const Sqlite::source_location &sourceLocation)
|
||||||
{
|
{
|
||||||
return QString(QStringLiteral("file: %1, function: %2, line: %3"))
|
return QStringView(u"file: %1, function: %2, line: %3")
|
||||||
.arg(QString::fromUtf8(file), QString::fromUtf8(function), QString::number(line));
|
.arg(QLatin1StringView{sourceLocation.file_name()},
|
||||||
}
|
QLatin1StringView{sourceLocation.function_name()},
|
||||||
|
QString::number(sourceLocation.line()));
|
||||||
/*!
|
|
||||||
Constructs an exception. \a line uses the __LINE__ macro, \a function uses
|
|
||||||
the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
|
|
||||||
the __FILE__ macro.
|
|
||||||
*/
|
|
||||||
Exception::Exception(int line, const QByteArray &function, const QByteArray &file)
|
|
||||||
: Exception(line, function, file, Exception::defaultDescription(line, function, file))
|
|
||||||
{ }
|
|
||||||
|
|
||||||
Exception::Exception(int line, const QByteArray &function,
|
|
||||||
const QByteArray &file, const QString &description)
|
|
||||||
: m_line(line)
|
|
||||||
, m_function(QString::fromUtf8(function))
|
|
||||||
, m_file(QString::fromUtf8(file))
|
|
||||||
, m_description(description)
|
|
||||||
#ifdef Q_OS_LINUX
|
|
||||||
, m_backTrace(getBackTrace())
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if (s_shouldAssert) {
|
|
||||||
qDebug() << Exception::description();
|
|
||||||
QTC_ASSERT(false, ;);
|
|
||||||
Q_ASSERT(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Exception::~Exception() = default;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the unmangled backtrace of this exception as a string.
|
|
||||||
*/
|
|
||||||
QString Exception::backTrace() const
|
|
||||||
{
|
|
||||||
return m_backTrace;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Exception::createWarning() const
|
void Exception::createWarning() const
|
||||||
@@ -140,13 +53,6 @@ void Exception::createWarning() const
|
|||||||
qDebug() << *this;
|
qDebug() << *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the optional description of this exception as a string.
|
|
||||||
*/
|
|
||||||
QString Exception::description() const
|
|
||||||
{
|
|
||||||
return m_description;
|
|
||||||
}
|
|
||||||
namespace {
|
namespace {
|
||||||
std::function<void(QStringView title, QStringView description)> showExceptionCallback;
|
std::function<void(QStringView title, QStringView description)> showExceptionCallback;
|
||||||
}
|
}
|
||||||
@@ -157,7 +63,7 @@ std::function<void(QStringView title, QStringView description)> showExceptionCal
|
|||||||
void Exception::showException([[maybe_unused]] const QString &title) const
|
void Exception::showException([[maybe_unused]] const QString &title) const
|
||||||
{
|
{
|
||||||
if (showExceptionCallback)
|
if (showExceptionCallback)
|
||||||
showExceptionCallback(title, m_description);
|
showExceptionCallback(title, description());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Exception::setShowExceptionCallback(std::function<void(QStringView, QStringView)> callback)
|
void Exception::setShowExceptionCallback(std::function<void(QStringView, QStringView)> callback)
|
||||||
@@ -170,15 +76,7 @@ void Exception::setShowExceptionCallback(std::function<void(QStringView, QString
|
|||||||
*/
|
*/
|
||||||
int Exception::line() const
|
int Exception::line() const
|
||||||
{
|
{
|
||||||
return m_line;
|
return location().line();
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the function name where this exception was thrown as a string.
|
|
||||||
*/
|
|
||||||
QString Exception::function() const
|
|
||||||
{
|
|
||||||
return m_function;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -186,26 +84,25 @@ QString Exception::function() const
|
|||||||
*/
|
*/
|
||||||
QString Exception::file() const
|
QString Exception::file() const
|
||||||
{
|
{
|
||||||
return m_file;
|
return QString::fromUtf8(location().file_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const Exception &exception)
|
QDebug operator<<(QDebug debug, const Exception &exception)
|
||||||
{
|
{
|
||||||
debug.nospace() << "Exception: " << exception.type() << "\n"
|
const auto &location = exception.location();
|
||||||
"Function: " << exception.function() << "\n"
|
debug.nospace() << "Exception: " << exception.type()
|
||||||
"File: " << exception.file() << "\n"
|
<< "\n"
|
||||||
"Line: " << exception.line() << "\n";
|
"Function: "
|
||||||
|
<< location.function_name()
|
||||||
|
<< "\n"
|
||||||
|
"File: "
|
||||||
|
<< location.file_name()
|
||||||
|
<< "\n"
|
||||||
|
"Line: "
|
||||||
|
<< location.line() << "\n";
|
||||||
if (!exception.description().isEmpty())
|
if (!exception.description().isEmpty())
|
||||||
debug.nospace() << exception.description() << "\n";
|
debug.nospace() << exception.description() << "\n";
|
||||||
|
|
||||||
if (!exception.backTrace().isEmpty())
|
|
||||||
debug.nospace().noquote() << exception.backTrace();
|
|
||||||
|
|
||||||
return debug.space();
|
return debug.space();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn QString Exception::type() const
|
|
||||||
Returns the type of this exception as a string.
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
@@ -7,51 +7,39 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
/*!
|
|
||||||
\class QmlDesigner::InvalidArgumentException
|
|
||||||
\ingroup CoreExceptions
|
|
||||||
\brief The InvalidArgumentException class provides an exception for an invalid
|
|
||||||
argument.
|
|
||||||
|
|
||||||
*/
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
QString InvalidArgumentException::invalidArgumentDescription(int line,
|
using namespace Qt::StringLiterals;
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file,
|
|
||||||
const QByteArray &argument)
|
|
||||||
{
|
|
||||||
if (QString::fromUtf8(function) == QLatin1String("createNode")) {
|
|
||||||
return DesignerCore::Tr::tr("Failed to create item of type %1.").arg(QString::fromUtf8(argument));
|
|
||||||
}
|
|
||||||
|
|
||||||
return Exception::defaultDescription(line, function, file);
|
QString InvalidArgumentException::invalidArgumentDescription(const Sqlite::source_location &location,
|
||||||
|
const QString &argument)
|
||||||
|
{
|
||||||
|
if (QLatin1StringView{location.file_name()} == "createNode"_L1)
|
||||||
|
return DesignerCore::Tr::tr("Failed to create item of type %1.").arg(argument);
|
||||||
|
|
||||||
|
return Exception::defaultDescription(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
InvalidArgumentException::InvalidArgumentException(const QString &argument,
|
||||||
Constructs the exception for \a argument. \a line uses the __LINE__ macro,
|
const Sqlite::source_location &location)
|
||||||
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
|
: Exception(location)
|
||||||
the __FILE__ macro.
|
, m_argument{argument}
|
||||||
*/
|
|
||||||
InvalidArgumentException::InvalidArgumentException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file,
|
|
||||||
const QByteArray &argument)
|
|
||||||
: InvalidArgumentException(line, function, file, argument,
|
|
||||||
invalidArgumentDescription(line, function, file, argument))
|
|
||||||
{
|
{
|
||||||
createWarning();
|
createWarning();
|
||||||
}
|
}
|
||||||
|
|
||||||
InvalidArgumentException::InvalidArgumentException(int line,
|
const char *InvalidArgumentException::what() const noexcept
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file,
|
|
||||||
const QByteArray &argument,
|
|
||||||
const QString &description)
|
|
||||||
: Exception(line, function, file, description)
|
|
||||||
, m_argument(QString::fromUtf8(argument))
|
|
||||||
{
|
{
|
||||||
createWarning();
|
return "InvalidArgumentException";
|
||||||
|
}
|
||||||
|
|
||||||
|
QString InvalidArgumentException::description() const
|
||||||
|
{
|
||||||
|
if (QLatin1StringView{location().file_name()} == "createNode"_L1)
|
||||||
|
return DesignerCore::Tr::tr("Failed to create item of type %1.").arg(m_argument);
|
||||||
|
|
||||||
|
return Exception::defaultDescription(location());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -59,7 +47,7 @@ InvalidArgumentException::InvalidArgumentException(int line,
|
|||||||
*/
|
*/
|
||||||
QString InvalidArgumentException::type() const
|
QString InvalidArgumentException::type() const
|
||||||
{
|
{
|
||||||
return QLatin1String("InvalidArgumentException");
|
return "InvalidArgumentException"_L1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@@ -1,53 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#include "invalididexception.h"
|
|
||||||
|
|
||||||
#include <designercoretr.h>
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
static QString descriptionBasedOnReason(InvalidIdException::Reason reason)
|
|
||||||
{
|
|
||||||
if (reason == InvalidIdException::InvalidCharacters)
|
|
||||||
return DesignerCore::Tr::tr("Only alphanumeric characters and underscore allowed.\n"
|
|
||||||
"Ids must begin with a lowercase letter.");
|
|
||||||
|
|
||||||
return DesignerCore::Tr::tr("Ids have to be unique.");
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString decorateDescriptionWithId(const QString &id, const QString &description)
|
|
||||||
{
|
|
||||||
return DesignerCore::Tr::tr("Invalid Id: %1\n%2").arg(id, description);
|
|
||||||
}
|
|
||||||
|
|
||||||
InvalidIdException::InvalidIdException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file,
|
|
||||||
const QByteArray &id,
|
|
||||||
Reason reason)
|
|
||||||
: InvalidArgumentException(line, function, file, "id",
|
|
||||||
decorateDescriptionWithId(QString::fromUtf8(id),
|
|
||||||
descriptionBasedOnReason(reason)))
|
|
||||||
{ }
|
|
||||||
|
|
||||||
InvalidIdException::InvalidIdException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file,
|
|
||||||
const QByteArray &id,
|
|
||||||
const QByteArray &description)
|
|
||||||
: InvalidArgumentException(line, function, file, "id",
|
|
||||||
decorateDescriptionWithId(QString::fromUtf8(id),
|
|
||||||
QString::fromUtf8(description)))
|
|
||||||
{
|
|
||||||
createWarning();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString InvalidIdException::type() const
|
|
||||||
{
|
|
||||||
return QLatin1String("InvalidIdException");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -3,34 +3,27 @@
|
|||||||
|
|
||||||
#include "invalidmetainfoexception.h"
|
#include "invalidmetainfoexception.h"
|
||||||
|
|
||||||
/*!
|
|
||||||
\class QmlDesigner::InvalidMetaInfoException
|
|
||||||
\ingroup CoreExceptions
|
|
||||||
\brief The InvalidMetaInfoException class provides an exception for invalid meta
|
|
||||||
info.
|
|
||||||
|
|
||||||
\see NodeMetaInfo PropertyMetaInfo MetaInfo
|
|
||||||
*/
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
/*!
|
|
||||||
Constructs an exception. \a line uses the __LINE__ macro,
|
using namespace Qt::StringLiterals;
|
||||||
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
|
|
||||||
the __FILE__ macro.
|
InvalidMetaInfoException::InvalidMetaInfoException(const Sqlite::source_location &location)
|
||||||
*/
|
: Exception(location)
|
||||||
InvalidMetaInfoException::InvalidMetaInfoException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file)
|
|
||||||
: Exception(line, function, file)
|
|
||||||
{
|
{
|
||||||
createWarning();
|
createWarning();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString InvalidMetaInfoException::description() const
|
||||||
|
{
|
||||||
|
return defaultDescription(location());
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the type of this exception as a string.
|
Returns the type of this exception as a string.
|
||||||
*/
|
*/
|
||||||
QString InvalidMetaInfoException::type() const
|
QString InvalidMetaInfoException::type() const
|
||||||
{
|
{
|
||||||
return QLatin1String("InvalidMetaInfoException");
|
return "InvalidMetaInfoException"_L1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,36 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#include "invalidmodelnodeexception.h"
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\class QmlDesigner::InvalidModelNodeException
|
|
||||||
\ingroup CoreExceptions
|
|
||||||
\brief The InvalidModelNodeException class provides an exception for an invalid
|
|
||||||
model node.
|
|
||||||
|
|
||||||
\see ModelNode
|
|
||||||
*/
|
|
||||||
namespace QmlDesigner {
|
|
||||||
/*!
|
|
||||||
Constructs an exception. \a line uses the __LINE__ macro,
|
|
||||||
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
|
|
||||||
the __FILE__ macro.
|
|
||||||
*/
|
|
||||||
InvalidModelNodeException::InvalidModelNodeException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file)
|
|
||||||
: Exception(line, function, file)
|
|
||||||
{
|
|
||||||
createWarning();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the type of this exception as a string.
|
|
||||||
*/
|
|
||||||
QString InvalidModelNodeException::type() const
|
|
||||||
{
|
|
||||||
return QLatin1String("InvalidModelNodeException");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,37 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#include "invalidmodelstateexception.h"
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\class QmlDesigner::InvalidModelStateException
|
|
||||||
\ingroup CoreExceptions
|
|
||||||
\brief The InvalidModelStateException class provides an exception for an
|
|
||||||
invalid model state.
|
|
||||||
|
|
||||||
|
|
||||||
\see ModelState
|
|
||||||
*/
|
|
||||||
namespace QmlDesigner {
|
|
||||||
/*!
|
|
||||||
Constructs an exception. \a line uses the __LINE__ macro,
|
|
||||||
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
|
|
||||||
the __FILE__ macro.
|
|
||||||
*/
|
|
||||||
InvalidModelStateException::InvalidModelStateException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file)
|
|
||||||
: Exception(line, function, file)
|
|
||||||
{
|
|
||||||
createWarning();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the type of the exception as a string.
|
|
||||||
*/
|
|
||||||
QString InvalidModelStateException::type() const
|
|
||||||
{
|
|
||||||
return QLatin1String("InvalidModelStateException");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
|
@@ -1,44 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#include "invalidpropertyexception.h"
|
|
||||||
/*!
|
|
||||||
\class QmlDesigner::InvalidPropertyException
|
|
||||||
\ingroup CoreExceptions
|
|
||||||
\brief The InvalidPropertyException class provides an exception for an invalid
|
|
||||||
property.
|
|
||||||
|
|
||||||
\see AbstractProperty
|
|
||||||
*/
|
|
||||||
namespace QmlDesigner {
|
|
||||||
/*!
|
|
||||||
Constructs an exception. \a line uses the __LINE__ macro,
|
|
||||||
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
|
|
||||||
the __FILE__ macro.
|
|
||||||
*/
|
|
||||||
InvalidPropertyException::InvalidPropertyException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file,
|
|
||||||
const QByteArray &argument)
|
|
||||||
: Exception(line, function, file), m_argument(QString::fromLatin1(argument))
|
|
||||||
{
|
|
||||||
createWarning();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the type of this exception as a string.
|
|
||||||
*/
|
|
||||||
QString InvalidPropertyException::type() const
|
|
||||||
{
|
|
||||||
return QLatin1String("InvalidPropertyException");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the argument of the property of this exception as a string.
|
|
||||||
*/
|
|
||||||
QString InvalidPropertyException::argument() const
|
|
||||||
{
|
|
||||||
return m_argument;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
|
@@ -1,36 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#include "invalidqmlsourceexception.h"
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\class QmlDesigner::InvalidQmlSourceException
|
|
||||||
\ingroup CoreExceptions
|
|
||||||
\brief The InvalidQmlSourceException class provides an exception for invalid QML
|
|
||||||
source code.
|
|
||||||
|
|
||||||
*/
|
|
||||||
namespace QmlDesigner {
|
|
||||||
/*!
|
|
||||||
Constructs an exception for \qmlSource. \a line uses the __LINE__ macro,
|
|
||||||
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
|
|
||||||
the __FILE__ macro.
|
|
||||||
*/
|
|
||||||
InvalidQmlSourceException::InvalidQmlSourceException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file,
|
|
||||||
const QByteArray &qmlSource)
|
|
||||||
: Exception(line, function, file, QString::fromUtf8(qmlSource))
|
|
||||||
{
|
|
||||||
createWarning();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the type of the exception as a string.
|
|
||||||
*/
|
|
||||||
QString InvalidQmlSourceException::type() const
|
|
||||||
{
|
|
||||||
return QLatin1String("InvalidQmlSourceException");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
|
@@ -1,34 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#include "invalidreparentingexception.h"
|
|
||||||
/*!
|
|
||||||
\class QmlDesigner::InvalidReparentingException
|
|
||||||
\ingroup CoreExceptions
|
|
||||||
\brief The InvalidReparentingException class provides an exception for
|
|
||||||
invalid reparenting.
|
|
||||||
|
|
||||||
\see ModelNode
|
|
||||||
*/
|
|
||||||
namespace QmlDesigner {
|
|
||||||
/*!
|
|
||||||
Constructs an exception. \a line uses the __LINE__ macro,
|
|
||||||
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
|
|
||||||
the __FILE__ macro.
|
|
||||||
*/
|
|
||||||
InvalidReparentingException::InvalidReparentingException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file)
|
|
||||||
: Exception(line, function, file)
|
|
||||||
{
|
|
||||||
createWarning();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the type of this exception as a string.
|
|
||||||
*/
|
|
||||||
QString InvalidReparentingException::type() const
|
|
||||||
{
|
|
||||||
return QLatin1String("InvalidReparentingException");
|
|
||||||
}
|
|
||||||
} // namespace QmlDesigner
|
|
@@ -1,36 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#include "invalidslideindexexception.h"
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\class QmlDesigner::InvalidSlideIndexException
|
|
||||||
\ingroup CoreExceptions
|
|
||||||
\brief The InvalidSlideIndexException class provides an exception for an invalid
|
|
||||||
index for a slide.
|
|
||||||
|
|
||||||
\see ModelNode
|
|
||||||
*/
|
|
||||||
namespace QmlDesigner {
|
|
||||||
/*!
|
|
||||||
Constructs an exception. \a line uses the __LINE__ macro,
|
|
||||||
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
|
|
||||||
the __FILE__ macro.
|
|
||||||
*/
|
|
||||||
InvalidSlideIndexException::InvalidSlideIndexException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file)
|
|
||||||
: Exception(line, function, file)
|
|
||||||
{
|
|
||||||
createWarning();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the type of the exception as a string.
|
|
||||||
*/
|
|
||||||
QString InvalidSlideIndexException::type() const
|
|
||||||
{
|
|
||||||
return QLatin1String("InvalidSlideIndexException");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
|
@@ -1,19 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#include "notimplementedexception.h"
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
NotImplementedException::NotImplementedException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file):
|
|
||||||
Exception(line, function, file)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QString NotImplementedException::type() const
|
|
||||||
{
|
|
||||||
return QLatin1String("NotImplementedException");
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,36 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#include "removebasestateexception.h"
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\class QmlDesigner::RemoveBaseStateException
|
|
||||||
\ingroup CoreExceptions
|
|
||||||
\brief The RemoveBaseStateException class provides an exception if you try
|
|
||||||
to remove a BaseState.
|
|
||||||
|
|
||||||
/see NodeState ModelState
|
|
||||||
*/
|
|
||||||
namespace QmlDesigner {
|
|
||||||
/*!
|
|
||||||
Constructs an exception. \a line uses the __LINE__ macro,
|
|
||||||
\a function uses the __FUNCTION__ or the Q_FUNC_INFO macro, and \a file uses
|
|
||||||
the __FILE__ macro.
|
|
||||||
*/
|
|
||||||
RemoveBaseStateException::RemoveBaseStateException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file)
|
|
||||||
: Exception(line, function, file)
|
|
||||||
{
|
|
||||||
createWarning();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the type of this exception as a string.
|
|
||||||
*/
|
|
||||||
QString RemoveBaseStateException::type() const
|
|
||||||
{
|
|
||||||
return QLatin1String("RemoveBaseStateException");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
|
@@ -3,25 +3,38 @@
|
|||||||
|
|
||||||
#include "rewritingexception.h"
|
#include "rewritingexception.h"
|
||||||
|
|
||||||
using namespace QmlDesigner;
|
namespace QmlDesigner {
|
||||||
|
|
||||||
RewritingException::RewritingException(int line,
|
using namespace Qt::StringLiterals;
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file,
|
RewritingException::RewritingException(const QString &description,
|
||||||
const QByteArray &description,
|
const QString &documentTextContent,
|
||||||
const QString &documentTextContent)
|
const Sqlite::source_location &location)
|
||||||
: Exception(line, function, file, QString::fromUtf8(description))
|
: Exception(location)
|
||||||
|
, m_description{description}
|
||||||
, m_documentTextContent(documentTextContent)
|
, m_documentTextContent(documentTextContent)
|
||||||
{
|
{
|
||||||
createWarning();
|
createWarning();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *RewritingException::what() const noexcept
|
||||||
|
{
|
||||||
|
return "RewritingException";
|
||||||
|
}
|
||||||
|
|
||||||
|
QString RewritingException::description() const
|
||||||
|
{
|
||||||
|
return defaultDescription(location()) + ": " + m_description;
|
||||||
|
}
|
||||||
|
|
||||||
QString RewritingException::type() const
|
QString RewritingException::type() const
|
||||||
{
|
{
|
||||||
return QLatin1String("RewritingException");
|
return "RewritingException"_L1;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RewritingException::documentTextContent() const
|
QString RewritingException::documentTextContent() const
|
||||||
{
|
{
|
||||||
return m_documentTextContent;
|
return m_documentTextContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace QmlDesigner
|
||||||
|
@@ -5,55 +5,40 @@
|
|||||||
|
|
||||||
#include <qmldesignercorelib_global.h>
|
#include <qmldesignercorelib_global.h>
|
||||||
|
|
||||||
|
#include <sqliteexception.h>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT Exception
|
class QMLDESIGNERCORE_EXPORT Exception : public Sqlite::Exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Exception(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file);
|
|
||||||
virtual ~Exception();
|
|
||||||
|
|
||||||
virtual QString type() const = 0;
|
virtual QString type() const = 0;
|
||||||
QString description() const;
|
virtual QString description() const = 0;
|
||||||
|
|
||||||
void showException(const QString &title = QString()) const;
|
void showException(const QString &title = QString()) const;
|
||||||
static void setShowExceptionCallback(
|
static void setShowExceptionCallback(
|
||||||
std::function<void(QStringView title, QStringView description)> callback);
|
std::function<void(QStringView title, QStringView description)> callback);
|
||||||
|
|
||||||
int line() const;
|
int line() const;
|
||||||
QString function() const;
|
|
||||||
QString file() const;
|
QString file() const;
|
||||||
QString backTrace() const;
|
|
||||||
|
|
||||||
void createWarning() const;
|
|
||||||
|
|
||||||
static void setShouldAssert(bool assert);
|
|
||||||
static bool shouldAssert();
|
|
||||||
static void setWarnAboutException(bool warn);
|
static void setWarnAboutException(bool warn);
|
||||||
static bool warnAboutException();
|
static bool warnAboutException();
|
||||||
|
|
||||||
|
friend QDebug operator<<(QDebug debug, const Exception &exception);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Exception(int line,
|
Exception(const Sqlite::source_location &location = Sqlite::source_location::current())
|
||||||
const QByteArray &function,
|
: Sqlite::Exception{location}
|
||||||
const QByteArray &file,
|
{}
|
||||||
const QString &description);
|
|
||||||
static QString defaultDescription(int line, const QByteArray &function, const QByteArray &file);
|
static QString defaultDescription(const Sqlite::source_location &sourceLocation);
|
||||||
QString defaultDescription();
|
void createWarning() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int m_line;
|
|
||||||
const QString m_function;
|
|
||||||
const QString m_file;
|
|
||||||
const QString m_description;
|
|
||||||
const QString m_backTrace;
|
|
||||||
static bool s_shouldAssert;
|
|
||||||
static bool s_warnAboutException;
|
static bool s_warnAboutException;
|
||||||
};
|
};
|
||||||
|
|
||||||
QMLDESIGNERCORE_EXPORT QDebug operator<<(QDebug debug, const Exception &exception);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -11,24 +11,20 @@ namespace QmlDesigner {
|
|||||||
class QMLDESIGNERCORE_EXPORT InvalidArgumentException : public Exception
|
class QMLDESIGNERCORE_EXPORT InvalidArgumentException : public Exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InvalidArgumentException(int line,
|
InvalidArgumentException(
|
||||||
const QByteArray &function,
|
const QString &argument,
|
||||||
const QByteArray &file,
|
const Sqlite::source_location &location = Sqlite::source_location::current());
|
||||||
const QByteArray &argument);
|
|
||||||
|
|
||||||
|
const char *what() const noexcept override;
|
||||||
|
|
||||||
|
QString description() const override;
|
||||||
QString type() const override;
|
QString type() const override;
|
||||||
QString argument() const;
|
QString argument() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
InvalidArgumentException(int line,
|
static QString invalidArgumentDescription(const Sqlite::source_location &location,
|
||||||
const QByteArray &function,
|
const QString &argument);
|
||||||
const QByteArray &file,
|
|
||||||
const QByteArray &argument,
|
|
||||||
const QString &description);
|
|
||||||
static QString invalidArgumentDescription(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file,
|
|
||||||
const QByteArray &argument);
|
|
||||||
private:
|
private:
|
||||||
const QString m_argument;
|
const QString m_argument;
|
||||||
};
|
};
|
||||||
|
@@ -1,30 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "invalidargumentexception.h"
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT InvalidIdException : public InvalidArgumentException
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum Reason { InvalidCharacters, DuplicateId };
|
|
||||||
|
|
||||||
InvalidIdException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file,
|
|
||||||
const QByteArray &id,
|
|
||||||
Reason reason);
|
|
||||||
|
|
||||||
InvalidIdException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file,
|
|
||||||
const QByteArray &id,
|
|
||||||
const QByteArray &description);
|
|
||||||
|
|
||||||
QString type() const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
@@ -10,10 +10,10 @@ namespace QmlDesigner {
|
|||||||
class QMLDESIGNERCORE_EXPORT InvalidMetaInfoException : public Exception
|
class QMLDESIGNERCORE_EXPORT InvalidMetaInfoException : public Exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InvalidMetaInfoException(int line,
|
InvalidMetaInfoException(
|
||||||
const QByteArray &function,
|
const Sqlite::source_location &location = Sqlite::source_location::current());
|
||||||
const QByteArray &file);
|
|
||||||
|
|
||||||
|
QString description() const override;
|
||||||
QString type() const override;
|
QString type() const override;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "exception.h"
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT InvalidModelNodeException : public Exception
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
InvalidModelNodeException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file);
|
|
||||||
|
|
||||||
QString type() const override;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
@@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "exception.h"
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT InvalidModelStateException : public Exception
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
InvalidModelStateException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file);
|
|
||||||
|
|
||||||
|
|
||||||
QString type() const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
|
@@ -1,25 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "exception.h"
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT InvalidPropertyException : public Exception
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
InvalidPropertyException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file,
|
|
||||||
const QByteArray &argument);
|
|
||||||
|
|
||||||
QString type() const override;
|
|
||||||
QString argument() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const QString m_argument;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
|
@@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <exception.h>
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT InvalidQmlSourceException : public QmlDesigner::Exception
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
InvalidQmlSourceException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file,
|
|
||||||
const QByteArray &qmlSource = QByteArray());
|
|
||||||
|
|
||||||
QString type() const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
|
@@ -1,20 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "exception.h"
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT InvalidReparentingException : public Exception
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
InvalidReparentingException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file);
|
|
||||||
|
|
||||||
QString type() const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
|
@@ -1,19 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "exception.h"
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT InvalidSlideIndexException : public Exception
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
InvalidSlideIndexException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file);
|
|
||||||
QString type() const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
|
@@ -10,7 +10,6 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include "qmldesignercorelib_global.h"
|
#include "qmldesignercorelib_global.h"
|
||||||
#include "invalidmetainfoexception.h"
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QDeclarativeContext;
|
class QDeclarativeContext;
|
||||||
|
@@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "exception.h"
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT NotImplementedException : public Exception
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NotImplementedException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file);
|
|
||||||
|
|
||||||
QString type() const override;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
@@ -1,20 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <exception.h>
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT RemoveBaseStateException : public Exception
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RemoveBaseStateException(int line,
|
|
||||||
const QByteArray &function,
|
|
||||||
const QByteArray &file);
|
|
||||||
|
|
||||||
QString type() const override;
|
|
||||||
|
|
||||||
};
|
|
||||||
} // namespace QmlDesigner
|
|
@@ -10,17 +10,19 @@ namespace QmlDesigner {
|
|||||||
class QMLDESIGNERCORE_EXPORT RewritingException: public Exception
|
class QMLDESIGNERCORE_EXPORT RewritingException: public Exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RewritingException(int line,
|
RewritingException(const QString &description,
|
||||||
const QByteArray &function,
|
const QString &documentTextContent,
|
||||||
const QByteArray &file,
|
const Sqlite::source_location &location = Sqlite::source_location::current());
|
||||||
const QByteArray &description,
|
|
||||||
const QString &documentTextContent);
|
|
||||||
|
|
||||||
|
const char *what() const noexcept override;
|
||||||
|
|
||||||
|
QString description() const override;
|
||||||
QString type() const override;
|
QString type() const override;
|
||||||
QString documentTextContent() const;
|
QString documentTextContent() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString m_documentTextContent;
|
QString m_description;
|
||||||
|
QString m_documentTextContent;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
#include "nodemetainfo.h"
|
#include "nodemetainfo.h"
|
||||||
#include "qregularexpression.h"
|
#include "qregularexpression.h"
|
||||||
|
|
||||||
#include <invalidmetainfoexception.h>
|
|
||||||
#include <propertycontainer.h>
|
#include <propertycontainer.h>
|
||||||
#include <sourcepathcache.h>
|
#include <sourcepathcache.h>
|
||||||
|
|
||||||
|
@@ -46,7 +46,7 @@ void ItemLibraryInfo::addEntries(const QList<ItemLibraryEntry> &entries, bool ov
|
|||||||
for (const ItemLibraryEntry &entry : entries) {
|
for (const ItemLibraryEntry &entry : entries) {
|
||||||
const QString key = keyForEntry(entry);
|
const QString key = keyForEntry(entry);
|
||||||
if (!overwriteDuplicate && m_nameToEntryHash.contains(key))
|
if (!overwriteDuplicate && m_nameToEntryHash.contains(key))
|
||||||
throw InvalidMetaInfoException(__LINE__, __FUNCTION__, __FILE__);
|
throw InvalidMetaInfoException();
|
||||||
m_nameToEntryHash.insert(key, entry);
|
m_nameToEntryHash.insert(key, entry);
|
||||||
}
|
}
|
||||||
emit entriesChanged();
|
emit entriesChanged();
|
||||||
|
@@ -46,14 +46,14 @@ void MetaInfoReader::readMetaInfoFile(const QString &path, bool overwriteDuplica
|
|||||||
qWarning() << "readMetaInfoFile()" << path;
|
qWarning() << "readMetaInfoFile()" << path;
|
||||||
qWarning() << errors();
|
qWarning() << errors();
|
||||||
m_parserState = Error;
|
m_parserState = Error;
|
||||||
throw InvalidMetaInfoException(__LINE__, __FUNCTION__, __FILE__);
|
throw InvalidMetaInfoException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!errors().isEmpty()) {
|
if (!errors().isEmpty()) {
|
||||||
qWarning() << "readMetaInfoFile()" << path;
|
qWarning() << "readMetaInfoFile()" << path;
|
||||||
qWarning() << errors();
|
qWarning() << errors();
|
||||||
m_parserState = Error;
|
m_parserState = Error;
|
||||||
throw InvalidMetaInfoException(__LINE__, __FUNCTION__, __FILE__);
|
throw InvalidMetaInfoException();
|
||||||
}
|
}
|
||||||
syncItemLibraryEntries();
|
syncItemLibraryEntries();
|
||||||
}
|
}
|
||||||
|
@@ -34,23 +34,6 @@ QT_WARNING_DISABLE_MSVC(4996)
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
/*!
|
|
||||||
\class QmlDesigner::NodeMetaInfo
|
|
||||||
\ingroup CoreModel
|
|
||||||
\brief The NodeMetaInfo class provides meta information about a qml type.
|
|
||||||
|
|
||||||
A NodeMetaInfo object can be created via ModelNode::metaInfo, or MetaInfo::nodeMetaInfo.
|
|
||||||
|
|
||||||
The object can be invalid - you can check this by calling isValid().
|
|
||||||
The object is invalid if you ask for meta information for
|
|
||||||
an non-existing qml property. Also the node meta info can become invalid
|
|
||||||
if the enclosing type is deregistered from the meta type system (e.g.
|
|
||||||
a sub component qml file is deleted). Trying to call any accessor functions on an invalid
|
|
||||||
NodeMetaInfo object will result in an InvalidMetaInfoException being thrown.
|
|
||||||
|
|
||||||
\see QmlDesigner::MetaInfo, QmlDesigner::PropertyMetaInfo, QmlDesigner::EnumeratorMetaInfo
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using Storage::ModuleKind;
|
using Storage::ModuleKind;
|
||||||
|
@@ -915,11 +915,7 @@ void ModelPrivate::resetModelByRewriter(const QString &description)
|
|||||||
if (m_rewriterView) {
|
if (m_rewriterView) {
|
||||||
m_rewriterView->resetToLastCorrectQml();
|
m_rewriterView->resetToLastCorrectQml();
|
||||||
|
|
||||||
throw RewritingException(__LINE__,
|
throw RewritingException(description, rewriterView()->textModifierContent());
|
||||||
__FUNCTION__,
|
|
||||||
__FILE__,
|
|
||||||
description.toUtf8(),
|
|
||||||
rewriterView()->textModifierContent());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,9 +3,6 @@
|
|||||||
|
|
||||||
#include "nodeabstractproperty.h"
|
#include "nodeabstractproperty.h"
|
||||||
#include "nodeproperty.h"
|
#include "nodeproperty.h"
|
||||||
#include "invalidmodelnodeexception.h"
|
|
||||||
#include "invalidpropertyexception.h"
|
|
||||||
#include "invalidreparentingexception.h"
|
|
||||||
#include "internalnodeabstractproperty.h"
|
#include "internalnodeabstractproperty.h"
|
||||||
#include "internalnode_p.h"
|
#include "internalnode_p.h"
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
|
@@ -480,11 +480,7 @@ void RewriterView::applyChanges()
|
|||||||
qDebug().noquote() << "RewriterView::applyChanges() got called while in error state. Will "
|
qDebug().noquote() << "RewriterView::applyChanges() got called while in error state. Will "
|
||||||
"do a quick-exit now.";
|
"do a quick-exit now.";
|
||||||
qDebug().noquote() << "Content: " << content;
|
qDebug().noquote() << "Content: " << content;
|
||||||
throw RewritingException(__LINE__,
|
throw RewritingException("RewriterView::applyChanges() already in error state", content);
|
||||||
__FUNCTION__,
|
|
||||||
__FILE__,
|
|
||||||
"RewriterView::applyChanges() already in error state",
|
|
||||||
content);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_differenceHandling = Validate;
|
m_differenceHandling = Validate;
|
||||||
@@ -508,11 +504,7 @@ void RewriterView::applyChanges()
|
|||||||
qDebug().noquote() << "Content: " << content;
|
qDebug().noquote() << "Content: " << content;
|
||||||
if (!errors().isEmpty())
|
if (!errors().isEmpty())
|
||||||
qDebug().noquote() << "Error:" << errors().constFirst().description();
|
qDebug().noquote() << "Error:" << errors().constFirst().description();
|
||||||
throw RewritingException(__LINE__,
|
throw RewritingException(m_rewritingErrorMessage, content);
|
||||||
__FUNCTION__,
|
|
||||||
__FILE__,
|
|
||||||
qPrintable(m_rewritingErrorMessage),
|
|
||||||
content);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -233,12 +233,6 @@ static bool documentIsAlreadyOpen(DesignDocument *designDocument, Core::IEditor
|
|||||||
&& designDocument->fileName() == editor->document()->filePath();
|
&& designDocument->fileName() == editor->document()->filePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool shouldAssertInException()
|
|
||||||
{
|
|
||||||
QProcessEnvironment processEnvironment = QProcessEnvironment::systemEnvironment();
|
|
||||||
return !processEnvironment.value("QMLDESIGNER_ASSERT_ON_EXCEPTION").isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool warningsForQmlFilesInsteadOfUiQmlEnabled()
|
static bool warningsForQmlFilesInsteadOfUiQmlEnabled()
|
||||||
{
|
{
|
||||||
return QmlDesignerPlugin::settings().value(DesignerSettingsKey::WARNING_FOR_QML_FILES_INSTEAD_OF_UIQML_FILES).toBool();
|
return QmlDesignerPlugin::settings().value(DesignerSettingsKey::WARNING_FOR_QML_FILES_INSTEAD_OF_UIQML_FILES).toBool();
|
||||||
@@ -247,18 +241,6 @@ static bool warningsForQmlFilesInsteadOfUiQmlEnabled()
|
|||||||
QmlDesignerPlugin::QmlDesignerPlugin()
|
QmlDesignerPlugin::QmlDesignerPlugin()
|
||||||
{
|
{
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
// Exceptions should never ever assert: they are handled in a number of
|
|
||||||
// places where it is actually VALID AND EXPECTED BEHAVIOUR to get an
|
|
||||||
// exception.
|
|
||||||
// If you still want to see exactly where the exception originally
|
|
||||||
// occurred, then you have various ways to do this:
|
|
||||||
// 1. set a breakpoint on the constructor of the exception
|
|
||||||
// 2. in gdb: "catch throw" or "catch throw Exception"
|
|
||||||
// 3. set a breakpoint on __raise_exception()
|
|
||||||
// And with gdb, you can even do this from your ~/.gdbinit file.
|
|
||||||
// DnD is not working with gdb so this is still needed to get a good stacktrace
|
|
||||||
|
|
||||||
Exception::setShouldAssert(shouldAssertInException());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlDesignerPlugin::~QmlDesignerPlugin()
|
QmlDesignerPlugin::~QmlDesignerPlugin()
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
#include "qml3dnode.h"
|
#include "qml3dnode.h"
|
||||||
#include "auxiliarydataproperties.h"
|
#include "auxiliarydataproperties.h"
|
||||||
#include "bindingproperty.h"
|
#include "bindingproperty.h"
|
||||||
#include "invalidmodelnodeexception.h"
|
|
||||||
#include "nodehints.h"
|
#include "nodehints.h"
|
||||||
#include "nodelistproperty.h"
|
#include "nodelistproperty.h"
|
||||||
#include "qmlanchors.h"
|
#include "qmlanchors.h"
|
||||||
|
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include <auxiliarydataproperties.h>
|
#include <auxiliarydataproperties.h>
|
||||||
#include <designersettings.h>
|
#include <designersettings.h>
|
||||||
#include <invalidmodelnodeexception.h>
|
|
||||||
|
|
||||||
#include <qmltimeline.h>
|
#include <qmltimeline.h>
|
||||||
|
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
#include "abstractview.h"
|
#include "abstractview.h"
|
||||||
#include <nodelistproperty.h>
|
#include <nodelistproperty.h>
|
||||||
#include <variantproperty.h>
|
#include <variantproperty.h>
|
||||||
#include <invalidmodelnodeexception.h>
|
|
||||||
#include "bindingproperty.h"
|
#include "bindingproperty.h"
|
||||||
#include "qmlchangeset.h"
|
#include "qmlchangeset.h"
|
||||||
#include "qmlitemnode.h"
|
#include "qmlitemnode.h"
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
#include "qmltimelinekeyframegroup.h"
|
#include "qmltimelinekeyframegroup.h"
|
||||||
|
|
||||||
#include <auxiliarydataproperties.h>
|
#include <auxiliarydataproperties.h>
|
||||||
#include <invalidmodelnodeexception.h>
|
|
||||||
#include <nodelistproperty.h>
|
#include <nodelistproperty.h>
|
||||||
#include <variantproperty.h>
|
#include <variantproperty.h>
|
||||||
|
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
#include "qmlitemnode.h"
|
#include "qmlitemnode.h"
|
||||||
|
|
||||||
#include <auxiliarydataproperties.h>
|
#include <auxiliarydataproperties.h>
|
||||||
#include <invalidmodelnodeexception.h>
|
|
||||||
#include <nodelistproperty.h>
|
#include <nodelistproperty.h>
|
||||||
#include <variantproperty.h>
|
#include <variantproperty.h>
|
||||||
|
|
||||||
|
@@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#include <designersettings.h>
|
#include <designersettings.h>
|
||||||
#include <externaldependenciesinterface.h>
|
#include <externaldependenciesinterface.h>
|
||||||
#include <invalididexception.h>
|
|
||||||
#include <invalidmodelnodeexception.h>
|
|
||||||
#include <model.h>
|
#include <model.h>
|
||||||
#include <modelmerger.h>
|
#include <modelmerger.h>
|
||||||
#include <modelnode.h>
|
#include <modelnode.h>
|
||||||
|
@@ -69,16 +69,7 @@ extend_qtc_library(TestDesignerCore
|
|||||||
SOURCES
|
SOURCES
|
||||||
exception.cpp
|
exception.cpp
|
||||||
invalidargumentexception.cpp
|
invalidargumentexception.cpp
|
||||||
invalididexception.cpp
|
|
||||||
invalidmetainfoexception.cpp
|
invalidmetainfoexception.cpp
|
||||||
invalidmodelnodeexception.cpp
|
|
||||||
invalidmodelstateexception.cpp
|
|
||||||
invalidpropertyexception.cpp
|
|
||||||
invalidqmlsourceexception.cpp
|
|
||||||
invalidreparentingexception.cpp
|
|
||||||
invalidslideindexexception.cpp
|
|
||||||
notimplementedexception.cpp
|
|
||||||
removebasestateexception.cpp
|
|
||||||
rewritingexception.cpp
|
rewritingexception.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -192,14 +183,7 @@ extend_qtc_library(TestDesignerCore
|
|||||||
imagecacheauxiliarydata.h
|
imagecacheauxiliarydata.h
|
||||||
import.h
|
import.h
|
||||||
invalidargumentexception.h
|
invalidargumentexception.h
|
||||||
invalididexception.h
|
|
||||||
invalidmetainfoexception.h
|
invalidmetainfoexception.h
|
||||||
invalidmodelnodeexception.h
|
|
||||||
invalidmodelstateexception.h
|
|
||||||
invalidpropertyexception.h
|
|
||||||
invalidqmlsourceexception.h
|
|
||||||
invalidreparentingexception.h
|
|
||||||
invalidslideindexexception.h
|
|
||||||
iwidgetplugin.h
|
iwidgetplugin.h
|
||||||
mathutils.h
|
mathutils.h
|
||||||
modelfwd.h
|
modelfwd.h
|
||||||
@@ -211,7 +195,6 @@ extend_qtc_library(TestDesignerCore
|
|||||||
nodelistproperty.h
|
nodelistproperty.h
|
||||||
nodemetainfo.h
|
nodemetainfo.h
|
||||||
nodeproperty.h
|
nodeproperty.h
|
||||||
notimplementedexception.h
|
|
||||||
objectpropertybinding.h
|
objectpropertybinding.h
|
||||||
projectstorageids.h
|
projectstorageids.h
|
||||||
propertybinding.h
|
propertybinding.h
|
||||||
@@ -222,7 +205,6 @@ extend_qtc_library(TestDesignerCore
|
|||||||
qmldesignercorelib_exports.h
|
qmldesignercorelib_exports.h
|
||||||
qmldesignercorelib_global.h
|
qmldesignercorelib_global.h
|
||||||
qmldesignercoreconstants.h
|
qmldesignercoreconstants.h
|
||||||
removebasestateexception.h
|
|
||||||
rewritertransaction.h
|
rewritertransaction.h
|
||||||
rewritingexception.h
|
rewritingexception.h
|
||||||
signalhandlerproperty.h
|
signalhandlerproperty.h
|
||||||
|
Reference in New Issue
Block a user