summaryrefslogtreecommitdiff
path: root/src/preview/PreviewController.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-04-14 18:00:24 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-04-14 18:00:24 (GMT)
commit4c6be4ff2cc822d9c1ed36c9c88261771775dc02 (patch)
tree9e07f4871b68ea5e0edc7fdfc56894c26bfba9bf /src/preview/PreviewController.cpp
parent64063fbc0f070a0731c896394e30abebd848f358 (diff)
downloadpowder-4c6be4ff2cc822d9c1ed36c9c88261771775dc02.zip
powder-4c6be4ff2cc822d9c1ed36c9c88261771775dc02.tar.gz
Graphics:: Extra icons for Report and Favourite. Client:: Get favourite status in GetSave, FavouriteSave, ReportSave, Preview:: Failure state when loading save
Diffstat (limited to 'src/preview/PreviewController.cpp')
-rw-r--r--src/preview/PreviewController.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/preview/PreviewController.cpp b/src/preview/PreviewController.cpp
index 558ccb4..a6e21c6 100644
--- a/src/preview/PreviewController.cpp
+++ b/src/preview/PreviewController.cpp
@@ -6,13 +6,17 @@
*/
#include <sstream>
+#include "client/Client.h"
#include "PreviewController.h"
#include "PreviewView.h"
#include "PreviewModel.h"
+#include "PreviewModelException.h"
+#include "dialogues/ErrorMessage.h"
#include "Controller.h"
PreviewController::PreviewController(int saveID, ControllerCallback * callback):
- HasExited(false)
+ HasExited(false),
+ saveId(saveID)
{
previewModel = new PreviewModel();
previewView = new PreviewView();
@@ -26,7 +30,14 @@ PreviewController::PreviewController(int saveID, ControllerCallback * callback):
void PreviewController::Update()
{
- previewModel->Update();
+ try
+ {
+ previewModel->Update();
+ }
+ catch (PreviewModelException & e)
+ {
+ new ErrorMessage("Error", e.what());
+ }
}
Save * PreviewController::GetSave()
@@ -44,6 +55,22 @@ void PreviewController::DoOpen()
previewModel->SetDoOpen(true);
}
+void PreviewController::Report(std::string message)
+{
+ if(Client::Ref().ReportSave(saveId, message) == RequestOkay)
+ {
+ Exit();
+ new ErrorMessage("Information", "Report submitted"); //TODO: InfoMessage
+ }
+ else
+ new ErrorMessage("Error", "Unable file report");
+}
+
+void PreviewController::FavouriteSave()
+{
+ previewModel->SetFavourite(true);
+}
+
void PreviewController::OpenInBrowser()
{
if(previewModel->GetSave())