Simplify ErrorDialog.
This commit is contained in:
@@ -688,8 +688,7 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
// throw up a pretty error dialog
|
||||
ErrorDialog *d = MakeErrorDialog();
|
||||
d->SetErrorText(g_sErrorString);
|
||||
d->ShowError();
|
||||
d->ShowError( g_sErrorString );
|
||||
delete d;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,16 +2,11 @@
|
||||
#define ERROR_DIALOG_H
|
||||
|
||||
class ErrorDialog {
|
||||
CString ErrorText;
|
||||
|
||||
public:
|
||||
void SetErrorText(const CString &error) { ErrorText = error; }
|
||||
CString GetErrorText() const { return ErrorText; }
|
||||
|
||||
/* This is used for showing errors from exceptions, so it might be used
|
||||
* before SDL has been initialized (or SDL may have failed to init); don't
|
||||
* use SDL. If the window has been opened, it'll be hidden or closed. */
|
||||
virtual void ShowError() = 0;
|
||||
virtual void ShowError( const CString &error ) = 0;
|
||||
virtual ~ErrorDialog() { }
|
||||
};
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "../../resource.h"
|
||||
|
||||
#include "../../archutils/Win32/GotoURL.h"
|
||||
#include "../../archutils/Win32/AppInstance.h"
|
||||
|
||||
#include "ErrorDialog_Win32.h"
|
||||
|
||||
@@ -90,10 +91,11 @@ BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
}
|
||||
|
||||
|
||||
void ErrorDialog_Win32::ShowError()
|
||||
void ErrorDialog_Win32::ShowError( const CString &error )
|
||||
{
|
||||
g_sErrorString = GetErrorText();
|
||||
g_sErrorString = error;
|
||||
// throw up a pretty error dialog
|
||||
AppInstance handle;
|
||||
DialogBox(handle.Get(), MAKEINTRESOURCE(IDD_ERROR_DIALOG),
|
||||
NULL, ErrorWndProc);
|
||||
}
|
||||
|
||||
@@ -2,14 +2,11 @@
|
||||
#define ERROR_DIALOG_WIN32_H
|
||||
|
||||
#include "ErrorDialog.h"
|
||||
#include "../../archutils/Win32/AppInstance.h"
|
||||
|
||||
class ErrorDialog_Win32: public ErrorDialog
|
||||
{
|
||||
AppInstance handle;
|
||||
|
||||
public:
|
||||
void ShowError();
|
||||
void ShowError( const CString &error );
|
||||
};
|
||||
|
||||
#undef ARCH_ERROR_DIALOG
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
class ErrorDialog_null: public ErrorDialog
|
||||
{
|
||||
public:
|
||||
void ShowError() { }
|
||||
void ShowError( const CString &error ) { }
|
||||
};
|
||||
|
||||
#undef ARCH_ERROR_DIALOG
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "../../global.h"
|
||||
#include "ErrorDialog_stdout.h"
|
||||
|
||||
void ErrorDialog_stdout::ShowError()
|
||||
void ErrorDialog_stdout::ShowError( const CString &error )
|
||||
{
|
||||
/* Simplest "dialog" ever. */
|
||||
printf("Error: %s\n", GetErrorText().c_str());
|
||||
printf("Error: %s\n", error.c_str());
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
class ErrorDialog_stdout: public ErrorDialog
|
||||
{
|
||||
public:
|
||||
void ShowError();
|
||||
void ShowError( const CString &error );
|
||||
};
|
||||
|
||||
#undef ARCH_ERROR_DIALOG
|
||||
|
||||
Reference in New Issue
Block a user