summaryrefslogtreecommitdiff
path: root/src/search/SearchModel.h
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-01-21 18:51:28 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-01-21 18:51:28 (GMT)
commit1cee908c165ead0fcecba4519d4584f3935988b5 (patch)
treec03981effdc5543fd9e50f70aab678c9631dbbcd /src/search/SearchModel.h
parent8ec6aae617525d13697d1c2a612ac37be0f341d5 (diff)
downloadpowder-1cee908c165ead0fcecba4519d4584f3935988b5.zip
powder-1cee908c165ead0fcecba4519d4584f3935988b5.tar.gz
Fix thumbnail crash, turns out SaveButton was storing a Thumbnail pointer, not a Thumbnail as I thought
Diffstat (limited to 'src/search/SearchModel.h')
-rw-r--r--src/search/SearchModel.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/search/SearchModel.h b/src/search/SearchModel.h
index a2d73cb..dbd6757 100644
--- a/src/search/SearchModel.h
+++ b/src/search/SearchModel.h
@@ -3,6 +3,7 @@
#include <vector>
#include <string>
+#include <math.h>
#include "Save.h"
#include "SearchView.h"
@@ -12,16 +13,31 @@ class SearchView;
class SearchModel
{
private:
+ string currentSort;
+ string lastQuery;
string lastError;
vector<SearchView*> observers;
vector<Save*> saveList;
+ int currentPage;
+ int resultCount;
+ bool showOwn;
void notifySaveListChanged();
+ void notifyPageChanged();
+ void notifySortChanged();
+ void notifyShowOwnChanged();
public:
SearchModel();
void AddObserver(SearchView * observer);
- void UpdateSaveList(std::string query);
+ void UpdateSaveList(int pageNumber, std::string query);
vector<Save*> GetSaveList();
string GetLastError() { return lastError; }
+ int GetPageCount() { return max(1, (int)(ceil(resultCount/16))); }
+ int GetPageNum() { return currentPage; }
+ std::string GetLastQuery() { return lastQuery; }
+ void SetSort(string sort) { currentSort = sort; UpdateSaveList(currentPage, lastQuery); notifySortChanged(); }
+ string GetSort() { return currentSort; }
+ void SetShowOwn(bool show) { showOwn = show; UpdateSaveList(currentPage, lastQuery); notifyShowOwnChanged(); }
+ bool GetShowOwn() { return showOwn; }
};
#endif // SEARCHMODEL_H