diff --git a/src/client/Client.cpp b/src/client/Client.cpp index 1e76ade95..b508d9fde 100644 --- a/src/client/Client.cpp +++ b/src/client/Client.cpp @@ -1356,7 +1356,6 @@ LoginStatus Client::Login(std::string username, std::string password, User & use RequestStatus Client::DeleteSave(int saveID) { lastError = ""; - std::vector * tags = NULL; std::stringstream urlStream; char * data = NULL; int dataStatus, dataLength; @@ -1408,11 +1407,10 @@ failure: RequestStatus Client::AddComment(int saveID, std::string comment) { lastError = ""; - std::vector * tags = NULL; std::stringstream urlStream; char * data = NULL; int dataStatus, dataLength; - urlStream << "http://" << SERVER << "/Browse/Comments.json?ID=" << saveID << "&Key=" << authUser.SessionKey; + urlStream << "http://" << SERVER << "/Browse/Comments.json?ID=" << saveID; if(authUser.ID) { std::stringstream userIDStream; @@ -1469,7 +1467,6 @@ failure: RequestStatus Client::FavouriteSave(int saveID, bool favourite) { lastError = ""; - std::vector * tags = NULL; std::stringstream urlStream; char * data = NULL; int dataStatus, dataLength; @@ -1526,7 +1523,6 @@ failure: RequestStatus Client::ReportSave(int saveID, std::string message) { lastError = ""; - std::vector * tags = NULL; std::stringstream urlStream; char * data = NULL; int dataStatus, dataLength; @@ -1585,7 +1581,6 @@ failure: RequestStatus Client::UnpublishSave(int saveID) { lastError = ""; - std::vector * tags = NULL; std::stringstream urlStream; char * data = NULL; int dataStatus, dataLength; diff --git a/src/gui/localbrowser/LocalBrowserController.cpp b/src/gui/localbrowser/LocalBrowserController.cpp index a1a01ed40..4b927e815 100644 --- a/src/gui/localbrowser/LocalBrowserController.cpp +++ b/src/gui/localbrowser/LocalBrowserController.cpp @@ -50,6 +50,7 @@ void LocalBrowserController::RemoveSelected() desc << "Are you sure you want to delete " << browserModel->GetSelected().size() << " stamp"; if(browserModel->GetSelected().size()>1) desc << "s"; + desc << "?"; new ConfirmPrompt("Delete stamps", desc.str(), new RemoveSelectedConfirmation(this)); } diff --git a/src/gui/preview/PreviewController.cpp b/src/gui/preview/PreviewController.cpp index 30622c2a2..3e6dd387e 100644 --- a/src/gui/preview/PreviewController.cpp +++ b/src/gui/preview/PreviewController.cpp @@ -141,10 +141,17 @@ void PreviewController::FavouriteSave() { if(previewModel->GetSave() && Client::Ref().GetAuthUser().ID) { - if(previewModel->GetSave()->Favourite) - previewModel->SetFavourite(false); - else - previewModel->SetFavourite(true); + try + { + if(previewModel->GetSave()->Favourite) + previewModel->SetFavourite(false); + else + previewModel->SetFavourite(true); + } + catch (PreviewModelException & e) + { + new ErrorMessage("Error", e.what()); + } } } diff --git a/src/gui/preview/PreviewModel.cpp b/src/gui/preview/PreviewModel.cpp index 8d608cf2e..07c4f1fbe 100644 --- a/src/gui/preview/PreviewModel.cpp +++ b/src/gui/preview/PreviewModel.cpp @@ -99,8 +99,12 @@ void PreviewModel::SetFavourite(bool favourite) { if(save) { - Client::Ref().FavouriteSave(save->id, favourite); - save->Favourite = favourite; + if (Client::Ref().FavouriteSave(save->id, favourite) == RequestOkay) + save->Favourite = favourite; + else if (favourite) + throw PreviewModelException("Error, could not fav. the save, are you logged in?"); + else + throw PreviewModelException("Error, could not unfav. the save, are you logged in?"); notifySaveChanged(); } } diff --git a/src/gui/preview/PreviewView.cpp b/src/gui/preview/PreviewView.cpp index 5453c5075..f78b9417c 100644 --- a/src/gui/preview/PreviewView.cpp +++ b/src/gui/preview/PreviewView.cpp @@ -427,7 +427,6 @@ void PreviewView::NotifySaveChanged(PreviewModel * sender) if(savePreview && savePreview->Buffer && !(savePreview->Width == XRES/2 && savePreview->Width == YRES/2)) { - int newSizeX, newSizeY; pixel * oldData = savePreview->Buffer; float factorX = ((float)XRES/2)/((float)savePreview->Width); float factorY = ((float)YRES/2)/((float)savePreview->Height); diff --git a/src/gui/search/SearchController.cpp b/src/gui/search/SearchController.cpp index b4b6569ed..312e8c55d 100644 --- a/src/gui/search/SearchController.cpp +++ b/src/gui/search/SearchController.cpp @@ -222,6 +222,7 @@ void SearchController::RemoveSelected() desc << "Are you sure you want to delete " << searchModel->GetSelected().size() << " save"; if(searchModel->GetSelected().size()>1) desc << "s"; + desc << "?"; new ConfirmPrompt("Delete saves", desc.str(), new RemoveSelectedConfirmation(this)); } @@ -274,6 +275,7 @@ void SearchController::UnpublishSelected() desc << "Are you sure you want to hide " << searchModel->GetSelected().size() << " save"; if(searchModel->GetSelected().size()>1) desc << "s"; + desc << "?"; new ConfirmPrompt("Unpublish saves", desc.str(), new UnpublishSelectedConfirmation(this)); } @@ -289,13 +291,14 @@ void SearchController::unpublishSelectedC() for(int i = 0; i < saves.size(); i++) { std::stringstream saveID; - saveID << "Hiding save [" << saves[i] << "] ..."; + saveID << "Hiding save [" << saves[i] << "]"; notifyStatus(saveID.str()); if(Client::Ref().UnpublishSave(saves[i])!=RequestOkay) { std::stringstream saveIDF; - saveIDF << "\boFailed to hide [" << saves[i] << "] ..."; - notifyStatus(saveIDF.str()); + saveIDF << "\boFailed to hide [" << saves[i] << "], is this save yours?"; + notifyError(saveIDF.str()); + return false; } notifyProgress((float(i+1)/float(saves.size())*100)); } @@ -321,13 +324,14 @@ void SearchController::FavouriteSelected() for(int i = 0; i < saves.size(); i++) { std::stringstream saveID; - saveID << "Favouring save [" << saves[i] << "] ..."; + saveID << "Favouring save [" << saves[i] << "]"; notifyStatus(saveID.str()); if(Client::Ref().FavouriteSave(saves[i], true)!=RequestOkay) { std::stringstream saveIDF; - saveIDF << "\boFailed to favourite [" << saves[i] << "] ..."; - notifyStatus(saveIDF.str()); + saveIDF << "\boFailed to favourite [" << saves[i] << "], are you logged in?"; + notifyError(saveIDF.str()); + return false; } notifyProgress((float(i+1)/float(saves.size())*100)); } @@ -345,13 +349,14 @@ void SearchController::FavouriteSelected() for(int i = 0; i < saves.size(); i++) { std::stringstream saveID; - saveID << "Unfavouring save [" << saves[i] << "] ..."; + saveID << "Unfavouring save [" << saves[i] << "]"; notifyStatus(saveID.str()); if(Client::Ref().FavouriteSave(saves[i], false)!=RequestOkay) { std::stringstream saveIDF; - saveIDF << "\boFailed to remove [" << saves[i] << "] ..."; - notifyStatus(saveIDF.str()); + saveIDF << "\boFailed to unfavourite [" << saves[i] << "], are you logged in?"; + notifyError(saveIDF.str()); + return false; } notifyProgress((float(i+1)/float(saves.size())*100)); } diff --git a/src/tasks/TaskWindow.cpp b/src/tasks/TaskWindow.cpp index f780d32f1..7848e815a 100644 --- a/src/tasks/TaskWindow.cpp +++ b/src/tasks/TaskWindow.cpp @@ -40,12 +40,14 @@ void TaskWindow::NotifyStatus(Task * task) void TaskWindow::NotifyError(Task * task) { new ErrorMessage("Error", task->GetError()); + done = true; } void TaskWindow::NotifyDone(Task * task) { if(closeOnDone) Exit(); + done = true; } void TaskWindow::Exit() @@ -78,6 +80,8 @@ void TaskWindow::OnTick(float dt) if(intermediatePos>100.0f) intermediatePos = 0.0f; task->Poll(); + if (done) + Exit(); } void TaskWindow::OnDraw()