summaryrefslogtreecommitdiff
path: root/src/search/SearchModel.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-04-14 20:11:54 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-04-14 20:11:54 (GMT)
commit900e23128a16bd49d8929a232ac57fc7e30ad3f9 (patch)
treea5d04c86dc0ac5efb887579699e86143f12f20a8 /src/search/SearchModel.cpp
parent4c6be4ff2cc822d9c1ed36c9c88261771775dc02 (diff)
downloadpowder-900e23128a16bd49d8929a232ac57fc7e30ad3f9.zip
powder-900e23128a16bd49d8929a232ac57fc7e30ad3f9.tar.gz
Add ability to get favourites
Diffstat (limited to 'src/search/SearchModel.cpp')
-rw-r--r--src/search/SearchModel.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/search/SearchModel.cpp b/src/search/SearchModel.cpp
index e1d9849..76d0bb7 100644
--- a/src/search/SearchModel.cpp
+++ b/src/search/SearchModel.cpp
@@ -6,6 +6,7 @@
SearchModel::SearchModel():
currentSort("best"),
showOwn(false),
+ showFavourite(false),
loadedSave(NULL),
updateSaveListWorking(false),
updateSaveListFinished(false),
@@ -22,7 +23,12 @@ void * SearchModel::updateSaveListTHelper(void * obj)
void * SearchModel::updateSaveListT()
{
- vector<Save*> * tempSaveList = Client::Ref().SearchSaves((currentPage-1)*20, 20, lastQuery, currentSort=="new"?"date":"votes", showOwn, resultCount);
+ std::string category = "";
+ if(showFavourite)
+ category = "Favourites";
+ if(showOwn && Client::Ref().GetAuthUser().ID)
+ category = "by:"+Client::Ref().GetAuthUser().Username;
+ vector<Save*> * tempSaveList = Client::Ref().SearchSaves((currentPage-1)*20, 20, lastQuery, currentSort=="new"?"date":"votes", category, resultCount);
updateSaveListFinished = true;
return tempSaveList;
}
@@ -162,6 +168,15 @@ void SearchModel::notifyShowOwnChanged()
}
}
+void SearchModel::notifyShowFavouriteChanged()
+{
+ for(int i = 0; i < observers.size(); i++)
+ {
+ SearchView* cObserver = observers[i];
+ cObserver->NotifyShowOwnChanged(this);
+ }
+}
+
void SearchModel::notifySelectedChanged()
{
for(int i = 0; i < observers.size(); i++)