summaryrefslogtreecommitdiff
path: root/quacker/letterboxsettings.cpp
blob: 66f052aee2122bea18bfb14f886e60a7d6c3243b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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);
}