Skip to content

Commit

Permalink
ver: bump to v0.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenvukhang committed Feb 2, 2023
2 parents 0226225 + 8fc1409 commit 50b15a8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,5 @@ Currently compiled for MacOS and Windows, but since it's written with
the Qt framework, it can be easily adapted to compile for Linux
distributions. PRs are welcome.

A tool for students to keep local folders in sync with remote folders
on Canvas.

[latest]: https://github.com/nguyenvukhang/canvas-sync/releases/latest
[settings]: https://canvas.nus.edu.sg/profile/settings
16 changes: 12 additions & 4 deletions mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ void MainWindow::pull_clicked()
ui->progressBar->setMaximum(0);
ui->progressBar->setValue(0);
std::vector<Update> tracked_folders = gather_tracked();
if (tracked_folders.empty()) {
QMessageBox::information(this, "Pull", "No folders selected to track.");
this->enable_pull();
return;
}
this->fetch_folder_files(tracked_folders, true);
}

Expand All @@ -74,6 +79,11 @@ void MainWindow::fetch_clicked()
this->disable_fetch();
this->updates.clear();
std::vector<Update> tracked_folders = gather_tracked();
if (tracked_folders.empty()) {
QMessageBox::information(this, "Fetch", "No folders selected to track.");
this->enable_fetch();
return;
}
this->fetch_folder_files(tracked_folders, false);
}

Expand Down Expand Up @@ -142,14 +152,12 @@ void MainWindow::folder_files_fetched(Update u, size_t total_expected_updates,
bool download)
{
QNetworkReply *r = (QNetworkReply *)this->sender();
if (has_network_err(r))
return;
std::vector<File> f = to_files(to_json(r));
remove_existing_files(&f, u.local_dir);

size_t n = f.size();
while (n-- > 0)
f[n].local_dir = u.local_dir;
for (size_t i = 0; i < n; i++)
f[i].local_dir = u.local_dir;

u.files = std::move(f);
// u.files now contains a list of files that the user does not have
Expand Down

0 comments on commit 50b15a8

Please sign in to comment.