OSDN Git Service

設定ページからEvernote関連ノートリスト統合機能の重み付けを変更できるように変更。設定完了後に連想ノートをリフレッシュするように変更。
authoryuki <kimaira7@gmail.com>
Tue, 2 Jul 2013 05:10:37 +0000 (14:10 +0900)
committeryuki <kimaira7@gmail.com>
Tue, 2 Jul 2013 05:10:37 +0000 (14:10 +0900)
src/cx/fbn/nevernote/Global.java
src/cx/fbn/nevernote/NeverNote.java
src/cx/fbn/nevernote/dialog/ConfigDialog.java
src/cx/fbn/nevernote/dialog/ConfigRensoNoteListPage.java
src/cx/fbn/nevernote/gui/RensoNoteList.java

index de2bb02..1a731e2 100644 (file)
@@ -2223,6 +2223,29 @@ public class Global {
                settings.endGroup();
                return value;
        }
                settings.endGroup();
                return value;
        }
+       
+       // Evernote関連ノート機能統合に対する重み付け
+       public static void setENRelatedNotesWeight(int weight) {
+               settings.beginGroup("RensoNoteList");
+               settings.setValue("enRelatedNotesWeight", weight);
+               settings.endGroup();
+       }
+       public static int getENRelatedNotesWeight() {
+               settings.beginGroup("RensoNoteList");
+               Integer value;
+               try {
+                       String val = (String)settings.value("enRelatedNotesWeight", 10);
+                       value = new Integer(val.trim());
+               } catch (Exception e) {
+                       try {
+                               value = (Integer)settings.value("enRelatedNotesWeight", 10);
+                       } catch (Exception e1) {
+                               value = 10;
+                       }
+               }
+               settings.endGroup();
+               return value;
+       }
     
     //*******************
     // ノートのマージ・複製の関連ノートリストへの適用
     
     //*******************
     // ノートのマージ・複製の関連ノートリストへの適用
index 3d30b1f..ff17b0d 100644 (file)
@@ -7760,4 +7760,9 @@ public class NeverNote extends QMainWindow{
                fromHistory.put(from,  fromHistory.get(to));
                fromHistory.put(to, fromHist);
        }
                fromHistory.put(from,  fromHistory.get(to));
                fromHistory.put(to, fromHist);
        }
+       
+       // 連想ノートリストのgetter
+       public RensoNoteList getRensoNoteList() {
+               return rensoNoteList;
+       }
 }
 }
index 1a4cabd..d313565 100644 (file)
@@ -41,9 +41,9 @@ import com.trolltech.qt.gui.QListWidgetItem;
 import com.trolltech.qt.gui.QPushButton;\r
 import com.trolltech.qt.gui.QStackedWidget;\r
 import com.trolltech.qt.gui.QVBoxLayout;\r
 import com.trolltech.qt.gui.QPushButton;\r
 import com.trolltech.qt.gui.QStackedWidget;\r
 import com.trolltech.qt.gui.QVBoxLayout;\r
-import com.trolltech.qt.gui.QWidget;\r
 \r
 import cx.fbn.nevernote.Global;\r
 \r
 import cx.fbn.nevernote.Global;\r
+import cx.fbn.nevernote.NeverNote;\r
 public class ConfigDialog extends QDialog {\r
        private final QListWidget                               contentsWidget;\r
        private final ConfigFontPage                    fontPage;\r
 public class ConfigDialog extends QDialog {\r
        private final QListWidget                               contentsWidget;\r
        private final ConfigFontPage                    fontPage;\r
@@ -53,12 +53,13 @@ public class ConfigDialog extends QDialog {
        private final ConfigAppearancePage              appearancePage;\r
        private final ConfigSpellPage                   spellPage;\r
        private final ConfigIndexPage                   indexPage;\r
        private final ConfigAppearancePage              appearancePage;\r
        private final ConfigSpellPage                   spellPage;\r
        private final ConfigIndexPage                   indexPage;\r
-       // ICHANGED\r
-       private final ConfigRensoNoteListPage           rensoNoteListPage;\r
+       private final ConfigRensoNoteListPage   rensoNoteListPage;\r
+       private final NeverNote                                 parent;\r
        \r
     private final String iconPath = new String("classpath:cx/fbn/nevernote/icons/");\r
        \r
        \r
     private final String iconPath = new String("classpath:cx/fbn/nevernote/icons/");\r
        \r
-       public ConfigDialog(QWidget parent) {\r
+       public ConfigDialog(NeverNote parent) {\r
+               this.parent = parent;\r
                \r
                contentsWidget = new QListWidget(this);\r
                setWindowIcon(new QIcon(iconPath+"config.png"));\r
                \r
                contentsWidget = new QListWidget(this);\r
                setWindowIcon(new QIcon(iconPath+"config.png"));\r
@@ -231,6 +232,7 @@ public class ConfigDialog extends QDialog {
                Global.setRensoItemClickWeight(rensoNoteListPage.getRensoItemClickWeight());
                Global.setSameTagWeight(rensoNoteListPage.getSameTagWeight());
                Global.setSameNotebookWeight(rensoNoteListPage.getSameNotebookWeight());\r
                Global.setRensoItemClickWeight(rensoNoteListPage.getRensoItemClickWeight());
                Global.setSameTagWeight(rensoNoteListPage.getSameTagWeight());
                Global.setSameNotebookWeight(rensoNoteListPage.getSameNotebookWeight());\r
+               Global.setENRelatedNotesWeight(rensoNoteListPage.getENRelatedNotesWeight());\r
                \r
                // ICHANGED\r
                Global.setMergeRensoNote(rensoNoteListPage.getMergeChecked());\r
                \r
                // ICHANGED\r
                Global.setMergeRensoNote(rensoNoteListPage.getMergeChecked());\r
@@ -238,6 +240,9 @@ public class ConfigDialog extends QDialog {
                Global.setVerifyExclude(rensoNoteListPage.getVerifyExcludeChecked());\r
                Global.setRensoListItemMaximum(rensoNoteListPage.getRensoListItemMaximum());\r
                \r
                Global.setVerifyExclude(rensoNoteListPage.getVerifyExcludeChecked());\r
                Global.setRensoListItemMaximum(rensoNoteListPage.getRensoListItemMaximum());\r
                \r
+               // 連想ノートリストをリフレッシュ\r
+               parent.getRensoNoteList().refreshRensoNoteList(parent.getCurrentNoteGuid());\r
+               \r
                close();\r
        }\r
        \r
                close();\r
        }\r
        \r
@@ -262,7 +267,6 @@ public class ConfigDialog extends QDialog {
        // Create icons used for navigating the page\r
        public void createIcons() {\r
                String iconPath = new String("classpath:cx/fbn/nevernote/icons/");\r
        // Create icons used for navigating the page\r
        public void createIcons() {\r
                String iconPath = new String("classpath:cx/fbn/nevernote/icons/");\r
-\r
                \r
                QListWidgetItem formatsButton = new QListWidgetItem(contentsWidget);\r
                formatsButton.setText(tr("Appearance"));\r
                \r
                QListWidgetItem formatsButton = new QListWidgetItem(contentsWidget);\r
                formatsButton.setText(tr("Appearance"));\r
index f680b5f..646b571 100644 (file)
@@ -39,6 +39,7 @@ public class ConfigRensoNoteListPage extends QWidget {
        private final QSlider rensoItemClickSlider;
        private final QSlider sameTagSlider;
        private final QSlider sameNotebookSlider;
        private final QSlider rensoItemClickSlider;
        private final QSlider sameTagSlider;
        private final QSlider sameNotebookSlider;
+       private final QSlider enRelatedNotesSlider;
        
        private final QSpinBox browseSpinner;
        private final QSpinBox copyPasteSpinner;
        
        private final QSpinBox browseSpinner;
        private final QSpinBox copyPasteSpinner;
@@ -47,6 +48,7 @@ public class ConfigRensoNoteListPage extends QWidget {
        private final QSpinBox sameTagSpinner;
        private final QSpinBox sameNotebookSpinner;
        private final QSpinBox rensoListItemMaximumSpinner;
        private final QSpinBox sameTagSpinner;
        private final QSpinBox sameNotebookSpinner;
        private final QSpinBox rensoListItemMaximumSpinner;
+       private final QSpinBox enRelatedNotesSpinner;
        
        private final QCheckBox mergeCheck;
        private final QCheckBox duplicateCheck;
        
        private final QCheckBox mergeCheck;
        private final QCheckBox duplicateCheck;
@@ -182,8 +184,30 @@ public class ConfigRensoNoteListPage extends QWidget {
                
                QHBoxLayout sameNotebookLayout = new QHBoxLayout();
                sameNotebookLayout.addWidget(sameNotebookSlider);
                
                QHBoxLayout sameNotebookLayout = new QHBoxLayout();
                sameNotebookLayout.addWidget(sameNotebookSlider);
-               sameNotebookLayout.addWidget(sameNotebookSpinner);      
+               sameNotebookLayout.addWidget(sameNotebookSpinner);
                
                
+               // enRelatedNotes
+               enRelatedNotesSlider = new QSlider();
+               enRelatedNotesSlider.setOrientation(Qt.Orientation.Horizontal);
+               enRelatedNotesSlider.setRange(0, 10);
+               enRelatedNotesSlider.setSingleStep(1);
+               enRelatedNotesSlider.setTickPosition(QSlider.TickPosition.TicksAbove);
+               enRelatedNotesSlider.setTickInterval(1);
+               enRelatedNotesSlider.setFocusPolicy(Qt.FocusPolicy.StrongFocus);
+               
+               enRelatedNotesSpinner = new QSpinBox();
+               enRelatedNotesSpinner.setRange(0, 10);
+               enRelatedNotesSpinner.setSingleStep(1);
+               
+               enRelatedNotesSlider.valueChanged.connect(enRelatedNotesSpinner, "setValue(int)");
+               enRelatedNotesSpinner.valueChanged.connect(enRelatedNotesSlider, "setValue(int)");
+               enRelatedNotesSpinner.setValue(Global.getENRelatedNotesWeight());
+               
+               QHBoxLayout enRelatedNotesLayout = new QHBoxLayout();
+               enRelatedNotesLayout.addWidget(enRelatedNotesSlider);
+               enRelatedNotesLayout.addWidget(enRelatedNotesSpinner);
+               
+               // 重み付け設定部分のレイアウト
                QFormLayout styleLayout = new QFormLayout();
                styleLayout.setHorizontalSpacing(10);
                styleLayout.setVerticalSpacing(30);
                QFormLayout styleLayout = new QFormLayout();
                styleLayout.setHorizontalSpacing(10);
                styleLayout.setVerticalSpacing(30);
@@ -193,6 +217,7 @@ public class ConfigRensoNoteListPage extends QWidget {
                styleLayout.addRow(tr("Renso Item Click Weight"), rensoItemClickLayout);
                styleLayout.addRow(tr("Same Tag Weight"), sameTagLayout);
                styleLayout.addRow(tr("Same Notebook Weight"), sameNotebookLayout);
                styleLayout.addRow(tr("Renso Item Click Weight"), rensoItemClickLayout);
                styleLayout.addRow(tr("Same Tag Weight"), sameTagLayout);
                styleLayout.addRow(tr("Same Notebook Weight"), sameNotebookLayout);
+               styleLayout.addRow(tr("Evernote Related Notes Integration"), enRelatedNotesLayout);
 
                QGroupBox weightingGroup = new QGroupBox(tr("Weighting"));
                weightingGroup.setLayout(styleLayout);
 
                QGroupBox weightingGroup = new QGroupBox(tr("Weighting"));
                weightingGroup.setLayout(styleLayout);
@@ -273,6 +298,13 @@ public class ConfigRensoNoteListPage extends QWidget {
        public int getSameNotebookWeight() {
                return sameNotebookSpinner.value();
        }
        public int getSameNotebookWeight() {
                return sameNotebookSpinner.value();
        }
+       
+       //*****************************************
+       //* Evernote Related Notes Integration Weight
+       //*****************************************
+       public int getENRelatedNotesWeight() {
+               return enRelatedNotesSpinner.value();
+       }
 
        //*****************************************
        //* Merge Check
 
        //*****************************************
        //* Merge Check
index fc58939..8fabaf7 100644 (file)
@@ -396,8 +396,7 @@ public class RensoNoteList extends QListWidget {
                HashMap<String, Integer> enRelatedNotes = new HashMap<String, Integer>();
                
                for (String relatedGuid : relatedNoteGuids) {
                HashMap<String, Integer> enRelatedNotes = new HashMap<String, Integer>();
                
                for (String relatedGuid : relatedNoteGuids) {
-                       // TODO 重みをとりあえず10で固定。あとで設定できるようにする。
-                       enRelatedNotes.put(relatedGuid, 10);
+                       enRelatedNotes.put(relatedGuid, Global.getENRelatedNotesWeight());
                }
                
                mergedHistory = mergeHistory(enRelatedNotes, mergedHistory);
                }
                
                mergedHistory = mergeHistory(enRelatedNotes, mergedHistory);