OSDN Git Service

Added more thumbnail logic & correct search bugs.
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / gui / NoteTableModel.java
index 3961b4b..a72ac2d 100644 (file)
@@ -10,8 +10,10 @@ import com.trolltech.qt.core.QDateTime;
 import com.trolltech.qt.core.QModelIndex;\r
 import com.trolltech.qt.core.Qt;\r
 import com.trolltech.qt.core.Qt.AspectRatioMode;\r
+import com.trolltech.qt.core.Qt.TransformationMode;\r
 import com.trolltech.qt.gui.QAbstractTableModel;\r
 import com.trolltech.qt.gui.QColor;\r
+import com.trolltech.qt.gui.QImage;\r
 import com.trolltech.qt.gui.QPixmap;\r
 \r
 import cx.fbn.nevernote.Global;\r
@@ -167,12 +169,25 @@ public class NoteTableModel extends QAbstractTableModel {
                        return note.getGuid();\r
                }\r
                if (col == Global.noteTableThumbnailPosition) {\r
-                       if (listManager.getThumbnails().get(note.getGuid()) == null)\r
+                       if (!Global.enableThumbnails())\r
                                return null;\r
-                       if (Global.listView)\r
-                               return QPixmap.fromImage(listManager.getThumbnails().get(note.getGuid())).scaled(Global.smallThumbnailSize, AspectRatioMode.KeepAspectRatio);\r
-                       else\r
-                               return QPixmap.fromImage(listManager.getThumbnails().get(note.getGuid())).scaled(Global.largeThumbnailSize, AspectRatioMode.KeepAspectRatio);\r
+                       if (Global.getListView() == Global.View_List_Wide) {\r
+//                             QImage img = listManager.getThumbnail(note.getGuid());\r
+                               QPixmap img = listManager.getThumbnailPixmap(note.getGuid());\r
+                               if (img != null)\r
+                                       return img.scaled(Global.smallThumbnailSize, \r
+                                               AspectRatioMode.KeepAspectRatio, TransformationMode.SmoothTransformation);\r
+                               else\r
+                                       return null;\r
+                       }\r
+                       else {\r
+                               QImage img = listManager.getThumbnail(note.getGuid());\r
+                               if (img != null)\r
+                                       return img.scaled(Global.largeThumbnailSize,\r
+                                               AspectRatioMode.KeepAspectRatio, TransformationMode.SmoothTransformation);\r
+                               else\r
+                                       return null;\r
+                       }\r
                                \r
                }\r
                return "";\r