From 0c972469b8563c4d13bab7f91135f06dd32d3e8d Mon Sep 17 00:00:00 2001 From: cxi1 Date: Wed, 13 Jul 2016 10:35:47 -0700 Subject: [PATCH] Improve consistency of error messages, use InformationMessage instead of ErrorMessage --- src/gui/game/GameController.cpp | 4 ++-- src/gui/game/PropertyTool.cpp | 18 +++++++++--------- src/gui/options/OptionsView.cpp | 13 ++++++------- src/gui/preview/PreviewController.cpp | 8 ++++---- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/gui/game/GameController.cpp b/src/gui/game/GameController.cpp index d017bf70cb..f1554909d8 100644 --- a/src/gui/game/GameController.cpp +++ b/src/gui/game/GameController.cpp @@ -293,7 +293,7 @@ void GameController::PlaceSave(ui::Point position) void GameController::Install() { #if defined(MACOSX) - new InformationMessage("No Installation necessary", "You don't need to install The Powder Toy on Mac OS X", false); + new InformationMessage("No installation necessary", "You don't need to install The Powder Toy on OS X", false); #elif defined(WIN) || defined(LIN) class InstallConfirmation: public ConfirmDialogueCallback { public: @@ -304,7 +304,7 @@ void GameController::Install() { if(Client::Ref().DoInstallation()) { - new InformationMessage("Install Success", "The installation completed!", false); + new InformationMessage("Success", "Installation completed", false); } else { diff --git a/src/gui/game/PropertyTool.cpp b/src/gui/game/PropertyTool.cpp index c1aba195fc..ec53819ff7 100644 --- a/src/gui/game/PropertyTool.cpp +++ b/src/gui/game/PropertyTool.cpp @@ -48,13 +48,13 @@ tool(tool_), sim(sim_) { properties = Particle::GetProperties(); - + ui::Label * messageLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 14), "Edit property"); messageLabel->SetTextColour(style::Colour::InformationTitle); messageLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; messageLabel->Appearance.VerticalAlign = ui::Appearance::AlignTop; AddComponent(messageLabel); - + ui::Button * okayButton = new ui::Button(ui::Point(0, Size.Y-17), ui::Point(Size.X, 17), "OK"); okayButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; okayButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle; @@ -62,7 +62,7 @@ sim(sim_) okayButton->SetActionCallback(new OkayAction(this)); AddComponent(okayButton); SetOkayButton(okayButton); - + class PropertyChanged: public ui::DropDownAction { PropertyWindow * w; @@ -81,14 +81,14 @@ sim(sim_) property->AddOption(std::pair(properties[i].Name, i)); } property->SetOption(Client::Ref().GetPrefInteger("Prop.Type", 0)); - + textField = new ui::Textbox(ui::Point(8, 46), ui::Point(Size.X-16, 16), "", "[value]"); textField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; textField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle; textField->SetText(Client::Ref().GetPrefString("Prop.Value", "")); AddComponent(textField); FocusComponent(textField); - + ui::Engine::Ref().ShowWindow(this); } @@ -120,7 +120,7 @@ void PropertyWindow::SetProperty() buffer << std::hex << value.substr(1); buffer >> v; } - else + else { if(properties[property->GetOption().second].Type == StructProperty::ParticleType) { @@ -140,7 +140,7 @@ void PropertyWindow::SetProperty() } if (property->GetOption().first == "type" && (v < 0 || v >= PT_NUM || !sim->elements[v].Enabled)) { - new ErrorMessage("Could not set property", "Invalid Particle Type"); + new ErrorMessage("Could not set property", "Invalid particle type"); return; } } @@ -176,7 +176,7 @@ void PropertyWindow::SetProperty() buffer << std::hex << value.substr(1); buffer >> v; } - else + else { std::stringstream buffer(value); buffer.exceptions(std::stringstream::failbit | std::stringstream::badbit); @@ -222,7 +222,7 @@ void PropertyWindow::OnTryExit(ExitMethod method) void PropertyWindow::OnDraw() { Graphics * g = ui::Engine::Ref().g; - + g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3); g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 200, 200, 200, 255); } diff --git a/src/gui/options/OptionsView.cpp b/src/gui/options/OptionsView.cpp index cfd0a3a083..857104d4a2 100644 --- a/src/gui/options/OptionsView.cpp +++ b/src/gui/options/OptionsView.cpp @@ -104,19 +104,19 @@ OptionsView::OptionsView(): airMode->AddOption(std::pair("Off", 3)); airMode->AddOption(std::pair("No Update", 4)); airMode->SetActionCallback(new AirModeChanged(this)); - + tempLabel = new ui::Label(ui::Point(8, 146), ui::Point(Size.X-96, 16), "Air Simulation Mode"); tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle; AddComponent(tempLabel); - + class GravityModeChanged: public ui::DropDownAction { OptionsView * v; public: GravityModeChanged(OptionsView * v): v(v) { } virtual void OptionChanged(ui::DropDown * sender, std::pair option) { v->c->SetGravityMode(option.second); } - }; - + }; + gravityMode = new ui::DropDown(ui::Point(Size.X-88, 166), ui::Point(80, 16)); AddComponent(gravityMode); gravityMode->AddOption(std::pair("Vertical", 0)); @@ -134,7 +134,7 @@ OptionsView::OptionsView(): public: EdgeModeChanged(OptionsView * v): v(v) { } virtual void OptionChanged(ui::DropDown * sender, std::pair option) { v->c->SetEdgeMode(option.second); } - }; + }; edgeMode = new ui::DropDown(ui::Point(Size.X-88, 186), ui::Point(80, 16)); AddComponent(edgeMode); @@ -172,7 +172,7 @@ OptionsView::OptionsView(): { #ifdef USE_SDL #if defined(MACOSX) && !SDL_VERSION_ATLEAST(1, 2, 15) - ErrorMessage::Blocking("Error", "fullscreen doesn't work on OS X"); + ErrorMessage::Blocking("Information", "Fullscreen doesn't work on OS X"); #else v->c->SetFullscreen(sender->GetChecked()); #endif @@ -317,4 +317,3 @@ void OptionsView::OnTryExit(ExitMethod method) OptionsView::~OptionsView() { } - diff --git a/src/gui/preview/PreviewController.cpp b/src/gui/preview/PreviewController.cpp index 35748cd925..cb2bccd91f 100644 --- a/src/gui/preview/PreviewController.cpp +++ b/src/gui/preview/PreviewController.cpp @@ -4,6 +4,7 @@ #include "PreviewView.h" #include "PreviewModel.h" #include "PreviewModelException.h" +#include "gui/dialogues/InformationMessage.h" #include "gui/dialogues/ErrorMessage.h" #include "gui/login/LoginController.h" #include "Controller.h" @@ -82,7 +83,7 @@ bool PreviewController::SubmitComment(std::string comment) RequestStatus status = Client::Ref().AddComment(saveId, comment); if(status != RequestOkay) { - new ErrorMessage("Error Submitting comment", Client::Ref().GetLastError()); + new ErrorMessage("Error submitting comment", Client::Ref().GetLastError()); return false; } else @@ -125,10 +126,10 @@ void PreviewController::Report(std::string message) if(Client::Ref().ReportSave(saveId, message) == RequestOkay) { Exit(); - new ErrorMessage("Information", "Report submitted"); //TODO: InfoMessage + new InformationMessage("Information", "Report submitted", false); } else - new ErrorMessage("Error", "Unable file report: " + Client::Ref().GetLastError()); + new ErrorMessage("Error", "Unable to file report: " + Client::Ref().GetLastError()); } void PreviewController::FavouriteSave() @@ -197,4 +198,3 @@ PreviewController::~PreviewController() { delete previewView; delete callback; } -