Пример #1
0
void VirtualConsole::createWidget(QPtrList <QString> &list)
{
    QString t;

    for (QString* s = list.next(); s != NULL; s = list.next())
    {
        if (*s == QString("Entry"))
        {
            s = list.prev();
            break;
        }
        else if (*s == QString("Frame"))
        {
            if (m_drawArea == NULL)
            {
                m_drawArea = new VCFrame(this);
                m_drawArea->init();
                m_drawArea->setBottomFrame(true);
                m_drawArea->setFrameStyle(QFrame::Panel | QFrame::Sunken);

                m_layout->addWidget(m_drawArea, 1);

                m_drawArea->createContents(list);

                m_drawArea->show();
            }
            else
            {
                VCFrame* w = new VCFrame(m_drawArea);
                w->init();
                w->createContents(list);
            }
        }
        else if (*s == QString("Label"))
        {
            VCLabel* w = new VCLabel(m_drawArea);
            w->init();
            w->createContents(list);
        }
        else if (*s == QString("Button"))
        {
            VCButton* w = new VCButton(m_drawArea);
            w->init();
            w->createContents(list);
        }
        else if (*s == QString("Slider"))
        {
            VCDockSlider* s = new VCDockSlider(m_drawArea);
            s->init();
            s->createContents(list);
        }
        else
        {
            // Unknown keyword, skip
            list.next();
        }
    }
}
Пример #2
0
void VCFrame::slotAddLabel(QPoint p)
{
  VCLabel* l = new VCLabel(this);
  assert(l);
  l->init();
  l->show();

  l->move(p);
    
  _app->doc()->setModified(true);
}
Пример #3
0
VCWidget* VCLabel::createCopy(VCWidget* parent)
{
    Q_ASSERT(parent != NULL);

    VCLabel* label = new VCLabel(parent, m_doc);
    if (label->copyFrom(this) == false)
    {
        delete label;
        label = NULL;
    }

    return label;
}
Пример #4
0
void VirtualConsole::slotAddLabel()
{
    VCWidget* parent(closestParent());
    if (parent == NULL)
        return;

    VCLabel* label = new VCLabel(parent, m_doc);
    Q_ASSERT(label != NULL);
    label->show();
    label->move(parent->lastClickPoint());
    clearWidgetSelection();
    setWidgetSelected(label, true);
    m_doc->setModified();
}
Пример #5
0
void VCFrame::addLabel(QPoint at)
{
	VCLabel* label = new VCLabel(this);
	Q_ASSERT(label != NULL);
	label->show();

	if (at.isNull() == false)
		label->move(at);
	else
		label->move(m_mousePressPoint);

	_app->virtualConsole()->setSelectedWidget(label);

	_app->doc()->setModified();
}
Пример #6
0
bool VCLabel::loader(QDomDocument* doc, QDomElement* root, QWidget* parent)
{
	VCLabel* label = NULL;
	
	Q_ASSERT(doc != NULL);
	Q_ASSERT(root != NULL);
	Q_ASSERT(parent != NULL);

	if (root->tagName() != KXMLQLCVCLabel)
	{
		qWarning("Label node not found!");
		return false;
	}

	/* Create a new label into its parent */
	label = new VCLabel(parent);
	label->show();

	/* Continue loading */
	return label->loadXML(doc, root);
}
Пример #7
0
void VirtualConsole::slotAddLabel()
{
    QWidget* parent = NULL;

    if (m_selectedWidget &&
            (QString(m_selectedWidget->className()) == QString("VCFrame")
             || QString(m_selectedWidget->className()) == QString("VCXYPad")))
    {
        parent = m_selectedWidget;
    }
    else
    {
        parent = m_drawArea;
    }

    VCLabel* l = new VCLabel(parent);
    assert(l);
    l->init();
    l->show();

    _app->doc()->setModified(true);
}
Пример #8
0
bool VCFrame::loadXML(const QDomElement* root)
{
    bool visible = false;
    int x = 0;
    int y = 0;
    int w = 0;
    int h = 0;

    QDomNode node;
    QDomElement tag;
    QString str;

    Q_ASSERT(root != NULL);

    if (root->tagName() != xmlTagName())
    {
        qWarning() << Q_FUNC_INFO << "Frame node not found";
        return false;
    }

    /* Caption */
    setCaption(root->attribute(KXMLQLCVCCaption));

    /* Children */
    node = root->firstChild();
    while (node.isNull() == false)
    {
        tag = node.toElement();
        if (tag.tagName() == KXMLQLCWindowState)
        {
            loadXMLWindowState(&tag, &x, &y, &w, &h, &visible);
            setGeometry(x, y, w, h);
        }
        else if (tag.tagName() == KXMLQLCVCAppearance)
        {
            loadXMLAppearance(&tag);
        }
        else if (tag.tagName() == KXMLQLCVCFrame)
        {
            /* Create a new frame into its parent */
            VCFrame* frame = new VCFrame(this, m_doc, m_outputMap, m_inputMap, m_masterTimer);
            if (frame->loadXML(&tag) == false)
                delete frame;
            else
                frame->show();
        }
        else if (tag.tagName() == KXMLQLCVCLabel)
        {
            /* Create a new label into its parent */
            VCLabel* label = new VCLabel(this, m_doc, m_outputMap, m_inputMap, m_masterTimer);
            if (label->loadXML(&tag) == false)
                delete label;
            else
                label->show();
        }
        else if (tag.tagName() == KXMLQLCVCButton)
        {
            /* Create a new button into its parent */
            VCButton* button = new VCButton(this, m_doc, m_outputMap, m_inputMap, m_masterTimer);
            if (button->loadXML(&tag) == false)
                delete button;
            else
                button->show();
        }
        else if (tag.tagName() == KXMLQLCVCXYPad)
        {
            /* Create a new xy pad into its parent */
            VCXYPad* xypad = new VCXYPad(this, m_doc, m_outputMap, m_inputMap, m_masterTimer);
            if (xypad->loadXML(&tag) == false)
                delete xypad;
            else
                xypad->show();
        }
        else if (tag.tagName() == KXMLQLCVCSlider)
        {
            /* Create a new slider into its parent */
            VCSlider* slider = new VCSlider(this, m_doc, m_outputMap, m_inputMap, m_masterTimer);
            if (slider->loadXML(&tag) == false)
                delete slider;
            else
                slider->show();
        }
        else if (tag.tagName() == KXMLQLCVCSoloFrame)
        {
            /* Create a new frame into its parent */
            VCSoloFrame* soloframe = new VCSoloFrame(this, m_doc, m_outputMap, m_inputMap, m_masterTimer);
            if (soloframe->loadXML(&tag) == false)
                delete soloframe;
            else
                soloframe->show();
        }
        else if (tag.tagName() == KXMLQLCVCCueList)
        {
            /* Create a new cuelist into its parent */
            VCCueList* cuelist = new VCCueList(this, m_doc, m_outputMap, m_inputMap, m_masterTimer);
            if (cuelist->loadXML(&tag) == false)
                delete cuelist;
            else
                cuelist->show();
        }
        else
        {
            qWarning() << Q_FUNC_INFO << "Unknown frame tag:" << tag.tagName();
        }

        node = node.nextSibling();
    }

    return true;
}