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 cffa7a6..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,26 +32,34 @@ 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
                // Server settings\r
                QGroupBox serverGroup =  new QGroupBox(tr("Server Configuration"));\r
                QLabel serverLabel = new QLabel(tr("Server"));\r
                serverCombo = new QComboBox();\r
-               serverCombo.addItem(tr("www.evernote.com"));\r
-               serverCombo.addItem(tr("sandbox.evernote.com"));\r
+               serverCombo.addItem("www.evernote.com");\r
+               serverCombo.addItem("sandbox.evernote.com");\r
                disableUploads = new QCheckBox();\r
-               disableUploads.setText("Disable uploads to server");\r
+               disableUploads.setText(tr("Disable uploads to server"));\r
 \r
                QHBoxLayout serverLayout = new QHBoxLayout();\r
                serverLayout.addWidget(serverLabel);\r
@@ -51,23 +67,40 @@ 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"));\r
-               messageCombo.addItem(tr("Medium"));\r
-               messageCombo.addItem(tr("High"));\r
-               messageCombo.addItem(tr("Extreme"));\r
+               messageCombo.addItem(tr("Low"),"Low");\r
+               messageCombo.addItem(tr("Medium"),"Medium");\r
+               messageCombo.addItem(tr("High"),"High");\r
+               messageCombo.addItem(tr("Extreme"),"Extreme");\r
                \r
                QHBoxLayout messageLayout = new QHBoxLayout();\r
                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.addLayout(messageLayout);\r
+               mainLayout.addLayout(databaseCacheLayout);\r
+               \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
+               mainLayout.addLayout(thumbnailLayout);\r
+               \r
                mainLayout.addWidget(serverGroup);\r
-               mainLayout.addWidget(messageGroup);\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
@@ -78,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("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
@@ -100,13 +152,24 @@ public class ConfigDebugPage extends QWidget {
        //* Message set/get\r
        //******************************************\r
        public void setDebugLevel(String level) {\r
-               int i = messageCombo.findText(level);\r
+               int i = messageCombo.findData(level);\r
                if (i>0)\r
                        messageCombo.setCurrentIndex(i);\r
        }\r
        public String getDebugLevel() {\r
                int i = messageCombo.currentIndex();\r
-               return messageCombo.itemText(i);\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
@@ -144,7 +207,28 @@ public class ConfigDebugPage extends QWidget {
                return disableUploads.isChecked();\r
        }\r
        \r
+       //****************************************\r
+       //* Thumbnails\r
+       //****************************************\r
+       public void setEnableThumbnails(boolean val) {\r
+               enableThumbnails.setChecked(val);\r
+       }\r
+       \r
+       public boolean getEnableThumbnails() {\r
+               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
-}
\ No newline at end of file
+}\r