1 #ifndef SEARCHCONTROLLER_H
2 #define SEARCHCONTROLLER_H
3 
4 #include "common/String.h"
5 
6 #include <functional>
7 
8 class SaveInfo;
9 class PreviewController;
10 class PreviewController;
11 class SearchView;
12 class SearchModel;
13 class SearchController
14 {
15 private:
16 	SearchModel * searchModel;
17 	SearchView * searchView;
18 	PreviewController * activePreview;
19 	std::function<void ()> onDone;
20 
21 	double nextQueryTime;
22 	String nextQuery;
23 	bool nextQueryDone;
24 	bool instantOpen;
25 	bool doRefresh;
26 	void removeSelectedC();
27 	void unpublishSelectedC(bool publish);
28 
29 	void OpenSaveDone();
30 public:
31 	bool HasExited;
32 	SearchController(std::function<void ()> onDone = nullptr);
33 	~SearchController();
GetView()34 	SearchView * GetView() { return searchView; }
35 	void Exit();
36 	void DoSearch(String query, bool now = false);
37 	void DoSearch2(String query);
38 	void Refresh();
39 	void SetPage(int page);
40 	void SetPageRelative(int offset);
41 	void ChangeSort();
42 	void ShowOwn(bool show);
43 	void ShowFavourite(bool show);
44 	void Selected(int saveID, bool selected);
45 	void InstantOpen(bool instant);
46 	void OpenSave(int saveID);
47 	void OpenSave(int saveID, int saveDate);
48 	void Update();
49 	void ClearSelection();
50 	void RemoveSelected();
51 	void UnpublishSelected(bool publish);
52 	void FavouriteSelected();
53 	void ReleaseLoadedSave();
54 	SaveInfo * GetLoadedSave();
55 };
56 
57 #endif // SEARCHCONTROLLER_H
58