1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-22 11:17:31 +01:00

rule group head drawn grey, no green frame around rule group

This commit is contained in:
Vadim Kurland 2008-08-23 05:32:43 +00:00
parent 5170f57d29
commit c298acf5df
5 changed files with 122 additions and 107 deletions

View File

@ -1 +1 @@
#define BUILD_NUM 481
#define BUILD_NUM 483

View File

@ -4,6 +4,11 @@
while navigating between rule elements using keyboard, it was not
possible to reach the very last rule if ruleset contained rule
groups
* RuleSetView.cpp (RuleSetView::paintCell): do not draw green
frame around rule group; draw black bracket line in the column #0
longer, almost to the bottom of the last rule row. Draw rule group
head row grey to make it visually stand out.
* ipt.cpp (main): additional fix for the bug #2051629 "group with
dns names are handled as empty": Compiler should check if any

View File

@ -11,15 +11,15 @@ SO_VERSION = @LIBFWBUILDER_SOLIB_VERSION@
DEFINES += $$(DEFINES)
LANGUAGE = C++
UI_DIR = ui
MANDIR = /Users/vadim/src/fwb3-branch-v3/install_root/share/man/
DOCDIR = /Users/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.0
MANDIR = /home/vadim/src/fwb3-branch-v3/install_root/share/man/
DOCDIR = /home/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.0
HAVE_ANTLR_RUNTIME = 1
HAVE_EXTERNAL_ANTLR = 0
unix {
ANTLR_INCLUDEPATH = /Users/vadim/src/fwb3-branch-v3/source/fwbuilder/src/
ANTLR_LIBS = /Users/vadim/src/fwb3-branch-v3/source/fwbuilder/src/antlr/libantlr.a
ANTLR_INCLUDEPATH = /home/vadim/src/fwb3-branch-v3/source/fwbuilder/src/
ANTLR_LIBS = /home/vadim/src/fwb3-branch-v3/source/fwbuilder/src/antlr/libantlr.a
FWBPARSER_LIB = ../parsers/libfwbparser.a
}
@ -30,38 +30,38 @@ unix {
MOC_DIR = .moc
OBJECTS_DIR = .obj
PREFIX = /Users/vadim/src/fwb3-branch-v3/install_root
PREFIX = /home/vadim/src/fwb3-branch-v3/install_root
exec_prefix = @EXEC_PREFIX@
DESTDIR =
ICONSDIR =
ICONSDIR = /home/vadim/src/fwb3-branch-v3/install_root/share//icons/hicolor/
INCLUDEPATH += .. ../.. $$(INCLUDEPATH) /Users/vadim/src/fwb3-branch-v3/install_root/include/ /Users/vadim/src/fwb3-branch-v3/install_root/include/fwb-3 /usr/include/libxml2
INCLUDEPATH += .. ../.. $$(INCLUDEPATH) /home/vadim/src/fwb3-branch-v3/install_root/include/ /home/vadim/src/fwb3-branch-v3/install_root/include/fwb-3 /usr/include/libxml2
LIBS_FWCOMPILER = -L/Users/vadim/src/fwb3-branch-v3/install_root/lib -lfwcompiler -lfwbuilder -lxslt -lxml2 -lz -lpthread -licucore -lm -lnetsnmp
LIBS_FWBUILDER = -L/Users/vadim/src/fwb3-branch-v3/install_root/lib -lfwbuilder -lxslt -lxml2 -lz -lpthread -licucore -lm -lnetsnmp
LIBS_FWCOMPILER = -L/home/vadim/src/fwb3-branch-v3/install_root/lib -pthread -lfwcompiler -lfwbuilder -lxslt -lxml2 -lnetsnmp -lm -lwrap
LIBS_FWBUILDER = -L/home/vadim/src/fwb3-branch-v3/install_root/lib -pthread -lfwbuilder -lxslt -lxml2 -lnetsnmp -lm -lwrap
target.path = $$PREFIX/bin
dtd.path = @TEMPLATE_DIR@/
migration.path = @TEMPLATE_DIR@/migration
doc.path = /Users/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.0
datadir.path = /Users/vadim/src/fwb3-branch-v3/install_root/share/
doc.path = /home/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.0
datadir.path = /home/vadim/src/fwb3-branch-v3/install_root/share/
# win32:target.path = $$PREFIX/
# unix:target.path = $$PREFIX/share/fwbuilder/
# macx:target.path = $$PREFIX/
res.path = ../Resources
res_os.path = ../Resources/os/
res_platform.path = ../Resources/platform/
res_help.path = ../Resources/help/
res_desktop.path = /Users/vadim/src/fwb3-branch-v3/install_root/share//applications/
res.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.0
res_os.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.0/os/
res_platform.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.0/platform/
res_help.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.0/help/
res_desktop.path = /home/vadim/src/fwb3-branch-v3/install_root/share//applications/
INSTALLS += res
INSTALLS += res_os
INSTALLS += res_platform
# INSTALLS += icns
LIBS += $$LIBS_FWBUILDER -L/sw/lib -lpoll
LIBS += $$LIBS_FWBUILDER -lutil
PKGLOCALEDIR = $$res.path/locale

View File

@ -33,7 +33,7 @@ public:
QString groupName ;
QString color ;
bool isBeginRow;
bool isFirstRow;
bool collapsedGroup ;
QModelIndex* index ;
@ -42,9 +42,9 @@ public:
this->operator =(r);
}
RuleRowInfo(QString groupName, bool begin, bool collapsed)
RuleRowInfo(QString groupName, bool first_row, bool collapsed)
{
isBeginRow = begin ;
isFirstRow = first_row ;
this->groupName = groupName;
collapsedGroup = collapsed ;
index = NULL;
@ -52,7 +52,7 @@ public:
RuleRowInfo& operator=(RuleRowInfo& r)
{
this->isBeginRow = r.isBeginRow;
this->isFirstRow = r.isFirstRow;
this->groupName = r.groupName;
this->index = r.index;
this->collapsedGroup = r.collapsedGroup ;

View File

@ -805,12 +805,10 @@ void RuleSetView::fixRulePosition(Rule *rule, FWObject *parent, int pos)
RuleRowInfo* RuleSetView::getRuleRowInfoByGroupName (QString name)
{
if (name=="")
name = "New Group";
if (name=="") name = "New Group";
for (int i = 0 ; i < rowsInfo.size(); i++)
{
if (rowsInfo[i]->groupName==name)
return rowsInfo[i];
if (rowsInfo[i]->groupName==name) return rowsInfo[i];
}
return NULL;
}
@ -819,8 +817,7 @@ int RuleSetView::getRuleRowInfoIndexByGroupName (QString name)
{
for (int i = 0 ; i < rowsInfo.size(); i++)
{
if (rowsInfo[i]->groupName==name)
return i;
if (rowsInfo[i]->groupName==name) return i;
}
return -1;
@ -950,8 +947,8 @@ void RuleSetView::debugPrintRows()
res << "groupName=";
res << rowsInfo[i]->groupName;
res << " ";
res << "isBeginning=";
res << rowsInfo[i]->isBeginRow;
res << "isFirstRow=";
res << rowsInfo[i]->isFirstRow;
res << " ";
res << "collapsed=";
res << rowsInfo[i]->collapsedGroup;
@ -975,7 +972,7 @@ void RuleSetView::addRuleGroupPanel(int row)
setSpan(row, 1, 0, ruleModel->columnCount(this->model()->index(row,0))-1);
// rri->index = &model()->index(row,0);
if (rri->isBeginRow)
if (rri->isFirstRow)
{
bool hide = isRowHidden(row+1);
RuleGroupPanel * grouppanel = new RuleGroupPanel(NULL,this,row);
@ -1029,7 +1026,7 @@ void RuleSetView::updateGroups()
setSpan(i,1,0,1);
if (ruleIndex[i]==NULL)
{
if (rowsInfo[i]->isBeginRow)
if (rowsInfo[i]->isFirstRow)
{
groupColors[rowsInfo[i]->groupName] = rowsInfo[i]->color ;
if (groupColors[rowsInfo[i]->groupName]=="")
@ -1507,11 +1504,12 @@ void RuleSetView::paintCell(QPainter *pntr,
if (col==0)
{
// qDebug("1");
// pntr->drawLine (cr.left()+10,cr.top()+20,cr.left()+30,cr.top());
// Leftmost column, we draw rule group expand/collapse control
// element here.
QPixmap bufferpixmap;
QString bpmname = QString("rulesetcell_%1_%2").arg(cr.width()).arg(cr.height());
QString bpmname = QString("rulesetcell_%1_%2").
arg(cr.width()).arg(cr.height());
if ( ! QPixmapCache::find( bpmname, bufferpixmap) )
{
bufferpixmap = QPixmap( cr.width() , cr.height() );
@ -1526,55 +1524,73 @@ void RuleSetView::paintCell(QPainter *pntr,
if (rule==NULL)
{
RuleRowInfo * rri = rowsInfo[row];
RuleRowInfo * rri = rowsInfo[row];
if (rri->isBeginRow)
{
p.drawRect((cr.width()-1)/2-4,(cr.height()-1)/2-4,8,8);
p.drawLine( (cr.width()-1)/2+7, (cr.height()-1)/2, cr.width()-1, (cr.height()-1)/2 );
if (!isRowHidden(row+1))
{
p.drawLine( (cr.width()-1)/2, (cr.height()-1)/2+7, (cr.width()-1)/2, cr.height()-1 );
p.drawLine( (cr.width()-1)/2-2, (cr.height()-1)/2,(cr.width()-1)/2+2, (cr.height()-1)/2);
}
else
{
p.drawLine( (cr.width()-1)/2-2, (cr.height()-1)/2,(cr.width()-1)/2+2, (cr.height()-1)/2);
p.drawLine( (cr.width()-1)/2, (cr.height()-1)/2-2,(cr.width()-1)/2, (cr.height()-1)/2+2);
}
if (rri->isFirstRow)
{
p.drawRect((cr.width()-1)/2-4,(cr.height()-1)/2-4,8,8);
p.drawLine( (cr.width()-1)/2+7, (cr.height()-1)/2,
cr.width()-1, (cr.height()-1)/2 );
if (!isRowHidden(row+1))
{
p.drawLine(
(cr.width()-1)/2, (cr.height()-1)/2+7,
(cr.width()-1)/2, cr.height()-1 );
p.drawLine(
(cr.width()-1)/2-2, (cr.height()-1)/2,
(cr.width()-1)/2+2, (cr.height()-1)/2);
}
else
{
p.drawLine(
(cr.width()-1)/2-2, (cr.height()-1)/2,
(cr.width()-1)/2+2, (cr.height()-1)/2);
p.drawLine(
(cr.width()-1)/2, (cr.height()-1)/2-2,
(cr.width()-1)/2, (cr.height()-1)/2+2);
}
}
}
}
else
{
QString group = rule->getRuleGroupName ().c_str();
if (group != "")
QString group = rule->getRuleGroupName().c_str();
if (group != "")
{
if (groupEnd!=-1 && groupEnd==row+1)
{
if (groupEnd!=-1&&groupEnd==row+1)
{
p.drawLine( (cr.width()-1)/2, (cr.height()-1)/2, cr.width()-1, (cr.height()-1)/2 );
p.drawLine( (cr.width()-1)/2, (cr.height()-1)/2, (cr.width()-1)/2, 0 );
}
else
{
p.drawLine( (cr.width()-1)/2, 0, (cr.width()-1)/2, cr.height()-1 );
}
// p.drawLine( (cr.width()-1)/2, (cr.height()-1)/2,
// cr.width()-1, (cr.height()-1)/2 );
// p.drawLine( (cr.width()-1)/2, (cr.height()-1)/2,
// (cr.width()-1)/2, 0 );
p.drawLine( (cr.width()-1)/2, cr.height()-4,
cr.width()-1, cr.height()-4 );
p.drawLine( (cr.width()-1)/2, cr.height()-4,
(cr.width()-1)/2, 0 );
}
else
{
p.drawLine( (cr.width()-1)/2, 0, (cr.width()-1)/2,
cr.height()-1 );
}
}
}
p.end();
pntr->drawPixmap( cr.left() - horizontalOffset(), cr.top() - verticalOffset(), bufferpixmap );
p.end();
pntr->drawPixmap( cr.left() - horizontalOffset(),
cr.top() - verticalOffset(), bufferpixmap );
return ;
}
if (rule==NULL)
{
RuleRowInfo * rri = rowsInfo[row];
QPixmap bufferpixmap;
QString bpmname = QString("rulesetcell_%1_%2").arg(cr.width()).arg(cr.height());
QString bpmname = QString("rulesetcell_%1_%2").
arg(cr.width()).arg(cr.height());
if ( ! QPixmapCache::find( bpmname, bufferpixmap) )
{
bufferpixmap = QPixmap( cr.width() , cr.height() );
@ -1586,21 +1602,19 @@ void RuleSetView::paintCell(QPainter *pntr,
QPainter p( &bufferpixmap );
QFont font = st->getRulesFont();
p.setFont(font);
if (!rri->color.isEmpty())
{
QRect rect(0, 0, cr.width(), cr.height() );
p.fillRect(rect, QColor(rri->color));
}
QRect rect(0, 0, cr.width(), cr.height() );
p.fillRect(rect, palette().color(QPalette::Active,
QPalette::AlternateBase));
#ifdef DRAW_RULE_GROUP_FRAME
p.setPen(Qt::green);
if (rri->isBeginRow)
if (rri->isFirstRow)
{
p.drawLine( 1, 1, 1, cr.height() );
p.drawLine( 1, 1, cr.width()-3, 1 );
p.drawLine( cr.width()-3, 1, cr.width()-3, cr.height() );
}
#endif
if (isRowHidden(row+1))
{
p.drawLine( 1, cr.height()-3, cr.width() , cr.height()-3);
@ -1609,18 +1623,16 @@ void RuleSetView::paintCell(QPainter *pntr,
p.end();
pntr->drawPixmap( cr.left() - horizontalOffset(), cr.top() - verticalOffset(), bufferpixmap );
/*
p.drawLine( (cr.width()-1)/2, (cr.height()-1)/2, cr.width()-1, (cr.height()-1)/2 );
if (rri->isBeginRow)
p.drawLine( (cr.width()-1)/2, (cr.height()-1)/2, (cr.width()-1)/2, cr.height()-1 );
else
p.drawLine( (cr.width()-1)/2, (cr.height()-1)/2, (cr.width()-1)/2, 0 );
*/
pntr->drawPixmap( cr.left() - horizontalOffset(),
cr.top() - verticalOffset(), bufferpixmap );
/*
p.drawLine( (cr.width()-1)/2, (cr.height()-1)/2, cr.width()-1, (cr.height()-1)/2 );
if (rri->isFirstRow)
p.drawLine( (cr.width()-1)/2, (cr.height()-1)/2, (cr.width()-1)/2, cr.height()-1 );
else
p.drawLine( (cr.width()-1)/2, (cr.height()-1)/2, (cr.width()-1)/2, 0 );
*/
return;
}
@ -1630,7 +1642,8 @@ void RuleSetView::paintCell(QPainter *pntr,
rclr = ropt->getStr("color").c_str();
QPixmap bufferpixmap;
QString bpmname = QString("rulesetcell_%1_%2").arg(cr.width()).arg(cr.height());
QString bpmname = QString("rulesetcell_%1_%2").
arg(cr.width()).arg(cr.height());
if ( ! QPixmapCache::find( bpmname, bufferpixmap) )
{
bufferpixmap = QPixmap( cr.width() , cr.height() );
@ -1647,12 +1660,7 @@ void RuleSetView::paintCell(QPainter *pntr,
QRect r = ruleDelegate->cellRect(row,col);
static int lastrow = 0;
if (lastrow != row)
{
lastrow = row;
/*if (fwbdebug)
qDebug("RuleSetView::paintCell real row %d height is %d", row, r.height());*/
}
if (lastrow != row) lastrow = row;
int x = r.left() + RuleElementSpacing/2;
int y = r.top();
@ -1669,8 +1677,10 @@ void RuleSetView::paintCell(QPainter *pntr,
p.drawLine( cr.width(), 1, cr.width(), cr.height() );
p.drawLine( 1, cr.height(), cr.width(), cr.height() );
/*const BackgroundMode bgmode = backgroundMode();
const QColorGroup::ColorRole crole = QPalette::backgroundRoleFromMode( bgmode );*/
/*
const BackgroundMode bgmode = backgroundMode();
const QColorGroup::ColorRole crole = QPalette::backgroundRoleFromMode( bgmode );
*/
bool sel = (row==currentRow() && col==currentColumn());
@ -1789,7 +1799,8 @@ void RuleSetView::paintCell(QPainter *pntr,
if (br.height()>height)
height=br.height();
p.drawText( x, y+ RuleElementSpacing/2, br.width(), height,
Qt::AlignLeft|Qt::AlignVCenter, res.toAscii().constData() );
Qt::AlignLeft|Qt::AlignVCenter,
res.toAscii().constData() );
break;
}
case Direction:
@ -1823,7 +1834,8 @@ void RuleSetView::paintCell(QPainter *pntr,
if (br.height()>height)
height=br.height();
p.drawText( x, y+ RuleElementSpacing/2, br.width(), height,
Qt::AlignLeft|Qt::AlignVCenter, res.toAscii().constData() );
Qt::AlignLeft|Qt::AlignVCenter,
res.toAscii().constData() );
break;
}
@ -1888,11 +1900,11 @@ void RuleSetView::paintCell(QPainter *pntr,
}
#ifdef DRAW_RULE_GROUP_FRAME
QString group = rule->getRuleGroupName ().c_str();
if (group!= "")
{
if (groupEnd!=-1&&groupEnd==row+1)
if (groupEnd!=-1 && groupEnd==row+1)
{
p.setPen(Qt::green);
if (col==1)
@ -1904,8 +1916,8 @@ void RuleSetView::paintCell(QPainter *pntr,
{
p.drawLine( cr.width()-3, 0, cr.width()-3, cr.height()-3 );
}
//p.drawLine( cr.width()-3, 0, cr.width()-3, cr.height()-1 );
}
//p.drawLine( cr.width()-3, 0, cr.width()-3, cr.height()-1 );
}
else
{
@ -1921,11 +1933,9 @@ void RuleSetView::paintCell(QPainter *pntr,
}
}
}
}
#endif
p.end();
@ -2629,7 +2639,7 @@ void RuleSetView::addToGroupAbove ()
if (fwbdebug)
qDebug("RuleSetView::addToGroupAbove row=%d count=%d", row, count);
if (!ru->isBeginRow)
if (!ru->isFirstRow)
{
top = getUpNullRuleIndex(top-1);
ru = rowsInfo[top];