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
|
/*
* Sudoku: A plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id: setup.cpp 11 2005-10-28 01:00:01Z tom $
*/
#include "setup.h"
#include "i18n.h"
#include <strings.h>
using namespace SudokuPlugin;
//--- class SudokuPlugin::SetupData --------------------------------------------
/** Constructor
*
* Initialize the parameters of the plugin with standard values.
*/
SetupData::SetupData()
{
givens_count = 36;
symmetric = 1;
mark_errors = 1;
mark_ambiguous = 1;
transparency = 50;
}
/** Parse the parameters of the plugin.
*
* This method is called for each parameter the plugin has previously
* stored in the global setup data.
*/
bool SetupData::parse(const char* name, const char* value)
{
if (!strcasecmp(name, "GivensCount"))
givens_count = atoi(value);
else if (!strcasecmp(name, "Symmetric"))
symmetric = atoi(value);
else if (!strcasecmp(name, "MarkErrors"))
mark_errors = atoi(value);
else if (!strcasecmp(name, "MarkAmbiguous"))
mark_ambiguous = atoi(value);
else if (!strcasecmp(name, "Transparency"))
transparency = atoi(value);
else
return false;
return true;
}
//--- class SudokuPlugin::SetupPage --------------------------------------------
/** Constructor */
SetupPage::SetupPage(SetupData& setup) :
setup(setup), data(setup)
{
Add(new cMenuEditIntItem(tr("Givens count"), &data.givens_count, 26, 81));
Add(new cMenuEditBoolItem(tr("Symmetric givens"), &data.symmetric));
Add(new cMenuEditBoolItem(tr("Mark errors"), &data.mark_errors));
Add(new cMenuEditBoolItem(tr("Mark ambiguous numbers"),
&data.mark_ambiguous));
Add(new cMenuEditIntItem(tr("Transparency (%)"), &data.transparency, 0, 100));
}
/** Store the parameters of the plugin.
*
* The parameters of the plugin are stored into the global setup data file.
*/
void SetupPage::Store()
{
setup = data;
SetupStore("GivensCount", setup.givens_count);
SetupStore("Symmetric", setup.symmetric);
SetupStore("MarkErrors", setup.mark_errors);
SetupStore("MarkAmbiguous", setup.mark_ambiguous);
SetupStore("Transparency", setup.transparency);
}
|