Update GUI, use new Archive progress API

This commit is contained in:
Robin Gareus 2023-05-19 00:19:04 +02:00
parent c9929698ee
commit 56176bb627
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 6 additions and 6 deletions

View File

@ -174,12 +174,12 @@ LibraryDownloadDialog::install (std::string const & path, Gtk::TreePath const &
std::string destdir = Glib::path_get_dirname (path); std::string destdir = Glib::path_get_dirname (path);
inflater = new Inflater (path, destdir); inflater = new Inflater (path, destdir);
//inflater->progress.connect (install_connection, invalidator(*this), boost::bind (&LibraryDownloadDialog::install_progress, this, _1, _2, path, treepath), gui_context()); inflater->Progress.connect (install_connection, invalidator(*this), boost::bind (&LibraryDownloadDialog::install_progress, this, _1, path, treepath), gui_context());
inflater->start (); /* starts unpacking in a thread */ inflater->start (); /* starts unpacking in a thread */
} }
void void
LibraryDownloadDialog::install_progress (size_t nread, size_t total, std::string path, Gtk::TreePath treepath) LibraryDownloadDialog::install_progress (float p, std::string path, Gtk::TreePath treepath)
{ {
Gtk::TreeModel::iterator row = _model->get_iter (treepath); Gtk::TreeModel::iterator row = _model->get_iter (treepath);
@ -192,7 +192,7 @@ LibraryDownloadDialog::install_progress (size_t nread, size_t total, std::string
return; return;
} }
(*row)[_columns.progress] = (int) round ((double) nread / total); (*row)[_columns.progress] = (int) round (100.0 * p);
} }
void void

View File

@ -112,7 +112,7 @@ class LibraryDownloadDialog : public ArdourDialog
PBD::Inflater* inflater; PBD::Inflater* inflater;
void install (std::string const & path, Gtk::TreePath const & treepath); void install (std::string const & path, Gtk::TreePath const & treepath);
void install_progress (size_t, size_t, std::string, Gtk::TreePath); void install_progress (float, std::string, Gtk::TreePath);
void install_finished (Gtk::TreeModel::iterator row, std::string path, int status); void install_finished (Gtk::TreeModel::iterator row, std::string path, int status);
PBD::ScopedConnection install_connection; PBD::ScopedConnection install_connection;

View File

@ -555,7 +555,7 @@ TemplateManager::export_all_templates ()
_current_action = _("Exporting templates"); _current_action = _("Exporting templates");
PBD::FileArchive ar (filename); PBD::FileArchive ar (filename, this);
PBD::ScopedConnectionList progress_connection; PBD::ScopedConnectionList progress_connection;
ar.create (filemap); ar.create (filemap);
@ -583,7 +583,7 @@ TemplateManager::import_template_set ()
_current_action = _("Importing templates"); _current_action = _("Importing templates");
FileArchive ar (dialog.get_filename ()); FileArchive ar (dialog.get_filename (), this);
PBD::ScopedConnectionList progress_connection; PBD::ScopedConnectionList progress_connection;
for (std::string fn = ar.next_file_name(); !fn.empty(); fn = ar.next_file_name()) { for (std::string fn = ar.next_file_name(); !fn.empty(); fn = ar.next_file_name()) {