mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-09-15 17:39:01 +02:00
2546 (enh)
This commit is contained in:
@@ -99,6 +99,7 @@ const char* screenPositionSetpath= SETTINGS_PATH_PREFIX "/ScreenPos/";
|
||||
|
||||
const char* SSHPath = SETTINGS_PATH_PREFIX "/SSH/SSHPath";
|
||||
const char* showIconsInRules = SETTINGS_PATH_PREFIX "/UI/Icons/ShowIconsInRules";
|
||||
const char* showDirectionText = SETTINGS_PATH_PREFIX "/UI/Icons/ShowDirectionTextInRules";
|
||||
const char* iconsInRulesSize = SETTINGS_PATH_PREFIX "/UI/Icons/IconsInRulesSize";
|
||||
const char* rulesFont = SETTINGS_PATH_PREFIX "/UI/Fonts/RulesFont";
|
||||
const char* treeFont = SETTINGS_PATH_PREFIX "/UI/Fonts/TreeFont";
|
||||
@@ -581,6 +582,17 @@ void FWBSettings::setShowIconsInRules(bool showIcons)
|
||||
setValue(showIconsInRules, showIcons);
|
||||
}
|
||||
|
||||
bool FWBSettings::getShowDirectionText()
|
||||
{
|
||||
return value(showDirectionText).toBool();
|
||||
}
|
||||
|
||||
void FWBSettings::setShowDirectionText(bool showText)
|
||||
{
|
||||
setValue(showDirectionText, showText);
|
||||
}
|
||||
|
||||
|
||||
QFont FWBSettings::getRulesFont()
|
||||
{
|
||||
return getFontByType(rulesFont);
|
||||
|
||||
@@ -143,6 +143,9 @@ class FWBSettings : public QSettings {
|
||||
bool getShowIconsInRules();
|
||||
void setShowIconsInRules(bool showIcons);
|
||||
|
||||
bool getShowDirectionText();
|
||||
void setShowDirectionText(bool showText);
|
||||
|
||||
QFont getRulesFont();
|
||||
void setRulesFont(const QFont &font);
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ PrefsDialog::PrefsDialog(QWidget *parent) : QDialog(parent)
|
||||
m_dialog->grayText->setText(t);
|
||||
|
||||
m_dialog->chShowIcons->setChecked(st->getShowIconsInRules() );
|
||||
|
||||
m_dialog->showDirectionText->setChecked(st->getShowDirectionText());
|
||||
if (FWBSettings::SIZE25X25 == st->getIconsInRulesSize())
|
||||
m_dialog->rb25->setChecked(true);
|
||||
else
|
||||
@@ -439,6 +439,7 @@ void PrefsDialog::accept()
|
||||
st->setLabelText (FWBSettings::GRAY, m_dialog->grayText->text() );
|
||||
|
||||
st->setShowIconsInRules(m_dialog->chShowIcons->isChecked());
|
||||
st->setShowDirectionText(m_dialog->showDirectionText->isChecked());
|
||||
FWBSettings::IconSize sz = m_dialog->rb25->isChecked() ?
|
||||
FWBSettings::SIZE25X25 : FWBSettings::SIZE16X16;
|
||||
st->setIconsInRulesSize(sz);
|
||||
|
||||
+45
-10
@@ -1217,9 +1217,15 @@ QRect RuleSetView::calculateCellSize( int row, int col )
|
||||
"Accept", "Deny", "Reject", "Accounting", "Tag",
|
||||
"Pipe", "Classify", "Custom", "Continue"
|
||||
*/
|
||||
QString ac =
|
||||
FWObjectPropertiesFactory::getRuleActionProperties(
|
||||
PolicyRule::cast(rule));
|
||||
PolicyRule *ruleP = PolicyRule::cast( rule );
|
||||
if (ruleP==NULL)
|
||||
break ;
|
||||
QString ac = ruleP->getActionAsString().c_str();
|
||||
|
||||
|
||||
|
||||
//FWObjectPropertiesFactory::getRuleActionProperties(
|
||||
//PolicyRule::cast(rule));
|
||||
QRect br=p.boundingRect(QRect(0, 0, 1000, 1000),
|
||||
Qt::AlignLeft|Qt::AlignVCenter, ac );
|
||||
hc = item_h;
|
||||
@@ -1229,8 +1235,17 @@ QRect RuleSetView::calculateCellSize( int row, int col )
|
||||
|
||||
case Direction:
|
||||
{
|
||||
PolicyRule *ruleP = PolicyRule::cast( rule );
|
||||
if (ruleP==NULL)
|
||||
break ;
|
||||
QString ac = ruleP->getDirectionAsString().c_str();
|
||||
// FWObjectPropertiesFactory::getRuleActionProperties(
|
||||
// PolicyRule::cast(rule));
|
||||
QRect br=p.boundingRect(QRect(0, 0, 1000, 1000),
|
||||
Qt::AlignLeft|Qt::AlignVCenter, ac );
|
||||
|
||||
hc = item_h;
|
||||
wc = RuleElementSpacing/2 + pixmap_w + RuleElementSpacing;
|
||||
wc = RuleElementSpacing/2 + pixmap_w + RuleElementSpacing + br.width();
|
||||
break;
|
||||
#if 0
|
||||
/* possible directions: "Inbound", "Outbound" , "Both" */
|
||||
@@ -1645,13 +1660,19 @@ void RuleSetView::paintCell(QPainter *pntr,
|
||||
res = FWObjectPropertiesFactory::getRuleActionProperties(rule);
|
||||
QPixmap pm;
|
||||
LoadPixmap(icn, pm);
|
||||
|
||||
int height = pm.height();
|
||||
p.drawPixmap( x,y + RuleElementSpacing/2, pm );
|
||||
x += pm.width()+1;
|
||||
if (st->getShowDirectionText())
|
||||
{
|
||||
res = act.c_str() ;
|
||||
}
|
||||
QRect br=p.boundingRect(QRect(x, y, 1000, 1000),
|
||||
Qt::AlignLeft|Qt::AlignVCenter,
|
||||
res.toAscii().constData() );
|
||||
p.drawText( x, y, br.width(), pm.height(),
|
||||
if (br.height()>height)
|
||||
height=br.height();
|
||||
p.drawText( x, y+ RuleElementSpacing/2, br.width(), height,
|
||||
Qt::AlignLeft|Qt::AlignVCenter, res.toAscii().constData() );
|
||||
break;
|
||||
}
|
||||
@@ -1661,19 +1682,33 @@ void RuleSetView::paintCell(QPainter *pntr,
|
||||
if (rule==NULL) return;
|
||||
|
||||
string dir = rule->getDirectionAsString();
|
||||
QString dir_ = rule->getDirectionAsString().c_str();
|
||||
QString dir_ = rule->getDirectionAsString().c_str();
|
||||
if (dir.empty())
|
||||
dir = "Both";
|
||||
dir = "Both";
|
||||
//dir="Both-tree";
|
||||
|
||||
|
||||
QString icn = chooseIcon((":/Icons/" + dir).c_str());
|
||||
|
||||
QString res ="";
|
||||
|
||||
QPixmap pm;
|
||||
LoadPixmap(icn, pm);
|
||||
int height = pm.height();
|
||||
if (st->getShowDirectionText())
|
||||
{
|
||||
res = dir.c_str() ;
|
||||
}
|
||||
|
||||
p.drawPixmap( x,y + RuleElementSpacing/2, pm );
|
||||
x += pm.width()+1;
|
||||
|
||||
QRect br=p.boundingRect(QRect(x, y, 1000, 1000),
|
||||
Qt::AlignLeft|Qt::AlignVCenter,
|
||||
res.toAscii().constData() );
|
||||
if (br.height()>height)
|
||||
height=br.height();
|
||||
p.drawText( x, y+ RuleElementSpacing/2, br.width(), height,
|
||||
Qt::AlignLeft|Qt::AlignVCenter, res.toAscii().constData() );
|
||||
|
||||
break;
|
||||
}
|
||||
case Options:
|
||||
|
||||
@@ -865,8 +865,8 @@
|
||||
<attribute name="toolTip" >
|
||||
<string>Icons settings</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QCheckBox" name="chShowIcons" >
|
||||
<property name="text" >
|
||||
<string>Show icons in rules</string>
|
||||
@@ -876,7 +876,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QCheckBox" name="showDirectionText" >
|
||||
<property name="text" >
|
||||
<string>Show text descriptions in columns "Direction", "Action"</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
<string>Icon size:</string>
|
||||
@@ -905,7 +912,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="3" column="0" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
||||
Reference in New Issue
Block a user