mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-19 09:47:20 +01:00
fixes #2183 count errors and warnings generated by the importer and show the numbers in the progress page of the wizard
This commit is contained in:
parent
633b65f9d7
commit
d82b81682e
@ -1,5 +1,11 @@
|
||||
2011-03-05 vadim <vadim@netcitadel.com>
|
||||
|
||||
* importFirewallConfigurationWizard/IC_ProgressPage.cpp (logLine):
|
||||
see #2183 "count errors and warnings generated by the importer and
|
||||
show the numbers in the progress page of the wizard". Configuration
|
||||
import wizard now shows counters of warnings and errors generated
|
||||
by the importer.
|
||||
|
||||
* FWBMainWindow_q.ui: see #2162 menu item "File / Import Policy"
|
||||
renamed to "File / Import Firewall". This menu item launches
|
||||
wizard that imports existing iptables, Cisco router IOS or
|
||||
|
||||
@ -52,6 +52,9 @@ IC_ProgressPage::IC_ProgressPage(QWidget *parent) : QWizardPage(parent)
|
||||
m_dialog->setupUi(this);
|
||||
importer = NULL;
|
||||
|
||||
errors_count = 0;
|
||||
warnings_count = 0;
|
||||
|
||||
QTextCursor cursor(m_dialog->importLog->textCursor());
|
||||
normal_format = cursor.charFormat();
|
||||
|
||||
@ -125,6 +128,8 @@ void IC_ProgressPage::initializePage()
|
||||
}
|
||||
|
||||
m_dialog->importLog->clear();
|
||||
m_dialog->errors_count_display->setText("0");
|
||||
m_dialog->warnings_count_display->setText("0");
|
||||
|
||||
QString platform =
|
||||
dynamic_cast<ImportFirewallConfigurationWizard*>(wizard())->
|
||||
@ -211,16 +216,28 @@ void IC_ProgressPage::logLine(const QString &buf)
|
||||
QTextCharFormat format = normal_format;
|
||||
|
||||
if (line.contains("Parser error"))
|
||||
{
|
||||
format = error_format;
|
||||
errors_count++;
|
||||
}
|
||||
|
||||
if (line.contains("Error: "))
|
||||
{
|
||||
format = error_format;
|
||||
errors_count++;
|
||||
}
|
||||
|
||||
if (line.contains("Parser warning"))
|
||||
{
|
||||
format = warning_format;
|
||||
warnings_count++;
|
||||
}
|
||||
|
||||
if (line.contains("Warning: "))
|
||||
{
|
||||
format = warning_format;
|
||||
warnings_count++;
|
||||
}
|
||||
|
||||
QString txt = line;
|
||||
while (!txt.isEmpty() && (txt.endsWith("\n") || txt.endsWith("\r")))
|
||||
@ -232,10 +249,13 @@ void IC_ProgressPage::logLine(const QString &buf)
|
||||
QTextCursor cursor = m_dialog->importLog->textCursor();
|
||||
cursor.insertBlock();
|
||||
cursor.insertText(txt, format);
|
||||
|
||||
QString s;
|
||||
m_dialog->errors_count_display->setText(s.setNum(errors_count));
|
||||
m_dialog->warnings_count_display->setText(s.setNum(warnings_count));
|
||||
}
|
||||
|
||||
m_dialog->importLog->ensureCursorVisible();
|
||||
|
||||
}
|
||||
|
||||
void IC_ProgressPage::saveLog()
|
||||
|
||||
@ -40,6 +40,8 @@ class IC_ProgressPage : public QWizardPage
|
||||
QTextCharFormat error_format;
|
||||
QTextCharFormat warning_format;
|
||||
ImporterThread *importer;
|
||||
int errors_count;
|
||||
int warnings_count;
|
||||
|
||||
public:
|
||||
IC_ProgressPage(QWidget *parent);
|
||||
|
||||
@ -48,11 +48,68 @@
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>141</width>
|
||||
<width>28</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Errors:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="errors_count_display">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Warnings:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="warnings_count_display">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user