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")); }
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())); }