remove qtimespan that isn't used anymore

This commit is contained in:
Stephen Birarda 2015-07-09 12:45:32 -07:00
parent dd30813ae0
commit 14b73ae00f
3 changed files with 24 additions and 2616 deletions

View file

@ -42,7 +42,7 @@ Agent::Agent(const QByteArray& packet) :
{
// be the parent of the script engine so it gets moved when we do
_scriptEngine.setParent(this);
DependencyManager::get<EntityScriptingInterface>()->setPacketSender(&_entityEditSender);
DependencyManager::set<ResourceCacheSharedItems>();
@ -53,16 +53,16 @@ void Agent::readPendingDatagrams() {
QByteArray receivedPacket;
HifiSockAddr senderSockAddr;
auto nodeList = DependencyManager::get<NodeList>();
while (readAvailableDatagram(receivedPacket, senderSockAddr)) {
if (nodeList->packetVersionAndHashMatch(receivedPacket)) {
PacketType::Value datagramPacketType = packetTypeForPacket(receivedPacket);
if (datagramPacketType == PacketType::Jurisdiction) {
int headerBytes = numBytesForPacketHeader(receivedPacket);
SharedNodePointer matchedNode = nodeList->sendingNodeForPacket(receivedPacket);
if (matchedNode) {
// PacketType_JURISDICTION, first byte is the node type...
switch (receivedPacket[headerBytes]) {
@ -72,7 +72,7 @@ void Agent::readPendingDatagrams() {
break;
}
}
} else if (datagramPacketType == PacketType::OctreeStats
|| datagramPacketType == PacketType::EntityData
|| datagramPacketType == PacketType::EntityErase
@ -89,7 +89,7 @@ void Agent::readPendingDatagrams() {
int statsMessageLength = OctreeHeadlessViewer::parseOctreeStats(mutablePacket, sourceNode);
if (messageLength > statsMessageLength) {
mutablePacket = mutablePacket.mid(statsMessageLength);
// TODO: this needs to be fixed, the goal is to test the packet version for the piggyback, but
// this is testing the version and hash of the original packet
// need to use numBytesArithmeticCodingFromBuffer()...
@ -106,7 +106,7 @@ void Agent::readPendingDatagrams() {
if (datagramPacketType == PacketType::EntityData || datagramPacketType == PacketType::EntityErase) {
_entityViewer.processDatagram(mutablePacket, sourceNode);
}
} else if (datagramPacketType == PacketType::MixedAudio || datagramPacketType == PacketType::SilentAudioFrame) {
_receivedAudioStream.parseData(receivedPacket);
@ -114,7 +114,7 @@ void Agent::readPendingDatagrams() {
_lastReceivedAudioLoudness = _receivedAudioStream.getNextOutputFrameLoudness();
_receivedAudioStream.clearBuffer();
// let this continue through to the NodeList so it updates last heard timestamp
// for the sending audio mixer
DependencyManager::get<NodeList>()->processNodeData(senderSockAddr, receivedPacket);
@ -124,7 +124,7 @@ void Agent::readPendingDatagrams() {
|| datagramPacketType == PacketType::KillAvatar) {
// let the avatar hash map process it
DependencyManager::get<AvatarHashMap>()->processAvatarMixerDatagram(receivedPacket, nodeList->sendingNodeForPacket(receivedPacket));
// let this continue through to the NodeList so it updates last heard timestamp
// for the sending avatar-mixer
DependencyManager::get<NodeList>()->processNodeData(senderSockAddr, receivedPacket);
@ -139,14 +139,14 @@ const QString AGENT_LOGGING_NAME = "agent";
void Agent::run() {
ThreadedAssignment::commonInit(AGENT_LOGGING_NAME, NodeType::Agent);
auto nodeList = DependencyManager::get<NodeList>();
nodeList->addSetOfNodeTypesToNodeInterestSet(NodeSet()
<< NodeType::AudioMixer
<< NodeType::AvatarMixer
<< NodeType::EntityServer
);
// figure out the URL for the script for this agent assignment
QUrl scriptURL;
if (_payload.isEmpty()) {
@ -157,29 +157,29 @@ void Agent::run() {
} else {
scriptURL = QUrl(_payload);
}
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
QNetworkRequest networkRequest = QNetworkRequest(scriptURL);
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
QNetworkReply* reply = networkAccessManager.get(networkRequest);
QNetworkDiskCache* cache = new QNetworkDiskCache();
QString cachePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
cache->setCacheDirectory(!cachePath.isEmpty() ? cachePath : "agentCache");
networkAccessManager.setCache(cache);
qDebug() << "Downloading script at" << scriptURL.toString();
QEventLoop loop;
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
loop.exec();
QString scriptContents(reply->readAll());
delete reply;
qDebug() << "Downloaded script:" << scriptContents;
// setup an Avatar for the script to use
ScriptableAvatar scriptedAvatar(&_scriptEngine);
scriptedAvatar.setForceFaceTrackerConnected(true);
@ -187,16 +187,16 @@ void Agent::run() {
// call model URL setters with empty URLs so our avatar, if user, will have the default models
scriptedAvatar.setFaceModelURL(QUrl());
scriptedAvatar.setSkeletonModelURL(QUrl());
// give this AvatarData object to the script engine
_scriptEngine.setAvatarData(&scriptedAvatar, "Avatar");
_scriptEngine.setAvatarHashMap(DependencyManager::get<AvatarHashMap>().data(), "AvatarList");
// register ourselves to the script engine
_scriptEngine.registerGlobalObject("Agent", this);
_scriptEngine.init(); // must be done before we set up the viewers
_scriptEngine.registerGlobalObject("SoundCache", DependencyManager::get<SoundCache>().data());
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
@ -213,7 +213,7 @@ void Agent::run() {
void Agent::aboutToFinish() {
_scriptEngine.stop();
// our entity tree is going to go away so tell that to the EntityScriptingInterface
DependencyManager::get<EntityScriptingInterface>()->setEntityTree(NULL);
}

File diff suppressed because it is too large Load diff

View file

@ -1,301 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QTIMESPAN_H
#define QTIMESPAN_H
#include <QtCore/qdatetime.h>
#include <QtCore/qstring.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qsharedpointer.h>
#include <QtCore/qmetatype.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Core)
//Move this to qnamespace.h when integrating
namespace Qt
{
enum TimeSpanUnit {
Milliseconds = 0x0001,
Seconds = 0x0002,
Minutes = 0x0004,
Hours = 0x0008,
Days = 0x0010,
Weeks = 0x0020,
Months = 0x0040,
Years = 0x0080,
DaysAndTime = Days | Hours | Minutes | Seconds,
AllUnits = Milliseconds | DaysAndTime | Months | Years,
NoUnit = 0
};
Q_DECLARE_FLAGS(TimeSpanFormat, TimeSpanUnit)
}
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TimeSpanFormat)
//end of section to move
class QTimeSpanPrivate;
class QTimeSpan
{
public:
QTimeSpan();
explicit QTimeSpan(qint64 msecs);
explicit QTimeSpan(const QDateTime& reference, qint64 msecs = 0);
explicit QTimeSpan(const QDate& reference, quint64 msecs = 0);
explicit QTimeSpan(const QTime& reference, quint64 msecs = 0);
explicit QTimeSpan(const QDateTime& reference, const QTimeSpan& other);
explicit QTimeSpan(const QDate& reference, const QTimeSpan& other);
explicit QTimeSpan(const QTime& reference, const QTimeSpan& other);
QTimeSpan(const QTimeSpan& other);
~QTimeSpan();
// constant time units
static const QTimeSpan Second;
static const QTimeSpan Minute;
static const QTimeSpan Hour;
static const QTimeSpan Day;
static const QTimeSpan Week;
// status/validity of the time span
bool isEmpty() const;
bool isNull() const;
// This set of functions operates on a single component of the time span.
inline int msecsPart(Qt::TimeSpanFormat format = Qt::DaysAndTime | Qt::Milliseconds) const {return part(Qt::Milliseconds, format);}
inline int secsPart(Qt::TimeSpanFormat format = Qt::DaysAndTime) const {return part(Qt::Seconds, format);}
inline int minutesPart(Qt::TimeSpanFormat format = Qt::DaysAndTime) const {return part(Qt::Minutes, format);}
inline int hoursPart(Qt::TimeSpanFormat format = Qt::DaysAndTime) const {return part(Qt::Hours, format);}
inline int daysPart(Qt::TimeSpanFormat format = Qt::DaysAndTime) const {return part(Qt::Days, format);}
inline int weeksPart(Qt::TimeSpanFormat format = Qt::DaysAndTime) const {return part(Qt::Weeks, format);}
//int monthsPart(Qt::TimeSpanFormat format) const;
//int yearsPart(Qt::TimeSpanFormat format) const;
int part(Qt::TimeSpanUnit unit, Qt::TimeSpanFormat format = Qt::DaysAndTime) const;
bool parts(int *msecondsPtr,
int *secondsPtr = 0,
int *minutesPtr = 0,
int *hoursPtr = 0,
int *daysPtr = 0,
int *weeksPtr = 0,
int *monthsPtr = 0,
int *yearsPtr = 0,
qreal *fractionalSmallestUnit = 0) const;
Qt::TimeSpanUnit magnitude();
inline void setMSecsPart(int msecs, Qt::TimeSpanFormat format = Qt::DaysAndTime) {setPart(Qt::Milliseconds, msecs, format);}
inline void setSecsPart(int seconds, Qt::TimeSpanFormat format = Qt::DaysAndTime) {setPart(Qt::Seconds, seconds, format);}
inline void setMinutesPart(int minutes, Qt::TimeSpanFormat format = Qt::DaysAndTime) {setPart(Qt::Minutes, minutes, format);}
inline void setHoursPart(int hours, Qt::TimeSpanFormat format = Qt::DaysAndTime) {setPart(Qt::Hours, hours, format);}
inline void setDaysPart(int days, Qt::TimeSpanFormat format = Qt::DaysAndTime) {setPart(Qt::Days, days, format);}
inline void setWeeksPart(int weeks, Qt::TimeSpanFormat format = Qt::DaysAndTime) {setPart(Qt::Weeks, weeks, format);}
inline void setMonthsPart(int months, Qt::TimeSpanFormat format = Qt::DaysAndTime) {setPart(Qt::Months, months, format);}
inline void setYearsPart(int years, Qt::TimeSpanFormat format = Qt::DaysAndTime) {setPart(Qt::Years, years, format);}
void setPart(Qt::TimeSpanUnit unit, int interval, Qt::TimeSpanFormat format = Qt::DaysAndTime);
// This set of functions operator on the entire timespan and not
// just a single component of it.
qint64 toMSecs() const;
inline qreal toSecs() const {return toTimeUnit(Qt::Seconds);}
inline qreal toMinutes() const {return toTimeUnit(Qt::Minutes);}
inline qreal toHours() const {return toTimeUnit(Qt::Hours);}
inline qreal toDays() const {return toTimeUnit(Qt::Days);}
inline qreal toWeeks() const {return toTimeUnit(Qt::Weeks);}
inline qreal toMonths() const {return toTimeUnit(Qt::Seconds);}
inline qreal toYears() const {return toTimeUnit(Qt::Seconds);}
qreal toTimeUnit(Qt::TimeSpanUnit unit) const;
void setFromMSecs(qint64 msecs);
inline void setFromSecs(qreal secs) {setFromTimeUnit(Qt::Seconds, secs);}
inline void setFromMinutes(qreal minutes) {setFromTimeUnit(Qt::Minutes, minutes);}
inline void setFromHours(qreal hours) {setFromTimeUnit(Qt::Hours, hours);}
inline void setFromDays(qreal days) {setFromTimeUnit(Qt::Days, days);}
inline void setFromWeeks(qreal weeks) {setFromTimeUnit(Qt::Weeks, weeks);}
void setFromMonths(qreal months);
void setFromYears(qreal years);
void setFromTimeUnit(Qt::TimeSpanUnit unit, qreal interval);
// Reference date
bool hasValidReference() const;
QDateTime referenceDate() const;
void setReferenceDate(const QDateTime &referenceDate);
void moveReferenceDate(const QDateTime &referenceDate);
void setReferencedDate(const QDateTime &referencedDate);
void moveReferencedDate(const QDateTime &referencedDate);
// Referenced date - referenceDate() + *this
QDateTime referencedDate() const;
// Pretty printing
#ifndef QT_NO_DATESTRING
QString toString(const QString &format) const;
QString toApproximateString(int suppresSecondUnitLimit = 3,
Qt::TimeSpanFormat format = Qt::Seconds | Qt::Minutes | Qt::Hours | Qt::Days | Qt::Weeks);
#endif
// Assignment operator
QTimeSpan &operator=(const QTimeSpan& other);
// Comparison operators
bool operator==(const QTimeSpan &other) const;
inline bool operator!=(const QTimeSpan &other) const {return !(operator==(other));}
bool operator<(const QTimeSpan &other) const;
bool operator<=(const QTimeSpan &other) const;
inline bool operator>(const QTimeSpan &other) const {return !(operator<=(other));}
inline bool operator>=(const QTimeSpan &other) const {return !(operator<(other));}
bool matchesLength(const QTimeSpan &other, bool normalize = false) const;
// Arithmetic operators. Operators that don't change *this are declared as non-members.
QTimeSpan &operator+=(const QTimeSpan &other);
QTimeSpan &operator+=(qint64 msecs);
QTimeSpan &operator-=(const QTimeSpan &other);
QTimeSpan &operator-=(qint64 msecs);
QTimeSpan &operator*=(qreal factor);
QTimeSpan &operator*=(int factor);
QTimeSpan &operator/=(qreal factor);
QTimeSpan &operator/=(int factor);
QTimeSpan &operator|=(const QTimeSpan &other); // Union
QTimeSpan &operator&=(const QTimeSpan &other); // Intersection
// Ensure the reference date is before the referenced date
QTimeSpan normalized() const;
void normalize();
QTimeSpan abs() const;
bool isNegative() const;
bool isNormal() const {return !isNegative();}
// Naturally ordered dates
QDateTime startDate() const;
QDateTime endDate() const;
// Containment
bool contains(const QDateTime &dateTime) const;
bool contains(const QDate &date) const;
bool contains(const QTime &time) const;
bool contains(const QTimeSpan &other) const;
bool overlaps(const QTimeSpan &other) const;
QTimeSpan overlapped(const QTimeSpan &other) const;
QTimeSpan united(const QTimeSpan &other) const;
// Static construction methods
#ifndef QT_NO_DATESTRING
static QTimeSpan fromString(const QString &string, const QString &format, const QDateTime& reference = QDateTime());
static QTimeSpan fromString(const QString &string, const QRegExp &pattern, const QDateTime& reference,
Qt::TimeSpanUnit unit1,
Qt::TimeSpanUnit unit2 = Qt::NoUnit, Qt::TimeSpanUnit unit3 = Qt::NoUnit,
Qt::TimeSpanUnit unit4 = Qt::NoUnit, Qt::TimeSpanUnit unit5 = Qt::NoUnit,
Qt::TimeSpanUnit unit6 = Qt::NoUnit, Qt::TimeSpanUnit unit7 = Qt::NoUnit,
Qt::TimeSpanUnit unit8 = Qt::NoUnit);
#endif
//static QTimeSpan fromString(const QString &string, Qt::TimeSpanFormat format);
static QTimeSpan fromTimeUnit(Qt::TimeSpanUnit unit, qreal interval, const QDateTime& reference = QDateTime());
/*
static QTimeSpan fromMSecs(qint64 msecs);
static QTimeSpan fromSecs(qreal secs) {return QTimeSpan::Second * secs;}
static QTimeSpan fromMinutes(qreal minutes) {return QTimeSpan::Minute * minutes;}
static QTimeSpan fromHours(qreal hours) {return QTimeSpan::Hour * hours;}
static QTimeSpan fromDays(qreal days) {return QTimeSpan::Day * days;}
static QTimeSpan fromWeeks(qreal weeks) {return QTimeSpan::Week * weeks;}
*/
private:
#ifndef QT_NO_DATASTREAM
friend QDataStream &operator<<(QDataStream &, const QTimeSpan &);
friend QDataStream &operator>>(QDataStream &, QTimeSpan &);
#endif
QSharedDataPointer<QTimeSpanPrivate> d;
};
Q_DECLARE_TYPEINFO(QTimeSpan, Q_MOVABLE_TYPE);
Q_DECLARE_METATYPE(QTimeSpan);
Q_DECLARE_METATYPE(Qt::TimeSpanUnit);
//non-member operators
QTimeSpan operator+(const QTimeSpan &left, const QTimeSpan &right);
QTimeSpan operator-(const QTimeSpan &left, const QTimeSpan &right);
QTimeSpan operator*(const QTimeSpan &left, qreal right);//no problem
QTimeSpan operator*(const QTimeSpan &left, int right);//no problem
inline QTimeSpan operator*(qreal left, const QTimeSpan &right) {return right * left;} // works
inline QTimeSpan operator*(int left, const QTimeSpan &right) {return right * left;} // works
//QTimeSpan operator*(qreal left, const QTimeSpan &right) {return right * left;} //does not work
//QTimeSpan operator*(int left, const QTimeSpan &right) {return right * left;} //does not work
QTimeSpan operator/(const QTimeSpan &left, qreal right);
QTimeSpan operator/(const QTimeSpan &left, int right);
qreal operator/(const QTimeSpan &left, const QTimeSpan &right);
QTimeSpan operator-(const QTimeSpan &right); // Unary negation
QTimeSpan operator|(const QTimeSpan &left, const QTimeSpan &right); // Union
QTimeSpan operator&(const QTimeSpan &left, const QTimeSpan &right); // Intersection
// Operators that use QTimeSpan and other date/time classes
QTimeSpan operator-(const QDateTime &left, const QDateTime &right);
QTimeSpan operator-(const QDate &left, const QDate &right);
QTimeSpan operator-(const QTime &left, const QTime &right);
QDate operator+(const QDate &left, const QTimeSpan &right);
QDate operator-(const QDate &left, const QTimeSpan &right);
QTime operator+(const QTime &left, const QTimeSpan &right);
QTime operator-(const QTime &left, const QTimeSpan &right);
QDateTime operator+(const QDateTime &left, const QTimeSpan &right);
QDateTime operator-(const QDateTime &left, const QTimeSpan &right);
#ifndef QT_NO_DATASTREAM
QDataStream &operator<<(QDataStream &, const QTimeSpan &);
QDataStream &operator>>(QDataStream &, QTimeSpan &);
#endif // QT_NO_DATASTREAM
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DATESTRING)
QDebug operator<<(QDebug, const QTimeSpan &);
#endif
QT_END_NAMESPACE
QT_END_HEADER
#endif // QTIMESPAN_H