summaryrefslogtreecommitdiffstats
path: root/src/modules/options/optw_avatar.cpp
blob: 7b578bdabde2885630b92e35f389226c100b784d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//=============================================================================
//
//   File : optw_avatar.cpp
//   Creation date : Wed Nov 19 09:25:16 2005 GMT by Grifisx & Noldor
//
//   This file is part of the KVirc irc client distribution
//   Copyright (C) 2003-2006 Szymon Stefanek (pragma at kvirc dot net)
//
//   This program is FREE software. You can redistribute it and/or
//   modify it under the terms of the GNU General Public License
//   as published by the Free Software Foundation; either version 2
//   of the License, or (at your opinion) any later version.
//
//   This program is distributed in the HOPE that it will be USEFUL,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//   See the GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with this program. If not, write to the Free Software Foundation,
//   Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//=============================================================================

#include "optw_avatar.h"

#include "kvi_locale.h"
#include "kvi_selectors.h"
#include "kvi_options.h"

#include "kvi_tal_tooltip.h"

KviAvatarAdvancedOptionsWidget::KviAvatarAdvancedOptionsWidget(TQWidget * parent)
: KviOptionsWidget(parent,"avatar_advanced_options_widget")
{
	createLayout(4,1);
	// AVATAR

	// 1st Box
	KviTalGroupBox *g = addGroupBox(0,0,0,0,1,TQt::Horizontal,__tr2qs_ctx("Scaling in userlist","options"));
	KviBoolSelector *b = addBoolSelector(g,__tr2qs_ctx("Scale avatar images in userlist (recommended)","options"),KviOption_boolScaleAvatars);
#ifdef COMPILE_INFO_TIPS	
	KviTalToolTip::add(b,__tr2qs_ctx("<center>This option will force KVIrc to scale avatars" \
			" shown in the userlist.<br>" \
			"Avatars will be scaled to fit the " \
			"constraints set below. Better keep this option on. :)</center>","options"));
#endif	
	addBoolSelector(g,__tr2qs_ctx("Do not scale avatar if it is less than required size","options"),KviOption_boolDoNotStretchAvatars);
	
	KviUIntSelector *u = addUIntSelector(g,__tr2qs_ctx("Image width:","options"),KviOption_uintAvatarScaleWidth,0,512,80,KVI_OPTION_BOOL(KviOption_boolScaleAvatars));
	connect(b,TQT_SIGNAL(toggled(bool)),u,TQT_SLOT(setEnabled(bool)));
	u = addUIntSelector(g,__tr2qs_ctx("Image height:","options"),KviOption_uintAvatarScaleHeight,0,512,80,KVI_OPTION_BOOL(KviOption_boolScaleAvatars));
	connect(b,TQT_SIGNAL(toggled(bool)),u,TQT_SLOT(setEnabled(bool)));

	//2nd
	g = addGroupBox(0,1,0,1,1,TQt::Horizontal,__tr2qs_ctx("Scaling on load (and in user tooltips)","options"));
	b = addBoolSelector(g,__tr2qs_ctx("Scale avatar images on image load","options"),KviOption_boolScaleAvatarsOnLoad);
	
	u = addUIntSelector(g,__tr2qs_ctx("Image width:","options"),KviOption_uintScaleAvatarsOnLoadWidth,0,1280,80,KVI_OPTION_BOOL(KviOption_boolScaleAvatarsOnLoad));
	connect(b,TQT_SIGNAL(toggled(bool)),u,TQT_SLOT(setEnabled(bool)));
	u = addUIntSelector(g,__tr2qs_ctx("Image height:","options"),KviOption_uintScaleAvatarsOnLoadHeight,0,1280,80,KVI_OPTION_BOOL(KviOption_boolScaleAvatarsOnLoad));
	connect(b,TQT_SIGNAL(toggled(bool)),u,TQT_SLOT(setEnabled(bool)));

	// 2st Box
	KviTalGroupBox *gs = addGroupBox(0,2,0,2,1,TQt::Horizontal,__tr2qs_ctx("Request CTCP","options"));
	KviBoolSelector * bs = addBoolSelector(g,__tr2qs_ctx("Request missing avatars","options"),KviOption_boolRequestMissingAvatars);
	KviUIntSelector * us = addUIntSelector(g,__tr2qs_ctx("Maximum requested file size:","options"),KviOption_uintMaximumRequestedAvatarSize,0,1048576,102400,KVI_OPTION_BOOL(KviOption_boolRequestMissingAvatars));

#ifdef COMPILE_INFO_TIPS
	mergeTip(bs,
		__tr2qs_ctx("<center>This option will cause KVIrc to send a DCC GET request " \
			"when someone sets an avatar and there is no cached copy available.</center>","options"));
#endif
	us->setSuffix(__tr2qs_ctx(" bytes","options"));
#ifdef COMPILE_INFO_TIPS
	mergeTip(us,
		__tr2qs_ctx("<center>This is the maximum size for avatar images that " \
			"will be automatically requested.<br>" \
			"A reasonable value might be 102400 bytes (100 K).</center>","options"));
#endif
	connect(bs,TQT_SIGNAL(toggled(bool)),us,TQT_SLOT(setEnabled(bool)));

	bs = addBoolSelector(gs,__tr2qs_ctx("Automatically accept incoming avatars","options"),KviOption_boolAutoAcceptIncomingAvatars);
#ifdef COMPILE_INFO_TIPS
	mergeTip(
		bs,
		__tr2qs_ctx("<center>This option will cause KVIrc to auto-accept " \
			"DCC SEND requests for incoming avatars.<br>" \
			"If you're using the \"Request missing avatars\" option " \
			"above, enabling this may by useful.<br>" \
			"Avatars will be saved in the local KVIrc directory.</center>","options"));
#endif

	bs = addBoolSelector(gs,__tr2qs_ctx("Remember avatars for registered users","options"),KviOption_boolSetLastAvatarAsDefaultForRegisteredUsers);

#ifdef COMPILE_INFO_TIPS
	mergeTip(
		bs,
		__tr2qs_ctx("<center>Use a user's last known avatar by default " \
			"(only for users that are registered).</center>","options"));
#endif

	us = addUIntSelector(gs,__tr2qs_ctx("Avatar offer timeout:","options"),KviOption_uintAvatarOfferTimeoutInSecs,1,99999,60);
	us->setSuffix(__tr2qs_ctx(" sec","options"));
#ifdef COMPILE_INFO_TIPS
	mergeTip(us,
		__tr2qs_ctx("<center>This is the amount of time to make an avatar available for transfer when requested.<br>" \
			"When someone sends a CTCP AVATAR request, " \
			"KVIrc will reply with a CTCP AVATAR message containing the name and size " \
			"of your avatar image.<br>" \
			"A time-limited file offer is added for the image file " \
			"to the requesting user.</center>","options"));
#endif

	bs = addBoolSelector(gs,__tr2qs_ctx("Ignore requests if no avatar is set","options"),KviOption_boolIgnoreChannelAvatarRequestsWhenNoAvatarSet);
#ifdef COMPILE_INFO_TIPS
	mergeTip(bs,
		__tr2qs_ctx("This option will cause KVIrc to ignore channel CTCP AVATAR requests " \
			"when you have no avatar set. This is usually a good practice since " \
			"it helps in reducing traffic by not sending a reply that would be empty.","options"));
#endif

	addRowSpacer(0,3,0,3);
}

KviAvatarAdvancedOptionsWidget::~KviAvatarAdvancedOptionsWidget()
{
}


#include "m_optw_avatar.moc"