From ba507cef98aa1a34a0d47235906d6967ee8e3c08 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Sat, 25 Apr 2015 11:01:02 +0200 Subject: [PATCH 1/2] Fix a few warnings --- interface/src/Application.cpp | 1 - interface/src/ui/ApplicationOverlay.cpp | 1 - libraries/entities/src/EntityItem.cpp | 1 - libraries/gpu/src/gpu/GLBackendTexture.cpp | 6 ++++-- libraries/physics/src/DynamicCharacterController.cpp | 2 -- libraries/render-utils/src/Model.cpp | 4 ++-- 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index b4d155319d..95700f3257 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1058,7 +1058,6 @@ void Application::keyPressEvent(QKeyEvent* event) { bool isShifted = event->modifiers().testFlag(Qt::ShiftModifier); bool isMeta = event->modifiers().testFlag(Qt::ControlModifier); bool isOption = event->modifiers().testFlag(Qt::AltModifier); - bool isKeypad = event->modifiers().testFlag(Qt::KeypadModifier); switch (event->key()) { break; case Qt::Key_L: diff --git a/interface/src/ui/ApplicationOverlay.cpp b/interface/src/ui/ApplicationOverlay.cpp index 2a8f01aafc..bf93a3e7d2 100644 --- a/interface/src/ui/ApplicationOverlay.cpp +++ b/interface/src/ui/ApplicationOverlay.cpp @@ -257,7 +257,6 @@ void ApplicationOverlay::displayOverlayTexture() { if (_alpha == 0.0f) { return; } - auto glCanvas = Application::getInstance()->getGLWidget(); glMatrixMode(GL_PROJECTION); glPushMatrix(); { glLoadIdentity(); diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index f968244ab3..65d4849b0e 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -1080,7 +1080,6 @@ const float MIN_ALIGNMENT_DOT = 0.999999f; const float MIN_VELOCITY_DELTA = 0.01f; const float MIN_DAMPING_DELTA = 0.001f; const float MIN_GRAVITY_DELTA = 0.001f; -const float MIN_ACCELERATION_DELTA = 0.001f; const float MIN_SPIN_DELTA = 0.0003f; void EntityItem::updatePositionInDomainUnits(const glm::vec3& value) { diff --git a/libraries/gpu/src/gpu/GLBackendTexture.cpp b/libraries/gpu/src/gpu/GLBackendTexture.cpp index b8f9ab0bf1..1c41860f49 100755 --- a/libraries/gpu/src/gpu/GLBackendTexture.cpp +++ b/libraries/gpu/src/gpu/GLBackendTexture.cpp @@ -16,8 +16,8 @@ GLBackend::GLTexture::GLTexture() : _storageStamp(0), _contentStamp(0), _texture(0), - _size(0), - _target(GL_TEXTURE_2D) + _target(GL_TEXTURE_2D), + _size(0) {} GLBackend::GLTexture::~GLTexture() { @@ -176,6 +176,8 @@ public: texel.internalFormat = GL_DEPTH_COMPONENT24; break; } + case gpu::NUM_TYPES: + Q_UNREACHABLE(); } break; default: diff --git a/libraries/physics/src/DynamicCharacterController.cpp b/libraries/physics/src/DynamicCharacterController.cpp index 46ff2e524e..3557511fab 100644 --- a/libraries/physics/src/DynamicCharacterController.cpp +++ b/libraries/physics/src/DynamicCharacterController.cpp @@ -8,11 +8,9 @@ const btVector3 LOCAL_UP_AXIS(0.0f, 1.0f, 0.0f); const float DEFAULT_GRAVITY = -5.0f; -const float TERMINAL_VELOCITY = 55.0f; const float JUMP_SPEED = 3.5f; const float MAX_FALL_HEIGHT = 20.0f; -const float MIN_HOVER_HEIGHT = 3.0f; const uint32_t PENDING_FLAG_ADD_TO_SIMULATION = 1U << 0; const uint32_t PENDING_FLAG_REMOVE_FROM_SIMULATION = 1U << 1; diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 4bc69f1bea..fe82af6b3c 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -111,7 +111,7 @@ void Model::RenderPipelineLib::addRenderPipeline(Model::RenderKey key, slotBindings.insert(gpu::Shader::Binding(std::string("emissiveMap"), 3)); gpu::ShaderPointer program = gpu::ShaderPointer(gpu::Shader::createProgram(vertexShader, pixelShader)); - bool makeResult = gpu::Shader::makeProgram(*program, slotBindings); + gpu::Shader::makeProgram(*program, slotBindings); auto locations = std::shared_ptr(new Locations()); @@ -139,7 +139,7 @@ void Model::RenderPipelineLib::addRenderPipeline(Model::RenderKey key, // Good to go add the brand new pipeline auto pipeline = gpu::PipelinePointer(gpu::Pipeline::create(program, state)); - auto it = insert(value_type(key.getRaw(), RenderPipeline(pipeline, locations))); + insert(value_type(key.getRaw(), RenderPipeline(pipeline, locations))); // If not a shadow pass, create the mirror version from the same state, just change the FrontFace if (!key.isShadow()) { From 0afe8c0e3268b0a92f09ebe382d635c7a08b05b2 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Sat, 25 Apr 2015 16:46:05 -0700 Subject: [PATCH 2/2] Coding standards --- libraries/ui/src/HifiMenu.cpp | 10 ++++++++ libraries/ui/src/HifiMenu.h | 8 +++--- libraries/ui/src/MessageDialog.cpp | 9 +++---- libraries/ui/src/MessageDialog.h | 12 +++------ libraries/ui/src/OffscreenQmlDialog.cpp | 6 ++--- libraries/ui/src/OffscreenQmlDialog.h | 2 +- libraries/ui/src/OffscreenUi.cpp | 33 +++++++++++-------------- 7 files changed, 41 insertions(+), 39 deletions(-) diff --git a/libraries/ui/src/HifiMenu.cpp b/libraries/ui/src/HifiMenu.cpp index 27517f99d7..3edcaebead 100644 --- a/libraries/ui/src/HifiMenu.cpp +++ b/libraries/ui/src/HifiMenu.cpp @@ -1,3 +1,13 @@ +// +// HifiMenu.cpp +// +// Created by Bradley Austin Davis on 2015/04/21 +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + #include "HifiMenu.h" #include diff --git a/libraries/ui/src/HifiMenu.h b/libraries/ui/src/HifiMenu.h index c89c91b028..03b3ed9de2 100644 --- a/libraries/ui/src/HifiMenu.h +++ b/libraries/ui/src/HifiMenu.h @@ -1,5 +1,5 @@ // -// MenuConstants.h +// HifiMenu.h // // Created by Bradley Austin Davis on 2015/04/21 // Copyright 2015 High Fidelity, Inc. @@ -9,8 +9,8 @@ // #pragma once -#ifndef hifi_MenuContants_h -#define hifi_MenuConstants_h +#ifndef hifi_HifiMenu_h +#define hifi_HifiMenu_h #include #include @@ -76,7 +76,7 @@ protected: QSignalMapper _toggleMapper; }; -#endif // hifi_MenuConstants_h +#endif // hifi_HifiMenu_h diff --git a/libraries/ui/src/MessageDialog.cpp b/libraries/ui/src/MessageDialog.cpp index 7d226fb774..695f87552a 100644 --- a/libraries/ui/src/MessageDialog.cpp +++ b/libraries/ui/src/MessageDialog.cpp @@ -1,5 +1,4 @@ // -// // MessageDialog.cpp // // Created by Bradley Austin Davis on 2015/04/14 @@ -12,7 +11,7 @@ HIFI_QML_DEF(MessageDialog) -MessageDialog::MessageDialog(QQuickItem *parent) : OffscreenQmlDialog(parent) { +MessageDialog::MessageDialog(QQuickItem* parent) : OffscreenQmlDialog(parent) { _buttons = StandardButtons(Ok | Cancel); } @@ -39,21 +38,21 @@ void MessageDialog::setVisible(bool v) { OffscreenQmlDialog::setVisible(v); } -void MessageDialog::setText(const QString &arg) { +void MessageDialog::setText(const QString& arg) { if (arg != _text) { _text = arg; emit textChanged(); } } -void MessageDialog::setInformativeText(const QString &arg) { +void MessageDialog::setInformativeText(const QString& arg) { if (arg != _informativeText) { _informativeText = arg; emit informativeTextChanged(); } } -void MessageDialog::setDetailedText(const QString &arg) { +void MessageDialog::setDetailedText(const QString& arg) { if (arg != _detailedText) { _detailedText = arg; emit detailedTextChanged(); diff --git a/libraries/ui/src/MessageDialog.h b/libraries/ui/src/MessageDialog.h index a4b04eb2d9..461bca8251 100644 --- a/libraries/ui/src/MessageDialog.h +++ b/libraries/ui/src/MessageDialog.h @@ -47,7 +47,7 @@ public: NRoles }; - MessageDialog(QQuickItem *parent = 0); + MessageDialog(QQuickItem* parent = 0); virtual ~MessageDialog(); QString text() const; @@ -57,9 +57,9 @@ public: public slots: virtual void setVisible(bool v); - void setText(const QString &arg); - void setInformativeText(const QString &arg); - void setDetailedText(const QString &arg); + void setText(const QString& arg); + void setInformativeText(const QString& arg); + void setDetailedText(const QString& arg); void setIcon(Icon icon); void setStandardButtons(StandardButtons buttons); void setResultCallback(OffscreenUi::ButtonCallback callback); @@ -98,7 +98,3 @@ private: }; #endif // hifi_MessageDialog_h - - - - diff --git a/libraries/ui/src/OffscreenQmlDialog.cpp b/libraries/ui/src/OffscreenQmlDialog.cpp index dbd621ad85..eba81f708b 100644 --- a/libraries/ui/src/OffscreenQmlDialog.cpp +++ b/libraries/ui/src/OffscreenQmlDialog.cpp @@ -24,9 +24,9 @@ QString OffscreenQmlDialog::title() const { return _title; } -void OffscreenQmlDialog::setTitle(const QString &arg) { - if (arg != _title) { - _title = arg; +void OffscreenQmlDialog::setTitle(const QString& title) { + if (title != _title) { + _title = title; emit titleChanged(); } } diff --git a/libraries/ui/src/OffscreenQmlDialog.h b/libraries/ui/src/OffscreenQmlDialog.h index 0ff9156f8f..33201c385d 100644 --- a/libraries/ui/src/OffscreenQmlDialog.h +++ b/libraries/ui/src/OffscreenQmlDialog.h @@ -59,7 +59,7 @@ protected: public: QString title() const; - void setTitle(const QString &arg); + void setTitle(const QString& title); signals: void accepted(); diff --git a/libraries/ui/src/OffscreenUi.cpp b/libraries/ui/src/OffscreenUi.cpp index 76a5e71b25..105e81404b 100644 --- a/libraries/ui/src/OffscreenUi.cpp +++ b/libraries/ui/src/OffscreenUi.cpp @@ -140,13 +140,6 @@ QQuickItem* OffscreenUi::getRootItem() { return _rootItem; } -//QQmlContext* OffscreenUi::qmlContext() { -// if (nullptr == _rootItem) { -// return _qmlComponent->creationContext(); -// } -// return QQmlEngine::contextForObject(_rootItem); -//} - void OffscreenUi::setBaseUrl(const QUrl& baseUrl) { _qmlEngine->setBaseUrl(baseUrl); } @@ -188,7 +181,7 @@ QObject* OffscreenUi::finishQmlLoad(std::function return nullptr; } - QQmlContext * newContext = new QQmlContext(_qmlEngine, qApp); + QQmlContext* newContext = new QQmlContext(_qmlEngine, qApp); QObject* newObject = _qmlComponent->beginCreate(newContext); if (_qmlComponent->isError()) { QList errorList = _qmlComponent->errors(); @@ -294,9 +287,9 @@ QPointF OffscreenUi::mapWindowToUi(const QPointF& sourcePosition, QObject* sourc // // However, the problem may go away once we switch to the new menu system, // so I think it's OK for the time being. -bool OffscreenUi::shouldSwallowShortcut(QEvent * event) { +bool OffscreenUi::shouldSwallowShortcut(QEvent* event) { Q_ASSERT(event->type() == QEvent::ShortcutOverride); - QObject * focusObject = _quickWindow->focusObject(); + QObject* focusObject = _quickWindow->focusObject(); if (focusObject != _quickWindow && focusObject != _rootItem) { //qDebug() << "Swallowed shortcut " << static_cast(event)->key(); event->accept(); @@ -319,7 +312,7 @@ bool OffscreenUi::eventFilter(QObject* originalDestination, QEvent* event) { #ifdef DEBUG // Don't intercept our own events, or we enter an infinite recursion - QObject * recurseTest = originalDestination; + QObject* recurseTest = originalDestination; while (recurseTest) { Q_ASSERT(recurseTest != _rootItem && recurseTest != _quickWindow); recurseTest = recurseTest->parent(); @@ -438,13 +431,13 @@ void OffscreenUi::messageBox(const QString& title, const QString& text, ButtonCallback callback, QMessageBox::Icon icon, QMessageBox::StandardButtons buttons) { - MessageDialog * pDialog{ nullptr }; - MessageDialog::show([&](QQmlContext*ctx, QObject*item) { + MessageDialog* pDialog{ nullptr }; + MessageDialog::show([&](QQmlContext* ctx, QObject* item) { pDialog = item->findChild(); pDialog->setIcon((MessageDialog::Icon)icon); pDialog->setTitle(title); pDialog->setText(text); - pDialog->setStandardButtons(MessageDialog::StandardButtons((int)buttons)); + pDialog->setStandardButtons(MessageDialog::StandardButtons(static_cast(buttons))); pDialog->setResultCallback(callback); }); pDialog->setEnabled(true); @@ -453,25 +446,29 @@ void OffscreenUi::messageBox(const QString& title, const QString& text, void OffscreenUi::information(const QString& title, const QString& text, ButtonCallback callback, QMessageBox::StandardButtons buttons) { - messageBox(title, text, callback, (QMessageBox::Icon)MessageDialog::Information, buttons); + messageBox(title, text, callback, + static_cast(MessageDialog::Information), buttons); } void OffscreenUi::question(const QString& title, const QString& text, ButtonCallback callback, QMessageBox::StandardButtons buttons) { - messageBox(title, text, callback, (QMessageBox::Icon)MessageDialog::Question, buttons); + messageBox(title, text, callback, + static_cast(MessageDialog::Question), buttons); } void OffscreenUi::warning(const QString& title, const QString& text, ButtonCallback callback, QMessageBox::StandardButtons buttons) { - messageBox(title, text, callback, (QMessageBox::Icon)MessageDialog::Warning, buttons); + messageBox(title, text, callback, + static_cast(MessageDialog::Warning), buttons); } void OffscreenUi::critical(const QString& title, const QString& text, ButtonCallback callback, QMessageBox::StandardButtons buttons) { - messageBox(title, text, callback, (QMessageBox::Icon)MessageDialog::Critical, buttons); + messageBox(title, text, callback, + static_cast(MessageDialog::Critical), buttons); }