Commit cf3e8163 authored by Marco Bubke's avatar Marco Bubke

QmlDesigner: Move ImportManagerView to ItemLibrary

Change-Id: I546199945e4b0b0acc7e4b656da547868b1cc99d
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent f6fc78ea
......@@ -30,10 +30,14 @@
#include "itemlibraryview.h"
#include "itemlibrarywidget.h"
#include <import.h>
#include <importmanagerview.h>
namespace QmlDesigner {
ItemLibraryView::ItemLibraryView(QObject* parent) : AbstractView(parent)
ItemLibraryView::ItemLibraryView(QObject* parent)
: AbstractView(parent),
m_importManagerView(new ImportManagerView(this))
{
}
......@@ -50,8 +54,10 @@ bool ItemLibraryView::hasWidget() const
WidgetInfo ItemLibraryView::widgetInfo()
{
if (m_widget.isNull())
m_widget = new ItemLibraryWidget;
if (m_widget.isNull()) {
m_widget = new ItemLibraryWidget;
m_widget->setImportsWidget(m_importManagerView->widgetInfo().widget);
}
return createWidgetInfo(m_widget.data(),
new WidgetInfo::ToolBarWidgetDefaultFactory<ItemLibraryWidget>(m_widget.data()),
......@@ -65,10 +71,13 @@ void ItemLibraryView::modelAttached(Model *model)
AbstractView::modelAttached(model);
m_widget->setModel(model);
updateImports();
model->attachView(m_importManagerView);
}
void ItemLibraryView::modelAboutToBeDetached(Model *model)
{
model->detachView(m_importManagerView);
AbstractView::modelAboutToBeDetached(model);
m_widget->setModel(0);
}
......
......@@ -38,7 +38,7 @@
namespace QmlDesigner {
class ItemLibraryWidget;
class ImportManagerView;
class ItemLibraryView : public AbstractView
{
......@@ -107,6 +107,7 @@ protected:
private:
QWeakPointer<ItemLibraryWidget> m_widget;
ImportManagerView *m_importManagerView;
};
}
......
......@@ -111,6 +111,7 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
QTabBar *tabBar = new QTabBar(this);
tabBar->addTab(tr("QML Types", "Title of library QML types view"));
tabBar->addTab(tr("Resources", "Title of library resources view"));
tabBar->addTab(tr("Imports", "Title of library imports view"));
tabBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_lineEdit = new Utils::FilterLineEdit(this);
......@@ -192,6 +193,11 @@ void ItemLibraryWidget::updateImports()
setImportFilter(filter);
}
void ItemLibraryWidget::setImportsWidget(QWidget *importsWidget)
{
m_stackedWidget->addWidget(importsWidget);
}
QList<QToolButton *> ItemLibraryWidget::createToolBarWidgets()
{
QList<QToolButton *> buttons;
......
......@@ -85,6 +85,8 @@ public:
void updateImports();
void setImportsWidget(QWidget *importsWidget);
public Q_SLOTS:
void setSearchFilter(const QString &searchFilter);
void updateModel();
......
......@@ -110,7 +110,6 @@ private: // variables
Internal::DebugView m_debugView;
ComponentView m_componentView;
FormEditorView m_formEditorView;
ImportManagerView m_importManagerView;
ItemLibraryView m_itemLibraryView;
NavigatorView m_navigatorView;
PropertyEditorView m_propertyEditorView;
......
......@@ -102,7 +102,6 @@ void ViewManager::detachViewsExceptRewriterAndComponetView()
currentModel()->detachView(&m_formEditorView);
currentModel()->detachView(&m_navigatorView);
currentModel()->detachView(&m_itemLibraryView);
currentModel()->detachView(&m_importManagerView);
currentModel()->detachView(&m_statesEditorView);
currentModel()->detachView(&m_propertyEditorView);
......@@ -150,7 +149,6 @@ void ViewManager::attachViewsExceptRewriterAndComponetView()
attachNodeInstanceView();
currentModel()->attachView(&m_formEditorView);
currentModel()->attachView(&m_navigatorView);
currentModel()->attachView(&m_importManagerView);
attachItemLibraryView();
currentModel()->attachView(&m_statesEditorView);
currentModel()->attachView(&m_propertyEditorView);
......@@ -184,7 +182,6 @@ QList<WidgetInfo> ViewManager::widgetInfos()
QList<WidgetInfo> widgetInfoList;
widgetInfoList.append(m_formEditorView.widgetInfo());
widgetInfoList.append(m_importManagerView.widgetInfo());
widgetInfoList.append(m_itemLibraryView.widgetInfo());
widgetInfoList.append(m_navigatorView.widgetInfo());
widgetInfoList.append(m_propertyEditorView.widgetInfo());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment