diff options
author | Sandro S. Andrade <sandroandrade@kde.org> | 2013-10-30 11:36:52 -0300 |
---|---|---|
committer | Sandro S. Andrade <sandroandrade@kde.org> | 2013-10-30 15:40:57 +0100 |
commit | 40ca2a15895df77bf3e953365b2980428e747210 (patch) | |
tree | c38dd2c3b043414bbe768209b6a2922465c96504 | |
parent | 6bf039a2d530bbfabb7f56d7160df7fcbcb78c6e (diff) |
Move DuSE-MT welcome screen from core to plugin
Change-Id: Ie662a382c1af5b17e27d147f91de1336d3b02ac5
Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
16 files changed, 188 insertions, 37 deletions
diff --git a/examples/uml/duse-mt/src/app/duse-mt.qrc b/examples/uml/duse-mt/src/app/duse-mt.qrc index 1455a739..f9fb4486 100644 --- a/examples/uml/duse-mt/src/app/duse-mt.qrc +++ b/examples/uml/duse-mt/src/app/duse-mt.qrc @@ -20,7 +20,6 @@ <file>metamodels/PrimitiveTypes.xmi</file> <file>metamodels/UML.xmi</file> <file>metamodels/SADuSEProfile.xmi</file> - <file>qml/welcomeview.qml</file> <file>qml/designspaceview.qml</file> </qresource> </RCC> diff --git a/examples/uml/duse-mt/src/app/mainwindow.ui b/examples/uml/duse-mt/src/app/mainwindow.ui index 557ad212..175cf648 100644 --- a/examples/uml/duse-mt/src/app/mainwindow.ui +++ b/examples/uml/duse-mt/src/app/mainwindow.ui @@ -36,28 +36,6 @@ <property name="currentIndex"> <number>0</number> </property> - <widget class="QWidget" name="tabWelcome"> - <attribute name="title"> - <string>Welcome to DuSE-MT</string> - </attribute> - <layout class="QGridLayout" name="gridLayout_13"> - <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="welcomeViewWidget" native="true"/> - </item> - </layout> - </widget> <widget class="QWidget" name="tabModelView"> <attribute name="title"> <string>Input Model</string> diff --git a/examples/uml/duse-mt/src/app/shell/core.h b/examples/uml/duse-mt/src/app/shell/core.h index 901763e6..746f4a88 100644 --- a/examples/uml/duse-mt/src/app/shell/core.h +++ b/examples/uml/duse-mt/src/app/shell/core.h @@ -60,6 +60,7 @@ public: virtual IPluginController *pluginController(); virtual IProjectController *projectController(); virtual IUiController *uiController(); + protected: Core(); bool initializeInternal(); diff --git a/examples/uml/duse-mt/src/app/shell/mainwindow.cpp b/examples/uml/duse-mt/src/app/shell/mainwindow.cpp index c0ab680f..b3625993 100644 --- a/examples/uml/duse-mt/src/app/shell/mainwindow.cpp +++ b/examples/uml/duse-mt/src/app/shell/mainwindow.cpp @@ -94,7 +94,7 @@ MainWindow::MainWindow(QWidget *parent) : _newModelDialog(new QDialog(this)), _newModel(new Ui::NewModel), _newDuseDesign(new NewDuseDesign(this)), - _welcomeQuickView(new QQuickView), +// _welcomeQuickView(new QQuickView), _modelQuickView(new QQuickView), _designSpaceQuickView(new QQuickView), _metricsQuickView(new QQuickView), @@ -122,8 +122,8 @@ MainWindow::MainWindow(QWidget *parent) : _paretoFrontQuickView->setSource(QUrl("qrc:/qml/paretofrontview.qml")); ui->gridLayout_12->addWidget(QWidget::createWindowContainer(_paretoFrontQuickView, ui->paretoFrontViewWidget), 0, 0, 1, 1); - _welcomeQuickView->setSource(QUrl("qrc:/qml/welcomeview.qml")); - ui->gridLayout_13->addWidget(QWidget::createWindowContainer(_welcomeQuickView, ui->welcomeViewWidget), 0, 0, 1, 1); +// _welcomeQuickView->setSource(QUrl("qrc:/qml/welcomeview.qml")); +// ui->gridLayout_13->addWidget(QWidget::createWindowContainer(_welcomeQuickView, ui->welcomeViewWidget), 0, 0, 1, 1); _designSpaceQuickView->setSource(QUrl("qrc:/qml/designspaceview.qml")); ui->gridLayout_15->addWidget(QWidget::createWindowContainer(_designSpaceQuickView, ui->designSpaceLocationViewWidget), 0, 0, 1, 1); @@ -132,7 +132,7 @@ MainWindow::MainWindow(QWidget *parent) : _designSpaceQuickView->setResizeMode(QQuickView::SizeRootObjectToView); _metricsQuickView->setResizeMode(QQuickView::SizeRootObjectToView); _paretoFrontQuickView->setResizeMode(QQuickView::SizeRootObjectToView); - _welcomeQuickView->setResizeMode(QQuickView::SizeRootObjectToView); +// _welcomeQuickView->setResizeMode(QQuickView::SizeRootObjectToView); readSettings(); } diff --git a/examples/uml/duse-mt/src/app/shell/mainwindow.h b/examples/uml/duse-mt/src/app/shell/mainwindow.h index 28a60668..f9c13bfe 100644 --- a/examples/uml/duse-mt/src/app/shell/mainwindow.h +++ b/examples/uml/duse-mt/src/app/shell/mainwindow.h @@ -116,8 +116,6 @@ private: QList<QModelingElement *> _inputModel; QList<QModelingElement *> _designSpaceLocation; -// QHash< QString, QPair<QMetaModelPlugin *, QJsonObject> > _metamodelPlugins; -// QList< QPair<DuSE::IPlugin *, QJsonObject> > _dusemtPlugins; QDialog *_aboutPluginsDialog; Ui::AboutPlugins *_aboutPlugins; QDialog *_aboutDuSEMTDialog; @@ -126,10 +124,8 @@ private: Ui::NewModel *_newModel; NewDuseDesign *_newDuseDesign; -// QScriptEngine _engine; -// QListView *_codeCompletionView; QQmlComponent *_qmlComponent; - QQuickView *_welcomeQuickView; +// QQuickView *_welcomeQuickView; QQuickView *_modelQuickView; QQuickView *_designSpaceQuickView; QQuickView *_metricsQuickView; diff --git a/examples/uml/duse-mt/src/app/shell/uicontroller.cpp b/examples/uml/duse-mt/src/app/shell/uicontroller.cpp index 2b686115..7e571426 100644 --- a/examples/uml/duse-mt/src/app/shell/uicontroller.cpp +++ b/examples/uml/duse-mt/src/app/shell/uicontroller.cpp @@ -81,11 +81,27 @@ void UiController::addDockWidget(Qt::DockWidgetArea area, QString name, QWidget } } -void UiController::removeDockWidget(QString name) +void UiController::removeDockWidget(const QString &name) { foreach (QObject *child, _mainWindow.children()) if (child->objectName() == name && qobject_cast<QDockWidget *>(child) != 0) delete child; } +void UiController::addCentralWidgetTab(QWidget *widget, const QString &label, const QIcon &icon) +{ + _mainWindow.ui->centralWidget->addTab(widget, icon, label); + widget->setObjectName(label); +} + +void UiController::removeCentralWidgetTab(const QString &name) +{ + int tabCount = _mainWindow.ui->centralWidget->count(); + for (int i = 0; i < tabCount; ++i) + if (_mainWindow.ui->centralWidget->widget(i)->objectName() == name) { + _mainWindow.ui->centralWidget->removeTab(i); + break; + } +} + } diff --git a/examples/uml/duse-mt/src/app/shell/uicontroller.h b/examples/uml/duse-mt/src/app/shell/uicontroller.h index 90d9be4f..e549a3ab 100644 --- a/examples/uml/duse-mt/src/app/shell/uicontroller.h +++ b/examples/uml/duse-mt/src/app/shell/uicontroller.h @@ -57,7 +57,10 @@ public: virtual bool initialize(); virtual void addDockWidget(Qt::DockWidgetArea area, QString name, QWidget *widget); - virtual void removeDockWidget(QString name); + virtual void removeDockWidget(const QString &name); + + virtual void addCentralWidgetTab(QWidget *widget, const QString &label, const QIcon &icon = QIcon()); + virtual void removeCentralWidgetTab(const QString &name); protected: MainWindow _mainWindow; diff --git a/examples/uml/duse-mt/src/libs/interfaces/iuicontroller.h b/examples/uml/duse-mt/src/libs/interfaces/iuicontroller.h index 1a5dc538..7d1ca396 100644 --- a/examples/uml/duse-mt/src/libs/interfaces/iuicontroller.h +++ b/examples/uml/duse-mt/src/libs/interfaces/iuicontroller.h @@ -45,6 +45,8 @@ #include <QtCore/QString> +#include <QtGui/QIcon> + class QModelingObject; class QWidget; @@ -62,7 +64,10 @@ public: virtual bool initialize() = 0; virtual void addDockWidget(Qt::DockWidgetArea area, QString name, QWidget *widget) = 0; - virtual void removeDockWidget(QString name) = 0; + virtual void removeDockWidget(const QString &name) = 0; + + virtual void addCentralWidgetTab(QWidget *widget, const QString &label, const QIcon &icon = QIcon()) = 0; + virtual void removeCentralWidgetTab(const QString &name) = 0; Q_SIGNALS: void currentModelingObjectChanged(QModelingObject *currentModelingObject); diff --git a/examples/uml/duse-mt/src/plugins/plugins.pro b/examples/uml/duse-mt/src/plugins/plugins.pro index 1ec83b60..739bfc39 100644 --- a/examples/uml/duse-mt/src/plugins/plugins.pro +++ b/examples/uml/duse-mt/src/plugins/plugins.pro @@ -3,4 +3,5 @@ CONFIG += ordered SUBDIRS = \ modelinspector \ - javascriptconsole + javascriptconsole \ + welcomedashboard diff --git a/examples/uml/duse-mt/src/plugins/welcomedashboard/qml/duse-mt-64x64.png b/examples/uml/duse-mt/src/plugins/welcomedashboard/qml/duse-mt-64x64.png Binary files differnew file mode 100644 index 00000000..ec26192f --- /dev/null +++ b/examples/uml/duse-mt/src/plugins/welcomedashboard/qml/duse-mt-64x64.png diff --git a/examples/uml/duse-mt/src/app/qml/welcomeview.qml b/examples/uml/duse-mt/src/plugins/welcomedashboard/qml/welcomedashboard.qml index 40d56d91..7dab38df 100644 --- a/examples/uml/duse-mt/src/app/qml/welcomeview.qml +++ b/examples/uml/duse-mt/src/plugins/welcomedashboard/qml/welcomedashboard.qml @@ -46,7 +46,7 @@ Rectangle { spacing: 10 Image { id: duseIcon - source: "qrc:/icons/duse-mt-64x64.png" + source: "duse-mt-64x64.png" } Text { text: "Welcome to DuSE-MT !" diff --git a/examples/uml/duse-mt/src/plugins/welcomedashboard/qml/welcomedashboard.qrc b/examples/uml/duse-mt/src/plugins/welcomedashboard/qml/welcomedashboard.qrc new file mode 100644 index 00000000..6dcf2323 --- /dev/null +++ b/examples/uml/duse-mt/src/plugins/welcomedashboard/qml/welcomedashboard.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/welcomedashboard"> + <file>welcomedashboard.qml</file> + <file>duse-mt-64x64.png</file> + </qresource> +</RCC> diff --git a/examples/uml/duse-mt/src/plugins/welcomedashboard/welcomedashboard.json b/examples/uml/duse-mt/src/plugins/welcomedashboard/welcomedashboard.json new file mode 100644 index 00000000..86c0672f --- /dev/null +++ b/examples/uml/duse-mt/src/plugins/welcomedashboard/welcomedashboard.json @@ -0,0 +1,5 @@ +{ + "Category": "Test", + "Vendor": "Qt Project", + "Version": "1.0" +} diff --git a/examples/uml/duse-mt/src/plugins/welcomedashboard/welcomedashboard.pro b/examples/uml/duse-mt/src/plugins/welcomedashboard/welcomedashboard.pro new file mode 100644 index 00000000..7aa22dae --- /dev/null +++ b/examples/uml/duse-mt/src/plugins/welcomedashboard/welcomedashboard.pro @@ -0,0 +1,15 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2013-10-25T17:38:51 +# +#------------------------------------------------- + +include(../../duse-mt-plugin.pri) + +SOURCES += welcomedashboardplugin.cpp + +HEADERS += welcomedashboardplugin.h + +RESOURCES += qml/welcomedashboard.qrc + +OTHER_FILES += welcomedashboard.json diff --git a/examples/uml/duse-mt/src/plugins/welcomedashboard/welcomedashboardplugin.cpp b/examples/uml/duse-mt/src/plugins/welcomedashboard/welcomedashboardplugin.cpp new file mode 100644 index 00000000..e6543b29 --- /dev/null +++ b/examples/uml/duse-mt/src/plugins/welcomedashboard/welcomedashboardplugin.cpp @@ -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$ +** +****************************************************************************/ +#include "welcomedashboardplugin.h" + +#include <interfaces/iuicontroller.h> + +#include <QtQuick/QQuickView> + +#include <QtWidgets/QWidget> + +WelcomeDashboardPlugin::WelcomeDashboardPlugin(QObject *parent) : + DuSE::IPlugin(parent), + _welcomeQuickView(new QQuickView) +{ +} + +bool WelcomeDashboardPlugin::initialize(DuSE::ICore *core) +{ + _welcomeQuickView->setSource(QUrl("qrc:/welcomedashboard/welcomedashboard.qml")); + _welcomeQuickView->setResizeMode(QQuickView::SizeRootObjectToView); + + core->uiController()->addCentralWidgetTab(QWidget::createWindowContainer(_welcomeQuickView), "Welcome"); + + return true; +} diff --git a/examples/uml/duse-mt/src/plugins/welcomedashboard/welcomedashboardplugin.h b/examples/uml/duse-mt/src/plugins/welcomedashboard/welcomedashboardplugin.h new file mode 100644 index 00000000..dba43103 --- /dev/null +++ b/examples/uml/duse-mt/src/plugins/welcomedashboard/welcomedashboardplugin.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 WELCOMEDASHBOARDPLUGIN_H +#define WELCOMEDASHBOARDPLUGIN_H + +#include <interfaces/iplugin.h> + +class QQuickView; + +class WelcomeDashboardPlugin : public DuSE::IPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.liveblue.DuSE.IPlugin" FILE "welcomedashboard.json") + +public: + WelcomeDashboardPlugin(QObject *parent = 0); + + virtual bool initialize(DuSE::ICore *core); + +private: + QQuickView *_welcomeQuickView; +}; + +#endif // WELCOMEDASHBOARDPLUGIN_H + |