improved search type naming

search
Marc Zinnschlag 10 years ago
parent babefacbfa
commit 128ccd8151

@ -103,14 +103,14 @@ CSMTools::Search::Search() : mType (Type_None) {}
CSMTools::Search::Search (Type type, const std::string& value) CSMTools::Search::Search (Type type, const std::string& value)
: mType (type), mText (value) : mType (type), mText (value)
{ {
if (type!=Type_Text && type!=Type_Reference) if (type!=Type_Text && type!=Type_Id)
throw std::logic_error ("Invalid search parameter (string)"); throw std::logic_error ("Invalid search parameter (string)");
} }
CSMTools::Search::Search (Type type, const QRegExp& value) CSMTools::Search::Search (Type type, const QRegExp& value)
: mType (type), mRegExp (value) : mType (type), mRegExp (value)
{ {
if (type!=Type_TextRegEx && type!=Type_ReferenceRegEx) if (type!=Type_TextRegEx && type!=Type_IdRegEx)
throw std::logic_error ("Invalid search parameter (RegExp)"); throw std::logic_error ("Invalid search parameter (RegExp)");
} }
@ -150,8 +150,8 @@ void CSMTools::Search::configure (const CSMWorld::IdTableBase *model)
break; break;
case Type_Reference: case Type_Id:
case Type_ReferenceRegEx: case Type_IdRegEx:
if (CSMWorld::ColumnBase::isId (display)) if (CSMWorld::ColumnBase::isId (display))
{ {
@ -202,13 +202,13 @@ void CSMTools::Search::searchRow (const CSMWorld::IdTableBase *model, int row,
switch (mType) switch (mType)
{ {
case Type_Text: case Type_Text:
case Type_Reference: case Type_Id:
searchTextCell (model, index, id, iter->second, messages); searchTextCell (model, index, id, iter->second, messages);
break; break;
case Type_TextRegEx: case Type_TextRegEx:
case Type_ReferenceRegEx: case Type_IdRegEx:
searchRegExCell (model, index, id, iter->second, messages); searchRegExCell (model, index, id, iter->second, messages);
break; break;

@ -30,8 +30,8 @@ namespace CSMTools
{ {
Type_Text = 0, Type_Text = 0,
Type_TextRegEx = 1, Type_TextRegEx = 1,
Type_Reference = 2, Type_Id = 2,
Type_ReferenceRegEx = 3, Type_IdRegEx = 3,
Type_RecordState = 4, Type_RecordState = 4,
Type_None Type_None
}; };

@ -50,8 +50,8 @@ CSVTools::SearchBox::SearchBox (QWidget *parent)
mMode.addItem ("Text"); mMode.addItem ("Text");
mMode.addItem ("Text (RegEx)"); mMode.addItem ("Text (RegEx)");
mMode.addItem ("Reference"); mMode.addItem ("ID");
mMode.addItem ("Reference (RegEx)"); mMode.addItem ("ID (RegEx)");
mMode.addItem ("Record State"); mMode.addItem ("Record State");
mLayout->addWidget (&mMode, 0, 0); mLayout->addWidget (&mMode, 0, 0);
@ -93,12 +93,12 @@ CSMTools::Search CSVTools::SearchBox::getSearch() const
switch (type) switch (type)
{ {
case CSMTools::Search::Type_Text: case CSMTools::Search::Type_Text:
case CSMTools::Search::Type_Reference: case CSMTools::Search::Type_Id:
return CSMTools::Search (type, std::string (mText.text().toUtf8().data())); return CSMTools::Search (type, std::string (mText.text().toUtf8().data()));
case CSMTools::Search::Type_TextRegEx: case CSMTools::Search::Type_TextRegEx:
case CSMTools::Search::Type_ReferenceRegEx: case CSMTools::Search::Type_IdRegEx:
return CSMTools::Search (type, QRegExp (mText.text().toUtf8().data(), Qt::CaseInsensitive)); return CSMTools::Search (type, QRegExp (mText.text().toUtf8().data(), Qt::CaseInsensitive));
@ -120,8 +120,8 @@ void CSVTools::SearchBox::modeSelected (int index)
{ {
case CSMTools::Search::Type_Text: case CSMTools::Search::Type_Text:
case CSMTools::Search::Type_TextRegEx: case CSMTools::Search::Type_TextRegEx:
case CSMTools::Search::Type_Reference: case CSMTools::Search::Type_Id:
case CSMTools::Search::Type_ReferenceRegEx: case CSMTools::Search::Type_IdRegEx:
mInput.setCurrentIndex (0); mInput.setCurrentIndex (0);
break; break;

Loading…
Cancel
Save