1 //=============================================================================
2 //
3 // File : OptionsWidget_avatar.cpp
4 // Creation date : Wed Nov 19 09:25:16 2005 GMT by Grifisx & Noldor
5 //
6 // This file is part of the KVIrc IRC client distribution
7 // Copyright (C) 2005-2008 Alessandro Carbone (elfonol at gmail dot com)
8 //
9 // This program is FREE software. You can redistribute it and/or
10 // modify it under the terms of the GNU General Public License
11 // as published by the Free Software Foundation; either version 2
12 // of the License, or (at your option) any later version.
13 //
14 // This program is distributed in the HOPE that it will be USEFUL,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 // See the GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program. If not, write to the Free Software Foundation,
21 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 //=============================================================================
24
25 #include "OptionsWidget_avatar.h"
26
27 #include "KviLocale.h"
28 #include "KviSelectors.h"
29 #include "KviOptions.h"
30 #include "KviTalToolTip.h"
31
OptionsWidget_avatar(QWidget * parent)32 OptionsWidget_avatar::OptionsWidget_avatar(QWidget * parent)
33 : KviOptionsWidget(parent)
34 {
35 setObjectName("avatar_advanced_options_widget");
36 createLayout();
37
38 KviTalGroupBox * g;
39 KviBoolSelector * b;
40
41 g = addGroupBox(0, 0, 0, 0, Qt::Horizontal, __tr2qs_ctx("Scaling in Userlist", "options"));
42 b = addBoolSelector(g, __tr2qs_ctx("Scale avatar images in userlist (recommended)", "options"), KviOption_boolScaleAvatars);
43 mergeTip(b, __tr2qs_ctx("This option will force KVIrc to scale avatars"
44 " shown in the userlist.<br>"
45 "Avatars will be scaled to fit the "
46 "constraints set below. Better keep this option on.",
47 "options"));
48
49 addBoolSelector(g, __tr2qs_ctx("Do not scale avatar if it is less than required size", "options"), KviOption_boolDoNotUpscaleAvatars);
50
51 KviUIntSelector * u = addUIntSelector(g, __tr2qs_ctx("Image width:", "options"), KviOption_uintAvatarScaleWidth, 0, 512, 80, KVI_OPTION_BOOL(KviOption_boolScaleAvatars));
52 u->setSuffix(__tr2qs_ctx(" pixels", "options"));
53 connect(b, SIGNAL(toggled(bool)), u, SLOT(setEnabled(bool)));
54 u = addUIntSelector(g, __tr2qs_ctx("Image height:", "options"), KviOption_uintAvatarScaleHeight, 0, 512, 80, KVI_OPTION_BOOL(KviOption_boolScaleAvatars));
55 u->setSuffix(__tr2qs_ctx(" pixels", "options"));
56 connect(b, SIGNAL(toggled(bool)), u, SLOT(setEnabled(bool)));
57
58 g = addGroupBox(0, 1, 0, 1, Qt::Horizontal, __tr2qs_ctx("Scaling on Load and in User Tooltips", "options"));
59 b = addBoolSelector(g, __tr2qs_ctx("Scale avatar images on image load", "options"), KviOption_boolScaleAvatarsOnLoad);
60
61 u = addUIntSelector(g, __tr2qs_ctx("Image width:", "options"), KviOption_uintScaleAvatarsOnLoadWidth, 0, 1280, 80, KVI_OPTION_BOOL(KviOption_boolScaleAvatarsOnLoad));
62 u->setSuffix(__tr2qs_ctx(" pixels", "options"));
63 connect(b, SIGNAL(toggled(bool)), u, SLOT(setEnabled(bool)));
64 u = addUIntSelector(g, __tr2qs_ctx("Image height:", "options"), KviOption_uintScaleAvatarsOnLoadHeight, 0, 1280, 80, KVI_OPTION_BOOL(KviOption_boolScaleAvatarsOnLoad));
65 u->setSuffix(__tr2qs_ctx(" pixels", "options"));
66 connect(b, SIGNAL(toggled(bool)), u, SLOT(setEnabled(bool)));
67
68 KviTalGroupBox * gs = addGroupBox(0, 2, 0, 2, Qt::Horizontal, __tr2qs_ctx("Request CTCP", "options"));
69 KviBoolSelector * bs = addBoolSelector(g, __tr2qs_ctx("Request missing avatars", "options"), KviOption_boolRequestMissingAvatars);
70 mergeTip(bs, __tr2qs_ctx("This option will cause KVIrc to send a DCC GET request "
71 "when someone sets an avatar and there is no cached copy available.",
72 "options"));
73
74 KviUIntSelector * us = addUIntSelector(g, __tr2qs_ctx("Maximum requested file size:", "options"), KviOption_uintMaximumRequestedAvatarSize, 0, 1048576, 102400,
75 KVI_OPTION_BOOL(KviOption_boolRequestMissingAvatars));
76 us->setSuffix(__tr2qs_ctx(" bytes", "options"));
77 mergeTip(us, __tr2qs_ctx("This is the maximum size for avatar images that "
78 "will be automatically requested.<br>"
79 "A reasonable value might be 102400 bytes (100 K).",
80 "options"));
81
82 connect(bs, SIGNAL(toggled(bool)), us, SLOT(setEnabled(bool)));
83
84 bs = addBoolSelector(gs, __tr2qs_ctx("Automatically accept incoming avatars", "options"), KviOption_boolAutoAcceptIncomingAvatars);
85 mergeTip(bs, __tr2qs_ctx("This option will cause KVIrc to auto-accept "
86 "DCC SEND requests for incoming avatars.<br>"
87 "If you're using the \"Request missing avatars\" option "
88 "above, enabling this may by useful.<br>"
89 "Avatars will be saved in the local KVIrc directory.",
90 "options"));
91
92 bs = addBoolSelector(gs, __tr2qs_ctx("Remember avatars for registered users", "options"), KviOption_boolSetLastAvatarAsDefaultForRegisteredUsers);
93 mergeTip(bs, __tr2qs_ctx("Use a user's last known avatar by default "
94 "(only for users that are registered).",
95 "options"));
96
97 us = addUIntSelector(gs, __tr2qs_ctx("Avatar offer timeout:", "options"), KviOption_uintAvatarOfferTimeoutInSecs, 1, 99999, 60);
98 us->setSuffix(__tr2qs_ctx(" sec", "options"));
99 mergeTip(us, __tr2qs_ctx("This is the amount of time to make an avatar available for transfer when requested.<br>"
100 "When someone sends a CTCP AVATAR request, "
101 "KVIrc will reply with a CTCP AVATAR message containing the name and size "
102 "of your avatar image.<br>"
103 "A time-limited file offer is added for the image file "
104 "to the requesting user.",
105 "options"));
106
107 bs = addBoolSelector(gs, __tr2qs_ctx("Ignore requests if no avatar is set", "options"), KviOption_boolIgnoreChannelAvatarRequestsWhenNoAvatarSet);
108 mergeTip(bs, __tr2qs_ctx("This option will cause KVIrc to ignore channel CTCP AVATAR requests "
109 "when you have no avatar set. This is usually a good practice since "
110 "it helps in reducing traffic by not sending a reply that would be empty.",
111 "options"));
112
113 addRowSpacer(0, 3, 0, 3);
114 }
115
116 OptionsWidget_avatar::~OptionsWidget_avatar()
117 = default;
118