Example #1
0
UndoAction *MoveAction::restore(WidgetArea *area)
{
    DataWidget *w = area->getWidget(m_id);
    if(!w)
        return NULL;

    UndoAction *opposite = new MoveAction(w);

    w->setScaledUp(m_scaledUp);
    w->move(m_pos);
    w->resize(m_size);

    return opposite;
}
Example #2
0
DataWidget *WidgetArea::addWidget(QPoint pos, quint8 type, bool show)
{
    DataWidget *w = sWidgetFactory.getWidget(type, this);
    if(!w)
        return NULL;

    quint32 id = getNewId();
    w->setId(id);

    w->setUp(m_storage);

    w->move(pos);
    if(show)
        w->show();

    m_widgets.insert(id, w);

    connect(w,          SIGNAL(removeWidget(quint32)),              SLOT(removeWidget(quint32)));
    connect(w,          SIGNAL(updateMarker(DataWidget*)),          SLOT(updateMarker(DataWidget*)));
    connect(w,          SIGNAL(clearPlacementLines()),              SLOT(clearPlacementLines()));
    connect(w,          SIGNAL(updateData()),                       SIGNAL(updateData()));
    connect(w,   SIGNAL(mouseStatus(bool,data_widget_info,qint32)), SIGNAL(mouseStatus(bool,data_widget_info,qint32)));
    connect(w,          SIGNAL(SendData(QByteArray)),   m_analyzer, SIGNAL(SendData(QByteArray)));
    connect(w,          SIGNAL(toggleSelection(bool)),              SLOT(toggleSelection(bool)));
    connect(this,       SIGNAL(setTitleVisibility(bool)),        w, SLOT(setTitleVisibility(bool)));
    connect(w,  SIGNAL(addChildTab(ChildTab*,QString)), m_analyzer, SLOT(addChildTab(ChildTab*,QString)));
    connect(w,  SIGNAL(removeChildTab(ChildTab*)),      m_analyzer, SLOT(removeChildTab(ChildTab*)));
    connect(w,          SIGNAL(addUndoAct(UndoAction*)),&m_undoStack,SLOT(addAction(UndoAction*)));
    connect(m_analyzer, SIGNAL(rawData(QByteArray)),             w, SIGNAL(rawData(QByteArray)));
    connect(this,       SIGNAL(setLocked(bool)),                 w, SLOT(setLocked(bool)));

    //events
    connect(this,       SIGNAL(onWidgetAdd(DataWidget*)),        w, SLOT(onWidgetAdd(DataWidget*)));
    connect(this,       SIGNAL(onWidgetRemove(DataWidget*)),     w, SLOT(onWidgetRemove(DataWidget*)));
    connect(this,       SIGNAL(onScriptEvent(QString)),          w, SLOT(onScriptEvent(QString)));
    connect(this,       SIGNAL(onScriptEvent(QString,QVariantList)), w, SLOT(onScriptEvent(QString, QVariantList)));
    connect(w,          SIGNAL(scriptEvent(QString)),         this, SIGNAL(onScriptEvent(QString)));
    connect(w,          SIGNAL(scriptEvent(QString, QVariantList)),this, SIGNAL(onScriptEvent(QString, QVariantList)));

    emit onWidgetAdd(w);

    m_analyzer->setDataChanged();

    w->setTitleVisibility(m_actTitleVisibility->isChecked());
    return w;
}
Example #3
0
UndoAction *MoveGroupAction::restore(WidgetArea *area)
{
    MoveGroupAction *opposite = new MoveGroupAction(std::set<DataWidget*>());

    for(QHash<quint32, QPoint>::iterator itr = m_positions.begin(); itr != m_positions.end(); ++itr)
    {
        DataWidget *w = area->getWidget(itr.key());
        if(!w)
            continue;

        opposite->addWidget(w);
        w->move(*itr);
    }

    if(opposite->empty())
    {
        delete opposite;
        return NULL;
    }

    return opposite;
}