2 * This file is part of NeverNote
\r
3 * Copyright 2009 Randy Baumgarte
\r
5 * This file may be licensed under the terms of of the
\r
6 * GNU General Public License Version 2 (the ``GPL'').
\r
8 * Software distributed under the License is distributed
\r
9 * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
\r
10 * express or implied. See the GPL for the specific language
\r
11 * governing rights and limitations.
\r
13 * You should have received a copy of the GPL along with this
\r
14 * program. If not, go to http://www.gnu.org/licenses/gpl.html
\r
15 * or write to the Free Software Foundation, Inc.,
\r
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
20 package cx.fbn.nevernote.dialog;
\r
22 import com.trolltech.qt.gui.QCheckBox;
\r
23 import com.trolltech.qt.gui.QComboBox;
\r
24 import com.trolltech.qt.gui.QGroupBox;
\r
25 import com.trolltech.qt.gui.QHBoxLayout;
\r
26 import com.trolltech.qt.gui.QLabel;
\r
27 import com.trolltech.qt.gui.QTextBrowser;
\r
28 import com.trolltech.qt.gui.QVBoxLayout;
\r
29 import com.trolltech.qt.gui.QWidget;
\r
31 public class ConfigDebugPage extends QWidget {
\r
33 QComboBox messageCombo;
\r
34 QComboBox serverCombo;
\r
35 QCheckBox disableUploads;
\r
36 QCheckBox carriageReturnFix;
\r
37 public ConfigDebugPage(QWidget parent) {
\r
40 QGroupBox serverGroup = new QGroupBox(tr("Server Configuration"));
\r
41 QLabel serverLabel = new QLabel(tr("Server"));
\r
42 serverCombo = new QComboBox();
\r
43 serverCombo.addItem(tr("www.evernote.com"));
\r
44 serverCombo.addItem(tr("sandbox.evernote.com"));
\r
45 disableUploads = new QCheckBox();
\r
46 disableUploads.setText("Disable uploads to server");
\r
48 QHBoxLayout serverLayout = new QHBoxLayout();
\r
49 serverLayout.addWidget(serverLabel);
\r
50 serverLayout.addWidget(serverCombo);
\r
51 serverLayout.addWidget(disableUploads);
\r
52 serverGroup.setLayout(serverLayout);
\r
54 QGroupBox messageGroup = new QGroupBox(tr("Debug Messages"));
\r
55 QLabel messageLevelLabel = new QLabel(tr("Message Level"));
\r
56 messageCombo = new QComboBox();
\r
57 messageCombo.addItem(tr("Low"));
\r
58 messageCombo.addItem(tr("Medium"));
\r
59 messageCombo.addItem(tr("High"));
\r
60 messageCombo.addItem(tr("Extreme"));
\r
62 QHBoxLayout messageLayout = new QHBoxLayout();
\r
63 messageLayout.addWidget(messageLevelLabel);
\r
64 messageLayout.addWidget(messageCombo);
\r
65 messageLayout.setStretch(1, 100);
\r
66 messageGroup.setLayout(messageLayout);
\r
68 QVBoxLayout mainLayout = new QVBoxLayout();
\r
69 mainLayout.addWidget(serverGroup);
\r
70 mainLayout.addWidget(messageGroup);
\r
72 QGroupBox crlfGroup = new QGroupBox(tr("Carriage Return Fix"));
\r
73 String crlfMessage = new String(tr("Note: The carriage return is a test fix. If you " +
\r
74 "enable it, it will do some modifications to the notes you view to try and" +
\r
75 " get the carriage returns to look correct. This is due to the way that " +
\r
76 "the way Evernote 3.1 Windows client is dealing with carriage returns. This fix"+
\r
77 "will try and correct this problem. This fix is not permanent unless you edit a note. If" +
\r
78 "you edit a note, this fix is PERMANENT and will be sent to Evernote on the next sync. I haven't" +
\r
79 "had any issues with this, but please be aware of this condition."));
\r
80 carriageReturnFix = new QCheckBox(this);
\r
81 QHBoxLayout crlfLayout = new QHBoxLayout();
\r
82 QLabel carriageReturnLabel = new QLabel("Enable Carriage Return Fix");
\r
83 crlfLayout.addWidget(carriageReturnLabel);
\r
84 crlfLayout.addWidget(carriageReturnFix);
\r
85 crlfGroup.setLayout(crlfLayout);
\r
87 QTextBrowser msg = new QTextBrowser(this);
\r
88 msg.setText(crlfMessage);
\r
89 mainLayout.addWidget(crlfGroup);
\r
91 mainLayout.addWidget(msg);
\r
93 mainLayout.addStretch(1);
\r
94 setLayout(mainLayout);
\r
96 serverCombo.activated.connect(this, "serverOptionChanged()");
\r
99 //******************************************
\r
100 //* Message set/get
\r
101 //******************************************
\r
102 public void setDebugLevel(String level) {
\r
103 int i = messageCombo.findText(level);
\r
105 messageCombo.setCurrentIndex(i);
\r
107 public String getDebugLevel() {
\r
108 int i = messageCombo.currentIndex();
\r
109 return messageCombo.itemText(i);
\r
111 public void setCarriageReturnFix(boolean val) {
\r
112 carriageReturnFix.setChecked(val);
\r
114 public boolean getCarriageReturnFix() {
\r
115 return carriageReturnFix.isChecked();
\r
119 //******************************************
\r
121 //******************************************
\r
122 public void setServer(String server) {
\r
123 int i = serverCombo.findText(server);
\r
125 serverCombo.setCurrentIndex(i);
\r
127 public String getServer() {
\r
128 int i = serverCombo.currentIndex();
\r
129 return serverCombo.itemText(i);
\r
131 @SuppressWarnings("unused")
\r
132 private void serverOptionChanged() {
\r
133 String text = serverCombo.currentText();
\r
134 if (text.equalsIgnoreCase("www.evernote.com"))
\r
135 disableUploads.setChecked(true);
\r
137 //*****************************************
\r
138 //* Disable uploads
\r
139 //*****************************************
\r
140 public void setDisableUploads(boolean val) {
\r
141 disableUploads.setChecked(val);
\r
143 public boolean getDisableUploads() {
\r
144 return disableUploads.isChecked();
\r