*/
void MainWindow::prepareTextFind(){
m_textFinder.setSearchParameter(ui->comboBoxTextPattern->currentText(),
- ui->checkBoxTextIgnoreCase->isChecked(), ui->checkBoxRegExpr,
- !ui->checkBoxBinaryFiles);
+ ui->checkBoxTextIgnoreCase->isChecked(), ui->checkBoxRegExpr->isChecked(),
+ !ui->checkBoxBinaryFiles->isChecked());
QString error = m_textFinder.regExprError();
if (!error.isEmpty()){
guiError(ui->comboBoxTextPattern, error);
* Destructor.
*/
TextFinder::~TextFinder(){
+ if (m_ownsRegExpr){
+ delete m_regExpr;
+ m_regExpr = NULL;
+ }
}
/**
m_regExpr = source.m_regExpr;
m_isRegExpr = source.m_isRegExpr;
m_ignoreCase = source.m_ignoreCase;
+ m_text = source.m_text;
}
/**
int length = data.length();
const char* ptr = reinterpret_cast <const char*>(memchr(data.constData(),
'\0', length));
- bool rc = int(ptr - data.constData()) != length;
-
- if (!rc)
- rc = !isText(data);
-
+ bool rc = ptr != NULL;
return rc;
}
m_ignoreCase = ignoreCase;
m_isRegExpr = isRegExpr;
m_ignoreBinary = ignoreBinary;
- if (isRegExpr && !text.isEmpty()){
+ if (! isRegExpr || text.isEmpty()){
+ delete m_regExpr;
+ m_regExpr = NULL;
+ } else {
QRegularExpression::PatternOption option =
ignoreCase ?
QRegularExpression::CaseInsensitiveOption :
*/
QString TextFinder::regExprError(){
QString rc;
- if (m_regExpr != NULL && m_regExpr->isValid())
+ if (m_regExpr != NULL && ! m_regExpr->isValid())
rc = m_regExpr->errorString();
return rc;
}