OSDN Git Service

loggerを修正した
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / gui / RensoNoteList.java
index 5307edb..6a1f2fe 100644 (file)
@@ -28,6 +28,7 @@ import java.util.Set;
 
 import com.evernote.edam.type.Note;
 import com.trolltech.qt.QThread;
+import com.trolltech.qt.core.QByteArray;
 import com.trolltech.qt.core.QFile;
 import com.trolltech.qt.core.QSize;
 import com.trolltech.qt.core.Qt.MouseButton;
@@ -41,6 +42,7 @@ import com.trolltech.qt.gui.QMenu;
 import cx.fbn.nevernote.Global;
 import cx.fbn.nevernote.NeverNote;
 import cx.fbn.nevernote.sql.DatabaseConnection;
+import cx.fbn.nevernote.threads.CounterRunner;
 import cx.fbn.nevernote.threads.ENRelatedNotesRunner;
 import cx.fbn.nevernote.threads.ENThumbnailRunner;
 import cx.fbn.nevernote.threads.SyncRunner;
@@ -81,13 +83,15 @@ public class RensoNoteList extends QListWidget {
                this.guid = new String();
                mergedHistory = new HashMap<String, Integer>();
                enRelatedNotesCache = new HashMap<String, List<String>>();
-               this.enRelatedNotesRunner = new ENRelatedNotesRunner(this.syncRunner, this.logger);
+               this.enRelatedNotesRunner = new ENRelatedNotesRunner(this.syncRunner, "enRelatedNotesRunner.log");
                this.enRelatedNotesRunner.enRelatedNotesSignal.getENRelatedNotesFinished.connect(this, "enRelatedNotesComplete()");
                this.enRelatedNotesRunner.limitSignal.rateLimitReached.connect(parent, "informRateLimit(Integer)");
                this.enRelatedNotesThread = new QThread(enRelatedNotesRunner, "ENRelatedNotes Thread");
                this.getEnRelatedNotesThread().start();
                
-               this.enThumbnailRunner = new ENThumbnailRunner(this.logger);
+               this.enThumbnailRunner = new ENThumbnailRunner("enThumbnailRunner.log", CounterRunner.NOTEBOOK, 
+                                       Global.getDatabaseUrl(), Global.getIndexDatabaseUrl(), Global.getResourceDatabaseUrl(), Global.getBehaviorDatabaseUrl(),
+                                       Global.getDatabaseUserid(), Global.getDatabaseUserPassword(), Global.cipherPassword);
                this.enThumbnailRunner.enThumbnailSignal.getENThumbnailFinished.connect(this, "enThumbnailComplete(String)");
                this.enThumbnailRunner.limitSignal.rateLimitReached.connect(parent, "informRateLimit(Integer)");
                this.enThumbnailThread = new QThread(enThumbnailRunner, "ENThumbnail Thread");
@@ -322,12 +326,14 @@ public class RensoNoteList extends QListWidget {
                                // 存在していて、かつ関連度0でなければノート情報を取得して連想ノートリストに追加
                                if (isNoteActive && maxNum > 0) {
                                        // Evernoteサムネイルが取得済みか確認。未取得ならサムネイル取得スレッドにキュー
-                                       // TODO 今はとりあえずresディレクトリを確認。あとでデータベースにカラムを追加する
                                        if (Global.isConnected) {
                                                String thumbnailName = Global.getFileManager().getResDirPath("enThumbnail-" + maxGuid + ".png");
                                                QFile thumbnail = new QFile(thumbnailName);
-                                               if (!thumbnail.exists()) {
-                                                       enThumbnailRunner.addGuid(maxGuid);
+                                               if (!thumbnail.exists()) {      // Evernoteサムネイルがファイルとして存在しない
+                                                       QByteArray data = conn.getNoteTable().getENThumbnail(maxGuid);
+                                                       if (data == null) {     // Evernoteサムネイル未取得
+                                                               enThumbnailRunner.addGuid(maxGuid);
+                                                       }
                                                }
                                        }