code cleanup

This commit is contained in:
Liv 2017-07-25 11:24:57 -07:00
parent 32ddffd9c8
commit 89a1c7a697
3 changed files with 7 additions and 15 deletions

View file

@ -6041,10 +6041,11 @@ bool Application::askToReplaceDomainContent(const QString& url) {
if (DependencyManager::get<NodeList>()->getThisNodeCanReplaceContent()) {
// Create a confirmation dialog when this call is made
static const QString infoText = "Your domain's content will be replaced but backup files of your "
"domain's content will not immediately be changed.\n Save a manual backup of your"
"models.json.gz file, usually stored at:\n"
"C:/Users/[username]/AppData/Roaming/High Fidelity/assignment-client/entities/models.json.gz";
const int MAX_CHARACTERS_PER_LINE = 90;
static const QString infoText = simpleWordWrap("Your domain's content will be replaced but backup files of your "
"domain's content will not immediately be changed. Save a manual backup of your"
"models.json.gz file, usually stored at:", MAX_CHARACTERS_PER_LINE) +
"\nC:/Users/[username]/AppData/Roaming/High Fidelity/assignment-client/entities/models.json.gz";
bool agreeToReplaceContent = false; // assume false
agreeToReplaceContent = QMessageBox::Yes == OffscreenUi::question("Are you sure you want to replace this domain's content set?",
@ -6052,15 +6053,14 @@ bool Application::askToReplaceDomainContent(const QString& url) {
if (agreeToReplaceContent) {
// Given confirmation, send request to domain server to replace content
qCDebug(interfaceapp) << "Attempting to replace domain content: " << url;
QByteArray _url(url.toUtf8());
auto limitedNodeList = DependencyManager::get<LimitedNodeList>();
limitedNodeList->eachMatchingNode([](const SharedNodePointer& node) {
return node->getType() == NodeType::EntityServer && node->getActiveSocket();
}, [&_url, limitedNodeList](const SharedNodePointer& octreeNode) {
auto octreeFilePacketList = NLPacketList::create(PacketType::OctreeFileReplacementFromUrl, QByteArray(), true, true);
octreeFilePacketList->write(_url);
qCDebug(entities) << "Attempting to send an octree file url to replace domain content";
octreeFilePacketList->write(_url);
limitedNodeList->sendPacketList(std::move(octreeFilePacketList), *octreeNode);
return true;
});

View file

@ -9,7 +9,6 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "DomainManagementScriptingInterface.h"
#include "EntitiesLogging.h"
#include "Application.h"
#include "OffscreenUi.h"
@ -28,7 +27,3 @@ bool DomainManagementScriptingInterface::canReplaceDomainContent() {
auto nodeList = DependencyManager::get<NodeList>();
return nodeList->getThisNodeCanReplaceContent();
}
void DomainManagementScriptingInterface::replaceDomainContentSet(const QString& url){
}

View file

@ -32,9 +32,6 @@ public:
public slots:
Q_INVOKABLE bool canReplaceDomainContent();
protected:
void replaceDomainContentSet(const QString& fileURL);
signals:
void canReplaceDomainContentChanged(bool canReplaceDomainContent);
};