~ubuntu-branches/ubuntu/quantal/psi/quantal

« back to all changes in this revision

Viewing changes to src/options/opt_chat.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2005-01-10 17:41:43 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050110174143-ltocv5zapl6blf5d
Tags: 0.9.3-1
* New upstream release
* Cleaned up debian/rules (some things are done by upstream Makefiles now)
* Fixed some lintian warnings:
  - removed executable bit from some .png files
  - moved psi.desktop to /usr/share/applications
* Updated menu files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "opt_chat.h"
 
2
#include "common.h"
 
3
#include "iconwidget.h"
 
4
 
 
5
#include <qwhatsthis.h>
 
6
#include <qcheckbox.h>
 
7
#include <qcombobox.h>
 
8
#include <qbuttongroup.h>
 
9
#include <qradiobutton.h>
 
10
 
 
11
#include "opt_chat-ui.h"
 
12
 
 
13
//----------------------------------------------------------------------------
 
14
// OptionsTabChat
 
15
//----------------------------------------------------------------------------
 
16
 
 
17
OptionsTabChat::OptionsTabChat(QObject *parent)
 
18
: OptionsTab(parent, "chat", "", tr("Chat"), tr("Configure the chat dialog"), "psi/chat")
 
19
{
 
20
        w = 0;
 
21
        bg_delChats = bg_defAct = 0;
 
22
}
 
23
 
 
24
OptionsTabChat::~OptionsTabChat()
 
25
{
 
26
        if ( bg_defAct )
 
27
                delete bg_defAct;
 
28
        if ( bg_delChats )
 
29
                delete bg_delChats;
 
30
}
 
31
 
 
32
QWidget *OptionsTabChat::widget()
 
33
{
 
34
        if ( w )
 
35
                return 0;
 
36
 
 
37
        w = new OptChatUI();
 
38
        OptChatUI *d = (OptChatUI *)w;
 
39
 
 
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 );
 
44
 
 
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 );
 
51
 
 
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] &lt;MyName&gt; Hi</P>"
 
59
                "<P>[01:23:56] &lt;YourName&gt; How are you?</P>"
 
60
                "<P>to:</P>"
 
61
                "<P>[01:23:45] MyName says:</P>"
 
62
                "<P>Hi</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>"));
 
88
 
 
89
        return w;
 
90
}
 
91
 
 
92
void OptionsTabChat::applyOptions(Options *opt)
 
93
{
 
94
        if ( !w )
 
95
                return;
 
96
 
 
97
        OptChatUI *d = (OptChatUI *)w;
 
98
 
 
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() );
 
107
}
 
108
 
 
109
void OptionsTabChat::restoreOptions(const Options *opt)
 
110
{
 
111
        if ( !w )
 
112
                return;
 
113
 
 
114
        OptChatUI *d = (OptChatUI *)w;
 
115
 
 
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 );
 
123
}