void VCFrame::slotAddXYPad(QPoint p) { VCXYPad* x = new VCXYPad(this); assert(x); x->init(); x->show(); x->move(p); _app->doc()->setModified(true); }
VCWidget* VCXYPad::createCopy(VCWidget* parent) { Q_ASSERT(parent != NULL); VCXYPad* xypad = new VCXYPad(parent, m_doc, m_outputMap, m_inputMap, m_masterTimer); if (xypad->copyFrom(this) == false) { delete xypad; xypad = NULL; } return xypad; }
VCWidget* VCXYPad::createCopy(VCWidget* parent) { Q_ASSERT(parent != NULL); VCXYPad* xypad = new VCXYPad(parent); if (xypad->copyFrom(this) == false) { delete xypad; xypad = NULL; } return xypad; }
void VirtualConsole::slotAddXYPad() { VCWidget* parent(closestParent()); if (parent == NULL) return; VCXYPad* xypad = new VCXYPad(parent, m_doc); Q_ASSERT(xypad != NULL); xypad->show(); xypad->move(parent->lastClickPoint()); clearWidgetSelection(); setWidgetSelected(xypad, true); m_doc->setModified(); }
void VCFrame::addXYPad(QPoint at) { VCXYPad* xypad = new VCXYPad(this); Q_ASSERT(xypad != NULL); xypad->show(); if (at.isNull() == false) xypad->move(at); else xypad->move(m_mousePressPoint); _app->virtualConsole()->setSelectedWidget(xypad); _app->doc()->setModified(); }
bool VCXYPad::copyFrom(VCWidget* widget) { VCXYPad* xypad = qobject_cast <VCXYPad*> (widget); if (xypad == NULL) return false; /* Get rid of existing channels */ m_fixtures.clear(); /* Copy the other widget's fixtures */ m_fixtures = xypad->fixtures(); /* Copy the current position */ setCurrentXYPosition(xypad->currentXYPosition()); /* Copy common stuff */ return VCWidget::copyFrom(widget); }
bool VCXYPad::loader(const QDomElement* root, QWidget* parent) { VCXYPad* xypad = NULL; Q_ASSERT(root != NULL); Q_ASSERT(parent != NULL); if (root->tagName() != KXMLQLCVCXYPad) { qDebug() << "XY Pad node not found!"; return false; } /* Create a new xy pad into its parent */ xypad = new VCXYPad(parent); xypad->show(); /* Continue loading */ return xypad->loadXML(root); }
void VirtualConsole::slotAddXYPad() { QWidget* parent = NULL; if (m_selectedWidget && QString(m_selectedWidget->className()) == QString("VCFrame")) { parent = m_selectedWidget; } else { parent = m_drawArea; } VCXYPad* f = new VCXYPad(parent); assert(f); f->init(); f->show(); _app->doc()->setModified(true); }
void VCXYPad_Test::copy() { QWidget w; VCFrame parent(&w, m_doc); VCXYPad pad(&parent, m_doc); pad.setCaption("Dingdong"); QSize size(80, 80); QPointF pt(50, 30); pad.m_area->setPosition(pt); VCXYPadFixture xyf1(m_doc); xyf1.setHead(GroupHead(1,5)); pad.appendFixture(xyf1); VCXYPadFixture xyf2(m_doc); xyf2.setHead(GroupHead(2,7)); pad.appendFixture(xyf2); VCXYPadFixture xyf3(m_doc); xyf3.setHead(GroupHead(3,9)); pad.appendFixture(xyf3); VCXYPad* copy = qobject_cast<VCXYPad*> (pad.createCopy(&parent)); QVERIFY(copy != NULL); QCOMPARE(copy->m_fixtures.size(), 3); QVERIFY(copy->m_fixtures[0] == xyf1); QVERIFY(copy->m_fixtures[1] == xyf2); QVERIFY(copy->m_fixtures[2] == xyf3); QVERIFY(©->m_fixtures[0] != &xyf1); QVERIFY(©->m_fixtures[1] != &xyf2); QVERIFY(©->m_fixtures[2] != &xyf3); QCOMPARE(copy->m_area->position(), pt); QCOMPARE(copy->size(), pad.size()); QCOMPARE(copy->caption(), QString("Dingdong")); }
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; }