예제 #1
0
void WsAccount::setUserNetwork( const IMAccount& imAccount ) 
{
	std::string method = "saveUserNetwork";
	std::string xml = toXml( imAccount, method );

	setUserNetwork( method, xml );
}
예제 #2
0
bool OSResult::save(const openstudio::path& p, bool overwrite) const {
  bool result(false);
  if (overwrite || !boost::filesystem::exists(p)) {
    try {
      QFile file(toQString(p));
      file.open(QFile::WriteOnly);
      QTextStream out(&file);
      toXml().save(out, 2);
      file.close();
      result = true;
    }
    catch (std::exception& e) {
      LOG(Error,"Could not save OSResult to " << toString(p) << ", because "
          << e.what());
    }
    catch (...) {
      LOG(Error,"Could not save OSResult to " << toString(p) << ".");
    }
  }
  else {
    LOG(Error,"Could not save OSResult because " << toString(p) <<
        " exists and overwrite == false.");
  }

  return result;
}
예제 #3
0
파일: maiaObject.cpp 프로젝트: hades/qtmpc
QString MaiaObject::prepareCall(QString method, QList<QVariant> args)
{
	QDomDocument doc;

	QDomProcessingInstruction header = doc.createProcessingInstruction( "xml", QString("version=\"1.0\" encoding=\"UTF-8\"" ));
	doc.appendChild(header);

	QDomElement methodCall = doc.createElement("methodCall");
	QDomElement methodName = doc.createElement("methodName");
	QDomElement params = doc.createElement("params");
	QDomElement param;

	doc.appendChild(methodCall);
	methodCall.appendChild(methodName);
	methodName.appendChild(doc.createTextNode(method));

	methodCall.appendChild(params);

	for(int i = 0; i < args.size(); ++i) {
		param = doc.createElement("param");
		param.appendChild(toXml(args.at(i)));
		params.appendChild(param);
	}

	return doc.toString();
}
예제 #4
0
QString Team::toXml() const
{
    QDomDocument document;

    toXml(document);

    return document.toString();
}
예제 #5
0
void UserGroupList::save() {
    QSettings* s = Settings::Instance();
    s->setValue("userGroups", toXml());

    QString ignorestr;
    foreach (QString ignorename, ignoreSet) {
        ignorestr += ignorename + ";";
    }
예제 #6
0
QDomNode *AQS::toXml(QObject *o, bool includeChildren,
                     bool includeComplexTypes) const
{
    AQSObject *aqo = ::qt_cast<AQSObject *>(findAQSObject(o));
    if (!aqo)
        return 0;
    return toXml(aqo, includeChildren, includeComplexTypes);
}
예제 #7
0
SellerManager::~SellerManager()
{
  toXml();
  for (QList<Seller*>::iterator it = m_sellers.begin(); it != m_sellers.end(); ++it)
  {
    delete *it;
  }
}
예제 #8
0
QString Profile::toXml() const
{
    QDomDocument document;

    toXml(document);

    return document.toString();
}
예제 #9
0
QString CDSObject::toXml( FilterMap &filter ) const
{
    QString     sXML;
    QTextStream os( &sXML, QIODevice::WriteOnly );
    os.setCodec(QTextCodec::codecForName("UTF-8"));
    toXml(os, filter);
    os << flush;
    return( sXML );
}
예제 #10
0
QString Profile::toXml() const
{
    const_cast<Profile*>(this)->sanitize();
    QDomDocument document;

    toXml(document);

    return document.toString();
}
예제 #11
0
void XmlResultPrinter::endTestRun(const Test&, TestResult&)
{
    addStatusAndTimeAttribute("testsuites", *testStat);

    builder->addAttributeTo("testsuites", "name", "AllTests");

    clearStatsBy(*testStat);
    toXml();

}
예제 #12
0
파일: vielement.cpp 프로젝트: EQ4/Visore
bool ViElement::saveToFile(QString fileName)
{
	QFile file(fileName);
	if(!file.open(QIODevice::WriteOnly))
	{
		return false;
	}
	file.write(toXml(). toLatin1());
	file.close();
	return true;
}
예제 #13
0
QString CDSObject::toXml()// FilterMap &filter )
{
    QString     sXML;
    QTextStream os( sXML, IO_WriteOnly );
    
    os.setEncoding( QTextStream::UnicodeUTF8 );

    toXml( os ); //, filter );

    return( sXML );
}
예제 #14
0
void LibraryTreeWidget::setModified(bool m)
{
	if (m == false)
		xmlString_ = toXml().toString();

	if (m == isModifed_)
		return;

	isModifed_ = m;

	emit modificationChanged(isModifed_);
}
예제 #15
0
// ============================================================================
std::ostream& Gaudi::Utils::Histos::toXml
( const AIDA::IProfile2D&   histo  ,
  std::ostream&             stream )
{
  //
  AIDA::IProfile2D* aida = const_cast<AIDA::IProfile2D*> ( &histo ) ;
  //
  const TProfile2D* root = Gaudi::Utils::Aida2ROOT::aida2root ( aida ) ;
  if ( 0 == root ) { return stream ; }                                // RETURN
  //
  return toXml  ( *root , stream ) ;
}
예제 #16
0
void LibraryTreeWidget::clear()
{
	QTreeWidget::clear();
	dependencyGraph_.clear();
	projectFileName_ = "";
	properties_.clear();
	xmlString_ = toXml().toString();

	bool changed = isModifed_ == true;
	isModifed_ = false;

	if (changed)
		emit modificationChanged(isModifed_);
}
예제 #17
0
void LibraryTreeWidget::checkModification()
{
	QString xmlString = toXml().toString();
	if (xmlString == xmlString_)
		return;

	bool changed = isModifed_ == false;

	isModifed_ = true;
	xmlString_ = xmlString;

	if (changed)
		emit modificationChanged(isModifed_);
}
예제 #18
0
파일: regexp.cpp 프로젝트: Fat-Zer/tdeutils
TQString RegExp::toXmlString() const
{
  TQDomDocument doc;
  doc.setContent( TQString::fromLatin1( "<RegularExpression/>" ) );
  TQDomNode top = doc.documentElement();
  top.toElement().setAttribute(TQString::fromLocal8Bit("version"), KRegExpEditorGUI::version);

  TQDomNode elm = toXml( &doc );

  top.appendChild( elm );
  TQString xmlString = TQString::fromLocal8Bit("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<!DOCTYPE RegularExpression PUBLIC \"-//KDE//KRegexpEditor DTD 1.0//EN\" \"http://www.blackie.dk/kreg.dtd\">\n") + doc.toString();

  return xmlString;
}
예제 #19
0
bool Profile::saveToFile(const QString &path) const
{
    QFile file(path);
    if(!file.open(QIODevice::WriteOnly))
    {
        QMessageBox::warning(0, QObject::tr("Error while saving the profile"),QObject::tr("Can't create file %1").arg(file.fileName()));
        return false;
    }

    QDomDocument document;

    toXml(document);

    QTextStream in(&file);
    document.save(in,4);
    return true;
}
예제 #20
0
void LibraryTreeWidget::newProject(const QString& projectFileName)
{
	dependencyGraph_.clear();

	QTreeWidget::clear();

	properties_.clear();

	QTreeWidgetItem* rootitem = createProjectItem(QFileInfo(projectFileName).completeBaseName());
	addTopLevelItem(rootitem);

	projectFileName_ = projectFileName;

	xmlString_ = toXml().toString();

	bool changed = isModifed_ == true;
	isModifed_ = false;

	if (changed)
		emit modificationChanged(isModifed_);
}
예제 #21
0
QString MaiaObject::prepareResponse(QVariant arg) {

    QDomDocument doc;

    QDomProcessingInstruction header = doc.createProcessingInstruction( "xml", QString("version=\"1.0\" encoding=\"UTF-8\"" ));
    doc.appendChild(header);

    QDomElement methodResponse = doc.createElement("methodResponse");
    QDomElement params = doc.createElement("params");
    QDomElement param;

    doc.appendChild(methodResponse);

    methodResponse.appendChild(params);

    if(!arg.isNull()) {
        param = doc.createElement("param");
        param.appendChild(toXml(arg));
        params.appendChild(param);
    }
    return doc.toString();
}
예제 #22
0
int Document::saveToFile(QString filename)
{
    if(filename == "")
        filename = this->fileName;
    this->fileName = filename;
    int ind = std::max(filename.lastIndexOf("/"), filename.lastIndexOf("\\"));
    _name = filename.mid(ind+1);
    QFile f(filename);
    if(!f.open(QIODevice::WriteOnly))
        return -1;
    QDomDocument doc("LDocument");
    doc.appendChild(toXml(doc));
    if(f.write(doc.toByteArray())== -1)
    {
        f.close();
        return 0;
    }

    f.close();
    setUnchanged();

    return 1;
}
예제 #23
0
void LibraryTreeWidget::loadXml(const QString& projectFileName, const QDomDocument& doc)
{
	dependencyGraph_.clear();

	std::vector<std::pair<QString, QString> > dependencies;

	QTreeWidget::clear();

	QDomElement root = doc.documentElement();

	// read properties
	{
		properties_.clear();

		QDomElement properties = root.firstChildElement("properties");

		// graphics options
		if (!properties.attribute("scaleMode").isEmpty())
			properties_.scaleMode = properties.attribute("scaleMode").toInt();
		if (!properties.attribute("logicalWidth").isEmpty())
			properties_.logicalWidth = properties.attribute("logicalWidth").toInt();
		if (!properties.attribute("logicalHeight").isEmpty())
			properties_.logicalHeight = properties.attribute("logicalHeight").toInt();
        if (!properties.attribute("windowWidth").isEmpty())
            properties_.windowWidth = properties.attribute("windowWidth").toInt();
        if (!properties.attribute("windowHeight").isEmpty())
            properties_.windowHeight = properties.attribute("windowHeight").toInt();
		QDomElement imageScales = properties.firstChildElement("imageScales");
		for(QDomNode n = imageScales.firstChild(); !n.isNull(); n = n.nextSibling())
		{
			QDomElement scale = n.toElement();
			if(!scale.isNull())
				properties_.imageScales.push_back(std::make_pair(scale.attribute("suffix"), scale.attribute("scale").toDouble()));
		}
		if (!properties.attribute("orientation").isEmpty())
			properties_.orientation = properties.attribute("orientation").toInt();
		if (!properties.attribute("fps").isEmpty())
			properties_.fps = properties.attribute("fps").toInt();

		// iOS options
		if (!properties.attribute("retinaDisplay").isEmpty())
            properties_.retinaDisplay = properties.attribute("retinaDisplay").toInt();
		if (!properties.attribute("autorotation").isEmpty())
			properties_.autorotation = properties.attribute("autorotation").toInt();
        if (!properties.attribute("version").isEmpty())
            properties_.version = properties.attribute("version");
        if (!properties.attribute("version_code").isEmpty())
            properties_.version_code = properties.attribute("version_code").toInt();

        // input options
        if (!properties.attribute("mouseToTouch").isEmpty())
            properties_.mouseToTouch = properties.attribute("mouseToTouch").toInt() != 0;
        if (!properties.attribute("touchToMouse").isEmpty())
            properties_.touchToMouse = properties.attribute("touchToMouse").toInt() != 0;
        if (!properties.attribute("mouseTouchOrder").isEmpty())
            properties_.mouseTouchOrder = properties.attribute("mouseTouchOrder").toInt();

		// export options
		if (!properties.attribute("architecture").isEmpty())
			properties_.architecture = properties.attribute("architecture").toInt();
        if (!properties.attribute("android_template").isEmpty())
            properties_.android_template = properties.attribute("android_template").toInt();
		if (!properties.attribute("assetsOnly").isEmpty())
			properties_.assetsOnly = properties.attribute("assetsOnly").toInt() != 0;
		if (!properties.attribute("iosDevice").isEmpty())
			properties_.iosDevice = properties.attribute("iosDevice").toInt();
        if (!properties.attribute("ios_bundle").isEmpty())
            properties_.ios_bundle = properties.attribute("ios_bundle");
		if (!properties.attribute("packageName").isEmpty())
			properties_.packageName = properties.attribute("packageName");
        if (!properties.attribute("osx_org").isEmpty())
			properties_.osx_org = properties.attribute("osx_org");
        if (!properties.attribute("osx_domain").isEmpty())
			properties_.osx_domain = properties.attribute("osx_domain");
        if (!properties.attribute("osx_bundle").isEmpty())
            properties_.osx_bundle = properties.attribute("osx_bundle");
        if (!properties.attribute("osx_category").isEmpty())
            properties_.osx_category = properties.attribute("osx_category").toInt();
        if (!properties.attribute("win_org").isEmpty())
			properties_.win_org = properties.attribute("win_org");
        if (!properties.attribute("win_domain").isEmpty())
			properties_.win_domain = properties.attribute("win_domain");
        if (!properties.attribute("winrt_org").isEmpty())
            properties_.winrt_org = properties.attribute("winrt_org");
        if (!properties.attribute("winrt_package").isEmpty())
            properties_.winrt_package = properties.attribute("winrt_package");
        if (!properties.attribute("html5_host").isEmpty())
            properties_.html5_host = properties.attribute("html5_host");
        if (!properties.attribute("encryptCode").isEmpty())
            properties_.encryptCode = properties.attribute("encryptCode").toInt() != 0;
        if (!properties.attribute("encryptAssets").isEmpty())
            properties_.encryptAssets = properties.attribute("encryptAssets").toInt() != 0;
    }

	QTreeWidgetItem* rootitem = createProjectItem(QFileInfo(projectFileName).completeBaseName());
	addTopLevelItem(rootitem);

	std::deque<std::pair<QTreeWidgetItem*, QDomNode> > stack;
	stack.push_back(std::make_pair(static_cast<QTreeWidgetItem*>(0), doc.documentElement()));

	while (stack.empty() == false)
	{
		QTreeWidgetItem* parent = stack.front().first;
		QDomNode n = stack.front().second;
		stack.pop_front();

		QTreeWidgetItem* item = 0;
		if (parent == 0)
		{
			item = rootitem;//invisibleRootItem();
		}
		else
		{
			QDomElement e = n.toElement();

			QString type = e.tagName();

			if (type == "file")
			{
				QString file = e.hasAttribute("source") ? e.attribute("source") : e.attribute("file");
                bool downsizing = e.hasAttribute("downsizing") && e.attribute("downsizing").toInt();
                bool excludeFromExecution = e.hasAttribute("excludeFromExecution") && e.attribute("excludeFromExecution").toInt();
                item = createFileItem(file, downsizing, excludeFromExecution);
			}
			else if (type == "folder")
			{
				QString name = e.attribute("name");
				item = createFolderItem(name);
			}
			else if (type == "dependency")
			{
				QString from = e.attribute("from");
				QString to = e.attribute("to");

				dependencies.push_back(std::make_pair(from, to));
			}

			if (item)
				parent->addChild(item);
		}

		QDomNodeList childNodes = n.childNodes();
		for (int i = 0; i < childNodes.size(); ++i)
			stack.push_back(std::make_pair(item, childNodes.item(i)));
	}

	rootitem->setExpanded(true);

	for (std::size_t i = 0; i < dependencies.size(); ++i)
		dependencyGraph_.addDependency(dependencies[i].first, dependencies[i].second);

	projectFileName_ = projectFileName;

	xmlString_ = toXml().toString();

	bool changed = isModifed_ == true;
	isModifed_ = false;

	if (changed)
		emit modificationChanged(isModifed_);
}
예제 #24
0
LibraryTreeWidget::LibraryTreeWidget(QWidget *parent)
	: QTreeWidget(parent)
{
	setSelectionMode(QAbstractItemView::ExtendedSelection);
	setDragEnabled(true);
	viewport()->setAcceptDrops(true);
	setDropIndicatorShown(true);
	setDragDropMode(QAbstractItemView::InternalMove);

	invisibleRootItem()->setFlags(invisibleRootItem()->flags() & ~Qt::ItemIsDropEnabled);

	setHeaderHidden(true);

	setEditTriggers(QAbstractItemView::EditKeyPressed | QAbstractItemView::SelectedClicked);

	addNewFileAction_ = new QAction(tr("Add New File..."), this);
	connect(addNewFileAction_, SIGNAL(triggered()), this, SLOT(addNewFile()));

	importToLibraryAction_ = new QAction(tr("Add Existing Files..."), this);
	connect(importToLibraryAction_, SIGNAL(triggered()), this, SLOT(importToLibrary()));

//	newFontAction_ = new QAction(tr("New Font..."), this);
//	connect(newFontAction_, SIGNAL(triggered()), this, SLOT(newFont()));

	newFolderAction_ = new QAction(tr("New Folder"), this);
	connect(newFolderAction_, SIGNAL(triggered()), this, SLOT(newFolder()));

	removeAction_ = new QAction(tr("Remove"), this);
	connect(removeAction_, SIGNAL(triggered()), this, SLOT(remove()));

	renameAction_ = new QAction(tr("Rename"), this);
	//renameAction_->setShortcut(Qt::Key_F2);
	connect(renameAction_, SIGNAL(triggered()), this, SLOT(rename()));

	sortAction_ = new QAction(tr("Sort"), this);
	connect(sortAction_, SIGNAL(triggered()), this, SLOT(sort()));

	codeDependenciesAction_ = new QAction(tr("Code Dependencies..."), this);
	connect(codeDependenciesAction_, SIGNAL(triggered()), this, SLOT(codeDependencies()));

	insertIntoDocumentAction_ = new QAction(tr("Insert Into Document"), this);
	connect(insertIntoDocumentAction_, SIGNAL(triggered()), this, SLOT(insertIntoDocument()));

	projectPropertiesAction_ = new QAction(tr("Properties..."), this);
	connect(projectPropertiesAction_, SIGNAL(triggered()), this, SLOT(projectProperties()));

	automaticDownsizingAction_ = new QAction(tr("Automatic Downsizing"), this);
	automaticDownsizingAction_->setCheckable(true);
	connect(automaticDownsizingAction_, SIGNAL(triggered(bool)), this, SLOT(automaticDownsizing(bool)));

    excludeFromExecutionAction_ = new QAction(tr("Exclude from Execution"), this);
    excludeFromExecutionAction_->setCheckable(true);
    connect(excludeFromExecutionAction_, SIGNAL(triggered(bool)), this, SLOT(excludeFromExecution(bool)));

    setContextMenuPolicy(Qt::CustomContextMenu);
	connect(this, SIGNAL(customContextMenuRequested  (const QPoint&)),
			this, SLOT  (onCustomContextMenuRequested(const QPoint&)));

	connect(this, SIGNAL(itemDoubleClicked  (QTreeWidgetItem*, int)),
			this, SLOT  (onItemDoubleClicked(QTreeWidgetItem*, int)));

	connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
			this, SLOT  (onCurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));

	isModifed_ = false;
	xmlString_ = toXml().toString();

	QTimer* timer = new QTimer(this);
	connect(timer, SIGNAL(timeout()), this, SLOT(checkModification()));
	timer->start(500);
}
예제 #25
0
QByteArray MeasureDragData::data()
{
  return toXml().toUtf8();
}
예제 #26
0
파일: maiaObject.cpp 프로젝트: hades/qtmpc
QDomElement MaiaObject::toXml(QVariant arg)
{
	//dummy document
	QDomDocument doc;
	//value element, we need this in each case
	QDomElement tagValue = doc.createElement("value");

	switch(arg.type()) {
	case QVariant::String: {

		QDomElement tagString = doc.createElement("string");
		QDomText textString = doc.createTextNode(arg.toString());

		tagValue.appendChild(tagString);
		tagString.appendChild(textString);

		return tagValue;

	} case QVariant::Int: {

		QDomElement tagInt = doc.createElement("int");
		QDomText textInt = doc.createTextNode(QString::number(arg.toInt()));

		tagValue.appendChild(tagInt);
		tagInt.appendChild(textInt);

		return tagValue;

	} case QVariant::Double: {

		QDomElement tagDouble = doc.createElement("double");
		QDomText textDouble = doc.createTextNode(QString::number(arg.toDouble()));

		tagValue.appendChild(tagDouble);
		tagDouble.appendChild(textDouble);

		return tagValue;

	} case QVariant::Bool: {

		QString textValue = arg.toBool() ? "1" : "0";

		QDomElement tag = doc.createElement("boolean");
		QDomText text = doc.createTextNode(textValue);

		tagValue.appendChild(tag);
		tag.appendChild(text);

		return tagValue;

	} case QVariant::ByteArray: {

		QString textValue = arg.toByteArray().toBase64();

		QDomElement tag = doc.createElement("base64");
		QDomText text = doc.createTextNode(textValue);

		tagValue.appendChild(tag);
		tag.appendChild(text);

		return tagValue;

	} case QVariant::DateTime: {

		QString textValue = arg.toDateTime().toString("yyyyMMddThh:mm:ss");

		QDomElement tag = doc.createElement("datetime.iso8601");
		QDomText text = doc.createTextNode(textValue);

		tagValue.appendChild(tag);
		tag.appendChild(text);

		return tagValue;

	} case QVariant::List: {

		QDomElement tagArray = doc.createElement("array");
		QDomElement tagData = doc.createElement("data");
		tagArray.appendChild(tagData);
		tagValue.appendChild(tagArray);

		const QList<QVariant> args = arg.toList();
		for(int i = 0; i < args.size(); ++i) {
			tagData.appendChild(toXml(args.at(i)));
		}

		return tagValue;

	} case QVariant::Map: {

		QDomElement tagStruct = doc.createElement("struct");
		QDomElement member;
		QDomElement name;

		tagValue.appendChild(tagStruct);

		QMap<QString, QVariant> map = arg.toMap();
		QMapIterator<QString, QVariant> i(map);
		while(i.hasNext()) {
			i.next();

			member = doc.createElement("member");
			name = doc.createElement("name");

			// (key) -> name -> member -> struct
			tagStruct.appendChild(member);
			member.appendChild(name);
			name.appendChild(doc.createTextNode(i.key()));

			// add variables by recursion
			member.appendChild(toXml(i.value()));
		}

		return tagValue;

	} default:
		qDebug() << "Failed to marshal unknown variant type: " << arg.type() << endl;
	}
	return QDomElement(); //QString::null;
}