X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=src%2Fcx%2Ffbn%2Fnevernote%2Fdialog%2FConfigIndexPage.java;h=e3da0b16cae4ad17e4ba1ba4ee75a7b6c05a2a17;hb=77166e472972f3ed2bb0f33175ef5d8dc5d4d70d;hp=6b73c2031fac693f86bdcc2db176b45e99c80da8;hpb=cae3ef89a498825e0613ee48509b0a669ba42f9a;p=neighbornote%2FNeighborNote.git diff --git a/src/cx/fbn/nevernote/dialog/ConfigIndexPage.java b/src/cx/fbn/nevernote/dialog/ConfigIndexPage.java index 6b73c20..e3da0b1 100644 --- a/src/cx/fbn/nevernote/dialog/ConfigIndexPage.java +++ b/src/cx/fbn/nevernote/dialog/ConfigIndexPage.java @@ -19,6 +19,7 @@ package cx.fbn.nevernote.dialog; +import com.trolltech.qt.gui.QCheckBox; import com.trolltech.qt.gui.QGroupBox; import com.trolltech.qt.gui.QHBoxLayout; import com.trolltech.qt.gui.QLabel; @@ -31,57 +32,49 @@ import cx.fbn.nevernote.Global; public class ConfigIndexPage extends QWidget { - private final QSpinBox indexThreadSpinner; - private final QSpinBox lengthSpinner; private final QSpinBox weightSpinner; + private final QSpinBox sleepSpinner; + private final QCheckBox indexAttachmentsLocally; private final QLineEdit regexEdit; public ConfigIndexPage(QWidget parent) { // super(parent); - - indexThreadSpinner = new QSpinBox(this); - indexThreadSpinner.setMaximum(5); - indexThreadSpinner.setMinimum(1); - - // Index threads layout - QLabel threadLabel = new QLabel(tr("Maximum Threads")); - QHBoxLayout threadsLayout = new QHBoxLayout(); - threadsLayout.addWidget(threadLabel); - threadsLayout.addWidget(indexThreadSpinner); - QGroupBox threadsGroup = new QGroupBox(tr("Indexing Threads (Requires Restart)")); - threadsGroup.setLayout(threadsLayout); - - threadsGroup.setVisible(false); - - - // Minimum word length - QGroupBox wordLengthGroup = new QGroupBox(tr("Word Length")); - QLabel wordLengthLabel = new QLabel(tr("Minimum Word Length")); - lengthSpinner = new QSpinBox(); - lengthSpinner.setRange(1,10); - lengthSpinner.setSingleStep(1); - lengthSpinner.setValue(Global.minimumWordCount); - - QHBoxLayout wordLengthLayout = new QHBoxLayout(); - wordLengthLayout.addWidget(wordLengthLabel); - wordLengthLayout.addWidget(lengthSpinner); - wordLengthGroup.setLayout(wordLengthLayout); - - - // Minimum word length + + // Recognition weight QGroupBox weightGroup = new QGroupBox(tr("Recognition")); QLabel weightLabel = new QLabel(tr("Minimum Recognition Weight")); weightSpinner = new QSpinBox(); weightSpinner.setRange(1,100); weightSpinner.setSingleStep(1); weightSpinner.setValue(Global.getRecognitionWeight()); - + QHBoxLayout weightLayout = new QHBoxLayout(); weightLayout.addWidget(weightLabel); weightLayout.addWidget(weightSpinner); weightGroup.setLayout(weightLayout); - + // Local attachment indexing + QGroupBox attachmentGroup = new QGroupBox(tr("Attachments")); + indexAttachmentsLocally = new QCheckBox(tr("Index Attachments Locally")); + indexAttachmentsLocally.setChecked(Global.indexAttachmentsLocally()); + + QHBoxLayout attachmentLayout = new QHBoxLayout(); + attachmentLayout.addWidget(indexAttachmentsLocally); + attachmentGroup.setLayout(attachmentLayout); + + // Index sleep interval + QGroupBox sleepGroup = new QGroupBox(tr("Index Interval")); + QLabel sleepLabel = new QLabel(tr("Seconds between looking for unindexed notes")); + sleepSpinner = new QSpinBox(); + sleepSpinner.setRange(30,600); + sleepSpinner.setSingleStep(1); + sleepSpinner.setValue(Global.getIndexThreadSleepInterval()); + + QHBoxLayout sleepLayout = new QHBoxLayout(); + sleepLayout.addWidget(sleepLabel); + sleepLayout.addWidget(sleepSpinner); + sleepGroup.setLayout(sleepLayout); + // Regular Expressions for word parsing QGroupBox regexGroup = new QGroupBox(tr("Word Parse")); QLabel regexLabel = new QLabel(tr("Regular Expression")); @@ -95,9 +88,9 @@ public class ConfigIndexPage extends QWidget { QVBoxLayout mainLayout = new QVBoxLayout(); - mainLayout.addWidget(threadsGroup); - mainLayout.addWidget(wordLengthGroup); + mainLayout.addWidget(sleepGroup); mainLayout.addWidget(weightGroup); + mainLayout.addWidget(attachmentGroup); mainLayout.addWidget(regexGroup); mainLayout.addStretch(1); setLayout(mainLayout); @@ -105,16 +98,25 @@ public class ConfigIndexPage extends QWidget { } + + //***************************************** + //* Get for flag to index attachments + //***************************************** + public boolean getIndexAttachmentsLocally() { + return indexAttachmentsLocally.isChecked(); + } + //***************************************** //* Word length get/set methods //***************************************** - public void setWordLength(int len) { - lengthSpinner.setValue(len); + public void setSleepInterval(int len) { + sleepSpinner.setValue(len); } - public int getWordLength() { - return lengthSpinner.value(); + public int getSleepInterval() { + return sleepSpinner.value(); } + //***************************************** //* Recognition Weight @@ -126,16 +128,6 @@ public class ConfigIndexPage extends QWidget { return weightSpinner.value(); } - //***************************************** - //* Index Threads get/set methods - //***************************************** - public void setIndexThreads(int value) { - indexThreadSpinner.setValue(value); - } - public int getIndexThreads() { - return indexThreadSpinner.value(); - } - //*****************************************