mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 12:36:42 +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) :
|
CSVWorld::ScriptEdit::ScriptEdit (QWidget* parent, const CSMDoc::Document& document) :
|
||||||
QTextEdit (parent),
|
QTextEdit (parent),
|
||||||
mDocument (document)
|
mDocument (document),
|
||||||
|
mWhiteListQoutes("^[a-z|_]{1}[a-z|0-9|_]{0,}$", Qt::CaseInsensitive)
|
||||||
{
|
{
|
||||||
mAllowedTypes <<CSMWorld::UniversalId::Type_Journal
|
mAllowedTypes <<CSMWorld::UniversalId::Type_Journal
|
||||||
<<CSMWorld::UniversalId::Type_Global
|
<<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…
|
//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(mWhiteListQoutes));
|
||||||
return !(string.contains(regexp));
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "../../model/world/universalid.hpp"
|
#include "../../model/world/universalid.hpp"
|
||||||
|
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
class QRegExp;
|
||||||
|
|
||||||
namespace CSMDoc
|
namespace CSMDoc
|
||||||
{
|
{
|
||||||
|
@ -24,6 +25,7 @@ namespace CSVWorld
|
||||||
private:
|
private:
|
||||||
QVector<CSMWorld::UniversalId::Type> mAllowedTypes;
|
QVector<CSMWorld::UniversalId::Type> mAllowedTypes;
|
||||||
const CSMDoc::Document& mDocument;
|
const CSMDoc::Document& mDocument;
|
||||||
|
const QRegExp mWhiteListQoutes;
|
||||||
|
|
||||||
void dragEnterEvent (QDragEnterEvent* event);
|
void dragEnterEvent (QDragEnterEvent* event);
|
||||||
|
|
||||||
|
@ -31,7 +33,7 @@ namespace CSVWorld
|
||||||
|
|
||||||
void dragMoveEvent (QDragMoveEvent* event);
|
void dragMoveEvent (QDragMoveEvent* event);
|
||||||
|
|
||||||
bool stringNeedsQuote(const std::string& id);
|
bool stringNeedsQuote(const std::string& id) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // SCRIPTEDIT_H
|
#endif // SCRIPTEDIT_H
|
Loading…
Reference in a new issue