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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
/*
* Quackle -- Crossword game artificial intelligence and analysis tool
* Copyright (C) 2005-2014 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <QtGui>
#include <uv.h>
#include "configpages.h"
#include "letterboxsettings.h"
#include "quackersettings.h"
LetterboxPage::LetterboxPage(QWidget *parent)
: ConfigPage(parent)
{
m_pageTitle = tr("Letterbox");
QGroupBox *timingsGroup = new QGroupBox(tr("Quiz timings"));
QLabel *baseLabel = new QLabel(tr("Initial wait:"));
m_baseSpin = new QSpinBox;
m_baseSpin->setSuffix(tr(" msec"));
m_baseSpin->setMinimum(0);
m_baseSpin->setMaximum(100000);
m_baseSpin->setSingleStep(500);
QLabel *extraLabel = new QLabel(tr("Extra wait per anagram:"));
m_extraSpin = new QSpinBox;
m_extraSpin->setSuffix(tr(" msec"));
m_extraSpin->setMinimum(0);
m_extraSpin->setMaximum(100000);
m_extraSpin->setSingleStep(500);
QGridLayout *timingsLayout = new QGridLayout;
timingsLayout->addWidget(baseLabel, 0, 0);
timingsLayout->addWidget(m_baseSpin, 0, 1);
timingsLayout->addWidget(extraLabel, 1, 0);
timingsLayout->addWidget(m_extraSpin, 1, 1);
timingsGroup->setLayout(timingsLayout);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(timingsGroup);
mainLayout->addStretch(1);
setLayout(mainLayout);
}
void LetterboxPage::readConfig()
{
m_baseSpin->setValue(LetterboxSettings::self()->msecWaitBase);
m_extraSpin->setValue(LetterboxSettings::self()->msecWaitExtraPerSolution);
}
void LetterboxPage::writeConfig()
{
LetterboxSettings::self()->msecWaitBase = m_baseSpin->value();
LetterboxSettings::self()->msecWaitExtraPerSolution = m_extraSpin->value();
}
InterfacePage::InterfacePage(QWidget *parent)
: ConfigPage(parent)
{
m_pageTitle = tr("Interface");
QGroupBox *boardGroup = new QGroupBox(tr("Board"));
m_verboseLabelsCheck = new QCheckBox(tr("Show &bonus square labels"));
m_scoreLabelsCheck = new QCheckBox(tr("Show &letter score labels"));
QLabel *britishColoringLabel = new QLabel(tr("British coloring:"));
m_britishColoringCombo = new QComboBox;
QStringList britishColorings;
britishColorings << tr("None") << tr("Text") << tr("Tile");
m_britishColoringCombo->addItems(britishColorings);
QGridLayout *checkersLayout = new QGridLayout;
checkersLayout->addWidget(britishColoringLabel, 0, 0);
checkersLayout->addWidget(m_britishColoringCombo, 0, 1);
checkersLayout->addWidget(m_verboseLabelsCheck, 1, 0, 1, 2);
checkersLayout->addWidget(m_scoreLabelsCheck, 2, 0, 1, 2);
boardGroup->setLayout(checkersLayout);
QGroupBox *miscellanyGroup = new QGroupBox(tr("Miscellany"));
m_vowelFirstCheck = new QCheckBox(tr("&Vowel-first alphabetizing"));
m_octothorpCheck = new QCheckBox(tr("&Octothorp British words"));
QGridLayout *miscellanyLayout = new QGridLayout;
miscellanyLayout->addWidget(m_vowelFirstCheck, 0, 0);
miscellanyLayout->addWidget(m_octothorpCheck, 1, 0);
miscellanyGroup->setLayout(miscellanyLayout);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(boardGroup);
mainLayout->addWidget(miscellanyGroup);
mainLayout->addStretch(1);
setLayout(mainLayout);
}
void InterfacePage::readConfig()
{
m_britishColoringCombo->setCurrentIndex(QuackerSettings::self()->britishColoring);
m_vowelFirstCheck->setChecked(QuackleIO::UtilSettings::self()->vowelFirst);
m_verboseLabelsCheck->setChecked(QuackerSettings::self()->verboseLabels);
m_scoreLabelsCheck->setChecked(QuackerSettings::self()->scoreLabels);
m_octothorpCheck->setChecked(QuackleIO::UtilSettings::self()->octothorpBritish);
}
void InterfacePage::writeConfig()
{
QuackerSettings::self()->britishColoring = m_britishColoringCombo->currentIndex();
QuackleIO::UtilSettings::self()->vowelFirst = m_vowelFirstCheck->isChecked();
QuackerSettings::self()->verboseLabels = m_verboseLabelsCheck->isChecked();
QuackerSettings::self()->scoreLabels = m_scoreLabelsCheck->isChecked();
QuackleIO::UtilSettings::self()->octothorpBritish = m_octothorpCheck->isChecked();
}
|