diff --git a/application/Jamfile b/application/Jamfile index 9e125da..24678ed 100644 --- a/application/Jamfile +++ b/application/Jamfile @@ -44,6 +44,7 @@ Application Caya : PreferencesDialog.cpp PreferencesAccounts.cpp PreferencesBehavior.cpp + PreferencesChatWindow.cpp # views ContactPopUp.cpp diff --git a/application/preferences/PreferencesBehavior.cpp b/application/preferences/PreferencesBehavior.cpp index a608eb7..3aa56dd 100644 --- a/application/preferences/PreferencesBehavior.cpp +++ b/application/preferences/PreferencesBehavior.cpp @@ -1,5 +1,6 @@ /* * Copyright 2010, Oliver Ruiz Dorantes. All rights reserved. + * Copyright 2012, Dario Casalinuovo. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -21,7 +22,9 @@ const uint32 kToCurrentWorkspace = 'CBcw'; const uint32 kActivateChatWindow = 'CBac'; -const uint32 kIgnoreEmoticons = 'CBhe'; +const uint32 kDisableReplicant = 'DSrp'; +const uint32 kPermanentReplicant ='PRpt'; +const uint32 kHideCayaTracker = 'HCtk'; @@ -45,27 +48,26 @@ PreferencesBehavior::PreferencesBehavior() "Play sound event", NULL); fPlaySoundOnMessageReceived->SetEnabled(false); // not implemented - fIgnoreEmoticons = new BCheckBox("IgnoreEmoticons", - "Ignore Emoticons", - new BMessage(kIgnoreEmoticons)); - fIgnoreEmoticons->SetEnabled(true); - fMarkUnreadWindow = new BCheckBox("MarkUnreadWindow", "Mark unread window chat", NULL); fMarkUnreadWindow->SetEnabled(false); // not implemented + fReplicantString = new BStringView("ReplicantString", "Replicant"); + fReplicantString->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE)); + fReplicantString->SetFont(be_bold_font); + fDisableReplicant = new BCheckBox("DisableReplicant", "Disable Deskbar replicant", NULL); fDisableReplicant->SetEnabled(true); fPermanentReplicant = new BCheckBox("PermanentReplicant", "Permanent Deskbar Replicant", NULL); - fPermanentReplicant->SetEnabled(true); + fPermanentReplicant->SetEnabled(false); - fHideCayaTracker = new BCheckBox("HideCayaTracker", - "Hide Caya in Tracker", NULL); - fHideCayaTracker->SetEnabled(false); + fHideCayaDeskbar = new BCheckBox("HideCayaDeskbar", + "Hide Caya field in Deskbar", NULL); + fHideCayaDeskbar->SetEnabled(true); const float spacing = be_control_look->DefaultItemSpacing(); @@ -77,12 +79,15 @@ PreferencesBehavior::PreferencesBehavior() .Add(fActivateChatWindow) .Add(fMarkUnreadWindow) .Add(fPlaySoundOnMessageReceived) - .Add(fDisableReplicant) - .Add(fPermanentReplicant) - .Add(fHideCayaTracker) .SetInsets(spacing * 2, spacing, spacing, spacing) .End() - .Add(fIgnoreEmoticons) + .Add(fReplicantString) + .AddGroup(B_VERTICAL, spacing) + .Add(fDisableReplicant) + .Add(fPermanentReplicant) + .Add(fHideCayaDeskbar) + .SetInsets(spacing * 2, spacing, spacing, spacing) + .End() .AddGlue() .SetInsets(spacing, spacing, spacing, spacing) .TopView() @@ -95,15 +100,11 @@ PreferencesBehavior::AttachedToWindow() { fToCurrentWorkspace->SetTarget(this); fActivateChatWindow->SetTarget(this); - fIgnoreEmoticons->SetTarget(this); fToCurrentWorkspace->SetValue( CayaPreferences::Item()->MoveToCurrentWorkspace); fActivateChatWindow->SetValue( CayaPreferences::Item()->ActivateWindow); - fIgnoreEmoticons->SetValue( - CayaPreferences::Item()->IgnoreEmoticons); - } @@ -119,10 +120,6 @@ PreferencesBehavior::MessageReceived(BMessage* message) CayaPreferences::Item()->ActivateWindow = fActivateChatWindow->Value(); break; - case kIgnoreEmoticons: - CayaPreferences::Item()->IgnoreEmoticons - = fIgnoreEmoticons->Value(); - break; default: BView::MessageReceived(message); } diff --git a/application/preferences/PreferencesBehavior.h b/application/preferences/PreferencesBehavior.h index ef7e8e5..a63a737 100644 --- a/application/preferences/PreferencesBehavior.h +++ b/application/preferences/PreferencesBehavior.h @@ -1,5 +1,6 @@ /* * Copyright 2010, Oliver Ruiz Dorantes. All rights reserved. + * Copyright 2012, Dario Casalinuovo. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _PREFERENCES_BEHAVIOR_H @@ -25,11 +26,10 @@ private: BCheckBox* fPlaySoundOnMessageReceived; BCheckBox* fMarkUnreadWindow; - BCheckBox* fIgnoreEmoticons; - + BStringView* fReplicantString; BCheckBox* fDisableReplicant; BCheckBox* fPermanentReplicant; - BCheckBox* fHideCayaTracker; + BCheckBox* fHideCayaDeskbar; }; diff --git a/application/preferences/PreferencesChatWindow.cpp b/application/preferences/PreferencesChatWindow.cpp new file mode 100644 index 0000000..33e87a4 --- /dev/null +++ b/application/preferences/PreferencesChatWindow.cpp @@ -0,0 +1,74 @@ +/* + * Copyright 2010, Oliver Ruiz Dorantes. All rights reserved. + * Copyright 2012, Dario Casalinuovo. All rights reserved. + * Distributed under the terms of the MIT License. + */ + +#include +#include +#include +#include +#include + +#include "CayaProtocol.h" +#include "PreferencesChatWindow.h" +#include "CayaPreferences.h" +#include "ProtocolManager.h" +#include "ProtocolSettings.h" +#include "MainWindow.h" +#include "TheApp.h" + +const uint32 kIgnoreEmoticons = 'CBhe'; + + +PreferencesChatWindow::PreferencesChatWindow() + : BView("Chat Window", B_WILL_DRAW) +{ + + fChatWindowString = new BStringView("ChatWindowString", "Chat Window Settings"); + fChatWindowString->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE)); + fChatWindowString->SetFont(be_bold_font); + + fIgnoreEmoticons = new BCheckBox("IgnoreEmoticons", + "Ignore Emoticons", + new BMessage(kIgnoreEmoticons)); + fIgnoreEmoticons->SetEnabled(true); + + const float spacing = be_control_look->DefaultItemSpacing(); + + SetLayout(new BGroupLayout(B_HORIZONTAL, spacing)); + AddChild(BGroupLayoutBuilder(B_VERTICAL) + .Add(fChatWindowString) + .AddGroup(B_VERTICAL, spacing) + .Add(fIgnoreEmoticons) + .SetInsets(spacing * 2, spacing, spacing, spacing) + .End() + .AddGlue() + .SetInsets(spacing, spacing, spacing, spacing) + .TopView() + ); +} + + +void +PreferencesChatWindow::AttachedToWindow() +{ + fIgnoreEmoticons->SetTarget(this); + fIgnoreEmoticons->SetValue( + CayaPreferences::Item()->IgnoreEmoticons); + +} + + +void +PreferencesChatWindow::MessageReceived(BMessage* message) +{ + switch (message->what) { + case kIgnoreEmoticons: + CayaPreferences::Item()->IgnoreEmoticons + = fIgnoreEmoticons->Value(); + break; + default: + BView::MessageReceived(message); + } +} diff --git a/application/preferences/PreferencesChatWindow.h b/application/preferences/PreferencesChatWindow.h new file mode 100644 index 0000000..aff4b97 --- /dev/null +++ b/application/preferences/PreferencesChatWindow.h @@ -0,0 +1,28 @@ +/* + * Copyright 2010, Oliver Ruiz Dorantes. All rights reserved. + * Copyright 2012, Dario Casalinuovo. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _PREFERENCES_CHATWINDOW_H +#define _PREFERENCES_CHATWINDOW_H + +#include + +class BCheckBox; +class BStringView; + +class PreferencesChatWindow : public BView { +public: + PreferencesChatWindow(); + + virtual void AttachedToWindow(); + virtual void MessageReceived(BMessage* msg); + +private: + + BStringView* fChatWindowString; + + BCheckBox* fIgnoreEmoticons; +}; + +#endif // _PREFERENCES_BEHAVIOR_H diff --git a/application/preferences/PreferencesDialog.cpp b/application/preferences/PreferencesDialog.cpp index 753f75d..2d098f6 100644 --- a/application/preferences/PreferencesDialog.cpp +++ b/application/preferences/PreferencesDialog.cpp @@ -14,17 +14,19 @@ #include "PreferencesDialog.h" #include "PreferencesAccounts.h" #include "PreferencesBehavior.h" +#include "PreferencesChatWindow.h" const uint32 kApply = 'SAVE'; PreferencesDialog::PreferencesDialog() - : BWindow(BRect(0, 0, 400, 400), "Preferences", B_TITLED_WINDOW, + : BWindow(BRect(0, 0, 500, 500), "Preferences", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_CLOSE_ON_ESCAPE) { BTabView* tabView = new BTabView("tabView", B_WIDTH_AS_USUAL); tabView->AddTab(new PreferencesAccounts()); tabView->AddTab(new PreferencesBehavior()); + tabView->AddTab(new PreferencesChatWindow()); BButton* ok = new BButton("OK", new BMessage(kApply));