2022-09-07 19:14:32 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2022 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2022-09-07 19:02:50 -04:00
|
|
|
#ifndef __gtk2_ardour_library_download_dialog_h__
|
|
|
|
#define __gtk2_ardour_library_download_dialog_h__
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2022-09-08 20:19:13 -04:00
|
|
|
#include <gtkmm/cellrendererprogress.h>
|
2022-09-13 15:53:39 -04:00
|
|
|
#include <gtkmm/cellrenderertext.h>
|
2022-09-07 19:02:50 -04:00
|
|
|
#include <gtkmm/entry.h>
|
|
|
|
#include <gtkmm/liststore.h>
|
2022-10-05 12:46:50 -04:00
|
|
|
#include <gtkmm/scrolledwindow.h>
|
2022-09-07 19:02:50 -04:00
|
|
|
#include <gtkmm/treeview.h>
|
2022-09-13 23:22:39 -04:00
|
|
|
#include <gtkmm/textview.h>
|
2022-09-07 19:02:50 -04:00
|
|
|
|
|
|
|
#include "ardour_dialog.h"
|
|
|
|
|
2022-09-13 15:53:39 -04:00
|
|
|
namespace PBD {
|
|
|
|
class Inflater;
|
|
|
|
class Downloader;
|
|
|
|
}
|
|
|
|
|
2022-09-07 19:02:50 -04:00
|
|
|
namespace ARDOUR {
|
|
|
|
class LibraryDescription;
|
2022-09-13 15:53:39 -04:00
|
|
|
class LibraryFetcher;
|
2022-09-07 19:02:50 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
class LibraryDownloadDialog : public ArdourDialog
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
LibraryDownloadDialog ();
|
2022-09-13 15:53:39 -04:00
|
|
|
~LibraryDownloadDialog ();
|
2022-09-07 19:02:50 -04:00
|
|
|
|
|
|
|
void add_library (ARDOUR::LibraryDescription const &);
|
2022-10-04 13:18:55 -04:00
|
|
|
void on_show ();
|
2022-09-07 19:02:50 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
class LibraryColumns : public Gtk::TreeModelColumnRecord {
|
|
|
|
public:
|
|
|
|
LibraryColumns() {
|
|
|
|
add (name);
|
|
|
|
add (author);
|
|
|
|
add (license);
|
|
|
|
add (size);
|
|
|
|
add (installed);
|
|
|
|
add (description);
|
2022-09-08 09:46:56 -04:00
|
|
|
add (url);
|
2022-09-13 15:53:39 -04:00
|
|
|
add (toplevel);
|
2022-09-08 20:19:13 -04:00
|
|
|
add (install);
|
|
|
|
add (progress);
|
|
|
|
add (downloader);
|
2022-09-07 19:02:50 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Gtk::TreeModelColumn<std::string> name;
|
|
|
|
Gtk::TreeModelColumn<std::string> author;
|
|
|
|
Gtk::TreeModelColumn<std::string> license;
|
|
|
|
Gtk::TreeModelColumn<std::string> size;
|
2022-09-08 20:19:13 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> install;
|
2022-09-07 19:02:50 -04:00
|
|
|
Gtk::TreeModelColumn<bool> installed;
|
2022-09-08 20:19:13 -04:00
|
|
|
/* these are not displayed */
|
|
|
|
Gtk::TreeModelColumn<std::string> url;
|
2022-09-13 15:53:39 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> toplevel;
|
|
|
|
Gtk::TreeModelColumn<PBD::Downloader*> downloader;
|
2022-09-10 17:19:16 -04:00
|
|
|
Gtk::TreeModelColumn<int> progress;
|
2022-09-08 20:19:13 -04:00
|
|
|
/* used as tooltip */
|
|
|
|
Gtk::TreeModelColumn<std::string> description;
|
2022-09-07 19:02:50 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
Gtk::TreeView _display;
|
2022-10-05 12:46:50 -04:00
|
|
|
Gtk::ScrolledWindow scroller;
|
2022-09-07 19:02:50 -04:00
|
|
|
Glib::RefPtr<Gtk::ListStore> _model;
|
|
|
|
LibraryColumns _columns;
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
Gtk::TreeViewColumn* append_col (Gtk::TreeModelColumn<T> 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;
|
|
|
|
}
|
|
|
|
|
2022-09-08 20:19:13 -04:00
|
|
|
Gtk::CellRendererProgress* progress_renderer;
|
2022-09-13 15:53:39 -04:00
|
|
|
Gtk::CellRendererText* install_renderer;
|
2022-09-07 19:02:50 -04:00
|
|
|
|
2022-09-08 20:19:13 -04:00
|
|
|
void append_progress_column ();
|
2022-09-13 15:53:39 -04:00
|
|
|
void append_install_column ();
|
2022-09-07 19:02:50 -04:00
|
|
|
|
2022-09-08 20:19:13 -04:00
|
|
|
void download (Gtk::TreePath const &);
|
2022-09-07 19:02:50 -04:00
|
|
|
|
2022-09-13 15:53:39 -04:00
|
|
|
bool dl_timer_callback (PBD::Downloader*, Gtk::TreePath);
|
2022-09-08 20:19:13 -04:00
|
|
|
bool display_button_press (GdkEventButton* ev);
|
2022-09-13 15:53:39 -04:00
|
|
|
|
|
|
|
PBD::Inflater* inflater;
|
|
|
|
void install (std::string const & path, Gtk::TreePath const & treepath);
|
2023-05-18 18:19:04 -04:00
|
|
|
void install_progress (float, std::string, Gtk::TreePath);
|
2022-09-13 15:53:39 -04:00
|
|
|
void install_finished (Gtk::TreeModel::iterator row, std::string path, int status);
|
|
|
|
PBD::ScopedConnection install_connection;
|
2022-09-13 23:22:39 -04:00
|
|
|
|
|
|
|
Gtk::TextView description_view;
|
|
|
|
void library_selected ();
|
2022-10-04 13:18:55 -04:00
|
|
|
void refill ();
|
2022-09-07 19:02:50 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* __gtk2_ardour_library_download_dialog_h__ */
|