Skip to content

Commit

Permalink
Improve consistency of error messages, use InformationMessage instead…
Browse files Browse the repository at this point in the history
… of ErrorMessage
  • Loading branch information
cxi1 authored and jacob1 committed Jul 17, 2016
1 parent 4ec4b32 commit 0c97246
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/gui/game/GameController.cpp
Expand Up @@ -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:
Expand All @@ -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
{
Expand Down
18 changes: 9 additions & 9 deletions src/gui/game/PropertyTool.cpp
Expand Up @@ -48,21 +48,21 @@ 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;
okayButton->Appearance.BorderInactive = ui::Colour(200, 200, 200);
okayButton->SetActionCallback(new OkayAction(this));
AddComponent(okayButton);
SetOkayButton(okayButton);

class PropertyChanged: public ui::DropDownAction
{
PropertyWindow * w;
Expand All @@ -81,14 +81,14 @@ sim(sim_)
property->AddOption(std::pair<std::string, int>(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);
}

Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down
13 changes: 6 additions & 7 deletions src/gui/options/OptionsView.cpp
Expand Up @@ -104,19 +104,19 @@ OptionsView::OptionsView():
airMode->AddOption(std::pair<std::string, int>("Off", 3));
airMode->AddOption(std::pair<std::string, int>("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<std::string, int> 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<std::string, int>("Vertical", 0));
Expand All @@ -134,7 +134,7 @@ OptionsView::OptionsView():
public:
EdgeModeChanged(OptionsView * v): v(v) { }
virtual void OptionChanged(ui::DropDown * sender, std::pair<std::string, int> option) { v->c->SetEdgeMode(option.second); }
};
};

edgeMode = new ui::DropDown(ui::Point(Size.X-88, 186), ui::Point(80, 16));
AddComponent(edgeMode);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -317,4 +317,3 @@ void OptionsView::OnTryExit(ExitMethod method)

OptionsView::~OptionsView() {
}

8 changes: 4 additions & 4 deletions src/gui/preview/PreviewController.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -197,4 +198,3 @@ PreviewController::~PreviewController() {
delete previewView;
delete callback;
}

0 comments on commit 0c97246

Please sign in to comment.