Merge branch 'master' of https://github.com/highfidelity/hifi into entityItemCleanup

This commit is contained in:
ZappoMan 2017-11-20 17:19:18 -08:00
commit b44ced4c21
13 changed files with 47 additions and 84 deletions

View file

@ -55,37 +55,6 @@ Item {
// Style // Style
color: hifi.colors.blueHighlight; color: hifi.colors.blueHighlight;
} }
HifiControlsUit.Button {
id: clearCachedPassphraseButton;
visible: root.showDebugButtons;
color: hifi.buttons.black;
colorScheme: hifi.colorSchemes.dark;
anchors.top: parent.top;
anchors.left: helpTitleText.right;
anchors.leftMargin: 20;
height: 40;
width: 150;
text: "DBG: Clear Pass";
onClicked: {
commerce.setPassphrase("");
sendSignalToWallet({method: 'passphraseReset'});
}
}
HifiControlsUit.Button {
id: resetButton;
visible: root.showDebugButtons;
color: hifi.buttons.red;
colorScheme: hifi.colorSchemes.dark;
anchors.top: clearCachedPassphraseButton.top;
anchors.left: clearCachedPassphraseButton.right;
height: 40;
width: 150;
text: "DBG: RST Wallet";
onClicked: {
commerce.reset();
sendSignalToWallet({method: 'walletReset'});
}
}
ListModel { ListModel {
id: helpModel; id: helpModel;

View file

@ -5503,6 +5503,8 @@ void Application::clearDomainOctreeDetails() {
DependencyManager::get<ModelCache>()->clearUnusedResources(); DependencyManager::get<ModelCache>()->clearUnusedResources();
DependencyManager::get<SoundCache>()->clearUnusedResources(); DependencyManager::get<SoundCache>()->clearUnusedResources();
DependencyManager::get<TextureCache>()->clearUnusedResources(); DependencyManager::get<TextureCache>()->clearUnusedResources();
getMyAvatar()->setAvatarEntityDataChanged(true);
} }
void Application::clearDomainAvatars() { void Application::clearDomainAvatars() {
@ -6331,20 +6333,14 @@ void Application::addAssetToWorldUnzipFailure(QString filePath) {
addAssetToWorldError(filename, "Couldn't unzip file " + filename + "."); addAssetToWorldError(filename, "Couldn't unzip file " + filename + ".");
} }
void Application::addAssetToWorld(QString filePath, QString zipFile, bool isZip, bool isBlocks) { void Application::addAssetToWorld(QString path, QString zipFile, bool isZip, bool isBlocks) {
// Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget(). // Automatically upload and add asset to world as an alternative manual process initiated by showAssetServerWidget().
QString mapping; QString mapping;
QString path = filePath;
QString filename = filenameFromPath(path); QString filename = filenameFromPath(path);
if (isZip) { if (isZip || isBlocks) {
QString assetFolder = zipFile.section("/", -1); QString assetName = zipFile.section("/", -1).remove(QRegExp("[.]zip(.*)$"));
assetFolder.remove(".zip"); QString assetFolder = path.section("model_repo/", -1);
mapping = "/" + assetFolder + "/" + filename; mapping = "/" + assetName + "/" + assetFolder;
} else if (isBlocks) {
qCDebug(interfaceapp) << "Path to asset folder: " << zipFile;
QString assetFolder = zipFile.section('/', -1);
assetFolder.remove(".zip?noDownload=false");
mapping = "/" + assetFolder + "/" + filename;
} else { } else {
mapping = "/" + filename; mapping = "/" + filename;
} }
@ -6730,9 +6726,11 @@ void Application::handleUnzip(QString zipFile, QStringList unzipFile, bool autoA
if (autoAdd) { if (autoAdd) {
if (!unzipFile.isEmpty()) { if (!unzipFile.isEmpty()) {
for (int i = 0; i < unzipFile.length(); i++) { for (int i = 0; i < unzipFile.length(); i++) {
if (QFileInfo(unzipFile.at(i)).isFile()) {
qCDebug(interfaceapp) << "Preparing file for asset server: " << unzipFile.at(i); qCDebug(interfaceapp) << "Preparing file for asset server: " << unzipFile.at(i);
addAssetToWorld(unzipFile.at(i), zipFile, isZip, isBlocks); addAssetToWorld(unzipFile.at(i), zipFile, isZip, isBlocks);
} }
}
} else { } else {
addAssetToWorldUnzipFailure(zipFile); addAssetToWorldUnzipFailure(zipFile);
} }

View file

@ -951,11 +951,7 @@ void MyAvatar::saveData() {
} }
settings.endArray(); settings.endArray();
if (_avatarEntityData.size() == 0) {
// HACK: manually remove empty 'avatarEntityData' else deleted avatarEntityData may show up in settings file
settings.remove("avatarEntityData"); settings.remove("avatarEntityData");
}
settings.beginWriteArray("avatarEntityData"); settings.beginWriteArray("avatarEntityData");
int avatarEntityIndex = 0; int avatarEntityIndex = 0;
auto hmdInterface = DependencyManager::get<HMDScriptingInterface>(); auto hmdInterface = DependencyManager::get<HMDScriptingInterface>();

View file

@ -111,14 +111,23 @@ void Ledger::inventory(const QStringList& keys) {
keysQuery("inventory", "inventorySuccess", "inventoryFailure"); keysQuery("inventory", "inventorySuccess", "inventoryFailure");
} }
QString nameFromKey(const QString& key, const QStringList& publicKeys) { QString amountString(const QString& label, const QString&color, const QJsonValue& moneyValue, const QJsonValue& certsValue) {
if (key.isNull() || key.isEmpty()) { int money = moneyValue.toInt();
return "Marketplace"; int certs = certsValue.toInt();
if (money <= 0 && certs <= 0) {
return QString();
} }
if (publicKeys.contains(key)) { QString result(QString("<font color='#%1'> %2").arg(color, label));
return "You"; if (money > 0) {
result += QString(" %1 HFC").arg(money);
} }
return "Someone"; if (certs > 0) {
if (money > 0) {
result += QString(",");
}
result += QString((certs == 1) ? " %1 certificate" : " %1 certificates").arg(certs);
}
return result + QString("</font>");
} }
static const QString MARKETPLACE_ITEMS_BASE_URL = NetworkingConstants::METAVERSE_SERVER_URL.toString() + "/marketplace/items/"; static const QString MARKETPLACE_ITEMS_BASE_URL = NetworkingConstants::METAVERSE_SERVER_URL.toString() + "/marketplace/items/";
@ -129,6 +138,7 @@ void Ledger::historySuccess(QNetworkReply& reply) {
// public key(s) are. Let's keep it that way // public key(s) are. Let's keep it that way
QByteArray response = reply.readAll(); QByteArray response = reply.readAll();
QJsonObject data = QJsonDocument::fromJson(response).object(); QJsonObject data = QJsonDocument::fromJson(response).object();
qInfo(commerce) << "history" << "response" << QJsonDocument(data).toJson(QJsonDocument::Compact);
// we will need the array of public keys from the wallet // we will need the array of public keys from the wallet
auto wallet = DependencyManager::get<Wallet>(); auto wallet = DependencyManager::get<Wallet>();
@ -141,32 +151,15 @@ void Ledger::historySuccess(QNetworkReply& reply) {
// TODO: do this with 0 copies if possible // TODO: do this with 0 copies if possible
for (auto it = historyArray.begin(); it != historyArray.end(); it++) { for (auto it = historyArray.begin(); it != historyArray.end(); it++) {
auto valueObject = (*it).toObject(); auto valueObject = (*it).toObject();
QString from = nameFromKey(valueObject["sender_key"].toString(), keys); QString sent = amountString("sent", "EA4C5F", valueObject["sent_money"], valueObject["sent_certs"]);
QString to = nameFromKey(valueObject["recipient_key"].toString(), keys); QString received = amountString("received", "1FC6A6", valueObject["received_money"], valueObject["received_certs"]);
bool isHfc = valueObject["asset_title"].toString() == "HFC";
bool iAmReceiving = to == "You";
QString coloredQuantityAndAssetTitle = QString::number(valueObject["quantity"].toInt()) + " " + valueObject["asset_title"].toString();
if (isHfc) {
if (iAmReceiving) {
coloredQuantityAndAssetTitle = QString("<font color='#1FC6A6'>") + coloredQuantityAndAssetTitle + QString("</font>");
} else {
coloredQuantityAndAssetTitle = QString("<font color='#EA4C5F'>") + coloredQuantityAndAssetTitle + QString("</font>");
}
} else {
coloredQuantityAndAssetTitle = QString("\"<font color='#0093C5'><a href='") +
MARKETPLACE_ITEMS_BASE_URL +
valueObject["asset_id"].toString() +
QString("'>") +
coloredQuantityAndAssetTitle +
QString("</a></font>\"");
}
// turns out on my machine, toLocalTime convert to some weird timezone, yet the // turns out on my machine, toLocalTime convert to some weird timezone, yet the
// systemTimeZone is correct. To avoid a strange bug with other's systems too, lets // systemTimeZone is correct. To avoid a strange bug with other's systems too, lets
// be explicit // be explicit
QDateTime createdAt = QDateTime::fromSecsSinceEpoch(valueObject["created_at"].toInt(), Qt::UTC); QDateTime createdAt = QDateTime::fromSecsSinceEpoch(valueObject["created_at"].toInt(), Qt::UTC);
QDateTime localCreatedAt = createdAt.toTimeZone(QTimeZone::systemTimeZone()); QDateTime localCreatedAt = createdAt.toTimeZone(QTimeZone::systemTimeZone());
valueObject["text"] = QString("%1 sent %2 %3 with message \"%4\""). valueObject["text"] = QString("%1%2%3").arg(valueObject["message"].toString(), sent, received);
arg(from, to, coloredQuantityAndAssetTitle, valueObject["message"].toString());
newHistoryArray.push_back(valueObject); newHistoryArray.push_back(valueObject);
} }
// now copy the rest of the json -- this is inefficient // now copy the rest of the json -- this is inefficient

View file

@ -204,7 +204,7 @@ bool ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID&
bool ContextOverlayInterface::contextOverlayFilterPassed(const EntityItemID& entityItemID) { bool ContextOverlayInterface::contextOverlayFilterPassed(const EntityItemID& entityItemID) {
EntityItemProperties entityProperties = _entityScriptingInterface->getEntityProperties(entityItemID, _entityPropertyFlags); EntityItemProperties entityProperties = _entityScriptingInterface->getEntityProperties(entityItemID, _entityPropertyFlags);
Setting::Handle<bool> _settingSwitch{ "commerce", false }; Setting::Handle<bool> _settingSwitch{ "commerce", true };
if (_settingSwitch.get()) { if (_settingSwitch.get()) {
return (entityProperties.getCertificateID().length() != 0); return (entityProperties.getCertificateID().length() != 0);
} else { } else {
@ -234,7 +234,7 @@ bool ContextOverlayInterface::destroyContextOverlay(const EntityItemID& entityIt
void ContextOverlayInterface::contextOverlays_mousePressOnOverlay(const OverlayID& overlayID, const PointerEvent& event) { void ContextOverlayInterface::contextOverlays_mousePressOnOverlay(const OverlayID& overlayID, const PointerEvent& event) {
if (overlayID == _contextOverlayID && event.getButton() == PointerEvent::PrimaryButton) { if (overlayID == _contextOverlayID && event.getButton() == PointerEvent::PrimaryButton) {
qCDebug(context_overlay) << "Clicked Context Overlay. Entity ID:" << _currentEntityWithContextOverlay << "Overlay ID:" << overlayID; qCDebug(context_overlay) << "Clicked Context Overlay. Entity ID:" << _currentEntityWithContextOverlay << "Overlay ID:" << overlayID;
Setting::Handle<bool> _settingSwitch{ "commerce", false }; Setting::Handle<bool> _settingSwitch{ "commerce", true };
if (_settingSwitch.get()) { if (_settingSwitch.get()) {
openInspectionCertificate(); openInspectionCertificate();
} else { } else {

View file

@ -198,6 +198,11 @@ void Avatar::setTargetScale(float targetScale) {
} }
} }
void Avatar::setAvatarEntityDataChanged(bool value) {
AvatarData::setAvatarEntityDataChanged(value);
_avatarEntityDataHashes.clear();
}
void Avatar::updateAvatarEntities() { void Avatar::updateAvatarEntities() {
PerformanceTimer perfTimer("attachments"); PerformanceTimer perfTimer("attachments");
// - if queueEditEntityMessage sees clientOnly flag it does _myAvatar->updateAvatarEntity() // - if queueEditEntityMessage sees clientOnly flag it does _myAvatar->updateAvatarEntity()

View file

@ -265,6 +265,8 @@ public:
virtual float getModelScale() const { return _modelScale; } virtual float getModelScale() const { return _modelScale; }
virtual void setModelScale(float scale) { _modelScale = scale; } virtual void setModelScale(float scale) { _modelScale = scale; }
virtual void setAvatarEntityDataChanged(bool value) override;
public slots: public slots:
// FIXME - these should be migrated to use Pose data instead // FIXME - these should be migrated to use Pose data instead

View file

@ -603,7 +603,7 @@ public:
Q_INVOKABLE AvatarEntityMap getAvatarEntityData() const; Q_INVOKABLE AvatarEntityMap getAvatarEntityData() const;
Q_INVOKABLE void setAvatarEntityData(const AvatarEntityMap& avatarEntityData); Q_INVOKABLE void setAvatarEntityData(const AvatarEntityMap& avatarEntityData);
void setAvatarEntityDataChanged(bool value) { _avatarEntityDataChanged = value; } virtual void setAvatarEntityDataChanged(bool value) { _avatarEntityDataChanged = value; }
void insertDetachedEntityID(const QUuid entityID); void insertDetachedEntityID(const QUuid entityID);
AvatarEntityIDs getAndClearRecentlyDetachedIDs(); AvatarEntityIDs getAndClearRecentlyDetachedIDs();

View file

@ -55,7 +55,7 @@ void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool
QStringList fileList = unzipFile(path, tempDir); QStringList fileList = unzipFile(path, tempDir);
if (!fileList.isEmpty()) { if (!fileList.isEmpty()) {
qCDebug(scriptengine) << "File to upload: " + fileList.first(); qCDebug(scriptengine) << "First file to upload: " + fileList.first();
} else { } else {
qCDebug(scriptengine) << "Unzip failed"; qCDebug(scriptengine) << "Unzip failed";
} }

View file

@ -62,7 +62,7 @@ void RequestFilters::interceptHFWebEngineRequest(QWebEngineUrlRequestInfo& info)
// During the period in which we have HFC commerce in the system, but not applied everywhere: // During the period in which we have HFC commerce in the system, but not applied everywhere:
const QString tokenStringCommerce{ "Chrome/48.0 (HighFidelityInterface WithHFC)" }; const QString tokenStringCommerce{ "Chrome/48.0 (HighFidelityInterface WithHFC)" };
Setting::Handle<bool> _settingSwitch{ "commerce", false }; Setting::Handle<bool> _settingSwitch{ "commerce", true };
bool isMoney = _settingSwitch.get(); bool isMoney = _settingSwitch.get();
const QString tokenString = !isAuthable ? tokenStringMobile : (isMoney ? tokenStringCommerce : tokenStringMetaverse); const QString tokenString = !isAuthable ? tokenStringMobile : (isMoney ? tokenStringCommerce : tokenStringMetaverse);

View file

@ -145,7 +145,7 @@
var button; var button;
var buttonName = "WALLET"; var buttonName = "WALLET";
var tablet = null; var tablet = null;
var walletEnabled = Settings.getValue("commerce", false); var walletEnabled = Settings.getValue("commerce", true);
function startup() { function startup() {
if (walletEnabled) { if (walletEnabled) {
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");

View file

@ -160,7 +160,7 @@
type: "marketplaces", type: "marketplaces",
action: "commerceSetting", action: "commerceSetting",
data: { data: {
commerceMode: Settings.getValue("commerce", false), commerceMode: Settings.getValue("commerce", true),
userIsLoggedIn: Account.loggedIn, userIsLoggedIn: Account.loggedIn,
walletNeedsSetup: Wallet.walletStatus === 1, walletNeedsSetup: Wallet.walletStatus === 1,
metaverseServerURL: Account.metaverseServerURL metaverseServerURL: Account.metaverseServerURL

View file

@ -14,7 +14,7 @@
(function () { (function () {
var APP_NAME = "BLOCKS"; var APP_NAME = "BLOCKS";
var APP_URL = "https://vr.google.com/objects/"; var APP_URL = "https://poly.google.com/";
var APP_OUTDATED_URL = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/updateToBlocks.html"; var APP_OUTDATED_URL = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/updateToBlocks.html";
var APP_ICON = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/blocks-i.svg"; var APP_ICON = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/blocks-i.svg";
var APP_ICON_ACTIVE = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/blocks-a.svg"; var APP_ICON_ACTIVE = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/blocks-a.svg";