2012-03-01 20:23:21 -06:00
|
|
|
/*
|
|
|
|
* Copyright 2010, Oliver Ruiz Dorantes. All rights reserved.
|
|
|
|
* Copyright 2012, Dario Casalinuovo. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
|
2021-07-19 09:54:27 -05:00
|
|
|
#include <Catalog.h>
|
2012-03-01 20:23:21 -06:00
|
|
|
#include <CheckBox.h>
|
|
|
|
#include <ControlLook.h>
|
|
|
|
#include <GroupLayout.h>
|
|
|
|
#include <GroupLayoutBuilder.h>
|
|
|
|
#include <StringView.h>
|
|
|
|
|
2021-06-20 12:44:20 -05:00
|
|
|
#include "ChatProtocol.h"
|
2012-03-01 20:23:21 -06:00
|
|
|
#include "PreferencesChatWindow.h"
|
2021-06-20 12:44:20 -05:00
|
|
|
#include "AppPreferences.h"
|
2012-03-01 20:23:21 -06:00
|
|
|
#include "ProtocolManager.h"
|
|
|
|
#include "ProtocolSettings.h"
|
|
|
|
#include "MainWindow.h"
|
|
|
|
#include "TheApp.h"
|
|
|
|
|
2021-07-19 09:54:27 -05:00
|
|
|
|
|
|
|
#undef B_TRANSLATION_CONTEXT
|
|
|
|
#define B_TRANSLATION_CONTEXT "PreferencesChatWindow"
|
|
|
|
|
|
|
|
|
2012-03-01 20:23:21 -06:00
|
|
|
const uint32 kIgnoreEmoticons = 'CBhe';
|
|
|
|
|
|
|
|
|
|
|
|
PreferencesChatWindow::PreferencesChatWindow()
|
2021-07-19 09:54:27 -05:00
|
|
|
: BView(B_TRANSLATE("Chat display"), B_WILL_DRAW)
|
2012-03-01 20:23:21 -06:00
|
|
|
{
|
|
|
|
|
2021-07-19 09:54:27 -05:00
|
|
|
fChatWindowString = new BStringView("ChatWindowString",
|
|
|
|
B_TRANSLATE("Chat settings"));
|
2012-03-01 20:23:21 -06:00
|
|
|
fChatWindowString->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
|
|
|
|
fChatWindowString->SetFont(be_bold_font);
|
|
|
|
|
|
|
|
fIgnoreEmoticons = new BCheckBox("IgnoreEmoticons",
|
2021-07-19 09:54:27 -05:00
|
|
|
B_TRANSLATE("Ignore emoticons"),
|
2012-03-01 20:23:21 -06:00
|
|
|
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(
|
2021-06-20 12:44:20 -05:00
|
|
|
AppPreferences::Item()->IgnoreEmoticons);
|
2012-03-01 20:23:21 -06:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
PreferencesChatWindow::MessageReceived(BMessage* message)
|
|
|
|
{
|
|
|
|
switch (message->what) {
|
|
|
|
case kIgnoreEmoticons:
|
2021-06-20 12:44:20 -05:00
|
|
|
AppPreferences::Item()->IgnoreEmoticons
|
2012-03-01 20:23:21 -06:00
|
|
|
= fIgnoreEmoticons->Value();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
BView::MessageReceived(message);
|
|
|
|
}
|
|
|
|
}
|