summaryrefslogtreecommitdiff
path: root/src/search
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-01-17 20:46:06 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-01-17 20:46:06 (GMT)
commit4a60b97c700c2f1843b7e99313554cb89fb5da4e (patch)
tree3b33ef6f74a4e8a4ff5968a81b9c4c429ccaa7c6 /src/search
parent6273089bf486bf46ad325d72c7290ebb272bd3d8 (diff)
downloadpowder-4a60b97c700c2f1843b7e99313554cb89fb5da4e.zip
powder-4a60b97c700c2f1843b7e99313554cb89fb5da4e.tar.gz
Some minor changes
Diffstat (limited to 'src/search')
-rw-r--r--src/search/Save.h41
-rw-r--r--src/search/SearchController.cpp14
-rw-r--r--src/search/SearchController.h18
-rw-r--r--src/search/SearchModel.cpp23
-rw-r--r--src/search/SearchModel.h23
-rw-r--r--src/search/SearchView.cpp10
-rw-r--r--src/search/SearchView.h13
7 files changed, 142 insertions, 0 deletions
diff --git a/src/search/Save.h b/src/search/Save.h
new file mode 100644
index 0000000..a3ef485
--- /dev/null
+++ b/src/search/Save.h
@@ -0,0 +1,41 @@
+#ifndef SAVE_H
+#define SAVE_H
+
+#include <string>
+
+using namespace std;
+
+class Save
+{
+private:
+ int id;
+ int votesUp, votesDown;
+ string userName;
+ string name;
+public:
+ Save(int _id, int _votesUp, int _votesDown, string _userName, string _name):
+ id(_id),
+ votesUp(_votesUp),
+ votesDown(_votesDown),
+ userName(_userName),
+ name(_name)
+ {
+ }
+
+ void SetName(string name){ this->name = name; }
+ string GetName(){ return name; }
+
+ void SetUserName(string userName){ this->userName = userName; }
+ string GetUserName(){ return userName; }
+
+ void SetID(int id){ this->id = id; }
+ int GetID(){ return id; }
+
+ void SetVotesUp(int votesUp){ this->votesUp = votesUp; }
+ int GetVotesUp(){ return votesUp; }
+
+ void SetVotesDown(int votesDown){ this->votesDown = votesDown; }
+ int GetVotesDown(){ return votesDown; }
+};
+
+#endif // SAVE_H
diff --git a/src/search/SearchController.cpp b/src/search/SearchController.cpp
new file mode 100644
index 0000000..cf13f2e
--- /dev/null
+++ b/src/search/SearchController.cpp
@@ -0,0 +1,14 @@
+#include "SearchController.h"
+#include "SearchModel.h"
+#include "SearchView.h"
+#include "interface/Panel.h"
+
+SearchController::SearchController()
+{
+ searchModel = new SearchModel();
+ searchView = new SearchView();
+ searchModel->AddObserver(searchView);
+
+ //Set up interface
+ //windowPanel.AddChild();
+}
diff --git a/src/search/SearchController.h b/src/search/SearchController.h
new file mode 100644
index 0000000..8755a07
--- /dev/null
+++ b/src/search/SearchController.h
@@ -0,0 +1,18 @@
+#ifndef SEARCHCONTROLLER_H
+#define SEARCHCONTROLLER_H
+
+#include "interface/Panel.h"
+#include "SearchModel.h"
+#include "SearchView.h"
+
+class SearchController
+{
+private:
+ SearchModel * searchModel;
+ SearchView * searchView;
+ ui::Panel * windowPanel;
+public:
+ SearchController();
+};
+
+#endif // SEARCHCONTROLLER_H
diff --git a/src/search/SearchModel.cpp b/src/search/SearchModel.cpp
new file mode 100644
index 0000000..63188bd
--- /dev/null
+++ b/src/search/SearchModel.cpp
@@ -0,0 +1,23 @@
+#include "SearchModel.h"
+#include "Save.h"
+
+SearchModel::SearchModel()
+{
+}
+
+void SearchModel::UpdateSaveList()
+{
+ saveList.clear();
+ notifySaveListChanged();
+ saveList.push_back(Save(1, 45, 5, "Simon", "Post logic gates"));
+ notifySaveListChanged();
+}
+
+void SearchModel::notifySaveListChanged()
+{
+ for(int i = 0; i < observers.size(); i++)
+ {
+ SearchView* cObserver = observers[i];
+ cObserver->NotifySaveListChanged(this);
+ }
+}
diff --git a/src/search/SearchModel.h b/src/search/SearchModel.h
new file mode 100644
index 0000000..0951577
--- /dev/null
+++ b/src/search/SearchModel.h
@@ -0,0 +1,23 @@
+#ifndef SEARCHMODEL_H
+#define SEARCHMODEL_H
+
+#include <vector>
+#include "Save.h"
+#include "SearchView.h"
+
+using namespace std;
+
+class SearchModel
+{
+private:
+ vector<SearchView*> observers;
+ vector<Save> saveList;
+ void notifySaveListChanged();
+public:
+ SearchModel();
+ void AddObserver(SearchView * observer){ observers.push_back(observer); }
+ void UpdateSaveList();
+ vector<Save> GetSaveList();
+};
+
+#endif // SEARCHMODEL_H
diff --git a/src/search/SearchView.cpp b/src/search/SearchView.cpp
new file mode 100644
index 0000000..4b551f3
--- /dev/null
+++ b/src/search/SearchView.cpp
@@ -0,0 +1,10 @@
+#include "SearchView.h"
+
+SearchView::SearchView()
+{
+}
+
+void SearchView::NotifySaveListChanged(SearchModel * sender)
+{
+
+}
diff --git a/src/search/SearchView.h b/src/search/SearchView.h
new file mode 100644
index 0000000..e540f21
--- /dev/null
+++ b/src/search/SearchView.h
@@ -0,0 +1,13 @@
+#ifndef SEARCHVIEW_H
+#define SEARCHVIEW_H
+
+class SearchModel;
+
+class SearchView
+{
+public:
+ void NotifySaveListChanged(SearchModel * sender);
+ SearchView();
+};
+
+#endif // SEARCHVIEW_H