OSDN Git Service

- Added the ability to do special refreshes for debugging. - Added the ability to...
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / dialog / ConfigDebugPage.java
index b97a758..e2bfc67 100644 (file)
  *\r
 */\r
 \r
+\r
+//**********************************************\r
+//**********************************************\r
+//* This dialog is the debugging information \r
+//* page used in the Edit/Preferences dialog\r
+//**********************************************\r
+//**********************************************\r
+\r
 package cx.fbn.nevernote.dialog;\r
 \r
 import com.trolltech.qt.gui.QCheckBox;\r
@@ -24,17 +32,23 @@ import com.trolltech.qt.gui.QComboBox;
 import com.trolltech.qt.gui.QGroupBox;\r
 import com.trolltech.qt.gui.QHBoxLayout;\r
 import com.trolltech.qt.gui.QLabel;\r
+import com.trolltech.qt.gui.QSpinBox;\r
 import com.trolltech.qt.gui.QTextBrowser;\r
 import com.trolltech.qt.gui.QVBoxLayout;\r
 import com.trolltech.qt.gui.QWidget;\r
 \r
+import cx.fbn.nevernote.Global;\r
+\r
 public class ConfigDebugPage extends QWidget {\r
        \r
        QComboBox messageCombo;\r
        QComboBox serverCombo;\r
        QCheckBox disableUploads;\r
        QCheckBox carriageReturnFix;\r
+       QCheckBox htmlEntitiesFix;\r
        QCheckBox enableThumbnails;\r
+       QSpinBox  databaseCache;\r
+       QCheckBox reloadSharedNotebooks;\r
        \r
        public ConfigDebugPage(QWidget parent) {\r
                super(parent);\r
@@ -53,7 +67,6 @@ public class ConfigDebugPage extends QWidget {
                serverLayout.addWidget(disableUploads);\r
                serverGroup.setLayout(serverLayout);\r
 \r
-               QGroupBox messageGroup = new QGroupBox(tr("Debug Messages"));\r
                QLabel messageLevelLabel = new QLabel(tr("Message Level"));\r
                messageCombo = new QComboBox();\r
                messageCombo.addItem(tr("Low"),"Low");\r
@@ -65,20 +78,29 @@ public class ConfigDebugPage extends QWidget {
                messageLayout.addWidget(messageLevelLabel);\r
                messageLayout.addWidget(messageCombo);\r
                messageLayout.setStretch(1, 100);\r
-               messageGroup.setLayout(messageLayout);\r
+               \r
+               \r
+               QHBoxLayout databaseCacheLayout = new QHBoxLayout();\r
+               databaseCache = new QSpinBox();\r
+               databaseCacheLayout.addWidget(new QLabel(tr("Database Cache (MB) - Requires restart")));\r
+               databaseCache.setMinimum(4);\r
+               databaseCache.setMaximum(128);\r
+               databaseCache.setValue(new Integer(Global.databaseCache)/1024);\r
+               databaseCacheLayout.addWidget(databaseCache);\r
+               databaseCacheLayout.setStretch(1, 100);\r
                \r
                QVBoxLayout mainLayout = new QVBoxLayout();\r
-               mainLayout.addWidget(serverGroup);\r
-               mainLayout.addWidget(messageGroup);\r
+               mainLayout.addLayout(messageLayout);\r
+               mainLayout.addLayout(databaseCacheLayout);\r
                \r
-               QGroupBox thumbnailGroup = new QGroupBox(tr("Thumbnails"));\r
                QHBoxLayout thumbnailLayout = new QHBoxLayout();\r
                QLabel thumbnailLabel = new QLabel(tr("Enable Thumbnails (experimental)"));\r
                thumbnailLayout.addWidget(thumbnailLabel);\r
                enableThumbnails = new QCheckBox(this);\r
                thumbnailLayout.addWidget(enableThumbnails);\r
-               thumbnailGroup.setLayout(thumbnailLayout);\r
-               mainLayout.addWidget(thumbnailGroup);\r
+               mainLayout.addLayout(thumbnailLayout);\r
+               \r
+               mainLayout.addWidget(serverGroup);\r
                \r
                QGroupBox crlfGroup = new QGroupBox(tr("Carriage Return Fix"));\r
                String crlfMessage = new String(tr("Note: The carriage return is a test fix.  If you " +\r
@@ -89,18 +111,37 @@ public class ConfigDebugPage extends QWidget {
                "you edit a note, this fix is PERMANENT and will be sent to Evernote on the next sync.  I haven't" +\r
                "had any issues with this, but please be aware of this condition."));\r
                carriageReturnFix = new QCheckBox(this);\r
-               QHBoxLayout crlfLayout = new QHBoxLayout();\r
-               QLabel carriageReturnLabel = new QLabel(tr("Enable Carriage Return Fix"));\r
-               crlfLayout.addWidget(carriageReturnLabel);\r
+               QVBoxLayout crlfLayout = new QVBoxLayout();\r
+               carriageReturnFix.setText(tr("Enable Carriage Return Fix"));\r
                crlfLayout.addWidget(carriageReturnFix);\r
                crlfGroup.setLayout(crlfLayout);\r
 \r
+               QGroupBox htmlGroup = new QGroupBox(tr("Android Note Fix"));\r
+               String entitiesMessage = new String(tr("Note: This is an experimental fix to correct Unicode" +\r
+                               " notes created on Android Evernote clients."));\r
+               htmlEntitiesFix = new QCheckBox(this);\r
+               QVBoxLayout htmlLayout = new QVBoxLayout();\r
+               htmlEntitiesFix.setText(tr("Enable Android Fix"));\r
+               htmlLayout.addWidget(htmlEntitiesFix);\r
+               htmlGroup.setLayout(htmlLayout);\r
+               \r
+               reloadSharedNotebooks = new QCheckBox(tr("Shared Notebooks"));\r
+               QGroupBox refresh = new QGroupBox(tr("Special Refresh (WARNING - This can cause unsynchronized data loss)."));\r
+               QVBoxLayout refreshLayout = new QVBoxLayout();\r
+               refreshLayout.addWidget(reloadSharedNotebooks);\r
+               refresh.setLayout(refreshLayout);\r
+               \r
+               \r
                QTextBrowser msg = new QTextBrowser(this);\r
+               QTextBrowser htmlMsg = new QTextBrowser(this);\r
                msg.setText(crlfMessage);\r
+               htmlMsg.setText(entitiesMessage);\r
+               crlfLayout.addWidget(msg);\r
                mainLayout.addWidget(crlfGroup);\r
+               htmlLayout.addWidget(htmlMsg);\r
+               mainLayout.addWidget(htmlGroup);\r
+               mainLayout.addWidget(refresh);\r
 \r
-               mainLayout.addWidget(msg);\r
-               \r
                mainLayout.addStretch(1);\r
                setLayout(mainLayout);\r
                \r
@@ -119,6 +160,17 @@ public class ConfigDebugPage extends QWidget {
                int i = messageCombo.currentIndex();\r
                return messageCombo.itemData(i).toString();\r
        }\r
+\r
+\r
+       //******************************************\r
+       //* Experimental fixes\r
+       //******************************************\r
+       public void setHtmlEntitiesFix(boolean val) {\r
+               htmlEntitiesFix.setChecked(val);\r
+       }\r
+       public boolean getHtmlEntitiesFix() {\r
+               return htmlEntitiesFix.isChecked();\r
+       }\r
        public void setCarriageReturnFix(boolean val) {\r
                carriageReturnFix.setChecked(val);\r
        }\r
@@ -166,5 +218,17 @@ public class ConfigDebugPage extends QWidget {
                return enableThumbnails.isChecked();\r
        }\r
 \r
+       \r
+       public String getDatabaseCacheSize() {\r
+               return new Integer(databaseCache.value()*1024).toString();\r
+       }\r
+\r
+       \r
+       //***************************************\r
+       //* Special refreshes\r
+       //***************************************\r
+       public boolean reloadSharedNotebooksClicked() {\r
+               return reloadSharedNotebooks.isChecked();\r
+       }\r
 \r
 }\r