OSDN Git Service

エラー/警告などのダイアログをwxLogベースに移行。
authorsirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Sun, 27 Dec 2009 07:41:44 +0000 (07:41 +0000)
committersirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Sun, 27 Dec 2009 07:41:44 +0000 (07:41 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/tpi/tpi@175 9df91469-1e22-0410-86e7-ea8537beb833

src/lychee/frm_main.cpp
src/lychee/lychee.cpp
src/lychee/lychee.h

index aa0552b..4944404 100644 (file)
@@ -302,14 +302,14 @@ void MainFrame::OnArcCreate(wxCommandEvent& e)
        this->fnArchive = wxFileName(mkDlg.cbDir->GetValue(), mkDlg.cbFileName->GetValue());\r
        if (! tpi.InitLibrary(mkDlg.afInfo[nSelected].szTPIName, this->fnArchive.GetFullPath(), mkDlg.afInfo[nSelected].llTypeId))\r
        {\r
-               ::ErrDlg(wxT("Error: InitLibrary()!"), this);\r
+               ::wxLogError(_("Error: %s!"), wxT("InitLibrary()!"));\r
                return;\r
        }\r
 \r
        // コールバック関数を設定。\r
        if (! tpi.SetCallbackProc(TPICallbackProc))\r
        {\r
-               ::ErrDlg(wxT("Error: SetCallbackProc()!"), this);\r
+               ::wxLogError(_("Error: %s!"), wxT("SetCallbackProc()!"));\r
        }\r
 \r
        // 処理を行う。\r
@@ -375,7 +375,7 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
        {\r
                procDlg.Show(false);\r
                tpi.FreeLibrary();\r
-               ::ErrDlg(_("No plug-in supporting this archive was found!"), this);\r
+               ::wxLogError(_("No plug-in supporting this archive was found!"));\r
                return;\r
        }\r
        TPICallbackProc(TPI_NOTIFY_COMMON, & piInfo);\r
@@ -391,7 +391,7 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
        {\r
                procDlg.Show(false);\r
                tpi.FreeLibrary();\r
-               ::ErrDlg(wxT("Error: OpenArchive()!"), this);\r
+               ::wxLogError(_("Error: %s!"), wxT("OpenArchive()"));\r
                return;\r
        }\r
 \r
@@ -443,13 +443,13 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
                        if (piInfo.fiInfo.fnFileName.GetPathWithSep().Find(wxT("..")) != wxNOT_FOUND)\r
                        {\r
                                piInfo.fiInfo.uDanger = TRUE;\r
-                               ::WrnDlg(_("This archive may have Directory Traversal Vulnerability(DTV) problem, and some danger files may be extracted to the unexpected system directory! You should use the \"Ignore file pathes\" option when extracting this archive.\nDanger file is:\n") + piInfo.fiInfo.szStoredName, this);\r
+                               ::wxLogWarning(_("This archive may have Directory Traversal Vulnerability(DTV) problem, and some danger files may be extracted to the unexpected system directory! You should use the \"Ignore file pathes\" option when extracting this archive.\nDanger file is:\n%s"), piInfo.fiInfo.szStoredName);\r
                        }\r
                        // 空白の連続による拡張子偽装を検査。\r
                        if (piInfo.fiInfo.fnFileName.GetFullName().Find(wxT("        ")) != wxNOT_FOUND)\r
                        {\r
                                piInfo.fiInfo.uDanger = TRUE;\r
-                               ::WrnDlg(_("This archive may contain extension-disguised files whose real extension is hidden by using many blank charactor and you may mistake that it is a \"safe\" file. Don\'t execute these files carelessly.\nDanger file is:\n") + piInfo.fiInfo.szStoredName, this);\r
+                               ::wxLogWarning(_("This archive may contain extension-disguised files whose real extension is hidden by using many blank charactor and you may mistake that it is a \"safe\" file. Don\'t execute these files carelessly.\nDanger file is:%s\n"), piInfo.fiInfo.szStoredName);\r
                        }\r
                        // Unicode制御文字を検査。\r
                        for (wxChar c = 0x200c; c <= 0x206f; c++)\r
@@ -457,7 +457,7 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
                                if (piInfo.fiInfo.fnFileName.GetFullName().Find(c) != wxNOT_FOUND)\r
                                {\r
                                        piInfo.fiInfo.uDanger = TRUE;\r
-                                       ::WrnDlg(_("This archive may contain extension-disguised files whose real extension is hidden by using Unicode control character and you may mistake that it is a \"safe\" file. Don\'t execute these files carelessly.\nDanger file is:\n") + piInfo.fiInfo.szStoredName, this);\r
+                                       ::wxLogWarning(_("This archive may contain extension-disguised files whose real extension is hidden by using Unicode control character and you may mistake that it is a \"safe\" file. Don\'t execute these files carelessly.\nDanger file is:\n"), piInfo.fiInfo.szStoredName);\r
                                }\r
                                switch (c)\r
                                {\r
@@ -478,7 +478,7 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
        {\r
                procDlg.Show(false);\r
                tpi.FreeLibrary();\r
-               ::ErrDlg(wxT("Error: GetArchiveInformation()!"), this);\r
+               ::wxLogError(_("Error: %s!"), wxT("GetArchiveInformation()"));\r
                return;\r
        }\r
        this->szComment = aiInfo.szComment;\r
@@ -486,7 +486,7 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
        // 書庫を閉じる。\r
        if (! tpi.CloseArchive())\r
        {\r
-               ::ErrDlg(wxT("Error: CloseArchive()!"), this);\r
+               ::wxLogError(_("Error: %s!"), wxT("CloseArchive()"));\r
        }\r
 \r
        // 以下、UI処理。\r
@@ -635,7 +635,7 @@ void MainFrame::OnArcExtract(wxCommandEvent& e)
                                ftFile = wxTheMimeTypesManager->GetFileTypeFromExtension(this->conf.ReadID(CONF_DEFAULT_EXT, (wxString) wxT("txt")));\r
                                if (! ftFile)\r
                                {\r
-                                       ::ErrDlg(_("Unable to get the file type!"), this);\r
+                                       ::wxLogError(_("Unable to get the file type!"));\r
                                        return;\r
                                }\r
                        }\r
@@ -652,7 +652,7 @@ void MainFrame::OnArcExtract(wxCommandEvent& e)
                swInfo.fnDestinationDirectory = MakeDirPath(wxFileName::DirName(::wxGetCwd()), szDestDirBase, true);\r
                if (! swInfo.fnDestinationDirectory.IsOk())\r
                {\r
-                       ::ErrDlg(_("Unable to make the temporary directory!"), this);\r
+                       ::wxLogError(_("Unable to make the temporary directory!"));\r
                        return;\r
                }\r
        }\r
@@ -676,7 +676,7 @@ void MainFrame::OnArcExtract(wxCommandEvent& e)
                        swInfo.fnDestinationDirectory = MakeDirPath(swInfo.fnDestinationDirectory, this->fnArchive.GetName(), true);\r
                        if (! swInfo.fnDestinationDirectory.IsOk())\r
                        {\r
-                               ::ErrDlg(_("Unable to make the destination directory!"), this);\r
+                               ::wxLogError(_("Unable to make the destination directory!"));\r
                                return;\r
                        }\r
                }\r
@@ -797,15 +797,16 @@ void MainFrame::OnArcTest(wxCommandEvent&)
        ProcessDialog procDlg;\r
        procDlg.InitDialog();\r
        procDlg.Show(true);\r
-       if (this->tpi.Command(TPI_COMMAND_TEST, & swInfo, this->fnArchive.GetFullPath(), MakeTargetFileList(this, false)))\r
+       bool bIsCorrect = this->tpi.Command(TPI_COMMAND_TEST, & swInfo, this->fnArchive.GetFullPath(), MakeTargetFileList(this, false));\r
+       procDlg.Show(false);\r
+       if (bIsCorrect)\r
        {\r
-               ::MsgDlg(_("This is a correct archive."), & procDlg, wxICON_INFORMATION);\r
+               ::wxLogMessage(_("This is a correct archive."));\r
        }\r
        else\r
        {\r
                this->ErrorCheck(tpi.nErrorCode);\r
        }\r
-       procDlg.Show(false);\r
 }\r
 \r
 void MainFrame::OnArcRepair(wxCommandEvent&)\r
@@ -971,14 +972,14 @@ int MainFrame::ErrorCheck(int nErrorCode)
        case TPI_CALLBACK_CONTINUE:\r
                break;\r
        case TPI_ERROR_D_UNSUPPORTED:\r
-               ::ErrDlg(_("Sorry, this function is not supported yet."), this);\r
+               ::wxLogError(_("Sorry, this function is not supported yet."));\r
                break;\r
        case TPI_ERROR_D_SKIPPED:\r
        case TPI_CALLBACK_CANCEL:\r
-               ::ErrDlg(_("This operation is canceled by the user."), this);\r
+               ::wxLogError(_("This operation is canceled by the user."));\r
                break;\r
        default:\r
-               ::ErrDlg(_("Error code: ") + wxString::Format(wxT("%d"), nErrorCode), this);\r
+               ::wxLogError(_("Error code: %d"), nErrorCode);\r
        }\r
        return nErrorCode;\r
 }\r
index e8a47d9..4d257f2 100644 (file)
@@ -50,7 +50,7 @@ bool Lychee::OnInit()
        frm_main->szCurrentPath = szCwd;\r
        if (! ::wxXmlResource::Get()->Load(L_DIR_S_XRC wxT("frm_main.xrc")))\r
        {\r
-               ::ErrDlg(_("Unable to find XRC!"), NULL);\r
+               ::wxLogError(_("Unable to find XRC!"));\r
                return false;\r
        }\r
 \r
index fc874fb..9281194 100644 (file)
@@ -54,10 +54,7 @@ WX_DECLARE_OBJARRAY(TPI_FILEINFO, ArrayTPI_FILEINFO);
 #define L_DIR_S_ICO L_DIR_SHR wxT("ico/")\r
 #define L_DIR_S_LOC L_DIR_SHR wxT("locale/")\r
 \r
-#define MsgDlg(msg, parent, flag) wxMessageBox(msg, wxT("Lychee"), wxCENTRE | flag, parent)\r
-#define ErrDlg(msg, parent) MsgDlg(msg, parent, wxOK | wxICON_ERROR)\r
-#define WrnDlg(msg, parent) MsgDlg(msg, parent, wxOK | wxICON_EXCLAMATION)\r
-#define AskDlg(msg, parent) MsgDlg(msg, parent, wxYES_NO | wxICON_QUESTION)\r
+#define AskDlg(msg, parent) wxMessageBox(msg, wxT("Lychee"), wxCENTRE | wxYES_NO | wxICON_QUESTION, parent)\r
 \r
 class Lychee: public wxApp\r
 {\r