/* * Copyright (C) 2022 Paul Davis * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __gtk2_ardour_library_download_dialog_h__ #define __gtk2_ardour_library_download_dialog_h__ #include #include #include #include #include #include #include #include #include "ardour_dialog.h" namespace PBD { class Inflater; class Downloader; } namespace ARDOUR { class LibraryDescription; class LibraryFetcher; } class LibraryDownloadDialog : public ArdourDialog { public: LibraryDownloadDialog (); ~LibraryDownloadDialog (); void add_library (ARDOUR::LibraryDescription const &); void on_show (); private: class LibraryColumns : public Gtk::TreeModelColumnRecord { public: LibraryColumns() { add (name); add (author); add (license); add (size); add (installed); add (description); add (url); add (toplevel); add (install); add (progress); add (downloader); } Gtk::TreeModelColumn name; Gtk::TreeModelColumn author; Gtk::TreeModelColumn license; Gtk::TreeModelColumn size; Gtk::TreeModelColumn install; Gtk::TreeModelColumn installed; /* these are not displayed */ Gtk::TreeModelColumn url; Gtk::TreeModelColumn toplevel; Gtk::TreeModelColumn downloader; Gtk::TreeModelColumn progress; /* used as tooltip */ Gtk::TreeModelColumn description; }; Gtk::TreeView _display; Gtk::ScrolledWindow scroller; Glib::RefPtr _model; LibraryColumns _columns; template Gtk::TreeViewColumn* append_col (Gtk::TreeModelColumn const& col, int width = 0) { Gtk::TreeViewColumn* c = manage (new Gtk::TreeViewColumn ("", col)); if (width) { c->set_fixed_width (width); c->set_sizing (Gtk::TREE_VIEW_COLUMN_FIXED); } _display.append_column (*c); return c; } Gtk::CellRendererProgress* progress_renderer; Gtk::CellRendererText* install_renderer; void append_progress_column (); void append_install_column (); void download (Gtk::TreePath const &); bool dl_timer_callback (PBD::Downloader*, Gtk::TreePath); bool display_button_press (GdkEventButton* ev); PBD::Inflater* inflater; void install (std::string const & path, Gtk::TreePath const & treepath); void install_progress (float, std::string, Gtk::TreePath); void install_finished (Gtk::TreeModel::iterator row, std::string path, int status); PBD::ScopedConnection install_connection; Gtk::TextView description_view; void library_selected (); void refill (); }; #endif /* __gtk2_ardour_library_download_dialog_h__ */