forked from qt-creator/qt-creator
ScxmlEditor: Code cosmetics
QVector->QList, some namespaces, ... Change-Id: Ibcc577193249c8410e68981a7f31b1792dc936ae Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -23,7 +23,7 @@ ColorPicker::ColorPicker(const QString &key, QWidget *parent)
|
|||||||
: QFrame(parent)
|
: QFrame(parent)
|
||||||
, m_key(key)
|
, m_key(key)
|
||||||
{
|
{
|
||||||
const QVector<QRgb> colors = {
|
const QList<QRgb> colors = {
|
||||||
qRgb(0xed, 0xf7, 0xf2), qRgb(0xdf, 0xd3, 0xb6), qRgb(0x89, 0x72, 0x5b), qRgb(0xff, 0xd3, 0x93), qRgb(0xff, 0x97, 0x4f),
|
qRgb(0xed, 0xf7, 0xf2), qRgb(0xdf, 0xd3, 0xb6), qRgb(0x89, 0x72, 0x5b), qRgb(0xff, 0xd3, 0x93), qRgb(0xff, 0x97, 0x4f),
|
||||||
qRgb(0xff, 0x85, 0x0d), qRgb(0xf7, 0xe9, 0x67), qRgb(0xef, 0xc9, 0x4c), qRgb(0xff, 0xe1, 0x1a), qRgb(0xc2, 0xe0, 0x78),
|
qRgb(0xff, 0x85, 0x0d), qRgb(0xf7, 0xe9, 0x67), qRgb(0xef, 0xc9, 0x4c), qRgb(0xff, 0xe1, 0x1a), qRgb(0xc2, 0xe0, 0x78),
|
||||||
qRgb(0xa2, 0xd7, 0x00), qRgb(0x45, 0xbf, 0x08), qRgb(0x91, 0xe3, 0xd8), qRgb(0x3c, 0xb3, 0xfd), qRgb(0x34, 0x67, 0xba),
|
qRgb(0xa2, 0xd7, 0x00), qRgb(0x45, 0xbf, 0x08), qRgb(0x91, 0xe3, 0xd8), qRgb(0x3c, 0xb3, 0xfd), qRgb(0x34, 0x67, 0xba),
|
||||||
|
@@ -29,7 +29,7 @@ private:
|
|||||||
QToolButton *createButton(const QColor &color);
|
QToolButton *createButton(const QColor &color);
|
||||||
|
|
||||||
QStringList m_lastUsedColorNames;
|
QStringList m_lastUsedColorNames;
|
||||||
QVector<QToolButton*> m_lastUsedColorButtons;
|
QList<QToolButton*> m_lastUsedColorButtons;
|
||||||
QString m_key;
|
QString m_key;
|
||||||
|
|
||||||
QHBoxLayout *m_lastUsedColorContainer;
|
QHBoxLayout *m_lastUsedColorContainer;
|
||||||
|
@@ -170,7 +170,7 @@ void ColorThemes::setCurrentColors(const QVariantMap &colorData)
|
|||||||
|
|
||||||
QStringList serializedColors;
|
QStringList serializedColors;
|
||||||
|
|
||||||
QVector<QColor> colors = ColorThemeView::defaultColors();
|
QList<QColor> colors = ColorThemeView::defaultColors();
|
||||||
for (QVariantMap::const_iterator i = colorData.begin(); i != colorData.end(); ++i) {
|
for (QVariantMap::const_iterator i = colorData.begin(); i != colorData.end(); ++i) {
|
||||||
const int k = i.key().toInt();
|
const int k = i.key().toInt();
|
||||||
if (k >= 0 && k < colors.count()) {
|
if (k >= 0 && k < colors.count()) {
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QAction)
|
QT_FORWARD_DECLARE_CLASS(QAction)
|
||||||
QT_FORWARD_DECLARE_CLASS(QMenu)
|
QT_FORWARD_DECLARE_CLASS(QMenu)
|
||||||
|
@@ -138,11 +138,11 @@ ColorThemeItem *ColorThemeView::createItem(int index, const QColor &color)
|
|||||||
return new ColorThemeItem(index, color, this);
|
return new ColorThemeItem(index, color, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QVector<QColor> &ColorThemeView::defaultColors()
|
const QList<QColor> &ColorThemeView::defaultColors()
|
||||||
{
|
{
|
||||||
// Left with hardcoded values for now
|
// Left with hardcoded values for now
|
||||||
if (Utils::creatorTheme()->colorScheme() == Qt::ColorScheme::Dark) {
|
if (Utils::creatorTheme()->colorScheme() == Qt::ColorScheme::Dark) {
|
||||||
static const QVector<QColor> colors = {
|
static const QList<QColor> colors = {
|
||||||
QColor(0x64, 0x64, 0x64),
|
QColor(0x64, 0x64, 0x64),
|
||||||
QColor(0x60, 0x68, 0x59),
|
QColor(0x60, 0x68, 0x59),
|
||||||
QColor(0x6f, 0x6c, 0x58),
|
QColor(0x6f, 0x6c, 0x58),
|
||||||
@@ -153,7 +153,7 @@ const QVector<QColor> &ColorThemeView::defaultColors()
|
|||||||
};
|
};
|
||||||
return colors;
|
return colors;
|
||||||
}
|
}
|
||||||
static const QVector<QColor> colors = {
|
static const QList<QColor> colors = {
|
||||||
QColor(0xe0, 0xe0, 0xe0),
|
QColor(0xe0, 0xe0, 0xe0),
|
||||||
QColor(0xd3, 0xe4, 0xc3),
|
QColor(0xd3, 0xe4, 0xc3),
|
||||||
QColor(0xeb, 0xe4, 0xba),
|
QColor(0xeb, 0xe4, 0xba),
|
||||||
|
@@ -54,7 +54,7 @@ public:
|
|||||||
void setColor(int index, const QColor &color);
|
void setColor(int index, const QColor &color);
|
||||||
QColor color(int index) const;
|
QColor color(int index) const;
|
||||||
QVariantMap colorData() const;
|
QVariantMap colorData() const;
|
||||||
static const QVector<QColor> &defaultColors();
|
static const QList<QColor> &defaultColors();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void colorChanged();
|
void colorChanged();
|
||||||
@@ -66,7 +66,7 @@ private:
|
|||||||
void updateItemRects();
|
void updateItemRects();
|
||||||
ColorThemeItem *createItem(int index, const QColor &color);
|
ColorThemeItem *createItem(int index, const QColor &color);
|
||||||
|
|
||||||
QVector<ColorThemeItem*> m_themeItems;
|
QList<ColorThemeItem*> m_themeItems;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
@@ -497,7 +497,7 @@ void MainWidget::addStateView(BaseItem *item)
|
|||||||
// Update transitions
|
// Update transitions
|
||||||
auto scene = static_cast<GraphicsScene*>(it->scene());
|
auto scene = static_cast<GraphicsScene*>(it->scene());
|
||||||
if (scene) {
|
if (scene) {
|
||||||
QVector<ScxmlTag*> childTransitionTags;
|
QList<ScxmlTag*> childTransitionTags;
|
||||||
TagUtils::findAllTransitionChildren(it->tag(), childTransitionTags);
|
TagUtils::findAllTransitionChildren(it->tag(), childTransitionTags);
|
||||||
for (int i = 0; i < childTransitionTags.count(); ++i) {
|
for (int i = 0; i < childTransitionTags.count(); ++i) {
|
||||||
BaseItem *item = scene->findItem(childTransitionTags[i]);
|
BaseItem *item = scene->findItem(childTransitionTags[i]);
|
||||||
|
@@ -108,8 +108,8 @@ private:
|
|||||||
|
|
||||||
PluginInterface::ScxmlDocument *m_document = nullptr;
|
PluginInterface::ScxmlDocument *m_document = nullptr;
|
||||||
PluginInterface::ScxmlUiFactory *m_uiFactory = nullptr;
|
PluginInterface::ScxmlUiFactory *m_uiFactory = nullptr;
|
||||||
QVector<QToolButton*> m_toolButtons;
|
QList<QToolButton*> m_toolButtons;
|
||||||
QVector<StateView*> m_views;
|
QList<StateView*> m_views;
|
||||||
bool m_autoFit = true;
|
bool m_autoFit = true;
|
||||||
bool m_windowBlocked = false;
|
bool m_windowBlocked = false;
|
||||||
PluginInterface::ActionHandler *m_actionHandler = nullptr;
|
PluginInterface::ActionHandler *m_actionHandler = nullptr;
|
||||||
|
@@ -36,7 +36,7 @@ private:
|
|||||||
void resetModel();
|
void resetModel();
|
||||||
|
|
||||||
PluginInterface::ScxmlDocument *m_document = nullptr;
|
PluginInterface::ScxmlDocument *m_document = nullptr;
|
||||||
QVector<PluginInterface::ScxmlTag*> m_allTags;
|
QList<PluginInterface::ScxmlTag*> m_allTags;
|
||||||
QString m_strFilter;
|
QString m_strFilter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -40,7 +40,7 @@ private:
|
|||||||
void calculateStats(PluginInterface::ScxmlTag *tag);
|
void calculateStats(PluginInterface::ScxmlTag *tag);
|
||||||
|
|
||||||
QStringList m_names;
|
QStringList m_names;
|
||||||
QVector<int> m_counts;
|
QList<int> m_counts;
|
||||||
int m_levels = 0;
|
int m_levels = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -54,7 +54,7 @@ StructureSortFilterProxyModel::StructureSortFilterProxyModel(QObject *parent)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void StructureSortFilterProxyModel::setVisibleTags(const QVector<TagType> &visibleTags)
|
void StructureSortFilterProxyModel::setVisibleTags(const QList<TagType> &visibleTags)
|
||||||
{
|
{
|
||||||
m_visibleTags = visibleTags;
|
m_visibleTags = visibleTags;
|
||||||
if (!m_visibleTags.contains(Scxml))
|
if (!m_visibleTags.contains(Scxml))
|
||||||
@@ -102,7 +102,7 @@ Structure::Structure(QWidget *parent)
|
|||||||
m_proxyModel->setDynamicSortFilter(false);
|
m_proxyModel->setDynamicSortFilter(false);
|
||||||
|
|
||||||
// Default set of the visible tags
|
// Default set of the visible tags
|
||||||
QVector<TagType> visibleTags;
|
QList<TagType> visibleTags;
|
||||||
for (int i = 0; i < Finalize; ++i)
|
for (int i = 0; i < Finalize; ++i)
|
||||||
visibleTags << TagType(i);
|
visibleTags << TagType(i);
|
||||||
m_proxyModel->setVisibleTags(visibleTags);
|
m_proxyModel->setVisibleTags(visibleTags);
|
||||||
@@ -132,7 +132,7 @@ void Structure::addCheckbox(const QString &name, TagType type)
|
|||||||
|
|
||||||
void Structure::updateCheckBoxes()
|
void Structure::updateCheckBoxes()
|
||||||
{
|
{
|
||||||
QVector<TagType> visibleTags;
|
QList<TagType> visibleTags;
|
||||||
for (QCheckBox *box : std::as_const(m_checkboxes)) {
|
for (QCheckBox *box : std::as_const(m_checkboxes)) {
|
||||||
if (box->isChecked()) {
|
if (box->isChecked()) {
|
||||||
switch (TagType(box->property(Constants::C_SCXMLTAG_TAGTYPE).toInt())) {
|
switch (TagType(box->property(Constants::C_SCXMLTAG_TAGTYPE).toInt())) {
|
||||||
|
@@ -43,11 +43,11 @@ public:
|
|||||||
explicit StructureSortFilterProxyModel(QObject *parent = nullptr);
|
explicit StructureSortFilterProxyModel(QObject *parent = nullptr);
|
||||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
|
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
|
||||||
void setSourceModel(QAbstractItemModel *sourceModel) override;
|
void setSourceModel(QAbstractItemModel *sourceModel) override;
|
||||||
void setVisibleTags(const QVector<PluginInterface::TagType> &visibleTags);
|
void setVisibleTags(const QList<PluginInterface::TagType> &visibleTags);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<StructureModel> m_sourceModel;
|
QPointer<StructureModel> m_sourceModel;
|
||||||
QVector<PluginInterface::TagType> m_visibleTags;
|
QList<PluginInterface::TagType> m_visibleTags;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,7 +80,7 @@ private:
|
|||||||
StructureModel *m_model;
|
StructureModel *m_model;
|
||||||
PluginInterface::ScxmlDocument *m_currentDocument = nullptr;
|
PluginInterface::ScxmlDocument *m_currentDocument = nullptr;
|
||||||
PluginInterface::GraphicsScene *m_scene = nullptr;
|
PluginInterface::GraphicsScene *m_scene = nullptr;
|
||||||
QVector<QCheckBox*> m_checkboxes;
|
QList<QCheckBox*> m_checkboxes;
|
||||||
TreeItemDelegate *m_customDelegate = nullptr;
|
TreeItemDelegate *m_customDelegate = nullptr;
|
||||||
|
|
||||||
QWidget *m_paneInnerFrame = nullptr;
|
QWidget *m_paneInnerFrame = nullptr;
|
||||||
|
@@ -37,8 +37,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QIcon m_emptyIcon;
|
QIcon m_emptyIcon;
|
||||||
QVector<PluginInterface::TagType> m_iconIndices;
|
QList<PluginInterface::TagType> m_iconIndices;
|
||||||
QVector<QIcon> m_icons;
|
QList<QIcon> m_icons;
|
||||||
};
|
};
|
||||||
|
|
||||||
class StructureModel : public QAbstractItemModel
|
class StructureModel : public QAbstractItemModel
|
||||||
|
@@ -68,8 +68,8 @@ private:
|
|||||||
void buttonClicked(PaneTitleButton *button, bool checked);
|
void buttonClicked(PaneTitleButton *button, bool checked);
|
||||||
void showAlert(OutputPane *pane);
|
void showAlert(OutputPane *pane);
|
||||||
|
|
||||||
QVector<OutputPane *> m_pages;
|
QList<OutputPane *> m_pages;
|
||||||
QVector<PaneTitleButton *> m_buttons;
|
QList<PaneTitleButton *> m_buttons;
|
||||||
|
|
||||||
QToolBar *m_toolBar = nullptr;
|
QToolBar *m_toolBar = nullptr;
|
||||||
QStackedWidget *m_stackedWidget = nullptr;
|
QStackedWidget *m_stackedWidget = nullptr;
|
||||||
|
@@ -52,7 +52,7 @@ private:
|
|||||||
QString severityName(Warning::Severity severity) const;
|
QString severityName(Warning::Severity severity) const;
|
||||||
QIcon severityIcon(Warning::Severity severity) const;
|
QIcon severityIcon(Warning::Severity severity) const;
|
||||||
|
|
||||||
QVector<Warning*> m_warnings;
|
QList<Warning*> m_warnings;
|
||||||
QMap<int, bool> m_warningVisibilities;
|
QMap<int, bool> m_warningVisibilities;
|
||||||
int m_oldCount = 0;
|
int m_oldCount = 0;
|
||||||
QPointer<QTimer> m_countChecker;
|
QPointer<QTimer> m_countChecker;
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
|
||||||
using namespace ScxmlEditor::PluginInterface;
|
namespace ScxmlEditor::PluginInterface {
|
||||||
|
|
||||||
ActionHandler::ActionHandler(QObject *parent)
|
ActionHandler::ActionHandler(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
@@ -68,3 +68,5 @@ QAction *ActionHandler::action(ActionType type) const
|
|||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // ScxmlEditor::PluginInterface
|
||||||
|
@@ -9,9 +9,7 @@
|
|||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QAction)
|
QT_FORWARD_DECLARE_CLASS(QAction)
|
||||||
|
|
||||||
namespace ScxmlEditor {
|
namespace ScxmlEditor::PluginInterface {
|
||||||
|
|
||||||
namespace PluginInterface {
|
|
||||||
|
|
||||||
class ActionHandler : public QObject
|
class ActionHandler : public QObject
|
||||||
{
|
{
|
||||||
@@ -23,8 +21,7 @@ public:
|
|||||||
QAction *action(ActionType type) const;
|
QAction *action(ActionType type) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<QAction*> m_actions;
|
QList<QAction*> m_actions;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace PluginInterface
|
} // namespace ScxmlEditor::PluginInterface
|
||||||
} // namespace ScxmlEditor
|
|
||||||
|
@@ -47,17 +47,17 @@ ConnectableItem::~ConnectableItem()
|
|||||||
{
|
{
|
||||||
setBlockUpdates(true);
|
setBlockUpdates(true);
|
||||||
|
|
||||||
const QVector<ConnectableItem *> overlappedItems = m_overlappedItems;
|
const QList<ConnectableItem *> overlappedItems = m_overlappedItems;
|
||||||
for (ConnectableItem *item : overlappedItems)
|
for (ConnectableItem *item : overlappedItems)
|
||||||
item->removeOverlappingItem(this);
|
item->removeOverlappingItem(this);
|
||||||
m_overlappedItems.clear();
|
m_overlappedItems.clear();
|
||||||
|
|
||||||
const QVector<TransitionItem *> outputTransitions = m_outputTransitions;
|
const QList<TransitionItem *> outputTransitions = m_outputTransitions;
|
||||||
for (TransitionItem *transition : outputTransitions)
|
for (TransitionItem *transition : outputTransitions)
|
||||||
transition->disconnectItem(this);
|
transition->disconnectItem(this);
|
||||||
m_outputTransitions.clear();
|
m_outputTransitions.clear();
|
||||||
|
|
||||||
const QVector<TransitionItem *> inputTransitions = m_inputTransitions;
|
const QList<TransitionItem *> inputTransitions = m_inputTransitions;
|
||||||
for (TransitionItem *transition : inputTransitions)
|
for (TransitionItem *transition : inputTransitions)
|
||||||
transition->disconnectItem(this);
|
transition->disconnectItem(this);
|
||||||
m_inputTransitions.clear();
|
m_inputTransitions.clear();
|
||||||
@@ -741,7 +741,7 @@ void ConnectableItem::removeOverlappingItem(ConnectableItem *item)
|
|||||||
|
|
||||||
void ConnectableItem::checkOverlapping()
|
void ConnectableItem::checkOverlapping()
|
||||||
{
|
{
|
||||||
QVector<ConnectableItem*> overlappedItems;
|
QList<ConnectableItem*> overlappedItems;
|
||||||
const QList<QGraphicsItem *> items = collidingItems();
|
const QList<QGraphicsItem *> items = collidingItems();
|
||||||
for (QGraphicsItem *it : items) {
|
for (QGraphicsItem *it : items) {
|
||||||
if (it->type() >= InitialStateType && it->parentItem() == parentItem()) {
|
if (it->type() >= InitialStateType && it->parentItem() == parentItem()) {
|
||||||
@@ -774,12 +774,12 @@ bool ConnectableItem::canStartTransition(ItemType type) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<TransitionItem*> ConnectableItem::outputTransitions() const
|
QList<TransitionItem*> ConnectableItem::outputTransitions() const
|
||||||
{
|
{
|
||||||
return m_outputTransitions;
|
return m_outputTransitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<TransitionItem*> ConnectableItem::inputTransitions() const
|
QList<TransitionItem*> ConnectableItem::inputTransitions() const
|
||||||
{
|
{
|
||||||
return m_inputTransitions;
|
return m_inputTransitions;
|
||||||
}
|
}
|
||||||
|
@@ -38,8 +38,8 @@ public:
|
|||||||
void addInputTransition(TransitionItem *transition);
|
void addInputTransition(TransitionItem *transition);
|
||||||
void removeOutputTransition(TransitionItem *transition);
|
void removeOutputTransition(TransitionItem *transition);
|
||||||
void removeInputTransition(TransitionItem *transition);
|
void removeInputTransition(TransitionItem *transition);
|
||||||
QVector<TransitionItem*> outputTransitions() const;
|
QList<TransitionItem*> outputTransitions() const;
|
||||||
QVector<TransitionItem*> inputTransitions() const;
|
QList<TransitionItem*> inputTransitions() const;
|
||||||
|
|
||||||
void setMinimumWidth(int width);
|
void setMinimumWidth(int width);
|
||||||
void setMinimumHeight(int height);
|
void setMinimumHeight(int height);
|
||||||
@@ -101,10 +101,10 @@ private:
|
|||||||
void removeCorners();
|
void removeCorners();
|
||||||
void updateShadowClipRegion();
|
void updateShadowClipRegion();
|
||||||
|
|
||||||
QVector<TransitionItem*> m_outputTransitions;
|
QList<TransitionItem*> m_outputTransitions;
|
||||||
QVector<TransitionItem*> m_inputTransitions;
|
QList<TransitionItem*> m_inputTransitions;
|
||||||
QVector<CornerGrabberItem*> m_corners;
|
QList<CornerGrabberItem*> m_corners;
|
||||||
QVector<QuickTransitionItem*> m_quickTransitions;
|
QList<QuickTransitionItem*> m_quickTransitions;
|
||||||
HighlightItem *m_highlighItem = nullptr;
|
HighlightItem *m_highlighItem = nullptr;
|
||||||
TransitionItem *m_newTransition = nullptr;
|
TransitionItem *m_newTransition = nullptr;
|
||||||
QPen m_selectedPen;
|
QPen m_selectedPen;
|
||||||
@@ -118,7 +118,7 @@ private:
|
|||||||
QPainterPath m_shadowClipPath;
|
QPainterPath m_shadowClipPath;
|
||||||
QPointF m_moveStartPoint;
|
QPointF m_moveStartPoint;
|
||||||
bool m_moveMacroStarted = false;
|
bool m_moveMacroStarted = false;
|
||||||
QVector<ConnectableItem*> m_overlappedItems;
|
QList<ConnectableItem*> m_overlappedItems;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace PluginInterface
|
} // namespace PluginInterface
|
||||||
|
@@ -66,7 +66,7 @@ void OnEntryExitItem::updateAttributes()
|
|||||||
|
|
||||||
void OnEntryExitItem::finalizeCreation()
|
void OnEntryExitItem::finalizeCreation()
|
||||||
{
|
{
|
||||||
const QVector<ScxmlTag*> children = tag()->allChildren();
|
const QList<ScxmlTag*> children = tag()->allChildren();
|
||||||
auto pos = m_eventNameItem->boundingRect().bottomLeft();
|
auto pos = m_eventNameItem->boundingRect().bottomLeft();
|
||||||
for (auto child : children) {
|
for (auto child : children) {
|
||||||
EventItem *item = new EventItem(pos, this);
|
EventItem *item = new EventItem(pos, this);
|
||||||
|
@@ -179,7 +179,7 @@ void GraphicsScene::cut()
|
|||||||
|
|
||||||
void GraphicsScene::removeSelectedItems()
|
void GraphicsScene::removeSelectedItems()
|
||||||
{
|
{
|
||||||
QVector<ScxmlTag*> tags = SceneUtils::findRemovedTags(m_baseItems);
|
QList<ScxmlTag*> tags = SceneUtils::findRemovedTags(m_baseItems);
|
||||||
if (!tags.isEmpty()) {
|
if (!tags.isEmpty()) {
|
||||||
m_document->undoStack()->beginMacro(Tr::tr("Remove items"));
|
m_document->undoStack()->beginMacro(Tr::tr("Remove items"));
|
||||||
|
|
||||||
@@ -199,9 +199,9 @@ void GraphicsScene::copy()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QPointF minPos;
|
QPointF minPos;
|
||||||
QVector<ScxmlTag*> tags;
|
QList<ScxmlTag*> tags;
|
||||||
if (m_document->currentTag()->tagType() == Scxml) {
|
if (m_document->currentTag()->tagType() == Scxml) {
|
||||||
QVector<BaseItem*> items;
|
QList<BaseItem*> items;
|
||||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||||
if (!item->parentItem())
|
if (!item->parentItem())
|
||||||
items << item;
|
items << item;
|
||||||
@@ -349,7 +349,7 @@ void GraphicsScene::runLayoutToSelectedStates()
|
|||||||
{
|
{
|
||||||
m_document->undoStack()->beginMacro(Tr::tr("Re-layout"));
|
m_document->undoStack()->beginMacro(Tr::tr("Re-layout"));
|
||||||
|
|
||||||
QVector<BaseItem*> selectedItems;
|
QList<BaseItem*> selectedItems;
|
||||||
for (BaseItem *node : std::as_const(m_baseItems)) {
|
for (BaseItem *node : std::as_const(m_baseItems)) {
|
||||||
if (node->isSelected()) {
|
if (node->isSelected()) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
@@ -514,7 +514,7 @@ void GraphicsScene::endTagChange(ScxmlDocument::TagChange change, ScxmlTag *tag,
|
|||||||
if (!tag)
|
if (!tag)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
QVector<ScxmlTag*> childTransitionTags;
|
QList<ScxmlTag*> childTransitionTags;
|
||||||
if (tag->tagName(false) == "transition")
|
if (tag->tagName(false) == "transition")
|
||||||
childTransitionTags << tag;
|
childTransitionTags << tag;
|
||||||
|
|
||||||
@@ -721,7 +721,7 @@ void GraphicsScene::removeItems(const ScxmlTag *tag)
|
|||||||
{
|
{
|
||||||
if (tag) {
|
if (tag) {
|
||||||
// Find right items
|
// Find right items
|
||||||
QVector<BaseItem*> items;
|
QList<BaseItem*> items;
|
||||||
for (BaseItem *it : std::as_const(m_baseItems)) {
|
for (BaseItem *it : std::as_const(m_baseItems)) {
|
||||||
if (it->tag() == tag)
|
if (it->tag() == tag)
|
||||||
items << it;
|
items << it;
|
||||||
|
@@ -57,7 +57,7 @@ public:
|
|||||||
void setDocument(ScxmlDocument *document);
|
void setDocument(ScxmlDocument *document);
|
||||||
void unselectAll();
|
void unselectAll();
|
||||||
void unhighlightAll();
|
void unhighlightAll();
|
||||||
void highlightItems(const QVector<ScxmlTag*> &lstIds);
|
void highlightItems(const QList<ScxmlTag*> &lstIds);
|
||||||
void addConnectableItem(ItemType type, const QPointF &pos, BaseItem *parentItem);
|
void addConnectableItem(ItemType type, const QPointF &pos, BaseItem *parentItem);
|
||||||
void runAutomaticLayout();
|
void runAutomaticLayout();
|
||||||
void runLayoutToSelectedStates();
|
void runLayoutToSelectedStates();
|
||||||
@@ -112,8 +112,8 @@ private:
|
|||||||
QPointer<OutputPane::WarningModel> m_warningModel;
|
QPointer<OutputPane::WarningModel> m_warningModel;
|
||||||
QPointer<ScxmlUiFactory> m_uiFactory;
|
QPointer<ScxmlUiFactory> m_uiFactory;
|
||||||
QPointer<ScxmlDocument> m_document;
|
QPointer<ScxmlDocument> m_document;
|
||||||
QVector<BaseItem*> m_baseItems;
|
QList<BaseItem*> m_baseItems;
|
||||||
QVector<WarningItem*> m_allWarnings;
|
QList<WarningItem*> m_allWarnings;
|
||||||
int m_pasteCounter = 0;
|
int m_pasteCounter = 0;
|
||||||
QPointer<BaseItem> m_lastPasteTargetItem;
|
QPointer<BaseItem> m_lastPasteTargetItem;
|
||||||
SnapLine *m_lineX = nullptr;
|
SnapLine *m_lineX = nullptr;
|
||||||
|
@@ -43,7 +43,7 @@ void IdWarningItem::setId(const QString &text)
|
|||||||
void IdWarningItem::checkDuplicates(const QString &id)
|
void IdWarningItem::checkDuplicates(const QString &id)
|
||||||
{
|
{
|
||||||
if (scene()) {
|
if (scene()) {
|
||||||
QVector<IdWarningItem*> foundItems;
|
QList<IdWarningItem*> foundItems;
|
||||||
|
|
||||||
QList<QGraphicsItem*> items = scene()->items();
|
QList<QGraphicsItem*> items = scene()->items();
|
||||||
for (int i = 0; i < items.count(); ++i) {
|
for (int i = 0; i < items.count(); ++i) {
|
||||||
|
@@ -45,7 +45,7 @@ void ParallelItem::doLayout(int d)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// 1. Find children items
|
// 1. Find children items
|
||||||
QVector<StateItem*> children;
|
QList<StateItem*> children;
|
||||||
const QList<QGraphicsItem *> items = childItems();
|
const QList<QGraphicsItem *> items = childItems();
|
||||||
for (QGraphicsItem *it : items) {
|
for (QGraphicsItem *it : items) {
|
||||||
if (it->type() >= StateType) {
|
if (it->type() >= StateType) {
|
||||||
@@ -74,7 +74,7 @@ void ParallelItem::doLayout(int d)
|
|||||||
|
|
||||||
// 3. Relocate children-states
|
// 3. Relocate children-states
|
||||||
// a) sort list
|
// a) sort list
|
||||||
QVector<StateItem*> sortedList;
|
QList<StateItem*> sortedList;
|
||||||
while (!children.isEmpty()) {
|
while (!children.isEmpty()) {
|
||||||
qreal minTop = children.first()->boundingRect().top();
|
qreal minTop = children.first()->boundingRect().top();
|
||||||
int minTopIndex = 0;
|
int minTopIndex = 0;
|
||||||
|
@@ -123,10 +123,10 @@ bool canDrop(int parentType, int childType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<ScxmlTag*> findCopyTags(const QVector<BaseItem*> &items, QPointF &minPos)
|
QList<ScxmlTag*> findCopyTags(const QList<BaseItem*> &items, QPointF &minPos)
|
||||||
{
|
{
|
||||||
QPointF pp(0, 0);
|
QPointF pp(0, 0);
|
||||||
QVector<ScxmlTag*> tags;
|
QList<ScxmlTag*> tags;
|
||||||
for (BaseItem *it : items) {
|
for (BaseItem *it : items) {
|
||||||
if (it->type() >= InitialStateType && it->isSelected()) {
|
if (it->type() >= InitialStateType && it->isSelected()) {
|
||||||
BaseItem *parent = it->parentBaseItem();
|
BaseItem *parent = it->parentBaseItem();
|
||||||
@@ -155,10 +155,10 @@ QVector<ScxmlTag*> findCopyTags(const QVector<BaseItem*> &items, QPointF &minPos
|
|||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<ScxmlTag*> findRemovedTags(const QVector<BaseItem*> &items)
|
QList<ScxmlTag*> findRemovedTags(const QList<BaseItem*> &items)
|
||||||
{
|
{
|
||||||
// Find right tags
|
// Find right tags
|
||||||
QVector<ScxmlTag*> tags;
|
QList<ScxmlTag*> tags;
|
||||||
for (BaseItem *it : items) {
|
for (BaseItem *it : items) {
|
||||||
if (it->isSelected()) {
|
if (it->isSelected()) {
|
||||||
// Find the last selected parent
|
// Find the last selected parent
|
||||||
|
@@ -31,8 +31,8 @@ ConnectableItem *createItem(ItemType type, const QPointF &pos = QPointF());
|
|||||||
ConnectableItem *createItemByTagType(TagType type, const QPointF &pos = QPointF());
|
ConnectableItem *createItemByTagType(TagType type, const QPointF &pos = QPointF());
|
||||||
ScxmlTag *createTag(ItemType type, ScxmlDocument *document);
|
ScxmlTag *createTag(ItemType type, ScxmlDocument *document);
|
||||||
bool canDrop(int parentType, int childType);
|
bool canDrop(int parentType, int childType);
|
||||||
QVector<ScxmlTag*> findCopyTags(const QVector<BaseItem*> &items, QPointF &minPos);
|
QList<ScxmlTag*> findCopyTags(const QList<BaseItem*> &items, QPointF &minPos);
|
||||||
QVector<ScxmlTag*> findRemovedTags(const QVector<BaseItem*> &items);
|
QList<ScxmlTag*> findRemovedTags(const QList<BaseItem*> &items);
|
||||||
void layout(const QList<QGraphicsItem*> &items);
|
void layout(const QList<QGraphicsItem*> &items);
|
||||||
bool isSomeSelected(QGraphicsItem *item);
|
bool isSomeSelected(QGraphicsItem *item);
|
||||||
void moveTop(BaseItem *item, GraphicsScene *scene);
|
void moveTop(BaseItem *item, GraphicsScene *scene);
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "shapeprovider.h"
|
#include "shapeprovider.h"
|
||||||
|
|
||||||
#include <QVector>
|
#include <QList>
|
||||||
|
|
||||||
namespace ScxmlEditor {
|
namespace ScxmlEditor {
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
QVector<ShapeGroup*> m_groups;
|
QList<ShapeGroup*> m_groups;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace PluginInterface
|
} // namespace PluginInterface
|
||||||
|
@@ -169,7 +169,7 @@ QColor ScxmlDocument::getColor(int depth) const
|
|||||||
return m_colors.isEmpty() ? QColor(Qt::gray) : m_colors[depth % m_colors.count()];
|
return m_colors.isEmpty() ? QColor(Qt::gray) : m_colors[depth % m_colors.count()];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScxmlDocument::setLevelColors(const QVector<QColor> &colors)
|
void ScxmlDocument::setLevelColors(const QList<QColor> &colors)
|
||||||
{
|
{
|
||||||
m_colors = colors;
|
m_colors = colors;
|
||||||
emit colorThemeChanged();
|
emit colorThemeChanged();
|
||||||
@@ -294,7 +294,7 @@ bool ScxmlDocument::pasteData(const QByteArray &data, const QPointF &minPos, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_idMap.clear();
|
m_idMap.clear();
|
||||||
QVector<ScxmlTag*> addedTags;
|
QList<ScxmlTag*> addedTags;
|
||||||
|
|
||||||
while (!xml.atEnd()) {
|
while (!xml.atEnd()) {
|
||||||
QXmlStreamReader::TokenType token = xml.readNext();
|
QXmlStreamReader::TokenType token = xml.readNext();
|
||||||
@@ -374,7 +374,7 @@ void ScxmlDocument::printSCXML()
|
|||||||
qDebug() << content();
|
qDebug() << content();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray ScxmlDocument::content(const QVector<ScxmlTag*> &tags) const
|
QByteArray ScxmlDocument::content(const QList<ScxmlTag*> &tags) const
|
||||||
{
|
{
|
||||||
QByteArray result;
|
QByteArray result;
|
||||||
if (!tags.isEmpty()) {
|
if (!tags.isEmpty()) {
|
||||||
@@ -494,7 +494,7 @@ void ScxmlDocument::changeOrder(ScxmlTag *child, int newPos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScxmlDocument::addTags(ScxmlTag *parent, const QVector<ScxmlTag*> tags)
|
void ScxmlDocument::addTags(ScxmlTag *parent, const QList<ScxmlTag*> tags)
|
||||||
{
|
{
|
||||||
if (m_undoRedoRunning)
|
if (m_undoRedoRunning)
|
||||||
return;
|
return;
|
||||||
|
@@ -5,11 +5,11 @@
|
|||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
#include <QList>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QUndoStack)
|
QT_FORWARD_DECLARE_CLASS(QUndoStack)
|
||||||
QT_FORWARD_DECLARE_CLASS(QXmlStreamReader)
|
QT_FORWARD_DECLARE_CLASS(QXmlStreamReader)
|
||||||
@@ -106,7 +106,7 @@ public:
|
|||||||
* @param child
|
* @param child
|
||||||
*/
|
*/
|
||||||
void addTag(ScxmlTag *parent, ScxmlTag *child);
|
void addTag(ScxmlTag *parent, ScxmlTag *child);
|
||||||
void addTags(ScxmlTag *parent, const QVector<ScxmlTag*> tags);
|
void addTags(ScxmlTag *parent, const QList<ScxmlTag*> tags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief removeTag - inform views that tag will be removed
|
* @brief removeTag - inform views that tag will be removed
|
||||||
@@ -183,7 +183,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool hasLayouted() const;
|
bool hasLayouted() const;
|
||||||
|
|
||||||
void setLevelColors(const QVector<QColor> &colors);
|
void setLevelColors(const QList<QColor> &colors);
|
||||||
QColor getColor(int depth) const;
|
QColor getColor(int depth) const;
|
||||||
|
|
||||||
bool hasError() const
|
bool hasError() const
|
||||||
@@ -196,7 +196,7 @@ public:
|
|||||||
return m_lastError;
|
return m_lastError;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray content(const QVector<ScxmlTag*> &tags) const;
|
QByteArray content(const QList<ScxmlTag*> &tags) const;
|
||||||
QByteArray content(ScxmlTag *tag = nullptr) const;
|
QByteArray content(ScxmlTag *tag = nullptr) const;
|
||||||
void clear(bool createRoot = true);
|
void clear(bool createRoot = true);
|
||||||
|
|
||||||
@@ -256,14 +256,14 @@ private:
|
|||||||
ScxmlTag *createScxmlTag();
|
ScxmlTag *createScxmlTag();
|
||||||
QString m_fileName;
|
QString m_fileName;
|
||||||
QUndoStack *m_undoStack;
|
QUndoStack *m_undoStack;
|
||||||
QVector<ScxmlTag*> m_tags;
|
QList<ScxmlTag*> m_tags;
|
||||||
QHash<QString, int> m_nextIdHash;
|
QHash<QString, int> m_nextIdHash;
|
||||||
QHash<QString, QString> m_idMap;
|
QHash<QString, QString> m_idMap;
|
||||||
bool m_hasError = false;
|
bool m_hasError = false;
|
||||||
QString m_lastError;
|
QString m_lastError;
|
||||||
QVector<ScxmlTag*> m_rootTags;
|
QList<ScxmlTag*> m_rootTags;
|
||||||
QMap<QString, ScxmlNamespace*> m_namespaces;
|
QMap<QString, ScxmlNamespace*> m_namespaces;
|
||||||
QVector<QColor> m_colors;
|
QList<QColor> m_colors;
|
||||||
bool m_hasLayouted = false;
|
bool m_hasLayouted = false;
|
||||||
QString m_idDelimiter;
|
QString m_idDelimiter;
|
||||||
bool m_useFullNameSpace = false;
|
bool m_useFullNameSpace = false;
|
||||||
|
@@ -476,14 +476,14 @@ ScxmlTag *ScxmlTag::tagForId(const QString &id) const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<ScxmlTag*> ScxmlTag::allChildren() const
|
QList<ScxmlTag*> ScxmlTag::allChildren() const
|
||||||
{
|
{
|
||||||
return m_childTags;
|
return m_childTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<ScxmlTag*> ScxmlTag::children(const QString &name) const
|
QList<ScxmlTag*> ScxmlTag::children(const QString &name) const
|
||||||
{
|
{
|
||||||
QVector<ScxmlTag*> children;
|
QList<ScxmlTag*> children;
|
||||||
for (ScxmlTag *tag : std::as_const(m_childTags)) {
|
for (ScxmlTag *tag : std::as_const(m_childTags)) {
|
||||||
if (tag->tagName() == name)
|
if (tag->tagName() == name)
|
||||||
children << tag;
|
children << tag;
|
||||||
|
@@ -83,8 +83,8 @@ public:
|
|||||||
void removeChild(ScxmlTag *child);
|
void removeChild(ScxmlTag *child);
|
||||||
void moveChild(int oldPos, int newPos);
|
void moveChild(int oldPos, int newPos);
|
||||||
int childCount() const;
|
int childCount() const;
|
||||||
QVector<ScxmlTag*> allChildren() const;
|
QList<ScxmlTag*> allChildren() const;
|
||||||
QVector<ScxmlTag*> children(const QString &name) const;
|
QList<ScxmlTag*> children(const QString &name) const;
|
||||||
ScxmlTag *child(const QString &name) const;
|
ScxmlTag *child(const QString &name) const;
|
||||||
ScxmlTag *child(int row) const;
|
ScxmlTag *child(int row) const;
|
||||||
int childIndex(const ScxmlTag *child) const;
|
int childIndex(const ScxmlTag *child) const;
|
||||||
@@ -116,7 +116,7 @@ private:
|
|||||||
QStringList m_attributeNames;
|
QStringList m_attributeNames;
|
||||||
QStringList m_attributeValues;
|
QStringList m_attributeValues;
|
||||||
QPointer<ScxmlTag> m_parentTag;
|
QPointer<ScxmlTag> m_parentTag;
|
||||||
QVector<ScxmlTag*> m_childTags;
|
QList<ScxmlTag*> m_childTags;
|
||||||
QPointer<ScxmlDocument> m_document;
|
QPointer<ScxmlDocument> m_document;
|
||||||
TagType m_tagType = UnknownTag;
|
TagType m_tagType = UnknownTag;
|
||||||
QString m_tagName;
|
QString m_tagName;
|
||||||
|
@@ -24,7 +24,7 @@ bool checkPaste(const QString &copiedTagTypes, const ScxmlTag *currentTag)
|
|||||||
if (copiedTagTypes.isEmpty() || !currentTag)
|
if (copiedTagTypes.isEmpty() || !currentTag)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QVector<TagType> tagTypes;
|
QList<TagType> tagTypes;
|
||||||
for (int i = 0; i < Finalize; ++i) {
|
for (int i = 0; i < Finalize; ++i) {
|
||||||
if (copiedTagTypes.contains(QLatin1String(scxml_tags[i].name)))
|
if (copiedTagTypes.contains(QLatin1String(scxml_tags[i].name)))
|
||||||
tagTypes << TagType(i);
|
tagTypes << TagType(i);
|
||||||
@@ -35,7 +35,7 @@ bool checkPaste(const QString &copiedTagTypes, const ScxmlTag *currentTag)
|
|||||||
if (tagTypes.isEmpty())
|
if (tagTypes.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QVector<TagType> childTags = allowedChildTypes(currentTag->tagType());
|
QList<TagType> childTags = allowedChildTypes(currentTag->tagType());
|
||||||
for (const TagType &type : std::as_const(tagTypes)) {
|
for (const TagType &type : std::as_const(tagTypes)) {
|
||||||
if (!childTags.contains(type))
|
if (!childTags.contains(type))
|
||||||
return false;
|
return false;
|
||||||
@@ -75,9 +75,9 @@ void createChildMenu(const ScxmlTag *tag, QMenu *menu, bool addRemove)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<TagType> allowedChildTypes(TagType tagType)
|
QList<TagType> allowedChildTypes(TagType tagType)
|
||||||
{
|
{
|
||||||
QVector<TagType> childTags;
|
QList<TagType> childTags;
|
||||||
|
|
||||||
switch (tagType) {
|
switch (tagType) {
|
||||||
case Scxml:
|
case Scxml:
|
||||||
@@ -161,9 +161,9 @@ QVector<TagType> allowedChildTypes(TagType tagType)
|
|||||||
return childTags;
|
return childTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<TagType> childTypes(TagType tagType)
|
QList<TagType> childTypes(TagType tagType)
|
||||||
{
|
{
|
||||||
QVector<TagType> childTags;
|
QList<TagType> childTags;
|
||||||
|
|
||||||
switch (tagType) {
|
switch (tagType) {
|
||||||
case Scxml:
|
case Scxml:
|
||||||
@@ -241,7 +241,7 @@ void initChildMenu(TagType tagType, QMenu *menu)
|
|||||||
{
|
{
|
||||||
menu->setTitle(QLatin1String(scxml_tags[tagType].name));
|
menu->setTitle(QLatin1String(scxml_tags[tagType].name));
|
||||||
|
|
||||||
QVector<TagType> childTags = childTypes(tagType);
|
QList<TagType> childTags = childTypes(tagType);
|
||||||
|
|
||||||
if (!childTags.isEmpty()) {
|
if (!childTags.isEmpty()) {
|
||||||
for (int i = 0; i < childTags.count(); ++i) {
|
for (int i = 0; i < childTags.count(); ++i) {
|
||||||
@@ -301,7 +301,7 @@ ScxmlTag *findChild(const ScxmlTag *tag, TagType childType)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void findAllChildren(const ScxmlTag *tag, QVector<ScxmlTag*> &children)
|
void findAllChildren(const ScxmlTag *tag, QList<ScxmlTag*> &children)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(tag, return);
|
QTC_ASSERT(tag, return);
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ void findAllChildren(const ScxmlTag *tag, QVector<ScxmlTag*> &children)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void findAllTransitionChildren(const ScxmlTag *tag, QVector<ScxmlTag*> &children)
|
void findAllTransitionChildren(const ScxmlTag *tag, QList<ScxmlTag*> &children)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(tag, return);
|
QTC_ASSERT(tag, return);
|
||||||
|
|
||||||
|
@@ -4,14 +4,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "scxmltag.h"
|
#include "scxmltag.h"
|
||||||
|
|
||||||
|
#include <QList>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
namespace ScxmlEditor {
|
namespace ScxmlEditor::PluginInterface::TagUtils {
|
||||||
|
|
||||||
namespace PluginInterface {
|
|
||||||
|
|
||||||
namespace TagUtils {
|
|
||||||
|
|
||||||
enum MenuAction {
|
enum MenuAction {
|
||||||
AddChild = 0,
|
AddChild = 0,
|
||||||
@@ -23,16 +20,14 @@ enum MenuAction {
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool checkPaste(const QString &copiedTagType, const ScxmlTag *currentTag);
|
bool checkPaste(const QString &copiedTagType, const ScxmlTag *currentTag);
|
||||||
QVector<TagType> allowedChildTypes(TagType tagType);
|
QList<TagType> allowedChildTypes(TagType tagType);
|
||||||
QVector<TagType> childTypes(TagType type);
|
QList<TagType> childTypes(TagType type);
|
||||||
void createChildMenu(const ScxmlTag *tag, QMenu *menu, bool addRemove = true);
|
void createChildMenu(const ScxmlTag *tag, QMenu *menu, bool addRemove = true);
|
||||||
void initChildMenu(TagType tagType, QMenu *menu);
|
void initChildMenu(TagType tagType, QMenu *menu);
|
||||||
ScxmlTag *findChild(const ScxmlTag *tag, TagType childType);
|
ScxmlTag *findChild(const ScxmlTag *tag, TagType childType);
|
||||||
ScxmlTag *metadataTag(ScxmlTag *tag, const QString &tagname, bool blockUpdates = false);
|
ScxmlTag *metadataTag(ScxmlTag *tag, const QString &tagname, bool blockUpdates = false);
|
||||||
void findAllChildren(const ScxmlTag *tag, QVector<ScxmlTag*> &children);
|
void findAllChildren(const ScxmlTag *tag, QList<ScxmlTag*> &children);
|
||||||
void findAllTransitionChildren(const ScxmlTag *tag, QVector<ScxmlTag*> &children);
|
void findAllTransitionChildren(const ScxmlTag *tag, QList<ScxmlTag*> &children);
|
||||||
void modifyPosition(ScxmlTag *tag, const QPointF &minPos, const QPointF &targetPos);
|
void modifyPosition(ScxmlTag *tag, const QPointF &minPos, const QPointF &targetPos);
|
||||||
|
|
||||||
} // namespace TagUtils
|
} // namespace ScxmlEditor::PluginInterface::TagUtils
|
||||||
} // namespace PluginInterface
|
|
||||||
} // namespace ScxmlEditor
|
|
||||||
|
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QList>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
namespace ScxmlEditor {
|
namespace ScxmlEditor {
|
||||||
|
|
||||||
|
@@ -7,9 +7,7 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
namespace ScxmlEditor {
|
namespace ScxmlEditor::PluginInterface {
|
||||||
|
|
||||||
namespace PluginInterface {
|
|
||||||
|
|
||||||
class ISCEditor;
|
class ISCEditor;
|
||||||
class ScxmlDocument;
|
class ScxmlDocument;
|
||||||
@@ -41,9 +39,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
void initPlugins();
|
void initPlugins();
|
||||||
|
|
||||||
QVector<ISCEditor*> m_plugins;
|
QList<ISCEditor*> m_plugins;
|
||||||
QMap<QString, QObject*> m_objects;
|
QMap<QString, QObject*> m_objects;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace PluginInterface
|
} // namespace ScxmlEditor::PluginInterface
|
||||||
} // namespace ScxmlEditor
|
|
||||||
|
@@ -9,9 +9,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace ScxmlEditor {
|
namespace ScxmlEditor::PluginInterface {
|
||||||
|
|
||||||
namespace PluginInterface {
|
|
||||||
|
|
||||||
class ShapeProvider : public QObject
|
class ShapeProvider : public QObject
|
||||||
{
|
{
|
||||||
@@ -36,7 +34,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString title;
|
QString title;
|
||||||
QVector<Shape*> shapes;
|
QList<Shape*> shapes;
|
||||||
void addShape(Shape *shape)
|
void addShape(Shape *shape)
|
||||||
{
|
{
|
||||||
shapes << shape;
|
shapes << shape;
|
||||||
@@ -59,5 +57,4 @@ signals:
|
|||||||
void changed();
|
void changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace PluginInterface
|
} // namespace ScxmlEditor::PluginInterface
|
||||||
} // namespace ScxmlEditor
|
|
||||||
|
@@ -190,7 +190,7 @@ void StateItem::updateBoundingRect()
|
|||||||
void StateItem::shrink()
|
void StateItem::shrink()
|
||||||
{
|
{
|
||||||
QRectF trect;
|
QRectF trect;
|
||||||
const QVector<TransitionItem *> items = outputTransitions();
|
const QList<TransitionItem *> items = outputTransitions();
|
||||||
for (TransitionItem *item : items) {
|
for (TransitionItem *item : items) {
|
||||||
if (item->targetType() == TransitionItem::InternalSameTarget || item->targetType() == TransitionItem::InternalNoTarget) {
|
if (item->targetType() == TransitionItem::InternalSameTarget || item->targetType() == TransitionItem::InternalNoTarget) {
|
||||||
trect = trect.united(item->wholeBoundingRect());
|
trect = trect.united(item->wholeBoundingRect());
|
||||||
@@ -223,7 +223,7 @@ void StateItem::transitionsChanged()
|
|||||||
{
|
{
|
||||||
QRectF rr = boundingRect();
|
QRectF rr = boundingRect();
|
||||||
QRectF rectInternalTransitions;
|
QRectF rectInternalTransitions;
|
||||||
const QVector<TransitionItem*> internalTransitions = outputTransitions();
|
const QList<TransitionItem*> internalTransitions = outputTransitions();
|
||||||
for (TransitionItem *item : internalTransitions) {
|
for (TransitionItem *item : internalTransitions) {
|
||||||
if (item->targetType() <= TransitionItem::InternalNoTarget) {
|
if (item->targetType() <= TransitionItem::InternalNoTarget) {
|
||||||
QRectF br = mapFromItem(item, item->boundingRect()).boundingRect();
|
QRectF br = mapFromItem(item, item->boundingRect()).boundingRect();
|
||||||
|
@@ -4,13 +4,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "transitionwarningitem.h"
|
#include "transitionwarningitem.h"
|
||||||
|
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QPen>
|
#include <QPen>
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
#include <QPolygon>
|
#include <QPolygon>
|
||||||
#include <QRectF>
|
#include <QRectF>
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
namespace ScxmlEditor {
|
namespace ScxmlEditor {
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ private:
|
|||||||
QPointF calculateTargetFactor(ConnectableItem *item, const QPointF &pos);
|
QPointF calculateTargetFactor(ConnectableItem *item, const QPointF &pos);
|
||||||
QPointF sceneTargetPoint(TransitionPoint p);
|
QPointF sceneTargetPoint(TransitionPoint p);
|
||||||
QPointF findIntersectionPoint(ConnectableItem *item, const QLineF &line, const QPointF &defaultPoint);
|
QPointF findIntersectionPoint(ConnectableItem *item, const QLineF &line, const QPointF &defaultPoint);
|
||||||
QVector<CornerGrabberItem*> m_cornerGrabbers;
|
QList<CornerGrabberItem*> m_cornerGrabbers;
|
||||||
CornerGrabberItem *m_selectedCornerGrabber = nullptr;
|
CornerGrabberItem *m_selectedCornerGrabber = nullptr;
|
||||||
|
|
||||||
QPolygonF m_cornerPoints;
|
QPolygonF m_cornerPoints;
|
||||||
|
@@ -332,7 +332,7 @@ void ChangeFullNameSpaceCommand::makeIdMap(ScxmlTag *tag, QHash<QString, QString
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QVector<ScxmlTag *> children = tag->allChildren();
|
const QList<ScxmlTag *> children = tag->allChildren();
|
||||||
for (ScxmlTag *child : children) {
|
for (ScxmlTag *child : children) {
|
||||||
makeIdMap(child, map, use);
|
makeIdMap(child, map, use);
|
||||||
}
|
}
|
||||||
@@ -359,7 +359,7 @@ void ChangeFullNameSpaceCommand::updateNameSpace(ScxmlTag *tag, const QHash<QStr
|
|||||||
tag->setAttribute(name, map[attr]);
|
tag->setAttribute(name, map[attr]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QVector<ScxmlTag *> children = tag->allChildren();
|
const QList<ScxmlTag *> children = tag->allChildren();
|
||||||
for (ScxmlTag *child : children) {
|
for (ScxmlTag *child : children) {
|
||||||
updateNameSpace(child, map);
|
updateNameSpace(child, map);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user