This commit is contained in:
Vadim Kurland
2009-09-29 02:18:22 +00:00
parent a394b10138
commit c3fbf1b444
4 changed files with 35 additions and 13 deletions
+1 -1
View File
@@ -1 +1 @@
#define BUILD_NUM 1506 #define BUILD_NUM 1516
+1
View File
@@ -207,6 +207,7 @@ void RuleSetModel::initModel()
} }
} }
if (fwbdebug)
qDebug("Model init: %d ms", t.elapsed()); qDebug("Model init: %d ms", t.elapsed());
} }
+24 -3
View File
@@ -2,7 +2,7 @@
Firewall Builder Firewall Builder
Copyright (C) 2003 NetCitadel, LLC Copyright (C) 2003-2009 NetCitadel, LLC
Author: Illiya Yalovoy <yalovoy@gmail.com> Author: Illiya Yalovoy <yalovoy@gmail.com>
@@ -21,6 +21,9 @@
To get a copy of the GNU General Public License, write to the Free Software To get a copy of the GNU General Public License, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
This module has been completely rewritten by yalovoy@gmail.com in 2009
*/ */
#include "../../config.h" #include "../../config.h"
@@ -120,10 +123,13 @@ void RuleSetView::init()
setUpdatesEnabled(false); setUpdatesEnabled(false);
QTime t; t.start(); QTime t; t.start();
configureGroups(); configureGroups();
if (fwbdebug)
qDebug("RuleSetView configureGroups: %d ms", t.restart()); qDebug("RuleSetView configureGroups: %d ms", t.restart());
restoreCollapsedGroups(); restoreCollapsedGroups();
if (fwbdebug)
qDebug("RuleSetView restoreCollapsedGroups: %d ms", t.restart()); qDebug("RuleSetView restoreCollapsedGroups: %d ms", t.restart());
resizeColumns(); resizeColumns();
if (fwbdebug)
qDebug("RuleSetView resizeColumns: %d ms", t.restart()); qDebug("RuleSetView resizeColumns: %d ms", t.restart());
setUpdatesEnabled(true); setUpdatesEnabled(true);
} }
@@ -921,6 +927,9 @@ void RuleSetView::renameGroup()
md->renameGroup(index, newGroupName); md->renameGroup(index, newGroupName);
} }
} }
QCoreApplication::postEvent(
mw, new dataModifiedEvent(project->getFileName(), md->getRuleSet()->getId()));
} }
void RuleSetView::setRuleColor(const QString &c) void RuleSetView::setRuleColor(const QString &c)
@@ -1395,6 +1404,8 @@ void RuleSetView::removeFromGroup()
md->removeFromGroup(group, itemsInGroups[group].first(), itemsInGroups[group].last()); md->removeFromGroup(group, itemsInGroups[group].first(), itemsInGroups[group].last());
} }
QCoreApplication::postEvent(
mw, new dataModifiedEvent(project->getFileName(), md->getRuleSet()->getId()));
} }
FWObject *RuleSetView::getObject(const QPoint &pos, const QModelIndex &index) FWObject *RuleSetView::getObject(const QPoint &pos, const QModelIndex &index)
@@ -1742,6 +1753,7 @@ void RuleSetView::deleteSelectedObject()
fwosm->reset(); fwosm->reset();
project->findObjectWidget->reset(); project->findObjectWidget->reset();
QCoreApplication::postEvent( QCoreApplication::postEvent(
mw, new dataModifiedEvent(project->getFileName(), md->getRuleSet()->getId())); mw, new dataModifiedEvent(project->getFileName(), md->getRuleSet()->getId()));
} }
@@ -1794,7 +1806,6 @@ void RuleSetView::pasteObject()
} }
QCoreApplication::postEvent( QCoreApplication::postEvent(
mw, new dataModifiedEvent(project->getFileName(), md->getRuleSet()->getId())); mw, new dataModifiedEvent(project->getFileName(), md->getRuleSet()->getId()));
} }
void RuleSetView::dragEnterEvent( QDragEnterEvent *ev) void RuleSetView::dragEnterEvent( QDragEnterEvent *ev)
@@ -1861,6 +1872,10 @@ void RuleSetView::dropEvent(QDropEvent *ev)
} }
} }
} }
QCoreApplication::postEvent(
mw, new dataModifiedEvent(project->getFileName(), md->getRuleSet()->getId()));
setCurrentIndex(index); setCurrentIndex(index);
ev->accept(); ev->accept();
} }
@@ -2025,26 +2040,32 @@ void RuleSetView::restoreCollapsedGroups()
RuleSetModel* md = ((RuleSetModel*)model()); RuleSetModel* md = ((RuleSetModel*)model());
QStringList collapsed_groups; QStringList collapsed_groups;
QString filename = project->getRCS()->getFileName(); QString filename = project->getRCS()->getFileName();
if (fwbdebug)
qDebug("restoreCollapsedGroups begin: %d ms", t.restart()); qDebug("restoreCollapsedGroups begin: %d ms", t.restart());
st->getCollapsedRuleGroups( st->getCollapsedRuleGroups(
filename, filename,
md->getFirewall()->getName().c_str(), md->getFirewall()->getName().c_str(),
md->getRuleSet()->getName().c_str(), md->getRuleSet()->getName().c_str(),
collapsed_groups); collapsed_groups);
if (fwbdebug)
qDebug("restoreCollapsedGroups getCollapsedRuleGroups: %d ms", t.restart()); qDebug("restoreCollapsedGroups getCollapsedRuleGroups: %d ms", t.restart());
QList<QModelIndex> groups; QList<QModelIndex> groups;
md->getGroups(groups); md->getGroups(groups);
if (fwbdebug)
{
qDebug("restoreCollapsedGroups getGroups: %d ms", t.restart()); qDebug("restoreCollapsedGroups getGroups: %d ms", t.restart());
qDebug() << "Groups:" << groups.size(); qDebug() << "Groups:" << groups.size();
}
foreach (QModelIndex index, groups) foreach (QModelIndex index, groups)
{ {
RuleNode* node = static_cast<RuleNode *>(index.internalPointer()); RuleNode* node = static_cast<RuleNode *>(index.internalPointer());
setExpanded(index, !collapsed_groups.contains(node->name) ); setExpanded(index, !collapsed_groups.contains(node->name) );
} }
qDebug("restoreCollapsedGroups foreach setExpanded: %d ms", t.restart());
if (fwbdebug)
qDebug("restoreCollapsedGroups foreach setExpanded: %d ms", t.restart());
} }
int RuleSetView::rowHeight(const QModelIndex& index) const int RuleSetView::rowHeight(const QModelIndex& index) const
+1 -1
View File
@@ -2,7 +2,7 @@
Firewall Builder Firewall Builder
Copyright (C) 2003 NetCitadel, LLC Copyright (C) 2003-2009 NetCitadel, LLC
Author: Illiya Yalovoy <yalovoy@gmail.com> Author: Illiya Yalovoy <yalovoy@gmail.com>