Ejemplo n.º 1
0
void VirtualConsole::slotAddSlider()
{
    VCWidget* parent(closestParent());
    if (parent == NULL)
        return;

    VCSlider* slider = new VCSlider(parent, m_doc);
    Q_ASSERT(slider != NULL);
    slider->show();
    slider->move(parent->lastClickPoint());
    clearWidgetSelection();
    setWidgetSelected(slider, true);
    m_doc->setModified();
}
Ejemplo n.º 2
0
void VCFrame::addSlider(QPoint at)
{
	VCSlider* slider = new VCSlider(this);
	Q_ASSERT(slider != NULL);
	slider->init();
	slider->show();

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

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

	_app->doc()->setModified();
}
Ejemplo n.º 3
0
void VirtualConsole::slotAddSliderMatrix()
{
    VCWidget* parent(closestParent());
    if (parent == NULL)
        return;

    AddVCSliderMatrix avsm(this);
    if (avsm.exec() == QDialog::Rejected)
        return;

    int width = VCSlider::defaultSize.width();
    int height = avsm.height();
    int count = avsm.amount();

    VCFrame* frame = new VCFrame(parent, m_doc);
    Q_ASSERT(frame != NULL);

    // Resize the parent frame to fit the sliders nicely
    frame->resize(QSize((count * width) + 20, height + 20));
    frame->setAllowResize(false);

    for (int i = 0; i < count; i++)
    {
        VCSlider* slider = new VCSlider(frame, m_doc);
        Q_ASSERT(slider != NULL);
        slider->move(QPoint(10 + (width * i), 10));
        slider->resize(QSize(width, height));
        slider->show();
    }

    // Show the frame after adding buttons to prevent flickering
    frame->show();
    frame->move(parent->lastClickPoint());
    frame->setAllowChildren(false); // Don't allow more children
    clearWidgetSelection();
    setWidgetSelected(frame, true);
    m_doc->setModified();
}
Ejemplo n.º 4
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;
}