/*\r
- * This file is part of NeverNote \r
+ * This file is part of NixNote/NeighborNote \r
* Copyright 2009 Randy Baumgarte\r
* \r
* This file may be licensed under the terms of of the\r
*\r
*/\r
\r
+\r
+//**********************************************\r
+//**********************************************\r
+//* Index settings in Edit/Preferences\r
+//**********************************************\r
+//**********************************************\r
+\r
package cx.fbn.nevernote.dialog;\r
\r
+import com.trolltech.qt.gui.QCheckBox;\r
import com.trolltech.qt.gui.QGroupBox;\r
import com.trolltech.qt.gui.QHBoxLayout;\r
import com.trolltech.qt.gui.QLabel;\r
\r
public class ConfigIndexPage extends QWidget {\r
\r
- private final QSpinBox indexThreadSpinner;\r
- private final QSpinBox lengthSpinner;\r
private final QSpinBox weightSpinner;\r
- private final QLineEdit regexEdit;\r
+ private final QSpinBox sleepSpinner;\r
+ private final QCheckBox indexAttachmentsLocally;\r
+ private final QCheckBox indexImageRecognition;\r
+ private final QCheckBox indexTitle;\r
+// private final QCheckBox automaticWildcard;\r
+// private final QLineEdit specialStrip;\r
+ private final QCheckBox indexBody;\r
+// private final QLineEdit regexEdit;\r
\r
public ConfigIndexPage(QWidget parent) {\r
// super(parent);\r
- \r
- indexThreadSpinner = new QSpinBox(this);\r
- indexThreadSpinner.setMaximum(5);\r
- indexThreadSpinner.setMinimum(1);\r
- \r
- // Index threads layout\r
- QLabel threadLabel = new QLabel(tr("Maximum Threads"));\r
- QHBoxLayout threadsLayout = new QHBoxLayout();\r
- threadsLayout.addWidget(threadLabel);\r
- threadsLayout.addWidget(indexThreadSpinner);\r
- QGroupBox threadsGroup = new QGroupBox(tr("Indexing Threads (Requires Restart)"));\r
- threadsGroup.setLayout(threadsLayout);\r
- \r
- threadsGroup.setVisible(false);\r
- \r
- \r
- // Minimum word length\r
- QGroupBox wordLengthGroup = new QGroupBox(tr("Word Length"));\r
- QLabel wordLengthLabel = new QLabel(tr("Minimum Word Length"));\r
- lengthSpinner = new QSpinBox();\r
- lengthSpinner.setRange(1,10);\r
- lengthSpinner.setSingleStep(1);\r
- lengthSpinner.setValue(Global.minimumWordCount);\r
- \r
- QHBoxLayout wordLengthLayout = new QHBoxLayout();\r
- wordLengthLayout.addWidget(wordLengthLabel);\r
- wordLengthLayout.addWidget(lengthSpinner);\r
- wordLengthGroup.setLayout(wordLengthLayout);\r
- \r
-\r
- // Minimum word length\r
+ \r
+ // Recognition weight\r
QGroupBox weightGroup = new QGroupBox(tr("Recognition"));\r
QLabel weightLabel = new QLabel(tr("Minimum Recognition Weight"));\r
weightSpinner = new QSpinBox();\r
weightSpinner.setRange(1,100);\r
weightSpinner.setSingleStep(1);\r
weightSpinner.setValue(Global.getRecognitionWeight());\r
-\r
+ \r
QHBoxLayout weightLayout = new QHBoxLayout();\r
weightLayout.addWidget(weightLabel);\r
weightLayout.addWidget(weightSpinner);\r
weightGroup.setLayout(weightLayout);\r
\r
- \r
- // Regular Expressions for word parsing\r
- QGroupBox regexGroup = new QGroupBox(tr("Word Parse"));\r
- QLabel regexLabel = new QLabel(tr("Regular Expression"));\r
- regexEdit = new QLineEdit();\r
- regexEdit.setText(Global.getWordRegex());\r
+ // Local attachment indexing\r
+ QGroupBox attachmentGroup = new QGroupBox(tr("Content"));\r
+ indexBody = new QCheckBox(tr("Index Note Body"));\r
+ indexBody.setChecked(Global.indexNoteBody());\r
+ indexTitle = new QCheckBox(tr("Index Note Title"));\r
+ indexTitle.setChecked(Global.indexNoteTitle());\r
+ indexAttachmentsLocally = new QCheckBox(tr("Index Attachments Locally"));\r
+ indexAttachmentsLocally.setChecked(Global.indexAttachmentsLocally());\r
+ indexImageRecognition = new QCheckBox(tr("Index Image Recognition"));\r
+ indexImageRecognition.setChecked(Global.indexImageRecognition());\r
+ \r
+// automaticWildcard = new QCheckBox(tr("Automatically Wildcard All Searches"));\r
+// automaticWildcard.setChecked(Global.automaticWildcardSearches());\r
+ \r
+// specialStrip = new QLineEdit();\r
+// specialStrip.setText(Global.getSpecialIndexCharacters());\r
+ \r
+ QVBoxLayout attachmentLayout = new QVBoxLayout();\r
+ attachmentLayout.addWidget(indexBody);\r
+ attachmentLayout.addWidget(indexTitle);\r
+ attachmentLayout.addWidget(indexAttachmentsLocally);\r
+ attachmentLayout.addWidget(indexImageRecognition);\r
+// attachmentLayout.addWidget(automaticWildcard);\r
+ \r
+// QHBoxLayout specialCharLayout = new QHBoxLayout();\r
+// specialCharLayout.addWidget(new QLabel(tr("Special Word Characters")));\r
+// specialCharLayout.addWidget(specialStrip);\r
+// attachmentLayout.addLayout(specialCharLayout);\r
+ attachmentGroup.setLayout(attachmentLayout);\r
+\r
+ // Index sleep interval\r
+ QGroupBox sleepGroup = new QGroupBox(tr("Index Interval"));\r
+ QLabel sleepLabel = new QLabel(tr("Seconds between looking for unindexed notes"));\r
+ sleepSpinner = new QSpinBox();\r
+ sleepSpinner.setRange(30,600);\r
+ sleepSpinner.setSingleStep(1);\r
+ sleepSpinner.setValue(Global.getIndexThreadSleepInterval());\r
\r
- QHBoxLayout regexLayout = new QHBoxLayout();\r
- regexLayout.addWidget(regexLabel);\r
- regexLayout.addWidget(regexEdit); \r
- regexGroup.setLayout(regexLayout);\r
+ QHBoxLayout sleepLayout = new QHBoxLayout();\r
+ sleepLayout.addWidget(sleepLabel);\r
+ sleepLayout.addWidget(sleepSpinner);\r
+ sleepGroup.setLayout(sleepLayout);\r
+ \r
+ // Regular Expressions for word parsing\r
+// QGroupBox regexGroup = new QGroupBox(tr("Word Parse"));\r
+// QLabel regexLabel = new QLabel(tr("Regular Expression"));\r
+// regexEdit = new QLineEdit();\r
+// regexEdit.setText(Global.getWordRegex());\r
+//\r
+// QHBoxLayout regexLayout = new QHBoxLayout();\r
+// regexLayout.addWidget(regexLabel);\r
+// regexLayout.addWidget(regexEdit); \r
+// regexGroup.setLayout(regexLayout);\r
\r
\r
QVBoxLayout mainLayout = new QVBoxLayout();\r
- mainLayout.addWidget(threadsGroup);\r
- mainLayout.addWidget(wordLengthGroup);\r
+ mainLayout.addWidget(sleepGroup);\r
mainLayout.addWidget(weightGroup);\r
- mainLayout.addWidget(regexGroup);\r
+ mainLayout.addWidget(attachmentGroup);\r
+// mainLayout.addWidget(regexGroup);\r
mainLayout.addStretch(1);\r
setLayout(mainLayout);\r
\r
\r
}\r
\r
+ \r
+ //*****************************************\r
+ //* Get for flag to index attachments \r
+ //*****************************************\r
+ public boolean getIndexAttachmentsLocally() {\r
+ return indexAttachmentsLocally.isChecked();\r
+ }\r
+ public boolean getIndexNoteBody() {\r
+ return indexBody.isChecked();\r
+ }\r
+ public boolean getIndexNoteTitle() {\r
+ return indexTitle.isChecked();\r
+ }\r
+// public String getSpecialCharacters() {\r
+// return specialStrip.text();\r
+// }\r
+ public boolean getIndexImageRecognition() {\r
+ return indexImageRecognition.isChecked();\r
+ }\r
+// public boolean getAutomaticWildcardSearches() {\r
+// return automaticWildcard.isChecked();\r
+// }\r
+ \r
//*****************************************\r
//* Word length get/set methods \r
//*****************************************\r
- public void setWordLength(int len) {\r
- lengthSpinner.setValue(len);\r
+ public void setSleepInterval(int len) {\r
+ sleepSpinner.setValue(len);\r
}\r
- public int getWordLength() {\r
- return lengthSpinner.value();\r
+ public int getSleepInterval() {\r
+ return sleepSpinner.value();\r
}\r
\r
+\r
\r
//*****************************************\r
//* Recognition Weight \r
return weightSpinner.value();\r
}\r
\r
- //*****************************************\r
- //* Index Threads get/set methods\r
- //*****************************************\r
- public void setIndexThreads(int value) {\r
- indexThreadSpinner.setValue(value);\r
- }\r
- public int getIndexThreads() {\r
- return indexThreadSpinner.value();\r
- }\r
-\r
\r
\r
//*****************************************\r
//* Regex get/set methods \r
//*****************************************\r
- public void setRegex(String s) {\r
- regexEdit.setText(s);\r
- }\r
- public String getRegex() {\r
- return regexEdit.text();\r
- }\r
+// public void setRegex(String s) {\r
+// regexEdit.setText(s);\r
+// }\r
+// public String getRegex() {\r
+// return regexEdit.text();\r
+// }\r
\r
}\r