OSDN Git Service

Add Linked notebooks to the ignore sync process.
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / dialog / ConfigIndexPage.java
1 /*\r
2  * This file is part of NeverNote \r
3  * Copyright 2009 Randy Baumgarte\r
4  * \r
5  * This file may be licensed under the terms of of the\r
6  * GNU General Public License Version 2 (the ``GPL'').\r
7  *\r
8  * Software distributed under the License is distributed\r
9  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either\r
10  * express or implied. See the GPL for the specific language\r
11  * governing rights and limitations.\r
12  *\r
13  * You should have received a copy of the GPL along with this\r
14  * program. If not, go to http://www.gnu.org/licenses/gpl.html\r
15  * or write to the Free Software Foundation, Inc.,\r
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
17  *\r
18 */\r
19 \r
20 package cx.fbn.nevernote.dialog;\r
21 \r
22 import com.trolltech.qt.gui.QCheckBox;\r
23 import com.trolltech.qt.gui.QGroupBox;\r
24 import com.trolltech.qt.gui.QHBoxLayout;\r
25 import com.trolltech.qt.gui.QLabel;\r
26 import com.trolltech.qt.gui.QLineEdit;\r
27 import com.trolltech.qt.gui.QSpinBox;\r
28 import com.trolltech.qt.gui.QVBoxLayout;\r
29 import com.trolltech.qt.gui.QWidget;\r
30 \r
31 import cx.fbn.nevernote.Global;\r
32 \r
33 public class ConfigIndexPage extends QWidget {\r
34 \r
35         private final QSpinBox weightSpinner;\r
36         private final QSpinBox sleepSpinner;\r
37         private final QCheckBox indexAttachmentsLocally;\r
38         private final QLineEdit regexEdit;\r
39         \r
40         public ConfigIndexPage(QWidget parent) {\r
41 //              super(parent);\r
42                                                         \r
43                 // Recognition weight\r
44                 QGroupBox weightGroup = new QGroupBox(tr("Recognition"));\r
45                 QLabel weightLabel = new QLabel(tr("Minimum Recognition Weight"));\r
46                 weightSpinner = new QSpinBox();\r
47                 weightSpinner.setRange(1,100);\r
48                 weightSpinner.setSingleStep(1);\r
49                 weightSpinner.setValue(Global.getRecognitionWeight());\r
50                 \r
51                 QHBoxLayout weightLayout = new QHBoxLayout();\r
52                 weightLayout.addWidget(weightLabel);\r
53                 weightLayout.addWidget(weightSpinner);\r
54                 weightGroup.setLayout(weightLayout);\r
55                 \r
56                 // Local attachment indexing\r
57                 QGroupBox attachmentGroup = new QGroupBox(tr("Attachments"));\r
58                 indexAttachmentsLocally = new QCheckBox(tr("Index Attachments Locally"));\r
59                 indexAttachmentsLocally.setChecked(Global.indexAttachmentsLocally());\r
60                 \r
61                 QHBoxLayout attachmentLayout = new QHBoxLayout();\r
62                 attachmentLayout.addWidget(indexAttachmentsLocally);\r
63                 attachmentGroup.setLayout(attachmentLayout);\r
64 \r
65                 // Index sleep interval\r
66                 QGroupBox sleepGroup = new QGroupBox(tr("Index Interval"));\r
67                 QLabel sleepLabel = new QLabel(tr("Seconds between looking for unindexed notes"));\r
68                 sleepSpinner = new QSpinBox();\r
69                 sleepSpinner.setRange(30,600);\r
70                 sleepSpinner.setSingleStep(1);\r
71                 sleepSpinner.setValue(Global.getIndexThreadSleepInterval());\r
72 \r
73                 QHBoxLayout sleepLayout = new QHBoxLayout();\r
74                 sleepLayout.addWidget(sleepLabel);\r
75                 sleepLayout.addWidget(sleepSpinner);\r
76                 sleepGroup.setLayout(sleepLayout);\r
77                 \r
78                 // Regular Expressions for word parsing\r
79                 QGroupBox regexGroup = new QGroupBox(tr("Word Parse"));\r
80                 QLabel regexLabel = new QLabel(tr("Regular Expression"));\r
81                 regexEdit = new QLineEdit();\r
82                 regexEdit.setText(Global.getWordRegex());\r
83 \r
84                 QHBoxLayout regexLayout = new QHBoxLayout();\r
85                 regexLayout.addWidget(regexLabel);\r
86                 regexLayout.addWidget(regexEdit);               \r
87                 regexGroup.setLayout(regexLayout);\r
88                 \r
89                 \r
90                 QVBoxLayout mainLayout = new QVBoxLayout();\r
91                 mainLayout.addWidget(sleepGroup);\r
92                 mainLayout.addWidget(weightGroup);\r
93                 mainLayout.addWidget(attachmentGroup);\r
94                 mainLayout.addWidget(regexGroup);\r
95                 mainLayout.addStretch(1);\r
96                 setLayout(mainLayout);\r
97 \r
98 \r
99         }\r
100         \r
101         \r
102         //*****************************************\r
103         //* Get for flag to index attachments \r
104         //*****************************************\r
105         public boolean getIndexAttachmentsLocally() {\r
106                 return indexAttachmentsLocally.isChecked();\r
107         }\r
108         \r
109         //*****************************************\r
110         //* Word length get/set methods \r
111         //*****************************************\r
112         public void setSleepInterval(int len) {\r
113                 sleepSpinner.setValue(len);\r
114         }\r
115         public int getSleepInterval() {\r
116                 return sleepSpinner.value();\r
117         }\r
118 \r
119 \r
120         \r
121         //*****************************************\r
122         //* Recognition Weight \r
123         //*****************************************\r
124         public void setRecognitionWeight(int len) {\r
125                 weightSpinner.setValue(len);\r
126         }\r
127         public int getRecognitionWeight() {\r
128                 return weightSpinner.value();\r
129         }\r
130         \r
131         \r
132         \r
133         //*****************************************\r
134         //* Regex get/set methods \r
135         //*****************************************\r
136         public void setRegex(String s) {\r
137                 regexEdit.setText(s);\r
138         }\r
139         public String getRegex() {\r
140                 return regexEdit.text();\r
141         }\r
142 \r
143 }\r