Added ArchHooks_darwin and moved the IgnoreMessage and MessageIsIgnored methods to the superclass, ArchHooks.

This commit is contained in:
Steve Checkoway
2003-07-15 09:44:02 +00:00
parent 718f3e4e6b
commit 7f906b4271
7 changed files with 92 additions and 30 deletions
@@ -1,4 +1,27 @@
#include "global.h" #include "global.h"
#include "ArchHooks.h" #include "ArchHooks.h"
#include "PrefsManager.h"
#include "RageUtil.h"
ArchHooks *HOOKS = NULL; ArchHooks *HOOKS = NULL;
bool ArchHooks::MessageIsIgnored( CString ID )
{
vector<CString> list;
split( PREFSMAN->m_sIgnoredMessageWindows, ",", list );
for( unsigned i = 0; i < list.size(); ++i )
if( !ID.CompareNoCase(list[i]) )
return true;
return false;
}
void ArchHooks::IgnoreMessage( CString ID )
{
if( MessageIsIgnored(ID) )
return;
vector<CString> list;
split( PREFSMAN->m_sIgnoredMessageWindows, ",", list );
list.push_back( ID );
PREFSMAN->m_sIgnoredMessageWindows = join( ",", list );
PREFSMAN->SaveGlobalPrefsToDisk();
}
+3
View File
@@ -17,6 +17,9 @@
*/ */
class ArchHooks class ArchHooks
{ {
bool MessageIsIgnored( CString ID );
void IgnoreMessage( CString ID );
public: public:
/* This receives all logs. 'important' is set for Warn and Info. */ /* This receives all logs. 'important' is set for Warn and Info. */
virtual void Log(CString str, bool important) { } virtual void Log(CString str, bool important) { }
@@ -39,27 +39,6 @@ void ArchHooks_Win32::DumpDebugInfo()
SearchForDebugInfo(); SearchForDebugInfo();
} }
bool ArchHooks_Win32::MessageIsIgnored( CString ID )
{
vector<CString> list;
split( PREFSMAN->m_sIgnoredMessageWindows, ",", list );
for( unsigned i = 0; i < list.size(); ++i )
if( !ID.CompareNoCase(list[i]) )
return true;
return false;
}
void ArchHooks_Win32::IgnoreMessage( CString ID )
{
if( MessageIsIgnored(ID) )
return;
vector<CString> list;
split( PREFSMAN->m_sIgnoredMessageWindows, ",", list );
list.push_back( ID );
PREFSMAN->m_sIgnoredMessageWindows = join( ",", list );
PREFSMAN->SaveGlobalPrefsToDisk();
}
static CString g_sMessage; static CString g_sMessage;
static bool g_AllowHush; static bool g_AllowHush;
static bool g_Hush; static bool g_Hush;
@@ -4,16 +4,13 @@
#include "ArchHooks.h" #include "ArchHooks.h"
class ArchHooks_Win32: public ArchHooks class ArchHooks_Win32: public ArchHooks
{ {
bool MessageIsIgnored( CString ID );
void IgnoreMessage( CString ID );
public: public:
ArchHooks_Win32(); ArchHooks_Win32();
void Log(CString str, bool important); void Log(CString str, bool important);
void DumpDebugInfo(); void DumpDebugInfo();
void AdditionalLog(CString str); void AdditionalLog(CString str);
void MessageBoxOK( CString sMessage, CString ID ); void MessageBoxOK( CString sMessage, CString ID );
MessageBoxResult MessageBoxAbortRetryIgnore( CString sMessage, CString ID ); MessageBoxResult MessageBoxAbortRetryIgnore( CString sMessage, CString ID );
}; };
#undef ARCH_HOOKS #undef ARCH_HOOKS
@@ -0,0 +1,28 @@
/*
* ArchHooks_darwin.cpp
* stepmania
*
* Created by Steve Checkoway on Tue Jul 15 2003.
* Copyright (c) 2003 Steve Checkoway. All rights reserved.
*
*/
#include "global.h"
#include "PrefsManager.h"
#include "ArchHooks_darwin.h"
ArchHooks_darwin::ArchHooks_darwin() {
}
void ArchHooks_darwin::Log(CString str, bool important) {
}
void ArchHooks_darwin::MessageBoxOK(CString sMessage, CString ID) {
}
ArchHooks::MessageBoxResult ArchHooks_darwin::MessageBoxAbortRetryIgnore(CString sMessage, CString ID) {
return ignore;
}
@@ -0,0 +1,31 @@
#ifndef ARCH_HOOKS_DARWIN_H
#define ARCH_HOOKS_DARWIN_H
/*
* ArchHooks_darwin.h
* stepmania
*
* Created by Steve Checkoway on Tue Jul 15 2003.
* Copyright (c) 2003 Steve Checkoway. All rights reserved.
*
*/
#include "ArchHooks.h"
#include <queue>
class ArchHooks_darwin : public ArchHooks {
private:
queue<CString> logs;
CString aLog;
public:
ArchHooks_darwin();
void Log(CString str, bool important);
void AdditionalLog(CString str) { aLog = str; }
void MessageBoxOK(CString sMessage, CString ID = "");
MessageBoxResult MessageBoxAbortRetryIgnore(CString sMessage, CString ID = "");
};
#undef ARCH_HOOKS
#define ARCH_HOOKS ArchHooks_darwin
#endif /* ARCH_HOOKS_DARWIN_H */
+1
View File
@@ -13,6 +13,7 @@
#include "Sound/RageSoundDriver_QT1.h" #include "Sound/RageSoundDriver_QT1.h"
#include "Sound/RageSoundDriver_QT.h" #include "Sound/RageSoundDriver_QT.h"
#include "LoadingWindow/LoadingWindow_Cocoa.h" #include "LoadingWindow/LoadingWindow_Cocoa.h"
#include "ArchHooks/ArchHooks_darwin.h"
#endif #endif