summaryrefslogtreecommitdiff
path: root/src/gui/preview/PreviewModel.h
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2013-07-28 09:30:32 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2013-07-28 09:30:32 (GMT)
commit8cfead7d5a89e0b1ef5db97d5c4ee85b2526ab37 (patch)
tree575b42207cc1dc45414ed9808eed210b402e0926 /src/gui/preview/PreviewModel.h
parentddd51aed3d354fc81ec764fb72aa76f56884a840 (diff)
downloadpowder-8cfead7d5a89e0b1ef5db97d5c4ee85b2526ab37.zip
powder-8cfead7d5a89e0b1ef5db97d5c4ee85b2526ab37.tar.gz
Use async requests/RequestBroker for PreviewModel
Diffstat (limited to 'src/gui/preview/PreviewModel.h')
-rw-r--r--src/gui/preview/PreviewModel.h44
1 files changed, 5 insertions, 39 deletions
diff --git a/src/gui/preview/PreviewModel.h b/src/gui/preview/PreviewModel.h
index 1918552..8e8eabf 100644
--- a/src/gui/preview/PreviewModel.h
+++ b/src/gui/preview/PreviewModel.h
@@ -9,41 +9,16 @@
#include "client/SaveInfo.h"
#include "gui/preview/Comment.h"
#include "gui/search/Thumbnail.h"
+#include "client/requestbroker/RequestListener.h"
using namespace std;
-struct SaveData
-{
- SaveData(unsigned char * data_, int len):
- data(data_),
- length(len)
- {
- }
- unsigned char * data;
- int length;
-};
-
-struct threadInfo {
- threadInfo(int saveID_, int saveDate_):
- threadFinished(true),
- previewExited(false),
- saveID(saveID_),
- saveDate(saveDate_)
- {
- }
- bool threadFinished;
- bool previewExited;
- int saveID;
- int saveDate;
-};
-
class PreviewView;
-class PreviewModel {
+class PreviewModel: RequestListener {
bool doOpen;
- bool commentBoxEnabled;
vector<PreviewView*> observers;
SaveInfo * save;
- SaveData *saveData;
+ std::vector<unsigned char> * saveData;
std::vector<SaveComment*> * saveComments;
void notifySaveChanged();
void notifySaveCommentsChanged();
@@ -55,21 +30,11 @@ class PreviewModel {
int tSaveDate;
//
+ bool commentBoxEnabled;
bool commentsLoaded;
int commentsTotal;
int commentsPageNumber;
- threadInfo * updateSaveDataInfo;
- pthread_t updateSaveDataThread;
- static void * updateSaveDataT(void * obj);
-
- threadInfo * updateSaveInfoInfo;
- pthread_t updateSaveInfoThread;
- static void * updateSaveInfoT(void * obj);
-
- threadInfo * updateSaveCommentsInfo;
- pthread_t updateSaveCommentsThread;
- static void * updateSaveCommentsT(void * obj);
public:
PreviewModel();
SaveInfo * GetSave();
@@ -89,6 +54,7 @@ public:
bool GetDoOpen();
void SetDoOpen(bool doOpen);
void Update();
+ virtual void OnResponseReady(void * object, int identifier);
virtual ~PreviewModel();
};