diff --git a/src/apps/webpositive/support/SettingsMessage.h b/headers/private/shared/SettingsMessage.h similarity index 100% rename from src/apps/webpositive/support/SettingsMessage.h rename to headers/private/shared/SettingsMessage.h diff --git a/src/apps/mediaplayer/Jamfile b/src/apps/mediaplayer/Jamfile index 3b4eeceaa3..bba251d3d2 100644 --- a/src/apps/mediaplayer/Jamfile +++ b/src/apps/mediaplayer/Jamfile @@ -105,7 +105,6 @@ for architectureObject in [ MultiArchSubDirSetup ] { ListenerAdapter.cpp MessageEvent.cpp Notifier.cpp - SettingsMessage.cpp StackBlurFilter.cpp # . diff --git a/src/apps/mediaplayer/settings/Settings.h b/src/apps/mediaplayer/settings/Settings.h index 5dbc499007..8bf49e6552 100644 --- a/src/apps/mediaplayer/settings/Settings.h +++ b/src/apps/mediaplayer/settings/Settings.h @@ -11,9 +11,9 @@ #include #include +#include #include "Notifier.h" -#include "SettingsMessage.h" #define SETTINGS_FILENAME "MediaPlayer" diff --git a/src/apps/mediaplayer/support/SettingsMessage.cpp b/src/apps/mediaplayer/support/SettingsMessage.cpp deleted file mode 100644 index dad98820b2..0000000000 --- a/src/apps/mediaplayer/support/SettingsMessage.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/* - * Copyright 2008, Stephan Aßmus . - * Copyright 1998, Eric Shepherd. - * All rights reserved. Distributed under the terms of the Be Sample Code - * license. - */ - -//! Be Newsletter Volume II, Issue 35; September 2, 1998 (Eric Shepherd) - -#include "SettingsMessage.h" - -#include -#include -#include - - -SettingsMessage::SettingsMessage(directory_which directory, - const char* filename) - : BMessage('pref') -{ - fStatus = find_directory(directory, &fPath); - - if (fStatus == B_OK) - fStatus = fPath.Append(filename); - - if (fStatus == B_OK) - fStatus = Load(); -} - - -SettingsMessage::~SettingsMessage() -{ - Save(); -} - - -status_t -SettingsMessage::InitCheck() const -{ - return fStatus; -} - - -status_t -SettingsMessage::Load() -{ - BFile file(fPath.Path(), B_READ_ONLY); - status_t status = file.InitCheck(); - - if (status == B_OK) - status = Unflatten(&file); - - return status; -} - - -status_t -SettingsMessage::Save() const -{ - BFile file(fPath.Path(), B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE); - status_t status = file.InitCheck(); - - if (status == B_OK) - status = Flatten(&file); - - return status; -} - - -// #pragma mark - - - -status_t -SettingsMessage::SetValue(const char* name, bool value) -{ - if (ReplaceBool(name, value) == B_OK) - return B_OK; - return AddBool(name, value); -} - - -status_t -SettingsMessage::SetValue(const char* name, int8 value) -{ - if (ReplaceInt8(name, value) == B_OK) - return B_OK; - return AddInt8(name, value); -} - - -status_t -SettingsMessage::SetValue(const char* name, int16 value) -{ - if (ReplaceInt16(name, value) == B_OK) - return B_OK; - return AddInt16(name, value); -} - - -status_t -SettingsMessage::SetValue(const char* name, int32 value) -{ - if (ReplaceInt32(name, value) == B_OK) - return B_OK; - return AddInt32(name, value); -} - - -status_t -SettingsMessage::SetValue(const char* name, uint32 value) -{ - if (ReplaceInt32(name, (int32)value) == B_OK) - return B_OK; - return AddInt32(name, (int32)value); -} - - -status_t -SettingsMessage::SetValue(const char* name, int64 value) -{ - if (ReplaceInt64(name, value) == B_OK) - return B_OK; - return AddInt64(name, value); -} - - -status_t -SettingsMessage::SetValue(const char* name, float value) -{ - if (ReplaceFloat(name, value) == B_OK) - return B_OK; - return AddFloat(name, value); -} - - -status_t -SettingsMessage::SetValue(const char* name, double value) -{ - if (ReplaceDouble(name, value) == B_OK) - return B_OK; - return AddDouble(name, value); -} - - -status_t -SettingsMessage::SetValue(const char* name, const char* value) -{ - if (ReplaceString(name, value) == B_OK) - return B_OK; - return AddString(name, value); -} - - -status_t -SettingsMessage::SetValue(const char* name, const BString& value) -{ - return SetValue(name, value.String()); -} - - -status_t -SettingsMessage::SetValue(const char* name, const BPoint& value) -{ - if (ReplacePoint(name, value) == B_OK) - return B_OK; - return AddPoint(name, value); -} - - -status_t -SettingsMessage::SetValue(const char* name, const BRect& value) -{ - if (ReplaceRect(name, value) == B_OK) - return B_OK; - return AddRect(name, value); -} - - -status_t -SettingsMessage::SetValue(const char* name, const entry_ref& value) -{ - if (ReplaceRef(name, &value) == B_OK) - return B_OK; - return AddRef(name, &value); -} - - -status_t -SettingsMessage::SetValue(const char* name, const BMessage* value) -{ - if (ReplaceMessage(name, value) == B_OK) - return B_OK; - return AddMessage(name, value); -} - - -status_t -SettingsMessage::SetValue(const char* name, const BFlattenable* value) -{ - if (ReplaceFlat(name, const_cast(value)) == B_OK) - return B_OK; - return AddFlat(name, const_cast(value)); -} - - -// #pragma mark - - -bool -SettingsMessage::GetValue(const char* name, bool defaultValue) const -{ - bool value; - if (FindBool(name, &value) != B_OK) - return defaultValue; - return value; -} - - -int8 -SettingsMessage::GetValue(const char* name, int8 defaultValue) const -{ - int8 value; - if (FindInt8(name, &value) != B_OK) - return defaultValue; - return value; -} - - -int16 -SettingsMessage::GetValue(const char* name, int16 defaultValue) const -{ - int16 value; - if (FindInt16(name, &value) != B_OK) - return defaultValue; - return value; -} - - -int32 -SettingsMessage::GetValue(const char* name, int32 defaultValue) const -{ - int32 value; - if (FindInt32(name, &value) != B_OK) - return defaultValue; - return value; -} - - -uint32 -SettingsMessage::GetValue(const char* name, uint32 defaultValue) const -{ - int32 value; - if (FindInt32(name, &value) != B_OK) - return defaultValue; - return (uint32)value; -} - - -int64 -SettingsMessage::GetValue(const char* name, int64 defaultValue) const -{ - int64 value; - if (FindInt64(name, &value) != B_OK) - return defaultValue; - return value; -} - - -float -SettingsMessage::GetValue(const char* name, float defaultValue) const -{ - float value; - if (FindFloat(name, &value) != B_OK) - return defaultValue; - return value; -} - - -double -SettingsMessage::GetValue(const char* name, double defaultValue) const -{ - double value; - if (FindDouble(name, &value) != B_OK) - return defaultValue; - return value; -} - - -BString -SettingsMessage::GetValue(const char* name, const BString& defaultValue) const -{ - BString value; - if (FindString(name, &value) != B_OK) - return defaultValue; - return value; -} - - -BPoint -SettingsMessage::GetValue(const char *name, BPoint defaultValue) const -{ - BPoint value; - if (FindPoint(name, &value) != B_OK) - return defaultValue; - return value; -} - - -BRect -SettingsMessage::GetValue(const char* name, BRect defaultValue) const -{ - BRect value; - if (FindRect(name, &value) != B_OK) - return defaultValue; - return value; -} - - -entry_ref -SettingsMessage::GetValue(const char* name, const entry_ref& defaultValue) const -{ - entry_ref value; - if (FindRef(name, &value) != B_OK) - return defaultValue; - return value; -} - - -BMessage -SettingsMessage::GetValue(const char* name, const BMessage& defaultValue) const -{ - BMessage value; - if (FindMessage(name, &value) != B_OK) - return defaultValue; - return value; -} - diff --git a/src/apps/mediaplayer/support/SettingsMessage.h b/src/apps/mediaplayer/support/SettingsMessage.h deleted file mode 100644 index f98121b5bb..0000000000 --- a/src/apps/mediaplayer/support/SettingsMessage.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2008 Stephan Aßmus . - * Copyright 1998 Eric Shepherd. - * All rights reserved. Distributed under the terms of the Be Sample Code - * license. - */ -#ifndef SETTINGS_MESSAGE_H -#define SETTINGS_MESSAGE_H - -#include -#include -#include - -class BString; - -class SettingsMessage : public BMessage { -public: - SettingsMessage(directory_which directory, - const char* filename); - virtual ~SettingsMessage(); - - - status_t InitCheck() const; - status_t Load(); - status_t Save() const; - - status_t SetValue(const char* name, bool value); - status_t SetValue(const char* name, int8 value); - status_t SetValue(const char* name, int16 value); - status_t SetValue(const char* name, int32 value); - status_t SetValue(const char* name, uint32 value); - status_t SetValue(const char* name, int64 value); - status_t SetValue(const char* name, float value); - status_t SetValue(const char* name, double value); - status_t SetValue(const char* name, - const char* value); - status_t SetValue(const char* name, - const BString& value); - status_t SetValue(const char *name, const BPoint& value); - status_t SetValue(const char* name, const BRect& value); - status_t SetValue(const char* name, const entry_ref& value); - status_t SetValue(const char* name, - const BMessage* value); - status_t SetValue(const char* name, - const BFlattenable* value); - - bool GetValue(const char* name, - bool defaultValue) const; - int8 GetValue(const char* name, - int8 defaultValue) const; - int16 GetValue(const char* name, - int16 defaultValue) const; - int32 GetValue(const char* name, - int32 defaultValue) const; - uint32 GetValue(const char* name, - uint32 defaultValue) const; - int64 GetValue(const char* name, - int64 defaultValue) const; - float GetValue(const char* name, - float defaultValue) const; - double GetValue(const char* name, - double defaultValue) const; - BString GetValue(const char* name, - const BString& defaultValue) const; - BPoint GetValue(const char *name, - BPoint defaultValue) const; - BRect GetValue(const char* name, - BRect defaultValue) const; - entry_ref GetValue(const char* name, - const entry_ref& defaultValue) const; - BMessage GetValue(const char* name, - const BMessage& defaultValue) const; - -private: - BPath fPath; - status_t fStatus; -}; - -#endif // SETTINGS_MESSAGE_H diff --git a/src/apps/webpositive/Jamfile b/src/apps/webpositive/Jamfile index 405fcab069..5e2c335dc7 100644 --- a/src/apps/webpositive/Jamfile +++ b/src/apps/webpositive/Jamfile @@ -23,7 +23,6 @@ local sources = BaseURL.cpp BookmarkBar.cpp FontSelectionView.cpp - SettingsMessage.cpp # tabview TabContainerView.cpp diff --git a/src/apps/webpositive/SettingsWindow.cpp b/src/apps/webpositive/SettingsWindow.cpp index 4c36c29841..722fc04e47 100644 --- a/src/apps/webpositive/SettingsWindow.cpp +++ b/src/apps/webpositive/SettingsWindow.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -34,7 +35,6 @@ #include "BrowserWindow.h" #include "FontSelectionView.h" #include "SettingsKeys.h" -#include "SettingsMessage.h" #include "WebSettings.h" diff --git a/src/kits/shared/Jamfile b/src/kits/shared/Jamfile index 7910176c73..f3babfc1d4 100644 --- a/src/kits/shared/Jamfile +++ b/src/kits/shared/Jamfile @@ -54,6 +54,7 @@ for architectureObject in [ MultiArchSubDirSetup ] { RWLocker.cpp RWLockManager.cpp SettingsHandler.cpp + SettingsMessage.cpp ShakeTrackingFilter.cpp StringForRate.cpp StringForSize.cpp diff --git a/src/apps/webpositive/support/SettingsMessage.cpp b/src/kits/shared/SettingsMessage.cpp similarity index 99% rename from src/apps/webpositive/support/SettingsMessage.cpp rename to src/kits/shared/SettingsMessage.cpp index 15dc12394c..1389b58e77 100644 --- a/src/apps/webpositive/support/SettingsMessage.cpp +++ b/src/kits/shared/SettingsMessage.cpp @@ -22,7 +22,7 @@ SettingsMessage::SettingsMessage(directory_which directory, const char* filename) : BMessage('pref'), - fListeners(4) + fListeners(0) { fStatus = find_directory(directory, &fPath); diff --git a/src/preferences/bluetooth/BluetoothSettingsView.cpp b/src/preferences/bluetooth/BluetoothSettingsView.cpp index 13e9afdb98..cabde7755e 100644 --- a/src/preferences/bluetooth/BluetoothSettingsView.cpp +++ b/src/preferences/bluetooth/BluetoothSettingsView.cpp @@ -161,7 +161,6 @@ BluetoothSettingsView::MessageReceived(BMessage* message) int32 policy; if (message->FindInt32("be:value", (int32*)&policy) == B_OK) { fSettings.Data.Policy = policy; - printf("Policy = %d\n", fSettings.Data.Policy); } break; } @@ -181,8 +180,6 @@ BluetoothSettingsView::MessageReceived(BMessage* message) if (message->FindInt32("be:value", (int32*)&deviceClass) == B_OK) { - printf("deviceClass = %d\n", deviceClass); - if (deviceClass == 5) _SetDeviceClass(2, 3, 0x72); else