From a8bb3e81619a04a56d6677dfc54bc85b926dab43 Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 20 Sep 2014 19:05:21 +0300 Subject: [PATCH] GCC warnings. --HG-- branch : develop --- Valentina.pri | 2 + src/libs/qmuparser/qmuparser.pro | 2 + .../plugins/Vector3d/vvector3dproperty.cpp | 2 +- .../plugins/vcolorpropertyeditor.cpp | 4 +- .../plugins/vcolorpropertyeditor.h | 1 + .../plugins/venumproperty.cpp | 2 +- .../vpropertyexplorer/plugins/venumproperty.h | 2 + .../plugins/vfilepropertyeditor.cpp | 3 +- .../plugins/vfilepropertyeditor.h | 3 + .../plugins/vnumberproperty.cpp | 8 +-- .../plugins/vobjectproperty.cpp | 2 +- .../plugins/vobjectproperty.h | 3 + .../plugins/vshortcutpropertyeditor.cpp | 2 +- .../plugins/vshortcutpropertyeditor.h | 3 + src/libs/vpropertyexplorer/stable.cpp | 22 +++++++ src/libs/vpropertyexplorer/stable.h | 58 +++++++++++++++++++ .../vpropertyexplorer/vpropertyexplorer.pro | 23 +++++++- .../vpropertyfactorymanager.h | 2 + .../vpropertyfactorymanager_p.h | 1 + .../vpropertyexplorer/vpropertyformview_p.h | 15 ++++- .../vpropertyexplorer/vpropertyformwidget_p.h | 8 ++- src/libs/vpropertyexplorer/vpropertymodel_p.h | 5 +- src/libs/vpropertyexplorer/vpropertyset_p.h | 7 ++- .../vpropertyexplorer/vpropertytreeview.h | 3 + .../vpropertyexplorer/vserializedproperty.cpp | 17 +++--- 25 files changed, 170 insertions(+), 30 deletions(-) create mode 100644 src/libs/vpropertyexplorer/stable.cpp create mode 100644 src/libs/vpropertyexplorer/stable.h diff --git a/Valentina.pri b/Valentina.pri index 948e56931..eb3a98d03 100644 --- a/Valentina.pri +++ b/Valentina.pri @@ -42,6 +42,7 @@ defineTest(copyToDestdir) { GCC_CXXFLAGS += \ + -O0 \ -Wall \ -Wextra \ -pedantic \ @@ -83,6 +84,7 @@ GCC_CXXFLAGS += \ -ftrapv CLANG_CXXFLAGS += \ + -O0 \ -fparse-all-comments \ -Wabi \ -Wabstract-final-class \ diff --git a/src/libs/qmuparser/qmuparser.pro b/src/libs/qmuparser/qmuparser.pro index 648586770..d2651f04d 100644 --- a/src/libs/qmuparser/qmuparser.pro +++ b/src/libs/qmuparser/qmuparser.pro @@ -69,6 +69,8 @@ win32-msvc* { PRECOMPILED_SOURCE = stable.cpp } +include(../../../Valentina.pri) + CONFIG(debug, debug|release){ # Debug unix { diff --git a/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.cpp b/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.cpp index 296475af4..a157d4f81 100644 --- a/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.cpp @@ -131,7 +131,7 @@ void QVector3DProperty::setValue(const QVariant &value) QStringList tmpStrings = value.toString().split(","); if (tmpStrings.count() == 3) { - setVector(tmpStrings[0].toDouble(), tmpStrings[1].toDouble(), tmpStrings[2].toDouble()); + setVector(tmpStrings[0].toFloat(), tmpStrings[1].toFloat(), tmpStrings[2].toFloat()); } } diff --git a/src/libs/vpropertyexplorer/plugins/vcolorpropertyeditor.cpp b/src/libs/vpropertyexplorer/plugins/vcolorpropertyeditor.cpp index bb1aac396..a3bf55fff 100644 --- a/src/libs/vpropertyexplorer/plugins/vcolorpropertyeditor.cpp +++ b/src/libs/vpropertyexplorer/plugins/vcolorpropertyeditor.cpp @@ -30,8 +30,8 @@ using namespace VPE; -VColorPropertyEditor::VColorPropertyEditor(QWidget *parent) : - QWidget(parent) +VColorPropertyEditor::VColorPropertyEditor(QWidget *parent) + : QWidget(parent), Color(), ToolButton(nullptr), TextLabel(nullptr), ColorLabel(nullptr), Spacer(nullptr) { setAutoFillBackground(true); diff --git a/src/libs/vpropertyexplorer/plugins/vcolorpropertyeditor.h b/src/libs/vpropertyexplorer/plugins/vcolorpropertyeditor.h index b90218b87..ac6dba31a 100644 --- a/src/libs/vpropertyexplorer/plugins/vcolorpropertyeditor.h +++ b/src/libs/vpropertyexplorer/plugins/vcolorpropertyeditor.h @@ -75,6 +75,7 @@ private slots: void onToolButtonClicked(); private: + Q_DISABLE_COPY(VColorPropertyEditor) QColor Color; QToolButton* ToolButton; QLabel* TextLabel; diff --git a/src/libs/vpropertyexplorer/plugins/venumproperty.cpp b/src/libs/vpropertyexplorer/plugins/venumproperty.cpp index 9caf63f6d..30330044d 100644 --- a/src/libs/vpropertyexplorer/plugins/venumproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/venumproperty.cpp @@ -27,7 +27,7 @@ using namespace VPE; VEnumProperty::VEnumProperty(const QString& name) - : VProperty(name, QVariant::Int) + : VProperty(name, QVariant::Int), EnumerationLiterals() { VProperty::d_ptr->VariantValue = 0; VProperty::d_ptr->VariantValue.convert(QVariant::Int); diff --git a/src/libs/vpropertyexplorer/plugins/venumproperty.h b/src/libs/vpropertyexplorer/plugins/venumproperty.h index 40da26dba..b15a04cd5 100644 --- a/src/libs/vpropertyexplorer/plugins/venumproperty.h +++ b/src/libs/vpropertyexplorer/plugins/venumproperty.h @@ -90,6 +90,8 @@ protected: 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 //members by reimplementing the VPropertyPrivate class without touching this header file. +private: + Q_DISABLE_COPY(VEnumProperty) }; } diff --git a/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp b/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp index 277b4dd23..acc4d2b1d 100644 --- a/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp +++ b/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp @@ -30,7 +30,8 @@ using namespace VPE; 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); ToolButton = new QToolButton(this); diff --git a/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.h b/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.h index d45a17e81..9cdaca357 100644 --- a/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.h +++ b/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.h @@ -101,6 +101,9 @@ protected: //! Specifies whether it is being looked for a directory (true) or a file (false, default) bool Directory; + +private: + Q_DISABLE_COPY(VFileEditWidget) }; } diff --git a/src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp b/src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp index 42ad9df4b..9ec659725 100644 --- a/src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp @@ -56,9 +56,9 @@ QWidget* VIntegerProperty::createEditor(QWidget * parent, const QStyleOptionView Q_UNUSED(delegate); QSpinBox* tmpEditor = new QSpinBox(parent); - tmpEditor->setMinimum(minValue); - tmpEditor->setMaximum(maxValue); - tmpEditor->setSingleStep(singleStep); + tmpEditor->setMinimum(static_cast(minValue)); + tmpEditor->setMaximum(static_cast(maxValue)); + tmpEditor->setSingleStep(static_cast(singleStep)); tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); tmpEditor->setValue(VProperty::d_ptr->VariantValue.toInt()); connect(tmpEditor, static_cast(&QSpinBox::valueChanged), this, @@ -203,7 +203,7 @@ void VDoubleProperty::setSetting(const QString& key, const QVariant& value) } else if (key == QLatin1String("Precision")) { - Precision = value.toDouble(); + Precision = value.toInt(); } } diff --git a/src/libs/vpropertyexplorer/plugins/vobjectproperty.cpp b/src/libs/vpropertyexplorer/plugins/vobjectproperty.cpp index 46a0d60e6..513d8d812 100644 --- a/src/libs/vpropertyexplorer/plugins/vobjectproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vobjectproperty.cpp @@ -28,7 +28,7 @@ using namespace VPE; VObjectProperty::VObjectProperty(const QString& name) - : VProperty(name, QVariant::Int) + : VProperty(name, QVariant::Int), objects() { VProperty::d_ptr->VariantValue = 0; VProperty::d_ptr->VariantValue.convert(QVariant::UInt); diff --git a/src/libs/vpropertyexplorer/plugins/vobjectproperty.h b/src/libs/vpropertyexplorer/plugins/vobjectproperty.h index ba1462c39..9c5b66f2c 100644 --- a/src/libs/vpropertyexplorer/plugins/vobjectproperty.h +++ b/src/libs/vpropertyexplorer/plugins/vobjectproperty.h @@ -86,6 +86,9 @@ protected: void FillList(QComboBox *box, const QMap &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 //members by reimplementing the VPropertyPrivate class without touching this header file. + +private: + Q_DISABLE_COPY(VObjectProperty) }; } diff --git a/src/libs/vpropertyexplorer/plugins/vshortcutpropertyeditor.cpp b/src/libs/vpropertyexplorer/plugins/vshortcutpropertyeditor.cpp index c4864150f..412c2f456 100644 --- a/src/libs/vpropertyexplorer/plugins/vshortcutpropertyeditor.cpp +++ b/src/libs/vpropertyexplorer/plugins/vshortcutpropertyeditor.cpp @@ -26,7 +26,7 @@ using namespace VPE; VShortcutEditWidget::VShortcutEditWidget(QWidget *parent) - : QWidget(parent) + : QWidget(parent), CurrentKeySequence(), LineEdit(nullptr) { // Create the line edit widget LineEdit = new QLineEdit(this); diff --git a/src/libs/vpropertyexplorer/plugins/vshortcutpropertyeditor.h b/src/libs/vpropertyexplorer/plugins/vshortcutpropertyeditor.h index 97a6ffb46..6e9c91144 100644 --- a/src/libs/vpropertyexplorer/plugins/vshortcutpropertyeditor.h +++ b/src/libs/vpropertyexplorer/plugins/vshortcutpropertyeditor.h @@ -78,6 +78,9 @@ protected: //! The line to display and edit the key sequence QLineEdit* LineEdit; + +private: + Q_DISABLE_COPY(VShortcutEditWidget) }; } diff --git a/src/libs/vpropertyexplorer/stable.cpp b/src/libs/vpropertyexplorer/stable.cpp new file mode 100644 index 000000000..dc0e7d1cb --- /dev/null +++ b/src/libs/vpropertyexplorer/stable.cpp @@ -0,0 +1,22 @@ +/************************************************************************ + ** + ** @file stable.cpp + ** @author Roman Telezhynskyi + ** @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" diff --git a/src/libs/vpropertyexplorer/stable.h b/src/libs/vpropertyexplorer/stable.h new file mode 100644 index 000000000..6390189fc --- /dev/null +++ b/src/libs/vpropertyexplorer/stable.h @@ -0,0 +1,58 @@ +/************************************************************************ + ** + ** @file stable.h + ** @author Roman Telezhynskyi + ** @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 +#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 +# endif + +# endif/*QT_NO_DEBUG*/ +#else + +# ifdef QT_WIDGETS_LIB +# include +# endif + +#endif/*Q_OS_WIN*/ + +#endif /*__cplusplus*/ + +#endif // STABLE_H diff --git a/src/libs/vpropertyexplorer/vpropertyexplorer.pro b/src/libs/vpropertyexplorer/vpropertyexplorer.pro index 69068d79c..b45f272e0 100644 --- a/src/libs/vpropertyexplorer/vpropertyexplorer.pro +++ b/src/libs/vpropertyexplorer/vpropertyexplorer.pro @@ -49,7 +49,8 @@ SOURCES += \ vstandardpropertyfactory.cpp \ plugins/vstringproperty.cpp \ plugins/vpointfproperty.cpp \ - plugins/vobjectproperty.cpp + plugins/vobjectproperty.cpp \ + stable.cpp HEADERS +=\ vpropertyexplorer_global.h \ @@ -88,13 +89,31 @@ HEADERS +=\ plugins/vstringproperty.h \ plugins/vpointfproperty.h \ plugins/vobjectproperty.h \ - vproperties.h + vproperties.h \ + stable.h unix { target.path = /usr/lib 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){ # Debug unix { diff --git a/src/libs/vpropertyexplorer/vpropertyfactorymanager.h b/src/libs/vpropertyexplorer/vpropertyfactorymanager.h index 18467aeba..4e8c2060f 100644 --- a/src/libs/vpropertyexplorer/vpropertyfactorymanager.h +++ b/src/libs/vpropertyexplorer/vpropertyfactorymanager.h @@ -83,6 +83,8 @@ protected: //! The default manager static VPropertyFactoryManager* DefaultManager; +private: + Q_DISABLE_COPY(VPropertyFactoryManager) }; } diff --git a/src/libs/vpropertyexplorer/vpropertyfactorymanager_p.h b/src/libs/vpropertyexplorer/vpropertyfactorymanager_p.h index 28aa1e3f7..4c517d5ee 100644 --- a/src/libs/vpropertyexplorer/vpropertyfactorymanager_p.h +++ b/src/libs/vpropertyexplorer/vpropertyfactorymanager_p.h @@ -34,6 +34,7 @@ class VAbstractPropertyFactory; class VPropertyFactoryManagerPrivate { public: + VPropertyFactoryManagerPrivate():Factories(QMap()){} QMap Factories; }; diff --git a/src/libs/vpropertyexplorer/vpropertyformview_p.h b/src/libs/vpropertyexplorer/vpropertyformview_p.h index 92646ce7b..28dc4a480 100644 --- a/src/libs/vpropertyexplorer/vpropertyformview_p.h +++ b/src/libs/vpropertyexplorer/vpropertyformview_p.h @@ -48,15 +48,24 @@ public: VPropertyFormViewPrivate() : VPropertyFormWidgetPrivate(), Model(NULL), PropertySet(NULL), NeedsRebuild(false), - IgnoreDataChangedSignal(false) {} + IgnoreDataChangedSignal(false) + {} VPropertyFormViewPrivate(VPropertyModel* prop_model) : VPropertyFormWidgetPrivate(), Model(prop_model), PropertySet(NULL), NeedsRebuild(false), - IgnoreDataChangedSignal(false) {} + IgnoreDataChangedSignal(false) + {} VPropertyFormViewPrivate(VPropertySet* prop_set) : VPropertyFormWidgetPrivate(), Model(NULL), PropertySet(prop_set), NeedsRebuild(false), - IgnoreDataChangedSignal(false) {} + IgnoreDataChangedSignal(false) + {} + + virtual ~VPropertyFormViewPrivate() + {} + +private: + Q_DISABLE_COPY(VPropertyFormViewPrivate) }; } diff --git a/src/libs/vpropertyexplorer/vpropertyformwidget_p.h b/src/libs/vpropertyexplorer/vpropertyformwidget_p.h index 12d2ed8a9..0cba9f21f 100644 --- a/src/libs/vpropertyexplorer/vpropertyformwidget_p.h +++ b/src/libs/vpropertyexplorer/vpropertyformwidget_p.h @@ -55,12 +55,16 @@ public: //! Default constructor VPropertyFormWidgetPrivate() - : UpdateEditors(true) + : Properties(QList()), EditorWidgets(QList()), UpdateEditors(true) {} //! Constructor VPropertyFormWidgetPrivate(const QList& properties) - : Properties(properties), UpdateEditors(true) {} + : Properties(properties), EditorWidgets(QList()), UpdateEditors(true) + {} + + virtual ~VPropertyFormWidgetPrivate() + {} }; } diff --git a/src/libs/vpropertyexplorer/vpropertymodel_p.h b/src/libs/vpropertyexplorer/vpropertymodel_p.h index 81cf8d491..cabd95480 100644 --- a/src/libs/vpropertyexplorer/vpropertymodel_p.h +++ b/src/libs/vpropertyexplorer/vpropertymodel_p.h @@ -47,7 +47,7 @@ public: //! Constructor VPropertyModelPrivate() - : Properties(nullptr) + : Properties(nullptr), HeadlineProperty(QString()), HeadlineValue(QString()) { //: The text that appears in the first column header HeadlineProperty = QObject::tr("Property"); @@ -55,6 +55,9 @@ public: //: The text that appears in the second column header HeadlineValue = QObject::tr("Value"); } + +private: + Q_DISABLE_COPY(VPropertyModelPrivate) }; } diff --git a/src/libs/vpropertyexplorer/vpropertyset_p.h b/src/libs/vpropertyexplorer/vpropertyset_p.h index 9b7baf7dd..5c97ffd3d 100644 --- a/src/libs/vpropertyexplorer/vpropertyset_p.h +++ b/src/libs/vpropertyexplorer/vpropertyset_p.h @@ -43,8 +43,11 @@ public: //! Constructor VPropertySetPrivate() - { - } + : Properties(QMap()), RootProperties(QList()) + {} + +private: + Q_DISABLE_COPY(VPropertySetPrivate) }; } diff --git a/src/libs/vpropertyexplorer/vpropertytreeview.h b/src/libs/vpropertyexplorer/vpropertytreeview.h index 635cbdb89..62ab14831 100644 --- a/src/libs/vpropertyexplorer/vpropertytreeview.h +++ b/src/libs/vpropertyexplorer/vpropertytreeview.h @@ -59,6 +59,9 @@ protected: //! The protected data VPropertyTreeViewPrivate* d_ptr; + +private: + Q_DISABLE_COPY(VPropertyTreeView) }; } diff --git a/src/libs/vpropertyexplorer/vserializedproperty.cpp b/src/libs/vpropertyexplorer/vserializedproperty.cpp index a19e85df3..f27c21cb6 100644 --- a/src/libs/vpropertyexplorer/vserializedproperty.cpp +++ b/src/libs/vpropertyexplorer/vserializedproperty.cpp @@ -23,15 +23,15 @@ using namespace VPE; VSerializedProperty::VSerializedProperty() - : ID(), Type(), Value() -{ -} + : ID(), Type(), Value(), Children() +{} /*! Creates a new VSerializedProperty from an existing property */ 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) { @@ -42,20 +42,19 @@ VSerializedProperty::VSerializedProperty(const VProperty* property, const VPrope } 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); } 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() -{ - // -} +{} void VSerializedProperty::initChildren(const VProperty *property, const VPropertySet *set) {