hgcacheproxymodel/tsrc/unit/bmhelper.cpp
changeset 8 15f034b8a3b5
parent 3 c863538fcbb6
--- a/hgcacheproxymodel/tsrc/unit/bmhelper.cpp	Fri Jun 11 14:43:11 2010 +0300
+++ b/hgcacheproxymodel/tsrc/unit/bmhelper.cpp	Wed Jun 23 19:25:46 2010 +0300
@@ -13,7 +13,7 @@
 *
 * Description:
 *
-*  Version     : %version: 5 %
+*  Version     : %version: 6 %
 */
 #include "bmhelper.h"
 #include <QDebug>
@@ -122,6 +122,22 @@
     return mBuffer.count();
 }
 
+void BMHelper::resizeCache(int newSize)
+{
+    int diff = totalSize() - newSize;
+    
+    while (diff != 0){
+        if (diff >0){
+            remove(mBuffer.count()-1);
+            diff--;
+        }else{
+            insert(mBuffer.count());
+            diff++;
+        }
+    }
+    
+}
+
 void BMHelper::remove(int pos)
 {
     if ( pos <0 || pos > mBuffer.count()){