diff options
author | Sandro S. Andrade <sandroandrade@kde.org> | 2013-10-30 12:02:57 -0300 |
---|---|---|
committer | Sandro S. Andrade <sandroandrade@kde.org> | 2013-10-30 16:06:59 +0100 |
commit | f98e8a71f149e01bf2f86260b5361b653951cfdc (patch) | |
tree | d53c8234c914eb0d7166c511e75e9ae63efbb106 | |
parent | 40ca2a15895df77bf3e953365b2980428e747210 (diff) |
Move DuSE-MT concrete syntax view from core to plugin
Change-Id: I0d855323a9d4e74bc79b4f75a0ab7e0dfc71fa7a
Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
13 files changed, 185 insertions, 66 deletions
diff --git a/examples/uml/duse-mt/src/app/duse-mt.qrc b/examples/uml/duse-mt/src/app/duse-mt.qrc index f9fb4486..78c0a214 100644 --- a/examples/uml/duse-mt/src/app/duse-mt.qrc +++ b/examples/uml/duse-mt/src/app/duse-mt.qrc @@ -15,7 +15,6 @@ <file>icons/duse-mt-64x64.png</file> <file>icons/duse-mt-128x128.png</file> <file>qml/grid.png</file> - <file>qml/modelview.qml</file> <file>qml/paretofrontview.qml</file> <file>metamodels/PrimitiveTypes.xmi</file> <file>metamodels/UML.xmi</file> diff --git a/examples/uml/duse-mt/src/app/mainwindow.ui b/examples/uml/duse-mt/src/app/mainwindow.ui index 175cf648..636d62f9 100644 --- a/examples/uml/duse-mt/src/app/mainwindow.ui +++ b/examples/uml/duse-mt/src/app/mainwindow.ui @@ -36,28 +36,6 @@ <property name="currentIndex"> <number>0</number> </property> - <widget class="QWidget" name="tabModelView"> - <attribute name="title"> - <string>Input Model</string> - </attribute> - <layout class="QGridLayout" name="gridLayout_11"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item row="0" column="0"> - <widget class="QWidget" name="modelViewWidget" native="true"/> - </item> - </layout> - </widget> <widget class="QWidget" name="tabDesignSpaceLocationView"> <attribute name="title"> <string>Current Design Space Location</string> diff --git a/examples/uml/duse-mt/src/app/shell/mainwindow.cpp b/examples/uml/duse-mt/src/app/shell/mainwindow.cpp index b3625993..f33bbbaa 100644 --- a/examples/uml/duse-mt/src/app/shell/mainwindow.cpp +++ b/examples/uml/duse-mt/src/app/shell/mainwindow.cpp @@ -94,8 +94,6 @@ MainWindow::MainWindow(QWidget *parent) : _newModelDialog(new QDialog(this)), _newModel(new Ui::NewModel), _newDuseDesign(new NewDuseDesign(this)), -// _welcomeQuickView(new QQuickView), - _modelQuickView(new QQuickView), _designSpaceQuickView(new QQuickView), _metricsQuickView(new QQuickView), _paretoFrontQuickView(new QQuickView) @@ -113,26 +111,18 @@ MainWindow::MainWindow(QWidget *parent) : ui->tblDesignSpace->resizeColumnToContents(1); ui->tblDesignSpace->resizeColumnToContents(2); - _modelQuickView->setSource(QUrl("qrc:/qml/modelview.qml")); - ui->gridLayout_11->addWidget(QWidget::createWindowContainer(_modelQuickView, ui->modelViewWidget), 0, 0, 1, 1); - _metricsQuickView->setSource(QUrl("qml/dialcontrol/dialcontrol.qml")); ui->gridLayout_10->addWidget(QWidget::createWindowContainer(_metricsQuickView, ui->metricsLayout), 0, 0, 1, 1); _paretoFrontQuickView->setSource(QUrl("qrc:/qml/paretofrontview.qml")); ui->gridLayout_12->addWidget(QWidget::createWindowContainer(_paretoFrontQuickView, ui->paretoFrontViewWidget), 0, 0, 1, 1); -// _welcomeQuickView->setSource(QUrl("qrc:/qml/welcomeview.qml")); -// ui->gridLayout_13->addWidget(QWidget::createWindowContainer(_welcomeQuickView, ui->welcomeViewWidget), 0, 0, 1, 1); - _designSpaceQuickView->setSource(QUrl("qrc:/qml/designspaceview.qml")); ui->gridLayout_15->addWidget(QWidget::createWindowContainer(_designSpaceQuickView, ui->designSpaceLocationViewWidget), 0, 0, 1, 1); - _modelQuickView->setResizeMode(QQuickView::SizeRootObjectToView); _designSpaceQuickView->setResizeMode(QQuickView::SizeRootObjectToView); _metricsQuickView->setResizeMode(QQuickView::SizeRootObjectToView); _paretoFrontQuickView->setResizeMode(QQuickView::SizeRootObjectToView); -// _welcomeQuickView->setResizeMode(QQuickView::SizeRootObjectToView); readSettings(); } @@ -223,8 +213,6 @@ void MainWindow::on_actionFileNewDuseDesign_triggered() // delete object; // _inputModel = loadXmi(_currentFileName); - _modelQuickView->setClearBeforeRendering(true); - _modelQuickView->setSource(QUrl("qrc:/qml/modelview.qml")); addToView(_inputModel[0]); // QScriptValue value = _engine.evaluate("function checkProfile() \ @@ -353,24 +341,25 @@ void MainWindow::on_centralWidget_currentChanged(int) { // if (_currentFileName.isEmpty()) // return; - if (ui->centralWidget->currentIndex() == 1) { +// if (ui->centralWidget->currentIndex() == 1) { // foreach (QWrappedObject *object, _inputModel) // delete object; // _inputModel = loadXmi(_currentFileName); - evaluateQualityMetrics(); - } - else if (ui->centralWidget->currentIndex() == 2) { +// evaluateQualityMetrics(); +// } +// else if (ui->centralWidget->currentIndex() == 2) { // foreach (QWrappedObject *object, _designSpaceLocation) // delete object; // _designSpaceLocation = loadXmi("/data/devel/qtmodeling/examples/uml/r1.xmi"); - addToDesignSpaceView(_designSpaceLocation.first()); - evaluateQualityMetrics(); - } - else if (ui->centralWidget->currentIndex() == 3) { +// addToDesignSpaceView(_designSpaceLocation.first()); +// evaluateQualityMetrics(); +// } +// else if (ui->centralWidget->currentIndex() == 3) { // foreach (QWrappedObject *object, _designSpaceLocation) // delete object; - } +// } } + void MainWindow::on_btnOptimize_clicked() { progress = new QProgressDialog("Optimizing architecture", "Abort", 0, 100, this); @@ -413,27 +402,27 @@ void MainWindow::metaModelChanged(QString newMetaModel) void MainWindow::addToView(QModelingElement *modelingObject, QQuickItem *parent) { - QQmlContext *context = new QQmlContext(_modelQuickView->engine()->rootContext()); - //modelingObject->setQmlContextProperties(context); - _qmlComponent = new QQmlComponent(_modelQuickView->engine()); - int x = qrand() % 400; - int y = qrand() % 400; - _qmlComponent->setData(QString("import QtQuick 2.0\nimport QtModeling.Uml 1.0\n\n%1 { x: %2; y: %3}").arg(QString(modelingObject->asQModelingObject()->metaObject()->className()).remove(QRegularExpression("^Q"))).arg(x).arg(y).toLatin1(), QUrl()); - - QQuickItem *item = 0; - if (_qmlComponent->isError()) { - qWarning() << _qmlComponent->errors(); - } else { - item = qobject_cast<QQuickItem *>(_qmlComponent->create(context)); - if (item) { - item->setParentItem(parent ? parent:(qobject_cast<QQuickFlickable *>(_modelQuickView->rootObject()))->contentItem()); - } - } +// QQmlContext *context = new QQmlContext(_modelQuickView->engine()->rootContext()); +// //modelingObject->setQmlContextProperties(context); +// _qmlComponent = new QQmlComponent(_modelQuickView->engine()); +// int x = qrand() % 400; +// int y = qrand() % 400; +// _qmlComponent->setData(QString("import QtQuick 2.0\nimport QtModeling.Uml 1.0\n\n%1 { x: %2; y: %3}").arg(QString(modelingObject->asQModelingObject()->metaObject()->className()).remove(QRegularExpression("^Q"))).arg(x).arg(y).toLatin1(), QUrl()); + +// QQuickItem *item = 0; +// if (_qmlComponent->isError()) { +// qWarning() << _qmlComponent->errors(); +// } else { +// item = qobject_cast<QQuickItem *>(_qmlComponent->create(context)); +// if (item) { +// item->setParentItem(parent ? parent:(qobject_cast<QQuickFlickable *>(_modelQuickView->rootObject()))->contentItem()); +// } +// } - foreach (QObject *child, modelingObject->asQModelingObject()->children()) - addToView(dynamic_cast<QModelingElement *>(qModelingElement(child))); +// foreach (QObject *child, modelingObject->asQModelingObject()->children()) +// addToView(dynamic_cast<QModelingElement *>(qModelingElement(child))); - _qmlComponent->deleteLater(); +// _qmlComponent->deleteLater(); } void MainWindow::addToDesignSpaceView(QModelingElement *modelingObject, QQuickItem *parent) diff --git a/examples/uml/duse-mt/src/app/shell/mainwindow.h b/examples/uml/duse-mt/src/app/shell/mainwindow.h index f9c13bfe..9b0e6075 100644 --- a/examples/uml/duse-mt/src/app/shell/mainwindow.h +++ b/examples/uml/duse-mt/src/app/shell/mainwindow.h @@ -125,8 +125,6 @@ private: NewDuseDesign *_newDuseDesign; QQmlComponent *_qmlComponent; -// QQuickView *_welcomeQuickView; - QQuickView *_modelQuickView; QQuickView *_designSpaceQuickView; QQuickView *_metricsQuickView; QQuickView *_paretoFrontQuickView; diff --git a/examples/uml/duse-mt/src/plugins/concretesyntaxview/concretesyntaxview.json b/examples/uml/duse-mt/src/plugins/concretesyntaxview/concretesyntaxview.json new file mode 100644 index 00000000..86c0672f --- /dev/null +++ b/examples/uml/duse-mt/src/plugins/concretesyntaxview/concretesyntaxview.json @@ -0,0 +1,5 @@ +{ + "Category": "Test", + "Vendor": "Qt Project", + "Version": "1.0" +} diff --git a/examples/uml/duse-mt/src/plugins/concretesyntaxview/concretesyntaxview.pro b/examples/uml/duse-mt/src/plugins/concretesyntaxview/concretesyntaxview.pro new file mode 100644 index 00000000..bbd0f8f7 --- /dev/null +++ b/examples/uml/duse-mt/src/plugins/concretesyntaxview/concretesyntaxview.pro @@ -0,0 +1,15 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2013-10-25T17:38:51 +# +#------------------------------------------------- + +include(../../duse-mt-plugin.pri) + +SOURCES += concretesyntaxviewplugin.cpp + +HEADERS += concretesyntaxviewplugin.h + +RESOURCES += qml/concretesyntaxview.qrc + +OTHER_FILES += concretesyntaxview.json diff --git a/examples/uml/duse-mt/src/plugins/concretesyntaxview/concretesyntaxviewplugin.cpp b/examples/uml/duse-mt/src/plugins/concretesyntaxview/concretesyntaxviewplugin.cpp new file mode 100644 index 00000000..4a862ea4 --- /dev/null +++ b/examples/uml/duse-mt/src/plugins/concretesyntaxview/concretesyntaxviewplugin.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtUml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "concretesyntaxviewplugin.h" + +#include <interfaces/iuicontroller.h> + +#include <QtQuick/QQuickView> + +#include <QtWidgets/QWidget> + +ConcreteSyntaxViewPlugin::ConcreteSyntaxViewPlugin(QObject *parent) : + DuSE::IPlugin(parent), + _concreteSyntaxQuickView(new QQuickView) +{ +} + +bool ConcreteSyntaxViewPlugin::initialize(DuSE::ICore *core) +{ + _concreteSyntaxQuickView->setSource(QUrl("qrc:/concretesyntaxview/concretesyntaxview.qml")); + _concreteSyntaxQuickView->setResizeMode(QQuickView::SizeRootObjectToView); + + core->uiController()->addCentralWidgetTab(QWidget::createWindowContainer(_concreteSyntaxQuickView), "Concrete Syntax"); + + return true; +} + diff --git a/examples/uml/duse-mt/src/plugins/concretesyntaxview/concretesyntaxviewplugin.h b/examples/uml/duse-mt/src/plugins/concretesyntaxview/concretesyntaxviewplugin.h new file mode 100644 index 00000000..7c3527c4 --- /dev/null +++ b/examples/uml/duse-mt/src/plugins/concretesyntaxview/concretesyntaxviewplugin.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtUml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef CONCRETESYNTAXVIEWPLUGIN_H +#define CONCRETESYNTAXVIEWPLUGIN_H + +#include <interfaces/iplugin.h> + +class QQuickView; + +class ConcreteSyntaxViewPlugin : public DuSE::IPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.liveblue.DuSE.IPlugin" FILE "concretesyntaxview.json") + +public: + ConcreteSyntaxViewPlugin(QObject *parent = 0); + + virtual bool initialize(DuSE::ICore *core); + +private: + QQuickView *_concreteSyntaxQuickView; +}; + +#endif // CONCRETESYNTAXVIEWPLUGIN_H + diff --git a/examples/uml/duse-mt/src/app/qml/modelview.qml b/examples/uml/duse-mt/src/plugins/concretesyntaxview/qml/concretesyntaxview.qml index c4f95246..c4f95246 100644 --- a/examples/uml/duse-mt/src/app/qml/modelview.qml +++ b/examples/uml/duse-mt/src/plugins/concretesyntaxview/qml/concretesyntaxview.qml diff --git a/examples/uml/duse-mt/src/plugins/concretesyntaxview/qml/concretesyntaxview.qrc b/examples/uml/duse-mt/src/plugins/concretesyntaxview/qml/concretesyntaxview.qrc new file mode 100644 index 00000000..dd25350d --- /dev/null +++ b/examples/uml/duse-mt/src/plugins/concretesyntaxview/qml/concretesyntaxview.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/concretesyntaxview"> + <file>concretesyntaxview.qml</file> + <file>grid.png</file> + </qresource> +</RCC> diff --git a/examples/uml/duse-mt/src/plugins/concretesyntaxview/qml/grid.png b/examples/uml/duse-mt/src/plugins/concretesyntaxview/qml/grid.png Binary files differnew file mode 100644 index 00000000..52162608 --- /dev/null +++ b/examples/uml/duse-mt/src/plugins/concretesyntaxview/qml/grid.png diff --git a/examples/uml/duse-mt/src/plugins/plugins.pro b/examples/uml/duse-mt/src/plugins/plugins.pro index 739bfc39..1f2bf539 100644 --- a/examples/uml/duse-mt/src/plugins/plugins.pro +++ b/examples/uml/duse-mt/src/plugins/plugins.pro @@ -4,4 +4,5 @@ CONFIG += ordered SUBDIRS = \ modelinspector \ javascriptconsole \ - welcomedashboard + welcomedashboard \ + concretesyntaxview diff --git a/examples/uml/duse-mt/src/plugins/welcomedashboard/welcomedashboardplugin.cpp b/examples/uml/duse-mt/src/plugins/welcomedashboard/welcomedashboardplugin.cpp index e6543b29..8f9e89a8 100644 --- a/examples/uml/duse-mt/src/plugins/welcomedashboard/welcomedashboardplugin.cpp +++ b/examples/uml/duse-mt/src/plugins/welcomedashboard/welcomedashboardplugin.cpp @@ -61,3 +61,4 @@ bool WelcomeDashboardPlugin::initialize(DuSE::ICore *core) return true; } + |