Correctly handle path tokens in download destinations

This commit is contained in:
Alexander Bock
2015-06-19 00:19:31 +02:00
parent cc76be6602
commit 77e668a1b6
3 changed files with 14 additions and 20 deletions

View File

@@ -60,22 +60,6 @@ InfoWidget::InfoWidget(QString name, int totalBytes)
setLayout(layout);
}
//void InfoWidget::update(int currentBytes) {
// _bytes->setText(
// QString("%1 / %2")
// .arg(currentBytes)
// .arg(_totalBytes)
// );
//
// float progress = static_cast<float>(currentBytes) / static_cast<float>(_totalBytes);
// _progress->setValue(static_cast<int>(progress * 100));
//}
//
//void InfoWidget::update(float progress) {
// _bytes->setText("");
// _progress->setValue(static_cast<int>(progress * 100));
//}
void InfoWidget::update(openspace::DownloadManager::FileFuture* f) {
_bytes->setText(
QString("%1 / %2")

View File

@@ -34,6 +34,7 @@
#include <ghoul/logging/log.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/logging/consolelog.h>
#include <ghoul/logging/htmllog.h>
#include <QApplication>
#include <QComboBox>
@@ -171,8 +172,9 @@ void MainWindow::initialize() {
_syncWidget->setWindowModality(Qt::WindowModal);
_syncWidget->hide();
ghoul::logging::LogManager::initialize(ghoul::logging::LogManager::LogLevel::Error);
ghoul::logging::LogManager::initialize(ghoul::logging::LogManager::LogLevel::Debug);
LogMgr.addLog(new ghoul::logging::ConsoleLog);
LogMgr.addLog(new ghoul::logging::HTMLLog("LauncherLog.html"));
LogMgr.addLog(new QLog);
std::string configurationFile = _configurationFile;

View File

@@ -68,8 +68,8 @@ namespace {
const std::string IdentifierKey = "Identifier";
const std::string VersionKey = "Version";
const bool OverwriteFiles = true;
const bool CleanInfoWidgets = false;
const bool OverwriteFiles = false;
const bool CleanInfoWidgets = true;
}
SyncWidget::SyncWidget(QWidget* parent, Qt::WindowFlags f)
@@ -202,8 +202,13 @@ void SyncWidget::handleFileRequest() {
for (const FileRequest& f : _fileRequests) {
LDEBUG(f.identifier.toStdString() << " (" << f.version << ") -> " << f.destination.toStdString());
ghoul::filesystem::Directory d = FileSys.currentDirectory();
std::string thisDirectory = absPath("${SCENE}/" + f.module.toStdString() + "/");
FileSys.setCurrentDirectory(thisDirectory);
std::string identifier = f.identifier.toStdString();
std::string path = absPath("${SCENE}/" + f.module.toStdString() + "/" + f.destination.toStdString());
std::string path = absPath(f.destination.toStdString());
int version = f.version;
DlManager.downloadRequestFilesAsync(
@@ -213,6 +218,8 @@ void SyncWidget::handleFileRequest() {
OverwriteFiles,
std::bind(&SyncWidget::handleFileFutureAddition, this, std::placeholders::_1)
);
FileSys.setCurrentDirectory(d);
}
}
@@ -282,6 +289,7 @@ void SyncWidget::syncButtonPressed() {
std::string module = modules.value<std::string>(std::to_string(i));
modulesList.append(QString::fromStdString(module));
}
modulesList.append("common");
QDir sceneDir(scene);
sceneDir.cdUp();