Commit 212f6077 authored by Jochen Becher's avatar Jochen Becher

ModelEditor: Apply naming convention to variables

This change applies the naming convention to function parameters and local variables.

Change-Id: Ifa495c70520923f14ba6791513d3691bfa7694f6
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 06821596
...@@ -66,9 +66,9 @@ ConfigController::~ConfigController() ...@@ -66,9 +66,9 @@ ConfigController::~ConfigController()
delete d; delete d;
} }
void ConfigController::setStereotypeController(StereotypeController *stereotype_controller) void ConfigController::setStereotypeController(StereotypeController *stereotypeController)
{ {
d->m_stereotypeController = stereotype_controller; d->m_stereotypeController = stereotypeController;
} }
void ConfigController::readStereotypeDefinitions(const QString &path) void ConfigController::readStereotypeDefinitions(const QString &path)
...@@ -79,8 +79,8 @@ void ConfigController::readStereotypeDefinitions(const QString &path) ...@@ -79,8 +79,8 @@ void ConfigController::readStereotypeDefinitions(const QString &path)
QDir dir(path); QDir dir(path);
dir.setNameFilters(QStringList() << QStringLiteral("*.def")); dir.setNameFilters(QStringList() << QStringLiteral("*.def"));
foreach (const QString &file_name, dir.entryList(QDir::Files)) { foreach (const QString &fileName, dir.entryList(QDir::Files)) {
QFile file(QFileInfo(dir, file_name).absoluteFilePath()); QFile file(QFileInfo(dir, fileName).absoluteFilePath());
if (file.open(QIODevice::ReadOnly)) { if (file.open(QIODevice::ReadOnly)) {
QString text = QString::fromUtf8(file.readAll()); QString text = QString::fromUtf8(file.readAll());
file.close(); file.close();
...@@ -99,9 +99,9 @@ void ConfigController::readStereotypeDefinitions(const QString &path) ...@@ -99,9 +99,9 @@ void ConfigController::readStereotypeDefinitions(const QString &path)
} }
} }
void ConfigController::onStereotypeIconParsed(const StereotypeIcon &stereotype_icon) void ConfigController::onStereotypeIconParsed(const StereotypeIcon &stereotypeIcon)
{ {
d->m_stereotypeController->addStereotypeIcon(stereotype_icon); d->m_stereotypeController->addStereotypeIcon(stereotypeIcon);
} }
void ConfigController::onToolbarParsed(const Toolbar &toolbar) void ConfigController::onToolbarParsed(const Toolbar &toolbar)
......
...@@ -55,7 +55,7 @@ public: ...@@ -55,7 +55,7 @@ public:
public: public:
void setStereotypeController(StereotypeController *stereotype_controller); void setStereotypeController(StereotypeController *stereotypeController);
public: public:
...@@ -63,7 +63,7 @@ public: ...@@ -63,7 +63,7 @@ public:
private slots: private slots:
void onStereotypeIconParsed(const StereotypeIcon &stereotype_icon); void onStereotypeIconParsed(const StereotypeIcon &stereotypeIcon);
void onToolbarParsed(const Toolbar &toolbar); void onToolbarParsed(const Toolbar &toolbar);
......
...@@ -39,10 +39,10 @@ SourcePos::SourcePos() ...@@ -39,10 +39,10 @@ SourcePos::SourcePos()
{ {
} }
SourcePos::SourcePos(int source_id, int line_number, int column_number) SourcePos::SourcePos(int sourceId, int lineNumber, int columnNumber)
: m_sourceId(source_id), : m_sourceId(sourceId),
m_lineNumber(line_number), m_lineNumber(lineNumber),
m_columnNumber(column_number) m_columnNumber(columnNumber)
{ {
} }
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
SourcePos(); SourcePos();
SourcePos(int source_id, int line_number, int column_number = -1); SourcePos(int sourceId, int lineNumber, int columnNumber = -1);
public: public:
......
...@@ -50,7 +50,7 @@ class QMT_EXPORT StereotypeDefinitionParserError : ...@@ -50,7 +50,7 @@ class QMT_EXPORT StereotypeDefinitionParserError :
{ {
public: public:
StereotypeDefinitionParserError(const QString &error_msg, const SourcePos &source_pos); StereotypeDefinitionParserError(const QString &errorMsg, const SourcePos &sourcePos);
~StereotypeDefinitionParserError(); ~StereotypeDefinitionParserError();
...@@ -79,7 +79,7 @@ public: ...@@ -79,7 +79,7 @@ public:
signals: signals:
void iconParsed(const StereotypeIcon &stereotype_icon); void iconParsed(const StereotypeIcon &stereotypeIcon);
void toolbarParsed(const Toolbar &toolbar); void toolbarParsed(const Toolbar &toolbar);
...@@ -93,7 +93,7 @@ private: ...@@ -93,7 +93,7 @@ private:
void parseIcon(); void parseIcon();
void parseIconProperties(StereotypeIcon *stereotype_icon); void parseIconProperties(StereotypeIcon *stereotypeIcon);
void parseToolbar(); void parseToolbar();
...@@ -113,7 +113,7 @@ private: ...@@ -113,7 +113,7 @@ private:
QColor parseColorProperty(); QColor parseColorProperty();
void parseIconCommands(StereotypeIcon *stereotype_icon); void parseIconCommands(StereotypeIcon *stereotypeIcon);
QList<ShapeValueF> parseIconCommandParameters(const QList<IconCommandParameter> &parameters); QList<ShapeValueF> parseIconCommandParameters(const QList<IconCommandParameter> &parameters);
...@@ -133,13 +133,13 @@ private: ...@@ -133,13 +133,13 @@ private:
Token readNextToken(); Token readNextToken();
qreal expectAbsoluteValue(const ShapeValueF &value, const SourcePos &source_pos); qreal expectAbsoluteValue(const ShapeValueF &value, const SourcePos &sourcePos);
void expectSemicolonOrEndOfLine(); void expectSemicolonOrEndOfLine();
bool nextIsComma(); bool nextIsComma();
void expectOperator(int op, const QString &op_name); void expectOperator(int op, const QString &opName);
void expectComma(); void expectComma();
......
...@@ -55,9 +55,9 @@ void StringTextSource::setText(const QString &text) ...@@ -55,9 +55,9 @@ void StringTextSource::setText(const QString &text)
m_columnNumber = 1; m_columnNumber = 1;
} }
void StringTextSource::setSourceId(int source_id) void StringTextSource::setSourceId(int sourceId)
{ {
m_sourceId = source_id; m_sourceId = sourceId;
} }
SourceChar StringTextSource::readNextChar() SourceChar StringTextSource::readNextChar()
......
...@@ -51,7 +51,7 @@ public: ...@@ -51,7 +51,7 @@ public:
int getSourceId() const { return m_sourceId; } int getSourceId() const { return m_sourceId; }
void setSourceId(int source_id); void setSourceId(int sourceId);
// ITextSource interface // ITextSource interface
public: public:
......
...@@ -48,7 +48,7 @@ class QMT_EXPORT TextScannerError : ...@@ -48,7 +48,7 @@ class QMT_EXPORT TextScannerError :
{ {
public: public:
TextScannerError(const QString &error_msg, const SourcePos &source_pos); TextScannerError(const QString &errorMsg, const SourcePos &sourcePos);
~TextScannerError(); ~TextScannerError();
...@@ -80,7 +80,7 @@ public: ...@@ -80,7 +80,7 @@ public:
void setOperators(const QList<QPair<QString, int> > &operators); void setOperators(const QList<QPair<QString, int> > &operators);
void setSource(ITextSource *text_source); void setSource(ITextSource *textSource);
SourcePos getSourcePos() const; SourcePos getSourcePos() const;
...@@ -94,19 +94,19 @@ private: ...@@ -94,19 +94,19 @@ private:
SourceChar readChar(); SourceChar readChar();
void unreadChar(const SourceChar &source_char); void unreadChar(const SourceChar &sourceChar);
void skipWhitespaces(); void skipWhitespaces();
Token scanString(const SourceChar &delimiter_char); Token scanString(const SourceChar &delimiterChar);
Token scanNumber(const SourceChar &first_digit); Token scanNumber(const SourceChar &firstDigit);
Token scanIdentifier(const SourceChar &first_char); Token scanIdentifier(const SourceChar &firstChar);
Token scanColorIdentifier(const SourceChar &first_char); Token scanColorIdentifier(const SourceChar &firstChar);
Token scanOperator(const SourceChar &first_char); Token scanOperator(const SourceChar &firstChar);
private: private:
......
...@@ -40,9 +40,9 @@ namespace qmt { ...@@ -40,9 +40,9 @@ namespace qmt {
struct SourceChar { struct SourceChar {
SourceChar() { } SourceChar() { }
SourceChar(QChar chr, const SourcePos &source_pos) SourceChar(QChar chr, const SourcePos &sourcePos)
: ch(chr), : ch(chr),
pos(source_pos) pos(sourcePos)
{ {
} }
......
...@@ -38,19 +38,19 @@ Token::Token() ...@@ -38,19 +38,19 @@ Token::Token()
{ {
} }
Token::Token(Type type, const QString &text, const SourcePos &source_pos) Token::Token(Type type, const QString &text, const SourcePos &sourcePos)
: m_type(type), : m_type(type),
m_subtype(0), m_subtype(0),
m_text(text), m_text(text),
m_sourcePos(source_pos) m_sourcePos(sourcePos)
{ {
} }
Token::Token(Token::Type type, int subtype, const QString &text, const SourcePos &source_pos) Token::Token(Token::Type type, int subtype, const QString &text, const SourcePos &sourcePos)
: m_type(type), : m_type(type),
m_subtype(subtype), m_subtype(subtype),
m_text(text), m_text(text),
m_sourcePos(source_pos) m_sourcePos(sourcePos)
{ {
} }
...@@ -73,9 +73,9 @@ void Token::setText(const QString &text) ...@@ -73,9 +73,9 @@ void Token::setText(const QString &text)
m_text = text; m_text = text;
} }
void Token::setSourcePos(const SourcePos &source_pos) void Token::setSourcePos(const SourcePos &sourcePos)
{ {
m_sourcePos = source_pos; m_sourcePos = sourcePos;
} }
} // namespace qmt } // namespace qmt
...@@ -56,8 +56,8 @@ public: ...@@ -56,8 +56,8 @@ public:
public: public:
Token(); Token();
Token(Type type, const QString &text, const SourcePos &source_pos); Token(Type type, const QString &text, const SourcePos &sourcePos);
Token(Type type, int subtype, const QString &text, const SourcePos &source_pos); Token(Type type, int subtype, const QString &text, const SourcePos &sourcePos);
~Token(); ~Token();
public: public:
...@@ -76,7 +76,7 @@ public: ...@@ -76,7 +76,7 @@ public:
SourcePos getSourcePos() const { return m_sourcePos; } SourcePos getSourcePos() const { return m_sourcePos; }
void setSourcePos(const SourcePos &source_pos); void setSourcePos(const SourcePos &sourcePos);
private: private:
Type m_type; Type m_type;
......
...@@ -45,117 +45,117 @@ NameController::~NameController() ...@@ -45,117 +45,117 @@ NameController::~NameController()
} }
QString NameController::convertFileNameToElementName(const QString &file_name) QString NameController::convertFileNameToElementName(const QString &fileName)
{ {
QFileInfo file_info(file_name); QFileInfo fileInfo(fileName);
QString base_name = file_info.baseName().trimmed(); QString baseName = fileInfo.baseName().trimmed();
QString element_name; QString elementName;
bool make_uppercase = true; bool makeUppercase = true;
bool insert_space = false; bool insertSpace = false;
for (int i = 0; i < base_name.size(); ++i) { for (int i = 0; i < baseName.size(); ++i) {
if (base_name.at(i) == QLatin1Char('_')) { if (baseName.at(i) == QLatin1Char('_')) {
make_uppercase = true; makeUppercase = true;
insert_space = true; insertSpace = true;
} else if (base_name.at(i) == QLatin1Char(' ') || base_name.at(i) == QLatin1Char('-')) { } else if (baseName.at(i) == QLatin1Char(' ') || baseName.at(i) == QLatin1Char('-')) {
make_uppercase = true; makeUppercase = true;
insert_space = false; insertSpace = false;
element_name += base_name.at(i); elementName += baseName.at(i);
} else if (make_uppercase) { } else if (makeUppercase) {
if (insert_space) { if (insertSpace) {
element_name += QLatin1Char(' '); elementName += QLatin1Char(' ');
insert_space = false; insertSpace = false;
} }
element_name += base_name.at(i).toUpper(); elementName += baseName.at(i).toUpper();
make_uppercase = false; makeUppercase = false;
} else { } else {
if (insert_space) { if (insertSpace) {
element_name += QLatin1Char(' '); elementName += QLatin1Char(' ');
insert_space = false; insertSpace = false;
} }
element_name += base_name.at(i); elementName += baseName.at(i);
} }
} }
return element_name; return elementName;
} }
QString NameController::convertElementNameToBaseFileName(const QString &element_name) QString NameController::convertElementNameToBaseFileName(const QString &elementName)
{ {
QString base_file_name; QString baseFileName;
bool insert_underscore = false; bool insertUnderscore = false;
for (int i = 0; i < element_name.size(); ++i) { for (int i = 0; i < elementName.size(); ++i) {
if (element_name.at(i) == QLatin1Char(' ')) { if (elementName.at(i) == QLatin1Char(' ')) {
insert_underscore = true; insertUnderscore = true;
} else { } else {
if (insert_underscore) { if (insertUnderscore) {
base_file_name += QLatin1Char('_'); baseFileName += QLatin1Char('_');
insert_underscore = false; insertUnderscore = false;
} }
base_file_name += element_name.at(i).toLower(); baseFileName += elementName.at(i).toLower();
} }
} }
return base_file_name; return baseFileName;
} }
QString NameController::calcRelativePath(const QString &absolute_file_name, const QString &anchor_path) QString NameController::calcRelativePath(const QString &absoluteFileName, const QString &anchorPath)
{ {
int second_last_slash_index = -1; int secondLastSlashIndex = -1;
int slash_index = -1; int slashIndex = -1;
int i = 0; int i = 0;
while (i < absolute_file_name.size() && i < anchor_path.size() && absolute_file_name.at(i) == anchor_path.at(i)) { while (i < absoluteFileName.size() && i < anchorPath.size() && absoluteFileName.at(i) == anchorPath.at(i)) {
if (absolute_file_name.at(i) == QLatin1Char('/')) { if (absoluteFileName.at(i) == QLatin1Char('/')) {
second_last_slash_index = slash_index; secondLastSlashIndex = slashIndex;
slash_index = i; slashIndex = i;
} }
++i; ++i;
} }
QString relative_path; QString relativePath;
if (slash_index < 0) { if (slashIndex < 0) {
relative_path = absolute_file_name; relativePath = absoluteFileName;
} else if (i >= absolute_file_name.size()) { } else if (i >= absoluteFileName.size()) {
// absolute_file_name is a substring of anchor path. // absoluteFileName is a substring of anchor path.
if (slash_index == i - 1) { if (slashIndex == i - 1) {
if (second_last_slash_index < 0) { if (secondLastSlashIndex < 0) {
relative_path = absolute_file_name; relativePath = absoluteFileName;
} else { } else {
relative_path = absolute_file_name.mid(second_last_slash_index + 1); relativePath = absoluteFileName.mid(secondLastSlashIndex + 1);
} }
} else { } else {
relative_path = absolute_file_name.mid(slash_index + 1); relativePath = absoluteFileName.mid(slashIndex + 1);
} }
} else { } else {
relative_path = absolute_file_name.mid(slash_index + 1); relativePath = absoluteFileName.mid(slashIndex + 1);
} }
return relative_path; return relativePath;
} }
QString NameController::calcElementNameSearchId(const QString &element_name) QString NameController::calcElementNameSearchId(const QString &elementName)
{ {
QString search_id; QString searchId;
foreach (const QChar &c, element_name) { foreach (const QChar &c, elementName) {
if (c.isLetterOrNumber()) { if (c.isLetterOrNumber()) {