GCC warnings.

--HG--
branch : develop
This commit is contained in:
dismine 2014-09-20 19:05:21 +03:00
parent cbd432075f
commit a8bb3e8161
25 changed files with 170 additions and 30 deletions

View File

@ -42,6 +42,7 @@ defineTest(copyToDestdir) {
GCC_CXXFLAGS += \ GCC_CXXFLAGS += \
-O0 \
-Wall \ -Wall \
-Wextra \ -Wextra \
-pedantic \ -pedantic \
@ -83,6 +84,7 @@ GCC_CXXFLAGS += \
-ftrapv -ftrapv
CLANG_CXXFLAGS += \ CLANG_CXXFLAGS += \
-O0 \
-fparse-all-comments \ -fparse-all-comments \
-Wabi \ -Wabi \
-Wabstract-final-class \ -Wabstract-final-class \

View File

@ -69,6 +69,8 @@ win32-msvc* {
PRECOMPILED_SOURCE = stable.cpp PRECOMPILED_SOURCE = stable.cpp
} }
include(../../../Valentina.pri)
CONFIG(debug, debug|release){ CONFIG(debug, debug|release){
# Debug # Debug
unix { unix {

View File

@ -131,7 +131,7 @@ void QVector3DProperty::setValue(const QVariant &value)
QStringList tmpStrings = value.toString().split(","); QStringList tmpStrings = value.toString().split(",");
if (tmpStrings.count() == 3) if (tmpStrings.count() == 3)
{ {
setVector(tmpStrings[0].toDouble(), tmpStrings[1].toDouble(), tmpStrings[2].toDouble()); setVector(tmpStrings[0].toFloat(), tmpStrings[1].toFloat(), tmpStrings[2].toFloat());
} }
} }

View File

@ -30,8 +30,8 @@
using namespace VPE; using namespace VPE;
VColorPropertyEditor::VColorPropertyEditor(QWidget *parent) : VColorPropertyEditor::VColorPropertyEditor(QWidget *parent)
QWidget(parent) : QWidget(parent), Color(), ToolButton(nullptr), TextLabel(nullptr), ColorLabel(nullptr), Spacer(nullptr)
{ {
setAutoFillBackground(true); setAutoFillBackground(true);

View File

@ -75,6 +75,7 @@ private slots:
void onToolButtonClicked(); void onToolButtonClicked();
private: private:
Q_DISABLE_COPY(VColorPropertyEditor)
QColor Color; QColor Color;
QToolButton* ToolButton; QToolButton* ToolButton;
QLabel* TextLabel; QLabel* TextLabel;

View File

@ -27,7 +27,7 @@
using namespace VPE; using namespace VPE;
VEnumProperty::VEnumProperty(const QString& name) VEnumProperty::VEnumProperty(const QString& name)
: VProperty(name, QVariant::Int) : VProperty(name, QVariant::Int), EnumerationLiterals()
{ {
VProperty::d_ptr->VariantValue = 0; VProperty::d_ptr->VariantValue = 0;
VProperty::d_ptr->VariantValue.convert(QVariant::Int); VProperty::d_ptr->VariantValue.convert(QVariant::Int);

View File

@ -90,6 +90,8 @@ protected:
QStringList EnumerationLiterals; QStringList EnumerationLiterals;
// No use of d-pointer in this case, because it is unlikely this will change. If it does, we can still add other // No use of d-pointer in this case, because it is unlikely this will change. If it does, we can still add other
//members by reimplementing the VPropertyPrivate class without touching this header file. //members by reimplementing the VPropertyPrivate class without touching this header file.
private:
Q_DISABLE_COPY(VEnumProperty)
}; };
} }

View File

@ -30,7 +30,8 @@
using namespace VPE; using namespace VPE;
VFileEditWidget::VFileEditWidget(QWidget *parent, bool is_directory) VFileEditWidget::VFileEditWidget(QWidget *parent, bool is_directory)
: QWidget(parent), Directory(is_directory) : QWidget(parent), CurrentFilePath(), ToolButton(nullptr), FileLineEdit(nullptr), FileDialogFilter(), FilterList(),
Directory(is_directory)
{ {
// Create the tool button,ToolButton = new QToolButton(this); // Create the tool button,ToolButton = new QToolButton(this);
ToolButton = new QToolButton(this); ToolButton = new QToolButton(this);

View File

@ -101,6 +101,9 @@ protected:
//! Specifies whether it is being looked for a directory (true) or a file (false, default) //! Specifies whether it is being looked for a directory (true) or a file (false, default)
bool Directory; bool Directory;
private:
Q_DISABLE_COPY(VFileEditWidget)
}; };
} }

View File

@ -56,9 +56,9 @@ QWidget* VIntegerProperty::createEditor(QWidget * parent, const QStyleOptionView
Q_UNUSED(delegate); Q_UNUSED(delegate);
QSpinBox* tmpEditor = new QSpinBox(parent); QSpinBox* tmpEditor = new QSpinBox(parent);
tmpEditor->setMinimum(minValue); tmpEditor->setMinimum(static_cast<int>(minValue));
tmpEditor->setMaximum(maxValue); tmpEditor->setMaximum(static_cast<int>(maxValue));
tmpEditor->setSingleStep(singleStep); tmpEditor->setSingleStep(static_cast<int>(singleStep));
tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
tmpEditor->setValue(VProperty::d_ptr->VariantValue.toInt()); tmpEditor->setValue(VProperty::d_ptr->VariantValue.toInt());
connect(tmpEditor, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, connect(tmpEditor, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
@ -203,7 +203,7 @@ void VDoubleProperty::setSetting(const QString& key, const QVariant& value)
} }
else if (key == QLatin1String("Precision")) else if (key == QLatin1String("Precision"))
{ {
Precision = value.toDouble(); Precision = value.toInt();
} }
} }

View File

@ -28,7 +28,7 @@
using namespace VPE; using namespace VPE;
VObjectProperty::VObjectProperty(const QString& name) VObjectProperty::VObjectProperty(const QString& name)
: VProperty(name, QVariant::Int) : VProperty(name, QVariant::Int), objects()
{ {
VProperty::d_ptr->VariantValue = 0; VProperty::d_ptr->VariantValue = 0;
VProperty::d_ptr->VariantValue.convert(QVariant::UInt); VProperty::d_ptr->VariantValue.convert(QVariant::UInt);

View File

@ -86,6 +86,9 @@ protected:
void FillList(QComboBox *box, const QMap<QString, quint32> &list)const; void FillList(QComboBox *box, const QMap<QString, quint32> &list)const;
// No use of d-pointer in this case, because it is unlikely this will change. If it does, we can still add other // No use of d-pointer in this case, because it is unlikely this will change. If it does, we can still add other
//members by reimplementing the VPropertyPrivate class without touching this header file. //members by reimplementing the VPropertyPrivate class without touching this header file.
private:
Q_DISABLE_COPY(VObjectProperty)
}; };
} }

View File

@ -26,7 +26,7 @@
using namespace VPE; using namespace VPE;
VShortcutEditWidget::VShortcutEditWidget(QWidget *parent) VShortcutEditWidget::VShortcutEditWidget(QWidget *parent)
: QWidget(parent) : QWidget(parent), CurrentKeySequence(), LineEdit(nullptr)
{ {
// Create the line edit widget // Create the line edit widget
LineEdit = new QLineEdit(this); LineEdit = new QLineEdit(this);

View File

@ -78,6 +78,9 @@ protected:
//! The line to display and edit the key sequence //! The line to display and edit the key sequence
QLineEdit* LineEdit; QLineEdit* LineEdit;
private:
Q_DISABLE_COPY(VShortcutEditWidget)
}; };
} }

View File

@ -0,0 +1,22 @@
/************************************************************************
**
** @file stable.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 20 9, 2014
**
** @brief
** @copyright
** All rights reserved. This program and the accompanying materials
** are made available under the terms of the GNU Lesser General Public License
** (LGPL) version 2.1 which accompanies this distribution, and is available at
** http://www.gnu.org/licenses/lgpl-2.1.html
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
*************************************************************************/
// Build the precompiled headers.
#include "stable.h"

View File

@ -0,0 +1,58 @@
/************************************************************************
**
** @file stable.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 20 9, 2014
**
** @brief
** @copyright
** All rights reserved. This program and the accompanying materials
** are made available under the terms of the GNU Lesser General Public License
** (LGPL) version 2.1 which accompanies this distribution, and is available at
** http://www.gnu.org/licenses/lgpl-2.1.html
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
*************************************************************************/
#ifndef STABLE_H
#define STABLE_H
/* I like to include this pragma too, so the build log indicates if pre-compiled headers were in use. */
#ifndef __clang__
#pragma message("Compiling precompiled headers for VPropertyExplorer library.\n")
#endif
/* Add C includes here */
#if defined __cplusplus
/* Add C++ includes here */
/*In all cases we need include core header for getting defined values*/
#ifdef QT_CORE_LIB
# include <QtCore>
#endif
//In Windows you can't use same header in all modes.
#if defined(Q_OS_WIN)
# if defined(QT_NO_DEBUG)//release mode
# ifdef QT_WIDGETS_LIB
# include <QtWidgets>
# endif
# endif/*QT_NO_DEBUG*/
#else
# ifdef QT_WIDGETS_LIB
# include <QtWidgets>
# endif
#endif/*Q_OS_WIN*/
#endif /*__cplusplus*/
#endif // STABLE_H

View File

@ -49,7 +49,8 @@ SOURCES += \
vstandardpropertyfactory.cpp \ vstandardpropertyfactory.cpp \
plugins/vstringproperty.cpp \ plugins/vstringproperty.cpp \
plugins/vpointfproperty.cpp \ plugins/vpointfproperty.cpp \
plugins/vobjectproperty.cpp plugins/vobjectproperty.cpp \
stable.cpp
HEADERS +=\ HEADERS +=\
vpropertyexplorer_global.h \ vpropertyexplorer_global.h \
@ -88,13 +89,31 @@ HEADERS +=\
plugins/vstringproperty.h \ plugins/vstringproperty.h \
plugins/vpointfproperty.h \ plugins/vpointfproperty.h \
plugins/vobjectproperty.h \ plugins/vobjectproperty.h \
vproperties.h vproperties.h \
stable.h
unix { unix {
target.path = /usr/lib target.path = /usr/lib
INSTALLS += target INSTALLS += target
*-g++{
QMAKE_CXX = ccache g++
}
clang*{
QMAKE_CXX = ccache clang++
}
} }
CONFIG += precompile_header
# Precompiled headers (PCH)
PRECOMPILED_HEADER = stable.h
win32-msvc* {
PRECOMPILED_SOURCE = stable.cpp
}
include(../../../Valentina.pri)
CONFIG(debug, debug|release){ CONFIG(debug, debug|release){
# Debug # Debug
unix { unix {

View File

@ -83,6 +83,8 @@ protected:
//! The default manager //! The default manager
static VPropertyFactoryManager* DefaultManager; static VPropertyFactoryManager* DefaultManager;
private:
Q_DISABLE_COPY(VPropertyFactoryManager)
}; };
} }

View File

@ -34,6 +34,7 @@ class VAbstractPropertyFactory;
class VPropertyFactoryManagerPrivate class VPropertyFactoryManagerPrivate
{ {
public: public:
VPropertyFactoryManagerPrivate():Factories(QMap<QString, VAbstractPropertyFactory*>()){}
QMap<QString, VAbstractPropertyFactory*> Factories; QMap<QString, VAbstractPropertyFactory*> Factories;
}; };

View File

@ -48,15 +48,24 @@ public:
VPropertyFormViewPrivate() VPropertyFormViewPrivate()
: VPropertyFormWidgetPrivate(), Model(NULL), PropertySet(NULL), NeedsRebuild(false), : VPropertyFormWidgetPrivate(), Model(NULL), PropertySet(NULL), NeedsRebuild(false),
IgnoreDataChangedSignal(false) {} IgnoreDataChangedSignal(false)
{}
VPropertyFormViewPrivate(VPropertyModel* prop_model) VPropertyFormViewPrivate(VPropertyModel* prop_model)
: VPropertyFormWidgetPrivate(), Model(prop_model), PropertySet(NULL), NeedsRebuild(false), : VPropertyFormWidgetPrivate(), Model(prop_model), PropertySet(NULL), NeedsRebuild(false),
IgnoreDataChangedSignal(false) {} IgnoreDataChangedSignal(false)
{}
VPropertyFormViewPrivate(VPropertySet* prop_set) VPropertyFormViewPrivate(VPropertySet* prop_set)
: VPropertyFormWidgetPrivate(), Model(NULL), PropertySet(prop_set), NeedsRebuild(false), : VPropertyFormWidgetPrivate(), Model(NULL), PropertySet(prop_set), NeedsRebuild(false),
IgnoreDataChangedSignal(false) {} IgnoreDataChangedSignal(false)
{}
virtual ~VPropertyFormViewPrivate()
{}
private:
Q_DISABLE_COPY(VPropertyFormViewPrivate)
}; };
} }

View File

@ -55,12 +55,16 @@ public:
//! Default constructor //! Default constructor
VPropertyFormWidgetPrivate() VPropertyFormWidgetPrivate()
: UpdateEditors(true) : Properties(QList<VProperty*>()), EditorWidgets(QList<SEditorWidget>()), UpdateEditors(true)
{} {}
//! Constructor //! Constructor
VPropertyFormWidgetPrivate(const QList<VProperty*>& properties) VPropertyFormWidgetPrivate(const QList<VProperty*>& properties)
: Properties(properties), UpdateEditors(true) {} : Properties(properties), EditorWidgets(QList<SEditorWidget>()), UpdateEditors(true)
{}
virtual ~VPropertyFormWidgetPrivate()
{}
}; };
} }

View File

@ -47,7 +47,7 @@ public:
//! Constructor //! Constructor
VPropertyModelPrivate() VPropertyModelPrivate()
: Properties(nullptr) : Properties(nullptr), HeadlineProperty(QString()), HeadlineValue(QString())
{ {
//: The text that appears in the first column header //: The text that appears in the first column header
HeadlineProperty = QObject::tr("Property"); HeadlineProperty = QObject::tr("Property");
@ -55,6 +55,9 @@ public:
//: The text that appears in the second column header //: The text that appears in the second column header
HeadlineValue = QObject::tr("Value"); HeadlineValue = QObject::tr("Value");
} }
private:
Q_DISABLE_COPY(VPropertyModelPrivate)
}; };
} }

View File

@ -43,8 +43,11 @@ public:
//! Constructor //! Constructor
VPropertySetPrivate() VPropertySetPrivate()
{ : Properties(QMap<QString, VProperty*>()), RootProperties(QList<VProperty*>())
} {}
private:
Q_DISABLE_COPY(VPropertySetPrivate)
}; };
} }

View File

@ -59,6 +59,9 @@ protected:
//! The protected data //! The protected data
VPropertyTreeViewPrivate* d_ptr; VPropertyTreeViewPrivate* d_ptr;
private:
Q_DISABLE_COPY(VPropertyTreeView)
}; };
} }

View File

@ -23,15 +23,15 @@
using namespace VPE; using namespace VPE;
VSerializedProperty::VSerializedProperty() VSerializedProperty::VSerializedProperty()
: ID(), Type(), Value() : ID(), Type(), Value(), Children()
{ {}
}
/*! Creates a new VSerializedProperty from an existing property /*! Creates a new VSerializedProperty from an existing property
*/ */
VSerializedProperty::VSerializedProperty(const VProperty* property, const VPropertySet* set) VSerializedProperty::VSerializedProperty(const VProperty* property, const VPropertySet* set)
: ID(), Type(property ? property->type() : QString()), Value(property ? property->getValue() : QVariant()) : ID(), Type(property ? property->type() : QString()), Value(property ? property->getValue() : QVariant()),
Children()
{ {
if (set) if (set)
{ {
@ -42,20 +42,19 @@ VSerializedProperty::VSerializedProperty(const VProperty* property, const VPrope
} }
VSerializedProperty::VSerializedProperty(const VProperty *property, const QString &id, const VPropertySet *set) VSerializedProperty::VSerializedProperty(const VProperty *property, const QString &id, const VPropertySet *set)
: ID(id), Type(property ? property->type() : QString()), Value(property ? property->getValue() : QVariant()) : ID(id), Type(property ? property->type() : QString()), Value(property ? property->getValue() : QVariant()),
Children()
{ {
initChildren(property, set); initChildren(property, set);
} }
VSerializedProperty::VSerializedProperty(const QString &id, const QString &type, const QVariant &value) VSerializedProperty::VSerializedProperty(const QString &id, const QString &type, const QVariant &value)
: ID(id), Type(type), Value(value) : ID(id), Type(type), Value(value), Children()
{ {
} }
VPE::VSerializedProperty::~VSerializedProperty() VPE::VSerializedProperty::~VSerializedProperty()
{ {}
//
}
void VSerializedProperty::initChildren(const VProperty *property, const VPropertySet *set) void VSerializedProperty::initChildren(const VProperty *property, const VPropertySet *set)
{ {