int fSettings::appendValue(QVariant fValue, QString array, QString key, int unique) { if((!unique)||(findValue(fValue,array,key)==-1)) { int size=beginReadArray(array); endArray(); beginWriteArray(array); setArrayIndex(size); setValue(key, fValue); endArray(); return 1; } else return 0; }
void Settings::store() { beginGroup("RecentProjects"); beginWriteArray("Project"); QLinkedList<RecentProject>::iterator itr; int i; for (itr = recentProjects_.begin(), i = 0; itr != recentProjects_.end(); ++itr, i++) { setArrayIndex(i); setValue("Path", (*itr).path_); setValue("Name", (*itr).name_); } endArray(); endGroup(); }
/** save configured values */ Preferences::~Preferences() { #define SV(s) setValue(#s, s) SV(console_font); SV(wrapMode); SV(console_out_fore); SV(console_out_back); SV(console_inp_fore); SV(console_inp_back); #undef SV beginWriteArray("ANSI_sequences"); for (int i = 0; i < ANSI_sequences.size(); ++i) { setArrayIndex(i); setValue("color", ANSI_sequences[i]); } endArray(); }
Config::~Config() { beginGroup("General"); setValue("language", language); setValue("recentFiles", recentFiles); setValue("openFiles", openFiles); setValue("lastFile", lastFile); setValue("mainWindowGeometry", mainWindowGeometry); setValue("mainWindowState", mainWindowState); setValue("helpWindowGeometry", helpWindowGeometry); endGroup(); beginGroup("Editor"); setValue("fontFamily", fontFamily); setValue("fontSize", fontSize); setValue("tabIndents", tabIndents); setValue("autoIndent", autoIndent); setValue("backUnindent", backUnindent); setValue("spaceTabs", spaceTabs); setValue("indentSize", indentSize); setValue("tabSize", tabSize); setValue("whitespaces", whitespaces); QMapIterator<QString, QTextCharFormat> it(colorScheme); beginWriteArray("ColorScheme"); int i = 0; while (it.hasNext()) { it.next(); setArrayIndex(i++); setValue("type", it.key()); setValue("italic", it.value().font().italic()); setValue("weihgt", it.value().font().weight()); setValue("foreground", it.value().foreground()); setValue("background", it.value().background()); } endArray(); endGroup(); // Editor beginGroup("Sessions"); setValue("leaveOpen", leaveOpen); setValue("sessions", sessions); setValue("sessionSplitter", sessionSplitter); endGroup(); beginGroup("Snippets"); setValue("snippetPath", snippetPath); setValue("snippetSplitter", snippetSplitter); endGroup(); beginGroup("SearchReplace"); findHistory.sort(); replaceHistory.sort(); setValue("findHistory", findHistory); setValue("replaceHistory", replaceHistory); setValue("matchCase", matchCase); setValue("regExp", regExp); setValue("allFiles", allFiles); endGroup(); }