diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-28 19:56:13 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-28 19:56:13 (GMT) |
| commit | 7c53ca7799832920066c23cfad2f1d7fa82233c7 (patch) | |
| tree | a29fab25e584fb7f0d3705f13ac0a97abaae122a /src/search | |
| parent | 28d4aecb6c31ac1e450c1f073a0db13437d9d5d1 (diff) | |
| download | powder-7c53ca7799832920066c23cfad2f1d7fa82233c7.zip powder-7c53ca7799832920066c23cfad2f1d7fa82233c7.tar.gz | |
Voting, fix save browser
Diffstat (limited to 'src/search')
| -rw-r--r-- | src/search/Save.cpp | 17 | ||||
| -rw-r--r-- | src/search/Save.h | 7 | ||||
| -rw-r--r-- | src/search/SearchModel.cpp | 2 | ||||
| -rw-r--r-- | src/search/SearchView.cpp | 2 |
4 files changed, 21 insertions, 7 deletions
diff --git a/src/search/Save.cpp b/src/search/Save.cpp index 5bcb0e9..47ac61a 100644 --- a/src/search/Save.cpp +++ b/src/search/Save.cpp @@ -11,7 +11,7 @@ Save::Save(Save & save) : userName(save.userName), name(save.name), Description(save.Description), date( save.date), Published(save.Published), id(save.id), votesUp( - save.votesUp), votesDown(save.votesDown), data(NULL) { + save.votesUp), votesDown(save.votesDown), data(NULL), vote(save.vote) { if (save.data) { std::cout << data << " " << save.data << std::endl; data = (unsigned char *) malloc(save.dataLength); @@ -24,14 +24,14 @@ Save::Save(int _id, int _date, int _votesUp, int _votesDown, string _userName, string _name) : id(_id), votesUp(_votesUp), votesDown(_votesDown), userName(_userName), name( _name), Description("No description provided"), date(_date), Published( - true), data(NULL) { + true), data(NULL), vote(0) { } -Save::Save(int _id, int date_, int _votesUp, int _votesDown, string _userName, +Save::Save(int _id, int date_, int _votesUp, int _votesDown, int _vote, string _userName, string _name, string description_, bool published_) : id(_id), votesUp(_votesUp), votesDown(_votesDown), userName(_userName), name( _name), Description(description_), date(date_), Published( - published_), data(NULL) { + published_), data(NULL), vote(_vote) { } Save::~Save() @@ -49,6 +49,15 @@ string Save::GetName() { return name; } +void Save::SetVote(int vote) +{ + this->vote = vote; +} +int Save::GetVote() +{ + return vote; +} + void Save::SetUserName(string userName) { this->userName = userName; } diff --git a/src/search/Save.h b/src/search/Save.h index 42cbb62..5c471e1 100644 --- a/src/search/Save.h +++ b/src/search/Save.h @@ -21,7 +21,7 @@ public: Save(int _id, int _date, int _votesUp, int _votesDown, string _userName, string _name); - Save(int _id, int date_, int _votesUp, int _votesDown, string _userName, string _name, string description_, bool published_); + Save(int _id, int date_, int _votesUp, int _votesDown, int _vote, string _userName, string _name, string description_, bool published_); ~Save(); @@ -30,6 +30,8 @@ public: string Description; + int vote; + bool Published; void SetName(string name); @@ -41,6 +43,9 @@ public: void SetID(int id); int GetID(); + void SetVote(int vote); + int GetVote(); + void SetVotesUp(int votesUp); int GetVotesUp(); diff --git a/src/search/SearchModel.cpp b/src/search/SearchModel.cpp index d9a4a1e..d740620 100644 --- a/src/search/SearchModel.cpp +++ b/src/search/SearchModel.cpp @@ -19,7 +19,7 @@ void SearchModel::UpdateSaveList(int pageNumber, std::string query) resultCount = 0; notifySaveListChanged(); notifyPageChanged(); - vector<Save*> * tempSaveList = Client::Ref().SearchSaves((pageNumber-1)*12, 12, query, currentSort, resultCount); + vector<Save*> * tempSaveList = Client::Ref().SearchSaves((pageNumber-1)*20, 20, query, currentSort, resultCount); saveList = *tempSaveList; delete tempSaveList; if(!saveList.size()) diff --git a/src/search/SearchView.cpp b/src/search/SearchView.cpp index 8e5360f..b1d9765 100644 --- a/src/search/SearchView.cpp +++ b/src/search/SearchView.cpp @@ -141,7 +141,7 @@ void SearchView::NotifyPageChanged(SearchModel * sender) void SearchView::NotifySaveListChanged(SearchModel * sender) { int i = 0; - int buttonWidth, buttonHeight, saveX = 0, saveY = 0, savesX = 4, savesY = 3, buttonPadding = 2; + int buttonWidth, buttonHeight, saveX = 0, saveY = 0, savesX = 5, savesY = 4, buttonPadding = 2; int buttonAreaWidth, buttonAreaHeight, buttonXOffset, buttonYOffset; vector<Save*> saves = sender->GetSaveList(); |
