OSDN Git Service

設定ページからEvernote関連ノートリスト統合機能の重み付けを変更できるように変更。設定完了後に連想ノートをリフレッシュするように変更。
[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         private final QSlider enRelatedNotesSlider;
43         
44         private final QSpinBox browseSpinner;
45         private final QSpinBox copyPasteSpinner;
46         private final QSpinBox addNewNoteSpinner;
47         private final QSpinBox rensoItemClickSpinner;
48         private final QSpinBox sameTagSpinner;
49         private final QSpinBox sameNotebookSpinner;
50         private final QSpinBox rensoListItemMaximumSpinner;
51         private final QSpinBox enRelatedNotesSpinner;
52         
53         private final QCheckBox mergeCheck;
54         private final QCheckBox duplicateCheck;
55         private final QCheckBox verifyExclude;
56         
57         public ConfigRensoNoteListPage(QWidget parent) {
58                 // 操作履歴への重み付け
59                 // browseHistory
60                 browseSlider = new QSlider();
61                 browseSlider.setOrientation(Qt.Orientation.Horizontal);
62                 browseSlider.setRange(0, 10);
63                 browseSlider.setSingleStep(1);
64                 browseSlider.setTickPosition(QSlider.TickPosition.TicksAbove);
65                 browseSlider.setTickInterval(1);
66                 browseSlider.setFocusPolicy(Qt.FocusPolicy.StrongFocus);
67
68                 browseSpinner = new QSpinBox();
69                 browseSpinner.setRange(0,10);
70                 browseSpinner.setSingleStep(1);
71                 
72                 browseSlider.valueChanged.connect(browseSpinner, "setValue(int)");
73                 browseSpinner.valueChanged.connect(browseSlider, "setValue(int)");
74                 browseSlider.setValue(Global.getBrowseWeight());
75                 
76                 QHBoxLayout browseLayout = new QHBoxLayout();
77                 browseLayout.addWidget(browseSlider);
78                 browseLayout.addWidget(browseSpinner);
79                 
80                 
81                 // copyPasteHistory
82                 copyPasteSlider = new QSlider();
83                 copyPasteSlider.setOrientation(Qt.Orientation.Horizontal);
84                 copyPasteSlider.setRange(0, 10);
85                 copyPasteSlider.setSingleStep(1);
86                 copyPasteSlider.setTickPosition(QSlider.TickPosition.TicksAbove);
87                 copyPasteSlider.setTickInterval(1);
88                 copyPasteSlider.setFocusPolicy(Qt.FocusPolicy.StrongFocus);
89                 
90                 copyPasteSpinner = new QSpinBox();
91                 copyPasteSpinner.setRange(0,10);
92                 copyPasteSpinner.setSingleStep(1);
93                 
94                 copyPasteSlider.valueChanged.connect(copyPasteSpinner, "setValue(int)");
95                 copyPasteSpinner.valueChanged.connect(copyPasteSlider, "setValue(int)");
96                 copyPasteSlider.setValue(Global.getCopyPasteWeight());
97
98                 
99                 QHBoxLayout copyPasteLayout = new QHBoxLayout();
100                 copyPasteLayout.addWidget(copyPasteSlider);
101                 copyPasteLayout.addWidget(copyPasteSpinner);
102                 
103                 
104                 // addNewNoteHistory
105                 addNewNoteSlider = new QSlider();
106                 addNewNoteSlider.setOrientation(Qt.Orientation.Horizontal);
107                 addNewNoteSlider.setRange(0, 10);
108                 addNewNoteSlider.setSingleStep(1);
109                 addNewNoteSlider.setTickPosition(QSlider.TickPosition.TicksAbove);
110                 addNewNoteSlider.setTickInterval(1);
111                 addNewNoteSlider.setFocusPolicy(Qt.FocusPolicy.StrongFocus);
112
113                 addNewNoteSpinner = new QSpinBox();
114                 addNewNoteSpinner.setRange(0,10);
115                 addNewNoteSpinner.setSingleStep(1);
116                 
117                 addNewNoteSlider.valueChanged.connect(addNewNoteSpinner, "setValue(int)");
118                 addNewNoteSpinner.valueChanged.connect(addNewNoteSlider, "setValue(int)");
119                 addNewNoteSlider.setValue(Global.getAddNewNoteWeight());
120                 
121                 QHBoxLayout addNewNoteLayout = new QHBoxLayout();
122                 addNewNoteLayout.addWidget(addNewNoteSlider);
123                 addNewNoteLayout.addWidget(addNewNoteSpinner);
124                 
125                 
126                 // rensoItemClickHistory
127                 rensoItemClickSlider = new QSlider();
128                 rensoItemClickSlider.setOrientation(Qt.Orientation.Horizontal);
129                 rensoItemClickSlider.setRange(0, 10);
130                 rensoItemClickSlider.setSingleStep(1);
131                 rensoItemClickSlider.setTickPosition(QSlider.TickPosition.TicksAbove);
132                 rensoItemClickSlider.setTickInterval(1);
133                 rensoItemClickSlider.setFocusPolicy(Qt.FocusPolicy.StrongFocus);
134
135                 rensoItemClickSpinner = new QSpinBox();
136                 rensoItemClickSpinner.setRange(0,10);
137                 rensoItemClickSpinner.setSingleStep(1);
138                 
139                 rensoItemClickSlider.valueChanged.connect(rensoItemClickSpinner, "setValue(int)");
140                 rensoItemClickSpinner.valueChanged.connect(rensoItemClickSlider, "setValue(int)");
141                 rensoItemClickSlider.setValue(Global.getRensoItemClickWeight());
142                 
143                 QHBoxLayout rensoItemClickLayout = new QHBoxLayout();
144                 rensoItemClickLayout.addWidget(rensoItemClickSlider);
145                 rensoItemClickLayout.addWidget(rensoItemClickSpinner);
146                 
147                 // sameTagHistory
148                 sameTagSlider = new QSlider();
149                 sameTagSlider.setOrientation(Qt.Orientation.Horizontal);
150                 sameTagSlider.setRange(0, 10);
151                 sameTagSlider.setSingleStep(1);
152                 sameTagSlider.setTickPosition(QSlider.TickPosition.TicksAbove);
153                 sameTagSlider.setTickInterval(1);
154                 sameTagSlider.setFocusPolicy(Qt.FocusPolicy.StrongFocus);
155
156                 sameTagSpinner = new QSpinBox();
157                 sameTagSpinner.setRange(0,10);
158                 sameTagSpinner.setSingleStep(1);
159                 
160                 sameTagSlider.valueChanged.connect(sameTagSpinner, "setValue(int)");
161                 sameTagSpinner.valueChanged.connect(sameTagSlider, "setValue(int)");
162                 sameTagSlider.setValue(Global.getSameTagWeight());
163                 
164                 QHBoxLayout sameTagLayout = new QHBoxLayout();
165                 sameTagLayout.addWidget(sameTagSlider);
166                 sameTagLayout.addWidget(sameTagSpinner);
167                 
168                 // sameNotebookHistory
169                 sameNotebookSlider = new QSlider();
170                 sameNotebookSlider.setOrientation(Qt.Orientation.Horizontal);
171                 sameNotebookSlider.setRange(0, 10);
172                 sameNotebookSlider.setSingleStep(1);
173                 sameNotebookSlider.setTickPosition(QSlider.TickPosition.TicksAbove);
174                 sameNotebookSlider.setTickInterval(1);
175                 sameNotebookSlider.setFocusPolicy(Qt.FocusPolicy.StrongFocus);
176
177                 sameNotebookSpinner = new QSpinBox();
178                 sameNotebookSpinner.setRange(0,10);
179                 sameNotebookSpinner.setSingleStep(1);
180                 
181                 sameNotebookSlider.valueChanged.connect(sameNotebookSpinner, "setValue(int)");
182                 sameNotebookSpinner.valueChanged.connect(sameNotebookSlider, "setValue(int)");
183                 sameNotebookSlider.setValue(Global.getSameNotebookWeight());
184                 
185                 QHBoxLayout sameNotebookLayout = new QHBoxLayout();
186                 sameNotebookLayout.addWidget(sameNotebookSlider);
187                 sameNotebookLayout.addWidget(sameNotebookSpinner);
188                 
189                 // enRelatedNotes
190                 enRelatedNotesSlider = new QSlider();
191                 enRelatedNotesSlider.setOrientation(Qt.Orientation.Horizontal);
192                 enRelatedNotesSlider.setRange(0, 10);
193                 enRelatedNotesSlider.setSingleStep(1);
194                 enRelatedNotesSlider.setTickPosition(QSlider.TickPosition.TicksAbove);
195                 enRelatedNotesSlider.setTickInterval(1);
196                 enRelatedNotesSlider.setFocusPolicy(Qt.FocusPolicy.StrongFocus);
197                 
198                 enRelatedNotesSpinner = new QSpinBox();
199                 enRelatedNotesSpinner.setRange(0, 10);
200                 enRelatedNotesSpinner.setSingleStep(1);
201                 
202                 enRelatedNotesSlider.valueChanged.connect(enRelatedNotesSpinner, "setValue(int)");
203                 enRelatedNotesSpinner.valueChanged.connect(enRelatedNotesSlider, "setValue(int)");
204                 enRelatedNotesSpinner.setValue(Global.getENRelatedNotesWeight());
205                 
206                 QHBoxLayout enRelatedNotesLayout = new QHBoxLayout();
207                 enRelatedNotesLayout.addWidget(enRelatedNotesSlider);
208                 enRelatedNotesLayout.addWidget(enRelatedNotesSpinner);
209                 
210                 // 重み付け設定部分のレイアウト
211                 QFormLayout styleLayout = new QFormLayout();
212                 styleLayout.setHorizontalSpacing(10);
213                 styleLayout.setVerticalSpacing(30);
214                 styleLayout.addRow(tr("Browse Weight"), browseLayout);
215                 styleLayout.addRow(tr("Copy&Paste Weight"), copyPasteLayout);
216                 styleLayout.addRow(tr("Add New Note Weight"), addNewNoteLayout);
217                 styleLayout.addRow(tr("Renso Item Click Weight"), rensoItemClickLayout);
218                 styleLayout.addRow(tr("Same Tag Weight"), sameTagLayout);
219                 styleLayout.addRow(tr("Same Notebook Weight"), sameNotebookLayout);
220                 styleLayout.addRow(tr("Evernote Related Notes Integration"), enRelatedNotesLayout);
221
222                 QGroupBox weightingGroup = new QGroupBox(tr("Weighting"));
223                 weightingGroup.setLayout(styleLayout);
224                 
225                 // ノートのマージ・複製の関連ノートリストへの適用
226                 mergeCheck = new QCheckBox(tr("When you merge the notes, also merge RensoNoteList"));
227                 mergeCheck.setChecked(Global.getMergeRensoNote());
228                 duplicateCheck = new QCheckBox(tr("When you duplicate the notes, also duplicate RensoNoteList"));
229                 duplicateCheck.setChecked(Global.getDuplicateRensoNote());
230                 verifyExclude = new QCheckBox(tr("Verify when you exclude the note"));
231                 verifyExclude.setChecked(Global.verifyExclude());
232                 
233                 // 連想ノートリスト最大アイテム表示数
234                 rensoListItemMaximumSpinner = new QSpinBox();
235                 rensoListItemMaximumSpinner.setRange(1,100);
236                 rensoListItemMaximumSpinner.setSingleStep(1);
237                 rensoListItemMaximumSpinner.setValue(Global.getRensoListItemMaximum());
238                 QFormLayout fLayout = new QFormLayout();
239                 fLayout.setHorizontalSpacing(100);
240                 fLayout.addRow(tr("Renso Note List Item Maximum"), rensoListItemMaximumSpinner);
241                 
242                 // その他のレイアウト
243                 QVBoxLayout othersLayout = new QVBoxLayout();
244                 othersLayout.addWidget(mergeCheck);
245                 othersLayout.addWidget(duplicateCheck);
246                 othersLayout.addWidget(verifyExclude);
247                 othersLayout.addLayout(fLayout);
248                 
249                 QGroupBox othersGroup = new QGroupBox(tr("Others"));
250                 othersGroup.setLayout(othersLayout);
251                 
252                 QVBoxLayout mainLayout = new QVBoxLayout();
253                 mainLayout.addWidget(weightingGroup);
254                 mainLayout.addWidget(othersGroup);
255                 mainLayout.addStretch(1);
256                 setLayout(mainLayout);
257                 
258         }
259         
260         //*****************************************
261         //* Browse Weight 
262         //*****************************************
263         public int getBrowseWeight() {
264                 return browseSpinner.value();
265         }
266         
267         //*****************************************
268         //* Copy & Paste Weight 
269         //*****************************************
270         public int getCopyPasteWeight() {
271                 return copyPasteSpinner.value();
272         }
273         
274         //*****************************************
275         //* Add New Note Weight 
276         //*****************************************
277         public int getAddNewNoteWeight() {
278                 return addNewNoteSpinner.value();
279         }
280         
281         //*****************************************
282         //* Renso Item Click Weight
283         //*****************************************
284         public int getRensoItemClickWeight() {
285                 return rensoItemClickSpinner.value();
286         }
287         
288         //*****************************************
289         //* Same Tag Weight
290         //*****************************************
291         public int getSameTagWeight() {
292                 return sameTagSpinner.value();
293         }
294         
295         //*****************************************
296         //* Same Notebook Weight
297         //*****************************************
298         public int getSameNotebookWeight() {
299                 return sameNotebookSpinner.value();
300         }
301         
302         //*****************************************
303         //* Evernote Related Notes Integration Weight
304         //*****************************************
305         public int getENRelatedNotesWeight() {
306                 return enRelatedNotesSpinner.value();
307         }
308
309         //*****************************************
310         //* Merge Check
311         //*****************************************
312         public boolean getMergeChecked() {
313                 return mergeCheck.isChecked();
314         }
315
316         //*****************************************
317         //* DuplicateCheck
318         //*****************************************
319         public boolean getDuplicateChecked() {
320                 return duplicateCheck.isChecked();
321         }
322         
323         //*****************************************
324         //* VerifyExcludeCheck
325         //*****************************************
326         public boolean getVerifyExcludeChecked() {
327                 return verifyExclude.isChecked();
328         }
329
330         //*****************************************
331         //* RensoNoteListItemMaximum
332         //*****************************************
333         public int getRensoListItemMaximum() {
334                 return rensoListItemMaximumSpinner.value();
335         }
336 }