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 += \
-O0 \
-Wall \
-Wextra \
-pedantic \
@ -83,6 +84,7 @@ GCC_CXXFLAGS += \
-ftrapv
CLANG_CXXFLAGS += \
-O0 \
-fparse-all-comments \
-Wabi \
-Wabstract-final-class \

View File

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

View File

@ -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());
}
}

View File

@ -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);

View File

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

View File

@ -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);

View File

@ -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)
};
}

View File

@ -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);

View File

@ -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)
};
}

View File

@ -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<int>(minValue));
tmpEditor->setMaximum(static_cast<int>(maxValue));
tmpEditor->setSingleStep(static_cast<int>(singleStep));
tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
tmpEditor->setValue(VProperty::d_ptr->VariantValue.toInt());
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"))
{
Precision = value.toDouble();
Precision = value.toInt();
}
}

View File

@ -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);

View File

@ -86,6 +86,9 @@ protected:
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
//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;
VShortcutEditWidget::VShortcutEditWidget(QWidget *parent)
: QWidget(parent)
: QWidget(parent), CurrentKeySequence(), LineEdit(nullptr)
{
// Create the line edit widget
LineEdit = new QLineEdit(this);

View File

@ -78,6 +78,9 @@ protected:
//! The line to display and edit the key sequence
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 \
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 {

View File

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

View File

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

View File

@ -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)
};
}

View File

@ -55,12 +55,16 @@ public:
//! Default constructor
VPropertyFormWidgetPrivate()
: UpdateEditors(true)
: Properties(QList<VProperty*>()), EditorWidgets(QList<SEditorWidget>()), UpdateEditors(true)
{}
//! Constructor
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
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)
};
}

View File

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

View File

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

View File

@ -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)
{