1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-22 03:07:20 +01:00

see #1931 Made "Parser error" message appear in bold red font in the importer log

This commit is contained in:
Vadim Kurland 2011-02-09 22:15:07 -08:00
parent 4adafeb105
commit b6b881af96
7 changed files with 58 additions and 15 deletions

View File

@ -7,7 +7,7 @@ FWB_MICRO_VERSION=0
# build number is like "nano" version number. I am incrementing build
# number during development cycle
#
BUILD_NUM="3468"
BUILD_NUM="3469"
VERSION="$FWB_MAJOR_VERSION.$FWB_MINOR_VERSION.$FWB_MICRO_VERSION.$BUILD_NUM"

View File

@ -1,2 +1,2 @@
#define VERSION "4.2.0.3468"
#define VERSION "4.2.0.3469"
#define GENERATION "4.2"

View File

@ -3,7 +3,7 @@
%define name fwbuilder
%define version 4.2.0.3468
%define version 4.2.0.3469
%define release 1
%if "%_vendor" == "MandrakeSoft"

View File

@ -4,6 +4,6 @@ Replaces: fwbuilder (<=4.1.1-1), fwbuilder-common, fwbuilder-bsd, fwbuilder-linu
Priority: extra
Section: checkinstall
Maintainer: vadim@fwbuilder.org
Version: 4.2.0.3468-1
Version: 4.2.0.3469-1
Depends: libqt4-gui (>= 4.3.0), libxml2, libxslt1.1, libsnmp | libsnmp15
Description: Firewall Builder GUI and policy compilers

View File

@ -1,6 +1,6 @@
%define name fwbuilder
%define version 4.2.0.3468
%define version 4.2.0.3469
%define release 1
%if "%_vendor" == "MandrakeSoft"

View File

@ -105,6 +105,16 @@ DiscoveryDruid::DiscoveryDruid(QWidget *parent, bool start_with_import) :
m_dialog->cancelButton,
m_dialog->titleLabel);
QTextCursor cursor(m_dialog->discoverylog->textCursor());
normal_format = cursor.charFormat();
error_format = normal_format;
error_format.setForeground(QBrush(Qt::red));
error_format.setAnchorHref("http://somewhere.com");
error_format.setAnchor(true);
// weight must be between 0 and 99. Qt 4.4.1 does not seem to mind if
// it is >99 (just caps it) but older versions assert
error_format.setProperty(QTextFormat::FontWeight, 99);
dm_method = new QButtonGroup;
dm_method->addButton(m_dialog->dm_fromfile,0);
dm_method->addButton(m_dialog->dm_importdns,1);
@ -1001,7 +1011,7 @@ void DiscoveryDruid::stopBackgroundProcess()
if (bop!=NULL && bop->isRunning())
{
m_dialog->discoverylog->append("Terminating task. Please wait...");
addToLog("Terminating task. Please wait...");
bop->stop_operation();
m_dialog->discoveryStopButton->setEnabled(false);
@ -1422,7 +1432,7 @@ void DiscoveryDruid::startSNMPScan()
{
logger = bop->start_operation();
if (fwbdebug) logger->copyToStderr();
m_dialog->discoverylog->append("Collecting data ...");
addToLog("Collecting data ...");
disconnect(timer, SIGNAL(timeout()), 0, 0);
connect(timer, SIGNAL(timeout()), this, SLOT(updateLog()));
@ -1510,10 +1520,8 @@ void DiscoveryDruid::loadDataFromCrawler()
od.sysname = hostName.toLatin1().constData();
}
QString buf;
buf = QString(od.addr.toString().c_str()) + " : " + od.sysname.c_str();
m_dialog->discoverylog->append(buf);
addToLog(
QString(od.addr.toString().c_str()) + " : " + od.sysname.c_str());
}
@ -1684,7 +1692,7 @@ void DiscoveryDruid::updateLog()
while(thread->Log->ready())
{
buf = thread->Log->getLine().c_str();
m_dialog->discoverylog->insertPlainText(buf);
addToLog(buf);
}
}
}
@ -1782,6 +1790,36 @@ void DiscoveryDruid::updateLog()
}
}
void DiscoveryDruid::addToLog(const QString &buf)
{
if (buf.isEmpty()) return;
foreach(QString line, buf.trimmed().split("\n"))
{
QTextCharFormat format = normal_format;
if (line.contains("Parser error"))
{
format = error_format;
}
QString txt = line;
while (!txt.isEmpty() && (txt.endsWith("\n") || txt.endsWith("\r")))
txt.chop(1);
if (format == error_format)
format.setAnchorHref(txt);
QTextCursor cursor = m_dialog->discoverylog->textCursor();
cursor.insertBlock();
cursor.insertText(txt, format);
}
m_dialog->discoverylog->ensureCursorVisible();
}
void DiscoveryDruid::changedSeedHost()
{
m_dialog->seedhosterror_message->setText(" ");
@ -1934,7 +1972,7 @@ int DiscoveryDruid::monitorOperation()
if (buf.endsWith('\n'))
buf = buf.left(buf.length() - 1);
m_dialog->discoverylog->insertPlainText(buf);
addToLog(buf);
/*if (fwbdebug) qDebug("monitorOperation appending the following buf: (1)");
if (fwbdebug) qDebug(buf.toAscii().constData());
@ -1966,7 +2004,7 @@ int DiscoveryDruid::monitorOperation()
if (buf.endsWith('\n'))
buf = buf.left(buf.length() - 1);
m_dialog->discoverylog->insertPlainText(buf);
addToLog(buf);
/*if (fwbdebug) qDebug("monitorOperation appending the following buf: (2)");
if (fwbdebug) qDebug(buf.toAscii().constData());

View File

@ -29,7 +29,6 @@
#include "../../config.h"
#include <ui_discoverydruid_q.h>
#include <QDialog>
#include <qobject.h>
#include <qthread.h>
@ -48,6 +47,9 @@
#include <vector>
#include <string>
#include <QDialog>
#include <QTextCharFormat>
using namespace std;
using namespace libfwbuilder;
@ -183,6 +185,8 @@ private:
FilterDialog * flt_net_d;
Ui::DiscoveryDruid_q * m_dialog;
QButtonGroup * dm_method;
QTextCharFormat normal_format;
QTextCharFormat error_format;
bool isSeedHostOK;
bool isSNMPInclNetOK;
@ -226,6 +230,7 @@ private:
FWObject* addInterface(libfwbuilder::FWObject *parent,
libfwbuilder::InterfaceData *in,
bool skip_ip_address_check);
void addToLog(const QString &buf);
public: