void InitVirtualDriveDialog::startDownload(const QString& repo_id) { default_repo_id_ = repo_id; LocalRepo repo; seafApplet->rpcClient()->getLocalRepo(repo_id, &repo); if (repo.isValid()) { // This repo is already here qDebug("The default library has already been downloaded"); createVirtualDisk(repo); default_repo_path_ = repo.worktree; finish(); return; } download_default_repo_req_ = new DownloadRepoRequest(account_, repo_id, false); connect(download_default_repo_req_, SIGNAL(success(const RepoDownloadInfo&)), this, SLOT(onDownloadRepoSuccess(const RepoDownloadInfo&))); connect(download_default_repo_req_, SIGNAL(failed(const ApiError&)), this, SLOT(onDownloadRepoFailure(const ApiError&))); download_default_repo_req_->send(); }
BOOL initFS(char* OsFileName, int SizeInBlocks) { // HANDLE hFile; fileSystemSizeInBlocks = SizeInBlocks; diskInBlocksSize = fileSystemSizeInBlocks * BLOCK_SIZE; createVirtualDisk(OsFileName, diskInBlocksSize); //openMapView(OsFileName, sizeInBlocks,hFile); CreateMyBitmap(); CreateFolder(); CreateOpenFiles(); return 0; }
void InitVirtualDriveDialog::checkDownloadProgress() { // First check for error std::vector<CloneTask> tasks; if (seafApplet->rpcClient()->getCloneTasks(&tasks) < 0) { return; } CloneTask task; for (size_t i = 0; i < tasks.size(); i++) { if (tasks[i].repo_id == default_repo_id_) { task = tasks[i]; break; } } if (!task.isValid()) { return; } if (task.state != "done" && task.state != "error") { return; } check_download_timer_->stop(); mRunInBackgroundBtn->setVisible(false); ensureVisible(); if (task.state == "error") { fail(tr("Error when downloading the default library: %1").arg(task.error_str)); return; } // Download is finished. Create the virutal disk in "My Computer". LocalRepo repo; seafApplet->rpcClient()->getLocalRepo(default_repo_id_, &repo); createVirtualDisk(repo); default_repo_path_ = repo.worktree; finish(); }