OSDN Git Service

Correct LaTeX images. Upgrade to 0.99
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / dialog / ConfigIndexPage.java
index 6b73c20..e3da0b1 100644 (file)
@@ -19,6 +19,7 @@
 \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
@@ -31,57 +32,49 @@ import cx.fbn.nevernote.Global;
 \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 QSpinBox sleepSpinner;\r
+       private final QCheckBox indexAttachmentsLocally;\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
+               // Local attachment indexing\r
+               QGroupBox attachmentGroup = new QGroupBox(tr("Attachments"));\r
+               indexAttachmentsLocally = new QCheckBox(tr("Index Attachments Locally"));\r
+               indexAttachmentsLocally.setChecked(Global.indexAttachmentsLocally());\r
+               \r
+               QHBoxLayout attachmentLayout = new QHBoxLayout();\r
+               attachmentLayout.addWidget(indexAttachmentsLocally);\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 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
@@ -95,9 +88,9 @@ public class ConfigIndexPage extends QWidget {
                \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(attachmentGroup);\r
                mainLayout.addWidget(regexGroup);\r
                mainLayout.addStretch(1);\r
                setLayout(mainLayout);\r
@@ -105,16 +98,25 @@ public class ConfigIndexPage extends QWidget {
 \r
        }\r
        \r
+       \r
+       //*****************************************\r
+       //* Get for flag to index attachments \r
+       //*****************************************\r
+       public boolean getIndexAttachmentsLocally() {\r
+               return indexAttachmentsLocally.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
@@ -126,16 +128,6 @@ public class ConfigIndexPage extends QWidget {
                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