summaryrefslogtreecommitdiffstats
path: root/examples/uml
diff options
context:
space:
mode:
authorSandro S. Andrade <sandroandrade@kde.org>2013-10-30 15:52:24 -0300
committerSandro S. Andrade <sandroandrade@kde.org>2013-10-30 19:57:22 +0100
commit5ecf52ae725c7b7154a8c84c5918b11f15287d84 (patch)
tree8864e3148a5601f095ba617a28fde0438f710c67 /examples/uml
parentd9a315111357df58f997cbbeb2e90b379dc0993d (diff)
Move DuSE-MT architecture optimization from core to plugin
Change-Id: Ic218e48d239ad3eb5108f95ea3d73f8ba5b0f1c4 Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
Diffstat (limited to 'examples/uml')
-rw-r--r--examples/uml/duse-mt/src/app/duse-mt.qrc2
-rw-r--r--examples/uml/duse-mt/src/app/mainwindow.ui24
-rw-r--r--examples/uml/duse-mt/src/app/shell/mainwindow.cpp63
-rw-r--r--examples/uml/duse-mt/src/app/shell/mainwindow.h5
-rw-r--r--examples/uml/duse-mt/src/app/shell/plugincontroller.cpp12
-rw-r--r--examples/uml/duse-mt/src/plugins/designoptimizer/designoptimizer.json5
-rw-r--r--examples/uml/duse-mt/src/plugins/designoptimizer/designoptimizer.pro15
-rw-r--r--examples/uml/duse-mt/src/plugins/designoptimizer/designoptimizerplugin.cpp64
-rw-r--r--examples/uml/duse-mt/src/plugins/designoptimizer/designoptimizerplugin.h63
-rw-r--r--examples/uml/duse-mt/src/plugins/designoptimizer/qml/designoptimizer.qrc5
-rw-r--r--examples/uml/duse-mt/src/plugins/designoptimizer/qml/paretofront.qml (renamed from examples/uml/duse-mt/src/app/qml/paretofrontview.qml)0
-rw-r--r--examples/uml/duse-mt/src/plugins/plugins.pro3
12 files changed, 185 insertions, 76 deletions
diff --git a/examples/uml/duse-mt/src/app/duse-mt.qrc b/examples/uml/duse-mt/src/app/duse-mt.qrc
index e51566a8..cd816f42 100644
--- a/examples/uml/duse-mt/src/app/duse-mt.qrc
+++ b/examples/uml/duse-mt/src/app/duse-mt.qrc
@@ -14,8 +14,6 @@
<file>icons/duse-mt-48x48.png</file>
<file>icons/duse-mt-64x64.png</file>
<file>icons/duse-mt-128x128.png</file>
- <file>qml/grid.png</file>
- <file>qml/paretofrontview.qml</file>
<file>metamodels/PrimitiveTypes.xmi</file>
<file>metamodels/UML.xmi</file>
<file>metamodels/SADuSEProfile.xmi</file>
diff --git a/examples/uml/duse-mt/src/app/mainwindow.ui b/examples/uml/duse-mt/src/app/mainwindow.ui
index 191a8ad4..185f60c2 100644
--- a/examples/uml/duse-mt/src/app/mainwindow.ui
+++ b/examples/uml/duse-mt/src/app/mainwindow.ui
@@ -34,30 +34,8 @@
<item row="0" column="0">
<widget class="QTabWidget" name="centralWidget">
<property name="currentIndex">
- <number>0</number>
+ <number>-1</number>
</property>
- <widget class="QWidget" name="tabParetoFront">
- <attribute name="title">
- <string>Pareto Front</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_12">
- <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="paretoFrontViewWidget" native="true"/>
- </item>
- </layout>
- </widget>
</widget>
</item>
</layout>
diff --git a/examples/uml/duse-mt/src/app/shell/mainwindow.cpp b/examples/uml/duse-mt/src/app/shell/mainwindow.cpp
index fa9723bd..fac1a56c 100644
--- a/examples/uml/duse-mt/src/app/shell/mainwindow.cpp
+++ b/examples/uml/duse-mt/src/app/shell/mainwindow.cpp
@@ -93,8 +93,7 @@ MainWindow::MainWindow(QWidget *parent) :
_aboutDuSEMT(new Ui::AboutDuSEMT),
_newModelDialog(new QDialog(this)),
_newModel(new Ui::NewModel),
- _newDuseDesign(new NewDuseDesign(this)),
- _paretoFrontQuickView(new QQuickView)
+ _newDuseDesign(new NewDuseDesign(this))
{
ui->setupUi(this);
@@ -105,10 +104,6 @@ MainWindow::MainWindow(QWidget *parent) :
// connect(ui->modelingObjectView, &QModelingObjectView::addToView, this, &MainWindow::addToView);
- _paretoFrontQuickView->setSource(QUrl("qrc:/qml/paretofrontview.qml"));
- ui->gridLayout_12->addWidget(QWidget::createWindowContainer(_paretoFrontQuickView, ui->paretoFrontViewWidget), 0, 0, 1, 1);
-
- _paretoFrontQuickView->setResizeMode(QQuickView::SizeRootObjectToView);
}
MainWindow::~MainWindow()
@@ -344,15 +339,15 @@ void MainWindow::on_centralWidget_currentChanged(int)
// }
}
-void MainWindow::on_btnOptimize_clicked()
-{
- progress = new QProgressDialog("Optimizing architecture", "Abort", 0, 100, this);
- progress->setWindowModality(Qt::WindowModal);
- timer = new QTimer(this);
- connect(progress, SIGNAL(finished(int)), timer, SLOT(stop()));
- connect(timer, SIGNAL(timeout()), this, SLOT(update()));
- timer->start(1000);
-}
+//void MainWindow::on_btnOptimize_clicked()
+//{
+// progress = new QProgressDialog("Optimizing architecture", "Abort", 0, 100, this);
+// progress->setWindowModality(Qt::WindowModal);
+// timer = new QTimer(this);
+// connect(progress, SIGNAL(finished(int)), timer, SLOT(stop()));
+// connect(timer, SIGNAL(timeout()), this, SLOT(update()));
+// timer->start(1000);
+//}
void MainWindow::update()
{
@@ -436,27 +431,27 @@ void MainWindow::addToDesignSpaceView(QModelingElement *modelingObject, QQuickIt
void MainWindow::addToPareto(QModelingElement *modelingObject, int pos)
{
- QQmlContext *context = _paretoFrontQuickView->engine()->rootContext();
- //modelingObject->setQmlContextProperties(context);
- _qmlComponent = new QQmlComponent(_paretoFrontQuickView->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(_paretoFrontQuickView->rootObject()->childItems().first()->childItems().first()->childItems().at(pos));
- }
- }
+// QQmlContext *context = _paretoFrontQuickView->engine()->rootContext();
+// //modelingObject->setQmlContextProperties(context);
+// _qmlComponent = new QQmlComponent(_paretoFrontQuickView->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(_paretoFrontQuickView->rootObject()->childItems().first()->childItems().first()->childItems().at(pos));
+// }
+// }
- foreach (QObject *child, modelingObject->asQModelingObject()->children())
- addToPareto(dynamic_cast<QModelingElement *>(qModelingElement(child)), pos);
+// foreach (QObject *child, modelingObject->asQModelingObject()->children())
+// addToPareto(dynamic_cast<QModelingElement *>(qModelingElement(child)), pos);
- _qmlComponent->deleteLater();
+// _qmlComponent->deleteLater();
}
void MainWindow::designSpaceChanged()
diff --git a/examples/uml/duse-mt/src/app/shell/mainwindow.h b/examples/uml/duse-mt/src/app/shell/mainwindow.h
index d19d4a2a..9a536035 100644
--- a/examples/uml/duse-mt/src/app/shell/mainwindow.h
+++ b/examples/uml/duse-mt/src/app/shell/mainwindow.h
@@ -98,7 +98,7 @@ private Q_SLOTS:
void on_actionHelpAboutPlugins_triggered();
void on_actionHelpAboutDuSEMT_triggered();
void on_centralWidget_currentChanged(int);
- void on_btnOptimize_clicked();
+// void on_btnOptimize_clicked();
void evaluateQualityMetrics();
void metaModelChanged(QString newMetaModel);
@@ -125,9 +125,6 @@ private:
NewDuseDesign *_newDuseDesign;
QQmlComponent *_qmlComponent;
-// QQuickView *_designSpaceQuickView;
-// QQuickView *_metricsQuickView;
- QQuickView *_paretoFrontQuickView;
QProgressDialog *progress;
QTimer *timer;
diff --git a/examples/uml/duse-mt/src/app/shell/plugincontroller.cpp b/examples/uml/duse-mt/src/app/shell/plugincontroller.cpp
index 513b3e91..372f912b 100644
--- a/examples/uml/duse-mt/src/app/shell/plugincontroller.cpp
+++ b/examples/uml/duse-mt/src/app/shell/plugincontroller.cpp
@@ -77,12 +77,6 @@ bool PluginController::initialize()
if (plugin && (metaModelPlugin = qobject_cast<QMetaModelPlugin *>(plugin))) {
QJsonObject jsonObject = loader.metaData().value(QString::fromLatin1("MetaData")).toObject();
_metamodelPlugins.insert(jsonObject.value(QString::fromLatin1("MetaModelNamespaceUri")).toString(), QPair<QMetaModelPlugin *, QJsonObject>(metaModelPlugin, jsonObject));
-// QTreeWidgetItem *metamodelItem = new QTreeWidgetItem(itemForCategory("Metamodels"),
-// QStringList() << metaModelPlugin->metaObject()->className()
-// << QString()
-// << jsonObject.value("Version").toString()
-// << jsonObject.value("Vendor").toString());
-// metamodelItem->setData(1, Qt::CheckStateRole, QVariant(Qt::Checked));
}
}
}
@@ -98,12 +92,6 @@ bool PluginController::initialize()
dusePlugin->initialize(core);
QJsonObject jsonObject = loader.metaData().value(QString::fromLatin1("MetaData")).toObject();
_dusemtPlugins << QPair<DuSE::IPlugin *, QJsonObject>(dusePlugin, jsonObject);
-// QTreeWidgetItem *dusePluginItem = new QTreeWidgetItem(itemForCategory(jsonObject.value("Category").toString()),
-// QStringList() << dusePlugin->metaObject()->className()
-// << QString()
-// << jsonObject.value("Version").toString()
-// << jsonObject.value("Vendor").toString());
-// dusePluginItem->setData(1, Qt::CheckStateRole, QVariant(Qt::Checked));
}
else
_errorStrings << "Error when loading plugin" << fileName << ":" << loader.errorString();
diff --git a/examples/uml/duse-mt/src/plugins/designoptimizer/designoptimizer.json b/examples/uml/duse-mt/src/plugins/designoptimizer/designoptimizer.json
new file mode 100644
index 00000000..86c0672f
--- /dev/null
+++ b/examples/uml/duse-mt/src/plugins/designoptimizer/designoptimizer.json
@@ -0,0 +1,5 @@
+{
+ "Category": "Test",
+ "Vendor": "Qt Project",
+ "Version": "1.0"
+}
diff --git a/examples/uml/duse-mt/src/plugins/designoptimizer/designoptimizer.pro b/examples/uml/duse-mt/src/plugins/designoptimizer/designoptimizer.pro
new file mode 100644
index 00000000..561c7b0d
--- /dev/null
+++ b/examples/uml/duse-mt/src/plugins/designoptimizer/designoptimizer.pro
@@ -0,0 +1,15 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2013-10-25T17:38:51
+#
+#-------------------------------------------------
+
+include(../../duse-mt-plugin.pri)
+
+SOURCES += designoptimizerplugin.cpp
+
+HEADERS += designoptimizerplugin.h
+
+RESOURCES += qml/designoptimizer.qrc
+
+OTHER_FILES += designoptimizer.json
diff --git a/examples/uml/duse-mt/src/plugins/designoptimizer/designoptimizerplugin.cpp b/examples/uml/duse-mt/src/plugins/designoptimizer/designoptimizerplugin.cpp
new file mode 100644
index 00000000..4512abc4
--- /dev/null
+++ b/examples/uml/duse-mt/src/plugins/designoptimizer/designoptimizerplugin.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 "designoptimizerplugin.h"
+
+#include <interfaces/iuicontroller.h>
+
+#include <QtQuick/QQuickView>
+
+#include <QtWidgets/QWidget>
+
+DesignOptimizerPlugin::DesignOptimizerPlugin(QObject *parent) :
+ DuSE::IPlugin(parent),
+ _paretoFrontQuickView(new QQuickView)
+{
+}
+
+bool DesignOptimizerPlugin::initialize(DuSE::ICore *core)
+{
+ _paretoFrontQuickView->setSource(QUrl("qrc:/designoptimizer/paretofront.qml"));
+ _paretoFrontQuickView->setResizeMode(QQuickView::SizeRootObjectToView);
+
+ core->uiController()->addCentralWidgetTab(QWidget::createWindowContainer(_paretoFrontQuickView), "Pareto Front");
+
+ return true;
+}
+
diff --git a/examples/uml/duse-mt/src/plugins/designoptimizer/designoptimizerplugin.h b/examples/uml/duse-mt/src/plugins/designoptimizer/designoptimizerplugin.h
new file mode 100644
index 00000000..d09f04d1
--- /dev/null
+++ b/examples/uml/duse-mt/src/plugins/designoptimizer/designoptimizerplugin.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 DESIGNOPTIMIZERPLUGIN_H
+#define DESIGNOPTIMIZERPLUGIN_H
+
+#include <interfaces/iplugin.h>
+
+class QQuickView;
+
+class DesignOptimizerPlugin : public DuSE::IPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.liveblue.DuSE.IPlugin" FILE "designoptimizer.json")
+
+public:
+ DesignOptimizerPlugin(QObject *parent = 0);
+
+ virtual bool initialize(DuSE::ICore *core);
+
+private:
+ QQuickView *_paretoFrontQuickView;
+};
+
+#endif // DESIGNOPTIMIZERPLUGIN_H
+
diff --git a/examples/uml/duse-mt/src/plugins/designoptimizer/qml/designoptimizer.qrc b/examples/uml/duse-mt/src/plugins/designoptimizer/qml/designoptimizer.qrc
new file mode 100644
index 00000000..c9152415
--- /dev/null
+++ b/examples/uml/duse-mt/src/plugins/designoptimizer/qml/designoptimizer.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/designoptimizer">
+ <file>paretofront.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/uml/duse-mt/src/app/qml/paretofrontview.qml b/examples/uml/duse-mt/src/plugins/designoptimizer/qml/paretofront.qml
index 69feb3dc..69feb3dc 100644
--- a/examples/uml/duse-mt/src/app/qml/paretofrontview.qml
+++ b/examples/uml/duse-mt/src/plugins/designoptimizer/qml/paretofront.qml
diff --git a/examples/uml/duse-mt/src/plugins/plugins.pro b/examples/uml/duse-mt/src/plugins/plugins.pro
index 35c63025..28395b54 100644
--- a/examples/uml/duse-mt/src/plugins/plugins.pro
+++ b/examples/uml/duse-mt/src/plugins/plugins.pro
@@ -6,4 +6,5 @@ SUBDIRS = \
javascriptconsole \
welcomedashboard \
concretesyntaxview \
- designspaceexplorer
+ designspaceexplorer \
+ designoptimizer