From 38f23ef79eb3d5ed6987032588594ecfa264de3e Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 24 Sep 2015 21:01:34 +0200 Subject: [PATCH] Remove Application friend --- interface/src/Application.h | 12 ++++++------ interface/src/PluginContainerProxy.cpp | 2 +- interface/src/octree/OctreePacketProcessor.cpp | 9 ++++----- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/interface/src/Application.h b/interface/src/Application.h index 71a678c6a2..21a4a4429a 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -100,11 +100,13 @@ class Application; class Application : public QApplication, public AbstractViewStateInterface, public AbstractScriptingServicesInterface { Q_OBJECT - + + // TODO? Get rid of those friend class OctreePacketProcessor; - friend class DatagramProcessor; + friend class PluginContainerProxy; public: + // FIXME? Empty methods, do we still need them? static void initPlugins(); static void shutdownPlugins(); @@ -205,6 +207,8 @@ public: const ApplicationCompositor& getApplicationCompositor() const { return _compositor; } Overlays& getOverlays() { return _overlays; } + bool isForeground() const { return _isForeground; } + float getFps() const { return _fps; } float getFieldOfView() { return _fieldOfView.get(); } @@ -239,8 +243,6 @@ public: DisplayPlugin* getActiveDisplayPlugin(); const DisplayPlugin* getActiveDisplayPlugin() const; -public: - FileLogger* getLogger() { return _logger; } glm::vec2 getViewportDimensions() const; @@ -608,8 +610,6 @@ private: quint64 _lastSimsPerSecondUpdate = 0; bool _isForeground = true; // starts out assumed to be in foreground bool _inPaint = false; - - friend class PluginContainerProxy; }; #endif // hifi_Application_h diff --git a/interface/src/PluginContainerProxy.cpp b/interface/src/PluginContainerProxy.cpp index 3310d9e4cd..4126b7b9bd 100644 --- a/interface/src/PluginContainerProxy.cpp +++ b/interface/src/PluginContainerProxy.cpp @@ -17,7 +17,7 @@ PluginContainerProxy::PluginContainerProxy() { } bool PluginContainerProxy::isForeground() { - return qApp->_isForeground && !qApp->getWindow()->isMinimized(); + return qApp->isForeground() && !qApp->getWindow()->isMinimized(); } void PluginContainerProxy::addMenu(const QString& menuName) { diff --git a/interface/src/octree/OctreePacketProcessor.cpp b/interface/src/octree/OctreePacketProcessor.cpp index 8dfee8f73b..2fa0267dc6 100644 --- a/interface/src/octree/OctreePacketProcessor.cpp +++ b/interface/src/octree/OctreePacketProcessor.cpp @@ -37,7 +37,6 @@ void OctreePacketProcessor::processPacket(QSharedPointer packet, Share qDebug("OctreePacketProcessor::processPacket() packets to process=%d", packetsToProcessCount()); } - Application* app = qApp; bool wasStatsPacket = false; PacketType octreePacketType = packet->getType(); @@ -46,7 +45,7 @@ void OctreePacketProcessor::processPacket(QSharedPointer packet, Share // immediately following them inside the same packet. So, we process the PacketType_OCTREE_STATS first // then process any remaining bytes as if it was another packet if (octreePacketType == PacketType::OctreeStats) { - int statsMessageLength = app->processOctreeStats(*packet, sendingNode); + int statsMessageLength = qApp->processOctreeStats(*packet, sendingNode); wasStatsPacket = true; int piggybackBytes = packet->getPayloadSize() - statsMessageLength; @@ -84,7 +83,7 @@ void OctreePacketProcessor::processPacket(QSharedPointer packet, Share return; // bail since piggyback version doesn't match } - app->trackIncomingOctreePacket(*packet, sendingNode, wasStatsPacket); + qApp->trackIncomingOctreePacket(*packet, sendingNode, wasStatsPacket); // seek back to beginning of packet after tracking packet->seek(0); @@ -92,13 +91,13 @@ void OctreePacketProcessor::processPacket(QSharedPointer packet, Share switch(packetType) { case PacketType::EntityErase: { if (DependencyManager::get()->shouldRenderEntities()) { - app->_entities.processEraseMessage(*packet, sendingNode); + qApp->getEntities()->processEraseMessage(*packet, sendingNode); } } break; case PacketType::EntityData: { if (DependencyManager::get()->shouldRenderEntities()) { - app->_entities.processDatagram(*packet, sendingNode); + qApp->getEntities()->processDatagram(*packet, sendingNode); } } break;