From 92ca8db404d606fd8817f956b523d76432ca1277 Mon Sep 17 00:00:00 2001 From: lltcggie Date: Wed, 6 Jul 2016 14:32:38 +0900 Subject: [PATCH] =?UTF-8?q?GUI=E3=81=A7Fatal=20Error=E3=81=8C=E7=99=BA?= =?UTF-8?q?=E7=94=9F=E3=81=97=E3=81=9F=E6=99=82=E3=81=AB=E8=87=AA=E5=88=86?= =?UTF-8?q?=E3=81=A7=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=82=92?= =?UTF-8?q?=E5=87=BA=E3=81=99=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/lang/english.json | 3 ++- bin/lang/japanese.json | 3 ++- waifu2x-caffe-gui/MainDialog.cpp | 15 ++++++++++++++- waifu2x-caffe-gui/MainDialog.h | 7 +++++-- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/bin/lang/english.json b/bin/lang/english.json index 1b269dd..b0a83c7 100644 --- a/bin/lang/english.json +++ b/bin/lang/english.json @@ -93,5 +93,6 @@ "Cancel":"Cancel", "IDC_STATIC_USE_GPU_NO":"Use GPU No", "IDC_RADIO_MODEL_UPCONV_RGB":"2-D illust (UpRGB Model)", -"IDC_RADIO_MODEL_UPCONV_PHOTO":"Photo (UpPhoto Model)" +"IDC_RADIO_MODEL_UPCONV_PHOTO":"Photo (UpPhoto Model)", +"MessageLogFatalError":"The fatal error has occurred.\r\nThere is a possibility the split size is too large" } diff --git a/bin/lang/japanese.json b/bin/lang/japanese.json index 5df1344..7ccecc8 100644 --- a/bin/lang/japanese.json +++ b/bin/lang/japanese.json @@ -93,5 +93,6 @@ "Cancel":"キャンセル", "IDC_STATIC_USE_GPU_NO":"使用GPU No", "IDC_RADIO_MODEL_UPCONV_RGB":"2次元イラスト (UpRGBモデル)", -"IDC_RADIO_MODEL_UPCONV_PHOTO":"写真・アニメ (UpPhotoモデル)" +"IDC_RADIO_MODEL_UPCONV_PHOTO":"写真・アニメ (UpPhotoモデル)", +"MessageLogFatalError":"致命的なエラーが発生しました。\r\n分割サイズが大きすぎる可能性があります" } diff --git a/waifu2x-caffe-gui/MainDialog.cpp b/waifu2x-caffe-gui/MainDialog.cpp index 47ce73f..a594aec 100644 --- a/waifu2x-caffe-gui/MainDialog.cpp +++ b/waifu2x-caffe-gui/MainDialog.cpp @@ -20,6 +20,7 @@ #include "CControl.h" //#include #include +#include const size_t AR_PATH_MAX(1024); @@ -37,6 +38,9 @@ const TCHAR * const MultiFileStr = TEXT("(Multi File)"); const UINT_PTR nIDEventTimeLeft = 1000; +LangStringList DialogEvent::langStringList; +HWND DialogEvent::dh; + namespace { @@ -1192,7 +1196,7 @@ UINT_PTR DialogEvent::OFNHookProcOut(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARA return 0L; } -DialogEvent::DialogEvent() : dh(nullptr), mode(Waifu2x::eWaifu2xModelTypeNoiseScale), modeStr("noise_scale"), noise_level(1), scale_ratio(2.0), scale_width(0), scale_height(0), model_dir(TEXT("models/anime_style_art_rgb")), +DialogEvent::DialogEvent() : mode(Waifu2x::eWaifu2xModelTypeNoiseScale), modeStr("noise_scale"), noise_level(1), scale_ratio(2.0), scale_width(0), scale_height(0), model_dir(TEXT("models/anime_style_art_rgb")), process("gpu"), outputExt(TEXT(".png")), inputFileExt(TEXT("png:jpg:jpeg:tif:tiff:bmp:tga")), use_tta(false), output_depth(8), crop_size(128), batch_size(1), gpu_no(0), isLastError(false), scaleType(eScaleTypeEnd), TimeLeftThread(-1), TimeLeftGetTimeThread(0), isCommandLineStart(false), tAutoMode(TEXT("none")), @@ -1626,6 +1630,9 @@ void DialogEvent::Create(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpData) SendMessage(hlang, CB_SETCURSEL, defaultListIndex, 0); } + // vIG[LogFatalFuncĂяo悤ɂ + google::InstallFailureFunction(LogFatalFunc); + SetWindowTextLang(); { @@ -3120,3 +3127,9 @@ void DialogEvent::AppSetting(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpD } } } + +void DialogEvent::LogFatalFunc() +{ + MessageBox(dh, langStringList.GetString(L"MessageLogFatalError").c_str(), langStringList.GetString(L"MessageTitleError").c_str(), MB_OK | MB_ICONERROR); + abort(); +} diff --git a/waifu2x-caffe-gui/MainDialog.h b/waifu2x-caffe-gui/MainDialog.h index 549e1cb..a89c60a 100644 --- a/waifu2x-caffe-gui/MainDialog.h +++ b/waifu2x-caffe-gui/MainDialog.h @@ -26,7 +26,9 @@ class DialogEvent { private: - HWND dh; + static HWND dh; + + static LangStringList langStringList; boost::filesystem::path exeDir; std::vector CropSizeList; @@ -94,7 +96,6 @@ private: eModelType modelType; - LangStringList langStringList; std::wstring LangName; std::atomic TimeLeftThread; @@ -153,6 +154,8 @@ private: _In_ LPARAM lParam ); + static void LogFatalFunc(); + public: DialogEvent();