summaryrefslogtreecommitdiffstats
path: root/examples/uml
diff options
context:
space:
mode:
authorSandro S. Andrade <sandroandrade@kde.org>2013-10-29 00:47:30 -0300
committerSandro S. Andrade <sandroandrade@kde.org>2013-10-29 04:44:47 +0100
commitc9af31e57a3977ea74bf9d9196e187c751a676ce (patch)
tree52a261c434849dd2ff6cd2983f3f175033b3e783 /examples/uml
parent899144a4a98d4b0445a6c84ec900747091742de3 (diff)
Move DuSE-MT model inspector from core to plugin
Change-Id: I203484f93e95e2d658165893b7e8a8ff40afd228 Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
Diffstat (limited to 'examples/uml')
-rw-r--r--examples/uml/duse-mt/src/app/app.pro2
-rw-r--r--examples/uml/duse-mt/src/app/mainwindow.ui62
-rw-r--r--examples/uml/duse-mt/src/app/shell/core.cpp12
-rw-r--r--examples/uml/duse-mt/src/app/shell/core.h4
-rw-r--r--examples/uml/duse-mt/src/app/shell/mainwindow.cpp65
-rw-r--r--examples/uml/duse-mt/src/app/shell/mainwindow.h17
-rw-r--r--examples/uml/duse-mt/src/app/shell/projectcontroller.cpp98
-rw-r--r--examples/uml/duse-mt/src/app/shell/projectcontroller.h71
-rw-r--r--examples/uml/duse-mt/src/app/shell/uicontroller.cpp3
-rw-r--r--examples/uml/duse-mt/src/libs/interfaces/icore.h2
-rw-r--r--examples/uml/duse-mt/src/libs/interfaces/interfaces.pro2
-rw-r--r--examples/uml/duse-mt/src/libs/interfaces/iprojectcontroller.cpp54
-rw-r--r--examples/uml/duse-mt/src/libs/interfaces/iprojectcontroller.h77
-rw-r--r--examples/uml/duse-mt/src/libs/interfaces/iuicontroller.h6
-rw-r--r--examples/uml/duse-mt/src/plugins/modelinspector/modelinspectorplugin.cpp28
-rw-r--r--examples/uml/duse-mt/src/plugins/modelinspector/modelinspectorplugin.h14
16 files changed, 415 insertions, 102 deletions
diff --git a/examples/uml/duse-mt/src/app/app.pro b/examples/uml/duse-mt/src/app/app.pro
index 4df145a3..eac91295 100644
--- a/examples/uml/duse-mt/src/app/app.pro
+++ b/examples/uml/duse-mt/src/app/app.pro
@@ -21,12 +21,14 @@ SOURCES += main.cpp \
newdusedesign.cpp \
shell/core.cpp \
shell/uicontroller.cpp \
+ shell/projectcontroller.cpp \
shell/mainwindow.cpp
HEADERS += \
newdusedesign.h \
shell/core.h \
shell/uicontroller.h \
+ shell/projectcontroller.h \
shell/mainwindow.h
FORMS += mainwindow.ui \
diff --git a/examples/uml/duse-mt/src/app/mainwindow.ui b/examples/uml/duse-mt/src/app/mainwindow.ui
index d8d581fd..34d3daa2 100644
--- a/examples/uml/duse-mt/src/app/mainwindow.ui
+++ b/examples/uml/duse-mt/src/app/mainwindow.ui
@@ -197,54 +197,6 @@
<addaction name="actionFileQuit"/>
</widget>
<widget class="QStatusBar" name="statusBar"/>
- <widget class="QDockWidget" name="dckInspector">
- <property name="windowTitle">
- <string>Model Inspector</string>
- </property>
- <attribute name="dockWidgetArea">
- <number>1</number>
- </attribute>
- <widget class="QWidget" name="dckInspectorLayout">
- <layout class="QGridLayout" name="gridLayout">
- <property name="leftMargin">
- <number>4</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item row="0" column="0">
- <widget class="QModelingObjectView" name="modelingObjectView" native="true"/>
- </item>
- </layout>
- </widget>
- </widget>
- <widget class="QDockWidget" name="dckPropertyEditor">
- <property name="windowTitle">
- <string>Property Editor</string>
- </property>
- <attribute name="dockWidgetArea">
- <number>2</number>
- </attribute>
- <widget class="QWidget" name="dckPropertyEditorLayout">
- <layout class="QGridLayout" name="gridLayout_2">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>4</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item row="0" column="0">
- <widget class="QModelingObjectPropertyEditor" name="propertyEditor" native="true"/>
- </item>
- </layout>
- </widget>
- </widget>
<widget class="QDockWidget" name="dckIssues">
<property name="windowTitle">
<string>Issues</string>
@@ -609,20 +561,6 @@
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
- <customwidgets>
- <customwidget>
- <class>QModelingObjectPropertyEditor</class>
- <extends>QWidget</extends>
- <header>qmodelingobjectpropertyeditor.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>QModelingObjectView</class>
- <extends>QWidget</extends>
- <header>qmodelingobjectview.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
<resources>
<include location="duse-mt.qrc"/>
</resources>
diff --git a/examples/uml/duse-mt/src/app/shell/core.cpp b/examples/uml/duse-mt/src/app/shell/core.cpp
index eefc3ebf..c68dc24b 100644
--- a/examples/uml/duse-mt/src/app/shell/core.cpp
+++ b/examples/uml/duse-mt/src/app/shell/core.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "core.h"
+#include "projectcontroller.h"
#include "uicontroller.h"
namespace DuSE
@@ -47,6 +48,7 @@ namespace DuSE
Core::~Core()
{
+ delete _projectController;
delete _uiController;
}
@@ -60,12 +62,18 @@ bool Core::initialize()
return true;
}
+IProjectController *Core::projectController()
+{
+ return _projectController;
+}
+
IUiController *Core::uiController()
{
return _uiController;
}
Core::Core() :
+ _projectController(0),
_uiController(0)
{
initializeInternal();
@@ -73,6 +81,10 @@ Core::Core() :
bool Core::initializeInternal()
{
+ if (!_projectController) {
+ _projectController = new ProjectController;
+ _projectController->initialize();
+ }
if (!_uiController) {
_uiController = new UiController;
_uiController->initialize();
diff --git a/examples/uml/duse-mt/src/app/shell/core.h b/examples/uml/duse-mt/src/app/shell/core.h
index 543c35ea..8a592ceb 100644
--- a/examples/uml/duse-mt/src/app/shell/core.h
+++ b/examples/uml/duse-mt/src/app/shell/core.h
@@ -46,6 +46,7 @@
namespace DuSE
{
+class ProjectController;
class UiController;
class Core : public ICore
@@ -54,11 +55,14 @@ public:
virtual ~Core();
static bool initialize();
+
+ virtual IProjectController *projectController();
virtual IUiController *uiController();
protected:
Core();
bool initializeInternal();
+ ProjectController *_projectController;
UiController *_uiController;
};
diff --git a/examples/uml/duse-mt/src/app/shell/mainwindow.cpp b/examples/uml/duse-mt/src/app/shell/mainwindow.cpp
index 52990459..9a4030f1 100644
--- a/examples/uml/duse-mt/src/app/shell/mainwindow.cpp
+++ b/examples/uml/duse-mt/src/app/shell/mainwindow.cpp
@@ -80,8 +80,9 @@
//#include <QtDuse/QtDuse>
+#include <interfaces/icore.h>
#include <interfaces/iplugin.h>
-#include <shell/core.h>
+#include <interfaces/iprojectcontroller.h>
#include "newdusedesign.h"
@@ -123,10 +124,12 @@ void scriptValueToQList(const QScriptValue &obj, QList<T *> &elements)
}
}
+namespace DuSE
+{
+
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
- _modelingObjectModel(new QModelingObjectModel(this)),
_aboutPluginsDialog(new QDialog(this)),
_aboutPlugins(new Ui::AboutPlugins),
_aboutDuSEMTDialog(new QDialog(this)),
@@ -145,22 +148,13 @@ MainWindow::MainWindow(QWidget *parent) :
_codeCompletionView->setParent(ui->txeJavaScript);
_codeCompletionView->hide();
- ui->modelingObjectView->setModel(_modelingObjectModel);
-
_newModel->setupUi(_newModelDialog);
connect(_newModel->cboMetamodel, SIGNAL(currentIndexChanged(QString)), SLOT(metaModelChanged(QString)));
_aboutPlugins->setupUi(_aboutPluginsDialog);
_aboutDuSEMT->setupUi(_aboutDuSEMTDialog);
- QModelingObjectPropertyModel *modelingObjectPropertyModel = new QModelingObjectPropertyModel(_modelingObjectModel);
- ui->propertyEditor->setModel(modelingObjectPropertyModel);
-
- connect(ui->modelingObjectView, &QModelingObjectView::modelingObjectChanged,
- modelingObjectPropertyModel, &QModelingObjectPropertyModel::setModelingObject);
// connect(ui->modelingObjectView, &QModelingObjectView::addToView, this, &MainWindow::addToView);
- connect(ui->modelingObjectView, &QModelingObjectView::modelingObjectChanged, this, &MainWindow::modelingObjectChanged);
- connect(modelingObjectPropertyModel, &QModelingObjectPropertyModel::indexChanged,
- _modelingObjectModel, &QModelingObjectModel::updateIndex);
+// connect(ui->modelingObjectView, &QModelingObjectView::modelingObjectChanged, this, &MainWindow::modelingObjectChanged);
qScriptRegisterMetaType(&_engine, qSetToScriptValue<QObject>, scriptValueToQSet<QObject>);
qScriptRegisterMetaType(&_engine, qListToScriptValue<QObject>, scriptValueToQList<QObject>);
@@ -176,10 +170,10 @@ MainWindow::MainWindow(QWidget *parent) :
tabifyDockWidget(ui->dckXPath, ui->dckOcl);
tabifyDockWidget(ui->dckOcl, ui->dckJavaScript);
ui->dckIssues->raise();
- tabifyDockWidget(ui->dckInspector, ui->dckMetrics);
- ui->dckInspector->raise();
- tabifyDockWidget(ui->dckPropertyEditor, ui->dckDesignSpace);
- ui->dckPropertyEditor->raise();
+// tabifyDockWidget(ui->dckInspector, ui->dckMetrics);
+// ui->dckInspector->raise();
+// tabifyDockWidget(ui->dckPropertyEditor, ui->dckDesignSpace);
+// ui->dckPropertyEditor->raise();
ui->tblDesignSpace->resizeColumnToContents(0);
ui->tblDesignSpace->resizeColumnToContents(1);
ui->tblDesignSpace->resizeColumnToContents(2);
@@ -320,24 +314,31 @@ void MainWindow::setModelInspector(QList<QModelingElement *> modelingObjectList)
ui->txeJavaScript->setText("self");
QTimer::singleShot(0, this, SLOT(on_psbJSEvaluate_clicked()));
}
- _modelingObjectModel->clear();
- foreach (QModelingElement *object, modelingObjectList)
- _modelingObjectModel->addModelingObject(object->asQModelingObject());
+// _modelingObjectModel->clear();
+// foreach (QModelingElement *object, modelingObjectList)
+// _modelingObjectModel->addModelingObject(object->asQModelingObject());
}
void MainWindow::on_actionFileOpenModel_triggered()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), QDir::currentPath(), "XMI files (*.xmi)");
if (!fileName.isEmpty()) {
- _currentFileName = fileName;
setCursor(Qt::WaitCursor);
-// foreach (QWrappedObject *object, _inputModel)
-// delete object;
- _inputModel = loadXmi(_currentFileName);
- _modelQuickView->setClearBeforeRendering(true);
- _modelQuickView->setSource(QUrl("qrc:/qml/modelview.qml"));
- addToView(_inputModel[0]);
+ bool ret = ICore::self()->projectController()->openModel(fileName);
setCursor(Qt::ArrowCursor);
+ if (!ret) {
+ QMessageBox::critical(this, tr("Open Model"), ICore::self()->projectController()->errorString());
+ return;
+ }
+ setWindowTitle(QFileInfo(QFile(fileName)).fileName() + " - DuSE-MT");
+
+// _currentFileName = fileName;
+//// foreach (QWrappedObject *object, _inputModel)
+//// delete object;
+// _inputModel = loadXmi(_currentFileName);
+// _modelQuickView->setClearBeforeRendering(true);
+// _modelQuickView->setSource(QUrl("qrc:/qml/modelview.qml"));
+// addToView(_inputModel[0]);
}
}
@@ -456,7 +457,7 @@ void MainWindow::on_actionFileSaveAs_triggered()
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), QDir::currentPath(), "XMI files (*.xmi)");
if (!fileName.isEmpty()) {
_currentFileName = fileName;
- saveXmi(_modelingObjectModel->modelingObjects());
+// saveXmi(_modelingObjectModel->modelingObjects());
}
}
@@ -464,8 +465,8 @@ void MainWindow::on_actionFileSave_triggered()
{
if (_currentFileName.isEmpty())
on_actionFileSaveAs_triggered();
- else
- saveXmi(_modelingObjectModel->modelingObjects());
+// else
+// saveXmi(_modelingObjectModel->modelingObjects());
}
void MainWindow::on_actionHelpAboutPlugins_triggered()
@@ -481,7 +482,7 @@ void MainWindow::on_actionHelpAboutDuSEMT_triggered()
void MainWindow::on_psbJSEvaluate_clicked()
{
ui->txeJavaScriptEvaluation->setText(_engine.evaluate(ui->txeJavaScript->toPlainText()).toString());
- ui->modelingObjectView->updateSelected();
+// ui->modelingObjectView->updateSelected();
}
void MainWindow::on_centralWidget_currentChanged(int)
@@ -721,7 +722,7 @@ void MainWindow::loadPlugins()
// ++i;
// }
- DuSE::ICore *core = DuSE::Core::self();
+ DuSE::ICore *core = DuSE::ICore::self();
DuSE::IPlugin *dusePlugin;
foreach (QString pluginPath, QCoreApplication::libraryPaths()) {
QDir pluginsDir(pluginPath);
@@ -776,3 +777,5 @@ void MainWindow::closeEvent(QCloseEvent *event)
settings.setValue("windowState", saveState());
QMainWindow::closeEvent(event);
}
+
+}
diff --git a/examples/uml/duse-mt/src/app/shell/mainwindow.h b/examples/uml/duse-mt/src/app/shell/mainwindow.h
index 59465f0d..1ca694d6 100644
--- a/examples/uml/duse-mt/src/app/shell/mainwindow.h
+++ b/examples/uml/duse-mt/src/app/shell/mainwindow.h
@@ -62,10 +62,6 @@ namespace Ui {
class NewModel;
}
-namespace DuSE {
- class IPlugin;
-}
-
class QModelingElement;
class QModelingObject;
class QMetaModelPlugin;
@@ -74,6 +70,11 @@ class QProgressDialog;
class NewDuseDesign;
+namespace DuSE
+{
+
+class IPlugin;
+
class MainWindow : public QMainWindow
{
Q_OBJECT
@@ -115,12 +116,12 @@ protected:
bool eventFilter(QObject *obj, QEvent *event);
private:
+ Ui::MainWindow *ui;
+
void saveXmi(QList<QModelingObject *> modelObjects);
QList<QModelingElement *> loadXmi(QString fileName = 0);
void populateDesignSpaceView(QModelingElement *modelingObject);
- Ui::MainWindow *ui;
- QModelingObjectModel *_modelingObjectModel;
QList<QModelingElement *> _inputModel;
QList<QModelingElement *> _designSpaceLocation;
@@ -148,6 +149,10 @@ private:
QTimer *timer;
QTreeWidgetItem *itemForCategory(const QString &category);
+
+ friend class UiController;
};
+}
+
#endif // MAINWINDOW_H
diff --git a/examples/uml/duse-mt/src/app/shell/projectcontroller.cpp b/examples/uml/duse-mt/src/app/shell/projectcontroller.cpp
new file mode 100644
index 00000000..e84e877c
--- /dev/null
+++ b/examples/uml/duse-mt/src/app/shell/projectcontroller.cpp
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** 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 "projectcontroller.h"
+
+#include <QtWidgets/QFileDialog>
+#include <QtWidgets/QMessageBox>
+
+#include <QtModeling/QXmiReader>
+#include <QtModeling/QModelingElement>
+
+namespace DuSE
+{
+
+ProjectController::ProjectController()
+{
+}
+
+ProjectController::~ProjectController()
+{
+}
+
+bool ProjectController::initialize()
+{
+ return true;
+}
+
+QString ProjectController::errorString() const
+{
+ return _errorString;
+}
+
+bool ProjectController::openModel(const QString &fileName)
+{
+ qDeleteAll(_currentModel);
+ _currentModel.clear();
+ _errorString.clear();
+
+ _currentModelFileName = fileName;
+
+ QFile file(fileName);
+ if (!file.open(QFile::ReadOnly | QFile::Text)) {
+ _errorString = QObject::tr("Cannot read file %1").arg(fileName);
+ return false;
+ }
+
+ QXmiReader reader;
+ _currentModel = reader.readFile(&file);
+
+// ui->txeIssues->setModel(new QStringListModel(reader.errorStrings()));
+// setModelInspector(modelingObjectList);
+ QList<QModelingObject *> modelObjects;
+ foreach (QModelingElement *element, _currentModel)
+ modelObjects << element->asQModelingObject();
+
+ emit modelOpened(modelObjects);
+
+ return true;
+}
+
+}
diff --git a/examples/uml/duse-mt/src/app/shell/projectcontroller.h b/examples/uml/duse-mt/src/app/shell/projectcontroller.h
new file mode 100644
index 00000000..f2cbd804
--- /dev/null
+++ b/examples/uml/duse-mt/src/app/shell/projectcontroller.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** 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 PROJECTCONTROLLER_H
+#define PROJECTCONTROLLER_H
+
+#include <interfaces/iprojectcontroller.h>
+
+#include "mainwindow.h"
+
+namespace DuSE
+{
+
+class ProjectController : public IProjectController
+{
+public:
+ ProjectController();
+ virtual ~ProjectController();
+
+ virtual bool initialize();
+ virtual QString errorString() const;
+
+public Q_SLOTS:
+ virtual bool openModel(const QString &fileName);
+
+private:
+ QString _currentModelFileName;
+ QList<QModelingElement *> _currentModel;
+ QString _errorString;
+};
+
+}
+
+#endif // PROJECTCONTROLLER_H
diff --git a/examples/uml/duse-mt/src/app/shell/uicontroller.cpp b/examples/uml/duse-mt/src/app/shell/uicontroller.cpp
index ced8c515..da2f8a7c 100644
--- a/examples/uml/duse-mt/src/app/shell/uicontroller.cpp
+++ b/examples/uml/duse-mt/src/app/shell/uicontroller.cpp
@@ -40,9 +40,12 @@
****************************************************************************/
#include "uicontroller.h"
+#include <QtWidgets/QAction>
#include <QtWidgets/QDockWidget>
#include <QtWidgets/QGridLayout>
+#include "ui_mainwindow.h"
+
namespace DuSE
{
diff --git a/examples/uml/duse-mt/src/libs/interfaces/icore.h b/examples/uml/duse-mt/src/libs/interfaces/icore.h
index d77e7a1a..bfb74780 100644
--- a/examples/uml/duse-mt/src/libs/interfaces/icore.h
+++ b/examples/uml/duse-mt/src/libs/interfaces/icore.h
@@ -46,6 +46,7 @@
namespace DuSE
{
+class IProjectController;
class IUiController;
class DUSEINTERFACESSHARED_EXPORT ICore
@@ -54,6 +55,7 @@ public:
virtual ~ICore();
static ICore *self();
+ virtual IProjectController *projectController() = 0;
virtual IUiController *uiController() = 0;
protected:
diff --git a/examples/uml/duse-mt/src/libs/interfaces/interfaces.pro b/examples/uml/duse-mt/src/libs/interfaces/interfaces.pro
index 024d60d3..3458f63f 100644
--- a/examples/uml/duse-mt/src/libs/interfaces/interfaces.pro
+++ b/examples/uml/duse-mt/src/libs/interfaces/interfaces.pro
@@ -6,9 +6,11 @@ DEFINES += DUSEINTERFACES_LIBRARY
SOURCES += icore.cpp \
iuicontroller.cpp \
+ iprojectcontroller.cpp \
iplugin.cpp
HEADERS += icore.h\
duseinterfaces_global.h \
iuicontroller.h \
+ iprojectcontroller.h \
iplugin.h
diff --git a/examples/uml/duse-mt/src/libs/interfaces/iprojectcontroller.cpp b/examples/uml/duse-mt/src/libs/interfaces/iprojectcontroller.cpp
new file mode 100644
index 00000000..1ea0a7df
--- /dev/null
+++ b/examples/uml/duse-mt/src/libs/interfaces/iprojectcontroller.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** 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 "iprojectcontroller.h"
+
+namespace DuSE
+{
+
+IProjectController::~IProjectController()
+{
+}
+
+IProjectController::IProjectController()
+{
+}
+
+}
diff --git a/examples/uml/duse-mt/src/libs/interfaces/iprojectcontroller.h b/examples/uml/duse-mt/src/libs/interfaces/iprojectcontroller.h
new file mode 100644
index 00000000..d8b55824
--- /dev/null
+++ b/examples/uml/duse-mt/src/libs/interfaces/iprojectcontroller.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** 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 IPROJECTCONTROLLER_H
+#define IPROJECTCONTROLLER_H
+
+#include <QtCore/QObject>
+
+#include <QtCore/QString>
+
+class QWidget;
+
+class QModelingObject;
+
+namespace DuSE
+{
+
+class IProjectController : public QObject
+{
+ Q_OBJECT
+
+public:
+ virtual ~IProjectController();
+
+ virtual bool initialize() = 0;
+ virtual QString errorString() const = 0;
+
+public Q_SLOTS:
+ virtual bool openModel(const QString &fileName) = 0;
+
+Q_SIGNALS:
+ void modelOpened(QList<QModelingObject *> model);
+
+protected:
+ IProjectController();
+};
+
+}
+
+#endif // IPROJECTCONTROLLER_H
diff --git a/examples/uml/duse-mt/src/libs/interfaces/iuicontroller.h b/examples/uml/duse-mt/src/libs/interfaces/iuicontroller.h
index d13933e0..6e27c3ad 100644
--- a/examples/uml/duse-mt/src/libs/interfaces/iuicontroller.h
+++ b/examples/uml/duse-mt/src/libs/interfaces/iuicontroller.h
@@ -41,6 +41,8 @@
#ifndef IUICONTROLLER_H
#define IUICONTROLLER_H
+#include <QtCore/QObject>
+
#include <QtCore/QString>
class QWidget;
@@ -48,8 +50,10 @@ class QWidget;
namespace DuSE
{
-class IUiController
+class IUiController : public QObject
{
+ Q_OBJECT
+
public:
virtual ~IUiController();
diff --git a/examples/uml/duse-mt/src/plugins/modelinspector/modelinspectorplugin.cpp b/examples/uml/duse-mt/src/plugins/modelinspector/modelinspectorplugin.cpp
index 33dd708c..6c18c75f 100644
--- a/examples/uml/duse-mt/src/plugins/modelinspector/modelinspectorplugin.cpp
+++ b/examples/uml/duse-mt/src/plugins/modelinspector/modelinspectorplugin.cpp
@@ -42,16 +42,40 @@
#include <interfaces/iuicontroller.h>
+#include <QtWidgets/QListView>
#include <QtWidgets/QPushButton>
+#include <QtModeling/QModelingObject>
+
+#include <QtModelingWidgets/QModelingObjectView>
+#include <QtModelingWidgets/QModelingObjectModel>
+#include <QtModelingWidgets/QModelingObjectPropertyEditor>
+#include <QtModelingWidgets/QModelingObjectPropertyModel>
+
+#include <interfaces/icore.h>
+#include <interfaces/iprojectcontroller.h>
+
ModelInspectorPlugin::ModelInspectorPlugin(QObject *parent) :
- DuSE::IPlugin(parent)
+ DuSE::IPlugin(parent),
+ _modelingObjectView(new QModelingObjectView),
+ _modelingObjectModel(new QModelingObjectModel),
+ _propertyEditor(new QModelingObjectPropertyEditor),
+ _propertyModel(new QModelingObjectPropertyModel(_modelingObjectModel)),
+ _outputIssues(new QListView)
{
+ _modelingObjectView->setModel(_modelingObjectModel);
+ _propertyEditor->setModel(_propertyModel);
+
+ connect(DuSE::ICore::self()->projectController(), SIGNAL(modelOpened(QList<QModelingObject*>)), _modelingObjectModel, SLOT(setModelingObjects(QList<QModelingObject*>)));
+ connect(_modelingObjectView, &QModelingObjectView::modelingObjectChanged, _propertyModel, &QModelingObjectPropertyModel::setModelingObject);
+ connect(_propertyModel, &QModelingObjectPropertyModel::indexChanged, _modelingObjectModel, &QModelingObjectModel::updateIndex);
}
bool ModelInspectorPlugin::initialize(DuSE::ICore *core)
{
- core->uiController()->addDockWidget(Qt::LeftDockWidgetArea, "Teste", new QPushButton("Teste"));
+ core->uiController()->addDockWidget(Qt::LeftDockWidgetArea, tr("Model Inspector"), _modelingObjectView);
+ core->uiController()->addDockWidget(Qt::RightDockWidgetArea, tr("Property Editor"), _propertyEditor);
+ core->uiController()->addDockWidget(Qt::BottomDockWidgetArea, tr("Issues"), _outputIssues);
return true;
}
diff --git a/examples/uml/duse-mt/src/plugins/modelinspector/modelinspectorplugin.h b/examples/uml/duse-mt/src/plugins/modelinspector/modelinspectorplugin.h
index e4b72c72..b64ab82f 100644
--- a/examples/uml/duse-mt/src/plugins/modelinspector/modelinspectorplugin.h
+++ b/examples/uml/duse-mt/src/plugins/modelinspector/modelinspectorplugin.h
@@ -43,6 +43,13 @@
#include <interfaces/iplugin.h>
+class QListView;
+
+class QModelingObjectView;
+class QModelingObjectModel;
+class QModelingObjectPropertyEditor;
+class QModelingObjectPropertyModel;
+
class ModelInspectorPlugin : public DuSE::IPlugin
{
Q_OBJECT
@@ -52,6 +59,13 @@ public:
ModelInspectorPlugin(QObject *parent = 0);
virtual bool initialize(DuSE::ICore *core);
+
+private:
+ QModelingObjectView *_modelingObjectView;
+ QModelingObjectModel *_modelingObjectModel;
+ QModelingObjectPropertyEditor *_propertyEditor;
+ QModelingObjectPropertyModel *_propertyModel;
+ QListView *_outputIssues;
};
#endif // MODELINSPECTORPLUGIN_H