1
#ifndef _OPTW_HIGHLIGHTING_CPP_
2
#define _OPTW_HIGHLIGHTING_CPP_
3
//=============================================================================
5
// File : OptionsWidget_alertsAndHighlighting.cpp
6
// Creation date : Sat Nov 3 18:09:35 2001 GMT by Szymon Stefanek
8
// This file is part of the KVIrc irc client distribution
9
// Copyright (C) 2001-2010 Szymon Stefanek (pragma at kvirc dot net)
11
// This program is FREE software. You can redistribute it and/or
12
// modify it under the terms of the GNU General Public License
13
// as published by the Free Software Foundation; either version 2
14
// of the License, or (at your opinion) any later version.
16
// This program is distributed in the HOPE that it will be USEFUL,
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19
// See the GNU General Public License for more details.
21
// You should have received a copy of the GNU General Public License
22
// along with this program. If not, write to the Free Software Foundation,
23
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
//=============================================================================
27
#include "OptionsWidget_alertsAndHighlighting.h"
28
#include "KviOptions.h"
29
#include "KviLocale.h"
33
#include <QRadioButton>
35
#include "KviTalToolTip.h"
37
OptionsWidget_alertsAndHighlighting::OptionsWidget_alertsAndHighlighting(QWidget * parent)
38
: KviOptionsWidget(parent)
40
setObjectName("highlighting_options_widget");
43
OptionsWidget_alertsAndHighlighting::~OptionsWidget_alertsAndHighlighting()
48
OptionsWidget_highlighting::OptionsWidget_highlighting(QWidget * parent)
49
: KviOptionsWidget(parent)
51
setObjectName("highlighting_options_widget");
55
KviBoolSelector * b = addBoolSelector(0,0,0,0,__tr2qs_ctx("Enable word highlighting","options"),KviOption_boolUseWordHighlighting);
56
KviStringListSelector * sl = addStringListSelector(0,1,0,1,__tr2qs_ctx("Words to highlight:","options"),KviOption_stringlistHighlightWords,KVI_OPTION_BOOL(KviOption_boolUseWordHighlighting));
58
connect(b,SIGNAL(toggled(bool)),sl,SLOT(setEnabled(bool)));
60
// This can be used even without Word highlighting
61
b = addBoolSelector(0,2,0,2,__tr2qs_ctx("Highlight messages containing my nickname","options"),KviOption_boolAlwaysHighlightNick);
62
mergeTip(b,__tr2qs_ctx("<center>If this option is enabled, KVIrc will highlight any user message containing your current nickname</center>","options"));
64
b = addBoolSelector(0,3,0,3,__tr2qs_ctx("Words/Nick matching is case sensitive ","options"),KviOption_boolCaseSensitiveHighlighting);
65
mergeTip(b,__tr2qs_ctx("<center>If this option is enabled, KVIrc will match your nick and/or the words you specified in a case sensitive manner</center>","options"));
67
KviTalGroupBox * gbox = addGroupBox(0,4,0,4,Qt::Horizontal,__tr2qs_ctx("Highlighting Method","options"));
69
// note: KviTalGroupBox automatically deletes its previous layout on setLayout()
70
// note2: every QWidget will take ownership of its layout.
71
QGridLayout * g = new QGridLayout();
74
m_pHighlightAllOccurencesRadioButton = new QRadioButton(__tr2qs_ctx("Highlight every occurence of a word inside text","options"),gbox);
75
g->addWidget(m_pHighlightAllOccurencesRadioButton,0,0,1,2);
76
m_pHighlightAllOccurencesRadioButton->setChecked(KVI_OPTION_BOOL(KviOption_boolUseFullWordHighlighting));
77
KviTalToolTip::add(m_pHighlightAllOccurencesRadioButton,__tr2qs_ctx("<center>This selection will cause KVIrc to search for the highlighted words or nicknames inside the whole text. This will also highlight parts of words (eg. if your nickname is Mark then Markus will be highlighted too).</center>","options"));
79
m_pHighlightWholeWordsOnlyRadioButton = new QRadioButton(__tr2qs_ctx("Highlight only whole words splitting on space and on:","options"),gbox);
80
g->addWidget(m_pHighlightWholeWordsOnlyRadioButton,1,0,1,1);
81
m_pHighlightWholeWordsOnlyRadioButton->setChecked(!KVI_OPTION_BOOL(KviOption_boolUseFullWordHighlighting));
82
KviTalToolTip::add(m_pHighlightWholeWordsOnlyRadioButton,__tr2qs_ctx("<center>This selection will first split the string on the specified boundaries (including space) and then will compare all the parts with the highlighted words.</center>","options"));
84
m_pWordSplitterCharactersEdit = new QLineEdit(gbox);
85
m_pWordSplitterCharactersEdit->setText(KVI_OPTION_STRING(KviOption_stringWordSplitters));
86
m_pWordSplitterCharactersEdit->setEnabled(!KVI_OPTION_BOOL(KviOption_boolUseFullWordHighlighting));
87
g->addWidget(m_pWordSplitterCharactersEdit,1,1,1,1);
89
connect(m_pHighlightWholeWordsOnlyRadioButton,SIGNAL(toggled(bool)),m_pWordSplitterCharactersEdit,SLOT(setEnabled(bool)));
91
gbox = addGroupBox(0,5,0,5,Qt::Horizontal,__tr2qs_ctx("Alert Options","options"));
93
b = addBoolSelector(gbox,__tr2qs_ctx("Flash the system taskbar entry on highlighted messages","options"),KviOption_boolFlashWindowOnHighlightedMessages);
94
mergeTip(b,__tr2qs_ctx("<center>If this option is enabled, KVIrc will (attempt to) flash the system taskbar entry when a highlighted message is printed and KVIrc is not the active window</center>","options"));
95
b = addBoolSelector(gbox,__tr2qs_ctx("Popup the notifier window on highlighted messages","options"),KviOption_boolPopupNotifierOnHighlightedMessages);
96
mergeTip(b,__tr2qs_ctx("<center>If this option is enabled, KVIrc will popup a little notifier window in the low right corner of your desktop when a highlighted message is printed and KVIrc is not the active window</center>","options"));
98
addRowSpacer(0,6,0,6);
101
OptionsWidget_highlighting::~OptionsWidget_highlighting()
105
void OptionsWidget_highlighting::commit()
107
KVI_OPTION_STRING(KviOption_stringWordSplitters) = m_pWordSplitterCharactersEdit->text().trimmed();
108
KVI_OPTION_BOOL(KviOption_boolUseFullWordHighlighting) = m_pHighlightAllOccurencesRadioButton->isChecked();
110
KviOptionsWidget::commit();
115
OptionsWidget_alerts::OptionsWidget_alerts(QWidget * parent)
116
: KviOptionsWidget(parent)
118
setObjectName("highlighting_options_widget");
122
KviTalGroupBox * g = addGroupBox(0,0,0,0,Qt::Horizontal,__tr2qs_ctx("Alert Restrictions","options"));
123
KviBoolSelector * b3 = addBoolSelector(g,__tr2qs_ctx("Restrict alert","options"),KviOption_boolHighlightOnlyNormalMsg);
124
mergeTip(b3, __tr2qs_ctx("<center>If this option is enabled, KVIrc will alert in the window list only if a normal message is received in a channel.<br>Actions like joins, parts and mode changes will be ignored.<br> This is useful if you are in channels with a high rate of traffic and only want to be alerted for messages that are interesting to you.</center>","options"));
126
KviBoolSelector * b4 = addBoolSelector(g,__tr2qs_ctx("Alert for highlighted words","options"),KviOption_boolHighlightOnlyNormalMsgHighlightInChanToo,KVI_OPTION_BOOL(KviOption_boolHighlightOnlyNormalMsg));
127
mergeTip(b4, __tr2qs_ctx("<center>If this option is enabled, the window list will also alert for messages which contain a word from the highlighted words list above.</center>","options"));
129
KviBoolSelector * b5 = addBoolSelector(g,__tr2qs_ctx("Alert for query messages","options"),KviOption_boolHighlightOnlyNormalMsgQueryToo,KVI_OPTION_BOOL(KviOption_boolHighlightOnlyNormalMsg));
130
mergeTip(b5, __tr2qs_ctx("<center>If this option is enabled, the window list will also alert for messages which are shown in queries.</center>","options"));
131
connect(b3,SIGNAL(toggled(bool)),b4,SLOT(setEnabled(bool)));
132
connect(b3,SIGNAL(toggled(bool)),b5,SLOT(setEnabled(bool)));
134
KviBoolSelector * b6 = addBoolSelector(g,__tr2qs_ctx("Use custom alert level","options"),KviOption_boolHighlightOnlyAtCostumHighlightLevel);
135
mergeTip(b6, __tr2qs_ctx("<center>If this option is enabled, KVIrc will alert in the window list only if the specified alert level is reached.</center>","options"));
137
KviUIntSelector * b7 = addUIntSelector(g,__tr2qs_ctx("Minimum alert level:","options"),KviOption_uintMinHighlightLevel,1,KVI_MSGTYPE_MAXLEVEL,KVI_MSGTYPE_MAXLEVEL,KVI_OPTION_BOOL(KviOption_boolHighlightOnlyAtCostumHighlightLevel));
138
b7->setEnabled(KVI_OPTION_BOOL(KviOption_boolHighlightOnlyAtCostumHighlightLevel));
139
mergeTip(b7, __tr2qs_ctx("<center>This option sets the minimum alert level for the window list.</center>","options"));
140
connect(b6,SIGNAL(toggled(bool)),b7,SLOT(setEnabled(bool)));
142
addRowSpacer(0,1,0,1);
145
OptionsWidget_alerts::~OptionsWidget_alerts()
150
#ifndef COMPILE_USE_STANDALONE_MOC_SOURCES
151
#include "m_OptionsWidget_alertsAndHighlighting.moc"
152
#endif //!COMPILE_USE_STANDALONE_MOC_SOURCES
154
#endif //_OPTW_HIGHLIGHTING_CPP_