Commit cdcaca42 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner: Add QmlDesignerWarning



This adds a general asynchronous warning to the QmlDesigner.

Change-Id: Idf7989c52108f454191650fbb971261e1119ca09
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent 539da9fe
......@@ -45,6 +45,8 @@
#include <nodeabstractproperty.h>
#include <rewriterview.h>
#include <qmldesignerwarning.h>
#include <coreplugin/icore.h>
#include <utils/fileutils.h>
......@@ -156,9 +158,9 @@ void PropertyEditorView::changeValue(const QString &name)
value->setValue(m_selectedNode.id());
m_locked = false;
if (!m_selectedNode.isValidId(newId))
QMessageBox::warning(Core::ICore::dialogParent(), tr("Invalid Id"), tr("%1 is an invalid id.").arg(newId));
QmlDesignerWarning::show(tr("Invalid Id"), tr("%1 is an invalid id.").arg(newId));
else
QMessageBox::warning(Core::ICore::dialogParent(), tr("Invalid Id"), tr("%1 already exists.").arg(newId));
QmlDesignerWarning::show(tr("Invalid Id"), tr("%1 already exists.").arg(newId));
}
return;
}
......
......@@ -30,6 +30,8 @@
#include "stateseditormodel.h"
#include "stateseditorview.h"
#include <qmldesignerwarning.h>
#include <QDebug>
#include <QMessageBox>
......@@ -171,7 +173,7 @@ void StatesEditorModel::renameState(int nodeId, const QString &newName)
return;
if (newName.isEmpty() ||! m_statesEditorView->validStateName(newName)) {
QMessageBox::warning(Core::ICore::dialogParent(), tr("Invalid state name"),
QmlDesignerWarning::show(tr("Invalid state name"),
newName.isEmpty() ?
tr("The empty string as a name is reserved for the base state.") :
tr("Name already used in another state"));
......
......@@ -33,6 +33,8 @@
#include "metainforeader.h"
#include "iwidgetplugin.h"
#include <qmldesignerwarning.h>
#include "pluginmanager/widgetpluginmanager.h"
......@@ -102,8 +104,7 @@ void MetaInfoPrivate::parseItemLibraryDescriptions()
} catch (InvalidMetaInfoException &e) {
qWarning() << e.description();
const QString errorMessage = plugin->metaInfo() + QLatin1Char('\n') + QLatin1Char('\n') + reader.errors().join(QLatin1String("\n"));
QMessageBox::critical(0,
QCoreApplication::translate("QmlDesigner::Internal::MetaInfoPrivate", "Invalid meta info"),
QmlDesignerWarning::show(QCoreApplication::translate("QmlDesigner::Internal::MetaInfoPrivate", "Invalid meta info"),
errorMessage);
}
}
......
......@@ -34,6 +34,8 @@
#include "model.h"
#include "metainforeader.h"
#include <qmldesignerwarning.h>
#include <utils/hostosinfo.h>
#include <QDir>
......@@ -249,8 +251,7 @@ void SubComponentManager::parseDirectory(const QString &canonicalDirPath, bool a
} catch (InvalidMetaInfoException &e) {
qWarning() << e.description();
const QString errorMessage = metaInfoFile.absoluteFilePath() + QLatin1Char('\n') + QLatin1Char('\n') + reader.errors().join(QLatin1String("\n"));
QMessageBox::critical(0,
QCoreApplication::translate("SubComponentManager::parseDirectory", "Invalid meta info"),
QmlDesignerWarning::show(QCoreApplication::translate("SubComponentManager::parseDirectory", "Invalid meta info"),
errorMessage);
}
}
......
......@@ -6,7 +6,8 @@ HEADERS += $$PWD/qmldesignerconstants.h \
$$PWD/settingspage.h \
$$PWD/designmodecontext.h \
$$PWD/documentmanager.h \
$$PWD/styledoutputpaneplaceholder.h
$$PWD/styledoutputpaneplaceholder.h \
$$PWD/qmldesignerwarning.h
SOURCES += $$PWD/qmldesignerplugin.cpp \
$$PWD/shortcutmanager.cpp \
......@@ -15,6 +16,7 @@ SOURCES += $$PWD/qmldesignerplugin.cpp \
$$PWD/settingspage.cpp \
$$PWD/designmodecontext.cpp \
$$PWD/documentmanager.cpp \
$$PWD/styledoutputpaneplaceholder.cpp
$$PWD/styledoutputpaneplaceholder.cpp \
$$PWD/qmldesignerwarning.cpp
FORMS += $$PWD/settingspage.ui
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "qmldesignerwarning.h"
#include <coreplugin/icore.h>
#include <QMessageBox>
void QmlDesigner::QmlDesignerWarning::show(const QString &title, const QString &desciption)
{
QMessageBox *messageBox = new QMessageBox(QMessageBox::Warning, title, desciption, QMessageBox::
Ok, Core::ICore::dialogParent());
messageBox->setAttribute(Qt::WA_DeleteOnClose);
messageBox->setModal(true);
messageBox->show();
}
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef QMLDESIGNERWARNING_H
#define QMLDESIGNERWARNING_H
#include <QString>
namespace QmlDesigner {
class QmlDesignerWarning
{
public:
static void show(const QString &title, const QString &desciption);
};
} //QmlDesigner
#endif // QMLDESIGNERWARNING_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment