mirror of
https://github.com/tnodir/fort
synced 2024-11-15 01:15:29 +00:00
UI: ConnBlockListModel: QT_TR_NOOP inside class
This commit is contained in:
parent
297f7cf8c3
commit
0269c97e7a
@ -36,28 +36,6 @@ QString formatIpPort(const ip_addr_t &ip, quint16 port, bool isIPv6, bool resolv
|
||||
return address + ':' + QString::number(port);
|
||||
}
|
||||
|
||||
QString reasonText(const ConnRow &connRow)
|
||||
{
|
||||
static const char *const blockReasonTexts[] = {
|
||||
QT_TR_NOOP("Blocked Internet address"),
|
||||
QT_TR_NOOP("Old connection closed on startup"),
|
||||
QT_TR_NOOP("Programs logic"),
|
||||
QT_TR_NOOP("App. Group logic"),
|
||||
QT_TR_NOOP("Filter Mode logic"),
|
||||
QT_TR_NOOP("Restrict access to LAN only"),
|
||||
QT_TR_NOOP("Restrict access by Zone"),
|
||||
QT_TR_NOOP("Limit of Ask to Connect"),
|
||||
};
|
||||
|
||||
if (connRow.blockReason >= FORT_BLOCK_REASON_IP_INET
|
||||
&& connRow.blockReason <= FORT_BLOCK_REASON_ASK_LIMIT) {
|
||||
const int index = connRow.blockReason - FORT_BLOCK_REASON_IP_INET;
|
||||
return ConnBlockListModel::tr(blockReasonTexts[index]);
|
||||
}
|
||||
|
||||
return ConnBlockListModel::tr("Unknown");
|
||||
}
|
||||
|
||||
QString reasonIconPath(const ConnRow &connRow)
|
||||
{
|
||||
static const char *const blockReasonIcons[] = {
|
||||
@ -122,7 +100,7 @@ QVariant dataDisplayDirection(const ConnRow &connRow, bool /*resolveAddress*/, i
|
||||
QVariant dataDisplayReason(const ConnRow &connRow, bool /*resolveAddress*/, int role)
|
||||
{
|
||||
if (role == Qt::ToolTipRole) {
|
||||
return reasonText(connRow)
|
||||
return ConnBlockListModel::blockReasonText(FortBlockReason(connRow.blockReason))
|
||||
+ (connRow.inherited ? " (" + ConnBlockListModel::tr("Inherited") + ")"
|
||||
: QString());
|
||||
}
|
||||
@ -460,3 +438,24 @@ void ConnBlockListModel::insertConnRows(qint64 idMax, int endRow, int count)
|
||||
invalidateRowCache();
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
QString ConnBlockListModel::blockReasonText(FortBlockReason reason)
|
||||
{
|
||||
static const char *const blockReasonTexts[] = {
|
||||
QT_TR_NOOP("Blocked Internet address"),
|
||||
QT_TR_NOOP("Old connection closed on startup"),
|
||||
QT_TR_NOOP("Programs logic"),
|
||||
QT_TR_NOOP("App. Group logic"),
|
||||
QT_TR_NOOP("Filter Mode logic"),
|
||||
QT_TR_NOOP("Restrict access to LAN only"),
|
||||
QT_TR_NOOP("Restrict access by Zone"),
|
||||
QT_TR_NOOP("Limit of Ask to Connect"),
|
||||
};
|
||||
|
||||
if (reason >= FORT_BLOCK_REASON_IP_INET && reason <= FORT_BLOCK_REASON_ASK_LIMIT) {
|
||||
const int index = reason - FORT_BLOCK_REASON_IP_INET;
|
||||
return tr(blockReasonTexts[index]);
|
||||
}
|
||||
|
||||
return tr("Unknown");
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <QDateTime>
|
||||
|
||||
#include <common/common_types.h>
|
||||
#include <common/fortdef.h>
|
||||
#include <util/model/tablesqlmodel.h>
|
||||
|
||||
class AppInfoCache;
|
||||
@ -61,6 +62,8 @@ public:
|
||||
|
||||
const ConnRow &connRowAt(int row) const;
|
||||
|
||||
static QString blockReasonText(FortBlockReason reason);
|
||||
|
||||
protected slots:
|
||||
void updateConnIdRange();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user