OSDN Git Service

f680b5f7db41dca0af9834fdbfb5b79f7ae5808d
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / dialog / ConfigRensoNoteListPage.java
1 /*
2  * This file is part of NeighborNote
3  * Copyright 2013 Yuki Takahashi
4  * 
5  * This file may be licensed under the terms of of the
6  * GNU General Public License Version 2 (the ``GPL'').
7  *
8  * Software distributed under the License is distributed
9  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
10  * express or implied. See the GPL for the specific language
11  * governing rights and limitations.
12  *
13  * You should have received a copy of the GPL along with this
14  * program. If not, go to http://www.gnu.org/licenses/gpl.html
15  * or write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18 */
19
20 // ICHANGED
21 package cx.fbn.nevernote.dialog;
22
23 import com.trolltech.qt.core.Qt;
24 import com.trolltech.qt.gui.QCheckBox;
25 import com.trolltech.qt.gui.QFormLayout;
26 import com.trolltech.qt.gui.QGroupBox;
27 import com.trolltech.qt.gui.QHBoxLayout;
28 import com.trolltech.qt.gui.QSlider;
29 import com.trolltech.qt.gui.QSpinBox;
30 import com.trolltech.qt.gui.QVBoxLayout;
31 import com.trolltech.qt.gui.QWidget;
32
33 import cx.fbn.nevernote.Global;
34
35 public class ConfigRensoNoteListPage extends QWidget {
36         private final QSlider browseSlider;
37         private final QSlider copyPasteSlider;
38         private final QSlider addNewNoteSlider;
39         private final QSlider rensoItemClickSlider;
40         private final QSlider sameTagSlider;
41         private final QSlider sameNotebookSlider;
42         
43         private final QSpinBox browseSpinner;
44         private final QSpinBox copyPasteSpinner;
45         private final QSpinBox addNewNoteSpinner;
46         private final QSpinBox rensoItemClickSpinner;
47         private final QSpinBox sameTagSpinner;
48         private final QSpinBox sameNotebookSpinner;
49         private final QSpinBox rensoListItemMaximumSpinner;
50         
51         private final QCheckBox mergeCheck;
52         private final QCheckBox duplicateCheck;
53         private final QCheckBox verifyExclude;
54         
55         public ConfigRensoNoteListPage(QWidget parent) {
56                 // 操作履歴への重み付け
57                 // browseHistory
58                 browseSlider = new QSlider();
59                 browseSlider.setOrientation(Qt.Orientation.Horizontal);
60                 browseSlider.setRange(0, 10);
61                 browseSlider.setSingleStep(1);
62                 browseSlider.setTickPosition(QSlider.TickPosition.TicksAbove);
63                 browseSlider.setTickInterval(1);
64                 browseSlider.setFocusPolicy(Qt.FocusPolicy.StrongFocus);
65
66                 browseSpinner = new QSpinBox();
67                 browseSpinner.setRange(0,10);
68                 browseSpinner.setSingleStep(1);
69                 
70                 browseSlider.valueChanged.connect(browseSpinner, "setValue(int)");
71                 browseSpinner.valueChanged.connect(browseSlider, "setValue(int)");
72                 browseSlider.setValue(Global.getBrowseWeight());
73                 
74                 QHBoxLayout browseLayout = new QHBoxLayout();
75                 browseLayout.addWidget(browseSlider);
76                 browseLayout.addWidget(browseSpinner);
77                 
78                 
79                 // copyPasteHistory
80                 copyPasteSlider = new QSlider();
81                 copyPasteSlider.setOrientation(Qt.Orientation.Horizontal);
82                 copyPasteSlider.setRange(0, 10);
83                 copyPasteSlider.setSingleStep(1);
84                 copyPasteSlider.setTickPosition(QSlider.TickPosition.TicksAbove);
85                 copyPasteSlider.setTickInterval(1);
86                 copyPasteSlider.setFocusPolicy(Qt.FocusPolicy.StrongFocus);
87                 
88                 copyPasteSpinner = new QSpinBox();
89                 copyPasteSpinner.setRange(0,10);
90                 copyPasteSpinner.setSingleStep(1);
91                 
92                 copyPasteSlider.valueChanged.connect(copyPasteSpinner, "setValue(int)");
93                 copyPasteSpinner.valueChanged.connect(copyPasteSlider, "setValue(int)");
94                 copyPasteSlider.setValue(Global.getCopyPasteWeight());
95
96                 
97                 QHBoxLayout copyPasteLayout = new QHBoxLayout();
98                 copyPasteLayout.addWidget(copyPasteSlider);
99                 copyPasteLayout.addWidget(copyPasteSpinner);
100                 
101                 
102                 // addNewNoteHistory
103                 addNewNoteSlider = new QSlider();
104                 addNewNoteSlider.setOrientation(Qt.Orientation.Horizontal);
105                 addNewNoteSlider.setRange(0, 10);
106                 addNewNoteSlider.setSingleStep(1);
107                 addNewNoteSlider.setTickPosition(QSlider.TickPosition.TicksAbove);
108                 addNewNoteSlider.setTickInterval(1);
109                 addNewNoteSlider.setFocusPolicy(Qt.FocusPolicy.StrongFocus);
110
111                 addNewNoteSpinner = new QSpinBox();
112                 addNewNoteSpinner.setRange(0,10);
113                 addNewNoteSpinner.setSingleStep(1);
114                 
115                 addNewNoteSlider.valueChanged.connect(addNewNoteSpinner, "setValue(int)");
116                 addNewNoteSpinner.valueChanged.connect(addNewNoteSlider, "setValue(int)");
117                 addNewNoteSlider.setValue(Global.getAddNewNoteWeight());
118                 
119                 QHBoxLayout addNewNoteLayout = new QHBoxLayout();
120                 addNewNoteLayout.addWidget(addNewNoteSlider);
121                 addNewNoteLayout.addWidget(addNewNoteSpinner);
122                 
123                 
124                 // rensoItemClickHistory
125                 rensoItemClickSlider = new QSlider();
126                 rensoItemClickSlider.setOrientation(Qt.Orientation.Horizontal);
127                 rensoItemClickSlider.setRange(0, 10);
128                 rensoItemClickSlider.setSingleStep(1);
129                 rensoItemClickSlider.setTickPosition(QSlider.TickPosition.TicksAbove);
130                 rensoItemClickSlider.setTickInterval(1);
131                 rensoItemClickSlider.setFocusPolicy(Qt.FocusPolicy.StrongFocus);
132
133                 rensoItemClickSpinner = new QSpinBox();
134                 rensoItemClickSpinner.setRange(0,10);
135                 rensoItemClickSpinner.setSingleStep(1);
136                 
137                 rensoItemClickSlider.valueChanged.connect(rensoItemClickSpinner, "setValue(int)");
138                 rensoItemClickSpinner.valueChanged.connect(rensoItemClickSlider, "setValue(int)");
139                 rensoItemClickSlider.setValue(Global.getRensoItemClickWeight());
140                 
141                 QHBoxLayout rensoItemClickLayout = new QHBoxLayout();
142                 rensoItemClickLayout.addWidget(rensoItemClickSlider);
143                 rensoItemClickLayout.addWidget(rensoItemClickSpinner);
144                 
145                 // sameTagHistory
146                 sameTagSlider = new QSlider();
147                 sameTagSlider.setOrientation(Qt.Orientation.Horizontal);
148                 sameTagSlider.setRange(0, 10);
149                 sameTagSlider.setSingleStep(1);
150                 sameTagSlider.setTickPosition(QSlider.TickPosition.TicksAbove);
151                 sameTagSlider.setTickInterval(1);
152                 sameTagSlider.setFocusPolicy(Qt.FocusPolicy.StrongFocus);
153
154                 sameTagSpinner = new QSpinBox();
155                 sameTagSpinner.setRange(0,10);
156                 sameTagSpinner.setSingleStep(1);
157                 
158                 sameTagSlider.valueChanged.connect(sameTagSpinner, "setValue(int)");
159                 sameTagSpinner.valueChanged.connect(sameTagSlider, "setValue(int)");
160                 sameTagSlider.setValue(Global.getSameTagWeight());
161                 
162                 QHBoxLayout sameTagLayout = new QHBoxLayout();
163                 sameTagLayout.addWidget(sameTagSlider);
164                 sameTagLayout.addWidget(sameTagSpinner);
165                 
166                 // sameNotebookHistory
167                 sameNotebookSlider = new QSlider();
168                 sameNotebookSlider.setOrientation(Qt.Orientation.Horizontal);
169                 sameNotebookSlider.setRange(0, 10);
170                 sameNotebookSlider.setSingleStep(1);
171                 sameNotebookSlider.setTickPosition(QSlider.TickPosition.TicksAbove);
172                 sameNotebookSlider.setTickInterval(1);
173                 sameNotebookSlider.setFocusPolicy(Qt.FocusPolicy.StrongFocus);
174
175                 sameNotebookSpinner = new QSpinBox();
176                 sameNotebookSpinner.setRange(0,10);
177                 sameNotebookSpinner.setSingleStep(1);
178                 
179                 sameNotebookSlider.valueChanged.connect(sameNotebookSpinner, "setValue(int)");
180                 sameNotebookSpinner.valueChanged.connect(sameNotebookSlider, "setValue(int)");
181                 sameNotebookSlider.setValue(Global.getSameNotebookWeight());
182                 
183                 QHBoxLayout sameNotebookLayout = new QHBoxLayout();
184                 sameNotebookLayout.addWidget(sameNotebookSlider);
185                 sameNotebookLayout.addWidget(sameNotebookSpinner);      
186                 
187                 QFormLayout styleLayout = new QFormLayout();
188                 styleLayout.setHorizontalSpacing(10);
189                 styleLayout.setVerticalSpacing(30);
190                 styleLayout.addRow(tr("Browse Weight"), browseLayout);
191                 styleLayout.addRow(tr("Copy&Paste Weight"), copyPasteLayout);
192                 styleLayout.addRow(tr("Add New Note Weight"), addNewNoteLayout);
193                 styleLayout.addRow(tr("Renso Item Click Weight"), rensoItemClickLayout);
194                 styleLayout.addRow(tr("Same Tag Weight"), sameTagLayout);
195                 styleLayout.addRow(tr("Same Notebook Weight"), sameNotebookLayout);
196
197                 QGroupBox weightingGroup = new QGroupBox(tr("Weighting"));
198                 weightingGroup.setLayout(styleLayout);
199                 
200                 // ノートのマージ・複製の関連ノートリストへの適用
201                 mergeCheck = new QCheckBox(tr("When you merge the notes, also merge RensoNoteList"));
202                 mergeCheck.setChecked(Global.getMergeRensoNote());
203                 duplicateCheck = new QCheckBox(tr("When you duplicate the notes, also duplicate RensoNoteList"));
204                 duplicateCheck.setChecked(Global.getDuplicateRensoNote());
205                 verifyExclude = new QCheckBox(tr("Verify when you exclude the note"));
206                 verifyExclude.setChecked(Global.verifyExclude());
207                 
208                 // 連想ノートリスト最大アイテム表示数
209                 rensoListItemMaximumSpinner = new QSpinBox();
210                 rensoListItemMaximumSpinner.setRange(1,100);
211                 rensoListItemMaximumSpinner.setSingleStep(1);
212                 rensoListItemMaximumSpinner.setValue(Global.getRensoListItemMaximum());
213                 QFormLayout fLayout = new QFormLayout();
214                 fLayout.setHorizontalSpacing(100);
215                 fLayout.addRow(tr("Renso Note List Item Maximum"), rensoListItemMaximumSpinner);
216                 
217                 // その他のレイアウト
218                 QVBoxLayout othersLayout = new QVBoxLayout();
219                 othersLayout.addWidget(mergeCheck);
220                 othersLayout.addWidget(duplicateCheck);
221                 othersLayout.addWidget(verifyExclude);
222                 othersLayout.addLayout(fLayout);
223                 
224                 QGroupBox othersGroup = new QGroupBox(tr("Others"));
225                 othersGroup.setLayout(othersLayout);
226                 
227                 QVBoxLayout mainLayout = new QVBoxLayout();
228                 mainLayout.addWidget(weightingGroup);
229                 mainLayout.addWidget(othersGroup);
230                 mainLayout.addStretch(1);
231                 setLayout(mainLayout);
232                 
233         }
234         
235         //*****************************************
236         //* Browse Weight 
237         //*****************************************
238         public int getBrowseWeight() {
239                 return browseSpinner.value();
240         }
241         
242         //*****************************************
243         //* Copy & Paste Weight 
244         //*****************************************
245         public int getCopyPasteWeight() {
246                 return copyPasteSpinner.value();
247         }
248         
249         //*****************************************
250         //* Add New Note Weight 
251         //*****************************************
252         public int getAddNewNoteWeight() {
253                 return addNewNoteSpinner.value();
254         }
255         
256         //*****************************************
257         //* Renso Item Click Weight
258         //*****************************************
259         public int getRensoItemClickWeight() {
260                 return rensoItemClickSpinner.value();
261         }
262         
263         //*****************************************
264         //* Same Tag Weight
265         //*****************************************
266         public int getSameTagWeight() {
267                 return sameTagSpinner.value();
268         }
269         
270         //*****************************************
271         //* Same Notebook Weight
272         //*****************************************
273         public int getSameNotebookWeight() {
274                 return sameNotebookSpinner.value();
275         }
276
277         //*****************************************
278         //* Merge Check
279         //*****************************************
280         public boolean getMergeChecked() {
281                 return mergeCheck.isChecked();
282         }
283
284         //*****************************************
285         //* DuplicateCheck
286         //*****************************************
287         public boolean getDuplicateChecked() {
288                 return duplicateCheck.isChecked();
289         }
290         
291         //*****************************************
292         //* VerifyExcludeCheck
293         //*****************************************
294         public boolean getVerifyExcludeChecked() {
295                 return verifyExclude.isChecked();
296         }
297
298         //*****************************************
299         //* RensoNoteListItemMaximum
300         //*****************************************
301         public int getRensoListItemMaximum() {
302                 return rensoListItemMaximumSpinner.value();
303         }
304 }