2012-03-01 20:23:21 -06:00
|
|
|
/*
|
|
|
|
* Copyright 2010, Oliver Ruiz Dorantes. All rights reserved.
|
|
|
|
* Copyright 2012, Dario Casalinuovo. All rights reserved.
|
2021-07-24 13:25:44 -05:00
|
|
|
* Copyright 2021, Jaidyn Levesque. All rights reserved.
|
2012-03-01 20:23:21 -06:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
|
2021-07-24 13:25:44 -05:00
|
|
|
#include "PreferencesChatWindow.h"
|
|
|
|
|
|
|
|
#include <Box.h>
|
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>
|
2021-07-24 13:25:44 -05:00
|
|
|
#include <LayoutBuilder.h>
|
2012-03-01 20:23:21 -06:00
|
|
|
|
2021-06-20 12:44:20 -05:00
|
|
|
#include "AppPreferences.h"
|
2012-03-01 20:23:21 -06:00
|
|
|
|
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-24 13:25:44 -05:00
|
|
|
: BView(B_TRANSLATE("Chat view"), B_WILL_DRAW)
|
2012-03-01 20:23:21 -06:00
|
|
|
{
|
2021-07-24 13:25:44 -05:00
|
|
|
BBox* chatBox = new BBox("chatBox");
|
|
|
|
chatBox->SetLabel(B_TRANSLATE("Chat settings"));
|
2012-03-01 20:23:21 -06:00
|
|
|
|
|
|
|
fIgnoreEmoticons = new BCheckBox("IgnoreEmoticons",
|
2021-07-24 13:25:44 -05:00
|
|
|
B_TRANSLATE("Ignore emoticons"), new BMessage(kIgnoreEmoticons));
|
2012-03-01 20:23:21 -06:00
|
|
|
fIgnoreEmoticons->SetEnabled(true);
|
|
|
|
|
|
|
|
const float spacing = be_control_look->DefaultItemSpacing();
|
|
|
|
|
2021-07-24 13:25:44 -05:00
|
|
|
|
|
|
|
BLayoutBuilder::Group<>(chatBox, B_VERTICAL)
|
|
|
|
.SetInsets(spacing, spacing * 2, spacing, spacing)
|
|
|
|
.Add(fIgnoreEmoticons)
|
|
|
|
.End();
|
|
|
|
|
|
|
|
BLayoutBuilder::Group<>(this, B_VERTICAL)
|
|
|
|
.SetInsets(B_USE_DEFAULT_SPACING)
|
|
|
|
.Add(chatBox)
|
2012-03-01 20:23:21 -06:00
|
|
|
.AddGlue()
|
2021-07-24 13:25:44 -05:00
|
|
|
.End();
|
2012-03-01 20:23:21 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
PreferencesChatWindow::AttachedToWindow()
|
|
|
|
{
|
|
|
|
fIgnoreEmoticons->SetTarget(this);
|
2021-07-24 13:25:44 -05:00
|
|
|
fIgnoreEmoticons->SetValue(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);
|
|
|
|
}
|
|
|
|
}
|