From 847051067fbdd43218602819bed7a69ee3a8a267 Mon Sep 17 00:00:00 2001 From: "Sandro S. Andrade" Date: Fri, 7 Jun 2013 11:44:22 -0300 Subject: Renaming QtUml Editor to DuSE-MT Change-Id: Id78c524b4c9022edded04fb1d852d8036b290d67 Reviewed-by: Sandro S. Andrade --- examples/uml/duse-mt/aboutplugins.ui | 89 +++++ examples/uml/duse-mt/duse-mt.pro | 31 ++ examples/uml/duse-mt/duse-mt.qrc | 12 + examples/uml/duse-mt/example.xmi | 17 + examples/uml/duse-mt/example2.xmi | 19 ++ examples/uml/duse-mt/icons/application-exit.png | Bin 0 -> 3017 bytes examples/uml/duse-mt/icons/cleartext.png | Bin 0 -> 760 bytes examples/uml/duse-mt/icons/document-new.png | Bin 0 -> 2461 bytes examples/uml/duse-mt/icons/document-open.png | Bin 0 -> 2798 bytes examples/uml/duse-mt/icons/document-save-as.png | Bin 0 -> 3792 bytes examples/uml/duse-mt/icons/document-save.png | Bin 0 -> 2122 bytes examples/uml/duse-mt/icons/help-about.png | Bin 0 -> 2742 bytes examples/uml/duse-mt/icons/resetproperty.png | Bin 0 -> 169 bytes examples/uml/duse-mt/main.cpp | 51 +++ examples/uml/duse-mt/mainwindow.cpp | 307 +++++++++++++++++ examples/uml/duse-mt/mainwindow.h | 104 ++++++ examples/uml/duse-mt/mainwindow.ui | 365 +++++++++++++++++++++ examples/uml/duse-mt/newmodel.ui | 98 ++++++ examples/uml/qtumleditor/aboutplugins.ui | 89 ----- examples/uml/qtumleditor/example.xmi | 17 - examples/uml/qtumleditor/example2.xmi | 19 -- .../uml/qtumleditor/icons/application-exit.png | Bin 3017 -> 0 bytes examples/uml/qtumleditor/icons/cleartext.png | Bin 760 -> 0 bytes examples/uml/qtumleditor/icons/document-new.png | Bin 2461 -> 0 bytes examples/uml/qtumleditor/icons/document-open.png | Bin 2798 -> 0 bytes .../uml/qtumleditor/icons/document-save-as.png | Bin 3792 -> 0 bytes examples/uml/qtumleditor/icons/document-save.png | Bin 2122 -> 0 bytes examples/uml/qtumleditor/icons/help-about.png | Bin 2742 -> 0 bytes examples/uml/qtumleditor/icons/resetproperty.png | Bin 169 -> 0 bytes examples/uml/qtumleditor/main.cpp | 51 --- examples/uml/qtumleditor/mainwindow.cpp | 307 ----------------- examples/uml/qtumleditor/mainwindow.h | 104 ------ examples/uml/qtumleditor/mainwindow.ui | 365 --------------------- examples/uml/qtumleditor/newmodel.ui | 98 ------ examples/uml/qtumleditor/qtumleditor.pro | 31 -- examples/uml/qtumleditor/qtumleditor.qrc | 12 - examples/uml/uml.pro | 2 +- 37 files changed, 1094 insertions(+), 1094 deletions(-) create mode 100644 examples/uml/duse-mt/aboutplugins.ui create mode 100644 examples/uml/duse-mt/duse-mt.pro create mode 100644 examples/uml/duse-mt/duse-mt.qrc create mode 100644 examples/uml/duse-mt/example.xmi create mode 100644 examples/uml/duse-mt/example2.xmi create mode 100644 examples/uml/duse-mt/icons/application-exit.png create mode 100644 examples/uml/duse-mt/icons/cleartext.png create mode 100644 examples/uml/duse-mt/icons/document-new.png create mode 100644 examples/uml/duse-mt/icons/document-open.png create mode 100644 examples/uml/duse-mt/icons/document-save-as.png create mode 100644 examples/uml/duse-mt/icons/document-save.png create mode 100644 examples/uml/duse-mt/icons/help-about.png create mode 100644 examples/uml/duse-mt/icons/resetproperty.png create mode 100644 examples/uml/duse-mt/main.cpp create mode 100644 examples/uml/duse-mt/mainwindow.cpp create mode 100644 examples/uml/duse-mt/mainwindow.h create mode 100644 examples/uml/duse-mt/mainwindow.ui create mode 100644 examples/uml/duse-mt/newmodel.ui delete mode 100644 examples/uml/qtumleditor/aboutplugins.ui delete mode 100644 examples/uml/qtumleditor/example.xmi delete mode 100644 examples/uml/qtumleditor/example2.xmi delete mode 100644 examples/uml/qtumleditor/icons/application-exit.png delete mode 100644 examples/uml/qtumleditor/icons/cleartext.png delete mode 100644 examples/uml/qtumleditor/icons/document-new.png delete mode 100644 examples/uml/qtumleditor/icons/document-open.png delete mode 100644 examples/uml/qtumleditor/icons/document-save-as.png delete mode 100644 examples/uml/qtumleditor/icons/document-save.png delete mode 100644 examples/uml/qtumleditor/icons/help-about.png delete mode 100644 examples/uml/qtumleditor/icons/resetproperty.png delete mode 100644 examples/uml/qtumleditor/main.cpp delete mode 100644 examples/uml/qtumleditor/mainwindow.cpp delete mode 100644 examples/uml/qtumleditor/mainwindow.h delete mode 100644 examples/uml/qtumleditor/mainwindow.ui delete mode 100644 examples/uml/qtumleditor/newmodel.ui delete mode 100644 examples/uml/qtumleditor/qtumleditor.pro delete mode 100644 examples/uml/qtumleditor/qtumleditor.qrc diff --git a/examples/uml/duse-mt/aboutplugins.ui b/examples/uml/duse-mt/aboutplugins.ui new file mode 100644 index 00000000..44ad9865 --- /dev/null +++ b/examples/uml/duse-mt/aboutplugins.ui @@ -0,0 +1,89 @@ + + + AboutPlugins + + + + 0 + 0 + 400 + 300 + + + + Installed Plugins + + + + + + true + + + false + + + + Name + + + + + Version + + + + + Vendor + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + + + + + + buttonBox + accepted() + AboutPlugins + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + AboutPlugins + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/examples/uml/duse-mt/duse-mt.pro b/examples/uml/duse-mt/duse-mt.pro new file mode 100644 index 00000000..f35182d2 --- /dev/null +++ b/examples/uml/duse-mt/duse-mt.pro @@ -0,0 +1,31 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2012-10-26T12:43:33 +# +#------------------------------------------------- + +QT = wrappedobjectswidgets script + +TARGET = duse-mt +TEMPLATE = app + +target.path = $$[QT_INSTALL_PREFIX]/bin + +xmi.path = $$[QT_INSTALL_PREFIX]/share/doc/packages/duse-mt +xmi.files = example.xmi + +INSTALLS += target xmi + +CONFIG += c++11 + +SOURCES += main.cpp \ + mainwindow.cpp + +HEADERS += mainwindow.h \ + +FORMS += mainwindow.ui \ + aboutplugins.ui \ + newmodel.ui + +RESOURCES += \ + duse-mt.qrc diff --git a/examples/uml/duse-mt/duse-mt.qrc b/examples/uml/duse-mt/duse-mt.qrc new file mode 100644 index 00000000..e46a2a73 --- /dev/null +++ b/examples/uml/duse-mt/duse-mt.qrc @@ -0,0 +1,12 @@ + + + icons/resetproperty.png + icons/help-about.png + icons/application-exit.png + icons/document-new.png + icons/document-open.png + icons/document-save-as.png + icons/document-save.png + icons/cleartext.png + + diff --git a/examples/uml/duse-mt/example.xmi b/examples/uml/duse-mt/example.xmi new file mode 100644 index 00000000..e2d7d431 --- /dev/null +++ b/examples/uml/duse-mt/example.xmi @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/examples/uml/duse-mt/example2.xmi b/examples/uml/duse-mt/example2.xmi new file mode 100644 index 00000000..bbef77a4 --- /dev/null +++ b/examples/uml/duse-mt/example2.xmi @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/examples/uml/duse-mt/icons/application-exit.png b/examples/uml/duse-mt/icons/application-exit.png new file mode 100644 index 00000000..9ae1f1fb Binary files /dev/null and b/examples/uml/duse-mt/icons/application-exit.png differ diff --git a/examples/uml/duse-mt/icons/cleartext.png b/examples/uml/duse-mt/icons/cleartext.png new file mode 100644 index 00000000..74133baf Binary files /dev/null and b/examples/uml/duse-mt/icons/cleartext.png differ diff --git a/examples/uml/duse-mt/icons/document-new.png b/examples/uml/duse-mt/icons/document-new.png new file mode 100644 index 00000000..61db97ae Binary files /dev/null and b/examples/uml/duse-mt/icons/document-new.png differ diff --git a/examples/uml/duse-mt/icons/document-open.png b/examples/uml/duse-mt/icons/document-open.png new file mode 100644 index 00000000..3432ed27 Binary files /dev/null and b/examples/uml/duse-mt/icons/document-open.png differ diff --git a/examples/uml/duse-mt/icons/document-save-as.png b/examples/uml/duse-mt/icons/document-save-as.png new file mode 100644 index 00000000..ed2453d9 Binary files /dev/null and b/examples/uml/duse-mt/icons/document-save-as.png differ diff --git a/examples/uml/duse-mt/icons/document-save.png b/examples/uml/duse-mt/icons/document-save.png new file mode 100644 index 00000000..cc380a03 Binary files /dev/null and b/examples/uml/duse-mt/icons/document-save.png differ diff --git a/examples/uml/duse-mt/icons/help-about.png b/examples/uml/duse-mt/icons/help-about.png new file mode 100644 index 00000000..8f3a936d Binary files /dev/null and b/examples/uml/duse-mt/icons/help-about.png differ diff --git a/examples/uml/duse-mt/icons/resetproperty.png b/examples/uml/duse-mt/icons/resetproperty.png new file mode 100644 index 00000000..9048252e Binary files /dev/null and b/examples/uml/duse-mt/icons/resetproperty.png differ diff --git a/examples/uml/duse-mt/main.cpp b/examples/uml/duse-mt/main.cpp new file mode 100644 index 00000000..9c210fbc --- /dev/null +++ b/examples/uml/duse-mt/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Sandro S. Andrade +** 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 "mainwindow.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.showMaximized(); + + return a.exec(); +} diff --git a/examples/uml/duse-mt/mainwindow.cpp b/examples/uml/duse-mt/mainwindow.cpp new file mode 100644 index 00000000..d6da525c --- /dev/null +++ b/examples/uml/duse-mt/mainwindow.cpp @@ -0,0 +1,307 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Sandro S. Andrade +** 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 "mainwindow.h" +#include "ui_mainwindow.h" +#include "ui_aboutplugins.h" +#include "ui_newmodel.h" + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow), + _wrappedObjectModel(new QWrappedObjectModel(this)), + _aboutPluginsDialog(new QDialog(this)), + _aboutPlugins(new Ui::AboutPlugins), + _newModelDialog(new QDialog(this)), + _newModel(new Ui::NewModel), + _codeCompletionView(new QListView) +{ + ui->setupUi(this); + _codeCompletionView->setParent(ui->txeJavaScript); + _codeCompletionView->hide(); + + ui->wrappedObjectView->setModel(_wrappedObjectModel); + + _newModel->setupUi(_newModelDialog); + connect(_newModel->cboMetamodel, SIGNAL(currentIndexChanged(QString)), SLOT(metaModelChanged(QString))); + _aboutPlugins->setupUi(_aboutPluginsDialog); + + QWrappedObjectPropertyModel *propertyModel = new QWrappedObjectPropertyModel(this); + ui->propertyEditor->setModel(propertyModel); + + connect(ui->wrappedObjectView, &QWrappedObjectView::wrappedObjectChanged, + propertyModel, &QWrappedObjectPropertyModel::setWrappedObject); + connect(propertyModel, &QWrappedObjectPropertyModel::indexChanged, + _wrappedObjectModel, &QWrappedObjectModel::updateIndex); + + loadPlugins(); + + QPalette modelPallete = ui->txeIssues->palette(); + modelPallete.setColor(QPalette::Active, QPalette::Base, QColor(255, 255, 255)); + modelPallete.setColor(QPalette::Inactive, QPalette::Base, QColor(255, 255, 255)); + modelPallete.setColor(QPalette::Active, QPalette::AlternateBase, QColor(248, 247, 246)); + modelPallete.setColor(QPalette::Inactive, QPalette::AlternateBase, QColor(248, 247, 246)); + ui->txeIssues->setPalette(modelPallete); + + tabifyDockWidget(ui->dckIssues, ui->dckXPath); + tabifyDockWidget(ui->dckXPath, ui->dckOcl); + tabifyDockWidget(ui->dckOcl, ui->dckJavaScript); + ui->dckIssues->raise(); + + ui->txeJavaScript->installEventFilter(this); + _codeCompletionView->installEventFilter(this); +} + +MainWindow::~MainWindow() +{ + delete ui; +} + +void MainWindow::on_actionFileNew_triggered() +{ + _newModel->lneModel->clear(); + _newModel->cboMetamodel->clear(); + int i = 0; + typedef QPair PluginData; + foreach (const PluginData &pair, _loadedPlugins.values()) { + _newModel->cboMetamodel->addItem(pair.first->metaObject()->className()); + ++i; + } + int type; + if (_newModelDialog->exec() == QDialog::Accepted) { + foreach (const PluginData &pair, _loadedPlugins.values()) { + if (pair.first->metaObject()->className() == _newModel->cboMetamodel->currentText()) + pair.first->initMetaModel(&_engine); + } + if ((type = QMetaType::type(_newModel->lstTopLevelContainers->currentItem()->text().append("*").toLatin1())) != QMetaType::UnknownType) { + const QMetaObject *metaObject = QMetaType::metaObjectForType(type); + if (metaObject) { + QWrappedObject *topLevelElement = dynamic_cast(metaObject->newInstance()); + if (topLevelElement) { + topLevelElement->setObjectName(_newModel->lneModel->text()); + _wrappedObjectModel->setWrappedObject(topLevelElement); + } + } + } + } +} + +void MainWindow::saveXmi(QWrappedObject *rootElement) +{ + QFile file(_currentFileName); + if (!file.open(QFile::WriteOnly | QFile::Text)) { + QMessageBox::critical(this, tr("Save As"), tr("Cannot write file !")); + return; + } + + QXmiWriter writer(rootElement); + if (!writer.writeFile(&file)) + QMessageBox::critical(this, tr("Save As"), tr("Error when writing XMI file !")); + else { + statusBar()->showMessage("XMI file successfully saved !", 3000); + setWindowTitle(QFileInfo(file).fileName() + " - DuSE-MT"); + } +} + +QWrappedObject *MainWindow::loadXmi() +{ + QFile file(_currentFileName); + if (!file.open(QFile::ReadOnly | QFile::Text)) { + QMessageBox::critical(this, tr("Open"), tr("Cannot read file !")); + return 0; + } + + QXmiReader reader(&_engine, true); + setWindowTitle(QFileInfo(file).fileName() + " - DuSE-MT"); + QWrappedObject *wrappedObject = reader.readFile(&file); + ui->txeIssues->setModel(new QStringListModel(reader.errorStrings())); + if (wrappedObject) { + _engine.globalObject().setProperty("model", _engine.newQObject(wrappedObject)); + _engine.globalObject().setProperty(wrappedObject->objectName(), _engine.newQObject(wrappedObject)); + ui->txeJavaScript->setText(wrappedObject->objectName()); + QTimer::singleShot(0, this, SLOT(on_psbJSEvaluate_clicked())); + } + + return wrappedObject; +} + +void MainWindow::on_actionFileOpen_triggered() +{ + QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), QDir::currentPath(), "XMI files (*.xmi)"); + if (!fileName.isEmpty()) { + _currentFileName = fileName; + delete _wrappedObjectModel->wrappedObject(); + _wrappedObjectModel->setWrappedObject(loadXmi()); + } +} + +void MainWindow::on_actionFileSaveAs_triggered() +{ + QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), QDir::currentPath(), "XMI files (*.xmi)"); + if (!fileName.isEmpty()) { + _currentFileName = fileName; + saveXmi(_wrappedObjectModel->wrappedObject()); + } +} + +void MainWindow::on_actionFileSave_triggered() +{ + if (_currentFileName.isEmpty()) + on_actionFileSaveAs_triggered(); + else + saveXmi(_wrappedObjectModel->wrappedObject()); +} + +void MainWindow::on_actionAboutPlugins_triggered() +{ + _aboutPlugins->loadedPlugins->clearContents(); + _aboutPlugins->loadedPlugins->setRowCount(_loadedPlugins.size()); + int i = 0; + typedef QPair PluginData; + foreach (const PluginData &pair, _loadedPlugins.values()) { + _aboutPlugins->loadedPlugins->setItem(i, 0, new QTableWidgetItem(pair.first->metaObject()->className())); + _aboutPlugins->loadedPlugins->setItem(i, 1, new QTableWidgetItem(pair.second.value("Version").toString())); + _aboutPlugins->loadedPlugins->setItem(i, 2, new QTableWidgetItem(pair.second.value("Vendor").toString())); + _aboutPlugins->loadedPlugins->setRowHeight(i, 22); + ++i; + } + _aboutPlugins->loadedPlugins->resizeColumnsToContents(); + _aboutPluginsDialog->exec(); +} + +void MainWindow::on_psbJSEvaluate_clicked() +{ + ui->txeJavaScriptEvaluation->setText(_engine.evaluate(ui->txeJavaScript->toPlainText()).toString()); + ui->wrappedObjectView->updateSelected(); +} + +void MainWindow::metaModelChanged(QString newMetaModel) +{ + _newModel->lstTopLevelContainers->clear(); + QVariantList list; + typedef QPair PluginData; + foreach (const PluginData &pair, _loadedPlugins.values()) { + if (pair.first->metaObject()->className() == newMetaModel) + list = pair.second.value("MetaModelTopLevelClasses").toArray().toVariantList(); + } + foreach (QVariant variant, list) + _newModel->lstTopLevelContainers->addItem(variant.toString()); + _newModel->lstTopLevelContainers->setCurrentRow(0); +} + +bool MainWindow::eventFilter(QObject *obj, QEvent *event) +{ + if (event->type() == QEvent::KeyPress && obj == ui->txeJavaScript) { + QKeyEvent *keyEvent = static_cast(event); + if (keyEvent->key() == 46) { + QWrappedObject *wrappedObject = qwrappedobject_cast(dynamic_cast(_engine.evaluate(ui->txeJavaScript->toPlainText()).toQObject())); + if (wrappedObject) { + const QMetaWrappedObject *metaWrappedObject = wrappedObject->metaWrappedObject(); + int propertyCount = metaWrappedObject->propertyCount(); + QStringList propertyList; + for (int i = 0; i < propertyCount; ++i) + propertyList << metaWrappedObject->property(i).metaProperty.name(); + _codeCompletionView->setModel(new QStringListModel(propertyList)); + QFont font; + QFontMetrics fm(font); + _codeCompletionView->setGeometry(ui->txeJavaScript->cursorRect().x(), ui->txeJavaScript->cursorRect().y()+fm.height(), 200, 100); + _codeCompletionView->show(); + _codeCompletionView->setFocus(); + } + } + return QObject::eventFilter(obj, event); + } else if (event->type() == QEvent::KeyPress && obj == _codeCompletionView) { + QKeyEvent *keyEvent = static_cast(event); + if (keyEvent->key() == 16777220 || keyEvent->key() == 32) { // spacebar or enter + ui->txeJavaScript->insertPlainText(_codeCompletionView->model()->data(_codeCompletionView->selectionModel()->selectedIndexes().first()).toString()); + _codeCompletionView->hide(); + ui->txeJavaScript->setFocus(); + return true; + } + else if (keyEvent->key() == 16777235 || keyEvent->key() == 16777237 || keyEvent->key() == 16777239 || keyEvent->key() == 16777238) { // uparrow and downarrow, pageup, pagedown + return QObject::eventFilter(obj, event); + } + else { + _codeCompletionView->hide(); + ui->txeJavaScript->setFocus(); + return true; + } + } + // standard event processing + return QObject::eventFilter(obj, event); +} + +void MainWindow::loadPlugins() +{ + QMetaModelPlugin *metaModelPlugin = 0; + foreach (QString pluginPath, QCoreApplication::libraryPaths()) { + QDir pluginsDir(pluginPath); + pluginsDir.cd("metamodels"); + foreach (QString fileName, pluginsDir.entryList(QDir::Files)) { + QPluginLoader loader(pluginsDir.absoluteFilePath(fileName)); + QObject *plugin = loader.instance(); + if (plugin && (metaModelPlugin = qobject_cast(plugin))) + _loadedPlugins.insert(loader.metaData().value(QString::fromLatin1("MetaData")).toObject().value(QString::fromLatin1("MetaModelNamespaceUri")).toString(), QPair(metaModelPlugin, loader.metaData().value(QString::fromLatin1("MetaData")).toObject())); + } + } +} diff --git a/examples/uml/duse-mt/mainwindow.h b/examples/uml/duse-mt/mainwindow.h new file mode 100644 index 00000000..1ad996a5 --- /dev/null +++ b/examples/uml/duse-mt/mainwindow.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Sandro S. Andrade +** 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 MAINWINDOW_H +#define MAINWINDOW_H + +#include + +#include +#include + +#include + +class QDialog; +class QListView; + +namespace Ui { + class MainWindow; + class AboutPlugins; + class NewModel; +} + +class QWrappedObject; +class QMetaModelPlugin; +class QWrappedObjectModel; + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private Q_SLOTS: + void on_actionFileNew_triggered(); + void on_actionFileOpen_triggered(); + void on_actionFileSaveAs_triggered(); + void on_actionFileSave_triggered(); + void on_actionAboutPlugins_triggered(); + void on_psbJSEvaluate_clicked(); + + void metaModelChanged(QString newMetaModel); + +protected: + bool eventFilter(QObject *obj, QEvent *event); + +private: + void loadPlugins(); + void saveXmi(QWrappedObject *rootElement); + QWrappedObject *loadXmi(); + + Ui::MainWindow *ui; + QWrappedObjectModel *_wrappedObjectModel; + + QString _currentFileName; + QHash< QString, QPair > _loadedPlugins; + QDialog *_aboutPluginsDialog; + Ui::AboutPlugins *_aboutPlugins; + QDialog *_newModelDialog; + Ui::NewModel *_newModel; + + QScriptEngine _engine; + QListView *_codeCompletionView; +}; + +#endif // MAINWINDOW_H diff --git a/examples/uml/duse-mt/mainwindow.ui b/examples/uml/duse-mt/mainwindow.ui new file mode 100644 index 00000000..5328010a --- /dev/null +++ b/examples/uml/duse-mt/mainwindow.ui @@ -0,0 +1,365 @@ + + + MainWindow + + + + 0 + 0 + 831 + 474 + + + + DuSE-MT + + + + + + + + 0 + 0 + 831 + 19 + + + + + &File + + + + + + + + + + + + &Help + + + + + + + + + TopToolBarArea + + + false + + + + + + + + + Model Inspector + + + 1 + + + + + + + + + + + + Property Editor + + + 2 + + + + + + + + + + + + Issues + + + 8 + + + + + + + + 0 + 0 + + + + + 0 + 100 + + + + true + + + + + + + + + XPath Browser + + + 8 + + + + + + + + 0 + 0 + + + + + 0 + 100 + + + + + + + + + + OCL Browser + + + 8 + + + + + + + + 0 + 0 + + + + + 0 + 100 + + + + + + + + + + JavaScript Browser + + + 8 + + + + + + + + + JavaScript Editor + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + &Evaluate + + + + + + + + + + + + + JavaScript Output + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + true + + + true + + + + + + + + + + + + + + + :/icons/document-new.png:/icons/document-new.png + + + &New... + + + New + + + Ctrl+N + + + + + + :/icons/document-open.png:/icons/document-open.png + + + &Open... + + + Ctrl+O + + + + + + :/icons/document-save.png:/icons/document-save.png + + + &Save + + + Save + + + Ctrl+S + + + + + + :/icons/document-save-as.png:/icons/document-save-as.png + + + Save &as... + + + + + + :/icons/application-exit.png:/icons/application-exit.png + + + &Quit + + + Ctrl+Q + + + + + + :/icons/help-about.png:/icons/help-about.png + + + About &Plugins... + + + + + + + QWrappedObjectPropertyEditor + QWidget +
qwrappedobjectpropertyeditor.h
+ 1 +
+ + QWrappedObjectView + QWidget +
qwrappedobjectview.h
+ 1 +
+
+ + + + + + actionFileQuit + triggered() + MainWindow + close() + + + -1 + -1 + + + 415 + 236 + + + + +
diff --git a/examples/uml/duse-mt/newmodel.ui b/examples/uml/duse-mt/newmodel.ui new file mode 100644 index 00000000..4493f5f2 --- /dev/null +++ b/examples/uml/duse-mt/newmodel.ui @@ -0,0 +1,98 @@ + + + NewModel + + + + 0 + 0 + 453 + 217 + + + + Dialog + + + + + + + + Model name: + + + + + + + + + + Metamodel: + + + + + + + + + + + + + Top level container: + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + NewModel + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + NewModel + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/examples/uml/qtumleditor/aboutplugins.ui b/examples/uml/qtumleditor/aboutplugins.ui deleted file mode 100644 index 44ad9865..00000000 --- a/examples/uml/qtumleditor/aboutplugins.ui +++ /dev/null @@ -1,89 +0,0 @@ - - - AboutPlugins - - - - 0 - 0 - 400 - 300 - - - - Installed Plugins - - - - - - true - - - false - - - - Name - - - - - Version - - - - - Vendor - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close - - - - - - - - - buttonBox - accepted() - AboutPlugins - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - AboutPlugins - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/examples/uml/qtumleditor/example.xmi b/examples/uml/qtumleditor/example.xmi deleted file mode 100644 index e2d7d431..00000000 --- a/examples/uml/qtumleditor/example.xmi +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/examples/uml/qtumleditor/example2.xmi b/examples/uml/qtumleditor/example2.xmi deleted file mode 100644 index bbef77a4..00000000 --- a/examples/uml/qtumleditor/example2.xmi +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/examples/uml/qtumleditor/icons/application-exit.png b/examples/uml/qtumleditor/icons/application-exit.png deleted file mode 100644 index 9ae1f1fb..00000000 Binary files a/examples/uml/qtumleditor/icons/application-exit.png and /dev/null differ diff --git a/examples/uml/qtumleditor/icons/cleartext.png b/examples/uml/qtumleditor/icons/cleartext.png deleted file mode 100644 index 74133baf..00000000 Binary files a/examples/uml/qtumleditor/icons/cleartext.png and /dev/null differ diff --git a/examples/uml/qtumleditor/icons/document-new.png b/examples/uml/qtumleditor/icons/document-new.png deleted file mode 100644 index 61db97ae..00000000 Binary files a/examples/uml/qtumleditor/icons/document-new.png and /dev/null differ diff --git a/examples/uml/qtumleditor/icons/document-open.png b/examples/uml/qtumleditor/icons/document-open.png deleted file mode 100644 index 3432ed27..00000000 Binary files a/examples/uml/qtumleditor/icons/document-open.png and /dev/null differ diff --git a/examples/uml/qtumleditor/icons/document-save-as.png b/examples/uml/qtumleditor/icons/document-save-as.png deleted file mode 100644 index ed2453d9..00000000 Binary files a/examples/uml/qtumleditor/icons/document-save-as.png and /dev/null differ diff --git a/examples/uml/qtumleditor/icons/document-save.png b/examples/uml/qtumleditor/icons/document-save.png deleted file mode 100644 index cc380a03..00000000 Binary files a/examples/uml/qtumleditor/icons/document-save.png and /dev/null differ diff --git a/examples/uml/qtumleditor/icons/help-about.png b/examples/uml/qtumleditor/icons/help-about.png deleted file mode 100644 index 8f3a936d..00000000 Binary files a/examples/uml/qtumleditor/icons/help-about.png and /dev/null differ diff --git a/examples/uml/qtumleditor/icons/resetproperty.png b/examples/uml/qtumleditor/icons/resetproperty.png deleted file mode 100644 index 9048252e..00000000 Binary files a/examples/uml/qtumleditor/icons/resetproperty.png and /dev/null differ diff --git a/examples/uml/qtumleditor/main.cpp b/examples/uml/qtumleditor/main.cpp deleted file mode 100644 index 9c210fbc..00000000 --- a/examples/uml/qtumleditor/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Sandro S. Andrade -** 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 "mainwindow.h" -#include - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - MainWindow w; - w.showMaximized(); - - return a.exec(); -} diff --git a/examples/uml/qtumleditor/mainwindow.cpp b/examples/uml/qtumleditor/mainwindow.cpp deleted file mode 100644 index 9ea275a9..00000000 --- a/examples/uml/qtumleditor/mainwindow.cpp +++ /dev/null @@ -1,307 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Sandro S. Andrade -** 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 "mainwindow.h" -#include "ui_mainwindow.h" -#include "ui_aboutplugins.h" -#include "ui_newmodel.h" - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::MainWindow), - _wrappedObjectModel(new QWrappedObjectModel(this)), - _aboutPluginsDialog(new QDialog(this)), - _aboutPlugins(new Ui::AboutPlugins), - _newModelDialog(new QDialog(this)), - _newModel(new Ui::NewModel), - _codeCompletionView(new QListView) -{ - ui->setupUi(this); - _codeCompletionView->setParent(ui->txeJavaScript); - _codeCompletionView->hide(); - - ui->wrappedObjectView->setModel(_wrappedObjectModel); - - _newModel->setupUi(_newModelDialog); - connect(_newModel->cboMetamodel, SIGNAL(currentIndexChanged(QString)), SLOT(metaModelChanged(QString))); - _aboutPlugins->setupUi(_aboutPluginsDialog); - - QWrappedObjectPropertyModel *propertyModel = new QWrappedObjectPropertyModel(this); - ui->propertyEditor->setModel(propertyModel); - - connect(ui->wrappedObjectView, &QWrappedObjectView::wrappedObjectChanged, - propertyModel, &QWrappedObjectPropertyModel::setWrappedObject); - connect(propertyModel, &QWrappedObjectPropertyModel::indexChanged, - _wrappedObjectModel, &QWrappedObjectModel::updateIndex); - - loadPlugins(); - - QPalette modelPallete = ui->txeIssues->palette(); - modelPallete.setColor(QPalette::Active, QPalette::Base, QColor(255, 255, 255)); - modelPallete.setColor(QPalette::Inactive, QPalette::Base, QColor(255, 255, 255)); - modelPallete.setColor(QPalette::Active, QPalette::AlternateBase, QColor(248, 247, 246)); - modelPallete.setColor(QPalette::Inactive, QPalette::AlternateBase, QColor(248, 247, 246)); - ui->txeIssues->setPalette(modelPallete); - - tabifyDockWidget(ui->dckIssues, ui->dckXPath); - tabifyDockWidget(ui->dckXPath, ui->dckOcl); - tabifyDockWidget(ui->dckOcl, ui->dckJavaScript); - ui->dckIssues->raise(); - - ui->txeJavaScript->installEventFilter(this); - _codeCompletionView->installEventFilter(this); -} - -MainWindow::~MainWindow() -{ - delete ui; -} - -void MainWindow::on_actionFileNew_triggered() -{ - _newModel->lneModel->clear(); - _newModel->cboMetamodel->clear(); - int i = 0; - typedef QPair PluginData; - foreach (const PluginData &pair, _loadedPlugins.values()) { - _newModel->cboMetamodel->addItem(pair.first->metaObject()->className()); - ++i; - } - int type; - if (_newModelDialog->exec() == QDialog::Accepted) { - foreach (const PluginData &pair, _loadedPlugins.values()) { - if (pair.first->metaObject()->className() == _newModel->cboMetamodel->currentText()) - pair.first->initMetaModel(&_engine); - } - if ((type = QMetaType::type(_newModel->lstTopLevelContainers->currentItem()->text().append("*").toLatin1())) != QMetaType::UnknownType) { - const QMetaObject *metaObject = QMetaType::metaObjectForType(type); - if (metaObject) { - QWrappedObject *topLevelElement = dynamic_cast(metaObject->newInstance()); - if (topLevelElement) { - topLevelElement->setObjectName(_newModel->lneModel->text()); - _wrappedObjectModel->setWrappedObject(topLevelElement); - } - } - } - } -} - -void MainWindow::saveXmi(QWrappedObject *rootElement) -{ - QFile file(_currentFileName); - if (!file.open(QFile::WriteOnly | QFile::Text)) { - QMessageBox::critical(this, tr("Save As"), tr("Cannot write file !")); - return; - } - - QXmiWriter writer(rootElement); - if (!writer.writeFile(&file)) - QMessageBox::critical(this, tr("Save As"), tr("Error when writing XMI file !")); - else { - statusBar()->showMessage("XMI file successfully saved !", 3000); - setWindowTitle(QFileInfo(file).fileName() + " - QtUml Editor"); - } -} - -QWrappedObject *MainWindow::loadXmi() -{ - QFile file(_currentFileName); - if (!file.open(QFile::ReadOnly | QFile::Text)) { - QMessageBox::critical(this, tr("Open"), tr("Cannot read file !")); - return 0; - } - - QXmiReader reader(&_engine, true); - setWindowTitle(QFileInfo(file).fileName() + " - QtUml Editor"); - QWrappedObject *wrappedObject = reader.readFile(&file); - ui->txeIssues->setModel(new QStringListModel(reader.errorStrings())); - if (wrappedObject) { - _engine.globalObject().setProperty("model", _engine.newQObject(wrappedObject)); - _engine.globalObject().setProperty(wrappedObject->objectName(), _engine.newQObject(wrappedObject)); - ui->txeJavaScript->setText(wrappedObject->objectName()); - QTimer::singleShot(0, this, SLOT(on_psbJSEvaluate_clicked())); - } - - return wrappedObject; -} - -void MainWindow::on_actionFileOpen_triggered() -{ - QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), QDir::currentPath(), "XMI files (*.xmi)"); - if (!fileName.isEmpty()) { - _currentFileName = fileName; - delete _wrappedObjectModel->wrappedObject(); - _wrappedObjectModel->setWrappedObject(loadXmi()); - } -} - -void MainWindow::on_actionFileSaveAs_triggered() -{ - QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), QDir::currentPath(), "XMI files (*.xmi)"); - if (!fileName.isEmpty()) { - _currentFileName = fileName; - saveXmi(_wrappedObjectModel->wrappedObject()); - } -} - -void MainWindow::on_actionFileSave_triggered() -{ - if (_currentFileName.isEmpty()) - on_actionFileSaveAs_triggered(); - else - saveXmi(_wrappedObjectModel->wrappedObject()); -} - -void MainWindow::on_actionAboutPlugins_triggered() -{ - _aboutPlugins->loadedPlugins->clearContents(); - _aboutPlugins->loadedPlugins->setRowCount(_loadedPlugins.size()); - int i = 0; - typedef QPair PluginData; - foreach (const PluginData &pair, _loadedPlugins.values()) { - _aboutPlugins->loadedPlugins->setItem(i, 0, new QTableWidgetItem(pair.first->metaObject()->className())); - _aboutPlugins->loadedPlugins->setItem(i, 1, new QTableWidgetItem(pair.second.value("Version").toString())); - _aboutPlugins->loadedPlugins->setItem(i, 2, new QTableWidgetItem(pair.second.value("Vendor").toString())); - _aboutPlugins->loadedPlugins->setRowHeight(i, 22); - ++i; - } - _aboutPlugins->loadedPlugins->resizeColumnsToContents(); - _aboutPluginsDialog->exec(); -} - -void MainWindow::on_psbJSEvaluate_clicked() -{ - ui->txeJavaScriptEvaluation->setText(_engine.evaluate(ui->txeJavaScript->toPlainText()).toString()); - ui->wrappedObjectView->updateSelected(); -} - -void MainWindow::metaModelChanged(QString newMetaModel) -{ - _newModel->lstTopLevelContainers->clear(); - QVariantList list; - typedef QPair PluginData; - foreach (const PluginData &pair, _loadedPlugins.values()) { - if (pair.first->metaObject()->className() == newMetaModel) - list = pair.second.value("MetaModelTopLevelClasses").toArray().toVariantList(); - } - foreach (QVariant variant, list) - _newModel->lstTopLevelContainers->addItem(variant.toString()); - _newModel->lstTopLevelContainers->setCurrentRow(0); -} - -bool MainWindow::eventFilter(QObject *obj, QEvent *event) -{ - if (event->type() == QEvent::KeyPress && obj == ui->txeJavaScript) { - QKeyEvent *keyEvent = static_cast(event); - if (keyEvent->key() == 46) { - QWrappedObject *wrappedObject = qwrappedobject_cast(dynamic_cast(_engine.evaluate(ui->txeJavaScript->toPlainText()).toQObject())); - if (wrappedObject) { - const QMetaWrappedObject *metaWrappedObject = wrappedObject->metaWrappedObject(); - int propertyCount = metaWrappedObject->propertyCount(); - QStringList propertyList; - for (int i = 0; i < propertyCount; ++i) - propertyList << metaWrappedObject->property(i).metaProperty.name(); - _codeCompletionView->setModel(new QStringListModel(propertyList)); - QFont font; - QFontMetrics fm(font); - _codeCompletionView->setGeometry(ui->txeJavaScript->cursorRect().x(), ui->txeJavaScript->cursorRect().y()+fm.height(), 200, 100); - _codeCompletionView->show(); - _codeCompletionView->setFocus(); - } - } - return QObject::eventFilter(obj, event); - } else if (event->type() == QEvent::KeyPress && obj == _codeCompletionView) { - QKeyEvent *keyEvent = static_cast(event); - if (keyEvent->key() == 16777220 || keyEvent->key() == 32) { // spacebar or enter - ui->txeJavaScript->insertPlainText(_codeCompletionView->model()->data(_codeCompletionView->selectionModel()->selectedIndexes().first()).toString()); - _codeCompletionView->hide(); - ui->txeJavaScript->setFocus(); - return true; - } - else if (keyEvent->key() == 16777235 || keyEvent->key() == 16777237 || keyEvent->key() == 16777239 || keyEvent->key() == 16777238) { // uparrow and downarrow, pageup, pagedown - return QObject::eventFilter(obj, event); - } - else { - _codeCompletionView->hide(); - ui->txeJavaScript->setFocus(); - return true; - } - } - // standard event processing - return QObject::eventFilter(obj, event); -} - -void MainWindow::loadPlugins() -{ - QMetaModelPlugin *metaModelPlugin = 0; - foreach (QString pluginPath, QCoreApplication::libraryPaths()) { - QDir pluginsDir(pluginPath); - pluginsDir.cd("metamodels"); - foreach (QString fileName, pluginsDir.entryList(QDir::Files)) { - QPluginLoader loader(pluginsDir.absoluteFilePath(fileName)); - QObject *plugin = loader.instance(); - if (plugin && (metaModelPlugin = qobject_cast(plugin))) - _loadedPlugins.insert(loader.metaData().value(QString::fromLatin1("MetaData")).toObject().value(QString::fromLatin1("MetaModelNamespaceUri")).toString(), QPair(metaModelPlugin, loader.metaData().value(QString::fromLatin1("MetaData")).toObject())); - } - } -} diff --git a/examples/uml/qtumleditor/mainwindow.h b/examples/uml/qtumleditor/mainwindow.h deleted file mode 100644 index 1ad996a5..00000000 --- a/examples/uml/qtumleditor/mainwindow.h +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Sandro S. Andrade -** 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 MAINWINDOW_H -#define MAINWINDOW_H - -#include - -#include -#include - -#include - -class QDialog; -class QListView; - -namespace Ui { - class MainWindow; - class AboutPlugins; - class NewModel; -} - -class QWrappedObject; -class QMetaModelPlugin; -class QWrappedObjectModel; - -class MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - explicit MainWindow(QWidget *parent = 0); - ~MainWindow(); - -private Q_SLOTS: - void on_actionFileNew_triggered(); - void on_actionFileOpen_triggered(); - void on_actionFileSaveAs_triggered(); - void on_actionFileSave_triggered(); - void on_actionAboutPlugins_triggered(); - void on_psbJSEvaluate_clicked(); - - void metaModelChanged(QString newMetaModel); - -protected: - bool eventFilter(QObject *obj, QEvent *event); - -private: - void loadPlugins(); - void saveXmi(QWrappedObject *rootElement); - QWrappedObject *loadXmi(); - - Ui::MainWindow *ui; - QWrappedObjectModel *_wrappedObjectModel; - - QString _currentFileName; - QHash< QString, QPair > _loadedPlugins; - QDialog *_aboutPluginsDialog; - Ui::AboutPlugins *_aboutPlugins; - QDialog *_newModelDialog; - Ui::NewModel *_newModel; - - QScriptEngine _engine; - QListView *_codeCompletionView; -}; - -#endif // MAINWINDOW_H diff --git a/examples/uml/qtumleditor/mainwindow.ui b/examples/uml/qtumleditor/mainwindow.ui deleted file mode 100644 index 9134fbf8..00000000 --- a/examples/uml/qtumleditor/mainwindow.ui +++ /dev/null @@ -1,365 +0,0 @@ - - - MainWindow - - - - 0 - 0 - 831 - 474 - - - - QtUml Editor - - - - - - - - 0 - 0 - 831 - 19 - - - - - &File - - - - - - - - - - - - &Help - - - - - - - - - TopToolBarArea - - - false - - - - - - - - - Model Inspector - - - 1 - - - - - - - - - - - - Property Editor - - - 2 - - - - - - - - - - - - Issues - - - 8 - - - - - - - - 0 - 0 - - - - - 0 - 100 - - - - true - - - - - - - - - XPath Browser - - - 8 - - - - - - - - 0 - 0 - - - - - 0 - 100 - - - - - - - - - - OCL Browser - - - 8 - - - - - - - - 0 - 0 - - - - - 0 - 100 - - - - - - - - - - JavaScript Browser - - - 8 - - - - - - - - - JavaScript Editor - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - &Evaluate - - - - - - - - - - - - - JavaScript Output - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - true - - - true - - - - - - - - - - - - - - - :/icons/document-new.png:/icons/document-new.png - - - &New... - - - New - - - Ctrl+N - - - - - - :/icons/document-open.png:/icons/document-open.png - - - &Open... - - - Ctrl+O - - - - - - :/icons/document-save.png:/icons/document-save.png - - - &Save - - - Save - - - Ctrl+S - - - - - - :/icons/document-save-as.png:/icons/document-save-as.png - - - Save &as... - - - - - - :/icons/application-exit.png:/icons/application-exit.png - - - &Quit - - - Ctrl+Q - - - - - - :/icons/help-about.png:/icons/help-about.png - - - About &Plugins... - - - - - - - QWrappedObjectPropertyEditor - QWidget -
qwrappedobjectpropertyeditor.h
- 1 -
- - QWrappedObjectView - QWidget -
qwrappedobjectview.h
- 1 -
-
- - - - - - actionFileQuit - triggered() - MainWindow - close() - - - -1 - -1 - - - 415 - 236 - - - - -
diff --git a/examples/uml/qtumleditor/newmodel.ui b/examples/uml/qtumleditor/newmodel.ui deleted file mode 100644 index 4493f5f2..00000000 --- a/examples/uml/qtumleditor/newmodel.ui +++ /dev/null @@ -1,98 +0,0 @@ - - - NewModel - - - - 0 - 0 - 453 - 217 - - - - Dialog - - - - - - - - Model name: - - - - - - - - - - Metamodel: - - - - - - - - - - - - - Top level container: - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - NewModel - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - NewModel - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/examples/uml/qtumleditor/qtumleditor.pro b/examples/uml/qtumleditor/qtumleditor.pro deleted file mode 100644 index 5c248cd0..00000000 --- a/examples/uml/qtumleditor/qtumleditor.pro +++ /dev/null @@ -1,31 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2012-10-26T12:43:33 -# -#------------------------------------------------- - -QT = wrappedobjectswidgets script - -TARGET = qtumleditor -TEMPLATE = app - -target.path = $$[QT_INSTALL_PREFIX]/bin - -xmi.path = $$[QT_INSTALL_PREFIX]/share/doc/packages/qtumleditor -xmi.files = example.xmi - -INSTALLS += target xmi - -CONFIG += c++11 - -SOURCES += main.cpp \ - mainwindow.cpp - -HEADERS += mainwindow.h \ - -FORMS += mainwindow.ui \ - aboutplugins.ui \ - newmodel.ui - -RESOURCES += \ - qtumleditor.qrc diff --git a/examples/uml/qtumleditor/qtumleditor.qrc b/examples/uml/qtumleditor/qtumleditor.qrc deleted file mode 100644 index e46a2a73..00000000 --- a/examples/uml/qtumleditor/qtumleditor.qrc +++ /dev/null @@ -1,12 +0,0 @@ - - - icons/resetproperty.png - icons/help-about.png - icons/application-exit.png - icons/document-new.png - icons/document-open.png - icons/document-save-as.png - icons/document-save.png - icons/cleartext.png - - diff --git a/examples/uml/uml.pro b/examples/uml/uml.pro index 65307ce6..78a8dc4f 100644 --- a/examples/uml/uml.pro +++ b/examples/uml/uml.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs SUBDIRS = nested-packages profiles xmi-write xmi-read -qtHaveModule(widgets): SUBDIRS += qtumleditor +qtHaveModule(widgets): SUBDIRS += duse-mt -- cgit v1.2.3