OSDN Git Service

add missing tr() for I18N
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / dialog / ConfigDebugPage.java
1 /*\r
2  * This file is part of NeverNote \r
3  * Copyright 2009 Randy Baumgarte\r
4  * \r
5  * This file may be licensed under the terms of of the\r
6  * GNU General Public License Version 2 (the ``GPL'').\r
7  *\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
12  *\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
17  *\r
18 */\r
19 \r
20 package cx.fbn.nevernote.dialog;\r
21 \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
30 \r
31 public class ConfigDebugPage extends QWidget {\r
32         \r
33         QComboBox messageCombo;\r
34         QComboBox serverCombo;\r
35         QCheckBox disableUploads;\r
36         QCheckBox carriageReturnFix;\r
37         public ConfigDebugPage(QWidget parent) {\r
38                 super(parent);\r
39                 // Server settings\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("www.evernote.com");\r
44                 serverCombo.addItem("sandbox.evernote.com");\r
45                 disableUploads = new QCheckBox();\r
46                 disableUploads.setText(tr("Disable uploads to server"));\r
47 \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
53 \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("Low");\r
58                 messageCombo.addItem("Medium");\r
59                 messageCombo.addItem("High");\r
60                 messageCombo.addItem("Extreme");\r
61                 \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
67                 \r
68                 QVBoxLayout mainLayout = new QVBoxLayout();\r
69                 mainLayout.addWidget(serverGroup);\r
70                 mainLayout.addWidget(messageGroup);\r
71                 \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(tr("Enable Carriage Return Fix"));\r
83                 crlfLayout.addWidget(carriageReturnLabel);\r
84                 crlfLayout.addWidget(carriageReturnFix);\r
85                 crlfGroup.setLayout(crlfLayout);\r
86 \r
87                 QTextBrowser msg = new QTextBrowser(this);\r
88                 msg.setText(crlfMessage);\r
89                 mainLayout.addWidget(crlfGroup);\r
90 \r
91                 mainLayout.addWidget(msg);\r
92                 \r
93                 mainLayout.addStretch(1);\r
94                 setLayout(mainLayout);\r
95                 \r
96                 serverCombo.activated.connect(this, "serverOptionChanged()");\r
97         }\r
98         \r
99         //******************************************\r
100         //* Message set/get\r
101         //******************************************\r
102         public void setDebugLevel(String level) {\r
103                 int i = messageCombo.findText(level);\r
104                 if (i>0)\r
105                         messageCombo.setCurrentIndex(i);\r
106         }\r
107         public String getDebugLevel() {\r
108                 int i = messageCombo.currentIndex();\r
109                 return messageCombo.itemText(i);\r
110         }\r
111         public void setCarriageReturnFix(boolean val) {\r
112                 carriageReturnFix.setChecked(val);\r
113         }\r
114         public boolean getCarriageReturnFix() {\r
115                 return carriageReturnFix.isChecked();\r
116         }\r
117 \r
118         \r
119         //******************************************\r
120         //* Server set/get\r
121         //******************************************\r
122         public void setServer(String server) {\r
123                 int i = serverCombo.findText(server);\r
124                 if (i>0)\r
125                         serverCombo.setCurrentIndex(i);\r
126         }\r
127         public String getServer() {\r
128                 int i = serverCombo.currentIndex();\r
129                 return serverCombo.itemText(i);\r
130         }\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
136         }\r
137         //*****************************************\r
138         //* Disable uploads \r
139         //*****************************************\r
140         public void setDisableUploads(boolean val) {\r
141                 disableUploads.setChecked(val);\r
142         }\r
143         public boolean getDisableUploads() {\r
144                 return disableUploads.isChecked();\r
145         }\r
146         \r
147         \r
148 \r
149 \r
150 }\r