Commit f77a7571 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner: Move TabViewDesignerAction to componentsplugin



Change-Id: Ib02092d38d4ba43ad3bed2460f7eb9615bd06fa7
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent 703a3153
VPATH += $$PWD
SOURCES += modelnodecontextmenu.cpp
SOURCES += addtabtotabviewdialog.cpp
SOURCES += designeractionmanagerview.cpp
SOURCES += tabviewdesigneraction.cpp
SOURCES += defaultdesigneraction.cpp
SOURCES += modelnodecontextmenu_helper.cpp
SOURCES += selectioncontext.cpp
......@@ -12,9 +10,7 @@ SOURCES += modelnodeoperations.cpp
SOURCES += crumblebar.cpp
HEADERS += modelnodecontextmenu.h
HEADERS += addtabtotabviewdialog.h
HEADERS += designeractionmanagerview.h
HEADERS += tabviewdesigneraction.h
HEADERS += defaultdesigneraction.h
HEADERS += modelnodecontextmenu_helper.h
HEADERS += selectioncontext.h
......@@ -24,4 +20,3 @@ HEADERS += modelnodeoperations.h
HEADERS += abstractdesigneraction.h
HEADERS += crumblebar.h
FORMS += addtabtotabviewdialog.ui
......@@ -31,7 +31,6 @@
#include <selectioncontext.h>
#include <abstractdesigneraction.h>
#include "tabviewdesigneraction.h"
namespace QmlDesigner {
......@@ -42,8 +41,6 @@ DesignerActionManagerView::DesignerActionManagerView()
m_setupContextDirty(false)
{
m_designerActionManager.createDefaultDesignerActions();
m_designerActionManager.addDesignerAction(new TabViewDesignerAction);
}
void DesignerActionManagerView::modelAttached(Model *model)
......
......@@ -27,7 +27,7 @@
**
****************************************************************************/
#include "tabviewdesigneraction.h"
#include "addtabdesigneraction.h"
#include "addtabtotabviewdialog.h"
#include <QCoreApplication>
......@@ -56,33 +56,33 @@ bool isTabAndParentIsTabView(const ModelNode &modelNode)
&& modelNode.parentProperty().parentModelNode().metaInfo().isSubclassOf("QtQuick.Controls.TabView", -1, -1);
}
TabViewDesignerAction::TabViewDesignerAction()
AddTabDesignerAction::AddTabDesignerAction()
: DefaultDesignerAction(QCoreApplication::translate("TabViewToolAction","Add Tab..."))
{
connect(action(), SIGNAL(triggered()), this, SLOT(addNewTab()));
}
QByteArray TabViewDesignerAction::category() const
QByteArray AddTabDesignerAction::category() const
{
return QByteArray();
}
QByteArray TabViewDesignerAction::menuId() const
QByteArray AddTabDesignerAction::menuId() const
{
return "TabViewAction";
}
int TabViewDesignerAction::priority() const
int AddTabDesignerAction::priority() const
{
return CustomActionsPriority;
}
AbstractDesignerAction::Type TabViewDesignerAction::type() const
AbstractDesignerAction::Type AddTabDesignerAction::type() const
{
return Action;
}
bool TabViewDesignerAction::isVisible(const SelectionContext &selectionContext) const
bool AddTabDesignerAction::isVisible(const SelectionContext &selectionContext) const
{
if (selectionContext.singleNodeIsSelected()) {
ModelNode selectedModelNode = selectionContext.currentSingleSelectedNode();
......@@ -92,7 +92,7 @@ bool TabViewDesignerAction::isVisible(const SelectionContext &selectionContext)
return false;
}
bool TabViewDesignerAction::isEnabled(const SelectionContext &selectionContext) const
bool AddTabDesignerAction::isEnabled(const SelectionContext &selectionContext) const
{
return isVisible(selectionContext);
}
......@@ -105,7 +105,7 @@ static ModelNode findTabViewModelNode(const ModelNode &currentModelNode)
return findTabViewModelNode(currentModelNode.parentProperty().parentModelNode());
}
void TabViewDesignerAction::addNewTab()
void AddTabDesignerAction::addNewTab()
{
QString tabName = AddTabToTabViewDialog::create(QStringLiteral("Tab"), Core::ICore::mainWindow());
......
......@@ -34,11 +34,11 @@
namespace QmlDesigner {
class TabViewDesignerAction : public QObject, public DefaultDesignerAction
class AddTabDesignerAction : public QObject, public DefaultDesignerAction
{
Q_OBJECT
public:
TabViewDesignerAction();
AddTabDesignerAction();
QByteArray category() const;
QByteArray menuId() const;
......
......@@ -30,6 +30,11 @@
#include "componentsplugin.h"
#include "tabviewindexmodel.h"
#include "addtabdesigneraction.h"
#include <viewmanager.h>
#include <qmldesignerplugin.h>
#include <QtPlugin>
namespace QmlDesigner {
......@@ -38,6 +43,7 @@ namespace QmlDesigner {
ComponentsPlugin::ComponentsPlugin()
{
TabViewIndexModel::registerDeclarativeType();
QmlDesignerPlugin::instance()->viewManager().designerActionManager().addDesignerAction(new AddTabDesignerAction);
}
QString ComponentsPlugin::pluginName() const
......
......@@ -9,6 +9,8 @@ include (../qmldesigner_dependencies.pri)
LIBS += -L$$IDE_PLUGIN_PATH
LIBS += -l$$qtLibraryName(QmlDesigner)
LIBS += -l$$qtLibraryName(Core)
LIBS += -l$$qtLibraryName(utils)
DEFINES += COMPONENTS_LIBRARY
......@@ -17,11 +19,18 @@ RESOURCES += $$PWD/componentsplugin.qrc
HEADERS += \
$$PWD/tabviewindexmodel.h \
$$PWD/componentsplugin.h \
$$PWD/../designercore/include/iwidgetplugin.h
$$PWD/../designercore/include/iwidgetplugin.h \
$$PWD/addtabdesigneraction.h \
$$PWD/addtabtotabviewdialog.h
SOURCES += \
$$PWD/componentsplugin.cpp \
$$PWD/tabviewindexmodel.cpp
$$PWD/tabviewindexmodel.cpp \
$$PWD/addtabdesigneraction.cpp \
$$PWD/addtabtotabviewdialog.cpp
FORMS += \
$$PWD/addtabtotabviewdialog.ui
OTHER_FILES += $$PWD/components.metainfo
Supports Markdown
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