forked from qt-creator/qt-creator
Remove some useless IContext subclasses
They are only created at single places anyhow, so use the setters of IContext instead Change-Id: I00a089c9f1ea151c76cb6443e2a24c4a05437bbb Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -98,12 +98,6 @@ private:
|
|||||||
Qt::MouseButton m_mouseButtonPressed = Qt::NoButton;
|
Qt::MouseButton m_mouseButtonPressed = Qt::NoButton;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TaskWindowContext : public Core::IContext
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
TaskWindowContext(QWidget *widget);
|
|
||||||
};
|
|
||||||
|
|
||||||
class TaskDelegate : public QStyledItemDelegate
|
class TaskDelegate : public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -289,7 +283,7 @@ public:
|
|||||||
Internal::TaskModel *m_model;
|
Internal::TaskModel *m_model;
|
||||||
Internal::TaskFilterModel *m_filter;
|
Internal::TaskFilterModel *m_filter;
|
||||||
Internal::TaskView *m_listview;
|
Internal::TaskView *m_listview;
|
||||||
Internal::TaskWindowContext *m_taskWindowContext;
|
Core::IContext *m_taskWindowContext;
|
||||||
QMenu *m_contextMenu;
|
QMenu *m_contextMenu;
|
||||||
QMap<const QAction *, ITaskHandler *> m_actionToHandlerMap;
|
QMap<const QAction *, ITaskHandler *> m_actionToHandlerMap;
|
||||||
ITaskHandler *m_defaultHandler = nullptr;
|
ITaskHandler *m_defaultHandler = nullptr;
|
||||||
@@ -329,8 +323,9 @@ TaskWindow::TaskWindow() : d(std::make_unique<TaskWindowPrivate>())
|
|||||||
d->m_listview->setContextMenuPolicy(Qt::ActionsContextMenu);
|
d->m_listview->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||||
d->m_listview->setAttribute(Qt::WA_MacShowFocusRect, false);
|
d->m_listview->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
|
|
||||||
d->m_taskWindowContext = new Internal::TaskWindowContext(d->m_listview);
|
d->m_taskWindowContext = new Core::IContext(d->m_listview);
|
||||||
|
d->m_taskWindowContext->setWidget(d->m_listview);
|
||||||
|
d->m_taskWindowContext->setContext(Core::Context(Core::Constants::C_PROBLEM_PANE));
|
||||||
Core::ICore::addContextObject(d->m_taskWindowContext);
|
Core::ICore::addContextObject(d->m_taskWindowContext);
|
||||||
|
|
||||||
connect(d->m_listview->selectionModel(), &QItemSelectionModel::currentChanged,
|
connect(d->m_listview->selectionModel(), &QItemSelectionModel::currentChanged,
|
||||||
@@ -1018,13 +1013,6 @@ void TaskDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
|
|||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskWindowContext::TaskWindowContext(QWidget *widget)
|
|
||||||
: Core::IContext(widget)
|
|
||||||
{
|
|
||||||
setWidget(widget);
|
|
||||||
setContext(Core::Context(Core::Constants::C_PROBLEM_PANE));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
|
||||||
|
@@ -41,8 +41,9 @@
|
|||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
BindingEditorWidget::BindingEditorWidget()
|
BindingEditorWidget::BindingEditorWidget()
|
||||||
: m_context(new BindingEditorContext(this))
|
: m_context(new Core::IContext(this))
|
||||||
{
|
{
|
||||||
|
m_context->setWidget(this);
|
||||||
Core::ICore::addContextObject(m_context);
|
Core::ICore::addContextObject(m_context);
|
||||||
|
|
||||||
const Core::Context context(BINDINGEDITOR_CONTEXT_ID);
|
const Core::Context context(BINDINGEDITOR_CONTEXT_ID);
|
||||||
|
@@ -39,18 +39,6 @@ namespace QmlDesigner {
|
|||||||
|
|
||||||
const char BINDINGEDITOR_CONTEXT_ID[] = "BindingEditor.BindingEditorContext";
|
const char BINDINGEDITOR_CONTEXT_ID[] = "BindingEditor.BindingEditorContext";
|
||||||
|
|
||||||
|
|
||||||
class BindingEditorContext : public Core::IContext
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
BindingEditorContext(QWidget *parent) : Core::IContext(parent)
|
|
||||||
{
|
|
||||||
setWidget(parent);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class BindingEditorWidget : public QmlJSEditor::QmlJSEditorWidget
|
class BindingEditorWidget : public QmlJSEditor::QmlJSEditorWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -71,7 +59,7 @@ signals:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
QmlJSEditor::QmlJSEditorDocument *qmljsdocument = nullptr;
|
QmlJSEditor::QmlJSEditorDocument *qmljsdocument = nullptr;
|
||||||
BindingEditorContext *m_context = nullptr;
|
Core::IContext *m_context = nullptr;
|
||||||
QAction *m_completionAction = nullptr;
|
QAction *m_completionAction = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -82,7 +82,6 @@ add_qtc_plugin(ScxmlEditor
|
|||||||
plugin_interface/utilsprovider.cpp plugin_interface/utilsprovider.h
|
plugin_interface/utilsprovider.cpp plugin_interface/utilsprovider.h
|
||||||
plugin_interface/warningitem.cpp plugin_interface/warningitem.h
|
plugin_interface/warningitem.cpp plugin_interface/warningitem.h
|
||||||
plugin_interface/warningprovider.h
|
plugin_interface/warningprovider.h
|
||||||
scxmlcontext.cpp scxmlcontext.h
|
|
||||||
scxmleditor_global.h
|
scxmleditor_global.h
|
||||||
scxmleditorconstants.h
|
scxmleditorconstants.h
|
||||||
scxmleditordata.cpp scxmleditordata.h
|
scxmleditordata.cpp scxmleditordata.h
|
||||||
|
@@ -1,35 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** 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 The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "scxmlcontext.h"
|
|
||||||
|
|
||||||
using namespace ScxmlEditor::Internal;
|
|
||||||
|
|
||||||
ScxmlContext::ScxmlContext(const Core::Context &context, QWidget *widget, QObject *parent)
|
|
||||||
: Core::IContext(parent)
|
|
||||||
{
|
|
||||||
setContext(context);
|
|
||||||
setWidget(widget);
|
|
||||||
}
|
|
@@ -1,40 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** 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 The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <coreplugin/icontext.h>
|
|
||||||
|
|
||||||
namespace ScxmlEditor {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class ScxmlContext : public Core::IContext
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit ScxmlContext(const Core::Context &contexts, QWidget *widget, QObject *parent = nullptr);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Designer
|
|
@@ -3,7 +3,6 @@ include(../../qtcreatorplugin.pri)
|
|||||||
INCLUDEPATH += $$PWD
|
INCLUDEPATH += $$PWD
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
scxmlcontext.h \
|
|
||||||
scxmleditor_global.h \
|
scxmleditor_global.h \
|
||||||
scxmleditorconstants.h \
|
scxmleditorconstants.h \
|
||||||
scxmleditordata.h \
|
scxmleditordata.h \
|
||||||
@@ -14,7 +13,6 @@ HEADERS += \
|
|||||||
scxmltexteditor.h
|
scxmltexteditor.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
scxmlcontext.cpp \
|
|
||||||
scxmleditordata.cpp \
|
scxmleditordata.cpp \
|
||||||
scxmleditordocument.cpp \
|
scxmleditordocument.cpp \
|
||||||
scxmleditorfactory.cpp \
|
scxmleditorfactory.cpp \
|
||||||
|
@@ -21,7 +21,6 @@ QtcPlugin {
|
|||||||
])
|
])
|
||||||
|
|
||||||
files: [
|
files: [
|
||||||
"scxmlcontext.cpp", "scxmlcontext.h",
|
|
||||||
"scxmleditor_global.h",
|
"scxmleditor_global.h",
|
||||||
"scxmleditorconstants.h",
|
"scxmleditorconstants.h",
|
||||||
"scxmleditordata.cpp", "scxmleditordata.h",
|
"scxmleditordata.cpp", "scxmleditordata.h",
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "scxmleditordata.h"
|
#include "scxmleditordata.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "scxmlcontext.h"
|
|
||||||
#include "scxmleditorconstants.h"
|
#include "scxmleditorconstants.h"
|
||||||
#include "scxmleditordocument.h"
|
#include "scxmleditordocument.h"
|
||||||
#include "scxmleditorstack.h"
|
#include "scxmleditorstack.h"
|
||||||
@@ -143,7 +142,9 @@ void ScxmlEditorData::fullInit()
|
|||||||
|
|
||||||
Context scxmlContexts = m_contexts;
|
Context scxmlContexts = m_contexts;
|
||||||
scxmlContexts.add(Core::Constants::C_EDITORMANAGER);
|
scxmlContexts.add(Core::Constants::C_EDITORMANAGER);
|
||||||
auto context = new ScxmlContext(scxmlContexts, m_modeWidget, this);
|
auto context = new IContext(this);
|
||||||
|
context->setContext(scxmlContexts);
|
||||||
|
context->setWidget(m_modeWidget);
|
||||||
ICore::addContextObject(context);
|
ICore::addContextObject(context);
|
||||||
|
|
||||||
DesignMode::registerDesignWidget(m_modeWidget, QStringList(QLatin1String(ProjectExplorer::Constants::SCXML_MIMETYPE)), m_contexts);
|
DesignMode::registerDesignWidget(m_modeWidget, QStringList(QLatin1String(ProjectExplorer::Constants::SCXML_MIMETYPE)), m_contexts);
|
||||||
|
@@ -40,7 +40,6 @@ namespace Internal {
|
|||||||
class ScxmlTextEditorFactory;
|
class ScxmlTextEditorFactory;
|
||||||
class ScxmlEditorWidget;
|
class ScxmlEditorWidget;
|
||||||
class ScxmlEditorStack;
|
class ScxmlEditorStack;
|
||||||
class ScxmlContext;
|
|
||||||
|
|
||||||
class ScxmlEditorData : public QObject
|
class ScxmlEditorData : public QObject
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user