mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
Improvements.
This commit is contained in:
parent
e1a0f60041
commit
2bb9e47507
2 changed files with 8 additions and 6 deletions
|
@ -11,7 +11,8 @@
|
|||
|
||||
CSVWorld::ScriptEdit::ScriptEdit (QWidget* parent, const CSMDoc::Document& document) :
|
||||
QTextEdit (parent),
|
||||
mDocument (document)
|
||||
mDocument (document),
|
||||
mWhiteListQoutes("^[a-z|_]{1}[a-z|0-9|_]{0,}$", Qt::CaseInsensitive)
|
||||
{
|
||||
mAllowedTypes <<CSMWorld::UniversalId::Type_Journal
|
||||
<<CSMWorld::UniversalId::Type_Global
|
||||
|
@ -79,10 +80,9 @@ void CSVWorld::ScriptEdit::dropEvent (QDropEvent* event)
|
|||
}
|
||||
}
|
||||
|
||||
bool CSVWorld::ScriptEdit::stringNeedsQuote (const std::string& id)
|
||||
bool CSVWorld::ScriptEdit::stringNeedsQuote (const std::string& id) const
|
||||
{
|
||||
QString string(QString::fromStdString(id)); //<regex> is only for c++11, so let's use qregexp for now.
|
||||
const QString string(QString::fromStdString(id)); //<regex> is only for c++11, so let's use qregexp for now.
|
||||
//I'm not quite sure when do we need to put quotes. To be safe we will use quotes for anything other than…
|
||||
QRegExp regexp("^[a-z|_]{1}[a-z|0-9|_]{0,}$", Qt::CaseInsensitive);
|
||||
return !(string.contains(regexp));
|
||||
return !(string.contains(mWhiteListQoutes));
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "../../model/world/universalid.hpp"
|
||||
|
||||
class QWidget;
|
||||
class QRegExp;
|
||||
|
||||
namespace CSMDoc
|
||||
{
|
||||
|
@ -24,6 +25,7 @@ namespace CSVWorld
|
|||
private:
|
||||
QVector<CSMWorld::UniversalId::Type> mAllowedTypes;
|
||||
const CSMDoc::Document& mDocument;
|
||||
const QRegExp mWhiteListQoutes;
|
||||
|
||||
void dragEnterEvent (QDragEnterEvent* event);
|
||||
|
||||
|
@ -31,7 +33,7 @@ namespace CSVWorld
|
|||
|
||||
void dragMoveEvent (QDragMoveEvent* event);
|
||||
|
||||
bool stringNeedsQuote(const std::string& id);
|
||||
bool stringNeedsQuote(const std::string& id) const;
|
||||
};
|
||||
}
|
||||
#endif // SCRIPTEDIT_H
|
Loading…
Reference in a new issue