forked from qt-creator/qt-creator
Fixed missing text/design mode sync warnings
Task-number: BAUHAUS-565 Reviewed-by:erikv
This commit is contained in:
@@ -72,19 +72,13 @@ public:
|
|||||||
enum Type {
|
enum Type {
|
||||||
NoError = 0,
|
NoError = 0,
|
||||||
InternalError = 1,
|
InternalError = 1,
|
||||||
ParseError = 2,
|
ParseError = 2
|
||||||
EngineError = 3
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Error();
|
Error();
|
||||||
Error(const QDeclarativeError &qmlError);
|
Error(const QDeclarativeError &qmlError);
|
||||||
Error(Exception *exception);
|
Error(Exception *exception);
|
||||||
Error(const QUrl &url,
|
|
||||||
const QString &description,
|
|
||||||
int line = -1,
|
|
||||||
int column = -1,
|
|
||||||
Type type = EngineError);
|
|
||||||
|
|
||||||
Type type() const
|
Type type() const
|
||||||
{ return m_type; }
|
{ return m_type; }
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
void applyChanges();
|
void applyChanges();
|
||||||
|
|
||||||
|
bool hasNoPendingChanges() const
|
||||||
|
{ return m_rewriteActions.isEmpty(); }
|
||||||
|
|
||||||
void nodeCreated(const ModelNode &createdNode);
|
void nodeCreated(const ModelNode &createdNode);
|
||||||
void nodeRemoved(const ModelNode &removedNode, const NodeAbstractProperty &parentProperty, PropertyChangeFlags propertyChange);
|
void nodeRemoved(const ModelNode &removedNode, const NodeAbstractProperty &parentProperty, PropertyChangeFlags propertyChange);
|
||||||
void propertiesRemoved(const QList<AbstractProperty>& propertyList);
|
void propertiesRemoved(const QList<AbstractProperty>& propertyList);
|
||||||
|
|||||||
@@ -71,15 +71,6 @@ RewriterView::Error::Error(const QDeclarativeError &qmlError):
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
RewriterView::Error::Error(const QUrl &url, const QString &description, int line,
|
|
||||||
int column, Type type):
|
|
||||||
m_type(type),
|
|
||||||
m_line(line),
|
|
||||||
m_column(column),
|
|
||||||
m_description(description),
|
|
||||||
m_url(url)
|
|
||||||
{}
|
|
||||||
|
|
||||||
QString RewriterView::Error::toString() const
|
QString RewriterView::Error::toString() const
|
||||||
{
|
{
|
||||||
QString str;
|
QString str;
|
||||||
@@ -342,6 +333,9 @@ void RewriterView::rootNodeTypeChanged(const QString &type, int majorVersion, in
|
|||||||
|
|
||||||
void RewriterView::customNotification(const AbstractView * /*view*/, const QString &identifier, const QList<ModelNode> & /* nodeList */, const QList<QVariant> & /*data */)
|
void RewriterView::customNotification(const AbstractView * /*view*/, const QString &identifier, const QList<ModelNode> & /* nodeList */, const QList<QVariant> & /*data */)
|
||||||
{
|
{
|
||||||
|
if (identifier == StartRewriterAmend || identifier == EndRewriterAmend)
|
||||||
|
return; // we emitted this ourselves, so just ignore these notifications.
|
||||||
|
|
||||||
if (identifier == ("__start rewriter transaction__")) {
|
if (identifier == ("__start rewriter transaction__")) {
|
||||||
transactionLevel++;
|
transactionLevel++;
|
||||||
setModificationGroupActive(true);
|
setModificationGroupActive(true);
|
||||||
@@ -396,6 +390,9 @@ void RewriterView::applyModificationGroupChanges()
|
|||||||
|
|
||||||
void RewriterView::applyChanges()
|
void RewriterView::applyChanges()
|
||||||
{
|
{
|
||||||
|
if (modelToTextMerger()->hasNoPendingChanges())
|
||||||
|
return; // quick exit: nothing to be done.
|
||||||
|
|
||||||
clearErrors();
|
clearErrors();
|
||||||
|
|
||||||
if (inErrorState()) {
|
if (inErrorState()) {
|
||||||
|
|||||||
@@ -103,7 +103,12 @@ DocumentWarningWidget::DocumentWarningWidget(DesignModeWidget *parent) :
|
|||||||
void DocumentWarningWidget::setError(const RewriterView::Error &error)
|
void DocumentWarningWidget::setError(const RewriterView::Error &error)
|
||||||
{
|
{
|
||||||
m_error = error;
|
m_error = error;
|
||||||
QString str = tr("%3 (%1:%2)").arg(QString::number(error.line()), QString::number(error.column()), error.description());
|
QString str;
|
||||||
|
if (error.type() == RewriterView::Error::ParseError) {
|
||||||
|
str = tr("%3 (%1:%2)").arg(QString::number(error.line()), QString::number(error.column()), error.description());
|
||||||
|
} else if (error.type() == RewriterView::Error::InternalError) {
|
||||||
|
str = tr("Internal error (%1)") .arg(error.description());
|
||||||
|
}
|
||||||
|
|
||||||
m_errorMessage->setText(str);
|
m_errorMessage->setText(str);
|
||||||
resize(layout()->totalSizeHint());
|
resize(layout()->totalSizeHint());
|
||||||
|
|||||||
Reference in New Issue
Block a user