Remove Application friend

This commit is contained in:
Atlante45 2015-09-24 21:01:34 +02:00
parent 311edabe51
commit 38f23ef79e
3 changed files with 11 additions and 12 deletions

View file

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

View file

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

View file

@ -37,7 +37,6 @@ void OctreePacketProcessor::processPacket(QSharedPointer<NLPacket> 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<NLPacket> 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<NLPacket> 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<NLPacket> packet, Share
switch(packetType) {
case PacketType::EntityErase: {
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) {
app->_entities.processEraseMessage(*packet, sendingNode);
qApp->getEntities()->processEraseMessage(*packet, sendingNode);
}
} break;
case PacketType::EntityData: {
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderEntities()) {
app->_entities.processDatagram(*packet, sendingNode);
qApp->getEntities()->processDatagram(*packet, sendingNode);
}
} break;