From: Mikko Rasa Date: Sun, 6 Oct 2013 16:50:30 +0000 (+0300) Subject: Fix the cocoa error dialog so that it actually compiles X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=010c91931c89fe2b6271a7395a0cb17279c704a2;p=libs%2Fgui.git Fix the cocoa error dialog so that it actually compiles --- diff --git a/source/graphics/cocoa/cocoaerrordialog.h b/source/graphics/cocoa/cocoaerrordialog.h new file mode 100644 index 0000000..7a03018 --- /dev/null +++ b/source/graphics/cocoa/cocoaerrordialog.h @@ -0,0 +1,14 @@ +#ifndef MSP_GRAPHICS_COCOAERRORDIALOG_H_ +#define MSP_GRAPHICS_COCOAERRORDIALOG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +void run_alert(const char *, const char *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/source/graphics/cocoa/cocoaerrordialog.m b/source/graphics/cocoa/cocoaerrordialog.m new file mode 100644 index 0000000..eb82d57 --- /dev/null +++ b/source/graphics/cocoa/cocoaerrordialog.m @@ -0,0 +1,13 @@ +#import +#import +#include "cocoaerrordialog.h" + +void run_alert(const char *type, const char *what) +{ + NSString *message = [[[NSString stringWithUTF8String:type] stringByAppendingString:@": "] + stringByAppendingString:[NSString stringWithUTF8String:what]]; + NSAlert *alert = [NSAlert alertWithMessageText:@"Uncaught exception" + defaultButton:nil alternateButton:nil otherButton:nil + informativeTextWithFormat:@"%@", message]; + [alert runModal]; +} diff --git a/source/graphics/cocoa/errordialog.cpp b/source/graphics/cocoa/errordialog.cpp index ec44461..e923586 100644 --- a/source/graphics/cocoa/errordialog.cpp +++ b/source/graphics/cocoa/errordialog.cpp @@ -1,14 +1,17 @@ +#include +#include +#include +#include "cocoaerrordialog.h" #include "errordialog.h" using namespace std; -extern "C" void run_alert(const char *, const char *); - namespace Msp { namespace Graphics { bool ErrorDialog::report_uncaught_exception(const exception &e) const { + (void)display; if(Application::get_data()) { string type = Debug::demangle(typeid(e).name()); diff --git a/source/graphics/cocoa/errordialog.m b/source/graphics/cocoa/errordialog.m deleted file mode 100644 index 2b6b3c6..0000000 --- a/source/graphics/cocoa/errordialog.m +++ /dev/null @@ -1,16 +0,0 @@ -#import -#import - -// The function gets incorrect linkage without a prototype -void run_alert(const char *, const char *); - -void run_alert(const char *type, const char *what) -{ - NSString *message = [[[NSString stringWithUTF8String:type] stringByAppendingString:@": "] - stringByAppendingString:[NSString stringWithUTF8String:what]]; - NSAlert *alert = [NSAlert alertWithMessageText:@"Uncaught exception" - defaultButton:nil alternateButton:nil otherButton:nil - informativeTextWithFormat:@"%@", message]; - [alert runModal]; -} -