3
#include "iconwidget.h"
5
#include <qwhatsthis.h>
8
#include <qbuttongroup.h>
9
#include <qradiobutton.h>
11
#include "opt_chat-ui.h"
13
//----------------------------------------------------------------------------
15
//----------------------------------------------------------------------------
17
OptionsTabChat::OptionsTabChat(QObject *parent)
18
: OptionsTab(parent, "chat", "", tr("Chat"), tr("Configure the chat dialog"), "psi/chat")
21
bg_delChats = bg_defAct = 0;
24
OptionsTabChat::~OptionsTabChat()
32
QWidget *OptionsTabChat::widget()
38
OptChatUI *d = (OptChatUI *)w;
40
bg_defAct = new QButtonGroup;
41
bg_defAct->setRadioButtonExclusive( true );
42
bg_defAct->insert( d->rb_defActMsg, 0 );
43
bg_defAct->insert( d->rb_defActChat, 1 );
45
bg_delChats = new QButtonGroup;
46
bg_delChats->setRadioButtonExclusive( true );
47
bg_delChats->insert( d->rb_delChatsClose, 0 );
48
bg_delChats->insert( d->rb_delChatsHour, 1 );
49
bg_delChats->insert( d->rb_delChatsDay, 2 );
50
bg_delChats->insert( d->rb_delChatsNever, 3 );
52
QWhatsThis::add(d->rb_defActMsg,
53
tr("Make the default action open a normal message window."));
54
QWhatsThis::add(d->rb_defActChat,
55
tr("Make the default action open a chat window."));
56
QWhatsThis::add(d->ck_chatSays,
57
tr("<P>Changes the normal chat style from:</P>"
58
"<P>[01:23:45] <MyName> Hi</P>"
59
"<P>[01:23:56] <YourName> How are you?</P>"
61
"<P>[01:23:45] MyName says:</P>"
63
"<P>[01:23:56] YourName says:</P>"
64
"<P>How are you?</P>"));
65
QWhatsThis::add(d->ck_chatSoftReturn,
66
tr("<P>When checked, pressing Enter in a chat window will send your message."
67
" You must use Shift+Enter in order to create a newline in the chat message."
68
" If unchecked, messages are sent by pressing Alt-S or Control-Enter, just as they are with regular messages.</P>"));
69
QWhatsThis::add(d->ck_alertOpenChats,
70
tr("Normally, Psi will not alert you when a new chat message"
71
" is received in a chat window that is already open."
72
" Check this option if you want to receive these alerts anyway."));
73
QWhatsThis::add(d->ck_raiseChatWindow,
74
tr("Makes Psi bring an open chat window to the front of your screen when you receive a new message."
75
" It does not take the keyboard focus, so it will not interfere with your work."));
76
QWhatsThis::add(d->ck_smallChats,
77
tr("Makes Psi open chat windows in compact mode."));
78
QString s = tr("<P>Controls how long the chat log will be kept in memory after the"
79
" chat window is closed.</P>");
80
QWhatsThis::add(d->rb_delChatsClose, s +
81
tr("<P>This option does not keep the chat log in memory.</P>"));
82
QWhatsThis::add(d->rb_delChatsHour, s +
83
tr("<P>This option keeps the chat log for 1 hour before deleting it.</P>"));
84
QWhatsThis::add(d->rb_delChatsDay, s +
85
tr("<P>This option keeps the chat log for 1 day before deleting it.</P>"));
86
QWhatsThis::add(d->rb_delChatsNever, s +
87
tr("<P>This options keeps the chat log forever.</P>"));
92
void OptionsTabChat::applyOptions(Options *opt)
97
OptChatUI *d = (OptChatUI *)w;
99
opt->defaultAction = bg_defAct->id(bg_defAct->selected());
100
opt->chatSays = d->ck_chatSays->isChecked();
101
opt->chatSoftReturn = d->ck_chatSoftReturn->isChecked();
102
opt->alertOpenChats = d->ck_alertOpenChats->isChecked();
103
opt->raiseChatWindow = d->ck_raiseChatWindow->isChecked();
104
opt->oldSmallChats = opt->smallChats;
105
opt->smallChats = d->ck_smallChats->isChecked();
106
opt->delChats = bg_delChats->id( bg_delChats->selected() );
109
void OptionsTabChat::restoreOptions(const Options *opt)
114
OptChatUI *d = (OptChatUI *)w;
116
bg_defAct->setButton( opt->defaultAction );
117
d->ck_chatSays->setChecked( opt->chatSays );
118
d->ck_chatSoftReturn->setChecked( opt->chatSoftReturn );
119
d->ck_alertOpenChats->setChecked( opt->alertOpenChats );
120
d->ck_raiseChatWindow->setChecked( opt->raiseChatWindow );
121
d->ck_smallChats->setChecked( opt->smallChats );
122
bg_delChats->setButton( opt->delChats );