Improve consistency of error messages, use InformationMessage instead of ErrorMessage
This commit is contained in:
parent
4ec4b32021
commit
0c972469b8
@ -293,7 +293,7 @@ void GameController::PlaceSave(ui::Point position)
|
|||||||
void GameController::Install()
|
void GameController::Install()
|
||||||
{
|
{
|
||||||
#if defined(MACOSX)
|
#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)
|
#elif defined(WIN) || defined(LIN)
|
||||||
class InstallConfirmation: public ConfirmDialogueCallback {
|
class InstallConfirmation: public ConfirmDialogueCallback {
|
||||||
public:
|
public:
|
||||||
@ -304,7 +304,7 @@ void GameController::Install()
|
|||||||
{
|
{
|
||||||
if(Client::Ref().DoInstallation())
|
if(Client::Ref().DoInstallation())
|
||||||
{
|
{
|
||||||
new InformationMessage("Install Success", "The installation completed!", false);
|
new InformationMessage("Success", "Installation completed", false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -48,13 +48,13 @@ tool(tool_),
|
|||||||
sim(sim_)
|
sim(sim_)
|
||||||
{
|
{
|
||||||
properties = Particle::GetProperties();
|
properties = Particle::GetProperties();
|
||||||
|
|
||||||
ui::Label * messageLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 14), "Edit property");
|
ui::Label * messageLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 14), "Edit property");
|
||||||
messageLabel->SetTextColour(style::Colour::InformationTitle);
|
messageLabel->SetTextColour(style::Colour::InformationTitle);
|
||||||
messageLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
messageLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
messageLabel->Appearance.VerticalAlign = ui::Appearance::AlignTop;
|
messageLabel->Appearance.VerticalAlign = ui::Appearance::AlignTop;
|
||||||
AddComponent(messageLabel);
|
AddComponent(messageLabel);
|
||||||
|
|
||||||
ui::Button * okayButton = new ui::Button(ui::Point(0, Size.Y-17), ui::Point(Size.X, 17), "OK");
|
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.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
okayButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
okayButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
@ -62,7 +62,7 @@ sim(sim_)
|
|||||||
okayButton->SetActionCallback(new OkayAction(this));
|
okayButton->SetActionCallback(new OkayAction(this));
|
||||||
AddComponent(okayButton);
|
AddComponent(okayButton);
|
||||||
SetOkayButton(okayButton);
|
SetOkayButton(okayButton);
|
||||||
|
|
||||||
class PropertyChanged: public ui::DropDownAction
|
class PropertyChanged: public ui::DropDownAction
|
||||||
{
|
{
|
||||||
PropertyWindow * w;
|
PropertyWindow * w;
|
||||||
@ -81,14 +81,14 @@ sim(sim_)
|
|||||||
property->AddOption(std::pair<std::string, int>(properties[i].Name, i));
|
property->AddOption(std::pair<std::string, int>(properties[i].Name, i));
|
||||||
}
|
}
|
||||||
property->SetOption(Client::Ref().GetPrefInteger("Prop.Type", 0));
|
property->SetOption(Client::Ref().GetPrefInteger("Prop.Type", 0));
|
||||||
|
|
||||||
textField = new ui::Textbox(ui::Point(8, 46), ui::Point(Size.X-16, 16), "", "[value]");
|
textField = new ui::Textbox(ui::Point(8, 46), ui::Point(Size.X-16, 16), "", "[value]");
|
||||||
textField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
textField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
textField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
textField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
textField->SetText(Client::Ref().GetPrefString("Prop.Value", ""));
|
textField->SetText(Client::Ref().GetPrefString("Prop.Value", ""));
|
||||||
AddComponent(textField);
|
AddComponent(textField);
|
||||||
FocusComponent(textField);
|
FocusComponent(textField);
|
||||||
|
|
||||||
ui::Engine::Ref().ShowWindow(this);
|
ui::Engine::Ref().ShowWindow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ void PropertyWindow::SetProperty()
|
|||||||
buffer << std::hex << value.substr(1);
|
buffer << std::hex << value.substr(1);
|
||||||
buffer >> v;
|
buffer >> v;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(properties[property->GetOption().second].Type == StructProperty::ParticleType)
|
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))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ void PropertyWindow::SetProperty()
|
|||||||
buffer << std::hex << value.substr(1);
|
buffer << std::hex << value.substr(1);
|
||||||
buffer >> v;
|
buffer >> v;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::stringstream buffer(value);
|
std::stringstream buffer(value);
|
||||||
buffer.exceptions(std::stringstream::failbit | std::stringstream::badbit);
|
buffer.exceptions(std::stringstream::failbit | std::stringstream::badbit);
|
||||||
@ -222,7 +222,7 @@ void PropertyWindow::OnTryExit(ExitMethod method)
|
|||||||
void PropertyWindow::OnDraw()
|
void PropertyWindow::OnDraw()
|
||||||
{
|
{
|
||||||
Graphics * g = ui::Engine::Ref().g;
|
Graphics * g = ui::Engine::Ref().g;
|
||||||
|
|
||||||
g->clearrect(Position.X-2, Position.Y-2, Size.X+3, Size.Y+3);
|
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);
|
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 200, 200, 200, 255);
|
||||||
}
|
}
|
||||||
|
@ -104,19 +104,19 @@ OptionsView::OptionsView():
|
|||||||
airMode->AddOption(std::pair<std::string, int>("Off", 3));
|
airMode->AddOption(std::pair<std::string, int>("Off", 3));
|
||||||
airMode->AddOption(std::pair<std::string, int>("No Update", 4));
|
airMode->AddOption(std::pair<std::string, int>("No Update", 4));
|
||||||
airMode->SetActionCallback(new AirModeChanged(this));
|
airMode->SetActionCallback(new AirModeChanged(this));
|
||||||
|
|
||||||
tempLabel = new ui::Label(ui::Point(8, 146), ui::Point(Size.X-96, 16), "Air Simulation Mode");
|
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;
|
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
AddComponent(tempLabel);
|
AddComponent(tempLabel);
|
||||||
|
|
||||||
class GravityModeChanged: public ui::DropDownAction
|
class GravityModeChanged: public ui::DropDownAction
|
||||||
{
|
{
|
||||||
OptionsView * v;
|
OptionsView * v;
|
||||||
public:
|
public:
|
||||||
GravityModeChanged(OptionsView * v): v(v) { }
|
GravityModeChanged(OptionsView * v): v(v) { }
|
||||||
virtual void OptionChanged(ui::DropDown * sender, std::pair<std::string, int> option) { v->c->SetGravityMode(option.second); }
|
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));
|
gravityMode = new ui::DropDown(ui::Point(Size.X-88, 166), ui::Point(80, 16));
|
||||||
AddComponent(gravityMode);
|
AddComponent(gravityMode);
|
||||||
gravityMode->AddOption(std::pair<std::string, int>("Vertical", 0));
|
gravityMode->AddOption(std::pair<std::string, int>("Vertical", 0));
|
||||||
@ -134,7 +134,7 @@ OptionsView::OptionsView():
|
|||||||
public:
|
public:
|
||||||
EdgeModeChanged(OptionsView * v): v(v) { }
|
EdgeModeChanged(OptionsView * v): v(v) { }
|
||||||
virtual void OptionChanged(ui::DropDown * sender, std::pair<std::string, int> option) { v->c->SetEdgeMode(option.second); }
|
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));
|
edgeMode = new ui::DropDown(ui::Point(Size.X-88, 186), ui::Point(80, 16));
|
||||||
AddComponent(edgeMode);
|
AddComponent(edgeMode);
|
||||||
@ -172,7 +172,7 @@ OptionsView::OptionsView():
|
|||||||
{
|
{
|
||||||
#ifdef USE_SDL
|
#ifdef USE_SDL
|
||||||
#if defined(MACOSX) && !SDL_VERSION_ATLEAST(1, 2, 15)
|
#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
|
#else
|
||||||
v->c->SetFullscreen(sender->GetChecked());
|
v->c->SetFullscreen(sender->GetChecked());
|
||||||
#endif
|
#endif
|
||||||
@ -317,4 +317,3 @@ void OptionsView::OnTryExit(ExitMethod method)
|
|||||||
|
|
||||||
OptionsView::~OptionsView() {
|
OptionsView::~OptionsView() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "PreviewView.h"
|
#include "PreviewView.h"
|
||||||
#include "PreviewModel.h"
|
#include "PreviewModel.h"
|
||||||
#include "PreviewModelException.h"
|
#include "PreviewModelException.h"
|
||||||
|
#include "gui/dialogues/InformationMessage.h"
|
||||||
#include "gui/dialogues/ErrorMessage.h"
|
#include "gui/dialogues/ErrorMessage.h"
|
||||||
#include "gui/login/LoginController.h"
|
#include "gui/login/LoginController.h"
|
||||||
#include "Controller.h"
|
#include "Controller.h"
|
||||||
@ -82,7 +83,7 @@ bool PreviewController::SubmitComment(std::string comment)
|
|||||||
RequestStatus status = Client::Ref().AddComment(saveId, comment);
|
RequestStatus status = Client::Ref().AddComment(saveId, comment);
|
||||||
if(status != RequestOkay)
|
if(status != RequestOkay)
|
||||||
{
|
{
|
||||||
new ErrorMessage("Error Submitting comment", Client::Ref().GetLastError());
|
new ErrorMessage("Error submitting comment", Client::Ref().GetLastError());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -125,10 +126,10 @@ void PreviewController::Report(std::string message)
|
|||||||
if(Client::Ref().ReportSave(saveId, message) == RequestOkay)
|
if(Client::Ref().ReportSave(saveId, message) == RequestOkay)
|
||||||
{
|
{
|
||||||
Exit();
|
Exit();
|
||||||
new ErrorMessage("Information", "Report submitted"); //TODO: InfoMessage
|
new InformationMessage("Information", "Report submitted", false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
new ErrorMessage("Error", "Unable file report: " + Client::Ref().GetLastError());
|
new ErrorMessage("Error", "Unable to file report: " + Client::Ref().GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewController::FavouriteSave()
|
void PreviewController::FavouriteSave()
|
||||||
@ -197,4 +198,3 @@ PreviewController::~PreviewController() {
|
|||||||
delete previewView;
|
delete previewView;
|
||||||
delete callback;
|
delete callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user