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

2009-01-24 vadim <vadim@vk.crocodile.org>

* platforms.cpp (getReadableRuleElementName): code refactoring:
made it possible to translate ruleset table column
names ("Source", "Destination" etc.). Currently only Russian
translation is provided.
This commit is contained in:
Vadim Kurland 2009-01-24 08:01:32 +00:00
parent ac34c6f2a1
commit 076864e9e3
10 changed files with 5680 additions and 4134 deletions

View File

@ -1 +1 @@
#define BUILD_NUM 747
#define BUILD_NUM 748

View File

@ -1,3 +1,10 @@
2009-01-24 vadim <vadim@vk.crocodile.org>
* platforms.cpp (getReadableRuleElementName): code refactoring:
made it possible to translate ruleset table column
names ("Source", "Destination" etc.). Currently only Russian
translation is provided.
2009-01-23 vadim <vadim@vk.crocodile.org>
* FindWhereUsedWidget.cpp (FindWhereUsedWidget::createQTWidgetItem):

View File

@ -304,7 +304,8 @@ QTreeWidgetItem* FindWhereUsedWidget::createQTWidgetItem(FWObject* o,
QString rule_element_name;
if (RuleElement::cast(container)!=NULL)
rule_element_name = container->getTypeName().c_str();
rule_element_name =
getReadableRuleElementName(container->getTypeName());
if (Rule::cast(container)!=NULL)
rule_element_name = "Action";

View File

@ -4998,37 +4998,37 @@ void PolicyView::init()
qsl << "";
colTypes[col++] = GroupHandle;
qsl << "Source"; // 0
qsl << getReadableRuleElementName(RuleElementSrc::TYPENAME); // 0
colTypes[col++] = Object;
qsl << "Destination"; // 1
qsl << getReadableRuleElementName(RuleElementDst::TYPENAME); // 1
colTypes[col++] = Object;
qsl << "Service"; // 2
qsl << getReadableRuleElementName(RuleElementSrv::TYPENAME); // 2
colTypes[col++] = Object;
qsl << "Interface"; // 3
qsl << getReadableRuleElementName(RuleElementItf::TYPENAME); // 3
colTypes[col++] = Object;
qsl << "Direction"; // 4
qsl << getReadableRuleElementName("Direction"); // 4
colTypes[col++] = Direction;
qsl << "Action"; // 5
qsl << getReadableRuleElementName("Action"); // 5
colTypes[col++] = Action;
if (supports_time)
{
qsl << "Time"; // 6
qsl << getReadableRuleElementName(RuleElementInterval::TYPENAME); // 6
colTypes[col++] = Time;
}
if (supports_logging && supports_rule_options)
{
qsl << "Options";
qsl << getReadableRuleElementName("Options");
colTypes[col++] = Options;
}
qsl << "Comment";
qsl << getReadableRuleElementName("Comment");
colTypes[col] = Comment;
ruleModel->setHeader(qsl);
@ -5108,28 +5108,28 @@ void NATView::init()
qsl << "";
colTypes[col++] = GroupHandle;
qsl << "Original Src";
qsl << getReadableRuleElementName(RuleElementOSrc::TYPENAME);
colTypes[col++] = Object;
qsl << "Original Dst";
qsl << getReadableRuleElementName(RuleElementODst::TYPENAME);
colTypes[col++] = Object;
qsl << "Original Srv";
qsl << getReadableRuleElementName(RuleElementOSrv::TYPENAME);
colTypes[col++] = Object;
qsl << "Translated Src";
qsl << getReadableRuleElementName(RuleElementTSrc::TYPENAME);
colTypes[col++] = Object;
qsl << "Translated Dst";
qsl << getReadableRuleElementName(RuleElementTDst::TYPENAME);
colTypes[col++] = Object;
qsl << "Translated Srv";
qsl << getReadableRuleElementName(RuleElementTSrv::TYPENAME);
colTypes[col++] = Object;
qsl << "Options";
qsl << getReadableRuleElementName("Options");
colTypes[col++] = Options;
qsl << "Comment";
qsl << getReadableRuleElementName("Comment");
colTypes[col++] = Comment;
ruleModel->setHeader(qsl);
@ -5200,25 +5200,25 @@ void RoutingView::init()
qsl << "";
colTypes[col++] = GroupHandle;
qsl << "Destination";
qsl << getReadableRuleElementName(RuleElementRDst::TYPENAME);
colTypes[col++] = Object;
qsl << "Gateway";
qsl << getReadableRuleElementName(RuleElementRGtw::TYPENAME);
colTypes[col++] = Object;
if (supports_routing_itf)
{
qsl << "Interface";
qsl << getReadableRuleElementName(RuleElementRItf::TYPENAME);
colTypes[col++] = Object;
}
qsl << "Metric";
qsl << getReadableRuleElementName("Metric");
colTypes[col++] = Metric;
qsl << "Options";
qsl << getReadableRuleElementName("Options");
colTypes[col++] = Options;
qsl << "Comment";
qsl << getReadableRuleElementName("Comment");
colTypes[col] = Comment;
ruleModel->setHeader(qsl);

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -530,7 +530,8 @@ QString getScreenName(QString s, const QStringList &sl)
* files and are not pulled using Rule::getActionAsString.
*/
QString getActionNameForPlatform(PolicyRule::Action action,const QString &platform)
QString getActionNameForPlatform(PolicyRule::Action action,
const QString &platform)
{
QString action_name = "";
switch (action)
@ -604,3 +605,39 @@ bool getStatelessFlagForAction(PolicyRule *rule)
else
return true;
}
/**
* Returns translatable string - name of the corresponding rule element.
*/
QString getReadableRuleElementName(const string &rule_element_type_name)
{
// The following map TYPENAME of RuleElement classes to readable
// translatable names.
if (rule_element_type_name == "Src") return QObject::tr("Source");
if (rule_element_type_name == "Dst") return QObject::tr("Destination");
if (rule_element_type_name == "Srv") return QObject::tr("Service");
if (rule_element_type_name == "Itf") return QObject::tr("Interface");
if (rule_element_type_name == "When") return QObject::tr("Time");
if (rule_element_type_name == "OSrc") return QObject::tr("Original Src");
if (rule_element_type_name == "ODst") return QObject::tr("Original Dst");
if (rule_element_type_name == "OSrv") return QObject::tr("Original Srv");
if (rule_element_type_name == "TSrc") return QObject::tr("Translated Src");
if (rule_element_type_name == "TDst") return QObject::tr("Translated Dst");
if (rule_element_type_name == "TSrv") return QObject::tr("Translated Srv");
if (rule_element_type_name == "RDst") return QObject::tr("Destination");
if (rule_element_type_name == "RGtw") return QObject::tr("Gateway");
if (rule_element_type_name == "RItf") return QObject::tr("Interface");
// as of v3.0.x the following are not real rule elements (not separate
// classes with names) but just attributes of corresponding Rule class.
if (rule_element_type_name == "Direction") return QObject::tr("Direction");
if (rule_element_type_name == "Action") return QObject::tr("Action");
if (rule_element_type_name == "Options") return QObject::tr("Options");
if (rule_element_type_name == "Metric") return QObject::tr("Metric");
if (rule_element_type_name == "Comment") return QObject::tr("Comment");
return QString();
}

View File

@ -108,9 +108,12 @@ QStringList getScreenNames(const QStringList &sl);
*/
QString getScreenName(QString s,const QStringList &sl);
QString getActionNameForPlatform(libfwbuilder::PolicyRule::Action action,const QString &platform);
QString getActionNameForPlatform(libfwbuilder::PolicyRule::Action action,
const QString &platform);
bool getStatelessFlagForAction(libfwbuilder::PolicyRule *rule);
QString getReadableRuleElementName(const std::string &rule_element_type_name);
#endif