Rename FieldEdit::setMask as FieldEdit::setMaskMode

This commit is contained in:
Srivats P 2021-12-11 13:40:44 +05:30
parent 975ce8093d
commit f0c7ef50f7
3 changed files with 11 additions and 11 deletions

View File

@ -35,25 +35,25 @@ void FieldEdit::setType(FieldType type)
switch (type_) { switch (type_) {
case kUInt64: case kUInt64:
setValidator(&uint64Validator_); setValidator(&uint64Validator_);
if (isMask_) if (isMaskMode_)
setText("0xFFFFFFFFFFFFFFFF"); setText("0xFFFFFFFFFFFFFFFF");
break; break;
case kMacAddress: case kMacAddress:
setValidator(&macValidator_); setValidator(&macValidator_);
setPlaceholderText("00:00:00:00:00:00"); setPlaceholderText("00:00:00:00:00:00");
if (isMask_) if (isMaskMode_)
setText("FF:FF:FF:FF:FF:FF"); setText("FF:FF:FF:FF:FF:FF");
break; break;
case kIp4Address: case kIp4Address:
setValidator(&ip4Validator_); setValidator(&ip4Validator_);
setPlaceholderText("0.0.0.0"); setPlaceholderText("0.0.0.0");
if (isMask_) if (isMaskMode_)
setText("255.255.255.255"); setText("255.255.255.255");
break; break;
case kIp6Address: case kIp6Address:
setValidator(&ip6Validator_); setValidator(&ip6Validator_);
setPlaceholderText("::"); setPlaceholderText("::");
if (isMask_) if (isMaskMode_)
setText("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"); setText("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
break; break;
default: default:
@ -68,14 +68,14 @@ void FieldEdit::setRange(quint64 min, quint64 max)
uint64Validator_.setRange(min, max); uint64Validator_.setRange(min, max);
if (type_ == kUInt64) { if (type_ == kUInt64) {
setPlaceholderText(QString("%1 - %2").arg(min).arg(max)); setPlaceholderText(QString("%1 - %2").arg(min).arg(max));
if (isMask_) if (isMaskMode_)
setText(QString::number(max, 16).toUpper().prepend("0x")); setText(QString::number(max, 16).toUpper().prepend("0x"));
} }
} }
void FieldEdit::setMask(bool isMask) void FieldEdit::setMaskMode(bool maskMode)
{ {
isMask_ = isMask; isMaskMode_ = maskMode;
} }
QString FieldEdit::text() const QString FieldEdit::text() const

View File

@ -42,13 +42,13 @@ public:
void setType(FieldType type); void setType(FieldType type);
void setRange(quint64 min, quint64 max); void setRange(quint64 min, quint64 max);
void setMask(bool isMask); // FIXME: rename void setMaskMode(bool maskMode);
QString text() const; QString text() const;
private: private:
FieldType type_{kUInt64}; FieldType type_{kUInt64};
bool isMask_{false}; bool isMaskMode_{false};
IPv4AddressValidator ip4Validator_; IPv4AddressValidator ip4Validator_;
IPv6AddressValidator ip6Validator_; IPv6AddressValidator ip6Validator_;

View File

@ -34,8 +34,8 @@ FindReplaceDialog::FindReplaceDialog(Action *action, QWidget *parent)
{ {
setupUi(this); setupUi(this);
findMask->setMask(true); findMask->setMaskMode(true);
replaceMask->setMask(true); replaceMask->setMaskMode(true);
// Keep things simple and don't use mask(s) (default) // Keep things simple and don't use mask(s) (default)
useFindMask->setChecked(false); useFindMask->setChecked(false);