Move BakingStatus

This commit is contained in:
Atlante45 2017-08-10 18:00:16 -07:00
parent fac6015bb0
commit fd3156b57c
6 changed files with 54 additions and 8 deletions

View file

@ -489,6 +489,7 @@ void AssetServer::handleGetAllMappingOperation(ReceivedMessage& message, SharedN
for (auto it = _fileMappings.cbegin(); it != _fileMappings.cend(); ++ it) {
replyPacket.writeString(it.key());
replyPacket.write(QByteArray::fromHex(it.value().toString().toUtf8()));
replyPacket.writePrimitive(_baker.getAssetStatus(it.value().toString()));
}
}

View file

@ -18,18 +18,11 @@
class AutoBaker {
public:
enum Status {
NotBaked,
Pending,
Baking,
Baked
};
void addPendingBake(AssetHash hash);
bool assetNeedsBaking(AssetHash hash);
Status getAssetStatus(AssetHash hash);
BakingStatus getAssetStatus(AssetHash hash);
private:
std::vector<AssetHash> _pendingBakes;

View file

@ -84,3 +84,16 @@ bool isValidHash(const AssetHash& hash) {
QRegExp hashRegex { ASSET_HASH_REGEX_STRING };
return hashRegex.exactMatch(hash);
}
QString bakingStatusToString(BakingStatus status) {
switch (status) {
case NotBaked:
return "Not Baked";
case Pending:
return "Pending";
case Baking:
return "Baking";
case Baked:
return "Baked";
}
}

View file

@ -52,6 +52,13 @@ enum AssetMappingOperationType : uint8_t {
Rename
};
enum BakingStatus {
NotBaked,
Pending,
Baking,
Baked
};
QUrl getATPUrl(const QString& hash);
QByteArray hashData(const QByteArray& data);
@ -63,4 +70,6 @@ bool isValidFilePath(const AssetPath& path);
bool isValidPath(const AssetPath& path);
bool isValidHash(const QString& hashString);
QString bakingStatusToString(BakingStatus status);
#endif // hifi_AssetUtils_h

View file

@ -136,6 +136,8 @@ void GetAllMappingsRequest::doStart() {
for (auto i = 0; i < numberOfMappings; ++i) {
auto path = message->readString();
auto hash = message->read(SHA256_HASH_LENGTH).toHex();
BakingStatus status;
message->readPrimitive(&status);
_mappings[path] = hash;
}
}

View file

@ -0,0 +1,28 @@
//
// Algorithms.h
// libraries/shared/src/shared
//
// Created by Clement Brisset on 8/9/17
// Copyright 2017 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
//
#ifndef Algorithms_h
#define Algorithms_h
#include <algorithm>
namespace alg {
}
#endif /* Algorithms_hpp */