summaryrefslogtreecommitdiff
path: root/quacker/letterboxsettings.cpp
diff options
context:
space:
mode:
authorJason Katz-Brown <jason@airbnb.com>2013-08-25 02:17:13 -0700
committerJason Katz-Brown <jason@airbnb.com>2013-08-25 02:17:13 -0700
commit9306cb60c32082c5403931de0823a9fd5daa196c (patch)
treeca1b6eb695fdf3f0c2294e92416b272164bae642 /quacker/letterboxsettings.cpp
parent8fb2c681cecc01b46b0f4ba02d5cc177c4747b1c (diff)
Initial git commit.
Diffstat (limited to 'quacker/letterboxsettings.cpp')
-rw-r--r--quacker/letterboxsettings.cpp92
1 files changed, 92 insertions, 0 deletions
diff --git a/quacker/letterboxsettings.cpp b/quacker/letterboxsettings.cpp
new file mode 100644
index 0000000..66f052a
--- /dev/null
+++ b/quacker/letterboxsettings.cpp
@@ -0,0 +1,92 @@
+/*
+ * Quackle -- Crossword game artificial intelligence and analysis tool
+ * Copyright (C) 2005-2006 Jason Katz-Brown and John O'Laughlin.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include <QtGui>
+
+#include "customqsettings.h"
+#include "letterboxsettings.h"
+
+LetterboxSettings *LetterboxSettings::m_self = 0;
+LetterboxSettings *LetterboxSettings::self()
+{
+ return m_self;
+}
+
+LetterboxSettings::LetterboxSettings()
+ : msecWaitBase(1500), msecWaitExtraPerSolution(1500), backgroundColor("#eeeeee"), foregroundColor("#000000"), sowpodsColor("#ff0000"), lengthOfExtensions(3), autoCompleteLength(0), mathMode(false), numExtensionChars(32), spaceComplete(false), newMissesFile(false)
+{
+ m_self = this;
+}
+
+LetterboxSettings::~LetterboxSettings()
+{
+}
+
+void LetterboxSettings::readSettings()
+{
+ CustomQSettings settings;
+
+ msecWaitBase = settings.value("quackle/letterbox/msecWaitBase", msecWaitBase).toInt();
+ msecWaitExtraPerSolution = settings.value("quackle/letterbox/msecWaitExtraPerSolution", msecWaitExtraPerSolution).toInt();
+
+ backgroundColor = settings.value("quackle/letterbox/backgroundColor", backgroundColor).toString();
+ foregroundColor = settings.value("quackle/letterbox/foregroundColor", foregroundColor).toString();
+ sowpodsColor = settings.value("quackle/letterbox/sowpodsColor", sowpodsColor).toString();
+
+ dictFilename = settings.value("quackle/letterbox/dict/filename", dictFilename).toString();
+ dictGaddagFilename = settings.value("quackle/letterbox/dict/gaddagfilename", dictGaddagFilename).toString();
+
+ lengthOfExtensions = settings.value("quackle/letterbox/lengthOfExtensions", lengthOfExtensions).toInt();
+
+ mathMode = settings.value("quackle/letterbox/mathMode", mathMode).toBool();
+
+ autoCompleteLength = settings.value("quackle/letterbox/autoCompleteLength", autoCompleteLength).toInt();
+
+ numExtensionChars = settings.value("quackle/letterbox/numExtensionChars", numExtensionChars).toInt();
+
+ spaceComplete = settings.value("quackle/letterbox/spaceComplete", spaceComplete).toBool();
+ newMissesFile = settings.value("quackle/letterbox/newMissesFile", newMissesFile).toBool();
+}
+
+void LetterboxSettings::writeSettings()
+{
+ CustomQSettings settings;
+
+ settings.setValue("quackle/letterbox/msecWaitBase", msecWaitBase);
+ settings.setValue("quackle/letterbox/msecWaitExtraPerSolution", msecWaitExtraPerSolution);
+
+ settings.setValue("quackle/letterbox/backgroundColor", backgroundColor);
+ settings.setValue("quackle/letterbox/foregroundColor", foregroundColor);
+ settings.setValue("quackle/letterbox/sowpodsColor", sowpodsColor);
+
+ settings.setValue("quackle/letterbox/dict/filename", dictFilename);
+ settings.setValue("quackle/letterbox/dict/gaddagfilename", dictGaddagFilename);
+
+ settings.setValue("quackle/letterbox/lengthOfExtensions", lengthOfExtensions);
+
+ settings.setValue("quackle/letterbox/mathMode", mathMode);
+
+ settings.setValue("quackle/letterbox/autoCompleteLength", autoCompleteLength);
+ settings.setValue("quackle/letterbox/numExtensionChars", numExtensionChars);
+
+ settings.setValue("quackle/letterbox/spaceComplete", spaceComplete);
+ settings.setValue("quackle/letterbox/newMissesFile", newMissesFile);
+}
+