From 205184bec5f5ebf7561fb90cc3a7f0dc9c8945a3 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Tue, 17 Feb 2015 13:45:19 -0800 Subject: [PATCH] Updates taking into account feedback --- CodingStyle.cc | 20 ++++++++++++++++++-- CodingStyle.h | 14 ++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/CodingStyle.cc b/CodingStyle.cc index 283e6bd7d..d328fdac3 100644 --- a/CodingStyle.cc +++ b/CodingStyle.cc @@ -2,7 +2,7 @@ QGroundControl Open Source Ground Control Station - (c) 2009 - 2014 QGROUNDCONTROL PROJECT + (c) 2009 - 2015 QGROUNDCONTROL PROJECT This file is part of the QGROUNDCONTROL project @@ -37,10 +37,14 @@ #include #include +#include + // Note how the Qt headers and the QGroundControl headers above are kept seperate Q_LOGGING_CATEGORY(CodingStyleLog, "CodingStyleLog") +const int CodingStyle::_privateStaticVariable = 0; + CodingStyle::CodingStyle(QObject* parent) : QObject(parent), _protectedVariable(1), @@ -85,8 +89,10 @@ void CodingStyle::_privateMethod2(void) typedValue.setValue(value.toUInt()); break; - case FactMetaData::valueTypeFloat: + case FactMetaData::valueTypeFloat: { + int localScopedVar = 1; typedValue.setValue(value.toFloat()); + } break; case FactMetaData::valueTypeDouble: @@ -94,3 +100,13 @@ void CodingStyle::_privateMethod2(void) break; } } + +void CodingStyle::_methodWithManyArguments(QWidget* parent, + const QString& caption, + const QString& dir, + Options options1, + Options options2, + Options options3) +{ + // Implementataion here... +} diff --git a/CodingStyle.h b/CodingStyle.h index 1d2786490..07a408fb9 100644 --- a/CodingStyle.h +++ b/CodingStyle.h @@ -39,16 +39,22 @@ #include #include +#include + #include "Fact.h" #include "UASInterface.h" -// Note how the Qt headers and the QGroundControl headers above are kept seperate +// Note how the Qt headers, Syste, headers and the QGroundControl headers above are kept in seperate groups // If you are going to use a logging category for a class it should have the same name as the class // with a suffix of Log. Q_DECLARE_LOGGING_CATEGORY(CodingStyleLog) -/// Here is the class documentation. Class names are PascalCase. +/// Here is the class documentation. Class names are PascalCase. If you override any of the Qt base classes to provide +/// generic base implementations for widespread use prefix the class name with QGC. For example: +/// QGCMessageBox - is a QGC special vesion of Qt MessageBox +/// QGCPalette - is a QGC special version of Qt Palette +/// For normal single use classes do no prefix them name with QGC. class CodingStyle : public QObject { @@ -84,10 +90,14 @@ private: // non-obvious private methods goes in the code file, not the header. void _privateMethod(void); + void _methodWithManyArguments(QWidget* parent, const QString& caption, const QString& dir, Options options1, Options options2, Options options3); + /// Document non-obvious variables in the header file. Long descriptions go here. int _privateVariable1; int _privateVariable2; ///< Short descriptions go here + + static const int _privateStaticVariable; }; #endif \ No newline at end of file -- 2.22.0