Merged merge request !17

remotes/1728160796594174844/tmp_0.7.0-alpha
Marc Zinnschlag 7 years ago
commit 7ba512b389

@ -55,6 +55,7 @@
Bug #4475: Scripted animations should not cause movement Bug #4475: Scripted animations should not cause movement
Bug #4479: "Game" category on Advanced page is getting too long Bug #4479: "Game" category on Advanced page is getting too long
Bug #4480: Segfalt in QuickKeysMenu when item no longer in inventory Bug #4480: Segfalt in QuickKeysMenu when item no longer in inventory
Feature #2606: Implemented (optional) case sensitive global search
Feature #3276: Editor: Search- Show number of (remaining) search results and indicate a search without any results Feature #3276: Editor: Search- Show number of (remaining) search results and indicate a search without any results
Feature #3641: Editor: Limit FPS in 3d preview window Feature #3641: Editor: Limit FPS in 3d preview window
Feature #4222: 360° screenshots Feature #4222: 360° screenshots

@ -22,7 +22,8 @@ void CSMTools::Search::searchTextCell (const CSMWorld::IdTableBase *model,
int pos = 0; int pos = 0;
while ((pos = text.indexOf (search, pos, Qt::CaseInsensitive))!=-1) Qt::CaseSensitivity caseSensitivity = mCase ? Qt::CaseSensitive : Qt::CaseInsensitive;
while ((pos = text.indexOf (search, pos, caseSensitivity))!=-1)
{ {
std::ostringstream hint; std::ostringstream hint;
hint hint
@ -120,25 +121,26 @@ QString CSMTools::Search::flatten (const QString& text) const
return flat; return flat;
} }
CSMTools::Search::Search() : mType (Type_None), mValue (0), mIdColumn (0), mTypeColumn (0), CSMTools::Search::Search() : mType (Type_None), mValue (0), mCase (false), mIdColumn (0), mTypeColumn (0),
mPaddingBefore (10), mPaddingAfter (10) {} mPaddingBefore (10), mPaddingAfter (10) {}
CSMTools::Search::Search (Type type, const std::string& value) CSMTools::Search::Search (Type type, bool caseSensitive, const std::string& value)
: mType (type), mText (value), mValue (0), mIdColumn (0), mTypeColumn (0), mPaddingBefore (10), mPaddingAfter (10) : mType (type), mText (value), mValue (0), mCase (caseSensitive), mIdColumn (0), mTypeColumn (0), mPaddingBefore (10), mPaddingAfter (10)
{ {
if (type!=Type_Text && type!=Type_Id) 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, bool caseSensitive, const QRegExp& value)
: mType (type), mRegExp (value), mValue (0), mIdColumn (0), mTypeColumn (0), mPaddingBefore (10), mPaddingAfter (10) : mType (type), mRegExp (value), mValue (0), mCase (caseSensitive), mIdColumn (0), mTypeColumn (0), mPaddingBefore (10), mPaddingAfter (10)
{ {
mRegExp.setCaseSensitivity(mCase ? Qt::CaseSensitive : Qt::CaseInsensitive);
if (type!=Type_TextRegEx && type!=Type_IdRegEx) if (type!=Type_TextRegEx && type!=Type_IdRegEx)
throw std::logic_error ("Invalid search parameter (RegExp)"); throw std::logic_error ("Invalid search parameter (RegExp)");
} }
CSMTools::Search::Search (Type type, int value) CSMTools::Search::Search (Type type, bool caseSensitive, int value)
: mType (type), mValue (value), mIdColumn (0), mTypeColumn (0), mPaddingBefore (10), mPaddingAfter (10) : mType (type), mValue (value), mCase (caseSensitive), mIdColumn (0), mTypeColumn (0), mPaddingBefore (10), mPaddingAfter (10)
{ {
if (type!=Type_RecordState) if (type!=Type_RecordState)
throw std::logic_error ("invalid search parameter (int)"); throw std::logic_error ("invalid search parameter (int)");

@ -43,6 +43,7 @@ namespace CSMTools
std::string mText; std::string mText;
QRegExp mRegExp; QRegExp mRegExp;
int mValue; int mValue;
bool mCase;
std::set<int> mColumns; std::set<int> mColumns;
int mIdColumn; int mIdColumn;
int mTypeColumn; int mTypeColumn;
@ -67,11 +68,11 @@ namespace CSMTools
Search(); Search();
Search (Type type, const std::string& value); Search (Type type, bool caseSensitive, const std::string& value);
Search (Type type, const QRegExp& value); Search (Type type, bool caseSensitive, const QRegExp& value);
Search (Type type, int value); Search (Type type, bool caseSensitive, int value);
// Configure search for the specified model. // Configure search for the specified model.
void configure (const CSMWorld::IdTableBase *model); void configure (const CSMWorld::IdTableBase *model);

@ -35,7 +35,7 @@ void CSVTools::SearchBox::updateSearchButton()
} }
CSVTools::SearchBox::SearchBox (QWidget *parent) CSVTools::SearchBox::SearchBox (QWidget *parent)
: QWidget (parent), mSearch ("Search"), mSearchEnabled (false), mReplace ("Replace All") : QWidget (parent), mSearch (tr("Search")), mSearchEnabled (false), mReplace (tr("Replace All"))
{ {
mLayout = new QGridLayout (this); mLayout = new QGridLayout (this);
@ -48,29 +48,26 @@ CSVTools::SearchBox::SearchBox (QWidget *parent)
++iter) ++iter)
mRecordState.addItem (QString::fromUtf8 (iter->c_str())); mRecordState.addItem (QString::fromUtf8 (iter->c_str()));
mMode.addItem ("Text"); mMode.addItem (tr("Text"));
mMode.addItem ("Text (RegEx)"); mMode.addItem (tr("Text (RegEx)"));
mMode.addItem ("ID"); mMode.addItem (tr("ID"));
mMode.addItem ("ID (RegEx)"); mMode.addItem (tr("ID (RegEx)"));
mMode.addItem ("Record State"); mMode.addItem (tr("Record State"));
connect (&mMode, SIGNAL (activated (int)), this, SLOT (modeSelected (int)));
mLayout->addWidget (&mMode, 0, 0); mLayout->addWidget (&mMode, 0, 0);
mLayout->addWidget (&mSearch, 0, 3); connect (&mText, SIGNAL (textChanged (const QString&)), this, SLOT (textChanged (const QString&)));
connect (&mText, SIGNAL (returnPressed()), this, SLOT (startSearch()));
mInput.insertWidget (0, &mText); mInput.insertWidget (0, &mText);
mInput.insertWidget (1, &mRecordState);
mLayout->addWidget (&mInput, 0, 1); mInput.insertWidget (1, &mRecordState);
mLayout->addWidget (&mInput, 0, 1);
connect (&mMode, SIGNAL (activated (int)), this, SLOT (modeSelected (int)));
connect (&mText, SIGNAL (textChanged (const QString&)), mCaseSensitive.setText (tr ("Case"));
this, SLOT (textChanged (const QString&))); mLayout->addWidget (&mCaseSensitive, 0, 2);
connect (&mSearch, SIGNAL (clicked (bool)), this, SLOT (startSearch (bool))); connect (&mSearch, SIGNAL (clicked (bool)), this, SLOT (startSearch (bool)));
mLayout->addWidget (&mSearch, 0, 3);
connect (&mText, SIGNAL (returnPressed()), this, SLOT (startSearch()));
// replace panel // replace panel
mReplaceInput.insertWidget (0, &mReplaceText); mReplaceInput.insertWidget (0, &mReplaceText);
@ -102,23 +99,24 @@ void CSVTools::SearchBox::setSearchMode (bool enabled)
CSMTools::Search CSVTools::SearchBox::getSearch() const CSMTools::Search CSVTools::SearchBox::getSearch() const
{ {
CSMTools::Search::Type type = static_cast<CSMTools::Search::Type> (mMode.currentIndex()); CSMTools::Search::Type type = static_cast<CSMTools::Search::Type> (mMode.currentIndex());
bool caseSensitive = mCaseSensitive.isChecked();
switch (type) switch (type)
{ {
case CSMTools::Search::Type_Text: case CSMTools::Search::Type_Text:
case CSMTools::Search::Type_Id: case CSMTools::Search::Type_Id:
return CSMTools::Search (type, std::string (mText.text().toUtf8().data())); return CSMTools::Search (type, caseSensitive, std::string (mText.text().toUtf8().data()));
case CSMTools::Search::Type_TextRegEx: case CSMTools::Search::Type_TextRegEx:
case CSMTools::Search::Type_IdRegEx: case CSMTools::Search::Type_IdRegEx:
return CSMTools::Search (type, QRegExp (mText.text().toUtf8().data(), Qt::CaseInsensitive)); return CSMTools::Search (type, caseSensitive, QRegExp (mText.text().toUtf8().data(), Qt::CaseInsensitive));
case CSMTools::Search::Type_RecordState: case CSMTools::Search::Type_RecordState:
return CSMTools::Search (type, mRecordState.currentIndex()); return CSMTools::Search (type, caseSensitive, mRecordState.currentIndex());
case CSMTools::Search::Type_None: case CSMTools::Search::Type_None:

@ -4,6 +4,7 @@
#include <QWidget> #include <QWidget>
#include <QLineEdit> #include <QLineEdit>
#include <QComboBox> #include <QComboBox>
#include <QCheckBox>
#include <QStackedWidget> #include <QStackedWidget>
#include <QPushButton> #include <QPushButton>
#include <QLabel> #include <QLabel>
@ -24,6 +25,7 @@ namespace CSVTools
QStackedWidget mInput; QStackedWidget mInput;
QLineEdit mText; QLineEdit mText;
QComboBox mRecordState; QComboBox mRecordState;
QCheckBox mCaseSensitive;
QPushButton mSearch; QPushButton mSearch;
QGridLayout *mLayout; QGridLayout *mLayout;
QComboBox mMode; QComboBox mMode;

Loading…
Cancel
Save