mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 23:33:34 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into entityItemCleanup
This commit is contained in:
commit
b44ced4c21
13 changed files with 47 additions and 84 deletions
interface
resources/qml/hifi/commerce/wallet
src
libraries
avatars-renderer/src/avatars-renderer
avatars/src
script-engine/src
ui/src/ui/types
scripts/system
unpublishedScripts/marketplace/blocks
|
@ -55,37 +55,6 @@ Item {
|
|||
// Style
|
||||
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 {
|
||||
id: helpModel;
|
||||
|
|
|
@ -5503,6 +5503,8 @@ void Application::clearDomainOctreeDetails() {
|
|||
DependencyManager::get<ModelCache>()->clearUnusedResources();
|
||||
DependencyManager::get<SoundCache>()->clearUnusedResources();
|
||||
DependencyManager::get<TextureCache>()->clearUnusedResources();
|
||||
|
||||
getMyAvatar()->setAvatarEntityDataChanged(true);
|
||||
}
|
||||
|
||||
void Application::clearDomainAvatars() {
|
||||
|
@ -6331,20 +6333,14 @@ void Application::addAssetToWorldUnzipFailure(QString filePath) {
|
|||
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().
|
||||
QString mapping;
|
||||
QString path = filePath;
|
||||
QString filename = filenameFromPath(path);
|
||||
if (isZip) {
|
||||
QString assetFolder = zipFile.section("/", -1);
|
||||
assetFolder.remove(".zip");
|
||||
mapping = "/" + assetFolder + "/" + filename;
|
||||
} else if (isBlocks) {
|
||||
qCDebug(interfaceapp) << "Path to asset folder: " << zipFile;
|
||||
QString assetFolder = zipFile.section('/', -1);
|
||||
assetFolder.remove(".zip?noDownload=false");
|
||||
mapping = "/" + assetFolder + "/" + filename;
|
||||
if (isZip || isBlocks) {
|
||||
QString assetName = zipFile.section("/", -1).remove(QRegExp("[.]zip(.*)$"));
|
||||
QString assetFolder = path.section("model_repo/", -1);
|
||||
mapping = "/" + assetName + "/" + assetFolder;
|
||||
} else {
|
||||
mapping = "/" + filename;
|
||||
}
|
||||
|
@ -6730,8 +6726,10 @@ void Application::handleUnzip(QString zipFile, QStringList unzipFile, bool autoA
|
|||
if (autoAdd) {
|
||||
if (!unzipFile.isEmpty()) {
|
||||
for (int i = 0; i < unzipFile.length(); i++) {
|
||||
qCDebug(interfaceapp) << "Preparing file for asset server: " << unzipFile.at(i);
|
||||
addAssetToWorld(unzipFile.at(i), zipFile, isZip, isBlocks);
|
||||
if (QFileInfo(unzipFile.at(i)).isFile()) {
|
||||
qCDebug(interfaceapp) << "Preparing file for asset server: " << unzipFile.at(i);
|
||||
addAssetToWorld(unzipFile.at(i), zipFile, isZip, isBlocks);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
addAssetToWorldUnzipFailure(zipFile);
|
||||
|
|
|
@ -951,11 +951,7 @@ void MyAvatar::saveData() {
|
|||
}
|
||||
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");
|
||||
int avatarEntityIndex = 0;
|
||||
auto hmdInterface = DependencyManager::get<HMDScriptingInterface>();
|
||||
|
|
|
@ -111,14 +111,23 @@ void Ledger::inventory(const QStringList& keys) {
|
|||
keysQuery("inventory", "inventorySuccess", "inventoryFailure");
|
||||
}
|
||||
|
||||
QString nameFromKey(const QString& key, const QStringList& publicKeys) {
|
||||
if (key.isNull() || key.isEmpty()) {
|
||||
return "Marketplace";
|
||||
QString amountString(const QString& label, const QString&color, const QJsonValue& moneyValue, const QJsonValue& certsValue) {
|
||||
int money = moneyValue.toInt();
|
||||
int certs = certsValue.toInt();
|
||||
if (money <= 0 && certs <= 0) {
|
||||
return QString();
|
||||
}
|
||||
if (publicKeys.contains(key)) {
|
||||
return "You";
|
||||
QString result(QString("<font color='#%1'> %2").arg(color, label));
|
||||
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/";
|
||||
|
@ -129,6 +138,7 @@ void Ledger::historySuccess(QNetworkReply& reply) {
|
|||
// public key(s) are. Let's keep it that way
|
||||
QByteArray response = reply.readAll();
|
||||
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
|
||||
auto wallet = DependencyManager::get<Wallet>();
|
||||
|
@ -141,32 +151,15 @@ void Ledger::historySuccess(QNetworkReply& reply) {
|
|||
// TODO: do this with 0 copies if possible
|
||||
for (auto it = historyArray.begin(); it != historyArray.end(); it++) {
|
||||
auto valueObject = (*it).toObject();
|
||||
QString from = nameFromKey(valueObject["sender_key"].toString(), keys);
|
||||
QString to = nameFromKey(valueObject["recipient_key"].toString(), keys);
|
||||
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>\"");
|
||||
}
|
||||
QString sent = amountString("sent", "EA4C5F", valueObject["sent_money"], valueObject["sent_certs"]);
|
||||
QString received = amountString("received", "1FC6A6", valueObject["received_money"], valueObject["received_certs"]);
|
||||
|
||||
// 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
|
||||
// be explicit
|
||||
QDateTime createdAt = QDateTime::fromSecsSinceEpoch(valueObject["created_at"].toInt(), Qt::UTC);
|
||||
QDateTime localCreatedAt = createdAt.toTimeZone(QTimeZone::systemTimeZone());
|
||||
valueObject["text"] = QString("%1 sent %2 %3 with message \"%4\"").
|
||||
arg(from, to, coloredQuantityAndAssetTitle, valueObject["message"].toString());
|
||||
valueObject["text"] = QString("%1%2%3").arg(valueObject["message"].toString(), sent, received);
|
||||
newHistoryArray.push_back(valueObject);
|
||||
}
|
||||
// now copy the rest of the json -- this is inefficient
|
||||
|
|
|
@ -204,7 +204,7 @@ bool ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID&
|
|||
|
||||
bool ContextOverlayInterface::contextOverlayFilterPassed(const EntityItemID& entityItemID) {
|
||||
EntityItemProperties entityProperties = _entityScriptingInterface->getEntityProperties(entityItemID, _entityPropertyFlags);
|
||||
Setting::Handle<bool> _settingSwitch{ "commerce", false };
|
||||
Setting::Handle<bool> _settingSwitch{ "commerce", true };
|
||||
if (_settingSwitch.get()) {
|
||||
return (entityProperties.getCertificateID().length() != 0);
|
||||
} else {
|
||||
|
@ -234,7 +234,7 @@ bool ContextOverlayInterface::destroyContextOverlay(const EntityItemID& entityIt
|
|||
void ContextOverlayInterface::contextOverlays_mousePressOnOverlay(const OverlayID& overlayID, const PointerEvent& event) {
|
||||
if (overlayID == _contextOverlayID && event.getButton() == PointerEvent::PrimaryButton) {
|
||||
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()) {
|
||||
openInspectionCertificate();
|
||||
} else {
|
||||
|
|
|
@ -198,6 +198,11 @@ void Avatar::setTargetScale(float targetScale) {
|
|||
}
|
||||
}
|
||||
|
||||
void Avatar::setAvatarEntityDataChanged(bool value) {
|
||||
AvatarData::setAvatarEntityDataChanged(value);
|
||||
_avatarEntityDataHashes.clear();
|
||||
}
|
||||
|
||||
void Avatar::updateAvatarEntities() {
|
||||
PerformanceTimer perfTimer("attachments");
|
||||
// - if queueEditEntityMessage sees clientOnly flag it does _myAvatar->updateAvatarEntity()
|
||||
|
|
|
@ -265,6 +265,8 @@ public:
|
|||
virtual float getModelScale() const { return _modelScale; }
|
||||
virtual void setModelScale(float scale) { _modelScale = scale; }
|
||||
|
||||
virtual void setAvatarEntityDataChanged(bool value) override;
|
||||
|
||||
public slots:
|
||||
|
||||
// FIXME - these should be migrated to use Pose data instead
|
||||
|
|
|
@ -603,7 +603,7 @@ public:
|
|||
|
||||
Q_INVOKABLE AvatarEntityMap getAvatarEntityData() const;
|
||||
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);
|
||||
AvatarEntityIDs getAndClearRecentlyDetachedIDs();
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ void FileScriptingInterface::runUnzip(QString path, QUrl url, bool autoAdd, bool
|
|||
QStringList fileList = unzipFile(path, tempDir);
|
||||
|
||||
if (!fileList.isEmpty()) {
|
||||
qCDebug(scriptengine) << "File to upload: " + fileList.first();
|
||||
qCDebug(scriptengine) << "First file to upload: " + fileList.first();
|
||||
} else {
|
||||
qCDebug(scriptengine) << "Unzip failed";
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
const QString tokenStringCommerce{ "Chrome/48.0 (HighFidelityInterface WithHFC)" };
|
||||
Setting::Handle<bool> _settingSwitch{ "commerce", false };
|
||||
Setting::Handle<bool> _settingSwitch{ "commerce", true };
|
||||
bool isMoney = _settingSwitch.get();
|
||||
|
||||
const QString tokenString = !isAuthable ? tokenStringMobile : (isMoney ? tokenStringCommerce : tokenStringMetaverse);
|
||||
|
|
|
@ -145,7 +145,7 @@
|
|||
var button;
|
||||
var buttonName = "WALLET";
|
||||
var tablet = null;
|
||||
var walletEnabled = Settings.getValue("commerce", false);
|
||||
var walletEnabled = Settings.getValue("commerce", true);
|
||||
function startup() {
|
||||
if (walletEnabled) {
|
||||
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
|
|
|
@ -160,7 +160,7 @@
|
|||
type: "marketplaces",
|
||||
action: "commerceSetting",
|
||||
data: {
|
||||
commerceMode: Settings.getValue("commerce", false),
|
||||
commerceMode: Settings.getValue("commerce", true),
|
||||
userIsLoggedIn: Account.loggedIn,
|
||||
walletNeedsSetup: Wallet.walletStatus === 1,
|
||||
metaverseServerURL: Account.metaverseServerURL
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
(function () {
|
||||
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_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";
|
||||
|
|
Loading…
Reference in a new issue