Common/MsgHandler: Namespace code within the Common namespace

Closes another gap in the Common library where code isn't being
namespaced under it.
This commit is contained in:
Lioncash
2019-06-16 23:45:37 -04:00
parent e7dd46a531
commit 4f1f55093f
15 changed files with 214 additions and 143 deletions

View File

@ -6,6 +6,8 @@
#include <string>
namespace Common
{
// Message alerts
enum class MsgType
{
@ -28,30 +30,69 @@ bool MsgAlert(bool yes_no, MsgType style, const char* format, ...)
#endif
;
void SetEnableAlert(bool enable);
} // namespace Common
#ifdef _WIN32
#define SuccessAlert(format, ...) MsgAlert(false, MsgType::Information, format, __VA_ARGS__)
#define PanicAlert(format, ...) MsgAlert(false, MsgType::Warning, format, __VA_ARGS__)
#define PanicYesNo(format, ...) MsgAlert(true, MsgType::Warning, format, __VA_ARGS__)
#define AskYesNo(format, ...) MsgAlert(true, MsgType::Question, format, __VA_ARGS__)
#define CriticalAlert(format, ...) MsgAlert(false, MsgType::Critical, format, __VA_ARGS__)
#define SuccessAlert(format, ...) \
Common::MsgAlert(false, Common::MsgType::Information, format, __VA_ARGS__)
#define PanicAlert(format, ...) \
Common::MsgAlert(false, Common::MsgType::Warning, format, __VA_ARGS__)
#define PanicYesNo(format, ...) \
Common::MsgAlert(true, Common::MsgType::Warning, format, __VA_ARGS__)
#define AskYesNo(format, ...) Common::MsgAlert(true, Common::MsgType::Question, format, __VA_ARGS__)
#define CriticalAlert(format, ...) \
Common::MsgAlert(false, Common::MsgType::Critical, format, __VA_ARGS__)
// Use these macros (that do the same thing) if the message should be translated.
#define SuccessAlertT(format, ...) MsgAlert(false, MsgType::Information, format, __VA_ARGS__)
#define PanicAlertT(format, ...) MsgAlert(false, MsgType::Warning, format, __VA_ARGS__)
#define PanicYesNoT(format, ...) MsgAlert(true, MsgType::Warning, format, __VA_ARGS__)
#define AskYesNoT(format, ...) MsgAlert(true, MsgType::Question, format, __VA_ARGS__)
#define CriticalAlertT(format, ...) MsgAlert(false, MsgType::Critical, format, __VA_ARGS__)
#define SuccessAlertT(format, ...) \
Common::MsgAlert(false, Common::MsgType::Information, format, __VA_ARGS__)
#define PanicAlertT(format, ...) \
Common::MsgAlert(false, Common::MsgType::Warning, format, __VA_ARGS__)
#define PanicYesNoT(format, ...) \
Common::MsgAlert(true, Common::MsgType::Warning, format, __VA_ARGS__)
#define AskYesNoT(format, ...) \
Common::MsgAlert(true, Common::MsgType::Question, format, __VA_ARGS__)
#define CriticalAlertT(format, ...) \
Common::MsgAlert(false, Common::MsgType::Critical, format, __VA_ARGS__)
#else
#define SuccessAlert(format, ...) MsgAlert(false, MsgType::Information, format, ##__VA_ARGS__)
#define PanicAlert(format, ...) MsgAlert(false, MsgType::Warning, format, ##__VA_ARGS__)
#define PanicYesNo(format, ...) MsgAlert(true, MsgType::Warning, format, ##__VA_ARGS__)
#define AskYesNo(format, ...) MsgAlert(true, MsgType::Question, format, ##__VA_ARGS__)
#define CriticalAlert(format, ...) MsgAlert(false, MsgType::Critical, format, ##__VA_ARGS__)
#define SuccessAlert(format, ...) \
Common::MsgAlert(false, Common::MsgType::Information, format, ##__VA_ARGS__)
#define PanicAlert(format, ...) \
Common::MsgAlert(false, Common::MsgType::Warning, format, ##__VA_ARGS__)
#define PanicYesNo(format, ...) \
Common::MsgAlert(true, Common::MsgType::Warning, format, ##__VA_ARGS__)
#define AskYesNo(format, ...) \
Common::MsgAlert(true, Common::MsgType::Question, format, ##__VA_ARGS__)
#define CriticalAlert(format, ...) \
Common::MsgAlert(false, Common::MsgType::Critical, format, ##__VA_ARGS__)
// Use these macros (that do the same thing) if the message should be translated.
#define SuccessAlertT(format, ...) MsgAlert(false, MsgType::Information, format, ##__VA_ARGS__)
#define PanicAlertT(format, ...) MsgAlert(false, MsgType::Warning, format, ##__VA_ARGS__)
#define PanicYesNoT(format, ...) MsgAlert(true, MsgType::Warning, format, ##__VA_ARGS__)
#define AskYesNoT(format, ...) MsgAlert(true, MsgType::Question, format, ##__VA_ARGS__)
#define CriticalAlertT(format, ...) MsgAlert(false, MsgType::Critical, format, ##__VA_ARGS__)
#define SuccessAlertT(format, ...) \
Common::MsgAlert(false, Common::MsgType::Information, format, ##__VA_ARGS__)
#define PanicAlertT(format, ...) \
Common::MsgAlert(false, Common::MsgType::Warning, format, ##__VA_ARGS__)
#define PanicYesNoT(format, ...) \
Common::MsgAlert(true, Common::MsgType::Warning, format, ##__VA_ARGS__)
#define AskYesNoT(format, ...) \
Common::MsgAlert(true, Common::MsgType::Question, format, ##__VA_ARGS__)
#define CriticalAlertT(format, ...) \
Common::MsgAlert(false, Common::MsgType::Critical, format, ##__VA_ARGS__)
#endif