diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2019-01-11 10:21:10 -0200 |
---|---|---|
committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2019-01-11 10:21:10 -0200 |
commit | f2fe2a96dbc2db59accf71e7ef5e6b5e4a9b7d2e (patch) | |
tree | 337ce62e492569e37f652788d0c19f2ea01ca80d /Project/main.cpp | |
parent | fc820e8a03cd670835ac7fc7434226fad1c8e444 (diff) | |
parent | aad89bf4d16d45c0790bd2fc010d9ec06cc35430 (diff) | |
download | PSP.git-f2fe2a96dbc2db59accf71e7ef5e6b5e4a9b7d2e.tar.gz PSP.git-f2fe2a96dbc2db59accf71e7ef5e6b5e4a9b7d2e.tar.xz PSP.git-f2fe2a96dbc2db59accf71e7ef5e6b5e4a9b7d2e.zip |
Merge branch 'wip/induction-motor' of https://github.com/Thales1330/PSP into wip/induction-motor
Diffstat (limited to 'Project/main.cpp')
-rw-r--r-- | Project/main.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/Project/main.cpp b/Project/main.cpp index 536ef57..61b7fc2 100644 --- a/Project/main.cpp +++ b/Project/main.cpp @@ -1,9 +1,10 @@ #include <wx/app.h> +#include <wx/cmdline.h> #include <wx/event.h> #include <wx/image.h> +#include <wx/msgdlg.h> #include <wx/stdpaths.h> #include <wx/textfile.h> -#include <wx/cmdline.h> #include "MainFrame.h" #include "PropertiesData.h" @@ -76,13 +77,23 @@ class MainApp : public wxApp void LoadCatalogs(wxLocale* locale, PropertiesData* propertiesData) { - locale->Init(propertiesData->GetGeneralPropertiesData().language, wxLOCALE_DONT_LOAD_DEFAULT); + if(!locale->Init(propertiesData->GetGeneralPropertiesData().language, wxLOCALE_DONT_LOAD_DEFAULT)) { + wxMessageDialog msgDialog(NULL, _("This language is not supported by the system."), _("Error"), + wxOK | wxCENTRE | wxICON_ERROR); + msgDialog.ShowModal(); + } wxFileName fn(wxStandardPaths::Get().GetExecutablePath()); wxString langPath = fn.GetPath() + wxFileName::DirName("\\..\\data\\lang", wxPATH_WIN).GetPath(); locale->AddCatalogLookupPathPrefix(langPath); - // Load translation catalogs. - locale->AddCatalog(wxT("pt_BR"), wxLANGUAGE_PORTUGUESE_BRAZILIAN); + //pt_BR + if(propertiesData->GetGeneralPropertiesData().language == wxLANGUAGE_PORTUGUESE_BRAZILIAN) { + if(!locale->AddCatalog(wxT("pt_BR"))) { + wxMessageDialog msgDialog(NULL, _("Fail to load brazilian portuguese language catalog."), _("Error"), + wxOK | wxCENTRE | wxICON_ERROR); + msgDialog.ShowModal(); + } + } } virtual bool OnInit() @@ -104,15 +115,13 @@ class MainApp : public wxApp if(cmdLineParser.Parse() == 0) { wxCmdLineArgs args = cmdLineParser.GetArguments(); for(auto it = args.begin(), itEnd = args.end(); it != itEnd; ++it) { - if(it->GetKind() == wxCMD_LINE_PARAM) { - openFilePath = it->GetStrVal(); - } + if(it->GetKind() == wxCMD_LINE_PARAM) { openFilePath = it->GetStrVal(); } } } MainFrame* mainFrame = new MainFrame(NULL, locale, propertiesData, openFilePath); - #ifdef __WXMSW__ +#ifdef __WXMSW__ mainFrame->SetIcon(wxICON(aaaaprogicon)); - #endif +#endif SetTopWindow(mainFrame); return GetTopWindow()->Show(); } |