X-Git-Url: http://git.sourceforge.jp/view?p=neighbornote%2FNeighborNote.git;a=blobdiff_plain;f=src%2Fcx%2Ffbn%2Fnevernote%2Fdialog%2FConfigDebugPage.java;h=e2bfc6776f79253c2824f8ccdcfda5d750dbc2a4;hp=3132f23ea4aab3a28d9bfe043850b400d43441ac;hb=1b45096a3370f812275406f48bbcb51edcdf809b;hpb=2be130acba6070e05d22380030b03e63f6c71607;ds=sidebyside diff --git a/src/cx/fbn/nevernote/dialog/ConfigDebugPage.java b/src/cx/fbn/nevernote/dialog/ConfigDebugPage.java index 3132f23..e2bfc67 100644 --- a/src/cx/fbn/nevernote/dialog/ConfigDebugPage.java +++ b/src/cx/fbn/nevernote/dialog/ConfigDebugPage.java @@ -17,6 +17,14 @@ * */ + +//********************************************** +//********************************************** +//* This dialog is the debugging information +//* page used in the Edit/Preferences dialog +//********************************************** +//********************************************** + package cx.fbn.nevernote.dialog; import com.trolltech.qt.gui.QCheckBox; @@ -24,16 +32,24 @@ import com.trolltech.qt.gui.QComboBox; import com.trolltech.qt.gui.QGroupBox; import com.trolltech.qt.gui.QHBoxLayout; import com.trolltech.qt.gui.QLabel; +import com.trolltech.qt.gui.QSpinBox; import com.trolltech.qt.gui.QTextBrowser; import com.trolltech.qt.gui.QVBoxLayout; import com.trolltech.qt.gui.QWidget; +import cx.fbn.nevernote.Global; + public class ConfigDebugPage extends QWidget { QComboBox messageCombo; QComboBox serverCombo; QCheckBox disableUploads; QCheckBox carriageReturnFix; + QCheckBox htmlEntitiesFix; + QCheckBox enableThumbnails; + QSpinBox databaseCache; + QCheckBox reloadSharedNotebooks; + public ConfigDebugPage(QWidget parent) { super(parent); // Server settings @@ -51,23 +67,40 @@ public class ConfigDebugPage extends QWidget { serverLayout.addWidget(disableUploads); serverGroup.setLayout(serverLayout); - QGroupBox messageGroup = new QGroupBox(tr("Debug Messages")); QLabel messageLevelLabel = new QLabel(tr("Message Level")); messageCombo = new QComboBox(); - messageCombo.addItem(tr("Low")); - messageCombo.addItem(tr("Medium")); - messageCombo.addItem(tr("High")); - messageCombo.addItem(tr("Extreme")); + messageCombo.addItem(tr("Low"),"Low"); + messageCombo.addItem(tr("Medium"),"Medium"); + messageCombo.addItem(tr("High"),"High"); + messageCombo.addItem(tr("Extreme"),"Extreme"); QHBoxLayout messageLayout = new QHBoxLayout(); messageLayout.addWidget(messageLevelLabel); messageLayout.addWidget(messageCombo); messageLayout.setStretch(1, 100); - messageGroup.setLayout(messageLayout); + + + QHBoxLayout databaseCacheLayout = new QHBoxLayout(); + databaseCache = new QSpinBox(); + databaseCacheLayout.addWidget(new QLabel(tr("Database Cache (MB) - Requires restart"))); + databaseCache.setMinimum(4); + databaseCache.setMaximum(128); + databaseCache.setValue(new Integer(Global.databaseCache)/1024); + databaseCacheLayout.addWidget(databaseCache); + databaseCacheLayout.setStretch(1, 100); QVBoxLayout mainLayout = new QVBoxLayout(); + mainLayout.addLayout(messageLayout); + mainLayout.addLayout(databaseCacheLayout); + + QHBoxLayout thumbnailLayout = new QHBoxLayout(); + QLabel thumbnailLabel = new QLabel(tr("Enable Thumbnails (experimental)")); + thumbnailLayout.addWidget(thumbnailLabel); + enableThumbnails = new QCheckBox(this); + thumbnailLayout.addWidget(enableThumbnails); + mainLayout.addLayout(thumbnailLayout); + mainLayout.addWidget(serverGroup); - mainLayout.addWidget(messageGroup); QGroupBox crlfGroup = new QGroupBox(tr("Carriage Return Fix")); String crlfMessage = new String(tr("Note: The carriage return is a test fix. If you " + @@ -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" + "had any issues with this, but please be aware of this condition.")); carriageReturnFix = new QCheckBox(this); - QHBoxLayout crlfLayout = new QHBoxLayout(); - QLabel carriageReturnLabel = new QLabel(tr("Enable Carriage Return Fix")); - crlfLayout.addWidget(carriageReturnLabel); + QVBoxLayout crlfLayout = new QVBoxLayout(); + carriageReturnFix.setText(tr("Enable Carriage Return Fix")); crlfLayout.addWidget(carriageReturnFix); crlfGroup.setLayout(crlfLayout); + QGroupBox htmlGroup = new QGroupBox(tr("Android Note Fix")); + String entitiesMessage = new String(tr("Note: This is an experimental fix to correct Unicode" + + " notes created on Android Evernote clients.")); + htmlEntitiesFix = new QCheckBox(this); + QVBoxLayout htmlLayout = new QVBoxLayout(); + htmlEntitiesFix.setText(tr("Enable Android Fix")); + htmlLayout.addWidget(htmlEntitiesFix); + htmlGroup.setLayout(htmlLayout); + + reloadSharedNotebooks = new QCheckBox(tr("Shared Notebooks")); + QGroupBox refresh = new QGroupBox(tr("Special Refresh (WARNING - This can cause unsynchronized data loss).")); + QVBoxLayout refreshLayout = new QVBoxLayout(); + refreshLayout.addWidget(reloadSharedNotebooks); + refresh.setLayout(refreshLayout); + + QTextBrowser msg = new QTextBrowser(this); + QTextBrowser htmlMsg = new QTextBrowser(this); msg.setText(crlfMessage); + htmlMsg.setText(entitiesMessage); + crlfLayout.addWidget(msg); mainLayout.addWidget(crlfGroup); + htmlLayout.addWidget(htmlMsg); + mainLayout.addWidget(htmlGroup); + mainLayout.addWidget(refresh); - mainLayout.addWidget(msg); - mainLayout.addStretch(1); setLayout(mainLayout); @@ -100,13 +152,24 @@ public class ConfigDebugPage extends QWidget { //* Message set/get //****************************************** public void setDebugLevel(String level) { - int i = messageCombo.findText(level); + int i = messageCombo.findData(level); if (i>0) messageCombo.setCurrentIndex(i); } public String getDebugLevel() { int i = messageCombo.currentIndex(); - return messageCombo.itemText(i); + return messageCombo.itemData(i).toString(); + } + + + //****************************************** + //* Experimental fixes + //****************************************** + public void setHtmlEntitiesFix(boolean val) { + htmlEntitiesFix.setChecked(val); + } + public boolean getHtmlEntitiesFix() { + return htmlEntitiesFix.isChecked(); } public void setCarriageReturnFix(boolean val) { carriageReturnFix.setChecked(val); @@ -144,7 +207,28 @@ public class ConfigDebugPage extends QWidget { return disableUploads.isChecked(); } + //**************************************** + //* Thumbnails + //**************************************** + public void setEnableThumbnails(boolean val) { + enableThumbnails.setChecked(val); + } + + public boolean getEnableThumbnails() { + return enableThumbnails.isChecked(); + } + + public String getDatabaseCacheSize() { + return new Integer(databaseCache.value()*1024).toString(); + } + + //*************************************** + //* Special refreshes + //*************************************** + public boolean reloadSharedNotebooksClicked() { + return reloadSharedNotebooks.isChecked(); + } }