From b1272cb1aab57fc8dbdc8b06897f54278ced9892 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 23 Sep 2016 21:58:43 +0200 Subject: [PATCH] fix -Wextra in Sandbox --- src/Mod/Sandbox/App/AppSandbox.cpp | 8 ++-- src/Mod/Sandbox/Gui/AppSandboxGui.cpp | 2 +- src/Mod/Sandbox/Gui/Command.cpp | 58 +++++++++++++------------- src/Mod/Sandbox/Gui/GLGraphicsView.cpp | 23 +++++----- src/Mod/Sandbox/Gui/Overlay.cpp | 6 +-- src/Mod/Sandbox/Gui/Workbench.cpp | 2 +- 6 files changed, 51 insertions(+), 48 deletions(-) diff --git a/src/Mod/Sandbox/App/AppSandbox.cpp b/src/Mod/Sandbox/App/AppSandbox.cpp index 17aa8accf..9cf93f0e0 100644 --- a/src/Mod/Sandbox/App/AppSandbox.cpp +++ b/src/Mod/Sandbox/App/AppSandbox.cpp @@ -151,12 +151,12 @@ public: // len(x) return m_array.size(); } - virtual Py::Object sequence_concat(const Py::Object & i) + virtual Py::Object sequence_concat(const Py::Object &) { // x + y throw Py::NotImplementedError("not yet implemented"); } - virtual Py::Object sequence_repeat(Py_ssize_t i) + virtual Py::Object sequence_repeat(Py_ssize_t) { // x * 3 throw Py::NotImplementedError("not yet implemented"); @@ -168,7 +168,7 @@ public: throw Py::IndexError("index out of range"); return m_array[i]; } - virtual Py::Object sequence_slice(Py_ssize_t i, Py_ssize_t j) + virtual Py::Object sequence_slice(Py_ssize_t, Py_ssize_t) { // x[0:3] throw Py::NotImplementedError("not yet implemented"); @@ -181,7 +181,7 @@ public: m_array[i] = o; return 0; } - virtual int sequence_ass_slice(Py_ssize_t i, Py_ssize_t j, const Py::Object & o) + virtual int sequence_ass_slice(Py_ssize_t, Py_ssize_t, const Py::Object &) { // x[0:3] = y throw Py::NotImplementedError("not yet implemented"); diff --git a/src/Mod/Sandbox/Gui/AppSandboxGui.cpp b/src/Mod/Sandbox/Gui/AppSandboxGui.cpp index 695c4dee0..456ab48bd 100644 --- a/src/Mod/Sandbox/Gui/AppSandboxGui.cpp +++ b/src/Mod/Sandbox/Gui/AppSandboxGui.cpp @@ -204,7 +204,7 @@ public: virtual ~Module() {} private: - Py::Object interactiveFilletArc(const Py::Tuple& args) + Py::Object interactiveFilletArc(const Py::Tuple& /*args*/) { Gui::Document* doc = Gui::Application::Instance->activeDocument(); if (doc) { diff --git a/src/Mod/Sandbox/Gui/Command.cpp b/src/Mod/Sandbox/Gui/Command.cpp index f592fbfc1..0148ac223 100644 --- a/src/Mod/Sandbox/Gui/Command.cpp +++ b/src/Mod/Sandbox/Gui/Command.cpp @@ -95,7 +95,7 @@ CmdSandboxDocumentThread::CmdSandboxDocumentThread() sPixmap = "Std_Tool1"; } -void CmdSandboxDocumentThread::activated(int iMsg) +void CmdSandboxDocumentThread::activated(int) { App::GetApplication().newDocument("Thread"); for (int i=0; i<5; i++) { @@ -122,7 +122,7 @@ CmdSandboxDocumentTestThread::CmdSandboxDocumentTestThread() sPixmap = "Std_Tool1"; } -void CmdSandboxDocumentTestThread::activated(int iMsg) +void CmdSandboxDocumentTestThread::activated(int) { App::GetApplication().newDocument("Thread"); Sandbox::DocumentTestThread* dt = new Sandbox::DocumentTestThread(); @@ -145,7 +145,7 @@ CmdSandboxDocumentSaveThread::CmdSandboxDocumentSaveThread() sStatusTip = QT_TR_NOOP("Sandbox save function"); } -void CmdSandboxDocumentSaveThread::activated(int iMsg) +void CmdSandboxDocumentSaveThread::activated(int) { App::Document* doc = App::GetApplication().getActiveDocument(); Sandbox::DocumentSaverThread* dt = new Sandbox::DocumentSaverThread(doc); @@ -174,7 +174,7 @@ CmdSandboxDocThreadWithSeq::CmdSandboxDocThreadWithSeq() sPixmap = "Std_Tool2"; } -void CmdSandboxDocThreadWithSeq::activated(int iMsg) +void CmdSandboxDocThreadWithSeq::activated(int) { App::GetApplication().newDocument("Thread"); Sandbox::DocumentThread* dt = new Sandbox::DocumentThread(); @@ -213,7 +213,7 @@ CmdSandboxDocThreadBusy::CmdSandboxDocThreadBusy() sPixmap = "Std_Tool3"; } -void CmdSandboxDocThreadBusy::activated(int iMsg) +void CmdSandboxDocThreadBusy::activated(int) { App::GetApplication().newDocument("Thread"); Sandbox::DocumentThread* dt = new Sandbox::DocumentThread(); @@ -250,7 +250,7 @@ CmdSandboxDocumentNoThread::CmdSandboxDocumentNoThread() sPixmap = "Std_Tool4"; } -void CmdSandboxDocumentNoThread::activated(int iMsg) +void CmdSandboxDocumentNoThread::activated(int) { App::GetApplication().newDocument("Thread"); App::Document* doc = App::GetApplication().getActiveDocument(); @@ -281,7 +281,7 @@ CmdSandboxWorkerThread::CmdSandboxWorkerThread() sPixmap = "Std_Tool1"; } -void CmdSandboxWorkerThread::activated(int iMsg) +void CmdSandboxWorkerThread::activated(int) { Sandbox::WorkerThread* wt = new Sandbox::WorkerThread(); QObject::connect(wt, SIGNAL(finished()), wt, SLOT(deleteLater())); @@ -303,7 +303,7 @@ CmdSandboxPythonLockThread::CmdSandboxPythonLockThread() sStatusTip = QT_TR_NOOP("Use Python's thread module where each thread is locked"); } -void CmdSandboxPythonLockThread::activated(int iMsg) +void CmdSandboxPythonLockThread::activated(int) { doCommand(Doc, "import thread, time, Sandbox\n" @@ -338,7 +338,7 @@ CmdSandboxPythonNolockThread::CmdSandboxPythonNolockThread() sStatusTip = QT_TR_NOOP("Use Python's thread module where each thread is unlocked"); } -void CmdSandboxPythonNolockThread::activated(int iMsg) +void CmdSandboxPythonNolockThread::activated(int) { doCommand(Doc, "import thread, time, Sandbox\n" @@ -370,7 +370,7 @@ CmdSandboxPyQtThread::CmdSandboxPyQtThread() sStatusTip = QT_TR_NOOP("Use PyQt's thread module"); } -void CmdSandboxPyQtThread::activated(int iMsg) +void CmdSandboxPyQtThread::activated(int) { doCommand(Doc, "from PyQt4 import QtCore; import Sandbox\n" @@ -405,7 +405,7 @@ CmdSandboxPythonThread::CmdSandboxPythonThread() sStatusTip = QT_TR_NOOP("Use class PythonThread running Python code in its run() method"); } -void CmdSandboxPythonThread::activated(int iMsg) +void CmdSandboxPythonThread::activated(int) { App::GetApplication().newDocument("Thread"); for (int i=0; i<5; i++) { @@ -431,7 +431,7 @@ CmdSandboxPythonMainThread::CmdSandboxPythonMainThread() sStatusTip = QT_TR_NOOP("Run python code in main thread"); } -void CmdSandboxPythonMainThread::activated(int iMsg) +void CmdSandboxPythonMainThread::activated(int) { doCommand(Doc, "import Sandbox\n" @@ -458,7 +458,7 @@ CmdSandboxDocThreadWithDialog::CmdSandboxDocThreadWithDialog() sPixmap = "Std_Tool7"; } -void CmdSandboxDocThreadWithDialog::activated(int iMsg) +void CmdSandboxDocThreadWithDialog::activated(int) { App::GetApplication().newDocument("Thread"); Sandbox::DocumentThread* dt = new Sandbox::DocumentThread(); @@ -485,7 +485,7 @@ CmdSandboxDocThreadWithFileDlg::CmdSandboxDocThreadWithFileDlg() sPixmap = "Std_Tool7"; } -void CmdSandboxDocThreadWithFileDlg::activated(int iMsg) +void CmdSandboxDocThreadWithFileDlg::activated(int) { App::GetApplication().newDocument("Thread"); Sandbox::DocumentThread* dt = new Sandbox::DocumentThread(); @@ -523,7 +523,7 @@ CmdSandboxEventLoop::CmdSandboxEventLoop() sPixmap = "Std_Tool6"; } -void CmdSandboxEventLoop::activated(int iMsg) +void CmdSandboxEventLoop::activated(int) { QTimer timer; timer.setSingleShot(true); @@ -566,7 +566,7 @@ CmdSandboxMeshLoader::CmdSandboxMeshLoader() sPixmap = "Std_Tool6"; } -void CmdSandboxMeshLoader::activated(int iMsg) +void CmdSandboxMeshLoader::activated(int) { // use current path as default QStringList filter; @@ -624,7 +624,7 @@ CmdSandboxMeshLoaderBoost::CmdSandboxMeshLoaderBoost() sPixmap = "Std_Tool6"; } -void CmdSandboxMeshLoaderBoost::activated(int iMsg) +void CmdSandboxMeshLoaderBoost::activated(int) { # if BOOST_VERSION >= 104100 // use current path as default @@ -678,7 +678,7 @@ CmdSandboxMeshLoaderFuture::CmdSandboxMeshLoaderFuture() sPixmap = "Std_Tool6"; } -void CmdSandboxMeshLoaderFuture::activated(int iMsg) +void CmdSandboxMeshLoaderFuture::activated(int) { // use current path as default QStringList filter; @@ -793,7 +793,7 @@ CmdSandboxMeshTestJob::CmdSandboxMeshTestJob() sPixmap = "Std_Tool7"; } -void CmdSandboxMeshTestJob::activated(int iMsg) +void CmdSandboxMeshTestJob::activated(int) { Mesh::MeshObjectConstRefList meshes; App::Document* app_doc = App::GetApplication().getActiveDocument(); @@ -887,7 +887,7 @@ CmdSandboxMeshTestRef::CmdSandboxMeshTestRef() sStatusTip = QT_TR_NOOP("Sandbox Test function"); } -void CmdSandboxMeshTestRef::activated(int iMsg) +void CmdSandboxMeshTestRef::activated(int) { Gui::WaitCursor wc; std::vector< boost::shared_ptr > threads; @@ -934,7 +934,7 @@ CmdTestGrabWidget::CmdTestGrabWidget() sStatusTip = sToolTipText; } -void CmdTestGrabWidget::activated(int iMsg) +void CmdTestGrabWidget::activated(int) { QCalendarWidget* c = new QCalendarWidget(); c->hide(); @@ -1052,7 +1052,7 @@ CmdTestImageNode::CmdTestImageNode() sStatusTip = sToolTipText; } -void CmdTestImageNode::activated(int iMsg) +void CmdTestImageNode::activated(int) { QString text = QString::fromLatin1("Distance: 2.7jgiorjgor84mm"); QFont font; @@ -1137,7 +1137,7 @@ CmdTestGDIWidget::CmdTestGDIWidget() sStatusTip = sToolTipText; } -void CmdTestGDIWidget::activated(int iMsg) +void CmdTestGDIWidget::activated(int) { #ifdef Q_OS_WIN32 GDIWidget* gdi = new GDIWidget(Gui::getMainWindow()); @@ -1163,7 +1163,7 @@ CmdTestRedirectPaint::CmdTestRedirectPaint() sStatusTip = sToolTipText; } -void CmdTestRedirectPaint::activated(int iMsg) +void CmdTestRedirectPaint::activated(int) { QCalendarWidget* cal = new QCalendarWidget(); QLabel* label = new QLabel(); @@ -1189,7 +1189,7 @@ CmdTestCryptographicHash::CmdTestCryptographicHash() sStatusTip = sToolTipText; } -void CmdTestCryptographicHash::activated(int iMsg) +void CmdTestCryptographicHash::activated(int) { QByteArray data = "FreeCAD"; QByteArray hash = QCryptographicHash::hash(data, QCryptographicHash::Md5); @@ -1211,7 +1211,7 @@ CmdTestWidgetShape::CmdTestWidgetShape() sStatusTip = sToolTipText; } -void CmdTestWidgetShape::activated(int iMsg) +void CmdTestWidgetShape::activated(int) { SandboxGui::SoWidgetShape* shape = new SandboxGui::SoWidgetShape; shape->setWidget(new QCalendarWidget()); @@ -1349,7 +1349,7 @@ MeshObjectRef makeParallelMengerSponge(int level, float x0, float y0, float z0) return mesh; } -void CmdMengerSponge::activated(int iMsg) +void CmdMengerSponge::activated(int) { bool ok; int level = QInputDialog::getInt(Gui::getMainWindow(), @@ -1402,7 +1402,7 @@ CmdTestGraphicsView::CmdTestGraphicsView() sStatusTip = QT_TR_NOOP("Creates a new view window for the active document"); } -void CmdTestGraphicsView::activated(int iMsg) +void CmdTestGraphicsView::activated(int) { Gui::GraphicsView3D* view3D = new Gui::GraphicsView3D(getActiveGuiDocument(), Gui::getMainWindow()); view3D->setWindowTitle(QString::fromLatin1("Graphics scene")); @@ -1431,7 +1431,7 @@ CmdTestTaskBox::CmdTestTaskBox() sStatusTip = sToolTipText; } -void CmdTestTaskBox::activated(int iMsg) +void CmdTestTaskBox::activated(int) { QWidget* w = new SandboxGui::TaskPanelView(); w->setAttribute(Qt::WA_DeleteOnClose); diff --git a/src/Mod/Sandbox/Gui/GLGraphicsView.cpp b/src/Mod/Sandbox/Gui/GLGraphicsView.cpp index eeef4244a..4be5f6b00 100644 --- a/src/Mod/Sandbox/Gui/GLGraphicsView.cpp +++ b/src/Mod/Sandbox/Gui/GLGraphicsView.cpp @@ -213,7 +213,7 @@ SceneEventFilter::unregisterInputDevice(SIM::Coin3D::Quarter::InputDevice * devi returns false. */ bool -SceneEventFilter::eventFilter(QObject * obj, QEvent * qevent) +SceneEventFilter::eventFilter(QObject *, QEvent * qevent) { // Convert the scene event back to a standard event std::unique_ptr sceneev; @@ -732,7 +732,7 @@ void GraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) if (event->isAccepted()) return; if (event->buttons() & Qt::LeftButton) { - const QPointF delta = event->scenePos() - event->lastScenePos(); + //const QPointF delta = event->scenePos() - event->lastScenePos(); //const Point3d angularImpulse = Point3d(delta.y(), delta.x(), 0) * 0.1; //m_rotation += angularImpulse; @@ -760,7 +760,7 @@ void GraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) if (event->isAccepted()) return; - const int delta = m_time.elapsed() - m_mouseEventTime; + //const int delta = m_time.elapsed() - m_mouseEventTime; //m_angularMomentum = m_accumulatedMomentum * (1000.0 / qMax(1, delta)); event->accept(); update(); @@ -972,14 +972,17 @@ void GraphicsView3D::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M if (strcmp(Reason, "BackgroundColor") == 0) { unsigned long col1 = rGrp.GetUnsigned("BackgroundColor",3940932863UL); - unsigned long col2 = rGrp.GetUnsigned("BackgroundColor2",859006463UL); // default color (dark blue) - unsigned long col3 = rGrp.GetUnsigned("BackgroundColor3",2880160255UL); // default color (blue/grey) - unsigned long col4 = rGrp.GetUnsigned("BackgroundColor4",1869583359UL); // default color (blue/grey) - float r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4; + //unsigned long col2 = rGrp.GetUnsigned("BackgroundColor2",859006463UL); // default color (dark blue) + //unsigned long col3 = rGrp.GetUnsigned("BackgroundColor3",2880160255UL); // default color (blue/grey) + //unsigned long col4 = rGrp.GetUnsigned("BackgroundColor4",1869583359UL); // default color (blue/grey) + float r1,g1,b1; + //float r2,g2,b2; + //float r3,g3,b3; + //float r4,g4,b4; r1 = ((col1 >> 24) & 0xff) / 255.0; g1 = ((col1 >> 16) & 0xff) / 255.0; b1 = ((col1 >> 8) & 0xff) / 255.0; - r2 = ((col2 >> 24) & 0xff) / 255.0; g2 = ((col2 >> 16) & 0xff) / 255.0; b2 = ((col2 >> 8) & 0xff) / 255.0; - r3 = ((col3 >> 24) & 0xff) / 255.0; g3 = ((col3 >> 16) & 0xff) / 255.0; b3 = ((col3 >> 8) & 0xff) / 255.0; - r4 = ((col4 >> 24) & 0xff) / 255.0; g4 = ((col4 >> 16) & 0xff) / 255.0; b4 = ((col4 >> 8) & 0xff) / 255.0; + //r2 = ((col2 >> 24) & 0xff) / 255.0; g2 = ((col2 >> 16) & 0xff) / 255.0; b2 = ((col2 >> 8) & 0xff) / 255.0; + //r3 = ((col3 >> 24) & 0xff) / 255.0; g3 = ((col3 >> 16) & 0xff) / 255.0; b3 = ((col3 >> 8) & 0xff) / 255.0; + //r4 = ((col4 >> 24) & 0xff) / 255.0; g4 = ((col4 >> 16) & 0xff) / 255.0; b4 = ((col4 >> 8) & 0xff) / 255.0; m_scene->setBackgroundColor(QColor::fromRgbF(r1, g1, b1)); //if (rGrp.GetBool("UseBackgroundColorMid",false) == false) // _viewer->setGradientBackgroundColor(SbColor(r2, g2, b2), SbColor(r3, g3, b3)); diff --git a/src/Mod/Sandbox/Gui/Overlay.cpp b/src/Mod/Sandbox/Gui/Overlay.cpp index b355d680c..0956417b7 100644 --- a/src/Mod/Sandbox/Gui/Overlay.cpp +++ b/src/Mod/Sandbox/Gui/Overlay.cpp @@ -201,7 +201,7 @@ void initializeGL() glDepthFunc(GL_LESS); } -void resizeGL(int width, int height) +void resizeGL(int /*width*/, int /*height*/) { #if 0 fbObject->bind(); @@ -588,7 +588,7 @@ int DrawingPlane::mouseButtonEvent(const SoMouseButtonEvent * const e, const QPo return Continue; } -int DrawingPlane::locationEvent(const SoLocation2Event * const e, const QPoint& pos) +int DrawingPlane::locationEvent(const SoLocation2Event * const, const QPoint& pos) { if (scribbling) { drawLineTo(pos); @@ -610,7 +610,7 @@ int DrawingPlane::locationEvent(const SoLocation2Event * const e, const QPoint& return Continue; } -int DrawingPlane::keyboardEvent( const SoKeyboardEvent * const e ) +int DrawingPlane::keyboardEvent(const SoKeyboardEvent * const) { return Continue; } diff --git a/src/Mod/Sandbox/Gui/Workbench.cpp b/src/Mod/Sandbox/Gui/Workbench.cpp index e2de1b877..5e8ba8de6 100644 --- a/src/Mod/Sandbox/Gui/Workbench.cpp +++ b/src/Mod/Sandbox/Gui/Workbench.cpp @@ -151,7 +151,7 @@ SoWidgetShape::SoWidgetShape() SO_NODE_CONSTRUCTOR(SoWidgetShape); } -void SoWidgetShape::GLRender(SoGLRenderAction *action) +void SoWidgetShape::GLRender(SoGLRenderAction * /*action*/) { #if 1 this->image = QPixmap::grabWidget(w, w->rect()).toImage();