mirror of
https://github.com/overte-org/overte.git
synced 2025-06-02 03:41:08 +02:00
rename atp-get to atp-client. add ability to list atp file mappings and to upload new files
This commit is contained in:
parent
fad686571a
commit
e9a8c3f5e8
5 changed files with 179 additions and 63 deletions
|
@ -17,8 +17,8 @@ set_target_properties(ac-client PROPERTIES FOLDER "Tools")
|
||||||
add_subdirectory(skeleton-dump)
|
add_subdirectory(skeleton-dump)
|
||||||
set_target_properties(skeleton-dump PROPERTIES FOLDER "Tools")
|
set_target_properties(skeleton-dump PROPERTIES FOLDER "Tools")
|
||||||
|
|
||||||
add_subdirectory(atp-get)
|
add_subdirectory(atp-client)
|
||||||
set_target_properties(atp-get PROPERTIES FOLDER "Tools")
|
set_target_properties(atp-client PROPERTIES FOLDER "Tools")
|
||||||
|
|
||||||
add_subdirectory(oven)
|
add_subdirectory(oven)
|
||||||
set_target_properties(oven PROPERTIES FOLDER "Tools")
|
set_target_properties(oven PROPERTIES FOLDER "Tools")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
set(TARGET_NAME atp-get)
|
set(TARGET_NAME atp-client)
|
||||||
setup_hifi_project(Core Widgets)
|
setup_hifi_project(Core Widgets)
|
||||||
setup_memory_debugger()
|
setup_memory_debugger()
|
||||||
link_hifi_libraries(shared networking)
|
link_hifi_libraries(shared networking)
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// ATPGetApp.cpp
|
// ATPClientApp.cpp
|
||||||
// tools/atp-get/src
|
// tools/atp-client/src
|
||||||
//
|
//
|
||||||
// Created by Seth Alves on 2017-3-15
|
// Created by Seth Alves on 2017-3-15
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
|
@ -15,26 +15,36 @@
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
|
|
||||||
#include <NetworkLogging.h>
|
#include <NetworkLogging.h>
|
||||||
#include <SharedLogging.h>
|
#include <SharedLogging.h>
|
||||||
#include <AddressManager.h>
|
#include <AddressManager.h>
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
#include <SettingHandle.h>
|
#include <SettingHandle.h>
|
||||||
|
#include <AssetUpload.h>
|
||||||
|
|
||||||
#include "ATPGetApp.h"
|
#include "ATPClientApp.h"
|
||||||
|
|
||||||
ATPGetApp::ATPGetApp(int argc, char* argv[]) :
|
#define HIGH_FIDELITY_ATP_CLIENT_USER_AGENT "Mozilla/5.0 (HighFidelityATPClient)"
|
||||||
|
|
||||||
|
ATPClientApp::ATPClientApp(int argc, char* argv[]) :
|
||||||
QCoreApplication(argc, argv)
|
QCoreApplication(argc, argv)
|
||||||
{
|
{
|
||||||
// parse command-line
|
// parse command-line
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
parser.setApplicationDescription("High Fidelity ATP-Get");
|
parser.setApplicationDescription("High Fidelity ATP-Client");
|
||||||
|
|
||||||
const QCommandLineOption helpOption = parser.addHelpOption();
|
const QCommandLineOption helpOption = parser.addHelpOption();
|
||||||
|
|
||||||
const QCommandLineOption verboseOutput("v", "verbose output");
|
const QCommandLineOption verboseOutput("v", "verbose output");
|
||||||
parser.addOption(verboseOutput);
|
parser.addOption(verboseOutput);
|
||||||
|
|
||||||
|
const QCommandLineOption uploadOption("T", "upload local file", "local-file-to-send");
|
||||||
|
parser.addOption(uploadOption);
|
||||||
|
|
||||||
|
const QCommandLineOption outputFilenameOption("o", "output filename", "output-file-name");
|
||||||
|
parser.addOption(outputFilenameOption);
|
||||||
|
|
||||||
const QCommandLineOption domainAddressOption("d", "domain-server address", "127.0.0.1");
|
const QCommandLineOption domainAddressOption("d", "domain-server address", "127.0.0.1");
|
||||||
parser.addOption(domainAddressOption);
|
parser.addOption(domainAddressOption);
|
||||||
|
|
||||||
|
@ -70,67 +80,94 @@ ATPGetApp::ATPGetApp(int argc, char* argv[]) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QStringList filenames = parser.positionalArguments();
|
QStringList posArgs = parser.positionalArguments();
|
||||||
if (filenames.empty() || filenames.size() > 2) {
|
if (posArgs.size() != 1) {
|
||||||
qDebug() << "give remote url and optional local filename as arguments";
|
qDebug() << "give remote url argument";
|
||||||
parser.showHelp();
|
parser.showHelp();
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
_url = QUrl(filenames[0]);
|
_url = QUrl(posArgs[0]);
|
||||||
if (_url.scheme() != "atp") {
|
if (_url.scheme() != "atp") {
|
||||||
qDebug() << "url should start with atp:";
|
qDebug() << "url should start with atp:";
|
||||||
parser.showHelp();
|
parser.showHelp();
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filenames.size() == 2) {
|
int domainPort = 40103;
|
||||||
_localOutputFile = filenames[1];
|
if (_url.port() != -1) {
|
||||||
|
domainPort = _url.port();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString domainServerAddress = "127.0.0.1:40103";
|
if (parser.isSet(outputFilenameOption)) {
|
||||||
|
_localOutputFile = parser.value(outputFilenameOption);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parser.isSet(uploadOption)) {
|
||||||
|
_localUploadFile = parser.value(uploadOption);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (parser.isSet(listenPortOption)) {
|
||||||
|
_listenPort = parser.value(listenPortOption).toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString domainServerAddress = QString("127.0.0.1") + ":" + QString::number(domainPort);
|
||||||
if (parser.isSet(domainAddressOption)) {
|
if (parser.isSet(domainAddressOption)) {
|
||||||
domainServerAddress = parser.value(domainAddressOption);
|
domainServerAddress = parser.value(domainAddressOption);
|
||||||
|
qDebug() << "domainServerAddress is " << domainServerAddress;
|
||||||
|
connectToDomain(domainServerAddress);
|
||||||
|
} else if (!_url.host().isEmpty()) {
|
||||||
|
QUrl domainURL;
|
||||||
|
domainURL.setScheme("hifi");
|
||||||
|
domainURL.setHost(_url.host());
|
||||||
|
connectToDomain(domainURL.toString());
|
||||||
|
} else {
|
||||||
|
qDebug() << "domainServerAddress is default " << domainServerAddress;
|
||||||
|
connectToDomain(domainServerAddress);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ATPClientApp::connectToDomain(QString domainServerAddress) {
|
||||||
|
|
||||||
if (_verbose) {
|
if (_verbose) {
|
||||||
qDebug() << "domain-server address is" << domainServerAddress;
|
qDebug() << "domain-server address is" << domainServerAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
int listenPort = INVALID_PORT;
|
DependencyManager::set<AccountManager>();
|
||||||
if (parser.isSet(listenPortOption)) {
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
listenPort = parser.value(listenPortOption).toInt();
|
QString username = accountManager->getAccountInfo().getUsername();
|
||||||
}
|
qDebug() << "username is" << username;
|
||||||
|
|
||||||
Setting::init();
|
Setting::init();
|
||||||
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
||||||
|
|
||||||
DependencyManager::set<AccountManager>([&]{ return QString("Mozilla/5.0 (HighFidelityATPGet)"); });
|
DependencyManager::set<AccountManager>([&]{ return QString(HIGH_FIDELITY_ATP_CLIENT_USER_AGENT); });
|
||||||
DependencyManager::set<AddressManager>();
|
DependencyManager::set<AddressManager>();
|
||||||
DependencyManager::set<NodeList>(NodeType::Agent, listenPort);
|
DependencyManager::set<NodeList>(NodeType::Agent, _listenPort);
|
||||||
|
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
nodeList->startThread();
|
nodeList->startThread();
|
||||||
|
|
||||||
// setup a timer for domain-server check ins
|
// setup a timer for domain-server check ins
|
||||||
QTimer* domainCheckInTimer = new QTimer(nodeList.data());
|
_domainCheckInTimer = new QTimer(nodeList.data());
|
||||||
connect(domainCheckInTimer, &QTimer::timeout, nodeList.data(), &NodeList::sendDomainServerCheckIn);
|
connect(_domainCheckInTimer, &QTimer::timeout, nodeList.data(), &NodeList::sendDomainServerCheckIn);
|
||||||
domainCheckInTimer->start(DOMAIN_SERVER_CHECK_IN_MSECS);
|
_domainCheckInTimer->start(DOMAIN_SERVER_CHECK_IN_MSECS);
|
||||||
|
|
||||||
const DomainHandler& domainHandler = nodeList->getDomainHandler();
|
const DomainHandler& domainHandler = nodeList->getDomainHandler();
|
||||||
|
|
||||||
connect(&domainHandler, SIGNAL(hostnameChanged(const QString&)), SLOT(domainChanged(const QString&)));
|
connect(&domainHandler, SIGNAL(hostnameChanged(const QString&)), SLOT(domainChanged(const QString&)));
|
||||||
// connect(&domainHandler, SIGNAL(resetting()), SLOT(resettingDomain()));
|
// connect(&domainHandler, SIGNAL(resetting()), SLOT(resettingDomain()));
|
||||||
// connect(&domainHandler, SIGNAL(disconnectedFromDomain()), SLOT(clearDomainOctreeDetails()));
|
// connect(&domainHandler, SIGNAL(disconnectedFromDomain()), SLOT(clearDomainOctreeDetails()));
|
||||||
connect(&domainHandler, &DomainHandler::domainConnectionRefused, this, &ATPGetApp::domainConnectionRefused);
|
connect(&domainHandler, &DomainHandler::domainConnectionRefused, this, &ATPClientApp::domainConnectionRefused);
|
||||||
|
|
||||||
connect(nodeList.data(), &NodeList::nodeAdded, this, &ATPGetApp::nodeAdded);
|
connect(nodeList.data(), &NodeList::nodeAdded, this, &ATPClientApp::nodeAdded);
|
||||||
connect(nodeList.data(), &NodeList::nodeKilled, this, &ATPGetApp::nodeKilled);
|
connect(nodeList.data(), &NodeList::nodeKilled, this, &ATPClientApp::nodeKilled);
|
||||||
connect(nodeList.data(), &NodeList::nodeActivated, this, &ATPGetApp::nodeActivated);
|
connect(nodeList.data(), &NodeList::nodeActivated, this, &ATPClientApp::nodeActivated);
|
||||||
// connect(nodeList.data(), &NodeList::uuidChanged, getMyAvatar(), &MyAvatar::setSessionUUID);
|
// connect(nodeList.data(), &NodeList::uuidChanged, getMyAvatar(), &MyAvatar::setSessionUUID);
|
||||||
// connect(nodeList.data(), &NodeList::uuidChanged, this, &ATPGetApp::setSessionUUID);
|
// connect(nodeList.data(), &NodeList::uuidChanged, this, &ATPClientApp::setSessionUUID);
|
||||||
connect(nodeList.data(), &NodeList::packetVersionMismatch, this, &ATPGetApp::notifyPacketVersionMismatch);
|
connect(nodeList.data(), &NodeList::packetVersionMismatch, this, &ATPClientApp::notifyPacketVersionMismatch);
|
||||||
|
|
||||||
nodeList->addSetOfNodeTypesToNodeInterestSet(NodeSet() << NodeType::AudioMixer << NodeType::AvatarMixer
|
nodeList->addSetOfNodeTypesToNodeInterestSet(NodeSet() << NodeType::AudioMixer << NodeType::AvatarMixer
|
||||||
<< NodeType::EntityServer << NodeType::AssetServer << NodeType::MessagesMixer);
|
<< NodeType::EntityServer << NodeType::AssetServer << NodeType::MessagesMixer);
|
||||||
|
@ -140,63 +177,131 @@ ATPGetApp::ATPGetApp(int argc, char* argv[]) :
|
||||||
auto assetClient = DependencyManager::set<AssetClient>();
|
auto assetClient = DependencyManager::set<AssetClient>();
|
||||||
assetClient->init();
|
assetClient->init();
|
||||||
|
|
||||||
QTimer* doTimer = new QTimer(this);
|
QTimer* _timeoutTimer = new QTimer(this);
|
||||||
doTimer->setSingleShot(true);
|
_timeoutTimer->setSingleShot(true);
|
||||||
connect(doTimer, &QTimer::timeout, this, &ATPGetApp::timedOut);
|
connect(_timeoutTimer, &QTimer::timeout, this, &ATPClientApp::timedOut);
|
||||||
doTimer->start(4000);
|
_timeoutTimer->start(4000);
|
||||||
}
|
}
|
||||||
|
|
||||||
ATPGetApp::~ATPGetApp() {
|
ATPClientApp::~ATPClientApp() {
|
||||||
|
delete _domainCheckInTimer;
|
||||||
|
delete _timeoutTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ATPGetApp::domainConnectionRefused(const QString& reasonMessage, int reasonCodeInt, const QString& extraInfo) {
|
void ATPClientApp::domainConnectionRefused(const QString& reasonMessage, int reasonCodeInt, const QString& extraInfo) {
|
||||||
qDebug() << "domainConnectionRefused";
|
qDebug() << "domainConnectionRefused";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATPGetApp::domainChanged(const QString& domainHostname) {
|
void ATPClientApp::domainChanged(const QString& domainHostname) {
|
||||||
if (_verbose) {
|
if (_verbose) {
|
||||||
qDebug() << "domainChanged";
|
qDebug() << "domainChanged";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATPGetApp::nodeAdded(SharedNodePointer node) {
|
void ATPClientApp::nodeAdded(SharedNodePointer node) {
|
||||||
if (_verbose) {
|
if (_verbose) {
|
||||||
qDebug() << "node added: " << node->getType();
|
qDebug() << "node added: " << node->getType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATPGetApp::nodeActivated(SharedNodePointer node) {
|
void ATPClientApp::nodeActivated(SharedNodePointer node) {
|
||||||
if (node->getType() == NodeType::AssetServer) {
|
if (node->getType() == NodeType::AssetServer) {
|
||||||
lookup();
|
auto path = _url.path();
|
||||||
|
|
||||||
|
if (_verbose) {
|
||||||
|
qDebug() << "path is " << path;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << "_localUploadFile =" << _localUploadFile;
|
||||||
|
|
||||||
|
if (!_localUploadFile.isEmpty()) {
|
||||||
|
uploadAsset();
|
||||||
|
} else if (path == "/") {
|
||||||
|
listAssets();
|
||||||
|
} else {
|
||||||
|
lookupAsset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATPGetApp::nodeKilled(SharedNodePointer node) {
|
void ATPClientApp::nodeKilled(SharedNodePointer node) {
|
||||||
qDebug() << "nodeKilled";
|
qDebug() << "nodeKilled";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATPGetApp::timedOut() {
|
void ATPClientApp::timedOut() {
|
||||||
finish(1);
|
finish(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATPGetApp::notifyPacketVersionMismatch() {
|
void ATPClientApp::notifyPacketVersionMismatch() {
|
||||||
if (_verbose) {
|
if (_verbose) {
|
||||||
qDebug() << "packet version mismatch";
|
qDebug() << "packet version mismatch";
|
||||||
}
|
}
|
||||||
finish(1);
|
finish(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATPGetApp::lookup() {
|
void ATPClientApp::uploadAsset() {
|
||||||
|
|
||||||
auto path = _url.path();
|
auto path = _url.path();
|
||||||
qDebug() << "path is " << path;
|
if (path == "/") {
|
||||||
|
qDebug() << "cannot upload to path of /";
|
||||||
|
QCoreApplication::exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto upload = DependencyManager::get<AssetClient>()->createUpload(_localUploadFile);
|
||||||
|
QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable {
|
||||||
|
if (upload->getError() != AssetUpload::NoError) {
|
||||||
|
qDebug() << "upload failed: " << upload->getErrorString();
|
||||||
|
} else {
|
||||||
|
setMapping(hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
upload->deleteLater();
|
||||||
|
});
|
||||||
|
|
||||||
|
upload->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ATPClientApp::setMapping(QString hash) {
|
||||||
|
auto path = _url.path();
|
||||||
|
auto assetClient = DependencyManager::get<AssetClient>();
|
||||||
|
auto request = assetClient->createSetMappingRequest(path, hash);
|
||||||
|
|
||||||
|
connect(request, &SetMappingRequest::finished, this, [=](SetMappingRequest* request) mutable {
|
||||||
|
if (request->getError() != SetMappingRequest::NoError) {
|
||||||
|
qDebug() << "upload succeeded, but couldn't set mapping: " << request->getErrorString();
|
||||||
|
}
|
||||||
|
request->deleteLater();
|
||||||
|
});
|
||||||
|
|
||||||
|
request->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ATPClientApp::listAssets() {
|
||||||
|
auto request = DependencyManager::get<AssetClient>()->createGetAllMappingsRequest();
|
||||||
|
QObject::connect(request, &GetAllMappingsRequest::finished, this, [=](GetAllMappingsRequest* request) mutable {
|
||||||
|
auto result = request->getError();
|
||||||
|
if (result == GetAllMappingsRequest::NotFound) {
|
||||||
|
qDebug() << "not found: " << request->getErrorString();
|
||||||
|
} else if (result == GetAllMappingsRequest::NoError) {
|
||||||
|
auto mappings = request->getMappings();
|
||||||
|
for (auto& kv : mappings ) {
|
||||||
|
qDebug() << kv.first << kv.second;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qDebug() << "error -- " << request->getError() << " -- " << request->getErrorString();
|
||||||
|
}
|
||||||
|
request->deleteLater();
|
||||||
|
});
|
||||||
|
request->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ATPClientApp::lookupAsset() {
|
||||||
|
auto path = _url.path();
|
||||||
auto request = DependencyManager::get<AssetClient>()->createGetMappingRequest(path);
|
auto request = DependencyManager::get<AssetClient>()->createGetMappingRequest(path);
|
||||||
QObject::connect(request, &GetMappingRequest::finished, this, [=](GetMappingRequest* request) mutable {
|
QObject::connect(request, &GetMappingRequest::finished, this, [=](GetMappingRequest* request) mutable {
|
||||||
auto result = request->getError();
|
auto result = request->getError();
|
||||||
if (result == GetMappingRequest::NotFound) {
|
if (result == GetMappingRequest::NotFound) {
|
||||||
qDebug() << "not found";
|
qDebug() << "not found: " << request->getErrorString();
|
||||||
} else if (result == GetMappingRequest::NoError) {
|
} else if (result == GetMappingRequest::NoError) {
|
||||||
qDebug() << "found, hash is " << request->getHash();
|
qDebug() << "found, hash is " << request->getHash();
|
||||||
download(request->getHash());
|
download(request->getHash());
|
||||||
|
@ -208,7 +313,7 @@ void ATPGetApp::lookup() {
|
||||||
request->start();
|
request->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATPGetApp::download(AssetHash hash) {
|
void ATPClientApp::download(AssetHash hash) {
|
||||||
auto assetClient = DependencyManager::get<AssetClient>();
|
auto assetClient = DependencyManager::get<AssetClient>();
|
||||||
auto assetRequest = new AssetRequest(hash);
|
auto assetRequest = new AssetRequest(hash);
|
||||||
|
|
||||||
|
@ -217,7 +322,7 @@ void ATPGetApp::download(AssetHash hash) {
|
||||||
|
|
||||||
if (request->getError() == AssetRequest::Error::NoError) {
|
if (request->getError() == AssetRequest::Error::NoError) {
|
||||||
QString data = QString::fromUtf8(request->getData());
|
QString data = QString::fromUtf8(request->getData());
|
||||||
if (_localOutputFile == "") {
|
if (_localOutputFile == "" || _localOutputFile == "-") {
|
||||||
QTextStream cout(stdout);
|
QTextStream cout(stdout);
|
||||||
cout << data;
|
cout << data;
|
||||||
} else {
|
} else {
|
||||||
|
@ -238,7 +343,7 @@ void ATPGetApp::download(AssetHash hash) {
|
||||||
assetRequest->start();
|
assetRequest->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATPGetApp::finish(int exitCode) {
|
void ATPClientApp::finish(int exitCode) {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
|
||||||
// send the domain a disconnect packet, force stoppage of domain-server check-ins
|
// send the domain a disconnect packet, force stoppage of domain-server check-ins
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// ATPGetApp.h
|
// ATPClientApp.h
|
||||||
// tools/atp-get/src
|
// tools/atp-client/src
|
||||||
//
|
//
|
||||||
// Created by Seth Alves on 2017-3-15
|
// Created by Seth Alves on 2017-3-15
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
|
@ -10,8 +10,8 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#ifndef hifi_ATPGetApp_h
|
#ifndef hifi_ATPClientApp_h
|
||||||
#define hifi_ATPGetApp_h
|
#define hifi_ATPClientApp_h
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <udt/Constants.h>
|
#include <udt/Constants.h>
|
||||||
|
@ -23,11 +23,11 @@
|
||||||
#include <MappingRequest.h>
|
#include <MappingRequest.h>
|
||||||
|
|
||||||
|
|
||||||
class ATPGetApp : public QCoreApplication {
|
class ATPClientApp : public QCoreApplication {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ATPGetApp(int argc, char* argv[]);
|
ATPClientApp(int argc, char* argv[]);
|
||||||
~ATPGetApp();
|
~ATPClientApp();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void domainConnectionRefused(const QString& reasonMessage, int reasonCodeInt, const QString& extraInfo);
|
void domainConnectionRefused(const QString& reasonMessage, int reasonCodeInt, const QString& extraInfo);
|
||||||
|
@ -38,15 +38,26 @@ private slots:
|
||||||
void notifyPacketVersionMismatch();
|
void notifyPacketVersionMismatch();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void connectToDomain(QString domainServerAddress);
|
||||||
|
|
||||||
NodeList* _nodeList;
|
NodeList* _nodeList;
|
||||||
void timedOut();
|
void timedOut();
|
||||||
void lookup();
|
void uploadAsset();
|
||||||
|
void setMapping(QString hash);
|
||||||
|
void lookupAsset();
|
||||||
|
void listAssets();
|
||||||
void download(AssetHash hash);
|
void download(AssetHash hash);
|
||||||
void finish(int exitCode);
|
void finish(int exitCode);
|
||||||
bool _verbose;
|
bool _verbose;
|
||||||
|
|
||||||
QUrl _url;
|
QUrl _url;
|
||||||
QString _localOutputFile;
|
QString _localOutputFile;
|
||||||
|
QString _localUploadFile;
|
||||||
|
|
||||||
|
int _listenPort { INVALID_PORT };
|
||||||
|
|
||||||
|
QTimer* _domainCheckInTimer { nullptr };
|
||||||
|
QTimer* _timeoutTimer { nullptr };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_ATPGetApp_h
|
#endif // hifi_ATPClientApp_h
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// main.cpp
|
// main.cpp
|
||||||
// tools/atp-get/src
|
// tools/atp-client/src
|
||||||
//
|
//
|
||||||
// Created by Seth Alves on 2017-3-15
|
// Created by Seth Alves on 2017-3-15
|
||||||
// Copyright 2017 High Fidelity, Inc.
|
// Copyright 2017 High Fidelity, Inc.
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#include <BuildInfo.h>
|
#include <BuildInfo.h>
|
||||||
|
|
||||||
#include "ATPGetApp.h"
|
#include "ATPClientApp.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ int main(int argc, char * argv[]) {
|
||||||
QCoreApplication::setOrganizationDomain(BuildInfo::ORGANIZATION_DOMAIN);
|
QCoreApplication::setOrganizationDomain(BuildInfo::ORGANIZATION_DOMAIN);
|
||||||
QCoreApplication::setApplicationVersion(BuildInfo::VERSION);
|
QCoreApplication::setApplicationVersion(BuildInfo::VERSION);
|
||||||
|
|
||||||
ATPGetApp app(argc, argv);
|
ATPClientApp app(argc, argv);
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
Loading…
Reference in a new issue