Example #1
0
void Widget::load(VXml xml)
{
    {
        VXml coordXml = xml.findChild("coord");
        if (!coordXml.isNull())
        {
            QRect rect = geometry();
            rect.setLeft  ((coordXml.getInt("left",   0)));
            rect.setTop   ((coordXml.getInt("top",    0)));
            rect.setWidth ((coordXml.getInt("width",  640)));
            rect.setHeight((coordXml.getInt("height", 480)));
            setGeometry(rect);
        }
    }

    ui->chkShowHexa->setCheckState((Qt::CheckState)xml.getInt("showHexa", (int)ui->chkShowHexa->checkState()));
    ui->chkSendHexa->setCheckState((Qt::CheckState)xml.getInt("sendHexa", (int)ui->chkSendHexa->checkState()));
    ui->chkEcho->setCheckState((Qt::CheckState)xml.getInt("echo", (int)ui->chkEcho->checkState()));
    ui->chkEchoBroadcast->setCheckState((Qt::CheckState)xml.getInt("echoBroadcast", (int)ui->chkEchoBroadcast->checkState()));
    ui->tabOption->setCurrentIndex(xml.getInt("currentIndex", 0));
    ui->leTcpPort->setText(xml.getStr("tcpPort", ui->leTcpPort->text()));
    ui->leUdpPort->setText(xml.getStr("udpPort", ui->leUdpPort->text()));
    ui->leSslPort->setText(xml.getStr("sslPort", ui->leSslPort->text()));
    ui->pteSend->insertPlainText(xml.getStr("sendText", ui->pteSend->toPlainText()));

    {
        VXml sizesXml = xml.findChild("sizes");
        QList<int> sizes;
        if (!sizesXml.isNull())
        {
            QStringList strList = sizesXml.getStr("splitter").split(",");
            foreach (QString s, strList) sizes << s.toInt();
            ui->splitter->setSizes(sizes);
        }
    }

    tcpServer.load(xml.gotoChilds("netClient/tcpServer"));
    udpServer.load(xml.gotoChilds("netClient/udpServer"));
    sslServer.load(xml.gotoChilds("netClient/sslServer"));
}
Example #2
0
VXml VXmlDoc::root()
{
  //QDomElement element = this->documentElement(); // gilgil temp 2012.05.31
  //VXml res = *((VXml*)&element);
  VXml res = QDomDocument::documentElement();
#ifdef _DEBUG
  if (res.isNull())
  {
    LOG_WARN("root is NULL");
  }
#endif // _DEBUG
  return res;
}
Example #3
0
QObject* VFactory::createObjectByDefaultDoc(const QString& path)
{
  VXmlDoc& doc = VXmlDoc::instance();
  VXml xml = doc.root().findChilds(path);
  if (xml.isNull()) return NULL;

  QString className = xml.getStr("_class", "");
  if (className == "")
  {
    return NULL;
  }
  VObject* obj = dynamic_cast<VObject*>(VFactory::instance().createObjectByClassName(className));
  if (obj == NULL)
  {
    return NULL;
  }
  obj->load(xml);
  return obj;
}
Example #4
0
void MainWindow::load(VXml xml)
{
  {
    VXml coordXml = xml.findChild("coord");
    if (!coordXml.isNull())
    {
      QRect rect = geometry();
      rect.setLeft  ((coordXml.getInt("left",   0)));
      rect.setTop   ((coordXml.getInt("top",    0)));
      rect.setWidth ((coordXml.getInt("width",  640)));
      rect.setHeight((coordXml.getInt("height", 480)));
      setGeometry(rect);
    }
  }

  ui->actionShowLog->setChecked(xml.getBool("showLog", ui->actionShowLog->isChecked()));
  ui->actionAlwaysOnTop->setChecked(xml.getBool("alwaysOnTop", ui->actionAlwaysOnTop->isChecked()));
  ui->actionWordWrap->setChecked(xml.getBool("wordWrap", ui->actionWordWrap->isChecked()));
}