Modified preferences dialog, better look for Replicant settings, added a new tab for Chat Window settings

This commit is contained in:
barrett 2012-03-02 02:23:21 +00:00
parent f51f924b89
commit cf7646fb00
6 changed files with 128 additions and 26 deletions

View File

@ -44,6 +44,7 @@ Application Caya :
PreferencesDialog.cpp
PreferencesAccounts.cpp
PreferencesBehavior.cpp
PreferencesChatWindow.cpp
# views
ContactPopUp.cpp

View File

@ -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);
}

View File

@ -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;
};

View File

@ -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 <CheckBox.h>
#include <ControlLook.h>
#include <GroupLayout.h>
#include <GroupLayoutBuilder.h>
#include <StringView.h>
#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);
}
}

View File

@ -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 <View.h>
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

View File

@ -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));