1 //=============================================================================
2 //
3 // File : OptionsWidget_ircOutput.cpp
4 // Creation date : Wed Nov 15 2000 11:45:06 CEST by Szymon Stefanek
5 //
6 // This file is part of the KVIrc IRC client distribution
7 // Copyright (C) 2000-2010 Szymon Stefanek (pragma at kvirc dot net)
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_ircOutput.h"
26
27 #include "kvi_settings.h"
28 #include "KviOptions.h"
29 #include "KviLocale.h"
30 #include "KviSelectors.h"
31 #include "KviTalToolTip.h"
32
33 #include <QLayout>
34 #include <QComboBox>
35 #include <QLabel>
36
OptionsWidget_ircOutput(QWidget * pParent)37 OptionsWidget_ircOutput::OptionsWidget_ircOutput(QWidget * pParent)
38 : KviOptionsWidget(pParent)
39 {
40 setObjectName("ircoutput_options_widget");
41 createLayout();
42
43 QLabel * pLabel = new QLabel(__tr2qs_ctx("Output verbosity:", "options"), this);
44 addWidgetToLayout(pLabel, 0, 0, 0, 0);
45
46 m_pVerbosityCombo = new QComboBox(this);
47 m_pVerbosityCombo->addItem(__tr2qs_ctx("Mute", "options"));
48 m_pVerbosityCombo->addItem(__tr2qs_ctx("Quiet", "options"));
49 m_pVerbosityCombo->addItem(__tr2qs_ctx("Normal", "options"));
50 m_pVerbosityCombo->addItem(__tr2qs_ctx("Verbose", "options"));
51 m_pVerbosityCombo->addItem(__tr2qs_ctx("Paranoic", "options"));
52 addWidgetToLayout(m_pVerbosityCombo, 1, 0, 1, 0);
53
54 if(KVI_OPTION_UINT(KviOption_uintOutputVerbosityLevel) > KVI_VERBOSITY_LEVEL_PARANOIC)
55 KVI_OPTION_UINT(KviOption_uintOutputVerbosityLevel) = KVI_VERBOSITY_LEVEL_NORMAL;
56 m_pVerbosityCombo->setCurrentIndex(KVI_OPTION_UINT(KviOption_uintOutputVerbosityLevel));
57
58 pLabel = new QLabel(__tr2qs_ctx("DateTime format:", "options"), this);
59 addWidgetToLayout(pLabel, 0, 1, 0, 1);
60
61 m_pDatetimeCombo = new QComboBox(this);
62 m_pDatetimeCombo->addItem(__tr2qs_ctx("Classic format", "options"));
63 m_pDatetimeCombo->addItem(__tr2qs_ctx("ISO 8601 format", "options"));
64 m_pDatetimeCombo->addItem(__tr2qs_ctx("System locale format", "options"));
65 addWidgetToLayout(m_pDatetimeCombo, 1, 1, 1, 1);
66
67 m_pDatetimeCombo->setCurrentIndex(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat));
68
69 KviTalGroupBox * pGroup = addGroupBox(0, 2, 1, 2, Qt::Horizontal, __tr2qs_ctx("Show in Active Window", "options"));
70 addBoolSelector(pGroup, __tr2qs_ctx("External messages", "options"), KviOption_boolExternalMessagesToActiveWindow);
71 addBoolSelector(pGroup, __tr2qs_ctx("External CTCP replies", "options"), KviOption_boolCtcpRepliesToActiveWindow);
72 addBoolSelector(pGroup, __tr2qs_ctx("WHOIS replies", "options"), KviOption_boolWhoisRepliesToActiveWindow);
73 addBoolSelector(pGroup, __tr2qs_ctx("WHO replies", "options"), KviOption_boolWhoRepliesToActiveWindow);
74 addBoolSelector(pGroup, __tr2qs_ctx("ChanServ and NickServ notices", "options"), KviOption_boolServicesNoticesToActiveWindow);
75 addBoolSelector(pGroup, __tr2qs_ctx("Invite messages", "options"), KviOption_boolInvitesToActiveWindow);
76 addBoolSelector(pGroup, __tr2qs_ctx("Server replies", "options"), KviOption_boolServerRepliesToActiveWindow);
77 addBoolSelector(pGroup, __tr2qs_ctx("Server notices", "options"), KviOption_boolServerNoticesToActiveWindow);
78 addBoolSelector(pGroup, __tr2qs_ctx("Broadcast and WALLOPS messages", "options"), KviOption_boolOperatorMessagesToActiveWindow);
79
80 KviBoolSelector * b;
81
82 addBoolSelector(0, 3, 1, 3, __tr2qs_ctx("Show extended server information", "options"), KviOption_boolShowExtendedServerInfo);
83 addBoolSelector(0, 4, 1, 4, __tr2qs_ctx("Show server pings", "options"), KviOption_boolShowPingPong);
84
85 b = addBoolSelector(0, 5, 1, 5, __tr2qs_ctx("Show own part messages", "options"), KviOption_boolShowOwnParts);
86 mergeTip(b, __tr2qs_ctx("When enabled, the current user's part messages will be shown in the console.<br>"
87 "When <b>Keep Channel Open</b> is enabled on part, this message will be shown in the dead channel instead.", "options"));
88
89 addBoolSelector(0, 6, 1, 6, __tr2qs_ctx("Show compact mode changes", "options"), KviOption_boolShowCompactModeChanges);
90
91 addRowSpacer(0, 7, 1, 7);
92 }
93
94 OptionsWidget_ircOutput::~OptionsWidget_ircOutput()
95 = default;
96
commit()97 void OptionsWidget_ircOutput::commit()
98 {
99 KviOptionsWidget::commit();
100
101 int iIdx = m_pVerbosityCombo->currentIndex();
102 if((iIdx < 0) || (iIdx > KVI_VERBOSITY_LEVEL_PARANOIC))
103 {
104 iIdx = KVI_VERBOSITY_LEVEL_NORMAL;
105 }
106 KVI_OPTION_UINT(KviOption_uintOutputVerbosityLevel) = iIdx;
107
108 KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat) = m_pDatetimeCombo->currentIndex();
109 }
110