Ejemplo n.º 1
0
xmlNodePtr Settings::saveProperty(const gchar* key, int value,
                                  xmlNodePtr parent)
{
	XOJ_CHECK_TYPE(Settings);

	char* text = g_strdup_printf("%i", value);
	xmlNodePtr xmlNode = saveProperty(key, text, parent);
	g_free(text);
	return xmlNode;
}
Ejemplo n.º 2
0
void MessagePropertyDialog::slotUser1()
{
    saveProperty(m_listview, m_message, this);
}
Ejemplo n.º 3
0
void Settings::save()
{
	XOJ_CHECK_TYPE(Settings);

	if (this->timeoutId)
	{
		g_source_remove(this->timeoutId);
		this->timeoutId = 0;
	}

	xmlDocPtr doc;
	xmlNodePtr root;
	xmlNodePtr xmlNode;

	xmlIndentTreeOutput = TRUE;

	doc = xmlNewDoc((const xmlChar*) "1.0");
	if (doc == NULL)
	{
		return;
	}

	saveButtonConfig();

	/* Create metadata root */
	root = xmlNewDocNode(doc, NULL, (const xmlChar*) "settings", NULL);
	xmlDocSetRootElement(doc, root);
	xmlNodePtr com = xmlNewComment((const xmlChar*)
	                               "The Xournal++ settings file. Do not edit this file! "
	                               "The most settings are available in the Settings dialog, "
	                               "the others are commented in this file, but handle with care!");
	xmlAddPrevSibling(root, com);

	WRITE_BOOL_PROP(useXinput);
	WRITE_BOOL_PROP(presureSensitivity);
	WRITE_BOOL_PROP(ignoreCoreEvents);

	WRITE_STRING_PROP(selectedToolbar);
	WRITE_STRING_PROP(lastSavePath);
	WRITE_STRING_PROP(lastImagePath);

	WRITE_INT_PROP(displayDpi);
	WRITE_INT_PROP(mainWndWidth);
	WRITE_INT_PROP(mainWndHeight);
	WRITE_BOOL_PROP(maximized);

	WRITE_BOOL_PROP(showSidebar);
	WRITE_INT_PROP(sidebarWidth);

	WRITE_BOOL_PROP(sidebarOnRight);
	WRITE_BOOL_PROP(scrollbarOnLeft);
	WRITE_BOOL_PROP(showTwoPages);
	WRITE_BOOL_PROP(presentationMode);

	WRITE_STRING_PROP(fullscreenHideElements);
	WRITE_COMMENT("Which gui elements are hidden if you are in Fullscreen mode, separated by a colon (,)");

	WRITE_STRING_PROP(presentationHideElements);
	WRITE_COMMENT("Which gui elements are hidden if you are in Presentation mode, separated by a colon (,)");

	WRITE_BOOL_PROP(showBigCursor);

	if (this->scrollbarHideType == SCROLLBAR_HIDE_BOTH)
	{
		saveProperty((const char*) "scrollbarHideType", "both", root);
	}
	else if (this->scrollbarHideType == SCROLLBAR_HIDE_HORIZONTAL)
	{
		saveProperty((const char*) "scrollbarHideType", "horizontal", root);
	}
	else if (this->scrollbarHideType == SCROLLBAR_HIDE_VERTICAL)
	{
		saveProperty((const char*) "scrollbarHideType", "vertical", root);
	}
	else
	{
		saveProperty((const char*) "scrollbarHideType", "none", root);
	}


	WRITE_BOOL_PROP(autoloadPdfXoj);
	WRITE_COMMENT("Hides scroolbars in the main window, allowed values: \"none\", \"horizontal\", \"vertical\", \"both\"");

	WRITE_STRING_PROP(defaultSaveName);

	WRITE_STRING_PROP(visiblePageFormats);
	WRITE_COMMENT("This paper format is visible in the paper format dialog, separated by a colon");

	WRITE_BOOL_PROP(autosaveEnabled);
	WRITE_INT_PROP(autosaveTimeout);

	WRITE_BOOL_PROP(addHorizontalSpace);
	WRITE_BOOL_PROP(addVerticalSpace);

	WRITE_BOOL_PROP(fixXinput);

	WRITE_BOOL_PROP(enableLeafEnterWorkaround);
	WRITE_COMMENT("If Xournal crashes if you e.g. unplug your mouse set this to true. If you have input problems, you can turn it of with false.");

	String pageInsertType = pageInsertTypeToString(this->pageInsertType);
	WRITE_STRING_PROP(pageInsertType);

	WRITE_INT_PROP(pageBackgroundColor);
	WRITE_INT_PROP(selectionColor);

	WRITE_INT_PROP(pdfPageCacheSize);
	WRITE_COMMENT("The count of rendered PDF pages which will be cached.");

	WRITE_DOUBLE_PROP(widthMinimumMultiplier);
	WRITE_COMMENT("The multiplier for the pressure sensitivity of the pen");
	WRITE_DOUBLE_PROP(widthMaximumMultiplier);
	WRITE_COMMENT("The multiplier for the pressure sensitivity of the pen");

	xmlNodePtr xmlFont;
	xmlFont = xmlNewChild(root, NULL, (const xmlChar*) "property", NULL);
	xmlSetProp(xmlFont, (const xmlChar*) "name", (const xmlChar*) "font");
	xmlSetProp(xmlFont, (const xmlChar*) "font",
	           (const xmlChar*) this->font.getName().c_str());
	gchar* sSize = g_strdup_printf("%0.1lf", this->font.getSize());
	xmlSetProp(xmlFont, (const xmlChar*) "size", (const xmlChar*) sSize);
	g_free(sSize);

	std::map<String, SElement>::iterator it;
	for (it = data.begin(); it != data.end(); it++)
	{
		saveData(root, (*it).first, (*it).second);
	}

	xmlSaveFormatFile(filename.c_str(), doc, 1);
	xmlFreeDoc(doc);
}
Ejemplo n.º 4
0
void XMLWriter::saveProperties(QObject *item, QDomElement *node)
{
    for (int i=0;i<item->metaObject()->propertyCount();i++){
        saveProperty(item->metaObject()->property(i).name(),item,node);
    }
}
Ejemplo n.º 5
0
void AttachPropertyDialog::saveClicked()
{
	saveProperty( properties_, m_attach, this );
}